AP_HAL: added HAL_CPU_CLASS define for selecting algorithms
this will make it easier to select the appropiate level of algorithm for a CPU
This commit is contained in:
parent
4c99d09265
commit
ea649e036b
@ -19,6 +19,30 @@
|
||||
#define HAL_BOARD_LINUX 7
|
||||
#define HAL_BOARD_EMPTY 99
|
||||
|
||||
|
||||
/**
|
||||
CPU classes, used to select if CPU intensive algorithms should be used
|
||||
|
||||
Note that these are only approximate, not exact CPU speeds.
|
||||
*/
|
||||
#define HAL_CPU_CLASS_16 1 // 16Mhz, AVR2560 or similar
|
||||
#define HAL_CPU_CLASS_75 2 // 75Mhz, Flymaple or similar
|
||||
#define HAL_CPU_CLASS_150 3 // 150Mhz, PX4 or similar, assumes
|
||||
// hardware floating point. Assumes tens
|
||||
// of kilobytes of memory available
|
||||
#define HAL_CPU_CLASS_1000 4 // GigaHz class, SITL, BeagleBone etc,
|
||||
// assumes megabytes of memory available
|
||||
|
||||
/**
|
||||
operating system features:
|
||||
|
||||
HAL implementations may define the following extra feature defines
|
||||
to 1 if available
|
||||
|
||||
HAL_OS_POSIX_IO : has posix-like filesystem IO
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
define AP_HAL_BOARD_DRIVER to the right hal type for this
|
||||
board. This prevents us having a mess of ifdefs in every example
|
||||
@ -28,27 +52,45 @@
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_APM1
|
||||
#define AP_HAL_BOARD_DRIVER AP_HAL_AVR_APM1
|
||||
#define HAL_BOARD_NAME "APM 1"
|
||||
#define HAL_CPU_CLASS HAL_CPU_CLASS_16
|
||||
|
||||
#elif CONFIG_HAL_BOARD == HAL_BOARD_APM2
|
||||
#define AP_HAL_BOARD_DRIVER AP_HAL_AVR_APM2
|
||||
#define HAL_BOARD_NAME "APM 2"
|
||||
#define HAL_CPU_CLASS HAL_CPU_CLASS_16
|
||||
|
||||
#elif CONFIG_HAL_BOARD == HAL_BOARD_AVR_SITL
|
||||
#define AP_HAL_BOARD_DRIVER AP_HAL_AVR_SITL
|
||||
#define HAL_BOARD_NAME "SITL"
|
||||
#define HAL_CPU_CLASS HAL_CPU_CLASS_1000
|
||||
#define HAL_OS_POSIX_IO 1
|
||||
|
||||
#elif CONFIG_HAL_BOARD == HAL_BOARD_FLYMAPLE
|
||||
#define AP_HAL_BOARD_DRIVER AP_HAL_FLYMAPLE
|
||||
#define HAL_BOARD_NAME "FLYMAPLE"
|
||||
#define HAL_CPU_CLASS HAL_CPU_CLASS_75
|
||||
|
||||
#elif CONFIG_HAL_BOARD == HAL_BOARD_PX4
|
||||
#define AP_HAL_BOARD_DRIVER AP_HAL_PX4
|
||||
#define HAL_BOARD_NAME "PX4"
|
||||
#define HAL_CPU_CLASS HAL_CPU_CLASS_150
|
||||
#define HAL_OS_POSIX_IO 1
|
||||
|
||||
#elif CONFIG_HAL_BOARD == HAL_BOARD_LINUX
|
||||
#define AP_HAL_BOARD_DRIVER AP_HAL_Linux
|
||||
#define HAL_BOARD_NAME "Linux"
|
||||
#define HAL_CPU_CLASS HAL_CPU_CLASS_1000
|
||||
#define HAL_OS_POSIX_IO 1
|
||||
|
||||
#elif CONFIG_HAL_BOARD == HAL_BOARD_EMPTY
|
||||
#define AP_HAL_BOARD_DRIVER AP_HAL_Empty
|
||||
#define HAL_BOARD_NAME "EMPTY"
|
||||
#define HAL_CPU_CLASS HAL_CPU_CLASS_16
|
||||
|
||||
#else
|
||||
#error "Unknown CONFIG_HAL_BOARD type"
|
||||
#endif
|
||||
|
||||
|
||||
#endif // __AP_HAL_BOARDS_H__
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include <AP_HAL.h>
|
||||
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_APM1 || CONFIG_HAL_BOARD == HAL_BOARD_APM2
|
||||
/**
|
||||
* This module exports AP_HAL::HAL instances only.
|
||||
* All internal drivers must conform to AP_HAL interfaces
|
||||
@ -14,5 +15,7 @@
|
||||
#include "HAL_AVR_APM2_Class.h"
|
||||
#include "AP_HAL_AVR_Main.h"
|
||||
|
||||
#endif // CONFIG_HAL_BOARD
|
||||
|
||||
#endif // __AP_HAL_AVR_H__
|
||||
|
||||
|
@ -4,8 +4,12 @@
|
||||
|
||||
#include <AP_HAL.h>
|
||||
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_AVR_SITL
|
||||
|
||||
#include "HAL_AVR_SITL_Class.h"
|
||||
#include "AP_HAL_AVR_SITL_Main.h"
|
||||
|
||||
#endif // CONFIG_HAL_BOARD
|
||||
|
||||
#endif // __AP_HAL_AVR_SITL_H__
|
||||
|
||||
|
@ -44,8 +44,12 @@
|
||||
* `void setup()` and `void loop()`, ala Arduino.
|
||||
*/
|
||||
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_FLYMAPLE
|
||||
|
||||
#include "HAL_FLYMAPLE_Class.h"
|
||||
#include "AP_HAL_FLYMAPLE_Main.h"
|
||||
|
||||
#endif // CONFIG_HAL_BOARD
|
||||
|
||||
#endif //__AP_HAL_FLYMAPLE_H__
|
||||
|
||||
|
@ -27,8 +27,11 @@
|
||||
* `void setup()` and `void loop()`, ala Arduino.
|
||||
*/
|
||||
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_LINUX
|
||||
|
||||
#include "HAL_Linux_Class.h"
|
||||
#include "AP_HAL_Linux_Main.h"
|
||||
|
||||
#endif // CONFIG_HAL_BOARD
|
||||
#endif //__AP_HAL_LINUX_H__
|
||||
|
||||
|
@ -3,8 +3,11 @@
|
||||
#define __AP_HAL_PX4_H__
|
||||
|
||||
#include <AP_HAL.h>
|
||||
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_PX4
|
||||
#include "HAL_PX4_Class.h"
|
||||
#include "AP_HAL_PX4_Main.h"
|
||||
|
||||
#endif // CONFIG_HAL_BOARD
|
||||
#endif // __AP_HAL_PX4_H__
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user