Fix some errors found in build testing + clean-up some issues with last changes to remove use of printf() from within the OS.

This commit is contained in:
Gregory Nutt 2018-03-03 15:51:27 -06:00
parent b4f2b0dfc6
commit 987a8298f2
6 changed files with 52 additions and 48 deletions

View File

@ -43,6 +43,7 @@
#include <nuttx/arch.h> #include <nuttx/arch.h>
#include <stdint.h> #include <stdint.h>
#include <syslog.h>
#include <errno.h> #include <errno.h>
#include <debug.h> #include <debug.h>
@ -549,7 +550,7 @@ int lc823450_wdt_initialize(void)
#else #else
if (getreg32(WDT_WT0RSTS) & (1 << WDT_WT0RSTS_RSTS)) if (getreg32(WDT_WT0RSTS) & (1 << WDT_WT0RSTS_RSTS))
{ {
wdwarn("**** WATCHDOG RESET****\n"); syslog(LOG_EMERG, "**** WATCHDOG RESET****\n");
} }
#endif #endif
@ -577,7 +578,7 @@ void lc823450_wdt_work_enable(int en)
if (getreg32(WDT_WT0RSTS) & (1 << WDT_WT0RSTS_RSTS)) if (getreg32(WDT_WT0RSTS) & (1 << WDT_WT0RSTS_RSTS))
{ {
wdwarn("**** WATCHDOG RESET****\n"); syslog(LOG_EMERG, "**** WATCHDOG RESET****\n");
} }
if (getreg32(LOCKUPR) & LOCKUPR_LOCKUPR0) if (getreg32(LOCKUPR) & LOCKUPR_LOCKUPR0)

View File

