forked from Archive/PX4-Autopilot
px4/common:mtd Use inttypes
This commit is contained in:
parent
1b80018f30
commit
dc23c85085
|
@ -14,7 +14,7 @@
|
|||
*
|
||||
* Derived from drivers/mtd/m25px.c
|
||||
*
|
||||
* Copyright (C) 2009-2011 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2009-2011, 2021 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -55,6 +55,7 @@
|
|||
#include <px4_platform_common/time.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -270,7 +271,7 @@ void at24c_test(void)
|
|||
}
|
||||
|
||||
} else if (result != 1) {
|
||||
syslog(LOG_INFO, "unexpected %u\n", result);
|
||||
syslog(LOG_INFO, "unexpected %zu\n", result);
|
||||
}
|
||||
|
||||
if ((count % 100) == 0) {
|
||||
|
@ -314,7 +315,7 @@ static ssize_t at24c_bread(FAR struct mtd_dev_s *dev, off_t startblock,
|
|||
#endif
|
||||
blocksleft = nblocks;
|
||||
|
||||
finfo("startblock: %08lx nblocks: %d\n", (long)startblock, (int)nblocks);
|
||||
finfo("startblock: %08jx nblocks: %zu\n", (intmax_t)startblock, nblocks);
|
||||
|
||||
if (startblock >= priv->npages) {
|
||||
return 0;
|
||||
|
@ -409,7 +410,7 @@ static ssize_t at24c_bwrite(FAR struct mtd_dev_s *dev, off_t startblock, size_t
|
|||
nblocks = priv->npages - startblock;
|
||||
}
|
||||
|
||||
finfo("startblock: %08lx nblocks: %d\n", (long)startblock, (int)nblocks);
|
||||
finfo("startblock: %08jx nblocks: %zu\n", (intmax_t)startblock, nblocks);
|
||||
|
||||
BOARD_EEPROM_WP_CTRL(false);
|
||||
|
||||
|
@ -505,7 +506,7 @@ static int at24c_ioctl(FAR struct mtd_dev_s *dev, int cmd, unsigned long arg)
|
|||
#endif
|
||||
ret = OK;
|
||||
|
||||
finfo("blocksize: %d erasesize: %d neraseblocks: %d\n",
|
||||
finfo("blocksize: %" PRId32 " erasesize: %" PRId32 " neraseblocks: %" PRId32 "\n",
|
||||
geo->blocksize, geo->erasesize, geo->neraseblocks);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* Copyright (c) 2020 PX4 Development Team. All rights reserved.
|
||||
* Copyright (c) 2020, 2021 PX4 Development Team. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -49,6 +49,7 @@
|
|||
#include <px4_platform_common/log.h>
|
||||
#include <px4_platform_common/spi.h>
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <errno.h>
|
||||
#include <stdbool.h>
|
||||
#include "systemlib/px4_macros.h"
|
||||
|
@ -363,7 +364,7 @@ memoryout:
|
|||
|
||||
char blockname[32];
|
||||
|
||||
unsigned offset;
|
||||
unsigned long offset;
|
||||
unsigned part;
|
||||
|
||||
for (offset = 0, part = 0; rv == 0 && part < nparts; offset += instances[i].partition_block_counts[part], part++) {
|
||||
|
@ -373,8 +374,8 @@ memoryout:
|
|||
instances[i].part_dev[part] = mtd_partition(instances[i].mtd_dev, offset, instances[i].partition_block_counts[part]);
|
||||
|
||||
if (instances[i].part_dev[part] == nullptr) {
|
||||
PX4_ERR("mtd_partition failed. offset=%lu nblocks=%lu",
|
||||
(unsigned long)offset, (unsigned long)nblocks);
|
||||
PX4_ERR("mtd_partition failed. offset=%lu nblocks=%u",
|
||||
offset, nblocks);
|
||||
rv = -ENOSPC;
|
||||
goto errout;
|
||||
}
|
||||
|
@ -407,7 +408,7 @@ memoryout:
|
|||
errout:
|
||||
|
||||
if (rv < 0) {
|
||||
PX4_ERR("mtd failure: %d bus %d address %d class %d",
|
||||
PX4_ERR("mtd failure: %d bus %" PRId32 " address %" PRId32 " class %d",
|
||||
rv,
|
||||
PX4_I2C_DEVID_BUS(instances[i].devid),
|
||||
PX4_I2C_DEVID_ADDR(instances[i].devid),
|
||||
|
|
Loading…
Reference in New Issue