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

#include <Scheduler.h>

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

Classes

class  SchedulerThread
 

Public Member Functions

 Scheduler ()
 
void init ()
 
void delay (uint16_t ms)
 
void delay_microseconds (uint16_t us)
 
void register_timer_process (AP_HAL::MemberProc)
 
void register_io_process (AP_HAL::MemberProc)
 
void suspend_timer_procs ()
 
void resume_timer_procs ()
 
bool in_main_thread () const override
 
void register_timer_failsafe (AP_HAL::Proc, uint32_t period_us)
 
void system_initialized ()
 
void reboot (bool hold_in_bootloader)
 
void stop_clock (uint64_t time_usec)
 
uint64_t stopped_clock_usec () const
 
void microsleep (uint32_t usec)
 
void teardown ()
 
- Public Member Functions inherited from AP_HAL::Scheduler
 Scheduler ()
 
virtual void delay_microseconds_boost (uint16_t us)
 
virtual void boost_end (void)
 
virtual void register_delay_callback (AP_HAL::Proc, uint16_t min_time_ms)
 
virtual bool in_delay_callback () const
 
virtual void create_uavcan_thread ()
 
virtual void * disable_interrupts_save (void)
 
virtual void restore_interrupts (void *)
 
virtual void call_delay_cb ()
 

Static Public Member Functions

static Schedulerfrom (AP_HAL::Scheduler *scheduler)
 

Private Member Functions

void _wait_all_threads ()
 
void _debug_stack ()
 
void _timer_task ()
 
void _io_task ()
 
void _rcin_task ()
 
void _uart_task ()
 
void _tonealarm_task ()
 
void _run_io ()
 
void _run_uarts ()
 

Private Attributes

AP_HAL::Proc _failsafe
 
bool _initialized
 
pthread_barrier_t _initialized_barrier
 
AP_HAL::MemberProc _timer_proc [LINUX_SCHEDULER_MAX_TIMER_PROCS]
 
uint8_t _num_timer_procs
 
volatile bool _in_timer_proc
 
AP_HAL::MemberProc _io_proc [LINUX_SCHEDULER_MAX_IO_PROCS]
 
uint8_t _num_io_procs
 
SchedulerThread _timer_thread {FUNCTOR_BIND_MEMBER(&Scheduler::_timer_task, void), *this}
 
SchedulerThread _io_thread {FUNCTOR_BIND_MEMBER(&Scheduler::_io_task, void), *this}
 
SchedulerThread _rcin_thread {FUNCTOR_BIND_MEMBER(&Scheduler::_rcin_task, void), *this}
 
SchedulerThread _uart_thread {FUNCTOR_BIND_MEMBER(&Scheduler::_uart_task, void), *this}
 
SchedulerThread _tonealarm_thread {FUNCTOR_BIND_MEMBER(&Scheduler::_tonealarm_task, void), *this}
 
uint64_t _stopped_clock_usec
 
uint64_t _last_stack_debug_msec
 
pthread_t _main_ctx
 
Semaphore _timer_semaphore
 
Semaphore _io_semaphore
 

Additional Inherited Members

- Public Attributes inherited from AP_HAL::Scheduler
uint16_t _min_delay_cb_ms
 

Detailed Description

Definition at line 19 of file Scheduler.h.

Constructor & Destructor Documentation

◆ Scheduler()

Scheduler::Scheduler ( )

Definition at line 61 of file Scheduler.cpp.

Member Function Documentation

◆ _debug_stack()

void Scheduler::_debug_stack ( )
private

Definition at line 115 of file Scheduler.cpp.

Referenced by init().

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

◆ _io_task()

void Scheduler::_io_task ( )
private

Definition at line 310 of file Scheduler.cpp.

Here is the call graph for this function:

◆ _rcin_task()

void Scheduler::_rcin_task ( )
private

Definition at line 294 of file Scheduler.cpp.

Here is the call graph for this function:

◆ _run_io()

void Scheduler::_run_io ( void  )
private

Definition at line 264 of file Scheduler.cpp.

Referenced by _io_task(), and stop_clock().

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

◆ _run_uarts()

void Scheduler::_run_uarts ( )
private

Definition at line 283 of file Scheduler.cpp.

Referenced by _uart_task().

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

