std_tlv.h

Common message types, result codes and payload data types for the Task-based TLV/INM (TTLV) communication module (task_tlv.h).  Also declares a standard set of logical registers for TLV/INM nodes, as well as helper macros that simplify implementation of the logical register interface.  Finally, there are some convenience functions for transmission of INM response messages.

CAUTION: The current logical register specification has bothersome and unnecessary limitations (e.g. all registers being one byte large) and is therefore being considered for compatibility-breaking replacement in a future release of libavr.

Summary
std_tlv.hCommon message types, result codes and payload data types for the Task-based TLV/INM (TTLV) communication module (task_tlv.h).
Message Types
Enumerations
TTLV Message Type IdentifiersNOTE: Application-specific message type identifiers SHOULD be greater than or equal to TTLV_MSG_T_APPLICATION.
Result Codes
Enumerations
TTLV Operation Result CodesNOTE: Application-specific result codes SHOULD be greater than or equal to TTLV_RES_APPLICATION and not equal to TTLV_RES_NONE.
Variables
ttlv_resultThe type of TTLV result codes.
ttlv_msg_inm_resultSpecifies the format of a generic INM response message.
Variables
result_codeIdentifies the result of the requested operation.
request_idIdentifies the request message.
Logical Registers
Variables
ttlv_reg_indexThe type of TTLV logical register identifiers.
ttlv_reg_valueThe type of TTLV logical register values.
ttlv_regpair_valueThe type of TTLV logical register pair values.
ttlv_msg_regSpecifies the format of an identifier-value pair for a logical register.
Variables
indexRegister identifier.
valueRegister value.
ttlv_msg_inm_regSpecifies the format of an identifier-value pair for a logical register, with an INM message ID appended.
Variables
indexRegister identifier.
valueRegister value.
request_idIdentifies the request message.
ttlv_msg_regpairSpecifies the format of an identifier-value pair for a logical register pair.
Variables
indexRegister identifier.
valueRegister pair value.
ttlv_msg_inm_regpairSpecifies the format of an identifier-value pair for a logical register pair, with an INM message ID appended.
Variables
indexRegister identifier.
valueRegister pair value.
request_idIdentifies the request message.
Message Lengths and Type Checking
Enumerations
Standard TTLV Message Lengths
Macros
TTLV_CHECK_RESULTTrue if and only if the current ttlv_recv_header matches a RESULT message with a ttlv_result payload.
TTLV_CHECK_INM_RESULTTrue if and only if the current ttlv_recv_header matches an INM_RESULT message with a ttlv_msg_inm_result payload.
TTLV_CHECK_REG_READTrue if and only if the current ttlv_recv_header matches a REG_READ message with a ttlv_reg_index payload.
TTLV_CHECK_REG_WRITETrue if and only if the current ttlv_recv_header matches a REG_WRITE message with a ttlv_msg_reg payload.
TTLV_CHECK_REG_TOGGLETrue if and only if the current ttlv_recv_header matches a REG_TOGGLE message with a ttlv_msg_reg payload.
TTLV_CHECK_REG_RW_EXCHTrue if and only if the current ttlv_recv_header matches a REG_RW_EXCH message with a ttlv_msg_reg payload.
TTLV_CHECK_REG_WR_EXCHTrue if and only if the current ttlv_recv_header matches a REG_WR_EXCH message with a ttlv_msg_reg payload.
TTLV_CHECK_REGPAIR_READTrue if and only if the current ttlv_recv_header matches a REGPAIR_READ message with a ttlv_reg_index payload.
TTLV_CHECK_REGPAIR_WRITETrue if and only if the current ttlv_recv_header matches a REGPAIR_WRITE message with a ttlv_msg_regpair payload.
TTLV_CHECK_REGPAIR_TOGGLETrue if and only if the current ttlv_recv_header matches a REGPAIR_TOGGLE message with a ttlv_msg_regpair payload.
TTLV_CHECK_REGPAIR_RW_EXCHTrue if and only if the current ttlv_recv_header matches a REGPAIR_RW_EXCH message with a ttlv_msg_regpair payload.
TTLV_CHECK_REGPAIR_WR_EXCHTrue if and only if the current ttlv_recv_header matches a REGPAIR_WR_EXCH message with a ttlv_msg_regpair payload.
Function Definition Macros
Functions
ttlv_reg_setterThe type of pointers to functions that set the value of a specified logical register.
ttlv_reg_manipulatorThe type of pointers to functions that perform some update operation on a specified logical register.
ttlv_regpair_setterThe type of pointers to functions that set the value of a specified logical register pair.
ttlv_regpair_manipulatorThe type of pointers to functions that perform some update operation on a specified logical register pair.
Macros
TTLV_STD_REG_TOGGLEDefines a static function that uses specified logical register read and write functions to implement the register toggle operation (R ^= V; ret R).
TTLV_STD_REG_RW_EXCHDefines a static function that uses specified logical register read and write functions to implement the register read-write operation (X = R; R = V; ret X).
TTLV_STD_REG_WR_EXCHDefines a static function that uses specified logical register read and write functions to implement the register write-read operation (R = V; ret R).
TTLV_STD_REGPAIR_READDefines a static function that uses a specified logical register read function to implement the register pair read operation (ret R).
TTLV_STD_REGPAIR_WRITEDefines a static function that uses a specified logical register write function to implement the register pair write operation (R = V).
TTLV_STD_REGPAIR_TOGGLEDefines a static function that uses specified logical register pair read and write functions to implement the register pair toggle operation (R ^= V; ret R).
TTLV_STD_REGPAIR_RW_EXCHDefines a static function that uses specified logical register pair read and write functions to implement the register pair read-write operation (X = R; R = V; ret X).
TTLV_STD_REGPAIR_WR_EXCHDefines a static function that uses specified logical register pair read and write functions to implement the register pair write-read operation (R = V; ret R).
API Functions
Functions
ttlv_xmit_responseConvenience function that uses ttlv_xmit to transmit a message.
ttlv_xmit_resultConvenience function that uses ttlv_xmit to transmit a TTLV_MSG_T_RESULT message.
ttlv_xmit_inm_resultConvenience function that uses ttlv_xmit to transmit a TTLV_MSG_T_INM_RESULT message.

Message Types

Summary
Enumerations
TTLV Message Type IdentifiersNOTE: Application-specific message type identifiers SHOULD be greater than or equal to TTLV_MSG_T_APPLICATION.

Enumerations

TTLV Message Type Identifiers

NOTE: Application-specific message type identifiers SHOULD be greater than or equal to TTLV_MSG_T_APPLICATION.

TTLV_MSG_T_DEFAULTDefault message type.
TTLV_MSG_T_RESULTGeneric TLV operation response (result code).
TTLV_MSG_T_INM_RESULTGeneric INM operation response (result code and request ID).
TTLV_MSG_T_REG_READLogical register read request.
TTLV_MSG_T_REG_READ_RESLogical TLV register read response.
TTLV_MSG_T_INM_REG_READ_RESLogical INM register read response (with request ID).
TTLV_MSG_T_REG_WRITELogical register write (R = V) request.
TTLV_MSG_T_REG_TOGGLELogical register toggle (R ^= V; ret R) request.
TTLV_MSG_T_REG_RW_EXCHLogical register read-write (X = R; R = V; ret X) request.
TTLV_MSG_T_REG_WR_EXCHLogical register write-read (R = V; ret R) request.
TTLV_MSG_T_REGPAIR_READLogical register pair read (ret R) request.
TTLV_MSG_T_REGPAIR_READ_RESLogical TLV register pair read response.
TTLV_MSG_T_INM_REGPAIR_READ_RESLogical INM register pair read response (with request ID).
TTLV_MSG_T_REGPAIR_WRITELogical register pair write request.
TTLV_MSG_T_REGPAIR_TOGGLELogical register pair toggle request.
TTLV_MSG_T_REGPAIR_RW_EXCHLogical register pair read-write request.
TTLV_MSG_T_REGPAIR_WR_EXCHLogical register pair write-read request.
TTLV_MSG_T_MEMMON_DATAMemory monitor notification.  Variable-length message.
TTLV_MSG_T_MEMMON_CTRLMemory monitor control request.  Not implemented.
TTLV_MSG_T_APPLICATIONStart of application-specific identifier range.

