X-Git-Url: http://rtime.felk.cvut.cz/gitweb/lincan.git/blobdiff_plain/9fd9dae9ad27311f99b9039782c1bd3998ccdf70..012f4747bffad9d61a1909969bc94b6802b1f068:/lincan/src/ipci165.c diff --git a/lincan/src/ipci165.c b/lincan/src/ipci165.c index 3dbbcb3..5ca7bc4 100644 --- a/lincan/src/ipci165.c +++ b/lincan/src/ipci165.c @@ -90,13 +90,13 @@ int bci_command(struct candevice_t *candev, char cmd, int size, char *data) } /* grant access to the command buffer */ - can_spin_lock(candev->device_lock); + can_spin_lock(&candev->device_lock); // check command buffer status if (readb(dpram_addr + OF_BCI_SYNC) != 0) { /* something went wrong ... */ - can_spin_unlock(candev->device_lock); + can_spin_unlock(&candev->device_lock); DEBUGMSG ("ipci165_bci_command: command buffer is busy\n"); return (-EBUSY); } @@ -143,7 +143,7 @@ int bci_response(struct candevice_t *candev, char cmd, int *size, char *data) { /* timeout occured */ /* release the lock */ - can_spin_unlock(candev->device_lock); + can_spin_unlock(&candev->device_lock); CANMSG ("BCI timeout!\n"); return -EBUSY; } @@ -158,7 +158,7 @@ int bci_response(struct candevice_t *candev, char cmd, int *size, char *data) /* release the buffer */ writeb(0, dpram_addr + OF_BCI_SYNC); /* unlock the access */ - can_spin_unlock(candev->device_lock); + can_spin_unlock(&candev->device_lock); DEBUGMSG ("ipci165_bci_command: invalid answer\n"); return -EIO; @@ -168,7 +168,7 @@ int bci_response(struct candevice_t *candev, char cmd, int *size, char *data) /* release the buffer */ writeb(0, dpram_addr + OF_BCI_SYNC); /* unlock the access */ - can_spin_unlock(candev->device_lock); + can_spin_unlock(&candev->device_lock); return 0; } @@ -967,6 +967,32 @@ void ipci165_do_tx_timeout(unsigned long data) DEBUGMSG ("ipci165_do_tx_timeout: finished\n"); } +/** + * ipci165_attach_to_chip: - attaches to the chip, setups registers and state + * @chip: pointer to chip state structure + * + * Return Value: negative value reports error. + * File: src/ipci165.c + */ +int ipci165_attach_to_chip(struct canchip_t *chip) +{ + return 0; +} + +/** + * ipci165_release_chip: - called before chip structure removal if %CHIP_ATTACHED is set + * @chip: pointer to chip state structure + * + * Return Value: negative value reports error. + * File: src/ipci165.c + */ +int ipci165_release_chip(struct canchip_t *chip) +{ + ipci165_stop_chip(chip); + /* disable interrupts in the hardware, etc. */ + return 0; +} + /* * * iPC-I 165/PCI Board Functionality * * */ /** @@ -1362,7 +1388,7 @@ int ipci165_init_hw_data(struct candevice_t *candev) candev->nr_all_chips=2; candev->flags |= CANDEV_PROGRAMMABLE_IRQ*0; /* initialize device spinlock */ - can_spin_lock_init(candev->device_lock); + can_spin_lock_init(&candev->device_lock); return 0; } @@ -1419,6 +1445,8 @@ int ipci165_init_chip_data(struct candevice_t *candev, int chipnr) chip->chip_data = chip_data; CANMSG("initializing ipci165 chip operations\n"); + chip->chipspecops->attach_to_chip=ipci165_attach_to_chip; + chip->chipspecops->release_chip=ipci165_release_chip; chip->chipspecops->chip_config=ipci165_chip_config; chip->chipspecops->baud_rate=ipci165_baud_rate; chip->chipspecops->set_btregs=ipci165_set_btregs;