Browse Source

AP_HAL: added HAL_MEM_CLASS for amount of memory

master
Andrew Tridgell 5 years ago
parent
commit
2d00298070
  1. 18
      libraries/AP_HAL/AP_HAL_Boards.h
  2. 15
      libraries/AP_HAL/board/chibios.h
  3. 1
      libraries/AP_HAL/board/empty.h
  4. 1
      libraries/AP_HAL/board/linux.h
  5. 1
      libraries/AP_HAL/board/sitl.h

18
libraries/AP_HAL/AP_HAL_Boards.h

@ -92,13 +92,27 @@ @@ -92,13 +92,27 @@
/* CPU classes, used to select if CPU intensive algorithms should be used
* Note that these are only approximate, not exact CPU speeds. */
/* 150Mhz: PX4 or similar. Assumes:
/* 150Mhz: STM32F4 or similar. Assumes:
* - hardware floating point
* - tens of kilobytes of memory available */
* - tens of kilobytes of memory available
*/
#define HAL_CPU_CLASS_150 3
/* GigaHz class: SITL, BeagleBone etc. Assumes megabytes of memory available. */
#define HAL_CPU_CLASS_1000 4
/*
memory classes, in kbytes. Board must have at least the given amount
of memory
*/
#define HAL_MEM_CLASS_20 1
#define HAL_MEM_CLASS_64 2
#define HAL_MEM_CLASS_192 3
#define HAL_MEM_CLASS_300 4
#define HAL_MEM_CLASS_500 5
#define HAL_MEM_CLASS_1000 6
/* Operating system features
*
* HAL implementations may define the following extra feature defines to 1 if

15
libraries/AP_HAL/board/chibios.h

@ -4,7 +4,20 @@ @@ -4,7 +4,20 @@
#include <hal.h>
#define HAL_BOARD_NAME "ChibiOS"
#define HAL_CPU_CLASS HAL_CPU_CLASS_150
#if HAL_MEMORY_TOTAL_KB >= 1000
#define HAL_MEM_CLASS HAL_MEM_CLASS_1000
#elif HAL_MEMORY_TOTAL_KB >= 500
#define HAL_MEM_CLASS HAL_MEM_CLASS_500
#elif HAL_MEMORY_TOTAL_KB >= 300
#define HAL_MEM_CLASS HAL_MEM_CLASS_300
#elif HAL_MEMORY_TOTAL_KB >= 192
#define HAL_MEM_CLASS HAL_MEM_CLASS_192
#elif HAL_MEMORY_TOTAL_KB >= 64
#define HAL_MEM_CLASS HAL_MEM_CLASS_64
#else
#define HAL_MEM_CLASS HAL_MEM_CLASS_20
#endif
#ifndef HAL_GPIO_LED_ON
#define HAL_GPIO_LED_ON 0

1
libraries/AP_HAL/board/empty.h

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
#define HAL_BOARD_NAME "EMPTY"
#define HAL_CPU_CLASS HAL_CPU_CLASS_150
#define HAL_MEM_CLASS HAL_MEM_CLASS_192
#define HAL_STORAGE_SIZE 16384
#define HAL_STORAGE_SIZE_AVAILABLE HAL_STORAGE_SIZE
#define HAL_INS_DEFAULT HAL_INS_HIL

1
libraries/AP_HAL/board/linux.h

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
#define HAL_BOARD_NAME "Linux"
#define HAL_CPU_CLASS HAL_CPU_CLASS_1000
#define HAL_MEM_CLASS HAL_MEM_CLASS_1000
#define HAL_OS_POSIX_IO 1
#define HAL_OS_SOCKETS 1
#define HAL_STORAGE_SIZE 16384

1
libraries/AP_HAL/board/sitl.h

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
#define HAL_BOARD_NAME "SITL"
#define HAL_CPU_CLASS HAL_CPU_CLASS_1000
#define HAL_MEM_CLASS HAL_MEM_CLASS_1000
#define HAL_OS_POSIX_IO 1
#define HAL_OS_SOCKETS 1
#define HAL_STORAGE_SIZE 16384

Loading…
Cancel
Save