You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

29 lines
837 B

/* read.c - read */
#include <xinu.h>
/*------------------------------------------------------------------------
* read - Read one or more bytes from a device
*------------------------------------------------------------------------
*/
syscall read(
did32 descrp, /* Descriptor for device */
char *buffer, /* Address of buffer */
uint32 count /* Length of buffer */
)
{
intmask mask; /* Saved interrupt mask */
// struct dentry *devptr; /* Entry in device switch table */
const __flash struct dentry *devptr; /* Entry in device switch table */
int32 retval; /* Value to return to caller */
mask = disable();
if (isbaddev(descrp)) {
restore(mask);
return SYSERR;
}
devptr = (struct dentry *) &devtab[descrp];
retval = (*devptr->dvread) (devptr, buffer, count);
restore(mask);
return retval;
}