# Memory Controller Interface Peripheral

MC (AT91S_MC) 0xFFFFFF00 (AT91C_BASE_MC)

Periph ID AIC | Symbol | Description
1 | (AT91C_ID_SYS) | System Peripheral

Function | Description
AT91F_MC_CfgPMC | Enable Peripheral clock in PMC for MC

## MC Software API (AT91S_MC)

Offset | Field | Description
0x0 | MC_RCR | MC Remap Control Register
0x4 | MC_ASR | MC Abort Status Register
0x8 | MC_AASR | MC Abort Address Status Register
0x60 | MC_FMR | MC Flash Mode Register
0x64 | MC_FCR | MC Flash Command Register
0x68 | MC_FSR | MC Flash Status Register

Function | Description
AT91F_MC_EFC_IsInterruptMasked | Test if EFC MC Interrupt is Masked
AT91F_MC_EFC_CfgModeReg | Configure the EFC Mode Register of the MC controller
AT91F_MC_EFC_IsInterruptSet | Test if EFC MC Interrupt is Set
AT91F_MC_EFC_ComputeFMCN | Return MC EFC Mode Regsiter
AT91F_MC_EFC_GetStatus | Return MC EFC Status
AT91F_MC_Remap | Make Remap
AT91F_MC_EFC_GetModeReg | Return MC EFC Mode Regsiter
AT91F_MC_EFC_PerformCmd | Perform EFC Command

## MC Register Description

#### MC: AT91_REG MC_RCR MC Remap Control Register

- MC AT91C_MC_RCR 0xFFFFFF00

Offset | Name | Description
0 | MC_RCB AT91C_MC_RCB | Remap Command Bit 0: No effect. 1: This Command Bit acts on a toggle basis: writing a 1 alternatively cancels and restores the remapping of the page zero memory devices.

#### MC: AT91_REG MC_ASR MC Abort Status Register

- MC AT91C_MC_ASR 0xFFFFFF04

Offset | Name | Description
0 | MC_UNDADD AT91C_MC_UNDADD | Undefined Addess Abort Status 0: The last abort is not due to the access of an undefined address in the address space. 1: The last abort is due to the access of an undefined address in the address space.
1 | MC_MISADD AT91C_MC_MISADD | Misaligned Addess Abort Status 0: During the last aborted access, the address was not unaligned. 1: During the last aborted access, the address was unaligned.
9..8 | MC_ABTSZ AT91C_MC_ABTSZ | Abort Size Status This field gives the size of the aborted access of the current master. Value | Label | Description
0 | MC_ABTSZ_BYTE AT91C_MC_ABTSZ_BYTE | Byte
1 | MC_ABTSZ_HWORD AT91C_MC_ABTSZ_HWORD | Half-word
2 | MC_ABTSZ_WORD AT91C_MC_ABTSZ_WORD | Word
11..10 | MC_ABTTYP AT91C_MC_ABTTYP | Abort Type Status This field gives the type of the aborted access of the current master. Value | Label | Description
0 | MC_ABTTYP_DATAR AT91C_MC_ABTTYP_DATAR | Data Read
1 | MC_ABTTYP_DATAW AT91C_MC_ABTTYP_DATAW | Data Write
2 | MC_ABTTYP_FETCH AT91C_MC_ABTTYP_FETCH | Code Fetch
16 | MC_MST0 AT91C_MC_MST0 | Master 0 Abort Source 0: The last abort was not due to the Master 0. 1: The last abort was due to the Master 0.
17 | MC_MST1 AT91C_MC_MST1 | Master 1 Abort Source 0: The last abort was not due to the Master 1. 1: The last abort was due to the Master 1.
24 | MC_SVMST0 AT91C_MC_SVMST0 | Saved Master 0 Abort Source 0: No abort due to the Master 0 occurred since the last read of MC_ASR or it is notified in the bit MST0. 1: At least one abort due to the Master 0 occurred since the last read of MC_ASR.
25 | MC_SVMST1 AT91C_MC_SVMST1 | Saved Master 1 Abort Source 0: No abort due to the Master 1 occurred since the last read of MC_ASR or it is notified in the bit MST1. 1: At least one abort due to the Master 1 occurred since the last read of MC_ASR.

#### MC: AT91_REG MC_AASR MC Abort Address Status Register

- MC AT91C_MC_AASR 0xFFFFFF08

This register contains the address of the last aborted access

#### MC: AT91_REG MC_FMR MC Flash Mode Register