◆ _timer_task()

void Scheduler::_timer_task ( )
private

Definition at line 223 of file Scheduler.cpp.

Here is the call graph for this function:

◆ _tonealarm_task()

void Scheduler::_tonealarm_task ( )
private

Definition at line 304 of file Scheduler.cpp.

Here is the call graph for this function:

◆ _uart_task()

void Scheduler::_uart_task ( )
private

Definition at line 299 of file Scheduler.cpp.

Here is the call graph for this function:

◆ _wait_all_threads()

void Scheduler::_wait_all_threads ( )
private

Definition at line 324 of file Scheduler.cpp.

Referenced by system_initialized().

Here is the caller graph for this function:

◆ delay()

void Scheduler::delay ( uint16_t  ms)
virtual

Implements AP_HAL::Scheduler.

Definition at line 143 of file Scheduler.cpp.

Referenced by from().

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

◆ delay_microseconds()

void Scheduler::delay_microseconds ( uint16_t  us)
virtual

Implements AP_HAL::Scheduler.

Definition at line 165 of file Scheduler.cpp.

Referenced by from().

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

◆ from()

static Scheduler* Linux::Scheduler::from ( AP_HAL::Scheduler scheduler)
inlinestatic

Definition at line 23 of file Scheduler.h.

Referenced by Linux::PeriodicThread::_run().

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

◆ in_main_thread()

bool Scheduler::in_main_thread ( ) const
overridevirtual

Implements AP_HAL::Scheduler.

Definition at line 319 of file Scheduler.cpp.

Referenced by delay(), and from().

Here is the caller graph for this function:

◆ init()

void Scheduler::init ( void  )
virtual

Implements AP_HAL::Scheduler.

Definition at line 64 of file Scheduler.cpp.

Referenced by from().

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

◆ microsleep()

void Scheduler::microsleep ( uint32_t  usec)

Definition at line 135 of file Scheduler.cpp.

Referenced by Linux::PeriodicThread::_run(), delay(), delay_microseconds(), and stopped_clock_usec().

Here is the caller graph for this function:

◆ reboot()

void Scheduler::reboot ( bool  hold_in_bootloader)
virtual

Implements AP_HAL::Scheduler.

Definition at line 343 of file Scheduler.cpp.

Referenced by from().

Here is the caller graph for this function:

◆ register_io_process()

void Scheduler::register_io_process ( AP_HAL::MemberProc  proc)
virtual

Implements AP_HAL::Scheduler.

Definition at line 190 of file Scheduler.cpp.

Referenced by from().

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

◆ register_timer_failsafe()

void Scheduler::register_timer_failsafe ( AP_HAL::Proc  failsafe,
uint32_t  period_us 
)
virtual

Implements AP_HAL::Scheduler.

Definition at line 206 of file Scheduler.cpp.

Referenced by from().

Here is the caller graph for this function:

◆ register_timer_process()

void Scheduler::register_timer_process ( AP_HAL::MemberProc  proc)
virtual

Implements AP_HAL::Scheduler.

Definition at line 173 of file Scheduler.cpp.

Referenced by from(), and init().

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

◆ resume_timer_procs()

void Scheduler::resume_timer_procs ( )
virtual

Implements AP_HAL::Scheduler.

Definition at line 218 of file Scheduler.cpp.

Referenced by from().

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

◆ stop_clock()

void Scheduler::stop_clock ( uint64_t  time_usec)
virtual

optional function to stop clock at a given time, used by log replay

Reimplemented from AP_HAL::Scheduler.

Definition at line 348 of file Scheduler.cpp.

Referenced by from().

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

◆ stopped_clock_usec()

uint64_t Linux::Scheduler::stopped_clock_usec ( ) const
inline

Definition at line 46 of file Scheduler.h.

Here is the call graph for this function:

◆ suspend_timer_procs()

void Scheduler::suspend_timer_procs ( )
virtual

Implements AP_HAL::Scheduler.

Definition at line 211 of file Scheduler.cpp.

Referenced by from().

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

◆ system_initialized()

void Scheduler::system_initialized ( )
virtual

Implements AP_HAL::Scheduler.

Definition at line 332 of file Scheduler.cpp.

Referenced by from().

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

◆ teardown()

