mirror of
https://github.com/espressif/openthread.git
synced 2026-07-29 23:27:46 +00:00
[posix-host] fix warnings caused by SPI arguments (#4596)
* signed/unsigned conversion error * undefined behavior of embedding macros in string literal
This commit is contained in:
+11
-12
@@ -142,15 +142,18 @@ static void PrintUsage(const char *aProgramName, FILE *aStream, int aExitCode)
|
||||
"Syntax:\n"
|
||||
" %s [Options] NodeId|Device|Command [DeviceConfig|CommandArgs]\n"
|
||||
"Options:\n"
|
||||
" -I --interface-name name Thread network interface name.\n"
|
||||
" -d --debug-level Debug level of logging.\n"
|
||||
" -h --help Display this usage information.\n"
|
||||
" -I --interface-name name Thread network interface name.\n"
|
||||
" -n --dry-run Just verify if arguments is valid and radio spinel is compatible.\n"
|
||||
" --no-reset Do not send Spinel reset command to RCP on initialization.\n"
|
||||
" --radio-version Print radio firmware version.\n"
|
||||
" --ncp-dataset Retrieve and save NCP dataset to file.\n"
|
||||
" -s --time-speed factor Time speed up factor.\n"
|
||||
" -v --verbose Also log to stderr.\n"
|
||||
" -v --verbose Also log to stderr.\n",
|
||||
aProgramName);
|
||||
#if OPENTHREAD_POSIX_RCP_SPI_ENABLE
|
||||
fprintf(aStream,
|
||||
" --gpio-int-dev[=gpio-device-path]\n"
|
||||
" Specify a path to the Linux sysfs-exported GPIO device for the\n"
|
||||
" `I̅N̅T̅` pin. If not specified, `SPI` interface will fall back to\n"
|
||||
@@ -171,10 +174,8 @@ static void PrintUsage(const char *aProgramName, FILE *aStream, int aExitCode)
|
||||
" --spi-align-allowance[=n] Specify the maximum number of 0xFF bytes to clip from start of\n"
|
||||
" MISO frame. Max value is 16.\n"
|
||||
" --spi-small-packet=[n] Specify the smallest packet we can receive in a single transaction.\n"
|
||||
" (larger packets will require two transactions). Default value is 32.\n"
|
||||
" (larger packets will require two transactions). Default value is 32.\n");
|
||||
#endif
|
||||
" -h --help Display this usage information.\n",
|
||||
aProgramName);
|
||||
exit(aExitCode);
|
||||
}
|
||||
|
||||
@@ -243,7 +244,6 @@ static void ParseArg(int aArgCount, char *aArgVector[], PosixConfig *aConfig)
|
||||
case ARG_RESTORE_NCP_DATASET:
|
||||
aConfig->mPlatformConfig.mRestoreDatasetFromNcp = true;
|
||||
break;
|
||||
#if OPENTHREAD_POSIX_RCP_SPI_ENABLE
|
||||
case ARG_SPI_GPIO_INT_DEV:
|
||||
aConfig->mPlatformConfig.mSpiGpioIntDevice = optarg;
|
||||
break;
|
||||
@@ -260,21 +260,20 @@ static void ParseArg(int aArgCount, char *aArgVector[], PosixConfig *aConfig)
|
||||
aConfig->mPlatformConfig.mSpiMode = (uint8_t)atoi(optarg);
|
||||
break;
|
||||
case ARG_SPI_SPEED:
|
||||
aConfig->mPlatformConfig.mSpiSpeed = atoi(optarg);
|
||||
aConfig->mPlatformConfig.mSpiSpeed = (uint32_t)atoi(optarg);
|
||||
break;
|
||||
case ARG_SPI_CS_DELAY:
|
||||
aConfig->mPlatformConfig.mSpiCsDelay = atoi(optarg);
|
||||
aConfig->mPlatformConfig.mSpiCsDelay = (uint16_t)atoi(optarg);
|
||||
break;
|
||||
case ARG_SPI_RESET_DELAY:
|
||||
aConfig->mPlatformConfig.mSpiResetDelay = atoi(optarg);
|
||||
aConfig->mPlatformConfig.mSpiResetDelay = (uint32_t)atoi(optarg);
|
||||
break;
|
||||
case ARG_SPI_ALIGN_ALLOWANCE:
|
||||
aConfig->mPlatformConfig.mSpiAlignAllowance = atoi(optarg);
|
||||
aConfig->mPlatformConfig.mSpiAlignAllowance = (uint8_t)atoi(optarg);
|
||||
break;
|
||||
case ARG_SPI_SMALL_PACKET:
|
||||
aConfig->mPlatformConfig.mSpiSmallPacketSize = atoi(optarg);
|
||||
aConfig->mPlatformConfig.mSpiSmallPacketSize = (uint8_t)atoi(optarg);
|
||||
break;
|
||||
#endif // OPENTHREAD_POSIX_RCP_SPI_ENABLE
|
||||
case '?':
|
||||
PrintUsage(aArgVector[0], stderr, OT_EXIT_INVALID_ARGUMENTS);
|
||||
break;
|
||||
|
||||
@@ -1239,7 +1239,7 @@ otError RadioSpinel::WaitResponse(void)
|
||||
{
|
||||
uint64_t end = platformGetTime() + kMaxWaitTime * US_PER_MS;
|
||||
|
||||
otLogInfoPlat("Wait response: tid=%u key=%u", mWaitingTid, mWaitingKey);
|
||||
otLogDebgPlat("Wait response: tid=%u key=%u", mWaitingTid, mWaitingKey);
|
||||
|
||||
do
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user