mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-29 13:20:39 +00:00
move run loop embedded specific functionality to run_loop_embedded.h
This commit is contained in:
parent
c6832aeae2
commit
8a5131287b
@ -50,6 +50,7 @@
|
||||
#include "hci.h"
|
||||
#include "hci_transport.h"
|
||||
#include "run_loop.h"
|
||||
#include "run_loop_embedded.h"
|
||||
|
||||
#include "hal_uart_dma.h"
|
||||
|
||||
|
@ -55,6 +55,7 @@
|
||||
#include "hci.h"
|
||||
#include "hci_transport.h"
|
||||
#include "run_loop.h"
|
||||
#include "run_loop_embedded.h"
|
||||
|
||||
#include "hal_uart_dma.h"
|
||||
|
||||
|
@ -54,6 +54,7 @@
|
||||
|
||||
|
||||
#include "run_loop.h"
|
||||
#include "run_loop_embedded.h"
|
||||
#include "bk_linked_list.h"
|
||||
#include "hal_tick.h"
|
||||
#include "hal_cpu.h"
|
||||
|
88
platform/embedded/run_loop_embedded.h
Normal file
88
platform/embedded/run_loop_embedded.h
Normal file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (C) 2014 BlueKitchen GmbH
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holders nor the names of
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* 4. Any redistribution, use, or modification is done solely for
|
||||
* personal benefit and not for any commercial purpose or for
|
||||
* monetary gain.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
|
||||
* RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* Please inquire about commercial licensing options at
|
||||
* contact@bluekitchen-gmbh.com
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* run_loop_embedded.h
|
||||
* Functionality special to the embedded run loop
|
||||
*/
|
||||
|
||||
#ifndef __RUN_LOOP_EMBEDDED_H
|
||||
#define __RUN_LOOP_EMBEDDED_H
|
||||
|
||||
#include "btstack-config.h"
|
||||
#include "bk_linked_list.h"
|
||||
|
||||
#ifdef HAVE_TIME
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
// hack to fix HCI timer handling
|
||||
#ifdef HAVE_TICK
|
||||
/**
|
||||
* @brief Sets how many milliseconds has one tick.
|
||||
*/
|
||||
uint32_t run_loop_embedded_ticks_for_ms(uint32_t time_in_ms);
|
||||
/**
|
||||
* @brief Queries the current time in ticks.
|
||||
*/
|
||||
uint32_t run_loop_embedded_get_ticks(void);
|
||||
#endif
|
||||
|
||||
#ifdef EMBEDDED
|
||||
/**
|
||||
* @brief Sets an internal flag that is checked in the critical section just before entering sleep mode. Has to be called by the interrupt handler of a data source to signal the run loop that a new data is available.
|
||||
*/
|
||||
void run_loop_embedded_trigger(void);
|
||||
/**
|
||||
* @brief Execute run_loop once. It can be used to integrate BTstack's timer and data source processing into a foreign run loop (it is not recommended).
|
||||
*/
|
||||
void run_loop_embedded_execute_once(void);
|
||||
#endif
|
||||
|
||||
/* API_END */
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __RUN_LOOP_EMBEDDED_H
|
@ -21,6 +21,7 @@
|
||||
#include "hci_cmds.h"
|
||||
#include "utils.h"
|
||||
#include "run_loop.h"
|
||||
#include "run_loop_embedded.h"
|
||||
#include "classic/sdp_util.h"
|
||||
|
||||
#include "bt_control_em9301.h"
|
||||
@ -40,7 +41,6 @@
|
||||
#define PIN_LED 13
|
||||
|
||||
// prototypes
|
||||
extern "C" void run_loop_embedded_execute_once(void);
|
||||
extern "C" void hal_uart_dma_process(void);
|
||||
|
||||
enum {
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include "system_config.h"
|
||||
#include "bt_control_csr.h"
|
||||
#include "run_loop.h"
|
||||
#include "run_loop_embedded.h"
|
||||
#include "hci_dump.h"
|
||||
#include "hci.h"
|
||||
#include "hci_transport.h"
|
||||
@ -19,7 +20,6 @@
|
||||
#include "peripheral/usart/plib_usart.h"
|
||||
#include "system/ports/sys_ports.h"
|
||||
|
||||
|
||||
//
|
||||
int btstack_main(int argc, const char * argv[]);
|
||||
|
||||
|
@ -127,28 +127,6 @@ int run_loop_remove_data_source(data_source_t *dataSource);
|
||||
*/
|
||||
void run_loop_execute(void);
|
||||
|
||||
// hack to fix HCI timer handling
|
||||
#ifdef HAVE_TICK
|
||||
/**
|
||||
* @brief Sets how many milliseconds has one tick.
|
||||
*/
|
||||
uint32_t run_loop_embedded_ticks_for_ms(uint32_t time_in_ms);
|
||||
/**
|
||||
* @brief Queries the current time in ticks.
|
||||
*/
|
||||
uint32_t run_loop_embedded_get_ticks(void);
|
||||
#endif
|
||||
#ifdef EMBEDDED
|
||||
/**
|
||||
* @brief Sets an internal flag that is checked in the critical section just before entering sleep mode. Has to be called by the interrupt handler of a data source to signal the run loop that a new data is available.
|
||||
*/
|
||||
void run_loop_embedded_trigger(void);
|
||||
/**
|
||||
* @brief Execute run_loop once. It can be used to integrate BTstack's timer and data source processing into a foreign run loop (it is not recommended).
|
||||
*/
|
||||
void run_loop_embedded_execute_once(void);
|
||||
#endif
|
||||
|
||||
/* API_END */
|
||||
|
||||
#if defined __cplusplus
|
||||
|
Loading…
x
Reference in New Issue
Block a user