ACwing FC firmware
STM32WB55: attitude IEKF, altitude Kalman filter, flight core, protocol v2
Loading...
Searching...
No Matches
log_store.h
Go to the documentation of this file.
1
19
#ifndef LOG_STORE_H
20
#define LOG_STORE_H
21
22
#include <stdint.h>
23
#include "
log_format.h
"
24
25
#define LOG_LIST_MAX 64u
26
28
typedef
struct
{
29
void
*
ctx
;
30
uint32_t
size
;
31
int (*read)(
void
*ctx, uint32_t
addr
,
void
*buf, uint32_t
n
);
32
int (*prog)(
void
*ctx, uint32_t
addr
,
const
void
*buf, uint32_t
n
);
33
int (*erase)(
void
*ctx, uint32_t
addr
);
34
}
log_flash_t
;
35
36
typedef
struct
{
37
uint16_t
id
;
38
uint16_t
first
;
39
uint16_t
nsect
;
40
uint8_t
truncated
;
41
uint8_t
active
;
42
uint32_t
t0_ms
;
43
}
log_entry_t
;
44
45
int
log_mount
(
const
log_flash_t
*f);
46
uint8_t
log_count
(
void
);
47
const
log_entry_t
*
log_entry
(uint8_t index);
48
const
log_entry_t
*
log_find
(uint16_t
id
);
49
uint8_t
log_used_pct
(
void
);
50
51
int
log_open
(uint32_t t0_ms);
52
int
log_append
(uint8_t type,
const
void
*payload, uint8_t len);
53
int
log_close
(
void
);
54
uint8_t
log_is_open
(
void
);
55
57
int
log_read
(uint16_t
id
, uint32_t offset,
void
*buf, uint32_t
n
);
58
uint32_t
log_size
(uint16_t
id
);
61
int
log_erase_all
(
void
);
62
63
#endif
/* LOG_STORE_H */
n
uint32_t n
Definition
calib_mgr.c:35
log_format.h
On-flash format of the ACwing flight log (format 1).
addr
static uint32_t addr(uint16_t sect)
Definition
log_store.c:49
log_count
uint8_t log_count(void)
Definition
log_store.c:120
log_find
const log_entry_t * log_find(uint16_t id)
Definition
log_store.c:124
log_append
int log_append(uint8_t type, const void *payload, uint8_t len)
Definition
log_store.c:193
log_open
int log_open(uint32_t t0_ms)
0 = ok
Definition
log_store.c:182
log_close
int log_close(void)
Definition
log_store.c:214
log_mount
int log_mount(const log_flash_t *f)
0 = ok (empty flash is ok)
Definition
log_store.c:82
log_used_pct
uint8_t log_used_pct(void)
Definition
log_store.c:130
log_read
int log_read(uint16_t id, uint32_t offset, void *buf, uint32_t n)
bytes of a closed log 'id' from 'offset' (sectors concatenated, headers included)
Definition
log_store.c:230
log_size
uint32_t log_size(uint16_t id)
nsect × LOG_SECTOR, 0 unknown
Definition
log_store.c:224
log_is_open
uint8_t log_is_open(void)
Definition
log_store.c:122
log_entry
const log_entry_t * log_entry(uint8_t index)
oldest first
Definition
log_store.c:121
log_erase_all
int log_erase_all(void)
erases every sector that holds data; logs restart from id 1
Definition
log_store.c:246
log_entry_t
Definition
log_store.h:36
log_entry_t::t0_ms
uint32_t t0_ms
Definition
log_store.h:42
log_entry_t::first
uint16_t first
sector of the lowest seq still present
Definition
log_store.h:38
log_entry_t::id
uint16_t id
Definition
log_store.h:37
log_entry_t::nsect
uint16_t nsect
Definition
log_store.h:39
log_entry_t::active
uint8_t active
being written now
Definition
log_store.h:41
log_entry_t::truncated
uint8_t truncated
seq 0 overwritten
Definition
log_store.h:40
log_flash_t
flash backend; addresses in bytes from the start of the log area
Definition
log_store.h:28
log_flash_t::ctx
void * ctx
Definition
log_store.h:29
log_flash_t::size
uint32_t size
multiple of LOG_SECTOR
Definition
log_store.h:30
log
log_store.h
Generated by
1.9.8