- MC AT91C_MC_FMR 0xFFFFFF60

For MC_FRDY, MC_LOCKE and MC_PROGE, 0: Interrupt enabled, 1: Interrupt disabled

Offset | Name | Description
0 | MC_FRDY AT91C_MC_FRDY | Flash Ready 0 = FRDY high in MC_FSR does not generate an interrupt 1= FRDY high in MC_FSR generates an interrupt
2 | MC_LOCKE AT91C_MC_LOCKE | Lock Error 0 = LOCKE high in MC_FSR does not generate an interrupt 1 = LOCKE high in MC_FSR generates an interrupt
3 | MC_PROGE AT91C_MC_PROGE | Programming Error 0 = PROGE high in MC_FSR does not generate an interrupt 1 = PROGE high in MC_FSR generates an interrupt
7 | MC_NEBP AT91C_MC_NEBP | No Erase Before Programming 0: A page erase is performed before programming. 1: No erase is performed before programming.
9..8 | MC_FWS AT91C_MC_FWS | Flash Wait State This field defines the number of wait states for read and write operations. Value | Label | Description
0 | MC_FWS_0FWS AT91C_MC_FWS_0FWS | 1 cycle for Read, 2 for Write operations
1 | MC_FWS_1FWS AT91C_MC_FWS_1FWS | 2 cycles for Read, 3 for Write operations
2 | MC_FWS_2FWS AT91C_MC_FWS_2FWS | 3 cycles for Read, 4 for Write operations
3 | MC_FWS_3FWS AT91C_MC_FWS_3FWS | 4 cycles for Read, 4 for Write operations
23..16 | MC_FMCN AT91C_MC_FMCN | Flash Microsecond Cycle Number This field defines the number of Master Clock cycles in one microsecond. The value 0 corresponds to the timings for a 33.3 kHz clock.

#### MC: AT91_REG MC_FCR MC Flash Command Register

- MC AT91C_MC_FCR 0xFFFFFF64

Offset | Name | Description
3..0 | MC_FCMD AT91C_MC_FCMD | Flash Command This field defines the different flash commands. Value | Label | Description
1 | MC_FCMD_START_PROG AT91C_MC_FCMD_START_PROG | Starts the programming of th epage specified by PAGEN.
2 | MC_FCMD_LOCK AT91C_MC_FCMD_LOCK | Starts a lock sequence of the sector defined by the bits 4 to 7 of the field PAGEN.
3 | MC_FCMD_PROG_AND_LOCK AT91C_MC_FCMD_PROG_AND_LOCK | The lock sequence automatically happens after the programming sequence is completed.
4 | MC_FCMD_UNLOCK AT91C_MC_FCMD_UNLOCK | Starts an unlock sequence of the sector defined by the bits 4 to 7 of the field PAGEN.
8 | MC_FCMD_ERASE_ALL AT91C_MC_FCMD_ERASE_ALL | Starts the erase of the entire flash.If at least a page is locked, the command is cancelled.
11 | MC_FCMD_SET_GP_NVM AT91C_MC_FCMD_SET_GP_NVM | Set General Purpose NVM bits.
13 | MC_FCMD_CLR_GP_NVM AT91C_MC_FCMD_CLR_GP_NVM | Clear General Purpose NVM bits.
15 | MC_FCMD_SET_SECURITY AT91C_MC_FCMD_SET_SECURITY | Set Security Bit.
17..8 | MC_PAGEN AT91C_MC_PAGEN | Page Number This field defines the page/sector currently in use, whatever it is for programming, locking or unlocking.
31..24 | MC_KEY AT91C_MC_KEY | Writing Protect Key This field should be written with the value 0x5A to enable the command defined by the bits of the register. If the field is written with a different value, the write is actually not performed and no action is started.

#### MC: AT91_REG MC_FSR MC Flash Status Register

- MC AT91C_MC_FSR 0xFFFFFF68

