Modbus Vault v1.0
Loading...
Searching...
No Matches
blackbox_logger_internal.h File Reference

Flash-backed circular logging system header internals. More...

#include "blackbox_logger.h"
#include <stdint.h>
Include dependency graph for blackbox_logger_internal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  __attribute__
 Blackbox logger entry header structure. More...
 

Macros

#define BLACKBOX_LOGGER_HEADER_MAGIC   (0x5355424DUL)
 
#define BLACKBOX_LOGGER_TAIL_MAGIC   (0x4D425553UL)
 
#define BLACKBOX_LOGGER_ENTRY_SIZE_WITHOUT_DATA_LENGTH
 
#define BLACKBOX_LOGGER_WRITE_LOCK_TIMEOUT_MS   (50U)
 
#define BLACKBOX_LOGGER_SECTOR_LOCK_TIMEOUT_MS   (500U)
 

Functions

size_t align_num_up_helper (size_t number, size_t align_to)
 Align-up number.
 
size_t entry_total_size_helper (size_t data_length)
 Calculates entry total size.
 
size_t entry_total_aligned_size_helper (size_t data_length, size_t align_to)
 Calculates entry total aligned size.
 
static bool is_logically_next_in_order_helper (uint32_t candidate, uint32_t reference)
 Check if candidate comes after reference taking wrap-around into account.
 

Detailed Description

Flash-backed circular logging system header internals.

Author
Abanoub Salah

Blackbox logger internal header provides different definitions and structures needed by the logger

Macro Definition Documentation

◆ BLACKBOX_LOGGER_ENTRY_SIZE_WITHOUT_DATA_LENGTH

#define BLACKBOX_LOGGER_ENTRY_SIZE_WITHOUT_DATA_LENGTH
Value:
(sizeof (blackbox_logger_entry_header_t) + \
sizeof (blackbox_logger_entry_tail_t))

Entry size without data field

◆ BLACKBOX_LOGGER_HEADER_MAGIC

#define BLACKBOX_LOGGER_HEADER_MAGIC   (0x5355424DUL)

"MBUS" reversed

◆ BLACKBOX_LOGGER_SECTOR_LOCK_TIMEOUT_MS

#define BLACKBOX_LOGGER_SECTOR_LOCK_TIMEOUT_MS   (500U)

Sector lock wait timeout in micro seconds

◆ BLACKBOX_LOGGER_TAIL_MAGIC

#define BLACKBOX_LOGGER_TAIL_MAGIC   (0x4D425553UL)

"SUBM" reversed

◆ BLACKBOX_LOGGER_WRITE_LOCK_TIMEOUT_MS

#define BLACKBOX_LOGGER_WRITE_LOCK_TIMEOUT_MS   (50U)

Write lock wait timeout in micro seconds

Function Documentation

◆ align_num_up_helper()

size_t align_num_up_helper ( size_t  number,
size_t  align_to 
)
inline

Align-up number.

Align number up-to nearest multiple configurable in kconfig

Parameters
numberNumber to align
align_toAlign to nearest
Returns
size_t Aligned number
Here is the caller graph for this function:

◆ entry_total_aligned_size_helper()

size_t entry_total_aligned_size_helper ( size_t  data_length,
size_t  align_to 
)

Calculates entry total aligned size.

Parameters
data_lengthLength of data
align_toAlign to nearest
Returns
size_t Total entry size

< Entry size without data field

Here is the call graph for this function:
Here is the caller graph for this function:

◆ entry_total_size_helper()

size_t entry_total_size_helper ( size_t  data_length)
inline

Calculates entry total size.

Parameters
data_lengthLength of data
Returns
size_t Total entry size

< Entry size without data field

◆ is_logically_next_in_order_helper()

static bool is_logically_next_in_order_helper ( uint32_t  candidate,
uint32_t  reference 
)
inlinestatic

Check if candidate comes after reference taking wrap-around into account.

Parameters
candidateCandidate number
referenceReference number
Returns
bool true if candidate is logically "after" reference
Here is the caller graph for this function: