drivers: convert to using newly introduced integer sized types
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.
Jira: ZEP-2051
Change-Id: I08f51e2bfd475f6245771c1bd2df7ffc744c48c4
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
diff --git a/drivers/flash/flash_stm32f4x.c b/drivers/flash/flash_stm32f4x.c
index d31fb21..51f12ac 100644
--- a/drivers/flash/flash_stm32f4x.c
+++ b/drivers/flash/flash_stm32f4x.c
@@ -19,14 +19,14 @@
struct k_sem sem;
};
-static bool valid_range(off_t offset, uint32_t len)
+static bool valid_range(off_t offset, u32_t len)
{
return offset >= 0 && (offset + len - 1 <= STM32F4X_FLASH_END);
}
static int check_status(struct stm32f4x_flash *regs)
{
- uint32_t const error =
+ u32_t const error =
FLASH_FLAG_WRPERR |
FLASH_FLAG_PGAERR |
FLASH_FLAG_RDERR |
@@ -43,7 +43,7 @@
static int wait_flash_idle(struct stm32f4x_flash *regs)
{
- uint32_t timeout = STM32F4X_FLASH_TIMEOUT;
+ u32_t timeout = STM32F4X_FLASH_TIMEOUT;
int rc;
rc = check_status(regs);
@@ -62,9 +62,9 @@
return 0;
}
-static int write_byte(off_t offset, uint8_t val, struct stm32f4x_flash *regs)
+static int write_byte(off_t offset, u8_t val, struct stm32f4x_flash *regs)
{
- uint32_t tmp;
+ u32_t tmp;
int rc;
/* if the control register is locked, do not fail silently */
@@ -84,7 +84,7 @@
/* flush the register write */
tmp = regs->ctrl;
- *((uint8_t *) offset + CONFIG_FLASH_BASE_ADDRESS) = val;
+ *((u8_t *) offset + CONFIG_FLASH_BASE_ADDRESS) = val;
rc = wait_flash_idle(regs);
regs->ctrl &= (~FLASH_CR_PG);
@@ -92,9 +92,9 @@
return rc;
}
-static int erase_sector(uint16_t sector, struct stm32f4x_flash *regs)
+static int erase_sector(u16_t sector, struct stm32f4x_flash *regs)
{
- uint32_t tmp;
+ u32_t tmp;
int rc;
/* if the control register is locked, do not fail silently */
@@ -199,7 +199,7 @@
k_sem_take(&p->sem, K_FOREVER);
for (i = 0; i < len; i++, offset++) {
- rc = write_byte(offset, ((const uint8_t *) data)[i], p->regs);
+ rc = write_byte(offset, ((const u8_t *) data)[i], p->regs);
if (rc < 0) {
k_sem_give(&p->sem);
return rc;