16 #ifdef __MSP430_HAS_TLV__
21 void TLV_getInfo(uint8_t tag,
24 uint16_t **data_address
28 char *TLV_address = (
char *)TLV_START;
30 while((TLV_address < (
char *)TLV_END)
31 && ((*TLV_address != tag) || instance)
32 && (*TLV_address != TLV_TAGEND))
34 if (*TLV_address == tag)
40 TLV_address += *(TLV_address + 1) + 2;
44 if (*TLV_address == tag)
47 *length = *(TLV_address + 1);
49 *data_address = (uint16_t *)(TLV_address + 2);
61 uint16_t TLV_getDeviceType()
63 uint16_t *pDeviceType = (uint16_t *)TLV_DEVICE_ID_0;
65 return pDeviceType[0];
68 uint16_t TLV_getMemory(uint8_t instance)
79 TLV_getInfo(TLV_PDTAG,
86 for (count = 0; count <= instance; count += 2)
88 if (pPDTAG[count] == 0)
93 if (count == instance)
95 return (pPDTAG[count] | pPDTAG[count+1]<<8);
104 uint16_t TLV_getPeripheral(uint8_t tag,
109 uint8_t bPDTAG_bytes;
114 TLV_getInfo(TLV_PDTAG,
122 while (TLV_getMemory(count))
127 pcount = pPDTAG[count * 2 + 1];
138 for (count = 0; count <= pcount; count += 2)
140 if (pPDTAG[count+1] == tag)
151 return (pPDTAG[count] | pPDTAG[count + 1] << 8);
161 uint8_t TLV_getInterrupt(uint8_t tag)
164 uint8_t bPDTAG_bytes;
169 TLV_getInfo(TLV_PDTAG,
177 while (TLV_getMemory(count))
182 pcount = pPDTAG[count * 2 + 1];
186 pPDTAG += (pcount + count) * 2;
191 for (count = 0; count <= tag; count += 2)
193 if (pPDTAG[count] == 0)
201 return (pPDTAG[count]);