69 lines
1.1 KiB
C
69 lines
1.1 KiB
C
#include "uds_did.h"
|
|
#include <stddef.h>
|
|
|
|
const uint16_t DIDOffset[] = {
|
|
DID_FOREACH(GENERATE_DID_OFFSETS)
|
|
};
|
|
|
|
const uint8_t DIDSize[] = {
|
|
DID_FOREACH(GENERATE_DID_SIZE)
|
|
};
|
|
|
|
const uint16_t DIDId[] = {
|
|
DID_FOREACH(GENERATE_DID_ID)
|
|
};
|
|
|
|
const uint8_t DIDIsStoreInFlashTable[] = {
|
|
DID_FOREACH(GENERATE_DID_STORE_FLAG)
|
|
};
|
|
|
|
const uint16_t DIDStoreInFlashOffset[] = {
|
|
DID_FOREACH(GENERATE_DID_STORE_IN_FLASH_OFFSETS)
|
|
};
|
|
|
|
const uint16_t DIDStoreInFlashSize[] = {
|
|
DID_FOREACH(GENERATE_DID_STORE_IN_FLASH_SIZE)
|
|
};
|
|
|
|
const uint16_t DIDStoreInFlashId[] = {
|
|
DID_FOREACH(GENERATE_DID_STORE_IN_FLASH_ID)
|
|
};
|
|
|
|
|
|
uint8_t GetDIDIndexByID(uint16_t id)
|
|
{
|
|
uint8_t ret = 0xFF;
|
|
uint8_t i;
|
|
|
|
for( i = 0; i < sizeof(DIDId)/sizeof(uint16_t); i++)
|
|
{
|
|
if (DIDId[i] == id)
|
|
{
|
|
ret = i;
|
|
break;
|
|
}
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
|
|
uint8_t GetDIDStoreInFlashIndexByID(uint16_t id)
|
|
{
|
|
uint8_t ret = 0xFF;
|
|
uint8_t i;
|
|
|
|
for( i = 0; i < sizeof(DIDStoreInFlashId)/sizeof(uint16_t); i++)
|
|
{
|
|
if (DIDStoreInFlashId[i] == id)
|
|
{
|
|
ret = i;
|
|
break;
|
|
}
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
|