/***********************************************************************
* global variables
***********************************************************************/
/***********************************************************************
* global variables
***********************************************************************/
//***********************************************************************
// * CAN device initialization - device side (adapted from LinCAN setup.c)
// ***********************************************************************
//***********************************************************************
// * CAN device initialization - device side (adapted from LinCAN setup.c)
// ***********************************************************************
- //ul_usb1_register(candev->hwspecops); // only for successful compiling (defined in ul_usb1.c)
+ //ul_usb1_register(candev->hwspecops); //(defined in ul_usb1.c)
+ // register for another board:
+ can_lmc1_register(candev->hwspecops);
+
// Alocate and initialize the chip structures
for (chipnr=0; chipnr < candev->nr_all_chips; chipnr++) {
// if(chipnr<irqnum)
// Alocate and initialize the chip structures
for (chipnr=0; chipnr < candev->nr_all_chips; chipnr++) {
// if(chipnr<irqnum)
for (chipnr=0; chipnr < candev->nr_all_chips; chipnr++) {
struct canchip_t *chip=candev->chip[chipnr];
int objnr;
for (chipnr=0; chipnr < candev->nr_all_chips; chipnr++) {
struct canchip_t *chip=candev->chip[chipnr];
int objnr;
-// Interrupts from chip are served in main cycle
-// if(can_chip_setup_irq(chip)<0) {
-// CANMSG("Error to setup chip IRQ\n");
-// sys_err();
-// }
+ // used with lpc17xx:
+ if(can_chip_setup_irq(chip)<0) {
+ CANMSG("Error to setup chip IRQ\n");
+ sys_err();
+ }
+
// * CAN device initialization - client side (adapted from LinCAN open.c)
// ***********************************************************************
// * CAN device initialization - client side (adapted from LinCAN open.c)
// ***********************************************************************
// if (!(IO0PIN&P0_SJA1000_INT_PIN)) //INT PIN is inverted
// chip->chipspecops->irq_handler(0,chip);
if (usb_device.ep_events & MASK_EP1RX) { //EP1RX - data waiting to receive
// if (!(IO0PIN&P0_SJA1000_INT_PIN)) //INT PIN is inverted
// chip->chipspecops->irq_handler(0,chip);
if (usb_device.ep_events & MASK_EP1RX) { //EP1RX - data waiting to receive
- // DEBUG - unused queue system (yet)
- //if (canque_get_inslot(qends, &qedge, &slot, 0)>=0){ //Free slot obtained
+ if (canque_get_inslot(qends, &qedge, &slot, 0)>=0){ //Free slot obtained
/* Automatic selection of extended format if ID>2047 */
if (canmsg.id & ~0x7ffl & MSG_ID_MASK ) canmsg.flags |= MSG_EXT;
/* has been dependent on "extended" option */
/* Automatic selection of extended format if ID>2047 */
if (canmsg.id & ~0x7ffl & MSG_ID_MASK ) canmsg.flags |= MSG_EXT;
/* has been dependent on "extended" option */
-
- // DEBUG - unused queue system (yet)
- //else
- // canque_abort_inslot(qends,qedge,slot);
+ else
+ canque_abort_inslot(qends,qedge,slot);
+
timer_rx_off=50; //rosviceni diody pri prijmu
CLR_OUT_PIN(LED_PORT,LED2_BIT);
usb_device.ep_events &= ~MASK_EP1RX;
timer_rx_off=50; //rosviceni diody pri prijmu
CLR_OUT_PIN(LED_PORT,LED2_BIT);
usb_device.ep_events &= ~MASK_EP1RX;
if(usb_device.ep_events & MASK_EP1TX){ //EP1TX - data transmitted
if(canque_test_outslot(qends, &qedge, &slot)>=0){
DEBUGMSG("CAN message ready to send over usb\n");
if(usb_device.ep_events & MASK_EP1TX){ //EP1TX - data transmitted
if(canque_test_outslot(qends, &qedge, &slot)>=0){
DEBUGMSG("CAN message ready to send over usb\n");
timer_tx_off=50; //rozsviceni diod pri vysilani
CLR_OUT_PIN(LED_PORT,LED1_BIT);
usb_device.ep_events &= ~MASK_EP1TX;
timer_tx_off=50; //rozsviceni diod pri vysilani
CLR_OUT_PIN(LED_PORT,LED1_BIT);
usb_device.ep_events &= ~MASK_EP1TX;