Desktop/xinu_mips-1.0.2.tar/xinu_mips-1.0.2/include/device.h File Reference

#include <kernel.h>

Include dependency graph for device.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dentry

Defines

#define SERIAL0   0
#define SERIAL1   1
#define CONSOLE   2
#define TTY0   2
#define TTY1   3
#define NUART   2
#define NTTY   2
#define NWIN   0
#define NFRAMBUF   0
#define NDEVS   ( NUART + NTTY + NFRAMBUF + NWIN )
#define isbaddev(f)   ( (ushort)(f)>=NDEVS )

Typedefs

typedef struct dentry device

Functions

devcall close (ushort)
devcall control (ushort, ushort, long, long)
devcall getc (ushort)
devcall open (ushort,...)
devcall putc (ushort, char)
devcall read (ushort, void *, long)
devcall write (ushort, void *, long)
devcall seek (ushort, long)

Variables

struct dentry devtab []


Detailed Description

isbaddev

Contains all definitions relating to the XINU device subsystem.

Id
device.h 226 2007-07-12 01:18:27Z mschul

Definition in file device.h.


Define Documentation

#define CONSOLE   2

type tty

Definition at line 45 of file device.h.

Referenced by main(), and nulluser().

#define isbaddev (  )     ( (ushort)(f)>=NDEVS )

Check that device id is between 0 and NDEVS. All calls to isbaddev will be ushort, so no need to check f < 0.

Parameters:
f id number to test

Definition at line 64 of file device.h.

Referenced by close(), control(), getc(), open(), putc(), read(), seek(), sysinit(), ttyOpen(), and write().

#define NDEVS   ( NUART + NTTY + NFRAMBUF + NWIN )

Definition at line 56 of file device.h.

Referenced by sysinit().

#define NFRAMBUF   0

number of frame buffers

Definition at line 53 of file device.h.

#define NTTY   2

number of TTY

Definition at line 51 of file device.h.

Referenced by ttyAlloc().

#define NUART   2

number of UART

Definition at line 50 of file device.h.

Referenced by uartIntr(), and xsh_uartstat().

#define NWIN   0

number of windowing devices

Definition at line 52 of file device.h.

#define SERIAL0   0

type uart

Definition at line 43 of file device.h.

Referenced by kprintf(), and nulluser().

#define SERIAL1   1

type uart

Definition at line 44 of file device.h.

Referenced by main().

#define TTY0   2

type tty

Definition at line 46 of file device.h.

#define TTY1   3

type tty

Definition at line 47 of file device.h.

Referenced by main().


Typedef Documentation

typedef struct dentry device


Function Documentation

devcall close ( ushort  descrp  ) 

close - close a device

Parameters:
descrp definition of device to close
Returns:
function to close device on success, SYSERR on failure

Definition at line 17 of file close.c.

References dentry::close, devtab, isbaddev, and SYSERR.

devcall control ( ushort  descrp,
ushort  func,
long  arg1,
long  arg2 
)

control - control a device (e.g., set the mode)

Parameters:
descrp definition of device to control
func specific control function for device
arg1 specific argument for func
arg2 specific argument for func
Returns:
function to control device on success, SYSERR on failure

Definition at line 20 of file control.c.

References dentry::control, devtab, isbaddev, and SYSERR.

Referenced by getch(), and shell().

devcall getc ( ushort  descrp  ) 

getc - get one character from a device

Parameters:
descrp definition of device from which to acquire character
Returns:
function to get character on success, SYSERR on failure

Definition at line 17 of file getc.c.

References devtab, dentry::getc, isbaddev, and SYSERR.

Referenced by fgets(), and getch().

devcall open ( ushort  descrp,
  ... 
)

open - open a connection to a device/file (params 2 & 3 are optional)

Parameters:
descrp definition of device to open
Returns:
function to open device on success, SYSERR on failure

Definition at line 18 of file open.c.

References devcall, devtab, isbaddev, dentry::open, SYSERR, va_end, and va_start.

Referenced by main(), and nulluser().

devcall putc ( ushort  descrp,
char  ch 
)

putc - write a single character to a device

Parameters:
descrp definition of device on which to write
ch character to write
Returns:
function to write character on success, SYSERR on failure

Definition at line 18 of file putc.c.

References devtab, isbaddev, dentry::putc, and SYSERR.

Referenced by fprintf(), and fputs().

devcall read ( ushort  descrp,
void *  buffer,
long  count 
)

read - read one or more bytes from a device

Parameters:
descrp definition of device from which to read
*buffer pointer into read-to location
count length of buffer
Returns:
function to read from device on success, SYSERR on failure

Definition at line 19 of file read.c.

References devtab, isbaddev, dentry::read, and SYSERR.

Referenced by shell().

devcall seek ( ushort  descrp,
long  pos 
)

seek - position a device (very common special case of control)

Parameters:
descrp definition of device on which to seek
pos requested position to seek
Returns:
function to seek on device on success, SYSERR on failure

Definition at line 18 of file seek.c.

References devtab, isbaddev, dentry::seek, and SYSERR.

devcall write ( ushort  descrp,
void *  buffer,
long  count 
)

write - write 1 or more bytes to a device

Parameters:
descrp definition of device on which to write
*buffer pointer to data to be written
count length of data to be written
Returns:
function to write data on success, SYSERR on failure

Definition at line 19 of file write.c.

References devtab, isbaddev, SYSERR, and dentry::write.


Variable Documentation

struct dentry devtab[]

Definition at line 18 of file devtable.c.

Referenced by close(), control(), getc(), kprintf(), open(), putc(), read(), seek(), sysinit(), ttyOpen(), and write().


Generated on Thu Oct 9 22:34:33 2008 for xinu by  doxygen 1.5.5