Skip to content
Snippets Groups Projects
Select Git revision
  • schneider/ir
  • master default protected
  • rahix/user-space-ctx
  • schneider/iaq-python
  • schneider/ble-mini-demo
  • schneider/ble-ecg-stream-visu
  • schneider/mp-exception-print
  • schneider/sleep-display
  • schneider/deepsleep4
  • schneider/deepsleep2
  • schneider/deepsleep
  • schneider/ble-central
  • rahix/bluetooth-app-favorite
  • schneider/v1.17-changelog
  • schneider/ancs
  • schneider/png
  • schneider/freertos-list-debug
  • schneider/212-reset-hardware-when-entering-repl
  • schneider/bonding-fail-if-full
  • schneider/ble-fixes-2020-3
  • v1.18
  • v1.17
  • v1.16
  • v1.15
  • v1.14
  • v1.13
  • v1.12
  • v1.11
  • v1.10
  • v1.9
  • v1.8
  • v1.7
  • v1.6
  • v1.5
  • v1.4
  • v1.3
  • v1.2
  • v1.1
  • v1.0
  • release-1
40 results

common.h

Blame
  • common.h 1.15 KiB
    #include <stdint.h>
    #include <stdbool.h>
    #include "gpio.h"
    
    /*
     * Semaphore used for API synchronization.
     * TODO: Replace this with a LDREX/STREX based implementation
     */
    #define _API_SEMAPHORE    0
    
    static const gpio_cfg_t debug_pin_0 = {PORT_0, PIN_22, GPIO_FUNC_OUT, GPIO_PAD_NONE};
    static const gpio_cfg_t debug_pin_1 = {PORT_0, PIN_21, GPIO_FUNC_OUT, GPIO_PAD_NONE};
    
    
    /* Type of API IDs */
    typedef uint32_t api_id_t;
    
    #define _API_FLAG_IDLE        0
    #define _API_FLAG_CALLING     1
    #define _API_FLAG_RETURNED    2
    
    /* Layout of the shared memory for API calls */
    struct api_call_mem {
    	/*
    	 * Flag for synchronization of API calls.  When this flag
    	 * is set, the caller has issued a call and is waiting for
    	 * the dispatcher to reset the flag.
    	 */
    	uint8_t call_flag;
    
    	/* ID if the ongoing API call */
    	api_id_t id;
    
    	/*
    	 * Buffer for arguments/return value.  This buffer will be
    	 * *overflown*, because there is guaranteed space behind it.
    	 *
    	 * TODO: Add a maximum bounds check
    	 */
    	uint8_t buffer[1];
    };
    
    /* TODO: Make this address part of the linker script */
    static __attribute__((unused)) struct api_call_mem* API_CALL_MEM =
    	(struct api_call_mem*)0x20080000;