Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
sdlog_chibios.c File Reference
+ Include dependency graph for sdlog_chibios.c:

Go to the source code of this file.

Macros

#define SDLOG_START_DELAY   30
 
#define SDLOG_AUTO_FLUSH_PERIOD   10
 
#define SDLOG_CONTIGUOUS_STORAGE_MEM   50
 
#define DefaultAdcOfVoltage(voltage)   ((uint32_t) (voltage/(DefaultVoltageOfAdc(1))))
 

Enumerations

enum  { SDLOG_STOPPED = 0, SDLOG_RUNNING, SDLOG_ERROR }
 sdlog status More...
 

Functions

static THD_WORKING_AREA (wa_thd_startlog, 2048)
 
static void thd_startlog (void *arg)
 
static THD_WORKING_AREA (wa_thd_bat_survey, 1024)
 
static void thd_bat_survey (void *arg)
 
static void powerOutageIsr (void)
 
static void send_sdlog_status (struct transport_tx *trans, struct link_device *dev)
 
static int sdlog_check_free_space (struct chibios_sdlog *p, long *fd, uint16_t len)
 
static void sdlog_transmit (struct chibios_sdlog *p, long fd, uint8_t byte)
 
static void sdlog_transmit_buffer (struct chibios_sdlog *p, long fd, uint8_t *data, uint16_t len)
 
static void sdlog_send (struct chibios_sdlog *p, long fd)
 
static int null_function (struct chibios_sdlog *p)
 
static uint8_t null_byte_function (struct chibios_sdlog *p)
 
void chibios_sdlog_init (struct chibios_sdlog *sdlog, FileDes *file)
 init chibios_sdlog structure More...
 
void sdlog_chibios_init (void)
 
void sdlog_chibios_finish (const bool flush)
 

Variables

static const uint16_t V_ALERT = DefaultAdcOfVoltage(5.5f)
 
static const char PPRZ_LOG_NAME [] = "pprzlog_"
 
static const char PPRZ_LOG_DIR [] = "PPRZ"
 
event_source_t powerOutageSource
 
event_listener_t powerOutageListener
 
bool sdOk = false
 
FileDes pprzLogFile = -1
 
struct chibios_sdlog chibios_sdlog
 
static enum { ... }  chibios_sdlog_status
 sdlog status More...
 
static char chibios_sdlog_filenames [68]
 sdlog filenames More...
 
static char NO_FILE_NAME [] = "none"
 

Macro Definition Documentation

◆ DefaultAdcOfVoltage

#define DefaultAdcOfVoltage (   voltage)    ((uint32_t) (voltage/(DefaultVoltageOfAdc(1))))

Definition at line 64 of file sdlog_chibios.c.

◆ SDLOG_AUTO_FLUSH_PERIOD

#define SDLOG_AUTO_FLUSH_PERIOD   10

Definition at line 52 of file sdlog_chibios.c.

◆ SDLOG_CONTIGUOUS_STORAGE_MEM

#define SDLOG_CONTIGUOUS_STORAGE_MEM   50

Definition at line 57 of file sdlog_chibios.c.

◆ SDLOG_START_DELAY

#define SDLOG_START_DELAY   30

Definition at line 47 of file sdlog_chibios.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

sdlog status

Enumerator
SDLOG_STOPPED 
SDLOG_RUNNING 
SDLOG_ERROR 

Definition at line 98 of file sdlog_chibios.c.

Function Documentation

◆ chibios_sdlog_init()

void chibios_sdlog_init ( struct chibios_sdlog sdlog,
FileDes file 
)

init chibios_sdlog structure

Definition at line 165 of file sdlog_chibios.c.

References chibios_sdlog::device, chibios_sdlog::file, null_byte_function(), null_function(), sdlog_check_free_space(), sdlog_send(), sdlog_transmit(), and sdlog_transmit_buffer().

Referenced by flight_recorder_init(), and thd_startlog().

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

◆ null_byte_function()

static uint8_t null_byte_function ( struct chibios_sdlog p)
static

Definition at line 163 of file sdlog_chibios.c.

Referenced by chibios_sdlog_init().

+ Here is the caller graph for this function:

◆ null_function()

static int null_function ( struct chibios_sdlog p)
static

Definition at line 162 of file sdlog_chibios.c.

Referenced by chibios_sdlog_init().

+ Here is the caller graph for this function:

◆ powerOutageIsr()

static void powerOutageIsr ( void  )
static

Definition at line 336 of file sdlog_chibios.c.

References powerOutageSource.

Referenced by thd_bat_survey().

+ Here is the caller graph for this function:

◆ sdlog_check_free_space()

static int sdlog_check_free_space ( struct chibios_sdlog p,
long *  fd,
uint16_t  len 
)
static

Definition at line 129 of file sdlog_chibios.c.

References fd, SDLOG_OK, and status.

Referenced by chibios_sdlog_init().

+ Here is the caller graph for this function:

◆ sdlog_chibios_finish()

void sdlog_chibios_finish ( const bool  flush)

Definition at line 196 of file sdlog_chibios.c.

References chibios_sdlog_status, mcu_periph_energy_save(), pprzLogFile, SDLOG_STOPPED, and sdLogFinish().

Referenced by thd_bat_survey(), and thdUsbStorage().

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

◆ sdlog_chibios_init()

void sdlog_chibios_init ( void  )

Definition at line 180 of file sdlog_chibios.c.

References chibios_sdlog_status, DefaultPeriodic, register_periodic_telemetry(), SDLOG_STOPPED, send_sdlog_status(), thd_startlog(), and usbStorageStartPolling().

+ Here is the call graph for this function:

◆ sdlog_send()

static void sdlog_send ( struct chibios_sdlog p,
long  fd 
)
static

Definition at line 156 of file sdlog_chibios.c.

References fd, and p.

Referenced by chibios_sdlog_init().

+ Here is the caller graph for this function:

◆ sdlog_transmit()

static void sdlog_transmit ( struct chibios_sdlog p,
long  fd,
uint8_t  byte 
)
static

Definition at line 141 of file sdlog_chibios.c.

References byte, and fd.

Referenced by chibios_sdlog_init().

+ Here is the caller graph for this function:

◆ sdlog_transmit_buffer()

static void sdlog_transmit_buffer ( struct chibios_sdlog p,
long  fd,
uint8_t data,
uint16_t  len 
)
static

Definition at line 149 of file sdlog_chibios.c.

References fd.

Referenced by chibios_sdlog_init().

+ Here is the caller graph for this function:

◆ send_sdlog_status()

static void send_sdlog_status ( struct transport_tx *  trans,
struct link_device *  dev 
)
static

Definition at line 111 of file sdlog_chibios.c.

References chibios_sdlog_filenames, chibios_sdlog_status, dev, NO_FILE_NAME, and status.

Referenced by sdlog_chibios_init().

+ Here is the caller graph for this function:

◆ thd_bat_survey()

static void thd_bat_survey ( void *  arg)
static

Definition at line 314 of file sdlog_chibios.c.

References mcu_deep_sleep(), powerOutageIsr(), powerOutageListener, powerOutageSource, SDLOG_BAT_ADC, SDLOG_BAT_CHAN, sdlog_chibios_finish(), and V_ALERT.

Referenced by thd_startlog().

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

◆ thd_startlog()

◆ THD_WORKING_AREA() [1/2]

static THD_WORKING_AREA ( wa_thd_bat_survey  ,
1024   
)
static

◆ THD_WORKING_AREA() [2/2]

static THD_WORKING_AREA ( wa_thd_startlog  ,
2048   
)
static

Variable Documentation

◆ chibios_sdlog

Definition at line 88 of file sdlog_chibios.c.

◆ chibios_sdlog_filenames

char chibios_sdlog_filenames[68]
static

sdlog filenames

Definition at line 106 of file sdlog_chibios.c.

Referenced by send_sdlog_status(), and thd_startlog().

◆ chibios_sdlog_status

enum { ... } chibios_sdlog_status

◆ NO_FILE_NAME

char NO_FILE_NAME[] = "none"
static

Definition at line 107 of file sdlog_chibios.c.

Referenced by send_sdlog_status().

◆ powerOutageListener

event_listener_t powerOutageListener

Definition at line 82 of file sdlog_chibios.c.

Referenced by thd_bat_survey().

◆ powerOutageSource

event_source_t powerOutageSource

Definition at line 81 of file sdlog_chibios.c.

Referenced by powerOutageIsr(), thd_bat_survey(), and thd_startlog().

◆ PPRZ_LOG_DIR

const char PPRZ_LOG_DIR[] = "PPRZ"
static

Definition at line 67 of file sdlog_chibios.c.

Referenced by thd_startlog().

◆ PPRZ_LOG_NAME

const char PPRZ_LOG_NAME[] = "pprzlog_"
static

Definition at line 66 of file sdlog_chibios.c.

Referenced by thd_startlog().

◆ pprzLogFile

◆ sdOk

bool sdOk = false

Definition at line 84 of file sdlog_chibios.c.

Referenced by thd_startlog().

◆ V_ALERT

const uint16_t V_ALERT = DefaultAdcOfVoltage(5.5f)
static

Definition at line 65 of file sdlog_chibios.c.

Referenced by thd_bat_survey().