Lines Matching refs:CANdriverState
103 void CO_CANsetConfigurationMode(void *CANdriverState){ in CO_CANsetConfigurationMode() argument
104 uint16_t C_CTRL1copy = CAN_REG(CANdriverState, C_CTRL1); in CO_CANsetConfigurationMode()
109 CAN_REG(CANdriverState, C_CTRL1) = C_CTRL1copy; in CO_CANsetConfigurationMode()
112 while((CAN_REG(CANdriverState, C_CTRL1) & 0x00E0) != 0x0080); in CO_CANsetConfigurationMode()
118 uint16_t C_CTRL1copy = CAN_REG(CANmodule->CANdriverState, C_CTRL1); in CO_CANsetNormalMode()
122 CAN_REG(CANmodule->CANdriverState, C_CTRL1) = C_CTRL1copy; in CO_CANsetNormalMode()
125 while((CAN_REG(CANmodule->CANdriverState, C_CTRL1) & 0x00E0) != 0x0000); in CO_CANsetNormalMode()
134 void *CANdriverState, in CO_CANmodule_init() argument
159 if(CANdriverState == ADDR_CAN1) { in CO_CANmodule_init()
170 else if(((uintptr_t) CANdriverState) == ADDR_CAN2) { in CO_CANmodule_init()
186 CANmodule->CANdriverState = CANdriverState; in CO_CANmodule_init()
210 CAN_REG(CANdriverState, C_CTRL1) = 0x0400; in CO_CANmodule_init()
211 CAN_REG(CANdriverState, C_CTRL2) = 0x0000; in CO_CANmodule_init()
228 CAN_REG(CANdriverState, C_CTRL1) |= 0x0800; in CO_CANmodule_init()
230 CAN_REG(CANdriverState, C_CFG1) = (CO_CANbitRateData[i].SJW - 1) << 6 | in CO_CANmodule_init()
233 CAN_REG(CANdriverState, C_CFG2) = ((uint16_t)(CO_CANbitRateData[i].phSeg2 - 1)) << 8 | in CO_CANmodule_init()
240 CAN_REG(CANdriverState, C_CTRL1) &= 0xFFFE; /* WIN = 0 - use buffer registers */ in CO_CANmodule_init()
241 CAN_REG(CANdriverState, C_RXFUL1) = 0x0000; in CO_CANmodule_init()
242 CAN_REG(CANdriverState, C_RXFUL2) = 0x0000; in CO_CANmodule_init()
243 CAN_REG(CANdriverState, C_RXOVF1) = 0x0000; in CO_CANmodule_init()
244 CAN_REG(CANdriverState, C_RXOVF2) = 0x0000; in CO_CANmodule_init()
245 CAN_REG(CANdriverState, C_TR01CON) = 0x0080; /* use one buffer for transmission */ in CO_CANmodule_init()
246 CAN_REG(CANdriverState, C_TR23CON) = 0x0000; in CO_CANmodule_init()
247 CAN_REG(CANdriverState, C_TR45CON) = 0x0000; in CO_CANmodule_init()
248 CAN_REG(CANdriverState, C_TR67CON) = 0x0000; in CO_CANmodule_init()
252 CAN_REG(CANdriverState, C_CTRL1) |= 0x0001; /* WIN = 1 - use filter registers */ in CO_CANmodule_init()
253 CAN_REG(CANdriverState, C_FEN1) = 0xFFFF; /* enable all 16 filters */ in CO_CANmodule_init()
254 CAN_REG(CANdriverState, C_FMSKSEL1) = 0x0000; /* all filters are using mask 0 */ in CO_CANmodule_init()
255 CAN_REG(CANdriverState, C_FMSKSEL2) = 0x0000; in CO_CANmodule_init()
256 CAN_REG(CANdriverState, C_BUFPNT1) = 0xFFFF; /* use FIFO for all filters */ in CO_CANmodule_init()
257 CAN_REG(CANdriverState, C_BUFPNT2) = 0xFFFF; in CO_CANmodule_init()
258 CAN_REG(CANdriverState, C_BUFPNT3) = 0xFFFF; in CO_CANmodule_init()
259 CAN_REG(CANdriverState, C_BUFPNT4) = 0xFFFF; in CO_CANmodule_init()
261 pRXF = &CAN_REG(CANdriverState, C_RXF0SID); in CO_CANmodule_init()
271 CAN_REG(CANdriverState, C_RXM0SID) = 0xFFE8; in CO_CANmodule_init()
272 CAN_REG(CANdriverState, C_RXM1SID) = 0xFFE8; in CO_CANmodule_init()
273 CAN_REG(CANdriverState, C_RXM2SID) = 0xFFE8; in CO_CANmodule_init()
279 CAN_REG(CANdriverState, C_RXM0SID) = 0x0008; in CO_CANmodule_init()
280 CAN_REG(CANdriverState, C_RXM1SID) = 0x0008; in CO_CANmodule_init()
281 CAN_REG(CANdriverState, C_RXM2SID) = 0x0008; in CO_CANmodule_init()
285 CAN_REG(CANdriverState, C_CTRL1) &= 0xFFFE; in CO_CANmodule_init()
292 CAN_REG(CANdriverState, C_FCTRL) = 0x8001; in CO_CANmodule_init()
296 CAN_REG(CANdriverState, C_FCTRL) = 0x6001; in CO_CANmodule_init()
300 CAN_REG(CANdriverState, C_FCTRL) = 0x4001; in CO_CANmodule_init()
304 CAN_REG(CANdriverState, C_FCTRL) = 0x2001; in CO_CANmodule_init()
308 CAN_REG(CANdriverState, C_FCTRL) = 0x0001; in CO_CANmodule_init()
317 DMA_REG(DMArxBaseAddress, DMA_PAD) = (volatile uint16_t) &CAN_REG(CANdriverState, C_RXD); in CO_CANmodule_init()
319 DMA_REG(DMArxBaseAddress, DMA_REQ) = (CANdriverState==ADDR_CAN1) ? 34 : 55; in CO_CANmodule_init()
332 DMA_REG(DMAtxBaseAddress, DMA_PAD) = (volatile uint16_t) &CAN_REG(CANdriverState, C_TXD); in CO_CANmodule_init()
334 DMA_REG(DMAtxBaseAddress, DMA_REQ) = (CANdriverState==ADDR_CAN1) ? 70 : 71; in CO_CANmodule_init()
348 CAN_REG(CANdriverState, C_INTF) = 0x0000; in CO_CANmodule_init()
350 CAN_REG(CANdriverState, C_INTE) = 0x0003; in CO_CANmodule_init()
359 CO_CANsetConfigurationMode(CANmodule->CANdriverState); in CO_CANmodule_disable()
385 uint16_t addr = CANmodule->CANdriverState; in CO_CANrxBufferInit()
511 static void CO_CANsendToModule(void *CANdriverState, __eds__ CO_CANrxMsg_t *dest, CO_CANtx_t *src){ in CO_CANsendToModule() argument
531 C_CTRL1old = CAN_REG(CANdriverState, C_CTRL1); in CO_CANsendToModule()
532 CAN_REG(CANdriverState, C_CTRL1) = C_CTRL1old & 0xFFFE; /* WIN = 0 - use buffer registers */ in CO_CANsendToModule()
533 CAN_REG(CANdriverState, C_TR01CON) |= 0x08; in CO_CANsendToModule()
534 CAN_REG(CANdriverState, C_CTRL1) = C_CTRL1old; in CO_CANsendToModule()
541 uint16_t addr = CANmodule->CANdriverState; in CO_CANsend()
584 volatile uint16_t C_CTRL1old = CAN_REG(CANmodule->CANdriverState, C_CTRL1); in CO_CANclearPendingSyncPDOs()
585 …CAN_REG(CANmodule->CANdriverState, C_CTRL1) = C_CTRL1old & 0xFFFE; /* WIN = 0 - use buffer reg… in CO_CANclearPendingSyncPDOs()
586 CAN_REG(CANmodule->CANdriverState, C_TR01CON) &= 0xFFF7; /* clear TXREQ */ in CO_CANclearPendingSyncPDOs()
587 CAN_REG(CANmodule->CANdriverState, C_CTRL1) = C_CTRL1old; in CO_CANclearPendingSyncPDOs()
620 err = CAN_REG(CANmodule->CANdriverState, C_INTF) >> 8; in CO_CANverifyErrors()
621 if(CAN_REG(CANmodule->CANdriverState, C_INTF) & 4){ in CO_CANverifyErrors()
631 CAN_REG(CANmodule->CANdriverState, C_INTF) &= 0xFFFB;/* clear bits */ in CO_CANverifyErrors()
677 if(CAN_REG(CANmodule->CANdriverState, C_INTF) & 0x02) { in CO_CANinterrupt()
684 C_CTRL1old = CAN_REG(CANmodule->CANdriverState, C_CTRL1); in CO_CANinterrupt()
685 …CAN_REG(CANmodule->CANdriverState, C_CTRL1) = C_CTRL1old & 0xFFFE; /* WIN = 0 - use buffer reg… in CO_CANinterrupt()
686 C_RXFUL1copy = CAN_REG(CANmodule->CANdriverState, C_RXFUL1); in CO_CANinterrupt()
687 CAN_REG(CANmodule->CANdriverState, C_CTRL1) = C_CTRL1old; in CO_CANinterrupt()
691 CAN_REG(CANmodule->CANdriverState, C_INTF) &= 0xFFFD; in CO_CANinterrupt()
692 C_FIFOcopy = CAN_REG(CANmodule->CANdriverState, C_FIFO); in CO_CANinterrupt()
761 C_CTRL1old = CAN_REG(CANmodule->CANdriverState, C_CTRL1); in CO_CANinterrupt()
762 …CAN_REG(CANmodule->CANdriverState, C_CTRL1) = C_CTRL1old & 0xFFFE; /* WIN = 0 - use buffer reg… in CO_CANinterrupt()
763 CAN_REG(CANmodule->CANdriverState, C_RXFUL1) &= ~(mask); in CO_CANinterrupt()
764 CAN_REG(CANmodule->CANdriverState, C_CTRL1) = C_CTRL1old; in CO_CANinterrupt()
769 FNRB = (CAN_REG(CANmodule->CANdriverState, C_FIFO) & 0x3F); in CO_CANinterrupt()
774 if(CAN_REG(CANmodule->CANdriverState, C_INTF) & 0x01) { in CO_CANinterrupt()
777 CAN_REG(CANmodule->CANdriverState, C_INTF) &= 0xFFFE; in CO_CANinterrupt()
797 CO_CANsendToModule(CANmodule->CANdriverState, CANmodule->CANmsgBuff, buffer); in CO_CANinterrupt()