Item driver_init(struct Driver * drv); – called in SVC context, do what you want with HW, and return dev→dev.n_Item or error.
void driver_abortio(struct IOReq * ior); – called in SVC context, let's you know that the SW finished this IORequest, and disposing them. For async devices – drop what you're doing and don't send signals back.
int32 driver_write(struct IOReq * ior); – called in SVC context, when DoIO is is called with ioinfo.ioi_Command == CMD_WRITE. Return value is passed as DoIO return value. ior→io_Info contains your ioinfo parameters. Typically ioi_Send has the buffer details. For async io use io_Callback when ready, but you have to track your IOReqs!!!
int32 driver_read(struct IOReq * ior); – called in SVC context, when DoIO is is called with ioinfo.ioi_Command == CMD_READ. Return value is passed as DoIO return value. ior→io_Info contains your ioinfo parameters. Typically ioi_Send has the buffer details. For async io use io_Callback when ready, but you have to track your IOReqs!!!
int32 driver_status(struct IOReq * ior); – called in SVC context, when DoIO is is called with ioinfo.ioi_Command == CMD_STATUS. Return value is passed as DoIO return value. ior→io_Info contains your ioinfo parameters. Typically the status is returned. No async statuses are supported. Use CMD_READ for anything async.
int32 dev_init(struct Device * dev); – called in SVC context, during the device creation call. It is intended for your named device init – software init : clear dev→dev_OpenCnt ; set dev→MaxUnitNum to something meaningful (0 - if you only have 1 unit). Think “/dev/tty0 , /dev/tty1…. /dev/ttyN , where N is dev→MaxUnitNum. You must return your item dev→dev.n_Item . Optionally you can do HW init here.
int32 dev_open(struct Device * dev); – called in SVC context, when OpenNamedDevice(“name”, unitNum) or FindAndOpenDevice is called. Do your house keeping, by incrementing dev→dev_OpenCnt . If it was the first open, take care of notifying your HW if needed. you must return your item dev→dev.n_Item or error. Unfortunately unitNum is not passed as of PF2.5 .. Eh???
void dev_close(struct Device * dev); – called in SVC context, when your named device item is closed. Do your house keeping, by decrementing dev→dev_OpenCnt . If it was the last close (i.e. count now is 0), take care of notifying your HW if needed.
driver_cmdtable - is an array of function pointers to your driver_write as [0], driver_read as [1], driver_status as [2]. You can add your own custom commands, taking care of indicating the size in CREATEDRIVER_TAG_MAXCMDS
All functions in SVC content must use non-swi style of Folio syscalls.. You cannot use SWI !!!!. See sample project's kernel_calls.s as example of how to access kernel syscalls.