Offset | Name | Description
0 | MC_FRDY AT91C_MC_FRDY | Flash Ready 0 = FRDY high in MC_FSR does not generate an interrupt 1= FRDY high in MC_FSR generates an interrupt
2 | MC_LOCKE AT91C_MC_LOCKE | Lock Error 0 = LOCKE high in MC_FSR does not generate an interrupt 1 = LOCKE high in MC_FSR generates an interrupt
3 | MC_PROGE AT91C_MC_PROGE | Programming Error 0 = PROGE high in MC_FSR does not generate an interrupt 1 = PROGE high in MC_FSR generates an interrupt
4 | MC_SECURITY AT91C_MC_SECURITY | Security Bit Status 0: Security Bit is not set. 1:Security Bit is set.
8 | MC_GPNVM0 AT91C_MC_GPNVM0 | Sector 0 Lock Status 0: General purpose NVM bit is not set. 1:General purpose NVM bit is set.
9 | MC_GPNVM1 AT91C_MC_GPNVM1 | Sector 1 Lock Status 0: General purpose NVM bit is not set. 1:General purpose NVM bit is set.
10 | MC_GPNVM2 AT91C_MC_GPNVM2 | Sector 2 Lock Status 0: General purpose NVM bit is not set. 1:General purpose NVM bit is set.
11 | MC_GPNVM3 AT91C_MC_GPNVM3 | Sector 3 Lock Status 0: General purpose NVM bit is not set. 1:General purpose NVM bit is set.
12 | MC_GPNVM4 AT91C_MC_GPNVM4 | Sector 4 Lock Status 0: General purpose NVM bit is not set. 1:General purpose NVM bit is set.
13 | MC_GPNVM5 AT91C_MC_GPNVM5 | Sector 5 Lock Status 0: General purpose NVM bit is not set. 1:General purpose NVM bit is set.
14 | MC_GPNVM6 AT91C_MC_GPNVM6 | Sector 6 Lock Status 0: General purpose NVM bit is not set. 1:General purpose NVM bit is set.
15 | MC_GPNVM7 AT91C_MC_GPNVM7 | Sector 7 Lock Status 0: General purpose NVM bit is not set. 1:General purpose NVM bit is set.
16 | MC_LOCKS0 AT91C_MC_LOCKS0 | Sector 0 Lock Status 0: The corresponding sector is not locked. 1:The corresponding sector is locked.
17 | MC_LOCKS1 AT91C_MC_LOCKS1 | Sector 1 Lock Status 0: The corresponding sector is not locked. 1:The corresponding sector is locked.
18 | MC_LOCKS2 AT91C_MC_LOCKS2 | Sector 2 Lock Status 0: The corresponding sector is not locked. 1:The corresponding sector is locked.
19 | MC_LOCKS3 AT91C_MC_LOCKS3 | Sector 3 Lock Status 0: The corresponding sector is not locked. 1:The corresponding sector is locked.
20 | MC_LOCKS4 AT91C_MC_LOCKS4 | Sector 4 Lock Status 0: The corresponding sector is not locked. 1:The corresponding sector is locked.
21 | MC_LOCKS5 AT91C_MC_LOCKS5 | Sector 5 Lock Status 0: The corresponding sector is not locked. 1:The corresponding sector is locked.
22 | MC_LOCKS6 AT91C_MC_LOCKS6 | Sector 6 Lock Status 0: The corresponding sector is not locked. 1:The corresponding sector is locked.
23 | MC_LOCKS7 AT91C_MC_LOCKS7 | Sector 7 Lock Status 0: The corresponding sector is not locked. 1:The corresponding sector is locked.
24 | MC_LOCKS8 AT91C_MC_LOCKS8 | Sector 8 Lock Status 0: The corresponding sector is not locked. 1:The corresponding sector is locked.
25 | MC_LOCKS9 AT91C_MC_LOCKS9 | Sector 9 Lock Status 0: The corresponding sector is not locked. 1:The corresponding sector is locked.
26 | MC_LOCKS10 AT91C_MC_LOCKS10 | Sector 10 Lock Status 0: The corresponding sector is not locked. 1:The corresponding sector is locked.
27 | MC_LOCKS11 AT91C_MC_LOCKS11 | Sector 11 Lock Status 0: The corresponding sector is not locked. 1:The corresponding sector is locked.
28 | MC_LOCKS12 AT91C_MC_LOCKS12 | Sector 12 Lock Status 0: The corresponding sector is not locked. 1:The corresponding sector is locked.
29 | MC_LOCKS13 AT91C_MC_LOCKS13 | Sector 13 Lock Status 0: The corresponding sector is not locked. 1:The corresponding sector is locked.
30 | MC_LOCKS14 AT91C_MC_LOCKS14 | Sector 14 Lock Status 0: The corresponding sector is not locked. 1:The corresponding sector is locked.
31 | MC_LOCKS15 AT91C_MC_LOCKS15 | Sector 15 Lock Status 0: The corresponding sector is not locked. 1:The corresponding sector is locked.