Status Information
[TTEthernet API Common Functions]

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

Detailed Description

This section contains various functions that return status information of the TTEthernet controller.


Function Documentation

__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.

Note:
This function may never fail and does not require the API to be initialized.
Returns:
Version number of the API implementation.

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.

Return values:
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.

Parameters:
[in] ctrl_id Controller number (0-based).
Return values:
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.

Parameters:
[in] ctrl_id Controller number (0-based).
[out] resolution Time resolution in nanoseconds.
Return values:
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.

Parameters:
[in] buf Input buffer handle initialized with one of the functions tte_get_ct_input_buf() or tte_get_bg_input_buf().
Returns:
See tte_retval_t.

Definition at line 586 of file TTEAPIApplicationBase.cc.

00592                                                                   {

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.

Note:
Some implementations may perform a message commit automatically when a sufficient number of payload bytes has been stored.
Parameters:
[in] buf Output buffer handle initialized with one of the functions tte_get_ct_output_buf() or tte_get_bg_output_buf().
Returns:
See tte_retval_t.

Definition at line 601 of file TTEAPIApplicationBase.cc.

00607                                                              {

int32_t tte_flush_bg_buffers ( const uint8_t  ctrl_id,
const uint8_t  channel 
)

Flushes all BG messages on one channel/port.

Parameters:
[in] ctrl_id Controller number (0-based).
[in] channel Channel number (0-based).
Returns:
See tte_retval_t.

Definition at line 636 of file TTEAPIApplicationBase.cc.

00641                                                            {

int32_t tte_flush_buffers ( const uint8_t  ctrl_id  ) 

Flushes all message buffers.

Parameters:
[in] ctrl_id Controller number (0-based).
Returns:
See tte_retval_t.

Definition at line 628 of file TTEAPIApplicationBase.cc.

00634                                                         {

int32_t tte_flush_tt_buffers ( const uint8_t  ctrl_id  ) 

Flushes all TT messages.

Parameters:
[in] ctrl_id Controller number (0-based).
Returns:
See tte_retval_t.

Definition at line 632 of file TTEAPIApplicationBase.cc.

00634                                                         {

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.

Parameters:
[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.
Returns:
See tte_retval_t.

Definition at line 546 of file TTEAPIApplicationBase.cc.

00552                                                               {
00553     TTEAPIApplicationBase *app = dynamic_cast<TTEAPIApplicationBase*>(cSimulation::getActiveSimulation()->getContext());

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.

Note:
The last octet of the source MAC address of all transmitted background messages may be modified by the controller to enforce ARINC 664 compatibility. Whether this is the case is defined in the specification of the TTEthernet controller.
Parameters:
[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.
Returns:
See tte_retval_t.

Definition at line 555 of file TTEAPIApplicationBase.cc.

00561                                                              {
00562     TTEAPIApplicationBase *app = dynamic_cast<TTEAPIApplicationBase*>(cSimulation::getActiveSimulation()->getContext());

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.

Parameters:
[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.
Returns:
See tte_retval_t.

Definition at line 608 of file TTEAPIApplicationBase.cc.

00614                                                                  {
00615     TTEAPIApplicationBase *app = dynamic_cast<TTEAPIApplicationBase*>(cSimulation::getActiveSimulation()->getContext());
00616     if(app != NULL)

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.

Parameters:
[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.
Returns:
See tte_retval_t.

Definition at line 537 of file TTEAPIApplicationBase.cc.

00543                                                              {
00544     TTEAPIApplicationBase *app = dynamic_cast<TTEAPIApplicationBase*>(cSimulation::getActiveSimulation()->getContext());

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.

Parameters:
[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.
Returns:
See tte_retval_t.

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.

Parameters:
[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.
Returns:
See tte_retval_t.

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.

Parameters:
[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).
Returns:
See tte_retval_t.

Definition at line 593 of file TTEAPIApplicationBase.cc.

00599                                                                 {

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.

Parameters:
[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.
Returns:
See tte_retval_t.

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.

Parameters:
[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.
Returns:
See tte_retval_t.

Definition at line 618 of file TTEAPIApplicationBase.cc.

00624                                                   {
00625     TTEAPIApplicationBase *app = dynamic_cast<TTEAPIApplicationBase*>(cSimulation::getActiveSimulation()->getContext());
00626         if(app != NULL)

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:

  • as soon as possible for background messages
  • as scheduled for TT messages
Note:
This function will internally call the tte_open_input_buf() and tte_close_input_buf() functions, however, it will work even if the buffer is already open. Opening a buffer multiple times does not change its status.
Parameters:
[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).
Returns:
See tte_retval_t.

Definition at line 564 of file TTEAPIApplicationBase.cc.

00570                                                               {


Variable Documentation

uint8_t tte_frame_t::channel [inherited]

Ethernet channel/port number (for background messages).

Definition at line 201 of file tte_api.h.

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]

Critical traffic ID (for TT messages).

Definition at line 198 of file tte_api.h.

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).

Definition at line 162 of file tte_api.h.

uint8_t tte_buf_status_t::dropped_frames [inherited]

Number of dropped frames. A frame is dropped when

  • the message uses a FIFO and all entries are occupied
  • the message uses a single buffer and the buffer is locked

Definition at line 139 of file tte_api.h.

tte_eth_hdr_t tte_frame_t::eth_hdr [inherited]

Ethernet header in network byte order.

Definition at line 192 of file tte_api.h.

uint8_t tte_buf_status_t::free_entries [inherited]

Number of free entries in the FIFO. The information is not used for state buffers.

Definition at line 134 of file tte_api.h.

uint8_t tte_buf_status_t::fresh_data [inherited]

Zero when the current frame was already read. This is possible only with state buffers, because a FIFO will delete the frame once is was read.

Definition at line 126 of file tte_api.h.

uint32_t tte_conf_t::length [inherited]

Length of the configuration block in 32-bit words.

Definition at line 429 of file tte_api.h.

uint8_t tte_buf_status_t::locked [inherited]

Non-zero when the buffer is written by controller. This is possible only with single buffers.

Definition at line 130 of file tte_api.h.

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]

Source MAC address in network byte order.

Definition at line 106 of file tte_api.h.

Reception timestamp of the current message in the buffer.

Note:
This field is set to 0 when time-stamping is not supported.

Definition at line 144 of file tte_api.h.

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]

Ethernet type/length field in network byte order.

big endian

Definition at line 108 of file tte_api.h.

Generated on Tue Nov 29 14:09:19 2011 for TTEthernet Model for INET Framework by  doxygen 1.6.3