void Scheduler::teardown ( )

Definition at line 363 of file Scheduler.cpp.

Referenced by stopped_clock_usec().

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

Member Data Documentation

◆ _failsafe

AP_HAL::Proc Linux::Scheduler::_failsafe
private

Definition at line 70 of file Scheduler.h.

Referenced by _timer_task(), and register_timer_failsafe().

◆ _in_timer_proc

volatile bool Linux::Scheduler::_in_timer_proc
private

Definition at line 77 of file Scheduler.h.

Referenced by _timer_task().

◆ _initialized

bool Linux::Scheduler::_initialized
private

Definition at line 72 of file Scheduler.h.

Referenced by system_initialized().

◆ _initialized_barrier

pthread_barrier_t Linux::Scheduler::_initialized_barrier
private

Definition at line 73 of file Scheduler.h.

Referenced by _wait_all_threads(), and init().

◆ _io_proc

AP_HAL::MemberProc Linux::Scheduler::_io_proc[LINUX_SCHEDULER_MAX_IO_PROCS]
private

Definition at line 79 of file Scheduler.h.

Referenced by _run_io(), and register_io_process().

◆ _io_semaphore

Semaphore Linux::Scheduler::_io_semaphore
private

Definition at line 102 of file Scheduler.h.

Referenced by _run_io().

◆ _io_thread

SchedulerThread Linux::Scheduler::_io_thread {FUNCTOR_BIND_MEMBER(&Scheduler::_io_task, void), *this}
private

Definition at line 83 of file Scheduler.h.

Referenced by _debug_stack(), and teardown().

◆ _last_stack_debug_msec

uint64_t Linux::Scheduler::_last_stack_debug_msec
private

Definition at line 98 of file Scheduler.h.

Referenced by _debug_stack().

◆ _main_ctx

pthread_t Linux::Scheduler::_main_ctx
private

Definition at line 99 of file Scheduler.h.

Referenced by in_main_thread(), and init().

◆ _num_io_procs

uint8_t Linux::Scheduler::_num_io_procs
private

Definition at line 80 of file Scheduler.h.

Referenced by _run_io(), and register_io_process().

◆ _num_timer_procs

uint8_t Linux::Scheduler::_num_timer_procs
private

Definition at line 76 of file Scheduler.h.

Referenced by _timer_task(), and register_timer_process().

◆ _rcin_thread

SchedulerThread Linux::Scheduler::_rcin_thread {FUNCTOR_BIND_MEMBER(&Scheduler::_rcin_task, void), *this}
private

Definition at line 84 of file Scheduler.h.

Referenced by _debug_stack(), and teardown().

◆ _stopped_clock_usec

uint64_t Linux::Scheduler::_stopped_clock_usec
private

Definition at line 97 of file Scheduler.h.

Referenced by delay(), delay_microseconds(), stop_clock(), and stopped_clock_usec().

◆ _timer_proc

AP_HAL::MemberProc Linux::Scheduler::_timer_proc[LINUX_SCHEDULER_MAX_TIMER_PROCS]
private

Definition at line 75 of file Scheduler.h.

Referenced by _timer_task(), and register_timer_process().

◆ _timer_semaphore

Semaphore Linux::Scheduler::_timer_semaphore
private

Definition at line 101 of file Scheduler.h.

Referenced by _timer_task(), resume_timer_procs(), and suspend_timer_procs().

◆ _timer_thread

SchedulerThread Linux::Scheduler::_timer_thread {FUNCTOR_BIND_MEMBER(&Scheduler::_timer_task, void), *this}
private

Definition at line 82 of file Scheduler.h.

Referenced by _debug_stack(), and teardown().

◆ _tonealarm_thread

SchedulerThread Linux::Scheduler::_tonealarm_thread {FUNCTOR_BIND_MEMBER(&Scheduler::_tonealarm_task, void), *this}
private

Definition at line 86 of file Scheduler.h.

Referenced by _debug_stack(), and teardown().

◆ _uart_thread

SchedulerThread Linux::Scheduler::_uart_thread {FUNCTOR_BIND_MEMBER(&Scheduler::_uart_task, void), *this}
private

Definition at line 85 of file Scheduler.h.

Referenced by _debug_stack(), and teardown().


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