tte_dcl.h File Reference

#include "tte_eth_driver.h"
#include "tte_environment.h"
#include "tte_target.h"
#include "tte_common.h"
#include "tte_config.h"

Go to the source code of this file.

Classes

struct  tte_dcl_msg_t
struct  tte_dcl_frame_t

Defines

#define TTE_DCL_MAX_FRAMES_NUMBER   (3)
#define TTE_DCL_MAX_PAYLOAD_SIZE   ((uint16_t)1494)
#define TTE_DCL_HEADER_SIZE   ((uint16_t)6)
#define TTE_DCL_MIN_PAYLOAD_SIZE   ((uint8_t)50)
#define TTE_DCL_ETHER_TYPE   ((uint16_t)0x891D)
#define TTE_DCL_OPCODE_DCL_CMD   ((uint8_t)0x00)
#define TTE_DCL_OPCODE_OPMASK   ((uint8_t)0x03)
#define TTE_DCL_OPCODE_REQCFG   ((uint8_t)0x04)
#define TTE_DCL_OPCODE_SNDCFG   ((uint8_t)0x08)
#define TTE_DCL_OPCODE_REQ_ACK   ((uint8_t)0x10)
#define TTE_DCL_OPCODE_PACK   ((uint8_t)0x20)
#define TTE_DCL_OPCODE_NACK   ((uint8_t)0x40)
#define TTE_DCL_OPCODE_ACKMASK   ((uint8_t)0x60)
#define TTE_DCL_OPCODE_OFFSET   ((uint8_t)0)
#define TTE_DCL_PAYLOAD_OFFSET   ((uint8_t)1)
#define TTE_DCL_PADDED_OFFSET   ((uint8_t)3)
#define TTE_DCL_FRAMES_OFFSET   ((uint8_t)4)
#define TTE_DCL_CURR_FRAME_OFFSET   ((uint8_t)5)
#define TTE_DCL_NODEID_OFFSET   ((uint8_t)0)
#define TTE_DCL_MACADR_OFFSET   ((uint8_t)2)
#define TTE_DCL_CLUSTERID_OFFSET   ((uint8_t)8)
#define TTE_DCL_SYNC_OFFSET   ((uint8_t)12)
#define TTE_DCL_CRANKSHAFT_OFFSET   ((uint8_t)13)
#define TTE_DCL_PERIOD_OFFSET   ((uint8_t)14)
#define TTE_DCL_CS_BLKOUT_OFFSET   ((uint8_t)18)
#define TTE_DCL_TTE_TX_OFFSET   ((uint8_t)20)
#define TTE_DCL_TTE_RX_OFFSET   ((uint8_t)22)
#define TTE_DCL_SCHED_ENTR_OFFSET   ((uint8_t)24)
#define TTE_DCL_NR_NODES_OFFSET   ((uint8_t)26)
#define TTE_DCL_RESERVED_OFFSET   ((uint8_t)28)
#define TTE_DCL_SCHED_BLOCK_OFFSET   ((uint8_t)40)
#define TTE_DCL_MSG_ID_OFFSET   ((uint8_t)0)
#define TTE_DCL_MSG_SIZE_OFFSET   ((uint8_t)2)
#define TTE_DCL_MSG_ETHTYPE_OFFSET   ((uint8_t)4)
#define TTE_DCL_MSG_BUFTYPE_OFFSET   ((uint8_t)6)
#define TTE_DCL_MSG_BUFLEN_OFFSET   ((uint8_t)7)
#define TTE_DCL_SCHED_TIME_OFFSET   ((uint8_t)0)
#define TTE_DCL_SCHED_TYPE_OFFSET   ((uint8_t)4)
#define TTE_DCL_SCHED_PARAM_OFFSET   ((uint8_t)5)
#define TTE_DCL_SCHED_RES_OFFSET   ((uint8_t)7)
#define TTE_DCL_GEN_BLOCK_LEN   ((uint8_t)40)
#define TTE_DCL_SCHED_BLOCK_LEN   ((uint8_t)8)
#define TTE_DCL_MSG_BLOCK_LEN   ((uint8_t)8)
#define TTE_DCL_MAC_BLOCK_LEN   ((uint8_t)8)
#define TTE_DCL_FALSE   ((uint8_t)0)
#define TTE_DCL_TRUE   ((uint8_t)1)
#define TTE_DCL_REQUEST_DCL   (TTE_DCL_OPCODE_REQCFG)
#define TTE_DCL_SEND_POS_ACK   (TTE_DCL_OPCODE_PACK)
#define TTE_DCL_SEND_NEG_ACK   (TTE_DCL_OPCODE_NACK)

Typedefs