Result Codes

Summary
Enumerations
TTLV Operation Result CodesNOTE: Application-specific result codes SHOULD be greater than or equal to TTLV_RES_APPLICATION and not equal to TTLV_RES_NONE.
Variables
ttlv_resultThe type of TTLV result codes.

Enumerations

TTLV Operation Result Codes

NOTE: Application-specific result codes SHOULD be greater than or equal to TTLV_RES_APPLICATION and not equal to TTLV_RES_NONE.

TTLV_RES_OKRequest successfully handled.
TTLV_RES_TYPEError: Unrecognized message type.
TTLV_RES_LENGTHError: Invalid message length.
TTLV_RES_REGISTERError: Message specified unrecognized logical register.
TTLV_RES_NOT_IMPLEMENTEDError: Message recognized but cannot be handled.
TTLV_RES_APPLICATIONStart of application-specific result code range.
TTLV_RES_NONEInvalid result code.

Variables

ttlv_result

typedef uint8_t ttlv_result

The type of TTLV result codes.

ttlv_msg_inm_result

typedef struct __attribute__ ((__packed__)) ttlv_msg_inm_result

Specifies the format of a generic INM response message.

Summary
Variables
result_codeIdentifies the result of the requested operation.
request_idIdentifies the request message.

Variables

result_code

ttlv_result result_code

Identifies the result of the requested operation.

request_id

uint16_t request_id

Identifies the request message.

Logical Registers

Summary
Variables
ttlv_reg_indexThe type of TTLV logical register identifiers.
ttlv_reg_valueThe type of TTLV logical register values.
ttlv_regpair_valueThe type of TTLV logical register pair values.

Variables

ttlv_reg_index

typedef uint8_t ttlv_reg_index

The type of TTLV logical register identifiers.

NOTE: These identifiers do NOT necessarily correspond to ATmega RAM or I/O addresses.  Their meaning is application-specific.

ttlv_reg_value

typedef uint8_t ttlv_reg_value

The type of TTLV logical register values.

ttlv_regpair_value

typedef uint16_t ttlv_regpair_value

The type of TTLV logical register pair values.

ttlv_msg_reg

typedef struct __attribute__ ((__packed__)) ttlv_msg_reg

Specifies the format of an identifier-value pair for a logical register.  Such pairs are the payloads of register write requests and register read responses.

Summary
Variables
indexRegister identifier.
valueRegister value.

Variables

index

ttlv_reg_index index

Register identifier.

value

ttlv_reg_value value

Register value.

ttlv_msg_inm_reg

typedef struct __attribute__ ((__packed__)) ttlv_msg_inm_reg

Specifies the format of an identifier-value pair for a logical register, with an INM message ID appended.  Such triples are the payloads of register read responses in INM applications.

Summary
Variables
indexRegister identifier.
valueRegister value.
request_idIdentifies the request message.

Variables

index

ttlv_reg_index index

Register identifier.

value

ttlv_reg_value value

Register value.

request_id

uint16_t request_id

Identifies the request message.

ttlv_msg_regpair

typedef struct __attribute__ ((__packed__)) ttlv_msg_regpair

Specifies the format of an identifier-value pair for a logical register pair.  Such pairs are the payloads of register pair write requests and register pair read responses.

Summary
Variables
indexRegister identifier.
valueRegister pair value.

Variables

index

ttlv_reg_index index

Register identifier.

value

ttlv_regpair_value value

Register pair value.  The value of the lower register (i.e. the one with the lesser register identifier) is in the least significant byte and the value of the higher register is in the most significant byte.

