APM:Libraries
Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | List of all members
Linux::Util Class Reference

#include <Util.h>

Inheritance diagram for Linux::Util:
[legend]
Collaboration diagram for Linux::Util:
[legend]

Public Member Functions

void init (int argc, char *const *argv)
 
bool run_debug_shell (AP_HAL::BetterStream *stream)
 
void commandline_arguments (uint8_t &argc, char *const *&argv)
 
bool toneAlarm_init ()
 
void toneAlarm_set_tune (uint8_t tune)
 
void _toneAlarm_timer_tick ()
 
void set_system_clock (uint64_t time_utc_usec)
 
const char * get_custom_log_directory () const override final
 
const char * get_custom_terrain_directory () const override final
 
const char * get_custom_storage_directory () const override final
 
void set_custom_log_directory (const char *_custom_log_directory)
 
void set_custom_terrain_directory (const char *_custom_terrain_directory)
 
void set_custom_storage_directory (const char *_custom_storage_directory)
 
bool is_chardev_node (const char *path)
 
void set_imu_temp (float current) override
 
void set_imu_target_temp (int8_t *target) override
 
uint32_t available_memory (void) override
 
int write_file (const char *path, const char *fmt,...) FMT_PRINTF(3
 
int int read_file (const char *path, const char *fmt,...) FMT_SCANF(3
 
int int perf_counter_t perf_alloc (enum perf_counter_type t, const char *name) override
 
void perf_begin (perf_counter_t perf) override
 
void perf_end (perf_counter_t perf) override
 
void perf_count (perf_counter_t perf) override
 
AP_HAL::Semaphorenew_semaphore (void) override
 
int get_hw_arm32 ()
 
- Public Member Functions inherited from AP_HAL::Util
int snprintf (char *str, size_t size, const char *format,...)
 
int vsnprintf (char *str, size_t size, const char *format, va_list ap)
 
void set_soft_armed (const bool b)
 
bool get_soft_armed () const
 
void set_capabilities (uint64_t cap)
 
void clear_capabilities (uint64_t cap)
 
uint64_t get_capabilities () const
 
virtual const char * get_custom_defaults_file () const
 
virtual enum safety_state safety_switch_state (void)
 
uint64_t get_system_clock_ms () const
 
void get_system_clock_utc (int32_t &hour, int32_t &min, int32_t &sec, int32_t &ms) const
 
uint32_t get_time_utc (int32_t hour, int32_t min, int32_t sec, int32_t ms) const
 
virtual bool get_system_id (char buf[40])
 
virtual AP_HAL::BetterStreamget_shell_stream ()
 
virtual void * malloc_type (size_t size, Memory_Type mem_type)
 
virtual void free_type (void *ptr, size_t size, Memory_Type mem_type)
 

Static Public Member Functions

static Utilfrom (AP_HAL::Util *util)
 

Private Attributes

int saved_argc
 
Heat_heat
 
char *const * saved_argv
 
const char * custom_log_directory = nullptr
 
const char * custom_terrain_directory = nullptr
 
const char * custom_storage_directory = nullptr
 

Static Private Attributes

static ToneAlarm_Disco _toneAlarm
 
static const char * _hw_names [UTIL_NUM_HARDWARES]
 

Additional Inherited Members

- Public Types inherited from AP_HAL::Util
enum  safety_state { SAFETY_NONE, SAFETY_DISARMED, SAFETY_ARMED }
 
enum  perf_counter_type { PC_COUNT, PC_ELAPSED, PC_INTERVAL }
 
enum  Memory_Type { MEM_DMA_SAFE, MEM_FAST }
 
typedef void * perf_counter_t
 
- Protected Attributes inherited from AP_HAL::Util
bool soft_armed = false
 
uint64_t capabilities = 0
 

Detailed Description

Definition at line 25 of file Util.h.

Member Function Documentation

◆ _toneAlarm_timer_tick()

void Util::_toneAlarm_timer_tick ( )
virtual

Reimplemented from AP_HAL::Util.

Definition at line 76 of file Util.cpp.

Referenced by Linux::Scheduler::_tonealarm_task(), and run_debug_shell().

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

◆ available_memory()

uint32_t Util::available_memory ( void  )
overridevirtual

how much free memory do we have in bytes. If unknown return 4096

Reimplemented from AP_HAL::Util.

Definition at line 121 of file Util.cpp.

Referenced by set_custom_storage_directory().

Here is the caller graph for this function:

◆ commandline_arguments()

void Util::commandline_arguments ( uint8_t &  argc,
char *const *&  argv 
)
virtual

return commandline arguments, if available

Reimplemented from AP_HAL::Util.

Definition at line 60 of file Util.cpp.

Referenced by run_debug_shell().

Here is the caller graph for this function:

◆ from()

static Util* Linux::Util::from ( AP_HAL::Util util)
inlinestatic

Definition at line 27 of file Util.h.

Referenced by Linux::UtilRPI::_check_rpi_version(), Linux::GPIO_Sysfs::_pinMode(), Linux::RCOutput_Bebop::_run_rcout(), Linux::Scheduler::_tonealarm_task(), Linux::PWM_Sysfs_Base::enable(), Linux::PWM_Sysfs_Base::get_period(), Linux::PWM_Sysfs_Base::get_polarity(), Linux::PWM_Sysfs_Base::init(), Linux::Led_Sysfs::init(), Linux::PWM_Sysfs_Base::is_enabled(), Linux::PWM_Sysfs_Base::set_period(), and Linux::PWM_Sysfs_Base::set_polarity().

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

◆ get_custom_log_directory()

const char* Linux::Util::get_custom_log_directory ( ) const
inlinefinaloverridevirtual

Reimplemented from AP_HAL::Util.

Definition at line 48 of file Util.h.

◆ get_custom_storage_directory()

const char* Linux::Util::get_custom_storage_directory ( ) const
inlinefinaloverridevirtual

Reimplemented from AP_HAL::Util.

Definition at line 50 of file Util.h.

◆ get_custom_terrain_directory()

const char* Linux::Util::get_custom_terrain_directory ( ) const
inlinefinaloverridevirtual

Reimplemented from AP_HAL::Util.

Definition at line 49 of file Util.h.

◆ get_hw_arm32()

int Util::get_hw_arm32 ( )

Definition at line 185 of file Util.cpp.

Referenced by Linux::UtilRPI::_check_rpi_version(), Linux::RCOutput_Bebop::_run_rcout(), and new_semaphore().

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

◆ init()

void Util::init ( int  argc,
char *const *  argv 
)

Definition at line 27 of file Util.cpp.

Referenced by from(), and HAL_Linux::run().

Here is the caller graph for this function:

◆ is_chardev_node()

bool Util::is_chardev_node ( const char *  path)

Definition at line 104 of file Util.cpp.

Referenced by set_custom_storage_directory().

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

◆ new_semaphore()

AP_HAL::Semaphore* Linux::Util::new_semaphore ( void  )
inlineoverridevirtual

Reimplemented from AP_HAL::Util.

Definition at line 99 of file Util.h.

Here is the call graph for this function:

◆ perf_alloc()

int int perf_counter_t Linux::Util::perf_alloc ( enum perf_counter_type  t,
const char *  name 
)
inlineoverridevirtual

Reimplemented from AP_HAL::Util.

Definition at line 78 of file Util.h.

Here is the call graph for this function:

◆ perf_begin()

void Linux::Util::perf_begin ( perf_counter_t  perf)
inlineoverridevirtual

Reimplemented from AP_HAL::Util.

Definition at line 83 of file Util.h.

Here is the call graph for this function:

◆ perf_count()

void Linux::Util::perf_count ( perf_counter_t  perf)
inlineoverridevirtual

Reimplemented from AP_HAL::Util.

Definition at line 93 of file Util.h.

Here is the call graph for this function:

◆ perf_end()

void Linux::Util::perf_end ( perf_counter_t  perf)
inlineoverridevirtual

Reimplemented from AP_HAL::Util.

Definition at line 88 of file Util.h.

Here is the call graph for this function:

◆ read_file()

int Util::read_file ( const char *  path,
const char *  fmt,
  ... 
)

Definition at line 151 of file Util.cpp.

Referenced by Linux::PWM_Sysfs_Base::get_period(), Linux::PWM_Sysfs_Base::get_polarity(), Linux::Led_Sysfs::init(), Linux::PWM_Sysfs_Base::is_enabled(), and set_custom_storage_directory().

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

◆ run_debug_shell()

bool Linux::Util::run_debug_shell ( AP_HAL::BetterStream stream)
inlinevirtual

Implements AP_HAL::Util.

Definition at line 32 of file Util.h.

Here is the call graph for this function:

◆ set_custom_log_directory()

void Linux::Util::set_custom_log_directory ( const char *  _custom_log_directory)
inline

Definition at line 52 of file Util.h.

Referenced by HAL_Linux::run().

Here is the caller graph for this function:

◆ set_custom_storage_directory()

void Linux::Util::set_custom_storage_directory ( const char *  _custom_storage_directory)
inline

Definition at line 54 of file Util.h.

Referenced by HAL_Linux::run().

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

◆ set_custom_terrain_directory()

void Linux::Util::set_custom_terrain_directory ( const char *  _custom_terrain_directory)
inline

Definition at line 53 of file Util.h.

Referenced by HAL_Linux::run().

Here is the caller graph for this function:

◆ set_imu_target_temp()

void Util::set_imu_target_temp ( int8_t *  target)
overridevirtual

Reimplemented from AP_HAL::Util.

Definition at line 52 of file Util.cpp.

Referenced by set_custom_storage_directory().

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

◆ set_imu_temp()

void Util::set_imu_temp ( float  current)
overridevirtual

Reimplemented from AP_HAL::Util.

Definition at line 46 of file Util.cpp.

Referenced by set_custom_storage_directory().

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

◆ set_system_clock()

void Util::set_system_clock ( uint64_t  time_utc_usec)
virtual

Reimplemented from AP_HAL::Util.

Definition at line 94 of file Util.cpp.

Referenced by run_debug_shell().

Here is the caller graph for this function:

◆ toneAlarm_init()

bool Util::toneAlarm_init ( )
virtual

Reimplemented from AP_HAL::Util.

Definition at line 66 of file Util.cpp.

Referenced by run_debug_shell().

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

◆ toneAlarm_set_tune()

void Util::toneAlarm_set_tune ( uint8_t  tune)
virtual

Reimplemented from AP_HAL::Util.

Definition at line 71 of file Util.cpp.

Referenced by run_debug_shell().

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

◆ write_file()

int Util::write_file ( const char *  path,
const char *  fmt,
  ... 
)

Definition at line 126 of file Util.cpp.

Referenced by Linux::GPIO_Sysfs::_pinMode(), Linux::PWM_Sysfs_Base::enable(), Linux::PWM_Sysfs_Base::init(), set_custom_storage_directory(), Linux::PWM_Sysfs_Base::set_period(), and Linux::PWM_Sysfs_Base::set_polarity().

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

Member Data Documentation

◆ _heat

Heat* Linux::Util::_heat
private

Definition at line 110 of file Util.h.

Referenced by init(), set_imu_target_temp(), and set_imu_temp().

◆ _hw_names

const char * Linux::Util::_hw_names
staticprivate
Initial value:
= {
[UTIL_HARDWARE_RPI1] = "BCM2708",
[UTIL_HARDWARE_RPI2] = "BCM2709",
[UTIL_HARDWARE_BEBOP] = "Mykonos3 board",
[UTIL_HARDWARE_BEBOP2] = "Milos board",
[UTIL_HARDWARE_DISCO] = "Evinrude board",
}

Definition at line 115 of file Util.h.

Referenced by get_hw_arm32(), and read_file().

◆ _toneAlarm

ToneAlarm_Disco Util::_toneAlarm
staticprivate

Definition at line 105 of file Util.h.

Referenced by _toneAlarm_timer_tick(), toneAlarm_init(), and toneAlarm_set_tune().

◆ custom_log_directory

const char* Linux::Util::custom_log_directory = nullptr
private

Definition at line 112 of file Util.h.

Referenced by get_custom_log_directory(), and set_custom_log_directory().

◆ custom_storage_directory

const char* Linux::Util::custom_storage_directory = nullptr
private

Definition at line 114 of file Util.h.

Referenced by get_custom_storage_directory(), and set_custom_storage_directory().

◆ custom_terrain_directory

const char* Linux::Util::custom_terrain_directory = nullptr
private

Definition at line 113 of file Util.h.

Referenced by get_custom_terrain_directory(), and set_custom_terrain_directory().

◆ saved_argc

int Linux::Util::saved_argc
private

Definition at line 109 of file Util.h.

Referenced by commandline_arguments(), and init().

◆ saved_argv

char* const* Linux::Util::saved_argv
private

Definition at line 111 of file Util.h.

Referenced by commandline_arguments(), and init().


The documentation for this class was generated from the following files: