X-Git-Url: https://rtime.felk.cvut.cz/gitweb/arc.git/blobdiff_plain/07bbcb79799c461e4dc58be060a0c3e01f466c97..60966c493db6916acb0f8d9beaa9c1e77c206ef2:/boards/ti_tms570ls/examples/tms570_hdk_can/config/Can_Cfg.h diff --git a/boards/ti_tms570ls/examples/tms570_hdk_can/config/Can_Cfg.h b/boards/ti_tms570ls/examples/tms570_hdk_can/config/Can_Cfg.h new file mode 100644 index 00000000..17c86f34 --- /dev/null +++ b/boards/ti_tms570ls/examples/tms570_hdk_can/config/Can_Cfg.h @@ -0,0 +1,156 @@ +/* +* Configuration of module: Can (Can_Cfg.h) +* +* Created by: ArcCore +* Copyright: +* +* Configured for (MCU): TMS570 +* +* Module vendor: ArcCore +* Generator version: 2.0.2 +* +* Generated by Arctic Studio (http://arccore.com) +*/ + + +#if !(((CAN_SW_MAJOR_VERSION == 1) && (CAN_SW_MINOR_VERSION == 0)) ) +#error Can: Configuration file expected BSW module version to be 1.0.* +#endif + +#ifndef CAN_CFG_H_ +#define CAN_CFG_H_ + +// Number of controller configs +#define CAN_ARC_CTRL_CONFIG_CNT 1 + +#define CAN_DEV_ERROR_DETECT STD_OFF +#define CAN_VERSION_INFO_API STD_OFF +#define CAN_MULTIPLEXED_TRANSMISSION STD_OFF // Not supported +#define CAN_WAKEUP_SUPPORT STD_OFF // Not supported +#define CAN_HW_TRANSMIT_CANCELLATION STD_OFF // Not supported + +typedef enum { + DCAN1 = 0, +// CAN_CTRL_1 = 0, + DCAN2 = 1, +// CAN_CTRL_2 = 1, + DCAN3 = 2, +// CAN_CTRL_3 = 2, + CAN_CONTROLLER_CNT = 3 +} CanControllerIdType; + +typedef enum { + CAN_ID_TYPE_EXTENDED, + CAN_ID_TYPE_MIXED, + CAN_ID_TYPE_STANDARD +} Can_IdTypeType; + +typedef enum { + CAN_OBJECT_TYPE_RECEIVE = 0x00000000, + CAN_OBJECT_TYPE_TRANSMIT = 0x20000000 +} Can_ObjectTypeType; + +typedef enum { + CAN_ARC_HANDLE_TYPE_BASIC, + CAN_ARC_HANDLE_TYPE_FULL +} Can_Arc_HohType; // the type (Full-CAN or Basic-CAN) of a hardware object + +typedef enum { + TxHwObject, + NUM_OF_HTHS +} Can_Arc_HTHType; // the type of the Hardware Transmit Handle + + +typedef enum { + RxHwObject, + NUM_OF_HRHS +} Can_Arc_HRHType; // the type of the Hardware Receive Handle + + +typedef struct { + // Specifies the InstanceId of this module instance. If only one instance is + // present it shall have the Id 0 + uint8 CanIndex; +} Can_GeneralType; + + +// mc9s12 unique?? +typedef enum { + CAN_ARC_IDAM_2_32BIT, + CAN_ARC_IDAM_4_16BIT, + CAN_ARC_IDAM_8_8BIT, + CAN_ARC_IDAM_FILTER_CLOSED, +} Can_Arc_IDAMType; // IDAM = identifier acceptance bits + +typedef uint32 Can_FilterMaskType; + +typedef enum { + CAN_ARC_PROCESS_TYPE_INTERRUPT = 0x00000400, + CAN_ARC_PROCESS_TYPE_POLLING = 0x00000000 +} Can_Arc_ProcessType; + +// TODO: ! +typedef struct { + void (*CancelTxConfirmation)( const Can_PduType * ); + void (*RxIndication)( uint8, Can_IdType, uint8, const uint8 * ); + void (*ControllerBusOff)(uint8); + void (*TxConfirmation)(PduIdType); + void (*ControllerWakeup)(uint8); + void (*Arc_Error)(uint8, Can_Arc_ErrorType); +} Can_CallbackType; + +typedef struct Can_HardwareObjectStruct { + Can_Arc_HohType CanHandleType; /* Specifies the type (Full-CAN or Basic-CAN) of a hardware object. */ + Can_IdTypeType CanIdType; /* Specifies whether the IdValue is of type - standard identifier - extended identifier- mixed mode. ImplementationType: Can_IdType */ + uint32 CanIdValue; /* Specifies (together with the filter mask) the identifiers range that passes the hardware filter. */ + uint16 CanObjectId; /* Holds the handle ID of HRH or HTH. The value of this parameter is unique in a given CAN Driver, and it should start with 0 and continue without any gaps. */ + Can_ObjectTypeType CanObjectType; /* Specifies if the HardwareObject is used as Transmit or as Receive object. */ + //CanControllerIdType CanControllerRef; /* Reference to CAN Controller to which the HOH is associated to. */ + Can_FilterMaskType *CanFilterMaskRef; /* Reference to the filter mask that is used for hardware filtering together with the CAN_ID_VALUE. */ + uint32 Can_Arc_MbMask; /* A "1" in this mask tells the driver that that HW Message Box should be occupied by this Hoh. A "1" in bit 31(ppc) occupies Mb 0 in HW. */ + boolean Can_Arc_EOL; +} Can_HardwareObjectType; + +typedef struct { + Can_Arc_ProcessType CanBusOffProcessing; /* Enables / disables API Can_MainFunction_BusOff() for handling busoff events in polling mode. */ + boolean CanControllerActivation; /* Defines if a CAN controller is used in the configuration. */ + //uint32 CanControllerBaseAddress; /* Specifies the CAN controller base address. */ + CanControllerIdType CanControllerId; /* Provides the controller ID which is unique in a given CAN Driver. */ + Can_Arc_ProcessType CanRxProcessing; /* Enables / disables API Can_MainFunction_Read() for handling PDU reception events in polling mode. */ + Can_Arc_ProcessType CanTxProcessing; /* Enables / disables API Can_MainFunction_Write() for handling PDU transmission events in polling mode. */ + Can_Arc_ProcessType CanWakeupProcessing; /* Enables / disables API Can_MainFunction_Wakeup() for handling wakeup events in polling mode. */ + uint32 CanCpuClockRef; /* Reference to the CPU clock configuration, which is set in the MCU driver configuration. */ + uint32 CanWakeupSourceRef; /* Reference to the Wakeup Source for this controller as defined in the ECU State Manager. Implementation Type: reference to EcuM_WakeupSourceType */ + + uint32 CanControllerBaudRate; /* Specifies the baudrate of the controller in kbps. */ + uint32 CanControllerPropSeg; /* Specifies propagation delay in time quantas. (uint8 ??) */ + uint32 CanControllerSeg1; /* Specifies phase segment 1 in time quantas. (uint8 ??) */ + uint32 CanControllerSeg2; /* Specifies phase segment 2 in time quantas. (uint8 ??) */ + uint32 CanControllerSyncJumpWidth; /* Specifies the synchronization jump width for the controller in time quantas. (uint8 ??) */ + uint32 CanControllerTimeQuanta; /* Specifies the time quanta for the controller. The calculation of the resulting prescaler value depending on module clocking and time quanta shall be done offline Hardware specific. */ + + // List of Hoh id's that belong to this controller + const Can_HardwareObjectType *Can_Arc_Hoh; + + boolean Can_Arc_Loopback; + boolean Can_Arc_Fifo; // set this to use the fifo +} Can_ControllerConfigType; + +typedef struct { + const Can_ControllerConfigType *CanController; /* contains the configuration parameters of the CAN controller(s) */ + + // Callbacks( Extension ) + const Can_CallbackType *CanCallbacks; +} Can_ConfigSetType; + +/* The type of external data structure containing the overall initialization data for the CAN driver and SFR settings affecting all controllers. */ +typedef struct { + const Can_ConfigSetType *CanConfigSet; /* the multiple configuration set container for CAN Driver */ + const Can_GeneralType *CanGeneral; /* contains the parameters related each CAN Driver Unit. */ +} Can_ConfigType; + +extern const Can_ConfigType CanConfigData; +extern const Can_ControllerConfigType CanControllerConfigData[]; +extern const Can_ConfigSetType Can_ConfigSet; + +#endif /*CAN_CFG_H_*/