#include #include #ifndef NOTE1_H #define NOTE1_H /* Uncomment this for debug */ #define NOTE1_DEBUG /* Note/1 status bits * DO NOT MODIFY! */ #define NOTE1_DATA0 0x20 /* Data bit 0 */ #define NOTE1_DATA1 0x08 /* Data bit 1 */ #define NOTE1_RX 0x40 /* Data can be recieved */ #define NOTE1_TX 0x80 /* Data can be sent */ /* Macro definitions */ #define NOTE1_DEVNAME "snd_noteone" #define NOTE1_DESC "Music Quest Note/1" #define NOTE1_DEVS PARPORT_MAX #define NOTE1_IOC_MAGIC 'N' #define NOTE1_IOC_MAXNR 0 /* Note/1 parent ioctls */ #define NOTE1_IOCPROBE _IO( NOTE1_IOC_MAGIC, 0 ) /* Kernel definitions */ #ifdef __KERNEL__ #include #include #include #include struct note1_device { struct semaphore sem; struct pardevice* par; struct snd_rawmidi* rmidi; struct snd_card* card; int busy, claimed, opened; }; #define NOTE1_DELAY_BETWEEN_READS 10 #define NOTE1_DELAY_BETWEEN_WRITES 10 /* macro to compact the 2 bits we * are reading for the get() function */ #define note1_get_stat_data(stat) ( ((stat & 0x20) >> 4) | (( stat & 0x08) >>3) ) /* Checks if mode is set to busy */ #define note1_isbusy( dev ) ( (dev)->busy ) /* Checks if the port is claimed */ #define note1_isclaimed( dev ) ( (dev)->claimed ) /* Checks if the device is already oepned */ #define note1_isopened( dev ) ( (dev)->opened ) /* Checks if there is a port associated with this structure */ #define note1_isused( dev ) ( (dev)->par != NULL ) /* These increment/decrement the busy counter, this is to protect us from port * preemption */ #define note1_setbusy( dev ) ( ++((dev)->busy) ) #define note1_unsetbusy( dev ) ( --((dev)->busy) ) /* Sets/Unsets claim * One should never need to use these. * Use note1_claim() and note1_release() instead. */ #define note1_setclaim( dev ) ( ++((dev)->claimed) ) #define note1_unsetclaim( dev ) ( --((dev)->claimed) ) /* Sets/Unsets open * One should never to use these. */ #define note1_setopen( dev ) ( ++((dev)->opened) ) #define note1_unsetopen( dev ) ( --((dev)->opened) ) /* This gets the port SAFELY if any */ #define note1_getport( dev ) ( note1_isused( dev ) ? (dev)->par->port : NULL ) #endif #endif