]> rtime.felk.cvut.cz Git - arc.git/blobdiff - boards/ti_tms570ls/examples/tms570_hdk_can/config/Can_Cfg.h
Added an example of CAN communication for the TMS570LS31x HDK
[arc.git] / 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 (file)
index 0000000..17c86f3
--- /dev/null
@@ -0,0 +1,156 @@
+/*\r
+* Configuration of module: Can (Can_Cfg.h)\r
+*\r
+* Created by:              ArcCore\r
+* Copyright:               \r
+*\r
+* Configured for (MCU):    TMS570\r
+*\r
+* Module vendor:           ArcCore\r
+* Generator version:       2.0.2\r
+*\r
+* Generated by Arctic Studio (http://arccore.com) \r
+*/\r
+\r
+
+#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_\r
+#define CAN_CFG_H_\r
+\r
+// Number of controller configs\r
+#define CAN_ARC_CTRL_CONFIG_CNT                1\r
+\r
+#define CAN_DEV_ERROR_DETECT                   STD_OFF\r
+#define CAN_VERSION_INFO_API                   STD_OFF\r
+#define CAN_MULTIPLEXED_TRANSMISSION   STD_OFF  // Not supported\r
+#define CAN_WAKEUP_SUPPORT                             STD_OFF  // Not supported\r
+#define CAN_HW_TRANSMIT_CANCELLATION   STD_OFF  // Not supported\r
+\r
+typedef enum {\r
+       DCAN1 = 0,\r
+//     CAN_CTRL_1 = 0,\r
+       DCAN2 = 1,\r
+//     CAN_CTRL_2 = 1,\r
+       DCAN3 = 2,\r
+//     CAN_CTRL_3 = 2,\r
+       CAN_CONTROLLER_CNT = 3\r
+} CanControllerIdType;\r
+\r
+typedef enum {\r
+       CAN_ID_TYPE_EXTENDED,\r
+       CAN_ID_TYPE_MIXED,\r
+       CAN_ID_TYPE_STANDARD\r
+} Can_IdTypeType;\r
+\r
+typedef enum {\r
+       CAN_OBJECT_TYPE_RECEIVE  = 0x00000000,\r
+       CAN_OBJECT_TYPE_TRANSMIT = 0x20000000\r
+} Can_ObjectTypeType;\r
+\r
+typedef enum {\r
+       CAN_ARC_HANDLE_TYPE_BASIC,\r
+       CAN_ARC_HANDLE_TYPE_FULL\r
+} Can_Arc_HohType;             // the type (Full-CAN or Basic-CAN) of a hardware object\r
+\r
+typedef enum {\r
+       TxHwObject,\r
+       NUM_OF_HTHS\r
+} Can_Arc_HTHType;             // the type of the Hardware Transmit Handle\r
+\r
+\r
+typedef enum {\r
+       RxHwObject,\r
+       NUM_OF_HRHS\r
+} Can_Arc_HRHType;             // the type of the Hardware Receive Handle\r
+\r
+\r
+typedef struct {\r
+       //      Specifies the InstanceId of this module instance. If only one instance is\r
+       //      present it shall have the Id 0\r
+       uint8 CanIndex;\r
+} Can_GeneralType;\r
+\r
+\r
+// mc9s12 unique??\r
+typedef enum {\r
+  CAN_ARC_IDAM_2_32BIT,\r
+  CAN_ARC_IDAM_4_16BIT,\r
+  CAN_ARC_IDAM_8_8BIT,\r
+  CAN_ARC_IDAM_FILTER_CLOSED,\r
+} Can_Arc_IDAMType;            // IDAM = identifier acceptance bits\r
+\r
+typedef uint32 Can_FilterMaskType;\r
+\r
+typedef enum {\r
+       CAN_ARC_PROCESS_TYPE_INTERRUPT = 0x00000400,\r
+       CAN_ARC_PROCESS_TYPE_POLLING   = 0x00000000\r
+} Can_Arc_ProcessType;\r
+\r
+// TODO: !\r
+typedef struct {\r
+       void (*CancelTxConfirmation)( const Can_PduType * );\r
+       void (*RxIndication)( uint8, Can_IdType, uint8,  const uint8 * );\r
+       void (*ControllerBusOff)(uint8);\r
+       void (*TxConfirmation)(PduIdType);\r
+       void (*ControllerWakeup)(uint8);\r
+       void (*Arc_Error)(uint8, Can_Arc_ErrorType);\r
+} Can_CallbackType;\r
+\r
+typedef struct Can_HardwareObjectStruct {\r
+       Can_Arc_HohType CanHandleType;          /* Specifies the type (Full-CAN or Basic-CAN) of a hardware object. */\r
+       Can_IdTypeType CanIdType;                       /* Specifies whether the IdValue is of type - standard identifier - extended identifier- mixed mode. ImplementationType: Can_IdType */\r
+       uint32 CanIdValue;                                      /* Specifies (together with the filter mask) the identifiers range that passes the hardware filter. */\r
+       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. */\r
+       Can_ObjectTypeType CanObjectType;       /* Specifies if the HardwareObject is used as Transmit or as Receive object. */\r
+       //CanControllerIdType   CanControllerRef; /* Reference to CAN Controller to which the HOH is associated to. */\r
+       Can_FilterMaskType *CanFilterMaskRef; /* Reference to the filter mask that is used for hardware filtering together with the CAN_ID_VALUE. */\r
+       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. */\r
+       boolean Can_Arc_EOL;\r
+} Can_HardwareObjectType;\r
+\r
+typedef struct {\r
+       Can_Arc_ProcessType CanBusOffProcessing;        /* Enables / disables API Can_MainFunction_BusOff() for handling busoff events in polling mode. */\r
+       boolean CanControllerActivation;                        /* Defines if a CAN controller is used in the configuration. */\r
+       //uint32 CanControllerBaseAddress;                      /* Specifies the CAN controller base address. */\r
+       CanControllerIdType CanControllerId;            /* Provides the controller ID which is unique in a given CAN Driver. */\r
+       Can_Arc_ProcessType CanRxProcessing;            /* Enables / disables API Can_MainFunction_Read() for handling PDU reception events in polling mode. */\r
+       Can_Arc_ProcessType CanTxProcessing;            /* Enables / disables API Can_MainFunction_Write() for handling PDU transmission events in polling mode. */\r
+       Can_Arc_ProcessType CanWakeupProcessing;        /* Enables / disables API Can_MainFunction_Wakeup() for handling wakeup events in polling mode. */\r
+       uint32 CanCpuClockRef;                                          /* Reference to the CPU clock configuration, which is set in the MCU driver configuration. */\r
+       uint32 CanWakeupSourceRef;                                      /* Reference to the Wakeup Source for this controller as defined in the ECU State Manager. Implementation Type: reference to EcuM_WakeupSourceType */\r
+\r
+       uint32 CanControllerBaudRate;                           /* Specifies the baudrate of the controller in kbps. */\r
+       uint32 CanControllerPropSeg;                            /* Specifies propagation delay in time quantas. (uint8 ??) */\r
+       uint32 CanControllerSeg1;                                       /* Specifies phase segment 1 in time quantas. (uint8 ??) */\r
+       uint32 CanControllerSeg2;                                       /* Specifies phase segment 2 in time quantas. (uint8 ??) */\r
+       uint32 CanControllerSyncJumpWidth;                      /* Specifies the synchronization jump width for the controller in time quantas. (uint8 ??) */\r
+       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. */\r
+\r
+       // List of Hoh id's that belong to this controller\r
+       const Can_HardwareObjectType  *Can_Arc_Hoh;\r
+\r
+       boolean Can_Arc_Loopback;\r
+       boolean Can_Arc_Fifo;   // set this to use the fifo\r
+} Can_ControllerConfigType;\r
+\r
+typedef struct {\r
+       const Can_ControllerConfigType *CanController;  /* contains the configuration parameters of the CAN controller(s) */\r
+\r
+       // Callbacks( Extension )\r
+       const Can_CallbackType *CanCallbacks;\r
+} Can_ConfigSetType;\r
+\r
+/* The type of external data structure containing the overall initialization data for the CAN driver and SFR settings affecting all controllers. */\r
+typedef struct {\r
+       const Can_ConfigSetType  *CanConfigSet;                 /* the multiple configuration set container for CAN Driver */\r
+       const Can_GeneralType    *CanGeneral;                   /* contains the parameters related each CAN Driver Unit. */\r
+} Can_ConfigType;\r
+\r
+extern const Can_ConfigType CanConfigData;\r
+extern const Can_ControllerConfigType CanControllerConfigData[];\r
+extern const Can_ConfigSetType Can_ConfigSet;\r
+\r
+#endif /*CAN_CFG_H_*/\r