26#ifndef CO_DRIVER_TARGET_H
27#define CO_DRIVER_TARGET_H
38#include "CO_driver_custom.h"
48#define CO_CONFIG_NMT CO_CONFIG_NMT_MASTER
52#ifndef CO_CONFIG_SDO_SRV
53#define CO_CONFIG_SDO_SRV (CO_CONFIG_SDO_SRV_SEGMENTED | \
54 CO_CONFIG_SDO_SRV_BLOCK)
56#ifndef CO_CONFIG_SDO_SRV_BUFFER_SIZE
57#define CO_CONFIG_SDO_SRV_BUFFER_SIZE 900
59#ifndef CO_CONFIG_CRC16
60#define CO_CONFIG_CRC16 (CO_CONFIG_CRC16_ENABLE)
76#define CO_LITTLE_ENDIAN
77#define CO_SWAP_16(x) x
78#define CO_SWAP_32(x) x
79#define CO_SWAP_64(x) x
83typedef unsigned char bool_t;
101#define CO_CANrxMsg_readIdent(msg) ((uint16_t)(((CO_CANrxMsg_t *)(msg))->ident))
102#define CO_CANrxMsg_readDLC(msg) ((uint8_t)(((CO_CANrxMsg_t *)(msg))->DLC))
103#define CO_CANrxMsg_readData(msg) ((uint8_t *)(((CO_CANrxMsg_t *)(msg))->data))
110 void (*CANrx_callback)(
void *object,
void *message);
118 volatile bool_t bufferFull;
125 CO_CANrxMsg_t CANmsgBuff[33];
132 volatile bool_t CANnormal;
133 volatile bool_t useCANrxFilters;
134 volatile bool_t bufferInhibitFlag;
135 volatile bool_t firstCANtxMessage;
138 unsigned int interruptStatus;
139 unsigned int interruptDisabler;
151 size_t eepromAddrSignature;
158#define CO_LOCK_CAN_SEND(CAN_MODULE) { \
159 if ((CAN_MODULE)->interruptDisabler == 0) { \
160 (CAN_MODULE)->interruptStatus = __builtin_disable_interrupts(); \
161 (CAN_MODULE)->interruptDisabler = 1; \
164#define CO_UNLOCK_CAN_SEND(CAN_MODULE) { \
165 if ((CAN_MODULE)->interruptDisabler == 1) { \
166 if(((CAN_MODULE)->interruptStatus & _CP0_STATUS_IE_MASK) != 0) { \
167 __builtin_enable_interrupts(); \
169 (CAN_MODULE)->interruptDisabler = 0; \
174#define CO_LOCK_EMCY(CAN_MODULE) { \
175 if ((CAN_MODULE)->interruptDisabler == 0) { \
176 (CAN_MODULE)->interruptStatus = __builtin_disable_interrupts(); \
177 (CAN_MODULE)->interruptDisabler = 2; \
180#define CO_UNLOCK_EMCY(CAN_MODULE) { \
181 if ((CAN_MODULE)->interruptDisabler == 2) { \
182 if(((CAN_MODULE)->interruptStatus & _CP0_STATUS_IE_MASK) != 0) { \
183 __builtin_enable_interrupts(); \
185 (CAN_MODULE)->interruptDisabler = 0; \
190#define CO_LOCK_OD(CAN_MODULE) { \
191 if ((CAN_MODULE)->interruptDisabler == 0) { \
192 (CAN_MODULE)->interruptStatus = __builtin_disable_interrupts(); \
193 (CAN_MODULE)->interruptDisabler = 3; \
196#define CO_UNLOCK_OD(CAN_MODULE) { \
197 if ((CAN_MODULE)->interruptDisabler == 3) { \
198 if(((CAN_MODULE)->interruptStatus & _CP0_STATUS_IE_MASK) != 0) { \
199 __builtin_enable_interrupts(); \
201 (CAN_MODULE)->interruptDisabler = 0; \
207#define CO_MemoryBarrier()
208#define CO_FLAG_READ(rxNew) ((rxNew) != NULL)
209#define CO_FLAG_SET(rxNew) {CO_MemoryBarrier(); rxNew = (void*)1L;}
210#define CO_FLAG_CLEAR(rxNew) {CO_MemoryBarrier(); rxNew = NULL;}
215typedef unsigned long CO_paddr_t;
216typedef unsigned long CO_vaddr_t;
217#define CO_KVA_TO_PA(v) ((CO_paddr_t)(v) & 0x1fffffff)
218#define CO_PA_TO_KVA0(pa) ((void *) ((pa) | 0x80000000))
219#define CO_PA_TO_KVA1(pa) ((void *) ((pa) | 0xa0000000))
unsigned long int uint32_t