From f22c1544c53232bdfe3020e5e1cd3ba14865342b Mon Sep 17 00:00:00 2001 From: Ralf Corsepius Date: Sat, 22 May 2010 16:51:05 +0000 Subject: [PATCH] =?UTF-8?q?2010-05-22=09Ralf=20Cors=C3=A9pius=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * libblock/include/rtems/nvdisk.h, libblock/src/nvdisk-sram.c: Use pointer arithmetic instead of int32_t arithmetic for 16bit compatibility. --- cpukit/ChangeLog | 6 ++++++ cpukit/libblock/include/rtems/nvdisk.h | 14 +++++++------- cpukit/libblock/src/nvdisk-sram.c | 18 +++++++++--------- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 50e3193d7d..9415329cf3 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,9 @@ +2010-05-22 Ralf Corsépius + + * libblock/include/rtems/nvdisk.h, libblock/src/nvdisk-sram.c: + Use pointer arithmetic instead of int32_t arithmetic for 16bit + compatibility. + 2010-05-22 Ralf Corsépius * libmisc/shell/fts.c: Cast to uintptr_t instead of long for better diff --git a/cpukit/libblock/include/rtems/nvdisk.h b/cpukit/libblock/include/rtems/nvdisk.h index 1b7bb47ae7..48d8ba0b16 100644 --- a/cpukit/libblock/include/rtems/nvdisk.h +++ b/cpukit/libblock/include/rtems/nvdisk.h @@ -99,8 +99,8 @@ typedef struct rtems_nvdisk_driver_handlers * @retval 0 No error. * @retval EIO The read did not complete. */ - int (*read) (uint32_t device, uint32_t flags, uint32_t base, - uint32_t offset, void* buffer, uint32_t size); + int (*read) (uint32_t device, uint32_t flags, void* base, + uint32_t offset, void* buffer, size_t size); /** * Write data from the buffer to the device. Return an errno @@ -115,8 +115,8 @@ typedef struct rtems_nvdisk_driver_handlers * @retval 0 No error. * @retval EIO The write did not complete or verify. */ - int (*write) (uint32_t device, uint32_t flags, uint32_t base, - uint32_t offset, const void* buffer, uint32_t size); + int (*write) (uint32_t device, uint32_t flags, void* base, + uint32_t offset, const void* buffer, size_t size); /** * Verify data in the buffer to the data in the device. Return an @@ -131,8 +131,8 @@ typedef struct rtems_nvdisk_driver_handlers * @retval 0 No error. * @retval EIO The data did not verify. */ - int (*verify) (uint32_t device, uint32_t flags, uint32_t base, - uint32_t offset, const void* buffer, uint32_t size); + int (*verify) (uint32_t device, uint32_t flags, void* base, + uint32_t offset, const void* buffer, size_t size); } rtems_nvdisk_driver_handlers; @@ -148,7 +148,7 @@ typedef struct rtems_nvdisk_driver_handlers typedef struct rtems_nvdisk_device_desc { uint32_t flags; /**< Private user flags. */ - uint32_t base; /**< Base address of the device. */ + void* base; /**< Base address of the device. */ uint32_t size; /**< Size of the device. */ const rtems_nvdisk_driver_handlers* nv_ops; /**< Device handlers. */ } rtems_nvdisk_device_desc; diff --git a/cpukit/libblock/src/nvdisk-sram.c b/cpukit/libblock/src/nvdisk-sram.c index 1b8369a626..b31f83cfed 100644 --- a/cpukit/libblock/src/nvdisk-sram.c +++ b/cpukit/libblock/src/nvdisk-sram.c @@ -27,36 +27,36 @@ static int rtems_nvdisk_sram_read (uint32_t device __attribute__((unused)), uint32_t flags __attribute__((unused)), - uint32_t base, + void* base, uint32_t offset, void* buffer, - uint32_t size) + size_t size) { - memcpy (buffer, (char*) (base + offset), size); + memcpy (buffer, (base + offset), size); return 0; } static int rtems_nvdisk_sram_write (uint32_t device __attribute__((unused)), uint32_t flags __attribute__((unused)), - uint32_t base, + void* base, uint32_t offset, const void* buffer, - uint32_t size) + size_t size) { - memcpy ((char*) (base + offset), buffer, size); + memcpy ((base + offset), buffer, size); return 0; } static int rtems_nvdisk_sram_verify (uint32_t device __attribute__((unused)), uint32_t flags __attribute__((unused)), - uint32_t base, + void* base, uint32_t offset, const void* buffer, - uint32_t size) + size_t size) { - return memcmp ((char*) (base + offset), buffer, size) == 0 ? 0 : EIO; + return memcmp ((base + offset), buffer, size) == 0 ? 0 : EIO; }