Functions | |
void | TLV_getInfo (uint8_t tag, uint8_t instance, uint8_t *length, uint16_t **data_address) |
Gets TLV Info. More... | |
uint16_t | TLV_getDeviceType () |
Retrieves the unique device ID from the TLV structure. More... | |
uint16_t | TLV_getMemory (uint8_t instance) |
Gets memory information. More... | |
uint16_t | TLV_getPeripheral (uint8_t tag, uint8_t instance) |
Gets peripheral information from the TLV. More... | |
uint8_t | TLV_getInterrupt (uint8_t tag) |
Get interrupt information from the TLV. More... | |
uint16_t TLV_getDeviceType | ( | void | ) |
Retrieves the unique device ID from the TLV structure.
void TLV_getInfo | ( | uint8_t | tag, |
uint8_t | instance, | ||
uint8_t * | length, | ||
uint16_t ** | data_address | ||
) |
Gets TLV Info.
The TLV structure uses a tag or base address to identify segments of the table where information is stored. Some examples of TLV tags are Peripheral Descriptor, Interrupts, Info Block and Die Record. This function retrieves the value of a tag and the length of the tag.
tag | represents the tag for which the information needs to be retrieved. Valid values are:
|
instance | In some cases a specific tag may have more than one instance. For example there may be multiple instances of timer calibration data present under a single Timer Cal tag. This variable specifies the instance for which information is to be retrieved (0, 1, etc.). When only one instance exists; 0 is passed. |
length | Acts as a return through indirect reference. The function retrieves the value of the TLV tag length. This value is pointed to by *length and can be used by the application level once the function is called. If the specified tag is not found then the pointer is null 0. |
data_address | acts as a return through indirect reference. Once the function is called data_address points to the pointer that holds the value retrieved from the specified TLV tag. If the specified tag is not found then the pointer is null 0. |
Referenced by TLV_getInterrupt(), TLV_getMemory(), and TLV_getPeripheral().
uint8_t TLV_getInterrupt | ( | uint8_t | tag | ) |
Get interrupt information from the TLV.
This function is used to retrieve information on available interrupt vectors. It allows the user to check if a specific interrupt vector is defined in a given device.
tag | represents the tag for the interrupt vector. Interrupt vector tags number from 0 to N depending on the number of available interrupts. Refer to the device datasheet for a list of available interrupts. |
References TLV_getInfo(), and TLV_getMemory().
uint16_t TLV_getMemory | ( | uint8_t | instance | ) |
Gets memory information.
The Peripheral Descriptor tag is split into two portions a list of the available flash memory blocks followed by a list of available peripherals. This function is used to parse through the first portion and calculate the total flash memory available in a device. The typical usage is to call the TLV_getMemory which returns a non-zero value until the entire memory list has been parsed. When a zero is returned, it indicates that all the memory blocks have been counted and the next address holds the beginning of the device peripheral list.
instance | In some cases a specific tag may have more than one instance. This variable specifies the instance for which information is to be retrieved (0, 1 etc). When only one instance exists; 0 is passed. |
References TLV_getInfo().
Referenced by TLV_getInterrupt(), and TLV_getPeripheral().
uint16_t TLV_getPeripheral | ( | uint8_t | tag, |
uint8_t | instance | ||
) |
Gets peripheral information from the TLV.
he Peripheral Descriptor tag is split into two portions a list of the available flash memory blocks followed by a list of available peripherals. This function is used to parse through the second portion and can be used to check if a specific peripheral is present in a device. The function calls TLV_getPeripheral() recursively until the end of the memory list and consequently the beginning of the peripheral list is reached. <
tag | represents represents the tag for a specific peripheral for which the information needs to be retrieved. In the header file tlv. h specific peripheral tags are pre-defined, for example USCIA_B and TA0 are defined as TLV_PID_USCI_AB and TLV_PID_TA2 respectively. Valid values are:
|
instance | In some cases a specific tag may have more than one instance. For example a device may have more than a single USCI module, each of which is defined by an instance number 0, 1, 2, etc. When only one instance exists; 0 is passed. |
References TLV_getInfo(), and TLV_getMemory().