Functions | |
int32_t | tte_get_var (const uint8_t ctrl_id, const tte_var_id_t var_id, const uint32_t var_size, void *const value) |
__attribute__ ((__unused__)) static TTE_INLINE uint32_t tte_get_api_version(void) | |
int32_t | tte_get_ct_output_buf (const uint8_t ctrl_id, const uint16_t ct_id, tte_buffer_t *const buf) |
int32_t | tte_get_bg_input_buf (const uint8_t ctrl_id, const uint8_t channel, tte_buffer_t *const buf) |
int32_t | tte_get_bg_output_buf (const uint8_t ctrl_id, const uint8_t channel, tte_buffer_t *const buf) |
int32_t | tte_write_output_buf (tte_buffer_t *const buf, tte_frame_t *const frame) |
int32_t | tte_read_input_buf (tte_buffer_t *const buf, tte_frame_t *const frame, tte_buf_status_t *const status) |
int32_t | tte_open_input_buf (tte_buffer_t *const buf, tte_frame_t *const frame, tte_buf_status_t *const status) |
int32_t | tte_close_input_buf (tte_buffer_t *const buf) |
int32_t | tte_open_output_buf (tte_buffer_t *const buf, tte_frame_t *const frame) |
int32_t | tte_close_output_buf (tte_buffer_t *const buf) |
int32_t | tte_get_buf_var (const tte_buffer_t *const buf, const tte_buf_var_id_t var_id, const uint32_t var_size, void *const value) |
int32_t | tte_set_buf_var (tte_buffer_t *const buf, const tte_buf_var_id_t var_id, const uint32_t var_size, const void *const value) |
int32_t | tte_flush_buffers (const uint8_t ctrl_id) |
int32_t | tte_flush_tt_buffers (const uint8_t ctrl_id) |
int32_t | tte_flush_bg_buffers (const uint8_t ctrl_id, const uint8_t channel) |
Variables | |
uint8_t | __attribute__::src_mac [6] |
uint16_t | __attribute__::type |
uint8_t | tte_buf_status_t::fresh_data |
uint8_t | tte_buf_status_t::locked |
uint8_t | tte_buf_status_t::free_entries |
uint8_t | tte_buf_status_t::dropped_frames |
tte_time_t | tte_buf_status_t::timestamp |
uint8_t | tte_buffer_t::direction |
uint8_t | tte_buffer_t::traffic_type |
uint8_t | tte_buffer_t::channel |
uint16_t | tte_buffer_t::ct_id |
uint8_t | tte_buffer_t::shared |
void * | tte_buffer_t::priv |
tte_eth_hdr_t | tte_frame_t::eth_hdr |
uint8_t * | tte_frame_t::data |
uint16_t | tte_frame_t::ct_id |
uint8_t | tte_frame_t::channel |
uint32_t | tte_conf_t::length |
const uint16_t | ct_id |
This section contains various functions that return status information of the TTEthernet controller.
__attribute__ | ( | (__unused__) | ) |
Returns the version of the TTEthernet library implementation. The function internally calls the tte_get_var() function for the TTE_VAR_API_VERSION variable. See their respective descriptions for more information.
Returns the number of available TTEthernet controllers. The function internally calls the tte_get_var() function for the TTE_VAR_CTRL_COUNT variable. See their respective descriptions for more information.
ETT_NOINIT | The API is not initialized. | |
0..127 | Number of available controllers. |
Returns the number of Ethernet channels/ports of a single controller.
The function internally calls the tte_get_var() function for the TTE_VAR_CHANNEL_COUNT variable. See their respective descriptions for more information.
[in] | ctrl_id | Controller number (0-based). |
0..127 | Number of Ethernet ports/channels. | |
ETT_NOINIT | The API is not initialized. | |
ETT_INVCTRL | The controller ID is invalid. | |
ETT_NOTSUPPORTED | This function is not supported. |
Returns the time resolution supported by the TTEthernet controller.
The function internally calls the tte_get_var() function for the TTE_VAR_TIME_RESOLUTION variable. See their respective descriptions for more information.
[in] | ctrl_id | Controller number (0-based). |
[out] | resolution | Time resolution in nanoseconds. |
ETT_SUCCESS | The operation was successful. | |
ETT_NOINIT | The API is not initialized. | |
ETT_INVCTRL | The controller ID is invalid. | |
ETT_NULLPTR | A NULL pointer was passed as argument. | |
ETT_NOTSUPPORTED | This function is not supported. |
The same as tte_get_ct_input_buf().
Definition at line 649 of file tte_api.h.
00651 { 00652 uint8_t cnt; 00653 int32_t ret; 00654 ret = tte_get_var(0, TTE_VAR_CTRL_COUNT, sizeof(cnt), &cnt); 00655 return (ret >= 0) ? cnt : ret; 00656 }
int32_t tte_close_input_buf | ( | tte_buffer_t *const | buf | ) |
Closes the input message buffer.
The currently opened message in the buffer will be released back to the controller, which means:
This function will do nothing if the buffer was not open.
[in] | buf | Input buffer handle initialized with one of the functions tte_get_ct_input_buf() or tte_get_bg_input_buf(). |
Definition at line 586 of file TTEAPIApplicationBase.cc.
int32_t tte_close_output_buf | ( | tte_buffer_t *const | buf | ) |
Closes the output message buffer.
Use this function when you have stored a complete frame directly within the controller's output buffer to commit the message for transmission.
[in] | buf | Output buffer handle initialized with one of the functions tte_get_ct_output_buf() or tte_get_bg_output_buf(). |
Definition at line 601 of file TTEAPIApplicationBase.cc.
int32_t tte_flush_bg_buffers | ( | const uint8_t | ctrl_id, | |
const uint8_t | channel | |||
) |
Flushes all BG messages on one channel/port.
[in] | ctrl_id | Controller number (0-based). |
[in] | channel | Channel number (0-based). |
Definition at line 636 of file TTEAPIApplicationBase.cc.
int32_t tte_flush_buffers | ( | const uint8_t | ctrl_id | ) |
Flushes all message buffers.
[in] | ctrl_id | Controller number (0-based). |
Definition at line 628 of file TTEAPIApplicationBase.cc.
int32_t tte_flush_tt_buffers | ( | const uint8_t | ctrl_id | ) |
Flushes all TT messages.
[in] | ctrl_id | Controller number (0-based). |
Definition at line 632 of file TTEAPIApplicationBase.cc.
int32_t tte_get_bg_input_buf | ( | const uint8_t | ctrl_id, | |
const uint8_t | channel, | |||
tte_buffer_t *const | buf | |||
) |
Gets a buffer handle to a background Ethernet receive queue.
The buffer handle can be used to directly access the receive queue of the background channel.
[in] | ctrl_id | Controller number (0-based). |
[in] | channel | Channel/port number (0-based). |
[out] | buf | Buffer handle that remains valid until a new configuration is loaded. |
Definition at line 546 of file TTEAPIApplicationBase.cc.
int32_t tte_get_bg_output_buf | ( | const uint8_t | ctrl_id, | |
const uint8_t | channel, | |||
tte_buffer_t *const | buf | |||
) |
Get a buffer handle to a background Ethernet transmit queue.
The buffer handle can be used to directly access the transmit queue of the background channel.
[in] | ctrl_id | Controller number (0-based). |
[in] | channel | Channel number (0-based). |
[out] | buf | Buffer handle that remains valid until a new configuration is loaded. |
Definition at line 555 of file TTEAPIApplicationBase.cc.
int32_t tte_get_buf_var | ( | const tte_buffer_t *const | buf, | |
const tte_buf_var_id_t | var_id, | |||
const uint32_t | var_size, | |||
void *const | value | |||
) |
Gets the value of a message buffer variable.
Message buffer variables allow you to modify non-standard parameters of message buffers at runtime or to read extended status information (implementation specific).
Each variable is identified by a single unique number; the list of the supported numbers and the explanations are described in the section on tte_buf_var_id_t. Access to a variable that is not supported will return the value ETT_NOTSUPPORTED.
[in] | buf | Buffer handle obtained via tte_get_ct_input_buf(), tte_get_bg_input_buf(), tte_get_ct_output_buf() or tte_get_bg_output_buf(). |
[in] | var_id | TTE variable identification number. |
[in] | var_size | Size of the provided buffer value in bytes. |
[out] | value | Storage for the variable value. |
Definition at line 608 of file TTEAPIApplicationBase.cc.
int32_t tte_get_ct_output_buf | ( | const uint8_t | ctrl_id, | |
const uint16_t | ct_id, | |||
tte_buffer_t *const | buf | |||
) |
Gets an output buffer handle to a CT message.
The buffer handle can be used to directly write the message into the controller. It can be also used to prevent non-deterministic CT ID lookup at runtime.
[in] | ctrl_id | Controller number (0-based). |
[in] | ct_id | Critical traffic identifier of the message. |
[out] | buf | Buffer handle that remains valid until a new configuration is loaded. |
Definition at line 537 of file TTEAPIApplicationBase.cc.
int32_t tte_get_var | ( | const uint8_t | ctrl_id, | |
const tte_var_id_t | var_id, | |||
const uint32_t | var_size, | |||
void *const | value | |||
) |
Gets the value of a TTEthernet API variable.
TTEthernet API variables export various internal information about the API, such as whether a feature is supported, what the currect status is, etc.
Each variable is identified by a single unique number; the list of the supported numbers and the explanations are described in the text on tte_var_id_t. Access to a variable that is not supported will return the value ETT_NOTSUPPORTED.
[in] | ctrl_id | Controller number (0-based). |
[in] | var_id | TTE variable identification number. |
[in] | var_size | Size of the provided buffer value in bytes. |
[out] | value | Storage for the variable value. |
Definition at line 518 of file TTEAPIApplicationBase.cc.
Referenced by __attribute__().
00520 { 00521 return ETT_NOTSUPPORTED; 00522 } 00523 00524 extern "C" int32_t tte_set_var(const uint8_t ctrl_id, 00525 const tte_var_id_t var_id, 00526 const uint32_t var_size,
int32_t tte_open_input_buf | ( | tte_buffer_t *const | buf, | |
tte_frame_t *const | frame, | |||
tte_buf_status_t *const | status | |||
) |
Opens a message buffer for direct reading.
This operation locks the current state of the message buffer until the tte_close_input_buf() function is used. The status of the message and the Ethernet header are copied into local memory (in frame.eth_hdr and status). The payload is not copied and the user may access it directly via the frame.data pointer.
Pay attention to the status.fresh_data flag when you read messages from a state buffer. A message from state buffer is not consumed on reading, hence it is possible to read the same message multiple times. The status.fresh_data flag tells you if the message was updated or not.
It is possible to open a buffer several times without closing it first. Opening a buffer that is already open will not change its status. The opening is not recursive: a single close operation is enough.
[in] | buf | Input buffer handle initialized with one of tte_get_ct_input_buf() or tte_get_bg_input_buf() functions. |
[out] | frame.length | The API will write the actual received payload length here on return. |
[out] | frame.data | Address of the received payload withing the controller memory. |
[out] | frame.eth_hdr | Ethernet frame header in network byte order. |
[out] | frame.ct_id | Critical traffic identifier of the message. |
[out] | status | Additional information about the received message. |
Definition at line 577 of file TTEAPIApplicationBase.cc.
00578 { 00579 //TODO High prio 00580 return ETT_NOTSUPPORTED; 00581 } 00582 00583 extern "C" int32_t tte_read_input_buf(tte_buffer_t * const buf, 00584 tte_frame_t * const frame,
int32_t tte_open_output_buf | ( | tte_buffer_t *const | buf, | |
tte_frame_t *const | frame | |||
) |
Opens a message buffer for direct writing.
This operation initializes the output interface and checks whether it is ready to accept a transmission. It does not write any part of the payload but may (depending on the implementation) store traffic-class relevant parts of the Ethernet header. The application is required to provide the payload of the frame.
[in] | buf | Output buffer handle initialized with one of the functionstte_get_ct_output_buf() or tte_get_bg_output_buf(). |
[in] | frame.length | Length of the payload in bytes. |
[in] | frame.eth_hdr | Ethernet frame header in network byte order. You need to specify only the type field for CT messages. |
[out] | frame.data | Address of the frame output buffer within the controller memory. Consult the controller specification to learn if there are any access restrictions for your platform (e.g., some controllers support only 32-bit access and ordered writes). |
Definition at line 593 of file TTEAPIApplicationBase.cc.
int32_t tte_read_input_buf | ( | tte_buffer_t *const | buf, | |
tte_frame_t *const | frame, | |||
tte_buf_status_t *const | status | |||
) |
Reads a message directly from a message buffer.
Whether a message was received or not is signalized by the return value and also by the status.empty_buffer flag.
Pay attention to the status.fresh_data flag when you read messages from a state buffer. A message from a state buffer is not consumed on reading, hence it is possible to read the same message multiple times. The status.fresh_data flag tells you if the message was updated or not.
[in] | buf | Input buffer handle initialized with one of the functions tte_get_ct_input_buf() or tte_get_bg_input_buf(). |
[in] | frame.data | Address of a prepared data buffer for payload. |
[in,out] | frame.length | The application must initialize this parameter with the maximum accepted payload size (the buffer in frame.data must be large enough). The API will write the actual received payload length here on return. |
[out] | frame.eth_hdr | Ethernet frame header in network byte order. |
[out] | frame.ct_id | Critical traffic identifier of the message. |
[out] | status | Additional information about the received message. |
Definition at line 570 of file TTEAPIApplicationBase.cc.
00570 { 00571 TTEAPIApplicationBase *app = dynamic_cast<TTEAPIApplicationBase*>(cSimulation::getActiveSimulation()->getContext()); 00572 if(app != NULL) 00573 return app->tte_get_bg_output_buf(ctrl_id, channel, buf); 00574 return ETT_NULLPTR; 00575 }
int32_t tte_set_buf_var | ( | tte_buffer_t *const | buf, | |
const tte_buf_var_id_t | var_id, | |||
const uint32_t | var_size, | |||
const void *const | value | |||
) |
Sets the value of a message buffer variable.
Message buffer variables allow you to modify non-standard parameters of message buffers at runtime or to read extended status information (implementation specific).
Each variable is identified by a single unique number; the list of the supported numbers and the explanations are described in the section on tte_buf_var_id_t. Access to a variable that is not supported will return the value ETT_NOTSUPPORTED.
[in] | buf | Buffer handle obtained via tte_get_ct_input_buf(), tte_get_bg_input_buf(), tte_get_ct_output_buf() or tte_get_bg_output_buf(). |
[in] | var_id | TTE variable identification number. |
[in] | var_size | Size of the new value in bytes. |
[in] | value | Address of the new value of the variable. |
Definition at line 618 of file TTEAPIApplicationBase.cc.
int32_t tte_write_output_buf | ( | tte_buffer_t *const | buf, | |
tte_frame_t *const | frame | |||
) |
Writes a message directly into a message buffer.
The message will be transmitted according to its configuration:
[in] | buf | Output buffer handle initialized with one of the functions tte_get_ct_output_buf() or tte_get_bg_output_buf(). |
[in] | frame.length | Length of the payload in bytes. |
[in] | frame.data | Address of the payload. |
[in] | frame.eth_hdr | Ethernet frame header (TT messages use only the type field). |
Definition at line 564 of file TTEAPIApplicationBase.cc.
uint8_t tte_frame_t::channel [inherited] |
uint8_t tte_buffer_t::channel [inherited] |
Background traffic channel/port number. Channel numbers are 0-based.
Definition at line 170 of file tte_api.h.
Referenced by TTEthernetModel::APICallback::executeCallback().
const uint16_t ct_id |
Definition at line 1191 of file tte_api.h.
Referenced by TTEthernetModel::Buffer::handleMessage().
uint16_t tte_frame_t::ct_id [inherited] |
uint16_t tte_buffer_t::ct_id [inherited] |
Critical traffic identifier (for TT messages).
Definition at line 173 of file tte_api.h.
Referenced by TTEthernetModel::APICallback::executeCallback().
uint8_t* tte_frame_t::data [inherited] |
Address of the payload.
Definition at line 195 of file tte_api.h.
Referenced by TTEthernetModel::TTEAPIApplicationBase::tte_close_output_buf().
uint8_t tte_buffer_t::direction [inherited] |
A bit combination of TTE_DIR_INPUT (receive buffer) and TTE_DIR_OUTPUT (transmit buffer).
uint8_t tte_buf_status_t::dropped_frames [inherited] |
tte_eth_hdr_t tte_frame_t::eth_hdr [inherited] |
uint8_t tte_buf_status_t::free_entries [inherited] |
uint8_t tte_buf_status_t::fresh_data [inherited] |
uint32_t tte_conf_t::length [inherited] |
uint8_t tte_buf_status_t::locked [inherited] |
void* tte_buffer_t::priv [inherited] |
Implementation specific buffer extension.
Definition at line 180 of file tte_api.h.
Referenced by TTEthernetModel::APICallback::executeCallback().
uint8_t tte_buffer_t::shared [inherited] |
Shared buffer flag: when set, this buffer receives CT messages with multiple CT IDs (depends on configuration.
Definition at line 177 of file tte_api.h.
Referenced by TTEthernetModel::APICallback::executeCallback().
uint8_t __attribute__::src_mac[6] [inherited] |
tte_time_t tte_buf_status_t::timestamp [inherited] |
uint8_t tte_buffer_t::traffic_type [inherited] |
Traffic type: one of TTE_TT_TRAFFIC, TTE_BG_TRAFFIC or TTE_CT_TRAFFIC.
Definition at line 166 of file tte_api.h.
Referenced by TTEthernetModel::APICallback::executeCallback().
uint16_t __attribute__::type [inherited] |