[FL-1906] Documentation: add Doxyfile, prepare sources for doxygen. (#741)
* Documentation: add Doxyfile, prepare sources for doxygen. * Update ReadMe and remove obsolete CLA * Add contribution guide * Contributing: update text * Correct spelling
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
/**
|
||||
* @file api-interrupt-mgr.h
|
||||
* Furi: interrupt API
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
@@ -23,45 +28,45 @@ typedef struct {
|
||||
bool ready;
|
||||
} InterruptCallbackItem;
|
||||
|
||||
/**
|
||||
* Init interrupt
|
||||
* @return true on succsessful initialization, false otherwise
|
||||
/** Init interrupt
|
||||
*
|
||||
* @return true on succsessful initialization, false otherwise
|
||||
*/
|
||||
bool api_interrupt_init();
|
||||
|
||||
/**
|
||||
* Add interrupt
|
||||
* @param callback InterruptCallback
|
||||
* @param type InterruptType
|
||||
* @param context context for callback
|
||||
/** Add interrupt
|
||||
*
|
||||
* @param callback InterruptCallback
|
||||
* @param type InterruptType
|
||||
* @param context context for callback
|
||||
*/
|
||||
void api_interrupt_add(InterruptCallback callback, InterruptType type, void* context);
|
||||
|
||||
/**
|
||||
* Remove interrupt
|
||||
* @param callback InterruptCallback
|
||||
* @param type InterruptType
|
||||
/** Remove interrupt
|
||||
*
|
||||
* @param callback InterruptCallback
|
||||
* @param type InterruptType
|
||||
*/
|
||||
void api_interrupt_remove(InterruptCallback callback, InterruptType type);
|
||||
|
||||
/**
|
||||
* Enable interrupt
|
||||
* @param callback InterruptCallback
|
||||
* @param type InterruptType
|
||||
/** Enable interrupt
|
||||
*
|
||||
* @param callback InterruptCallback
|
||||
* @param type InterruptType
|
||||
*/
|
||||
void api_interrupt_enable(InterruptCallback callback, InterruptType type);
|
||||
|
||||
/**
|
||||
* Disable interrupt
|
||||
* @param callback InterruptCallback
|
||||
* @param type InterruptType
|
||||
/** Disable interrupt
|
||||
*
|
||||
* @param callback InterruptCallback
|
||||
* @param type InterruptType
|
||||
*/
|
||||
void api_interrupt_disable(InterruptCallback callback, InterruptType type);
|
||||
|
||||
/**
|
||||
* Call interrupt
|
||||
* @param type InterruptType
|
||||
* @param hw pointer to hardware peripheral
|
||||
/** Call interrupt
|
||||
*
|
||||
* @param type InterruptType
|
||||
* @param hw pointer to hardware peripheral
|
||||
*/
|
||||
void api_interrupt_call(InterruptType type, void* hw);
|
||||
|
||||
|
@@ -68,6 +68,12 @@ size_t memmgr_get_minimum_free_heap(void) {
|
||||
return xPortGetMinimumEverFreeHeapSize();
|
||||
}
|
||||
|
||||
void* furi_alloc(size_t size) {
|
||||
void* p = malloc(size);
|
||||
furi_check(p);
|
||||
return memset(p, 0, size);
|
||||
}
|
||||
|
||||
void* __wrap__malloc_r(struct _reent* r, size_t size) {
|
||||
void* pointer = malloc(size);
|
||||
return pointer;
|
||||
|
@@ -1,3 +1,8 @@
|
||||
/**
|
||||
* @file memmgr.h
|
||||
* Furi: memory managment API and glue
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
@@ -12,14 +17,27 @@ extern "C" {
|
||||
// define for test case "link against furi memmgr"
|
||||
#define FURI_MEMMGR_GUARD 1
|
||||
|
||||
/** Get free heap size
|
||||
*
|
||||
* @return free heap size in bytes
|
||||
*/
|
||||
size_t memmgr_get_free_heap(void);
|
||||
|
||||
/** Get heap watermark
|
||||
*
|
||||
* @return minimum heap in bytes
|
||||
*/
|
||||
size_t memmgr_get_minimum_free_heap(void);
|
||||
|
||||
inline static void* furi_alloc(size_t size) {
|
||||
void* p = malloc(size);
|
||||
furi_check(p);
|
||||
return memset(p, 0, size);
|
||||
}
|
||||
/** Allocate memory from heap
|
||||
*
|
||||
* @note performs memset with 0, will crash system if not enough memory
|
||||
*
|
||||
* @param[in] size bytes to allocate
|
||||
*
|
||||
* @return pointer to allocated memory
|
||||
*/
|
||||
void* furi_alloc(size_t size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -1,3 +1,8 @@
|
||||
/**
|
||||
* @file memmgr_heap.h
|
||||
* Furi: heap memory managment API and allocator
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
@@ -10,28 +15,32 @@ extern "C" {
|
||||
#define MEMMGR_HEAP_UNKNOWN 0xFFFFFFFF
|
||||
|
||||
/** Memmgr heap enable thread allocation tracking
|
||||
* @param thread_id - thread id to track
|
||||
*
|
||||
* @param thread_id - thread id to track
|
||||
*/
|
||||
void memmgr_heap_enable_thread_trace(osThreadId_t thread_id);
|
||||
|
||||
/** Memmgr heap disable thread allocation tracking
|
||||
* @param thread_id - thread id to track
|
||||
*
|
||||
* @param thread_id - thread id to track
|
||||
*/
|
||||
void memmgr_heap_disable_thread_trace(osThreadId_t thread_id);
|
||||
|
||||
/** Memmgr heap get allocatred thread memory
|
||||
* @param thread_id - thread id to track
|
||||
* @return bytes allocated right now
|
||||
*
|
||||
* @param thread_id - thread id to track
|
||||
*
|
||||
* @return bytes allocated right now
|
||||
*/
|
||||
size_t memmgr_heap_get_thread_memory(osThreadId_t thread_id);
|
||||
|
||||
/** Memmgr heap get the max contiguous block size on the heap
|
||||
* @return size_t max contiguous block size
|
||||
*
|
||||
* @return size_t max contiguous block size
|
||||
*/
|
||||
size_t memmgr_heap_get_max_free_block();
|
||||
|
||||
/**
|
||||
* Print the address and size of all free blocks to stdout
|
||||
/** Print the address and size of all free blocks to stdout
|
||||
*/
|
||||
void memmgr_heap_printf_free_blocks();
|
||||
|
||||
|
@@ -1,3 +1,8 @@
|
||||
/**
|
||||
* @file record.h
|
||||
* Furi: record API
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
@@ -6,36 +11,45 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Initialize record storage
|
||||
* For internal use only.
|
||||
/** Initialize record storage For internal use only.
|
||||
*/
|
||||
void furi_record_init();
|
||||
|
||||
/** Create record
|
||||
* @param name - record name
|
||||
* @param data - data pointer
|
||||
* @note Thread safe. Create and destroy must be executed from the same thread.
|
||||
*
|
||||
* @param name record name
|
||||
* @param data data pointer
|
||||
* @note Thread safe. Create and destroy must be executed from the same
|
||||
* thread.
|
||||
*/
|
||||
void furi_record_create(const char* name, void* data);
|
||||
|
||||
/** Destroy record
|
||||
* @param name - record name
|
||||
* @return true if successful, false if still have holders or thread is not owner.
|
||||
* @note Thread safe. Create and destroy must be executed from the same thread.
|
||||
*
|
||||
* @param name record name
|
||||
*
|
||||
* @return true if successful, false if still have holders or thread is not
|
||||
* owner.
|
||||
* @note Thread safe. Create and destroy must be executed from the same
|
||||
* thread.
|
||||
*/
|
||||
bool furi_record_destroy(const char* name);
|
||||
|
||||
/** Open record
|
||||
* @param name - record name
|
||||
* @return pointer to the record
|
||||
* @note Thread safe. Open and close must be executed from the same thread.
|
||||
* Suspends caller thread till record appear
|
||||
*
|
||||
* @param name record name
|
||||
*
|
||||
* @return pointer to the record
|
||||
* @note Thread safe. Open and close must be executed from the same
|
||||
* thread. Suspends caller thread till record appear
|
||||
*/
|
||||
void* furi_record_open(const char* name);
|
||||
|
||||
/** Close record
|
||||
* @param name - record name
|
||||
* @note Thread safe. Open and close must be executed from the same thread.
|
||||
*
|
||||
* @param name record name
|
||||
* @note Thread safe. Open and close must be executed from the same
|
||||
* thread.
|
||||
*/
|
||||
void furi_record_close(const char* name);
|
||||
|
||||
|
@@ -1,3 +1,8 @@
|
||||
/**
|
||||
* @file stdglue.h
|
||||
* Furi: stdlibc glue
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
@@ -7,31 +12,31 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Write callback
|
||||
* @param _cookie - pointer to cookie (see stdio gnu extension)
|
||||
* @param data - pointer to data
|
||||
* @param size - data size
|
||||
* @warnign your handler must consume everything
|
||||
/** Write callback
|
||||
* @param _cookie pointer to cookie (see stdio gnu extension)
|
||||
* @param data pointer to data
|
||||
* @param size data size @warnign your handler must consume everything
|
||||
*/
|
||||
typedef void (*FuriStdglueWriteCallback)(void* _cookie, const char* data, size_t size);
|
||||
|
||||
/** Initialized std library glue code */
|
||||
void furi_stdglue_init();
|
||||
|
||||
/**
|
||||
* Set global STDOUT callback
|
||||
* @param callback - callback or NULL to clear
|
||||
* @return true on success, otherwise fail
|
||||
* @warning function is thread aware, use this API from the same thread
|
||||
/** Set global STDOUT callback
|
||||
*
|
||||
* @param callback callback or NULL to clear
|
||||
*
|
||||
* @return true on success, otherwise fail
|
||||
* @warning function is thread aware, use this API from the same thread
|
||||
*/
|
||||
bool furi_stdglue_set_global_stdout_callback(FuriStdglueWriteCallback callback);
|
||||
|
||||
/**
|
||||
* Set STDOUT callback for your thread
|
||||
* @param callback - callback or NULL to clear
|
||||
* @return true on success, otherwise fail
|
||||
* @warning function is thread aware, use this API from the same thread
|
||||
/** Set STDOUT callback for your thread
|
||||
*
|
||||
* @param callback callback or NULL to clear
|
||||
*
|
||||
* @return true on success, otherwise fail
|
||||
* @warning function is thread aware, use this API from the same thread
|
||||
*/
|
||||
bool furi_stdglue_set_thread_stdout_callback(FuriStdglueWriteCallback callback);
|
||||
|
||||
|
@@ -1,3 +1,8 @@
|
||||
/**
|
||||
* @file thread.h
|
||||
* Furi: Furi Thread API
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
@@ -18,109 +23,130 @@ typedef enum {
|
||||
/** FuriThread anonymous structure */
|
||||
typedef struct FuriThread FuriThread;
|
||||
|
||||
/** FuriThreadCallback
|
||||
* Your callback to run in new thread
|
||||
* @warning don't use osThreadExit
|
||||
/** FuriThreadCallback Your callback to run in new thread
|
||||
* @warning never use osThreadExit in FuriThread
|
||||
*/
|
||||
typedef int32_t (*FuriThreadCallback)(void* context);
|
||||
|
||||
/** FuriThread state change calback
|
||||
* called upon thread state change
|
||||
* @param state - new thread state
|
||||
* @param context - callback context
|
||||
/** FuriThread state change calback called upon thread state change
|
||||
* @param state new thread state
|
||||
* @param context callback context
|
||||
*/
|
||||
typedef void (*FuriThreadStateCallback)(FuriThreadState state, void* context);
|
||||
|
||||
/** Allocate FuriThread
|
||||
* @return FuriThread instance
|
||||
*
|
||||
* @return FuriThread instance
|
||||
*/
|
||||
FuriThread* furi_thread_alloc();
|
||||
|
||||
/** Release FuriThread
|
||||
* @param thread - FuriThread instance
|
||||
*
|
||||
* @param thread FuriThread instance
|
||||
*/
|
||||
void furi_thread_free(FuriThread* thread);
|
||||
|
||||
/** Set FuriThread name
|
||||
* @param thread - FuriThread instance
|
||||
* @param name - string
|
||||
*
|
||||
* @param thread FuriThread instance
|
||||
* @param name string
|
||||
*/
|
||||
void furi_thread_set_name(FuriThread* thread, const char* name);
|
||||
|
||||
/** Set FuriThread stack size
|
||||
* @param thread - FuriThread instance
|
||||
* @param stack_size - stack size in bytes
|
||||
*
|
||||
* @param thread FuriThread instance
|
||||
* @param stack_size stack size in bytes
|
||||
*/
|
||||
void furi_thread_set_stack_size(FuriThread* thread, size_t stack_size);
|
||||
|
||||
/** Set FuriThread callback
|
||||
* @param thread - FuriThread instance
|
||||
* @param callback - FuriThreadCallback, called upon thread run
|
||||
*
|
||||
* @param thread FuriThread instance
|
||||
* @param callback FuriThreadCallback, called upon thread run
|
||||
*/
|
||||
void furi_thread_set_callback(FuriThread* thread, FuriThreadCallback callback);
|
||||
|
||||
/** Set FuriThread context
|
||||
* @param thread - FuriThread instance
|
||||
* @param context - pointer to context for thread callback
|
||||
*
|
||||
* @param thread FuriThread instance
|
||||
* @param context pointer to context for thread callback
|
||||
*/
|
||||
void furi_thread_set_context(FuriThread* thread, void* context);
|
||||
|
||||
/** Set FuriThread state change callback
|
||||
* @param thread - FuriThread instance
|
||||
* @param callack - state change callback
|
||||
*
|
||||
* @param thread FuriThread instance
|
||||
* @param callback state change callback
|
||||
*/
|
||||
void furi_thread_set_state_callback(FuriThread* thread, FuriThreadStateCallback callback);
|
||||
|
||||
/** Set FuriThread state change context
|
||||
* @param thread - FuriThread instance
|
||||
* @param context - pointer to context
|
||||
*
|
||||
* @param thread FuriThread instance
|
||||
* @param context pointer to context
|
||||
*/
|
||||
void furi_thread_set_state_context(FuriThread* thread, void* context);
|
||||
|
||||
/** Get FuriThread state
|
||||
* @param thread - FuriThread instance
|
||||
* @return thread state from FuriThreadState
|
||||
*
|
||||
* @param thread FuriThread instance
|
||||
*
|
||||
* @return thread state from FuriThreadState
|
||||
*/
|
||||
FuriThreadState furi_thread_get_state(FuriThread* thread);
|
||||
|
||||
/** Start FuriThread
|
||||
* @param thread - FuriThread instance
|
||||
* @return true on success
|
||||
*
|
||||
* @param thread FuriThread instance
|
||||
*
|
||||
* @return true on success
|
||||
*/
|
||||
bool furi_thread_start(FuriThread* thread);
|
||||
|
||||
/** Treminate FuriThread
|
||||
* @param thread - FuriThread instance
|
||||
* @return osStatus_t
|
||||
* @warning terminating statefull thread is dangerous
|
||||
* use only if you know what you doing
|
||||
*
|
||||
* @param thread FuriThread instance
|
||||
*
|
||||
* @return osStatus_t
|
||||
* @warning terminating statefull thread is dangerous use only if you know
|
||||
* what you doing
|
||||
*/
|
||||
osStatus_t furi_thread_terminate(FuriThread* thread);
|
||||
|
||||
/** Join FuriThread
|
||||
* @param thread - FuriThread instance
|
||||
* @return osStatus_t
|
||||
*
|
||||
* @param thread FuriThread instance
|
||||
*
|
||||
* @return osStatus_t
|
||||
*/
|
||||
osStatus_t furi_thread_join(FuriThread* thread);
|
||||
|
||||
/** Get CMSIS Thread ID
|
||||
* @param thread - FuriThread instance
|
||||
* @return osThreadId_t or NULL
|
||||
*
|
||||
* @param thread FuriThread instance
|
||||
*
|
||||
* @return osThreadId_t or NULL
|
||||
*/
|
||||
osThreadId_t furi_thread_get_thread_id(FuriThread* thread);
|
||||
|
||||
/** Enable heap tracing
|
||||
* @param thread - FuriThread instance
|
||||
*
|
||||
* @param thread FuriThread instance
|
||||
*/
|
||||
void furi_thread_enable_heap_trace(FuriThread* thread);
|
||||
|
||||
/** Disable heap tracing
|
||||
* @param thread - FuriThread instance
|
||||
*
|
||||
* @param thread FuriThread instance
|
||||
*/
|
||||
void furi_thread_disable_heap_trace(FuriThread* thread);
|
||||
|
||||
/** Get thread heap size
|
||||
* @param thread - FuriThread instance
|
||||
*
|
||||
* @param thread FuriThread instance
|
||||
*
|
||||
* @return size in bytes
|
||||
*/
|
||||
size_t furi_thread_get_heap_size(FuriThread* thread);
|
||||
|
||||
|
Reference in New Issue
Block a user