Skip to content
Snippets Groups Projects
Verified Commit be09c127 authored by rahix's avatar rahix
Browse files

feat(epicardium): Add module for hardware init


Signed-off-by: default avatarRahix <rahix@rahix.de>
parent 5f794074
No related branches found
No related tags found
No related merge requests found
......@@ -36,7 +36,8 @@ int main(void)
LOG_INFO("startup", "Epicardium startup ...");
LOG_INFO("startup", "Version " CARD10_VERSION);
card10_init();
hardware_early_init();
#ifdef CARD10_DEBUG_CORE1
LOG_WARN("startup", "Core 1 Debugger Mode");
static const gpio_cfg_t swclk = {
......@@ -157,6 +158,8 @@ int main(void)
core1_load((void *)0x10080000, "main.py");
}
hardware_init();
LOG_INFO("startup", "Starting FreeRTOS ...");
vTaskStartScheduler();
......
#include "modules/modules.h"
#include "card10.h"
/*
* Early init is called at the very beginning and is meant for modules which
* absolutely need to start as soon as possible. hardware_early_init() blocks
* which means code in here should be fast.
*/
int hardware_early_init(void)
{
card10_init();
return 0;
}
/*
* hardware_init() is called after the core has been bootstrapped and is meant
* for less critical initialization steps. Modules which initialize here should
* be robust against a l0dable using their API before initialization is done.
*
* Ideally, acquire a lock in hardware_early_init() and release it in
* hardware_init() once initialization is done.
*/
int hardware_init(void)
{
return 0;
}
/*
* hardware_reset() is called whenever a new l0dable is started. hardware_reset()
* should bring all peripherals back into a known initial state. This does not
* necessarily mean resetting the peripheral entirely but hardware_reset()
* should at least bring the API facing part of a peripheral back into the state
* a fresh booted l0dable expects.
*/
int hardware_reset(void)
{
card10_init();
return 0;
}
......@@ -2,6 +2,7 @@ module_sources = files(
'dispatcher.c',
'display.c',
'fileops.c',
'hardware.c',
'leds.c',
'light_sensor.c',
'log.c',
......
......@@ -11,6 +11,11 @@ void vApiDispatcher(void *pvParameters);
extern SemaphoreHandle_t api_mutex;
extern TaskHandle_t dispatcher_task_id;
/* ---------- Hardware Init & Reset ---------------------------------------- */
int hardware_early_init(void);
int hardware_init(void);
int hardware_reset(void);
/* ---------- Serial ------------------------------------------------------- */
#define SERIAL_READ_BUFFER_SIZE 128
void vSerialTask(void *pvParameters);
......@@ -27,4 +32,5 @@ void ble_uart_write(uint8_t *pValue, uint8_t len);
// Forces an unlock of the display. Only to be used in epicardium
void disp_forcelock();
#endif /* MODULES_H */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment