From: Adrian M. <ad...@mc...> - 2001-11-21 21:01:20
|
Below is a code fragment from the sound driver i am working on - very basic as you can see. I intend ploughing on - adding to the attach bit to plug into the OSS drivers, but even this simple code misbehaves at the moment. I am sure it is something basic and silly, but I hope you will indulge me by telling me what... What happens now... insmod aica.o generates (correctly) - "Attaching AICA" and then "AICA sound driver has been initialised" lsmod shows it then in situ. But rmmod produces "Device busy" error message. Any ideas? Is it simply because this is not a properly registered driver yet - or is there a coding problem? Any and all help etc.... // Macros to make it easier #define AICA_REG(x) ((int *)(0xa0700000 + (x))) #define SET_AICA_REG(x) (*AICA_REG(x)) static int attach_aica(void) { printk("<1>Attaching AICA\n"); return 0; } static int __init init_aica (void) { MOD_INC_USE_COUNT; //increment count //disable the ARM7 SET_AICA_REG(0x2c00) |= 1; //empty sound memory memset((void*)0xa0800000, 0, 0x200000); /*Simply set low bit of AICA register 0x2c00 to zero this maps to 0xa0702c00 in the SH4 memory map*/ SET_AICA_REG(0x2c00) &= ~1; attach_aica(); printk("<1>AICA sound driver has been initialised\n"); return 0; } static void __exit exit_aica(void) { /*set low bit of register to 1*/ printk("<1>AICA sound driver being unloaded...\n"); SET_AICA_REG(0x2c00) |= 1; MOD_DEC_USE_COUNT; } module_init(init_aica); module_exit(exit_aica); |