diff --git a/drivers/mmcsd/mmcsd_spi.c b/drivers/mmcsd/mmcsd_spi.c index ea791229eca..812faff2c19 100644 --- a/drivers/mmcsd/mmcsd_spi.c +++ b/drivers/mmcsd/mmcsd_spi.c @@ -28,6 +28,7 @@ #include +#include #include #include #include @@ -563,11 +564,11 @@ static uint32_t mmcsd_sendcmd(FAR struct mmcsd_slot_s *slot, if (busy != 0xff) { - ferr("ERROR: Failed: card still busy (%02x)\n", busy); + ferr("ERROR: Failed: card still busy (%02" PRIx32 ")\n", busy); return (uint32_t)-1; } - finfo("CMD%d[%08x] R1B=%02x\n", + finfo("CMD%d[%08" PRIx32 "] R1B=%02" PRIx8 "\n", cmd->cmd & 0x3f, arg, response); } break; @@ -576,7 +577,7 @@ static uint32_t mmcsd_sendcmd(FAR struct mmcsd_slot_s *slot, case MMCSD_CMDRESP_R1: { - finfo("CMD%d[%08x] R1=%02x\n", + finfo("CMD%d[%08" PRIx32 "] R1=%02" PRIx8 "\n", cmd->cmd & 0x3f, arg, response); } break; @@ -588,7 +589,7 @@ static uint32_t mmcsd_sendcmd(FAR struct mmcsd_slot_s *slot, result = ((uint32_t)(response & 0xff) << 8); result |= SPI_SEND(spi, 0xff) & 0xff; - finfo("CMD%d[%08x] R2=%04x\n", + finfo("CMD%d[%08" PRIx32 "] R2=%04" PRIx32 "\n", cmd->cmd & 0x3f, arg, result); } break; @@ -602,7 +603,7 @@ static uint32_t mmcsd_sendcmd(FAR struct mmcsd_slot_s *slot, slot->ocr |= ((uint32_t)(SPI_SEND(spi, 0xff) & 0xff) << 8); slot->ocr |= SPI_SEND(spi, 0xff) & 0xff; - finfo("CMD%d[%08x] R1=%02x OCR=%08x\n", + finfo("CMD%d[%08" PRIx32 "] R1=%02" PRIx8 " OCR=%08" PRIx32 "\n", cmd->cmd & 0x3f, arg, response, slot->ocr); } break; @@ -617,7 +618,7 @@ static uint32_t mmcsd_sendcmd(FAR struct mmcsd_slot_s *slot, slot->r7 |= ((uint32_t)(SPI_SEND(spi, 0xff) & 0xff) << 8); slot->r7 |= SPI_SEND(spi, 0xff) & 0xff; - finfo("CMD%d[%08x] R1=%02x R7=%08x\n", + finfo("CMD%d[%08" PRIx32 "] R1=%02" PRIx8 " R7=%08" PRIx32 "\n", cmd->cmd & 0x3f, arg, response, slot->r7); } break; @@ -641,11 +642,11 @@ static void mmcsd_setblklen(FAR struct mmcsd_slot_s *slot, uint32_t length) { uint32_t response; - finfo("Set block length to %d\n", length); + finfo("Set block length to %" PRId32 "\n", length); response = mmcsd_sendcmd(slot, &g_cmd16, length); if (response != MMCSD_SPIR1_OK) { - ferr("ERROR: Failed to set block length: %02x\n", response); + ferr("ERROR: Failed to set block length: %02" PRIx32 "\n", response); } } @@ -792,10 +793,10 @@ static void mmcsd_decodecsd(FAR struct mmcsd_slot_s *slot, uint8_t *csd) } finfo("SPI Frequency\n"); - finfo(" Maximum: %d Hz\n", maxfrequency); - finfo(" Actual: %d Hz\n", frequency); - finfo("Read access time: %d ticks\n", slot->taccess); - finfo("Write access time: %d ticks\n", slot->twrite); + finfo(" Maximum: %" PRId32 " Hz\n", maxfrequency); + finfo(" Actual: %" PRId32 " Hz\n", frequency); + finfo("Read access time: %" PRId32 " ticks\n", slot->taccess); + finfo("Write access time: %" PRId32 " ticks\n", slot->twrite); /* Get the physical geometry of the card: sector size and number of * sectors. The card's total capacity is computed from @@ -866,7 +867,7 @@ static void mmcsd_decodecsd(FAR struct mmcsd_slot_s *slot, uint8_t *csd) #endif slot->nsectors = csize << csizemult; finfo("Sector size: %d\n", SECTORSIZE(slot)); - finfo("Number of sectors: %d\n", slot->nsectors); + finfo("Number of sectors: %" PRId32 "\n", slot->nsectors); } /**************************************************************************** @@ -923,7 +924,7 @@ static int mmcsd_getcardinfo(FAR struct mmcsd_slot_s *slot, uint8_t *buffer, result = mmcsd_sendcmd(slot, cmd, 0); if (result != MMCSD_SPIR1_OK) { - ferr("ERROR: CMD9/10 failed: R1=%02x\n", result); + ferr("ERROR: CMD9/10 failed: R1=%02" PRIx32 "\n", result); return -EIO; } @@ -1217,12 +1218,12 @@ static ssize_t mmcsd_read(FAR struct inode *inode, unsigned char *buffer, if (IS_BLOCK(slot->type)) { offset = start_sector; - finfo("nbytes=%d sector offset=%d\n", nbytes, offset); + finfo("nbytes=%zu sector offset=%jd\n", nbytes, (intmax_t)offset); } else { offset = start_sector * SECTORSIZE(slot); - finfo("nbytes=%d byte offset=%d\n", nbytes, offset); + finfo("nbytes=%zu byte offset=%jd\n", nbytes, (intmax_t)offset); } /* Select the slave */ @@ -1386,12 +1387,12 @@ static ssize_t mmcsd_write(FAR struct inode *inode, if (IS_BLOCK(slot->type)) { offset = start_sector; - finfo("nbytes=%d sector offset=%d\n", nbytes, offset); + finfo("nbytes=%zu sector offset=%jd\n", nbytes, (intmax_t)offset); } else { offset = start_sector * SECTORSIZE(slot); - finfo("nbytes=%d byte offset=%d\n", nbytes, offset); + finfo("nbytes=%zu byte offset=%jd\n", nbytes, (intmax_t)offset); } mmcsd_dumpbuffer("Write buffer", buffer, nbytes); @@ -1687,7 +1688,7 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot) if (result != MMCSD_SPIR1_IDLESTATE) { - ferr("ERROR: Send CMD0 failed: R1=%02x\n", result); + ferr("ERROR: Send CMD0 failed: R1=%02" PRIx32 "\n", result); SPI_SELECT(spi, SPIDEV_MMCSD(0), false); mmcsd_semgive(slot); return -EIO; @@ -1717,7 +1718,7 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot) elapsed = 0; do { - finfo("%d. Send CMD55/ACMD41\n", elapsed); + finfo("%ju. Send CMD55/ACMD41\n", (uintmax_t)elapsed); result = mmcsd_sendcmd(slot, &g_cmd55, 0); if (result == MMCSD_SPIR1_IDLESTATE || result == MMCSD_SPIR1_OK) @@ -1743,7 +1744,7 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot) result = mmcsd_sendcmd(slot, &g_cmd58, 0); if (result == MMCSD_SPIR1_OK) { - finfo("OCR: %08x\n", slot->ocr); + finfo("OCR: %08" PRIx32 "\n", slot->ocr); if ((slot->ocr & MMCSD_OCR_CCS) != 0) { finfo("Identified SD ver2 card/with block access\n"); @@ -1788,7 +1789,7 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot) { if (IS_SD(slot->type)) { - finfo("%d. Send CMD55/ACMD41\n", elapsed); + finfo("%ju. Send CMD55/ACMD41\n", (uintmax_t)elapsed); result = mmcsd_sendcmd(slot, &g_cmd55, 0); if (result == MMCSD_SPIR1_IDLESTATE || result == MMCSD_SPIR1_OK) @@ -1839,7 +1840,7 @@ static int mmcsd_mediainitialize(FAR struct mmcsd_slot_s *slot) result = mmcsd_getcsd(slot, csd); if (result != OK) { - ferr("ERROR: mmcsd_getcsd(CMD9) failed: %d\n", result); + ferr("ERROR: mmcsd_getcsd(CMD9) failed: %" PRId32 "\n", result); SPI_SELECT(spi, SPIDEV_MMCSD(0), false); mmcsd_semgive(slot); return -EIO;