Skip to content
Snippets Groups Projects
Select Git revision
  • b7c0b608f86d9fea6ec91f60331c8a57f6175822
  • master default protected
  • mh/blecentral
  • patch-2
  • patch-1
  • filenames-blacklist
  • rahix/ble-fix
  • genofire/ble-rewrite
  • koalo/bhi160-works-but-dirty
  • ch3/splashscreen
  • m
  • rahix/simple_menu
  • ios-workarounds
  • koalo/wip/i2c-for-python
  • renze/safe_mode
  • renze/hatchery_apps
  • schneider/fundamental-test
  • koalo/factory-reset
  • msgctl/gfx_rle
  • msgctl/faultscreen
  • msgctl/textbuffer_api
  • v1.2
  • v1.1
  • v1.0
  • release-1
  • bootloader-v1
  • v0.0
27 results

modules.h

Blame
  • Forked from card10 / firmware
    1390 commits behind the upstream repository.
    Rahix's avatar
    rahix authored
    This commit introduces a lifecycle for core 1.  Based on the new loading
    system, a few APIs are made available to control the payload running on
    core 1.  These are:
    
    1. From core 1 (Pycardium, L0dable):
    
        - `epic_exec(name)` API Call:  Request loading of a new payload by
          name.  If the file does not exist, the call will return with an
          error code.  Otherwise, control will go to the new payload.
        - `epic_exit(retcode)` API Call:  Return from payload
          unconditionally.  This call should be called whenever a payload is
          done or when it has hit an unrecoverable error.  On `epic_exit`,
          Epicardium will reset the core back into the menu.
    
    2. From inside Epicardium:
    
        - `epic_exec(name)`: This is **not** the same as the API call, as it
          needs a different implementation underneath.  It will load a new
          payload and wait until this load actually completed (synchroneous).
        - `return_to_menu()`: Return core 1 to the menu script no matter
          what it is currently doing.  This call is asynchroneous and will
          return immediately after scheduling the lifecycle task.  This task
          will then take care of actually performing the load.
    
    Signed-off-by: default avatarRahix <rahix@rahix.de>
    b7c0b608
    History
    modules.h 1.23 KiB
    #ifndef MODULES_H
    #define MODULES_H
    
    #include "FreeRTOS.h"
    #include "semphr.h"
    
    #include <stdint.h>
    
    /* ---------- Dispatcher --------------------------------------------------- */
    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);
    
    /* ---------- Lifecycle ---------------------------------------------------- */
    void vLifecycleTask(void *pvParameters);
    void return_to_menu(void);
    
    /* ---------- Serial ------------------------------------------------------- */
    #define SERIAL_READ_BUFFER_SIZE 128
    void vSerialTask(void *pvParameters);
    void serial_enqueue_char(char chr);
    
    /* ---------- PMIC --------------------------------------------------------- */
    /* In 1/10s */
    #define PMIC_PRESS_SLEEP           20
    #define PMIC_PRESS_POWEROFF        40
    void vPmicTask(void *pvParameters);
    
    /* ---------- BLE ---------------------------------------------------------- */
    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 */