BM module Interface definitions.
Copyright (c) 2018 Microchip Technology Inc. and its subsidiaries.
#include "platform_files.h"
#include "bm_mode.h"
#include "bm_application_mode.h"
#include "bm_program_mode.h"
#include "bm_utils.h"
#include "fifo.h"
#include "event_mem.h"
#include "memory.h"
#include "ble_api.h"
#include "dfu_api.h"
#include "interface.h"
Variables | |
event_t | appEvent |
uart_read_async_cb_t | ble_uart_receive_async |
uart_write_sync_cb_t | ble_uart_send_sync |
static bool | hw_timer_status = 0 |
static void * | interface_event_timer_handle = NULL |
static bool | interface_event_timer_timeout = false |
static void * | interface_uart_timer_handle = NULL |
static bool | interface_uart_timer_timeout = false |
static bool | is_fifo_full = false |
ble_platform_api_list_t * | platform |
static void * | platform_timer_handle = NULL |
static uint8_t | resp_event_id = INVALID_EVENT_ID |
static fifo_t | rx_fifo |
static uint8_t | rx_fifo_buffer [1024] |
static sw_timer_t | sw_timers [INTERFACE_SW_TIMERS] = {0} |
bool ble_response_check | ( | uint8_t | byte | ) |
References BM_APPLICATION_ResponseCheck().
Referenced by interface_process_fifo_data().
event_t* get_received_cmd_frame | ( | void | ) |
References appEvent.
Referenced by ble_characteristic_value_read_by_uuid_parser(), ble_characteristic_value_read_parser(), ble_command_complete_parser(), ble_gatt_service_create_parser(), ble_gatt_service_read_parser(), ble_rssi_read_parser(), ble_status_report_parser(), dfu_response_read_parser(), dfu_response_report_parser(), dfu_status_handle_parser(), and dfu_status_report_parser().
void init_fifo | ( | void | ) |
References fifo_init(), and rx_fifo_buffer.
Referenced by interface_init().
ble_status_t interface_cmd_send_no_wait | ( | uint8_t * | cmd, |
uint32_t | cmd_len | ||
) |
References BLE_SUCCESS, and ble_platform_api_list_t::uart_tx_cb.
Referenced by ble_create_connection(), ble_disconnect_device(), and ble_primary_service_discover_all().
ble_status_t interface_cmd_send_wait | ( | uint8_t * | cmd, |
uint32_t | cmd_len, | ||
uint8_t | event_id | ||
) |
References BLE_SUCCESS, BLE_UART_TIMEOUT, INTERFACE_CMD_COMPLETE_TIMEOUT, interface_event_process(), interface_start_timer(), interface_stop_timer(), interface_uart_timer_handle, interface_uart_timer_timeout, resp_event_id, and ble_platform_api_list_t::uart_tx_cb.
Referenced by ble_adv_data_set(), ble_adv_param_set(), ble_adv_start(), ble_adv_stop(), ble_cancel_connection(), ble_characteristic_attribute_read_request(), ble_characteristic_attribute_read_response(), ble_characteristic_read(), ble_characteristic_read_by_uuid(), ble_characteristic_reliable_write_request_cancel(), ble_characteristic_reliable_write_request_execute(), ble_characteristic_reliable_write_request_prepare(), ble_characteristic_reliable_write_response_execute(), ble_characteristic_reliable_write_response_prepare(), ble_characteristic_value_read(), ble_characteristic_value_send(), ble_characteristic_value_update(), ble_characteristic_write_with_response(), ble_characteristic_write_without_respose(), ble_error_response_send(), ble_gatt_service_create(), ble_gatt_service_read(), ble_init(), ble_pair_device_delete(), ble_pair_device_erase_all(), ble_pair_mode_get(), ble_pair_mode_set(), ble_pair_passkey_clear(), ble_pair_passkey_confirm(), ble_pair_passkey_enter(), ble_pair_passkey_erase_digits(), ble_pair_passkey_reply(), ble_pair_request(), ble_primary_service_characteristics_discover(), ble_primary_service_characteristics_read(), ble_primary_service_read_all(), ble_read_response_send(), ble_rssi_read(), ble_scan_param_set(), ble_scan_resp_data_set(), ble_scan_start(), ble_set_connection_params(), ble_set_device_name(), ble_shutdown(), ble_transparent_uart_data_send(), ble_transparent_uart_enable(), ble_update_connection_parameters(), ble_write_response_send(), dfu_deinit(), dfu_init(), dfu_program_memory_erase(), dfu_program_memory_read(), dfu_program_memory_write(), and dfu_program_memory_write_continue().
ble_status_t interface_cmd_send_wait_time | ( | uint8_t * | cmd, |
uint32_t | cmd_len, | ||
uint8_t | event_id, | ||
uint16_t | timeout | ||
) |
|
static |
References INTERFACE_SW_TIMERS, NULL, sw_timer_t::timer_cb, sw_timer_t::timer_counter, and sw_timer_t::timer_usage.
Referenced by interface_init().
event_status_t interface_event_get | ( | void | ) |
References BLE_EVENT_Q_EMPTY, event_msg_t::data_len, event_fifo_write(), event_t::event_msg, INTERFACE_EVENT_READY, and interface_process_fifo_data().
Referenced by ble_event_get().
bool interface_event_process | ( | void | ) |
References event_msg_t::data_len, event_fifo_write(), event_t::event_id, event_t::event_msg, INTERFACE_EVENT_READY, interface_process_fifo_data(), interface_uart_timer_timeout, is_waiting_for_response(), and is_waiting_for_this_response().
Referenced by interface_cmd_send_wait(), interface_cmd_send_wait_time(), interface_event_wait(), and interface_event_wait_time().
|
static |
References interface_event_timer_timeout.
Referenced by interface_init().
ble_status_t interface_event_wait | ( | uint8_t | event_id | ) |
References BLE_SUCCESS, BLE_UART_TIMEOUT, INTERFACE_CMD_COMPLETE_TIMEOUT, interface_event_process(), interface_start_timer(), interface_stop_timer(), interface_uart_timer_handle, interface_uart_timer_timeout, and resp_event_id.
Referenced by dfu_init(), dfu_program_memory_erase(), dfu_program_memory_read(), dfu_program_memory_write(), and dfu_program_memory_write_continue().
ble_status_t interface_event_wait_time | ( | uint8_t | event_id, |
uint16_t | timeout | ||
) |
References BLE_SUCCESS, BLE_UART_TIMEOUT, interface_event_process(), interface_start_timer(), interface_stop_timer(), interface_uart_timer_handle, interface_uart_timer_timeout, and resp_event_id.
Referenced by ble_init().
ble_status_t interface_init | ( | platform_init_t * | platform_init | ) |
References BLE_FAILURE, BLE_INVALID_COMMAND_PARAMETERS, BLE_SUCCESS, ble_platform_api_list_t::create_timer, ble_platform_api_list_t::delete_timer, event_fifo_init(), platform_init_t::event_mem, event_mem_t::event_mem_pool, event_mem_t::event_mem_pool_size, event_mem_t::event_payload_mem, event_mem_t::event_payload_mem_size, ble_platform_api_list_t::gpio_set, init_fifo(), interface_create_timer(), interface_event_timer_cb(), interface_event_timer_handle, interface_timer_callback(), interface_uart_timer_cb(), interface_uart_timer_handle, mem_init(), ble_platform_api_list_t::mode_set, NULL, platform_init_t::platform_api_list, platform_timer_handle, ble_platform_api_list_t::sleep_timer_ms, ble_platform_api_list_t::start_timer, ble_platform_api_list_t::stop_timer, store_uart_data(), ble_platform_api_list_t::uart_rx_cb, and ble_platform_api_list_t::uart_tx_cb.
Referenced by ble_init(), and dfu_init().
uint8_t interface_process_fifo_data | ( | void | ) |
References ble_response_check(), BM_MODE_APPLICATION, BM_MODE_PROGRAM, dfu_response_check(), fifo_empty(), fifo_get(), INTERFACE_EVENT_READY, INTERFACE_EVENT_WAITING, is_fifo_full, ble_platform_api_list_t::mode_get, result, store_uart_data(), and ble_platform_api_list_t::uart_rx_cb.
Referenced by interface_event_get(), and interface_event_process().
|
static |
|
static |
|
static |
|
static |
References interface_uart_timer_timeout.
Referenced by interface_init().
bool is_waiting_for_response | ( | void | ) |
References INVALID_EVENT_ID, and resp_event_id.
Referenced by interface_event_process().
bool is_waiting_for_this_response | ( | uint8_t | event_id | ) |
References INVALID_EVENT_ID, and resp_event_id.
Referenced by interface_event_process().
void store_uart_data | ( | uint16_t | rx_data | ) |
References data, fifo_full(), fifo_put(), is_fifo_full, store_uart_data(), and ble_platform_api_list_t::uart_rx_cb.
Referenced by interface_init(), interface_process_fifo_data(), and store_uart_data().
event_t appEvent |
uart_read_async_cb_t ble_uart_receive_async |
uart_write_sync_cb_t ble_uart_send_sync |
|
static |
Referenced by interface_start_timer(), interface_stop_timer(), and interface_timer_callback().
|
static |
Referenced by interface_init().
Referenced by interface_event_timer_cb().
|
static |
Referenced by interface_process_fifo_data(), and store_uart_data().
ble_platform_api_list_t* platform |
|
static |
Referenced by interface_init(), interface_start_timer(), interface_stop_timer(), and interface_timer_callback().
|
static |
|
static |
|
static |
Referenced by init_fifo().
|
static |