mirror of https://github.com/zrafa/xinu-avr.git
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.
30 lines
936 B
30 lines
936 B
/* control.c - control */ |
|
|
|
#include <xinu.h> |
|
|
|
/*------------------------------------------------------------------------ |
|
* control - Control a device or a driver (e.g., set the driver mode) |
|
*------------------------------------------------------------------------ |
|
*/ |
|
syscall control( |
|
did32 descrp, /* Descriptor for device */ |
|
int32 func, /* Specific control function */ |
|
int32 arg1, /* Specific argument for func */ |
|
int32 arg2 /* Specific argument for func */ |
|
) |
|
{ |
|
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->dvcntl) (devptr, func, arg1, arg2); |
|
restore(mask); |
|
return retval; |
|
}
|
|
|