typedef uint16_t tte_dcl_id_t
typedef uint8_t tte_dcl_data_buf_t
typedef int32_t tte_dcl_copy_data_buf_t
typedef uint16_t tte_dcl_data_len_t

Functions

int32_t tte_dcl_ack_funct (eth_mac_addr_t *ack_dst_mac, uint16_t ack_src_node_id, uint8_t ack_rsp)
 Send a dynamic configuration loading (DCL) ACK frame.
int32_t tte_dcl_check_configure (uint8_t *dcl_data, tte_conf_t *curr_config, uint16_t size)
 Check TTE configuration for consistency.
int32_t tte_dcl_prepare_data (uint16_t node_id, uint8_t *dcl_data, uint16_t size, tte_conf_t *dcl_config)
 Prepare DCL data.
int32_t tte_dcl_process_frame (tte_dcl_frame_t *dcl_frame)
 Process received DCL frame.
int32_t tte_dcl_req_cfg (uint16_t src_node_id)
int32_t tte_dcl_send_cfg (eth_mac_addr_t *dest_mac, uint16_t src_node_id, uint8_t *dcl_data, uint16_t dcl_data_len, uint8_t req_ack)
 Send DCL frame.
int32_t tte_dcl_set_config (uint8_t *dcl_data, tte_conf_t *curr_config, uint16_t size)
 Set DCL config.

Define Documentation

#define TTE_DCL_CLUSTERID_OFFSET   ((uint8_t)8)

Definition at line 58 of file tte_dcl.h.

#define TTE_DCL_CRANKSHAFT_OFFSET   ((uint8_t)13)

Definition at line 60 of file tte_dcl.h.

#define TTE_DCL_CS_BLKOUT_OFFSET   ((uint8_t)18)

Definition at line 62 of file tte_dcl.h.

#define TTE_DCL_CURR_FRAME_OFFSET   ((uint8_t)5)

Definition at line 52 of file tte_dcl.h.

#define TTE_DCL_ETHER_TYPE   ((uint16_t)0x891D)

Definition at line 34 of file tte_dcl.h.

#define TTE_DCL_FALSE   ((uint8_t)0)

Definition at line 90 of file tte_dcl.h.

#define TTE_DCL_FRAMES_OFFSET   ((uint8_t)4)

Definition at line 51 of file tte_dcl.h.

#define TTE_DCL_GEN_BLOCK_LEN   ((uint8_t)40)

Definition at line 85 of file tte_dcl.h.

#define TTE_DCL_HEADER_SIZE   ((uint16_t)6)

Definition at line 31 of file tte_dcl.h.

#define TTE_DCL_MAC_BLOCK_LEN   ((uint8_t)8)

Definition at line 88 of file tte_dcl.h.

#define TTE_DCL_MACADR_OFFSET   ((uint8_t)2)

Definition at line 57 of file tte_dcl.h.

#define TTE_DCL_MAX_FRAMES_NUMBER   (3)

Definition at line 28 of file tte_dcl.h.

#define TTE_DCL_MAX_PAYLOAD_SIZE   ((uint16_t)1494)

Definition at line 30 of file tte_dcl.h.

#define TTE_DCL_MIN_PAYLOAD_SIZE   ((uint8_t)50)

Definition at line 32 of file tte_dcl.h.

#define TTE_DCL_MSG_BLOCK_LEN   ((uint8_t)8)

Definition at line 87 of file tte_dcl.h.

#define TTE_DCL_MSG_BUFLEN_OFFSET   ((uint8_t)7)

Definition at line 75 of file tte_dcl.h.

#define TTE_DCL_MSG_BUFTYPE_OFFSET   ((uint8_t)6)

Definition at line 74 of file tte_dcl.h.

#define TTE_DCL_MSG_ETHTYPE_OFFSET   ((uint8_t)4)

Definition at line 73 of file tte_dcl.h.

#define TTE_DCL_MSG_ID_OFFSET   ((uint8_t)0)

Definition at line 71 of file tte_dcl.h.

#define TTE_DCL_MSG_SIZE_OFFSET   ((uint8_t)2)

Definition at line 72 of file tte_dcl.h.

#define TTE_DCL_NODEID_OFFSET   ((uint8_t)0)

Definition at line 56 of file tte_dcl.h.

#define TTE_DCL_NR_NODES_OFFSET   ((uint8_t)26)

Definition at line 66 of file tte_dcl.h.

#define TTE_DCL_OPCODE_ACKMASK   ((uint8_t)0x60)

Definition at line 45 of file tte_dcl.h.

#define TTE_DCL_OPCODE_DCL_CMD   ((uint8_t)0x00)

Definition at line 37 of file tte_dcl.h.

#define TTE_DCL_OPCODE_NACK   ((uint8_t)0x40)

Definition at line 44 of file tte_dcl.h.

