[PATCH rtems6 - v2 02/16] flashdev: Unify IOCTL macro names
berndmoessner80 at gmail.com
berndmoessner80 at gmail.com
Sun Jan 7 18:18:36 UTC 2024
From: Bernd Moessner <berndmoessner80 at gmail.com>
Updates #4981
---
cpukit/dev/flash/flashdev.c | 16 ++++++++--------
cpukit/include/dev/flash/flashdev.h | 16 ++++++++--------
cpukit/libmisc/shell/main_flashdev.c | 12 ++++++------
testsuites/libtests/flashdev01/init.c | 16 ++++++++--------
4 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/cpukit/dev/flash/flashdev.c b/cpukit/dev/flash/flashdev.c
index be85593201..40666290e0 100644
--- a/cpukit/dev/flash/flashdev.c
+++ b/cpukit/dev/flash/flashdev.c
@@ -362,32 +362,32 @@ static int rtems_flashdev_ioctl(
rtems_flashdev_release( flash );
err = 0;
break;
- case RTEMS_FLASHDEV_IOCTL_JEDEC_ID:
+ case RTEMS_FLASHDEV_IOCTL_GET_JEDEC_ID:
*( (uint32_t *) arg ) = rtems_flashdev_ioctl_jedec_id( flash );
err = 0;
break;
case RTEMS_FLASHDEV_IOCTL_ERASE:
err = rtems_flashdev_ioctl_erase( flash, iop, arg );
break;
- case RTEMS_FLASHDEV_IOCTL_REGION_SET:
+ case RTEMS_FLASHDEV_IOCTL_SET_REGION:
err = rtems_flashdev_ioctl_set_region( flash, iop, arg );
break;
- case RTEMS_FLASHDEV_IOCTL_REGION_UNSET:
+ case RTEMS_FLASHDEV_IOCTL_UNSET_REGION:
err = rtems_flashdev_ioctl_clear_region( flash, iop );
break;
- case RTEMS_FLASHDEV_IOCTL_TYPE:
+ case RTEMS_FLASHDEV_IOCTL_GET_TYPE:
err = rtems_flashdev_ioctl_flash_type( flash, arg );
break;
- case RTEMS_FLASHDEV_IOCTL_PAGEINFO_BY_OFFSET:
+ case RTEMS_FLASHDEV_IOCTL_GET_PAGEINFO_BY_OFFSET:
err = rtems_flashdev_ioctl_pageinfo_offset( flash, arg );
break;
- case RTEMS_FLASHDEV_IOCTL_PAGEINFO_BY_INDEX:
+ case RTEMS_FLASHDEV_IOCTL_GET_PAGEINFO_BY_INDEX:
err = rtems_flashdev_ioctl_pageinfo_index( flash, arg );
break;
- case RTEMS_FLASHDEV_IOCTL_PAGE_COUNT:
+ case RTEMS_FLASHDEV_IOCTL_GET_PAGE_COUNT:
err = rtems_flashdev_ioctl_page_count( flash, arg );
break;
- case RTEMS_FLASHDEV_IOCTL_WRITE_BLOCK_SIZE:
+ case RTEMS_FLASHDEV_IOCTL_GET_WRITE_BLOCK_SIZE:
err = rtems_flashdev_ioctl_write_block_size( flash, arg );
break;
}
diff --git a/cpukit/include/dev/flash/flashdev.h b/cpukit/include/dev/flash/flashdev.h
index 6759357206..59028a8cba 100644
--- a/cpukit/include/dev/flash/flashdev.h
+++ b/cpukit/include/dev/flash/flashdev.h
@@ -77,7 +77,7 @@ typedef struct rtems_flashdev rtems_flashdev;
* @param[out] jedec_id Pointer to uint32_t in which the JEDEC ID is
* returned in.
*/
-#define RTEMS_FLASHDEV_IOCTL_JEDEC_ID 2
+#define RTEMS_FLASHDEV_IOCTL_GET_JEDEC_ID 2
/**
* @brief Erases flash device.
*
@@ -94,20 +94,20 @@ typedef struct rtems_flashdev rtems_flashdev;
* @param[in] region Pointer to rtems_flashdev_region struct containing
* base and length of defined region.
*/
-#define RTEMS_FLASHDEV_IOCTL_REGION_SET 4
+#define RTEMS_FLASHDEV_IOCTL_SET_REGION 4
/**
* @brief Removes the set region on the file descriptor.
*
* This command has no argument.
*/
-#define RTEMS_FLASHDEV_IOCTL_REGION_UNSET 5
+#define RTEMS_FLASHDEV_IOCTL_UNSET_REGION 5
/**
* @brief Returns the type of flash device (e.g. NOR or NAND).
*
* @param[out] flash_type Pointer to integer which is set to the flash
* type macro value.
*/
-#define RTEMS_FLASHDEV_IOCTL_TYPE 6
+#define RTEMS_FLASHDEV_IOCTL_GET_TYPE 6
/**
* @brief Get the size and address of flash page at given offset
@@ -118,7 +118,7 @@ typedef struct rtems_flashdev rtems_flashdev;
* @param[in,out] rtems_flashdev_ioctl_page_info arg Pointer to struct
* with offset and space for return values.
*/
-#define RTEMS_FLASHDEV_IOCTL_PAGEINFO_BY_OFFSET 7
+#define RTEMS_FLASHDEV_IOCTL_GET_PAGEINFO_BY_OFFSET 7
/**
* @brief Get the size and address of nth flash page where n is index passed in.
@@ -128,21 +128,21 @@ typedef struct rtems_flashdev rtems_flashdev;
* @param[in,out] rtems_flashdev_ioctl_page_info arg Pointer to struct
* with index and space for return values.
*/
-#define RTEMS_FLASHDEV_IOCTL_PAGEINFO_BY_INDEX 8
+#define RTEMS_FLASHDEV_IOCTL_GET_PAGEINFO_BY_INDEX 8
/**
* @brief Get the number of pages in flash device.
*
* @param[out] count Integer containing the number of pages.
*/
-#define RTEMS_FLASHDEV_IOCTL_PAGE_COUNT 9
+#define RTEMS_FLASHDEV_IOCTL_GET_PAGE_COUNT 9
/**
* @brief Get the minimum write size supported by the driver.
*
* @param[out] count Integer containing the minimum write size.
*/
-#define RTEMS_FLASHDEV_IOCTL_WRITE_BLOCK_SIZE 10
+#define RTEMS_FLASHDEV_IOCTL_GET_WRITE_BLOCK_SIZE 10
/**
* @brief The maximum number of region limited file descriptors
diff --git a/cpukit/libmisc/shell/main_flashdev.c b/cpukit/libmisc/shell/main_flashdev.c
index ca2454b33c..969b0687d2 100644
--- a/cpukit/libmisc/shell/main_flashdev.c
+++ b/cpukit/libmisc/shell/main_flashdev.c
@@ -385,7 +385,7 @@ int flashdev_shell_type( char *dev_path )
/* Get type */
status = flashdev_shell_ioctl_value(
dev_path,
- RTEMS_FLASHDEV_IOCTL_TYPE,
+ RTEMS_FLASHDEV_IOCTL_GET_TYPE,
&type
);
@@ -416,7 +416,7 @@ int flashdev_shell_jedecid( char *dev_path ) {
/* Get JEDEC Id */
status = flashdev_shell_ioctl_value(
dev_path,
- RTEMS_FLASHDEV_IOCTL_JEDEC_ID,
+ RTEMS_FLASHDEV_IOCTL_GET_JEDEC_ID,
&ret
);
@@ -440,7 +440,7 @@ static int flashdev_shell_page_off(
dev_path,
argc,
argv,
- RTEMS_FLASHDEV_IOCTL_PAGEINFO_BY_OFFSET
+ RTEMS_FLASHDEV_IOCTL_GET_PAGEINFO_BY_OFFSET
);
}
@@ -454,7 +454,7 @@ static int flashdev_shell_page_idx(
dev_path,
argc,
argv,
- RTEMS_FLASHDEV_IOCTL_PAGEINFO_BY_INDEX
+ RTEMS_FLASHDEV_IOCTL_GET_PAGEINFO_BY_INDEX
);
}
@@ -466,7 +466,7 @@ static int flashdev_shell_pg_count( char *dev_path )
/* Get Page Count */
status = flashdev_shell_ioctl_value(
dev_path,
- RTEMS_FLASHDEV_IOCTL_PAGE_COUNT,
+ RTEMS_FLASHDEV_IOCTL_GET_PAGE_COUNT,
&ret
);
@@ -488,7 +488,7 @@ static int flashdev_shell_wb_size( char *dev_path )
/* Get Write Block Size */
status = flashdev_shell_ioctl_value(
dev_path,
- RTEMS_FLASHDEV_IOCTL_WRITE_BLOCK_SIZE,
+ RTEMS_FLASHDEV_IOCTL_GET_WRITE_BLOCK_SIZE,
&ret
);
diff --git a/testsuites/libtests/flashdev01/init.c b/testsuites/libtests/flashdev01/init.c
index 6ce9709496..30af3f33c1 100644
--- a/testsuites/libtests/flashdev01/init.c
+++ b/testsuites/libtests/flashdev01/init.c
@@ -103,44 +103,44 @@ static void run_test(void) {
rtems_test_assert(buff[0] == 0);
/* Test getting JEDEC ID */
- status = ioctl(fd, RTEMS_FLASHDEV_IOCTL_JEDEC_ID, &jedec);
+ status = ioctl(fd, RTEMS_FLASHDEV_IOCTL_GET_JEDEC_ID, &jedec);
rtems_test_assert(!status);
rtems_test_assert(jedec == 0x00ABCDEF);
/* Test getting flash type */
- status = ioctl(fd, RTEMS_FLASHDEV_IOCTL_TYPE, &type);
+ status = ioctl(fd, RTEMS_FLASHDEV_IOCTL_GET_TYPE, &type);
rtems_test_assert(!status);
rtems_test_assert(type == RTEMS_FLASHDEV_NOR);
/* Test getting page info from offset */
pg_info.location = PAGE_SIZE + PAGE_SIZE/2;
- status = ioctl(fd, RTEMS_FLASHDEV_IOCTL_PAGEINFO_BY_OFFSET, &pg_info);
+ status = ioctl(fd, RTEMS_FLASHDEV_IOCTL_GET_PAGEINFO_BY_OFFSET, &pg_info);
rtems_test_assert(!status);
rtems_test_assert(pg_info.page_info.offset == PAGE_SIZE);
rtems_test_assert(pg_info.page_info.size == PAGE_SIZE);
/* Test getting page info from index */
pg_info.location = 2;
- status = ioctl(fd, RTEMS_FLASHDEV_IOCTL_PAGEINFO_BY_INDEX, &pg_info);
+ status = ioctl(fd, RTEMS_FLASHDEV_IOCTL_GET_PAGEINFO_BY_INDEX, &pg_info);
rtems_test_assert(!status);
rtems_test_assert(pg_info.page_info.offset == 2*PAGE_SIZE);
rtems_test_assert(pg_info.page_info.size == PAGE_SIZE);
/* Test getting page count */
- status = ioctl(fd, RTEMS_FLASHDEV_IOCTL_PAGE_COUNT, &page_count);
+ status = ioctl(fd, RTEMS_FLASHDEV_IOCTL_GET_PAGE_COUNT, &page_count);
rtems_test_assert(!status);
rtems_test_assert(page_count == PAGE_COUNT);
/* Test getting write block size */
- status = ioctl(fd, RTEMS_FLASHDEV_IOCTL_WRITE_BLOCK_SIZE, &wb_size);
+ status = ioctl(fd, RTEMS_FLASHDEV_IOCTL_GET_WRITE_BLOCK_SIZE, &wb_size);
rtems_test_assert(!status);
rtems_test_assert(wb_size == WB_SIZE);
/* Test Regions */
region.offset = 0x400;
region.size = 0x200;
- status = ioctl(fd, RTEMS_FLASHDEV_IOCTL_REGION_SET, ®ion);
+ status = ioctl(fd, RTEMS_FLASHDEV_IOCTL_SET_REGION, ®ion);
rtems_test_assert(!status);
/* Test read to larger then region */
@@ -155,7 +155,7 @@ static void run_test(void) {
/* Write to base unset region and check the writes location */
fseek(file, 0x0, SEEK_SET);
fwrite("HELLO WORLD", 11, 1, file);
- ioctl(fd, RTEMS_FLASHDEV_IOCTL_REGION_UNSET, NULL);
+ ioctl(fd, RTEMS_FLASHDEV_IOCTL_UNSET_REGION, NULL);
fseek(file, 0x400, SEEK_SET);
fgets(buff, 11, file);
rtems_test_assert(strncmp(buff, "HELLO WORLD", 11));
--
2.34.1
More information about the devel
mailing list