[BACK]Return to devctl.h CVS log [TXT][DIR] Up to [local] / funnyos / sys

File: [local] / funnyos / sys / devctl.h (download)

Revision 1.1, Sun Dec 16 23:03:00 2007 UTC (16 years, 4 months ago) by nbrk
Branch: MAIN
CVS Tags: HEAD

introducing devctl, a mechanism to talk to device drivers from other drivers or userland.
interested drivers should implement callback function (xxx_devctl) and register it with devctl_register();
once registered, all other FunnyOS subsystems should be able to pass in/out some control commands
and data to/from device driver in subject.

for example, to toggle onboard LED on/off (see next commits) one will use: devctl("gpioled", 0, DCGPIOLED_TOGGLE, NULL);
DCGPIOLED is a 'ctlcmd' and NULL is a 'ctldata'. ctlcmd is a command recognized by that driver (gpioled);

this is similar to ioctl(2) in UNIX.

/*
 * $Id: devctl.h,v 1.1 2007/12/16 23:03:00 nbrk Exp $
 */
#ifndef _SYS_DEVCTL_H
#define _SYS_DEVCTL_H

#include <sys/types.h>

void 	devctl_register(struct device *self, int (*ctlfunc)(struct device *self, uint32_t ctlcmd, void *ctldata));
int 	devctl(const char *dv_name, uint8_t dv_minor, uint32_t ctlcmd, void *ctldata);

#endif /* !_SYS_DEVCTL_H */