diff options
Diffstat (limited to 'tmk_core/common/chibios/eeprom.c')
-rw-r--r-- | tmk_core/common/chibios/eeprom.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tmk_core/common/chibios/eeprom.c b/tmk_core/common/chibios/eeprom.c index 5ff8ee86f..9061b790c 100644 --- a/tmk_core/common/chibios/eeprom.c +++ b/tmk_core/common/chibios/eeprom.c | |||
@@ -79,6 +79,10 @@ | |||
79 | #define EEESIZE 0x39 | 79 | #define EEESIZE 0x39 |
80 | #endif | 80 | #endif |
81 | 81 | ||
82 | /** \brief eeprom initialization | ||
83 | * | ||
84 | * FIXME: needs doc | ||
85 | */ | ||
82 | void eeprom_initialize(void) | 86 | void eeprom_initialize(void) |
83 | { | 87 | { |
84 | uint32_t count=0; | 88 | uint32_t count=0; |
@@ -111,6 +115,10 @@ void eeprom_initialize(void) | |||
111 | 115 | ||
112 | #define FlexRAM ((uint8_t *)0x14000000) | 116 | #define FlexRAM ((uint8_t *)0x14000000) |
113 | 117 | ||
118 | /** \brief eeprom read byte | ||
119 | * | ||
120 | * FIXME: needs doc | ||
121 | */ | ||
114 | uint8_t eeprom_read_byte(const uint8_t *addr) | 122 | uint8_t eeprom_read_byte(const uint8_t *addr) |
115 | { | 123 | { |
116 | uint32_t offset = (uint32_t)addr; | 124 | uint32_t offset = (uint32_t)addr; |
@@ -119,6 +127,10 @@ uint8_t eeprom_read_byte(const uint8_t *addr) | |||
119 | return FlexRAM[offset]; | 127 | return FlexRAM[offset]; |
120 | } | 128 | } |
121 | 129 | ||
130 | /** \brief eeprom read word | ||
131 | * | ||
132 | * FIXME: needs doc | ||
133 | */ | ||
122 | uint16_t eeprom_read_word(const uint16_t *addr) | 134 | uint16_t eeprom_read_word(const uint16_t *addr) |
123 | { | 135 | { |
124 | uint32_t offset = (uint32_t)addr; | 136 | uint32_t offset = (uint32_t)addr; |
@@ -127,6 +139,10 @@ uint16_t eeprom_read_word(const uint16_t *addr) | |||
127 | return *(uint16_t *)(&FlexRAM[offset]); | 139 | return *(uint16_t *)(&FlexRAM[offset]); |
128 | } | 140 | } |
129 | 141 | ||
142 | /** \brief eeprom read dword | ||
143 | * | ||
144 | * FIXME: needs doc | ||
145 | */ | ||
130 | uint32_t eeprom_read_dword(const uint32_t *addr) | 146 | uint32_t eeprom_read_dword(const uint32_t *addr) |
131 | { | 147 | { |
132 | uint32_t offset = (uint32_t)addr; | 148 | uint32_t offset = (uint32_t)addr; |
@@ -135,6 +151,10 @@ uint32_t eeprom_read_dword(const uint32_t *addr) | |||
135 | return *(uint32_t *)(&FlexRAM[offset]); | 151 | return *(uint32_t *)(&FlexRAM[offset]); |
136 | } | 152 | } |
137 | 153 | ||
154 | /** \brief eeprom read block | ||
155 | * | ||
156 | * FIXME: needs doc | ||
157 | */ | ||
138 | void eeprom_read_block(void *buf, const void *addr, uint32_t len) | 158 | void eeprom_read_block(void *buf, const void *addr, uint32_t len) |
139 | { | 159 | { |
140 | uint32_t offset = (uint32_t)addr; | 160 | uint32_t offset = (uint32_t)addr; |
@@ -148,11 +168,19 @@ void eeprom_read_block(void *buf, const void *addr, uint32_t len) | |||
148 | } | 168 | } |
149 | } | 169 | } |
150 | 170 | ||
171 | /** \brief eeprom is ready | ||
172 | * | ||
173 | * FIXME: needs doc | ||
174 | */ | ||
151 | int eeprom_is_ready(void) | 175 | int eeprom_is_ready(void) |
152 | { | 176 | { |
153 | return (FTFL->FCNFG & FTFL_FCNFG_EEERDY) ? 1 : 0; | 177 | return (FTFL->FCNFG & FTFL_FCNFG_EEERDY) ? 1 : 0; |
154 | } | 178 | } |
155 | 179 | ||
180 | /** \brief flexram wait | ||
181 | * | ||
182 | * FIXME: needs doc | ||
183 | */ | ||
156 | static void flexram_wait(void) | 184 | static void flexram_wait(void) |
157 | { | 185 | { |
158 | while (!(FTFL->FCNFG & FTFL_FCNFG_EEERDY)) { | 186 | while (!(FTFL->FCNFG & FTFL_FCNFG_EEERDY)) { |
@@ -160,6 +188,10 @@ static void flexram_wait(void) | |||
160 | } | 188 | } |
161 | } | 189 | } |
162 | 190 | ||
191 | /** \brief eeprom_write_byte | ||
192 | * | ||
193 | * FIXME: needs doc | ||
194 | */ | ||
163 | void eeprom_write_byte(uint8_t *addr, uint8_t value) | 195 | void eeprom_write_byte(uint8_t *addr, uint8_t value) |
164 | { | 196 | { |
165 | uint32_t offset = (uint32_t)addr; | 197 | uint32_t offset = (uint32_t)addr; |
@@ -172,6 +204,10 @@ void eeprom_write_byte(uint8_t *addr, uint8_t value) | |||
172 | } | 204 | } |
173 | } | 205 | } |
174 | 206 | ||
207 | /** \brief eeprom write word | ||
208 | * | ||
209 | * FIXME: needs doc | ||
210 | */ | ||
175 | void eeprom_write_word(uint16_t *addr, uint16_t value) | 211 | void eeprom_write_word(uint16_t *addr, uint16_t value) |
176 | { | 212 | { |
177 | uint32_t offset = (uint32_t)addr; | 213 | uint32_t offset = (uint32_t)addr; |
@@ -199,6 +235,10 @@ void eeprom_write_word(uint16_t *addr, uint16_t value) | |||
199 | #endif | 235 | #endif |
200 | } | 236 | } |
201 | 237 | ||
238 | /** \brief eeprom write dword | ||
239 | * | ||
240 | * FIXME: needs doc | ||
241 | */ | ||
202 | void eeprom_write_dword(uint32_t *addr, uint32_t value) | 242 | void eeprom_write_dword(uint32_t *addr, uint32_t value) |
203 | { | 243 | { |
204 | uint32_t offset = (uint32_t)addr; | 244 | uint32_t offset = (uint32_t)addr; |
@@ -242,6 +282,10 @@ void eeprom_write_dword(uint32_t *addr, uint32_t value) | |||
242 | #endif | 282 | #endif |
243 | } | 283 | } |
244 | 284 | ||
285 | /** \brief eeprom write block | ||
286 | * | ||
287 | * FIXME: needs doc | ||
288 | */ | ||
245 | void eeprom_write_block(const void *buf, void *addr, uint32_t len) | 289 | void eeprom_write_block(const void *buf, void *addr, uint32_t len) |
246 | { | 290 | { |
247 | uint32_t offset = (uint32_t)addr; | 291 | uint32_t offset = (uint32_t)addr; |