#define TTE_DCL_OPCODE_OFFSET   ((uint8_t)0)

Definition at line 48 of file tte_dcl.h.

#define TTE_DCL_OPCODE_OPMASK   ((uint8_t)0x03)

Definition at line 38 of file tte_dcl.h.

#define TTE_DCL_OPCODE_PACK   ((uint8_t)0x20)

Definition at line 43 of file tte_dcl.h.

#define TTE_DCL_OPCODE_REQ_ACK   ((uint8_t)0x10)

Definition at line 42 of file tte_dcl.h.

#define TTE_DCL_OPCODE_REQCFG   ((uint8_t)0x04)

Definition at line 40 of file tte_dcl.h.

#define TTE_DCL_OPCODE_SNDCFG   ((uint8_t)0x08)

Definition at line 41 of file tte_dcl.h.

#define TTE_DCL_PADDED_OFFSET   ((uint8_t)3)

Definition at line 50 of file tte_dcl.h.

#define TTE_DCL_PAYLOAD_OFFSET   ((uint8_t)1)

Definition at line 49 of file tte_dcl.h.

#define TTE_DCL_PERIOD_OFFSET   ((uint8_t)14)

Definition at line 61 of file tte_dcl.h.

#define TTE_DCL_REQUEST_DCL   (TTE_DCL_OPCODE_REQCFG)

Definition at line 94 of file tte_dcl.h.

#define TTE_DCL_RESERVED_OFFSET   ((uint8_t)28)

Definition at line 67 of file tte_dcl.h.

#define TTE_DCL_SCHED_BLOCK_LEN   ((uint8_t)8)

Definition at line 86 of file tte_dcl.h.

#define TTE_DCL_SCHED_BLOCK_OFFSET   ((uint8_t)40)

Definition at line 68 of file tte_dcl.h.

#define TTE_DCL_SCHED_ENTR_OFFSET   ((uint8_t)24)

Definition at line 65 of file tte_dcl.h.

#define TTE_DCL_SCHED_PARAM_OFFSET   ((uint8_t)5)

Definition at line 80 of file tte_dcl.h.

#define TTE_DCL_SCHED_RES_OFFSET   ((uint8_t)7)

Definition at line 81 of file tte_dcl.h.

#define TTE_DCL_SCHED_TIME_OFFSET   ((uint8_t)0)

Definition at line 78 of file tte_dcl.h.

#define TTE_DCL_SCHED_TYPE_OFFSET   ((uint8_t)4)

Definition at line 79 of file tte_dcl.h.

#define TTE_DCL_SEND_NEG_ACK   (TTE_DCL_OPCODE_NACK)

Definition at line 96 of file tte_dcl.h.

#define TTE_DCL_SEND_POS_ACK   (TTE_DCL_OPCODE_PACK)

Definition at line 95 of file tte_dcl.h.

#define TTE_DCL_SYNC_OFFSET   ((uint8_t)12)

Definition at line 59 of file tte_dcl.h.

#define TTE_DCL_TRUE   ((uint8_t)1)

Definition at line 91 of file tte_dcl.h.

#define TTE_DCL_TTE_RX_OFFSET   ((uint8_t)22)

Definition at line 64 of file tte_dcl.h.

#define TTE_DCL_TTE_TX_OFFSET   ((uint8_t)20)

Definition at line 63 of file tte_dcl.h.


Typedef Documentation

typedef int32_t tte_dcl_copy_data_buf_t

Definition at line 105 of file tte_dcl.h.

typedef uint8_t tte_dcl_data_buf_t

Definition at line 104 of file tte_dcl.h.

typedef uint16_t tte_dcl_data_len_t

Definition at line 106 of file tte_dcl.h.

typedef uint16_t tte_dcl_id_t

Definition at line 103 of file tte_dcl.h.


Function Documentation

int32_t tte_dcl_ack_funct ( eth_mac_addr_t *  ack_dst_mac,
uint16_t  ack_src_node_id,
uint8_t  ack_rsp 
)

Send a dynamic configuration loading (DCL) ACK frame.

Send a positive or negative DCL aknowlegment frame.

Parameters:
ack_dst_mac - pointer to the destination MAC address
ack_src_node_id - ID of the node.
ack_res - 0 for negative, other value than zero for positive acknowledgment
Returns:
  • Zero(0) - the operation is executed successfully.
  • ETT_ENOMEM - in case of no available place in the transmission
  • ETT_LINKLOST - in case the Ethernet link is lost.
  • ETT_NULLPTR - the data pointer, or the ack_dst_mac pointer is NULL.
  • ETT_FAILED - in case the operation fails for any other reason.
int32_t tte_dcl_check_configure ( uint8_t *  dcl_data,
tte_conf_t curr_config,
uint16_t  size 
)

