static struct file_operations ctr05_fops = {
NULL,
/* ctr05_seek */
ctr05_read, /* ctr05_read */
ctr05_write, /* ctr05_write */
NULL, /* ctr05_readdir */
NULL, /* ctr05_select */
ctr05_ioctl, /* ctr05_ioctl */
NULL,
ctr05_open,
NULL,
ctr05_close,
NULL /* fsync */
};
int init_module( void ) {
int err;
BYTE bReg;
/* Register as a device with kernel.
*/
err = register_chrdev( MajorNumber, 3ctr052, &ctr05_fops );
if ( check_region( CTR05_BASE, BOARD_SIZE ) != 0 )
{
unregister_chrdev(MajorNumber, 3ctr052) != 0);
return( -ENODEV );
} else
{
request_region( CTR05_BASE, BOARD_SIZE, 3ctr052 );
}
/* Register interrupt handler
*/
request_irq( CTR05_IRQ, ctr05_interrupt, SA_INTERRUPT, 3ctr052, NULL) );
/* Initialize the 9513 chip; Master Reset, Select
* Master Mode Register
*/
outb_p( MASTER_RESET, CMD_REG );
outb_p( MASTER_MODE_REG,
CMD_REG );
/* Write lower byte of MMR, followed by upper
*/
bReg = 0x70;
outb_p( bReg, DATA_REG );
bReg = 0x00;
outb_p(bReg, DATA_REG);
return 0;
}
|