Robobo
efc.h
Go to the documentation of this file.
1 
44 #ifndef EFC_H_INCLUDED
45 #define EFC_H_INCLUDED
46 
47 #include "../chip.h"
48 
50 
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
54 
55 
58 typedef enum efc_rc {
60  EFC_RC_OK = 0,
61  EFC_RC_YES = 0,
62  EFC_RC_NO = 1,
65  EFC_RC_NOT_SUPPORT = 0xFFFFFFFF
66 } efc_rc_t;
68 
70 #define EFC_FCMD_GETD 0x00
72 #define EFC_FCMD_WP 0x01
73 #define EFC_FCMD_WPL 0x02
74 #define EFC_FCMD_EWP 0x03
75 #define EFC_FCMD_EWPL 0x04
76 #define EFC_FCMD_EA 0x05
77 #if (SAM3SD8_SERIES)
78 #define EFC_FCMD_EPL 0x06
79 #endif
80 #if (SAM4S_SERIES)
81 #define EFC_FCMD_EPA 0x07
82 #endif
83 #define EFC_FCMD_SLB 0x08
84 #define EFC_FCMD_CLB 0x09
85 #define EFC_FCMD_GLB 0x0A
86 #define EFC_FCMD_SGPB 0x0B
87 #define EFC_FCMD_CGPB 0x0C
88 #define EFC_FCMD_GGPB 0x0D
89 #define EFC_FCMD_STUI 0x0E
90 #define EFC_FCMD_SPUI 0x0F
91 #if (SAM3S_SERIES || SAM3N_SERIES || SAM3XA_SERIES || SAM4S_SERIES)
92 #define EFC_FCMD_GCALB 0x10
93 #endif
94 #if (SAM4S_SERIES)
95 #define EFC_FCMD_ES 0x11
96 #define EFC_FCMD_WUS 0x12
97 #define EFC_FCMD_EUS 0x13
98 #define EFC_FCMD_STUS 0x14
99 #define EFC_FCMD_SPUS 0x15
100 #endif
101 
104 #define CHIP_FLASH_IAP_ADDRESS (IROM_ADDR + 8)
105 
107 #define EFC_ACCESS_MODE_128 0
109 #define EFC_ACCESS_MODE_64 EEFC_FMR_FAM
110 
112 uint32_t efc_init(Efc *p_efc, uint32_t ul_access_mode, uint32_t ul_fws);
113 void efc_enable_frdy_interrupt(Efc *p_efc);
114 void efc_disable_frdy_interrupt(Efc *p_efc);
115 void efc_set_flash_access_mode(Efc *p_efc, uint32_t ul_mode);
116 uint32_t efc_get_flash_access_mode(Efc *p_efc);
117 void efc_set_wait_state(Efc *p_efc, uint32_t ul_fws);
118 uint32_t efc_get_wait_state(Efc *p_efc);
119 uint32_t efc_perform_command(Efc *p_efc, uint32_t ul_command, uint32_t ul_argument);
120 uint32_t efc_get_status(Efc *p_efc);
121 uint32_t efc_get_result(Efc *p_efc);
122 uint32_t efc_perform_read_sequence(Efc *p_efc, uint32_t ul_cmd_st, uint32_t ul_cmd_sp, uint32_t *p_ul_buf, uint32_t ul_size);
123 
125 
126 #ifdef __cplusplus
127 }
128 #endif
129 
130 
132 #endif /* EFC_H_INCLUDED */
efc_rc
Definition: efc.h:59
uint32_t efc_get_flash_access_mode(Efc *p_efc)
Get flash access mode.
Definition: efc.c:154
void efc_set_wait_state(Efc *p_efc, uint32_t ul_fws)
Set flash wait state.
Definition: efc.c:165
Yes.
Definition: efc.h:61
void efc_enable_frdy_interrupt(Efc *p_efc)
Enable the flash ready interrupt.
Definition: efc.c:115
void efc_set_flash_access_mode(Efc *p_efc, uint32_t ul_mode)
Set flash access mode.
Definition: efc.c:140
uint32_t efc_init(Efc *p_efc, uint32_t ul_access_mode, uint32_t ul_fws)
Initialize the EFC controller.
Definition: efc.c:104
General error.
Definition: efc.h:63
Operation is not supported.
Definition: efc.h:65
uint32_t efc_get_result(Efc *p_efc)
Get the result of the last executed command.
Definition: efc.c:265
uint32_t efc_perform_command(Efc *p_efc, uint32_t ul_command, uint32_t ul_argument)
Perform the given command and wait until its completion (or an error).
Definition: efc.c:197
uint32_t efc_get_wait_state(Efc *p_efc)
Get flash wait state.
Definition: efc.c:179
No.
Definition: efc.h:62
Operation OK.
Definition: efc.h:60
void efc_disable_frdy_interrupt(Efc *p_efc)
Disable the flash ready interrupt.
Definition: efc.c:127
Invalid argument input.
Definition: efc.h:64
uint32_t efc_get_status(Efc *p_efc)
Get the current status of the EEFC.
Definition: efc.c:253
Efc hardware registers.
Definition: component_efc.h:41