# HG changeset patch # User bartv # Date 1101154280 0 # Node ID a15c7003d1dad7d22729dbfe4b8258e86050b35b # Parent 61fbcc1cb232442438b13c86ae6cfd25f4b6e9d0 Update following changes to the flash device driver interface diff --git a/packages/devs/flash/amd/am29xxxxxv2/current/ChangeLog b/packages/devs/flash/amd/am29xxxxxv2/current/ChangeLog --- a/packages/devs/flash/amd/am29xxxxxv2/current/ChangeLog +++ b/packages/devs/flash/amd/am29xxxxxv2/current/ChangeLog @@ -1,5 +1,8 @@ 2004-11-22 Bart Veer + * include/am29xxxxx_dev.h, src/am29xxxxx.c, src/am29xxxxx_aux.c, + doc/am29xxxxx.sgml: implement changes to the interface between the + generic flash code and the device drivers. * include/am29xxxxx_dev.h: rename cyg_block_info to cyg_flash_block_info diff --git a/packages/devs/flash/amd/am29xxxxxv2/current/doc/am29xxxxx.sgml b/packages/devs/flash/amd/am29xxxxxv2/current/doc/am29xxxxx.sgml --- a/packages/devs/flash/amd/am29xxxxxv2/current/doc/am29xxxxx.sgml +++ b/packages/devs/flash/amd/am29xxxxxv2/current/doc/am29xxxxx.sgml @@ -126,14 +126,14 @@ the one supported by the platform HAL an int cyg_am29xxxxx_erase_XX struct cyg_flash_dev* device - const cyg_flashaddr_t addr + cyg_flashaddr_t addr int cyg_am29xxxxx_program_XX struct cyg_flash_dev* device - const cyg_flashaddr_t addr + cyg_flashaddr_t addr const void* data - const size_t len + size_t len int cyg_am29xxxxx_query_nop @@ -303,7 +303,7 @@ static const CYG_FLASH_FUNS(hal_alaia_fl &cyg_am29xxxxx_query_nop, &cyg_am29xxxxx_erase_16, &cyg_am29xxxxx_program_16, - (int (*)(struct cyg_flash_dev*, const cyg_flashaddr_t, void*, const size_t))0, + (int (*)(struct cyg_flash_dev*, const cyg_flashaddr_t, void*, size_t))0, &cyg_am29xxxxx_hwr_map_error_nop, &cyg_am29xxxxx_lock_nop, &cyg_am29xxxxx_unlock_nop); @@ -318,14 +318,15 @@ static const cyg_am29xxxxx_dev hal_alaia } }; -struct cyg_flash_dev hal_alaia_flash CYG_HAL_TABLE_ENTRY(cyg_flashdev) = { - .funs = &hal_alaia_flash_amd_funs, - .start = 0xFFE00000, - .end = 0xFFFFFFFF, - .num_block_infos = 4, - .block_info = hal_alaia_flash_priv.block_info, - .priv = &hal_alaia_flash_priv -}; +CYG_FLASH_DRIVER(hal_alaia_flash, + &hal_alaia_flash_amd_funs, + 0, + 0xFFE00000, + 0xFFFFFFFF, + 4, + hal_alaia_flash_priv.block_info, + &hal_alaia_flash_priv +); #endif @@ -459,7 +460,7 @@ platform-specific erase function would l static int -alaia_flash_erase(struct cyg_flash_dev* dev, const cyg_flashaddr_t addr) +alaia_flash_erase(struct cyg_flash_dev* dev, cyg_flashaddr_t addr) { int result; … // Set up the hardware for an erase diff --git a/packages/devs/flash/amd/am29xxxxxv2/current/include/am29xxxxx_dev.h b/packages/devs/flash/amd/am29xxxxxv2/current/include/am29xxxxx_dev.h --- a/packages/devs/flash/amd/am29xxxxxv2/current/include/am29xxxxx_dev.h +++ b/packages/devs/flash/amd/am29xxxxxv2/current/include/am29xxxxx_dev.h @@ -82,21 +82,21 @@ externC int cyg_am29xxxxx_init_cfi_8888( externC int cyg_am29xxxxx_init_cfi_1616( struct cyg_flash_dev*); externC int cyg_am29xxxxx_init_cfi_16as8( struct cyg_flash_dev*); -externC int cyg_am29xxxxx_erase_8( struct cyg_flash_dev*, const cyg_flashaddr_t); -externC int cyg_am29xxxxx_erase_16( struct cyg_flash_dev*, const cyg_flashaddr_t); -externC int cyg_am29xxxxx_erase_32( struct cyg_flash_dev*, const cyg_flashaddr_t); -externC int cyg_am29xxxxx_erase_88( struct cyg_flash_dev*, const cyg_flashaddr_t); -externC int cyg_am29xxxxx_erase_8888( struct cyg_flash_dev*, const cyg_flashaddr_t); -externC int cyg_am29xxxxx_erase_1616( struct cyg_flash_dev*, const cyg_flashaddr_t); -externC int cyg_am29xxxxx_erase_16as8( struct cyg_flash_dev*, const cyg_flashaddr_t); +externC int cyg_am29xxxxx_erase_8( struct cyg_flash_dev*, cyg_flashaddr_t); +externC int cyg_am29xxxxx_erase_16( struct cyg_flash_dev*, cyg_flashaddr_t); +externC int cyg_am29xxxxx_erase_32( struct cyg_flash_dev*, cyg_flashaddr_t); +externC int cyg_am29xxxxx_erase_88( struct cyg_flash_dev*, cyg_flashaddr_t); +externC int cyg_am29xxxxx_erase_8888( struct cyg_flash_dev*, cyg_flashaddr_t); +externC int cyg_am29xxxxx_erase_1616( struct cyg_flash_dev*, cyg_flashaddr_t); +externC int cyg_am29xxxxx_erase_16as8( struct cyg_flash_dev*, cyg_flashaddr_t); -externC int cyg_am29xxxxx_program_8( struct cyg_flash_dev*, const cyg_flashaddr_t, const void*, const size_t); -externC int cyg_am29xxxxx_program_16( struct cyg_flash_dev*, const cyg_flashaddr_t, const void*, const size_t); -externC int cyg_am29xxxxx_program_32( struct cyg_flash_dev*, const cyg_flashaddr_t, const void*, const size_t); -externC int cyg_am29xxxxx_program_88( struct cyg_flash_dev*, const cyg_flashaddr_t, const void*, const size_t); -externC int cyg_am29xxxxx_program_8888( struct cyg_flash_dev*, const cyg_flashaddr_t, const void*, const size_t); -externC int cyg_am29xxxxx_program_1616( struct cyg_flash_dev*, const cyg_flashaddr_t, const void*, const size_t); -externC int cyg_am29xxxxx_program_16as8( struct cyg_flash_dev*, const cyg_flashaddr_t, const void*, const size_t); +externC int cyg_am29xxxxx_program_8( struct cyg_flash_dev*, cyg_flashaddr_t, const void*, size_t); +externC int cyg_am29xxxxx_program_16( struct cyg_flash_dev*, cyg_flashaddr_t, const void*, size_t); +externC int cyg_am29xxxxx_program_32( struct cyg_flash_dev*, cyg_flashaddr_t, const void*, size_t); +externC int cyg_am29xxxxx_program_88( struct cyg_flash_dev*, cyg_flashaddr_t, const void*, size_t); +externC int cyg_am29xxxxx_program_8888( struct cyg_flash_dev*, cyg_flashaddr_t, const void*, size_t); +externC int cyg_am29xxxxx_program_1616( struct cyg_flash_dev*, cyg_flashaddr_t, const void*, size_t); +externC int cyg_am29xxxxx_program_16as8( struct cyg_flash_dev*, cyg_flashaddr_t, const void*, size_t); // FIXME: add program_buffered() support as per e.g. the AM29LV128 // FIXME: add software lock/unlock support as per e.g. the AM29BDS640 diff --git a/packages/devs/flash/amd/am29xxxxxv2/current/src/am29xxxxx.c b/packages/devs/flash/amd/am29xxxxxv2/current/src/am29xxxxx.c --- a/packages/devs/flash/amd/am29xxxxxv2/current/src/am29xxxxx.c +++ b/packages/devs/flash/amd/am29xxxxxv2/current/src/am29xxxxx.c @@ -207,7 +207,7 @@ cyg_am29xxxxx_init_nop(struct cyg_flash_ // A dummy query routine. The implementation of this is specific to // each device driver, and I choose to do as little as possible. size_t -cyg_am29xxxxx_query_nop(struct cyg_flash_dev* dev, void* data, const size_t len) +cyg_am29xxxxx_query_nop(struct cyg_flash_dev* dev, void* data, size_t len) { CYG_UNUSED_PARAM(struct cyg_flash_dev*, dev); CYG_UNUSED_PARAM(void*, data); diff --git a/packages/devs/flash/amd/am29xxxxxv2/current/src/am29xxxxx_aux.c b/packages/devs/flash/amd/am29xxxxxv2/current/src/am29xxxxx_aux.c --- a/packages/devs/flash/amd/am29xxxxxv2/current/src/am29xxxxx_aux.c +++ b/packages/devs/flash/amd/am29xxxxxv2/current/src/am29xxxxx_aux.c @@ -377,7 +377,7 @@ AM29_FNNAME(cyg_am29xxxxx_init_cfi)(stru int result; CYG_CHECK_DATA_PTR(dev, "valid flash device pointer required"); - am29_dev = (cyg_am29xxxxx_dev*) dev->priv; + am29_dev = (cyg_am29xxxxx_dev*) dev->priv; // Remove const, only place where this is needed. addr = AM29_P2V(dev->start); cfi_fn = (int (*)(struct cyg_flash_dev*, cyg_am29xxxxx_dev*, volatile AM29_TYPE*)) am29_anonymizer( & AM29_FNNAME(am29_hw_cfi)); @@ -399,7 +399,7 @@ AM29_FNNAME(cyg_am29xxxxx_init_cfi)(stru // Erase a single block. The calling code will have supplied a pointer // aligned to a block boundary. int -AM29_FNNAME(cyg_am29xxxxx_erase)(struct cyg_flash_dev* dev, const cyg_flashaddr_t addr) +AM29_FNNAME(cyg_am29xxxxx_erase)(struct cyg_flash_dev* dev, cyg_flashaddr_t addr) { void (*erase_fn)(volatile AM29_TYPE*); volatile AM29_TYPE* block; @@ -435,7 +435,7 @@ AM29_FNNAME(cyg_am29xxxxx_erase)(struct // Write some data to the flash. The destination must be aligned // appropriately for the bus width (not the device width). int -AM29_FNNAME(cyg_am29xxxxx_program)(struct cyg_flash_dev* dev, const cyg_flashaddr_t dest, const void* src, const size_t len) +AM29_FNNAME(cyg_am29xxxxx_program)(struct cyg_flash_dev* dev, cyg_flashaddr_t dest, const void* src, size_t len) { void (*program_fn)(volatile AM29_TYPE*, volatile AM29_TYPE*, const cyg_uint8*, cyg_uint32); volatile AM29_TYPE* block;