ttlv_msg_inm_regpair

typedef struct __attribute__ ((__packed__)) ttlv_msg_inm_regpair

Specifies the format of an identifier-value pair for a logical register pair, with an INM message ID appended.  Such triples are the payloads of register pair read responses in INM applications.

Summary
Variables
indexRegister identifier.
valueRegister pair value.
request_idIdentifies the request message.

Variables

index

ttlv_reg_index index

Register identifier.

value

ttlv_regpair_value value

Register pair value.  The value of the lower register (i.e. the one with the lesser register identifier) is in the least significant byte and the value of the higher register is in the most significant byte.

request_id

uint16_t request_id

Identifies the request message.

Message Lengths and Type Checking

Summary
Enumerations
Standard TTLV Message Lengths
Macros
TTLV_CHECK_RESULTTrue if and only if the current ttlv_recv_header matches a RESULT message with a ttlv_result payload.
TTLV_CHECK_INM_RESULTTrue if and only if the current ttlv_recv_header matches an INM_RESULT message with a ttlv_msg_inm_result payload.
TTLV_CHECK_REG_READTrue if and only if the current ttlv_recv_header matches a REG_READ message with a ttlv_reg_index payload.
TTLV_CHECK_REG_WRITETrue if and only if the current ttlv_recv_header matches a REG_WRITE message with a ttlv_msg_reg payload.
TTLV_CHECK_REG_TOGGLETrue if and only if the current ttlv_recv_header matches a REG_TOGGLE message with a ttlv_msg_reg payload.
TTLV_CHECK_REG_RW_EXCHTrue if and only if the current ttlv_recv_header matches a REG_RW_EXCH message with a ttlv_msg_reg payload.
TTLV_CHECK_REG_WR_EXCHTrue if and only if the current ttlv_recv_header matches a REG_WR_EXCH message with a ttlv_msg_reg payload.
TTLV_CHECK_REGPAIR_READTrue if and only if the current ttlv_recv_header matches a REGPAIR_READ message with a ttlv_reg_index payload.
TTLV_CHECK_REGPAIR_WRITETrue if and only if the current ttlv_recv_header matches a REGPAIR_WRITE message with a ttlv_msg_regpair payload.
TTLV_CHECK_REGPAIR_TOGGLETrue if and only if the current ttlv_recv_header matches a REGPAIR_TOGGLE message with a ttlv_msg_regpair payload.
TTLV_CHECK_REGPAIR_RW_EXCHTrue if and only if the current ttlv_recv_header matches a REGPAIR_RW_EXCH message with a ttlv_msg_regpair payload.
TTLV_CHECK_REGPAIR_WR_EXCHTrue if and only if the current ttlv_recv_header matches a REGPAIR_WR_EXCH message with a ttlv_msg_regpair payload.

Enumerations

Standard TTLV Message Lengths

TTLV_MSG_L_RESULTTLV length of a TTLV_MSG_T_RESULT message.
TTLV_MSG_L_INM_RESULTTLV length of a TTLV_MSG_T_INM_RESULT message.
TTLV_MSG_L_REG_READTLV length of a TTLV_MSG_T_REG_READ message.
TTLV_MSG_L_REG_READ_RESTLV length of a TTLV_MSG_T_REG_READ_RES message.
TTLV_MSG_L_INM_REG_READ_RESTLV length of a TTLV_MSG_T_INM_REG_READ_RES message.
TTLV_MSG_L_REG_WRITETLV length of a TTLV_MSG_T_REG_WRITE message.
TTLV_MSG_L_REG_TOGGLETLV length of a TTLV_MSG_T_REG_TOGGLE message.
TTLV_MSG_L_REG_RW_EXCHTLV length of a TTLV_MSG_T_REG_RW_EXCH message.
TTLV_MSG_L_REG_WR_EXCHTLV length of a TTLV_MSG_T_REG_WR_EXCH message.
TTLV_MSG_L_REGPAIR_READTLV length of a TTLV_MSG_T_REGPAIR_READ message.
TTLV_MSG_L_REGPAIR_READ_RESTLV length of a TTLV_MSG_T_REGPAIR_READ_RES message.
TTLV_MSG_L_INM_REGPAIR_READ_RESTLV length of a TTLV_MSG_T_INM_REGPAIR_READ_RES message.
TTLV_MSG_L_REGPAIR_WRITETLV length of a TTLV_MSG_T_REGPAIR_WRITE message.
TTLV_MSG_L_REGPAIR_TOGGLETLV length of a TTLV_MSG_T_REGPAIR_TOGGLE message.
TTLV_MSG_L_REGPAIR_RW_EXCHTLV length of a TTLV_MSG_T_REGPAIR_RW_EXCH message.
TTLV_MSG_L_REGPAIR_WR_EXCHTLV length of a TTLV_MSG_T_REGPAIR_WR_EXCH message.

