summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libcpu/powerpc/mpc55xx/include/mpc55xx.h
diff options
context:
space:
mode:
Diffstat (limited to 'c/src/lib/libcpu/powerpc/mpc55xx/include/mpc55xx.h')
-rw-r--r--c/src/lib/libcpu/powerpc/mpc55xx/include/mpc55xx.h42
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)