@ -363,7 +363,7 @@ int stm32_bbsram_int(void)
rv = hardfault_get_desc(&desc); rv = hardfault_get_desc(&desc);
if (rv >= OK) if (rv >= OK)
{ {
_err("ERROR: There is a hard fault logged.\n"); syslog(LOG_EMERG, "ERROR: There is a hard fault logged.\n");
state = (desc.lastwrite.tv_sec || desc.lastwrite.tv_nsec) ? OK : 1; state = (desc.lastwrite.tv_sec || desc.lastwrite.tv_nsec) ? OK : 1;
syslog(LOG_INFO, "Fault Log info File No %d Length %d flags:0x%02x " syslog(LOG_INFO, "Fault Log info File No %d Length %d flags:0x%02x "

View File

@ -362,7 +362,7 @@ int stm32_bbsram_int(void)
rv = hardfault_get_desc(&desc); rv = hardfault_get_desc(&desc);
if (rv >= OK) if (rv >= OK)
{ {
_err("There is a hard fault logged.\n"); syslog(LOG_EMERG, "There is a hard fault logged.\n");
state = (desc.lastwrite.tv_sec || desc.lastwrite.tv_nsec) ? OK : 1; state = (desc.lastwrite.tv_sec || desc.lastwrite.tv_nsec) ? OK : 1;
syslog(LOG_INFO, "Fault Log info File No %d Length %d flags:0x%02x " syslog(LOG_INFO, "Fault Log info File No %d Length %d flags:0x%02x "

View File

@ -120,7 +120,7 @@
# ifdef CONFIG_DEBUG_INFO # ifdef CONFIG_DEBUG_INFO
# define message(...) _info(__VA_ARGS__) # define message(...) _info(__VA_ARGS__)
# else # else
# define message(...) _err(__VA_ARGS__) # define message(...) syslog(LOG_INFO, __VA_ARGS__)
# endif # endif
#else #else
# ifdef CONFIG_DEBUG_INFO # ifdef CONFIG_DEBUG_INFO

View File

@ -1291,7 +1291,7 @@ int mfrc522_selftest(FAR struct mfrc522_dev_s *dev)
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0}; 0, 0, 0, 0, 0};
char outbuf[3 * 8 + 1] char outbuf[3 * 8 + 1];
uint8_t result[64]; uint8_t result[64];
int i; int i;
int j; int j;
@ -1354,7 +1354,7 @@ int mfrc522_selftest(FAR struct mfrc522_dev_s *dev)
for (i = 0; i < 64; i += 8) for (i = 0; i < 64; i += 8)
{ {
for (j = 0; k = 0; j < 8; j++, k += 3) for (j = 0, k = 0; j < 8; j++, k += 3)
{ {
(void)sprintf(&outbuf[k], " %02x", result[i + j]); (void)sprintf(&outbuf[k], " %02x", result[i + j]);
} }

View File

@ -2352,8 +2352,10 @@ static int smart_scan(FAR struct smart_struct_s *dev)
dev->releasecount[sector / dev->sectorsPerBlk]++; dev->releasecount[sector / dev->sectorsPerBlk]++;
#else #else
smart_update_cache(dev, 0, newsector); smart_update_cache(dev, 0, newsector);
#ifdef CONFIG_MTD_SMART_PACK_COUNTS
smart_add_count(dev, dev->freecount, newsector / dev->sectorsPerBlk, -1); smart_add_count(dev, dev->freecount, newsector / dev->sectorsPerBlk, -1);
smart_add_count(dev, dev->releasecount, sector / dev->sectorsPerBlk, 1); smart_add_count(dev, dev->releasecount, sector / dev->sectorsPerBlk, 1);
#endif
#endif #endif
} }
} }
@ -3243,7 +3245,8 @@ static int smart_relocate_block(FAR struct smart_struct_s *dev, uint16_t block)
#ifdef CONFIG_SMART_LOCAL_CHECKFREE #ifdef CONFIG_SMART_LOCAL_CHECKFREE
if (smart_checkfree(dev, __LINE__) != OK) if (smart_checkfree(dev, __LINE__) != OK)
{ {
fwarn(" ...while relocating block %d, free=%d\n", block, dev->freesectors); fwarn(" ...while relocating block %d, free=%d\n",
block, dev->freesectors);
} }
#endif #endif
@ -3625,7 +3628,7 @@ retry:
ferr("ERROR: Program bug! Expected a free sector, free=%d\n", ferr("ERROR: Program bug! Expected a free sector, free=%d\n",
dev->freesectors); dev->freesectors);
for (i = 0, remaining = dev->neraseblock; for (i = 0, remaining = dev->neraseblocks;
remaining > 0; remaining > 0;
i += 8, remaining -= 8) i += 8, remaining -= 8)
{ {
@ -5258,7 +5261,7 @@ static int smart_ioctl(FAR struct inode *inode, int cmd, unsigned long arg)
/* Get ProcFS data */ /* Get ProcFS data */
procfs_data = (FAR struct mtd_smart_procfs_data_s *) arg; procfs_data = (FAR struct mtd_smart_procfs_data_s *)arg;
procfs_data->totalsectors = dev->totalsectors; procfs_data->totalsectors = dev->totalsectors;
procfs_data->sectorsize = dev->sectorsize; procfs_data->sectorsize = dev->sectorsize;
procfs_data->freesectors = dev->freesectors; procfs_data->freesectors = dev->freesectors;
@ -5406,8 +5409,8 @@ int smart_initialize(int minor, FAR struct mtd_dev_s *mtd, FAR const char *partn
totalsectors -= 2; totalsectors -= 2;
} }
dev->totalsectors = (uint16_t) totalsectors; dev->totalsectors = (uint16_t)totalsectors;
dev->freesectors = (uint16_t) dev->availSectPerBlk * dev->geo.neraseblocks; dev->freesectors = (uint16_t)dev->availSectPerBlk * dev->geo.neraseblocks;
dev->lastallocblock = 0; dev->lastallocblock = 0;
dev->debuglevel = 0; dev->debuglevel = 0;