Commit bc6d8102 authored by schneider's avatar schneider
Browse files

Merge branch 'rahix/cleanup-epicardium-structure' into 'master'

Cleanup epicardium structure

See merge request !472
parents b0e0988f 7994ab45
Pipeline #5209 passed with stages
in 4 minutes and 55 seconds
.. _epicardium_internal_apis:
Epicardium Internal APIs
========================
Core OS APIs
------------
.. c:autodoc:: epicardium/os/core.h
......@@ -23,7 +23,7 @@ look at the :ref:`mutex-design-reasons`.
Definitions
-----------
.. c:autodoc:: epicardium/modules/mutex.h
.. c:autodoc:: epicardium/os/mutex.h
.. _mutex-design-reasons:
......
......@@ -66,6 +66,7 @@ Last but not least, if you want to start hacking the lower-level firmware, the
epicardium/overview
epicardium/api
epicardium-guide
epicardium/internal
.. toctree::
:maxdepth: 1
......
#include "epicardium.h"
#include "api/dispatcher.h"
#include "modules/log.h"
#include "card10.h"
......
......@@ -246,7 +246,7 @@ void __dispatch_isr(api_int_id_t id)
# Generate Dispatcher {{{
with open(args.server, "w") as f_dispatcher:
tmp = """\
#include "modules/log.h"
#include "os/core.h"
#include "{header}"
void __api_dispatch_call(uint32_t id, void*epc__apistub_buffer)
......
#include "epicardium.h"
#include "modules/log.h"
#include "modules/config.h"
#include "os/core.h"
#include "os/config.h"
#include "fs/fs_util.h"
#include "wsf_types.h"
......
#include "ble_api.h"
#include "epicardium.h"
#include "modules/log.h"
#include "modules/config.h"
#include "os/core.h"
#include "os/config.h"
#include "wsf_types.h"
#include "util/bstream.h"
......
......@@ -12,7 +12,7 @@
#include "profiles/gap_api.h"
#include "tipc/tipc_api.h"
#include "modules/log.h"
#include "os/core.h"
/* card10:
* copied from lib/sdk/Libraries/BTLE/stack/ble-profiles/sources/apps/tag/tag_main.c
* and lib/sdk/Libraries/BTLE/stack/ble-profiles/sources/apps/watch/watch_main.c
......
......@@ -39,8 +39,8 @@
#include "ble_api.h"
#include "epicardium.h"
#include "modules/log.h"
#include "modules/config.h"
#include "os/core.h"
#include "os/config.h"
#define SCAN_REPORTS_NUM 16
......
......@@ -33,7 +33,7 @@
#include "app_cfg.h"
#include "epicardium.h"
#include "modules/log.h"
#include "os/core.h"
#include "FreeRTOS.h"
#include "timers.h"
#include "mxc_sys.h"
......
#include "ble_api.h"
#include "epicardium.h"
#include "modules/log.h"
#include "os/core.h"
#include "wsf_types.h"
#include "util/bstream.h"
......
#include "ble_api.h"
#include "epicardium.h"
#include "modules/log.h"
#include "os/core.h"
#include "modules/modules.h"
#include "user_core/interrupts.h"
#include "wsf_buf.h"
#include "app_api.h"
......
......@@ -8,8 +8,10 @@
#include "app_api.h"
#include "epicardium.h"
#include "modules/log.h"
#include "os/core.h"
#include "os/work_queue.h"
#include "modules/modules.h"
#include "drivers/drivers.h"
#include "ble/ble_api.h"
......
......@@ -33,7 +33,7 @@
#include "hci_vs.h"
#include <epicardium.h>
#include "modules/log.h"
#include "os/core.h"
#include "util/bstream.h"
#include "att_api.h"
......
......@@ -10,7 +10,7 @@
#include "svc_hid.h"
#include "hid/hid_api.h"
#include "modules/log.h"
#include "os/core.h"
#include <stdio.h>
#include <string.h>
......
......@@ -2,7 +2,7 @@
#include "cccd.h"
#include "epicardium.h"
#include "modules/log.h"
#include "os/core.h"
#include "dm_api.h"
#include "att_api.h"
......
......@@ -2,6 +2,7 @@
#include "cccd.h"
#include "modules/modules.h"
#include "drivers/drivers.h"
#include "wsf_types.h"
#include "util/bstream.h"
......
......@@ -12,9 +12,11 @@
#include "queue.h"
#include "epicardium.h"
#include "modules/log.h"
#include "os/core.h"
#include "modules/modules.h"
#include "drivers/drivers.h"
#include "modules/stream.h"
#include "user_core/interrupts.h"
/* BHI160 Firmware Blob. Contents are defined in libcard10. */
extern uint8_t bhy1_fw[];
......
#include "epicardium.h"
#include "modules/modules.h"
#include "modules/log.h"
#include "os/core.h"
#include "drivers/drivers.h"
#include "card10.h"
......
......@@ -7,9 +7,9 @@
#include "ble/ess.h"
#include "epicardium.h"
#include "modules.h"
#include "config.h"
#include "modules/log.h"
#include "modules/modules.h"
#include "os/config.h"
#include "os/core.h"
#include "FreeRTOS.h"
#include "task.h"
......
#include "epicardium.h"
#include "modules/modules.h"
#include "modules/log.h"
#include "os/core.h"
#include "portexpander.h"
#include "MAX77650-Arduino-Library.h"
......
#ifndef DRIVERS_H
#define DRIVERS_H
#include "FreeRTOS.h"
#include "gpio.h"
#include "os/mutex.h"
#include "epicardium.h"
#include <stdint.h>
#include <stdbool.h>
/* ---------- Serial ------------------------------------------------------- */
#define SERIAL_READ_BUFFER_SIZE 128
#define SERIAL_WRITE_STREAM_BUFFER_SIZE 512
void serial_init();
void vSerialTask(void *pvParameters);
void serial_enqueue_char(char chr);
void serial_flush(void);
extern TaskHandle_t serial_task_id;
/* Turn off the print queue and do prints synchroneous from now on. */
void serial_return_to_synchronous();
// For the eSetBit xTaskNotify task semaphore trigger
enum serial_notify{
SERIAL_WRITE_NOTIFY = 0x01,
SERIAL_READ_NOTIFY = 0x02,
};
/* ---------- PMIC --------------------------------------------------------- */
void vPmicTask(void *pvParameters);
/* ---------- Watchdog ----------------------------------------------------- */
void watchdog_init();
void watchdog_clearer_init();
/* Critical battery voltage */
#define BATTERY_CRITICAL 3.40f
enum pmic_amux_signal {
PMIC_AMUX_DISABLED = 0x0,
PMIC_AMUX_CHGIN_U = 0x1,
PMIC_AMUX_CHGIN_I = 0x2,
PMIC_AMUX_BATT_U = 0x3,
PMIC_AMUX_BATT_CHG_I = 0x4,
PMIC_AMUX_BATT_DIS_I = 0x5,
PMIC_AMUX_BATT_NULL_I = 0x6,
PMIC_AMUX_THM_U = 0x7,
PMIC_AMUX_TBIAS_U = 0x8,
PMIC_AMUX_AGND_U = 0x9,
PMIC_AMUX_SYS_U = 0xA,
_PMIC_AMUX_MAX,
};
/*
* Read a value from the PMIC's AMUX. The result is already converted into its
* proper unit. See the MAX77650 datasheet for details.
*/
int pmic_read_amux(enum pmic_amux_signal sig, float *result);
/* ---------- Display ------------------------------------------------------ */
/* Forces an unlock of the display. Only to be used in Epicardium */
void disp_forcelock();
/* ---------- BHI160 ------------------------------------------------------- */
#define BHI160_FIFO_SIZE 128
#define BHI160_MUTEX_WAIT_MS 50
void vBhi160Task(void *pvParameters);
/* ---------- BME680 ------------------------------------------------------- */
void bme680_periodic(int period);
/* ---------- MAX86150 ----------------------------------------------------- */
#define MAX86150_MUTEX_WAIT_MS 50
void vMAX86150Task(void *pvParameters);
void max86150_mutex_init(void);
/* ---------- MAX30001 ----------------------------------------------------- */
void vMAX30001Task(void *pvParameters);
void max30001_mutex_init(void);
/* ---------- GPIO --------------------------------------------------------- */
extern gpio_cfg_t gpio_configs[];
/* ---------- BSEC / BME680 ------------------------------------------------ */
int bsec_activate(void);
void vBSECTask(void *pvParameters);
bool bsec_active(void);
struct bme680_sensor_data;
int bsec_read_bme680(struct bme680_sensor_data *data);
/* ---------- Sleep -------------------------------------------------------- */
void sleep_deepsleep(void);
/* ---------- RNG ---------------------------------------------------------- */
void rng_init(void);
#endif /* DRIVERS_H */
......@@ -4,7 +4,7 @@
#include "mxc_sys.h"
#include "adc.h"
#include "mxc_errors.h"
#include "modules/log.h"
#include "os/core.h"
#include "modules/modules.h"
/*
......
......@@ -4,7 +4,7 @@
#include "timers.h"
#include "task.h"
#include "epicardium.h"
#include "modules.h"
#include "modules/modules.h"
#include <stdbool.h>
......
#include "epicardium.h"
#include "modules/log.h"
#include "os/core.h"
#include "os/work_queue.h"
#include "modules/modules.h"
#include "mxc_config.h"
......
......@@ -12,10 +12,11 @@
#include "queue.h"
#include "epicardium.h"
#include "modules/log.h"
#include "os/core.h"
#include "modules/modules.h"
#include "modules/stream.h"
#include "modules/mutex.h"
#include "os/mutex.h"
#include "user_core/interrupts.h"
/* Interrupt Pin */
static const gpio_cfg_t max30001_interrupt_pin = {
......
......@@ -3,11 +3,11 @@
#include <stdio.h>
#include "max86150.h"
#include "epicardium.h"
#include "modules.h"
#include "modules/log.h"
#include "os/core.h"
#include "modules/stream.h"
#include "gpio.h"
#include "pmic.h"
#include "user_core/interrupts.h"
#include "FreeRTOS.h"
#include "task.h"
......
driver_sources = files(
'bhi.c',
'bsec.c',
'bme680.c',
'buttons.c',
'display.c',
'gpio.c',
'leds.c',
'light_sensor.c',
'max86150.c',
'max30001.c',
'pmic.c',
'rtc.c',
'serial.c',
'sleep.c',
'rng.c',
'usb.c',
'vibra.c',
'watchdog.c',
'ws2812.c'
)
#include "epicardium.h"
#include "modules/modules.h"
#include "modules/log.h"
#include "modules/config.h"
#include "drivers/drivers.h"
#include "os/core.h"
#include "os/config.h"
#include "user_core/user_core.h"
#include "card10.h"
#include "pmic.h"
......
#include "epicardium.h"
#include "modules.h"
#include "modules/modules.h"
#include "drivers/drivers.h"
#include "MAX77650-Arduino-Library.h"
#include "tiny-AES-c/aes.h"
......
#include "epicardium.h"
#include "modules/log.h"
#include "os/core.h"
#include "modules/modules.h"
#include "user_core/interrupts.h"
#include "FreeRTOS.h"
#include "task.h"
......
#include "epicardium.h"
#include "modules/log.h"
#include "os/core.h"
#include "modules/modules.h"
#include "drivers/drivers.h"
#include "user_core/interrupts.h"
#include "max32665.h"
#include "usb/cdcacm.h"
......
#include "epicardium.h"
#include "modules/modules.h"
#include "modules/log.h"
#include "os/core.h"
#include "card10.h"
#include "simo.h"
......
......@@ -11,15 +11,15 @@
#include "epicardium.h"
#include "modules/filesystem.h"
#include "modules/config.h"
#include "fs/filesystem.h"
#include "os/config.h"
#include "usb/cdcacm.h"
#include "usb/mass_storage.h"
#include "usb/descriptors.h"
#include "usb/epc_usb.h"
#include "modules/log.h"
#include "os/core.h"
#include "mx25lba.h"
#include "msc.h"
......
#include "modules/log.h"
#include "os/core.h"
#include "modules/modules.h"
#include "timers.h"
......
......@@ -5,7 +5,8 @@
#include "epicardium.h"
#include "max32665.h"
#include "gpio.h"
#include "modules.h"
#include "modules/modules.h"
#include "drivers/drivers.h"
#include <stdbool.h>
......
......@@ -19,13 +19,14 @@
#include <timers.h>
#include "fs/internal.h"
#include "modules/filesystem.h"
#include "fs/filesystem.h"
#include "user_core/user_core.h"
#include "epicardium.h"
#include "card10.h"
#include "modules/log.h"
#include "os/core.h"
#include "modules/modules.h"
#include "api/common.h"
#include "modules/mutex.h"
#include "os/mutex.h"
#define SSLOG_DEBUG(...) LOG_DEBUG("fatfs", __VA_ARGS__)
#define SSLOG_INFO(...) LOG_INFO("fatfs", __VA_ARGS__)
......
fs_sources = files(
'fileops.c',
'filesystem_fat.c',
'fs_util.c',
)
......@@ -6,7 +6,7 @@
#include "epicardium.h"
#include "l0der/elf.h"
#include "modules/log.h"
#include "os/core.h"
/*
* l0der is, in reality, a boneless operating-system style ELF loader.
......
#include "modules/modules.h"
#include "modules/log.h"
#include "modules/filesystem.h"
#include "modules/config.h"
#include "os/core.h"
#include "os/work_queue.h"
#include "fs/filesystem.h"
#include "drivers/drivers.h"
#include "user_core/user_core.h"
#include "os/config.h"
#include "card10-version.h"
#include "user_core/interrupts.h"
#include "gfx.h"
#include "display.h"
......
......@@ -66,7 +66,11 @@ freertos = static_library(
##########################################################################
subdir('modules/')
subdir('drivers/')
subdir('user_core/')
subdir('ble/')
subdir('os/')
subdir('fs/')
subdir('l0der/')
......@@ -96,9 +100,11 @@ elf = executable(
'usb/mass_storage.c',
'main.c',
'support.c',
'fs/filesystem_fat.c',
'fs/fs_util.c',
module_sources,
os_sources,
user_core_sources,
driver_sources,
fs_sources,
l0der_sources,
ble_sources,
version_hdr,
......
......@@ -2,10 +2,13 @@
#include "api/dispatcher.h"
#include "usb/epc_usb.h"
#include "modules/filesystem.h"
#include "modules/log.h"
#include "fs/filesystem.h"
#include "os/core.h"
#include "modules/modules.h"
#include "modules/stream.h"
#include "drivers/drivers.h"
#include "user_core/interrupts.h"
#include "user_core/user_core.h"
#include "card10.h"
#include "display.h"
......
#include "modules/log.h"
#include "os/core.h"
#include "modules/modules.h"
#include "modules/mutex.h"
#include "os/mutex.h"
#include "FreeRTOS.h"
#include "task.h"
......
module_sources = files(
'bhi.c',
'bsec.c',
'bme680.c',
'buttons.c',
'config.c',
'dispatcher.c',
'display.c',
'fileops.c',
'gpio.c',