00001 /* -*- coding: iso-8859-1 -*- 00002 * Copyright (C) 2008 TTTech Computertechnik AG 00003 * **************************************************************************** 00004 * Name 00005 * tte_config.h 00006 * 00007 * Purpose 00008 * Configuration Structures for the TTE protocol layer 00009 * 00010 * Revision Dates 00011 * 29-May-2008 Creation 00012 * 07-Oct-2008 (AAD) mIRSA and TTTech coding guidlines update 00013 * 02-Dec-2008 (KSE) [29628] Guard defines 00014 * 02-Dec-2008 (KSE) [29628] Changed include names 00015 * 04-Jun-2010 (JWO) Added integration cycle lookup 00016 * 13-Sep-2010 (AAD) Added support for 64 bit CPU 00017 *-- 00018 */ 00019 00023 #ifndef TTE_CONFIG_H_ 00024 #define TTE_CONFIG_H_ 00025 00026 #include "tte_environment.h" 00027 #include "tte_hw_timer.h" 00028 #include "tte_common.h" 00029 #include "tte_eth_driver.h" 00030 #include "tte_api.h" 00031 00033 typedef enum { 00034 TTE_QUEUE_BUF = 0, 00035 TTE_DOUBLE_BUF = 2 00036 } tte_buffer_type_t; 00037 00038 00039 //#pragma pack(push) 00040 //#pragma pack(1) 00042 typedef struct { 00045 uint16_t msg_id; 00046 00048 eth_mac_addr_t dst_mac; 00049 00051 uint16_t eth_type; 00052 00054 uint16_t size; 00055 00057 uint8_t buf_type; 00058 00061 uint8_t buf_len; 00062 } tte_message_conf_t; 00063 //#pragma pack(pop) 00064 00065 00069 typedef struct { 00072 void (*fn)(void *arg); 00073 00075 void *arg; 00076 } tte_task_conf_t; 00077 00078 00080 typedef enum { 00081 TTE_SCHED_TT_TX = 0u, 00082 TTE_SCHED_BG_TX, 00083 TTE_SCHED_TASK, 00084 TTE_SCHED_RX, 00085 TTE_SCHED_SYNC, 00086 TTE_SCHED_CRANKSHAFT 00087 } tte_sched_type_t; 00088 00089 00090 //#pragma pack(push) 00091 //#pragma pack(2) 00093 typedef struct { 00095 uint64_t time_ns; 00096 /* Task type: one of ::TTE_SCHED_TT_TX, ::TTE_SCHED_BG_TX, 00097 * ::TTE_SCHED_TASK, ::TTE_SCHED_RX, ::TTE_SCHED_SYNC, ::TTE_SCHED_CRANKSHAFT. */ 00098 uint8_t type; 00100 union { 00103 tte_message_conf_t *tt_msg; 00105 tte_task_conf_t *task; 00108 uint32_t bg_max; /*maximum number of BG messages to send*/ 00109 } sched; 00110 00114 uint64_t deadline_ns; 00115 } tte_schedule_entry_t; 00116 //#pragma pack(pop) 00117 00118 00122 typedef struct { 00126 uint32_t cluster_id; 00127 00130 uint8_t sync_master; 00131 00133 uint8_t crankshaft; 00134 00137 uint64_t period_ns; 00138 00141 uint16_t cs_blackout_cnt; 00142 00144 uint16_t rx_table_len; 00145 00147 uint16_t tx_table_len; 00148 00150 uint16_t schedule_table_len; 00151 00153 uint16_t task_table_len; 00154 00156 tte_message_conf_t *rx_table; 00157 00159 tte_message_conf_t *tx_table; 00160 00162 tte_schedule_entry_t *schedule_table; 00163 00165 tte_task_conf_t *task_table; 00166 00169 tte_message_conf_t *pcf_conf; 00170 00175 void (*init_cb)(void); 00176 00181 void (*bg_hook_cb)(void); 00182 00187 void (*app_error_cb)(int32_t tte_error_nr); 00188 00191 eth_mac_addr_t mac; 00192 00194 uint16_t tt_rx_ethbufs; 00195 00197 uint16_t tt_tx_ethbufs; 00198 00200 uint16_t bg_rx_ethbufs; 00201 00203 uint16_t bg_tx_ethbufs; 00204 00206 uint16_t tx_maxbufsize; 00207 00209 void (* app_dcl_cb)(uint8_t * frame, uint8_t opcode); 00210 00218 void (* app_get_node_id)(uint16_t * tte_node_id); 00219 00221 uint8_t promisc; 00222 00225 uint64_t max_sched_delay_ns; 00226 00228 uint32_t *ic_lookup; 00229 int8_t ic_lookup_len; 00230 } tte_swes_conf_t; 00231 00232 typedef struct { 00233 tte_message_conf_t *tt_msg; 00234 uint64_t time_ns; 00235 } tte_rc_conf_t; 00236 00239 extern tte_swes_conf_t *tte_conf; 00240 00241 #endif /* TTE_CONFIG_H_ */ 00242