Champs,
I am asking this for our customer.
The user got a warning under MISRA-C 2004 Rule 10.1 when using driverlib like below.
#1393-D (MISRA-C:2004 10.1/R) The value of an expression of integer type shall not be implicitly converted to a different underlying type if it is not a conversion to a wider integer type of the same signedness
The user’s codes are like these:
1. DEVICE_DELAY_US(1000);
2. HWREG_BP(base + CAN_O_IF2CMD) = CAN_IF2CMD_TXRQST | (objID & CAN_IF2CMD_MSG_NUM_M);
3. HWREG_BP(base + CAN_O_IF1CMD) = CAN_IF1CMD_CLRINTPND | (intClr & CAN_IF1CMD_MSG_NUM_M);
4. HWREG_BP(base + CAN_O_IF1CMD) = CAN_IF1CMD_CONTROL | (objID & CAN_IF1CMD_MSG_NUM_M);
5. CMPSS_configRamp (CMPSS1_BASE, (U16)(0xFFFF), Can_Rx_315h_Data.Buck_Slope_Ramp_Dec_Val_Shadow_Set_U16, (U16)(0x0), (U16)(2), true);
6. EPWM_setDeadBandOutputSwapMode(EPWM1_BASE, EPWM_DB_OUTPUT_A, false);
7. EPWM_setDeadBandDelayMode(EPWM1_BASE, EPWM_DB_RED, false);
Our questions are:
1) Does this warning mean the user should have “explicit casting”?
2) Do you have any suggestion how the user can modify his codes to avoid this warning?
3) Is it possible the warning is from the underlying drivelib? Is our driver lib compliant to MISRA-C 2004?
Wayne Huang