Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
François Revol
firmware
Commits
be09c127
Verified
Commit
be09c127
authored
Aug 13, 2019
by
Rahix
Browse files
feat(epicardium): Add module for hardware init
Signed-off-by:
Rahix
<
rahix@rahix.de
>
parent
5f794074
Changes
4
Hide whitespace changes
Inline
Side-by-side
epicardium/main.c
View file @
be09c127
...
...
@@ -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
();
...
...
epicardium/modules/hardware.c
0 → 100644
View file @
be09c127
#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
;
}
epicardium/modules/meson.build
View file @
be09c127
...
...
@@ -2,6 +2,7 @@ module_sources = files(
'dispatcher.c'
,
'display.c'
,
'fileops.c'
,
'hardware.c'
,
'leds.c'
,
'light_sensor.c'
,
'log.c'
,
...
...
epicardium/modules/modules.h
View file @
be09c127
...
...
@@ -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 */
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment