#include "bsp_number.h" typedef struct { uint16_t type : NUMBER_TYPE_LEN; uint16_t appl : NUMBER_APPL_LEN; uint16_t ver : NUMBER_VER_LEN; uint16_t detal : NUMBER_DETAIL_LEN; }ProductNumber; typedef struct { uint16_t len; const uint16_t *dev_list; }ProNumArray; const uint16_t bsu_dev_list[] = { NUMBER_ASSEMBLE(NUMBER_TYPE_BSU, NUMBER_APPL_E, NUMBER_VER_B, NUMBER_BSU_1), //0x0100 NUMBER_ASSEMBLE(NUMBER_TYPE_BSU, NUMBER_APPL_E, NUMBER_VER_C, NUMBER_BSU_1), //0x0200 NUMBER_ASSEMBLE(NUMBER_TYPE_BSU, NUMBER_APPL_E, NUMBER_VER_C, NUMBER_BSU_2), //0x8200 }; const uint16_t bcu_dev_list[] = { NUMBER_ASSEMBLE(NUMBER_TYPE_BCU, NUMBER_APPL_E, NUMBER_VER_B, NUMBER_BCU_1B), //0x0101 NUMBER_ASSEMBLE(NUMBER_TYPE_BCU, NUMBER_APPL_E, NUMBER_VER_B, NUMBER_BCU_2B), //0x2101 NUMBER_ASSEMBLE(NUMBER_TYPE_BCU, NUMBER_APPL_E, NUMBER_VER_C, NUMBER_BCU_1B), //0x0201 }; const uint16_t bmu_dev_list[] = { NUMBER_ASSEMBLE(NUMBER_TYPE_BMU, NUMBER_APPL_E, NUMBER_VER_B, NUMBER_BMU_16), //0x0102 NUMBER_ASSEMBLE(NUMBER_TYPE_BMU, NUMBER_APPL_E, NUMBER_VER_B, NUMBER_BMU_32), //0x2102 NUMBER_ASSEMBLE(NUMBER_TYPE_BMU, NUMBER_APPL_E, NUMBER_VER_B, NUMBER_BMU_48), //0x4102 NUMBER_ASSEMBLE(NUMBER_TYPE_BMU, NUMBER_APPL_E, NUMBER_VER_B, NUMBER_BMU_64), //0x6102 NUMBER_ASSEMBLE(NUMBER_TYPE_BMU, NUMBER_APPL_E, NUMBER_VER_B, NUMBER_BMU_22), //0x8102 NUMBER_ASSEMBLE(NUMBER_TYPE_BMU, NUMBER_APPL_E, NUMBER_VER_C, NUMBER_BMU_16), //0x0202 NUMBER_ASSEMBLE(NUMBER_TYPE_BMU, NUMBER_APPL_E, NUMBER_VER_F, NUMBER_BMU_16), //0x0502 NUMBER_ASSEMBLE(NUMBER_TYPE_BMU, NUMBER_APPL_E, NUMBER_VER_F, NUMBER_BMU_32), //0x2502 NUMBER_ASSEMBLE(NUMBER_TYPE_BMU, NUMBER_APPL_E, NUMBER_VER_F, NUMBER_BMU_22), //0x8502 }; const ProNumArray pro_num_array[kDevType_End] = { {sizeof(bsu_dev_list) / 2, bsu_dev_list}, {sizeof(bcu_dev_list) / 2, bcu_dev_list}, {sizeof(bmu_dev_list) / 2, bmu_dev_list}, }; uint16_t bsp_num_get_product_num(DevType type, uint16_t num) { uint32_t i; if(type < kDevType_End) { for(i = 0; i < pro_num_array[type].len; i++) { if(num == pro_num_array[type].dev_list[i]) { return num; } } return pro_num_array[type].dev_list[0]; } return 0; }