Macros

TTLV_CHECK_RESULT

True if and only if the current ttlv_recv_header matches a RESULT message with a ttlv_result payload.  Expression macro.

TTLV_CHECK_INM_RESULT

True if and only if the current ttlv_recv_header matches an INM_RESULT message with a ttlv_msg_inm_result payload.  Expression macro.

TTLV_CHECK_REG_READ

True if and only if the current ttlv_recv_header matches a REG_READ message with a ttlv_reg_index payload.  Expression macro.

TTLV_CHECK_REG_WRITE

True if and only if the current ttlv_recv_header matches a REG_WRITE message with a ttlv_msg_reg payload.  Expression macro.

TTLV_CHECK_REG_TOGGLE

True if and only if the current ttlv_recv_header matches a REG_TOGGLE message with a ttlv_msg_reg payload.  Expression macro.

TTLV_CHECK_REG_RW_EXCH

True if and only if the current ttlv_recv_header matches a REG_RW_EXCH message with a ttlv_msg_reg payload.  Expression macro.

TTLV_CHECK_REG_WR_EXCH

True if and only if the current ttlv_recv_header matches a REG_WR_EXCH message with a ttlv_msg_reg payload.  Expression macro.

TTLV_CHECK_REGPAIR_READ

True if and only if the current ttlv_recv_header matches a REGPAIR_READ message with a ttlv_reg_index payload.  Expression macro.

TTLV_CHECK_REGPAIR_WRITE

True if and only if the current ttlv_recv_header matches a REGPAIR_WRITE message with a ttlv_msg_regpair payload.  Expression macro.

TTLV_CHECK_REGPAIR_TOGGLE

True if and only if the current ttlv_recv_header matches a REGPAIR_TOGGLE message with a ttlv_msg_regpair payload.  Expression macro.

TTLV_CHECK_REGPAIR_RW_EXCH

True if and only if the current ttlv_recv_header matches a REGPAIR_RW_EXCH message with a ttlv_msg_regpair payload.  Expression macro.

TTLV_CHECK_REGPAIR_WR_EXCH

True if and only if the current ttlv_recv_header matches a REGPAIR_WR_EXCH message with a ttlv_msg_regpair payload.  Expression macro.

Function Definition Macros

