diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2011-08-30 13:30:09 +0000 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2011-08-30 13:30:09 +0000 |
commit | c1188b418c812fe1afd28e3ba0a5c2afaaf1a4fc (patch) | |
tree | ce1e73893b8c74d2f1e5b7580a6f9342136be827 /c/src/lib/libcpu/powerpc/mpc55xx/include/mpc55xx.h | |
parent | 2011-08-30 Sebastian Huber <sebastian.huber@embedded-brains.de> (diff) | |
download | rtems-c1188b418c812fe1afd28e3ba0a5c2afaaf1a4fc.tar.bz2 |
2011-08-30 Peter Dufault <dufault@hda.com>
* mpc55xx/misc/flash_support.c: New file.
* Makefile.am: Reflect change above.
* mpc55xx/include/mpc55xx.h: Add definitions for the FLASH interface
and two memory protect interfaces. Add modifications to eliminate
warnings in some of the cache macros.
* mpc55xx/include/regs.h: Add some structure tag names for some
structures that I needed access to. Don't define the ALTCADR for the
MPC5554 - it is reserved and acess casues an exception. Hide the C99
designated initializers when compiling with C++. Add some support for
the EQADC.
* mpc55xx/include/esci.h, mpc55xx/include/watchdog.h: Add C++
protection.
Diffstat (limited to '')
-rw-r--r-- | c/src/lib/libcpu/powerpc/mpc55xx/include/mpc55xx.h | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/c/src/lib/libcpu/powerpc/mpc55xx/include/mpc55xx.h b/c/src/lib/libcpu/powerpc/mpc55xx/include/mpc55xx.h index 4cd6abab8b..284ccb9af5 100644 --- a/c/src/lib/libcpu/powerpc/mpc55xx/include/mpc55xx.h +++ b/c/src/lib/libcpu/powerpc/mpc55xx/include/mpc55xx.h @@ -61,6 +61,44 @@ void mpc55xx_system_reset(); /* Defined in flash.S */ void mpc55xx_flash_config(); +int mpc55xx_flash_copy(void *dest, const void *src, size_t nbytes); +int mpc55xx_flash_copy_op(void *rdest, const void *src, size_t nbytes, + uint32_t opmask, uint32_t *p_fail_addr); +int mpc55xx_flash_size(uint32_t *p_size); +int mpc55xx_flash_writable(void); +uint32_t mpc55xx_flash_address(void); +void mpc55xx_flash_set_read_only(void); +void mpc55xx_flash_set_read_write(void); + +int mpc55xx_physical_address(const void *addr, uint32_t *p_result); +int mpc55xx_mapped_address(const void *addr, uint32_t *p_result); + +/* Bits for opmask. */ +#define MPC55XX_FLASH_BLANK_CHECK 0x01 +#define MPC55XX_FLASH_UNLOCK 0x02 +#define MPC55XX_FLASH_ERASE 0x04 +#define MPC55XX_FLASH_PROGRAM 0x08 +#define MPC55XX_FLASH_VERIFY 0x10 + +/* Error returns. CONFIG or SIZE might mean you just + * need to check for new configuration bits. + * SIZE and RANGE mean you are outside of a known flash region. + * ERASE means the erase failed, + * PROGRAM means the program failed, + * BLANK means it wasn't blank and BLANK_CHECK was specified, + * VERIFY means VERIFY was set and it didn't match the source, + * and LOCK means either the locking failed or you needed to + * specify MPC55XX_FLASH_UNLOCK and didn't. + */ +#define MPC55XX_FLASH_CONFIG_ERR (-1) +#define MPC55XX_FLASH_SIZE_ERR (-2) +#define MPC55XX_FLASH_RANGE_ERR (-3) +#define MPC55XX_FLASH_ERASE_ERR (-4) +#define MPC55XX_FLASH_PROGRAM_ERR (-5) +#define MPC55XX_FLASH_NOT_BLANK_ERR (-6) +#define MPC55XX_FLASH_VERIFY_ERR (-7) +#define MPC55XX_FLASH_LOCK_ERR (-8) + #define MPC55XX_CACHE_ALIGNED_MASK ((uintptr_t) 0x1f) #define MPC55XX_CACHE_LINE_SIZE 32 @@ -73,9 +111,9 @@ static inline int mpc55xx_is_cache_aligned( const void *s, size_t n) return !(((uintptr_t) s & MPC55XX_CACHE_ALIGNED_MASK) || (n & MPC55XX_CACHE_ALIGNED_MASK)); } -static inline void* mpc55xx_cache_aligned_start( const void *s) +static inline uintptr_t mpc55xx_cache_aligned_start( const void *s) { - return ((uintptr_t) s & MPC55XX_CACHE_ALIGNED_MASK) ? (((uintptr_t) s & ~MPC55XX_CACHE_ALIGNED_MASK) + MPC55XX_CACHE_LINE_SIZE) : s; + return ((uintptr_t) s & MPC55XX_CACHE_ALIGNED_MASK) ? (((uintptr_t) s & ~MPC55XX_CACHE_ALIGNED_MASK) + MPC55XX_CACHE_LINE_SIZE) : (uintptr_t)s; } static inline size_t mpc55xx_non_cache_aligned_size( const void *s) |