- Patch the 'skeleton' example driver to be more consistant with the new
state of the world.
This commit is contained in:
parent
e3cdaf12b2
commit
84c3cb0136
@ -37,9 +37,12 @@
|
|||||||
#include <sys/exec.h>
|
#include <sys/exec.h>
|
||||||
#include <sys/lkm.h>
|
#include <sys/lkm.h>
|
||||||
|
|
||||||
|
#include <sys/select.h>
|
||||||
#include <pccard/card.h>
|
#include <pccard/card.h>
|
||||||
|
#include <pccard/driver.h>
|
||||||
#include <pccard/slot.h>
|
#include <pccard/slot.h>
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This defines the lkm_misc module use by modload
|
* This defines the lkm_misc module use by modload
|
||||||
* to define the module name.
|
* to define the module name.
|
||||||
@ -47,19 +50,19 @@
|
|||||||
MOD_MISC( "skel")
|
MOD_MISC( "skel")
|
||||||
|
|
||||||
|
|
||||||
static int skelintr(struct pccard_devinfo *); /* Interrupt handler */
|
static int skelinit(struct pccard_devinfo *); /* init device */
|
||||||
static void skelunload(struct pccard_devinfo *); /* Disable driver */
|
static void skelunload(struct pccard_devinfo *); /* Disable driver */
|
||||||
static void skelsuspend(struct pccard_devinfo *); /* Suspend driver */
|
static int skelintr(struct pccard_devinfo *); /* Interrupt handler */
|
||||||
static int skelinit(struct pccard_devinfo *, int); /* init device */
|
|
||||||
|
|
||||||
static struct pccard_drv skel_info =
|
static struct pccard_device skel_info = {
|
||||||
{
|
|
||||||
"skel",
|
"skel",
|
||||||
skelintr,
|
|
||||||
skelunload,
|
|
||||||
skelsuspend,
|
|
||||||
skelinit,
|
skelinit,
|
||||||
};
|
skelunload,
|
||||||
|
skelintr,
|
||||||
|
0, /* Attributes - presently unused */
|
||||||
|
&net_imask /* Interrupt mask for device */
|
||||||
|
};
|
||||||
|
|
||||||
static int opened; /* Rather minimal device state... */
|
static int opened; /* Rather minimal device state... */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -137,51 +140,36 @@ int ver;
|
|||||||
/*
|
/*
|
||||||
* Skeleton driver entry points for PCCARD configuration.
|
* Skeleton driver entry points for PCCARD configuration.
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
|
* Initialize the device.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
skelinit(struct pccard_devinfo *devi)
|
||||||
|
{
|
||||||
|
if ((1 << devi->unit) & opened)
|
||||||
|
return(EBUSY);
|
||||||
|
opened |= 1 << devi->unit;
|
||||||
|
printf("skel%d: init\n", devi->unit);
|
||||||
|
printf("iomem = 0x%x, iobase = 0x%x\n", devi->memory, devi->ioaddr);
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* The device entry is being removed. Shut it down,
|
* The device entry is being removed. Shut it down,
|
||||||
* and turn off interrupts etc. Not called unless
|
* and turn off interrupts etc. Not called unless
|
||||||
* the device was successfully installed.
|
* the device was successfully installed.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
skelunload(struct pccard_devinfo *dp)
|
skelunload(struct pccard_devinfo *devi)
|
||||||
{
|
{
|
||||||
printf("skel%d: unload\n", dp->unit);
|
printf("skel%d: unload\n", devi->unit);
|
||||||
opened &= ~(1 << dp->unit);
|
opened &= ~(1 << devi->unit);
|
||||||
}
|
|
||||||
/*
|
|
||||||
* Called when a power down is wanted. Shuts down the
|
|
||||||
* device and configures the device as unavailable (but
|
|
||||||
* still loaded...). A resume is done by calling
|
|
||||||
* skelinit with first=0.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
skelsuspend(struct pccard_devinfo *dp)
|
|
||||||
{
|
|
||||||
printf("skel%d: suspending\n", dp->unit);
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* Initialize the device.
|
|
||||||
* if first is set, then initially check for
|
|
||||||
* the device's existence before initialising it.
|
|
||||||
* Once initialised, the device table may be set up.
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
skelinit(struct pccard_devinfo *dp, int first)
|
|
||||||
{
|
|
||||||
if (first && ((1 << dp->unit)&opened))
|
|
||||||
return(EBUSY);
|
|
||||||
if (first)
|
|
||||||
opened |= 1 << dp->unit;
|
|
||||||
printf("skel%d: init, first = %d\n", dp->unit, first);
|
|
||||||
printf("iomem = 0x%x, iobase = 0x%x\n", dp->memory, dp->ioaddr);
|
|
||||||
return(0);
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Interrupt handler.
|
* Interrupt handler.
|
||||||
* Returns true if the interrupt is for us.
|
* Returns true if the interrupt is for us.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
skelintr(struct pccard_devinfo *dp)
|
skelintr(struct pccard_devinfo *devi)
|
||||||
{
|
{
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user