Lines Matching refs:CANmodule

92 void CO_CANsetNormalMode(CO_CANmodule_t *CANmodule){  in CO_CANsetNormalMode()  argument
95 CAN_REG(CANmodule->CANdriverState, C_CON+CLR) = 0x07000000; in CO_CANsetNormalMode()
98 while((CAN_REG(CANmodule->CANdriverState, C_CON) & 0x00E00000) != 0x00000000); in CO_CANsetNormalMode()
100 CANmodule->CANnormal = true; in CO_CANsetNormalMode()
106 CO_CANmodule_t *CANmodule, in CO_CANmodule_init() argument
117 if(CANmodule==NULL || rxArray==NULL || txArray==NULL){ in CO_CANmodule_init()
122 CANmodule->CANdriverState = CANdriverState; in CO_CANmodule_init()
123 CANmodule->CANmsgBuffSize = 33; /* Must be the same as size of CANmodule->CANmsgBuff array. */ in CO_CANmodule_init()
124 CANmodule->rxArray = rxArray; in CO_CANmodule_init()
125 CANmodule->rxSize = rxSize; in CO_CANmodule_init()
126 CANmodule->txArray = txArray; in CO_CANmodule_init()
127 CANmodule->txSize = txSize; in CO_CANmodule_init()
128 CANmodule->CANnormal = false; in CO_CANmodule_init()
129 CANmodule->useCANrxFilters = (rxSize <= NO_CAN_RXF) ? true : false; in CO_CANmodule_init()
130 CANmodule->bufferInhibitFlag = false; in CO_CANmodule_init()
131 CANmodule->firstCANtxMessage = true; in CO_CANmodule_init()
132 CANmodule->CANtxCount = 0U; in CO_CANmodule_init()
133 CANmodule->errOld = 0U; in CO_CANmodule_init()
134 CANmodule->em = NULL; in CO_CANmodule_init()
146 uint32_t* f = (uint32_t*) CANmodule->CANmsgBuff; in CO_CANmodule_init()
147 for(i=0; i<(CANmodule->CANmsgBuffSize*4); i++){ in CO_CANmodule_init()
157 CAN_REG(CANdriverState, C_FIFOBA) = CO_KVA_TO_PA(CANmodule->CANmsgBuff);/* FIFO base address */ in CO_CANmodule_init()
187 if(CANmodule->useCANrxFilters){ in CO_CANmodule_init()
222 void CO_CANmodule_disable(CO_CANmodule_t *CANmodule){ in CO_CANmodule_disable() argument
223 CO_CANsetConfigurationMode(CANmodule->CANdriverState); in CO_CANmodule_disable()
235 CO_CANmodule_t *CANmodule, in CO_CANrxBufferInit() argument
245 if((CANmodule!=NULL) && (object!=NULL) && (pFunct!=NULL) && (index < CANmodule->rxSize)){ in CO_CANrxBufferInit()
247 CO_CANrx_t *buffer = &CANmodule->rxArray[index]; in CO_CANrxBufferInit()
261 if(CANmodule->useCANrxFilters){ in CO_CANrxBufferInit()
267 uint16_t addr = CANmodule->CANdriverState; in CO_CANrxBufferInit()
329 CO_CANmodule_t *CANmodule, in CO_CANtxBufferInit() argument
338 if((CANmodule != NULL) && (index < CANmodule->txSize)){ in CO_CANtxBufferInit()
340 buffer = &CANmodule->txArray[index]; in CO_CANtxBufferInit()
355 CO_ReturnError_t CO_CANsend(CO_CANmodule_t *CANmodule, CO_CANtx_t *buffer){ in CO_CANsend() argument
357 uint16_t addr = CANmodule->CANdriverState; in CO_CANsend()
366 if(!CANmodule->firstCANtxMessage){ in CO_CANsend()
368 …CO_errorReport((CO_EM_t*)CANmodule->em, CO_EM_CAN_TX_OVERFLOW, CO_EMC_CAN_OVERRUN, buffer->CMSGSID… in CO_CANsend()
376 if((TX_FIFOconCopy & 0x8) == 0 && CANmodule->CANtxCount == 0){ in CO_CANsend()
377 CANmodule->bufferInhibitFlag = buffer->syncFlag; in CO_CANsend()
390 CANmodule->CANtxCount++; in CO_CANsend()
401 void CO_CANclearPendingSyncPDOs(CO_CANmodule_t *CANmodule){ in CO_CANclearPendingSyncPDOs() argument
403 volatile uint32_t* TX_FIFOcon = &CAN_REG(CANmodule->CANdriverState, C_FIFOCON+0x40); in CO_CANclearPendingSyncPDOs()
404 volatile uint32_t* TX_FIFOconClr = &CAN_REG(CANmodule->CANdriverState, C_FIFOCON+0x44); in CO_CANclearPendingSyncPDOs()
409 if((*TX_FIFOcon & 0x8) && CANmodule->bufferInhibitFlag){ in CO_CANclearPendingSyncPDOs()
411 CANmodule->bufferInhibitFlag = false; in CO_CANclearPendingSyncPDOs()
415 if(CANmodule->CANtxCount != 0U){ in CO_CANclearPendingSyncPDOs()
417 CO_CANtx_t *buffer = &CANmodule->txArray[0]; in CO_CANclearPendingSyncPDOs()
418 for(i = CANmodule->txSize; i > 0U; i--){ in CO_CANclearPendingSyncPDOs()
422 CANmodule->CANtxCount--; in CO_CANclearPendingSyncPDOs()
433 …CO_errorReport((CO_EM_t*)CANmodule->em, CO_EM_TPDO_OUTSIDE_WINDOW, CO_EMC_COMMUNICATION, tpdoDelet… in CO_CANclearPendingSyncPDOs()
439 void CO_CANverifyErrors(CO_CANmodule_t *CANmodule){ in CO_CANverifyErrors() argument
442 CO_EM_t* em = (CO_EM_t*)CANmodule->em; in CO_CANverifyErrors()
445 TREC = CAN_REG(CANmodule->CANdriverState, C_TREC); in CO_CANverifyErrors()
449 overflow = (CAN_REG(CANmodule->CANdriverState, C_FIFOINT)&0x8) ? 1 : 0; in CO_CANverifyErrors()
453 if(CANmodule->errOld != err){ in CO_CANverifyErrors()
454 CANmodule->errOld = err; in CO_CANverifyErrors()
474 if(!CANmodule->firstCANtxMessage){ in CO_CANverifyErrors()
499 void CO_CANinterrupt(CO_CANmodule_t *CANmodule){ in CO_CANinterrupt() argument
501 ICODE = (uint8_t) CAN_REG(CANmodule->CANdriverState, C_VEC) & 0x7F; in CO_CANinterrupt()
511 rcvMsg = (CO_CANrxMsg_t*) CO_PA_TO_KVA1(CAN_REG(CANmodule->CANdriverState, C_FIFOUA)); in CO_CANinterrupt()
514 if(CANmodule->useCANrxFilters){ in CO_CANinterrupt()
518 if(index < CANmodule->rxSize){ in CO_CANinterrupt()
519 buffer = &CANmodule->rxArray[index]; in CO_CANinterrupt()
529 buffer = &CANmodule->rxArray[0]; in CO_CANinterrupt()
530 for(index = CANmodule->rxSize; index > 0U; index--){ in CO_CANinterrupt()
545 CAN_REG(CANmodule->CANdriverState, C_FIFOCON+0x08) = 0x2000; /* set UINC */ in CO_CANinterrupt()
552 CANmodule->firstCANtxMessage = false; in CO_CANinterrupt()
554 CANmodule->bufferInhibitFlag = false; in CO_CANinterrupt()
556 if(CANmodule->CANtxCount > 0U){ in CO_CANinterrupt()
560 CO_CANtx_t *buffer = &CANmodule->txArray[0]; in CO_CANinterrupt()
562 for(i = CANmodule->txSize; i > 0U; i--){ in CO_CANinterrupt()
566 CANmodule->CANtxCount--; in CO_CANinterrupt()
569 CANmodule->bufferInhibitFlag = buffer->syncFlag; in CO_CANinterrupt()
570 … uint32_t* TXmsgBuffer = CO_PA_TO_KVA1(CAN_REG(CANmodule->CANdriverState, C_FIFOUA+0x40)); in CO_CANinterrupt()
572 … volatile uint32_t* TX_FIFOconSet = &CAN_REG(CANmodule->CANdriverState, C_FIFOCON+0x48); in CO_CANinterrupt()
586 CANmodule->CANtxCount = 0U; in CO_CANinterrupt()
591 if(CANmodule->CANtxCount == 0U){ in CO_CANinterrupt()
592 CAN_REG(CANmodule->CANdriverState, C_FIFOINT+0x44) = 0x01000000; in CO_CANinterrupt()