Summary
Functions
ttlv_reg_setterThe type of pointers to functions that set the value of a specified logical register.
ttlv_reg_manipulatorThe type of pointers to functions that perform some update operation on a specified logical register.
ttlv_regpair_setterThe type of pointers to functions that set the value of a specified logical register pair.
ttlv_regpair_manipulatorThe type of pointers to functions that perform some update operation on a specified logical register pair.
Macros
TTLV_STD_REG_TOGGLEDefines a static function that uses specified logical register read and write functions to implement the register toggle operation (R ^= V; ret R).
TTLV_STD_REG_RW_EXCHDefines a static function that uses specified logical register read and write functions to implement the register read-write operation (X = R; R = V; ret X).
TTLV_STD_REG_WR_EXCHDefines a static function that uses specified logical register read and write functions to implement the register write-read operation (R = V; ret R).
TTLV_STD_REGPAIR_READDefines a static function that uses a specified logical register read function to implement the register pair read operation (ret R).
TTLV_STD_REGPAIR_WRITEDefines a static function that uses a specified logical register write function to implement the register pair write operation (R = V).
TTLV_STD_REGPAIR_TOGGLEDefines a static function that uses specified logical register pair read and write functions to implement the register pair toggle operation (R ^= V; ret R).
TTLV_STD_REGPAIR_RW_EXCHDefines a static function that uses specified logical register pair read and write functions to implement the register pair read-write operation (X = R; R = V; ret X).
TTLV_STD_REGPAIR_WR_EXCHDefines a static function that uses specified logical register pair read and write functions to implement the register pair write-read operation (R = V; ret R).

Functions

ttlv_reg_setter

typedef ttlv_result (
   *ttlv_reg_setter
)(ttlv_reg_index index, ttlv_reg_value value)

The type of pointers to functions that set the value of a specified logical register.

Parameters

indexIdentifier of the target logical register.
valueThe new register value.

Returns

A ttlv_result indicating the outcome of the attempted register operation.

ttlv_reg_manipulator

typedef ttlv_result (
   *ttlv_reg_manipulator
)(ttlv_reg_index index, ttlv_reg_value *value_p)

The type of pointers to functions that perform some update operation on a specified logical register.

Parameters

indexIdentifier of the target logical register.
value_pPointer to a register value.  Used both to receive the input value and to return the output value.

Returns

A ttlv_result indicating the outcome of the attempted register operation.

ttlv_regpair_setter

typedef ttlv_result (
   *ttlv_regpair_setter
)(ttlv_reg_index index, ttlv_regpair_value value)

The type of pointers to functions that set the value of a specified logical register pair.

Parameters

indexIdentifier of the lower half of the target logical register pair.
valueThe new register pair value.

Returns

A ttlv_result indicating the outcome of the attempted register operation.

ttlv_regpair_manipulator

typedef ttlv_result (
   *ttlv_regpair_manipulator
)(ttlv_reg_index index, ttlv_regpair_value *value_p)

The type of pointers to functions that perform some update operation on a specified logical register pair.

Parameters

indexIdentifier of the lower half of the target logical register pair.
value_pPointer to a register pair value.  Used both to receive the input value and to return the output value.

Returns

A ttlv_result indicating the outcome of the attempted register operation.

Macros

TTLV_STD_REG_TOGGLE

Defines a static function that uses specified logical register read and write functions to implement the register toggle operation (R ^= V; ret R).  Function definition macro.

Parameters

RFName of a ttlv_reg_manipulator that implements the read operation.
WFName of a ttlv_reg_setter that implements the write operation.
DFName of the emitted register toggle function.

Returns

Emits a definition of a static ttlv_reg_manipulator function that implements the register toggle operation.

TTLV_STD_REG_RW_EXCH

Defines a static function that uses specified logical register read and write functions to implement the register read-write operation (X = R; R = V; ret X).  Function definition macro.

Parameters

RFName of a ttlv_reg_manipulator that implements the read operation.
WFName of a ttlv_reg_setter that implements the write operation.
DFName of the emitted register read-write function.

Returns

Emits a definition of a ttlv_reg_manipulator function that implements the register read-write operation.

TTLV_STD_REG_WR_EXCH

Defines a static function that uses specified logical register read and write functions to implement the register write-read operation (R = V; ret R).  Function definition macro.

Parameters

RFName of a ttlv_reg_manipulator that implements the read operation.
WFName of a ttlv_reg_setter that implements the write operation.
DFName of the emitted register write-read function.

Returns

Emits a definition of a static ttlv_reg_manipulator function that implements the register write-read operation.

TTLV_STD_REGPAIR_READ

Defines a static function that uses a specified logical register read function to implement the register pair read operation (ret R).  Function definition macro.

Parameters

