struct ADRV9025_COMMON_ERR {
int32_t errNo;
const char *errMsg;
void (*callback)(void *);
void **args;
} ADRV9025_COMMON_ERR_MAP[] =
{
{0x0000, " No error detected ", NULL, NULL},
{0x0001, " Invalid parameter detected in function", NULL, NULL},
{0x0002, " Null parameter detected in function", NULL, NULL},
{0x0003, " Error detected in API function", NULL, NULL},
{0x0004, " SPI interface error detected ",
(void (*)(void *))adi_common_ErrorClear, (void **)&g_device},
{0x0008, " CPU exception detected ",
(void (*)(void *))board_adrv9025_driver_init, NULL},
},
ADRV9025_RETVAL_ERR_MAP[] =
{
{3, " API OK - Parameter exceeds the range of values allowed "},
{2, " API OK - Rerun feature "},
{1, " API OK - LOG Not working "},
{0, " API OK - NO ACTION REQUIRED "},
{-1, " API OK - timer not working "},
{-2, " API OK - INVALID PARAM "},
{-3, " API NG - Interface Not Working ",
(void (*)(void *))adi_common_ErrorClear, (void **)&g_device},
{-4, " API NG - Reset feature "},
{-5, " API NG - Module Not working "},
{
-6,
" API NG - FULL RESET REQUIRED ",
(void (*)(void *))board_adrv9025_driver_init,
NULL,
},
},
ADRV9025_DPD_ERR_MAP[] = {
{0, "No DPD Error"},
{0x3401, " Deprecated - Error code to convey that the Orx is disabled"},
{0x3402, " Deprecated - Error code to convey that the Tx is disabled"},
{0x3403, " Error code to convey that the external path delay calibration "
"was not run"},
{0x3404, " Deprecated - Error code to convey that the DPD initial "
"calibration has not run"},
{0x3405, " Error code to convey that the ORx signal is too small to "
"perform DPD adaptation"},
{0x3406, " Error code to convey that the ORx signal is saturating -check "
"for Rx gain"},
{0x3407,
" Error code to convey that the Tx signal is too small to perform "
"DPD adaptation"},
{0x3408, " Error code to convey that the Orx signal is saturating"},
{0x3409, " Deprecated - Error code to convey that the DPD modeling error "
"over model_err_thres (over saturating)"},
{0x340A, " Error code to convey that the DPD adaptation has encountered "
"too many AM-AM outliers"},
{0x340B, " Deprecated - Error code to convey that the profile for DPD is "
"invalid"},
{0x340C, " Error codeL DPD data capture loop time out"},
{0x340D,
" Error code to convey that unity model isn't available for gain "
"monitoring feature"},
{0x340E, " Error code to convey that there is an LDL solver error"},
{0x340F, " Error code to convey that the max partitions are reached"},
{0x3410, " Error code to convey that RPC send failed"},
{0x3411, " Error code to convey that unknown RPC message is received"},
{0x3412,
" Error code to convey that FW timed out waiting for RPC message"},
{0x3413, " Error code to convey that FW couldn't create mutex"},
{0x3414, " Error code to convey that conflicting memory terms were "
"assigned to an LUT"},
{0x3415, " Error code to convey that the DPD actuator power term in the "
"GMP polynomial expression has exceeded the range"},
{0x3416, " Error code to convey that conflicting cross terms were "
"encountered in the feature set provided"},
{0x3417, " Error code to convey that the LUT assignment for a feature is "
"invalid"},
{0x3418, " Error code to convey that the roaming LUTs(LUTs 26,27,28,29) "
"assigned to a feature could not find a free multiplier row"},
{0x3419,
" Error code to convey that the firmware could not update the DPD "
"actuator look up tables"},
{0x341A,
" Error code to convey that the DPD hardware is in use by another "
"feature"},
{0x341B,
" Error code to convey that there was a DPD data capture failure"},
{0x341C,
" Error code to convey that the cross correlation caused an error"},
{0x341D, " Error code to convey that the DPD stability error occurs"},
{0x341E, " Error code to convey that the DPD cholesky diagonal term is "
"too small"},
{0x341F, " Error code to convey that DPD-CLGC synchronization error"},
{0x3420, " Error code to convey that DPD actuator entry is saturated"},
{0x3421, " Error code to convey that DPD Data capture timed out"}};
#define ADRV9025_RECOVERY(name, err) \
({ \
for (uint32_t i = 0; i < sizeof(name) / sizeof(name[0]); i++) { \
if (name[i].errNo == err && name[i].callback != NULL && \
name[i].args != NULL) { \
name[i].callback(*(name[i].args)) \
} \
} \
})
#define ADRV9025_ERR_STR(name, err, str) \
do { \
for (uint32_t i = 0; i < sizeof(name) / sizeof(name[0]); i++) { \
if (name[i].errNo == err) { \
fprintf(stderr, "%s\n", name[i].errMsg); \
str = name[i].errMsg; \
break; \
} \
} \
} while (0)
这是一段有意思的C程序
#include
#include
int32_t pp() {
printf("Hello World\n");
return 0;
}
struct p {
void (*c)(void *);
} ppp = {.c = (void (*)(void *))pp};
int32_t main(void) { ppp.c(0); }
try{}except{} //C 也可以实现
看了知乎上有关嵌入式工程师 职业发展
1.MCU 的工程师,直接干逻辑,哪里不对补哪里,不考虑可移植性和代码复用,强耦合代码
2.Linux 驱动工程师,更注重底层的框架逻辑和数据结构,代码量大,可移植性高,代码低耦合性,有挑战性
其实更像是技术工人的一种工作,需要什么就去学什么