Microchip® Advanced Software Framework

ble_sdk/src/platform.c File Reference

Platform Abstraction layer for BLE applications.

Copyright (c) 2017-2018 Microchip Technology Inc. and its subsidiaries.

#include <asf.h>
#include "platform.h"
#include "serial_drv.h"
#include "serial_fifo.h"
#include "ble_utils.h"
#include "conf_serialdrv.h"
#include "timer_hw.h"

Macros

#define DBG_LOG_BLE   DBG_LOG
 

Functions

void plaform_ble_rx_callback (void)
 
void platform_configure_hw_fc_uart (uint32_t baudrate)
 
void platform_configure_primary_uart (uint32_t baudrate)
 sends a message over the platform-specific bus and blocks until Tx Completes More...
 
void * platform_create_signal (void)
 
void * platform_create_timer (void(*timer_cb)(void *))
 
void platform_delete_signal (void *signal_handler)
 
void platform_delete_timer (void *timer_handle)
 
void platform_dma_process_rxdata (uint8_t *buf, uint16_t len)
 
void platform_enter_sleep (void)
 
void platform_gpio_set (at_ble_gpio_pin_t pin, at_ble_gpio_status_t status)
 
void platform_host_set_sleep (bool sleep)
 
void platform_host_wake_interrupt_handler (void)
 
at_ble_status_t platform_init (uint8_t bus_type, uint8_t btlc1000_module_version)
 implements platform-specific initialization More...
 
void platform_process_rxdata (uint8_t t_rx_data)
 
void platform_recv_async (void(*recv_async_callback)(uint8_t))
 
void platform_reset_signal (void *signal_handler)
 
void platform_send_sync (uint8_t *data, uint32_t len)
 
void platform_sleep (uint32_t ms)
 
void platform_start_timer (void *timer_handle, uint32_t ms)
 
void platform_stop_timer (void *timer_handle)
 
void platform_trigger_signal (void *signal_handler)
 
void platform_wait_for_signal (uint32_t count, void **signal_handler_list)
 
bool platform_wakeup_pin_status (void)
 

Variables

static volatile bool host_sleep_flag = false
 
static os_signal_t platform_os_signals [MAX_PLATFORM_OS_SIGNAL]
 
static volatile bool platform_timer_used = false
 
static void(* recv_async_cb )(uint8_t) = NULL
 
volatile bool wakeup_pin_status
 

#define DBG_LOG_BLE   DBG_LOG

Referenced by platform_send_sync().

void plaform_ble_rx_callback ( void  )
void platform_configure_hw_fc_uart ( uint32_t  baudrate)
void platform_configure_primary_uart ( uint32_t  baudrate)

sends a message over the platform-specific bus and blocks until Tx Completes

Sends a message over the platform-specific bus that might be UART, SPI

Parameters
[in]datadata to send over the interface
[in]lenlength of data

References configure_serial_drv().

Referenced by ble_device_init(), and ble_init().

void* platform_create_signal ( void  )
void* platform_create_timer ( void(*)(void *)  timer_cb)

References platform_create_hw_timer(), and timer_cb().

Referenced by ble_init().

void platform_delete_signal ( void *  signal_handler)
void platform_delete_timer ( void *  timer_handle)

References platform_delete_bus_timer().

Referenced by ble_init().

void platform_dma_process_rxdata ( uint8_t *  buf,
uint16_t  len 
)

References recv_async_cb.

void platform_gpio_set ( at_ble_gpio_pin_t  pin,
at_ble_gpio_status_t  status 
)
void platform_host_set_sleep ( bool  sleep)

References host_sleep_flag.

Referenced by ble_device_init(), and ble_init().

void platform_host_wake_interrupt_handler ( void  )
at_ble_status_t platform_init ( uint8_t  bus_type,
uint8_t  btlc1000_module_version 
)

implements platform-specific initialization

Parameters
[in]bus_typebus type can be UART or SPI
[in]btlc1000_module_versionBTLC1000 MR/ZR Module version
Returns
Upon successful completion the function shall return AT_BLE_SUCCESS, Otherwise the function shall return at_ble_status_t

References ALL_UNUSED, AT_BLE_INVALID_PARAM, AT_BLE_SUCCESS, AT_BLE_UART, ble_assert, configure_serial_drv(), platform_configure_sleep_manager(), and status.

void platform_process_rxdata ( uint8_t  t_rx_data)

References Assert, NULL, and recv_async_cb.

Referenced by serial_drv_read_cb().

void platform_recv_async ( void(*)(uint8_t)  recv_async_callback)

References platform_start_rx(), and recv_async_cb.

Referenced by ble_init().

void platform_reset_signal ( void *  signal_handler)
void platform_send_sync ( uint8_t *  data,
uint32_t  len 
)
void platform_sleep ( uint32_t  ms)

References delay_ms.

Referenced by ble_init().

void platform_start_timer ( void *  timer_handle,
uint32_t  ms 
)
void platform_stop_timer ( void *  timer_handle)
void platform_trigger_signal ( void *  signal_handler)
void platform_wait_for_signal ( uint32_t  count,
void **  signal_handler_list 
)
bool platform_wakeup_pin_status ( void  )

Referenced by platform_send_sync().

volatile bool host_sleep_flag = false
static
os_signal_t platform_os_signals[MAX_PLATFORM_OS_SIGNAL]
static

Referenced by platform_create_signal().

volatile bool platform_timer_used = false
static
void(* recv_async_cb)(uint8_t) = NULL
static
volatile bool wakeup_pin_status