RFName of a ttlv_reg_manipulator that implements the read operation.
DFName of the emitted register pair read function.

Returns

Emits a definition of a static ttlv_regpair_manipulator function that implements the register pair read operation.

TTLV_STD_REGPAIR_WRITE

Defines a static function that uses a specified logical register write function to implement the register pair write operation (R = V).  Function definition macro.

Parameters

WFName of a ttlv_reg_setter that implements the write operation.
DFName of the emitted register pair write function.

Returns

Emits a definition of a static ttlv_regpair_setter function that implements the register pair write operation.

TTLV_STD_REGPAIR_TOGGLE

Defines a static function that uses specified logical register pair read and write functions to implement the register pair toggle operation (R ^= V; ret R).  Function definition macro.

Parameters

RFName of a ttlv_regpair_manipulator that implements the read operation.
WFName of a ttlv_regpair_setter that implements the write operation.
DFName of the emitted register pair toggle function.

Returns

Emits a definition of a static ttlv_regpair_manipulator function that implements the register pair toggle operation.

TTLV_STD_REGPAIR_RW_EXCH

Defines a static function that uses specified logical register pair read and write functions to implement the register pair read-write operation (X = R; R = V; ret X).  Function definition macro.

Parameters

RFName of a ttlv_regpair_manipulator that implements the read operation.
WFName of a ttlv_regpair_setter that implements the write operation.
DFName of the emitted register pair read-write function.

Returns

Emits a definition of a static ttlv_regpair_manipulator function that implements the register pair read-write operation.

TTLV_STD_REGPAIR_WR_EXCH

Defines a static function that uses specified logical register pair read and write functions to implement the register pair write-read operation (R = V; ret R).  Function definition macro.

Parameters

RFName of a ttlv_regpair_manipulator that implements the read operation.
WFName of a ttlv_regpair_setter that implements the write operation.
DFName of the emitted register pair write-read function.

Returns

Emits a definition of a static ttlv_regpair_manipulator function that implements the register pair write-read operation.

API Functions

Summary
Functions
ttlv_xmit_responseConvenience function that uses ttlv_xmit to transmit a message.
ttlv_xmit_resultConvenience function that uses ttlv_xmit to transmit a TTLV_MSG_T_RESULT message.
ttlv_xmit_inm_resultConvenience function that uses ttlv_xmit to transmit a TTLV_MSG_T_INM_RESULT message.

Functions

ttlv_xmit_response

ttlv_state ttlv_xmit_response(uint8_t type,
uint8_t length,
const uint8_t *data_p)

Convenience function that uses ttlv_xmit to transmit a message.  The INM destination address will be copied from the srcadr field of ttlv_recv_inm_header (assumed to contain the address of the source of the most recently received request).

Parameters

typeTLV type identifier of the message to transmit.
lengthTLV length of the message to transmit.
data_pPointer to the data bytes (TLV value) of the message to transmit.

Returns

An integer result code, which will be an error code if and only if the attempt to initiate transmission failed.

ttlv_xmit_result

ttlv_state ttlv_xmit_result(ttlv_result res)

Convenience function that uses ttlv_xmit to transmit a TTLV_MSG_T_RESULT message.  The INM destination address will be copied from the srcadr field of ttlv_recv_inm_header (assumed to contain the address of the source of the most recently received request).

Parameters

resThe result code to send in the TTLV_MSG_T_RESULT message.

Returns

An integer result code, which will be an error code if and only if the attempt to initiate transmission failed.

ttlv_xmit_inm_result

ttlv_state ttlv_xmit_inm_result(ttlv_result res)

Convenience function that uses ttlv_xmit to transmit a TTLV_MSG_T_INM_RESULT message.  The INM destination address and request ID in the transmitted message will be copied from the srcadr and msg_id fields of ttlv_recv_inm_header (assumed to contain the source address and message ID of the most recently received request).

Parameters

resThe result code to send in the TTLV_MSG_T_INM_RESULT message.

Returns