Check TTE configuration for consistency.

Check the received configuration data for consistency. Check if TT-Tx and TT-RX messages are order according to the message ID. Check if scheduling action points are ordered according to the time offset. Check if enough Ethernet buffers are planned for the given configuration. Check if the WRAP action point is the last schedule action point.

Parameters:
dcl_data - pointer to the downloaded data
curr_config - pointer to the current configuration
size - size of the DCL data
Returns:
  • Zero(0) - the configuration is correct.
  • ETT_NULLPTR - the dcl_data pointer, or the curr_config pointer is NULL.
  • ETT_CONFIG - configuration is not correct
int32_t tte_dcl_prepare_data ( uint16_t  node_id,
uint8_t *  dcl_data,
uint16_t  size,
tte_conf_t dcl_config 
)

Prepare DCL data.

Write the data from a configuration structure (dcl_config) into the supplied data buffer (dcl_data).

Parameters:
node_id - ID of the node to which the configuratin will be send.
dcl_data - pointer to the supplied data buffer.
size - size of the supplied data buffer.
dcl_config - pointer to the configuration structure.
Returns:
  • integer number conteining the size of the configuration data bytes
  • ETT_NULLPTR - the dcl_data pointer, or the dcl_config pointer is NULL.
  • ETT_NOMEM in case that a configuration cannot fit in the supplied buffer size.
int32_t tte_dcl_process_frame ( tte_dcl_frame_t dcl_frame  ) 

Process received DCL frame.

Process a received DCL frame. Writes the status of the received download frame in the buffer provided by the application.

Parameters:
dcl_frame - pointer to received download frame.
Returns:
  • Zero(0) - the configuration is correct.
  • ETT_NULLPTR - the dcl_frame pointer is NULL.
  • ETT_INVPCF - receivd frame does not have the correct format.
int32_t tte_dcl_req_cfg ( uint16_t  src_node_id  ) 

Send a request for configuration,

The request need to be sent, either as broadcast message, or to the download master node.

Parameters:
src_node_id [in] - ID of the node to which the configuratin will be send.
Returns:
  • Zero(0) - the configuration is correct.
  • ETT_NOINIT - controller was not initialized via tte_init().
  • ETT_LOSTLINK - in case the Ethernet link is lost.
  • ETT_NOTSUPPORTED - the operation is not supported in this state
  • ETT_NOMEM - in case of no available place in the transmission queue for the required data.
  • ETT_FAILED - in case the operation fails for any other reason.
int32_t tte_dcl_send_cfg ( eth_mac_addr_t *  dest_mac,
uint16_t  src_node_id,
uint8_t *  dcl_data,
uint16_t  dcl_data_len,
uint8_t  req_ack 
)

Send DCL frame.

Send the DCL frame with the configuration data to the node

Parameters:
dest_mac - MAC address of node src_node_id.
src_node_id - ID of the node to which the configuratin will be send.
dcl_data - pointer to DCL data buffer to be sent
dcl_data_len - size of the DCL data to be sent (range:40-1460 bytes).
req_ack - request acknowledgment from the node upon reception of the DCL data. 0 - no ack required, value other than 0 - ack is required.
Returns:
  • Zero(0) - the configuration is correct.
  • ETT_NULLPTR - the dcl_data pointer or the dest_mac is NULL.
  • ETT_INVPARAM - invalid length of the dcl data buffer.
  • ETT_NULLPTR - the dcl_data pointer or the dest_mac is NULL.
  • ETT_NOINIT - controller was not initialized via tte_init().
  • ETT_LOSTLINK - in case the Ethernet link is lost.
  • ETT_NOTSUPPORTED - the operation is not supported in this state
  • ETT_NOMEM - in case of no available place in the transmission queue for the required data.
  • ETT_FAILED - in case the operation fails for any other reason.
int32_t tte_dcl_set_config ( uint8_t *  dcl_data,
tte_conf_t curr_config,
uint16_t  size 
)

Set DCL config.

Set the config parameters from the received DCL frame into the configuration data structure.

Parameters:
dcl_data - pointer to the received DCL data
curr_config - pointer to the current configuration
size - size of the received DCL data
Returns:
  • Zero(0) - the configuration is correct.
  • ETT_NULLPTR - the dcl_data pointer or the dcl_frame pointer is NULL.
  • ETT_INVPARAM - invalid length of the dcl data
  • ETT_NOINIT - controller was not initialized via tte_init().
  • ETT_LOSTLINK - in case the Ethernet link is lost.
  • ETT_FAILED - in case the operation fails for any other reason.
Generated on Tue Nov 29 14:09:19 2011 for TTEthernet Model for INET Framework by  doxygen 1.6.3