mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-29 02:38:07 +08:00
[chibios] Add support for a full ChibiOS arch (#1699)
[chibios] Add support for a full ChibiOS arch This is replacing the previous mix chibios/libopencm3: - all drivers are ported to the new arch - it was hard to go forward and take advantages of the RTOS, now it is much easier - switch to v3 of ChibiOS - for now, it is functionaly the same than before - the previous variable length array mechanism used internaly by the sdlog is replaced by a more efficient library called TLSF (allow constant time malloc/free)
This commit is contained in:
+1
-1
Submodule sw/ext/chibios updated: 1804611c43...3a6e100efc
+1
-1
Submodule sw/ext/fatfs updated: 73901ef981...169a1acbfc
+1
-1
Submodule sw/ext/pprzlink updated: b5c7baef55...0a44f55835
@@ -0,0 +1 @@
|
||||
see http://tlsf.baisoku.org
|
||||
+1066
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,68 @@
|
||||
#pragma once
|
||||
|
||||
/*
|
||||
** Two Level Segregated Fit memory allocator, version 3.0.
|
||||
** Written by Matthew Conte, and placed in the Public Domain.
|
||||
** http://tlsf.baisoku.org
|
||||
**
|
||||
** Based on the original documentation by Miguel Masmano:
|
||||
** http://rtportal.upv.es/rtmalloc/allocators/tlsf/index.shtml
|
||||
**
|
||||
** Please see the accompanying Readme.txt for implementation
|
||||
** notes and caveats.
|
||||
**
|
||||
** This implementation was written to the specification
|
||||
** of the document, therefore no GPL restrictions apply.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* tlsf_t: a TLSF structure. Can contain 1 to N pools. */
|
||||
/* pool_t: a block of memory that TLSF can manage. */
|
||||
typedef void* tlsf_t;
|
||||
typedef void* pool_t;
|
||||
typedef void (*error_cb_t) (const char *msg);
|
||||
|
||||
/* Create/destroy a memory pool. */
|
||||
tlsf_t tlsf_create(void* mem, error_cb_t error_cb);
|
||||
tlsf_t tlsf_create_with_pool(void* mem, size_t bytes, error_cb_t error_cb);
|
||||
void tlsf_destroy(tlsf_t tlsf);
|
||||
pool_t tlsf_get_pool(tlsf_t tlsf);
|
||||
|
||||
/* Add/remove memory pools. */
|
||||
pool_t tlsf_add_pool(tlsf_t tlsf, void* mem, size_t bytes);
|
||||
void tlsf_remove_pool(tlsf_t tlsf, pool_t pool);
|
||||
|
||||
/* malloc/memalign/realloc/free replacements. */
|
||||
void* tlsf_malloc(tlsf_t tlsf, size_t bytes);
|
||||
void* tlsf_memalign(tlsf_t tlsf, size_t align, size_t bytes);
|
||||
void* tlsf_realloc(tlsf_t tlsf, void* ptr, size_t size);
|
||||
void tlsf_free(tlsf_t tlsf, void* ptr);
|
||||
|
||||
/* Returns internal block size, not original request size */
|
||||
size_t tlsf_block_size(void* ptr);
|
||||
|
||||
/* Overheads/limits of internal structures. */
|
||||
size_t tlsf_size(void);
|
||||
size_t tlsf_align_size(void);
|
||||
size_t tlsf_block_size_min(void);
|
||||
size_t tlsf_block_size_max(void);
|
||||
size_t tlsf_pool_overhead(void);
|
||||
size_t tlsf_alloc_overhead(void);
|
||||
|
||||
/* Debugging. */
|
||||
typedef void (*tlsf_walker)(void* ptr, size_t size, int used, void* user);
|
||||
void tlsf_walk_pool(pool_t pool, tlsf_walker walker, void* user);
|
||||
/* Returns nonzero if any internal consistency check fails. */
|
||||
int tlsf_check(tlsf_t tlsf);
|
||||
int tlsf_check_pool(pool_t pool);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user