An integer result code, which will be an error code if and only if the attempt to initiate transmission failed.

Task-based TLV (TTLV) communication module for ATmega microcontrollers.
typedef uint8_t ttlv_result
The type of TTLV result codes.
typedef struct __attribute__ ((__packed__)) ttlv_msg_inm_result
Specifies the format of a generic INM response message.
ttlv_result result_code
Identifies the result of the requested operation.
uint16_t request_id
Identifies the request message.
typedef uint8_t ttlv_reg_index
The type of TTLV logical register identifiers.
typedef uint8_t ttlv_reg_value
The type of TTLV logical register values.
typedef uint16_t ttlv_regpair_value
The type of TTLV logical register pair values.
typedef struct __attribute__ ((__packed__)) ttlv_msg_reg
Specifies the format of an identifier-value pair for a logical register.
ttlv_reg_index index
Register identifier.
ttlv_reg_value value
Register value.
typedef struct __attribute__ ((__packed__)) ttlv_msg_inm_reg
Specifies the format of an identifier-value pair for a logical register, with an INM message ID appended.
ttlv_reg_index index
Register identifier.
ttlv_reg_value value
Register value.
uint16_t request_id
Identifies the request message.
typedef struct __attribute__ ((__packed__)) ttlv_msg_regpair
Specifies the format of an identifier-value pair for a logical register pair.
ttlv_reg_index index
Register identifier.
ttlv_regpair_value value
Register pair value.
typedef struct __attribute__ ((__packed__)) ttlv_msg_inm_regpair
Specifies the format of an identifier-value pair for a logical register pair, with an INM message ID appended.
ttlv_reg_index index
Register identifier.
ttlv_regpair_value value
Register pair value.
uint16_t request_id
Identifies the request message.
extern ttlv_header ttlv_recv_header
Contains the most recently received TLV header.
typedef ttlv_result (
   *ttlv_reg_setter
)(ttlv_reg_index index, ttlv_reg_value value)
The type of pointers to functions that set the value of a specified logical register.
typedef ttlv_result (
   *ttlv_reg_manipulator
)(ttlv_reg_index index, ttlv_reg_value *value_p)
The type of pointers to functions that perform some update operation on a specified logical register.
typedef ttlv_result (
   *ttlv_regpair_setter
)(ttlv_reg_index index, ttlv_regpair_value value)
The type of pointers to functions that set the value of a specified logical register pair.
typedef ttlv_result (
   *ttlv_regpair_manipulator
)(ttlv_reg_index index, ttlv_regpair_value *value_p)
The type of pointers to functions that perform some update operation on a specified logical register pair.
ttlv_state ttlv_xmit_response(uint8_t type,
uint8_t length,
const uint8_t *data_p)
Convenience function that uses ttlv_xmit to transmit a message.
ttlv_state ttlv_xmit(uint8_t dstadr,
uint8_t type,
uint8_t length,
const uint8_t *data_p)
Initiates transmission of a specified message or clears the transmit buffer.
ttlv_state ttlv_xmit_result(ttlv_result res)
Convenience function that uses ttlv_xmit to transmit a TTLV_MSG_T_RESULT message.
Generic TLV operation response (result code).
ttlv_state ttlv_xmit_inm_result(ttlv_result res)
Convenience function that uses ttlv_xmit to transmit a TTLV_MSG_T_INM_RESULT message.
Generic INM operation response (result code and request ID).
Logical register read request.
Logical TLV register read response.
Logical INM register read response (with request ID).
Logical register write (R = V) request.
Logical register toggle (R ^= V; ret R) request.
Logical register read-write (X = R; R = V; ret X) request.
Logical register write-read (R = V; ret R) request.
Logical register pair read (ret R) request.
Logical TLV register pair read response.
Logical INM register pair read response (with request ID).
Logical register pair write request.
Logical register pair toggle request.
Logical register pair read-write request.
Logical register pair write-read request.
extern ttlv_inm_header ttlv_recv_inm_header
Contains the most recently received INM header.
Close