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.
26 lines
614 B
26 lines
614 B
/* getdev.c - getdev */ |
|
|
|
#include <xinu.h> |
|
#include <string.h> |
|
|
|
/*------------------------------------------------------------------------ |
|
* getdev - Convert a device name to a device ID |
|
*------------------------------------------------------------------------ |
|
*/ |
|
did32 getdev( |
|
char *devname /* Name of the device */ |
|
) |
|
{ |
|
intmask mask; /* Saved interrupt mask */ |
|
did32 id; /* Value to return to caller */ |
|
|
|
mask = disable(); |
|
for (id = 0; id < NDEVS; id++) { |
|
if (strncmp(devname, devtab[id].dvname, DEVNAMLEN)) { |
|
restore(mask); |
|
return id; |
|
} |
|
} |
|
restore(mask); |
|
return (did32) SYSERR; |
|
}
|
|
|