APM:Libraries
Classes | Macros | Typedefs | Enumerations | Functions | Variables
Scheduler.h File Reference
#include <AP_HAL/AP_HAL.h>
#include "AP_HAL_F4Light_Namespace.h"
#include "handler.h"
#include "Config.h"
#include "Semaphores.h"
#include "GPIO.h"
#include <delay.h>
#include <systick.h>
#include <boards.h>
#include <timer.h>
Include dependency graph for Scheduler.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  task_t
 
struct  REVO_IO
 
class  F4Light::Scheduler
 
struct  F4Light::Scheduler::IO_COMPLETION
 

Macros

#define F4Light_SCHEDULER_MAX_IO_PROCS   10
 
#define MAIN_PRIORITY   100
 
#define DRIVER_PRIORITY   98
 
#define IO_PRIORITY   115
 
#define SHED_FREQ   10000
 
#define TIMER_PERIOD   100
 
#define MAIN_STACK_SIZE   4096U+1024U
 
#define IO_STACK_SIZE   4096U
 
#define DEFAULT_STACK_SIZE   1024U
 
#define SMALL_TASK_STACK   1024U
 
#define STACK_MAX   65536U
 
#define EnterCriticalSection   __set_BASEPRI(SVC_INT_PRIORITY << (8 - __NVIC_PRIO_BITS))
 
#define LeaveCriticalSection   __set_BASEPRI(0)
 
#define RAMEND   ((size_t)&_estack)
 
#define MAX_IO_COMPLETION   8
 
#define await(cond)   while(!(cond)) yield()
 

Typedefs

typedef struct REVO_IO Revo_IO
 

Enumerations

enum  Revo_IO_Flags { IO_PERIODIC = 0, IO_ONCE = 1 }
 

Functions

void revo_call_handler (Handler hh, uint32_t arg)
 
void PendSV_Handler ()
 
void SVC_Handler ()
 
void getNextTask ()
 
void switchContext ()
 
void __do_context_switch ()
 
void hal_try_kill_task_or_reboot (uint8_t n)
 
void hal_go_next_task ()
 
void hal_stop_multitask ()
 
bool hal_is_armed ()
 
void hal_yield (uint16_t ttw)
 
void hal_delay (uint16_t t)
 
void hal_delay_microseconds (uint16_t t)
 
uint32_t hal_micros ()
 
void hal_isr_time (uint32_t t)
 
void hal_set_task_active (void *handle)
 
void hal_context_switch_isr ()
 
void * hal_register_task (voidFuncPtr task, uint32_t stack)
 
void hal_set_task_priority (void *handle, uint8_t prio)
 
void enqueue_flash_erase (uint32_t from, uint32_t to)
 

Variables

unsigned _estack
 
uint32_t us_ticks
 
void * _sdata
 
void * _edata
 
void * _sccm
 
void * _eccm
 
voidFuncPtr boardEmergencyHandler
 
task_ts_running
 
task_tnext_task
 
caddr_t stack_bottom
 

Macro Definition Documentation

◆ await

#define await (   cond)    while(!(cond)) yield()

Definition at line 498 of file Scheduler.h.

◆ DEFAULT_STACK_SIZE

#define DEFAULT_STACK_SIZE   1024U

Definition at line 34 of file Scheduler.h.

◆ DRIVER_PRIORITY

#define DRIVER_PRIORITY   98

◆ EnterCriticalSection

#define EnterCriticalSection   __set_BASEPRI(SVC_INT_PRIORITY << (8 - __NVIC_PRIO_BITS))

◆ F4Light_SCHEDULER_MAX_IO_PROCS

#define F4Light_SCHEDULER_MAX_IO_PROCS   10

Definition at line 21 of file Scheduler.h.

Referenced by F4Light::Scheduler::_register_io_process().

◆ IO_PRIORITY

#define IO_PRIORITY   115

◆ IO_STACK_SIZE

#define IO_STACK_SIZE   4096U

Definition at line 33 of file Scheduler.h.

Referenced by F4Light::Scheduler::_register_io_process().

◆ LeaveCriticalSection

#define LeaveCriticalSection   __set_BASEPRI(0)

◆ MAIN_PRIORITY

#define MAIN_PRIORITY   100

◆ MAIN_STACK_SIZE

#define MAIN_STACK_SIZE   4096U+1024U

Definition at line 32 of file Scheduler.h.

Referenced by F4Light::Scheduler::Scheduler().

