Blackbox device type 'file' (SITL) considered working when file handler is available
[inav.git] / src / main / config / config_streamer_ram.c
blob420e2a0e6ce09a36f5457139244e1dbb084c4f6d
1 /*
2 * This file is part of Cleanflight.
4 * Cleanflight is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Cleanflight is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
18 #include <string.h>
19 #include "platform.h"
20 #include "drivers/system.h"
21 #include "config/config_streamer.h"
23 #if defined(CONFIG_IN_RAM)
25 static bool streamerLocked = true;
27 void config_streamer_impl_unlock(void)
29 streamerLocked = false;
32 void config_streamer_impl_lock(void)
34 streamerLocked = true;
37 int config_streamer_impl_write_word(config_streamer_t *c, config_streamer_buffer_align_type_t *buffer)
39 if (streamerLocked) {
40 return -1;
43 if (c->address == (uintptr_t)&eepromData[0]) {
44 ZERO_FARRAY(eepromData);
47 config_streamer_buffer_align_type_t *destAddr = (config_streamer_buffer_align_type_t *)c->address;
48 config_streamer_buffer_align_type_t *srcAddr = buffer;
50 uint8_t nRows = CONFIG_STREAMER_BUFFER_SIZE / sizeof(config_streamer_buffer_align_type_t);
52 do {
53 *destAddr++ = *srcAddr++;
54 } while(--nRows != 0);
56 c->address += CONFIG_STREAMER_BUFFER_SIZE;
58 return 0;
61 #endif