MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / flash_write_buffer

Function flash_write_buffer

Tools/AP_Bootloader/support.cpp:219–244  ·  view source on GitHub ↗

write to flash with buffering to 32 bytes alignment */

Source from the content-addressed store, hash-verified

217 write to flash with buffering to 32 bytes alignment
218 */
219bool flash_write_buffer(uint32_t address, const uint32_t *v, uint8_t nwords)
220{
221 if (fbuf.n > 0 && address != fbuf.address + fbuf.n*4) {
222 if (!flash_write_flush()) {
223 return false;
224 }
225 }
226 while (nwords > 0) {
227 if (fbuf.n == 0) {
228 fbuf.address = address;
229 memset(fbuf.buffer, 0xff, sizeof(fbuf.buffer));
230 }
231 uint8_t n = MIN(ARRAY_SIZE(fbuf.buffer)-fbuf.n, nwords);
232 memcpy(&fbuf.buffer[fbuf.n], v, n*4);
233 address += n*4;
234 v += n;
235 nwords -= n;
236 fbuf.n += n;
237 if (fbuf.n == ARRAY_SIZE(fbuf.buffer)) {
238 if (!flash_write_flush()) {
239 return false;
240 }
241 }
242 }
243 return true;
244}
245
246uint32_t get_mcu_id(void)
247{

Callers 3

bl_protocol.cppFile · 0.85
handle_postMethod · 0.85

Calls 4

flash_write_flushFunction · 0.85
memsetFunction · 0.85
MINFunction · 0.85
memcpyFunction · 0.85

Tested by

no test coverage detected