◆ MAX_IO_COMPLETION

#define MAX_IO_COMPLETION   8

Definition at line 407 of file Scheduler.h.

Referenced by F4Light::Scheduler::register_io_completion().

◆ RAMEND

#define RAMEND   ((size_t)&_estack)

Definition at line 135 of file Scheduler.h.

Referenced by F4Light::Scheduler::_start_task().

◆ SHED_FREQ

#define SHED_FREQ   10000

Definition at line 28 of file Scheduler.h.

Referenced by F4Light::Scheduler::init().

◆ SMALL_TASK_STACK

#define SMALL_TASK_STACK   1024U

Definition at line 35 of file Scheduler.h.

Referenced by F4Light::Scheduler::_register_timer_task().

◆ STACK_MAX

#define STACK_MAX   65536U

Definition at line 36 of file Scheduler.h.

◆ TIMER_PERIOD

#define TIMER_PERIOD   100

Definition at line 29 of file Scheduler.h.

Referenced by F4Light::Scheduler::get_next_task().

Typedef Documentation

◆ Revo_IO

typedef struct REVO_IO Revo_IO

Enumeration Type Documentation

◆ Revo_IO_Flags

Enumerator
IO_PERIODIC 
IO_ONCE 

Definition at line 157 of file Scheduler.h.

Function Documentation

◆ __do_context_switch()

void __do_context_switch ( )

Referenced by PendSV_Handler().

Here is the caller graph for this function:

◆ enqueue_flash_erase()

void enqueue_flash_erase ( uint32_t  from,
uint32_t  to 
)

◆ getNextTask()

void getNextTask ( )

◆ hal_delay()

void hal_delay ( uint16_t  t)

Definition at line 1431 of file Scheduler.cpp.

Here is the call graph for this function:

◆ hal_delay_microseconds()

void hal_delay_microseconds ( uint16_t  t)

Definition at line 1432 of file Scheduler.cpp.

Here is the call graph for this function:

◆ hal_go_next_task()

void hal_go_next_task ( )

Definition at line 1448 of file Scheduler.cpp.

Here is the call graph for this function:

◆ hal_is_armed()

bool hal_is_armed ( )

Definition at line 1446 of file Scheduler.cpp.

Here is the call graph for this function:

◆ hal_isr_time()

void hal_isr_time ( uint32_t  t)

Definition at line 1435 of file Scheduler.cpp.

◆ hal_micros()

uint32_t hal_micros ( )

Definition at line 1434 of file Scheduler.cpp.

Here is the call graph for this function:

◆ hal_stop_multitask()

void hal_stop_multitask ( )

Definition at line 1449 of file Scheduler.cpp.

Here is the call graph for this function:

◆ hal_try_kill_task_or_reboot()

void hal_try_kill_task_or_reboot ( uint8_t  n)

Definition at line 1447 of file Scheduler.cpp.

Here is the call graph for this function:

◆ hal_yield()

void hal_yield ( uint16_t  ttw)

Definition at line 1430 of file Scheduler.cpp.

Here is the call graph for this function:

◆ PendSV_Handler()

void PendSV_Handler ( )

Definition at line 1280 of file Scheduler.cpp.

Here is the call graph for this function:

◆ revo_call_handler()

void revo_call_handler ( Handler  hh,
uint32_t  arg 
)

Definition at line 1420 of file Scheduler.cpp.

Referenced by F4Light::Scheduler::_ioc_timer_event(), F4Light::Scheduler::_run_io(), F4Light::Scheduler::arming_state_changed(), and F4Light::Scheduler::do_task().

Here is the caller graph for this function:

◆ SVC_Handler()

void SVC_Handler ( )

Definition at line 1293 of file Scheduler.cpp.

Referenced by F4Light::Scheduler::plan_context_switch().

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

◆ switchContext()

void switchContext ( )

Variable Documentation

◆ _eccm

void* _eccm

◆ _edata

void* _edata

◆ _estack

unsigned _estack

◆ _sccm

void* _sccm

◆ _sdata

void* _sdata

◆ boardEmergencyHandler

voidFuncPtr boardEmergencyHandler

◆ next_task

task_t* next_task

◆ s_running

task_t* s_running

◆ stack_bottom

caddr_t stack_bottom

Definition at line 74 of file syscalls.c.

Referenced by _sbrk_ccm(), and F4Light::Scheduler::_start_task().

◆ us_ticks

uint32_t us_ticks