31#ifndef LIBOPENCM3_PAC55XX_MEMCTL_H_
32#define LIBOPENCM3_PAC55XX_MEMCTL_H_
41#define MEMCTL_MEMCTLR MMIO32(MEMCTL_BASE)
42#define MEMCTL_MEMCTLR_WSTATE_MASK (0xF)
43#define MEMCTL_MEMCTLR_WSTATE(ws) ((ws) & MEMCTL_MEMCTLR_WSTATE_MASK)
44#define MEMCTL_MEMCTLR_MCLKDIV_MASK (0xF)
45#define MEMCTL_MEMCTLR_MCLKDIV_SHIFT 4
47#define MEMCTL_MEMCTLR_MCLKDIV(div) (((div-1) & MEMCTL_MEMCTLR_MCLKDIV_MASK) << MEMCTL_MEMCTLR_MCLKDIV_SHIFT)
48#define MEMCTL_MEMCTLR_WRITEWORDCNT_MASK (0x3)
49#define MEMCTL_MEMCTLR_WRITEWORDCNT_SHIFT 8
50#define MEMCTL_MEMCTLR_WRITEWORDCNT(cnt) (((cnt) & MEMCTL_MEMCTLR_WRITEWORDCNT_MASK) << MEMCTL_MEMCTLR_WRITEWORDCNT_SHIFT)
51#define MEMCTL_MEMCTLR_SEIE BIT16
52#define MEMCTL_MEMCTLR_DEIE BIT17
53#define MEMCTL_MEMCTLR_INVADDRIE BIT18
54#define MEMCTL_MEMCTLR_STBY BIT19
55#define MEMCTL_MEMCTLR_ECCDIS BIT20
56#define MEMCTL_MEMCTLR_CACHEDIS BIT21
57#define MEMCTL_MEMCTLR_MCLKSEL BIT22
63#define MEMCTL_MEMSTATUS MMIO32(MEMCTL_BASE + 0x0004)
64#define MEMCTL_MEMSTATUS_WBUSY BIT0
65#define MEMCTL_MEMSTATUS_EBUSY BIT1
66#define MEMCTL_MEMSTATUS_WRITEWORDCNT_MASK (0x3)
67#define MEMCTL_MEMSTATUS_WRITEWORDCNT_SHIFT 8
68#define MEMCTL_MEMSTATUS_WRITEWORDCNT ((MEMCTL_MEMSTATUS >> MEMCTL_MEMSTATUS_WRITEWORDCNT_SHIFT) & MEMCTL_MEMSTATUS_WRITEWORDCNT_MASK)
69#define MEMCTL_MEMSTATUS_WRITEWORDCNT_4BYTES (0)
70#define MEMCTL_MEMSTATUS_WRITEWORDCNT_8BYTES (1)
71#define MEMCTL_MEMSTATUS_WRITEWORDCNT_12BYTES (2)
72#define MEMCTL_MEMSTATUS_WRITEWORDCNT_16BYTES (3)
73#define MEMCTL_MEMSTATUS_SE BIT16
74#define MEMCTL_MEMSTATUS_DE BIT17
75#define MEMCTL_MEMSTATUS_INVADDR BIT18
81#define MEMCTL_FLASHLOCK MMIO32(MEMCTL_BASE + 0x0008)
82#define MEMCTL_FLASHLOCK_CLEAR (0)
83#define MEMCTL_FLASHLOCK_ALLOW_FLASH_WRITE (0x43DF140A)
84#define MEMCTL_FLASHLOCK_ALLOW_MEMCTL_WRITE (0xD513B490)
85#define MEMCTL_FLASHLOCK_ALLOW_INFO2_SWDFUSE (0x79B4F762)
89#define MEMCTL_FLASHPAGE MMIO32(MEMCTL_BASE + 0x000C)
91#define MEMCTL_SWDUNLOCK MMIO32(MEMCTL_BASE + 0x0010)
96#define MEMCTL_FLASHERASE MMIO32(MEMCTL_BASE + 0x0020)
97#define MEMCTL_FLASHERASE_PAGE_ERASE (0x8C799CA7)
98#define MEMCTL_FLASHERASE_MASS_PAGE_ERASE (0x09EE76C9)
99#define MEMCTL_FLASHERASE_INFO3_ERASE (0x1266FF45)
void memctl_sram_ecc_disable(void)
Disable SRAM ECC.
void memctl_flash_select_mclk(void)
Select MCLK as input to Flash Memory Controller.
void memctl_flash_reset_write_buffer(void)
Set WRITEWORDCOUNT to 0 to reset the Flash write data buffer.
void memctl_flash_standby_mode_disable(void)
Disable Flash Standby Mode.
void memctl_invaddr_interrupt_disable(void)
Disable Invalid Memory Access Interrupt.
void memctl_flash_select_roscclk(void)
Select ROSCCLK as input to Flash Memory Controller.
void memctl_flash_cache_enable(void)
Enable Flash cache.
void memctl_sram_ecc_dual_bit_interrupt_enable(void)
Enable SRAM ECC Dual Bit Detection Interrupt.
void memctl_sram_ecc_dual_bit_interrupt_disable(void)
Disable SRAM ECC Dual Bit Detection Interrupt.
void memctl_flash_standby_mode_enable(void)
Enable Flash Standby Mode.
void memctl_sram_ecc_single_bit_interrupt_disable(void)
Disable SRAM ECC Single Bit Detection Interrupt.
void memctl_sram_ecc_enable(void)
Enable SRAM ECC.
void memctl_invaddr_interrupt_enable(void)
Enable Invalid Memory Access Interrupt.
void memctl_flash_set_wstate(uint32_t wstate)
Set the number of wait states for Flash reads.
void memctl_flash_set_mclkdiv(uint32_t div)
Set the MCLK divisor.
void memctl_sram_ecc_single_bit_interrupt_enable(void)
Enable SRAM ECC Single Bit Detection Interrupt.
void memctl_flash_cache_disable(void)
Disable Flash cache.