mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-04 06:39:53 +00:00
removed older uCos port
This commit is contained in:
parent
442b628805
commit
72b19bf647
@ -1,261 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 by Matthias Ringwald
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY MATTHIAS RINGWALD 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* btstack_memory_ucos.c
|
||||
*
|
||||
* @brief BTstack memory management via configurable memory pools
|
||||
*
|
||||
* Created by Albis Technologies.
|
||||
*/
|
||||
|
||||
#include <btstack/port_ucos.h>
|
||||
|
||||
#include "../config.h"
|
||||
#include "btstack_memory.h"
|
||||
|
||||
#include "hci.h"
|
||||
#include "l2cap.h"
|
||||
#include "rfcomm.h"
|
||||
|
||||
DEFINE_THIS_FILE
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
static MEM_POOL hci_connection_pool;
|
||||
hci_connection_t * btstack_memory_hci_connection_get(void)
|
||||
{
|
||||
LIB_ERR err;
|
||||
return Mem_PoolBlkGet(&hci_connection_pool,
|
||||
sizeof(hci_connection_t),
|
||||
&err);
|
||||
}
|
||||
void btstack_memory_hci_connection_free(hci_connection_t *hci_connection)
|
||||
{
|
||||
LIB_ERR err;
|
||||
Mem_PoolBlkFree(&hci_connection_pool, hci_connection, &err);
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
static MEM_POOL l2cap_service_pool;
|
||||
l2cap_service_t * btstack_memory_l2cap_service_get(void)
|
||||
{
|
||||
LIB_ERR err;
|
||||
return Mem_PoolBlkGet(&l2cap_service_pool,
|
||||
sizeof(l2cap_service_t),
|
||||
&err);
|
||||
}
|
||||
void btstack_memory_l2cap_service_free(l2cap_service_t *l2cap_service)
|
||||
{
|
||||
LIB_ERR err;
|
||||
Mem_PoolBlkFree(&l2cap_service_pool, l2cap_service, &err);
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
static MEM_POOL l2cap_channel_pool;
|
||||
l2cap_channel_t * btstack_memory_l2cap_channel_get(void)
|
||||
{
|
||||
LIB_ERR err;
|
||||
return Mem_PoolBlkGet(&l2cap_channel_pool,
|
||||
sizeof(l2cap_channel_t),
|
||||
&err);
|
||||
}
|
||||
void btstack_memory_l2cap_channel_free(l2cap_channel_t *l2cap_channel)
|
||||
{
|
||||
LIB_ERR err;
|
||||
Mem_PoolBlkFree(&l2cap_channel_pool, l2cap_channel, &err);
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
static MEM_POOL rfcomm_multiplexer_pool;
|
||||
rfcomm_multiplexer_t * btstack_memory_rfcomm_multiplexer_get(void)
|
||||
{
|
||||
LIB_ERR err;
|
||||
return Mem_PoolBlkGet(&rfcomm_multiplexer_pool,
|
||||
sizeof(rfcomm_multiplexer_t),
|
||||
&err);
|
||||
}
|
||||
void btstack_memory_rfcomm_multiplexer_free(rfcomm_multiplexer_t *rfcomm_multiplexer)
|
||||
{
|
||||
LIB_ERR err;
|
||||
Mem_PoolBlkFree(&rfcomm_multiplexer_pool, rfcomm_multiplexer, &err);
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
static MEM_POOL rfcomm_service_pool;
|
||||
rfcomm_service_t * btstack_memory_rfcomm_service_get(void)
|
||||
{
|
||||
LIB_ERR err;
|
||||
return Mem_PoolBlkGet(&rfcomm_service_pool,
|
||||
sizeof(rfcomm_service_t),
|
||||
&err);
|
||||
}
|
||||
void btstack_memory_rfcomm_service_free(rfcomm_service_t *rfcomm_service)
|
||||
{
|
||||
LIB_ERR err;
|
||||
Mem_PoolBlkFree(&rfcomm_service_pool, rfcomm_service, &err);
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
static MEM_POOL rfcomm_channel_pool;
|
||||
rfcomm_channel_t * btstack_memory_rfcomm_channel_get(void)
|
||||
{
|
||||
LIB_ERR err;
|
||||
return Mem_PoolBlkGet(&rfcomm_channel_pool,
|
||||
sizeof(rfcomm_channel_t),
|
||||
&err);
|
||||
}
|
||||
void btstack_memory_rfcomm_channel_free(rfcomm_channel_t *rfcomm_channel)
|
||||
{
|
||||
LIB_ERR err;
|
||||
Mem_PoolBlkFree(&rfcomm_channel_pool, rfcomm_channel, &err);
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
static MEM_POOL db_mem_device_pool;
|
||||
db_mem_device_t * btstack_memory_db_mem_device_get(void){
|
||||
LIB_ERR err;
|
||||
return Mem_PoolBlkGet(&db_mem_device_pool,
|
||||
sizeof(db_mem_device_t),
|
||||
&err);
|
||||
}
|
||||
void btstack_memory_db_mem_device_free(db_mem_device_t *db_mem_device){
|
||||
LIB_ERR err;
|
||||
Mem_PoolBlkFree(&db_mem_device_pool, db_mem_device, &err);
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
static MEM_POOL db_mem_service_pool;
|
||||
db_mem_service_t * btstack_memory_db_mem_service_get(void){
|
||||
LIB_ERR err;
|
||||
return Mem_PoolBlkGet(&db_mem_service_pool,
|
||||
sizeof(db_mem_service_t),
|
||||
&err);
|
||||
}
|
||||
void btstack_memory_db_mem_service_free(db_mem_service_t *db_mem_service){
|
||||
LIB_ERR err;
|
||||
Mem_PoolBlkFree(&db_mem_service_pool, db_mem_service, &err);
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void btstack_memory_init(void)
|
||||
{
|
||||
LIB_ERR err;
|
||||
CPU_SIZE_T octetsReqd;
|
||||
|
||||
Mem_PoolCreate(&hci_connection_pool,
|
||||
0,
|
||||
MAX_NO_HCI_CONNECTIONS * sizeof(hci_connection_t),
|
||||
MAX_NO_HCI_CONNECTIONS,
|
||||
sizeof(hci_connection_t),
|
||||
sizeof(unsigned long),
|
||||
&octetsReqd,
|
||||
&err);
|
||||
SYS_ASSERT(err == LIB_MEM_ERR_NONE);
|
||||
|
||||
Mem_PoolCreate(&l2cap_service_pool,
|
||||
0,
|
||||
MAX_NO_L2CAP_SERVICES * sizeof(l2cap_service_t),
|
||||
MAX_NO_L2CAP_SERVICES,
|
||||
sizeof(l2cap_service_t),
|
||||
sizeof(unsigned long),
|
||||
&octetsReqd,
|
||||
&err);
|
||||
SYS_ASSERT(err == LIB_MEM_ERR_NONE);
|
||||
|
||||
Mem_PoolCreate(&l2cap_channel_pool,
|
||||
0,
|
||||
MAX_NO_L2CAP_CHANNELS * sizeof(l2cap_channel_t),
|
||||
MAX_NO_L2CAP_CHANNELS,
|
||||
sizeof(l2cap_channel_t),
|
||||
sizeof(unsigned long),
|
||||
&octetsReqd,
|
||||
&err);
|
||||
SYS_ASSERT(err == LIB_MEM_ERR_NONE);
|
||||
|
||||
Mem_PoolCreate(&rfcomm_multiplexer_pool,
|
||||
0,
|
||||
MAX_NO_RFCOMM_MULTIPLEXERS * sizeof(rfcomm_multiplexer_t),
|
||||
MAX_NO_RFCOMM_MULTIPLEXERS,
|
||||
sizeof(rfcomm_multiplexer_t),
|
||||
sizeof(unsigned long),
|
||||
&octetsReqd,
|
||||
&err);
|
||||
SYS_ASSERT(err == LIB_MEM_ERR_NONE);
|
||||
|
||||
Mem_PoolCreate(&rfcomm_service_pool,
|
||||
0,
|
||||
MAX_NO_RFCOMM_SERVICES * sizeof(rfcomm_service_t),
|
||||
MAX_NO_RFCOMM_SERVICES,
|
||||
sizeof(rfcomm_service_t),
|
||||
sizeof(unsigned long),
|
||||
&octetsReqd,
|
||||
&err);
|
||||
SYS_ASSERT(err == LIB_MEM_ERR_NONE);
|
||||
|
||||
Mem_PoolCreate(&rfcomm_channel_pool,
|
||||
0,
|
||||
MAX_NO_RFCOMM_CHANNELS * sizeof(rfcomm_channel_t),
|
||||
MAX_NO_RFCOMM_CHANNELS,
|
||||
sizeof(rfcomm_channel_t),
|
||||
sizeof(unsigned long),
|
||||
&octetsReqd,
|
||||
&err);
|
||||
SYS_ASSERT(err == LIB_MEM_ERR_NONE);
|
||||
|
||||
Mem_PoolCreate(&db_mem_device_pool,
|
||||
0,
|
||||
MAX_NO_DB_MEM_DEVICES * sizeof(db_mem_device_t),
|
||||
MAX_NO_DB_MEM_DEVICES,
|
||||
sizeof(db_mem_device_t),
|
||||
sizeof(unsigned long),
|
||||
&octetsReqd,
|
||||
&err);
|
||||
SYS_ASSERT(err == LIB_MEM_ERR_NONE);
|
||||
|
||||
Mem_PoolCreate(&db_mem_service_pool,
|
||||
0,
|
||||
MAX_NO_DB_MEM_SERVICES * sizeof(db_mem_service_t),
|
||||
MAX_NO_DB_MEM_SERVICES,
|
||||
sizeof(db_mem_service_t),
|
||||
sizeof(unsigned long),
|
||||
&octetsReqd,
|
||||
&err);
|
||||
SYS_ASSERT(err == LIB_MEM_ERR_NONE);
|
||||
}
|
@ -1,317 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 by Matthias Ringwald
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY MATTHIAS RINGWALD 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* hci_transport_h4_ucos.c
|
||||
*
|
||||
* @brief BTstack serial H4 transport for uC/OS
|
||||
*
|
||||
* Created by Albis Technologies.
|
||||
*/
|
||||
|
||||
#include <btstack/port_ucos.h>
|
||||
|
||||
#include "hci.h"
|
||||
#include "hci_transport.h"
|
||||
#include "hci_dump.h"
|
||||
#include "run_loop_ucos.h"
|
||||
|
||||
#include "bsp_btuart.h"
|
||||
|
||||
DEFINE_THIS_FILE
|
||||
|
||||
typedef enum
|
||||
{
|
||||
H4_W4_PACKET_TYPE,
|
||||
H4_W4_EVENT_HEADER,
|
||||
H4_W4_ACL_HEADER,
|
||||
H4_W4_PAYLOAD,
|
||||
H4_W4_PICKUP
|
||||
} H4RxState;
|
||||
|
||||
static int h4_reader_process(struct data_source *ds);
|
||||
static void h4_rx_data(unsigned char *data, unsigned long size);
|
||||
static void dummyHandler(uint8_t packetType, uint8_t *packet, uint16_t size);
|
||||
static void (*incomingPacketHandler)(uint8_t a,
|
||||
uint8_t *b,
|
||||
uint16_t c) = dummyHandler;
|
||||
static struct
|
||||
{
|
||||
data_source_t dataSource;
|
||||
hci_transport_t transport;
|
||||
} hciTransportH4;
|
||||
|
||||
/*=============================================================================
|
||||
* H4 receiver.
|
||||
*============================================================================*/
|
||||
#define NOF_RX_BUFFERS 20
|
||||
#define RX_BUFFER_SIZE 1020
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char data[RX_BUFFER_SIZE];
|
||||
unsigned long nofBytes;
|
||||
} ReceiveBuffer;
|
||||
|
||||
static struct
|
||||
{
|
||||
/* H4 Rx state and remaining number of Bytes in this state. */
|
||||
H4RxState state;
|
||||
unsigned long remainingInState;
|
||||
|
||||
/* H4 packet ring buffer and current buffer in use for Rx data. */
|
||||
ReceiveBuffer buffers[NOF_RX_BUFFERS];
|
||||
ReceiveBuffer *currBuffer;
|
||||
volatile unsigned long enqueueIdx;
|
||||
volatile unsigned long dequeueIdx;
|
||||
volatile unsigned long nextEnqueueIdx;
|
||||
}rx;
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
static void advanceToNextBuffer(void)
|
||||
{
|
||||
rx.nextEnqueueIdx = rx.enqueueIdx + 1;
|
||||
if(rx.nextEnqueueIdx >= NOF_RX_BUFFERS)
|
||||
{
|
||||
rx.nextEnqueueIdx = 0;
|
||||
}
|
||||
if(rx.nextEnqueueIdx == rx.dequeueIdx)
|
||||
{
|
||||
/* The ring buffer is full. */
|
||||
SYS_ERROR(1);
|
||||
}
|
||||
|
||||
/* Prepare current buffer for receiving. */
|
||||
rx.currBuffer = &rx.buffers[rx.enqueueIdx];
|
||||
rx.currBuffer->nofBytes = 0;
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
static int h4_open(void *config)
|
||||
{
|
||||
/* Initialise H4 receiver. */
|
||||
rx.enqueueIdx = 0;
|
||||
rx.dequeueIdx = 0;
|
||||
advanceToNextBuffer();
|
||||
|
||||
BSP_BTUART_EnableRxCallback(h4_rx_data);
|
||||
|
||||
/* Prepare for 1st H4 packet type ID. */
|
||||
rx.state = H4_W4_PACKET_TYPE;
|
||||
rx.remainingInState = 1;
|
||||
BSP_BTUART_AnounceDmaReceiverSize(rx.remainingInState);
|
||||
|
||||
hciTransportH4.dataSource.process = h4_reader_process;
|
||||
run_loop_add_data_source(&hciTransportH4.dataSource);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
static int h4_close(void *config)
|
||||
{
|
||||
BSP_BTUART_DisableRxCallback();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
static int h4_send_packet(uint8_t packetType, uint8_t *packet, int size)
|
||||
{
|
||||
hci_dump_packet(packetType, 0, packet, size);
|
||||
|
||||
BSP_BTUART_Transmit(&packetType, 1);
|
||||
BSP_BTUART_Transmit(packet, size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
static void h4_register_packet_handler(void (*handler)(uint8_t a,
|
||||
uint8_t *b,
|
||||
uint16_t c))
|
||||
{
|
||||
incomingPacketHandler = handler;
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
static void h4_rx_fsm(void)
|
||||
{
|
||||
switch(rx.state)
|
||||
{
|
||||
case H4_W4_PACKET_TYPE:
|
||||
if(rx.currBuffer->data[0] == HCI_EVENT_PACKET)
|
||||
{
|
||||
rx.remainingInState = HCI_EVENT_PKT_HDR;
|
||||
rx.state = H4_W4_EVENT_HEADER;
|
||||
}
|
||||
else if(rx.currBuffer->data[0] == HCI_ACL_DATA_PACKET)
|
||||
{
|
||||
rx.remainingInState = HCI_ACL_DATA_PKT_HDR;
|
||||
rx.state = H4_W4_ACL_HEADER;
|
||||
}
|
||||
else
|
||||
{
|
||||
rx.currBuffer->nofBytes = 0;
|
||||
rx.remainingInState = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case H4_W4_EVENT_HEADER:
|
||||
rx.remainingInState = rx.currBuffer->data[2];
|
||||
rx.state = H4_W4_PAYLOAD;
|
||||
break;
|
||||
|
||||
case H4_W4_ACL_HEADER:
|
||||
rx.remainingInState = READ_BT_16(rx.currBuffer->data, 3);
|
||||
rx.state = H4_W4_PAYLOAD;
|
||||
break;
|
||||
|
||||
case H4_W4_PAYLOAD:
|
||||
rx.state = H4_W4_PICKUP;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if(rx.remainingInState)
|
||||
{
|
||||
BSP_BTUART_AnounceDmaReceiverSize(rx.remainingInState);
|
||||
}
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
static int h4_reader_process(struct data_source *ds)
|
||||
{
|
||||
unsigned long pickUpSize;
|
||||
unsigned char *pickUpBuffer;
|
||||
unsigned long nextDequeueIdx;
|
||||
|
||||
pickUpSize = rx.buffers[rx.dequeueIdx].nofBytes - 1;
|
||||
pickUpBuffer = rx.buffers[rx.dequeueIdx].data;
|
||||
|
||||
/* Handle complete incoming HCI packet. */
|
||||
SYS_ASSERT(pickUpSize >= 2);
|
||||
|
||||
hci_dump_packet(*pickUpBuffer, 1, pickUpBuffer + 1, pickUpSize);
|
||||
incomingPacketHandler(*pickUpBuffer, pickUpBuffer + 1, pickUpSize);
|
||||
|
||||
nextDequeueIdx = rx.dequeueIdx + 1;
|
||||
if(nextDequeueIdx >= NOF_RX_BUFFERS)
|
||||
{
|
||||
nextDequeueIdx = 0;
|
||||
}
|
||||
rx.dequeueIdx = nextDequeueIdx;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
static void h4_rx_data(unsigned char *data, unsigned long size)
|
||||
{
|
||||
unsigned long i;
|
||||
|
||||
SYS_ASSERT(size + rx.currBuffer->nofBytes <= RX_BUFFER_SIZE);
|
||||
SYS_ASSERT(size <= rx.remainingInState);
|
||||
|
||||
/* Copy from DMA buffer to Rx buffer (no memcpy() or Mem_Copy()). */
|
||||
for(i = 0; i < size; ++i)
|
||||
{
|
||||
rx.currBuffer->data[rx.currBuffer->nofBytes + i] = data[i];
|
||||
}
|
||||
|
||||
rx.currBuffer->nofBytes += size;
|
||||
rx.remainingInState -= size;
|
||||
|
||||
if(rx.remainingInState == 0)
|
||||
{
|
||||
h4_rx_fsm();
|
||||
|
||||
if(rx.state == H4_W4_PICKUP)
|
||||
{
|
||||
/* Advance to next Rx buffer. */
|
||||
rx.enqueueIdx = rx.nextEnqueueIdx;
|
||||
advanceToNextBuffer();
|
||||
|
||||
/* Prepare for next H4 packet type ID. */
|
||||
rx.state = H4_W4_PACKET_TYPE;
|
||||
rx.remainingInState = 1;
|
||||
BSP_BTUART_AnounceDmaReceiverSize(rx.remainingInState);
|
||||
|
||||
/* Notify complete Rx packet. */
|
||||
run_loop_notify_incoming_transport_packet();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
static int h4_set_baudrate(uint32_t baudrate)
|
||||
{
|
||||
BSP_BTUART_SetBaudrate(baudrate);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
const char * h4_transport_name(void)
|
||||
{
|
||||
return "H4";
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
static void dummyHandler(uint8_t packetType, uint8_t *packet, uint16_t size)
|
||||
{
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
* H4 transport instance.
|
||||
*============================================================================*/
|
||||
hci_transport_t * hci_transport_h4_instance(void)
|
||||
{
|
||||
hciTransportH4.transport.open = h4_open;
|
||||
hciTransportH4.transport.close = h4_close;
|
||||
hciTransportH4.transport.send_packet = h4_send_packet;
|
||||
hciTransportH4.transport.register_packet_handler = h4_register_packet_handler;
|
||||
hciTransportH4.transport.get_transport_name = h4_transport_name;
|
||||
hciTransportH4.transport.set_baudrate = h4_set_baudrate;
|
||||
|
||||
return &hciTransportH4.transport;
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2009 by Matthias Ringwald
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY MATTHIAS RINGWALD 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* port_ucos.c
|
||||
*
|
||||
* uC/OS porting layer.
|
||||
*
|
||||
* Created by Albis Technologies.
|
||||
*/
|
||||
|
||||
#include <btstack/port_ucos.h>
|
||||
|
||||
#include "../config.h"
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
int gettimeofday(struct timeval *tv, void *tzp)
|
||||
{
|
||||
INT32U ticks = OSTimeGet();
|
||||
|
||||
tv->tv_sec = ticks / OS_TICKS_PER_SEC;
|
||||
tv->tv_usec = (ticks - (tv->tv_sec * OS_TICKS_PER_SEC)) *
|
||||
(1000000UL / OS_TICKS_PER_SEC);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
uint32_t embedded_get_ticks(void)
|
||||
{
|
||||
return OSTimeGet();
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
uint32_t embedded_ticks_for_ms(uint32_t time_in_ms)
|
||||
{
|
||||
return MSEC_TO_TICKS(time_in_ms);
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
int gethostname(char *name, size_t len)
|
||||
{
|
||||
Str_Copy_N((CPU_CHAR *)name, (CPU_CHAR *)BT_DEV_NAME, len - 1);
|
||||
return 0;
|
||||
}
|
@ -1,105 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2009 by Matthias Ringwald
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY MATTHIAS RINGWALD 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* port_ucos.h
|
||||
*
|
||||
* uC/OS porting layer.
|
||||
*
|
||||
* Created by Albis Technologies.
|
||||
*/
|
||||
|
||||
#ifndef PORT_UCOS_H
|
||||
#define PORT_UCOS_H
|
||||
|
||||
/* uC/OS-II include files. */
|
||||
#include <ucos_ii.h>
|
||||
#include <lib_mem.h>
|
||||
#include <lib_str.h>
|
||||
|
||||
/* These standard includes are allowed. */
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/* OS version depending macros. */
|
||||
#define USE_OS_NO_ERROR OS_NO_ERR
|
||||
#define USE_OS_TIMEOUT OS_TIMEOUT
|
||||
|
||||
/* Convert msec to OS ticks. */
|
||||
#define MSEC_TO_TICKS(ms) \
|
||||
((ms > 0u) ? (((ms * OS_TICKS_PER_SEC) + 1000u - 1u) / 1000u) : 0u)
|
||||
|
||||
/* Map stdlib functions to uC/LIB ones. */
|
||||
#define memcpy(a, b, c) (Mem_Copy((void *)(a), (void *)(b), c))
|
||||
#define memset(a, b, c) (Mem_Set((void *)(a), b, c))
|
||||
#define bzero(a, c) (Mem_Set((void *)(a), 0, c))
|
||||
#define memcmp(a, b, c) (!Mem_Cmp((void *)(a), (void *)(b), c))
|
||||
#define strncpy(a, b, c) (Str_Copy_N((CPU_CHAR *)(a), (CPU_CHAR *)b, c))
|
||||
#define strncmp(a, b, c) (Str_Cmp_N((CPU_CHAR *)(a), (CPU_CHAR *)b, c))
|
||||
#define strlen(a) (Str_Len((CPU_CHAR *)(a)))
|
||||
|
||||
extern void * memmove(void *dst, const void *src, unsigned int length);
|
||||
|
||||
/* There are no such uC-LIB implementations. */
|
||||
#define sprintf(a, b, ...) __error__
|
||||
#define sscanf(a, ...) __error__
|
||||
|
||||
/* Time function. */
|
||||
struct timeval
|
||||
{
|
||||
unsigned long tv_sec;
|
||||
unsigned long tv_usec;
|
||||
};
|
||||
int gettimeofday(struct timeval *tv, void *tzp);
|
||||
|
||||
/* Host name. */
|
||||
int gethostname(char *name, size_t len);
|
||||
|
||||
/* Debug output. */
|
||||
#include "bsp_debug.h"
|
||||
|
||||
#define ENABLE_BTSTACK_DEBUG_OUTPUT 0
|
||||
|
||||
#if(ENABLE_BTSTACK_DEBUG_OUTPUT == 1)
|
||||
#define printf(...) { printos(__VA_ARGS__); }
|
||||
#define fprintf(_fd, ...) { printos(__VA_ARGS__); }
|
||||
#define log_debug(...) { printos(__VA_ARGS__); }
|
||||
#define log_info(...) { printos(__VA_ARGS__); }
|
||||
#define log_error(...) { printos(__VA_ARGS__); }
|
||||
#else
|
||||
#define printf(...)
|
||||
#define fprintf(_fd, ...)
|
||||
#define log_debug(...)
|
||||
#define log_info(...)
|
||||
#define log_error(...)
|
||||
#endif /* ENABLE_BTSTACK_DEBUG_OUTPUT */
|
||||
|
||||
#endif /* PORT_UCOS_H */
|
@ -1,172 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 by Matthias Ringwald
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY MATTHIAS RINGWALD 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* run_loop_ucos.c
|
||||
*
|
||||
* @brief BTstack run loop for uC/OS
|
||||
*
|
||||
* Created by Albis Technologies.
|
||||
*/
|
||||
|
||||
#include <btstack/port_ucos.h>
|
||||
#include <btstack/run_loop.h>
|
||||
|
||||
#include "run_loop_ucos.h"
|
||||
#include "hci_transport.h"
|
||||
#include "serial.h"
|
||||
|
||||
DEFINE_THIS_FILE
|
||||
|
||||
static linked_list_t timers;
|
||||
static data_source_t *transportDataSource = 0;
|
||||
|
||||
/*=============================================================================
|
||||
* Run loop message queue.
|
||||
*============================================================================*/
|
||||
#define MSG_QUEUE_BUFFER_SIZE 32
|
||||
|
||||
#define MSG_ID_INCOMING_TRANSPORT_PACKET 1
|
||||
#define MSG_ID_OUTGOING_RFCOMM_DATA 2
|
||||
|
||||
static struct
|
||||
{
|
||||
OS_EVENT *queue;
|
||||
void * queueBuffer[MSG_QUEUE_BUFFER_SIZE];
|
||||
} messages;
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void run_loop_notify_incoming_transport_packet(void)
|
||||
{
|
||||
INT8U err;
|
||||
|
||||
err = OSQPost(messages.queue, (void *)MSG_ID_INCOMING_TRANSPORT_PACKET);
|
||||
SYS_ASSERT(err == USE_OS_NO_ERROR);
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void run_loop_notify_outgoing_rfcomm_data(void)
|
||||
{
|
||||
INT8U err;
|
||||
|
||||
err = OSQPost(messages.queue, (void *)MSG_ID_OUTGOING_RFCOMM_DATA);
|
||||
SYS_ASSERT(err == USE_OS_NO_ERROR);
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void run_loop_add_data_source(data_source_t *ds)
|
||||
{
|
||||
transportDataSource = ds;
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void run_loop_add_timer(timer_source_t *ts)
|
||||
{
|
||||
linked_item_t *it;
|
||||
|
||||
for(it = (linked_item_t *)&timers; it->next; it = it->next)
|
||||
{
|
||||
if(ts->timeout < ((timer_source_t *)it->next)->timeout)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ts->item.next = it->next;
|
||||
it->next = (linked_item_t *)ts;
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void run_loop_set_timer(timer_source_t *ts, uint32_t timeout_in_ms)
|
||||
{
|
||||
unsigned long ticks = MSEC_TO_TICKS(timeout_in_ms);
|
||||
ts->timeout = OSTimeGet() + ticks;
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
int run_loop_remove_timer(timer_source_t *ts)
|
||||
{
|
||||
return linked_list_remove(&timers, (linked_item_t *) ts);
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void run_loop_execute(void)
|
||||
{
|
||||
INT8U err;
|
||||
void *event;
|
||||
INT16U timeout;
|
||||
|
||||
for(;;)
|
||||
{
|
||||
/* Get next timeout. */
|
||||
timeout = 0;
|
||||
if(timers)
|
||||
{
|
||||
timeout = ((timer_source_t *)timers)->timeout - OSTimeGet();
|
||||
}
|
||||
|
||||
event = OSQPend(messages.queue, timeout, &err);
|
||||
|
||||
if(err == USE_OS_NO_ERROR)
|
||||
{
|
||||
if((unsigned long)event == MSG_ID_INCOMING_TRANSPORT_PACKET)
|
||||
{
|
||||
transportDataSource->process(transportDataSource);
|
||||
}
|
||||
}
|
||||
|
||||
/* Process timers. */
|
||||
while(timers)
|
||||
{
|
||||
timer_source_t *ts = (timer_source_t *)timers;
|
||||
if(ts->timeout > OSTimeGet()) break;
|
||||
run_loop_remove_timer(ts);
|
||||
ts->process(ts);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void run_loop_init(RUN_LOOP_TYPE type)
|
||||
{
|
||||
timers = 0;
|
||||
|
||||
messages.queue = OSQCreate(messages.queueBuffer, MSG_QUEUE_BUFFER_SIZE);
|
||||
SYS_ASSERT(messages.queue);
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2011 by Matthias Ringwald
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY MATTHIAS RINGWALD 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* run_loop_ucos.h
|
||||
*
|
||||
* @brief BTstack run loop for uC/OS
|
||||
*
|
||||
* Created by Albis Technologies.
|
||||
*/
|
||||
|
||||
#ifndef __RUN_LOOP_UCOS_H
|
||||
#define __RUN_LOOP_UCOS_H
|
||||
|
||||
void run_loop_notify_incoming_transport_packet(void);
|
||||
|
||||
#endif // __RUN_LOOP_UCOS_H
|
@ -1,199 +0,0 @@
|
||||
#==============================================================================
|
||||
# (C) Copyright Albis Technologies Ltd 2011
|
||||
#==============================================================================
|
||||
# STM32 Example Code
|
||||
#==============================================================================
|
||||
# File name: Makefile
|
||||
#
|
||||
# Notes: -
|
||||
#==============================================================================
|
||||
|
||||
firsttarget: all
|
||||
|
||||
include project.settings
|
||||
|
||||
SHELL=/bin/bash.exe
|
||||
GCC=arm-none-eabi-gcc.exe
|
||||
AS=arm-none-eabi-as.exe
|
||||
OBJCPY=arm-none-eabi-objcopy
|
||||
RM=rm
|
||||
ECHO=echo
|
||||
|
||||
#==============================================================================
|
||||
# Building.
|
||||
#==============================================================================
|
||||
AFLAGS=-mcpu=cortex-m3 \
|
||||
|
||||
CFLAGS=-Wall \
|
||||
-Wpointer-arith \
|
||||
-Wstrict-prototypes \
|
||||
-Werror \
|
||||
-mcpu=cortex-m3 \
|
||||
-mthumb \
|
||||
-g \
|
||||
-O2 \
|
||||
$(LED_DEFINES) \
|
||||
|
||||
LFLAGS=-nostartfiles \
|
||||
-nostdlib \
|
||||
-mcpu=cortex-m3 \
|
||||
|
||||
.s.o:
|
||||
$(AS) $(AFLAGS) -c $< -o $@
|
||||
|
||||
.c.o:
|
||||
$(GCC) $(CFLAGS) $(INCL) -c $< -o $@
|
||||
|
||||
#==============================================================================
|
||||
# Repository directories.
|
||||
#==============================================================================
|
||||
PATH_OS_SRC=../../../../uCOS-II/Source
|
||||
PATH_CM3_SRC=../../../../uCOS-II/Ports/ARM-Cortex-M3/Generic/GNU
|
||||
PATH_BSP_SRC=..
|
||||
PATH_CPU_SRC=../../../../uC-CPU/ARM-Cortex-M3/GNU
|
||||
PATH_CPU_INC=../../../../uC-CPU
|
||||
PATH_UCLIB_SRC=../../../../uC-LIB
|
||||
PATH_STM32_SRC=../../../../CPU/ST/STM32/src
|
||||
PATH_STM32_INC=../../../../CPU/ST/STM32/inc
|
||||
PATH_BTSTACK_SRC=../../../../../../BTstack/src
|
||||
PATH_BTSTACK_INC=../../../../../../BTstack/include
|
||||
PATH_APPL_SRC=../../../../../../Application
|
||||
PATH_APPL_INC=../../../../../../Application
|
||||
|
||||
#==============================================================================
|
||||
# Board support package (BSP).
|
||||
#==============================================================================
|
||||
ASMS_START=vector_table.o \
|
||||
|
||||
OBJS_BSP=$(PATH_BSP_SRC)/app_hooks.o \
|
||||
$(PATH_BSP_SRC)/bsp.o \
|
||||
$(PATH_BSP_SRC)/bsp_debug.o \
|
||||
$(PATH_BSP_SRC)/bsp_i2c.o \
|
||||
$(PATH_BSP_SRC)/bsp_int.o \
|
||||
$(PATH_BSP_SRC)/bsp_periph.o \
|
||||
$(PATH_BSP_SRC)/bsp_stlm75.o \
|
||||
$(PATH_BSP_SRC)/main.o \
|
||||
$(PATH_BSP_SRC)/T32_Term.o \
|
||||
$(PATH_BSP_SRC)/uCOS-II/bsp_os.o \
|
||||
vector_funcs.o \
|
||||
|
||||
ifeq ($(STM32_USART_DMA),yes)
|
||||
OBJS_BSP+=$(PATH_BSP_SRC)/bsp_btuart_dma.o
|
||||
else
|
||||
OBJS_BSP+=$(PATH_BSP_SRC)/bsp_btuart_nodma.o
|
||||
endif
|
||||
|
||||
INCL_BSP=-I$(PATH_BSP_SRC) \
|
||||
-I$(PATH_BSP_SRC)/uCOS-II
|
||||
|
||||
#==============================================================================
|
||||
# uC/OS-II.
|
||||
#==============================================================================
|
||||
ASMS_UCOS=$(PATH_CM3_SRC)/os_cpu_a.o \
|
||||
$(PATH_CPU_SRC)/cpu_a.o \
|
||||
|
||||
OBJS_UCOS=$(PATH_OS_SRC)/os_core.o \
|
||||
$(PATH_OS_SRC)/os_flag.o \
|
||||
$(PATH_OS_SRC)/os_mbox.o \
|
||||
$(PATH_OS_SRC)/os_mem.o \
|
||||
$(PATH_OS_SRC)/os_mutex.o \
|
||||
$(PATH_OS_SRC)/os_q.o \
|
||||
$(PATH_OS_SRC)/os_sem.o \
|
||||
$(PATH_OS_SRC)/os_task.o \
|
||||
$(PATH_OS_SRC)/os_time.o \
|
||||
$(PATH_OS_SRC)/os_tmr.o \
|
||||
$(PATH_CM3_SRC)/os_cpu_c.o \
|
||||
$(PATH_CM3_SRC)/os_dbg.o \
|
||||
$(PATH_CPU_SRC)/cpu_c.o
|
||||
|
||||
INCL_UCOS=-I$(PATH_OS_SRC) \
|
||||
-I$(PATH_CM3_SRC) \
|
||||
-I$(PATH_CPU_SRC) \
|
||||
-I$(PATH_CPU_INC) \
|
||||
|
||||
#==============================================================================
|
||||
# uC/LIB.
|
||||
#==============================================================================
|
||||
OBJS_UCLIB=$(PATH_UCLIB_SRC)/lib_mem.o \
|
||||
$(PATH_UCLIB_SRC)/lib_str.o \
|
||||
$(PATH_UCLIB_SRC)/memmove.o \
|
||||
|
||||
INCL_UCLIB=-I$(PATH_UCLIB_SRC) \
|
||||
|
||||
#==============================================================================
|
||||
# STM32.
|
||||
#==============================================================================
|
||||
OBJS_STM32=$(PATH_STM32_SRC)/stm32f10x_flash.o \
|
||||
$(PATH_STM32_SRC)/stm32f10x_gpio.o \
|
||||
$(PATH_STM32_SRC)/stm32f10x_rcc.o \
|
||||
$(PATH_STM32_SRC)/stm32f10x_usart.o \
|
||||
|
||||
ifeq ($(STM32_USART_DMA),yes)
|
||||
OBJS_STM32+=$(PATH_STM32_SRC)/stm32f10x_dma.o $(PATH_STM32_SRC)/misc.o
|
||||
endif
|
||||
|
||||
INCL_STM32=-I$(PATH_STM32_INC) \
|
||||
-I$(PATH_STM32_SRC) \
|
||||
|
||||
#==============================================================================
|
||||
# BTstack.
|
||||
#==============================================================================
|
||||
OBJS_BTSTACK=$(PATH_BTSTACK_SRC)/btstack_memory_ucos.o \
|
||||
$(PATH_BTSTACK_SRC)/daemon.o \
|
||||
$(PATH_BTSTACK_SRC)/hci.o \
|
||||
$(PATH_BTSTACK_SRC)/hci_cmds.o \
|
||||
$(PATH_BTSTACK_SRC)/hci_dump_ucos.o \
|
||||
$(PATH_BTSTACK_SRC)/hci_transport_h4_ucos.o \
|
||||
$(PATH_BTSTACK_SRC)/l2cap.o \
|
||||
$(PATH_BTSTACK_SRC)/l2cap_signaling.o \
|
||||
$(PATH_BTSTACK_SRC)/linked_list.o \
|
||||
$(PATH_BTSTACK_SRC)/port_ucos.o \
|
||||
$(PATH_BTSTACK_SRC)/remote_device_db_memory.o \
|
||||
$(PATH_BTSTACK_SRC)/rfcomm.o \
|
||||
$(PATH_BTSTACK_SRC)/run_loop_ucos.o \
|
||||
$(PATH_BTSTACK_SRC)/sdp.o \
|
||||
$(PATH_BTSTACK_SRC)/sdp_util.o \
|
||||
$(PATH_BTSTACK_SRC)/sdp_spp_record.o \
|
||||
$(PATH_BTSTACK_SRC)/utils.o \
|
||||
|
||||
ifeq ($(BT_CHIPSET),CSR_BC4)
|
||||
OBJS_BTSTACK+=$(PATH_BTSTACK_SRC)/bt_chipset_csrbc4.o
|
||||
CFLAGS+=-DBT_CHIPSET_CSR_BC4=1
|
||||
CFLAGS+=-DBT_CHIPSET_CSR_BC4_CHANGE_BAUDRATE=$(CSR_BC4_CHANGE_BAUDRATE_ID)
|
||||
endif
|
||||
|
||||
ifeq ($(BT_CHIPSET),PAN1315)
|
||||
OBJS_BTSTACK+=$(PATH_BTSTACK_SRC)/bt_chipset_pan1315.o
|
||||
OBJS_BTSTACK+=$(PATH_BTSTACK_SRC)/pan1315_init.o
|
||||
CFLAGS+=-DBT_CHIPSET_PAN1315=1
|
||||
endif
|
||||
|
||||
INCL_BTSTACK=-I$(PATH_BTSTACK_INC) \
|
||||
-I$(PATH_BTSTACK_SRC) \
|
||||
|
||||
#==============================================================================
|
||||
# Application.
|
||||
#==============================================================================
|
||||
OBJS_APPL=$(PATH_APPL_SRC)/api.o \
|
||||
$(PATH_APPL_SRC)/serial.o \
|
||||
|
||||
INCL_APPL=-I$(PATH_APPL_INC)
|
||||
|
||||
#==============================================================================
|
||||
# All objects for binary.
|
||||
#==============================================================================
|
||||
ASMS=$(ASMS_START) $(ASMS_UCOS)
|
||||
OBJS=$(OBJS_BSP) $(OBJS_UCOS) $(OBJS_UCLIB) $(OBJS_STM32) $(OBJS_BTSTACK) $(OBJS_APPL)
|
||||
INCL=$(INCL_BSP) $(INCL_UCOS) $(INCL_UCLIB) $(INCL_STM32) $(INCL_BTSTACK) $(INCL_APPL)
|
||||
BIN=btstackfw
|
||||
|
||||
all: $(ASMS) $(OBJS)
|
||||
@$(ECHO) Linking Flash image...
|
||||
$(GCC) $(LFLAGS) -Wl,-Map,$(BIN).map -Tlinker.lds -o $(BIN).elf $(ASMS) $(OBJS)
|
||||
$(OBJCPY) -O binary $(BIN).elf $(BIN).bin
|
||||
@$(ECHO)
|
||||
@$(ECHO) Successfully built BTstack Flash image for $(BT_CHIPSET), STM32 UART DMA $(STM32_USART_DMA).
|
||||
@$(ECHO)
|
||||
|
||||
clean:
|
||||
$(RM) -f *.elf *.bin *.map $(ASMS) $(OBJS)
|
@ -1,132 +0,0 @@
|
||||
/*=============================================================================
|
||||
* (C) Copyright Albis Technologies Ltd 2011
|
||||
*==============================================================================
|
||||
* STM32 Example Code
|
||||
*==============================================================================
|
||||
* File name: linker.lds
|
||||
*
|
||||
* Notes: GNU linker script STM32F10x flash images.
|
||||
*
|
||||
* CPU-Type Flash size SRAM size
|
||||
* (kByte) (kByte)
|
||||
* -------------------------------------
|
||||
* STM32F101C4 16. 4.
|
||||
* STM32F101C6 32. 6.
|
||||
* STM32F101C8 64. 10.
|
||||
* STM32F101CB 128. 16.
|
||||
* STM32F101R4 16. 4.
|
||||
* STM32F101R6 32. 6.
|
||||
* STM32F101R8 64. 10.
|
||||
* STM32F101RB 128. 16.
|
||||
* STM32F101RC 256. 32.
|
||||
* STM32F101RD 384. 48.
|
||||
* STM32F101RE 512. 48.
|
||||
* STM32F101T4 16. 4.
|
||||
* STM32F101T6 32. 6.
|
||||
* STM32F101T8 64. 10.
|
||||
* STM32F101V8 64. 10.
|
||||
* STM32F101VB 128. 16.
|
||||
* STM32F101VC 256. 32.
|
||||
* STM32F101VD 384. 48.
|
||||
* STM32F101VE 512. 48.
|
||||
* STM32F101ZC 256. 32.
|
||||
* STM32F101ZD 384. 48.
|
||||
* STM32F101ZE 512. 48.
|
||||
* -------------------------------------
|
||||
* STM32F102C4 16. 4.
|
||||
* STM32F102C6 32. 6.
|
||||
* STM32F102C8 64. 10.
|
||||
* STM32F102CB 128. 16.
|
||||
* STM32F102R4 16. 4.
|
||||
* STM32F102R6 32. 6.
|
||||
* STM32F102R8 64. 10.
|
||||
* STM32F102RB 128. 16.
|
||||
* -------------------------------------
|
||||
* STM32F103C4 16. 6.
|
||||
* STM32F103C6 32. 10.
|
||||
* STM32F103C8 64. 20.
|
||||
* STM32F103CB 128. 20.
|
||||
* STM32F103R4 16. 6.
|
||||
* STM32F103R6 32. 10.
|
||||
* STM32F103R8 64. 20.
|
||||
* STM32F103RB 128. 20.
|
||||
* STM32F103RC 256. 48.
|
||||
* STM32F103RD 284. 64.
|
||||
* STM32F103RE 512. 64.
|
||||
* STM32F103T4 16. 6.
|
||||
* STM32F103T6 32. 10.
|
||||
* STM32F103T8 64. 20.
|
||||
* STM32F103V8 64. 20.
|
||||
* STM32F103VB 128. 20.
|
||||
* STM32F103VC 256. 48.
|
||||
* STM32F103VD 384. 64.
|
||||
* STM32F103VE 512. 64.
|
||||
* STM32F103ZC 256. 48.
|
||||
* STM32F103ZD 384. 64.
|
||||
* STM32F103ZE 512. 64.
|
||||
* -------------------------------------
|
||||
* STM32F105R8 64. 20.
|
||||
* STM32F105RB 128. 32.
|
||||
* STM32F105RC 256. 64.
|
||||
* STM32F105V8 64. 20.
|
||||
* STM32F105VB 128. 32.
|
||||
* STM32F105VC 256. 64.
|
||||
* -------------------------------------
|
||||
* STM32F107RB 128. 48.
|
||||
* STM32F107RC 256. 64.
|
||||
* STM32F107VB 128. 48.
|
||||
* STM32F107VC 256. 64.
|
||||
*
|
||||
* Flash base address : 0x08000000
|
||||
* SRAM base address : 0x20000000
|
||||
*============================================================================*/
|
||||
|
||||
OUTPUT_ARCH(arm)
|
||||
OUTPUT_FORMAT("elf32-littlearm")
|
||||
ENTRY(vectorTableBegin)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
/* STM32 internal Flash EEPROM is remapped to 0x0 */
|
||||
. = 0x0;
|
||||
|
||||
. = ALIGN(4);
|
||||
.text : { *(.text) }
|
||||
|
||||
. = ALIGN(4);
|
||||
.rodata : { *(.rodata) }
|
||||
|
||||
/* .data section in Flash */
|
||||
. = ALIGN(4);
|
||||
_data_start_in_flash = .;
|
||||
|
||||
/* Check if Flash EEPROM full */
|
||||
ASSERT(. < 0x40000, "Error: STM32F107VC internal Flash EERPROM full!")
|
||||
|
||||
/* STM32 internal SRAM start address */
|
||||
. = 0x20000000;
|
||||
|
||||
/* .data section in RAM */
|
||||
. = ALIGN(4);
|
||||
_data_start_in_ram = .;
|
||||
.data : AT (_data_start_in_flash) { *(.data) }
|
||||
_data_end_in_ram = .;
|
||||
|
||||
_data_section_size = _data_end_in_ram - _data_start_in_ram;
|
||||
|
||||
. = ALIGN(4);
|
||||
_bss_start = .;
|
||||
.bss : { *(.bss) }
|
||||
. = ALIGN(4);
|
||||
_bss_end = .;
|
||||
|
||||
_bss_size = _bss_end - _bss_start;
|
||||
|
||||
/* Allocate CM3 main stack */
|
||||
. = ALIGN(4);
|
||||
. += 0x200;
|
||||
_cm3_main_stack = .;
|
||||
|
||||
/* Check if RAM full */
|
||||
ASSERT(. < 0x2000fff0, "Error: STM32F107VC internal RAM full!")
|
||||
}
|
@ -1,74 +0,0 @@
|
||||
#==============================================================================
|
||||
# (C) Copyright Albis Technologies Ltd 2011
|
||||
#==============================================================================
|
||||
# Example Code
|
||||
#==============================================================================
|
||||
# File name: project.settings
|
||||
#
|
||||
# Notes: -
|
||||
#==============================================================================
|
||||
|
||||
# Choose evaluation board. Available:
|
||||
# EVAL_BOARD=MICRIUM (UM0780)
|
||||
# EVAL_BOARD=OLIMEX (STM32-P107)
|
||||
EVAL_BOARD=MICRIUM
|
||||
|
||||
# Choose Bluetooth chipset. Available:
|
||||
# BT_CHIPSET=CSR_BC4 (CSR BlueCore4)
|
||||
# BT_CHIPSET=PAN1315 (Panasonic PAN1315)
|
||||
BT_CHIPSET=CSR_BC4
|
||||
|
||||
# CSR BlueCore4 only : change to higher baud rate during initialisation.
|
||||
# Set 0 for no change.
|
||||
# 1 : 38400
|
||||
# 2 : 57600
|
||||
# 3 : 115200
|
||||
# 4 : 230400
|
||||
# 5 : 460800
|
||||
# 6 : 500000
|
||||
# 7 : 921600
|
||||
ifeq ($(BT_CHIPSET),CSR_BC4)
|
||||
CSR_BC4_CHANGE_BAUDRATE_ID=6
|
||||
endif
|
||||
|
||||
# Choose whether or not STM32 USART DMA in use [yes|no].
|
||||
STM32_USART_DMA=no
|
||||
|
||||
# Notification LEDs.
|
||||
#
|
||||
# Micrium STM32 evaluation board UM0780
|
||||
# Green : PD13
|
||||
# Orange : PD14
|
||||
# Red : PD15
|
||||
#
|
||||
# Olimex STM32 evaluation board STM32-P107
|
||||
# Green : PC6
|
||||
# Orange : PC7
|
||||
# Red : none
|
||||
ifeq ($(EVAL_BOARD),MICRIUM)
|
||||
LED_PORT=4
|
||||
LED_GREEN_PRESENT=1
|
||||
LED_GREEN=13
|
||||
LED_ORANGE_PRESENT=1
|
||||
LED_ORANGE=14
|
||||
LED_RED_PRESENT=1
|
||||
LED_RED=15
|
||||
endif
|
||||
|
||||
ifeq ($(EVAL_BOARD),OLIMEX)
|
||||
LED_PORT=3
|
||||
LED_GREEN_PRESENT=1
|
||||
LED_GREEN=6
|
||||
LED_ORANGE_PRESENT=1
|
||||
LED_ORANGE=7
|
||||
LED_RED_PRESENT=0
|
||||
LED_RED=0
|
||||
endif
|
||||
|
||||
LED_DEFINES=-DLED_PORT=$(LED_PORT)
|
||||
LED_DEFINES+=-DLED_GREEN_PRESENT=$(LED_GREEN_PRESENT)
|
||||
LED_DEFINES+=-DLED_GREEN=$(LED_GREEN)
|
||||
LED_DEFINES+=-DLED_ORANGE_PRESENT=$(LED_ORANGE_PRESENT)
|
||||
LED_DEFINES+=-DLED_ORANGE=$(LED_ORANGE)
|
||||
LED_DEFINES+=-DLED_RED_PRESENT=$(LED_RED_PRESENT)
|
||||
LED_DEFINES+=-DLED_RED=$(LED_RED)
|
@ -1,88 +0,0 @@
|
||||
/*=============================================================================
|
||||
* (C) Copyright Albis Technologies Ltd 2011
|
||||
*==============================================================================
|
||||
* STM32 Example Code
|
||||
*==============================================================================
|
||||
* File name: vector_funcs.c
|
||||
*
|
||||
* Notes: STM32 vector functions.
|
||||
*============================================================================*/
|
||||
|
||||
/* Get a linker script symbol's value. */
|
||||
#define GET_LDS_ULONG(symbol) ((unsigned long)(&symbol))
|
||||
|
||||
extern unsigned long _data_start_in_flash;
|
||||
extern unsigned long _data_start_in_ram;
|
||||
extern unsigned long _data_section_size;
|
||||
extern unsigned long _bss_start;
|
||||
extern unsigned long _bss_size;
|
||||
|
||||
extern void main(void);
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void startup(void)
|
||||
{
|
||||
unsigned long len, i;
|
||||
unsigned long *src, *dest;
|
||||
|
||||
/* Zero out BSS. */
|
||||
dest = (void *)GET_LDS_ULONG(_bss_start);
|
||||
len = GET_LDS_ULONG(_bss_size);
|
||||
for(i = 0; i < len; i += 4)
|
||||
{
|
||||
*(dest++) = 0;
|
||||
}
|
||||
|
||||
/* Copy the data segment initializers from Flash to RAM. */
|
||||
src = (void *)GET_LDS_ULONG(_data_start_in_flash);
|
||||
dest = (void *)GET_LDS_ULONG(_data_start_in_ram);
|
||||
len = GET_LDS_ULONG(_data_section_size);
|
||||
for(i = 0; i < len; i += 4)
|
||||
{
|
||||
*(dest++) = *(src++);
|
||||
}
|
||||
|
||||
main();
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void App_NMI_ISR(void)
|
||||
{
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void App_Fault_ISR(void)
|
||||
{
|
||||
for(;;);
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void App_BusFault_ISR(void)
|
||||
{
|
||||
for(;;);
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void App_UsageFault_ISR(void)
|
||||
{
|
||||
for(;;);
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void App_MemFault_ISR(void)
|
||||
{
|
||||
for(;;);
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void App_Spurious_ISR(void)
|
||||
{
|
||||
for(;;);
|
||||
}
|
@ -1,172 +0,0 @@
|
||||
@==============================================================================
|
||||
@ (C) Copyright Albis Technologies Ltd 2011
|
||||
@==============================================================================
|
||||
@ STM32 Example Code
|
||||
@==============================================================================
|
||||
@ File name: vector_table.s
|
||||
@
|
||||
@ Notes: STM32 vector table.
|
||||
@ Must be located at beginning of flash image.
|
||||
@==============================================================================
|
||||
|
||||
.extern _cm3_main_stack
|
||||
.extern startup
|
||||
.extern App_NMI_ISR
|
||||
.extern App_Fault_ISR
|
||||
.extern App_MemFault_ISR
|
||||
.extern App_BusFault_ISR
|
||||
.extern App_UsageFault_ISR
|
||||
.extern App_Spurious_ISR
|
||||
.extern OS_CPU_PendSVHandler
|
||||
.extern OS_CPU_SysTickHandler
|
||||
|
||||
.extern BSP_IntHandlerWWDG
|
||||
.extern BSP_IntHandlerPVD
|
||||
.extern BSP_IntHandlerTAMPER
|
||||
.extern BSP_IntHandlerRTC
|
||||
.extern BSP_IntHandlerFLASH
|
||||
.extern BSP_IntHandlerRCC
|
||||
.extern BSP_IntHandlerEXTI0
|
||||
.extern BSP_IntHandlerEXTI1
|
||||
.extern BSP_IntHandlerEXTI2
|
||||
.extern BSP_IntHandlerEXTI3
|
||||
.extern BSP_IntHandlerEXTI4
|
||||
.extern BSP_IntHandlerDMA1_CH1
|
||||
.extern BSP_IntHandlerDMA1_CH2
|
||||
.extern BSP_IntHandlerDMA1_CH3
|
||||
.extern BSP_IntHandlerDMA1_CH4
|
||||
.extern BSP_IntHandlerDMA1_CH5
|
||||
|
||||
.extern BSP_IntHandlerDMA1_CH6
|
||||
.extern BSP_IntHandlerDMA1_CH7
|
||||
.extern BSP_IntHandlerADC1_2
|
||||
.extern BSP_IntHandlerUSB_HP_CAN_TX
|
||||
.extern BSP_IntHandlerUSB_LP_CAN_RX0
|
||||
.extern BSP_IntHandlerCAN_RX1
|
||||
.extern BSP_IntHandlerCAN_SCE
|
||||
.extern BSP_IntHandlerEXTI9_5
|
||||
.extern BSP_IntHandlerTIM1_BRK
|
||||
.extern BSP_IntHandlerTIM1_UP
|
||||
.extern BSP_IntHandlerTIM1_TRG_COM
|
||||
.extern BSP_IntHandlerTIM1_CC
|
||||
.extern BSP_IntHandlerTIM2
|
||||
.extern BSP_IntHandlerTIM3
|
||||
.extern BSP_IntHandlerTIM4
|
||||
.extern BSP_IntHandlerI2C1_EV
|
||||
|
||||
.extern BSP_IntHandlerI2C1_ER
|
||||
.extern BSP_IntHandlerI2C2_EV
|
||||
.extern BSP_IntHandlerI2C2_ER
|
||||
.extern BSP_IntHandlerSPI1
|
||||
.extern BSP_IntHandlerSPI2
|
||||
.extern BSP_IntHandlerUSART1
|
||||
.extern BSP_IntHandlerUSART2
|
||||
.extern BSP_IntHandlerUSART3
|
||||
.extern BSP_IntHandlerEXTI15_10
|
||||
.extern BSP_IntHandlerRTCAlarm
|
||||
.extern BSP_IntHandlerUSBWakeUp
|
||||
.extern BSP_IntHandlerTIM8_BRK
|
||||
.extern BSP_IntHandlerTIM8_UP
|
||||
.extern BSP_IntHandlerTIM8_TRG_COM
|
||||
.extern BSP_IntHandlerTIM8_CC
|
||||
.extern BSP_IntHandlerADC3
|
||||
|
||||
.extern BSP_IntHandlerFSMC
|
||||
.extern BSP_IntHandlerSDIO
|
||||
.extern BSP_IntHandlerTIM5
|
||||
.extern BSP_IntHandlerSPI3
|
||||
.extern BSP_IntHandlerUART4
|
||||
.extern BSP_IntHandlerUART5
|
||||
.extern BSP_IntHandlerTIM6
|
||||
.extern BSP_IntHandlerTIM7
|
||||
.extern BSP_IntHandlerDMA2_CH1
|
||||
.extern BSP_IntHandlerDMA2_CH2
|
||||
.extern BSP_IntHandlerDMA2_CH3
|
||||
.extern BSP_IntHandlerDMA2_CH4_5
|
||||
|
||||
.global vectorTableBegin
|
||||
|
||||
.section .text
|
||||
|
||||
vectorTableBegin:
|
||||
|
||||
.word _cm3_main_stack @ Main stack
|
||||
.word startup @ Reset handler.
|
||||
.word App_NMI_ISR @ 2, NMI.
|
||||
.word App_Fault_ISR @ 3, Hard Fault.
|
||||
.word App_MemFault_ISR @ 4, Memory Management.
|
||||
.word App_BusFault_ISR @ 5, Bus Fault.
|
||||
.word App_UsageFault_ISR @ 6, Usage Fault.
|
||||
.word App_Spurious_ISR @ 7, Reserved.
|
||||
.word App_Spurious_ISR @ 8, Reserved.
|
||||
.word App_Spurious_ISR @ 9, Reserved.
|
||||
.word App_Spurious_ISR @ 10, Reserved.
|
||||
.word App_Spurious_ISR @ 11, SVCall.
|
||||
.word App_Spurious_ISR @ 12, Debug Monitor.
|
||||
.word App_Spurious_ISR @ 13, Reserved.
|
||||
.word OS_CPU_PendSVHandler + 1 @ 14, PendSV Handler.
|
||||
.word OS_CPU_SysTickHandler + 1 @ 15, uC/OS-II Tick ISR Handler.
|
||||
|
||||
.word BSP_IntHandlerWWDG @ 16, INTISR[ 0] Window Watchdog.
|
||||
.word BSP_IntHandlerPVD @ 17, INTISR[ 1] PVD through EXTI Line Detection.
|
||||
.word BSP_IntHandlerTAMPER @ 18, INTISR[ 2] Tamper Interrupt.
|
||||
.word BSP_IntHandlerRTC @ 19, INTISR[ 3] RTC Global Interrupt.
|
||||
.word BSP_IntHandlerFLASH @ 20, INTISR[ 4] FLASH Global Interrupt.
|
||||
.word BSP_IntHandlerRCC @ 21, INTISR[ 5] RCC Global Interrupt.
|
||||
.word BSP_IntHandlerEXTI0 @ 22, INTISR[ 6] EXTI Line0 Interrupt.
|
||||
.word BSP_IntHandlerEXTI1 @ 23, INTISR[ 7] EXTI Line1 Interrupt.
|
||||
.word BSP_IntHandlerEXTI2 @ 24, INTISR[ 8] EXTI Line2 Interrupt.
|
||||
.word BSP_IntHandlerEXTI3 @ 25, INTISR[ 9] EXTI Line3 Interrupt.
|
||||
.word BSP_IntHandlerEXTI4 @ 26, INTISR[ 10] EXTI Line4 Interrupt.
|
||||
.word BSP_IntHandlerDMA1_CH1 @ 27, INTISR[ 11] DMA Channel1 Global Interrupt.
|
||||
.word BSP_IntHandlerDMA1_CH2 @ 28, INTISR[ 12] DMA Channel2 Global Interrupt.
|
||||
.word BSP_IntHandlerDMA1_CH3 @ 29, INTISR[ 13] DMA Channel3 Global Interrupt.
|
||||
.word BSP_IntHandlerDMA1_CH4 @ 30, INTISR[ 14] DMA Channel4 Global Interrupt.
|
||||
.word BSP_IntHandlerDMA1_CH5 @ 31, INTISR[ 15] DMA Channel5 Global Interrupt.
|
||||
|
||||
.word BSP_IntHandlerDMA1_CH6 @ 32, INTISR[ 16] DMA Channel6 Global Interrupt.
|
||||
.word BSP_IntHandlerDMA1_CH7 @ 33, INTISR[ 17] DMA Channel7 Global Interrupt.
|
||||
.word BSP_IntHandlerADC1_2 @ 34, INTISR[ 18] ADC1 & ADC2 Global Interrupt.
|
||||
.word BSP_IntHandlerUSB_HP_CAN_TX @ 35, INTISR[ 19] USB High Prio / CAN TX Interrupts.
|
||||
.word BSP_IntHandlerUSB_LP_CAN_RX0 @ 36, INTISR[ 20] USB Low Prio / CAN RX0 Interrupts.
|
||||
.word BSP_IntHandlerCAN_RX1 @ 37, INTISR[ 21] CAN RX1 Interrupt.
|
||||
.word BSP_IntHandlerCAN_SCE @ 38, INTISR[ 22] CAN SCE Interrupt.
|
||||
.word BSP_IntHandlerEXTI9_5 @ 39, INTISR[ 23] EXTI Line[9:5] Interrupt.
|
||||
.word BSP_IntHandlerTIM1_BRK @ 40, INTISR[ 24] TIM1 Break Interrupt.
|
||||
.word BSP_IntHandlerTIM1_UP @ 41, INTISR[ 25] TIM1 Update Interrupt.
|
||||
.word BSP_IntHandlerTIM1_TRG_COM @ 42, INTISR[ 26] TIM1 Trig & Commutation Interrupts.
|
||||
.word BSP_IntHandlerTIM1_CC @ 43, INTISR[ 27] TIM1 Capture Compare Interrupt.
|
||||
.word BSP_IntHandlerTIM2 @ 44, INTISR[ 28] TIM2 Global Interrupt.
|
||||
.word BSP_IntHandlerTIM3 @ 45, INTISR[ 29] TIM3 Global Interrupt.
|
||||
.word BSP_IntHandlerTIM4 @ 46, INTISR[ 30] TIM4 Global Interrupt.
|
||||
.word BSP_IntHandlerI2C1_EV @ 47, INTISR[ 31] I2C1 Event Interrupt.
|
||||
|
||||
.word BSP_IntHandlerI2C1_ER @ 48, INTISR[ 32] I2C1 Error Interrupt.
|
||||
.word BSP_IntHandlerI2C2_EV @ 49, INTISR[ 33] I2C2 Event Interrupt.
|
||||
.word BSP_IntHandlerI2C2_ER @ 50, INTISR[ 34] I2C2 Error Interrupt.
|
||||
.word BSP_IntHandlerSPI1 @ 51, INTISR[ 35] SPI1 Global Interrupt.
|
||||
.word BSP_IntHandlerSPI2 @ 52, INTISR[ 36] SPI2 Global Interrupt.
|
||||
.word BSP_IntHandlerUSART1 @ 53, INTISR[ 37] USART1 Global Interrupt.
|
||||
.word BSP_IntHandlerUSART2 @ 54, INTISR[ 38] USART2 Global Interrupt.
|
||||
.word BSP_IntHandlerUSART3 @ 55, INTISR[ 39] USART3 Global Interrupt.
|
||||
.word BSP_IntHandlerEXTI15_10 @ 56, INTISR[ 40] EXTI Line [15:10] Interrupts.
|
||||
.word BSP_IntHandlerRTCAlarm @ 57, INTISR[ 41] RTC Alarm EXT Line Interrupt.
|
||||
.word BSP_IntHandlerUSBWakeUp @ 58, INTISR[ 42] USB Wakeup from Suspend EXTI Int.
|
||||
.word BSP_IntHandlerTIM8_BRK @ 59, INTISR[ 43] TIM8 Break Interrupt.
|
||||
.word BSP_IntHandlerTIM8_UP @ 60, INTISR[ 44] TIM8 Update Interrupt.
|
||||
.word BSP_IntHandlerTIM8_TRG_COM @ 61, INTISR[ 45] TIM8 Trigg/Commutation Interrupts.
|
||||
.word BSP_IntHandlerTIM8_CC @ 62, INTISR[ 46] TIM8 Capture Compare Interrupt.
|
||||
.word BSP_IntHandlerADC3 @ 63, INTISR[ 47] ADC3 Global Interrupt.
|
||||
|
||||
.word BSP_IntHandlerFSMC @ 64, INTISR[ 48] FSMC Global Interrupt.
|
||||
.word BSP_IntHandlerSDIO @ 65, INTISR[ 49] SDIO Global Interrupt.
|
||||
.word BSP_IntHandlerTIM5 @ 66, INTISR[ 50] TIM5 Global Interrupt.
|
||||
.word BSP_IntHandlerSPI3 @ 67, INTISR[ 51] SPI3 Global Interrupt.
|
||||
.word BSP_IntHandlerUART4 @ 68, INTISR[ 52] UART4 Global Interrupt.
|
||||
.word BSP_IntHandlerUART5 @ 69, INTISR[ 53] UART5 Global Interrupt.
|
||||
.word BSP_IntHandlerTIM6 @ 70, INTISR[ 54] TIM6 Global Interrupt.
|
||||
.word BSP_IntHandlerTIM7 @ 71, INTISR[ 55] TIM7 Global Interrupt.
|
||||
.word BSP_IntHandlerDMA2_CH1 @ 72, INTISR[ 56] DMA2 Channel1 Global Interrupt.
|
||||
.word BSP_IntHandlerDMA2_CH2 @ 73, INTISR[ 57] DMA2 Channel2 Global Interrupt.
|
||||
.word BSP_IntHandlerDMA2_CH3 @ 74, INTISR[ 58] DMA2 Channel3 Global Interrupt.
|
||||
.word BSP_IntHandlerDMA2_CH4_5 @ 75, INTISR[ 59] DMA2 Channel4/5 Global Interrups.
|
@ -1,333 +0,0 @@
|
||||
|
||||
/*------------------------------*/
|
||||
/* TRACE32 Terminal Function */
|
||||
/*------------------------------*/
|
||||
/*
|
||||
this terminal Function are for SingeE Access
|
||||
on Devices with Dualport Access only.
|
||||
|
||||
use on the Trace32 Driver the command
|
||||
Terminal Setup:
|
||||
|
||||
TERM.Reset
|
||||
TERM.METHODE.SingleE
|
||||
TERM.MODE Ascii| String | RAW | HEX | VT100
|
||||
|
||||
After this, start your Window Definition.
|
||||
This can containe ONE terminal.view command with the SAME
|
||||
configuration addresses.
|
||||
|
||||
TERM e:TermOutAddress1 e:TermInAddress1
|
||||
TERM e:TermOutAddress2 e:TermInAddress2
|
||||
.....
|
||||
|
||||
|
||||
If you use the Enable functionality, then you can
|
||||
enable (or disable) the T32-Terimanl Driver on the fly
|
||||
by the command
|
||||
|
||||
Data.Set e:TermOutAddress+2 %Byte -1 ; for enable
|
||||
or
|
||||
Data.Set e:TermOutAddress+2 %Byte 0 ; for disable
|
||||
|
||||
note
|
||||
if the "t32_term_pen_port" is located in the zero-section, then the
|
||||
terminal is automatically disabled by default.
|
||||
|
||||
|
||||
In the example, T32OutAddress means the Out-Byte of the Applycation view
|
||||
and the T32InAddress means the In-Byte of the Applycation view
|
||||
|
||||
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* History */
|
||||
/*--------- */
|
||||
/*--Date-+-change---------------------------------------------------+aut+Vers+*/
|
||||
/* 110508: is created for cortex (e.g. target with e: access) :akj:1.00:*/
|
||||
/*-------+----------------------------------------------------------+---+----+*/
|
||||
/* : : : :*/
|
||||
/*-------+----------------------------------------------------------+---+----+*/
|
||||
/* : : : :*/
|
||||
/*-------+----------------------------------------------------------+---+----+*/
|
||||
/* : : : :*/
|
||||
/*-------+----------------------------------------------------------+---+----+*/
|
||||
/* : : : :*/
|
||||
/*-------+----------------------------------------------------------+---+----+*/
|
||||
/* : : : :*/
|
||||
/*-------+----------------------------------------------------------+---+----+*/
|
||||
/* : : : :*/
|
||||
/*-------+----------------------------------------------------------+---+----+*/
|
||||
/* : : : :*/
|
||||
/*-------+----------------------------------------------------------+---+----+*/
|
||||
|
||||
|
||||
#include "T32_Term.h"
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Put a character to T32-Terminal */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/*
|
||||
Abstract
|
||||
this funktion puts a character to the 3 (or 2) byte port
|
||||
the port is a 3 cell memory part.
|
||||
|
||||
struct(3 bytes, [0] unsigned char put (unsigned 8 bits),
|
||||
[1] unsigned char get (unsigned 8 bits),
|
||||
[2] unsigned char enable (unsigned 8 bits))
|
||||
|
||||
the last byte is optional and controller by the
|
||||
- T32_term_enable_byte in the T32_Term.h file.
|
||||
if this is >0, the the byte is used.
|
||||
|
||||
The enable byte must be set to >0, otherwise, the terminal
|
||||
functions are disabled in the applycation.
|
||||
--------------------------------------------------------------------------
|
||||
The Put Funtion first checks the Enable Byte. If it is 0x0,
|
||||
the the function is returned.
|
||||
|
||||
If the Terminal is enabled, the Put Function checks the put Byte
|
||||
if no Terminal is opened in the Trace32, then the last Character
|
||||
is not readed and the Put Function will polling up to n parts.
|
||||
n = t32_term_polling_nr defined in the T32_Term.h file.
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Parameter
|
||||
-1-
|
||||
struct t32_term_typedef *Address
|
||||
|
||||
pointer to the Port-Structure. It is defined in the
|
||||
T32_Term.h file. The selectable Port-Channel is for
|
||||
Multi-Terminal mode.
|
||||
Normaly use -> t32_termport <- for this paramter always.
|
||||
|
||||
-2-
|
||||
unsigned char
|
||||
|
||||
8 Bit Value for transmit to the Terminal.
|
||||
Don't send a 0x00 value, it will not transmit.
|
||||
|
||||
|
||||
the terminal can interprete a subset of VT100 syntax.
|
||||
|
||||
return
|
||||
none
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Example:
|
||||
|
||||
include "T32_Term.h"
|
||||
|
||||
T32_Term_Put(t32_termport,Character);
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
void T32_Term_Put(t32_term_typedef *port, char uc_value)
|
||||
{
|
||||
unsigned int polling_loop_ctr;
|
||||
|
||||
|
||||
#if t32_term_enable_byte > 0
|
||||
if (port->enable == 0)
|
||||
return;
|
||||
#endif
|
||||
|
||||
polling_loop_ctr = t32_term_polling_nr;
|
||||
while ((port->put!=0) && (polling_loop_ctr !=0)) {
|
||||
polling_loop_ctr--;
|
||||
}
|
||||
|
||||
if (port->put !=0)
|
||||
return;
|
||||
|
||||
port->put = (unsigned char)uc_value;
|
||||
|
||||
return;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Get a character from T32-Terminal */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/*
|
||||
Abstract
|
||||
this funktion read's a character from the 3 (or 2) byte port
|
||||
the port is a 3 cell memory part.
|
||||
|
||||
struct(3 bytes, [0] unsigned char put (unsigned 8 bits),
|
||||
[1] unsigned char get (unsigned 8 bits),
|
||||
[2] unsigned char enable (unsigned 8 bits))
|
||||
|
||||
the last byte is optional and controller by the
|
||||
- T32_term_enable_byte in the T32_Term.h file.
|
||||
if this is >0, the the byte is used.
|
||||
|
||||
The enable byte must be set to > 0, otherwise, the terminal
|
||||
functions are disabled in the applycation.
|
||||
--------------------------------------------------------------------------
|
||||
The Get Funtion first checks the Enable Byte. If it is 0x0,
|
||||
the the function is returned with 0x00.
|
||||
|
||||
If the Terminal is enabled, the Get Function reads the Value from
|
||||
get Byte and then writes a 0x00 to the get byte for signaling to
|
||||
Trace32, that the charcater is taked.
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Parameter
|
||||
-1-
|
||||
struct t32_term_typedef *Address
|
||||
|
||||
pointer to the Port-Structure. It is defined in the
|
||||
T32_Term.h file. The selectable Port-Channel is for
|
||||
Multi-Terminal mode.
|
||||
Normaly use -> t32_termport <- for this paramter always.
|
||||
|
||||
|
||||
return unsigned char
|
||||
|
||||
- 0x00 for no character is present
|
||||
> 0x00 as Terminal Value.
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Example:
|
||||
|
||||
include "T32_Term.h"
|
||||
|
||||
unsigned char uc_terminal_char;
|
||||
|
||||
uc_terminal_char = T32_Term_Get(t32_termport);
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
unsigned char T32_Term_Get(t32_term_typedef *port)
|
||||
{
|
||||
unsigned char uc_val;
|
||||
|
||||
#if t32_term_enable_byte > 0
|
||||
if (port->enable == 0)
|
||||
return (unsigned char)0x0;
|
||||
#endif
|
||||
|
||||
uc_val = (unsigned char)port->get; /* read port */
|
||||
if (uc_val > 0)
|
||||
port->get = 0; /* write handshake */
|
||||
|
||||
return uc_val;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* RX-Status T32-Terminal */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/*
|
||||
Abstract see Put and Get Function
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Parameter
|
||||
-1-
|
||||
struct t32_term_typedef *Address
|
||||
|
||||
pointer to the Port-Structure. It is defined in the
|
||||
T32_Term.h file. At this time, only one Terminal can
|
||||
be used in the Trace32. The selectable Port-Channel is for
|
||||
future.
|
||||
Normaly use -> t32_termport <- for this paramter always.
|
||||
|
||||
|
||||
return unsigned char
|
||||
|
||||
- 0x00 for no character is present
|
||||
0xFF a Character is ready for get it
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Example:
|
||||
|
||||
include "T32_Term.h"
|
||||
|
||||
unsigned char uc_terminal_status;
|
||||
|
||||
uc_terminal_status = T32_Term_RXStatus(t32_termport);
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
unsigned char T32_Term_RXStatus(t32_term_typedef *port)
|
||||
{
|
||||
unsigned char uc_val;
|
||||
|
||||
#if t32_term_enable_byte > 0
|
||||
if (port->enable == 0)
|
||||
return (unsigned char)0x0;
|
||||
#endif
|
||||
|
||||
uc_val = port->get; /* read port */
|
||||
if (uc_val > 0)
|
||||
return (unsigned char)0x0;
|
||||
else
|
||||
return (unsigned char)0xff;
|
||||
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* TX-Status T32-Terminal */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/*
|
||||
Abstract see Put and Get Function
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Parameter
|
||||
-1-
|
||||
struct t32_term_typedef *Address
|
||||
|
||||
pointer to the Port-Structure. It is defined in the
|
||||
T32_Term.h file. At this time, only one Terminal can
|
||||
be used in the Trace32. The selectable Port-Channel is for
|
||||
future.
|
||||
Normaly use -> t32_termport <- for this paramter always.
|
||||
|
||||
|
||||
return unsigned char
|
||||
|
||||
- 0x00 TX Buffer is empty
|
||||
0xFF TX Buffer is not ready for transmit
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Example:
|
||||
|
||||
include "T32_Term.h"
|
||||
|
||||
unsigned char uc_terminal_status;
|
||||
|
||||
uc_terminal_status = T32_Term_TXStatus(t32_termport);
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
unsigned char T32_Term_TXStatus(t32_term_typedef *port)
|
||||
{
|
||||
unsigned char uc_val;
|
||||
|
||||
#if t32_term_enable_byte > 0
|
||||
if (port->enable == 0)
|
||||
return (unsigned char)0x0;
|
||||
#endif
|
||||
|
||||
uc_val = port->put;
|
||||
if (uc_val > 0)
|
||||
return (unsigned char)0xff;
|
||||
else
|
||||
return (unsigned char)0x00;
|
||||
}
|
||||
|
||||
/* eof */
|
||||
|
@ -1,72 +0,0 @@
|
||||
/*------------------------------*/
|
||||
/* TRACE32 Terminal Header File */
|
||||
/*------------------------------*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* History */
|
||||
/*--------- */
|
||||
/*--Date-+-change---------------------------------------------------+aut+Vers+*/
|
||||
/* 110508: is created for cortex (e.g. target with e: access) :akj:1.00:*/
|
||||
/*-------+----------------------------------------------------------+---+----+*/
|
||||
/* : : : :*/
|
||||
/*-------+----------------------------------------------------------+---+----+*/
|
||||
/* : : : :*/
|
||||
/*-------+----------------------------------------------------------+---+----+*/
|
||||
/* : : : :*/
|
||||
/*-------+----------------------------------------------------------+---+----+*/
|
||||
/* : : : :*/
|
||||
/*-------+----------------------------------------------------------+---+----+*/
|
||||
/* : : : :*/
|
||||
/*-------+----------------------------------------------------------+---+----+*/
|
||||
/* : : : :*/
|
||||
/*-------+----------------------------------------------------------+---+----+*/
|
||||
/* : : : :*/
|
||||
/*-------+----------------------------------------------------------+---+----+*/
|
||||
|
||||
|
||||
|
||||
#ifndef __t32_term_def_h
|
||||
#define __t32_term_def_h
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define t32_term_enable_byte 1 /* 1 = terminal Enable-Byte is used; 0= not used */
|
||||
#define t32_term_polling_nr 100 /* n pollings for transmit a byte is used (min is 1) */
|
||||
#define t32_termportaddress 0x2000fff0 /* Put = 0x20083ff0, get = 0x20083ff1, enable = 0x20083ff2 */
|
||||
#define t32_termportaddress2 0x2000fff3 /* Put = 0x20083ff3, get = 0x20083ff4, enable = 0x20083ff5 */
|
||||
|
||||
|
||||
/*----------------*/
|
||||
/* Define Struct */
|
||||
/*----------------*/
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
volatile unsigned char put;
|
||||
volatile unsigned char get;
|
||||
#if t32_term_enable_byte > 0
|
||||
volatile unsigned char enable;
|
||||
#endif
|
||||
} t32_term_typedef;
|
||||
|
||||
#define t32_termport (( t32_term_typedef *) t32_termportaddress)
|
||||
#define t32_termport_2 (( t32_term_typedef *) t32_termportaddress2)
|
||||
|
||||
|
||||
|
||||
/*----------------*/
|
||||
/* Define Function*/
|
||||
/*----------------*/
|
||||
|
||||
extern void T32_Term_Put(t32_term_typedef * port,
|
||||
char uc_value ); /* send a character from application to the host */
|
||||
unsigned char T32_Term_Get(t32_term_typedef *port ); /* get a character from host to application */
|
||||
extern unsigned char T32_Term_TXStatus(t32_term_typedef *port ); /* check terminal status */
|
||||
extern unsigned char T32_Term_RXStatus(t32_term_typedef *port ); /* check terminal status */
|
||||
|
||||
#endif
|
||||
|
||||
/* eof */
|
||||
|
@ -1,156 +0,0 @@
|
||||
/*=============================================================================
|
||||
* (C) Copyright Albis Technologies Ltd 2011
|
||||
*==============================================================================
|
||||
* STM32 Example Code
|
||||
*==============================================================================
|
||||
* File name: bsp_btuart.h
|
||||
*
|
||||
* Notes: STM32 Bluetooth UART driver.
|
||||
*============================================================================*/
|
||||
|
||||
#ifndef BSP_BTUART_H
|
||||
#define BSP_BTUART_H
|
||||
|
||||
/*=============================================================================
|
||||
* Prototype of receiver callback function.
|
||||
=============================================================================*/
|
||||
typedef void(* RxCallbackFunc)(unsigned char *data, unsigned long size);
|
||||
|
||||
/*=============================================================================
|
||||
* PURPOSE: Initialising Bluetooth UART.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* -
|
||||
*
|
||||
* RETURN VALUE:
|
||||
* -
|
||||
*
|
||||
* COMMENTS: -
|
||||
=============================================================================*/
|
||||
void BSP_BTUART_Initialise(void);
|
||||
|
||||
/*=============================================================================
|
||||
* PURPOSE: Setting Bluetooth UART baud rate.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* baudrate - baud rate to set.
|
||||
*
|
||||
* RETURN VALUE:
|
||||
* -
|
||||
*
|
||||
* COMMENTS: -
|
||||
=============================================================================*/
|
||||
void BSP_BTUART_SetBaudrate(unsigned long baudrate);
|
||||
|
||||
/*=============================================================================
|
||||
* PURPOSE: Activating BT chip reset.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* -
|
||||
*
|
||||
* RETURN VALUE:
|
||||
* -
|
||||
*
|
||||
* COMMENTS: -
|
||||
=============================================================================*/
|
||||
void BSP_BTUART_ActivateReset(void);
|
||||
|
||||
/*=============================================================================
|
||||
* PURPOSE: Deactivating BT chip reset.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* -
|
||||
*
|
||||
* RETURN VALUE:
|
||||
* -
|
||||
*
|
||||
* COMMENTS: -
|
||||
=============================================================================*/
|
||||
void BSP_BTUART_DeactivateReset(void);
|
||||
|
||||
/*=============================================================================
|
||||
* PURPOSE: Sending on Bluetooth UART.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* buffer - pointer to buffer to send.
|
||||
* count - number of bytes to send.
|
||||
*
|
||||
* RETURN VALUE:
|
||||
* -
|
||||
*
|
||||
* COMMENTS: -
|
||||
=============================================================================*/
|
||||
void BSP_BTUART_Transmit(unsigned char *buffer, unsigned long count);
|
||||
|
||||
/*=============================================================================
|
||||
* PURPOSE: Anouncing DMA receiver size.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* count - number of bytes to receive with DMA.
|
||||
*
|
||||
* RETURN VALUE:
|
||||
* -
|
||||
*
|
||||
* COMMENTS: -
|
||||
=============================================================================*/
|
||||
void BSP_BTUART_AnounceDmaReceiverSize(unsigned long count);
|
||||
|
||||
/*=============================================================================
|
||||
* PURPOSE: Receiving on Bluetooth UART without receiver callback.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* buffer - pointer to buffer for received bytes.
|
||||
* maxCount - maximal number of bytes buffer can hold.
|
||||
* rxCount - output: pointer to number of received bytes.
|
||||
* timeout - timeout in msec, zero = wait forever.
|
||||
*
|
||||
* RETURN VALUE:
|
||||
* -
|
||||
*
|
||||
* COMMENTS: -
|
||||
=============================================================================*/
|
||||
void BSP_BTUART_Receive(unsigned char *buffer,
|
||||
unsigned long maxCount,
|
||||
unsigned long *rxCount,
|
||||
unsigned long timeout);
|
||||
|
||||
/*=============================================================================
|
||||
* PURPOSE: Draining bytes already received.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* -
|
||||
*
|
||||
* RETURN VALUE:
|
||||
* -
|
||||
*
|
||||
* COMMENTS: -
|
||||
=============================================================================*/
|
||||
void BSP_BTUART_DrainReceiver(void);
|
||||
|
||||
/*=============================================================================
|
||||
* PURPOSE: Enabling Bluetooth receiver callback.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* callbackFunc - receiver callback function.
|
||||
*
|
||||
* RETURN VALUE:
|
||||
* -
|
||||
*
|
||||
* COMMENTS: -
|
||||
=============================================================================*/
|
||||
void BSP_BTUART_EnableRxCallback(RxCallbackFunc callbackFunc);
|
||||
|
||||
/*=============================================================================
|
||||
* PURPOSE: Disabling Bluetooth receiver callback.
|
||||
*
|
||||
* PARAMETERS:
|
||||
* -
|
||||
*
|
||||
* RETURN VALUE:
|
||||
* -
|
||||
*
|
||||
* COMMENTS: -
|
||||
=============================================================================*/
|
||||
void BSP_BTUART_DisableRxCallback(void);
|
||||
|
||||
#endif /* BSP_BTUART_H */
|
@ -1,300 +0,0 @@
|
||||
/*=============================================================================
|
||||
* (C) Copyright Albis Technologies Ltd 2011
|
||||
*==============================================================================
|
||||
* STM32 Example Code
|
||||
*==============================================================================
|
||||
* File name: bsp_btuart_dma.c
|
||||
*
|
||||
* Notes: STM32 Bluetooth UART driver with DMA.
|
||||
*============================================================================*/
|
||||
|
||||
#include "bsp.h"
|
||||
#include "bsp_btuart.h"
|
||||
#include "bsp_debug.h"
|
||||
|
||||
#include "stm32f10x_dma.h"
|
||||
#include "stm32f10x_gpio.h"
|
||||
#include "stm32f10x_dma.h"
|
||||
#include "stm32f10x_usart.h"
|
||||
|
||||
DEFINE_THIS_FILE
|
||||
|
||||
/* OS version depending macros. */
|
||||
#define USE_OS_NO_ERROR OS_NO_ERR
|
||||
#define USE_OS_TIMEOUT OS_TIMEOUT
|
||||
#define USE_OS_Q_FULL OS_Q_FULL
|
||||
|
||||
/* PD2 is BT chipset reset. */
|
||||
#define BT_RESET_PIN (1UL << 2)
|
||||
|
||||
/* BT UART is USART2 (remapped). */
|
||||
#define BTUART_INST_IN_USE USART2
|
||||
|
||||
/* Convert msec to OS ticks. */
|
||||
#define MSEC_TO_TICKS(ms) \
|
||||
((ms > 0u) ? (((ms * OS_TICKS_PER_SEC) + 1000u - 1u) / 1000u) : 0u)
|
||||
|
||||
/* USART instance in use. */
|
||||
static USART_TypeDef *usartInst = 0;
|
||||
|
||||
/* UART receiver with callback. */
|
||||
static RxCallbackFunc rxCallbackFunc = 0;
|
||||
|
||||
/* DMA channels for Rx/Tx. */
|
||||
static OS_EVENT *dmaRxComplete = 0;
|
||||
static OS_EVENT *dmaTxComplete = 0;
|
||||
static DMA_Channel_TypeDef *dmaRx;
|
||||
static DMA_Channel_TypeDef *dmaTx;
|
||||
static unsigned long dmaRxDataLength;
|
||||
static unsigned char dmaRxData[1024];
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
static void isr_usart_rx_dma(void)
|
||||
{
|
||||
INT8U err;
|
||||
|
||||
DMA_ClearITPendingBit(DMA1_IT_TC6);
|
||||
DMA_Cmd(dmaRx, DISABLE);
|
||||
|
||||
if(rxCallbackFunc)
|
||||
{
|
||||
rxCallbackFunc(dmaRxData, dmaRxDataLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
err = OSSemPost(dmaRxComplete);
|
||||
SYS_ASSERT(err == USE_OS_NO_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
static void isr_usart_tx_dma(void)
|
||||
{
|
||||
INT8U err;
|
||||
|
||||
DMA_ClearITPendingBit(DMA1_IT_TC7);
|
||||
|
||||
err = OSSemPost(dmaTxComplete);
|
||||
SYS_ASSERT(err == USE_OS_NO_ERROR);
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void BSP_BTUART_Initialise(void)
|
||||
{
|
||||
DMA_InitTypeDef dmaInit;
|
||||
GPIO_InitTypeDef gpioInit;
|
||||
NVIC_InitTypeDef nvicInit;
|
||||
USART_ClockInitTypeDef usartClkInit;
|
||||
|
||||
/* UART instance in use. */
|
||||
usartInst = BTUART_INST_IN_USE;
|
||||
|
||||
/* DMA Rx/Tx complete. */
|
||||
dmaRxComplete = OSSemCreate(0);
|
||||
SYS_ASSERT(dmaRxComplete);
|
||||
dmaTxComplete = OSSemCreate(0);
|
||||
SYS_ASSERT(dmaTxComplete);
|
||||
|
||||
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE);
|
||||
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE);
|
||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD, ENABLE);
|
||||
|
||||
/* Common DMA channel settings. */
|
||||
DMA_StructInit(&dmaInit);
|
||||
dmaInit.DMA_PeripheralBaseAddr = (unsigned long)&usartInst->DR;
|
||||
dmaInit.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
|
||||
dmaInit.DMA_MemoryInc = DMA_MemoryInc_Enable;
|
||||
dmaInit.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;
|
||||
dmaInit.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;
|
||||
dmaInit.DMA_Mode = DMA_Mode_Normal;
|
||||
dmaInit.DMA_M2M = DMA_M2M_Disable;
|
||||
dmaInit.DMA_BufferSize = 1;
|
||||
|
||||
/* Init DMA Tx channel MEM -> USART. */
|
||||
dmaTx = DMA1_Channel7;
|
||||
dmaInit.DMA_Priority = DMA_Priority_Low;
|
||||
dmaInit.DMA_DIR = DMA_DIR_PeripheralDST;
|
||||
BSP_IntVectSet(BSP_INT_ID_DMA1_CH7, isr_usart_tx_dma);
|
||||
DMA_Init(dmaTx, &dmaInit);
|
||||
DMA_ITConfig(dmaTx, DMA_IT_TC, ENABLE);
|
||||
USART_DMACmd(usartInst, USART_DMAReq_Tx, ENABLE);
|
||||
|
||||
/* Init DMA Rx channel USART -> MEM. */
|
||||
dmaRx = DMA1_Channel6;
|
||||
dmaInit.DMA_Priority = DMA_Priority_Medium;
|
||||
dmaInit.DMA_DIR = DMA_DIR_PeripheralSRC;
|
||||
BSP_IntVectSet(BSP_INT_ID_DMA1_CH6, isr_usart_rx_dma);
|
||||
DMA_Init(dmaRx, &dmaInit);
|
||||
DMA_ITConfig(dmaRx, DMA_IT_TC, ENABLE);
|
||||
USART_DMACmd(usartInst, USART_DMAReq_Rx, ENABLE);
|
||||
|
||||
nvicInit.NVIC_IRQChannelPreemptionPriority = 0;
|
||||
nvicInit.NVIC_IRQChannelSubPriority = 0;
|
||||
nvicInit.NVIC_IRQChannelCmd = ENABLE;
|
||||
|
||||
nvicInit.NVIC_IRQChannel = DMA1_Channel6_IRQn;
|
||||
NVIC_Init(&nvicInit);
|
||||
|
||||
nvicInit.NVIC_IRQChannel = DMA1_Channel7_IRQn;
|
||||
NVIC_Init(&nvicInit);
|
||||
|
||||
USART_ClockStructInit(&usartClkInit);
|
||||
usartClkInit.USART_Clock = USART_Clock_Disable;
|
||||
usartClkInit.USART_CPOL = USART_CPOL_Low;
|
||||
usartClkInit.USART_CPHA = USART_CPHA_2Edge;
|
||||
usartClkInit.USART_LastBit = USART_LastBit_Disable;
|
||||
|
||||
BSP_PeriphEn(BSP_PERIPH_ID_USART2);
|
||||
|
||||
BSP_PeriphEn(BSP_PERIPH_ID_IOPD);
|
||||
BSP_PeriphEn(BSP_PERIPH_ID_AFIO);
|
||||
GPIO_PinRemapConfig(GPIO_Remap_USART2, ENABLE);
|
||||
|
||||
/* Configure GPIOD.5 (TX) as push-pull. */
|
||||
gpioInit.GPIO_Pin = GPIO_Pin_5;
|
||||
gpioInit.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
gpioInit.GPIO_Mode = GPIO_Mode_AF_PP;
|
||||
GPIO_Init(GPIOD, &gpioInit);
|
||||
|
||||
/* Configure GPIOD.4 (RTS) as push-pull. */
|
||||
gpioInit.GPIO_Pin = GPIO_Pin_4;
|
||||
gpioInit.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
gpioInit.GPIO_Mode = GPIO_Mode_AF_PP;
|
||||
GPIO_Init(GPIOD, &gpioInit);
|
||||
|
||||
/* Configure GPIOD.6 (RX) as input floating. */
|
||||
gpioInit.GPIO_Pin = GPIO_Pin_6;
|
||||
gpioInit.GPIO_Mode = GPIO_Mode_IN_FLOATING;
|
||||
GPIO_Init(GPIOD, &gpioInit);
|
||||
|
||||
/* Configure GPIOD.3 (CTS) as input floating. */
|
||||
gpioInit.GPIO_Pin = GPIO_Pin_3;
|
||||
gpioInit.GPIO_Mode = GPIO_Mode_IN_FLOATING;
|
||||
GPIO_Init(GPIOD, &gpioInit);
|
||||
|
||||
BSP_BTUART_SetBaudrate(115200);
|
||||
USART_ClockInit(usartInst, &usartClkInit);
|
||||
USART_Cmd(usartInst, ENABLE);
|
||||
|
||||
/* GPO for BT chipset reset. */
|
||||
gpioInit.GPIO_Pin = BT_RESET_PIN;
|
||||
gpioInit.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
gpioInit.GPIO_Mode = GPIO_Mode_Out_PP;
|
||||
GPIO_Init(GPIOD, &gpioInit);
|
||||
|
||||
BSP_BTUART_ActivateReset();
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void BSP_BTUART_SetBaudrate(unsigned long baudrate)
|
||||
{
|
||||
USART_InitTypeDef usartInit;
|
||||
|
||||
USART_StructInit(&usartInit);
|
||||
usartInit.USART_BaudRate = baudrate / 2;
|
||||
usartInit.USART_WordLength = USART_WordLength_8b;
|
||||
usartInit.USART_StopBits = USART_StopBits_1;
|
||||
usartInit.USART_Parity = USART_Parity_No;
|
||||
usartInit.USART_HardwareFlowControl = USART_HardwareFlowControl_RTS_CTS;
|
||||
usartInit.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
|
||||
|
||||
USART_Init(usartInst, &usartInit);
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void BSP_BTUART_ActivateReset(void)
|
||||
{
|
||||
GPIO_ResetBits(GPIOD, BT_RESET_PIN);
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void BSP_BTUART_DeactivateReset(void)
|
||||
{
|
||||
GPIO_SetBits(GPIOD, BT_RESET_PIN);
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void BSP_BTUART_Transmit(unsigned char *buffer, unsigned long count)
|
||||
{
|
||||
INT8U err;
|
||||
|
||||
dmaTx->CMAR = (unsigned long)buffer;
|
||||
dmaTx->CNDTR = count;
|
||||
|
||||
DMA_Cmd(dmaTx, ENABLE);
|
||||
|
||||
OSSemPend(dmaTxComplete, MSEC_TO_TICKS(2000), &err);
|
||||
if(err == USE_OS_TIMEOUT)
|
||||
{
|
||||
DMA_Cmd(dmaTx, DISABLE);
|
||||
return;
|
||||
}
|
||||
SYS_ASSERT(err == USE_OS_NO_ERROR);
|
||||
|
||||
DMA_Cmd(dmaTx, DISABLE);
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void BSP_BTUART_AnounceDmaReceiverSize(unsigned long count)
|
||||
{
|
||||
dmaRx->CMAR = (unsigned long)(&dmaRxData[0]);
|
||||
dmaRx->CNDTR = count;
|
||||
dmaRxDataLength = count;
|
||||
|
||||
DMA_Cmd(dmaRx, ENABLE);
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void BSP_BTUART_Receive(unsigned char *buffer,
|
||||
unsigned long maxCount,
|
||||
unsigned long *rxCount,
|
||||
unsigned long timeout)
|
||||
{
|
||||
INT8U err;
|
||||
unsigned short timeoutTicks = MSEC_TO_TICKS(timeout);
|
||||
|
||||
rxCallbackFunc = 0;
|
||||
|
||||
BSP_BTUART_AnounceDmaReceiverSize(maxCount);
|
||||
|
||||
OSSemPend(dmaRxComplete, timeoutTicks, &err);
|
||||
if(err == USE_OS_TIMEOUT)
|
||||
{
|
||||
*rxCount = 0;
|
||||
return;
|
||||
}
|
||||
SYS_ASSERT(err == USE_OS_NO_ERROR);
|
||||
|
||||
Mem_Copy(buffer, dmaRxData, dmaRxDataLength);
|
||||
*rxCount = dmaRxDataLength;
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void BSP_BTUART_DrainReceiver(void)
|
||||
{
|
||||
/* Nothing to do. */
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void BSP_BTUART_EnableRxCallback(RxCallbackFunc callbackFunc)
|
||||
{
|
||||
rxCallbackFunc = callbackFunc;
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void BSP_BTUART_DisableRxCallback(void)
|
||||
{
|
||||
rxCallbackFunc = 0;
|
||||
}
|
@ -1,270 +0,0 @@
|
||||
/*=============================================================================
|
||||
* (C) Copyright Albis Technologies Ltd 2011
|
||||
*==============================================================================
|
||||
* STM32 Example Code
|
||||
*==============================================================================
|
||||
* File name: bsp_btuart_nodma.c
|
||||
*
|
||||
* Notes: STM32 Bluetooth UART driver without DMA.
|
||||
*============================================================================*/
|
||||
|
||||
#include "bsp.h"
|
||||
#include "bsp_btuart.h"
|
||||
#include "bsp_debug.h"
|
||||
|
||||
#include "stm32f10x_gpio.h"
|
||||
#include "stm32f10x_usart.h"
|
||||
|
||||
DEFINE_THIS_FILE
|
||||
|
||||
/* OS version depending macros. */
|
||||
#define USE_OS_NO_ERROR OS_NO_ERR
|
||||
#define USE_OS_TIMEOUT OS_TIMEOUT
|
||||
#define USE_OS_Q_FULL OS_Q_FULL
|
||||
|
||||
/* PD2 is BT chipset reset. */
|
||||
#define BT_RESET_PIN (1UL << 2)
|
||||
|
||||
/* BT UART is USART2 (remapped). */
|
||||
#define BTUART_INST_IN_USE USART2
|
||||
|
||||
/* Convert msec to OS ticks. */
|
||||
#define MSEC_TO_TICKS(ms) \
|
||||
((ms > 0u) ? (((ms * OS_TICKS_PER_SEC) + 1000u - 1u) / 1000u) : 0u)
|
||||
|
||||
/* USART instance in use. */
|
||||
static USART_TypeDef *usartInst = 0;
|
||||
|
||||
/* UART receiver without callback. */
|
||||
#define RX_QUEUE_BUFFER_SIZE 512
|
||||
static OS_EVENT *rxQueue = 0;
|
||||
static void * rxQueueBuffer[RX_QUEUE_BUFFER_SIZE];
|
||||
|
||||
/* UART receiver with callback. */
|
||||
static RxCallbackFunc rxCallbackFunc = 0;
|
||||
|
||||
//=============================================================================
|
||||
//=============================================================================
|
||||
static void isr_bluetooth_usart(void)
|
||||
{
|
||||
INT8U err;
|
||||
CPU_INT32U rxData;
|
||||
|
||||
if(USART_GetITStatus(usartInst, USART_IT_RXNE) != RESET)
|
||||
{
|
||||
rxData = USART_ReceiveData(usartInst) & 0xff;
|
||||
|
||||
if(rxCallbackFunc)
|
||||
{
|
||||
rxCallbackFunc((unsigned char *)&rxData, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
err = OSQPost(rxQueue, (void *)rxData);
|
||||
if(err == USE_OS_NO_ERROR)
|
||||
{
|
||||
// Ok.
|
||||
}
|
||||
else if(err == USE_OS_Q_FULL)
|
||||
{
|
||||
printos("Tossing BT data!\r\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
SYS_ERROR(1);
|
||||
}
|
||||
}
|
||||
|
||||
USART_ClearITPendingBit(usartInst, USART_IT_RXNE);
|
||||
}
|
||||
else
|
||||
{
|
||||
SYS_ERROR(1);
|
||||
}
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void BSP_BTUART_Initialise(void)
|
||||
{
|
||||
GPIO_InitTypeDef gpioInit;
|
||||
USART_ClockInitTypeDef usartClkInit;
|
||||
|
||||
/* UART instance in use. */
|
||||
usartInst = BTUART_INST_IN_USE;
|
||||
|
||||
/* Create Rx queue. */
|
||||
rxQueue = OSQCreate(rxQueueBuffer, RX_QUEUE_BUFFER_SIZE);
|
||||
SYS_ASSERT(rxQueue);
|
||||
|
||||
USART_ClockStructInit(&usartClkInit);
|
||||
usartClkInit.USART_Clock = USART_Clock_Disable;
|
||||
usartClkInit.USART_CPOL = USART_CPOL_Low;
|
||||
usartClkInit.USART_CPHA = USART_CPHA_2Edge;
|
||||
usartClkInit.USART_LastBit = USART_LastBit_Disable;
|
||||
|
||||
RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE);
|
||||
BSP_PeriphEn(BSP_PERIPH_ID_USART2);
|
||||
|
||||
BSP_PeriphEn(BSP_PERIPH_ID_IOPD);
|
||||
BSP_PeriphEn(BSP_PERIPH_ID_AFIO);
|
||||
GPIO_PinRemapConfig(GPIO_Remap_USART2, ENABLE);
|
||||
|
||||
/* Configure GPIOD.5 (TX) as push-pull. */
|
||||
gpioInit.GPIO_Pin = GPIO_Pin_5;
|
||||
gpioInit.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
gpioInit.GPIO_Mode = GPIO_Mode_AF_PP;
|
||||
GPIO_Init(GPIOD, &gpioInit);
|
||||
|
||||
/* Configure GPIOD.4 (RTS) as push-pull. */
|
||||
gpioInit.GPIO_Pin = GPIO_Pin_4;
|
||||
gpioInit.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
gpioInit.GPIO_Mode = GPIO_Mode_AF_PP;
|
||||
GPIO_Init(GPIOD, &gpioInit);
|
||||
|
||||
/* Configure GPIOD.6 (RX) as input floating. */
|
||||
gpioInit.GPIO_Pin = GPIO_Pin_6;
|
||||
gpioInit.GPIO_Mode = GPIO_Mode_IN_FLOATING;
|
||||
GPIO_Init(GPIOD, &gpioInit);
|
||||
|
||||
/* Configure GPIOD.3 (CTS) as input floating. */
|
||||
gpioInit.GPIO_Pin = GPIO_Pin_3;
|
||||
gpioInit.GPIO_Mode = GPIO_Mode_IN_FLOATING;
|
||||
GPIO_Init(GPIOD, &gpioInit);
|
||||
|
||||
BSP_BTUART_SetBaudrate(115200);
|
||||
USART_ClockInit(usartInst, &usartClkInit);
|
||||
USART_Cmd(usartInst, ENABLE);
|
||||
|
||||
BSP_IntVectSet(BSP_INT_ID_USART2, isr_bluetooth_usart);
|
||||
BSP_IntEn(BSP_INT_ID_USART2);
|
||||
USART_ITConfig(usartInst, USART_IT_RXNE, ENABLE);
|
||||
|
||||
/* GPO for BT chipset reset. */
|
||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD, ENABLE);
|
||||
gpioInit.GPIO_Pin = BT_RESET_PIN;
|
||||
gpioInit.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
gpioInit.GPIO_Mode = GPIO_Mode_Out_PP;
|
||||
GPIO_Init(GPIOD, &gpioInit);
|
||||
|
||||
BSP_BTUART_ActivateReset();
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void BSP_BTUART_SetBaudrate(unsigned long baudrate)
|
||||
{
|
||||
USART_InitTypeDef usartInit;
|
||||
|
||||
USART_StructInit(&usartInit);
|
||||
usartInit.USART_BaudRate = baudrate / 2;
|
||||
usartInit.USART_WordLength = USART_WordLength_8b;
|
||||
usartInit.USART_StopBits = USART_StopBits_1;
|
||||
usartInit.USART_Parity = USART_Parity_No;
|
||||
usartInit.USART_HardwareFlowControl = USART_HardwareFlowControl_RTS_CTS;
|
||||
usartInit.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
|
||||
|
||||
USART_Init(usartInst, &usartInit);
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void BSP_BTUART_ActivateReset(void)
|
||||
{
|
||||
GPIO_ResetBits(GPIOD, BT_RESET_PIN);
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void BSP_BTUART_DeactivateReset(void)
|
||||
{
|
||||
GPIO_SetBits(GPIOD, BT_RESET_PIN);
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void BSP_BTUART_Transmit(unsigned char *buffer, unsigned long count)
|
||||
{
|
||||
unsigned long i;
|
||||
|
||||
for(i = 0; i < count; ++i)
|
||||
{
|
||||
while(USART_GetFlagStatus(usartInst, USART_FLAG_TXE) != SET);
|
||||
USART_SendData(usartInst, buffer[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void BSP_BTUART_AnounceDmaReceiverSize(unsigned long count)
|
||||
{
|
||||
/* Nothing to do: no DMA. */
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void BSP_BTUART_Receive(unsigned char *buffer,
|
||||
unsigned long maxCount,
|
||||
unsigned long *rxCount,
|
||||
unsigned long timeout)
|
||||
{
|
||||
INT8U err;
|
||||
void *event = 0;
|
||||
unsigned long rxCounter = 0;
|
||||
unsigned short timeoutTicks = MSEC_TO_TICKS(timeout);
|
||||
|
||||
for(;;)
|
||||
{
|
||||
event = OSQPend(rxQueue, timeoutTicks, &err);
|
||||
|
||||
if(err == USE_OS_NO_ERROR)
|
||||
{
|
||||
buffer[rxCounter++] = (unsigned char)(unsigned long)event;
|
||||
|
||||
if(rxCounter >= maxCount)
|
||||
{
|
||||
// Received expected number of bytes.
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(err == USE_OS_TIMEOUT)
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
SYS_ERROR(1);
|
||||
}
|
||||
}
|
||||
|
||||
if(rxCount)
|
||||
{
|
||||
*rxCount = rxCounter;
|
||||
}
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void BSP_BTUART_DrainReceiver(void)
|
||||
{
|
||||
INT8U err;
|
||||
|
||||
do
|
||||
{
|
||||
OSQPend(rxQueue, 1, &err);
|
||||
} while(err == OS_ERR_NONE);
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void BSP_BTUART_EnableRxCallback(RxCallbackFunc callbackFunc)
|
||||
{
|
||||
rxCallbackFunc = callbackFunc;
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void BSP_BTUART_DisableRxCallback(void)
|
||||
{
|
||||
rxCallbackFunc = 0;
|
||||
}
|
@ -1,375 +0,0 @@
|
||||
/*=============================================================================
|
||||
* (C) Copyright Albis Technologies Ltd 2011
|
||||
*==============================================================================
|
||||
* STM32 Example Code
|
||||
*==============================================================================
|
||||
* File name: bsp_debug.c
|
||||
*
|
||||
* Notes: STM32 evaluation board UM0780 debug utilities BSP.
|
||||
*============================================================================*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "bsp.h"
|
||||
#include "bsp_debug.h"
|
||||
#include "T32_Term.h"
|
||||
|
||||
#include "stm32f10x_gpio.h"
|
||||
#include "stm32f10x_usart.h"
|
||||
|
||||
#define DEBUG_T32_TERM_IN_USE 0
|
||||
|
||||
#define DEBUG_UART_IN_USE 0
|
||||
#define UART_2_REMAP 1
|
||||
|
||||
#define DEBUG_UART_1 1
|
||||
#define DEBUG_UART_2 2
|
||||
#define DEBUG_UART_3 3
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
static void writeByteSerialPort(const char b)
|
||||
{
|
||||
#if(DEBUG_UART_IN_USE == DEBUG_UART_1)
|
||||
while(USART_GetFlagStatus(USART1, USART_FLAG_TXE) != SET);
|
||||
USART_SendData(USART1, b);
|
||||
#endif
|
||||
|
||||
#if(DEBUG_UART_IN_USE == DEBUG_UART_2)
|
||||
while(USART_GetFlagStatus(USART2, USART_FLAG_TXE) != SET);
|
||||
USART_SendData(USART2, b);
|
||||
#endif
|
||||
|
||||
#if(DEBUG_UART_IN_USE == DEBUG_UART_3)
|
||||
while(USART_GetFlagStatus(USART3, USART_FLAG_TXE) != SET);
|
||||
USART_SendData(USART3, b);
|
||||
#endif
|
||||
|
||||
#if(DEBUG_T32_TERM_IN_USE > 0)
|
||||
while(T32_Term_TXStatus(t32_termport) != 0);
|
||||
T32_Term_Put(t32_termport, b);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
static void writeStringSerialPort(const char *s)
|
||||
{
|
||||
int total = 0;
|
||||
|
||||
while(s[total])
|
||||
{
|
||||
writeByteSerialPort(s[total++]);
|
||||
}
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
static void dbgOutNumHex(unsigned long n, long depth)
|
||||
{
|
||||
if(depth)
|
||||
{
|
||||
depth--;
|
||||
}
|
||||
|
||||
if((n & ~0xf) || depth)
|
||||
{
|
||||
dbgOutNumHex(n >> 4, depth);
|
||||
n &= 0xf;
|
||||
}
|
||||
|
||||
if(n < 10)
|
||||
{
|
||||
writeByteSerialPort((unsigned char)(n + '0'));
|
||||
}
|
||||
else
|
||||
{
|
||||
writeByteSerialPort((unsigned char)(n - 10 + 'A'));
|
||||
}
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
static void dbgOutNumDecimal(unsigned long n)
|
||||
{
|
||||
if(n >= 10)
|
||||
{
|
||||
dbgOutNumDecimal(n / 10);
|
||||
n %= 10;
|
||||
}
|
||||
writeByteSerialPort((unsigned char)(n + '0'));
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void initSerialDebug(void)
|
||||
{
|
||||
#if(DEBUG_UART_IN_USE > 0)
|
||||
GPIO_InitTypeDef gpio_init;
|
||||
USART_InitTypeDef usart_init;
|
||||
USART_ClockInitTypeDef usart_clk_init;
|
||||
|
||||
/* ----------------- INIT USART STRUCT ---------------- */
|
||||
usart_init.USART_BaudRate = 115200 / 2;
|
||||
usart_init.USART_WordLength = USART_WordLength_8b;
|
||||
usart_init.USART_StopBits = USART_StopBits_1;
|
||||
usart_init.USART_Parity = USART_Parity_No;
|
||||
usart_init.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
|
||||
usart_init.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
|
||||
|
||||
usart_clk_init.USART_Clock = USART_Clock_Disable;
|
||||
usart_clk_init.USART_CPOL = USART_CPOL_Low;
|
||||
usart_clk_init.USART_CPHA = USART_CPHA_2Edge;
|
||||
usart_clk_init.USART_LastBit = USART_LastBit_Disable;
|
||||
|
||||
#if(DEBUG_UART_IN_USE == DEBUG_UART_1)
|
||||
BSP_PeriphEn(BSP_PERIPH_ID_USART1);
|
||||
|
||||
/* ----------------- SETUP USART1 GPIO ---------------- */
|
||||
#if(UART_1_REMAP > 0)
|
||||
BSP_PeriphEn(BSP_PERIPH_ID_IOPB);
|
||||
BSP_PeriphEn(BSP_PERIPH_ID_IOPD);
|
||||
BSP_PeriphEn(BSP_PERIPH_ID_AFIO);
|
||||
GPIO_PinRemapConfig(GPIO_Remap_USART1, ENABLE);
|
||||
|
||||
/* Configure GPIOB.6 as push-pull. */
|
||||
gpio_init.GPIO_Pin = GPIO_Pin_6;
|
||||
gpio_init.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
gpio_init.GPIO_Mode = GPIO_Mode_AF_PP;
|
||||
GPIO_Init(GPIOB, &gpio_init);
|
||||
|
||||
/* Configure GPIOB.7 as input floating. */
|
||||
gpio_init.GPIO_Pin = GPIO_Pin_7;
|
||||
gpio_init.GPIO_Mode = GPIO_Mode_IN_FLOATING;
|
||||
GPIO_Init(GPIOB, &gpio_init);
|
||||
#else
|
||||
BSP_PeriphEn(BSP_PERIPH_ID_IOPA);
|
||||
|
||||
/* Configure GPIOA.9 as push-pull. */
|
||||
gpio_init.GPIO_Pin = GPIO_Pin_9;
|
||||
gpio_init.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
gpio_init.GPIO_Mode = GPIO_Mode_AF_PP;
|
||||
GPIO_Init(GPIOA, &gpio_init);
|
||||
|
||||
/* Configure GPIOA.10 as input floating. */
|
||||
gpio_init.GPIO_Pin = GPIO_Pin_10;
|
||||
gpio_init.GPIO_Mode = GPIO_Mode_IN_FLOATING;
|
||||
GPIO_Init(GPIOA, &gpio_init);
|
||||
#endif /* UART_1_REMAP */
|
||||
|
||||
/* ------------------ SETUP USART1 -------------------- */
|
||||
USART_Init(USART1, &usart_init);
|
||||
USART_ClockInit(USART1, &usart_clk_init);
|
||||
USART_Cmd(USART1, ENABLE);
|
||||
|
||||
#ifdef UART_IRQ
|
||||
BSP_IntVectSet(BSP_INT_ID_USART1, debug_uart_isr);
|
||||
BSP_IntEn(BSP_INT_ID_USART1);
|
||||
#endif /* UART_IRQ */
|
||||
#endif /* DEBUG_UART_1 */
|
||||
|
||||
#if(DEBUG_UART_IN_USE == DEBUG_UART_2)
|
||||
BSP_PeriphEn(BSP_PERIPH_ID_USART2);
|
||||
|
||||
/* ----------------- SETUP USART2 GPIO ---------------- */
|
||||
#if(UART_2_REMAP > 0)
|
||||
BSP_PeriphEn(BSP_PERIPH_ID_IOPD);
|
||||
BSP_PeriphEn(BSP_PERIPH_ID_AFIO);
|
||||
GPIO_PinRemapConfig(GPIO_Remap_USART2, ENABLE);
|
||||
|
||||
/* Configure GPIOD.5 as push-pull. */
|
||||
gpio_init.GPIO_Pin = GPIO_Pin_5;
|
||||
gpio_init.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
gpio_init.GPIO_Mode = GPIO_Mode_AF_PP;
|
||||
GPIO_Init(GPIOD, &gpio_init);
|
||||
|
||||
/* Configure GPIOD.6 as input floating. */
|
||||
gpio_init.GPIO_Pin = GPIO_Pin_6;
|
||||
gpio_init.GPIO_Mode = GPIO_Mode_IN_FLOATING;
|
||||
GPIO_Init(GPIOD, &gpio_init);
|
||||
#else
|
||||
BSP_PeriphEn(BSP_PERIPH_ID_IOPA);
|
||||
|
||||
/* Configure GPIOA.2 as push-pull. */
|
||||
gpio_init.GPIO_Pin = GPIO_Pin_2;
|
||||
gpio_init.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
gpio_init.GPIO_Mode = GPIO_Mode_AF_PP;
|
||||
GPIO_Init(GPIOA, &gpio_init);
|
||||
|
||||
/* Configure GPIOA.3 as input floating. */
|
||||
gpio_init.GPIO_Pin = GPIO_Pin_3;
|
||||
gpio_init.GPIO_Mode = GPIO_Mode_IN_FLOATING;
|
||||
GPIO_Init(GPIOA, &gpio_init);
|
||||
#endif /* UART_2_REMAP */
|
||||
|
||||
/* ------------------ SETUP USART2 -------------------- */
|
||||
USART_Init(USART2, &usart_init);
|
||||
USART_ClockInit(USART2, &usart_clk_init);
|
||||
USART_Cmd(USART2, ENABLE);
|
||||
|
||||
#ifdef UART_IRQ
|
||||
BSP_IntVectSet(BSP_INT_ID_USART2, debug_uart_isr);
|
||||
BSP_IntEn(BSP_INT_ID_USART2);
|
||||
#endif /* UART_IRQ */
|
||||
#endif /* DEBUG_UART_2 */
|
||||
|
||||
#if(DEBUG_UART_IN_USE == DEBUG_UART_3)
|
||||
BSP_PeriphEn(BSP_PERIPH_ID_USART3);
|
||||
|
||||
/* ----------------- SETUP USART3 GPIO ---------------- */
|
||||
#if(UART_3_REMAP_PARTIAL > 0)
|
||||
BSP_PeriphEn(BSP_PERIPH_ID_IOPC);
|
||||
BSP_PeriphEn(BSP_PERIPH_ID_AFIO);
|
||||
GPIO_PinRemapConfig(GPIO_PartialRemap_USART3, ENABLE);
|
||||
|
||||
/* Configure GPIOC.10 as push-pull. */
|
||||
gpio_init.GPIO_Pin = GPIO_Pin_10;
|
||||
gpio_init.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
gpio_init.GPIO_Mode = GPIO_Mode_AF_PP;
|
||||
GPIO_Init(GPIOC, &gpio_init);
|
||||
|
||||
/* Configure GPIOC.11 as input floating. */
|
||||
gpio_init.GPIO_Pin = GPIO_Pin_11;
|
||||
gpio_init.GPIO_Mode = GPIO_Mode_IN_FLOATING;
|
||||
GPIO_Init(GPIOC, &gpio_init);
|
||||
|
||||
#elif(UART_3_REMAP_FULL > 0)
|
||||
BSP_PeriphEn(BSP_PERIPH_ID_IOPD);
|
||||
BSP_PeriphEn(BSP_PERIPH_ID_AFIO);
|
||||
GPIO_PinRemapConfig(GPIO_FullRemap_USART3, ENABLE);
|
||||
|
||||
/* Configure GPIOD.8 as push-pull. */
|
||||
gpio_init.GPIO_Pin = GPIO_Pin_8;
|
||||
gpio_init.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
gpio_init.GPIO_Mode = GPIO_Mode_AF_PP;
|
||||
GPIO_Init(GPIOD, &gpio_init);
|
||||
|
||||
/* Configure GPIOD.9 as input floating. */
|
||||
gpio_init.GPIO_Pin = GPIO_Pin_9;
|
||||
gpio_init.GPIO_Mode = GPIO_Mode_IN_FLOATING;
|
||||
GPIO_Init(GPIOD, &gpio_init);
|
||||
|
||||
#else
|
||||
BSP_PeriphEn(BSP_PERIPH_ID_IOPB);
|
||||
|
||||
/* Configure GPIOB.10 as push-pull. */
|
||||
gpio_init.GPIO_Pin = GPIO_Pin_10;
|
||||
gpio_init.GPIO_Speed = GPIO_Speed_50MHz;
|
||||
gpio_init.GPIO_Mode = GPIO_Mode_AF_PP;
|
||||
GPIO_Init(GPIOB, &gpio_init);
|
||||
|
||||
/* Configure GPIOB.11 as input floating. */
|
||||
gpio_init.GPIO_Pin = GPIO_Pin_11;
|
||||
gpio_init.GPIO_Mode = GPIO_Mode_IN_FLOATING;
|
||||
GPIO_Init(GPIOB, &gpio_init);
|
||||
#endif /* UART_3_REMAP_FULL */
|
||||
|
||||
/* ------------------ SETUP USART3 -------------------- */
|
||||
USART_Init(USART3, &usart_init);
|
||||
USART_ClockInit(USART3, &usart_clk_init);
|
||||
USART_Cmd(USART3, ENABLE);
|
||||
|
||||
#ifdef UART_IRQ
|
||||
BSP_IntVectSet(BSP_INT_ID_USART3, debug_uart_isr);
|
||||
BSP_IntEn(BSP_INT_ID_USART3);
|
||||
#endif /* UART_IRQ */
|
||||
#endif /* DEBUG_UART_3 */
|
||||
#endif /* DEBUG_UART_IN_USE */
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void printos(const char *sz, ...)
|
||||
{
|
||||
unsigned char c;
|
||||
va_list vl;
|
||||
|
||||
va_start(vl, sz);
|
||||
|
||||
while (*sz)
|
||||
{
|
||||
c = *sz++;
|
||||
switch (c)
|
||||
{
|
||||
case '%':
|
||||
c = *sz++;
|
||||
switch (c) {
|
||||
case 'x':
|
||||
dbgOutNumHex(va_arg(vl, unsigned long), 0);
|
||||
break;
|
||||
case 'B':
|
||||
dbgOutNumHex(va_arg(vl, unsigned long), 2);
|
||||
break;
|
||||
case 'H':
|
||||
dbgOutNumHex(va_arg(vl, unsigned long), 4);
|
||||
break;
|
||||
case 'X':
|
||||
dbgOutNumHex(va_arg(vl, unsigned long), 8);
|
||||
break;
|
||||
case 'd':
|
||||
{
|
||||
long l;
|
||||
|
||||
l = va_arg(vl, long);
|
||||
if (l < 0) {
|
||||
writeByteSerialPort('-');
|
||||
l = - l;
|
||||
}
|
||||
dbgOutNumDecimal((unsigned long)l);
|
||||
}
|
||||
break;
|
||||
case 'u':
|
||||
dbgOutNumDecimal(va_arg(vl, unsigned long));
|
||||
break;
|
||||
case 's':
|
||||
writeStringSerialPort(va_arg(vl, char *));
|
||||
break;
|
||||
case '%':
|
||||
writeByteSerialPort('%');
|
||||
break;
|
||||
case 'c':
|
||||
c = (unsigned char)va_arg(vl, unsigned int);
|
||||
writeByteSerialPort(c);
|
||||
break;
|
||||
|
||||
default:
|
||||
writeByteSerialPort(' ');
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case '\r':
|
||||
if (*sz == '\n')
|
||||
sz ++;
|
||||
c = '\n';
|
||||
/* fall through */
|
||||
case '\n':
|
||||
writeByteSerialPort('\r');
|
||||
/* fall through */
|
||||
default:
|
||||
writeByteSerialPort(c);
|
||||
}
|
||||
}
|
||||
|
||||
va_end(vl);
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void restartSystem(void)
|
||||
{
|
||||
BSP_LED_On(3);
|
||||
|
||||
/* TODO */
|
||||
for(;;);
|
||||
}
|
||||
|
||||
/*=============================================================================
|
||||
=============================================================================*/
|
||||
void fatalErrorHandler(const int reset,
|
||||
const char *fileName,
|
||||
unsigned short lineNumber)
|
||||
{
|
||||
printos("\r\nFATAL SW ERROR IN %s at %d!\r\n", fileName, lineNumber);
|
||||
|
||||
restartSystem();
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
/*=============================================================================
|
||||
* (C) Copyright Albis Technologies Ltd 2011
|
||||
*==============================================================================
|
||||
* STM32 Example Code
|
||||
*==============================================================================
|
||||
* File name: bsp_debug.h
|
||||
*
|
||||
* Notes: STM32 evaluation board UM0780 debug utilities BSP.
|
||||
*============================================================================*/
|
||||
|
||||
#ifndef BSP_DEBUG_H
|
||||
#define BSP_DEBUG_H
|
||||
|
||||
void fatalErrorHandler(const int reset,
|
||||
const char *fileName,
|
||||
unsigned short lineNumber);
|
||||
|
||||
// Whether or not source code file names are revealed.
|
||||
#define REVEAL_SOURCE_FILE_NAMES 1
|
||||
|
||||
#if (REVEAL_SOURCE_FILE_NAMES == 1)
|
||||
#define DEFINE_THIS_FILE static char const _this_file_name_[] = __FILE__;
|
||||
#else
|
||||
#define DEFINE_THIS_FILE static char const _this_file_name_[] = "***";
|
||||
#endif // REVEAL_SOURCE_FILE_NAMES
|
||||
|
||||
#define SYS_ERROR(reset) fatalErrorHandler(reset, \
|
||||
_this_file_name_, \
|
||||
__LINE__)
|
||||
|
||||
#define SYS_ASSERT(cond) if(!(cond)) { SYS_ERROR(1); }
|
||||
|
||||
void initSerialDebug(void);
|
||||
|
||||
void printos(const char *sz, ...);
|
||||
|
||||
void restartSystem(void);
|
||||
|
||||
#endif // BSP_DEBUG_H
|
Loading…
x
Reference in New Issue
Block a user