From ceeb99ef2ccb5f207d54844729c23a664ce3cfaa Mon Sep 17 00:00:00 2001 From: Haq Date: Mon, 9 Jan 2017 14:40:14 -0800 Subject: [PATCH 01/19] fixed memcpy typo in simple_peripheral_observer --- .../cc26xx/app/simple_peripheral_observer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/examples/simple_peripheral_observer/cc26xx/app/simple_peripheral_observer.c b/src/examples/simple_peripheral_observer/cc26xx/app/simple_peripheral_observer.c index c89b1eb..a802282 100644 --- a/src/examples/simple_peripheral_observer/cc26xx/app/simple_peripheral_observer.c +++ b/src/examples/simple_peripheral_observer/cc26xx/app/simple_peripheral_observer.c @@ -1144,7 +1144,7 @@ static void SimpleBLEPeripheral_ObserverStateChangeCB(gapPeripheralObserverRoleE memcpy(pDevDiscMsg, pEvent, sizeof(gapDevDiscEvent_t)); pDevDiscMsg->pDevList = ICall_malloc((pEvent->discCmpl.numDevs)*sizeof(gapDevRec_t)); - memcpy(pDevDiscMsg->pDevList, pEvent->discCmpl.pDevList, sizeof((pEvent->discCmpl.numDevs)*sizeof(gapDevRec_t))); + memcpy(pDevDiscMsg->pDevList, pEvent->discCmpl.pDevList, (pEvent->discCmpl.numDevs)*sizeof(gapDevRec_t)); pMsg->pData = (uint8 *)pDevDiscMsg; } From f08ce72f818d7b58004433eb0e718c125f0c9794 Mon Sep 17 00:00:00 2001 From: Sean Lyons Date: Wed, 18 Jan 2017 11:25:53 -0600 Subject: [PATCH 02/19] Merge pull request #26 in SA/ble_examples from feature/simple_central_lp to ble_examples-2.2 Squashed commit of the following: commit e1291c377e56b64df4bb08eb3af6cd5ec7c133db Author: Sean Lyons Date: Wed Jan 18 09:25:04 2017 -0800 Spotfix compiler opts for SBC docs commit b1570c7f53489dbaec42452dcf73e0497394e120 Author: Marie Hernes Date: Wed Jan 18 11:04:48 2017 +0100 Changed project name. commit ea4b01b1a5442c0906ef1422a75cb43c180b7fed Author: Marie Hernes Date: Wed Jan 18 10:31:47 2017 +0100 Added arrows for menu items and changed project and projectspec name. commit 62d057ed3f6a259f063ec039bd6f62f5b2a5c5c9 Author: Sean Lyons Date: Tue Jan 17 17:54:37 2017 -0800 Readme updates to explain R1/R2 breakdown commit de0d39f10b65b731b4728b6b459358cf10d06c7b Author: Sean Lyons Date: Tue Jan 17 17:53:59 2017 -0800 Update SBCLP to use UART disp, readme update commit f5571c89077996c77311273c56ca3185786dea65 Author: Marie Hernes Date: Mon Jan 16 13:20:02 2017 +0100 Corrected spelling errors. commit 42f5b931be3808f6b3cfe6f5c732e5260b376b91 Author: Marie Hernes Date: Wed Nov 9 09:48:29 2016 +0100 Deleted unnecessary file. commit 6a4d387489134e55d9d76c202031c772b221e17c Author: Marie Hernes Date: Tue Nov 8 07:58:22 2016 -0600 Updated simple_central.md with Displays commit 999a9745a66cee2261c206ba7a1a0ce11a8a84ed Author: Marie Hernes Date: Tue Nov 8 07:36:10 2016 -0600 Updated simple_central.c on displays. commit 08c8fc8842876bd7ab70bf2333808336dc4e7e76 Author: Marie Hernes Date: Fri Nov 4 15:35:28 2016 +0100 Ported to BLE stack 2.2.1 commit 87d1b0dbcb34bf88ca926b3cb29d7769329a197b Author: Marie Hernes Date: Thu Nov 3 10:52:54 2016 +0100 Updated so that LCD display is enabled by default. commit f6ca849fcda4231e9094a16c9fe1c7652dbf0ecc Author: Marie Hernes Date: Fri Oct 14 16:12:47 2016 +0200 Fixed error in projectspec and ewp-files. commit 1df08a8eee8842096938bea12cb04a7b86d15ff8 Author: Marie Hernes Date: Fri Oct 14 15:52:57 2016 +0200 Added DisplayUart.h. commit 1faa4a6fd721b4b4c00780adf58f4281df8d15d5 Author: Marie Hernes Date: Thu Oct 13 10:48:02 2016 +0200 Corrected minor error in app projectspec. commit 03dbdad54eb161771a66b352352528933975d0da Author: Marie Hernes Date: Thu Oct 13 10:08:49 2016 +0200 Fixed error in link in simple_central_lp doc. commit 8bc9a76eeea900e51957d28e317d6947828896a0 Author: Marie Hernes Date: Tue Oct 11 07:36:55 2016 -0500 Update README.md commit e2a7b68d70942512faffbd4e8b7bb6617a9f892b Author: Marie Hernes Date: Tue Oct 11 13:25:28 2016 +0200 Added simple_central_lp in README.md. commit 320055087661c46e2e3dc6acb58e3def0c49a9dd Author: Marie Hernes Date: Tue Oct 11 13:24:39 2016 +0200 Added simple_central_lp in docs. commit 04538a9fef78ba911365be68d1f0ab8747b285b1 Author: Marie Hernes Date: Tue Oct 11 13:23:51 2016 +0200 Added DisplaySharp.c and DisplayUart.c in display_eng folder. commit 0d7cf1c5113e27ea1de40f2ff4288c58f9c878b7 Author: Marie Hernes Date: Tue Oct 11 13:22:58 2016 +0200 Added simple_central_lp projects. --- README.md | 15 +- docs/simple_central_lp.md | 45 + .../simple_central_cc2650lp_app.projectspec | 257 +++ ...simple_central_lp_cc2650lp_app.projectspec | 257 +++ .../simple_central/ccs/config/app_ble.cfg | 4 + .../ccs/config/ccs_compiler_defines.bcfg | 10 + .../ccs/config/ccs_linker_defines.cmd | 10 + .../simple_central/ccs/config/lib_linker.cmd | 8 + .../simple_central_cc2650lp_stack.projectspec | 269 +++ ...mple_central_lp_cc2650lp_stack.projectspec | 269 +++ .../simple_central/iar/app/cc2650lp_app.ewd | 1522 +++++++++++++ .../simple_central/iar/app/cc2650lp_app.ewp | 1225 ++++++++++ .../simple_central/iar/config/app_ble.cfg | 679 ++++++ .../simple_central/iar/config/ccfg_app_ble.c | 70 + .../iar/config/iar_boundary.bdef | 10 + .../iar/config/iar_boundary.xcl | 10 + .../simple_central/iar/config/lib_linker.cmd | 8 + .../iar/simple_central.custom_argvars | 48 + .../simple_central/iar/simple_central.eww | 13 + .../simple_central/iar/stack/build_config.opt | 144 ++ .../iar/stack/cc2650lp_stack.ewd | 1522 +++++++++++++ .../iar/stack/cc2650lp_stack.ewp | 1249 +++++++++++ .../display_eng/ti/mw/display/DisplaySharp.c | 480 ++++ .../display_eng/ti/mw/display/DisplayUart.c | 331 +++ .../display_eng/ti/mw/display/DisplayUart.h | 80 + .../cc26xx/app/simple_central.c | 1979 +++++++++++++++++ 26 files changed, 10510 insertions(+), 4 deletions(-) create mode 100644 docs/simple_central_lp.md create mode 100644 examples/cc2650lp/simple_central/ccs/app/simple_central_cc2650lp_app.projectspec create mode 100644 examples/cc2650lp/simple_central/ccs/app/simple_central_lp_cc2650lp_app.projectspec create mode 100644 examples/cc2650lp/simple_central/ccs/config/app_ble.cfg create mode 100644 examples/cc2650lp/simple_central/ccs/config/ccs_compiler_defines.bcfg create mode 100644 examples/cc2650lp/simple_central/ccs/config/ccs_linker_defines.cmd create mode 100644 examples/cc2650lp/simple_central/ccs/config/lib_linker.cmd create mode 100644 examples/cc2650lp/simple_central/ccs/stack/simple_central_cc2650lp_stack.projectspec create mode 100644 examples/cc2650lp/simple_central/ccs/stack/simple_central_lp_cc2650lp_stack.projectspec create mode 100644 examples/cc2650lp/simple_central/iar/app/cc2650lp_app.ewd create mode 100644 examples/cc2650lp/simple_central/iar/app/cc2650lp_app.ewp create mode 100644 examples/cc2650lp/simple_central/iar/config/app_ble.cfg create mode 100644 examples/cc2650lp/simple_central/iar/config/ccfg_app_ble.c create mode 100644 examples/cc2650lp/simple_central/iar/config/iar_boundary.bdef create mode 100644 examples/cc2650lp/simple_central/iar/config/iar_boundary.xcl create mode 100644 examples/cc2650lp/simple_central/iar/config/lib_linker.cmd create mode 100644 examples/cc2650lp/simple_central/iar/simple_central.custom_argvars create mode 100644 examples/cc2650lp/simple_central/iar/simple_central.eww create mode 100644 examples/cc2650lp/simple_central/iar/stack/build_config.opt create mode 100644 examples/cc2650lp/simple_central/iar/stack/cc2650lp_stack.ewd create mode 100644 examples/cc2650lp/simple_central/iar/stack/cc2650lp_stack.ewp create mode 100644 src/components/display_eng/ti/mw/display/DisplaySharp.c create mode 100644 src/components/display_eng/ti/mw/display/DisplayUart.c create mode 100644 src/components/display_eng/ti/mw/display/DisplayUart.h create mode 100644 src/examples/simple_central/cc26xx/app/simple_central.c diff --git a/README.md b/README.md index 9dc98c1..709b251 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ -Extra examples for TI BLE-Stack SDK -=================================== +Extra examples for TI BLE-Stack 2.2.x SDK +========================================= -This repository contains additional sample applications and components for the Texas Instruments *Bluetooth®* Low Energy software development kit. All Github sample apps are compatible with the latest BLE-Stack SDK. +This repository contains additional sample applications and components for the Texas Instruments *Bluetooth®* Low Energy software development kit. All Github sample apps are compatible with BLE-Stack 2.2.x. To use the examples and tools in this repository, please [download and install the SDK](http://www.ti.com/ble-stack) first, and if necessary [buy an evaluation kit](https://store.ti.com/Search.aspx?k=CC2650). For other hardware and software resources, [please visit our wiki](http://www.ti.com/ble-wiki). If you have any questions please refer to the [FAQ page](docs/faq.md). -**Note:** Not all additional sample projects are migrated to GitHub - please refer to the Examples List below. +**Note:** Not all additional sample projects are migrated to GitHub. Additionally all examples on this page are targeted for the **`CC2650R1`** device - please refer to the Examples List below. Installation ============ @@ -54,6 +54,8 @@ The [FAQ page](docs/faq.md) will try to address some of the common questions rel Examples List ============= +**Note: All of the sample applications below run on CC2650R1 based devopment kits. These examples will not work on CC2640R2 devices. For R2 examples, please ble_examples-3.0.** + The following examples are currently supported: ### beacon\_rfdriver @@ -86,6 +88,11 @@ The following examples are currently supported:     [docs](docs/simple_beacon.md) | [project files ](examples/cc2650lp/simple_beacon) | [src](src/examples/simple_beacon) +### simple\_central\_lp +    SimpleBLECentral for CC2650 LaunchPad + +    [docs](docs/simple_central_lp.md) | [Launchpad project files](examples/cc2650lp/simple_central) | [src](src/examples/simple_central) + ### simple\_central\_audio\_receiver     Receive and decode a voice stream over BLE using CC2650 central device and SensorTag or
    HID Advanced Remote peripheral device diff --git a/docs/simple_central_lp.md b/docs/simple_central_lp.md new file mode 100644 index 0000000..5fb1bb1 --- /dev/null +++ b/docs/simple_central_lp.md @@ -0,0 +1,45 @@ +Purpose +=============== + +This example project configures the Simple BLE Central for the CC2650 LaunchPad. The simple central is a Bluetooth low energy central device with GATT client functionality. To accommodate the CC2650 LaunchPad, two buttons are used to navigate through the menu. + +By default, the simple central application is configured to filter and connect to peripheral devices with the TI Simple Profile Service UUID, such as Simple Peripheral. To modify this behavior, set DEFAULT_DEV_DISC_BY_SVC_UUID to FALSE in simple_central.c. + +The application can be used with a LCD screen, or a terminal program such as PuTTY can be used to display over UART. + +Requirements +============= + +#### Hardware + +- [CC2650 LaunchPad](http://www.ti.com/tool/launchxl-cc2650) +- **OPTIONAL:** [Sharp LCD BoosterPack](http://www.ti.com/tool/430boost-sharp96) +- Device to connect to + +##### Software +- simple_central_lp project from this GIT page +- [BLE-Stack v2.2.1](http://www.ti.com/ble-stack) +- **OPTIONAL:** Terminal program such as [PuTTY](http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) +- CCS 6.2.x **or** IAR 7.70.x + + +User Interface +================ + +#### Choosing Display + +By default, the project will use a UART display. To use LCD to display (instead of UART), go to the project Predefines (Properties -> Build -> ARM Compiler -> Predefined Symbols) and delete the `BOARD_DISPLAY_EXCLUDE_LCD` entry. Then add `BOARD_DISPLAY_EXCLUDE_UART`. + +For instructions on using PuTTY with the CC2650 LaunchPad, please see the [FAQ page](faq.md). + +#### Running the Project + +Upon powering the device, press the right button (BTN-2) to scan for devices. The central will display both address and name of the devices found. To browse through the found devices press the left button (BTN-1). To scan for devices, press the right button. When browsing through devices, press the right button to connect. + +When connected, the bottom row displays the possible actions. Press left to toggle which option is selected, and right to execute. +- Param upd req: Send a parameter update request, toggling between the "initial" and "default" set of connection parameters. (By default, this toggles between a connection interval of 400 and 200 ms.) +- Start/stop RSSI poll: Start or cancel RSSI polling. +- Read/write req: Send a read or write request for the Simple Service characteristic 1. +- Disconnect. + +When disconnected, press right to scan for devices. diff --git a/examples/cc2650lp/simple_central/ccs/app/simple_central_cc2650lp_app.projectspec b/examples/cc2650lp/simple_central/ccs/app/simple_central_cc2650lp_app.projectspec new file mode 100644 index 0000000..040caa8 --- /dev/null +++ b/examples/cc2650lp/simple_central/ccs/app/simple_central_cc2650lp_app.projectspec @@ -0,0 +1,257 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/cc2650lp/simple_central/ccs/app/simple_central_lp_cc2650lp_app.projectspec b/examples/cc2650lp/simple_central/ccs/app/simple_central_lp_cc2650lp_app.projectspec new file mode 100644 index 0000000..040caa8 --- /dev/null +++ b/examples/cc2650lp/simple_central/ccs/app/simple_central_lp_cc2650lp_app.projectspec @@ -0,0 +1,257 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/cc2650lp/simple_central/ccs/config/app_ble.cfg b/examples/cc2650lp/simple_central/ccs/config/app_ble.cfg new file mode 100644 index 0000000..c2c1cc1 --- /dev/null +++ b/examples/cc2650lp/simple_central/ccs/config/app_ble.cfg @@ -0,0 +1,4 @@ +utils.importFile("src/common/cc26xx/kernel/cc2640/config/cc2640.cfg"); +/* +* Extend the cc2640 configuration +*/ \ No newline at end of file diff --git a/examples/cc2650lp/simple_central/ccs/config/ccs_compiler_defines.bcfg b/examples/cc2650lp/simple_central/ccs/config/ccs_compiler_defines.bcfg new file mode 100644 index 0000000..d133ee9 --- /dev/null +++ b/examples/cc2650lp/simple_central/ccs/config/ccs_compiler_defines.bcfg @@ -0,0 +1,10 @@ +/* +** Stack Frontier Generator 1.1.0 (2017-01-18 09:58:05.054000) +** +** WARNING - Auto-generated file. Modifications could be lost! +*/ + +--define=ICALL_STACK0_ADDR=0xb001 +--define=ICALL_STACK0_START=0xb000 +--define=ICALL_RAM0_START=0x200041d0 + diff --git a/examples/cc2650lp/simple_central/ccs/config/ccs_linker_defines.cmd b/examples/cc2650lp/simple_central/ccs/config/ccs_linker_defines.cmd new file mode 100644 index 0000000..47fd065 --- /dev/null +++ b/examples/cc2650lp/simple_central/ccs/config/ccs_linker_defines.cmd @@ -0,0 +1,10 @@ +/* +** Stack Frontier Generator 1.1.0 (2017-01-18 09:58:05.054000) +** +** WARNING - Auto-generated file. Modifications could be lost! +*/ + +--define=ICALL_RAM0_START=0x200041d0 +--define=ICALL_STACK0_START=0xb000 +--define=ICALL_STACK0_ADDR=0xb001 + diff --git a/examples/cc2650lp/simple_central/ccs/config/lib_linker.cmd b/examples/cc2650lp/simple_central/ccs/config/lib_linker.cmd new file mode 100644 index 0000000..1ca7b72 --- /dev/null +++ b/examples/cc2650lp/simple_central/ccs/config/lib_linker.cmd @@ -0,0 +1,8 @@ +/* + * DO NOT MODIFY. This file is automatically generated during the pre-build + * step by the lib_search utility + */ + +"C:\ti\simplelink\ble_sdk_2_02_01_18\blelib\host\host_xcxx_sc.a" +"C:\ti\simplelink\ble_sdk_2_02_01_18\blelib\ctrl\cc2640\cc2640_ctrl_xcxx_41c_ext_sc.a" +"C:\ti\simplelink\ble_sdk_2_02_01_18\blelib\hci_tl\cc26xx\cc26xx_hci_tl_none_v41_v42.a" diff --git a/examples/cc2650lp/simple_central/ccs/stack/simple_central_cc2650lp_stack.projectspec b/examples/cc2650lp/simple_central/ccs/stack/simple_central_cc2650lp_stack.projectspec new file mode 100644 index 0000000..3cc3b20 --- /dev/null +++ b/examples/cc2650lp/simple_central/ccs/stack/simple_central_cc2650lp_stack.projectspec @@ -0,0 +1,269 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/cc2650lp/simple_central/ccs/stack/simple_central_lp_cc2650lp_stack.projectspec b/examples/cc2650lp/simple_central/ccs/stack/simple_central_lp_cc2650lp_stack.projectspec new file mode 100644 index 0000000..3cc3b20 --- /dev/null +++ b/examples/cc2650lp/simple_central/ccs/stack/simple_central_lp_cc2650lp_stack.projectspec @@ -0,0 +1,269 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/cc2650lp/simple_central/iar/app/cc2650lp_app.ewd b/examples/cc2650lp/simple_central/iar/app/cc2650lp_app.ewd new file mode 100644 index 0000000..0ae5497 --- /dev/null +++ b/examples/cc2650lp/simple_central/iar/app/cc2650lp_app.ewd @@ -0,0 +1,1522 @@ + + + + 2 + + FlashROM + + ARM + + 1 + + C-SPY + 2 + + 27 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + CMSISDAP_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 1 + 1 + 1 + + + + + + + + + IJET_ID + 2 + + 6 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + JLINK_ID + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + MACRAIGOR_ID + 2 + + 3 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + PEMICRO_ID + 2 + + 2 + 1 + 1 + + + + + + + + + RDI_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + STLINK_ID + 2 + + 3 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + XDS100_ID + 2 + + 4 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $TOOLKIT_DIR$\plugins\middleware\HCCWare\HCCWare.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\middleware\PercepioTraceExporter\PercepioTraceExportPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\AVIX\AVIX.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB7_Plugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin + 1 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin + 0 + + + + + + diff --git a/examples/cc2650lp/simple_central/iar/app/cc2650lp_app.ewp b/examples/cc2650lp/simple_central/iar/app/cc2650lp_app.ewp new file mode 100644 index 0000000..18ada4b --- /dev/null +++ b/examples/cc2650lp/simple_central/iar/app/cc2650lp_app.ewp @@ -0,0 +1,1225 @@ + + + + 2 + + FlashROM + + ARM + + 1 + + General + 3 + + 24 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 31 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + 0 + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + "$XDCROOT$/xs" --xdcpath="$XDCPATH$" iar.tools.configuro -c "$TOOLKIT_DIR$" --cc "$COMPILER_PATH$" --device "$DEVICE$" --compileOptions $COMPILER_ARGS_ROOT_QUOTED$ --linkOptions $LINKER_ARGS_QUOTED$ --profile release --projFile "$PROJ_PATH$" + + + + + ILINK + 0 + + 17 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + Application + + $SRC_BLE_CORE$\common\cc26xx\board_key.c + + + $SRC_BLE_CORE$\common\cc26xx\board_key.h + + + $PROJ_DIR$\..\..\..\..\..\src\examples\simple_central\cc26xx\app\simple_central.c + + + $SRC_BLE_CORE$\examples\simple_central\cc26xx\app\simple_central.h + + + $SRC_BLE_CORE$\common\cc26xx\util.c + + + $SRC_BLE_CORE$\common\cc26xx\util.h + + + + Drivers + + Display + + $TI_RTOS_DRIVERS_BASE$\ti\mw\display\Display.c + + + $TI_RTOS_DRIVERS_BASE$\ti\mw\display\Display.h + + + $TI_RTOS_DRIVERS_BASE$\ti\mw\display\DisplayDogm1286.h + + + $PROJ_DIR$\..\..\..\..\..\src\components\display_eng\ti\mw\display\DisplaySharp.c + + + $PROJ_DIR$\..\..\..\..\..\src\components\display_eng\ti\mw\display\DisplayUart.c + + + $PROJ_DIR$\..\..\..\..\..\src\components\display_eng\ti\mw\display\DisplayUart.h + + + + ECC + + $SRC_BLE_CORE$\common\cc26xx\ecc\ECCROMCC26XX.c + + + $SRC_BLE_CORE$\common\cc26xx\ecc\ECCROMCC26XX.h + + + + PIN + + $TI_RTOS_DRIVERS_BASE$\ti\drivers\PIN.h + + + $TI_RTOS_DRIVERS_BASE$\ti\drivers\pin\PINCC26XX.c + + + $TI_RTOS_DRIVERS_BASE$\ti\drivers\pin\PINCC26XX.h + + + + RF + + $TI_RTOS_DRIVERS_BASE$\ti\drivers\rf\RF.h + + + $TI_RTOS_DRIVERS_BASE$\ti\drivers\rf\RFCC26XX_singleMode.c + + + + SPI + + $TI_RTOS_DRIVERS_BASE$\ti\drivers\SPI.c + + + $TI_RTOS_DRIVERS_BASE$\ti\drivers\SPI.h + + + $TI_RTOS_DRIVERS_BASE$\ti\drivers\spi\SPICC26XXDMA.c + + + $TI_RTOS_DRIVERS_BASE$\ti\drivers\spi\SPICC26XXDMA.h + + + + TRNG + + $SRC_COMMON$\hal\src\target\_common\TRNGCC26XX.c + + + $SRC_COMMON$\hal\src\target\_common\TRNGCC26XX.h + + + + UDMA + + $TI_RTOS_DRIVERS_BASE$\ti\drivers\dma\UDMACC26XX.c + + + $TI_RTOS_DRIVERS_BASE$\ti\drivers\dma\UDMACC26XX.h + + + + + ICall + + $SRC_COMMON$\heapmgr\heapmgr.h + + + $SRC_COMMON$\icall\src\icall.c + + + $SRC_COMMON$\icall\src\inc\icall.h + + + $SRC_BLE_CORE$\icall\inc\icall_addrs.h + + + $SRC_COMMON$\icall\src\icall_cc2650.c + + + $SRC_COMMON$\icall\src\icall_platform.h + + + + ICallBLE + + $SRC_BLE_CORE$\icall\app\ble_user_config.c + + + $SRC_BLE_CORE$\icall\inc\ble_user_config.h + + + $SRC_BLE_CORE$\icall\app\icall_api.c + + + $SRC_BLE_CORE$\icall\inc\icall_apimsg.h + + + + Include + + $SRC_BLE_CORE$\inc\gap.h + + + $SRC_BLE_CORE$\profiles\roles\gapbondmgr.h + + + $SRC_BLE_CORE$\inc\gapgattserver.h + + + $SRC_BLE_CORE$\inc\gatt.h + + + $SRC_BLE_CORE$\inc\hci.h + + + $SRC_COMMON$\osal\src\common\osal.c + + + $SRC_COMMON$\osal\src\inc\osal_snv.h + + + + Profiles + + $SRC_BLE_CORE$\profiles\roles\cc26xx\central.c + + + $SRC_BLE_CORE$\profiles\roles\cc26xx\central.h + + + + Startup + + $SRC_COMMON$\hal\src\target\board.c + + + $PROJ_DIR$\..\config\ccfg_app_ble.c + + + $SRC_BLE_CORE$\examples\simple_central\cc26xx\app\main.c + + + + Tools + + $PROJ_DIR$\..\config\app_ble.cfg + + FlashROM + + CUSTOM + + .cfg + "$XDCROOT$/bin/stderr" + 0 + + + $PROJ_DIR$\..\config\configPkg\package.mak + + + + + + + + $SRC_BLE_CORE$\common\cc26xx\iar\cc26xx_app.icf + + + $PROJ_DIR$\..\config\iar_boundary.bdef + + + $PROJ_DIR$\..\config\iar_boundary.xcl + + + + + diff --git a/examples/cc2650lp/simple_central/iar/config/app_ble.cfg b/examples/cc2650lp/simple_central/iar/config/app_ble.cfg new file mode 100644 index 0000000..af231cc --- /dev/null +++ b/examples/cc2650lp/simple_central/iar/config/app_ble.cfg @@ -0,0 +1,679 @@ +/****************************************************************************** + + @file app_ble.cfg + + @brief TI RTOS Configuration file for CC26xx + + Imported Symbols + Note: These symbols are defined following the --cfgArgs option. + In IAR this is done at the end of the pre-build step. In CCS, this + is done in Properties->build->XDCtools-Advanced options->Configuration + script arguments. Multiple symbols can be used separating them by a + comma (","). + + By default, TI RTOS builds with RTOS in ROM, interrupt vectors starting + at address 0x0 and uses ROM only kernel modules. + + NO_ROM: When set to a non-zero value, RTOS builds in Flash instead + of ROM + OAD_IMG_A: When set to a non-zero value, interrupt vectors are set to + their expected location for on-chip OAD Image A. + OAD_IMG_B: When set to a non-zero value, interrupt vectors are set to + their expected location for on-chip OAD Image B. + OAD_IMG_E: When set to a non-zero value, interrupt vectors are set to + their expected location for external flash OAD. + USE_EVENTS: Build the RTOS Kernel Event module. + + Group: WCS, BTS + Target Device: CC2650, CC2640, CC1350 + + ****************************************************************************** + + Copyright (c) 2013-2016, Texas Instruments Incorporated + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * 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. + + * Neither the name of Texas Instruments Incorporated nor the names of + its contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 THE COPYRIGHT OWNER 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. + + ****************************************************************************** + Release Name: ble_sdk_2_02_00_31 + Release Date: 2016-06-16 18:57:29 + *****************************************************************************/ + + +/* ================ ROM configuration ================ */ +/* + * To use BIOS in flash, comment out the code block below. + */ +if (typeof NO_ROM == 'undefined' || (typeof NO_ROM != 'undefined' && NO_ROM == 0)) +{ + var ROM = xdc.useModule('ti.sysbios.rom.ROM'); + if (Program.cpu.deviceName.match(/CC26/)) { + ROM.romName = ROM.CC2650; + } + else if (Program.cpu.deviceName.match(/CC13/)) { + ROM.romName = ROM.CC1350; + } +} + + + +/* ================ Boot configuration ================ */ +if (typeof NO_ROM == 'undefined' || (typeof NO_ROM != 'undefined' && NO_ROM == 0)) +{ + var Boot = xdc.useModule('ti.sysbios.family.arm.cc26xx.Boot'); +} +/* + * This module contains family specific Boot APIs and configuration settings. + * See the SYS/BIOS API guide for more information. + */ +if (typeof NO_ROM == 'undefined' || (typeof NO_ROM != 'undefined' && NO_ROM == 0)) +{ + Boot.driverlibVersion = 2; + Boot.customerConfig = false; +} + + +/* ================ Clock configuration ================ */ +var Clock = xdc.useModule('ti.sysbios.knl.Clock'); +/* + * When using Power and calibrateRCOSC is set to true, this should be set to 10. + * The timer used by the Clock module supports TickMode_DYNAMIC. This enables us + * to set the tick period to 10 us without generating the overhead of additional + * interrupts. + * + * Note: The calibrateRCOSC parameter is set within the Power configuration + * structure in the "Board.c" file. + */ +Clock.tickPeriod = 10; +Clock.swiPriority = 5; + + +/* ================ Types configuration ================ */ +var Types = xdc.useModule('xdc.runtime.Types'); +/* + * This module defines basic constants and types used throughout the + * xdc.runtime package. + */ + + + +/* ================ Defaults (module) configuration ================ */ +var Defaults = xdc.useModule('xdc.runtime.Defaults'); +/* + * A flag to allow module names to be loaded on the target. Module name + * strings are placed in the .const section for debugging purposes. + * + * Pick one: + * - true (default) + * Setting this parameter to true will include name strings in the .const + * section so that Errors and Asserts are easier to debug. + * - false + * Setting this parameter to false will reduce footprint in the .const + * section. As a result, Error and Assert messages will contain an + * "unknown module" prefix instead of the actual module name. + * + * When using BIOS in ROM: + * This option must be set to false. + */ +//Defaults.common$.namedModule = true; +Defaults.common$.namedModule = false; + +/* Compile out all Assert's */ +//Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF; + +/* Allow Mod_create() and Mod_construct() but not delete() or destruct() */ +Defaults.common$.memoryPolicy = Types.CREATE_POLICY; + + + +/* ================ Error configuration ================ */ +var Error = xdc.useModule('xdc.runtime.Error'); +/* + * This function is called to handle all raised errors, but unlike + * Error.raiseHook, this function is responsible for completely handling the + * error with an appropriately initialized Error_Block. + * + * Pick one: + * - Error.policyDefault (default) + * Calls Error.raiseHook with an initialized Error_Block structure and logs + * the error using the module's logger. + * - Error.policySpin + * Simple alternative that traps on a while(1) loop for minimized target + * footprint. + * Using Error.policySpin, the Error.raiseHook will NOT called. + */ +//Error.policyFxn = Error.policyDefault; +Error.policyFxn = Error.policySpin; + +/* + * If Error.policyFxn is set to Error.policyDefault, this function is called + * whenever an error is raised by the Error module. + * + * Pick one: + * - Error.print (default) + * Errors are formatted and output via System_printf() for easier + * debugging. + * - null + * Errors are trapped with a while(1) stub function. This option reduces + * code footprint. + * - non-null function + * Errors invoke custom user function. See the Error module documentation + * for more details. + */ +//Error.raiseHook = Error.print; +Error.raiseHook = null; +//Error.raiseHook = "&myErrorFxn"; + +/* + * If Error.policyFxn is set to Error.policyDefault, this option applies to the + * maximum number of times the Error.raiseHook function can be recursively + * invoked. This option limits the possibility of an infinite recursion that + * could lead to a stack overflow. + * The default value is 16. + */ +Error.maxDepth = 2; + + + +/* ================ Hwi configuration ================ */ +var halHwi = xdc.useModule('ti.sysbios.hal.Hwi'); +var m3Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi'); +/* + * Checks for Hwi (system) stack overruns while in the Idle loop. + * + * Pick one: + * - true (default) + * Checks the top word for system stack overflows during the idle loop and + * raises an Error if one is detected. + * - false + * Disabling the runtime check improves runtime performance and yields a + * reduced flash footprint. + */ +//halHwi.checkStackFlag = true; +halHwi.checkStackFlag = false; + +/* + * The following options alter the system's behavior when a hardware exception + * is detected. + * + * Pick one: + * - Hwi.enableException = true + * This option causes the default m3Hwi.excHandlerFunc function to fully + * decode an exception and dump the registers to the system console. + * This option raises errors in the Error module and displays the + * exception in ROV. + * - Hwi.enableException = false + * This option reduces code footprint by not decoding or printing the + * exception to the system console. + * It however still raises errors in the Error module and displays the + * exception in ROV. + * - Hwi.excHandlerFunc = null + * This is the most aggressive option for code footprint savings; but it + * can difficult to debug exceptions. It reduces flash footprint by + * plugging in a default while(1) trap when exception occur. This option + * does not raise an error with the Error module. + */ +//m3Hwi.enableException = true; +//m3Hwi.enableException = false; +m3Hwi.excHandlerFunc = null; + +/* + * Enable hardware exception generation when dividing by zero. + * + * Pick one: + * - 0 (default) + * Disables hardware exceptions when dividing by zero + * - 1 + * Enables hardware exceptions when dividing by zero + */ +m3Hwi.nvicCCR.DIV_0_TRP = 0; +//m3Hwi.nvicCCR.DIV_0_TRP = 1; + +/* + * Enable hardware exception generation for invalid data alignment. + * + * Pick one: + * - 0 (default) + * Disables hardware exceptions for data alignment + * - 1 + * Enables hardware exceptions for data alignment + */ +m3Hwi.nvicCCR.UNALIGN_TRP = 0; +//m3Hwi.nvicCCR.UNALIGN_TRP = 1; + +/* Put reset vector at start of Flash */ +if (typeof OAD_IMG_A != 'undefined' && OAD_IMG_A == 1) +{ + m3Hwi.resetVectorAddress = 0x0610; +} +else if (typeof OAD_IMG_B != 'undefined' && OAD_IMG_B == 1) +{ + m3Hwi.resetVectorAddress = 0x6010; +} +else if (typeof OAD_IMG_E != 'undefined' && OAD_IMG_E == 1) +{ + m3Hwi.resetVectorAddress = 0x1010; +} +else +{ + m3Hwi.resetVectorAddress = 0x0; +} + +/* Put interrupt vector at start of RAM so interrupts can be configured at runtime */ +m3Hwi.vectorTableAddress = 0x20000000; + +/* CC2650 has 50 interrupts */ +m3Hwi.NUM_INTERRUPTS = 50; + + + +/* ================ Idle configuration ================ */ +var Idle = xdc.useModule('ti.sysbios.knl.Idle'); +/* + * The Idle module is used to specify a list of functions to be called when no + * other tasks are running in the system. + * + * Functions added here will be run continuously within the idle task. + * + * Function signature: + * Void func(Void); + */ +//Idle.addFunc("&myIdleFunc"); + + + +/* ================ Kernel (SYS/BIOS) configuration ================ */ +var BIOS = xdc.useModule('ti.sysbios.BIOS'); +/* + * Enable asserts in the BIOS library. + * + * Pick one: + * - true (default) + * Enables asserts for debugging purposes. + * - false + * Disables asserts for a reduced code footprint and better performance. + * + * When using BIOS in ROM: + * This option must be set to false. + */ +//BIOS.assertsEnabled = true; +BIOS.assertsEnabled = false; + +/* + * Specify default heap size for BIOS. + */ +if (typeof NO_ROM == 'undefined' || (typeof NO_ROM != 'undefined' && NO_ROM == 0)) +{ + BIOS.heapSize = 1668; +} + +/* + * A flag to determine if xdc.runtime sources are to be included in a custom + * built BIOS library. + * + * Pick one: + * - false (default) + * The pre-built xdc.runtime library is provided by the respective target + * used to build the application. + * - true + * xdc.runtime library sources are to be included in the custom BIOS + * library. This option yields the most efficient library in both code + * footprint and runtime performance. + */ +//BIOS.includeXdcRuntime = false; +BIOS.includeXdcRuntime = true; + +/* + * The SYS/BIOS runtime is provided in the form of a library that is linked + * with the application. Several forms of this library are provided with the + * SYS/BIOS product. + * + * Pick one: + * - BIOS.LibType_Custom + * Custom built library that is highly optimized for code footprint and + * runtime performance. + * - BIOS.LibType_Debug + * Custom built library that is non-optimized that can be used to + * single-step through APIs with a debugger. + * + */ +BIOS.libType = BIOS.LibType_Custom; +//BIOS.libType = BIOS.LibType_Debug; + +/* + * Runtime instance creation enable flag. + * + * Pick one: + * - true (default) + * Allows Mod_create() and Mod_delete() to be called at runtime which + * requires a default heap for dynamic memory allocation. + * - false + * Reduces code footprint by disallowing Mod_create() and Mod_delete() to + * be called at runtime. Object instances are constructed via + * Mod_construct() and destructed via Mod_destruct(). + * + * When using BIOS in ROM: + * This option must be set to true. + */ +BIOS.runtimeCreatesEnabled = true; +//BIOS.runtimeCreatesEnabled = false; + +/* + * Enable logs in the BIOS library. + * + * Pick one: + * - true (default) + * Enables logs for debugging purposes. + * - false + * Disables logging for reduced code footprint and improved runtime + * performance. + * + * When using BIOS in ROM: + * This option must be set to false. + */ +//BIOS.logsEnabled = true; +BIOS.logsEnabled = false; + +BIOS.swiEnabled = true; + + + +/* ================ Memory configuration ================ */ +var Memory = xdc.useModule('xdc.runtime.Memory'); +/* + * The Memory module itself simply provides a common interface for any + * variety of system and application specific memory management policies + * implemented by the IHeap modules(Ex. HeapMem, HeapBuf). + */ +/* Create a small "alloc-only" heap */ +if (typeof NO_ROM != 'undefined' && NO_ROM != 0) +{ + var HeapMin = xdc.useModule('xdc.runtime.HeapMin'); + var heapMinParams = new HeapMin.Params; + heapMinParams.size = 1668; + var myHeapMin = HeapMin.create(heapMinParams); + Memory.defaultHeapInstance = myHeapMin; +} + + + +/* ================ Program configuration ================ */ +/* + * Program.stack is ignored with IAR. Use the project options in + * IAR Embedded Workbench to alter the system stack size. + */ +if (typeof NO_ROM == 'undefined' || (typeof NO_ROM != 'undefined' && NO_ROM == 0)) +{ + Program.stack = 1024; + Program.argSize = 0; +} +else +{ + Program.stack = 512; +} + + + +/* ================ Semaphore configuration ================ */ +var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore'); +/* + * Enables global support for Task priority pend queuing. + * + * Pick one: + * - true (default) + * This allows pending tasks to be serviced based on their task priority. + * - false + * Pending tasks are services based on first in, first out basis. + * + * When using BIOS in ROM: + * This option must be set to false. + */ +//Semaphore.supportsPriority = true; +Semaphore.supportsPriority = false; + +/* + * Allows for the implicit posting of events through the semaphore, + * disable for additional code saving. + * + * Pick one: + * - true + * This allows the Semaphore module to post semaphores and events + * simultaneously. + * - false (default) + * Events must be explicitly posted to unblock tasks. + * + * When using BIOS in ROM: + * This option must be set to false. + */ +//Semaphore.supportsEvents = true; +Semaphore.supportsEvents = false; + + + + +/* ================ Events configuration ================ */ +if (typeof USE_EVENTS != 'undefined' && USE_EVENTS != 0) +{ + var Events = xdc.useModule('ti.sysbios.knl.Event'); +} + + + +/* ================ Swi configuration ================ */ +var Swi = xdc.useModule('ti.sysbios.knl.Swi'); +/* + * A software interrupt is an object that encapsulates a function to be + * executed and a priority. Software interrupts are prioritized, preempt tasks + * and are preempted by hardware interrupt service routines. + * + * This module is included to allow Swi's in a users' application. + */ +Swi.numPriorities = 6; + + + +/* ================ System configuration ================ */ +var System = xdc.useModule('xdc.runtime.System'); +/* + * The Abort handler is called when the system exits abnormally. + * + * Pick one: + * - System.abortStd (default) + * Call the ANSI C Standard 'abort()' to terminate the application. + * - System.abortSpin + * A lightweight abort function that loops indefinitely in a while(1) trap + * function. + * - A custom abort handler + * A user-defined function. See the System module documentation for + * details. + */ +//System.abortFxn = System.abortStd; +System.abortFxn = System.abortSpin; +//System.abortFxn = "&myAbortSystem"; + +/* + * The Exit handler is called when the system exits normally. + * + * Pick one: + * - System.exitStd (default) + * Call the ANSI C Standard 'exit()' to terminate the application. + * - System.exitSpin + * A lightweight exit function that loops indefinitely in a while(1) trap + * function. + * - A custom exit function + * A user-defined function. See the System module documentation for + * details. + */ +//System.exitFxn = System.exitStd; +System.exitFxn = System.exitSpin; +//System.exitFxn = "&myExitSystem"; + +/* + * Minimize exit handler array in the System module. The System module includes + * an array of functions that are registered with System_atexit() which is + * called by System_exit(). The default value is 8. + */ +System.maxAtexitHandlers = 0; + +/* + * The System.SupportProxy defines a low-level implementation of System + * functions such as System_printf(), System_flush(), etc. + * + * Pick one pair: + * - SysMin + * This module maintains an internal configurable circular buffer that + * stores the output until System_flush() is called. + * The size of the circular buffer is set via SysMin.bufSize. + * - SysCallback + * SysCallback allows for user-defined implementations for System APIs. + * The SysCallback support proxy has a smaller code footprint and can be + * used to supply custom System_printf services. + * The default SysCallback functions point to stub functions. See the + * SysCallback module's documentation. + */ +//var SysMin = xdc.useModule('xdc.runtime.SysMin'); +//SysMin.bufSize = 128; +//System.SupportProxy = SysMin; +var SysCallback = xdc.useModule('xdc.runtime.SysCallback'); +System.SupportProxy = SysCallback; +//SysCallback.abortFxn = "&myUserAbort"; +//SysCallback.exitFxn = "&myUserExit"; +//SysCallback.flushFxn = "&myUserFlush"; +//SysCallback.putchFxn = "&myUserPutch"; +//SysCallback.readyFxn = "&myUserReady"; + + + +/* ================ Task configuration ================ */ +var Task = xdc.useModule('ti.sysbios.knl.Task'); +/* + * Check task stacks for overflow conditions. + * + * Pick one: + * - true (default) + * Enables runtime checks for task stack overflow conditions during + * context switching ("from" and "to") + * - false + * Disables runtime checks for task stack overflow conditions. + * + * When using BIOS in ROM: + * This option must be set to false. + */ +//Task.checkStackFlag = true; +Task.checkStackFlag = false; + +/* + * Set the default task stack size when creating tasks. + * + * The default is dependent on the device being used. Reducing the default stack + * size yields greater memory savings. + */ +Task.defaultStackSize = 512; + +/* + * Enables the idle task. + * + * Pick one: + * - true (default) + * Creates a task with priority of 0 which calls idle hook functions. This + * option must be set to true to gain power savings provided by the Power + * module. + * - false + * No idle task is created. This option consumes less memory as no + * additional default task stack is needed. + * To gain power savings by the Power module without having the idle task, + * add Idle.run as the Task.allBlockedFunc. + */ +Task.enableIdleTask = true; +//Task.enableIdleTask = false; +//Task.allBlockedFunc = Idle.run; + +/* + * If Task.enableIdleTask is set to true, this option sets the idle task's + * stack size. + * + * Reducing the idle stack size yields greater memory savings. + */ +Task.idleTaskStackSize = 512; + +/* + * Reduce the number of task priorities. + * The default is 16. + * Decreasing the number of task priorities yield memory savings. + */ +Task.numPriorities = 6; + + + +/* ================ Text configuration ================ */ +var Text = xdc.useModule('xdc.runtime.Text'); +/* + * These strings are placed in the .const section. Setting this parameter to + * false will save space in the .const section. Error, Assert and Log messages + * will print raw ids and args instead of a formatted message. + * + * Pick one: + * - true (default) + * This option loads test string into the .const for easier debugging. + * - false + * This option reduces the .const footprint. + */ +//Text.isLoaded = true; +Text.isLoaded = false; + + + +/* ================ TI-RTOS middleware configuration ================ */ +var mwConfig = xdc.useModule('ti.mw.Config'); +/* + * Include TI-RTOS middleware libraries + */ + + + +/* ================ TI-RTOS drivers' configuration ================ */ +var driversConfig = xdc.useModule('ti.drivers.Config'); +/* + * Include TI-RTOS drivers + * + * Pick one: + * - driversConfig.LibType_NonInstrumented (default) + * Use TI-RTOS drivers library optimized for footprint and performance + * without asserts or logs. + * - driversConfig.LibType_Instrumented + * Use TI-RTOS drivers library for debugging with asserts and logs enabled. + */ +driversConfig.libType = driversConfig.LibType_NonInstrumented; +//driversConfig.libType = driversConfig.LibType_Instrumented; + + + +// Remaining Modules +var Diags = xdc.useModule('xdc.runtime.Diags'); +var Main = xdc.useModule('xdc.runtime.Main'); +var Reset = xdc.useModule('xdc.runtime.Reset'); diff --git a/examples/cc2650lp/simple_central/iar/config/ccfg_app_ble.c b/examples/cc2650lp/simple_central/iar/config/ccfg_app_ble.c new file mode 100644 index 0000000..63e5297 --- /dev/null +++ b/examples/cc2650lp/simple_central/iar/config/ccfg_app_ble.c @@ -0,0 +1,70 @@ +/****************************************************************************** + + @file ccfg_app_ble.c + + @brief Customer Configuration CC26xx PG2 device family. + + Group: WCS, BTS + Target Device: CC2650, CC2640, CC1350 + + ****************************************************************************** + + Copyright (c) 2014-2016, Texas Instruments Incorporated + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * 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. + + * Neither the name of Texas Instruments Incorporated nor the names of + its contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 THE COPYRIGHT OWNER 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. + + ****************************************************************************** + Release Name: ble_sdk_2_02_00_31_s + Release Date: 2016-06-16 18:59:11 + *****************************************************************************/ + +// +// ===> READ THIS BEFORE MODIFYING THIS FILE +// +// +// ===> READ THIS BEFORE MODIFYING THIS FILE +// +// +// ===> READ THIS BEFORE MODIFYING THIS FILE +// + +// The customer configuration area (ccfg section) is located at the end of the +// flash and reflect the hw configuration of the device. it is very important +// that it remains align with the version of driverlib you are using. +// all BLE project except sensor tag use the same configuration. +// Keeping the "#include " guarantee that your project using +// driverlib and the ccfg area will be align. + +// you can modify it if you want, the recommend way will be to remove the +// bellow include, copy the content of the file in this +// file and rebuild. + +// ==> KEEP IN MIND that if you do so, be sure that any further update of the +// driverlib must be align with your modified version of ccfg area. +#include diff --git a/examples/cc2650lp/simple_central/iar/config/iar_boundary.bdef b/examples/cc2650lp/simple_central/iar/config/iar_boundary.bdef new file mode 100644 index 0000000..432dff8 --- /dev/null +++ b/examples/cc2650lp/simple_central/iar/config/iar_boundary.bdef @@ -0,0 +1,10 @@ +/* +** Stack Frontier Generator 1.1.0 (2016-10-05 10:34:51.136000) +** +** WARNING - Auto-generated file. Modifications could be lost! +*/ + +-D ICALL_STACK0_ADDR=0x0000c001 +-D ICALL_STACK0_START=0x0000c000 +-D ICALL_RAM0_START=0x200041f0 + diff --git a/examples/cc2650lp/simple_central/iar/config/iar_boundary.xcl b/examples/cc2650lp/simple_central/iar/config/iar_boundary.xcl new file mode 100644 index 0000000..8dc1168 --- /dev/null +++ b/examples/cc2650lp/simple_central/iar/config/iar_boundary.xcl @@ -0,0 +1,10 @@ +/* +** Stack Frontier Generator 1.1.0 (2016-10-05 10:34:51.136000) +** +** WARNING - Auto-generated file. Modifications could be lost! +*/ + +--config_def ICALL_RAM0_START=0x200041f0 +--config_def ICALL_STACK0_START=0x0000c000 +--config_def ICALL_STACK0_ADDR=0x0000c001 + diff --git a/examples/cc2650lp/simple_central/iar/config/lib_linker.cmd b/examples/cc2650lp/simple_central/iar/config/lib_linker.cmd new file mode 100644 index 0000000..b59a277 --- /dev/null +++ b/examples/cc2650lp/simple_central/iar/config/lib_linker.cmd @@ -0,0 +1,8 @@ +/* + * DO NOT MODIFY. This file is automatically generated during the pre-build + * step by the lib_search utility + */ + +"C:\ti\simplelink\ble_sdk_2_02_00_31\blelib\host\host_xcxx_sc.a" +"C:\ti\simplelink\ble_sdk_2_02_00_31\blelib\ctrl\cc2640\cc2640_ctrl_xcxx_41c_ext_sc.a" +"C:\ti\simplelink\ble_sdk_2_02_00_31\blelib\hci_tl\cc26xx\cc26xx_hci_tl_none_v41.a" diff --git a/examples/cc2650lp/simple_central/iar/simple_central.custom_argvars b/examples/cc2650lp/simple_central/iar/simple_central.custom_argvars new file mode 100644 index 0000000..efb80c9 --- /dev/null +++ b/examples/cc2650lp/simple_central/iar/simple_central.custom_argvars @@ -0,0 +1,48 @@ + + + + + + TI_RTOS_DRIVERS_BASE + C:\ti\tirtos_cc13xx_cc26xx_2_20_01_08\products\tidrivers_cc13xx_cc26xx_2_20_01_10\packages + + + BIOS_BASE + C:\ti\tirtos_cc13xx_cc26xx_2_20_01_08\products\bios_6_46_01_38\packages + + + XDCPATH + $PROJ_DIR$\..\..\..\..\..\src\components\display_eng;C:\ti\tirtos_cc13xx_cc26xx_2_20_01_08\products\tidrivers_cc13xx_cc26xx_2_20_01_10\packages;C:\ti\tirtos_cc13xx_cc26xx_2_20_01_08\products\bios_6_46_01_38\packages;C:\ti\simplelink\ble_sdk_2_02_01_18 + + + CC26XXWARE + C:\ti\tirtos_cc13xx_cc26xx_2_20_01_08\products\cc26xxware_2_24_02_17393 + + + XDCROOT + C:\ti\xdctools_3_32_00_06_core + + + SRC_EX + C:\ti\simplelink\ble_sdk_2_02_01_18\src + + + SRC_BLE_CORE + C:\ti\simplelink\ble_sdk_2_02_01_18\src + + + SRC_COMMON + C:\ti\simplelink\ble_sdk_2_02_01_18\src\components + + + TOOLS_BLE + C:\ti\simplelink\ble_sdk_2_02_01_18\tools + + + ROM + C:\ti\simplelink\ble_sdk_2_02_01_18\src\rom + + + + + diff --git a/examples/cc2650lp/simple_central/iar/simple_central.eww b/examples/cc2650lp/simple_central/iar/simple_central.eww new file mode 100644 index 0000000..4db5250 --- /dev/null +++ b/examples/cc2650lp/simple_central/iar/simple_central.eww @@ -0,0 +1,13 @@ + + + + + $WS_DIR$\app\cc2650lp_app.ewp + + + $WS_DIR$\stack\cc2650lp_stack.ewp + + + + + diff --git a/examples/cc2650lp/simple_central/iar/stack/build_config.opt b/examples/cc2650lp/simple_central/iar/stack/build_config.opt new file mode 100644 index 0000000..28d7886 --- /dev/null +++ b/examples/cc2650lp/simple_central/iar/stack/build_config.opt @@ -0,0 +1,144 @@ +/****************************************************************************** + + @file build_config.opt + + @brief This file contains the Bluetooth Low Energy (BLE) build config options. + + Group: WCS, BTS + Target Device: CC2650, CC2640, CC1350 + + ****************************************************************************** + + Copyright (c) 2011-2016, Texas Instruments Incorporated + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * 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. + + * Neither the name of Texas Instruments Incorporated nor the names of + its contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 THE COPYRIGHT OWNER 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. + + ****************************************************************************** + Release Name: ble_sdk_2_02_00_31_s + Release Date: 2016-06-16 18:59:11 + *****************************************************************************/ + +/* + The following is a list of all possible build defines and corresponding options + that can be set for each define: + + GATT_DB_OFF_CHIP - Indicates that the GATT database is maintained off the chip on the + Application Processor (AP). + + GAP_BOND_MGR - Used to include the Bond Manager + + HOST_CONFIG (BLE Host Build Configurations) Possible Options: + PERIPHERAL_CFG - Used to include the GAP Peripheral Role support + CENTRAL_CFG - Used to include the GAP Central Role support + OBSERVER_CFG - Used to include the GAP Observer Role support + BROADCASTER_CFG - Used to include the GAP Broadcaster Role support + + BLE_V41_FEATURES Configure the stack to use features from the BLE 4.1 Specification + L2CAP_COC_CFG - Enable L2CAP Connection Oriented Channels + V41_CTRL_CFG - Enable Ping, Slave Feature Exchange, Connection Parameter Request, and + Master Slave connection roles within the Controller + + BLE_V42_FEATURES Configure the stack to use features from the BLE 4.2 Specification + EXT_DATA_LEN_CFG - Enable the Extended Data Length Feature in the Controller + SECURE_CONNS_CFG - Enable Secure Connections Pairing Procedure + PRIVACY_1_2_CFG - Enable Enahnced Privacy + + HCI_TL_FULL - All supported HCI commands are available via the Tranport Layer's NPI. + - Intended for NP solution. + HCI_TL_PTM - Only those HCI commands needed for Production Test Mode are available + via the Transport Layer's NPI + - Intended for SOC solutions where, during production, accesss is temporarily + needed (e.g. for PHY testing using Direct Test Mode, etc.). + HCI_TL_NONE - No supported HCI commands are available via the Transport Layer's NPI. + - Intended for SOC solutions. + + Below is general information for using and/or changing this configuration option file: + + Combo Roles: Combo roles can be set by defining multiple roles for HOST_CONFIG. The possible + combo roles and HOST_CONFIG defines are: + Peirpheral + Observer : PERIPHERAL_CFG+OBSERVER_CFG + Central + Broadcaster : CENTRAL_CFG+BROADCASTER_CFG + Peripheral + Central : PERIPHERAL_CFG+CENTRAL_CFG + Broadcaster + Observer : BROADCASTER_CFG+OBSERVER_CFG + + LibSearch Tool: There is a pre build action for every stack project that runs a tool + lib_search.exe. This tool aims to automatically import the correct library + files into your project based on the defines in this file. + + The locations of all library files and their correspond options are + /ble_core/ble_[host,ctrl]_lib/ for stack libs + and at /ble_core/hci_tl_lib/ for + HCI Transport Layer libs + + If an library is found that was built with matching options, it will be + copied into the project local directory at /../../lib/ and + subsequently linked with the stack. + + If you experience a build error with lib_search.exe, expand the build error + message by clicking Tools->Options->Messages->Show build messages:->All. + The error messages printed out by the LibSearch tool should now appear in + your Build Message window. + +*/ + +/* BLE Host Build Configurations */ +/* -DHOST_CONFIG=PERIPHERAL_CFG */ +-DHOST_CONFIG=CENTRAL_CFG +/* -DHOST_CONFIG=OBSERVER_CFG */ +/* -DHOST_CONFIG=BROADCASTER_CFG */ +/* -DHOST_CONFIG=PERIPHERAL_CFG+OBSERVER_CFG */ +/* -DHOST_CONFIG=CENTRAL_CFG+BROADCASTER_CFG */ +/* -DHOST_CONFIG=PERIPHERAL_CFG+CENTRAL_CFG */ +/* -DHOST_CONFIG=OBSERVER_CFG+BROADCASTER_CFG */ + +/* GATT Database being off chip */ +/* -DGATT_DB_OFF_CHIP */ + +/* Include GAP Bond Manager */ +-DGAP_BOND_MGR + +/* BLE v4.1 Features */ +/* -DBLE_V41_FEATURES=L2CAP_COC_CFG+V41_CTRL_CFG */ +/* -DBLE_V41_FEATURES=L2CAP_COC_CFG */ +-DBLE_V41_FEATURES=V41_CTRL_CFG + +/* BLE v4.2 Features */ +/* -DBLE_V42_FEATURES=SECURE_CONNS_CFG+PRIVACY_1_2_CFG+EXT_DATA_LEN_CFG */ +/* -DBLE_V42_FEATURES=SECURE_CONNS_CFG+PRIVACY_1_2_CFG */ +/* -DBLE_V42_FEATURES=PRIVACY_1_2_CFG+EXT_DATA_LEN_CFG */ +-DBLE_V42_FEATURES=SECURE_CONNS_CFG+EXT_DATA_LEN_CFG +/* -DBLE_V42_FEATURES=SECURE_CONNS_CFG */ +/* -DBLE_V42_FEATURES=PRIVACY_1_2_CFG */ +/*-DBLE_V42_FEATURES=EXT_DATA_LEN_CFG */ + +/* Include Transport Layer (Full or PTM) */ +-DHCI_TL_NONE +/* -DHCI_TL_PTM */ +/* -DHCI_TL_FULL */ + diff --git a/examples/cc2650lp/simple_central/iar/stack/cc2650lp_stack.ewd b/examples/cc2650lp/simple_central/iar/stack/cc2650lp_stack.ewd new file mode 100644 index 0000000..d6e9103 --- /dev/null +++ b/examples/cc2650lp/simple_central/iar/stack/cc2650lp_stack.ewd @@ -0,0 +1,1522 @@ + + + + 2 + + FlashROM + + ARM + + 1 + + C-SPY + 2 + + 27 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + CMSISDAP_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 1 + 1 + 1 + + + + + + + + + IJET_ID + 2 + + 6 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + JLINK_ID + 2 + + 15 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + MACRAIGOR_ID + 2 + + 3 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + PEMICRO_ID + 2 + + 2 + 1 + 1 + + + + + + + + + RDI_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + STLINK_ID + 2 + + 3 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + XDS100_ID + 2 + + 4 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $TOOLKIT_DIR$\plugins\middleware\HCCWare\HCCWare.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\middleware\PercepioTraceExporter\PercepioTraceExportPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\AVIX\AVIX.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB7_Plugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin + 0 + + + + + + diff --git a/examples/cc2650lp/simple_central/iar/stack/cc2650lp_stack.ewp b/examples/cc2650lp/simple_central/iar/stack/cc2650lp_stack.ewp new file mode 100644 index 0000000..d0e3479 --- /dev/null +++ b/examples/cc2650lp/simple_central/iar/stack/cc2650lp_stack.ewp @@ -0,0 +1,1249 @@ + + + + 2 + + FlashROM + + ARM + + 1 + + General + 3 + + 24 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 31 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + 0 + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + "$TOOLS_BLE$/lib_search/lib_search.exe" $PROJ_DIR$/build_config.opt "$TOOLS_BLE$/lib_search/params_split_cc2640.xml" $SRC_BLE_CORE$/../blelib $PROJ_DIR$/../config/lib_linker.cmd + "$TOOLS_BLE$/frontier/frontier.exe" iar "$PROJ_DIR$/$CONFIG_NAME$/List/simple_central_cc2650lp_stack.map" "$PROJ_DIR$/../config/iar_boundary.bdef" "$PROJ_DIR$/../config/iar_boundary.xcl" + + + + ILINK + 0 + + 17 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + HAL + + Common + + $SRC_COMMON$\hal\src\common\hal_assert.c + + + + Include + + $SRC_COMMON$\hal\src\inc\hal_adc.h + + + $SRC_COMMON$\hal\src\inc\hal_assert.h + + + $SRC_COMMON$\hal\src\inc\hal_board.h + + + $SRC_COMMON$\hal\src\inc\hal_defs.h + + + $SRC_COMMON$\hal\src\inc\hal_key.h + + + $SRC_COMMON$\hal\src\inc\hal_lcd.h + + + $SRC_COMMON$\hal\src\inc\hal_led.h + + + $SRC_COMMON$\hal\src\inc\hal_sleep.h + + + $SRC_COMMON$\hal\src\inc\hal_timer.h + + + $SRC_COMMON$\hal\src\inc\hal_uart.h + + + + Target + + CC2650 + + _common + + $SRC_COMMON$\hal\src\target\_common\hal_mcu.h + + + + Config + + $SRC_COMMON$\hal\src\target\_common\hal_board_cfg.h + + + + Drivers + + $SRC_COMMON$\hal\src\target\_common\hal_flash_wrapper.c + + + $SRC_COMMON$\hal\src\target\_common\hal_gpio_wrapper.h + + + $SRC_COMMON$\hal\src\target\_common\hal_rtc_wrapper.c + + + $SRC_COMMON$\hal\src\target\_common\hal_rtc_wrapper.h + + + $SRC_COMMON$\hal\src\target\_common\hal_trng_wrapper.c + + + $SRC_COMMON$\hal\src\target\_common\hal_trng_wrapper.h + + + + + + + ICallBLE + + $SRC_BLE_CORE$\icall\stack\ble_dispatch.c + + + $SRC_BLE_CORE$\icall\inc\ble_dispatch.h + + + + INCLUDE + + $SRC_BLE_CORE$\inc\att.h + + + $SRC_BLE_CORE$\inc\gap.h + + + $SRC_BLE_CORE$\inc\gatt.h + + + $SRC_BLE_CORE$\inc\gatt_uuid.h + + + $SRC_BLE_CORE$\inc\hci.h + + + $SRC_BLE_CORE$\inc\l2cap.h + + + $SRC_BLE_CORE$\inc\linkdb.h + + + $SRC_BLE_CORE$\controller\cc26xx\inc\ll.h + + + $SRC_BLE_CORE$\inc\sm.h + + + + LIB + + $PROJ_DIR$\..\config\lib_linker.cmd + + + + NPI + + $SRC_BLE_CORE$\common\cc26xx\npi\stack\npi.c + + + + OSAL + + $SRC_COMMON$\osal\src\inc\comdef.h + + + $SRC_COMMON$\osal\src\common\osal.c + + + $SRC_COMMON$\osal\src\inc\osal.h + + + $SRC_COMMON$\osal\src\common\osal_bufmgr.c + + + $SRC_COMMON$\osal\src\inc\osal_bufmgr.h + + + $SRC_COMMON$\osal\src\common\osal_cbtimer.c + + + $SRC_COMMON$\osal\src\inc\osal_cbtimer.h + + + $SRC_COMMON$\osal\src\common\osal_clock.c + + + $SRC_COMMON$\osal\src\inc\osal_clock.h + + + $SRC_COMMON$\osal\src\inc\osal_memory.h + + + $SRC_COMMON$\osal\src\common\osal_memory_icall.c + + + $SRC_COMMON$\osal\src\common\osal_pwrmgr.c + + + $SRC_COMMON$\osal\src\inc\osal_pwrmgr.h + + + $SRC_COMMON$\osal\src\inc\osal_snv.h + + + $SRC_COMMON$\osal\src\mcu\cc26xx\osal_snv_wrapper.c + + + $SRC_COMMON$\osal\src\inc\osal_task.h + + + $SRC_COMMON$\osal\src\common\osal_timers.c + + + $SRC_COMMON$\osal\src\inc\osal_timers.h + + + + Profiles + + $SRC_BLE_CORE$\profiles\roles\gap.c + + + $SRC_BLE_CORE$\profiles\roles\gapbondmgr.c + + + $SRC_BLE_CORE$\profiles\roles\gapbondmgr.h + + + $SRC_BLE_CORE$\host\gattservapp_util.c + + + $SRC_BLE_CORE$\host\sm_ecc.c + + + + Startup + + $SRC_BLE_CORE$\icall\stack\ble_user_config.c + + + $SRC_BLE_CORE$\common\cc26xx\icall_startup.c + + + $SRC_BLE_CORE$\examples\simple_central\cc26xx\stack\osal_icall_ble.c + + + $SRC_BLE_CORE$\rom\rom_jt.c + + + + Tools + + $SRC_BLE_CORE$\config\build_components.opt + + + $PROJ_DIR$\build_config.opt + + + $SRC_BLE_CORE$\common\cc26xx\iar\cc26xx_stack.icf + + + $SRC_BLE_CORE$\common\cc26xx\onboard.c + + + $SRC_BLE_CORE$\common\cc26xx\onboard.h + + + + + diff --git a/src/components/display_eng/ti/mw/display/DisplaySharp.c b/src/components/display_eng/ti/mw/display/DisplaySharp.c new file mode 100644 index 0000000..af917ac --- /dev/null +++ b/src/components/display_eng/ti/mw/display/DisplaySharp.c @@ -0,0 +1,480 @@ +/* + * Copyright (c) 2016, Texas Instruments Incorporated + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * 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. + * + * * Neither the name of Texas Instruments Incorporated nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 THE COPYRIGHT OWNER 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. + */ + +/* ----------------------------------------------------------------------------- + * Includes + * ------------------------------------------------------------------------------ + */ +// TI RTOS drivers +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +/* ----------------------------------------------------------------------------- + * Constants and macros + * ------------------------------------------------------------------------------ + */ +// Timeout of semaphore that controls exclusive to the LCD (infinite) +#define ACCESS_TIMEOUT BIOS_WAIT_FOREVER + +/* ----------------------------------------------------------------------------- + * Type definitions + * ------------------------------------------------------------------------------ + */ + + +/* ----------------------------------------------------------------------------- + * Local variables + * ------------------------------------------------------------------------------ + */ +/* Display function table for sharp implementation */ +const Display_FxnTable DisplaySharp_fxnTable = { + DisplaySharp_open, + DisplaySharp_clear, + DisplaySharp_clearLines, + DisplaySharp_put5, + DisplaySharp_close, + DisplaySharp_control, + DisplaySharp_getType, +}; + +/* ----------------------------------------------------------------------------- + * Functions + * ------------------------------------------------------------------------------ + */ +/*! + * @fn DisplaySharp_open + * + * @brief Initialize the LCD + * + * @descr Initializes the pins used by the LCD, creates resource access + * protection semaphore, turns on the LCD device, initializes the + * frame buffer, initializes to white background/dark foreground, + * and finally clears the object->displayColor. + * + * @param hDisplay - pointer to Display_Config struct + * @param params - display parameters + * + * @return Pointer to Display_Config struct + */ +Display_Handle DisplaySharp_open(Display_Handle hDisplay, + Display_Params *params) +{ + DisplaySharp_HWAttrs *hwAttrs = (DisplaySharp_HWAttrs *)hDisplay->hwAttrs; + DisplaySharp_Object *object = (DisplaySharp_Object *)hDisplay->object; + + PIN_Config pinTable[4 + 1]; + + object->lineClearMode = params->lineClearMode; + + uint32_t i = 0; + if (hwAttrs->csPin != PIN_TERMINATE) + { + pinTable[i++] = hwAttrs->csPin | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX; + } + if (hwAttrs->extcominPin != PIN_TERMINATE) + { + pinTable[i++] = hwAttrs->extcominPin | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX; + } + if (hwAttrs->powerPin != PIN_TERMINATE) + { + pinTable[i++] = hwAttrs->powerPin | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MAX; + } + if (hwAttrs->enablePin != PIN_TERMINATE) + { + pinTable[i++] = hwAttrs->enablePin | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MAX; + } + pinTable[i++] = PIN_TERMINATE; + + object->hPins = PIN_open(&object->pinState, pinTable); + if (object->hPins == NULL) + { + Log_error0("Couldn't open pins for Sharp96x96"); + return NULL; + } + + SPI_Params spiParams; + SPI_Params_init(&spiParams); + spiParams.bitRate = 4000000; + + object->hSpi = SPI_open(hwAttrs->spiIndex, &spiParams); + + if (object->hSpi == NULL) + { + Log_error0("Couldn't open SPI driver for Sharp96x96"); + PIN_close(object->hPins); + object->hPins = NULL; + return NULL; + } + + // Init colors + object->displayColor.bg = ClrBlack; + object->displayColor.fg = ClrWhite; + + // Exclusive access + Semaphore_Params semParams; + + Semaphore_Params_init(&semParams); + semParams.mode = Semaphore_Mode_BINARY; + Semaphore_construct(&object->semLCD, 1, &semParams); + + // Grab LCD + Semaphore_pend((Semaphore_Handle) & object->semLCD, ACCESS_TIMEOUT); + + // Initialize the GrLib back-end transport + SharpGrLib_init(object->hSpi, object->hPins, hwAttrs->csPin); + + object->g_sDisplay.lSize = sizeof(tDisplay); + object->g_sDisplay.pFxns = &g_sharpFxns; + object->g_sDisplay.pvDisplayData = object->displayBuffer; + object->g_sDisplay.usHeight = hwAttrs->pixelHeight; + object->g_sDisplay.usWidth = hwAttrs->pixelWidth; + object->g_sDisplay.pvDisplayData = hwAttrs->displayBuf; + + // Graphics library init + GrContextInit(&object->g_sContext, &object->g_sDisplay, &g_sharpFxns); + + // Graphics properties + GrContextForegroundSet(&object->g_sContext, object->displayColor.fg); + GrContextBackgroundSet(&object->g_sContext, object->displayColor.bg); + GrContextFontSet(&object->g_sContext, &g_sFontFixed6x8); + + // Clear display + GrClearDisplay(&object->g_sContext); + GrFlush(&object->g_sContext); + + // Release LCD + Semaphore_post((Semaphore_Handle) & object->semLCD); + + return hDisplay; +} + + +/*! + * @fn DisplaySharp_clear + * + * @brief Clears the display + * + * @param hDisplay - pointer to Display_Config struct + * + * @return void + */ +void DisplaySharp_clear(Display_Handle hDisplay) +{ + DisplaySharp_Object *object = (DisplaySharp_Object *)hDisplay->object; + + if (object->hPins == NULL) + { + return; + } + + // Grab LCD + if (Semaphore_pend((Semaphore_Handle) & object->semLCD, ACCESS_TIMEOUT)) + { + GrClearDisplay(&object->g_sContext); + GrFlush(&object->g_sContext); + + // Release LCD + Semaphore_post((Semaphore_Handle) & object->semLCD); + } +} + + +/*! + * @fn DisplaySharp_clearLines + * + * @brief Clears lines lineFrom-lineTo of the display, inclusive + * + * @param hDisplay - pointer to Display_Config struct + * @param lineFrom - line index (0 .. ) + * @param lineTo - line index (0 .. ) + * + * @return void + */ +void DisplaySharp_clearLines(Display_Handle hDisplay, + uint8_t lineFrom, uint8_t lineTo) +{ + DisplaySharp_Object *object = (DisplaySharp_Object *)hDisplay->object; + + if (lineTo <= lineFrom) + { + lineTo = lineFrom; + } + + tRectangle rect = { + .sXMin = 0, + .sXMax = object->g_sContext.sClipRegion.sXMax, + .sYMin = lineFrom * object->g_sContext.pFont->ucHeight, + .sYMax = (lineTo + 1) * object->g_sContext.pFont->ucHeight - 1, + }; + + GrContextForegroundSet(&object->g_sContext, object->displayColor.bg); + GrRectFill(&object->g_sContext, &rect); + GrContextForegroundSet(&object->g_sContext, object->displayColor.fg); + GrFlush(&object->g_sContext); +} + + +/*! + * @fn DisplaySharp_put5 + * + * @brief Write a text string to a specific line/column of the display + * + * @param hDisplay - pointer to Display_Config struct + * @param line - line index (0..) + * @param column - column index (0..) + * @param fmt - format string + * @param aN - optional format arguments + * + * @return void + */ +void DisplaySharp_put5(Display_Handle hDisplay, uint8_t line, + uint8_t column, uintptr_t fmt, uintptr_t a0, + uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4) +{ + DisplaySharp_Object *object = (DisplaySharp_Object *)hDisplay->object; + + uint8_t xp, yp, clearStartX, clearEndX; + + char dispStr[23]; + + if (object->hPins == NULL) + { + return; + } + + // Grab LCD + if (Semaphore_pend((Semaphore_Handle) & object->semLCD, ACCESS_TIMEOUT)) + { + xp = column * object->g_sContext.pFont->ucMaxWidth + 1; + yp = line * object->g_sContext.pFont->ucHeight + 0; + clearStartX = clearEndX = xp; + + switch (object->lineClearMode) + { + case DISPLAY_CLEAR_LEFT: + clearStartX = 0; + break; + case DISPLAY_CLEAR_RIGHT: + clearEndX = object->g_sContext.sClipRegion.sXMax; + break; + case DISPLAY_CLEAR_BOTH: + clearStartX = 0; + clearEndX = object->g_sContext.sClipRegion.sXMax; + break; + case DISPLAY_CLEAR_NONE: + default: + break; + } + + if (clearStartX != clearEndX) + { + tRectangle rect = { + .sXMin = clearStartX, + .sXMax = clearEndX, + .sYMin = yp, + .sYMax = yp + object->g_sContext.pFont->ucHeight - 1, + }; + + GrContextForegroundSet(&object->g_sContext, object->displayColor.bg); + GrRectFill(&object->g_sContext, &rect); + GrContextForegroundSet(&object->g_sContext, object->displayColor.fg); + } + + System_snprintf(dispStr, sizeof(dispStr), (xdc_CString)fmt, a0, a1, a2, a3, a4); + + // Draw a text on the display + GrStringDraw(&object->g_sContext, + dispStr, + AUTO_STRING_LENGTH, + xp, + yp, + OPAQUE_TEXT); + + GrFlush(&object->g_sContext); + + // Release LCD + Semaphore_post((Semaphore_Handle) & object->semLCD); + } +} + + +/*! + * @fn DisplaySharp_close + * + * @brief Turns of the display and releases the LCD control pins + * + * @param hDisplay - pointer to Display_Config struct + * + * @return void + */ +void DisplaySharp_close(Display_Handle hDisplay) +{ + DisplaySharp_HWAttrs *hwAttrs = (DisplaySharp_HWAttrs *)hDisplay->hwAttrs; + DisplaySharp_Object *object = (DisplaySharp_Object *)hDisplay->object; + + if (object->hPins == NULL) + { + return; + } + + // Grab LCD + if (Semaphore_pend((Semaphore_Handle) & object->semLCD, ACCESS_TIMEOUT)) + { + // Turn off the display + PIN_setOutputValue(object->hPins, hwAttrs->enablePin, 0); + + // Release resources + PIN_close(object->hPins); + object->hPins = NULL; + + SPI_close(object->hSpi); + object->hSpi = NULL; + + // Deconfigure GrLib back-end + SharpGrLib_init(NULL, NULL, PIN_UNASSIGNED); + + // Release LCD + Semaphore_post((Semaphore_Handle) & object->semLCD); + } +} + +/*! + * @fn DisplaySharp_control + * + * @brief Function for setting control parameters of the Display driver + * after it has been opened. + * + * @param hDisplay - pointer to Display_Config struct + * @param cmd - command to execute, supported commands are: + * | Command | Description | + * |------------------------------- |-------------------------| + * | ::DISPLAY_CMD_TRANSPORT_CLOSE | Close SPI but leave control pins | + * | ::DISPLAY_CMD_TRANSPORT_OPEN | Re-open SPI driver | + * @param arg - argument to the command + * + * @return ::DISPLAY_STATUS_SUCCESS if success, or error code if error. + */ +int DisplaySharp_control(Display_Handle hDisplay, unsigned int cmd, void *arg) +{ + DisplaySharp_HWAttrs *hwAttrs = (DisplaySharp_HWAttrs *)hDisplay->hwAttrs; + DisplaySharp_Object *object = (DisplaySharp_Object *)hDisplay->object; + + /* Initialize return value */ + int ret = DISPLAY_STATUS_ERROR; + + /* Perform command */ + switch(cmd) + { + case DISPLAY_CMD_TRANSPORT_CLOSE: + // Grab LCD + if (Semaphore_pend((Semaphore_Handle) & object->semLCD, ACCESS_TIMEOUT)) + { + if (object->hSpi) + { + // Close SPI and tell back-end there is no SPI + SPI_close(object->hSpi); + SharpGrLib_init(NULL, object->hPins, hwAttrs->csPin); + object->hSpi = NULL; + ret = DISPLAY_STATUS_SUCCESS; + } + // Release LCD + Semaphore_post((Semaphore_Handle) & object->semLCD); + } + break; + + case DISPLAY_CMD_TRANSPORT_OPEN: + // Grab LCD + if (Semaphore_pend((Semaphore_Handle) & object->semLCD, ACCESS_TIMEOUT)) + { + if (NULL == object->hSpi) + { + // Re-open SPI and re-init back-end + SPI_Params spiParams; + SPI_Params_init(&spiParams); + spiParams.bitRate = 4000000; + object->hSpi = SPI_open(hwAttrs->spiIndex, &spiParams); + SharpGrLib_init(object->hSpi, object->hPins, hwAttrs->csPin); + ret = DISPLAY_STATUS_SUCCESS; + } + // Release LCD + Semaphore_post((Semaphore_Handle) & object->semLCD); + } + break; + + case DISPLAYSHARP_CMD_SET_COLORS: + // Grab LCD + if (Semaphore_pend((Semaphore_Handle) & object->semLCD, ACCESS_TIMEOUT)) + { + object->displayColor = *(DisplaySharpColor_t *)arg; + + GrContextForegroundSet(&object->g_sContext, object->displayColor.fg); + GrContextBackgroundSet(&object->g_sContext, object->displayColor.bg); + + // Release LCD + Semaphore_post((Semaphore_Handle) & object->semLCD); + + // Return success + ret = DISPLAY_STATUS_SUCCESS; + } + break; + + default: + /* The command is not defined */ + ret = SPI_STATUS_UNDEFINEDCMD; + break; + } + + return ret; +} + +/*! + * @fn DisplaySharp_getType + * + * @brief Returns type of transport + * + * @return Display type define LCD + */ +unsigned int DisplaySharp_getType(void) +{ + return Display_Type_LCD | Display_Type_GRLIB; +} diff --git a/src/components/display_eng/ti/mw/display/DisplayUart.c b/src/components/display_eng/ti/mw/display/DisplayUart.c new file mode 100644 index 0000000..77de1de --- /dev/null +++ b/src/components/display_eng/ti/mw/display/DisplayUart.c @@ -0,0 +1,331 @@ +/* + * Copyright (c) 2016, Texas Instruments Incorporated + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * 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. + * + * * Neither the name of Texas Instruments Incorporated nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 THE COPYRIGHT OWNER 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. + */ + +/* ----------------------------------------------------------------------------- + * Includes + * ----------------------------------------------------------------------------- + */ +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include + +/* ----------------------------------------------------------------------------- + * Constants and macros + * ----------------------------------------------------------------------------- + */ +#ifndef MIN +# define MIN(n, m) (((n) > (m)) ? (m) : (n)) +#endif + +#define DISPLAY_UART_ESC_INITIAL "\x1b\x63" /* Reset terminal */ \ + "\x1b[2J" /* Clear screen */ \ + "\x1b[10r" /* Scrolling region from line 10 */ \ + "\x1b[11;1H" /* Set initial cursor to line 11 */ + +#define DISPLAY_UART_ESC_MOVEPOS_FMT "\x1b\x37" /* Save cursor position */ \ + "\x1b[10r" /* Retransmit scroll */ \ + "\x1b[%d;%dH" /* Move cursor fmt str */ + +#define DISPLAY_UART_ESC_RESTOREPOS "\x1b\x38" /* Restore saved cursor pos */ + +#define DISPLAY_UART_ESC_CLEAR_SCREEN "\x1b[2J" /* Clear screen */ +#define DISPLAY_UART_ESC_CLEAR_CUR_LEFT "\x1b[1K" /* Clear cursor left */ +#define DISPLAY_UART_ESC_CLEAR_CUR_RIGHT "\x1b[0K" /* Clear cursor right */ +#define DISPLAY_UART_ESC_CLEAR_BOTH "\x1b[2K" /* Clear line */ +#define DISPLAY_UART_ESC_CLEARSEQ_LEN 4 + +/* ----------------------------------------------------------------------------- + * Type definitions + * ----------------------------------------------------------------------------- + */ + + +/* ----------------------------------------------------------------------------- + * Local variables + * ----------------------------------------------------------------------------- + */ +/* Display function table for UART implementation */ +const Display_FxnTable DisplayUart_fxnTable = { + DisplayUart_open, + DisplayUart_clear, + DisplayUart_clearLines, + DisplayUart_put5, + DisplayUart_close, + DisplayUart_control, + DisplayUart_getType, +}; + +/* ----------------------------------------------------------------------------- + * Functions + * ----------------------------------------------------------------------------- + */ +/*! + * @fn DisplayUart_open + * + * @brief Initialize the UART transport + * + * @descr Opens the UART index specified in the HWAttrs, and creates a + * mutex semaphore + * + * @param hDisplay - pointer to Display_Config struct + * @param params - display parameters + * + * @return Pointer to Display_Config struct + */ +Display_Handle DisplayUart_open(Display_Handle hDisplay, + Display_Params *params) +{ + DisplayUart_HWAttrs *hwAttrs = (DisplayUart_HWAttrs *)hDisplay->hwAttrs; + DisplayUart_Object *object = (DisplayUart_Object *)hDisplay->object; + + UART_Params uartParams; + UART_Params_init(&uartParams); + uartParams.baudRate = hwAttrs->baudRate; + uartParams.writeMode = UART_MODE_BLOCKING; + + Semaphore_Params semParams; + Semaphore_Params_init(&semParams); + semParams.mode = Semaphore_Mode_BINARY; + Semaphore_construct(&object->mutex, 1, &semParams); + + switch (params->lineClearMode) + { + case DISPLAY_CLEAR_BOTH: object->lineClearSeq = DISPLAY_UART_ESC_CLEAR_BOTH; break; + case DISPLAY_CLEAR_LEFT: object->lineClearSeq = DISPLAY_UART_ESC_CLEAR_CUR_LEFT; break; + case DISPLAY_CLEAR_RIGHT: object->lineClearSeq = DISPLAY_UART_ESC_CLEAR_CUR_RIGHT; break; + default: /* fall-through */ + case DISPLAY_CLEAR_NONE: object->lineClearSeq = NULL; break; + } + + object->hUart = UART_open(hwAttrs->uartIdx, &uartParams); + if (NULL == object->hUart) + { + Log_print0(Diags_USER1, "DisplayUart.c: Couldn't open UART"); + return NULL; + } + + /* Send VT100 initial config to terminal */ + UART_write(object->hUart, DISPLAY_UART_ESC_INITIAL, sizeof DISPLAY_UART_ESC_INITIAL - 1); + + return hDisplay; +} + +/*! + * @fn DisplayUart_clear + * + * @brief Does nothing, as output is stateless. + * + * @param hDisplay - pointer to Display_Config struct + * + * @return void + */ +void DisplayUart_clear(Display_Handle hDisplay) +{ + DisplayUart_Object *object = (DisplayUart_Object *)hDisplay->object; + DisplayUart_HWAttrs *hwAttrs = (DisplayUart_HWAttrs *)hDisplay->hwAttrs; + + if (Semaphore_pend((Semaphore_Handle) & object->mutex, hwAttrs->mutexTimeout)) + { + UART_write(object->hUart, DISPLAY_UART_ESC_CLEAR_SCREEN, 4); + Semaphore_post((Semaphore_Handle) & object->mutex); + } +} + + +/*! + * @fn DisplayUart_clearLines + * + * @brief Does nothing, as output is stateless. + * + * @param hDisplay - pointer to Display_Config struct + * @param lineFrom - line index (0 .. ) + * @param lineTo - line index (0 .. ) + * + * @return void + */ +void DisplayUart_clearLines(Display_Handle hDisplay, + uint8_t lineFrom, uint8_t lineTo) +{ + DisplayUart_Object *object = (DisplayUart_Object *)hDisplay->object; + DisplayUart_HWAttrs *hwAttrs = (DisplayUart_HWAttrs *)hDisplay->hwAttrs; + + uint32_t strSize = 0; + uint32_t curLine = 0; + const uint8_t uartClearLineMoveDown[] = "\x1b[2K\x1b\x45"; + + if (lineTo <= lineFrom) + { + lineTo = lineFrom; + } + + if (Semaphore_pend((Semaphore_Handle) & object->mutex, hwAttrs->mutexTimeout)) + { + strSize += System_snprintf(hwAttrs->strBuf, hwAttrs->strBufLen, + DISPLAY_UART_ESC_MOVEPOS_FMT, lineFrom + 1, 0); + + for (curLine = lineFrom + 1; + curLine < lineTo + 2 && + hwAttrs->strBufLen - strSize > sizeof DISPLAY_UART_ESC_RESTOREPOS - 1; + curLine++) + { + memcpy(hwAttrs->strBuf + strSize, uartClearLineMoveDown, sizeof uartClearLineMoveDown - 1); + strSize += sizeof uartClearLineMoveDown - 1; + } + + memcpy(hwAttrs->strBuf + strSize, DISPLAY_UART_ESC_RESTOREPOS, sizeof DISPLAY_UART_ESC_RESTOREPOS - 1); + strSize += sizeof DISPLAY_UART_ESC_RESTOREPOS - 1; + + UART_write(object->hUart, hwAttrs->strBuf, strSize); + Semaphore_post((Semaphore_Handle) & object->mutex); + } +} + + +/*! + * @fn DisplayUart_put5 + * + * @brief Write a text string to UART with return and newline. + * + * @param hDisplay - pointer to Display_Config struct + * @param line - line index (0..) + * @param column - column index (0..) + * @param fmt - format string + * @param aN - optional format arguments + * + * @return void + */ +void DisplayUart_put5(Display_Handle hDisplay, uint8_t line, + uint8_t column, uintptr_t fmt, uintptr_t a0, + uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4) +{ + DisplayUart_Object *object = (DisplayUart_Object *)hDisplay->object; + DisplayUart_HWAttrs *hwAttrs = (DisplayUart_HWAttrs *)hDisplay->hwAttrs; + + uint32_t strSize = 0; + + char *strBuf = hwAttrs->strBuf; + const uint16_t bufLen = hwAttrs->strBufLen; + + if (Semaphore_pend((Semaphore_Handle) & object->mutex, hwAttrs->mutexTimeout)) + { + if (line != DisplayUart_SCROLLING) + { + /* Add cursor movement escape sequence */ + strSize += System_snprintf(strBuf + strSize, bufLen - strSize - 2, + DISPLAY_UART_ESC_MOVEPOS_FMT, line + 1, column + 1); + + /* Add line clearing escape sequence */ + if (object->lineClearSeq) + { + memcpy(strBuf + strSize, object->lineClearSeq, DISPLAY_UART_ESC_CLEARSEQ_LEN); + strSize += DISPLAY_UART_ESC_CLEARSEQ_LEN; + } + } + + strSize += System_snprintf(strBuf + strSize, bufLen - strSize - 2, (xdc_CString)fmt, a0, a1, a2, a3, a4); + + if (line != DisplayUart_SCROLLING) + { + memcpy(strBuf + strSize, DISPLAY_UART_ESC_RESTOREPOS, sizeof DISPLAY_UART_ESC_RESTOREPOS - 1); + strSize += 2; + } + else + { + strBuf[strSize++] = '\r'; + strBuf[strSize++] = '\n'; + } + + UART_write(object->hUart, strBuf, strSize); + Semaphore_post((Semaphore_Handle) & object->mutex); + } +} + + +/*! + * @fn DisplayUart_close + * + * @brief Closes the UART handle + * + * @param hDisplay - pointer to Display_Config struct + * + * @return void + */ +void DisplayUart_close(Display_Handle hDisplay) +{ + DisplayUart_Object *object = (DisplayUart_Object *)hDisplay->object; + + // Not sure what happens if someone is writing + UART_close(object->hUart); + object->hUart = NULL; + + // Not sure what happens if someone is pending + Semaphore_destruct(&object->mutex); +} + +/*! + * @fn DisplayUart_control + * + * @brief Function for setting control parameters of the Display driver + * after it has been opened. + * + * @param hDisplay - pointer to Display_Config struct + * @param cmd - command to execute + * @param arg - argument to the command + * + * @return ::DISPLAY_STATUS_UNDEFINEDCMD because no commands are supported + */ +int DisplayUart_control(Display_Handle hDisplay, unsigned int cmd, void *arg) +{ + return DISPLAY_STATUS_UNDEFINEDCMD; +} + +/*! + * @fn DisplayUart_getType + * + * @brief Returns type of transport + * + * @return Display type UART + */ +unsigned int DisplayUart_getType(void) +{ + return Display_Type_UART; +} diff --git a/src/components/display_eng/ti/mw/display/DisplayUart.h b/src/components/display_eng/ti/mw/display/DisplayUart.h new file mode 100644 index 0000000..f3c2dc4 --- /dev/null +++ b/src/components/display_eng/ti/mw/display/DisplayUart.h @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2016, Texas Instruments Incorporated + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * 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. + * + * * Neither the name of Texas Instruments Incorporated nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 THE COPYRIGHT OWNER 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. + */ + +#ifndef _DISPLAY_UART_H_ +#define _DISPLAY_UART_H_ + +#include +#include +#include +#include + +extern const Display_FxnTable DisplayUart_fxnTable; + +/* + * @brief Line number for text to appear in scrolling region + */ +#define DisplayUart_SCROLLING 0xFF + + +typedef struct DisplayUart_HWAttrs +{ + unsigned int uartIdx; + unsigned int baudRate; + unsigned int mutexTimeout; + char *strBuf; + uint16_t strBufLen; +} DisplayUart_HWAttrs; + + +typedef struct DisplayUart_Object +{ + UART_Handle hUart; + Semaphore_Struct mutex; + uint8_t *lineClearSeq; +} DisplayUart_Object, *DisplayUart_Handle; + + +Display_Handle DisplayUart_open(Display_Handle, + Display_Params * params); +void DisplayUart_clear(Display_Handle handle); +void DisplayUart_clearLines(Display_Handle handle, + uint8_t fromLine, + uint8_t toLine); +void DisplayUart_put5(Display_Handle handle, uint8_t line, + uint8_t column, uintptr_t fmt, uintptr_t a0, + uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4); +void DisplayUart_close(Display_Handle); +int DisplayUart_control(Display_Handle handle, unsigned int cmd, void *arg); +unsigned int DisplayUart_getType(void); + +#endif // _DISPLAY_UART_H_ diff --git a/src/examples/simple_central/cc26xx/app/simple_central.c b/src/examples/simple_central/cc26xx/app/simple_central.c new file mode 100644 index 0000000..014baef --- /dev/null +++ b/src/examples/simple_central/cc26xx/app/simple_central.c @@ -0,0 +1,1979 @@ +/****************************************************************************** + + @file simple_central.c + + @brief This file contains the Simple BLE Central sample application for use + with the CC2650 Bluetooth Low Energy Protocol Stack. + + Group: WCS, BTS + Target Device: CC2650, CC2640, CC1350 + + ****************************************************************************** + + Copyright (c) 2013-2016, Texas Instruments Incorporated + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * 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. + + * Neither the name of Texas Instruments Incorporated nor the names of + its contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 THE COPYRIGHT OWNER 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. + + ****************************************************************************** + Release Name: ble_sdk_2_02_00_31 + Release Date: 2016-06-16 18:57:29 + *****************************************************************************/ + +/********************************************************************* + * INCLUDES + */ +#include + +#include +#include +#include +#include + +#include "bcomdef.h" + +#include "hci_tl.h" +#include "linkdb.h" +#include "gatt.h" +#include "gapgattserver.h" +#include "gattservapp.h" +#include "central.h" +#include "gapbondmgr.h" +#include "simple_gatt_profile.h" + +#include "osal_snv.h" +#include "icall_apimsg.h" + +#include "util.h" +#include "board_key.h" +#include +#include "board.h" + +#include "simple_central.h" + +#include "ble_user_config.h" + + + + +/********************************************************************* + * MACROS + */ + +/********************************************************************* + * CONSTANTS + */ + +// Simple BLE Central Task Events +#define SBC_START_DISCOVERY_EVT 0x0001 +#define SBC_PAIRING_STATE_EVT 0x0002 +#define SBC_PASSCODE_NEEDED_EVT 0x0004 +#define SBC_RSSI_READ_EVT 0x0008 +#define SBC_KEY_CHANGE_EVT 0x0010 +#define SBC_STATE_CHANGE_EVT 0x0020 +#define SBC_CONNECTING_TIMEOUT_EVT 0x0040 + +// Maximum number of scan responses +#define DEFAULT_MAX_SCAN_RES 8 + +// Scan duration in ms +#define DEFAULT_SCAN_DURATION 4000 + +// Discovery mode (limited, general, all) +#define DEFAULT_DISCOVERY_MODE DEVDISC_MODE_ALL + +// TRUE to use active scan +#define DEFAULT_DISCOVERY_ACTIVE_SCAN TRUE + +// TRUE to use white list during discovery +#define DEFAULT_DISCOVERY_WHITE_LIST FALSE + +// TRUE to use high scan duty cycle when creating link +#define DEFAULT_LINK_HIGH_DUTY_CYCLE FALSE + +// TRUE to use white list when creating link +#define DEFAULT_LINK_WHITE_LIST FALSE + +// Initial minimum connection interval (units of 1.25 ms.) +#define INITIAL_MIN_CONN_INTERVAL 160 + +// Initial minimum connection interval (units of 1.25 ms.) +#define INITIAL_MAX_CONN_INTERVAL 320 + +// Initial slave latency +#define INITIAL_SLAVE_LATENCY 0 + +// Initial supervision timeout (units of 1.25 ms) +#define INITIAL_CONN_TIMEOUT 700 + +// Default RSSI polling period in ms +#define DEFAULT_RSSI_PERIOD 1000 + +// Whether to enable automatic parameter update request when a connection is +// formed +#define DEFAULT_ENABLE_UPDATE_REQUEST FALSE + +// Minimum connection interval (units of 1.25ms) if automatic parameter update +// request is enabled +#define DEFAULT_UPDATE_MIN_CONN_INTERVAL 80 + +// Maximum connection interval (units of 1.25ms) if automatic parameter update +// request is enabled +#define DEFAULT_UPDATE_MAX_CONN_INTERVAL 160 + +// Slave latency to use if automatic parameter update request is enabled +#define DEFAULT_UPDATE_SLAVE_LATENCY 0 + +// Supervision timeout value (units of 10ms) if automatic parameter update +// request is enabled +#define DEFAULT_UPDATE_CONN_TIMEOUT 600 + +// Default passcode +#define DEFAULT_PASSCODE 19655 + +// Default GAP pairing mode +#define DEFAULT_PAIRING_MODE GAPBOND_PAIRING_MODE_WAIT_FOR_REQ + +// Default MITM mode (TRUE to require passcode or OOB when pairing) +#define DEFAULT_MITM_MODE FALSE + +// Default bonding mode, TRUE to bond +#define DEFAULT_BONDING_MODE TRUE + +// Default GAP bonding I/O capabilities +#define DEFAULT_IO_CAPABILITIES GAPBOND_IO_CAP_DISPLAY_ONLY + +// Default service discovery timer delay in ms +#define DEFAULT_SVC_DISCOVERY_DELAY 1000 + +// TRUE to filter discovery results on desired service UUID +#define DEFAULT_DEV_DISC_BY_SVC_UUID TRUE + +// Length of bd addr as a string +#define B_ADDR_STR_LEN 15 + +// Task configuration +#define SBC_TASK_PRIORITY 1 + +#ifndef SBC_TASK_STACK_SIZE +#define SBC_TASK_STACK_SIZE 864 +#endif + +// Application states +typedef enum +{ + BLE_STATE_IDLE, + BLE_STATE_BROWSING, + BLE_STATE_CONNECTING, + BLE_STATE_CONNECTED, + BLE_STATE_DISCOVERED, + BLE_STATE_DISCONNECTING +} bleState_t; + + +// Discovery states +typedef enum +{ + BLE_DISC_STATE_IDLE, // Idle + BLE_DISC_STATE_MTU, // Exchange ATT MTU size + BLE_DISC_STATE_SVC, // Service discovery + BLE_DISC_STATE_CHAR // Characteristic discovery +} bleDiscState_t; + +// Connection parameter update +enum +{ + INITIAL_PARAMETERS, + DEFAULT_UPDATE_PARAMETERS +}; + +// Screen row +enum +{ + ROW_ZERO = 0, + ROW_ONE = 1, + ROW_TWO = 2, + ROW_THREE = 3, + ROW_FOUR = 4, + ROW_FIVE = 5, + ROW_SIX = 6, + ROW_SEVEN = 7 +}; + +// Menu item state +typedef enum { + MENU_ITEM_CONN_PARAM_UPDATE, + MENU_ITEM_RSSI, + MENU_ITEM_READ_WRITE, + MENU_ITEM_DISCONNECT + } MenuItem_t; + +/********************************************************************* + * TYPEDEFS + */ + +// App event passed from profiles. +typedef struct +{ + appEvtHdr_t hdr; // event header + uint8_t *pData; // event data +} sbcEvt_t; + +// RSSI read data structure +typedef struct +{ + Clock_Struct *pClock; // pointer to clock struct + uint16_t period; // how often to read RSSI + uint16_t connHandle; // connection handle +} readRssi_t; + +/** + * Type of device discovery (Scan) to perform. + */ +typedef struct +{ + char localName[20]; //!< Device's Name + uint8_t addrType; //!< Address Type: @ref ADDRTYPE_DEFINES + uint8_t addr[B_ADDR_LEN]; //!< Device's Address + uint8_t nameLength; //!< Device name length +} devRecInfo_t; + +/********************************************************************* + * GLOBAL VARIABLES + */ + +// Display Interface +Display_Handle dispHandle = NULL; + +/********************************************************************* + * EXTERNAL VARIABLES + */ + +/********************************************************************* + * LOCAL VARIABLES + */ + +// Entity ID globally used to check for source and/or destination of messages +static ICall_EntityID selfEntity; + +// Semaphore globally used to post events to the application thread +static ICall_Semaphore sem; + +// Clock object used to signal timeout +static Clock_Struct startDiscClock; + +// Clock object used to timeout connection +static Clock_Struct connectingClock; + +// Queue object used for app messages +static Queue_Struct appMsg; +static Queue_Handle appMsgQueue; + +// Task pending events +static uint16_t events = 0; + +// Task configuration +Task_Struct sbcTask; +Char sbcTaskStack[SBC_TASK_STACK_SIZE]; + +// GAP GATT Attributes +static const uint8_t attDeviceName[GAP_DEVICE_NAME_LEN] = "Simple BLE Central"; + +// Number of scan results and scan result index +static uint8_t scanRes; +static uint8_t scanIdx; + +// Scan result list +static devRecInfo_t devList[DEFAULT_MAX_SCAN_RES]; + +// Scanning state +static bool scanningStarted = FALSE; + +// Connection handle of current connection +static uint16_t connHandle = GAP_CONNHANDLE_INIT; + +// Application state +static bleState_t state = BLE_STATE_IDLE; + +// Discovery state +static bleDiscState_t discState = BLE_DISC_STATE_IDLE; + +// Connection paramters +static uint8_t currentConnectionParameter = INITIAL_PARAMETERS; + +//Connection option state +static MenuItem_t selectedMenuItem = MENU_ITEM_CONN_PARAM_UPDATE; + +// Discovered service start and end handle +static uint16_t svcStartHdl = 0; +static uint16_t svcEndHdl = 0; + +// Discovered characteristic handle +static uint16_t charHdl = 0; + +// Value to write +static uint8_t charVal = 0; + +// Value read/write toggle +static bool doWrite = FALSE; + +// GATT read/write procedure state +static bool procedureInProgress = FALSE; + +// Maximum PDU size (default = 27 octets) +static uint16_t maxPduSize; + +// Array of RSSI read structures +static readRssi_t readRssi[MAX_NUM_BLE_CONNS]; + +/********************************************************************* + * LOCAL FUNCTIONS + */ +static void SimpleBLECentral_init(void); +static void SimpleBLECentral_taskFxn(UArg a0, UArg a1); + +static void SimpleBLECentral_processGATTMsg(gattMsgEvent_t *pMsg); +static void SimpleBLECentral_handleKeys(uint8_t shift, uint8_t keys); +static void SimpleBLECentral_processStackMsg(ICall_Hdr *pMsg); +static void SimpleBLECentral_processAppMsg(sbcEvt_t *pMsg); +static void SimpleBLECentral_processRoleEvent(gapCentralRoleEvent_t *pEvent); +static void SimpleBLECentral_processGATTDiscEvent(gattMsgEvent_t *pMsg); +static void SimpleBLECentral_startDiscovery(void); +static bool SimpleBLECentral_findSvcUuid(uint16_t uuid, uint8_t *pData, + uint8_t dataLen); +static void SimpleBLECentral_discoverDevices(void); +void SimpleBLECentral_timeoutConnecting(UArg arg0); +static void SimpleBLECentral_addDeviceInfo(uint8_t *pAddr, uint8_t addrType); +static bool SimpleBLECentral_findLocalName(uint8_t *pEvtData, uint8_t dataLen); +static void SimpleBLECentral_addDeviceName(uint8_t i, uint8_t *pEvtData, + uint8_t dataLen); +static void SimpleBLECentral_processPairState(uint8_t pairState, uint8_t status); +static void SimpleBLECentral_processPasscode(uint16_t connectionHandle, + uint8_t uiOutputs); + +static void SimpleBLECentral_processCmdCompleteEvt(hciEvt_CmdComplete_t *pMsg); +static bStatus_t SimpleBLECentral_StartRssi(uint16_t connHandle, uint16_t period); +static bStatus_t SimpleBLECentral_CancelRssi(uint16_t connHandle); +static readRssi_t *SimpleBLECentral_RssiAlloc(uint16_t connHandle); +static readRssi_t *SimpleBLECentral_RssiFind(uint16_t connHandle); +static void SimpleBLECentral_RssiFree(uint16_t connHandle); + +static uint8_t SimpleBLECentral_eventCB(gapCentralRoleEvent_t *pEvent); +static void SimpleBLECentral_passcodeCB(uint8_t *deviceAddr, uint16_t connHandle, + uint8_t uiInputs, uint8_t uiOutputs); +static void SimpleBLECentral_pairStateCB(uint16_t connHandle, uint8_t pairState, + uint8_t status); + +void SimpleBLECentral_startDiscHandler(UArg a0); +void SimpleBLECentral_keyChangeHandler(uint8_t keys); +void SimpleBLECentral_readRssiHandler(UArg a0); + +static uint8_t SimpleBLECentral_enqueueMsg(uint8_t event, uint8_t status, + uint8_t *pData); + +/********************************************************************* + * PROFILE CALLBACKS + */ + +// GAP Role Callbacks +static gapCentralRoleCB_t SimpleBLECentral_roleCB = +{ + SimpleBLECentral_eventCB // Event callback +}; + +// Bond Manager Callbacks +static gapBondCBs_t SimpleBLECentral_bondCB = +{ + (pfnPasscodeCB_t)SimpleBLECentral_passcodeCB, // Passcode callback + SimpleBLECentral_pairStateCB // Pairing state callback +}; + +/********************************************************************* + * PUBLIC FUNCTIONS + */ + +/********************************************************************* + * @fn SimpleBLEPeripheral_createTask + * + * @brief Task creation function for the Simple BLE Peripheral. + * + * @param none + * + * @return none + */ +void SimpleBLECentral_createTask(void) +{ + Task_Params taskParams; + + // Configure task + Task_Params_init(&taskParams); + taskParams.stack = sbcTaskStack; + taskParams.stackSize = SBC_TASK_STACK_SIZE; + taskParams.priority = SBC_TASK_PRIORITY; + + Task_construct(&sbcTask, SimpleBLECentral_taskFxn, &taskParams, NULL); +} + +/********************************************************************* + * @fn SimpleBLECentral_Init + * + * @brief Initialization function for the Simple BLE Central App Task. + * This is called during initialization and should contain + * any application specific initialization (ie. hardware + * initialization/setup, table initialization, power up + * notification). + * + * @param none + * + * @return none + */ +static void SimpleBLECentral_init(void) +{ + uint8_t i; + + // ****************************************************************** + // N0 STACK API CALLS CAN OCCUR BEFORE THIS CALL TO ICall_registerApp + // ****************************************************************** + // Register the current thread as an ICall dispatcher application + // so that the application can send and receive messages. + ICall_registerApp(&selfEntity, &sem); + + // Create an RTOS queue for message from profile to be sent to app. + appMsgQueue = Util_constructQueue(&appMsg); + + // Setup discovery delay as a one-shot timer + Util_constructClock(&startDiscClock, SimpleBLECentral_startDiscHandler, + DEFAULT_SVC_DISCOVERY_DELAY, 0, false, 0); + + // Set initial connection parameter values + GAP_SetParamValue(TGAP_CONN_EST_INT_MIN, INITIAL_MIN_CONN_INTERVAL); + GAP_SetParamValue(TGAP_CONN_EST_INT_MAX, INITIAL_MAX_CONN_INTERVAL); + GAP_SetParamValue(TGAP_CONN_EST_SUPERV_TIMEOUT, INITIAL_CONN_TIMEOUT); + GAP_SetParamValue(TGAP_CONN_EST_LATENCY, INITIAL_SLAVE_LATENCY); + + // Construct clock for connecting timeout + Util_constructClock(&connectingClock, SimpleBLECentral_timeoutConnecting, + DEFAULT_SCAN_DURATION, 0, false, 0); + + Board_initKeys(SimpleBLECentral_keyChangeHandler); + + //In the project predefines, UART is disabled by default. Thus LCD display will be used. + //Please see the project documentation for instructions on choosing LDC or UART display. + Display_Params dispParams; + dispParams.lineClearMode = DISPLAY_CLEAR_BOTH; + dispHandle = Display_open(Display_Type_LCD, &dispParams); + if (dispHandle == NULL) dispHandle = Display_open(Display_Type_UART, &dispParams); // Try UART if no LCD found + + // Initialize internal data + for (i = 0; i < MAX_NUM_BLE_CONNS; i++) + { + readRssi[i].connHandle = GAP_CONNHANDLE_ALL; + readRssi[i].pClock = NULL; + } + + // Setup Central Profile + { + uint8_t scanRes = DEFAULT_MAX_SCAN_RES; + + GAPCentralRole_SetParameter(GAPCENTRALROLE_MAX_SCAN_RES, sizeof(uint8_t), + &scanRes); + } + + // Setup GAP + GAP_SetParamValue(TGAP_GEN_DISC_SCAN, DEFAULT_SCAN_DURATION); + GAP_SetParamValue(TGAP_LIM_DISC_SCAN, DEFAULT_SCAN_DURATION); + GGS_SetParameter(GGS_DEVICE_NAME_ATT, GAP_DEVICE_NAME_LEN, + (void *)attDeviceName); + + // Setup the GAP Bond Manager + { + uint32_t passkey = DEFAULT_PASSCODE; + uint8_t pairMode = DEFAULT_PAIRING_MODE; + uint8_t mitm = DEFAULT_MITM_MODE; + uint8_t ioCap = DEFAULT_IO_CAPABILITIES; + uint8_t bonding = DEFAULT_BONDING_MODE; + + + GAPBondMgr_SetParameter(GAPBOND_DEFAULT_PASSCODE, sizeof(uint32_t), + &passkey); + GAPBondMgr_SetParameter(GAPBOND_PAIRING_MODE, sizeof(uint8_t), &pairMode); + GAPBondMgr_SetParameter(GAPBOND_MITM_PROTECTION, sizeof(uint8_t), &mitm); + GAPBondMgr_SetParameter(GAPBOND_IO_CAPABILITIES, sizeof(uint8_t), &ioCap); + GAPBondMgr_SetParameter(GAPBOND_BONDING_ENABLED, sizeof(uint8_t), &bonding); + } + + // Initialize GATT Client + VOID GATT_InitClient(); + + // Register to receive incoming ATT Indications/Notifications + GATT_RegisterForInd(selfEntity); + + // Initialize GATT attributes + GGS_AddService(GATT_ALL_SERVICES); // GAP + GATTServApp_AddService(GATT_ALL_SERVICES); // GATT attributes + + // Start the Device + VOID GAPCentralRole_StartDevice(&SimpleBLECentral_roleCB); + + // Register with bond manager after starting device + GAPBondMgr_Register(&SimpleBLECentral_bondCB); + + // Register with GAP for HCI/Host messages (for RSSI) + GAP_RegisterForMsgs(selfEntity); + + // Register for GATT local events and ATT Responses pending for transmission + GATT_RegisterForMsgs(selfEntity); + + Display_print0(dispHandle, ROW_ZERO, 0, "BLE Central"); +} + +/********************************************************************* + * @fn SimpleBLECentral_taskFxn + * + * @brief Application task entry point for the Simple BLE Central. + * + * @param none + * + * @return events not processed + */ +static void SimpleBLECentral_taskFxn(UArg a0, UArg a1) +{ + // Initialize application + SimpleBLECentral_init(); + + // Application main loop + for (;;) + { + // Waits for a signal to the semaphore associated with the calling thread. + // Note that the semaphore associated with a thread is signaled when a + // message is queued to the message receive queue of the thread or when + // ICall_signal() function is called onto the semaphore. + ICall_Errno errno = ICall_wait(ICALL_TIMEOUT_FOREVER); + + if (errno == ICALL_ERRNO_SUCCESS) + { + ICall_EntityID dest; + ICall_ServiceEnum src; + ICall_HciExtEvt *pMsg = NULL; + + if (ICall_fetchServiceMsg(&src, &dest, + (void **)&pMsg) == ICALL_ERRNO_SUCCESS) + { + if ((src == ICALL_SERVICE_CLASS_BLE) && (dest == selfEntity)) + { + // Process inter-task message + SimpleBLECentral_processStackMsg((ICall_Hdr *)pMsg); + } + + if (pMsg) + { + ICall_freeMsg(pMsg); + } + } + } + + // If RTOS queue is not empty, process app message + while (!Queue_empty(appMsgQueue)) + { + sbcEvt_t *pMsg = (sbcEvt_t *)Util_dequeueMsg(appMsgQueue); + if (pMsg) + { + // Process message + SimpleBLECentral_processAppMsg(pMsg); + + // Free the space from the message + ICall_free(pMsg); + } + } + + if (events & SBC_START_DISCOVERY_EVT) + { + events &= ~SBC_START_DISCOVERY_EVT; + + SimpleBLECentral_startDiscovery(); + } + } +} + +/********************************************************************* + * @fn SimpleBLECentral_processStackMsg + * + * @brief Process an incoming task message. + * + * @param pMsg - message to process + * + * @return none + */ +static void SimpleBLECentral_processStackMsg(ICall_Hdr *pMsg) +{ + switch (pMsg->event) + { + case GAP_MSG_EVENT: + SimpleBLECentral_processRoleEvent((gapCentralRoleEvent_t *)pMsg); + break; + + case GATT_MSG_EVENT: + SimpleBLECentral_processGATTMsg((gattMsgEvent_t *)pMsg); + break; + + case HCI_GAP_EVENT_EVENT: + { + // Process HCI message + switch(pMsg->status) + { + case HCI_COMMAND_COMPLETE_EVENT_CODE: + SimpleBLECentral_processCmdCompleteEvt((hciEvt_CmdComplete_t *)pMsg); + break; + + default: + break; + } + } + break; + + default: + break; + } +} + +/********************************************************************* + * @fn SimpleBLECentral_processAppMsg + * + * @brief Central application event processing function. + * + * @param pMsg - pointer to event structure + * + * @return none + */ +static void SimpleBLECentral_processAppMsg(sbcEvt_t *pMsg) +{ + switch (pMsg->hdr.event) + { + case SBC_STATE_CHANGE_EVT: + SimpleBLECentral_processStackMsg((ICall_Hdr *)pMsg->pData); + + // Free the stack message + ICall_freeMsg(pMsg->pData); + break; + + case SBC_KEY_CHANGE_EVT: + SimpleBLECentral_handleKeys(0, pMsg->hdr.state); + break; + + case SBC_RSSI_READ_EVT: + { + readRssi_t *pRssi = (readRssi_t *)pMsg->pData; + + // If link is up and RSSI reads active + if (pRssi->connHandle != GAP_CONNHANDLE_ALL && + linkDB_Up(pRssi->connHandle)) + { + // Restart timer + Util_restartClock(pRssi->pClock, pRssi->period); + + // Read RSSI + VOID HCI_ReadRssiCmd(pRssi->connHandle); + } + } + break; + + // Pairing event + case SBC_PAIRING_STATE_EVT: + { + SimpleBLECentral_processPairState(pMsg->hdr.state, *pMsg->pData); + + ICall_free(pMsg->pData); + break; + } + + // Passcode event + case SBC_PASSCODE_NEEDED_EVT: + { + SimpleBLECentral_processPasscode(connHandle, *pMsg->pData); + + ICall_free(pMsg->pData); + break; + } + + // Connecting to device timed out + case SBC_CONNECTING_TIMEOUT_EVT: + { + GAPCentralRole_TerminateLink(connHandle); + } + + default: + // Do nothing. + break; + } +} + +/********************************************************************* + * @fn SimpleBLECentral_processRoleEvent + * + * @brief Central role event processing function. + * + * @param pEvent - pointer to event structure + * + * @return none + */ +static void SimpleBLECentral_processRoleEvent(gapCentralRoleEvent_t *pEvent) +{ + switch (pEvent->gap.opcode) + { + case GAP_DEVICE_INIT_DONE_EVENT: + { + maxPduSize = pEvent->initDone.dataPktLen; + Display_print0(dispHandle, ROW_ZERO, 0, "BLE Central"); + Display_print0(dispHandle, ROW_ONE, 0, Util_convertBdAddr2Str(pEvent->initDone.devAddr)); + Display_print0(dispHandle, ROW_TWO, 0, "Initialized"); + Display_print0(dispHandle, ROW_SEVEN, 0, ">RIGHT to scan"); + } + break; + + case GAP_DEVICE_INFO_EVENT: + { + //Find peer device address by UUID + if ( (DEFAULT_DEV_DISC_BY_SVC_UUID == FALSE) || + SimpleBLECentral_findSvcUuid(SIMPLEPROFILE_SERV_UUID, + pEvent->deviceInfo.pEvtData, + pEvent->deviceInfo.dataLen)) + { + SimpleBLECentral_addDeviceInfo(pEvent->deviceInfo.addr, + pEvent->deviceInfo.addrType); + } + + // Check if the discovered device is already in scan results + uint8_t i; + for (i = 0; i < scanRes; i++) + { + if (memcmp(pEvent->deviceInfo.addr, devList[i].addr , B_ADDR_LEN) == 0) + { + //Check if pEventData contains a device name + if (SimpleBLECentral_findLocalName(pEvent->deviceInfo.pEvtData, + pEvent->deviceInfo.dataLen)) + { + //Update deviceInfo entry with the name + SimpleBLECentral_addDeviceName(i, pEvent->deviceInfo.pEvtData, + pEvent->deviceInfo.dataLen); + } + } + } + } + break; + + case GAP_DEVICE_DISCOVERY_EVENT: + { + // discovery complete + scanningStarted = FALSE; + // initialize scan index to first + scanIdx = 0; + Display_clearLines(dispHandle, ROW_ONE, ROW_SEVEN); + Display_print1(dispHandle, ROW_ONE, 0, "Devices found %d", scanRes); + state = BLE_STATE_DISCOVERED; + + if (scanRes > 0) + { + Display_print0(dispHandle, ROW_SIX, 0, "RIGHT to scan"); + } + break; + + case GAP_LINK_ESTABLISHED_EVENT: + { + if (pEvent->gap.hdr.status == SUCCESS) + { + //Connect to selected device + state = BLE_STATE_CONNECTED; + connHandle = pEvent->linkCmpl.connectionHandle; + procedureInProgress = TRUE; + + // If service discovery not performed initiate service discovery + if (charHdl == 0) + { + Util_startClock(&startDiscClock); + } + + //Find device name in devList struct + uint8_t i; + for (i = 0; i < scanRes; i++) + { + if (memcmp(pEvent->linkCmpl.devAddr, devList[i].addr, B_ADDR_LEN) == NULL) + { + break; + } + } + Display_clearLines(dispHandle, ROW_ONE, ROW_SEVEN); + Display_print1(dispHandle, ROW_ONE, 0, "%s", devList[i].localName); + Display_print1(dispHandle, ROW_TWO, 0, "%s", Util_convertBdAddr2Str(pEvent->linkCmpl.devAddr)); + Display_print0(dispHandle, ROW_THREE, 0, "Connected"); + selectedMenuItem = MENU_ITEM_CONN_PARAM_UPDATE; + Display_print0(dispHandle, ROW_SEVEN, 0, ">Param upd req"); + } + else + { + state = BLE_STATE_IDLE; + connHandle = GAP_CONNHANDLE_INIT; + discState = BLE_DISC_STATE_IDLE; + + Display_clearLine(dispHandle, ROW_FOUR); + Display_print0(dispHandle, ROW_TWO, 0, "Connect Failed"); + Display_print1(dispHandle, ROW_THREE, 0, "Reason: %d", pEvent->gap.hdr.status); + Display_print0(dispHandle, ROW_SEVEN, 0, ">RIGHT to scan"); + } + } + break; + + case GAP_LINK_TERMINATED_EVENT: + { + state = BLE_STATE_IDLE; + connHandle = GAP_CONNHANDLE_INIT; + discState = BLE_DISC_STATE_IDLE; + charHdl = 0; + procedureInProgress = FALSE; + + // Cancel RSSI reads + SimpleBLECentral_CancelRssi(pEvent->linkTerminate.connectionHandle); + + //Clear screen and display disconnect reason + Display_clearLines(dispHandle, ROW_ONE, ROW_SEVEN); + Display_print0(dispHandle, ROW_ONE, 0, "Disconnected"); + Display_print1(dispHandle, ROW_TWO, 0, "Reason: %d", pEvent->linkTerminate.reason); + Display_print0(dispHandle, ROW_SEVEN, 0, ">RIGHT to scan"); + selectedMenuItem = MENU_ITEM_CONN_PARAM_UPDATE; + } + break; + + case GAP_LINK_PARAM_UPDATE_EVENT: + { + if (state == BLE_STATE_CONNECTED) + { + if (pEvent->linkUpdate.status == SUCCESS) + { + Display_print1(dispHandle, ROW_FOUR, 0, "ParUpd: %d ms", pEvent->linkUpdate.connInterval * 1.25); + } + else + { + Display_print1(dispHandle, ROW_FOUR, 0, "Param error: %d", pEvent->linkUpdate.status); + } + } + } + break; + + default: + break; + } +} + +/********************************************************************* + * @fn SimpleBLECentral_handleKeys + * + * @brief Handles all key events for this device. + * + * @param shift - true if in shift/alt. + * @param keys - bit field for key events. Valid entries: + * HAL_KEY_SW_2 + * HAL_KEY_SW_1 + * + * @return none + */ +static void SimpleBLECentral_handleKeys(uint8_t shift, uint8_t keys) +{ + switch (state) + { + case BLE_STATE_IDLE: + if (keys & KEY_RIGHT) + { + // Discover devices + SimpleBLECentral_discoverDevices(); + } + //If LEFT is pressed, nothing happens. + break; + + case BLE_STATE_DISCOVERED: + if (keys & KEY_LEFT) + { + //Display Discovery Results + if (!scanningStarted && scanRes > 0) + { + if (scanIdx >= scanRes) + { + Display_clearLines(dispHandle, ROW_TWO, ROW_SEVEN); + Display_print0(dispHandle, ROW_SIX, 0, "RIGHT to scan"); + + state = BLE_STATE_BROWSING; + scanIdx = 0; + } + else + { + Display_print1(dispHandle, ROW_ONE, 0, "Device %d", (scanIdx + 1)); + Display_print0(dispHandle, ROW_TWO, 0, Util_convertBdAddr2Str(devList[scanIdx].addr)); + Display_print1(dispHandle, ROW_THREE, 0, "%s", devList[scanIdx].localName); + Display_print0(dispHandle, ROW_SEVEN, 0, ">RIGHT to connect"); + + state = BLE_STATE_BROWSING; + scanIdx++; + } + } + return; + } + else if (keys & KEY_RIGHT) + { + //Start scanning + SimpleBLECentral_discoverDevices(); + } + break; + + case BLE_STATE_BROWSING: + if (keys & KEY_LEFT) + { + //Navigate through discovery results + if (!scanningStarted && scanRes > 0) + { + if (scanIdx >= scanRes) + { + //Display the scan option + Display_clearLines(dispHandle, ROW_ONE, ROW_SEVEN); + Display_print1(dispHandle, ROW_ONE, 0, "Devices found %d", scanRes); + Display_print0(dispHandle, ROW_SIX, 0, "RIGHT to scan"); + + state = BLE_STATE_BROWSING; + scanIdx = 0; + } + else + { + //Display next device + Display_print1(dispHandle, ROW_ONE, 0, "Device %d", (scanIdx + 1)); + Display_print0(dispHandle, ROW_TWO, 0, Util_convertBdAddr2Str(devList[scanIdx].addr)); + Display_print1(dispHandle, ROW_THREE, 0, "%s", devList[scanIdx].localName); + Display_print0(dispHandle, ROW_SEVEN, 0, ">RIGHT to connect"); + + state = BLE_STATE_BROWSING; + scanIdx++; + } + } + } + else if (keys & KEY_RIGHT) + { + //Scan for devices if the scan option is displayed + if (scanIdx == 0){ + SimpleBLECentral_discoverDevices(); + } + + //Connect to displayed device + else + { + uint8_t addrType; + uint8_t *peerAddr; + if (scanRes > 0 && state == BLE_STATE_BROWSING) + { + // connect to current device in scan result + peerAddr = devList[scanIdx-1].addr; + addrType = devList[scanIdx-1].addrType; + + state = BLE_STATE_CONNECTING; + + Util_startClock(&connectingClock); + + GAPCentralRole_EstablishLink(DEFAULT_LINK_HIGH_DUTY_CYCLE, + DEFAULT_LINK_WHITE_LIST, + addrType, peerAddr); + + Display_clearLines(dispHandle, ROW_FOUR, ROW_SEVEN); + Display_print0(dispHandle, ROW_TWO, 0, Util_convertBdAddr2Str(peerAddr)); + Display_print0(dispHandle, ROW_FOUR, 0, "Connecting"); + } + } + } + break; + + case BLE_STATE_CONNECTING: + //Nothing happens if buttons are pressed while the device is connecting. + break; + + case BLE_STATE_CONNECTED: + if (keys & KEY_LEFT) //Navigate though menu. + { + //Iterate through rows + switch (selectedMenuItem) + { + case MENU_ITEM_CONN_PARAM_UPDATE: + selectedMenuItem = MENU_ITEM_RSSI; + if (SimpleBLECentral_RssiFind(connHandle) == NULL) + { + Display_print0(dispHandle, ROW_SEVEN, 0, ">Start RSSI poll"); + } + else + { + Display_print0(dispHandle, ROW_SEVEN, 0, ">Stop RSSI poll"); + } + break; + + case MENU_ITEM_RSSI: + selectedMenuItem = MENU_ITEM_READ_WRITE; + Display_print0(dispHandle, ROW_SEVEN, 0, ">Read/write req"); + break; + + case MENU_ITEM_READ_WRITE: + selectedMenuItem = MENU_ITEM_DISCONNECT; + Display_print0(dispHandle, ROW_SEVEN, 0, ">Disconnect"); + break; + + case MENU_ITEM_DISCONNECT: + selectedMenuItem = MENU_ITEM_CONN_PARAM_UPDATE; + Display_print0(dispHandle, ROW_SEVEN, 0, ">Param upd req"); + break; + } + } + if (keys & KEY_RIGHT) + { + switch (selectedMenuItem) + { + case MENU_ITEM_CONN_PARAM_UPDATE: + //Connection Parameter Update + Display_print0(dispHandle, ROW_FOUR, 0, "Param upd req"); + switch (currentConnectionParameter) + { + case INITIAL_PARAMETERS: + GAPCentralRole_UpdateLink(connHandle, + DEFAULT_UPDATE_MIN_CONN_INTERVAL, + DEFAULT_UPDATE_MAX_CONN_INTERVAL, + DEFAULT_UPDATE_SLAVE_LATENCY, + DEFAULT_UPDATE_CONN_TIMEOUT); + currentConnectionParameter = DEFAULT_UPDATE_PARAMETERS; + break; + case DEFAULT_UPDATE_PARAMETERS: + GAPCentralRole_UpdateLink(connHandle, + INITIAL_MIN_CONN_INTERVAL, + INITIAL_MAX_CONN_INTERVAL, + INITIAL_SLAVE_LATENCY, + INITIAL_CONN_TIMEOUT); + currentConnectionParameter = INITIAL_PARAMETERS; + break; + } + break; + + case MENU_ITEM_RSSI: + // Start or cancel RSSI polling + if (SimpleBLECentral_RssiFind(connHandle) == NULL) + { + Display_clearLine(dispHandle, ROW_FIVE); + SimpleBLECentral_StartRssi(connHandle, DEFAULT_RSSI_PERIOD); + Display_print0(dispHandle, ROW_SEVEN, 0, ">Stop RSSI poll"); + } + else + { + SimpleBLECentral_CancelRssi(connHandle); + Display_print0(dispHandle, ROW_FIVE, 0, "RSSI Cancelled"); + if (selectedMenuItem == MENU_ITEM_RSSI) + { + Display_print0(dispHandle, ROW_SEVEN, 0, ">Start RSSI poll"); + } + } + break; + + case MENU_ITEM_READ_WRITE: + if (state == BLE_STATE_CONNECTED && + charHdl != 0 && + procedureInProgress == FALSE) + { + uint8_t status; + // Do a read or write as long as no other read or write is in progress + if (doWrite) + { + // Do a write + attWriteReq_t req; + req.pValue = GATT_bm_alloc(connHandle, ATT_WRITE_REQ, 1, NULL); + if ( req.pValue != NULL ) + { + Display_print0(dispHandle, ROW_SIX, 0, "Write req sent"); + req.handle = charHdl; + req.len = 1; + req.pValue[0] = charVal; + req.sig = 0; + req.cmd = 0; + status = GATT_WriteCharValue(connHandle, &req, selfEntity); + if ( status != SUCCESS ) + { + GATT_bm_free((gattMsg_t *)&req, ATT_WRITE_REQ); + } + } + else + { + status = bleMemAllocError; + } + } + else + { + // Do a read + attReadReq_t req; + req.handle = charHdl; + status = GATT_ReadCharValue(connHandle, &req, selfEntity); + Display_print0(dispHandle, ROW_SIX, 0, "Read req sent"); + } + + if (status == SUCCESS) + { + procedureInProgress = TRUE; + doWrite = !doWrite; + } + } + break; + + case MENU_ITEM_DISCONNECT: + GAPCentralRole_TerminateLink(connHandle); + state = BLE_STATE_DISCONNECTING; + Display_clearLines(dispHandle, ROW_ONE, ROW_SEVEN); + Display_print0(dispHandle, ROW_ONE, 0, "Disconnecting"); + break; + } + } + } + return; +} + +/********************************************************************* + * @fn SimpleBLECentral_processGATTMsg + * + * @brief Process GATT messages and events. + * + * @return none + */ +static void SimpleBLECentral_processGATTMsg(gattMsgEvent_t *pMsg) +{ + if (state == BLE_STATE_CONNECTED) + { + // See if GATT server was unable to transmit an ATT response + if (pMsg->hdr.status == blePending) + { + // No HCI buffer was available. App can try to retransmit the response + // on the next connection event. Drop it for now. + Display_print1(dispHandle, ROW_SIX, 0, "ATT Rsp drped %d", pMsg->method); + } + else if ((pMsg->method == ATT_READ_RSP) || + ((pMsg->method == ATT_ERROR_RSP) && + (pMsg->msg.errorRsp.reqOpcode == ATT_READ_REQ))) + { + if (pMsg->method == ATT_ERROR_RSP) + { + Display_print1(dispHandle, ROW_SIX, 0, "Read Error %d", pMsg->msg.errorRsp.errCode); + } + else + { + // After a successful read, display the read value + Display_print1(dispHandle, ROW_SIX, 0, "Read rsp: %d", pMsg->msg.readRsp.pValue[0]); + } + + procedureInProgress = FALSE; + } + else if ((pMsg->method == ATT_WRITE_RSP) || + ((pMsg->method == ATT_ERROR_RSP) && + (pMsg->msg.errorRsp.reqOpcode == ATT_WRITE_REQ))) + { + if (pMsg->method == ATT_ERROR_RSP) + { + Display_print1(dispHandle, ROW_SIX, 0, "Write Error %d", pMsg->msg.errorRsp.errCode); + } + else + { + // After a successful write, display the value that was written and + // increment value + Display_print1(dispHandle, ROW_SIX, 0, "Write sent: %d", charVal++); + } + + procedureInProgress = FALSE; + } + else if (pMsg->method == ATT_FLOW_CTRL_VIOLATED_EVENT) + { + // ATT request-response or indication-confirmation flow control is + // violated. All subsequent ATT requests or indications will be dropped. + // The app is informed in case it wants to drop the connection. + + // Display the opcode of the message that caused the violation. + Display_print1(dispHandle, ROW_THREE, 0, "FC Violated: %d", pMsg->msg.flowCtrlEvt.opcode); + } + else if (pMsg->method == ATT_MTU_UPDATED_EVENT) + { + // MTU size updated + Display_print1(dispHandle, ROW_THREE, 0, "MTU Size: %d", pMsg->msg.mtuEvt.MTU); + } + else if (discState != BLE_DISC_STATE_IDLE) + { + SimpleBLECentral_processGATTDiscEvent(pMsg); + } + } // else - in case a GATT message came after a connection has dropped, ignore it. + + // Needed only for ATT Protocol messages + GATT_bm_free(&pMsg->msg, pMsg->method); +} + +/********************************************************************* + * @fn SimpleBLECentral_processCmdCompleteEvt + * + * @brief Process an incoming OSAL HCI Command Complete Event. + * + * @param pMsg - message to process + * + * @return none + */ +static void SimpleBLECentral_processCmdCompleteEvt(hciEvt_CmdComplete_t *pMsg) +{ + switch (pMsg->cmdOpcode) + { + case HCI_READ_RSSI: + { + if (state == BLE_STATE_CONNECTED) + { + int8 rssi = (int8)pMsg->pReturnParam[3]; + Display_print1(dispHandle, ROW_FIVE, 0, "RSSI -dB: %d", (uint32_t)(-rssi)); + } + } + break; + + default: + break; + } +} + +/********************************************************************* + * @fn SimpleBLECentral_StartRssi + * + * @brief Start periodic RSSI reads on a link. + * + * @param connHandle - connection handle of link + * @param period - RSSI read period in ms + * + * @return SUCCESS: Terminate started + * bleIncorrectMode: No link + * bleNoResources: No resources + */ +static bStatus_t SimpleBLECentral_StartRssi(uint16_t connHandle, uint16_t period) +{ + readRssi_t *pRssi; + + // Verify link is up + if (!linkDB_Up(connHandle)) + { + return bleIncorrectMode; + } + + // If already allocated + if ((pRssi = SimpleBLECentral_RssiFind(connHandle)) != NULL) + { + // Stop timer + Util_stopClock(pRssi->pClock); + pRssi->period = period; + } + + // Allocate structure + else if ((pRssi = SimpleBLECentral_RssiAlloc(connHandle)) != NULL) + { + pRssi->period = period; + } + // Allocate failed + else + { + return bleNoResources; + } + // Start timer + Util_restartClock(pRssi->pClock, period); + return SUCCESS; +} + +/********************************************************************* + * @fn SimpleBLECentral_CancelRssi + * + * @brief Cancel periodic RSSI reads on a link. + * + * @param connHandle - connection handle of link + * + * @return SUCCESS: Operation successful + * bleIncorrectMode: No link + */ +static bStatus_t SimpleBLECentral_CancelRssi(uint16_t connHandle) +{ + readRssi_t *pRssi; + if ((pRssi = SimpleBLECentral_RssiFind(connHandle)) != NULL) + { + // Stop timer + Util_stopClock(pRssi->pClock); + + // Free RSSI structure + SimpleBLECentral_RssiFree(connHandle); + return SUCCESS; + } + // Not found + return bleIncorrectMode; +} + +/********************************************************************* + * @fn gapCentralRole_RssiAlloc + * + * @brief Allocate an RSSI structure. + * + * @param connHandle - Connection handle + * + * @return pointer to structure or NULL if allocation failed. + */ +static readRssi_t *SimpleBLECentral_RssiAlloc(uint16_t connHandle) +{ + uint8_t i; + + // Find free RSSI structure + for (i = 0; i < MAX_NUM_BLE_CONNS; i++) + { + if (readRssi[i].connHandle == GAP_CONNHANDLE_ALL) + { + readRssi_t *pRssi = &readRssi[i]; + pRssi->pClock = (Clock_Struct *)ICall_malloc(sizeof(Clock_Struct)); + if (pRssi->pClock) + { + Util_constructClock(pRssi->pClock, SimpleBLECentral_readRssiHandler, + 0, 0, false, i); + pRssi->connHandle = connHandle; + return pRssi; + } + } + } + // No free structure found + return NULL; +} + +/********************************************************************* + * @fn gapCentralRole_RssiFind + * + * @brief Find an RSSI structure. + * + * @param connHandle - Connection handle + * + * @return pointer to structure or NULL if not found. + */ +static readRssi_t *SimpleBLECentral_RssiFind(uint16_t connHandle) +{ + uint8_t i; + // Find free RSSI structure + for (i = 0; i < MAX_NUM_BLE_CONNS; i++) + { + if (readRssi[i].connHandle == connHandle) + { + return &readRssi[i]; + } + } + // Not found + return NULL; +} + +/********************************************************************* + * @fn gapCentralRole_RssiFree + * + * @brief Free an RSSI structure. + * + * @param connHandle - Connection handle + * + * @return none + */ +static void SimpleBLECentral_RssiFree(uint16_t connHandle) +{ + uint8_t i; + + // Find RSSI structure + for (i = 0; i < MAX_NUM_BLE_CONNS; i++) + { + if (readRssi[i].connHandle == connHandle) + { + readRssi_t *pRssi = &readRssi[i]; + if (pRssi->pClock) + { + Clock_destruct(pRssi->pClock); + + // Free clock struct + ICall_free(pRssi->pClock); + pRssi->pClock = NULL; + } + pRssi->connHandle = GAP_CONNHANDLE_ALL; + break; + } + } +} + +/********************************************************************* + * @fn SimpleBLECentral_processPairState + * + * @brief Process the new paring state. + * + * @return none + */ +static void SimpleBLECentral_processPairState(uint8_t pairState, uint8_t status) +{ + if (pairState == GAPBOND_PAIRING_STATE_STARTED) + { + Display_print0(dispHandle, ROW_SIX, 0, "Pairing started"); + } + else if (pairState == GAPBOND_PAIRING_STATE_COMPLETE) + { + if (status == SUCCESS) + { + Display_print0(dispHandle, ROW_SIX, 0, "Pairing success"); + } + else + { + Display_print1(dispHandle, ROW_SIX, 0, "Pairing fail: %d", status); + } + } + else if (pairState == GAPBOND_PAIRING_STATE_BONDED) + { + if (status == SUCCESS) + { + Display_print0(dispHandle, ROW_SIX, 0, "Bonding success"); + } + } + else if (pairState == GAPBOND_PAIRING_STATE_BOND_SAVED) + { + if (status == SUCCESS) + { + Display_print0(dispHandle, ROW_SIX, 0, "Bond save succ"); + } + else + { + Display_print1(dispHandle, ROW_SIX, 0, "Bnd save fail: %d", status); + } + } +} + +/********************************************************************* + * @fn SimpleBLECentral_processPasscode + * + * @brief Process the Passcode request. + * + * @return none + */ +static void SimpleBLECentral_processPasscode(uint16_t connectionHandle, + uint8_t uiOutputs) +{ + uint32_t passcode; + + // Create random passcode + passcode = Util_GetTRNG(); + passcode %= 1000000; + + // Display passcode to user + if (uiOutputs != 0) + { + Display_print0(dispHandle, ROW_FOUR, 0, "Passcode:"); + Display_print1(dispHandle, ROW_FIVE, 0, "%d", passcode); + } + // Send passcode response + GAPBondMgr_PasscodeRsp(connectionHandle, SUCCESS, passcode); +} + +/********************************************************************* + * @fn SimpleBLECentral_startDiscovery + * + * @brief Start service discovery. + * + * @return none + */ +static void SimpleBLECentral_startDiscovery(void) +{ + attExchangeMTUReq_t req; + + // Initialize cached handles + svcStartHdl = svcEndHdl = charHdl = 0; + + discState = BLE_DISC_STATE_MTU; + + // Discover GATT Server's Rx MTU size + req.clientRxMTU = maxPduSize - L2CAP_HDR_SIZE; + + // ATT MTU size should be set to the minimum of the Client Rx MTU + // and Server Rx MTU values + VOID GATT_ExchangeMTU(connHandle, &req, selfEntity); +} + +/********************************************************************* + * @fn SimpleBLECentral_processGATTDiscEvent + * + * @brief Process GATT discovery event + * + * @return none + */ +static void SimpleBLECentral_processGATTDiscEvent(gattMsgEvent_t *pMsg) +{ + if (discState == BLE_DISC_STATE_MTU) + { + // MTU size response received, discover simple BLE service + if (pMsg->method == ATT_EXCHANGE_MTU_RSP) + { + uint8_t uuid[ATT_BT_UUID_SIZE] = { LO_UINT16(SIMPLEPROFILE_SERV_UUID), + HI_UINT16(SIMPLEPROFILE_SERV_UUID) }; + + // Just in case we're using the default MTU size (23 octets) + Display_print1(dispHandle, ROW_THREE, 0, "MTU Size: %d", ATT_MTU_SIZE); + discState = BLE_DISC_STATE_SVC; + + // Discovery simple BLE service + VOID GATT_DiscPrimaryServiceByUUID(connHandle, uuid, ATT_BT_UUID_SIZE, + selfEntity); + } + } + else if (discState == BLE_DISC_STATE_SVC) + { + // Service found, store handles + if (pMsg->method == ATT_FIND_BY_TYPE_VALUE_RSP && + pMsg->msg.findByTypeValueRsp.numInfo > 0) + { + svcStartHdl = ATT_ATTR_HANDLE(pMsg->msg.findByTypeValueRsp.pHandlesInfo, 0); + svcEndHdl = ATT_GRP_END_HANDLE(pMsg->msg.findByTypeValueRsp.pHandlesInfo, 0); + } + + // If procedure complete + if (((pMsg->method == ATT_FIND_BY_TYPE_VALUE_RSP) && + (pMsg->hdr.status == bleProcedureComplete)) || + (pMsg->method == ATT_ERROR_RSP)) + { + if (svcStartHdl != 0) + { + attReadByTypeReq_t req; + + // Discover characteristic + discState = BLE_DISC_STATE_CHAR; + + req.startHandle = svcStartHdl; + req.endHandle = svcEndHdl; + req.type.len = ATT_BT_UUID_SIZE; + req.type.uuid[0] = LO_UINT16(SIMPLEPROFILE_CHAR1_UUID); + req.type.uuid[1] = HI_UINT16(SIMPLEPROFILE_CHAR1_UUID); + + VOID GATT_ReadUsingCharUUID(connHandle, &req, selfEntity); + } + } + } + else if (discState == BLE_DISC_STATE_CHAR) + { + // Characteristic found, store handle + if ((pMsg->method == ATT_READ_BY_TYPE_RSP) && + (pMsg->msg.readByTypeRsp.numPairs > 0)) + { + charHdl = BUILD_UINT16(pMsg->msg.readByTypeRsp.pDataList[0], + pMsg->msg.readByTypeRsp.pDataList[1]); + Display_print0(dispHandle, ROW_THREE, 0, "Simple Svc Found"); + procedureInProgress = FALSE; + } + discState = BLE_DISC_STATE_IDLE; + } +} + +/********************************************************************* + * @fn SimpleBLECentral_findSvcUuid + * + * @brief Find a given UUID in an advertiser's service UUID list. + * + * @return TRUE if service UUID found + */ +static bool SimpleBLECentral_findSvcUuid(uint16_t uuid, uint8_t *pData, + uint8_t dataLen) +{ + uint8_t adLen; + uint8_t adType; + uint8_t *pEnd; + + pEnd = pData + dataLen - 1; + + // While end of data not reached + while (pData < pEnd) + { + // Get length of next AD item + adLen = *pData++; + if (adLen > 0) + { + adType = *pData; + + // If AD type is for 16-bit service UUID + if ((adType == GAP_ADTYPE_16BIT_MORE) || + (adType == GAP_ADTYPE_16BIT_COMPLETE)) + { + pData++; + adLen--; + + // For each UUID in list + while (adLen >= 2 && pData < pEnd) + { + // Check for match + if ((pData[0] == LO_UINT16(uuid)) && + (pData[1] == HI_UINT16(uuid))) + { + // Match found + return TRUE; + } + + // Go to next AD item + pData += 2; + adLen -= 2; + } + + // Handle possible erroneous extra byte in UUID list + if (adLen == 1) + { + pData++; + } + + } + else + { + // Go to next AD item + pData += adLen; + } + } + } + // Match not found + return FALSE; +} + +/********************************************************************* + * @fn SimpleBLECentral_discoverDevices + * + * @brief Scan to discover devices. + * + * @return none + */ +static void SimpleBLECentral_discoverDevices(void){ + if (!scanningStarted) + { + scanningStarted = TRUE; + + //Clear old scan results + scanRes = 0; + memset(devList, NULL, sizeof(devList[0])*DEFAULT_MAX_SCAN_RES); + + Display_clearLines(dispHandle, ROW_ONE, ROW_SEVEN); + Display_print0(dispHandle, ROW_ONE, 0, "Discovering..."); + GAPCentralRole_StartDiscovery(DEFAULT_DISCOVERY_MODE, + DEFAULT_DISCOVERY_ACTIVE_SCAN, + DEFAULT_DISCOVERY_WHITE_LIST); + } + else + { + GAPCentralRole_CancelDiscovery(); + } +} + +/********************************************************************** + * @fn SimpleBLECentral_timeoutConnecting + * + * @brief Post event if connecting is timed out. + * + * @return none + */ +Void SimpleBLECentral_timeoutConnecting(UArg arg0) +{ + if (state == BLE_STATE_CONNECTING) + { + SimpleBLECentral_enqueueMsg(SBC_CONNECTING_TIMEOUT_EVT, 0, NULL); + } +} + +/********************************************************************* + * @fn SimpleBLECentral_addDeviceInfo + * + * @brief Add a device to the device discovery result list + * + * @return none + */ +static void SimpleBLECentral_addDeviceInfo(uint8_t *pAddr, uint8_t addrType) +{ + uint8_t i; + + // If result count not at max + if (scanRes < DEFAULT_MAX_SCAN_RES) + { + // Check if device is already in scan results + for (i = 0; i < scanRes; i++) + { + if (memcmp(pAddr, devList[i].addr , B_ADDR_LEN) == 0) + { + return; + } + } + + // Add addr to scan result list + memcpy(devList[scanRes].addr, pAddr, B_ADDR_LEN); + devList[scanRes].addrType = addrType; + + // Increment scan result count + scanRes++; + } +} + +/********************************************************************* + * @fn SimpleBLECentral_findLocalName + * + * @brief Check if pEvtData contains a device local name + * + * @return TRUE if local name found + */ +static bool SimpleBLECentral_findLocalName(uint8_t *pEvtData, uint8_t dataLen) +{ + uint8_t adLen; + uint8_t adType; + uint8_t *pEnd; + + pEnd = pEvtData + dataLen - 1; + + // While end of data not reached + while (pEvtData < pEnd) + { + // Get length of next data item + adLen = *pEvtData++; + if (adLen > 0) + { + adType = *pEvtData; + + // If AD type is for local name + if ((adType == GAP_ADTYPE_LOCAL_NAME_SHORT) || + (adType == GAP_ADTYPE_LOCAL_NAME_COMPLETE)) + { + pEvtData++; + adLen--; + // For each local name in list + if (adLen >= 2 && pEvtData < pEnd) + { + return TRUE; + } + + // Handle possible erroneous extra byte in advertisement data + if (adLen == 1) + { + pEvtData++; + } + } + else + { + // Go to next item + pEvtData += adLen; + } + } + } + // No name found + return FALSE; +} + +/********************************************************************* + * @fn SimpleBLECentral_addDeviceName + * + * @brief Add a name to an existing device in the scan result list + * + * @return none + */ +static void SimpleBLECentral_addDeviceName(uint8_t i, uint8_t *pEvtData, uint8_t dataLen) +{ + uint8_t scanRspLen; + uint8_t scanRspType; + uint8_t *pEnd; + + pEnd = pEvtData + dataLen - 1; + + // While end of data not reached + while (pEvtData < pEnd) + { + // Get length of next scan response item + scanRspLen = *pEvtData++; + if (scanRspLen > 0) + { + scanRspType = *pEvtData; + + // If scan response type is for local name + if ((scanRspType == GAP_ADTYPE_LOCAL_NAME_SHORT) || + (scanRspType == GAP_ADTYPE_LOCAL_NAME_COMPLETE)) + { + //Set name length in the device struct. + devList[i].nameLength = scanRspLen - 1; + pEvtData++; + uint8_t j = 0; + + //Copy device name from the scan response data + while ((pEvtData < pEnd) && + (j < scanRspLen - 1)) + { + devList[i].localName[j] = *pEvtData; + pEvtData++; + j++; + } + } + } + else + { + // Go to next scan response item + pEvtData += scanRspLen; + } + } +} + + +/********************************************************************* + * @fn SimpleBLECentral_eventCB + * + * @brief Central event callback function. + * + * @param pEvent - pointer to event structure + * + * @return TRUE if safe to deallocate event message, FALSE otherwise. + */ +static uint8_t SimpleBLECentral_eventCB(gapCentralRoleEvent_t *pEvent) +{ + // Forward the role event to the application + if (SimpleBLECentral_enqueueMsg(SBC_STATE_CHANGE_EVT, + SUCCESS, (uint8_t *)pEvent)) + { + // App will process and free the event + return FALSE; + } + + // Caller should free the event + return TRUE; +} + +/********************************************************************* + * @fn SimpleBLECentral_pairStateCB + * + * @brief Pairing state callback. + * + * @return none + */ +static void SimpleBLECentral_pairStateCB(uint16_t connHandle, uint8_t pairState, + uint8_t status) +{ + uint8_t *pData; + + // Allocate space for the event data. + if ((pData = ICall_malloc(sizeof(uint8_t)))) + { + *pData = status; + + // Queue the event. + SimpleBLECentral_enqueueMsg(SBC_PAIRING_STATE_EVT, pairState, pData); + } +} + +/********************************************************************* + * @fn SimpleBLECentral_passcodeCB + * + * @brief Passcode callback. + * + * @return none + */ +static void SimpleBLECentral_passcodeCB(uint8_t *deviceAddr, uint16_t connHandle, + uint8_t uiInputs, uint8_t uiOutputs) +{ + uint8_t *pData; + + // Allocate space for the passcode event. + if ((pData = ICall_malloc(sizeof(uint8_t)))) + { + *pData = uiOutputs; + + // Enqueue the event. + SimpleBLECentral_enqueueMsg(SBC_PASSCODE_NEEDED_EVT, 0, pData); + } +} + +/********************************************************************* + * @fn SimpleBLECentral_startDiscHandler + * + * @brief Clock handler function + * + * @param a0 - ignored + * + * @return none + */ +void SimpleBLECentral_startDiscHandler(UArg a0) +{ + events |= SBC_START_DISCOVERY_EVT; + + // Wake up the application thread when it waits for clock event + Semaphore_post(sem); +} + +/********************************************************************* + * @fn SimpleBLECentral_keyChangeHandler + * + * @brief Key event handler function + * + * @param a0 - ignored + * + * @return none + */ +void SimpleBLECentral_keyChangeHandler(uint8_t keys) +{ + SimpleBLECentral_enqueueMsg(SBC_KEY_CHANGE_EVT, keys, NULL); +} + +/********************************************************************* + * @fn SimpleBLECentral_readRssiHandler + * + * @brief Read RSSI handler function + * + * @param a0 - read RSSI index + * + * @return none + */ +void SimpleBLECentral_readRssiHandler(UArg a0) +{ + SimpleBLECentral_enqueueMsg(SBC_RSSI_READ_EVT, SUCCESS, + (uint8_t *)&readRssi[a0]); +} + +/********************************************************************* + * @fn SimpleBLECentral_enqueueMsg + * + * @brief Creates a message and puts the message in RTOS queue. + * + * @param event - message event. + * @param state - message state. + * @param pData - message data pointer. + * + * @return TRUE or FALSE + */ +static uint8_t SimpleBLECentral_enqueueMsg(uint8_t event, uint8_t status, + uint8_t *pData) +{ + sbcEvt_t *pMsg = ICall_malloc(sizeof(sbcEvt_t)); + + // Create dynamic pointer to message. + if (pMsg) + { + pMsg->hdr.event = event; + pMsg->hdr.state = status; + pMsg->pData = pData; + + // Enqueue the message. + return Util_enqueueMsg(appMsgQueue, sem, (uint8_t *)pMsg); + } + return FALSE; +} From 7bceaec8d215134ce7132d3d7947041e90674e5d Mon Sep 17 00:00:00 2001 From: Sean Lyons Date: Thu, 19 Jan 2017 14:20:15 -0800 Subject: [PATCH 03/19] Changes to start disc after connect This change adds support for discovering chars after connect instead of waiting to bond. This adds support for the 2.2.1 STK on IAR and CCS --- .../app/simple_central_audio_receiver.c | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/examples/simple_central_audio_receiver/cc26xx/app/simple_central_audio_receiver.c b/src/examples/simple_central_audio_receiver/cc26xx/app/simple_central_audio_receiver.c index 8f731b7..e6d704c 100644 --- a/src/examples/simple_central_audio_receiver/cc26xx/app/simple_central_audio_receiver.c +++ b/src/examples/simple_central_audio_receiver/cc26xx/app/simple_central_audio_receiver.c @@ -5,7 +5,7 @@ * data over BLE at a high throughput. * * - * Copyright (C) 2016 Texas Instruments Incorporated - http://www.ti.com/ + * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/ * * * Redistribution and use in source and binary forms, with or without @@ -365,8 +365,8 @@ static void SimpleBLECentral_processRoleEvent(gapCentralRoleEvent_t *pEvent); static void SimpleBLECentral_startDiscovery(void); static bool SimpleBLECentral_findSvcUuid(uint16_t uuid, uint8_t *pData, uint8_t dataLen); -static void SimpleBLECentral_addDeviceInfo(uint8_t *pAddr, uint8_t addrType) -;static void SimpleBLECentral_processPairState(uint8_t state, uint8_t status); +static void SimpleBLECentral_addDeviceInfo(uint8_t *pAddr, uint8_t addrType); +static void SimpleBLECentral_processPairState(uint8_t state, uint8_t status); static void SimpleBLECentral_processPasscode(uint16_t connectionHandle, uint8_t uiOutputs); @@ -864,10 +864,11 @@ static void SimpleBLECentral_processRoleEvent(gapCentralRoleEvent_t *pEvent) state = BLE_STATE_CONNECTED; connHandle = pEvent->linkCmpl.connectionHandle; - // If service discovery not performed initiate service discovery - if (charHdl == 0) + if (FALSE == serviceDiscComplete) { - Util_startClock(&startDiscClock); + // Begin Service Discovery of AUDIO Service to find out report handles + serviceToDiscover = AUDIO_SERV_UUID; + SimpleBLECentral_DiscoverService( connHandle, serviceToDiscover ); } Display_print0(dispHandle, 2, 0, "Connected"); @@ -1246,9 +1247,12 @@ static void SimpleBLECentral_processPairState(uint8_t state, uint8_t status) // Enter a GAP Bond manager Paired state Display_print0(dispHandle, 2, 0, "Pairing success"); - // Begin Service Discovery of AUDIO Service to find out report handles - serviceToDiscover = AUDIO_SERV_UUID; - SimpleBLECentral_DiscoverService( connHandle, serviceToDiscover ); + if (FALSE == serviceDiscComplete) + { + // Begin Service Discovery of AUDIO Service to find out report handles + serviceToDiscover = AUDIO_SERV_UUID; + SimpleBLECentral_DiscoverService( connHandle, serviceToDiscover ); + } } else { From a39b251bafd095331cb251ec5a438f56b93ffd33 Mon Sep 17 00:00:00 2001 From: Sean Lyons Date: Thu, 19 Jan 2017 14:42:32 -0800 Subject: [PATCH 04/19] Voice Docs update --- docs/simple_central_audio_receiver.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/simple_central_audio_receiver.md b/docs/simple_central_audio_receiver.md index a36d52f..f4e5f02 100644 --- a/docs/simple_central_audio_receiver.md +++ b/docs/simple_central_audio_receiver.md @@ -73,6 +73,19 @@ Before running the demo, the user will need the following components: Running the Demo ================ +#### A Note for SensorTag Users + + * In order for the `sensortag_audio` project to run standalone (without a debugger attached), a BIM project must be loaded. + * BIM can be loaded using the project in `\examples\util\bim_extflash`, be sure to use the `FlashOnly_ST` configuration. + + * Additionally the `sensortag_audio` project for CCS will need to have a target configration added to the app project. + * The target config can be added to the app project by copying the `CC2650F128.ccxml` file from the /targetConfigs folder of the stack project to into the app project. + + * `sensortag_audio` for CCS in BLE 2.2.1 does not have pairing and bonding enabled by default. You may see "pairing failed" on the screen. This is safe to ignore, the + demo will proceed correctly. + +#### Voice Streaming on the CC2650 + After building the firmware required for the voice streamer and receiver, you are ready to demo the voice capabilites of the CC2650. 1. Connect the audio\_receiver (CC2650 LaunchPad) device to your PC. Use windows device manager to note the COM port, it is the User/UART port (COM4 in picture below) @@ -83,6 +96,9 @@ After building the firmware required for the voice streamer and receiver, you ar ```Python ser = Serial("COM38", 400000, timeout=0.1) ``` + + * The python script requires pyserial and other dependencies to be installed please see the [FAQ](faq.md) for more info. + 3. Run `audio_frame_serial_print.py` 4. Power up the voice streaming device. * The SensorTag will advertise out of the box, this is indicated by the green blinking LED. From 356f0055c6398329d4bc2cd5d1b3e6e0e5265187 Mon Sep 17 00:00:00 2001 From: Sean Lyons Date: Thu, 19 Jan 2017 16:26:21 -0800 Subject: [PATCH 05/19] Remove duplicate simple_central projectspecs --- ...simple_central_lp_cc2650lp_app.projectspec | 257 ----------------- ...mple_central_lp_cc2650lp_stack.projectspec | 269 ------------------ 2 files changed, 526 deletions(-) delete mode 100644 examples/cc2650lp/simple_central/ccs/app/simple_central_lp_cc2650lp_app.projectspec delete mode 100644 examples/cc2650lp/simple_central/ccs/stack/simple_central_lp_cc2650lp_stack.projectspec diff --git a/examples/cc2650lp/simple_central/ccs/app/simple_central_lp_cc2650lp_app.projectspec b/examples/cc2650lp/simple_central/ccs/app/simple_central_lp_cc2650lp_app.projectspec deleted file mode 100644 index 040caa8..0000000 --- a/examples/cc2650lp/simple_central/ccs/app/simple_central_lp_cc2650lp_app.projectspec +++ /dev/null @@ -1,257 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/cc2650lp/simple_central/ccs/stack/simple_central_lp_cc2650lp_stack.projectspec b/examples/cc2650lp/simple_central/ccs/stack/simple_central_lp_cc2650lp_stack.projectspec deleted file mode 100644 index 3cc3b20..0000000 --- a/examples/cc2650lp/simple_central/ccs/stack/simple_central_lp_cc2650lp_stack.projectspec +++ /dev/null @@ -1,269 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 3f7ed115b6ce5cc59ab0d78e57a21aba38a5c8c7 Mon Sep 17 00:00:00 2001 From: Sean Lyons Date: Thu, 19 Jan 2017 17:13:28 -0800 Subject: [PATCH 06/19] Fix audio_receiver build warnings --- .../cc26xx/app/simple_central_audio_receiver.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/examples/simple_central_audio_receiver/cc26xx/app/simple_central_audio_receiver.c b/src/examples/simple_central_audio_receiver/cc26xx/app/simple_central_audio_receiver.c index e6d704c..a9e579a 100644 --- a/src/examples/simple_central_audio_receiver/cc26xx/app/simple_central_audio_receiver.c +++ b/src/examples/simple_central_audio_receiver/cc26xx/app/simple_central_audio_receiver.c @@ -307,9 +307,6 @@ static uint8_t state = BLE_STATE_IDLE; static uint16_t svcStartHdl = 0; static uint16_t svcEndHdl = 0; -// Discovered characteristic handle -static uint16_t charHdl = 0; - // Maximum PDU size (default = 27 octets) static uint16 maxPduSize; @@ -898,7 +895,6 @@ static void SimpleBLECentral_processRoleEvent(gapCentralRoleEvent_t *pEvent) state = BLE_STATE_IDLE; connHandle = GAP_CONNHANDLE_INIT; - charHdl = 0; Display_print0(dispHandle, 2, 0, "Disconnected"); Display_print1(dispHandle, 3, 0, "Reason: %d", pEvent->linkTerminate.reason); @@ -1368,7 +1364,7 @@ static void SimpleBLECentral_startDiscovery(void) attExchangeMTUReq_t req; // Initialize cached handles - svcStartHdl = svcEndHdl = charHdl = 0; + svcStartHdl = svcEndHdl = 0; // Discover GATT Server's Rx MTU size req.clientRxMTU = maxPduSize - L2CAP_HDR_SIZE; From 07bbd7fc02f08915a9ff57faa2dd00ebe08bbc07 Mon Sep 17 00:00:00 2001 From: Sean Lyons Date: Tue, 7 Feb 2017 16:25:13 -0600 Subject: [PATCH 07/19] Merge pull request #27 in SA/ble_examples from feature/fix_beacon_stack_projectspecs to ble_examples-2.2 Squashed commit of the following: commit aa7c0758075ac19dd3b47aa680c847424bffab35 Author: Nathan Siegel Date: Mon Jan 23 09:18:17 2017 -0800 Fixed stack projectspecs --- .../ccs/stack/simple_beacon_cc2650lp_stack.projectspec | 2 +- .../ccs/stack/simple_eddystone_cc2650lp_stack.projectspec | 2 +- .../stack/simple_proprietary_beacon_cc2650lp_stack.projectspec | 2 +- src/examples/simple_beacon/cc26xx/app/simple_beacon.c | 2 +- .../cc26xx/app/simple_proprietary_beacon.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/cc2650lp/simple_beacon/ccs/stack/simple_beacon_cc2650lp_stack.projectspec b/examples/cc2650lp/simple_beacon/ccs/stack/simple_beacon_cc2650lp_stack.projectspec index e3370ab..456eac0 100644 --- a/examples/cc2650lp/simple_beacon/ccs/stack/simple_beacon_cc2650lp_stack.projectspec +++ b/examples/cc2650lp/simple_beacon/ccs/stack/simple_beacon_cc2650lp_stack.projectspec @@ -60,7 +60,7 @@ preBuildStep=""${TI_BLE_SDK_BASE}/tools/lib_search/lib_search.exe" ${PROJECT_ROOT}/TOOLS/build_config.opt "${TI_BLE_SDK_BASE}/tools/lib_search/params_split_cc2640.xml" ${TI_BLE_SDK_BASE}/blelib "${PROJECT_ROOT}/TOOLS/lib_linker.cmd"" - postBuildStep="${CG_TOOL_HEX} -order MS --memwidth=8 --romwidth=8 --intel -o ${ProjName}.hex ${ProjName}.out;${TI_BLE_SDK_BASE}/tools/frontier/frontier.exe ccs ${PROJECT_LOC}/${ConfigName}/${ProjName}_linkInfo.xml ${PROJECT_ROOT}/TOOLS/ccs_compiler_defines.bcfg ${PROJECT_ROOT}/TOOLS/ccs_linker_defines.cmd" + postBuildStep="${CG_TOOL_HEX} -order MS --memwidth=8 --romwidth=8 --intel -o ${ProjName}.hex ${ProjName}.out;${TI_BLE_SDK_BASE}/tools/frontier/frontier.exe ccs ${PROJECT_LOC}/${ConfigName}/${ProjName}_linkInfo.xml ${PROJECT_IMPORT_LOC}/../config/ccs_compiler_defines.bcfg ${PROJECT_IMPORT_LOC}/../config/ccs_linker_defines.cmd" > diff --git a/examples/cc2650lp/simple_eddystone/ccs/stack/simple_eddystone_cc2650lp_stack.projectspec b/examples/cc2650lp/simple_eddystone/ccs/stack/simple_eddystone_cc2650lp_stack.projectspec index 88bf8cb..fb00be6 100644 --- a/examples/cc2650lp/simple_eddystone/ccs/stack/simple_eddystone_cc2650lp_stack.projectspec +++ b/examples/cc2650lp/simple_eddystone/ccs/stack/simple_eddystone_cc2650lp_stack.projectspec @@ -58,7 +58,7 @@ preBuildStep=""${TI_BLE_SDK_BASE}/tools/lib_search/lib_search.exe" ${PROJECT_ROOT}/TOOLS/build_config.opt "${TI_BLE_SDK_BASE}/tools/lib_search/params_split_cc2640.xml" ${TI_BLE_SDK_BASE}/blelib "${PROJECT_ROOT}/TOOLS/lib_linker.cmd"" - postBuildStep="${CG_TOOL_HEX} -order MS --memwidth=8 --romwidth=8 --intel -o ${ProjName}.hex ${ProjName}.out;${TI_BLE_SDK_BASE}/tools/frontier/frontier.exe ccs ${PROJECT_LOC}/${ConfigName}/${ProjName}_linkInfo.xml ${PROJECT_ROOT}/TOOLS/ccs_compiler_defines.bcfg ${PROJECT_ROOT}/TOOLS/ccs_linker_defines.cmd" + postBuildStep="${CG_TOOL_HEX} -order MS --memwidth=8 --romwidth=8 --intel -o ${ProjName}.hex ${ProjName}.out;${TI_BLE_SDK_BASE}/tools/frontier/frontier.exe ccs ${PROJECT_LOC}/${ConfigName}/${ProjName}_linkInfo.xml ${PROJECT_IMPORT_LOC}/../config/ccs_compiler_defines.bcfg ${PROJECT_IMPORT_LOC}/../config/ccs_linker_defines.cmd" > diff --git a/examples/cc2650lp/simple_proprietary_beacon/ccs/stack/simple_proprietary_beacon_cc2650lp_stack.projectspec b/examples/cc2650lp/simple_proprietary_beacon/ccs/stack/simple_proprietary_beacon_cc2650lp_stack.projectspec index 44c6f9c..95a4699 100644 --- a/examples/cc2650lp/simple_proprietary_beacon/ccs/stack/simple_proprietary_beacon_cc2650lp_stack.projectspec +++ b/examples/cc2650lp/simple_proprietary_beacon/ccs/stack/simple_proprietary_beacon_cc2650lp_stack.projectspec @@ -60,7 +60,7 @@ preBuildStep=""${TI_BLE_SDK_BASE}/tools/lib_search/lib_search.exe" ${PROJECT_ROOT}/TOOLS/build_config.opt "${TI_BLE_SDK_BASE}/tools/lib_search/params_split_cc2640.xml" ${TI_BLE_SDK_BASE}/blelib "${PROJECT_ROOT}/TOOLS/lib_linker.cmd"" - postBuildStep="${CG_TOOL_HEX} -order MS --memwidth=8 --romwidth=8 --intel -o ${ProjName}.hex ${ProjName}.out;${TI_BLE_SDK_BASE}/tools/frontier/frontier.exe ccs ${PROJECT_LOC}/${ConfigName}/${ProjName}_linkInfo.xml ${PROJECT_ROOT}/TOOLS/ccs_compiler_defines.bcfg ${PROJECT_ROOT}/TOOLS/ccs_linker_defines.cmd" + postBuildStep="${CG_TOOL_HEX} -order MS --memwidth=8 --romwidth=8 --intel -o ${ProjName}.hex ${ProjName}.out;${TI_BLE_SDK_BASE}/tools/frontier/frontier.exe ccs ${PROJECT_LOC}/${ConfigName}/${ProjName}_linkInfo.xml ${PROJECT_IMPORT_LOC}/../config/ccs_compiler_defines.bcfg ${PROJECT_IMPORT_LOC}/../config/ccs_linker_defines.cmd" > diff --git a/src/examples/simple_beacon/cc26xx/app/simple_beacon.c b/src/examples/simple_beacon/cc26xx/app/simple_beacon.c index f880606..6999812 100644 --- a/src/examples/simple_beacon/cc26xx/app/simple_beacon.c +++ b/src/examples/simple_beacon/cc26xx/app/simple_beacon.c @@ -413,7 +413,7 @@ static void SimpleBeacon_init(void) // Setup the GAP Peripheral Role Profile { - uint8_t initialAdvertEnable = TRUE; + uint8_t initialAdvertEnable = FALSE; uint8_t initialNonConnAdvEnable = TRUE; // By setting this to zero, the device will go into the waiting state after diff --git a/src/examples/simple_proprietary_beacon/cc26xx/app/simple_proprietary_beacon.c b/src/examples/simple_proprietary_beacon/cc26xx/app/simple_proprietary_beacon.c index b7464fc..3ccfa3f 100644 --- a/src/examples/simple_proprietary_beacon/cc26xx/app/simple_proprietary_beacon.c +++ b/src/examples/simple_proprietary_beacon/cc26xx/app/simple_proprietary_beacon.c @@ -418,7 +418,7 @@ static void SimplePropBeacon_init(void) // Setup the GAP Peripheral Role Profile { - uint8_t initialAdvertEnable = TRUE; + uint8_t initialAdvertEnable = FALSE; uint8_t initialNonConnAdvEnable = TRUE; // By setting this to zero, the device will go into the waiting state after From 2ac7cf4f97e7e3e29b3418dca20facd15e981c66 Mon Sep 17 00:00:00 2001 From: Sean Lyons Date: Wed, 8 Feb 2017 00:38:04 -0600 Subject: [PATCH 08/19] Merge pull request #25 in SA/ble_examples from feature/audio_receiver_voice_improvements to ble_examples-2.2 Squashed commit of the following: commit 9932fc8285249dbd7c16f6f9d10851c210b411a8 Author: Sean Lyons Date: Tue Feb 7 22:35:21 2017 -0800 Minor cleanup, doc updates commit c7acbaa5b5b2bded4ed16f09f766e7577884ca04 Author: Torbjorn Sorby Date: Tue Jan 24 09:19:36 2017 +0100 LPRFAPPS-678: Add manifest for mSBC codec commit a37edf8f78e3ce2498802086332c7d68fa750b31 Author: Sean Lyons Date: Mon Jan 16 18:21:07 2017 -0800 Add CC26xx SBC Implementation src files See LPRFAPPS-678 commit 24d8d363975a20407a4d62575b6675a5fc75bbbe Author: Sean Lyons Date: Thu Jan 12 17:51:33 2017 -0800 Update peri_audio_tx project to IARv7.70.2 See: LPRFAPPS-678 commit 855a40a45c923afb67f8e43e58d5e6fb2a386e62 Author: Sean Lyons Date: Thu Jan 12 17:38:51 2017 -0800 Port IAR audio receiver to IARv7.70.2 commit 34c1a6f86704bd4501d31725d573775b375f54e0 Author: Sean Lyons Date: Thu Jan 12 16:13:52 2017 -0800 Change audio_rx,tx CCS apps to use auxram linker See: LPRFAPPS-678 commit 7471ef2cbeae1210b02c0ed0beafc0398a87c4fd Author: Torbjorn Sorby Date: Wed Jan 4 12:43:25 2017 +0100 Audio Tx Peripheral Add simple_peripheral_audio_transmitter to work as audio source Add support for new Simple Peripheral Audio Transmitter commit 2e1f52358b419763e649acf30888d26a77583fba Author: Torbjorn Sorby Date: Wed Jan 4 12:45:56 2017 +0100 Audio Central + mSBC and CC3200AUDBOOST Add I2S driver, both input and output Changed codec configuration to get a usable bitclock and word clock period Made compatible changes to I2S driver Add volume adjustments, compensate for difference in gain between mSBC and ADPCM Add volume fading in/out of streaming Runtime configurable codec Enable ADPCM encoding Two outputs are supported: CC3200AUDBOOST booster pack, and UART By default output to AUDBOOST is enabled. In order to change to UART one must either disable logging, or route it to LCD. It is safe to route to LCD even if it is not mounted. In addition one must undefine STREAM_TO_AUDBOOST and define STREAM_TO_PC. When streaming over UART to PC is enabled, the default mode is to stream the encoded data. It is possible to stream uncompressed data if one defines UART_DUMP_UNCOMPRESSED. The original python script audio_frame_serial_print.py has been modified to expect a full frame, instead of single notificiations. Another script, pySBC27.py, has been added to decode the mSBC stream. Currently only one can operate at a time. It would be possible to merge the two scripts with some processing. Optimally a start and stop sequence could be transmitted over UART to identify which stream to expect. commit 60668ca7e2e8a9b548b0cd44516292e2f84429a9 Author: Torbjorn Sorby Date: Wed Jan 4 12:58:40 2017 +0100 mSBC library (binary) For IAR: bin/cc2650_mSBCdecode_library.a bin/cc2650_mSBCencode_library.a For CCS: bin/cc2650_mSBCdecode_library.lib bin/cc2650_mSBCencode_library.lib Use with include/msbc_library.h commit 34799ee8cf3b67c7f63194fc3c33c843cfdba7f9 Author: Sean Lyons Date: Thu Nov 3 20:23:29 2016 -0700 Cleanup comments See LPRFAPPS-678 commit ea5a39529ad22364e8a39282c616fcd414fa9095 Author: Sean Lyons Date: Thu Nov 3 20:16:55 2016 -0700 Implement I2C control interface to codec See LPRFAPPS-678 commit 2839f3cd2cb9be368a3fb730cb19bdd975008a04 Author: Sean Lyons Date: Thu Nov 3 17:18:16 2016 -0700 Add TLV320AIC3254 code from CC3200 SDK See LPRFAPPS-678 commit f7cba936a875bc0479268f6925b50a06b7c411d9 Author: Sean Lyons Date: Thu Nov 3 17:14:39 2016 -0700 Add drivers, codecs to project files See LPRFAPPS-678 commit 4135bdf92d555919a654834f1dd9387b4c64b208 Author: Sean Lyons Date: Thu Nov 3 13:06:10 2016 -0700 Local voice decode working on IAR and CCS This commit moves ADPCM decode to the CC2650 LP - Now sends decoded PCM data over UART - Python script updated to handle PCM instead of ADPCM See LPRFAPPS-677 commit fc9a614f082597c9ad206e7efe8a07618372fed8 Author: Sean Lyons Date: Wed Nov 2 11:56:04 2016 -0700 Remove AUDIO_SERVICE defines See LPRFAPPS-677 --- README.md | 10 +- docs/simple_central_audio_receiver.md | 175 +- docs/simple_peripheral_audio_transmitter.md | 175 ++ ...al_audio_receiver_cc2650lp_app.projectspec | 211 +- .../ccs/config/ccs_compiler_defines.bcfg | 6 +- .../ccs/config/ccs_linker_defines.cmd | 6 +- .../iar/app/cc2650lp_app.ewd | 198 +- .../iar/app/cc2650lp_app.ewp | 142 +- .../iar/config/iar_boundary.bdef | 6 +- .../iar/config/iar_boundary.xcl | 6 +- ...mple_central_audio_receiver.custom_argvars | 16 +- ...audio_transmitter_cc2650lp_app.projectspec | 314 +++ .../ccs/config/app_ble.cfg | 676 ++++++ .../ccs/config/ccs_compiler_defines.bcfg | 10 + .../ccs/config/ccs_linker_defines.cmd | 10 + ...dio_transmitter_cc2650lp_stack.projectspec | 269 +++ .../iar/app/cc2650lp_app.ewd | 1646 +++++++++++++++ .../iar/app/cc2650lp_app.ewp | 1268 ++++++++++++ .../iar/config/app_ble.cfg | 676 ++++++ .../iar/config/iar_boundary.bdef | 10 + .../iar/config/iar_boundary.xcl | 10 + .../iar/config/lib_linker.cmd | 8 + ...eripheral_audio_transmitter.custom_argvars | 52 + .../simple_peripheral_audio_transmitter.eww | 13 + .../iar/stack/build_config.opt | 138 ++ .../iar/stack/cc2650lp_stack.ewd | 1646 +++++++++++++++ .../iar/stack/cc2650lp_stack.ewp | 1245 +++++++++++ .../bin/cc2650_mSBCdecode_library.a | Bin 0 -> 73094 bytes .../bin/cc2650_mSBCdecode_library.lib | Bin 0 -> 127968 bytes .../bin/cc2650_mSBCencode_library.a | Bin 0 -> 67726 bytes .../bin/cc2650_mSBCencode_library.lib | Bin 0 -> 118258 bytes .../util/mSBClibrary/include/msbc_library.h | 64 + ...udio_codec_cc26xx_cc13xx_1.0_manifest.html | 357 ++++ src/boards/CC2650_LAUNCHXL/Board.h | 84 + src/boards/CC2650_LAUNCHXL/CC2650_LAUNCHXL.c | 791 +++++++ src/boards/CC2650_LAUNCHXL/CC2650_LAUNCHXL.h | 328 +++ src/common/cc26xx/ccs/cc26xx_app_auxram.cmd | 157 ++ .../app/simple_central_audio_receiver.c | 530 ++++- .../app/simple_peripheral_audio_transmitter.c | 1842 +++++++++++++++++ src/util/audio_codec/I2SCC26XX.c | 1203 +++++++++++ src/util/audio_codec/I2SCC26XX.h | 1141 ++++++++++ src/util/audio_codec/audiocodec.c | 638 ++++++ src/util/audio_codec/audiocodec.h | 198 ++ src/util/audio_codec/ti3254.h | 145 ++ src/util/sbc/sbc.c | 1664 +++++++++++++++ src/util/sbc/sbc.h | 124 ++ src/util/sbc/sbc_cc26xx_port.h | 65 + src/util/sbc/sbc_math.h | 71 + src/util/sbc/sbc_primitives.c | 706 +++++++ src/util/sbc/sbc_primitives.h | 92 + src/util/sbc/sbc_private.h | 30 + src/util/sbc/sbc_tables.h | 662 ++++++ tools/scripts/audio/SBC.dll | Bin 0 -> 13824 bytes tools/scripts/audio/SBC_x64.dll | Bin 0 -> 15872 bytes .../scripts/audio/audio_frame_serial_print.py | 71 +- tools/scripts/audio/pySBC27.py | 232 +++ tools/scripts/audio/samples/.gitignore | 5 + 57 files changed, 19849 insertions(+), 293 deletions(-) create mode 100644 docs/simple_peripheral_audio_transmitter.md create mode 100644 examples/cc2650lp/simple_peripheral_audio_transmitter/ccs/app/simple_peripheral_audio_transmitter_cc2650lp_app.projectspec create mode 100644 examples/cc2650lp/simple_peripheral_audio_transmitter/ccs/config/app_ble.cfg create mode 100644 examples/cc2650lp/simple_peripheral_audio_transmitter/ccs/config/ccs_compiler_defines.bcfg create mode 100644 examples/cc2650lp/simple_peripheral_audio_transmitter/ccs/config/ccs_linker_defines.cmd create mode 100644 examples/cc2650lp/simple_peripheral_audio_transmitter/ccs/stack/simple_peripheral_audio_transmitter_cc2650lp_stack.projectspec create mode 100644 examples/cc2650lp/simple_peripheral_audio_transmitter/iar/app/cc2650lp_app.ewd create mode 100644 examples/cc2650lp/simple_peripheral_audio_transmitter/iar/app/cc2650lp_app.ewp create mode 100644 examples/cc2650lp/simple_peripheral_audio_transmitter/iar/config/app_ble.cfg create mode 100644 examples/cc2650lp/simple_peripheral_audio_transmitter/iar/config/iar_boundary.bdef create mode 100644 examples/cc2650lp/simple_peripheral_audio_transmitter/iar/config/iar_boundary.xcl create mode 100644 examples/cc2650lp/simple_peripheral_audio_transmitter/iar/config/lib_linker.cmd create mode 100644 examples/cc2650lp/simple_peripheral_audio_transmitter/iar/simple_peripheral_audio_transmitter.custom_argvars create mode 100644 examples/cc2650lp/simple_peripheral_audio_transmitter/iar/simple_peripheral_audio_transmitter.eww create mode 100644 examples/cc2650lp/simple_peripheral_audio_transmitter/iar/stack/build_config.opt create mode 100644 examples/cc2650lp/simple_peripheral_audio_transmitter/iar/stack/cc2650lp_stack.ewd create mode 100644 examples/cc2650lp/simple_peripheral_audio_transmitter/iar/stack/cc2650lp_stack.ewp create mode 100644 examples/util/mSBClibrary/bin/cc2650_mSBCdecode_library.a create mode 100644 examples/util/mSBClibrary/bin/cc2650_mSBCdecode_library.lib create mode 100644 examples/util/mSBClibrary/bin/cc2650_mSBCencode_library.a create mode 100644 examples/util/mSBClibrary/bin/cc2650_mSBCencode_library.lib create mode 100644 examples/util/mSBClibrary/include/msbc_library.h create mode 100644 mSBC_audio_codec_cc26xx_cc13xx_1.0_manifest.html create mode 100644 src/boards/CC2650_LAUNCHXL/Board.h create mode 100644 src/boards/CC2650_LAUNCHXL/CC2650_LAUNCHXL.c create mode 100644 src/boards/CC2650_LAUNCHXL/CC2650_LAUNCHXL.h create mode 100644 src/common/cc26xx/ccs/cc26xx_app_auxram.cmd create mode 100644 src/examples/simple_peripheral_audio_transmitter/cc26xx/app/simple_peripheral_audio_transmitter.c create mode 100644 src/util/audio_codec/I2SCC26XX.c create mode 100644 src/util/audio_codec/I2SCC26XX.h create mode 100644 src/util/audio_codec/audiocodec.c create mode 100644 src/util/audio_codec/audiocodec.h create mode 100644 src/util/audio_codec/ti3254.h create mode 100644 src/util/sbc/sbc.c create mode 100644 src/util/sbc/sbc.h create mode 100644 src/util/sbc/sbc_cc26xx_port.h create mode 100644 src/util/sbc/sbc_math.h create mode 100644 src/util/sbc/sbc_primitives.c create mode 100644 src/util/sbc/sbc_primitives.h create mode 100644 src/util/sbc/sbc_private.h create mode 100644 src/util/sbc/sbc_tables.h create mode 100644 tools/scripts/audio/SBC.dll create mode 100644 tools/scripts/audio/SBC_x64.dll create mode 100644 tools/scripts/audio/pySBC27.py create mode 100644 tools/scripts/audio/samples/.gitignore diff --git a/README.md b/README.md index 709b251..6325eb0 100644 --- a/README.md +++ b/README.md @@ -94,11 +94,17 @@ The following examples are currently supported:     [docs](docs/simple_central_lp.md) | [Launchpad project files](examples/cc2650lp/simple_central) | [src](src/examples/simple_central) ### simple\_central\_audio\_receiver -    Receive and decode a voice stream over BLE using CC2650 central device and SensorTag or
-    HID Advanced Remote peripheral device +    Receive and decode a voice stream over BLE using CC2650 central device and SensorTag,
+    HID Advanced Remote or CC2650 LaunchPad with CC3200AUDBOOST peripheral device     [docs](docs/simple_central_audio_receiver.md) | [project files](examples/cc2650lp/simple_central_audio_receiver) | [src](src/examples/simple_central_audio_receiver) +### simple\_peripheral\_audio\_transmitter +    Encode and transmit an audio stream over BLE using CC2650 peripheral device on LaunchPad with CC3200AUDBOOST
+    booster pack + +    [docs](docs/simple_peripheral_audio_transmitter.md) | [project files](examples/cc2650lp/simple_peripheral_audio_transmitter) | [src](src/examples/simple_peripheral_audio_transmitter) + ### simple\_eddystone     Demonstrate an implementation of a beacon that uses the Eddystone beacon format diff --git a/docs/simple_central_audio_receiver.md b/docs/simple_central_audio_receiver.md index f4e5f02..484d0c7 100644 --- a/docs/simple_central_audio_receiver.md +++ b/docs/simple_central_audio_receiver.md @@ -2,27 +2,28 @@ Purpose / Scope =============== This page will document how to demonstrate an end to end BLE voice solution using two CC2650 devices. -Emphasis will be placed on the central device which is reponsible for recieving and decoding the voice stream. +Emphasis will be placed on the central device which is responsible for receieving and decoding the voice stream. -TI's voice system supports streaming voice data from the Pulse Density Modulation (PDM) microphone on the CC2650 SensorTag and HID Advanced Remote kits. -Voice data is transferred over BLE using the TI audio\_profile which is a Voice Over GATT Profile (VoGP) design. +TI's voice system has long supported streaming voice data from the Pulse Density Modulation (PDM) microphone on the CC2650 SensorTag and HID Advanced Remote kits. Now support for the CC3200AUDBOOST boosterpack and another compression algorithm, mSBC, is added. +Voice data is transferred over BLE using the TI audio\_profile which is a Voice Over GATT Profile (VoGP) design. This profile has been update to add an additional start byte. This new start byte indicates that the following stream uses mSBC compression. In this demo, data flows unidirectionally between a streamer (GATT server) and a receiver (GATT client) device. -The supported streamer examples from the BLE-Stack SDK are: +In addition to the `simple_peripheral_audio_transmitter`, the following streamer examples from the BLE-Stack SDK are supported: - `hid_adv_remote` - `sensortag_audio` -The streaming devices are the ones containing the PDM microphone on board. These are the devices the user will ultimately be speaking into. -These devkits and firmware examples can be found within the BLE-Stack SDK release. +The streaming devices are the ones containing the PDM microphone on board, and CC2650 LaunchPad with CC3200AUDBOOST boosterpack. These are the devices the user will ultimately be speaking into, or send audio to via 3.5mm jack. +The PDM microphone based devkits and firmware examples can be found within the BLE-Stack SDK release. Simple Central Audio Receiver is designed to demonstrate receiving and decoding (for playback or cloud based speech recognition) the voice stream from one of the supported streamer examples above. This example is based on the simple\_central project from the **BLE-Stack v2.2.1** installer. The central project was slightly modified to: - Run on the CC2650 LaunchPad - - Automatically connect to CC2650 SensorTag or CC2650RC based on advertisement data + - Automatically connect to CC2650 SensorTag, CC2650RC or CC2650 LaunchPad with CC3200AUDBOOST based on advertisement data - Receive voice stream using the TI VoGP audio\_profile - - Send the voice stream to the PC over UART for post processing (Python script included) + - Decode the voice stream and output to headphone/line out on CC3200AUDBOOST. Connect this to headphones, or speaker + - [Optional] Send the voice stream to the PC over UART for post processing (Python script included) Streaming Voice over BLE ======================== @@ -35,12 +36,12 @@ _Note: The above links also apply to sensortag\_audio projects as well. They emp Some quick facts about voice over BLE: - - Input device: `Pulse Density Modulation (PDM) Microphone` + - Input device: `Pulse Density Modulation (PDM) Microphone` or `CC3200AUDBOOST boosterpack` - Sample rate: `16kHz` - Bit Depth: `16 bits` - - Compression mechanism: `4:1 IMA-ADPCM` - - Required application throughput: `66.67kbps` - - Voice quality has been qualified by Nuance and is sufficient for voice recognition solutions + - Compression mechanism: `4:1 IMA-ADPCM` or `mSBC` + - Required application throughput: `66.67kbps` or `60.8kpbs` + - Voice quality (IMA-ADPCM) has been qualified by Nuance and is sufficient for voice recognition solutions Prerequisites @@ -50,21 +51,27 @@ Prerequisites Before running the demo, the user will need the following components: -- CC2650 voice enabled development kit (SensorTag or HID Advanced Remote) +- CC2650 voice enabled development kit (SensorTag, HID Advanced Remote or CC2650 LaunchPad with CC3200AUDBOOST) - [CC2650 RC](http://www.ti.com/tool/cc2650rc) - [CC2650 STK](http://www.ti.com/tool/cc2650stk) + - [CC2650 LaunchPad](http://www.ti.com/tool/launchxl-cc2650) + with [CC3200AUDBOOST](http://www.ti.com/tool/cc3200audboost) - [BLE-Stack v2.2.1](http://www.ti.com/ble-stack) - [CC2650 LaunchPad](http://www.ti.com/tool/launchxl-cc2650) -- A PC that supports `.wav` file playback. +- A device to output audio over a 3.5mm jack (connected to the LINE-IN, 3.5mm stereo jack, of the CC3200AUDBOOST boosterpack) +- **OPTIONAL:** A PC that supports `.wav` file playback, and/or view logging via UART-over-USB, @460800 baudrate - **OPTIONAL:** [Sharp LCD BoosterPack](http://www.ti.com/tool/430boost-sharp96) #### Firmware Requirements +_Note: Apple headphones will not work with the CC3200 boosterpack_ + 1. Load the voice streaming device with it's proper firmware image from the BLE-Stack SDK * For the CC2650 STK this is the `sensortag_audio` project * For the CC2650 RC this is the `hid_adv_remote` project + * For the CC2650 LaunchPad with CC3200AUDBOOST this is the `simple_peripheral_audio_transmitter` project 2. Load the `simple_central_audio_reciever` project onto the CC2650 LaunchPad -3. Handle Python dependencies for `audio_frame_serial_print.py` from [tools/scripts/audio folder](../tools/scripts/audio) +3. **OPTIONAL** Handle Python dependencies for `audio_frame_serial_print.py` from [tools/scripts/audio folder](../tools/scripts/audio) * Requires [Python 2.7](https://www.python.org/download/releases/2.7/) * The script also requires the following Python modules: struct, wave, serial, time, winsound * See the [FAQ](faq.md) for more info @@ -86,32 +93,110 @@ Running the Demo #### Voice Streaming on the CC2650 -After building the firmware required for the voice streamer and receiver, you are ready to demo the voice capabilites of the CC2650. +After building the firmware required for the voice transmitter and receiver, you are ready to demo the voice capabilities of the CC2650. + +1. Power up the transmitter launchpad + * If the serial port is attached it will log + ``` + Audio Tx Peripheral + + Initialized + Advertising + ``` + +2. Power up the audio\_receiver device + * If the serial port is attached it will log + ``` + Audio Central + + Initialized + Idle... + ``` +3. Start Discovery on the central device by pressing the left key on the LaunchPad. Scanning is indicated by blinking green LED on the LaunchPad. + * The Central device will scan the peripheral's advertisement data for either the TI\_COMPANY\_ID (SensorTag), the HID\_SERV\_UUID (HID Advanced Remote) or SIMPLEPROFILE\_SERV\_UUID (Audio Tx Peripheral). + * After finding devices that list these services their advertisement payloads it will scan for the following device names: + ```c + static uint8 remoteNameST[] = + { + 'C', 'C', '2', '6', '5', '0', ' ', + 'S', 'e', 'n', 's', 'o', 'r', 'T', 'a', 'g', + }; + ... + static uint8 remoteNameRC[] = + { + 'H', 'I', 'D', ' ', 'A', 'd', 'v', 'R', 'e', 'm', 'o', 't', 'e' + }; + ... + static uint8 remoteNameTx[] = + { + 'S', 'i', 'm', 'p', 'l', 'e', + 'B', 'L', 'E', + 'A', 'u', 'd', 'i', 'o', 'T', 'x', + }; + ``` +4. If an acceptable voice streaming device is found (STK, CC2650RC or CC2650LP) then the central will connect, pair, and bond to the device. If attached the serial port will log: + * Audio Central + ``` + Discovering... + Pairing started + Connected + + Pairing success + Bond Saved OR Param Update: 0 + ``` + * Audio Tx Peripheral + ``` + Connected + + ``` +5. The devices are now ready to stream voice over BLE. + * Press and hold the MIC button to start streaming voice from the HID Advanced Remote + * Press and hold the right key on the SensorTag to start streaming voice from the SensorTag + * If using the launchpad press: + * Right button to start transmitting with ADPCM compression + * Left button to start transmitting with mSBC compression + * Press both buttons simultaneously to stop transmitting +6. The demo is written such that, once a sensortag, remote control or transmitting launchpad is discovered, the audio\_receiver project will pair and bond to it. Scanning/connecting to other devices is not allowed while bonded. (i.e. left button is disabled). In order to "forget the devices" you should: + * Power off your audio transmitting device. Wait for link to be terminated. Red LED will turn on. + * Press the right key to erase the bonds from the audio\_receiver project. Green LED will blink 1x while red LED stays on. + * The bonds are now erased, you can discover and connect to another device. + +Optional demo +------------ + +It is possible to send the stream to a PC. In this case there will be no logging via UART, for logging please mount LCD on top of CC3200AUDBOOST. To enable this one must rebuild the `simple_central_audio_reciever` project with the following modifications in Project-->C/C++ Compiler-->Preprocessor-->Defined symbols: +``` +xSTREAM_TO_AUDBOOST +STREAM_TO_PC +BOARD_DISPLAY_EXCLUDE_UART +xBOARD_DISPLAY_EXCLUDE_LCD +``` + +There are two python scripts for decoding and recording audio. `audio_frame_serial_print` is used for ADPCM stream, and `pySBC27` is used for mSBC format. The instructions below are written for the `audio_frame_serial_print`. To decode mSBC simply replace all references to `audio_frame_serial_print` below with `pySBC27`. 1. Connect the audio\_receiver (CC2650 LaunchPad) device to your PC. Use windows device manager to note the COM port, it is the User/UART port (COM4 in picture below) ![Connecting the COM Port](doc_resources/dev_mgr_xds110.png) -2. Make note of the COM port from step #1 and update the Python script to use that port by replacing COM38 the following line: +2. Make note of the COM port from step #1 and update the Python script to use that port by replacing COM91 the following line: ```Python - ser = Serial("COM38", 400000, timeout=0.1) + ser = Serial("COM91", 460800, timeout=0.1) ``` - - * The python script requires pyserial and other dependencies to be installed please see the [FAQ](faq.md) for more info. - + * The python script requires pyserial and other dependencies to be installed please see the [FAQ](faq.md) for more info. 3. Run `audio_frame_serial_print.py` 4. Power up the voice streaming device. * The SensorTag will advertise out of the box, this is indicated by the green blinking LED. * The HID Advanced Remote will advertise after any button press. + * The CC2650 LaunchPad with CC3200AUDBOOST will always advertise when not in connection 5. Power up the audio\receiver device - * If the LCD is attached it will display + * If the LCD is mounted it will display ``` Audio central Idle... ``` 6. Start Discovery on the central device by pressing the left key on the LaunchPad. Scanning is indicated by blinking green LED on the LaunchPad. - * The Central device will scan the peripheral's advertisement data for either the TI\_COMPANY\_ID (SensorTag) or the HID\_SERV\_UUID (HID Advanced Remote). + * The Central device will scan the peripheral's advertisement data for either the TI\_COMPANY\_ID (SensorTag), the HID\_SERV\_UUID (HID Advanced Remote) or SIMPLEPROFILE\_SERV\_UUID (Audio Tx Peripheral). * After finding devices that list these services their advertisement payloads it will scan for the following device names: ```c static uint8 remoteNameST[] = @@ -124,17 +209,36 @@ After building the firmware required for the voice streamer and receiver, you ar { 'H', 'I', 'D', ' ', 'A', 'd', 'v', 'R', 'e', 'm', 'o', 't', 'e' }; + ... + static uint8 remoteNameTx[] = + { + 'S', 'i', 'm', 'p', 'l', 'e', + 'B', 'L', 'E', + 'A', 'u', 'd', 'i', 'o', 'T', 'x', + }; ``` -7. If an acceptable voice streaming device is found (STK or CC2650RC) then the central will connect, pair, and bond to the device. If attached the Sharp LCD will display: +7. If an acceptable voice streaming device is found (STK, CC2650RC or CC2650LP) then the central will connect, pair, and bond to the device. If attached the serial port will log: + * Audio Central ``` - Audio central - + Discovering... + Pairing started + Connected + + Pairing success Bond Saved OR Param Update: 0 + ``` + * Audio Tx Peripheral + ``` + Connected ``` 8. The devices are now ready to stream voice over BLE * Press and hold the MIC button to start streaming voice from the HID Advanced Remote * Press and hold the right key on the SensorTag to start streaming voice from the SensorTag + * On the transmitting launchpad press: + * Right button to start transmitting with ADPCM compression + * Left button to start transmitting with mSBC compression + * Press both buttons simultaneously to stop transmitting 9. The Python script will read the voice frames from the CC2650 and decode them into `.wav` files. These files can be played back on the PC. * The files are saved in the format: `pdm_test_%Y-%m-%d_%H-%M-%S_adpcm` where Y, m, d, H, M, S are used to store the time stamp when the file was saved. @@ -154,6 +258,25 @@ The following states of the device can be described by the red and green LEDs on * Device connected and bonded + streaming voice: Red LED blinks on both LP and STK or Remote. * Bonds forgotten: Green LED blinks 1x while red LED is on. +Useful tip +========== + +To make more RAM available to HEAP some variables are placed in AUX_RAM. This ram is available when the Sensor Controller is not in use. The following code in `simple_central_audio_receiver.c` shows this placement: + +IAR: +``` +#pragma default_variable_attributes = @ "AUX_RAM_SECTION" +``` + +CCS: +``` +#pragma DATA_SECTION(i2sContMgtBuffer, ".aux_ram") +#pragma DATA_SECTION(audio_encoded, ".aux_ram") +#pragma DATA_SECTION(sbc, ".aux_ram") +#pragma DATA_SECTION(written, ".aux_ram") +#pragma DATA_SECTION(streamVariables, ".aux_ram") +``` + References ========== * [CC2650 Remote Control User's Guide](http://processors.wiki.ti.com/index.php/CC2650RC_UG) diff --git a/docs/simple_peripheral_audio_transmitter.md b/docs/simple_peripheral_audio_transmitter.md new file mode 100644 index 0000000..b91dbfa --- /dev/null +++ b/docs/simple_peripheral_audio_transmitter.md @@ -0,0 +1,175 @@ +Purpose / Scope +=============== + +This page will document how to demonstrate an end to end BLE voice solution using two CC2650 LaunchPads with CC3200AUDBOOST boosterpacks. +Emphasis will be placed on the peripheral device which is responsible for coding and transmitting the voice stream. + +TI's voice system has long supported streaming voice data from the Pulse Density Modulation (PDM) microphone on the CC2650 SensorTag and HID Advanced Remote kits. This page documents an addition. The addition is the usage of the CC3200AUDBOOST boosterpack. It also adds another compression algorithm, mSBC. +Voice data is transferred over BLE using the TI audio\_profile which is a Voice Over GATT Profile (VoGP) design. This profile has been update to add an additional start byte. This new start byte indicates that the following stream uses mSBC compression. +In this demo, data flows unidirectionally between a streamer (GATT server) and a receiver (GATT client) device. + +Other supported streamer examples from the BLE-Stack SDK are: + - `hid_adv_remote` + - `sensortag_audio` + +Simple Peripheral Audio Transmitter is designed to demonstrate coding and transmitting the audio stream from the CC3200AUDBOOST boosterpack. This example is based on the simple\_peripheral project from the **BLE-Stack v2.2.1** installer. + +The peripheral project was modified as follows: + + - Run on the CC2650 LaunchPad + - Always advertise and attempt to connect to CC2650 LaunchPad Audio Central + - Change scan response data to 'SimpleBLEAudioTx' and device name to 'Simple BLE AudioTx' + - Transmit audio stream using the TI VoGP audio\_profile + - Switch between ADPCM and mSBC compression + +Streaming Voice over BLE +======================== + +For more information about the technical details of TI's Voice Over BLE Solution please see: + - [Voice Streaming on CC2650](http://processors.wiki.ti.com/index.php/CC2650RC_Getting_Started_with_Development#Voice_Streaming_on_the_CC2650RC) + - [Voice Over BLE](http://processors.wiki.ti.com/index.php/BLESDK-2.2.x-CC2650RC_Developers_Guide#Voice_Over_BLE) + +_Note: The above links also apply to sensortag\_audio projects as well. They employ the same firmware components (PDM driver, audio\_profile, etc) as the Remote Control solutions, but deploy on a different dev board._ + +Some quick facts about voice over BLE: + + - Input device: `Pulse Density Modulation (PDM) Microphone` or `CC3200AUDBOOST boosterpack` + - Sample rate: `16kHz` + - Bit Depth: `16 bits` + - Compression mechanism: `4:1 IMA-ADPCM` or `mSBC` + - Required application throughput: `66.67kbps` or `60.8kpbs` + - Voice quality (IMA-ADPCM) has been qualified by Nuance and is sufficient for voice recognition solutions + + +Prerequisites +============= + +#### Hardware Requirements + +_Note: Apple headphones will not work with the CC3200 boosterpack_ + +Before running the demo, the user will need the following components: + +- [CC2650 LaunchPad](http://www.ti.com/tool/launchxl-cc2650) +- [CC3200AUDBOOST](http://www.ti.com/tool/cc3200audboost) +- [BLE-Stack v2.2.1](http://www.ti.com/ble-stack) +- A device to output audio over a 3.5mm jack (connected to the LINE-IN, 3.5mm stereo jack, of the CC3200AUDBOOST boosterpack) +- **OPTIONAL:** A PC to view logging via UART-over-USB, @460800 baudrate +- **OPTIONAL:** [Sharp LCD BoosterPack](http://www.ti.com/tool/430boost-sharp96) + +#### Firmware Requirements + +1. Load the `simple_peripheral_audio_transmitter` project onto one CC2650 LaunchPad +2. Load the `simple_central_audio_reciever` project onto the other CC2650 LaunchPad + + +Running the Demo +================ + +After building the firmware required for the voice transmitter and receiver, you are ready to demo the voice capabilities of the CC2650. Before following the steps below, +be sure that an audio source (i.e. line out from a PC is connected to the LINE_IN jack of the `CC3200AUDBOOST`). + +1. Power up the transmitter launchpad + * If the serial port is attached it will log + ``` + Audio Tx Peripheral + + Initialized + Advertising + ``` +2. Power up the audio\_receiver device + * If the serial port is attached it will log + ``` + Audio Central + + Initialized + Idle... + ``` +3. Start Discovery on the central device by pressing the left key on the LaunchPad. Scanning is indicated by blinking green LED on the LaunchPad. + * The Central device will scan the peripheral's advertisement data for either the TI\_COMPANY\_ID (SensorTag), the HID\_SERV\_UUID (HID Advanced Remote) or SIMPLEPROFILE\_SERV\_UUID (Audio Tx Peripheral). + * After finding devices that list these services their advertisement payloads it will scan for the following device names: + ```c + static uint8 remoteNameST[] = + { + 'C', 'C', '2', '6', '5', '0', ' ', + 'S', 'e', 'n', 's', 'o', 'r', 'T', 'a', 'g', + }; + ... + static uint8 remoteNameRC[] = + { + 'H', 'I', 'D', ' ', 'A', 'd', 'v', 'R', 'e', 'm', 'o', 't', 'e' + }; + ... + static uint8 remoteNameTx[] = + { + 'S', 'i', 'm', 'p', 'l', 'e', + 'B', 'L', 'E', + 'A', 'u', 'd', 'i', 'o', 'T', 'x', + }; + ``` +4. If an acceptable voice streaming device is found (STK, CC2650RC or CC2650LP) then the central will connect, pair, and bond to the device. If attached the serial port will log: + * Audio Central + ``` + Discovering... + Pairing started + Connected + + Pairing success + Bond Saved OR Param Update: 0 + ``` + * Audio Tx Peripheral + ``` + Connected + + ``` +5. The devices are now ready to stream voice over BLE. On the transmitting launchpad press: + * Right button to start transmitting with ADPCM compression + * Left button to start transmitting with mSBC compression +6. The demo is written such that, once a sensortag, remote control or transmitting launchpad is discovered, the audio\_receiver project will pair and bond to it. Scanning/connecting to other devices is not allowed while bonded. (i.e. left button is disabled). In order to "forget the devices" you should: + * Power off your audio transmitting device. Wait for link to be terminated. Red LED will turn on. + * Press the right key to erase the bonds from the audio\_receiver project. Green LED will blink 1x while red LED stays on. + * The bonds are now erased, you can discover and connect to another device. + +Demo LED states +=============== + +The following states of the device can be described by the red and green LEDs on the LaunchPad. + +Audio Central: +* Idle + bonds forgotten: Red LED is on, solid +* Scanning for devices: Green LED is flashing +* Device connected + bond saved: Green LED is on, solid +* Device connected and bonded + streaming voice: Red LED blinks on both LP and STK or Remote. +* Bonds forgotten: Green LED blinks 1x while red LED is on. + +Audio Tx Peripheral: +* Transmitting mSBC compressed audio: Red LED is active, and on (Green is inactive LED) +* Transmitting ADPCM compressed audio: Green LED is active, and on (Red is inactive LED) +* Fails to add notification to queue: Active LED flicker +* I2S driver fails to get buffer for next frame: Inactive LED flicker + +Useful tip +========== + +To make more RAM available to HEAP some variables are placed in AUX_RAM. This ram is available when the Sensor Controller is not in use. The following code in `simple_peripheral_audio_transmitter.c` shows this placement: + +IAR: +``` +#pragma default_variable_attributes = @ "AUX_RAM_SECTION" +``` + +CCS: +``` +#pragma DATA_SECTION(i2sContMgtBuffer, ".aux_ram") +#pragma DATA_SECTION(audio_encoded, ".aux_ram") +#pragma DATA_SECTION(sbc, ".aux_ram") +#pragma DATA_SECTION(written, ".aux_ram") +#pragma DATA_SECTION(streamVariables, ".aux_ram") +``` + +References +========== + * [CC2650 Remote Control User's Guide](http://processors.wiki.ti.com/index.php/CC2650RC_UG) + * [CC2650 Remote Control Developer's Guide](http://processors.wiki.ti.com/index.php/CC2650RC_Getting_Started_with_Development#Getting_started_with_Development) + * [CC2650 SensorTag User's Guide](http://processors.wiki.ti.com/index.php/CC2650_SensorTag_User%27s_Guide) + * [Voice Over BLE](http://processors.wiki.ti.com/index.php/BLESDK-2.2.x-CC2650RC_Developers_Guide#Voice_Over_BLE) diff --git a/examples/cc2650lp/simple_central_audio_receiver/ccs/app/simple_central_audio_receiver_cc2650lp_app.projectspec b/examples/cc2650lp/simple_central_audio_receiver/ccs/app/simple_central_audio_receiver_cc2650lp_app.projectspec index b99db8e..aef7257 100644 --- a/examples/cc2650lp/simple_central_audio_receiver/ccs/app/simple_central_audio_receiver_cc2650lp_app.projectspec +++ b/examples/cc2650lp/simple_central_audio_receiver/ccs/app/simple_central_audio_receiver_cc2650lp_app.projectspec @@ -7,89 +7,100 @@ cgtVersion="5.2.6" connection="TIXDS110_Connection.xml" toolChain="TI" - linkerCommandFile="cc26xx_app.cmd" + linkerCommandFile="cc26xx_app_auxram.cmd" preBuildStep="" - postBuildStep="${CG_TOOL_HEX} -order MS --memwidth=8 --romwidth=8 --intel -o ${ProjName}.hex ${ProjName}.out" + postBuildStep="${CG_TOOL_HEX} -order MS --memwidth=8 --romwidth=8 --intel -o ${ProjName}.hex ${ProjName}.out"> - compilerBuildOptions=" - --cmd_file=${SRC_EX}/config/build_components.opt - --cmd_file=${PROJECT_IMPORT_LOC}/../../iar/stack/build_config.opt - --cmd_file=${PROJECT_IMPORT_LOC}/../config/ccs_compiler_defines.bcfg - --silicon_version=7M3 - --code_state=16 - --float_support=vfplib - -O4 - --opt_for_speed=0 - --c99 - --relaxed_ansi - --diag_suppress=48 - --diag_warning=225 - --diag_wrap=off - --gen_func_subsections=on - --fp_reassoc=off - --unaligned_access=on - --embedded_constants=on - --wchar_t=16 - --enum_type=packed - --common=on - --sat_reassoc=off - --plain_char=unsigned + + -DUSE_ICALL + -DPOWER_SAVING + -DGAPCENTRALROLE_TASK_STACK_SIZE=700 + -DHEAPMGR_SIZE=0 + -DxDisplay_DISABLE_ALL + -DxBOARD_DISPLAY_EXCLUDE_UART + -DBOARD_DISPLAY_EXCLUDE_LCD + -DAUDIO_RECEIVER + -DSTREAM_TO_AUDBOOST + -DxSTREAM_TO_PC + -DGAPCENTRALROLE_NUM_RSSI_LINKS=1 + -DICALL_MAX_NUM_TASKS=3 + -DICALL_MAX_NUM_ENTITIES=6 + -Dxdc_runtime_Assert_DISABLE_ALL + -Dxdc_runtime_Log_DISABLE_ALL + -DxCC2650DK_7ID + -DCC26XX + -DCC2650_LAUNCHXL + -I${PROJECT_IMPORT_LOC}/../../../../../src/util/audio_codec + -I${PROJECT_IMPORT_LOC}/../../../../util/mSBClibrary/include + -I${PROJECT_IMPORT_LOC}/../../../../../src/boards/CC2650_LAUNCHXL + -I${SRC_BLE_CORE}/examples/simple_central/cc26xx/app + -I${SRC_BLE_CORE}/controller/cc26xx/inc + -I${SRC_BLE_CORE}/inc + -I${SRC_EX}/common/cc26xx + -I${SRC_EX}/icall/inc + -I${SRC_EX}/inc + -I${SRC_EX}/profiles/roles + -I${SRC_EX}/profiles/roles/cc26xx + -I${SRC_EX}/profiles/simple_profile + -I${SRC_EX}/profiles/audio + -I${SRC_EX}/target + -I${SRC_COMMON}/hal/src/inc + -I${SRC_COMMON}/hal/src/target/_common + -I${SRC_COMMON}/hal/src/target/_common/cc26xx + -I${SRC_EX}/rom + -I${SRC_COMMON}/heapmgr + -I${SRC_COMMON}/icall/src/inc + -I${SRC_COMMON}/osal/src/inc + -I${SRC_COMMON}/services/src/saddr + -I${SRC_COMMON}/services/src/sdata + -I${CC26XXWARE} + " + linkerBuildOptions=" + -l${PROJECT_IMPORT_LOC}/../config/ccs_linker_defines.cmd + -l${PROJECT_IMPORT_LOC}/../../../../../src/common/cc26xx/ccs/cc26xx_app_auxram.cmd + --library="libc.a" + --library=${CC26XXWARE}/driverlib/bin/ccs/driverlib.lib + --library=${SRC_BLE_CORE}/rom/common_rom_releases/03282014/common_rom.symbols + --library=${PROJECT_IMPORT_LOC}/../../../../util/mSBClibrary/bin/cc2650_mSBCdecode_library.lib + --diag_wrap=off + --unused_section_elimination=on + --xml_link_info=${ProjName}_linkInfo.xml + --diag_suppress=10247-D + --diag_suppress=16002-D + " + description="" + launchWizard="false"> + + @@ -99,6 +110,7 @@ + @@ -106,10 +118,9 @@ - + - @@ -189,6 +200,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -235,9 +280,13 @@ + + + + - + @@ -247,7 +296,7 @@ - + diff --git a/examples/cc2650lp/simple_central_audio_receiver/ccs/config/ccs_compiler_defines.bcfg b/examples/cc2650lp/simple_central_audio_receiver/ccs/config/ccs_compiler_defines.bcfg index 3dcfbc8..e5eaf32 100644 --- a/examples/cc2650lp/simple_central_audio_receiver/ccs/config/ccs_compiler_defines.bcfg +++ b/examples/cc2650lp/simple_central_audio_receiver/ccs/config/ccs_compiler_defines.bcfg @@ -1,10 +1,10 @@ /* -** Stack Frontier Generator 1.1.0 (2016-10-27 22:33:51.971000) +** Stack Frontier Generator 1.1.0 (2017-01-11 16:13:45.899000) ** ** WARNING - Auto-generated file. Modifications could be lost! */ ---define=ICALL_STACK0_ADDR=0xc001 ---define=ICALL_STACK0_START=0xc000 +--define=ICALL_STACK0_ADDR=0xd001 +--define=ICALL_STACK0_START=0xd000 --define=ICALL_RAM0_START=0x20004340 diff --git a/examples/cc2650lp/simple_central_audio_receiver/ccs/config/ccs_linker_defines.cmd b/examples/cc2650lp/simple_central_audio_receiver/ccs/config/ccs_linker_defines.cmd index d4cd8da..3b58fd0 100644 --- a/examples/cc2650lp/simple_central_audio_receiver/ccs/config/ccs_linker_defines.cmd +++ b/examples/cc2650lp/simple_central_audio_receiver/ccs/config/ccs_linker_defines.cmd @@ -1,10 +1,10 @@ /* -** Stack Frontier Generator 1.1.0 (2016-10-27 22:33:51.971000) +** Stack Frontier Generator 1.1.0 (2017-01-11 16:13:45.899000) ** ** WARNING - Auto-generated file. Modifications could be lost! */ --define=ICALL_RAM0_START=0x20004340 ---define=ICALL_STACK0_START=0xc000 ---define=ICALL_STACK0_ADDR=0xc001 +--define=ICALL_STACK0_START=0xd000 +--define=ICALL_STACK0_ADDR=0xd001 diff --git a/examples/cc2650lp/simple_central_audio_receiver/iar/app/cc2650lp_app.ewd b/examples/cc2650lp/simple_central_audio_receiver/iar/app/cc2650lp_app.ewd index 4b7a360..1de7f0d 100644 --- a/examples/cc2650lp/simple_central_audio_receiver/iar/app/cc2650lp_app.ewd +++ b/examples/cc2650lp/simple_central_audio_receiver/iar/app/cc2650lp_app.ewd @@ -12,7 +12,7 @@ C-SPY 2 - 27 + 28 1 1 - + @@ -282,18 +282,47 @@ - CMSISDAP_ID + CADI_ID 2 - 2 + 0 1 1 + + + + + + + + CMSISDAP_ID + 2 + + 4 + 1 + 1 + + + @@ -524,15 +561,15 @@ IJET_ID 2 - 6 + 8 1 1 + + JLINK_ID 2 - 15 + 16 1 1 + - - XDS100_ID + TIFET_ID 2 - 4 + 1 1 1 + + + + + + + + + + + + + + + + + XDS100_ID + 2 + + 6 + 1 + 1 + + + + @@ -1507,10 +1635,6 @@ $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 - - $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin - 1 - $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 diff --git a/examples/cc2650lp/simple_central_audio_receiver/iar/app/cc2650lp_app.ewp b/examples/cc2650lp/simple_central_audio_receiver/iar/app/cc2650lp_app.ewp index 5059ee8..294f3d4 100644 --- a/examples/cc2650lp/simple_central_audio_receiver/iar/app/cc2650lp_app.ewp +++ b/examples/cc2650lp/simple_central_audio_receiver/iar/app/cc2650lp_app.ewp @@ -77,7 +77,7 @@ @@ -183,10 +183,14 @@ CCDefines USE_ICALL POWER_SAVING + HEAPMGR_METRICS + AUDIO_RECEIVER + STREAM_TO_AUDBOOST + xSTREAM_TO_PC HEAPMGR_SIZE=0 xDisplay_DISABLE_ALL - BOARD_DISPLAY_EXCLUDE_UART - xBOARD_DISPLAY_EXCLUDE_LCD + xBOARD_DISPLAY_EXCLUDE_UART + BOARD_DISPLAY_EXCLUDE_LCD GAPCENTRALROLE_NUM_RSSI_LINKS=1 ICALL_MAX_NUM_TASKS=3 ICALL_MAX_NUM_ENTITIES=6 @@ -194,7 +198,6 @@ xdc_runtime_Log_DISABLE_ALL CC26XX CC2650_LAUNCHXL - AUDIO_SERVICE - + - + @@ -304,7 +305,7 @@ - + diff --git a/examples/cc2650lp/simple_peripheral_audio_transmitter/iar/app/cc2650lp_app.ewp b/examples/cc2650lp/simple_peripheral_audio_transmitter/iar/app/cc2650lp_app.ewp index 4a10b05..b4e4b15 100644 --- a/examples/cc2650lp/simple_peripheral_audio_transmitter/iar/app/cc2650lp_app.ewp +++ b/examples/cc2650lp/simple_peripheral_audio_transmitter/iar/app/cc2650lp_app.ewp @@ -192,9 +192,11 @@ ICALL_MAX_NUM_TASKS=3 ICALL_MAX_NUM_ENTITIES=6 xdc_runtime_Assert_DISABLE_ALL - xdc_runtime_Log_DISABLE_ALL + xxdc_runtime_Log_DISABLE_ALL CC2650_LAUNCHXL CC26XX + MAX_PDU_SIZE=107 + xDLE_ENABLED (!I!jf(i_y8OG|)J#rlz}tB%Fgm>J&B@~gv5@wzchopTpslBy zzr6FVcVa0~#31vY*BE4qd7@6_j@;ViQY+wHF77gDsF1NJ9R{@2*(-Sj$L(#W$xM-D z_a)W7f)YMoz35kBP0g6G>g!W`G3Rq@a^@QSg7n|(Yw-yGf`kd^buq2hGrKlW^#AJ* zF)#B)=3#i~=*8k3>Z(6MR?xepe3=!JO2Tx;q=y!2>=iQd?MUegU)nh7aZ?_Uf_ov& zz$z`LDru>JSNcQ+G;7sB(hkgQ4T z>4on9{W|p!)hU|UD;`YeG3Vypn-6w=Y2BNpvl3J2L?p+oO_8_8q(^-zxwfv20vh$` zQQ!E9j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$HEs+&{P zY3~h?qba`AIqld!c5rrl06EhR47A+EvcolQaCWpoZj;bs1x`EmLypz~oX%+nEw^A; z9N?VgaT?@IJJ5}D7t4;hkXtxF+raYJ3b}PL#SGJMU0&tBcGjiJc589#gKE_u^n@vT9Ga*aN6++dA*%-=_pL$7$yho`9fZDg$Z6ID zi!jc7$-)xMZwI084anU!2)S#f8H*uK(f2{HCg-dw1eshs_!ny z-C`w(0JIDkX9+xKhVf{W#@`e{r}{?=G1lPkK@MHz09WYHH*BUcev`gxAx-*d0mrH@ z7jjtxv|$Wz=sOK^W;>r{(dV>dF61_WPw`^P$XzTuc0n#y{yFV90yzp#`pz`eaolN# z8%7Ssjy%Yjc9`vn^gHb+h1@34Dc&4hG(ROf@+@-BdUZbJMhdj zf)NzI3N1t}twm#-E})Iq5d=ZRUtnd##`|XXWiKzo zFoU2@4rkt-o!v~b5j96$WN6~EIc~vq(J$lb`uF9y#z~8xg~n|BEpy%}(F+=j_#xf*fh0GEPW&3$-kcTMtJUkBV6`eob!M`iOQx9K>?GdR5Q z+SlZ^T|&KIJCjHPY80pYGdy^~rxLkE!p1 ze9b_8SCPIu@|^^HPm#V4@|^~JKasvw6=g?mvC?eS*`xiviy^`S23gHJ|U7 xe9Oei$5eS;CDUt$bWb>z81IxJSOwp&KdCy{R5gNT6zEg diff --git a/examples/util/mSBClibrary/bin/cc2650_mSBCencode_library.lib b/examples/util/mSBClibrary/bin/cc2650_mSBCencode_library.lib index 84cde31c9fbdacc041225d669e9e7096629ed2c3..f85c67264207d35d87eb3315240d27929f5f15f7 100644 GIT binary patch delta 35581 zcmeHw33wD$*7m)%ba#?Yr?ZlT5IQ74AR#2|TO@2@3xbFUf`kA;kX1GTfewlzE~9}$ zE65hycVW6!}Ed5k--JO9vPJ_uQ&ZswekYyH#u)v@2tElHTJKJhyT~gvJ-c{{HW5ZXMTRq{On$dO^J*!WCH&kg6ZAc}yD|(_6l|_@H)UOxJ||#T5azcYHwcm+rhY z;413doORURib;gILUcw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wC9@_EqvH){PrLmu6zuk@IR+!M97&-2#O-#2Qv zk!Zh3;jn+kPS881kL3GR{8mo)`U8yaFNcy%? eth3RcK7@{I-=@6=W^Ajw8M|DDbEXe<$NvR~h+Ibi diff --git a/examples/util/mSBClibrary/ccs/cc2650_mSBC_library.projectspec b/examples/util/mSBClibrary/ccs/cc2650_mSBC_library.projectspec new file mode 100644 index 0000000..fc2c2f2 --- /dev/null +++ b/examples/util/mSBClibrary/ccs/cc2650_mSBC_library.projectspec @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/util/mSBClibrary/iar/app/cc2650_mSBC_library.ewd b/examples/util/mSBClibrary/iar/app/cc2650_mSBC_library.ewd new file mode 100644 index 0000000..ddd121c --- /dev/null +++ b/examples/util/mSBClibrary/iar/app/cc2650_mSBC_library.ewd @@ -0,0 +1,3285 @@ + + + + 2 + + mSBCencode + + ARM + + 1 + + C-SPY + 2 + + 28 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + CADI_ID + 2 + + 0 + 1 + 1 + + + + + + + + + CMSISDAP_ID + 2 + + 4 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 1 + 1 + 1 + + + + + + + + + IJET_ID + 2 + + 8 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + JLINK_ID + 2 + + 16 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + MACRAIGOR_ID + 2 + + 3 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + PEMICRO_ID + 2 + + 3 + 1 + 1 + + + + + + + + RDI_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + STLINK_ID + 2 + + 3 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + TIFET_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + + + XDS100_ID + 2 + + 6 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $TOOLKIT_DIR$\plugins\middleware\HCCWare\HCCWare.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\middleware\PercepioTraceExporter\PercepioTraceExportPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\AVIX\AVIX.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB7_Plugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin + 0 + + + + + mSBCdecode + + ARM + + 1 + + C-SPY + 2 + + 28 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ARMSIM_ID + 2 + + 1 + 1 + 1 + + + + + + + + ANGEL_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + + CADI_ID + 2 + + 0 + 1 + 1 + + + + + + + + + CMSISDAP_ID + 2 + + 4 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GDBSERVER_ID + 2 + + 0 + 1 + 1 + + + + + + + + + + + IARROM_ID + 2 + + 1 + 1 + 1 + + + + + + + + + IJET_ID + 2 + + 8 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + JLINK_ID + 2 + + 16 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LMIFTDI_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + MACRAIGOR_ID + 2 + + 3 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + PEMICRO_ID + 2 + + 3 + 1 + 1 + + + + + + + + RDI_ID + 2 + + 2 + 1 + 1 + + + + + + + + + + + + + + + + STLINK_ID + 2 + + 3 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + THIRDPARTY_ID + 2 + + 0 + 1 + 1 + + + + + + + + TIFET_ID + 2 + + 1 + 1 + 1 + + + + + + + + + + + + + + + + + + + XDS100_ID + 2 + + 6 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $TOOLKIT_DIR$\plugins\middleware\HCCWare\HCCWare.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\middleware\PercepioTraceExporter\PercepioTraceExportPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\AVIX\AVIX.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB7_Plugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin + 0 + + + $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin + 0 + + + $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin + 1 + + + $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin + 0 + + + $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin + 0 + + + + + + diff --git a/examples/util/mSBClibrary/iar/app/cc2650_mSBC_library.ewp b/examples/util/mSBClibrary/iar/app/cc2650_mSBC_library.ewp new file mode 100644 index 0000000..272183a --- /dev/null +++ b/examples/util/mSBClibrary/iar/app/cc2650_mSBC_library.ewp @@ -0,0 +1,2002 @@ + + + + 2 + + mSBCencode + + ARM + + 1 + + General + 3 + + 24 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 31 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + 0 + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 18 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + mSBCdecode + + ARM + + 1 + + General + 3 + + 24 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 31 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + 0 + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + + + + + + ILINK + 0 + + 18 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + SBC + + $PROJ_DIR$\..\..\..\..\..\src\util\sbc\sbc.c + + + $PROJ_DIR$\..\..\..\..\..\src\util\sbc\sbc_primitives.c + + + + + diff --git a/examples/util/mSBClibrary/iar/cc2650_mSBC_library.custom_argvars b/examples/util/mSBClibrary/iar/cc2650_mSBC_library.custom_argvars new file mode 100644 index 0000000..2f84b13 --- /dev/null +++ b/examples/util/mSBClibrary/iar/cc2650_mSBC_library.custom_argvars @@ -0,0 +1,50 @@ + + + + + + TI_BLE_SDK_BASE + C:\ti\simplelink\ble_sdk_2_02_01_18 + + + TI_RTOS_DRIVERS_BASE + C:\ti\tirtos_cc13xx_cc26xx_2_20_01_08\products\tidrivers_cc13xx_cc26xx_2_20_01_10\packages + + + BIOS_BASE + C:\ti\tirtos_cc13xx_cc26xx_2_20_01_08\products\bios_6_46_01_38\packages + + + XDCPATH + C:\ti\tirtos_cc13xx_cc26xx_2_20_01_08\products\tidrivers_cc13xx_cc26xx_2_20_01_10\packages;C:\ti\tirtos_cc13xx_cc26xx_2_20_01_08\products\bios_6_46_01_38\packages;$TI_BLE_SDK_BASE$ + + + CC26XXWARE + C:\ti\tirtos_cc13xx_cc26xx_2_20_01_08\products\cc26xxware_2_24_02_17393 + + + XDCROOT + C:\ti\xdctools_3_32_00_06_core + + + SRC_EX + $TI_BLE_SDK_BASE$\src + + + SRC_BLE_CORE + $TI_BLE_SDK_BASE$\src + + + SRC_COMMON + $TI_BLE_SDK_BASE$\src\components + + + TOOLS_BLE + $TI_BLE_SDK_BASE$\tools + + + ROM + $TI_BLE_SDK_BASE$\src\rom + + + diff --git a/examples/util/mSBClibrary/iar/cc2650_mSBC_library.eww b/examples/util/mSBClibrary/iar/cc2650_mSBC_library.eww new file mode 100644 index 0000000..4d91505 --- /dev/null +++ b/examples/util/mSBClibrary/iar/cc2650_mSBC_library.eww @@ -0,0 +1,10 @@ + + + + + $WS_DIR$\app\cc2650_mSBC_library.ewp + + + + + diff --git a/src/examples/simple_central_audio_receiver/cc26xx/app/simple_central_audio_receiver.c b/src/examples/simple_central_audio_receiver/cc26xx/app/simple_central_audio_receiver.c index df7323d..8dbd179 100644 --- a/src/examples/simple_central_audio_receiver/cc26xx/app/simple_central_audio_receiver.c +++ b/src/examples/simple_central_audio_receiver/cc26xx/app/simple_central_audio_receiver.c @@ -225,6 +225,9 @@ uint8 audioConfigEnable = 0; #define BLE_AUDIO_RX_BUF_SIZE BLE_AUDIO_U16_COMPRESSION_RATE*BLEAUDIO_NOTSIZE +#define DLE_MAX_PDU_SIZE 251 +#define DLE_MAX_TX_TIME 2120 + // Application states enum { @@ -376,8 +379,6 @@ static uint16 audioStartCCCHandle = GATT_INVALID_HANDLE; static uint16 audioDataCharValueHandle = GATT_INVALID_HANDLE; static uint16 audioDataCCCHandle = GATT_INVALID_HANDLE; -// CCC's of the notifications -static uint16 keyCCCHandle = GATT_INVALID_HANDLE; static uint8 serviceDiscComplete = FALSE; /********************************************************************* @@ -438,10 +439,15 @@ PIN_Config ledPinTable[] = { #define BLEAUDIO_BUFSIZE_ADPCM 96 #define BLEAUDIO_HDRSIZE_ADPCM 4 -#define BLEAUDIO_NOTSIZE 20 -#define BLEAUDIO_NUM_NOT_PER_FRAME_ADPCM 5 +#ifdef DLE_ENABLED // Data Length Extension Enable +#define BLEAUDIO_NUM_NOT_PER_FRAME_ADPCM 1 +#define BLEAUDIO_NUM_NOT_PER_FRAME_MSBC 1 + +#else +#define BLEAUDIO_NUM_NOT_PER_FRAME_ADPCM 5 #define BLEAUDIO_NUM_NOT_PER_FRAME_MSBC 3 +#endif #define ADPCM_SAMPLES_PER_FRAME (BLEAUDIO_BUFSIZE_ADPCM * 2) #define MSBC_SAMPLES_PER_FRAME 120 @@ -459,20 +465,20 @@ const unsigned char msbc_data[] = 0xe0 }; -#ifdef __IAR_SYSTEMS_ICC__ -#pragma default_variable_attributes = @ "AUX_RAM_SECTION" -/* ----------- CCS Compiler ----------- */ -#elif defined __TI_COMPILER_VERSION || defined __TI_COMPILER_VERSION__ -#pragma DATA_SECTION(i2sContMgtBuffer, ".aux_ram") -#pragma DATA_SECTION(audio_encoded, ".aux_ram") -#pragma DATA_SECTION(sbc, ".aux_ram") -#pragma DATA_SECTION(written, ".aux_ram") -#pragma DATA_SECTION(streamVariables, ".aux_ram") -/* ----------- Unrecognized Compiler ----------- */ -#else -#error "ERROR: Unknown compiler." -#endif - +//#ifdef __IAR_SYSTEMS_ICC__ +//#pragma default_variable_attributes = @ "AUX_RAM_SECTION" +///* ----------- CCS Compiler ----------- */ +//#elif defined __TI_COMPILER_VERSION || defined __TI_COMPILER_VERSION__ +//#pragma DATA_SECTION(i2sContMgtBuffer, ".aux_ram") +//#pragma DATA_SECTION(audio_encoded, ".aux_ram") +//#pragma DATA_SECTION(sbc, ".aux_ram") +//#pragma DATA_SECTION(written, ".aux_ram") +//#pragma DATA_SECTION(streamVariables, ".aux_ram") +///* ----------- Unrecognized Compiler ----------- */ +//#else +//#error "ERROR: Unknown compiler." +//#endif +// #ifdef STREAM_TO_AUDBOOST uint8_t i2sContMgtBuffer[I2S_BLOCK_OVERHEAD_IN_BYTES * I2SCC26XX_QUEUE_SIZE] = {0}; #endif //STREAM_TO_AUDBOOST @@ -490,9 +496,9 @@ struct { uint8_t i2sOpened; #endif //STREAM_TO_AUDBOOST } streamVariables = {0}; -#ifdef __IAR_SYSTEMS_ICC__ -#pragma default_variable_attributes = -#endif //__IAR_SYSTEMS_ICC__ +//#ifdef __IAR_SYSTEMS_ICC__ +//#pragma default_variable_attributes = +//#endif //__IAR_SYSTEMS_ICC__ #ifdef STREAM_TO_AUDBOOST static void I2SCC26XX_i2sCallbackFxn(I2SCC26XX_Handle handle, I2SCC26XX_StreamNotification *notification); @@ -581,6 +587,10 @@ static void SimpleBLECentral_init(void) // so that the application can send and receive messages. ICall_registerApp(&selfEntity, &sem); +#if defined (DLE_ENABLED) + HCI_LE_WriteSuggestedDefaultDataLenCmd(DLE_MAX_PDU_SIZE , DLE_MAX_TX_TIME); +#endif + // Open all pins ledPinHandle = PIN_open(&allPinState, ledPinTable); @@ -684,8 +694,11 @@ static void SimpleBLECentral_init(void) // Register for GATT local events and ATT Responses pending for transmission GATT_RegisterForMsgs(selfEntity); - +#if defined (DLE_ENABLED) + Display_print0(dispHandle, 0, 0, "Audio Central with DLE"); +#else Display_print0(dispHandle, 0, 0, "Audio Central"); +#endif #ifdef STREAM_TO_AUDBOOST /* Then initialize I2S driver */ @@ -956,7 +969,7 @@ static void SimpleBLECentral_processRoleEvent(gapCentralRoleEvent_t *pEvent) (SimpleBLECentral_findSvcUuid( HID_SERV_UUID, pEvent->deviceInfo.pEvtData, pEvent->deviceInfo.dataLen)) || - (SimpleBLECentral_findSvcUuid( SIMPLEPROFILE_SERV_UUID, + (SimpleBLECentral_findSvcUuid( AUDIO_SERV_UUID, pEvent->deviceInfo.pEvtData, pEvent->deviceInfo.dataLen)) ) { @@ -964,14 +977,13 @@ static void SimpleBLECentral_processRoleEvent(gapCentralRoleEvent_t *pEvent) pEvent->deviceInfo.addrType); addrType = pEvent->deviceInfo.addrType; osal_memcpy( remoteAddr, pEvent->deviceInfo.addr, B_ADDR_LEN ); - peerDeviceFound = TRUE; } } - if ( ( peerDeviceFound == TRUE ) && - ( pEvent->deviceInfo.eventType == GAP_ADRPT_SCAN_RSP ) && + if (( pEvent->deviceInfo.eventType == GAP_ADRPT_SCAN_RSP ) && SimpleBLECentral_FindHIDRemote( pEvent->deviceInfo.pEvtData, pEvent->deviceInfo.dataLen ) ) { + peerDeviceFound = TRUE; // End device discovery VOID GAPCentralRole_CancelDiscovery(); } @@ -1018,12 +1030,7 @@ static void SimpleBLECentral_processRoleEvent(gapCentralRoleEvent_t *pEvent) state = BLE_STATE_CONNECTED; connHandle = pEvent->linkCmpl.connectionHandle; - if (FALSE == serviceDiscComplete) - { - // Begin Service Discovery of AUDIO Service to find out report handles - serviceToDiscover = AUDIO_SERV_UUID; - SimpleBLECentral_DiscoverService( connHandle, serviceToDiscover ); - } + Util_startClock(&startDiscClock); Display_print0(dispHandle, 2, 0, "Connected"); Display_print0(dispHandle, 3, 0, Util_convertBdAddr2Str(pEvent->linkCmpl.devAddr)); @@ -1069,9 +1076,7 @@ static void SimpleBLECentral_processRoleEvent(gapCentralRoleEvent_t *pEvent) // Invalidate service discovery variables. serviceDiscComplete = FALSE; - keyCharHandle = GATT_INVALID_HANDLE; - keyCCCHandle = GATT_INVALID_HANDLE; serviceToDiscover = GATT_INVALID_HANDLE; audioStartCharValueHandle = GATT_INVALID_HANDLE; @@ -1508,12 +1513,10 @@ static void SimpleBLECentral_processGATTMsg(gattMsgEvent_t *pMsg) && pMsg->msg.errorRsp.handle == 0x0001) //0x0001 is the start attribute handle of 0xfff0, AUDIO_SERV_UUID { - - if ( (enableCCCDs == TRUE) && (keyCharHandle != GATT_INVALID_HANDLE)) + if ( (enableCCCDs == TRUE) && (audioStartCharValueHandle != GATT_INVALID_HANDLE)) { - keyCCCHandle = keyCharHandle + 1; - // Begin configuring the characteristics for notifications - SimpleBLECentral_EnableNotification( connHandle, keyCCCHandle ); + audioStartCCCHandle = audioStartCharValueHandle + 1 ; + SimpleBLECentral_EnableNotification( connHandle, audioStartCCCHandle ); } } break; @@ -1572,9 +1575,6 @@ static void SimpleBLECentral_processGATTMsg(gattMsgEvent_t *pMsg) else if (audioDataCCCHandle == GATT_INVALID_HANDLE) { handle = audioDataCCCHandle = audioDataCharValueHandle + 1; } - else if (keyCCCHandle == GATT_INVALID_HANDLE ) { - handle = keyCCCHandle = keyCharHandle + 1; - } else { serviceDiscComplete = TRUE; break; @@ -1603,6 +1603,13 @@ static void SimpleBLECentral_processGATTMsg(gattMsgEvent_t *pMsg) } break; + // Service Change indication + case ATT_EXCHANGE_MTU_RSP: + { + Display_print1(dispHandle, 10, 0, "server Rx MTU size : %d", pMsg->msg.exchangeMTURsp.serverRxMTU); + } + break; + default: // Unknown event break; diff --git a/src/examples/simple_peripheral_audio_transmitter/cc26xx/app/simple_peripheral_audio_transmitter.c b/src/examples/simple_peripheral_audio_transmitter/cc26xx/app/simple_peripheral_audio_transmitter.c index 5f11a86..281a879 100644 --- a/src/examples/simple_peripheral_audio_transmitter/cc26xx/app/simple_peripheral_audio_transmitter.c +++ b/src/examples/simple_peripheral_audio_transmitter/cc26xx/app/simple_peripheral_audio_transmitter.c @@ -55,8 +55,8 @@ #include "linkdb.h" #include "gapgattserver.h" #include "gattservapp.h" -#include "devinfoservice.h" -#include "simple_gatt_profile.h" +//#include "devinfoservice.h" +//#include "simple_gatt_profile.h" #if defined(FEATURE_OAD) || defined(IMAGE_INVALIDATE) #include "oad_target.h" @@ -290,8 +290,8 @@ static uint8_t advertData[] = HI_UINT16(OAD_SERVICE_UUID), #endif //FEATURE_OAD #ifndef FEATURE_OAD_ONCHIP - LO_UINT16(SIMPLEPROFILE_SERV_UUID), - HI_UINT16(SIMPLEPROFILE_SERV_UUID) + LO_UINT16(AUDIO_SERV_UUID), + HI_UINT16(AUDIO_SERV_UUID) #endif //FEATURE_OAD_ONCHIP }; @@ -305,10 +305,15 @@ static uint8_t rspTxRetry = 0; #define INPUT_OPTION AUDIO_CODEC_MIC_LINE_IN //AUDIO_CODEC_MIC_ONBOARD #define BLEAUDIO_BUFSIZE_ADPCM 96 #define BLEAUDIO_HDRSIZE_ADPCM 4 -#define BLEAUDIO_NOTSIZE 20 -#define BLEAUDIO_NUM_NOT_PER_FRAME_ADPCM 5 +#ifdef DLE_ENABLED // Data Length Extension Enable +#define BLEAUDIO_NUM_NOT_PER_FRAME_ADPCM 1 +#define BLEAUDIO_NUM_NOT_PER_FRAME_MSBC 1 + +#else +#define BLEAUDIO_NUM_NOT_PER_FRAME_ADPCM 5 #define BLEAUDIO_NUM_NOT_PER_FRAME_MSBC 3 +#endif #define ADPCM_SAMPLES_PER_FRAME (BLEAUDIO_BUFSIZE_ADPCM * 2) #define MSBC_SAMPLES_PER_FRAME 120 @@ -334,19 +339,7 @@ const unsigned char msbc_data[] = }; //int16_t pcmSamples[MSBC_SAMPLES_PER_FRAME * I2SCC26XX_QUEUE_SIZE] = {0}; int16_t *pcmSamples; -#ifdef __IAR_SYSTEMS_ICC__ -#pragma default_variable_attributes = @ "AUX_RAM_SECTION" -/* ----------- CCS Compiler ----------- */ -#elif defined __TI_COMPILER_VERSION || defined __TI_COMPILER_VERSION__ -#pragma DATA_SECTION(i2sContMgtBuffer, ".aux_ram") -#pragma DATA_SECTION(audio_encoded, ".aux_ram") -#pragma DATA_SECTION(sbc, ".aux_ram") -#pragma DATA_SECTION(written, ".aux_ram") -#pragma DATA_SECTION(streamVariables, ".aux_ram") -/* ----------- Unrecognized Compiler ----------- */ -#else -#error "ERROR: Unknown compiler." -#endif + uint8_t i2sContMgtBuffer[I2S_BLOCK_OVERHEAD_IN_BYTES * I2SCC26XX_QUEUE_SIZE] = {0}; uint8_t audio_encoded[100] = {0}; sbc_t sbc = {0}; @@ -362,9 +355,6 @@ struct { int16_t pv; uint8_t activeLED; } streamVariables = {STREAM_STATE_IDLE, STREAM_STATE_IDLE, 0, 0, 0, 0, 0, 0, 0}; -#ifdef __IAR_SYSTEMS_ICC__ -#pragma default_variable_attributes = -#endif //__IAR_SYSTEMS_ICC__ static void I2SCC26XX_i2sCallbackFxn(I2SCC26XX_Handle handle, I2SCC26XX_StreamNotification *notification); static I2SCC26XX_Handle i2sHandle = NULL; @@ -397,16 +387,13 @@ static uint8_t SimpleBLEPeripheral_processStackMsg(ICall_Hdr *pMsg); static uint8_t SimpleBLEPeripheral_processGATTMsg(gattMsgEvent_t *pMsg); static void SimpleBLEPeripheral_processAppMsg(sbpEvt_t *pMsg); static void SimpleBLEPeripheral_processStateChangeEvt(gaprole_States_t newState); -static void SimpleBLEPeripheral_processCharValueChangeEvt(uint8_t paramID); static void SimpleBLEPeripheral_clockHandler(UArg arg); static void SimpleBLEPeripheral_sendAttRsp(void); static void SimpleBLEPeripheral_freeAttRsp(uint8_t status); static void SimpleBLEPeripheral_stateChangeCB(gaprole_States_t newState); -#ifndef FEATURE_OAD_ONCHIP -static void SimpleBLEPeripheral_charValueChangeCB(uint8_t paramID); -#endif //!FEATURE_OAD_ONCHIP + static void SimpleBLEPeripheral_enqueueMsg(uint8_t event, uint8_t state); #ifdef FEATURE_OAD @@ -445,14 +432,6 @@ static gapBondCBs_t simpleBLEPeripheral_BondMgrCBs = NULL // Pairing / Bonding state Callback (not used by application) }; -// Simple GATT Profile Callbacks -#ifndef FEATURE_OAD_ONCHIP -static simpleProfileCBs_t SimpleBLEPeripheral_simpleProfileCBs = -{ - SimpleBLEPeripheral_charValueChangeCB // Characteristic value change callback -}; -#endif //!FEATURE_OAD_ONCHIP - #ifdef FEATURE_OAD static oadTargetCBs_t simpleBLEPeripheral_oadCBs = { @@ -515,6 +494,10 @@ static void SimpleBLEPeripheral_init(void) RCOSC_enableCalibration(); #endif // USE_RCOSC +#if defined (DLE_ENABLED) + HCI_LE_WriteSuggestedDefaultDataLenCmd(DLE_MAX_PDU_SIZE , DLE_MAX_TX_TIME); +#endif + // Create an RTOS queue for message from profile to be sent to app. appMsgQueue = Util_constructQueue(&appMsg); @@ -609,11 +592,6 @@ static void SimpleBLEPeripheral_init(void) // Initialize GATT attributes GGS_AddService(GATT_ALL_SERVICES); // GAP GATTServApp_AddService(GATT_ALL_SERVICES); // GATT attributes - DevInfo_AddService(); // Device Information Service - -#ifndef FEATURE_OAD_ONCHIP - SimpleProfile_AddService(GATT_ALL_SERVICES); // Simple GATT Profile -#endif //!FEATURE_OAD_ONCHIP #ifdef FEATURE_OAD VOID OAD_addService(); // OAD Profile @@ -628,31 +606,6 @@ static void SimpleBLEPeripheral_init(void) // Add Audio Service Audio_AddService(); -#ifndef FEATURE_OAD_ONCHIP - // Setup the SimpleProfile Characteristic Values - { - uint8_t charValue1 = 1; - uint8_t charValue2 = 2; - uint8_t charValue3 = 3; - uint8_t charValue4 = 4; - uint8_t charValue5[SIMPLEPROFILE_CHAR5_LEN] = { 1, 2, 3, 4, 5 }; - - SimpleProfile_SetParameter(SIMPLEPROFILE_CHAR1, sizeof(uint8_t), - &charValue1); - SimpleProfile_SetParameter(SIMPLEPROFILE_CHAR2, sizeof(uint8_t), - &charValue2); - SimpleProfile_SetParameter(SIMPLEPROFILE_CHAR3, sizeof(uint8_t), - &charValue3); - SimpleProfile_SetParameter(SIMPLEPROFILE_CHAR4, sizeof(uint8_t), - &charValue4); - SimpleProfile_SetParameter(SIMPLEPROFILE_CHAR5, SIMPLEPROFILE_CHAR5_LEN, - charValue5); - } - - // Register callback with SimpleGATTprofile - SimpleProfile_RegisterAppCBs(&SimpleBLEPeripheral_simpleProfileCBs); -#endif //!FEATURE_OAD_ONCHIP - // Start the Device VOID GAPRole_StartDevice(&SimpleBLEPeripheral_gapRoleCBs); @@ -668,13 +621,17 @@ static void SimpleBLEPeripheral_init(void) HCI_LE_ReadMaxDataLenCmd(); #if defined FEATURE_OAD -#if defined (HAL_IMAGE_A) - Display_print0(dispHandle, 0, 0, "Audio Tx Peripheral A"); -#else - Display_print0(dispHandle, 0, 0, "Audio Tx Peripheral B"); -#endif // HAL_IMAGE_A + #if defined (HAL_IMAGE_A) + Display_print0(dispHandle, 0, 0, "Audio Tx Peripheral A"); + #else + Display_print0(dispHandle, 0, 0, "Audio Tx Peripheral B"); + #endif // HAL_IMAGE_A #else - Display_print0(dispHandle, 0, 0, "Audio Tx Peripheral"); + #if defined (DLE_ENABLED) + Display_print0(dispHandle, 0, 0, "Audio Tx Peripheral with DLE"); + #else + Display_print0(dispHandle, 0, 0, "Audio Tx Peripheral"); + #endif #endif // FEATURE_OAD // Open pin structure for use @@ -970,7 +927,7 @@ static uint8_t SimpleBLEPeripheral_processGATTMsg(gattMsgEvent_t *pMsg) else if (pMsg->method == ATT_MTU_UPDATED_EVENT) { // MTU size updated - Display_print1(dispHandle, 5, 0, "MTU Size: $d", pMsg->msg.mtuEvt.MTU); + Display_print1(dispHandle, 5, 0, "MTU Size: %d", pMsg->msg.mtuEvt.MTU); } // Free message payload. Needed only for ATT Protocol messages @@ -1072,10 +1029,6 @@ static void SimpleBLEPeripheral_processAppMsg(sbpEvt_t *pMsg) hdr.state); break; - case SBP_CHAR_CHANGE_EVT: - SimpleBLEPeripheral_processCharValueChangeEvt(pMsg->hdr.state); - break; - case SBP_KEY_CHANGE_EVT: SimpleBLEPeripheral_handleKeys(0, pMsg->hdr.state); break; @@ -1120,26 +1073,9 @@ static void SimpleBLEPeripheral_processStateChangeEvt(gaprole_States_t newState) case GAPROLE_STARTED: { uint8_t ownAddress[B_ADDR_LEN]; - uint8_t systemId[DEVINFO_SYSTEM_ID_LEN]; GAPRole_GetParameter(GAPROLE_BD_ADDR, ownAddress); - // use 6 bytes of device address for 8 bytes of system ID value - systemId[0] = ownAddress[0]; - systemId[1] = ownAddress[1]; - systemId[2] = ownAddress[2]; - - // set middle bytes to zero - systemId[4] = 0x00; - systemId[3] = 0x00; - - // shift three bytes up - systemId[7] = ownAddress[5]; - systemId[6] = ownAddress[4]; - systemId[5] = ownAddress[3]; - - DevInfo_SetParameter(DEVINFO_SYSTEM_ID, DEVINFO_SYSTEM_ID_LEN, systemId); - // Display device address Display_print0(dispHandle, 1, 0, Util_convertBdAddr2Str(ownAddress)); Display_print0(dispHandle, 2, 0, "Initialized"); @@ -1252,59 +1188,6 @@ static void SimpleBLEPeripheral_processStateChangeEvt(gaprole_States_t newState) //gapProfileState = newState; } -#ifndef FEATURE_OAD_ONCHIP -/********************************************************************* - * @fn SimpleBLEPeripheral_charValueChangeCB - * - * @brief Callback from Simple Profile indicating a characteristic - * value change. - * - * @param paramID - parameter ID of the value that was changed. - * - * @return None. - */ -static void SimpleBLEPeripheral_charValueChangeCB(uint8_t paramID) -{ - SimpleBLEPeripheral_enqueueMsg(SBP_CHAR_CHANGE_EVT, paramID); -} -#endif //!FEATURE_OAD_ONCHIP - -/********************************************************************* - * @fn SimpleBLEPeripheral_processCharValueChangeEvt - * - * @brief Process a pending Simple Profile characteristic value change - * event. - * - * @param paramID - parameter ID of the value that was changed. - * - * @return None. - */ -static void SimpleBLEPeripheral_processCharValueChangeEvt(uint8_t paramID) -{ -#ifndef FEATURE_OAD_ONCHIP - uint8_t newValue; - - switch(paramID) - { - case SIMPLEPROFILE_CHAR1: - SimpleProfile_GetParameter(SIMPLEPROFILE_CHAR1, &newValue); - - Display_print1(dispHandle, 4, 0, "Char 1: %d", (uint16_t)newValue); - break; - - case SIMPLEPROFILE_CHAR3: - SimpleProfile_GetParameter(SIMPLEPROFILE_CHAR3, &newValue); - - Display_print1(dispHandle, 4, 0, "Char 3: %d", (uint16_t)newValue); - break; - - default: - // should not reach here! - break; - } -#endif //!FEATURE_OAD_ONCHIP -} - #ifdef FEATURE_OAD /********************************************************************* diff --git a/src/profiles/audio/audio_profile.c b/src/profiles/audio/audio_profile.c new file mode 100644 index 0000000..5a7d972 --- /dev/null +++ b/src/profiles/audio/audio_profile.c @@ -0,0 +1,517 @@ +/****************************************************************************** + + @file audio_profile.c + + @brief This file contains the audio profile sample service profile for use + with the BLE sample application. + + Group: WCS, BTS + Target Device: CC2650, CC2640, CC1350 + + ****************************************************************************** + + Copyright (c) 2015-2016, Texas Instruments Incorporated + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * 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. + + * Neither the name of Texas Instruments Incorporated nor the names of + its contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 THE COPYRIGHT OWNER 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. + + ****************************************************************************** + Release Name: ble_sdk_2_02_01_18 + Release Date: 2016-10-26 15:20:04 + *****************************************************************************/ + +/********************************************************************* + * INCLUDES + */ +#include +#include "bcomdef.h" +#include "OSAL.h" +#include "linkdb.h" +#include "att.h" +#include "gatt.h" +#include "gatt_uuid.h" +#include "gattservapp.h" +#include "gapbondmgr.h" +#include "peripheral.h" + +#include "audio_profile.h" +#include "ll.h" + +/********************************************************************* + * MACROS + */ + +/********************************************************************* + * CONSTANTS + */ + +/********************************************************************* + * TYPEDEFS + */ + +/********************************************************************* + * GLOBAL VARIABLES + */ +// audio GATT Profile Service UUID: 0xB000 +static CONST uint8 audioProfileServUUID[ATT_UUID_SIZE] = +{ + TI_BASE_UUID_128(AUDIO_SERV_UUID) +}; + +// Start/Stop Characteristic UUID: 0xB001 +static CONST uint8 audioProfileStartUUID[ATT_UUID_SIZE] = +{ + TI_BASE_UUID_128(AUDIOPROFILE_START_UUID) +}; + +// Audio Stream Characteristic UUID: 0xB002 +static CONST uint8 audioProfileAudioUUID[ATT_UUID_SIZE] = +{ + TI_BASE_UUID_128(AUDIOPROFILE_AUDIO_UUID) +}; + + +/********************************************************************* + * EXTERNAL VARIABLES + */ + +/********************************************************************* + * EXTERNAL FUNCTIONS + */ + +/********************************************************************* + * LOCAL VARIABLES + */ + +/********************************************************************* + * Profile Attributes - variables + */ +// Audio Profile Service attribute +static CONST gattAttrType_t audioProfileService = {ATT_UUID_SIZE, + audioProfileServUUID}; + +// Audio Profile Start/Stop Characteristic Properties +static uint8 audioProfileStartProps = GATT_PROP_READ | GATT_PROP_NOTIFY; + +// Start/Stop Characteristic Value +static uint8 audioProfileStart = 0; + +// Start/Stop Characteristic Configuration Descriptor Value +static gattCharCfg_t *audioProfileStartConfig; + +// Simple Profile Audio Stream Characteristic Properties +static uint8 audioProfileAudioProps = GATT_PROP_READ | GATT_PROP_NOTIFY; + +// Audio Stream Characteristic Value +static uint8_t audioProfileAudio[BLEAUDIO_NOTSIZE]; + +// Audio Stream Characteristic Configuration Descriptor Value +static gattCharCfg_t *audioProfileAudioConfig; + + +/********************************************************************* + * Profile Attributes - Table + */ + +static gattAttribute_t audioProfileAttrTbl[] = +{ + // Audio Profile Service + { + {ATT_BT_UUID_SIZE, primaryServiceUUID}, /* type */ + GATT_PERMIT_READ, /* permissions */ + 0, /* handle */ + (uint8 *)&audioProfileService /* pValue */ + }, + + // Start/Stop Characteristic Declaration + { + {ATT_BT_UUID_SIZE, characterUUID}, + GATT_PERMIT_READ, + 0, + &audioProfileStartProps + }, + + // Start/Stop Characteristic Value + { + {ATT_UUID_SIZE, audioProfileStartUUID}, + GATT_PERMIT_READ, + 0, + &audioProfileStart + }, + + // Start/Stop Characteristic configuration + { + {ATT_BT_UUID_SIZE, clientCharCfgUUID}, + GATT_PERMIT_READ | GATT_PERMIT_WRITE, + 0, + (uint8 *)&audioProfileStartConfig + }, + + // Audio Stream Characteristic Declaration + { + {ATT_BT_UUID_SIZE, characterUUID}, + GATT_PERMIT_READ, + 0, + &audioProfileAudioProps + }, + + // Audio Stream Characteristic Value + { + {ATT_UUID_SIZE, audioProfileAudioUUID}, + GATT_PERMIT_READ, + 0, + (uint8 *)audioProfileAudio + }, + + // Audio Stream Characteristic configuration + { + {ATT_BT_UUID_SIZE, clientCharCfgUUID}, + GATT_PERMIT_READ | GATT_PERMIT_WRITE, + 0, + (uint8 *)&audioProfileAudioConfig + }, +}; + +/********************************************************************* + * LOCAL FUNCTIONS + */ +static uint8 audioProfile_ReadAttrCB(uint16 connHandle, gattAttribute_t *pAttr, + uint8 *pValue, uint16 *pLen, uint16 offset, + uint16 maxLen, uint8 method); +static bStatus_t audioProfile_WriteAttrCB(uint16 connHandle, + gattAttribute_t *pAttr, + uint8 *pValue, + uint16 len, + uint16 offset, + uint8 method); + +/********************************************************************* + * PROFILE CALLBACKS + */ +// Audio Profile Service Callbacks +// Note: When an operation on a characteristic requires authorization and +// pfnAuthorizeAttrCB is not defined for that characteristic's service, the +// Stack will report a status of ATT_ERR_UNLIKELY to the client. When an +// operation on a characteristic requires authorization the Stack will call +// pfnAuthorizeAttrCB to check a client's authorization prior to calling +// pfnReadAttrCB or pfnWriteAttrCB, so no checks for authorization need to be +// made within these functions. +static CONST gattServiceCBs_t audioProfileCBs = +{ + audioProfile_ReadAttrCB, // Read callback function pointer + audioProfile_WriteAttrCB, // Write callback function pointer + NULL // Authorization callback function pointer +}; + +/********************************************************************* + * PUBLIC FUNCTIONS + */ + +/********************************************************************* + * @fn Audio_AddService + * + * @brief Initializes the Audio Profile service by registering + * GATT attributes with the GATT server. + * + * @return SUCCESS, bleMemAllocError, or return value of + * GATTServApp_RegisterService + */ +bStatus_t Audio_AddService(void) +{ + uint8 status = SUCCESS; + + // Allocate Audio Cmd Client Characteristic Configuration table + audioProfileStartConfig = (gattCharCfg_t *)ICall_malloc(sizeof(gattCharCfg_t)* + linkDBNumConns ); + if (audioProfileStartConfig == NULL) + { + return bleMemAllocError; + } + + // Initialize Audio Cmd Client Characteristic Configuration attributes + GATTServApp_InitCharCfg(INVALID_CONNHANDLE, audioProfileStartConfig); + + // Allocate Audio Stream Client Characteristic Configuration table + audioProfileAudioConfig = (gattCharCfg_t *)ICall_malloc(sizeof(gattCharCfg_t)* + linkDBNumConns); + if (audioProfileAudioConfig == NULL) + { + return bleMemAllocError; + } + + // Initialize Audio Stream Client Characteristic Configuration attributes + GATTServApp_InitCharCfg(INVALID_CONNHANDLE, audioProfileAudioConfig); + + // Register GATT attribute list and CBs with GATT Server App + status = GATTServApp_RegisterService(audioProfileAttrTbl, + GATT_NUM_ATTRS(audioProfileAttrTbl), + GATT_MAX_ENCRYPT_KEY_SIZE, + &audioProfileCBs); + + return status; +} + +/********************************************************************* + * @fn Audio_SetParameter + * + * @brief Set an Audio Profile parameter. + * + * @param param - Profile parameter ID + * @param len - length of data to write + * @param value - pointer to data to write. This is dependent on + * the parameter ID and WILL be cast to the appropriate + * data type (example: data type of uint16 will be cast to + * uint16 pointer). + * + * @return SUCCESS, bleInvalidRange, INVALIDPARAMETER, or return + * value of GATTServApp_ProcessCharCfg + */ +bStatus_t Audio_SetParameter(uint8 param, uint8 len, void *value) +{ + bStatus_t ret = SUCCESS; + + switch (param) + { + case AUDIOPROFILE_START: + if (len == sizeof (audioProfileStart)) + { + audioProfileStart = *((uint8*)value); + + // See if Notifications have been enabled and send + ret = GATTServApp_ProcessCharCfg(audioProfileStartConfig, + &audioProfileStart, + FALSE, + audioProfileAttrTbl, + GATT_NUM_ATTRS(audioProfileAttrTbl), + INVALID_TASK_ID, + audioProfile_ReadAttrCB); + } + else + { + ret = bleInvalidRange; + } + break; + + case AUDIOPROFILE_AUDIO: + { + VOID memcpy(audioProfileAudio, value, BLEAUDIO_NOTSIZE); + + // See if Notifications have been enabled and send + ret = GATTServApp_ProcessCharCfg(audioProfileAudioConfig, + (uint8_t *)audioProfileAudio, + FALSE, + audioProfileAttrTbl, + GATT_NUM_ATTRS(audioProfileAttrTbl), + INVALID_TASK_ID, + audioProfile_ReadAttrCB); + } + break; + + default: + ret = INVALIDPARAMETER; + break; + } + + return ret; +} + +/********************************************************************* + * @fn Audio_GetParameter + * + * @brief Get a Audio Profile parameter. + * + * @param param - Profile parameter ID + * @param value - pointer to data to put. This is dependent on + * the parameter ID and WILL be cast to the appropriate + * data type (example: data type of uint16 will be cast to + * uint16 pointer). + * + * @return SUCCESS or INVALIDPARAMETER + */ +bStatus_t Audio_GetParameter(uint8 param, void *value) +{ + bStatus_t ret = SUCCESS; + + switch (param) + { + case AUDIOPROFILE_START: + *((uint8*)value) = audioProfileStart; + break; + + case AUDIOPROFILE_AUDIO: + VOID memcpy(value, audioProfileAudio, BLEAUDIO_NOTSIZE); + break; + + default: + ret = INVALIDPARAMETER; + break; + } + + return ret; +} + +/********************************************************************* + * @fn audioProfile_ReadAttrCB + * + * @brief Read an attribute. + * + * @param connHandle - connection message was received on + * @param pAttr - pointer to attribute + * @param pValue - pointer to data to be read + * @param pLen - length of data to be read + * @param offset - offset of the first octet to be read + * @param maxLen - maximum length of data to be read + * @param method - type of read message + * + * @return SUCCESS, ATT_ERR_INSUFFICIENT_AUTHOR, + * ATT_ERR_ATTR_NOT_LONG, or ATT_ERR_INVALID_HANDLE + */ +static uint8 audioProfile_ReadAttrCB(uint16 connHandle, + gattAttribute_t *pAttr, + uint8 *pValue, + uint16 *pLen, + uint16 offset, + uint16 maxLen, + uint8 method) +{ + bStatus_t status = SUCCESS; + + // Make sure it's not a blob operation (no attributes in the profile are long) + if (offset > 0) + { + return ATT_ERR_ATTR_NOT_LONG; + } + + if (pAttr->type.len == ATT_UUID_SIZE) + { + // 128-bit UUID + uint16 uuid = BUILD_UINT16(pAttr->type.uuid[12], pAttr->type.uuid[13]); + switch (uuid) + { + case AUDIOPROFILE_START_UUID: + // Let remote side know the current state of play + *pLen = sizeof(audioProfileStart); + pValue[0] = *pAttr->pValue; + break; + + case AUDIOPROFILE_AUDIO_UUID: + *pLen = BLEAUDIO_NOTSIZE; + VOID memcpy(pValue, pAttr->pValue, BLEAUDIO_NOTSIZE); + break; + + default: + // Should never get here! + *pLen = 0; + status = ATT_ERR_ATTR_NOT_FOUND; + break; + } + } + else + { + // 16-bit UUID + *pLen = 0; + status = ATT_ERR_INVALID_HANDLE; + } + + return status; +} + +/********************************************************************* + * @fn audioProfile_WriteAttrCB + * + * @brief Validate attribute data prior to a write operation + * + * @param connHandle - connection message was received on + * @param pAttr - pointer to attribute + * @param pValue - pointer to data to be written + * @param len - length of data + * @param offset - offset of the first octet to be written + * @param method - type of read message + * + * @return SUCCESS, ATT_ERR_INSUFFICIENT_AUTHOR, + * ATT_ERR_ATTR_NOT_LONG, or ATT_ERR_INVALID_HANDLE + */ +static bStatus_t audioProfile_WriteAttrCB(uint16 connHandle, + gattAttribute_t *pAttr, + uint8 *pValue, + uint16 len, + uint16 offset, + uint8 method) +{ + bStatus_t status = SUCCESS; + + if (offset != 0) + { + return ATT_ERR_ATTR_NOT_LONG; + } + + if (pAttr->type.len == ATT_BT_UUID_SIZE) + { + // 16-bit UUID + uint16 uuid = BUILD_UINT16(pAttr->type.uuid[0], pAttr->type.uuid[1]); + switch (uuid) + { + case GATT_CLIENT_CHAR_CFG_UUID: + status = GATTServApp_ProcessCCCWriteReq(connHandle, pAttr, pValue, len, + offset, GATT_CLIENT_CFG_NOTIFY); + break; + + default: + // Should never get here! + status = ATT_ERR_ATTR_NOT_FOUND; + break; + } + } + else if (pAttr->type.len == ATT_UUID_SIZE) + { + // 128-bit UUID + uint16 uuid = BUILD_UINT16(pAttr->type.uuid[12], pAttr->type.uuid[13]); + switch (uuid) + { + case AUDIOPROFILE_START_UUID: + case AUDIOPROFILE_AUDIO_UUID: + // Write not permitted + status = ATT_ERR_WRITE_NOT_PERMITTED; + break; + + default: + // Should never get here! + status = ATT_ERR_ATTR_NOT_FOUND; + break; + } + } + else + { + status = ATT_ERR_INVALID_HANDLE; + } + + return status; +} + +/********************************************************************* +*********************************************************************/ diff --git a/src/profiles/audio/audio_profile.h b/src/profiles/audio/audio_profile.h new file mode 100644 index 0000000..9bb5877 --- /dev/null +++ b/src/profiles/audio/audio_profile.h @@ -0,0 +1,204 @@ +/****************************************************************************** + + @file audio_profile.h + + @brief This file contains the audio profile sample service profile for use + with the BLE sample application. + + Group: WCS, BTS + Target Device: CC2650, CC2640, CC1350 + + ****************************************************************************** + + Copyright (c) 2015-2016, Texas Instruments Incorporated + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * 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. + + * Neither the name of Texas Instruments Incorporated nor the names of + its contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 THE COPYRIGHT OWNER 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. + + ****************************************************************************** + Release Name: ble_sdk_2_02_01_18 + Release Date: 2016-10-26 15:20:04 + *****************************************************************************/ + +#ifndef AUDIOPROFILE_H +#define AUDIOPROFILE_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +/********************************************************************* + * INCLUDES + */ + +/********************************************************************* + * CONSTANTS + */ +// Profile Parameters +#define AUDIOPROFILE_START 0 +#define AUDIOPROFILE_AUDIO 1 + +// Audio Profile Service UUID +#define AUDIO_SERV_UUID 0xB000 + +// Key Pressed UUID +#define AUDIOPROFILE_START_UUID 0xB001 +#define AUDIOPROFILE_AUDIO_UUID 0xB002 + +#define AUDIOPROFILE_CMD_LEN 1 + +#define BLEAUDIO_BUFSIZE 96 +#define BLEAUDIO_HDRSIZE 4 + +#ifdef DLE_ENABLED // Data Length Extension Enable +#define BLEAUDIO_NOTSIZE 100 +#define BLEAUDIO_NUM_NOT_PER_FRAME 1 +#else +#define BLEAUDIO_NOTSIZE 20 +#define BLEAUDIO_NUM_NOT_PER_FRAME 5 +#endif +/********************************************************************* + * TYPEDEFS + */ +typedef struct audioServiceConfig +{ + uint8 mode; + uint16 l2capCh; +} audioServiceConfig_t; + +/********************************************************************* + * MACROS + */ + +/********************************************************************* + * Profile Callbacks + */ + +// Callback when a characteristic value has changed +typedef void (*audioProfileChange_t)(uint8 paramID); + +typedef struct +{ + // Called when characteristic value changes + audioProfileChange_t pfnAudioProfileChange; +} audioProfileCBs_t; + + + +/********************************************************************* + * API FUNCTIONS + */ + +/********************************************************************* + * @fn Audio_AddService + * + * @brief Initializes the Audio Profile service by registering + * GATT attributes with the GATT server. + * + * @param None. + * + * @return Generic BLE status return + */ +extern bStatus_t Audio_AddService(void); + +/********************************************************************* + * @fn Audio_SetParameter + * + * @brief Set an Audio Profile parameter. + * + * @param param - Profile parameter ID + * @param len - length of data to right + * @param value - pointer to data to write. This is dependent on + * the parameter ID and WILL be cast to the appropriate + * data type (example: data type of uint16 will be cast to + * uint16 pointer). + * + * @return Generic BLE status return + */ +extern bStatus_t Audio_SetParameter(uint8 param, uint8 len, void *value); + +/********************************************************************* + * @fn Audio_GetParameter + * + * @brief Get an Audio Profile parameter. + * + * @param param - Profile parameter ID + * @param value - pointer to data to read. This is dependent on + * the parameter ID and WILL be cast to the appropriate + * data type (example: data type of uint16 will be cast to + * uint16 pointer). + * + * @return Generic BLE status return + */ +extern bStatus_t Audio_GetParameter(uint8 param, void *value); + +/********************************************************************* + * @fn Audio_ProcessEvent + * + * @brief Audio Profile event handler routine. + * + * @param taskID - The HCI Test Application OSAL task identifer. + * @param events - HCI Test Application OSAL task events. + * + * @return Unprocessed events. + */ +extern uint16 Audio_ProcessEvent(uint8 task_id, uint16 events); + +/********************************************************************* + * @fn Audio_StartTxStreaming + * + * @brief This is the Audio Pofile start function that + * will start audio streaming. + * + * @param None. + * + * @return None. + */ +extern void Audio_StartTxStreaming(void); + +/********************************************************************* + * @fn Audio_StopTxStreaming + * + * @brief This is the Audio Pofile stop function that + * will stop audio streaming. + * + * @param None. + * + * @return None. + */ +extern void Audio_StopTxStreaming(void); + +/********************************************************************* +*********************************************************************/ + +#ifdef __cplusplus +} +#endif + +#endif // AUDIOPROFILE_H diff --git a/src/util/audio_codec/I2SCC26XX.h b/src/util/audio_codec/I2SCC26XX.h index fced3bf..9b4d025 100644 --- a/src/util/audio_codec/I2SCC26XX.h +++ b/src/util/audio_codec/I2SCC26XX.h @@ -247,7 +247,7 @@ extern "C" { * At least three elements must exist for good flow in driver */ #define I2SCC26XX_MIN_ALLOWED_QUEUE_SIZE 3 -#define I2SCC26XX_QUEUE_SIZE 7 +#define I2SCC26XX_QUEUE_SIZE 5 //7 /*! * PDM block overhead size in number of bytes --> sizeof(queueNodeI2S_t) diff --git a/src/util/sbc/sbc.c b/src/util/sbc/sbc.c index d70cab9..69d452b 100644 --- a/src/util/sbc/sbc.c +++ b/src/util/sbc/sbc.c @@ -1074,17 +1074,14 @@ struct sbc_priv { #ifdef SBC_CC26XX #ifdef __IAR_SYSTEMS_ICC__ -#pragma default_variable_attributes = @ "AUX_RAM_SECTION" /* ----------- CCS Compiler ----------- */ #elif defined __TI_COMPILER_VERSION || defined __TI_COMPILER_VERSION__ -#pragma DATA_SECTION(sbc_mem, ".aux_ram") /* ----------- Unrecognized Compiler ----------- */ #else #error "ERROR: Unknown compiler." #endif uint8_t sbc_mem[sizeof(struct sbc_priv) + SBC_ALIGN_MASK] = {0}; #ifdef __IAR_SYSTEMS_ICC__ -#pragma default_variable_attributes = #endif //__IAR_SYSTEMS_ICC__ #endif //SBC_CC26XX From c1a54cf2534c10a187513c309023c5e3063af5a3 Mon Sep 17 00:00:00 2001 From: Sean Lyons Date: Thu, 30 Mar 2017 01:11:00 -0500 Subject: [PATCH 11/19] Merge pull request #30 in SA/ble_examples from feature/audio_logging_fix to ble_examples-2.2 Squashed commit of the following: commit d23f420507ba0e1806b03325f809eb75f68e8c18 Author: Sean Lyons Date: Wed Mar 29 23:08:42 2017 -0700 Update script, tx code so all adpcm matches simple_peripheral_audio_transmitter was using 8 bit seqNum, this was incompatible with the 5 bit seq num used by other projects commit 90663d3805e8e3ed77cc48c48a04187367c84555 Author: Christin Lee Date: Thu Mar 23 17:30:06 2017 +0100 fix UART logging to PC error on receiver side and python script --- .../app/simple_central_audio_receiver.c | 35 +++++++------------ .../app/simple_peripheral_audio_transmitter.c | 10 +++--- .../scripts/audio/audio_frame_serial_print.py | 20 +++++------ 3 files changed, 29 insertions(+), 36 deletions(-) diff --git a/src/examples/simple_central_audio_receiver/cc26xx/app/simple_central_audio_receiver.c b/src/examples/simple_central_audio_receiver/cc26xx/app/simple_central_audio_receiver.c index 8dbd179..b658a69 100644 --- a/src/examples/simple_central_audio_receiver/cc26xx/app/simple_central_audio_receiver.c +++ b/src/examples/simple_central_audio_receiver/cc26xx/app/simple_central_audio_receiver.c @@ -465,20 +465,6 @@ const unsigned char msbc_data[] = 0xe0 }; -//#ifdef __IAR_SYSTEMS_ICC__ -//#pragma default_variable_attributes = @ "AUX_RAM_SECTION" -///* ----------- CCS Compiler ----------- */ -//#elif defined __TI_COMPILER_VERSION || defined __TI_COMPILER_VERSION__ -//#pragma DATA_SECTION(i2sContMgtBuffer, ".aux_ram") -//#pragma DATA_SECTION(audio_encoded, ".aux_ram") -//#pragma DATA_SECTION(sbc, ".aux_ram") -//#pragma DATA_SECTION(written, ".aux_ram") -//#pragma DATA_SECTION(streamVariables, ".aux_ram") -///* ----------- Unrecognized Compiler ----------- */ -//#else -//#error "ERROR: Unknown compiler." -//#endif -// #ifdef STREAM_TO_AUDBOOST uint8_t i2sContMgtBuffer[I2S_BLOCK_OVERHEAD_IN_BYTES * I2SCC26XX_QUEUE_SIZE] = {0}; #endif //STREAM_TO_AUDBOOST @@ -496,9 +482,6 @@ struct { uint8_t i2sOpened; #endif //STREAM_TO_AUDBOOST } streamVariables = {0}; -//#ifdef __IAR_SYSTEMS_ICC__ -//#pragma default_variable_attributes = -//#endif //__IAR_SYSTEMS_ICC__ #ifdef STREAM_TO_AUDBOOST static void I2SCC26XX_i2sCallbackFxn(I2SCC26XX_Handle handle, I2SCC26XX_StreamNotification *notification); @@ -1329,6 +1312,11 @@ static void SimpleBLECentral_processGATTMsg(gattMsgEvent_t *pMsg) } PIN_setOutputValue( ledPinHandle, Board_DIO26_ANALOG, 0); UART_write(uartHandle, audio_decoded, streamVariables.samplesPerFrame * sizeof(int16_t)); + PIN_setOutputValue( ledPinHandle, Board_DIO26_ANALOG, 1); + } + else { + audio_decoded = ICall_malloc(sizeof(int16_t) * streamVariables.samplesPerFrame); + } #else //!UART_DUMP_UNCOMPRESSED if (streamVariables.streamType == BLE_AUDIO_CMD_START_MSBC) { UART_write(uartHandle, audio_encoded, MSBC_ENCODED_SIZE); @@ -1337,11 +1325,6 @@ static void SimpleBLECentral_processGATTMsg(gattMsgEvent_t *pMsg) UART_write(uartHandle, audio_encoded, BLEAUDIO_BUFSIZE_ADPCM + BLEAUDIO_HDRSIZE_ADPCM); } #endif //UART_DUMP_UNCOMPRESSED - PIN_setOutputValue( ledPinHandle, Board_DIO26_ANALOG, 1); - } - else { - audio_decoded = ICall_malloc(sizeof(int16_t) * streamVariables.samplesPerFrame); - } #endif //STREAM_TO_AUDBOOST frameReady = FALSE; } @@ -1364,10 +1347,12 @@ static void SimpleBLECentral_processGATTMsg(gattMsgEvent_t *pMsg) } } #else //STREAM_TO_PC +#ifdef UART_DUMP_UNCOMPRESSED if (!audio_decoded) { audio_decoded = ICall_malloc(sizeof(int16_t) * streamVariables.samplesPerFrame); Display_print0(dispHandle, 5, 0, "Failed to allocate mem for decoding"); } +#endif //UART_DUMP_UNCOMPRESSED #endif //STREAM_TO_AUDBOOST PIN_setOutputValue( ledPinHandle, Board_DIO28_ANALOG, 1); } @@ -1397,7 +1382,9 @@ static void SimpleBLECentral_processGATTMsg(gattMsgEvent_t *pMsg) streamVariables.i2sOpened = TRUE; } #else //STREAM_TO_PC +#ifdef UART_DUMP_UNCOMPRESSED audio_decoded = ICall_malloc(sizeof(int16_t) * streamVariables.samplesPerFrame); +#endif //UART_DUMP_UNCOMPRESSED #endif //STREAM_TO_AUDBOOST Display_print0(dispHandle, 5, 0, "ADPCM Stream"); } @@ -1424,7 +1411,9 @@ static void SimpleBLECentral_processGATTMsg(gattMsgEvent_t *pMsg) Display_print0(dispHandle, 5, 0, "Failed to allocate mem for I2S driver on start"); } #else //STREAM_TO_PC +#ifdef UART_DUMP_UNCOMPRESSED audio_decoded = ICall_malloc(sizeof(int16_t) * streamVariables.samplesPerFrame); +#endif //UART_DUMP_UNCOMPRESSED #endif //STREAM_TO_AUDBOOST // Initialize encoder sbc_init_msbc(&sbc, 0); @@ -1465,9 +1454,11 @@ static void SimpleBLECentral_processGATTMsg(gattMsgEvent_t *pMsg) } } #else //STREAM_TO_PC +#ifdef UART_DUMP_UNCOMPRESSED if (audio_decoded) { ICall_free(audio_decoded); } +#endif //UART_DUMP_UNCOMPRESSED if (streamVariables.streamType == BLE_AUDIO_CMD_START_MSBC) { sbc_finish(&sbc); diff --git a/src/examples/simple_peripheral_audio_transmitter/cc26xx/app/simple_peripheral_audio_transmitter.c b/src/examples/simple_peripheral_audio_transmitter/cc26xx/app/simple_peripheral_audio_transmitter.c index 281a879..f67f1cd 100644 --- a/src/examples/simple_peripheral_audio_transmitter/cc26xx/app/simple_peripheral_audio_transmitter.c +++ b/src/examples/simple_peripheral_audio_transmitter/cc26xx/app/simple_peripheral_audio_transmitter.c @@ -179,6 +179,8 @@ #define BLE_AUDIO_CMD_START_MSBC 0x05 #define BLE_AUDIO_CMD_NONE 0xFF +#define RAS_DATA_TIC1_CMD 0x01 + /********************************************************************* * TYPEDEFS */ @@ -302,7 +304,7 @@ static uint8_t attDeviceName[GAP_DEVICE_NAME_LEN] = "Simple BLE AudioTx"; static gattMsgEvent_t *pAttRsp = NULL; static uint8_t rspTxRetry = 0; -#define INPUT_OPTION AUDIO_CODEC_MIC_LINE_IN //AUDIO_CODEC_MIC_ONBOARD +#define INPUT_OPTION AUDIO_CODEC_MIC_ONBOARD #define BLEAUDIO_BUFSIZE_ADPCM 96 #define BLEAUDIO_HDRSIZE_ADPCM 4 @@ -494,10 +496,10 @@ static void SimpleBLEPeripheral_init(void) RCOSC_enableCalibration(); #endif // USE_RCOSC -#if defined (DLE_ENABLED) +#if defined (DLE_ENABLED) HCI_LE_WriteSuggestedDefaultDataLenCmd(DLE_MAX_PDU_SIZE , DLE_MAX_TX_TIME); #endif - + // Create an RTOS queue for message from profile to be sent to app. appMsgQueue = Util_constructQueue(&appMsg); @@ -761,7 +763,7 @@ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) audio_encoded[1] = seqNum++; } else { - audio_encoded[0] = seqNum++; + audio_encoded[0] = (((seqNum++ % 32) << 3) | RAS_DATA_TIC1_CMD); // Send previous PV and SI audio_encoded[1] = streamVariables.si; audio_encoded[2] = LO_UINT16(streamVariables.pv); diff --git a/tools/scripts/audio/audio_frame_serial_print.py b/tools/scripts/audio/audio_frame_serial_print.py index 2a1318a..6994ae1 100644 --- a/tools/scripts/audio/audio_frame_serial_print.py +++ b/tools/scripts/audio/audio_frame_serial_print.py @@ -3,8 +3,8 @@ * Filename: audio_frame_serial_print.py * * Description: This tool is used to decode audio frames from the - * CC2650ARC, the CC2650STK development kits and the CC2650 LaunchPad with - * CC3200AUDBOOST booster pack. These frames will saved to a wav file for + * CC2650ARC, the CC2650STK development kits and the CC2650 LaunchPad with + * CC3200AUDBOOST booster pack. These frames will saved to a wav file for * playback. This script expects audio compressed in ADPCM format. * * Copyright (C) 2016-2017 Texas Instruments Incorporated - http://www.ti.com/ @@ -48,6 +48,8 @@ from time import time import time import winsound +import os +import sys tic1_stepsize_Lut = [ 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 25, 28, 31, @@ -66,6 +68,9 @@ SI_Dec = 0 PV_Dec = 0 +def get_script_path(): + return os.path.dirname(os.path.realpath(sys.argv[0])) + def tic1_DecodeSingle(nibble): global SI_Dec global PV_Dec @@ -123,7 +128,7 @@ def save_wav(): filename = time.strftime("pdm_test_%Y-%m-%d_%H-%M-%S_adpcm") print "saving file" - w = wave.open("samples/" + filename + ".wav", "w") + w = wave.open(get_script_path() + "/samples/" + filename + ".wav", "w") w.setnchannels(1) w.setframerate(16000) w.setsampwidth(2) @@ -148,7 +153,7 @@ def save_wav(): missedFrames = 0 try: ser = None - ser = Serial("COM91", 460800, timeout=0.1) + ser = Serial("COM137", 460800, timeout=0.1) readSoFar = 0 while True: @@ -162,7 +167,6 @@ def save_wav(): inbuffer += indata if len(inbuffer) == bufLen: -## if frameNum == 1: seqNum, SI_received, PV_received = struct.unpack('BBh', inbuffer[0:4]) seqNum = (seqNum >> 3) print "Frame sequence number: %d" % seqNum @@ -170,10 +174,6 @@ def save_wav(): print "HDR_1 local: %d, HDR_1 received: %d" % (SI_Dec, SI_received) print "HDR_2 local: %d, HDR_2 received: %d" % (PV_Dec, PV_received) - #always use received PV and SI -## PV_Dec = PV_received -## SI_Dec = SI_received - if seqNum > prevSeqNum: missedFrames = (seqNum - prevSeqNum -1) else: @@ -191,7 +191,7 @@ def save_wav(): readSoFar = 0 lastByteTime = time.time() - + except SerialException as e: print "Serial port error" print e From 773abdf0288d32eaf2c076d69710694f0b31fd4d Mon Sep 17 00:00:00 2001 From: Sean Lyons Date: Thu, 30 Mar 2017 14:32:49 -0700 Subject: [PATCH 12/19] Add sensortag support back to audioRX --- .../ccs/config/ccs_compiler_defines.bcfg | 8 ++++---- .../ccs/config/ccs_linker_defines.cmd | 8 ++++---- .../ccs/config/lib_linker.cmd | 4 ++-- .../cc26xx/app/simple_central_audio_receiver.c | 13 +++++++++++-- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/examples/cc2650lp/simple_central_audio_receiver/ccs/config/ccs_compiler_defines.bcfg b/examples/cc2650lp/simple_central_audio_receiver/ccs/config/ccs_compiler_defines.bcfg index e5eaf32..dd1beb4 100644 --- a/examples/cc2650lp/simple_central_audio_receiver/ccs/config/ccs_compiler_defines.bcfg +++ b/examples/cc2650lp/simple_central_audio_receiver/ccs/config/ccs_compiler_defines.bcfg @@ -1,10 +1,10 @@ /* -** Stack Frontier Generator 1.1.0 (2017-01-11 16:13:45.899000) +** Stack Frontier Generator 1.1.0 (2017-03-30 11:36:30.981000) ** ** WARNING - Auto-generated file. Modifications could be lost! */ ---define=ICALL_STACK0_ADDR=0xd001 ---define=ICALL_STACK0_START=0xd000 ---define=ICALL_RAM0_START=0x20004340 +--define=ICALL_STACK0_ADDR=0xc001 +--define=ICALL_STACK0_START=0xc000 +--define=ICALL_RAM0_START=0x20004318 diff --git a/examples/cc2650lp/simple_central_audio_receiver/ccs/config/ccs_linker_defines.cmd b/examples/cc2650lp/simple_central_audio_receiver/ccs/config/ccs_linker_defines.cmd index 3b58fd0..15f6ec3 100644 --- a/examples/cc2650lp/simple_central_audio_receiver/ccs/config/ccs_linker_defines.cmd +++ b/examples/cc2650lp/simple_central_audio_receiver/ccs/config/ccs_linker_defines.cmd @@ -1,10 +1,10 @@ /* -** Stack Frontier Generator 1.1.0 (2017-01-11 16:13:45.899000) +** Stack Frontier Generator 1.1.0 (2017-03-30 11:36:30.981000) ** ** WARNING - Auto-generated file. Modifications could be lost! */ ---define=ICALL_RAM0_START=0x20004340 ---define=ICALL_STACK0_START=0xd000 ---define=ICALL_STACK0_ADDR=0xd001 +--define=ICALL_RAM0_START=0x20004318 +--define=ICALL_STACK0_START=0xc000 +--define=ICALL_STACK0_ADDR=0xc001 diff --git a/examples/cc2650lp/simple_central_audio_receiver/ccs/config/lib_linker.cmd b/examples/cc2650lp/simple_central_audio_receiver/ccs/config/lib_linker.cmd index 2b073d3..2106e9c 100644 --- a/examples/cc2650lp/simple_central_audio_receiver/ccs/config/lib_linker.cmd +++ b/examples/cc2650lp/simple_central_audio_receiver/ccs/config/lib_linker.cmd @@ -4,5 +4,5 @@ */ "C:\ti\simplelink\ble_sdk_2_02_01_18\blelib\host\host_xcxx.a" -"C:\ti\simplelink\ble_sdk_2_02_01_18\blelib\ctrl\cc2640\cc2640_ctrl_xcxx_41c.a" -"C:\ti\simplelink\ble_sdk_2_02_01_18\blelib\hci_tl\cc26xx\cc26xx_hci_tl_none_v41.a" +"C:\ti\simplelink\ble_sdk_2_02_01_18\blelib\ctrl\cc2640\cc2640_ctrl_xcxx_41c_ext.a" +"C:\ti\simplelink\ble_sdk_2_02_01_18\blelib\hci_tl\cc26xx\cc26xx_hci_tl_none_v41_v42.a" diff --git a/src/examples/simple_central_audio_receiver/cc26xx/app/simple_central_audio_receiver.c b/src/examples/simple_central_audio_receiver/cc26xx/app/simple_central_audio_receiver.c index b658a69..2db60cf 100644 --- a/src/examples/simple_central_audio_receiver/cc26xx/app/simple_central_audio_receiver.c +++ b/src/examples/simple_central_audio_receiver/cc26xx/app/simple_central_audio_receiver.c @@ -570,10 +570,10 @@ static void SimpleBLECentral_init(void) // so that the application can send and receive messages. ICall_registerApp(&selfEntity, &sem); -#if defined (DLE_ENABLED) +#if defined (DLE_ENABLED) HCI_LE_WriteSuggestedDefaultDataLenCmd(DLE_MAX_PDU_SIZE , DLE_MAX_TX_TIME); #endif - + // Open all pins ledPinHandle = PIN_open(&allPinState, ledPinTable); @@ -1013,6 +1013,15 @@ static void SimpleBLECentral_processRoleEvent(gapCentralRoleEvent_t *pEvent) state = BLE_STATE_CONNECTED; connHandle = pEvent->linkCmpl.connectionHandle; + if (FALSE == serviceDiscComplete) + { + // Begin Service Discovery of AUDIO Service to find out report handles + serviceToDiscover = AUDIO_SERV_UUID; + SimpleBLECentral_DiscoverService( connHandle, serviceToDiscover ); + serviceDiscComplete = FALSE; + audioConfigEnable =0; //This will re-trig an audio configuration if needed + } + Util_startClock(&startDiscClock); Display_print0(dispHandle, 2, 0, "Connected"); From 5688abed8138e532a07a043052396a064f004936 Mon Sep 17 00:00:00 2001 From: Thomas Kopriva Date: Mon, 1 May 2017 09:17:23 -0500 Subject: [PATCH 13/19] Merge pull request #32 in SA/ble_examples from feature/spp_ble_fix_ccs_throughput_issue to ble_examples-2.2 Squashed commit of the following: commit cd88ddbd06fe2c50200068507ac262425fc9975e Author: Haq Date: Fri Apr 28 18:38:40 2017 -0700 replaced tabs with white spaces commit 3090ba488002484676e1d0f980ed5b41e3d0743c Author: Haq Date: Fri Apr 28 15:06:45 2017 -0700 fix CCS throughput issue --- .../spp_ble_client_cc2650lp_app.projectspec | 68 +++++++++---------- .../spp_ble_server_cc2650lp_app.projectspec | 68 +++++++++---------- src/components/sdi/inc/sdi_tl_uart.h | 2 +- 3 files changed, 69 insertions(+), 69 deletions(-) diff --git a/examples/cc2650lp/spp_ble_client/ccs/app/spp_ble_client_cc2650lp_app.projectspec b/examples/cc2650lp/spp_ble_client/ccs/app/spp_ble_client_cc2650lp_app.projectspec index d7a5f1b..2797f92 100644 --- a/examples/cc2650lp/spp_ble_client/ccs/app/spp_ble_client_cc2650lp_app.projectspec +++ b/examples/cc2650lp/spp_ble_client/ccs/app/spp_ble_client_cc2650lp_app.projectspec @@ -39,48 +39,48 @@ --plain_char=unsigned -DUSE_ICALL - -DMAX_PDU_SIZE=69 + -DMAX_PDU_SIZE=135 -DxPOWER_SAVING - -DSDI_USE_UART - -DDEBUG_SIMPLE + -DSDI_USE_UART + -DDEBUG_SIMPLE -DHEAPMGR_SIZE=0 - -DDisplay_DISABLE_ALL + -DDisplay_DISABLE_ALL -DxBOARD_DISPLAY_EXCLUDE_UART -DxBOARD_DISPLAY_EXCLUDE_LCD - -DGAPperipheralROLE_NUM_RSSI_LINKS=1 + -DGAPperipheralROLE_NUM_RSSI_LINKS=1 -DICALL_MAX_NUM_TASKS=4 -DICALL_MAX_NUM_ENTITIES=6 -Dxdc_runtime_Assert_DISABLE_ALL -Dxdc_runtime_Log_DISABLE_ALL -DCC2650_LAUNCHXL - -DCC26XXWARE + -DCC26XXWARE -DCC26XX - -I${CG_TOOL_ROOT}/include - -I${SRC_BLE_CORE}/inc - -I${SRC_BLE_CORE}/controller/cc26xx/inc - -I${SRC_EX}/common/cc26xx - -I${SRC_EX}/icall/inc - -I${SRC_EX}/inc - -I${SRC_EX}/profiles/dev_info - -I${SRC_EX}/profiles/roles/ - -I${SRC_EX}/profiles/roles/cc26xx - -I${PROJECT_IMPORT_LOC}/../../../../../src/profiles/serial_port - -I${PROJECT_IMPORT_LOC}/../../../../../src/profiles/serial_port/cc26xx - -I${PROJECT_IMPORT_LOC}/../../../../../src/examples/spp_ble_client/cc26xx/app - -I${SRC_EX}/target - -I${SRC_COMMON}/hal/src/inc - -I${SRC_COMMON}/hal/src/target/_common - -I${SRC_COMMON}/hal/src/target/_common/cc26xx - -I${SRC_COMMON}/heapmgr - -I${SRC_COMMON}/icall/src/inc - -I${SRC_COMMON}/osal/src/inc - -I${SRC_COMMON}/services/src/saddr - -I${SRC_COMMON}/services/src/sdata - -I${PROJECT_IMPORT_LOC}/../../../../../src/components/sdi - -I${CC26XXWARE} - -I${TI_RTOS_DRIVERS_BASE} - " + -I${CG_TOOL_ROOT}/include + -I${SRC_BLE_CORE}/inc + -I${SRC_BLE_CORE}/controller/cc26xx/inc + -I${SRC_EX}/common/cc26xx + -I${SRC_EX}/icall/inc + -I${SRC_EX}/inc + -I${SRC_EX}/profiles/dev_info + -I${SRC_EX}/profiles/roles/ + -I${SRC_EX}/profiles/roles/cc26xx + -I${PROJECT_IMPORT_LOC}/../../../../../src/profiles/serial_port + -I${PROJECT_IMPORT_LOC}/../../../../../src/profiles/serial_port/cc26xx + -I${PROJECT_IMPORT_LOC}/../../../../../src/examples/spp_ble_client/cc26xx/app + -I${SRC_EX}/target + -I${SRC_COMMON}/hal/src/inc + -I${SRC_COMMON}/hal/src/target/_common + -I${SRC_COMMON}/hal/src/target/_common/cc26xx + -I${SRC_COMMON}/heapmgr + -I${SRC_COMMON}/icall/src/inc + -I${SRC_COMMON}/osal/src/inc + -I${SRC_COMMON}/services/src/saddr + -I${SRC_COMMON}/services/src/sdata + -I${PROJECT_IMPORT_LOC}/../../../../../src/components/sdi + -I${CC26XXWARE} + -I${TI_RTOS_DRIVERS_BASE} + " linkerBuildOptions=" -l${PROJECT_IMPORT_LOC}/../config/ccs_linker_defines.cmd @@ -199,11 +199,11 @@ - + - + - + diff --git a/examples/cc2650lp/spp_ble_server/ccs/app/spp_ble_server_cc2650lp_app.projectspec b/examples/cc2650lp/spp_ble_server/ccs/app/spp_ble_server_cc2650lp_app.projectspec index ca211cd..6b70df2 100644 --- a/examples/cc2650lp/spp_ble_server/ccs/app/spp_ble_server_cc2650lp_app.projectspec +++ b/examples/cc2650lp/spp_ble_server/ccs/app/spp_ble_server_cc2650lp_app.projectspec @@ -39,48 +39,48 @@ --plain_char=unsigned -DUSE_ICALL - -DMAX_PDU_SIZE=69 + -DMAX_PDU_SIZE=135 -DxPOWER_SAVING - -DSDI_USE_UART - -DDEBUG_SIMPLE + -DSDI_USE_UART + -DDEBUG_SIMPLE -DHEAPMGR_SIZE=0 - -DDisplay_DISABLE_ALL + -DDisplay_DISABLE_ALL -DxBOARD_DISPLAY_EXCLUDE_UART -DxBOARD_DISPLAY_EXCLUDE_LCD - -DGAPperipheralROLE_NUM_RSSI_LINKS=1 + -DGAPperipheralROLE_NUM_RSSI_LINKS=1 -DICALL_MAX_NUM_TASKS=4 -DICALL_MAX_NUM_ENTITIES=6 -Dxdc_runtime_Assert_DISABLE_ALL -Dxdc_runtime_Log_DISABLE_ALL -DCC2650_LAUNCHXL - -DCC26XXWARE + -DCC26XXWARE -DCC26XX - -I${CG_TOOL_ROOT}/include - -I${SRC_BLE_CORE}/inc - -I${SRC_BLE_CORE}/controller/cc26xx/inc - -I${SRC_EX}/common/cc26xx - -I${SRC_EX}/icall/inc - -I${SRC_EX}/inc - -I${SRC_EX}/profiles/dev_info - -I${SRC_EX}/profiles/roles/ - -I${SRC_EX}/profiles/roles/cc26xx - -I${PROJECT_IMPORT_LOC}/../../../../../src/profiles/serial_port - -I${PROJECT_IMPORT_LOC}/../../../../../src/profiles/serial_port/cc26xx - -I${PROJECT_IMPORT_LOC}/../../../../../src/examples/spp_ble_server/cc26xx/app - -I${SRC_EX}/target - -I${SRC_COMMON}/hal/src/inc - -I${SRC_COMMON}/hal/src/target/_common - -I${SRC_COMMON}/hal/src/target/_common/cc26xx - -I${SRC_COMMON}/heapmgr - -I${SRC_COMMON}/icall/src/inc - -I${SRC_COMMON}/osal/src/inc - -I${SRC_COMMON}/services/src/saddr - -I${SRC_COMMON}/services/src/sdata - -I${PROJECT_IMPORT_LOC}/../../../../../src/components/sdi - -I${CC26XXWARE} - -I${TI_RTOS_DRIVERS_BASE} - " + -I${CG_TOOL_ROOT}/include + -I${SRC_BLE_CORE}/inc + -I${SRC_BLE_CORE}/controller/cc26xx/inc + -I${SRC_EX}/common/cc26xx + -I${SRC_EX}/icall/inc + -I${SRC_EX}/inc + -I${SRC_EX}/profiles/dev_info + -I${SRC_EX}/profiles/roles/ + -I${SRC_EX}/profiles/roles/cc26xx + -I${PROJECT_IMPORT_LOC}/../../../../../src/profiles/serial_port + -I${PROJECT_IMPORT_LOC}/../../../../../src/profiles/serial_port/cc26xx + -I${PROJECT_IMPORT_LOC}/../../../../../src/examples/spp_ble_server/cc26xx/app + -I${SRC_EX}/target + -I${SRC_COMMON}/hal/src/inc + -I${SRC_COMMON}/hal/src/target/_common + -I${SRC_COMMON}/hal/src/target/_common/cc26xx + -I${SRC_COMMON}/heapmgr + -I${SRC_COMMON}/icall/src/inc + -I${SRC_COMMON}/osal/src/inc + -I${SRC_COMMON}/services/src/saddr + -I${SRC_COMMON}/services/src/sdata + -I${PROJECT_IMPORT_LOC}/../../../../../src/components/sdi + -I${CC26XXWARE} + -I${TI_RTOS_DRIVERS_BASE} + " linkerBuildOptions=" -l${PROJECT_IMPORT_LOC}/../config/ccs_linker_defines.cmd @@ -212,11 +212,11 @@ - + - + - + diff --git a/src/components/sdi/inc/sdi_tl_uart.h b/src/components/sdi/inc/sdi_tl_uart.h index a1f440a..8e59125 100644 --- a/src/components/sdi/inc/sdi_tl_uart.h +++ b/src/components/sdi/inc/sdi_tl_uart.h @@ -62,7 +62,7 @@ extern "C" #define SDI_UART_INT_ENABLE TRUE #if !defined(SDI_UART_BR) -#define SDI_UART_BR 921600 //115200 +#define SDI_UART_BR 115200 #endif // !SDI_UART_BR // UART ISR Buffer define From 9d7aaf6c14b4b4b6ce7e6b022736616ed4ff8f0d Mon Sep 17 00:00:00 2001 From: Thomas Kopriva Date: Tue, 2 May 2017 10:15:45 -0500 Subject: [PATCH 14/19] Merge pull request #35 in SA/ble_examples from feature/LPRFAPPS-789-compiler-warning-edit to ble_examples-2.2-develop Squashed commit of the following: commit b930318d9950592b1a93fc2ccceda30b4530c6e8 Author: Rachel Powers Date: Mon May 1 15:09:30 2017 -0700 linked to installing new compiler in SDG --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6325eb0..2a8fbca 100644 --- a/README.md +++ b/README.md @@ -39,10 +39,12 @@ By default, TI\_BLE\_SDK\_BASE points to `C:\ti\simplelink\ble_sdk_2_02_01_18\`. Required Tools ============== -Similar to the BLE-Stack SDK, the examples in this repository support the IAR and CCS toolchains. Please pay careful attention to versions of these tools, the supported version are listed below. Using a non supported version is untested and may result in unexpected behavior. +Similar to the BLE-Stack SDK, the examples in this repository support the IAR and CCS toolchains. Please pay careful attention to versions of these tools, the supported version are listed below. **Using a non supported version is untested and may result in unexpected behavior.** - IAR for ARM v7.70.2 - CCS v6.2.0 with TI ARM Compiler v5.2.6 + +TI ARM Compiler is no longer installed by default in CCS v6.2.0. For instructions on installing TI ARM Compiler v5.2.6, please refer to the [Installing a Specific TI ARM Compiler](http://software-dl.ti.com/lprf/sdg-latest/html/cc2640/platform.html#installing-a-specific-ti-arm-compiler) of the TI BLE Software Developer's Guide. For more information on toolchain setup, please refer to our [FAQ page](docs/faq.md). From 7f63c8e9fa429b6690b4b1f8d1a5c0aaf426b7e6 Mon Sep 17 00:00:00 2001 From: Thomas Kopriva Date: Thu, 18 May 2017 22:26:52 -0500 Subject: [PATCH 15/19] Merge pull request #41 in SA/ble_examples from bugfix/LPRFAPPS-791-add-sm_ecc-file to ble_examples-2.2-develop Squashed commit of the following: commit b4b1b3df92a3485ba951eb889c9f75164ea35e3f Author: Rachel Powers Date: Thu May 18 15:35:11 2017 -0500 hid_adv_remote_privacy_cc2650rc_app.projectspec edited online with Bitbucket commit 3d75105915261147ce8861dc640423b14dbb7d9c Author: Rachel Powers Date: Thu May 18 15:33:01 2017 -0500 simple_eddystone_cc2650lp_app.projectspec edited online with Bitbucket commit 3a06db93fd9270cdcef6c636cd5836a43a1c4130 Author: Rachel Powers Date: Wed May 17 13:21:25 2017 -0700 adding files missed during porting --- .../hid_emu_kbd_cc2650lp_stack.projectspec | 2 + .../multi_role_cc2650lp_stack.projectspec | 2 + .../simple_beacon_cc2650lp_app.projectspec | 4 +- .../simple_beacon_cc2650lp_stack.projectspec | 17 +++--- ..._audio_receiver_cc2650lp_stack.projectspec | 2 + .../simple_eddystone_cc2650lp_app.projectspec | 7 ++- ...imple_eddystone_cc2650lp_stack.projectspec | 9 ++- ...dio_transmitter_cc2650lp_stack.projectspec | 2 + ...ripheral_observer_cc2650lp_app.projectspec | 6 ++ ...pheral_observer_cc2650lp_stack.projectspec | 2 + ...roprietary_beacon_cc2650lp_app.projectspec | 3 +- ...prietary_beacon_cc2650lp_stack.projectspec | 13 ++-- .../spp_ble_client_cc2650lp_app.projectspec | 6 ++ .../spp_ble_client_cc2650lp_stack.projectspec | 2 + .../spp_ble_server_cc2650lp_app.projectspec | 6 ++ .../spp_ble_server_cc2650lp_stack.projectspec | 2 + ...example_central_cc2650lp_stack.projectspec | 2 + ...mple_peripheral_cc2650lp_stack.projectspec | 2 + ...dv_remote_privacy_cc2650rc_app.projectspec | 7 ++- ..._remote_privacy_cc2650rc_stack.projectspec | 60 ++++++++----------- 20 files changed, 95 insertions(+), 61 deletions(-) diff --git a/examples/cc2650lp/hid_emu_kbd/ccs/stack/hid_emu_kbd_cc2650lp_stack.projectspec b/examples/cc2650lp/hid_emu_kbd/ccs/stack/hid_emu_kbd_cc2650lp_stack.projectspec index 4cfe995..a9be3e0 100644 --- a/examples/cc2650lp/hid_emu_kbd/ccs/stack/hid_emu_kbd_cc2650lp_stack.projectspec +++ b/examples/cc2650lp/hid_emu_kbd/ccs/stack/hid_emu_kbd_cc2650lp_stack.projectspec @@ -185,6 +185,8 @@ + + diff --git a/examples/cc2650lp/multi_role/ccs/stack/multi_role_cc2650lp_stack.projectspec b/examples/cc2650lp/multi_role/ccs/stack/multi_role_cc2650lp_stack.projectspec index 7420622..82d96a8 100644 --- a/examples/cc2650lp/multi_role/ccs/stack/multi_role_cc2650lp_stack.projectspec +++ b/examples/cc2650lp/multi_role/ccs/stack/multi_role_cc2650lp_stack.projectspec @@ -238,6 +238,8 @@ + + diff --git a/examples/cc2650lp/simple_beacon/ccs/app/simple_beacon_cc2650lp_app.projectspec b/examples/cc2650lp/simple_beacon/ccs/app/simple_beacon_cc2650lp_app.projectspec index 8c33793..2b24407 100644 --- a/examples/cc2650lp/simple_beacon/ccs/app/simple_beacon_cc2650lp_app.projectspec +++ b/examples/cc2650lp/simple_beacon/ccs/app/simple_beacon_cc2650lp_app.projectspec @@ -8,7 +8,7 @@ connection="common/targetdb/connections/TIXDS110_Connection.xml" toolChain="TI" linkerCommandFile="" - compilerBuildOptions="--cmd_file="${TI_BLE_SDK_BASE}/src/config/build_components.opt" --cmd_file="${WORKSPACE_LOC}/simple_beacon_cc2650lp_stack/TOOLS/build_config.opt" --cmd_file="${WORKSPACE_LOC}/simple_beacon_cc2650lp_stack/TOOLS/ccs_compiler_defines.bcfg" -mv7M3 --code_state=16 --abi=eabi -me -g --c99 --gcc --gen_func_subsections=on --display_error_number --diag_warning=255 --diag_wrap=off + compilerBuildOptions="--cmd_file="${TI_BLE_SDK_BASE}/src/config/build_components.opt" --cmd_file="${WORKSPACE_LOC}/simple_beacon_cc2650lp_stack/TOOLS/build_config.opt" --cmd_file="${WORKSPACE_LOC}/simple_beacon_cc2650lp_stack/TOOLS/ccs_compiler_defines.bcfg" -mv7M3 -O4 --opt_for_speed=0 --code_state=16 --abi=eabi -me -g --c99 --gcc --gen_func_subsections=on --display_error_number --diag_warning=255 --diag_wrap=off -DUSE_ICALL -DPOWER_SAVING -DSBP_TASK_STACK_SIZE=700 @@ -49,7 +49,7 @@ -I${TI_BLE_SDK_BASE}/src/inc -I${CC26XXWARE} " - linkerBuildOptions="-l${}libc.a -l${CC26XXWARE}/driverlib/bin/ccs/driverlib.lib -l${TI_BLE_SDK_BASE}/src/rom/common_rom_releases/03282014/common_rom.symbols -l${PROJECT_IMPORT_LOC}/../../ccs/config/ccs_linker_defines.cmd + linkerBuildOptions="-l${}libc.a -l${CC26XXWARE}/driverlib/bin/ccs/driverlib.lib -l${TI_BLE_SDK_BASE}/src/rom/common_rom_releases/03282014/common_rom.symbols -l${PROJECT_ROOT}/../simple_beacon_cc2650lp_stack/TOOLS/ccs_linker_defines.cmd -l${TI_BLE_SDK_BASE}/src/common/cc26xx/ccs/cc26xx_app.cmd -x --diag_suppress=16002-D --diag_suppress=16004-D --diag_suppress=10247-D --diag_suppress=10325-D --diag_suppress=10229-D" description="" launchWizard="false" diff --git a/examples/cc2650lp/simple_beacon/ccs/stack/simple_beacon_cc2650lp_stack.projectspec b/examples/cc2650lp/simple_beacon/ccs/stack/simple_beacon_cc2650lp_stack.projectspec index 456eac0..ac8b660 100644 --- a/examples/cc2650lp/simple_beacon/ccs/stack/simple_beacon_cc2650lp_stack.projectspec +++ b/examples/cc2650lp/simple_beacon/ccs/stack/simple_beacon_cc2650lp_stack.projectspec @@ -8,7 +8,7 @@ connection="common/targetdb/connections/TIXDS110_Connection.xml" toolChain="TI" linkerCommandFile="" - compilerBuildOptions="--cmd_file="${TI_BLE_SDK_BASE}/src/config/build_components.opt" --cmd_file="${PROJECT_ROOT}/TOOLS/build_config.opt" -mv7M3 --code_state=16 --abi=eabi -me -g --c99 --gcc --gen_func_subsections=on --display_error_number --diag_warning=255 --diag_wrap=off + compilerBuildOptions="--cmd_file="${TI_BLE_SDK_BASE}/src/config/build_components.opt" --cmd_file="${PROJECT_ROOT}/TOOLS/build_config.opt" -mv7M3 -O4 --opt_for_speed=0 --code_state=16 --abi=eabi -me -g --c99 --gcc --gen_func_subsections=on --display_error_number --diag_warning=255 --diag_wrap=off -DUSE_ICALL -DOSAL_SNV=1 -DFLASH_ROM_BUILD @@ -33,7 +33,6 @@ -I${TI_BLE_SDK_BASE}/src/examples/simple_peripheral/cc26xx/app -I${TI_BLE_SDK_BASE}/src/common/cc26xx -I${TI_BLE_SDK_BASE}/src/components/hal/src/target/_common - -I${TI_BLE_SDK_BASE}/src/components/hal/src/target/_common -I${TI_BLE_SDK_BASE}/src/components/hal/src/target -I${TI_BLE_SDK_BASE}/src/components/hal/src/target/_common/cc26xx -I${TI_BLE_SDK_BASE}/src/components/hal/src/inc @@ -53,14 +52,14 @@ -I${CC26XXWARE} -I${SRC_BLE_CORE}/rom " - linkerBuildOptions="-l${}libc.a -l${PROJECT_LOC}/TOOLS/lib_linker.cmd -l${TI_BLE_SDK_BASE}/src/rom/enc_lib/cc26xx_ecc_rom_api.a -l${TI_BLE_SDK_BASE}/src/rom/ble_rom_releases/04242014/ble_rom_patch.symbols -l${CC26XXWARE}/driverlib/bin/ccs/driverlib.lib -l${PROJECT_IMPORT_LOC}/../../ccs/config/ccs_linker_defines.cmd - -l${TI_BLE_SDK_BASE}/src/common/cc26xx/ccs/cc26xx_stack.cmd -x --entry_point=startup_entry --diag_suppress=16002-D --diag_suppress=16004-D --diag_suppress=10247-D --diag_suppress=10325-D --diag_suppress=10229-D" + linkerBuildOptions="-l${PROJECT_LOC}/TOOLS/lib_linker.cmd -l${TI_BLE_SDK_BASE}/src/rom/enc_lib/cc26xx_ecc_rom_api.a -l${TI_BLE_SDK_BASE}/src/rom/ble_rom_releases/04242014/ble_rom_patch.symbols -l${CC26XXWARE}/driverlib/bin/ccs/driverlib.lib -l${PROJECT_ROOT}/TOOLS/ccs_linker_defines.cmd + -l${TI_BLE_SDK_BASE}/src/common/cc26xx/ccs/cc26xx_stack.cmd -x --entry_point=startup_entry --diag_suppress=16002-D --diag_suppress=16004-D --diag_suppress=10247-D --diag_suppress=10325-D --diag_suppress=10229-D" description="" launchWizard="false" preBuildStep=""${TI_BLE_SDK_BASE}/tools/lib_search/lib_search.exe" ${PROJECT_ROOT}/TOOLS/build_config.opt "${TI_BLE_SDK_BASE}/tools/lib_search/params_split_cc2640.xml" ${TI_BLE_SDK_BASE}/blelib "${PROJECT_ROOT}/TOOLS/lib_linker.cmd"" - postBuildStep="${CG_TOOL_HEX} -order MS --memwidth=8 --romwidth=8 --intel -o ${ProjName}.hex ${ProjName}.out;${TI_BLE_SDK_BASE}/tools/frontier/frontier.exe ccs ${PROJECT_LOC}/${ConfigName}/${ProjName}_linkInfo.xml ${PROJECT_IMPORT_LOC}/../config/ccs_compiler_defines.bcfg ${PROJECT_IMPORT_LOC}/../config/ccs_linker_defines.cmd" + postBuildStep="${CG_TOOL_HEX} -order MS --memwidth=8 --romwidth=8 --intel -o ${ProjName}.hex ${ProjName}.out;${TI_BLE_SDK_BASE}/tools/frontier/frontier.exe ccs ${PROJECT_LOC}/${ConfigName}/${ProjName}_linkInfo.xml ${PROJECT_ROOT}/TOOLS/ccs_compiler_defines.bcfg ${PROJECT_ROOT}/TOOLS/ccs_linker_defines.cmd" > @@ -151,14 +150,16 @@ - + - + + + @@ -169,7 +170,7 @@ - + diff --git a/examples/cc2650lp/simple_central_audio_receiver/ccs/stack/simple_central_audio_receiver_cc2650lp_stack.projectspec b/examples/cc2650lp/simple_central_audio_receiver/ccs/stack/simple_central_audio_receiver_cc2650lp_stack.projectspec index 65dc92c..3275ae1 100644 --- a/examples/cc2650lp/simple_central_audio_receiver/ccs/stack/simple_central_audio_receiver_cc2650lp_stack.projectspec +++ b/examples/cc2650lp/simple_central_audio_receiver/ccs/stack/simple_central_audio_receiver_cc2650lp_stack.projectspec @@ -235,6 +235,8 @@ + + diff --git a/examples/cc2650lp/simple_eddystone/ccs/app/simple_eddystone_cc2650lp_app.projectspec b/examples/cc2650lp/simple_eddystone/ccs/app/simple_eddystone_cc2650lp_app.projectspec index 043d8ff..f385329 100644 --- a/examples/cc2650lp/simple_eddystone/ccs/app/simple_eddystone_cc2650lp_app.projectspec +++ b/examples/cc2650lp/simple_eddystone/ccs/app/simple_eddystone_cc2650lp_app.projectspec @@ -8,7 +8,8 @@ connection="common/targetdb/connections/TIXDS110_Connection.xml" toolChain="TI" linkerCommandFile="" - compilerBuildOptions="--cmd_file="${TI_BLE_SDK_BASE}/src/config/build_components.opt" --cmd_file="${WORKSPACE_LOC}/simple_eddystone_cc2650lp_stack/TOOLS/build_config.opt" --cmd_file="${WORKSPACE_LOC}/simple_eddystone_cc2650lp_stack/TOOLS/ccs_compiler_defines.bcfg" -mv7M3 --code_state=16 --abi=eabi -me -g --c99 --gcc --gen_func_subsections=on --display_error_number --diag_warning=255 --diag_wrap=off + compilerBuildOptions="--cmd_file="${TI_BLE_SDK_BASE}/src/config/build_components.opt" --cmd_file="${WORKSPACE_LOC}/simple_eddystone_cc2650lp_stack/TOOLS/build_config.opt" --cmd_file="${WORKSPACE_LOC}/simple_eddystone_cc2650lp_stack/TOOLS/ccs_compiler_defines.bcfg" + -mv7M3 -O4 --opt_for_speed=0 --code_state=16 --abi=eabi -me -g --c99 --gcc --gen_func_subsections=on --display_error_number --diag_warning=255 --diag_wrap=off -DUSE_ICALL -DPOWER_SAVING -DSBP_TASK_STACK_SIZE=700 @@ -51,7 +52,7 @@ -I${TI_BLE_SDK_BASE}/src/inc -I${CC26XXWARE} " - linkerBuildOptions="-l${}libc.a -l${CC26XXWARE}/driverlib/bin/ccs/driverlib.lib -l${TI_BLE_SDK_BASE}/src/rom/common_rom_releases/03282014/common_rom.symbols -l${PROJECT_IMPORT_LOC}/../../ccs/config/ccs_linker_defines.cmd + linkerBuildOptions="-l${}libc.a -l${CC26XXWARE}/driverlib/bin/ccs/driverlib.lib -l${TI_BLE_SDK_BASE}/src/rom/common_rom_releases/03282014/common_rom.symbols -l${PROJECT_ROOT}/../simple_eddystone_cc2650lp_stack/TOOLS/ccs_linker_defines.cmd -l${TI_BLE_SDK_BASE}/src/common/cc26xx/ccs/cc26xx_app.cmd -x --diag_suppress=16002-D --diag_suppress=16004-D --diag_suppress=10247-D --diag_suppress=10325-D --diag_suppress=10229-D" description="" launchWizard="false" @@ -232,4 +233,4 @@ - \ No newline at end of file + diff --git a/examples/cc2650lp/simple_eddystone/ccs/stack/simple_eddystone_cc2650lp_stack.projectspec b/examples/cc2650lp/simple_eddystone/ccs/stack/simple_eddystone_cc2650lp_stack.projectspec index fb00be6..9f6ec0d 100644 --- a/examples/cc2650lp/simple_eddystone/ccs/stack/simple_eddystone_cc2650lp_stack.projectspec +++ b/examples/cc2650lp/simple_eddystone/ccs/stack/simple_eddystone_cc2650lp_stack.projectspec @@ -8,7 +8,7 @@ connection="common/targetdb/connections/TIXDS110_Connection.xml" toolChain="TI" linkerCommandFile="" - compilerBuildOptions="--cmd_file="${TI_BLE_SDK_BASE}/src/config/build_components.opt" --cmd_file="${PROJECT_ROOT}/TOOLS/build_config.opt" -mv7M3 --code_state=16 --abi=eabi -me -g --c99 --gcc --gen_func_subsections=on --display_error_number --diag_warning=255 --diag_wrap=off + compilerBuildOptions="--cmd_file="${TI_BLE_SDK_BASE}/src/config/build_components.opt" --cmd_file="${PROJECT_ROOT}/TOOLS/build_config.opt" -mv7M3 -O4 --opt_for_speed=0 --code_state=16 --abi=eabi -me -g --c99 --gcc --gen_func_subsections=on --display_error_number --diag_warning=255 --diag_wrap=off -DUSE_ICALL -DOSAL_SNV=1 -DFLASH_ROM_BUILD @@ -52,13 +52,14 @@ -I${CC26XXWARE} -I${SRC_BLE_CORE}/rom " - linkerBuildOptions="-l${}libc.a -l${PROJECT_LOC}/TOOLS/lib_linker.cmd -l${TI_BLE_SDK_BASE}/src/rom/enc_lib/cc26xx_ecc_rom_api.a -l${TI_BLE_SDK_BASE}/src/rom/ble_rom_releases/04242014/ble_rom_patch.symbols -l${CC26XXWARE}/driverlib/bin/ccs/driverlib.lib -l${PROJECT_IMPORT_LOC}/../../ccs/config/ccs_linker_defines.cmd -l${TI_BLE_SDK_BASE}/src/common/cc26xx/ccs/cc26xx_stack.cmd -x --entry_point=startup_entry --diag_suppress=16002-D --diag_suppress=16004-D --diag_suppress=10247-D --diag_suppress=10325-D --diag_suppress=10229-D" + linkerBuildOptions="-l${PROJECT_LOC}/TOOLS/lib_linker.cmd -l${TI_BLE_SDK_BASE}/src/rom/enc_lib/cc26xx_ecc_rom_api.a -l${TI_BLE_SDK_BASE}/src/rom/ble_rom_releases/04242014/ble_rom_patch.symbols -l${CC26XXWARE}/driverlib/bin/ccs/driverlib.lib -l${PROJECT_ROOT}/TOOLS/ccs_linker_defines.cmd + -l${TI_BLE_SDK_BASE}/src/common/cc26xx/ccs/cc26xx_stack.cmd -x --entry_point=startup_entry --diag_suppress=16002-D --diag_suppress=16004-D --diag_suppress=10247-D --diag_suppress=10325-D --diag_suppress=10229-D" description="" launchWizard="false" preBuildStep=""${TI_BLE_SDK_BASE}/tools/lib_search/lib_search.exe" ${PROJECT_ROOT}/TOOLS/build_config.opt "${TI_BLE_SDK_BASE}/tools/lib_search/params_split_cc2640.xml" ${TI_BLE_SDK_BASE}/blelib "${PROJECT_ROOT}/TOOLS/lib_linker.cmd"" - postBuildStep="${CG_TOOL_HEX} -order MS --memwidth=8 --romwidth=8 --intel -o ${ProjName}.hex ${ProjName}.out;${TI_BLE_SDK_BASE}/tools/frontier/frontier.exe ccs ${PROJECT_LOC}/${ConfigName}/${ProjName}_linkInfo.xml ${PROJECT_IMPORT_LOC}/../config/ccs_compiler_defines.bcfg ${PROJECT_IMPORT_LOC}/../config/ccs_linker_defines.cmd" + postBuildStep="${CG_TOOL_HEX} -order MS --memwidth=8 --romwidth=8 --intel -o ${ProjName}.hex ${ProjName}.out;${TI_BLE_SDK_BASE}/tools/frontier/frontier.exe ccs ${PROJECT_LOC}/${ConfigName}/${ProjName}_linkInfo.xml ${PROJECT_ROOT}/TOOLS/ccs_compiler_defines.bcfg ${PROJECT_ROOT}/TOOLS/ccs_linker_defines.cmd" > @@ -149,6 +150,8 @@ + + diff --git a/examples/cc2650lp/simple_peripheral_audio_transmitter/ccs/stack/simple_peripheral_audio_transmitter_cc2650lp_stack.projectspec b/examples/cc2650lp/simple_peripheral_audio_transmitter/ccs/stack/simple_peripheral_audio_transmitter_cc2650lp_stack.projectspec index f2465c9..9541ddd 100644 --- a/examples/cc2650lp/simple_peripheral_audio_transmitter/ccs/stack/simple_peripheral_audio_transmitter_cc2650lp_stack.projectspec +++ b/examples/cc2650lp/simple_peripheral_audio_transmitter/ccs/stack/simple_peripheral_audio_transmitter_cc2650lp_stack.projectspec @@ -238,6 +238,8 @@ + + diff --git a/examples/cc2650lp/simple_peripheral_observer/ccs/app/simple_peripheral_observer_cc2650lp_app.projectspec b/examples/cc2650lp/simple_peripheral_observer/ccs/app/simple_peripheral_observer_cc2650lp_app.projectspec index 2d56a88..22c6da6 100644 --- a/examples/cc2650lp/simple_peripheral_observer/ccs/app/simple_peripheral_observer_cc2650lp_app.projectspec +++ b/examples/cc2650lp/simple_peripheral_observer/ccs/app/simple_peripheral_observer_cc2650lp_app.projectspec @@ -135,6 +135,12 @@ + + + + + + diff --git a/examples/cc2650lp/simple_peripheral_observer/ccs/stack/simple_peripheral_observer_cc2650lp_stack.projectspec b/examples/cc2650lp/simple_peripheral_observer/ccs/stack/simple_peripheral_observer_cc2650lp_stack.projectspec index 7794866..e05cd8b 100644 --- a/examples/cc2650lp/simple_peripheral_observer/ccs/stack/simple_peripheral_observer_cc2650lp_stack.projectspec +++ b/examples/cc2650lp/simple_peripheral_observer/ccs/stack/simple_peripheral_observer_cc2650lp_stack.projectspec @@ -240,6 +240,8 @@ + + diff --git a/examples/cc2650lp/simple_proprietary_beacon/ccs/app/simple_proprietary_beacon_cc2650lp_app.projectspec b/examples/cc2650lp/simple_proprietary_beacon/ccs/app/simple_proprietary_beacon_cc2650lp_app.projectspec index c38e53e..7c833ac 100644 --- a/examples/cc2650lp/simple_proprietary_beacon/ccs/app/simple_proprietary_beacon_cc2650lp_app.projectspec +++ b/examples/cc2650lp/simple_proprietary_beacon/ccs/app/simple_proprietary_beacon_cc2650lp_app.projectspec @@ -8,7 +8,8 @@ connection="common/targetdb/connections/TIXDS110_Connection.xml" toolChain="TI" linkerCommandFile="" - compilerBuildOptions="--cmd_file="${TI_BLE_SDK_BASE}/src/config/build_components.opt" --cmd_file="${WORKSPACE_LOC}/simple_proprietary_beacon_cc2650lp_stack/TOOLS/build_config.opt" --cmd_file="${WORKSPACE_LOC}/simple_proprietary_beacon_cc2650lp_stack/TOOLS/ccs_compiler_defines.bcfg" -mv7M3 --code_state=16 --abi=eabi -me -g --c99 --gcc --gen_func_subsections=on --display_error_number --diag_warning=255 --diag_wrap=off + compilerBuildOptions="--cmd_file="${TI_BLE_SDK_BASE}/src/config/build_components.opt" --cmd_file="${WORKSPACE_LOC}/simple_proprietary_beacon_cc2650lp_stack/TOOLS/build_config.opt" --cmd_file="${WORKSPACE_LOC}/simple_proprietary_beacon_cc2650lp_stack/TOOLS/ccs_compiler_defines.bcfg" + -mv7M3 -O4 --opt_for_speed=0 --code_state=16 --abi=eabi -me -g --c99 --gcc --gen_func_subsections=on --display_error_number --diag_warning=255 --diag_wrap=off -DUSE_ICALL -DPOWER_SAVING -DSBP_TASK_STACK_SIZE=700 diff --git a/examples/cc2650lp/simple_proprietary_beacon/ccs/stack/simple_proprietary_beacon_cc2650lp_stack.projectspec b/examples/cc2650lp/simple_proprietary_beacon/ccs/stack/simple_proprietary_beacon_cc2650lp_stack.projectspec index 95a4699..901264d 100644 --- a/examples/cc2650lp/simple_proprietary_beacon/ccs/stack/simple_proprietary_beacon_cc2650lp_stack.projectspec +++ b/examples/cc2650lp/simple_proprietary_beacon/ccs/stack/simple_proprietary_beacon_cc2650lp_stack.projectspec @@ -8,7 +8,7 @@ connection="common/targetdb/connections/TIXDS110_Connection.xml" toolChain="TI" linkerCommandFile="" - compilerBuildOptions="--cmd_file="${TI_BLE_SDK_BASE}/src/config/build_components.opt" --cmd_file="${PROJECT_ROOT}/TOOLS/build_config.opt" -mv7M3 --code_state=16 --abi=eabi -me -g --c99 --gcc --gen_func_subsections=on --display_error_number --diag_warning=255 --diag_wrap=off + compilerBuildOptions="--cmd_file="${TI_BLE_SDK_BASE}/src/config/build_components.opt" --cmd_file="${PROJECT_ROOT}/TOOLS/build_config.opt" -mv7M3 -O4 --opt_for_speed=0 --code_state=16 --abi=eabi -me -g --c99 --gcc --gen_func_subsections=on --display_error_number --diag_warning=255 --diag_wrap=off -DUSE_ICALL -DOSAL_SNV=1 -DFLASH_ROM_BUILD @@ -33,7 +33,6 @@ -I${TI_BLE_SDK_BASE}/src/examples/simple_peripheral/cc26xx/app -I${TI_BLE_SDK_BASE}/src/common/cc26xx -I${TI_BLE_SDK_BASE}/src/components/hal/src/target/_common - -I${TI_BLE_SDK_BASE}/src/components/hal/src/target/_common -I${TI_BLE_SDK_BASE}/src/components/hal/src/target -I${TI_BLE_SDK_BASE}/src/components/hal/src/target/_common/cc26xx -I${TI_BLE_SDK_BASE}/src/components/hal/src/inc @@ -53,14 +52,14 @@ -I${CC26XXWARE} -I${SRC_BLE_CORE}/rom " - linkerBuildOptions="-l${}libc.a -l${PROJECT_LOC}/TOOLS/lib_linker.cmd -l${TI_BLE_SDK_BASE}/src/rom/enc_lib/cc26xx_ecc_rom_api.a -l${TI_BLE_SDK_BASE}/src/rom/ble_rom_releases/04242014/ble_rom_patch.symbols -l${CC26XXWARE}/driverlib/bin/ccs/driverlib.lib -l${PROJECT_IMPORT_LOC}/../../ccs/config/ccs_linker_defines.cmd - -l${TI_BLE_SDK_BASE}/src/common/cc26xx/ccs/cc26xx_stack.cmd -x --entry_point=startup_entry --diag_suppress=16002-D --diag_suppress=16004-D --diag_suppress=10247-D --diag_suppress=10325-D --diag_suppress=10229-D" + linkerBuildOptions="-l${PROJECT_LOC}/TOOLS/lib_linker.cmd -l${TI_BLE_SDK_BASE}/src/rom/enc_lib/cc26xx_ecc_rom_api.a -l${TI_BLE_SDK_BASE}/src/rom/ble_rom_releases/04242014/ble_rom_patch.symbols -l${CC26XXWARE}/driverlib/bin/ccs/driverlib.lib -l${PROJECT_ROOT}/TOOLS/ccs_linker_defines.cmd + -l${TI_BLE_SDK_BASE}/src/common/cc26xx/ccs/cc26xx_stack.cmd -x --entry_point=startup_entry --diag_suppress=16002-D --diag_suppress=16004-D --diag_suppress=10247-D --diag_suppress=10325-D --diag_suppress=10229-D" description="" launchWizard="false" preBuildStep=""${TI_BLE_SDK_BASE}/tools/lib_search/lib_search.exe" ${PROJECT_ROOT}/TOOLS/build_config.opt "${TI_BLE_SDK_BASE}/tools/lib_search/params_split_cc2640.xml" ${TI_BLE_SDK_BASE}/blelib "${PROJECT_ROOT}/TOOLS/lib_linker.cmd"" - postBuildStep="${CG_TOOL_HEX} -order MS --memwidth=8 --romwidth=8 --intel -o ${ProjName}.hex ${ProjName}.out;${TI_BLE_SDK_BASE}/tools/frontier/frontier.exe ccs ${PROJECT_LOC}/${ConfigName}/${ProjName}_linkInfo.xml ${PROJECT_IMPORT_LOC}/../config/ccs_compiler_defines.bcfg ${PROJECT_IMPORT_LOC}/../config/ccs_linker_defines.cmd" + postBuildStep="${CG_TOOL_HEX} -order MS --memwidth=8 --romwidth=8 --intel -o ${ProjName}.hex ${ProjName}.out;${TI_BLE_SDK_BASE}/tools/frontier/frontier.exe ccs ${PROJECT_LOC}/${ConfigName}/${ProjName}_linkInfo.xml ${PROJECT_ROOT}/TOOLS/ccs_compiler_defines.bcfg ${PROJECT_ROOT}/TOOLS/ccs_linker_defines.cmd" > @@ -151,6 +150,8 @@ + + @@ -169,7 +170,7 @@ - + diff --git a/examples/cc2650lp/spp_ble_client/ccs/app/spp_ble_client_cc2650lp_app.projectspec b/examples/cc2650lp/spp_ble_client/ccs/app/spp_ble_client_cc2650lp_app.projectspec index 2797f92..d4bd4fd 100644 --- a/examples/cc2650lp/spp_ble_client/ccs/app/spp_ble_client_cc2650lp_app.projectspec +++ b/examples/cc2650lp/spp_ble_client/ccs/app/spp_ble_client_cc2650lp_app.projectspec @@ -135,6 +135,12 @@ + + + + + + diff --git a/examples/cc2650lp/spp_ble_client/ccs/stack/spp_ble_client_cc2650lp_stack.projectspec b/examples/cc2650lp/spp_ble_client/ccs/stack/spp_ble_client_cc2650lp_stack.projectspec index 2361073..2f1cfed 100644 --- a/examples/cc2650lp/spp_ble_client/ccs/stack/spp_ble_client_cc2650lp_stack.projectspec +++ b/examples/cc2650lp/spp_ble_client/ccs/stack/spp_ble_client_cc2650lp_stack.projectspec @@ -240,6 +240,8 @@ + + diff --git a/examples/cc2650lp/spp_ble_server/ccs/app/spp_ble_server_cc2650lp_app.projectspec b/examples/cc2650lp/spp_ble_server/ccs/app/spp_ble_server_cc2650lp_app.projectspec index 6b70df2..3196a08 100644 --- a/examples/cc2650lp/spp_ble_server/ccs/app/spp_ble_server_cc2650lp_app.projectspec +++ b/examples/cc2650lp/spp_ble_server/ccs/app/spp_ble_server_cc2650lp_app.projectspec @@ -134,6 +134,12 @@ + + + + + + diff --git a/examples/cc2650lp/spp_ble_server/ccs/stack/spp_ble_server_cc2650lp_stack.projectspec b/examples/cc2650lp/spp_ble_server/ccs/stack/spp_ble_server_cc2650lp_stack.projectspec index a0fa0a7..d56c658 100644 --- a/examples/cc2650lp/spp_ble_server/ccs/stack/spp_ble_server_cc2650lp_stack.projectspec +++ b/examples/cc2650lp/spp_ble_server/ccs/stack/spp_ble_server_cc2650lp_stack.projectspec @@ -240,6 +240,8 @@ + + diff --git a/examples/cc2650lp/throughput_example_central/ccs/stack/throughput_example_central_cc2650lp_stack.projectspec b/examples/cc2650lp/throughput_example_central/ccs/stack/throughput_example_central_cc2650lp_stack.projectspec index c9c4201..400554a 100644 --- a/examples/cc2650lp/throughput_example_central/ccs/stack/throughput_example_central_cc2650lp_stack.projectspec +++ b/examples/cc2650lp/throughput_example_central/ccs/stack/throughput_example_central_cc2650lp_stack.projectspec @@ -236,6 +236,8 @@ + + diff --git a/examples/cc2650lp/throughput_example_peripheral/ccs/stack/throughput_example_peripheral_cc2650lp_stack.projectspec b/examples/cc2650lp/throughput_example_peripheral/ccs/stack/throughput_example_peripheral_cc2650lp_stack.projectspec index 1737d34..31bb42a 100644 --- a/examples/cc2650lp/throughput_example_peripheral/ccs/stack/throughput_example_peripheral_cc2650lp_stack.projectspec +++ b/examples/cc2650lp/throughput_example_peripheral/ccs/stack/throughput_example_peripheral_cc2650lp_stack.projectspec @@ -243,6 +243,8 @@ + + diff --git a/examples/cc2650rc/hid_adv_remote_privacy/ccs/app/hid_adv_remote_privacy_cc2650rc_app.projectspec b/examples/cc2650rc/hid_adv_remote_privacy/ccs/app/hid_adv_remote_privacy_cc2650rc_app.projectspec index 05500b2..475d94b 100644 --- a/examples/cc2650rc/hid_adv_remote_privacy/ccs/app/hid_adv_remote_privacy_cc2650rc_app.projectspec +++ b/examples/cc2650rc/hid_adv_remote_privacy/ccs/app/hid_adv_remote_privacy_cc2650rc_app.projectspec @@ -7,7 +7,7 @@ cgtVersion="5.2.6" connection="common/targetdb/connections/TIXDS110_Connection.xml" toolChain="TI" - linkerCommandFile="cc26xx_app.cmd" + linkerCommandFile="" compilerBuildOptions=" --cmd_file=${TI_BLE_SDK_BASE}/src/config/build_components.opt --cmd_file=${PROJECT_IMPORT_LOC}/../../iar/stack/build_config.opt @@ -18,6 +18,7 @@ -me -g -O4 + --opt_for_speed=0 --c99 --gcc --gen_func_subsections=on @@ -75,6 +76,7 @@ -l${PROJECT_IMPORT_LOC}/../config/ccs_linker_defines.cmd -l${TI_BLE_SDK_BASE}/src/common/cc26xx/ccs/cc26xx_app.cmd -l${CC26XXWARE}/driverlib/bin/ccs/driverlib.lib + -l${TI_BLE_SDK_BASE}/src/rom/common_rom_releases/03282014/common_rom.symbols --diag_suppress=16002-D --diag_suppress=10247-D --diag_suppress=10325-D @@ -97,7 +99,8 @@ - + diff --git a/examples/cc2650rc/hid_adv_remote_privacy/ccs/stack/hid_adv_remote_privacy_cc2650rc_stack.projectspec b/examples/cc2650rc/hid_adv_remote_privacy/ccs/stack/hid_adv_remote_privacy_cc2650rc_stack.projectspec index 4761d06..d60aaae 100644 --- a/examples/cc2650rc/hid_adv_remote_privacy/ccs/stack/hid_adv_remote_privacy_cc2650rc_stack.projectspec +++ b/examples/cc2650rc/hid_adv_remote_privacy/ccs/stack/hid_adv_remote_privacy_cc2650rc_stack.projectspec @@ -8,37 +8,8 @@ connection="common/targetdb/connections/TIXDS110_Connection.xml" toolChain="TI" linkerCommandFile="cc26xx_stack.cmd" - - preBuildStep=" - "${TI_BLE_SDK_BASE}/tools/lib_search/lib_search.exe" - ${PROJECT_IMPORT_LOC}/../../iar/stack/build_config.opt - "${TI_BLE_SDK_BASE}/tools/lib_search/params_split_cc2640.xml" - ${TI_BLE_SDK_BASE}/blelib - "${PROJECT_IMPORT_LOC}/../../iar/config/lib_linker.cmd" - " - - postBuildStep=" - ${CG_TOOL_HEX} -order MS --memwidth=8 --romwidth=8 --intel -o ${ProjName}.hex ${ProjName}.out; - ${TI_BLE_SDK_BASE}/tools/frontier/frontier.exe ccs ${PROJECT_LOC}/${ConfigName}/${ProjName}_linkInfo.xml ${PROJECT_IMPORT_LOC}/../config/ccs_compiler_defines.bcfg ${PROJECT_IMPORT_LOC}/../config/ccs_linker_defines.cmd - " - - compilerBuildOptions=" - --cmd_file="${PROJECT_IMPORT_LOC}/../../iar/stack/build_config.opt" - --cmd_file="${TI_BLE_SDK_BASE}/src/config/build_components.opt" - -O4 - --opt_for_speed=0 - -mv7M3 - --code_state=16 - --abi=eabi - -me - --c99 - --display_error_number - --diag_wrap=off - --diag_suppress=48 - --diag_suppress=16004 - --diag_warning=225 - --diag_warning=2 - --c99 + compilerBuildOptions="--cmd_file="${TI_BLE_SDK_BASE}/src/config/build_components.opt" --cmd_file="${PROJECT_ROOT}/TOOLS/build_config.opt" + -mv7M3 -O4 --opt_for_speed=0 --code_state=16 --abi=eabi -me --c99 --display_error_number --diag_wrap=off --diag_suppress=48 --diag_suppress=16004 --diag_warning=225 --diag_warning=2 --c99 -DUSE_ICALL -DFLASH_ROM_BUILD @@ -87,11 +58,11 @@ " linkerBuildOptions=" - -l${PROJECT_IMPORT_LOC}/../../iar/config/lib_linker.cmd + -l${PROJECT_LOC}/TOOLS/lib_linker.cmd -l${TI_BLE_SDK_BASE}/src/rom/enc_lib/cc26xx_ecc_rom_api.a -l${TI_BLE_SDK_BASE}/src/rom/ble_rom_releases/04242014/ble_rom_patch.symbols -l${CC26XXWARE}/driverlib/bin/ccs/driverlib.lib - -llibc.a -x + -x --entry_point=startup_entry --diag_suppress=16002-D --diag_suppress=10247-D @@ -100,6 +71,21 @@ " description="" launchWizard="false" + + preBuildStep=" + "${TI_BLE_SDK_BASE}/tools/lib_search/lib_search.exe" + ${PROJECT_ROOT}/TOOLS/build_config.opt + "${TI_BLE_SDK_BASE}/tools/lib_search/params_split_cc2640.xml" + ${TI_BLE_SDK_BASE}/blelib + "${PROJECT_ROOT}/TOOLS/lib_linker.cmd" + " + + postBuildStep=" + ${CG_TOOL_HEX} -order MS --memwidth=8 --romwidth=8 --intel -o ${ProjName}.hex ${ProjName}.out; + ${TI_BLE_SDK_BASE}/tools/frontier/frontier.exe ccs ${PROJECT_LOC}/${ConfigName}/${ProjName}_linkInfo.xml ${PROJECT_ROOT}/TOOLS/ccs_compiler_defines.bcfg ${PROJECT_ROOT}/TOOLS/ccs_linker_defines.cmd + " + + > @@ -186,6 +172,8 @@ + + @@ -238,11 +226,11 @@ - + - + - + From efade629249504cf5842f7b96dbf9660e8ed848a Mon Sep 17 00:00:00 2001 From: Thomas Kopriva Date: Fri, 19 May 2017 15:31:35 -0500 Subject: [PATCH 16/19] Merge pull request #45 in SA/ble_examples from feature/spp_ble_fixes to ble_examples-2.2-develop Squashed commit of the following: commit b228a7454d5be82bd26c0f8c24b052c825b0e2cc Author: Haq Date: Fri May 19 12:42:06 2017 -0700 updated with some enhancements --- docs/spp_ble.md | 2 +- .../iar/config/iar_boundary.bdef | 6 +- .../iar/config/iar_boundary.xcl | 6 +- .../iar/config/iar_boundary.bdef | 6 +- .../iar/config/iar_boundary.xcl | 6 +- src/components/sdi/inc/sdi_task.h | 9 +++ src/components/sdi/sdi_task.c | 20 +++++-- .../cc26xx/app/spp_ble_client.c | 58 +++++++++++-------- .../cc26xx/app/spp_ble_server.c | 35 +++++++---- 9 files changed, 96 insertions(+), 52 deletions(-) diff --git a/docs/spp_ble.md b/docs/spp_ble.md index fd9fbe5..6ec43e0 100644 --- a/docs/spp_ble.md +++ b/docs/spp_ble.md @@ -51,7 +51,7 @@ Running the demo is as simple and compiling and loading the code, then hooking u - You can use the terminal to send data from your PC to the LaunchPad, and also display the info sent from one device to another. - You will need to open two instances of the terminal program to, one to communicate with each board. - Follow the steps from our [FAQ](faq.md) to connect to the LaunchPad boards - - **Please note that the SPP project uses a baud rate of 921600 not 115200** + - **Please note that the SPP project uses the default baud rate of 115200** 2. Power the boards inividually and verify they are initialized - The client will blink the green LED twice at initialzation. It will also display `Auto connecting...` on the terminal diff --git a/examples/cc2650lp/spp_ble_client/iar/config/iar_boundary.bdef b/examples/cc2650lp/spp_ble_client/iar/config/iar_boundary.bdef index e0690ce..065606a 100644 --- a/examples/cc2650lp/spp_ble_client/iar/config/iar_boundary.bdef +++ b/examples/cc2650lp/spp_ble_client/iar/config/iar_boundary.bdef @@ -1,10 +1,10 @@ /* -** Stack Frontier Generator 1.1.0 (2016-11-02 11:47:45.467000) +** Stack Frontier Generator 1.1.0 (2017-05-19 12:28:56.481000) ** ** WARNING - Auto-generated file. Modifications could be lost! */ --D ICALL_STACK0_ADDR=0x0000e2f5 --D ICALL_STACK0_START=0x0000e2f4 +-D ICALL_STACK0_ADDR=0x0000e2f9 +-D ICALL_STACK0_START=0x0000e2f8 -D ICALL_RAM0_START=0x20004320 diff --git a/examples/cc2650lp/spp_ble_client/iar/config/iar_boundary.xcl b/examples/cc2650lp/spp_ble_client/iar/config/iar_boundary.xcl index 4e412ca..ccbdab9 100644 --- a/examples/cc2650lp/spp_ble_client/iar/config/iar_boundary.xcl +++ b/examples/cc2650lp/spp_ble_client/iar/config/iar_boundary.xcl @@ -1,10 +1,10 @@ /* -** Stack Frontier Generator 1.1.0 (2016-11-02 11:47:45.467000) +** Stack Frontier Generator 1.1.0 (2017-05-19 12:28:56.481000) ** ** WARNING - Auto-generated file. Modifications could be lost! */ --config_def ICALL_RAM0_START=0x20004320 ---config_def ICALL_STACK0_START=0x0000e2f4 ---config_def ICALL_STACK0_ADDR=0x0000e2f5 +--config_def ICALL_STACK0_START=0x0000e2f8 +--config_def ICALL_STACK0_ADDR=0x0000e2f9 diff --git a/examples/cc2650lp/spp_ble_server/iar/config/iar_boundary.bdef b/examples/cc2650lp/spp_ble_server/iar/config/iar_boundary.bdef index abd0dbf..686f8fb 100644 --- a/examples/cc2650lp/spp_ble_server/iar/config/iar_boundary.bdef +++ b/examples/cc2650lp/spp_ble_server/iar/config/iar_boundary.bdef @@ -1,10 +1,10 @@ /* -** Stack Frontier Generator 1.1.0 (2016-11-02 14:24:42.407000) +** Stack Frontier Generator 1.1.0 (2017-05-19 12:13:41.482000) ** ** WARNING - Auto-generated file. Modifications could be lost! */ --D ICALL_STACK0_ADDR=0x0000f811 --D ICALL_STACK0_START=0x0000f810 +-D ICALL_STACK0_ADDR=0x0000f815 +-D ICALL_STACK0_START=0x0000f814 -D ICALL_RAM0_START=0x20004320 diff --git a/examples/cc2650lp/spp_ble_server/iar/config/iar_boundary.xcl b/examples/cc2650lp/spp_ble_server/iar/config/iar_boundary.xcl index 4cc99e3..20a5a59 100644 --- a/examples/cc2650lp/spp_ble_server/iar/config/iar_boundary.xcl +++ b/examples/cc2650lp/spp_ble_server/iar/config/iar_boundary.xcl @@ -1,10 +1,10 @@ /* -** Stack Frontier Generator 1.1.0 (2016-11-02 14:24:42.407000) +** Stack Frontier Generator 1.1.0 (2017-05-19 12:13:41.482000) ** ** WARNING - Auto-generated file. Modifications could be lost! */ --config_def ICALL_RAM0_START=0x20004320 ---config_def ICALL_STACK0_START=0x0000f810 ---config_def ICALL_STACK0_ADDR=0x0000f811 +--config_def ICALL_STACK0_START=0x0000f814 +--config_def ICALL_STACK0_ADDR=0x0000f815 diff --git a/src/components/sdi/inc/sdi_task.h b/src/components/sdi/inc/sdi_task.h index 55ddedc..a129388 100644 --- a/src/components/sdi/inc/sdi_task.h +++ b/src/components/sdi/inc/sdi_task.h @@ -115,6 +115,15 @@ extern void SDITask_registerIncomingRXEventAppCB(sdiIncomingEventCBack_t appRxCB // ----------------------------------------------------------------------------- extern void SDITask_sendToUART(uint8_t *pMsg, uint16_t length); +// ----------------------------------------------------------------------------- +//! \brief API for application task to set packet data size to send over the air. +//! +//! \param[in] mtuSize GATT MTU size. +//! +//! \return void +// ----------------------------------------------------------------------------- +extern void SDITask_setAppDataSize(uint16_t mtuSize); + #ifdef __cplusplus { #endif // extern "C" diff --git a/src/components/sdi/sdi_task.c b/src/components/sdi/sdi_task.c index 5d2da84..9fae3d4 100644 --- a/src/components/sdi/sdi_task.c +++ b/src/components/sdi/sdi_task.c @@ -87,7 +87,7 @@ #define SDITASK_PRIORITY 2 //! \brief Max bytes received from UART send to App -#define MAX_UART_LENGTH 128 +#define DEFAULT_APP_DATA_LENGTH 20 // **************************************************************************** // typedefs @@ -144,6 +144,7 @@ ICall_EntityID sdiAppEntityID = 0; //! rerouting of messages to application. //! static sdiIncomingEventCBack_t incomingRXEventAppCBFunc = NULL; +static uint16 maxAppDataSize = DEFAULT_APP_DATA_LENGTH; //***************************************************************************** // function prototypes @@ -169,6 +170,15 @@ static void SDITask_MRDYEventCB(int size); //! static void SDITask_ProcessTXQ(void); +// ----------------------------------------------------------------------------- +//! \brief Initialization for the SDI Thread +//! +//! \return void +// ----------------------------------------------------------------------------- +void SDITask_setAppDataSize(uint16 mtuSize) +{ + maxAppDataSize = mtuSize - 3; //subtract GATT Notification overhead: 1 byte opcode, 2 bytes conn. handle +} // ----------------------------------------------------------------------------- //! \brief Initialization for the SDI Thread @@ -249,9 +259,9 @@ static void SDITask_process(void) { length = SDIRxBuf_GetRxBufLen(); - if(length > MAX_UART_LENGTH) + if(length > maxAppDataSize) { - lengthRead = MAX_UART_LENGTH; + lengthRead = (maxAppDataSize & 0xFF); }else { lengthRead = (length & 0xFF); @@ -269,8 +279,8 @@ static void SDITask_process(void) { incomingRXEventAppCBFunc( UART_DATA_EVT , buf, lengthRead); } - - if(length > MAX_UART_LENGTH) + + if(length > maxAppDataSize) { // Additional bytes to collect, preserve the flag and repost // to the semaphore diff --git a/src/examples/spp_ble_client/cc26xx/app/spp_ble_client.c b/src/examples/spp_ble_client/cc26xx/app/spp_ble_client.c index 9b55ba5..a1a0d64 100644 --- a/src/examples/spp_ble_client/cc26xx/app/spp_ble_client.c +++ b/src/examples/spp_ble_client/cc26xx/app/spp_ble_client.c @@ -219,7 +219,7 @@ typedef struct // App event passed from profiles. typedef struct { - uint8_t data[SERIALPORTSERVICE_DATA_LEN]; // New data + uint8_t *pData; // New data uint8_t length; // New status } sbcUARTEvt_t; @@ -323,6 +323,9 @@ static bool procedureInProgress = FALSE; // Maximum PDU size (default = 27 octets) static uint16 maxPduSize; +// Maximum MTU size (default = 23 octets) +static uint16 currentMTUSize; + // Pins that are actively used by the application static PIN_Config SPPBLEAppPinTable[] = { @@ -644,26 +647,26 @@ static void SPPBLEClient_taskFxn(UArg a0, UArg a1) // Process message. bStatus_t retVal = FAILURE; - // Do a write - attWriteReq_t req; - - //Allocate data bytes to send over the air - req.pValue = GATT_bm_alloc(connHandle, ATT_WRITE_REQ, pMsg->length, NULL); - - if ( (req.pValue != NULL) && charDataHdl) - { - req.handle = charDataHdl; //handle for Value of Data characteristic found during service discovery - req.len = pMsg->length; - memcpy(req.pValue, pMsg->data, pMsg->length); - req.sig = FALSE; - req.cmd = TRUE; + // Do a write + attWriteReq_t req; + + //Allocate data bytes to send over the air + req.pValue = GATT_bm_alloc(connHandle, ATT_WRITE_REQ, pMsg->length, NULL); + + if ( (req.pValue != NULL) && charDataHdl) + { + req.handle = charDataHdl; //handle for Value of Data characteristic found during service discovery + req.len = pMsg->length; + memcpy(req.pValue, pMsg->pData, pMsg->length); + req.sig = FALSE; + req.cmd = TRUE; retVal = GATT_WriteNoRsp(connHandle, &req); if ( retVal != SUCCESS ) { GATT_bm_free((gattMsg_t *)&req, ATT_WRITE_REQ); - DEBUG("FAIL FROM CLIENT"); + DEBUG("FAIL FROM CLIENT: "); DEBUG((uint8_t*)convInt32ToText((int)retVal)); DEBUG_NEWLINE(); }else { //Remove from the queue @@ -672,6 +675,7 @@ static void SPPBLEClient_taskFxn(UArg a0, UArg a1) //Toggle LED to indicate data received from UART terminal and sent over the air //SPPBLEClient_toggleLed(Board_GLED, Board_LED_TOGGLE); + ICall_freeMsg(pMsg->pData); // Free the space from the message. ICall_free(pMsg); @@ -1203,6 +1207,11 @@ static void SPPBLEClient_processGATTMsg(gattMsgEvent_t *pMsg) } else if (pMsg->method == ATT_MTU_UPDATED_EVENT) { + currentMTUSize = pMsg->msg.mtuEvt.MTU; + SDITask_setAppDataSize(currentMTUSize); + + DEBUG("MTU Size: "); DEBUG((uint8_t*)convInt32ToText((int)currentMTUSize)); DEBUG_NEWLINE(); + // MTU size updated Display_print1(dispHandle, 4, 0, "MTU Size: %d", pMsg->msg.mtuEvt.MTU); } @@ -1538,14 +1547,11 @@ static void SPPBLEClient_processGATTDiscEvent(gattMsgEvent_t *pMsg) if (pMsg->method == ATT_EXCHANGE_MTU_RSP) { uint8_t uuid[ATT_UUID_SIZE] = { TI_BASE_UUID_128(SERIALPORTSERVICE_SERV_UUID) }; - - DEBUG("Server receive MTU: "); - DEBUG((uint8_t*)convInt32ToText((int)pMsg->msg.exchangeMTURsp.serverRxMTU)); DEBUG_NEWLINE(); - + discState = BLE_DISC_STATE_SVC; - - DEBUG("Discovering services..."); - + + DEBUG("Discovering services..."); DEBUG_NEWLINE(); + // Discovery simple BLE service VOID GATT_DiscPrimaryServiceByUUID(connHandle, uuid, ATT_UUID_SIZE, selfEntity); @@ -1900,7 +1906,13 @@ void SPPBLEClient_enqueueUARTMsg(uint8_t event, uint8_t *data, uint8_t len) // Create dynamic pointer to message. if (pMsg = ICall_malloc(sizeof(sbcUARTEvt_t))) { - memcpy(pMsg->data , data, len); + + pMsg->pData = (uint8 *)ICall_allocMsg(len); + if(pMsg->pData) + { + //payload + memcpy(pMsg->pData , data, len); + } pMsg->length = len; // Enqueue the message. diff --git a/src/examples/spp_ble_server/cc26xx/app/spp_ble_server.c b/src/examples/spp_ble_server/cc26xx/app/spp_ble_server.c index 27fbf06..4e9f339 100644 --- a/src/examples/spp_ble_server/cc26xx/app/spp_ble_server.c +++ b/src/examples/spp_ble_server/cc26xx/app/spp_ble_server.c @@ -173,9 +173,9 @@ typedef struct typedef struct { uint8_t event; // Type of event - uint8_t data[SERIALPORTSERVICE_DATA_LEN]; // New data + uint8_t *pData; // New data uint8_t length; // New status -} sbpUARTEvt_t; //size = 22 bytes +} sbpUARTEvt_t; /********************************************************************* * GLOBAL VARIABLES */ @@ -186,6 +186,9 @@ typedef struct // Global pin resources PIN_State pinGpioState; PIN_Handle hGpioPin; + +uint16 currentMTUSize; + /********************************************************************* * LOCAL VARIABLES */ @@ -304,7 +307,7 @@ static uint8_t rspTxRetry = 0; static PIN_Config SPPBLEAppPinTable[] = { Board_RLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ - Board_LED2 | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ + Board_GLED | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* LED initially off */ PIN_TERMINATE }; @@ -708,7 +711,7 @@ static void SPPBLEServer_taskFxn(UArg a0, UArg a1) case SBP_UART_DATA_EVT: { //Send the notification - retVal = SerialPortService_SetParameter(SERIALPORTSERVICE_CHAR_DATA, pMsg->length, pMsg->data); + retVal = SerialPortService_SetParameter(SERIALPORTSERVICE_CHAR_DATA, pMsg->length, pMsg->pData); if(retVal != SUCCESS) { @@ -724,8 +727,10 @@ static void SPPBLEServer_taskFxn(UArg a0, UArg a1) Util_dequeueMsg(appUARTMsgQueue); //Toggle LED to indicate data received from UART terminal and sent over the air - //SPPBLEServer_toggleLed(Board_LED2, Board_LED_TOGGLE); - + //SPPBLEServer_toggleLed(Board_GLED, Board_LED_TOGGLE); + + //Deallocate data payload being transmitted. + ICall_freeMsg(pMsg->pData); // Free the space from the message. ICall_free(pMsg); } @@ -875,9 +880,10 @@ static uint8_t SPPBLEServer_processGATTMsg(gattMsgEvent_t *pMsg) else if (pMsg->method == ATT_MTU_UPDATED_EVENT) { // MTU size updated - Display_print1(dispHandle, 5, 0, "MTU Size: $d", pMsg->msg.mtuEvt.MTU); - DEBUG("MTU Updated: "); - DEBUG((uint8_t*)convInt32ToText((int)pMsg->msg.mtuEvt.MTU)); DEBUG_NEWLINE(); + currentMTUSize = pMsg->msg.mtuEvt.MTU; + SDITask_setAppDataSize(currentMTUSize); + Display_print1(dispHandle, 5, 0, "MTU Size: %d", currentMTUSize); + DEBUG("MTU Size: "); DEBUG((uint8_t*)convInt32ToText((int)currentMTUSize)); DEBUG_NEWLINE(); } // Free message payload. Needed only for ATT Protocol messages @@ -1103,6 +1109,7 @@ static void SPPBLEServer_processStateChangeEvt(gaprole_States_t newState) { Display_print1(dispHandle, 2, 0, "Num Conns: %d", (uint16_t)numActive); Display_print0(dispHandle, 3, 0, Util_convertBdAddr2Str(linkInfo.addr)); + DEBUG("CONNECTED..."); DEBUG_NEWLINE(); } else { @@ -1151,6 +1158,7 @@ static void SPPBLEServer_processStateChangeEvt(gaprole_States_t newState) Display_print0(dispHandle, 2, 0, "Disconnected"); + DEBUG("DISCONNECTED..."); DEBUG_NEWLINE(); // Clear remaining lines //Display_clearLines(dispHandle, 3, 5); break; @@ -1159,7 +1167,7 @@ static void SPPBLEServer_processStateChangeEvt(gaprole_States_t newState) SPPBLEServer_freeAttRsp(bleNotConnected); Display_print0(dispHandle, 2, 0, "Timed Out"); - + DEBUG("DISCONNECTED AFTER TIMEOUT..."); DEBUG_NEWLINE(); // Clear remaining lines //Display_clearLines(dispHandle, 3, 5); @@ -1314,7 +1322,12 @@ void SPPBLEServer_enqueueUARTMsg(uint8_t event, uint8_t *data, uint8_t len) { pMsg->event = event; - memcpy(pMsg->data , data, len); + pMsg->pData = (uint8 *)ICall_allocMsg(len); + if(pMsg->pData) + { + //payload + memcpy(pMsg->pData , data, len); + } pMsg->length = len; // Enqueue the message. From 99165b81737c4c6c4a619fdb0fdf2846c705d783 Mon Sep 17 00:00:00 2001 From: Thomas Kopriva Date: Fri, 19 May 2017 15:37:14 -0500 Subject: [PATCH 17/19] Merge pull request #31 in SA/ble_examples from LPRFAPPS-777_audio_receiver_memory_leak_fix to ble_examples-2.2-develop Squashed commit of the following: commit 05d9d5873ffb6f7a262d54ff00d542b7e7439a87 Author: Marie Hernes Date: Wed Apr 5 16:05:12 2017 +0200 LPRFAPPS-777 Fixed memory leak commit 539add28313d7b7620eb54b734f6f830bb424db9 Author: Marie Hernes Date: Wed Apr 5 15:57:31 2017 +0200 Revert "LPRFAPPS-777 Fixed memory leak." This reverts commit 55d7ee56290514873eb9c0d8767d65657d3f2188. commit ac598b4bb7f7a80faa993ba8556abb19a1312801 Author: Marie Hernes Date: Wed Apr 5 15:41:41 2017 +0200 LPRFAPPS-777 Fixed memory leak. --- .../cc26xx/app/simple_central_audio_receiver.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/examples/simple_central_audio_receiver/cc26xx/app/simple_central_audio_receiver.c b/src/examples/simple_central_audio_receiver/cc26xx/app/simple_central_audio_receiver.c index 2db60cf..d67cf4c 100644 --- a/src/examples/simple_central_audio_receiver/cc26xx/app/simple_central_audio_receiver.c +++ b/src/examples/simple_central_audio_receiver/cc26xx/app/simple_central_audio_receiver.c @@ -1388,6 +1388,7 @@ static void SimpleBLECentral_processGATTMsg(gattMsgEvent_t *pMsg) i2sParams.pvContBuffer = (void *) audio_decoded; i2sParams.ui32conBufTotalSize = sizeof(int16_t) * (streamVariables.samplesPerFrame * I2SCC26XX_QUEUE_SIZE); I2SCC26XX_open(i2sHandle, &i2sParams); + Display_print0(dispHandle, 5, 0, "Opened I2S driver"); streamVariables.i2sOpened = TRUE; } #else //STREAM_TO_PC @@ -1449,6 +1450,9 @@ static void SimpleBLECentral_processGATTMsg(gattMsgEvent_t *pMsg) { sbc_finish(&sbc); } + } + if (streamVariables.i2sOpened == TRUE) + { I2SCC26XX_close(i2sHandle); streamVariables.i2sOpened = FALSE; Display_print0(dispHandle, 5, 0, "Closed I2S driver"); From 1f6dbbd067b679f8b87b8ae02188f4e2a3c509a9 Mon Sep 17 00:00:00 2001 From: Zahid Haq Date: Fri, 28 Jul 2017 14:47:25 -0500 Subject: [PATCH 18/19] Merge pull request #52 in SA/ble_examples from feature/spp_ble_power_saving_fix to ble_examples-2.2-develop Squashed commit of the following: commit 64e7533ea704b40423e4308af559c9d8156b25cb Author: Haq Date: Thu Jul 27 15:40:28 2017 -0700 added cc2650 module boosterpack support commit bbbaca3c54b9aa720c37f67ab10a15b2b41c2f64 Author: Haq Date: Thu Jul 27 13:47:15 2017 -0700 minor polishings/cleanup commit ee20454bbcbf0a7f7606063da053b19a92183001 Author: Haq Date: Wed Jun 7 14:25:38 2017 -0700 fixed some RTOS naming errors when POWER_SAVING is enabled --- .../spp_ble_client_cc2650lp_app.projectspec | 1 + .../spp_ble_client/iar/app/cc2650lp_app.ewd | 1817 +++-------------- .../spp_ble_client/iar/app/cc2650lp_app.ewp | 1062 +++++++++- .../iar/stack/cc2650lp_stack.ewd | 186 +- .../iar/stack/cc2650lp_stack.ewp | 10 +- .../spp_ble_server_cc2650lp_app.projectspec | 1 + .../spp_ble_server/iar/app/cc2650lp_app.ewd | 1817 ++++++++++++++++- .../spp_ble_server/iar/app/cc2650lp_app.ewp | 1062 +++++++++- src/components/sdi/inc/sdi_config.h | 6 +- src/components/sdi/inc/sdi_rxbuf.h | 11 +- src/components/sdi/sdi_rxbuf.c | 14 +- src/components/sdi/sdi_task.c | 121 +- src/components/sdi/sdi_tl.c | 8 +- src/components/sdi/sdi_tl_uart.c | 54 +- src/examples/spp_ble_client/cc26xx/app/main.c | 43 +- .../cc26xx/app/spp_ble_client.c | 187 +- .../cc26xx/app/spp_ble_server.c | 107 +- 17 files changed, 4599 insertions(+), 1908 deletions(-) diff --git a/examples/cc2650lp/spp_ble_client/ccs/app/spp_ble_client_cc2650lp_app.projectspec b/examples/cc2650lp/spp_ble_client/ccs/app/spp_ble_client_cc2650lp_app.projectspec index d4bd4fd..0901557 100644 --- a/examples/cc2650lp/spp_ble_client/ccs/app/spp_ble_client_cc2650lp_app.projectspec +++ b/examples/cc2650lp/spp_ble_client/ccs/app/spp_ble_client_cc2650lp_app.projectspec @@ -53,6 +53,7 @@ -Dxdc_runtime_Assert_DISABLE_ALL -Dxdc_runtime_Log_DISABLE_ALL -DCC2650_LAUNCHXL + -DxBOOSTXL_CC2650MA -DCC26XXWARE -DCC26XX diff --git a/examples/cc2650lp/spp_ble_client/iar/app/cc2650lp_app.ewd b/examples/cc2650lp/spp_ble_client/iar/app/cc2650lp_app.ewd index 87b9514..6f61de3 100644 --- a/examples/cc2650lp/spp_ble_client/iar/app/cc2650lp_app.ewd +++ b/examples/cc2650lp/spp_ble_client/iar/app/cc2650lp_app.ewd @@ -12,9 +12,13 @@ C-SPY 2 - 27 + 28 1 1 + - + @@ -278,18 +282,47 @@ - CMSISDAP_ID + CADI_ID 2 - 2 + 0 1 1 + + + + + + + + CMSISDAP_ID + 2 + + 4 + 1 + 1 + + + @@ -520,15 +561,15 @@ IJET_ID 2 - 6 + 8 1 1 + + JLINK_ID 2 - 15 + 16 1 1 + - - XDS100_ID + TIFET_ID 2 - 4 + 1 1 1 + + + + + + + + + + + + + + + + + XDS100_ID + 2 + + 6 + 1 + 1 + + + + @@ -1503,10 +1635,6 @@ $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 - - $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin - 1 - $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 @@ -1514,7 +1642,7 @@ - FlashOnly_OAD_ImgB + FlashROM-CC2650MOD-BP ARM @@ -1523,9 +1651,13 @@ C-SPY 2 - 27 + 28 1 1 + - + @@ -1789,18 +1921,47 @@ - CMSISDAP_ID + CADI_ID 2 - 2 + 0 1 1 + + + + + + + + CMSISDAP_ID + 2 + + 4 + 1 + 1 + + + @@ -2031,15 +2200,15 @@ IJET_ID 2 - 6 + 8 1 1 + + JLINK_ID 2 - 15 + 16 1 1 + - - XDS100_ID + TIFET_ID 2 - 4 + 1 1 1 - + + + + XDS100_ID + 2 + + 6 + 1 + 1 - - - - - - - - - - - - - - - - - - - - - - - - - $TOOLKIT_DIR$\plugins\middleware\HCCWare\HCCWare.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\middleware\PercepioTraceExporter\PercepioTraceExportPlugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\AVIX\AVIX.ENU.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\CMX\CmxArmPlugin.ENU.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\CMX\CmxTinyArmPlugin.ENU.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\embOS\embOSPlugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\MQX\MQXRtosPlugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\OpenRTOS\OpenRTOSPlugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\Quadros\Quadros_EWB7_Plugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\SafeRTOS\SafeRTOSPlugin.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\ThreadX\ThreadXArmPlugin.ENU.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\TI-RTOS\tirtosplugin.ewplugin - 1 - - - $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-286-KA-CSpy.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\uCOS-II\uCOS-II-KA-CSpy.ewplugin - 0 - - - $TOOLKIT_DIR$\plugins\rtos\uCOS-III\uCOS-III-KA-CSpy.ewplugin - 0 - - - $EW_DIR$\common\plugins\CodeCoverage\CodeCoverage.ENU.ewplugin - 1 - - - $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin - 0 - - - $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin - 1 - - - $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin - 0 - - - - - FlashOnly_OAD_ExtFlash - - ARM - - 1 - - C-SPY - 2 - - 27 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ARMSIM_ID - 2 - - 1 - 1 - 1 - - - - - - - - ANGEL_ID - 2 - - 0 - 1 - 1 - - - - - - - - - - - - CMSISDAP_ID - 2 - - 2 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GDBSERVER_ID - 2 - - 0 - 1 - 1 - - - - - - - - - - - IARROM_ID - 2 - - 1 - 1 - 1 - - - - - - - - - IJET_ID - 2 - - 6 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - JLINK_ID - 2 - - 15 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - LMIFTDI_ID - 2 - - 2 - 1 - 1 - - - - - - - - - - MACRAIGOR_ID - 2 - - 3 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - PEMICRO_ID - 2 - - 2 - 1 - 1 - - - - - - - - - RDI_ID - 2 - - 2 - 1 - 1 - - - - - - - - - - - - - - - - STLINK_ID - 2 - - 3 - 1 - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - THIRDPARTY_ID - 2 - - 0 - 1 - 1 - - - - - - - - XDS100_ID - 2 - - 4 - 1 - 1 - + + @@ -4525,10 +3274,6 @@ $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 - - $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin - 1 - $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 diff --git a/examples/cc2650lp/spp_ble_client/iar/app/cc2650lp_app.ewp b/examples/cc2650lp/spp_ble_client/iar/app/cc2650lp_app.ewp index 3fd5cc1..6b9e7c6 100644 --- a/examples/cc2650lp/spp_ble_client/iar/app/cc2650lp_app.ewp +++ b/examples/cc2650lp/spp_ble_client/iar/app/cc2650lp_app.ewp @@ -77,7 +77,7 @@ @@ -191,6 +191,7 @@ xdc_runtime_Assert_DISABLE_ALL xdc_runtime_Log_DISABLE_ALL CC2650_LAUNCHXL + xBOOSTXL_CC2650MA CC26XX Display_DISABLE_ALL @@ -682,7 +683,7 @@ ILINK 0 - 17 + 18 1 1 + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + FlashROM-CC2650MOD-BP + + ARM + + 1 + + General + 3 + + 24 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 31 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + 0 + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + "$XDCROOT$/xs" --xdcpath="$XDCPATH$" iar.tools.configuro -c "$TOOLKIT_DIR$" --cc "$COMPILER_PATH$" --device "$DEVICE$" --compileOptions $COMPILER_ARGS_ROOT_QUOTED$ --linkOptions $LINKER_ARGS_QUOTED$ --profile release --projFile "$PROJ_PATH$" + + + + + ILINK + 0 + + 18 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1023,27 +2033,27 @@ $TI_BLE_SDK_BASE$\src\common\cc26xx\util.h - + Drivers - + RF + + $TI_RTOS_DRIVERS_BASE$\ti\drivers\rf\RF.h + $TI_RTOS_DRIVERS_BASE$\ti\drivers\rf\RFCC26XX_singleMode.c + + + TRNG + + $TI_BLE_SDK_BASE$\src\components\hal\src\target\_common\TRNGCC26XX.c + - $TI_RTOS_DRIVERS_BASE$\ti\drivers\rf\RF.h + $TI_BLE_SDK_BASE$\src\components\hal\src\target\_common\TRNGCC26XX.h - - TRNG - - $SRC_COMMON$\hal\src\target\_common\TRNGCC26XX.c - - - $SRC_COMMON$\hal\src\target\_common\TRNGCC26XX.h - - - + ICall @@ -1163,6 +2173,22 @@ + + FlashROM-CC2650MOD-BP + + CUSTOM + + .cfg + "$XDCROOT$/bin/stderr" + 0 + + + $PROJ_DIR$\..\config\configPkg\package.mak + + + + + $TI_BLE_SDK_BASE$\src\common\cc26xx\iar\cc26xx_app.icf diff --git a/examples/cc2650lp/spp_ble_client/iar/stack/cc2650lp_stack.ewd b/examples/cc2650lp/spp_ble_client/iar/stack/cc2650lp_stack.ewd index d8ccc2a..59e3558 100644 --- a/examples/cc2650lp/spp_ble_client/iar/stack/cc2650lp_stack.ewd +++ b/examples/cc2650lp/spp_ble_client/iar/stack/cc2650lp_stack.ewd @@ -12,7 +12,7 @@ C-SPY 2 - 27 + 28 1 1 - + @@ -282,18 +282,47 @@ - CMSISDAP_ID + CADI_ID 2 - 2 + 0 1 1 + + + + + + + + CMSISDAP_ID + 2 + + 4 + 1 + 1 + + + @@ -524,15 +561,15 @@ IJET_ID 2 - 6 + 8 1 1 + + JLINK_ID 2 - 15 + 16 1 1 + - - XDS100_ID + TIFET_ID 2 - 4 + 1 1 1 + + + + + + + + + + + + + + + + + XDS100_ID + 2 + + 6 + 1 + 1 + + + + @@ -1507,10 +1635,6 @@ $EW_DIR$\common\plugins\Orti\Orti.ENU.ewplugin 0 - - $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin - 1 - $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 diff --git a/examples/cc2650lp/spp_ble_client/iar/stack/cc2650lp_stack.ewp b/examples/cc2650lp/spp_ble_client/iar/stack/cc2650lp_stack.ewp index 04d50f6..9f211df 100644 --- a/examples/cc2650lp/spp_ble_client/iar/stack/cc2650lp_stack.ewp +++ b/examples/cc2650lp/spp_ble_client/iar/stack/cc2650lp_stack.ewp @@ -77,7 +77,7 @@ - - $EW_DIR$\common\plugins\SymList\SymList.ENU.ewplugin - 1 - $EW_DIR$\common\plugins\uCProbe\uCProbePlugin.ENU.ewplugin 0 diff --git a/examples/cc2650lp/spp_ble_server/iar/app/cc2650lp_app.ewp b/examples/cc2650lp/spp_ble_server/iar/app/cc2650lp_app.ewp index 32911f1..83805ee 100644 --- a/examples/cc2650lp/spp_ble_server/iar/app/cc2650lp_app.ewp +++ b/examples/cc2650lp/spp_ble_server/iar/app/cc2650lp_app.ewp @@ -77,7 +77,7 @@ @@ -191,6 +191,7 @@ xdc_runtime_Assert_DISABLE_ALL xdc_runtime_Log_DISABLE_ALL CC2650_LAUNCHXL + xBOOSTXL_CC2650MA CC26XX Display_DISABLE_ALL @@ -682,7 +683,7 @@ ILINK 0 - 17 + 18 1 1 + + + + + + + + IARCHIVE + 0 + + 0 + 1 + 1 + + + + + + + BILINK + 0 + + + + + FlashROM-CC2650MOD-BP + + ARM + + 1 + + General + 3 + + 24 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ICCARM + 2 + + 31 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + AARM + 2 + + 9 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OBJCOPY + 0 + + 1 + 1 + 1 + + + + + + + + + CUSTOM + 3 + + + + 0 + + + + BICOMP + 0 + + + + BUILDACTION + 1 + + "$XDCROOT$/xs" --xdcpath="$XDCPATH$" iar.tools.configuro -c "$TOOLKIT_DIR$" --cc "$COMPILER_PATH$" --device "$DEVICE$" --compileOptions $COMPILER_ARGS_ROOT_QUOTED$ --linkOptions $LINKER_ARGS_QUOTED$ --profile release --projFile "$PROJ_PATH$" + + + + + ILINK + 0 + + 18 + 1 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1023,27 +2033,27 @@ $TI_BLE_SDK_BASE$\src\common\cc26xx\util.h - + Drivers - + RF + + $TI_RTOS_DRIVERS_BASE$\ti\drivers\rf\RF.h + $TI_RTOS_DRIVERS_BASE$\ti\drivers\rf\RFCC26XX_singleMode.c + + + TRNG - $TI_RTOS_DRIVERS_BASE$\ti\drivers\rf\RF.h + $TI_BLE_SDK_BASE$\src\components\hal\src\target\_common\TRNGCC26XX.c + + + $TI_BLE_SDK_BASE$\src\components\hal\src\target\_common\TRNGCC26XX.h - - TRNG - - $SRC_COMMON$\hal\src\target\_common\TRNGCC26XX.c - - - $SRC_COMMON$\hal\src\target\_common\TRNGCC26XX.h - - - + ICall @@ -1184,6 +2194,22 @@ + + FlashROM-CC2650MOD-BP + + CUSTOM + + .cfg + "$XDCROOT$/bin/stderr" + 0 + + + $PROJ_DIR$\..\config\configPkg\package.mak + + + + + $TI_BLE_SDK_BASE$\src\common\cc26xx\iar\cc26xx_app.icf diff --git a/src/components/sdi/inc/sdi_config.h b/src/components/sdi/inc/sdi_config.h index 59923ee..0d7f895 100644 --- a/src/components/sdi/inc/sdi_config.h +++ b/src/components/sdi/inc/sdi_config.h @@ -77,8 +77,8 @@ extern "C" # error "ERROR: You must choose Board_SPI1 SPI module for NPI." # endif # elif defined(SDI_USE_UART) -# define MRDY_PIN Board_KEY_UP -# define SRDY_PIN Board_KEY_DOWN +# define MRDY_PIN Board_BUTTON0 +# define SRDY_PIN Board_BUTTON1 # endif # define SRDY_ENABLE() PIN_setOutputValue(hSdiHandshakePins, SRDY_PIN, 0) /* RTS low */ # define SRDY_DISABLE() PIN_setOutputValue(hSdiHandshakePins, SRDY_PIN, 1) /* RTS high */ @@ -90,7 +90,7 @@ extern "C" #define SDI_TL_BUF_SIZE 270 #define SDI_SPI_PAYLOAD_SIZE 255 #define SDI_SPI_HDR_LEN 4 - + #ifdef NPI_USE_SPI # if (NPI_TL_BUF_SIZE - NPI_SPI_HDR_LEN) < NPI_SPI_PAYLOAD_SIZE # define NPI_MAX_FRAG_SIZE (NPI_TL_BUF_SIZE - NPI_SPI_HDR_LEN) diff --git a/src/components/sdi/inc/sdi_rxbuf.h b/src/components/sdi/inc/sdi_rxbuf.h index ad882ab..0cd9c85 100644 --- a/src/components/sdi/inc/sdi_rxbuf.h +++ b/src/components/sdi/inc/sdi_rxbuf.h @@ -41,7 +41,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - + //****************************************************************************** #ifndef SDIRXBUF_H #define SDIRXBUF_H @@ -88,7 +88,14 @@ uint16 SDIRxBuf_Read(uint16); //! //! \return uint16 - // ----------------------------------------------------------------------------- -uint16 SDIRxBuf_GetRxBufLen(); +uint16 SDIRxBuf_GetRxBufCount(); + +// ----------------------------------------------------------------------------- +//! \brief Returns number of bytes that are available in RxBuf +//! +//! \return uint16 - +// ----------------------------------------------------------------------------- +uint16 SDIRxBuf_GetRxBufAvail(); // ----------------------------------------------------------------------------- //! \brief SDIRxBuf_ReadFromRxBuf diff --git a/src/components/sdi/sdi_rxbuf.c b/src/components/sdi/sdi_rxbuf.c index a30da59..810eec1 100644 --- a/src/components/sdi/sdi_rxbuf.c +++ b/src/components/sdi/sdi_rxbuf.c @@ -115,11 +115,21 @@ uint16 SDIRxBuf_Read(uint16 len) //! //! \return uint16 - // ----------------------------------------------------------------------------- -uint16 SDIRxBuf_GetRxBufLen(void) +uint16 SDIRxBuf_GetRxBufCount(void) { return ((RxBufTail - RxBufHead) + SDI_TL_BUF_SIZE) % SDI_TL_BUF_SIZE; } +// ----------------------------------------------------------------------------- +//! \brief Returns number of bytes that are available in RxBuf +//! +//! \return uint16 - +// ----------------------------------------------------------------------------- +uint16 SDIRxBuf_GetRxBufAvail(void) +{ + return (SDI_TL_BUF_SIZE - SDIRxBuf_GetRxBufCount()); +} + // ----------------------------------------------------------------------------- //! \brief SDIRxBuf_ReadFromRxBuf //! @@ -127,7 +137,7 @@ uint16 SDIRxBuf_GetRxBufLen(void) // ----------------------------------------------------------------------------- uint16 SDIRxBuf_ReadFromRxBuf(uint8_t *buf, uint16 len) { - uint16_t idx; + uint16_t idx; for (idx = 0; idx < len; idx++) { *buf++ = RxBuf[RxBufHead]; diff --git a/src/components/sdi/sdi_task.c b/src/components/sdi/sdi_task.c index 9fae3d4..91d9cc5 100644 --- a/src/components/sdi/sdi_task.c +++ b/src/components/sdi/sdi_task.c @@ -50,7 +50,6 @@ #include #include -#include #include #include #include @@ -69,19 +68,31 @@ // **************************************************************************** //! \brief Transport layer RX Event (ie. bytes received, RX ISR etc.) -#define SDITASK_TRANSPORT_RX_EVENT Event_Id_00 +#define SDITASK_TRANSPORT_RX_EVENT Event_Id_00 //! \brief Transmit Complete Event (likely associated with TX ISR etc.) -#define SDITASK_TRANSPORT_TX_DONE_EVENT Event_Id_01 +#define SDITASK_TRANSPORT_TX_DONE_EVENT Event_Id_01 //! \brief A framed message buffer is ready to be sent to the transport layer. -#define SDITASK_TX_READY_EVENT Event_Id_02 +#define SDITASK_TX_READY_EVENT Event_Id_02 //! \brief MRDY Received Event #define SDITASK_MRDY_EVENT Event_Id_03 //! \brief Size of stack created for SDI RTOS task -#define SDITASK_STACK_SIZE 512 +#ifndef Display_DISABLE_ALL +#ifdef __TI_COMPILER_VERSION__ +#define SDITASK_STACK_SIZE 752 /* in order to optimize memory, this value should be a multiple of 8 bytes */ +#else // !__TI_COMPILER_VERSION__ +#define SDITASK_STACK_SIZE 656 /* in order to optimize memory, this value should be a multiple of 8 bytes */ +#endif // __TI_COMPILER_VERSION__ +#else // Display_DISABLE_ALL +#ifdef __TI_COMPILER_VERSION__ +#define SDITASK_STACK_SIZE 752 /* in order to optimize memory, this value should be a multiple of 8 bytes */ +#else // !__TI_COMPILER_VERSION__ +#define SDITASK_STACK_SIZE 608 /* in order to optimize memory, this value should be a multiple of 8 bytes */ +#endif // __TI_COMPILER_VERSION__ +#endif // Display_DISABLE_ALL //! \brief Task priority for SDI RTOS task #define SDITASK_PRIORITY 2 @@ -95,7 +106,7 @@ //! \brief Queue record structure //! -typedef struct SDI_QueueRec_t +typedef struct SDI_QueueRec_t { Queue_Elem _elem; SDIMSG_msg_t *sdiMsg; @@ -105,23 +116,18 @@ typedef struct SDI_QueueRec_t //***************************************************************************** // globals //***************************************************************************** - -uint8 buf[SDI_TL_BUF_SIZE] ={0x00,}; -uint16 length; -uint8 lengthRead; -uint8 bufTest[SDI_TL_BUF_SIZE] ={0x00,}; -uint16 lenTest = 0; -//! \brief ICall ID for stack which will be sending SDI messages -//! -//static uint32_t stackServiceID = 0x0000; - //! \brief RTOS task structure for SDI task //! static Task_Struct sdiTaskStruct; //! \brief Allocated memory block for SDI task's stack //! -Char sdiTaskStack[SDITASK_STACK_SIZE]; +#if defined __TI_COMPILER_VERSION__ +#pragma DATA_ALIGN(sdiTaskStack, 8) +#else +#pragma data_alignment=8 +#endif +uint8_t sdiTaskStack[SDITASK_STACK_SIZE]; //! \brief Handle for the ASYNC TX Queue //! @@ -136,14 +142,19 @@ static uint8_t *lastQueuedTxMsg; Event_Struct uartEvent; Event_Handle hUartEvent; //!< Event used to control the UART thread -//! \brief SDI ICall Application Entity ID. -//! -ICall_EntityID sdiAppEntityID = 0; - //! \brief Pointer to Application RX event callback function for optional //! rerouting of messages to application. //! static sdiIncomingEventCBack_t incomingRXEventAppCBFunc = NULL; + +//! \brief Data buffer to send to application +//! +static uint8 buf[SDI_TL_BUF_SIZE] ={0x00,}; +static uint16 length; +static uint8 lengthRead; + +//! \brief Size of data to send to application +//! static uint16 maxAppDataSize = DEFAULT_APP_DATA_LENGTH; //***************************************************************************** @@ -197,7 +208,7 @@ static void SDITask_inititializeTask(void) Event_construct(&uartEvent, &evParams); hUartEvent = Event_handle(&uartEvent); - + // Initialize Network Processor Interface (SDI) and Transport Layer SDITL_initTL( &SDITask_transportTxDoneCallBack, &SDITask_transportRXCallBack, @@ -211,17 +222,17 @@ static void SDITask_inititializeTask(void) //! \return void // ----------------------------------------------------------------------------- static void SDITask_process(void) -{ +{ UInt postedEvents; - + /* Forever loop */ - while (1) + for (;; ) { /* Wait for response message */ postedEvents = Event_pend(hUartEvent, Event_Id_NONE, SDITASK_MRDY_EVENT | SDITASK_TX_READY_EVENT | SDITASK_TRANSPORT_RX_EVENT | SDITASK_TRANSPORT_TX_DONE_EVENT, BIOS_WAIT_FOREVER); - + { - // Capture the ISR events flags now within this task loop. + // Capture the ISR events flags now within this task loop. // MRDY event if (postedEvents & SDITASK_MRDY_EVENT) @@ -240,11 +251,11 @@ static void SDITask_process(void) { SDITask_ProcessTXQ(); } - + if (Queue_empty(sdiTxQueue)) { // Q is empty, no action. - + } else { @@ -257,7 +268,7 @@ static void SDITask_process(void) // The Transport Layer has received some bytes if(postedEvents & SDITASK_TRANSPORT_RX_EVENT) { - length = SDIRxBuf_GetRxBufLen(); + length = SDIRxBuf_GetRxBufCount(); if(length > maxAppDataSize) { @@ -266,12 +277,10 @@ static void SDITask_process(void) { lengthRead = (length & 0xFF); } - - //bufTest[lenTest++] = length; - + //Do custom app processing SDIRxBuf_ReadFromRxBuf(buf, lengthRead); - + //Echo back via UART //SDITask_sendToUART(buf, length); @@ -283,7 +292,7 @@ static void SDITask_process(void) if(length > maxAppDataSize) { // Additional bytes to collect, preserve the flag and repost - // to the semaphore + // to the event Event_post(hUartEvent, SDITASK_TRANSPORT_RX_EVENT); } } @@ -292,12 +301,12 @@ static void SDITask_process(void) if(postedEvents & SDITASK_TRANSPORT_TX_DONE_EVENT) { // Current TX is done. - + if (!Queue_empty(sdiTxQueue)) { // There are pending ASYNC messages waiting to be sent // to the host. Post to event. - + Event_post(hUartEvent, SDITASK_TX_READY_EVENT); } } @@ -381,26 +390,26 @@ void SDITask_sendToUART(uint8_t *pMsg, uint16 length) SDI_QueueRec *recPtr; SDIMSG_msg_t *pSDIMsg =(SDIMSG_msg_t *)ICall_malloc( sizeof(SDIMSG_msg_t)); - - key = ICall_enterCriticalSection(); - + + key = ICall_enterCriticalSection(); + if(pSDIMsg) { pSDIMsg->msgType = SDIMSG_Type_ASYNC; pSDIMsg->pBuf = (uint8 *)ICall_allocMsg(length); pSDIMsg->pBufSize = length; - + if(pSDIMsg->pBuf) { // Payload memcpy(pSDIMsg->pBuf, pMsg, length); } - + recPtr = ICall_malloc(sizeof(SDI_QueueRec)); recPtr->sdiMsg = pSDIMsg; } - + switch (pSDIMsg->msgType) { case SDIMSG_Type_ASYNC: @@ -427,9 +436,16 @@ void SDITask_sendToUART(uint8_t *pMsg, uint16 length) // ----------------------------------------------------------------------------- static void SDITask_ProcessTXQ(void) { - + ICall_CSState key; SDI_QueueRec *recPtr = NULL; + // Processing of any TX Queue should only be done + // in a critical section since any application + // task can enqueue items freely + key = ICall_enterCriticalSection(); + + if (!Queue_empty(sdiTxQueue)) + { recPtr = Queue_dequeue(sdiTxQueue); if (recPtr != NULL) @@ -441,8 +457,10 @@ static void SDITask_ProcessTXQ(void) //free the Queue record ICall_free(recPtr->sdiMsg); ICall_free(recPtr); - } + } + } + ICall_leaveCriticalSection(key); } // ----------------------------------------------------------------------------- @@ -457,7 +475,7 @@ static void SDITask_ProcessTXQ(void) // ----------------------------------------------------------------------------- static void SDITask_transportTxDoneCallBack(int size) { - + if(lastQueuedTxMsg) { //Deallocate most recent message being transmitted. @@ -480,7 +498,16 @@ static void SDITask_transportTxDoneCallBack(int size) // ----------------------------------------------------------------------------- static void SDITask_transportRXCallBack(int size) { - SDIRxBuf_Read(size); + if ( size < SDIRxBuf_GetRxBufAvail() ) + { + SDIRxBuf_Read(size); + } + else + { + // Trap here for pending buffer overflow. If SDI_FLOW_CTRL is + // enabled, increase size of RxBuf to handle larger frames from host. + for(;;); + } Event_post(hUartEvent, SDITASK_TRANSPORT_RX_EVENT); } diff --git a/src/components/sdi/sdi_tl.c b/src/components/sdi/sdi_tl.c index df66cd1..09ede94 100644 --- a/src/components/sdi/sdi_tl.c +++ b/src/components/sdi/sdi_tl.c @@ -236,8 +236,8 @@ static void SDITL_setPM(void) return; } // set constraints for Standby and idle mode - Power_setConstraint(Power_SB_DISALLOW); - Power_setConstraint(Power_IDLE_PD_DISALLOW); + Power_setConstraint(PowerCC26XX_SB_DISALLOW); + Power_setConstraint(PowerCC26XX_IDLE_PD_DISALLOW); sdiPMSetConstraint = TRUE; } #endif @@ -256,8 +256,8 @@ static void SDITL_relPM(void) return; } // release constraints for Standby and idle mode - Power_releaseConstraint(Power_SB_DISALLOW); - Power_releaseConstraint(Power_IDLE_PD_DISALLOW); + Power_releaseConstraint(PowerCC26XX_SB_DISALLOW); + Power_releaseConstraint(PowerCC26XX_IDLE_PD_DISALLOW); sdiPMSetConstraint = FALSE; } #endif diff --git a/src/components/sdi/sdi_tl_uart.c b/src/components/sdi/sdi_tl_uart.c index 48db101..c742768 100644 --- a/src/components/sdi/sdi_tl_uart.c +++ b/src/components/sdi/sdi_tl_uart.c @@ -140,28 +140,28 @@ void SDITLUART_registerIncomingRXErrorStatusAppCB(sdiTLIncomingEventCBack_t appR void SDITLUART_closeUART(void) { ICall_CSState key; - + key = ICall_enterCriticalSection(); - + // Cancel any pending reads UART_readCancel(uartHandle); - + // Close / power off the UART. UART_close(uartHandle); - + ICall_leaveCriticalSection(key); } uint8 SDITLUART_configureUARTParams(UART_Params *initParams) -{ +{ uint8 status = SUCCESS; ICall_CSState key; - + SDITLUART_closeUART(); - + key = ICall_enterCriticalSection(); - + // Open / power on the UART. uartHandle = UART_open(Board_UART, ¶msUART); if(uartHandle != NULL) @@ -171,17 +171,17 @@ uint8 SDITLUART_configureUARTParams(UART_Params *initParams) //DEBUG("ERROR in UART_open"); status = FAILURE; } - + //Enable Partial Reads on all subsequent UART_read() status = UART_control(uartHandle, UARTCC26XX_RETURN_PARTIAL_ENABLE, NULL); - + ICall_leaveCriticalSection(key); - + #ifndef POWER_SAVING //Initiate first read to start polling UART SDITLUART_readTransport(); #endif //POWER_SAVING - + return status; } @@ -191,8 +191,8 @@ uint8 SDITLUART_configureUARTParams(UART_Params *initParams) //! //! \param[in] tRxBuf - pointer to SDI TL Tx Buffer //! \param[in] tTxBuf - pointer to SDI TL Rx Buffer -//! \param[in] sdiCBack - SDI TL call back function to be invoked at the end of -//! a UART transaction +//! \param[in] sdiCBack - SDI TL call back function to be invoked at the end of +//! a UART transaction //! //! \return void // ----------------------------------------------------------------------------- @@ -218,7 +218,7 @@ void SDITLUART_initializeTransport(Char *tRxBuf, Char *tTxBuf, sdiCB_t sdiCBack) paramsUART.writeCallback = SDITLUART_writeCallBack; //paramsUART.readReturnMode = UART_RETURN_FULL; - + // Open / power on the UART. uartHandle = UART_open(Board_UART, ¶msUART); if(uartHandle != NULL) @@ -248,7 +248,7 @@ void SDITLUART_stopTransfer(void) // or that the FIFO has already been read for this UART_read() // In either case UART_readCancel will call the read CB function and it will // invoke sdiTransmitCB with the appropriate number of bytes read - if (!UARTCharsAvail(((UARTCC26XX_HWAttrs const *)(uartHandle->hwAttrs))->baseAddr)) + if (!UARTCharsAvail(((UARTCC26XX_HWAttrsV1 const *)(uartHandle->hwAttrs))->baseAddr)) { RxActive = FALSE; UART_readCancel(uartHandle); @@ -270,7 +270,7 @@ void SDITLUART_handleMrdyEvent(void) { ICall_CSState key; key = ICall_enterCriticalSection(); - + mrdy_flag = 0; // If we haven't already begun reading, now is the time before Master @@ -299,7 +299,7 @@ void SDITLUART_handleMrdyEvent(void) } ICall_leaveCriticalSection(key); - + return; } #endif //POWER_SAVING @@ -321,7 +321,7 @@ static void SDITLUART_writeCallBack(UART_Handle handle, void *ptr, size_t size) if (errStatus = ((UARTCC26XX_Handle)handle->object)->status) { - //report UART error status to application + //report UART error status to application if(incomingRXErrorStatusAppCBFunc != NULL) incomingRXErrorStatusAppCBFunc(UART_ERROR_EVT, &errStatus, sizeof(errStatus)); } @@ -337,7 +337,7 @@ static void SDITLUART_writeCallBack(UART_Handle handle, void *ptr, size_t size) } TxActive = FALSE; - + #else if ( sdiTransmitCB ) { @@ -366,7 +366,7 @@ static void SDITLUART_readCallBack(UART_Handle handle, void *ptr, size_t size) if (errStatus = ((UARTCC26XX_Handle)handle->object)->status) { - //report UART error status to application + //report UART error status to application if(incomingRXErrorStatusAppCBFunc != NULL) incomingRXErrorStatusAppCBFunc(UART_ERROR_EVT, &errStatus, sizeof(errStatus)); } @@ -390,11 +390,11 @@ static void SDITLUART_readCallBack(UART_Handle handle, void *ptr, size_t size) #ifdef POWER_SAVING // Read has been cancelled by transport layer, or bus timeout and no bytes in FIFO // - do not invoke another read - if ( !UARTCharsAvail(((UARTCC26XX_HWAttrs const *)(uartHandle->hwAttrs))->baseAddr) && + if ( !UARTCharsAvail(((UARTCC26XX_HWAttrsV1 const *)(uartHandle->hwAttrs))->baseAddr) && mrdy_flag ) { RxActive = FALSE; - + // If TX has also completed then we are safe to issue call back if ( !TxActive && sdiTransmitCB ) { @@ -450,14 +450,14 @@ void SDITLUART_readTransport(void) { ICall_CSState key; key = ICall_enterCriticalSection(); - + #ifdef POWER_SAVING RxActive = TRUE; #endif //POWER_SAVING TransportRxLen = 0; UART_read(uartHandle, &isrRxBuf[0], UART_ISR_BUF_SIZE); - + ICall_leaveCriticalSection(key); } @@ -473,7 +473,7 @@ uint16 SDITLUART_writeTransport(uint16 len) { ICall_CSState key; key = ICall_enterCriticalSection(); - + TransportTxLen = len; #ifdef POWER_SAVING @@ -492,6 +492,6 @@ uint16 SDITLUART_writeTransport(uint16 len) } #endif //POWER_SAVING ICall_leaveCriticalSection(key); - + return TransportTxLen; } diff --git a/src/examples/spp_ble_client/cc26xx/app/main.c b/src/examples/spp_ble_client/cc26xx/app/main.c index f65f79f..84945db 100644 --- a/src/examples/spp_ble_client/cc26xx/app/main.c +++ b/src/examples/spp_ble_client/cc26xx/app/main.c @@ -10,7 +10,7 @@ ****************************************************************************** $License: BSD3 2013 $ *****************************************************************************/ - + /******************************************************************************* * INCLUDES */ @@ -26,7 +26,7 @@ #include "bcomdef.h" #include "central.h" #include "spp_ble_client.h" -#include "inc/sdi_task.h" +#include "inc/sdi_task.h" /* Header files required to enable instruction fetch cache */ #include @@ -41,8 +41,6 @@ bleUserCfg_t user0Cfg = BLE_USER_CFG; #endif // USE_DEFAULT_USER_CFG -//#include - /******************************************************************************* * MACROS */ @@ -63,24 +61,6 @@ bleUserCfg_t user0Cfg = BLE_USER_CFG; * GLOBAL VARIABLES */ -#ifdef CC1350_LAUNCHXL -#ifdef POWER_SAVING -// Power Notify Object for wake-up callbacks -Power_NotifyObj rFSwitchPowerNotifyObj; -static uint8_t rFSwitchNotifyCb(uint8_t eventType, uint32_t *eventArg, - uint32_t *clientArg); -#endif //POWER_SAVING - -PIN_State radCtrlState; -PIN_Config radCtrlCfg[] = -{ - Board_DIO1_RFSW | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* RF SW Switch defaults to 2.4GHz path*/ - Board_DIO30_SWPWR | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MAX, /* Power to the RF Switch */ - PIN_TERMINATE -}; -PIN_Handle radCtrlHandle; -#endif //CC1350_LAUNCHXL - /******************************************************************************* * EXTERNS */ @@ -103,7 +83,7 @@ extern uint16 dispHandle; * * @param None. * - * @return None. + * @return None. */ int main() { @@ -112,17 +92,6 @@ int main() PIN_init(BoardGpioInitTable); -#ifdef CC1350_LAUNCHXL - // Enable 2.4GHz Radio - radCtrlHandle = PIN_open(&radCtrlState, radCtrlCfg); - -#ifdef POWER_SAVING - Power_registerNotify(&rFSwitchPowerNotifyObj, - PowerCC26XX_ENTERING_STANDBY | PowerCC26XX_AWAKE_STANDBY, - (Power_NotifyFxn) rFSwitchNotifyCb, NULL); -#endif //POWER_SAVING -#endif //CC1350_LAUNCHXL - #ifndef POWER_SAVING /* Set constraints for Standby, powerdown and idle mode */ Power_setConstraint(PowerCC26XX_SB_DISALLOW); @@ -139,8 +108,8 @@ int main() GAPCentralRole_createTask(); /* SDI UART Example Task - Priority 2 */ - SDITask_createTask(); - + SDITask_createTask(); + /* Kick off application - Priority 1 */ SPPBLEClient_createTask(); @@ -264,7 +233,7 @@ static uint8_t rFSwitchNotifyCb(uint8_t eventType, uint32_t *eventArg, // Power up RF Switch PIN_setOutputValue(radCtrlHandle, Board_DIO30_SWPWR, 1); } - + // Notification handled successfully return Power_NOTIFYDONE; } diff --git a/src/examples/spp_ble_client/cc26xx/app/spp_ble_client.c b/src/examples/spp_ble_client/cc26xx/app/spp_ble_client.c index a1a0d64..cab6faa 100644 --- a/src/examples/spp_ble_client/cc26xx/app/spp_ble_client.c +++ b/src/examples/spp_ble_client/cc26xx/app/spp_ble_client.c @@ -69,7 +69,6 @@ #include "util.h" #include "board_key.h" -//#include #include "board.h" #include "ble_user_config.h" @@ -176,7 +175,7 @@ #define SBC_TASK_STACK_SIZE 864 #endif - + // Application states enum { @@ -203,14 +202,14 @@ enum */ // RTOS queue for profile/app messages. -typedef struct _queueRec_ +typedef struct _queueRec_ { Queue_Elem _elem; // queue element uint8_t *pData; // pointer to app data } queueRec_t; // App event passed from profiles. -typedef struct +typedef struct { appEvtHdr_t hdr; // event header uint8_t *pData; // event data pointer @@ -270,7 +269,7 @@ static Queue_Handle appMsgQueue; // Queue object used for UART messages static Queue_Struct appUARTMsg; -static Queue_Handle appUARTMsgQueue; +static Queue_Handle appUARTMsgQueue; // Task pending events static uint16_t events = 0; @@ -440,9 +439,9 @@ void SPPBLEClient_blinkLed(uint8_t led, uint8_t nBlinks) for (i=0; ipData; - + if (pMsg && (state == BLE_STATE_CONNECTED)) { // Process message. @@ -662,7 +661,7 @@ static void SPPBLEClient_taskFxn(UArg a0, UArg a1) req.cmd = TRUE; retVal = GATT_WriteNoRsp(connHandle, &req); - + if ( retVal != SUCCESS ) { GATT_bm_free((gattMsg_t *)&req, ATT_WRITE_REQ); @@ -674,11 +673,11 @@ static void SPPBLEClient_taskFxn(UArg a0, UArg a1) //Toggle LED to indicate data received from UART terminal and sent over the air //SPPBLEClient_toggleLed(Board_GLED, Board_LED_TOGGLE); - - ICall_freeMsg(pMsg->pData); + + ICall_freeMsg(pMsg->pData); // Free the space from the message. ICall_free(pMsg); - + if(!Queue_empty(appUARTMsgQueue)) { // Wake up the application to flush out any remaining UART data in the queue. @@ -686,11 +685,11 @@ static void SPPBLEClient_taskFxn(UArg a0, UArg a1) } } } - + } } - + // If RTOS queue is not empty, process app message while (!Queue_empty(appMsgQueue)) { @@ -704,23 +703,23 @@ static void SPPBLEClient_taskFxn(UArg a0, UArg a1) ICall_free(pMsg); } } - - + + if (events & SBC_UART_CHANGE_EVT) - { + { // Process message. uint8 retVal; attWriteReq_t req; uint8 configData[2] = {0x01,0x00}; - + events &= ~SBC_UART_CHANGE_EVT; - + req.pValue = GATT_bm_alloc(connHandle, ATT_WRITE_REQ, 2, NULL); - - if ((charCCCDHdl == NULL) && (charDataHdl != NULL)) {charCCCDHdl = charDataHdl + 1;} //Hardcoded + + if ((charCCCDHdl == NULL) && (charDataHdl != NULL)) {charCCCDHdl = charDataHdl + 1;} //Hardcoded if ( (req.pValue != NULL) && charCCCDHdl) { - req.handle = charCCCDHdl; //Handle for CCCD of Data characteristic + req.handle = charCCCDHdl; //Handle for CCCD of Data characteristic req.len = 2; memcpy(req.pValue, configData, 2); req.cmd = TRUE; //Has to be true for NoRsp from server(command, not request) @@ -734,30 +733,30 @@ static void SPPBLEClient_taskFxn(UArg a0, UArg a1) { DEBUG("Notification enabled...\n\r"); } - } + } } - + if (events & SBC_START_DISCOVERY_EVT) { events &= ~SBC_START_DISCOVERY_EVT; - + if(!scanningStarted) - SPPBLEClient_startDiscovery(); - + SPPBLEClient_startDiscovery(); + } if (events & SBC_AUTO_CONNECT_EVT) { events &= ~SBC_AUTO_CONNECT_EVT; -#if defined (CLIENT_AUTO_CONNECT) && (CLIENT_AUTO_CONNECT == TRUE) +#if defined (CLIENT_AUTO_CONNECT) && (CLIENT_AUTO_CONNECT == TRUE) SPPBLEClient_autoConnect(); #endif } - - - + + + } } @@ -886,10 +885,10 @@ static void SPPBLEClient_processRoleEvent(gapCentralRoleEvent_t *pEvent) Display_print0(dispHandle, 1, 0, Util_convertBdAddr2Str(pEvent->initDone.devAddr)); Display_print0(dispHandle, 2, 0, "Initialized"); - -#if defined (CLIENT_AUTO_CONNECT) && (CLIENT_AUTO_CONNECT == TRUE) + +#if defined (CLIENT_AUTO_CONNECT) && (CLIENT_AUTO_CONNECT == TRUE) SPPBLEClient_genericHandler(SBC_AUTO_CONNECT_EVT); -#endif +#endif } break; @@ -902,7 +901,7 @@ static void SPPBLEClient_processRoleEvent(gapCentralRoleEvent_t *pEvent) pEvent->deviceInfo.pEvtData, pEvent->deviceInfo.dataLen)) { - SPPBLEClient_addDeviceInfo(pEvent->deviceInfo.addr, + SPPBLEClient_addDeviceInfo(pEvent->deviceInfo.addr, pEvent->deviceInfo.addrType); } } @@ -944,7 +943,7 @@ static void SPPBLEClient_processRoleEvent(gapCentralRoleEvent_t *pEvent) procedureInProgress = TRUE; SPPBLEClient_toggleLed(Board_GLED, Board_LED_TOGGLE); - + // If service discovery not performed initiate service discovery if (charDataHdl == 0) { @@ -1009,19 +1008,19 @@ static void SPPBLEClient_processRoleEvent(gapCentralRoleEvent_t *pEvent) static void SPPBLEClient_handleKeys(uint8_t shift, uint8_t keys) { (void)shift; // Intentionally unreferenced parameter - - - // Set Packet Length in a Connection + + + // Set Packet Length in a Connection if (keys & KEY_RIGHT) { //SPPBLEClient_toggleLed(Board_GLED, Board_LED_TOGGLE); - + if (state == BLE_STATE_CONNECTED ) - { + { //Request max supported size uint16_t requestedPDUSize = APP_SUGGESTED_PDU_SIZE; uint16_t requestedTxTime = APP_SUGGESTED_TX_TIME; - + //This API is documented in hci.h if(SUCCESS != HCI_LE_SetDataLenCmd(connHandle, requestedPDUSize, requestedTxTime)) { @@ -1032,7 +1031,7 @@ static void SPPBLEClient_handleKeys(uint8_t shift, uint8_t keys) { uint8_t addrType; uint8_t *peerAddr; - + // Connect or disconnect if (state == BLE_STATE_IDLE) { @@ -1042,9 +1041,9 @@ static void SPPBLEClient_handleKeys(uint8_t shift, uint8_t keys) // connect to current device in scan result peerAddr = devList[scanIdx].addr; addrType = devList[scanIdx].addrType; - + state = BLE_STATE_CONNECTING; - + GAPCentralRole_EstablishLink(DEFAULT_LINK_HIGH_DUTY_CYCLE, DEFAULT_LINK_WHITE_LIST, addrType, peerAddr); @@ -1057,7 +1056,7 @@ static void SPPBLEClient_handleKeys(uint8_t shift, uint8_t keys) if (keys & KEY_LEFT) { //SPPBLEClient_toggleLed(Board_RLED, Board_LED_TOGGLE); - + // Start or stop discovery if (state == BLE_STATE_CONNECTED && charDataHdl != 0 && @@ -1096,7 +1095,7 @@ static void SPPBLEClient_handleKeys(uint8_t shift, uint8_t keys) } else { -#if defined (CLIENT_AUTO_CONNECT) && (CLIENT_AUTO_CONNECT == TRUE) +#if defined (CLIENT_AUTO_CONNECT) && (CLIENT_AUTO_CONNECT == TRUE) SPPBLEClient_genericHandler(SBC_AUTO_CONNECT_EVT); #endif } @@ -1117,7 +1116,7 @@ void SPPBLEClient_autoConnect(void) { uint8_t addrType; uint8_t peerAddr[6]; - + // connect to hardcoded device address i.e. 0x050403020100 int x = 0; for(x = 0; x<6; x++) @@ -1128,7 +1127,7 @@ void SPPBLEClient_autoConnect(void) addrType = ADDRTYPE_PUBLIC; DEBUG("Auto connecting..."); DEBUG_NEWLINE(); - + GAPCentralRole_EstablishLink(DEFAULT_LINK_HIGH_DUTY_CYCLE, DEFAULT_LINK_WHITE_LIST, addrType, peerAddr); @@ -1146,12 +1145,12 @@ static void SPPBLEClient_processGATTMsg(gattMsgEvent_t *pMsg) { if (state == BLE_STATE_CONNECTED) { - + if(pMsg->method == ATT_HANDLE_VALUE_NOTI) - { + { //Send received bytes to serial port - SDITask_sendToUART(pMsg->msg.handleValueNoti.pValue, pMsg->msg.handleValueNoti.len); - + SDITask_sendToUART(pMsg->msg.handleValueNoti.pValue, pMsg->msg.handleValueNoti.len); + //Toggle LED to indicate data received from client SPPBLEClient_toggleLed(Board_RLED, Board_LED_TOGGLE); } @@ -1246,13 +1245,13 @@ static void SPPBLEClient_processCmdCompleteEvt(hciEvt_CmdComplete_t *pMsg) DEBUG("Max TX bytes: "); DEBUG((uint8_t*)convInt32ToText((int)pMsg->pReturnParam[1] + (pMsg->pReturnParam[2]<<8))); DEBUG_NEWLINE(); DEBUG("Max TX time: "); - DEBUG((uint8_t*)convInt32ToText((int)pMsg->pReturnParam[3] + (pMsg->pReturnParam[4]<<8))); DEBUG_NEWLINE(); + DEBUG((uint8_t*)convInt32ToText((int)pMsg->pReturnParam[3] + (pMsg->pReturnParam[4]<<8))); DEBUG_NEWLINE(); DEBUG("Max RX bytes: "); - DEBUG((uint8_t*)convInt32ToText((int)pMsg->pReturnParam[5] + (pMsg->pReturnParam[6]<<8))); DEBUG_NEWLINE(); + DEBUG((uint8_t*)convInt32ToText((int)pMsg->pReturnParam[5] + (pMsg->pReturnParam[6]<<8))); DEBUG_NEWLINE(); DEBUG("Max RX time: "); DEBUG((uint8_t*)convInt32ToText((int)pMsg->pReturnParam[7] + (pMsg->pReturnParam[8]<<8))); DEBUG_NEWLINE(); break; - + // case HCI_READ_RSSI: // { // int8 rssi = (int8)pMsg->pReturnParam[3]; @@ -1540,7 +1539,7 @@ static void SPPBLEClient_startDiscovery(void) * @return none */ static void SPPBLEClient_processGATTDiscEvent(gattMsgEvent_t *pMsg) -{ +{ if (discState == BLE_DISC_STATE_MTU) { // MTU size response received, discover simple BLE service @@ -1567,9 +1566,9 @@ static void SPPBLEClient_processGATTDiscEvent(gattMsgEvent_t *pMsg) svcEndHdl = ATT_GRP_END_HANDLE(pMsg->msg.findByTypeValueRsp.pHandlesInfo, 0); DEBUG("Found Serial Port Service..."); } - + // If procedure complete - if (((pMsg->method == ATT_FIND_BY_TYPE_VALUE_RSP) && + if (((pMsg->method == ATT_FIND_BY_TYPE_VALUE_RSP) && (pMsg->hdr.status == bleProcedureComplete)) || (pMsg->method == ATT_ERROR_RSP)) { @@ -1577,34 +1576,34 @@ static void SPPBLEClient_processGATTDiscEvent(gattMsgEvent_t *pMsg) { attReadByTypeReq_t req; uint8_t uuid[ATT_UUID_SIZE] = { TI_BASE_UUID_128(SERIALPORTSERVICE_DATA_UUID) }; - + // Discover characteristic discState = BLE_DISC_STATE_CHAR; - + req.startHandle = svcStartHdl; req.endHandle = svcEndHdl; req.type.len = ATT_UUID_SIZE; memcpy(req.type.uuid, uuid, ATT_UUID_SIZE); - + //DEBUG("Reading UUIDs..."); - + // Discover characteristic descriptors GATT_DiscAllCharDescs(connHandle, svcStartHdl + 1, svcEndHdl, - selfEntity); + selfEntity); } } } else if (discState == BLE_DISC_STATE_CHAR) - { + { // Characteristic descriptors found if (pMsg->method == ATT_FIND_INFO_RSP && - pMsg->msg.findInfoRsp.numInfo > 0) + pMsg->msg.findInfoRsp.numInfo > 0) { uint8_t i; - + // For each handle/uuid pair for (i = 0; i < pMsg->msg.findInfoRsp.numInfo; i++) { @@ -1633,27 +1632,27 @@ static void SPPBLEClient_processGATTDiscEvent(gattMsgEvent_t *pMsg) } } } - - + + // If procedure complete - if ((pMsg->method == ATT_FIND_INFO_RSP && + if ((pMsg->method == ATT_FIND_INFO_RSP && pMsg->hdr.status == bleProcedureComplete) || (pMsg->method == ATT_ERROR_RSP)) { - + //Enable notification on peripheral(after a few seconds delay, let it finish connection/discovery process) { Util_startClock(&startNotiEnableClock); } - - procedureInProgress = FALSE; + + procedureInProgress = FALSE; discState = BLE_DISC_STATE_IDLE; } - - - - + + + + } } @@ -1899,7 +1898,7 @@ static void SPPBLEClient_genericHandler(UArg arg) void SPPBLEClient_enqueueUARTMsg(uint8_t event, uint8_t *data, uint8_t len) { sbcUARTEvt_t *pMsg; - + //Enqueue message only in a connected state if(state == BLE_STATE_CONNECTED) { @@ -1914,7 +1913,7 @@ void SPPBLEClient_enqueueUARTMsg(uint8_t event, uint8_t *data, uint8_t len) memcpy(pMsg->pData , data, len); } pMsg->length = len; - + // Enqueue the message. Util_enqueueMsg(appUARTMsgQueue, sem, (uint8_t *)pMsg); } diff --git a/src/examples/spp_ble_server/cc26xx/app/spp_ble_server.c b/src/examples/spp_ble_server/cc26xx/app/spp_ble_server.c index 4e9f339..0a90972 100644 --- a/src/examples/spp_ble_server/cc26xx/app/spp_ble_server.c +++ b/src/examples/spp_ble_server/cc26xx/app/spp_ble_server.c @@ -71,7 +71,7 @@ #ifdef USE_RCOSC #include "rcosc_calibration.h" #endif //USE_RCOSC - + //#include #include "board_key.h" @@ -79,7 +79,7 @@ #include "serial_port_service.h" #include "spp_ble_server.h" -#include "inc/sdi_task.h" +#include "inc/sdi_task.h" #include "inc/sdi_tl_uart.h" @@ -157,7 +157,7 @@ * TYPEDEFS */ // RTOS queue for profile/app messages. -typedef struct _queueRec_ +typedef struct _queueRec_ { Queue_Elem _elem; // queue element uint8_t *pData; // pointer to app data @@ -208,7 +208,7 @@ static Queue_Handle appMsgQueue; // Queue object used for UART messages static Queue_Struct appUARTMsg; -static Queue_Handle appUARTMsgQueue; +static Queue_Handle appUARTMsgQueue; #if defined(FEATURE_OAD) // Event data from OAD profile. @@ -252,7 +252,7 @@ static uint8_t scanRspData[] = 'V', 'E', 'R', - + // connection interval range 0x05, // length of this data GAP_ADTYPE_SLAVE_CONN_INTERVAL_RANGE, @@ -416,9 +416,9 @@ void SPPBLEServer_blinkLed(uint8_t led, uint8_t nBlinks) for (i=0; ipData; - + if (pMsg && ((gapProfileState == GAPROLE_CONNECTED) || (gapProfileState == GAPROLE_CONNECTED_ADV))) { bStatus_t retVal = FAILURE; switch(pMsg->event) { -// case SBP_UART_ERROR_EVT: -// { -// SerialPortService_AddStatusErrorCount((UART_Status)pMsg->data); -// //Remove from queue -// Util_dequeueMsg(appUARTMsgQueue); -// // Free the space from the message. -// ICall_free(pMsg); -// -// break; -// } - case SBP_UART_DATA_EVT: { //Send the notification @@ -721,11 +710,11 @@ static void SPPBLEServer_taskFxn(UArg a0, UArg a1) else { //Increment TX status counter - SerialPortService_AddStatusTXBytes(pMsg->length); - + SerialPortService_AddStatusTXBytes(pMsg->length); + //Remove from queue Util_dequeueMsg(appUARTMsgQueue); - + //Toggle LED to indicate data received from UART terminal and sent over the air //SPPBLEServer_toggleLed(Board_GLED, Board_LED_TOGGLE); @@ -734,7 +723,7 @@ static void SPPBLEServer_taskFxn(UArg a0, UArg a1) // Free the space from the message. ICall_free(pMsg); } - + if(!Queue_empty(appUARTMsgQueue)) { // Wake up the application to flush out any remaining UART data in the queue. @@ -747,8 +736,8 @@ static void SPPBLEServer_taskFxn(UArg a0, UArg a1) } } } - - + + // If RTOS queue is not empty, process app message. while (!Queue_empty(appMsgQueue)) { @@ -763,7 +752,7 @@ static void SPPBLEServer_taskFxn(UArg a0, UArg a1) } } } - + if (events & SBP_PERIODIC_EVT) { events &= ~SBP_PERIODIC_EVT; @@ -984,11 +973,11 @@ static void SPPBLEServer_processAppMsg(sbpEvt_t *pMsg) SPPBLEServer_processStateChangeEvt((gaprole_States_t)pMsg-> hdr.state); break; - + case SBP_KEY_CHANGE_EVT: SPPBLEServer_handleKeys(0, pMsg->hdr.state); break; - + case SBP_CHAR_CHANGE_EVT: SPPBLEServer_processCharValueChangeEvt(pMsg->hdr.state); break; @@ -1098,11 +1087,11 @@ static void SPPBLEServer_processStateChangeEvt(gaprole_States_t newState) uint8_t numActive = 0; Util_startClock(&periodicClock); - + numActive = linkDB_NumActive(); - + connHandle = numActive - 1; - + // Use numActive to determine the connection handle of the last // connection if ( linkDB_GetInfo( numActive - 1, &linkInfo ) == SUCCESS ) @@ -1123,7 +1112,7 @@ static void SPPBLEServer_processStateChangeEvt(gaprole_States_t newState) } SPPBLEServer_toggleLed(Board_GLED, Board_LED_TOGGLE); - + #ifdef PLUS_BROADCASTER // Only turn advertising on for this state when we first connect // otherwise, when we go from connected_advertising back to this state @@ -1220,7 +1209,7 @@ static void SPPBLEServer_charValueChangeCB(uint8_t paramID) static void SPPBLEServer_processCharValueChangeEvt(uint8_t paramID) { - + } /********************************************************************* @@ -1319,8 +1308,8 @@ void SPPBLEServer_enqueueUARTMsg(uint8_t event, uint8_t *data, uint8_t len) { // Create dynamic pointer to message. if (pMsg = ICall_malloc(sizeof(sbpUARTEvt_t))) - { - + { + pMsg->event = event; pMsg->pData = (uint8 *)ICall_allocMsg(len); if(pMsg->pData) @@ -1376,20 +1365,20 @@ static void SPPBLEServer_enqueueMsg(uint8_t event, uint8_t state) static void SPPBLEServer_handleKeys(uint8_t shift, uint8_t keys) { (void)shift; // Intentionally unreferenced parameter - - - // Set Packet Length in a Connection + + + // Set Packet Length in a Connection if (keys & KEY_RIGHT) { //SPPBLEServer_toggleLed(Board_GLED, Board_LED_TOGGLE); - + if (gapProfileState == GAPROLE_CONNECTED ) - { + { //Request max supported size uint16_t requestedPDUSize = APP_SUGGESTED_PDU_SIZE; uint16_t requestedTxTime = APP_SUGGESTED_TX_TIME; - + //This API is documented in hci.h if(SUCCESS != HCI_LE_SetDataLenCmd(connHandle, requestedPDUSize, requestedTxTime)) { @@ -1403,15 +1392,15 @@ static void SPPBLEServer_handleKeys(uint8_t shift, uint8_t keys) if (keys & KEY_LEFT) { //SPPBLEServer_toggleLed(Board_RLED, Board_LED_TOGGLE); - + // Start or stop discovery if (gapProfileState == GAPROLE_CONNECTED) { uint8_t status; - + //Send the notification - status = SerialPortService_SetParameter(SERIALPORTSERVICE_CHAR_DATA, 1, &charVal); - + status = SerialPortService_SetParameter(SERIALPORTSERVICE_CHAR_DATA, 1, &charVal); + if(status == SUCCESS){ charVal++; } From bb442567b5e125b6b87fbf37d1c7a549c44aced8 Mon Sep 17 00:00:00 2001 From: Sean Lyons Date: Fri, 25 Aug 2017 15:24:26 -0500 Subject: [PATCH 19/19] Merge pull request #38 in SA/ble_examples from feature/audio_receiver_improvement to ble_examples-2.2-develop Squashed commit of the following: commit 811117245e1ea88f0da7bf22c814ddcc3e32a2f4 Author: Sean Lyons Date: Thu Aug 24 12:18:26 2017 -0700 Cleanup formatting, merge changes commit 3ac308428d9fdfe75ef726e6a0d52b39c368d86f Author: Torbjorn Sorby Date: Fri May 26 13:21:45 2017 +0200 LPRFAPPS-799: Log missed frames and compensate, also for Fs Log missed frames for ADPCM stream, compensate for the loss by repeating the newly received frame. Only up to three repeats. I2S driver compensates for underflow. The PDM driver samples at slightly less than 16kHz. Every 375 frames there will be one missing. We compensate for this by repeating one frame. It's not ideal, but better than inevitably running into underflow situation. Set a flag to only compensate for Fs when paired with CC2650RC. Instead of instantly muting upon underflow, we fade out. Also, fade in when we're back on track. Increased fading speed. 5 steps (0-75) per frame (12ms) commit 2967e2303331c743a7b02333b0c7e9a4bb3d8bad Author: Christin Lee Date: Wed May 10 16:00:50 2017 +0200 LPRFAPPS-799: Fix memory leak, command race condition and workaround for I2S repeated data due to missing packets --- .../app/simple_central_audio_receiver.c | 331 ++++++++++++------ src/util/audio_codec/I2SCC26XX.h | 2 +- 2 files changed, 232 insertions(+), 101 deletions(-) diff --git a/src/examples/simple_central_audio_receiver/cc26xx/app/simple_central_audio_receiver.c b/src/examples/simple_central_audio_receiver/cc26xx/app/simple_central_audio_receiver.c index d67cf4c..88db65f 100644 --- a/src/examples/simple_central_audio_receiver/cc26xx/app/simple_central_audio_receiver.c +++ b/src/examples/simple_central_audio_receiver/cc26xx/app/simple_central_audio_receiver.c @@ -114,6 +114,8 @@ uint8 audioConfigEnable = 0; #define SBC_KEY_CHANGE_EVT 0x0010 #define SBC_STATE_CHANGE_EVT 0x0020 #define SBC_SCANNING_TOGGLE_EVT 0x0040 +#define SBC_AUDIO_FORCESTOP_EVT 0x0080 +#define SBC_AUDIO_VOLUMEDOWN_EVT 0x0100 // Maximum number of scan responses @@ -292,6 +294,9 @@ typedef struct // Display Interface Display_Handle dispHandle = NULL; +#ifdef STREAM_TO_AUDBOOST + static uint8_t volume = 0; +#endif /********************************************************************* * EXTERNAL VARIABLES */ @@ -455,14 +460,14 @@ PIN_Config ledPinTable[] = { int16_t *audio_decoded; const unsigned char msbc_data[] = { - 0xad, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x01, 0x12, - 0xe1, 0xeb, 0x31, 0x60, 0x76, 0xcd, 0x61, 0xf3, - 0x40, 0xe5, 0x09, 0x38, 0xc4, 0xba, 0xa3, 0xa2, - 0x38, 0x7b, 0x09, 0xb8, 0x1d, 0xdf, 0x30, 0x7c, - 0xd1, 0xa2, 0x42, 0x4b, 0xe5, 0xae, 0xa9, 0x15, - 0x9e, 0x1e, 0xc1, 0x62, 0x07, 0x6e, 0xb5, 0x1f, - 0x33, 0x56, 0x90, 0x92, 0xf9, 0x7b, 0xaa, 0x35, - 0xe0 + 0xad, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x01, 0x12, + 0xe1, 0xeb, 0x31, 0x60, 0x76, 0xcd, 0x61, 0xf3, + 0x40, 0xe5, 0x09, 0x38, 0xc4, 0xba, 0xa3, 0xa2, + 0x38, 0x7b, 0x09, 0xb8, 0x1d, 0xdf, 0x30, 0x7c, + 0xd1, 0xa2, 0x42, 0x4b, 0xe5, 0xae, 0xa9, 0x15, + 0x9e, 0x1e, 0xc1, 0x62, 0x07, 0x6e, 0xb5, 0x1f, + 0x33, 0x56, 0x90, 0x92, 0xf9, 0x7b, 0xaa, 0x35, + 0xe0 }; #ifdef STREAM_TO_AUDBOOST @@ -472,6 +477,7 @@ uint8_t audio_encoded[100] = {0}; sbc_t sbc = {0}; size_t written = 0; struct { + uint8_t sourceIsPDM; uint8_t streamType; uint8_t samplesPerFrame; uint8_t notificationsPerFrame; @@ -574,6 +580,7 @@ static void SimpleBLECentral_init(void) HCI_LE_WriteSuggestedDefaultDataLenCmd(DLE_MAX_PDU_SIZE , DLE_MAX_TX_TIME); #endif + HCI_EXT_SetSCACmd(120); // Open all pins ledPinHandle = PIN_open(&allPinState, ledPinTable); @@ -779,6 +786,65 @@ static void SimpleBLECentral_taskFxn(UArg a0, UArg a1) PIN_setOutputValue(ledPinHandle, Board_GLED, !PIN_getOutputValue(Board_GLED)); } + if (events & SBC_AUDIO_FORCESTOP_EVT) + { + events &= ~SBC_AUDIO_FORCESTOP_EVT; + PIN_setOutputValue(ledPinHandle, Board_RLED, Board_LED_OFF); +#ifdef STREAM_TO_AUDBOOST + if (i2sStreamInProgress) { + I2SCC26XX_stopStream(i2sHandle); + i2sStreamInProgress = false; + Display_print0(dispHandle, 5, 0, "Force Shutdown I2S stream"); + + /* Turn output volume back down */ //TODO: Turn off codec + volume = 0; + AudioCodecSpeakerVolCtrl(AUDIO_CODEC_TI_3254, AUDIO_CODEC_SPEAKER_HP, volume); + + if (streamVariables.streamType == BLE_AUDIO_CMD_START_MSBC) + { + sbc_finish(&sbc); + } + } + if (streamVariables.i2sOpened == TRUE) + { + I2SCC26XX_close(i2sHandle); + streamVariables.i2sOpened = FALSE; + Display_print0(dispHandle, 5, 0, "Closed I2S driver"); + if (audio_decoded) { + ICall_free(audio_decoded); + audio_decoded = NULL; + Display_print0(dispHandle, 5, 0, "Free'd memory for I2S driver"); + } + else { + asm(" NOP"); + Display_print0(dispHandle, 5, 0, "Failed to free memory for I2S driver"); + } + } +#else //STREAM_TO_PC +#ifdef UART_DUMP_UNCOMPRESSED + if (audio_decoded) { + ICall_free(audio_decoded); + } +#endif //UART_DUMP_UNCOMPRESSED + if (streamVariables.streamType == BLE_AUDIO_CMD_START_MSBC) + { + sbc_finish(&sbc); + } +#endif //STREAM_TO_AUDBOOST + streamVariables.streamType = BLE_AUDIO_CMD_STOP; + Display_print0(dispHandle, 5, 0, "Force Shutdown"); + } + + if (events & SBC_AUDIO_VOLUMEDOWN_EVT) + { + events &= ~SBC_AUDIO_VOLUMEDOWN_EVT; + /* Turn output volume back down */ //TODO: Turn off codec + volume = 0; + AudioCodecSpeakerVolCtrl(AUDIO_CODEC_TI_3254, AUDIO_CODEC_SPEAKER_HP, volume); + Display_print0(dispHandle, 5, 0, "Turn Volume down to 0"); + } + + } } @@ -930,8 +996,6 @@ static void SimpleBLECentral_processRoleEvent(gapCentralRoleEvent_t *pEvent) Util_startClock(&scanningToggleClock); } -// // Initiate connection -// SimpleBLECentral_EstablishLink( TRUE, addrType, remoteAddr ); } else { @@ -1181,10 +1245,9 @@ static void SimpleBLECentral_handleKeys(uint8_t shift, uint8_t keys) */ static void SimpleBLECentral_processGATTMsg(gattMsgEvent_t *pMsg) { - static uint8_t audio_pkt_counter = 0, frameReady = FALSE; -#ifdef STREAM_TO_AUDBOOST - static uint8_t volume = 0; -#endif + static uint16_t prevSeqNum = 0; + static int numberOfPackets = 0, lostPackets = 0, counterToAccountForSamplingFrequencyDifference = 0; + static uint8_t audio_pkt_counter = 0, frameReady = FALSE, missedFrames = 0; if (state == BLE_STATE_CONNECTED) { @@ -1215,12 +1278,36 @@ static void SimpleBLECentral_processGATTMsg(gattMsgEvent_t *pMsg) { audio_pkt_counter = 0; frameReady = TRUE; + // Check for missing frames + numberOfPackets++; + counterToAccountForSamplingFrequencyDifference++; + missedFrames = 0; + uint8_t curSeqNum = audio_encoded[0] >> 3; + if (((prevSeqNum + 1) & 0x001F) != curSeqNum) { + if (curSeqNum > prevSeqNum) { + missedFrames = curSeqNum - prevSeqNum; + } else { + missedFrames = (curSeqNum + 31) - prevSeqNum; + } + numberOfPackets += missedFrames; + counterToAccountForSamplingFrequencyDifference += missedFrames; + lostPackets += missedFrames; + Display_print2(dispHandle, 5, 0, "Missing frame, PER %d/%d", lostPackets, numberOfPackets); + // Don't account for too many missed frames, limit to three + missedFrames &= 0x03; + } + prevSeqNum = curSeqNum; + // Account for sampling frequency mismatch, in case source is PDM from CC26xx Remote (sampled at ~15.97kHz + if ((streamVariables.sourceIsPDM == TRUE) && (counterToAccountForSamplingFrequencyDifference >= 375)) { + counterToAccountForSamplingFrequencyDifference -= 375; + missedFrames += 1; + Display_print1(dispHandle, 5, 0, "Accounting for sampling frequency mismatch, frame %d", numberOfPackets); + } } } else if (streamVariables.streamType == BLE_AUDIO_CMD_START_MSBC) { if ((pMsg->msg.handleValueNoti.pValue[0] == 0xAD) && -// (pMsg->msg.handleValueNoti.pValue[1] == 0x00) && (pMsg->msg.handleValueNoti.pValue[2] == 0x00)) { audio_pkt_counter = 0; @@ -1240,6 +1327,7 @@ static void SimpleBLECentral_processGATTMsg(gattMsgEvent_t *pMsg) #ifdef STREAM_TO_AUDBOOST if (i2sStreamInProgress) { I2SCC26XX_BufferRequest bufferRequest; + void *bufferCopy; I2SCC26XX_BufferRelease bufferRelease; bool gotBuffer = I2SCC26XX_requestBuffer(i2sHandle, &bufferRequest); if (gotBuffer) { @@ -1254,16 +1342,34 @@ static void SimpleBLECentral_processGATTMsg(gattMsgEvent_t *pMsg) } PIN_setOutputValue( ledPinHandle, Board_DIO26_ANALOG, 1); } + // Repeat to make up for missing frames + while (missedFrames) { + // Get new buffer to copy to before releasing + bufferRelease.bufferHandleIn = NULL; + bufferRelease.bufferHandleOut = bufferRequest.bufferHandleOut; + bufferCopy = bufferRequest.bufferOut; + // Now get new buffer + gotBuffer = I2SCC26XX_requestBuffer(i2sHandle, &bufferRequest); + if (gotBuffer) { + missedFrames--; + // Copy the same samples + memcpy(bufferRequest.bufferOut, bufferCopy, streamVariables.samplesPerFrame * sizeof(int16_t)); + } + // Then release buffer, and try again if there are more missing frames + I2SCC26XX_releaseBuffer(i2sHandle, &bufferRelease); + } bufferRelease.bufferHandleIn = NULL; bufferRelease.bufferHandleOut = bufferRequest.bufferHandleOut; I2SCC26XX_releaseBuffer(i2sHandle, &bufferRelease); if (gotBuffer) { if (volume <= streamVariables.maxVolume) { - if ((volume % 20) == 0) { - // Volume control - AudioCodecSpeakerVolCtrl(AUDIO_CODEC_TI_3254, AUDIO_CODEC_SPEAKER_HP, volume); + if (volume < streamVariables.maxVolume) { + volume += 5; + } else if (volume > streamVariables.maxVolume) { + volume -= 5; } - volume++; + // Volume control + AudioCodecSpeakerVolCtrl(AUDIO_CODEC_TI_3254, AUDIO_CODEC_SPEAKER_HP, volume); } } } @@ -1287,6 +1393,7 @@ static void SimpleBLECentral_processGATTMsg(gattMsgEvent_t *pMsg) if (audio_decoded) { i2sParams.blockSize = streamVariables.samplesPerFrame; i2sParams.pvContBuffer = (void *) audio_decoded; + memset(audio_decoded, 0, sizeof(int16_t) * (streamVariables.samplesPerFrame * I2SCC26XX_QUEUE_SIZE)); i2sParams.ui32conBufTotalSize = sizeof(int16_t) * (streamVariables.samplesPerFrame * I2SCC26XX_QUEUE_SIZE); I2SCC26XX_open(i2sHandle, &i2sParams); Display_print0(dispHandle, 5, 0, "Opened I2S driver"); @@ -1321,30 +1428,31 @@ static void SimpleBLECentral_processGATTMsg(gattMsgEvent_t *pMsg) } PIN_setOutputValue( ledPinHandle, Board_DIO26_ANALOG, 0); UART_write(uartHandle, audio_decoded, streamVariables.samplesPerFrame * sizeof(int16_t)); - PIN_setOutputValue( ledPinHandle, Board_DIO26_ANALOG, 1); +#else //!UART_DUMP_UNCOMPRESSED + if (streamVariables.streamType == BLE_AUDIO_CMD_START_MSBC) { + UART_write(uartHandle, audio_encoded, MSBC_ENCODED_SIZE); } else { - audio_decoded = ICall_malloc(sizeof(int16_t) * streamVariables.samplesPerFrame); + UART_write(uartHandle, audio_encoded, BLEAUDIO_BUFSIZE_ADPCM + BLEAUDIO_HDRSIZE_ADPCM); } -#else //!UART_DUMP_UNCOMPRESSED - if (streamVariables.streamType == BLE_AUDIO_CMD_START_MSBC) { - UART_write(uartHandle, audio_encoded, MSBC_ENCODED_SIZE); - } - else { - UART_write(uartHandle, audio_encoded, BLEAUDIO_BUFSIZE_ADPCM + BLEAUDIO_HDRSIZE_ADPCM); - } #endif //UART_DUMP_UNCOMPRESSED + PIN_setOutputValue( ledPinHandle, Board_DIO26_ANALOG, 1); + } + else{ + audio_decoded = ICall_malloc(sizeof(int16_t) * streamVariables.samplesPerFrame); + } #endif //STREAM_TO_AUDBOOST frameReady = FALSE; } #ifdef STREAM_TO_AUDBOOST - else if (streamVariables.i2sOpened == FALSE) { + else if ((streamVariables.i2sOpened == FALSE)&& (streamVariables.streamType != BLE_AUDIO_CMD_STOP)) { // Failed to open, take the opportunity to try again // Allocate memory for decoded PCM data - audio_decoded = ICall_malloc(sizeof(int16_t) * (streamVariables.samplesPerFrame * I2SCC26XX_QUEUE_SIZE)); + audio_decoded = ICall_malloc(sizeof(int16_t) * (streamVariables.samplesPerFrame * I2SCC26XX_QUEUE_SIZE)); if (audio_decoded) { i2sParams.blockSize = streamVariables.samplesPerFrame; i2sParams.pvContBuffer = (void *) audio_decoded; + memset(audio_decoded, 0, sizeof(int16_t) * (streamVariables.samplesPerFrame * I2SCC26XX_QUEUE_SIZE)); i2sParams.ui32conBufTotalSize = sizeof(int16_t) * (streamVariables.samplesPerFrame * I2SCC26XX_QUEUE_SIZE); I2SCC26XX_open(i2sHandle, &i2sParams); volume = 40; @@ -1374,60 +1482,81 @@ static void SimpleBLECentral_processGATTMsg(gattMsgEvent_t *pMsg) // If we received a stop command reset the audio_pkt_counter, SI, PV if(BLE_AUDIO_CMD_START == *(pMsg->msg.handleValueNoti.pValue)) { - audio_pkt_counter = 0; - PIN_setOutputValue(ledPinHandle, Board_RLED, Board_LED_ON); - streamVariables.streamType = BLE_AUDIO_CMD_START; - streamVariables.notificationsPerFrame = BLEAUDIO_NUM_NOT_PER_FRAME_ADPCM; - streamVariables.samplesPerFrame = ADPCM_SAMPLES_PER_FRAME; - streamVariables.maxVolume = 85 - 10; - // Allocate memory for decoded PCM data -#ifdef STREAM_TO_AUDBOOST - audio_decoded = ICall_malloc(sizeof(int16_t) * (streamVariables.samplesPerFrame * I2SCC26XX_QUEUE_SIZE)); - if (audio_decoded) { - i2sParams.blockSize = streamVariables.samplesPerFrame; - i2sParams.pvContBuffer = (void *) audio_decoded; - i2sParams.ui32conBufTotalSize = sizeof(int16_t) * (streamVariables.samplesPerFrame * I2SCC26XX_QUEUE_SIZE); - I2SCC26XX_open(i2sHandle, &i2sParams); - Display_print0(dispHandle, 5, 0, "Opened I2S driver"); - streamVariables.i2sOpened = TRUE; + if (streamVariables.streamType != BLE_AUDIO_CMD_STOP) { + Display_print0(dispHandle, 5, 0, "Already started stream"); } + else { + numberOfPackets = 0; + lostPackets = 0; + prevSeqNum = 0; + counterToAccountForSamplingFrequencyDifference = 0; + audio_pkt_counter = 0; + PIN_setOutputValue(ledPinHandle, Board_RLED, Board_LED_ON); + streamVariables.streamType = BLE_AUDIO_CMD_START; + streamVariables.notificationsPerFrame = BLEAUDIO_NUM_NOT_PER_FRAME_ADPCM; + streamVariables.samplesPerFrame = ADPCM_SAMPLES_PER_FRAME; + streamVariables.maxVolume = 85 - 10; + // Allocate memory for decoded PCM data +#ifdef STREAM_TO_AUDBOOST + audio_decoded = ICall_malloc(sizeof(int16_t) * (streamVariables.samplesPerFrame * I2SCC26XX_QUEUE_SIZE)); + + if (audio_decoded) { + i2sParams.blockSize = streamVariables.samplesPerFrame; + i2sParams.pvContBuffer = (void *) audio_decoded; + memset(audio_decoded, 0, sizeof(int16_t) * (streamVariables.samplesPerFrame * I2SCC26XX_QUEUE_SIZE)); + i2sParams.ui32conBufTotalSize = sizeof(int16_t) * (streamVariables.samplesPerFrame * I2SCC26XX_QUEUE_SIZE); + I2SCC26XX_open(i2sHandle, &i2sParams); + Display_print1(dispHandle, 5, 0, "Opened I2S driver: %d", 1); + streamVariables.i2sOpened = TRUE; + } + else { + Display_print0(dispHandle, 5, 0, "Failed to allocate mem for I2S driver on start"); + } #else //STREAM_TO_PC #ifdef UART_DUMP_UNCOMPRESSED - audio_decoded = ICall_malloc(sizeof(int16_t) * streamVariables.samplesPerFrame); + audio_decoded = ICall_malloc(sizeof(int16_t) * streamVariables.samplesPerFrame); #endif //UART_DUMP_UNCOMPRESSED #endif //STREAM_TO_AUDBOOST - Display_print0(dispHandle, 5, 0, "ADPCM Stream"); + Display_print0(dispHandle, 5, 0, "ADPCM Stream"); + } } else if(BLE_AUDIO_CMD_START_MSBC == *(pMsg->msg.handleValueNoti.pValue)) { - audio_pkt_counter = 0; - PIN_setOutputValue(ledPinHandle, Board_RLED, Board_LED_ON); - streamVariables.streamType = BLE_AUDIO_CMD_START_MSBC; - streamVariables.notificationsPerFrame = BLEAUDIO_NUM_NOT_PER_FRAME_MSBC; - streamVariables.samplesPerFrame = MSBC_SAMPLES_PER_FRAME; - streamVariables.maxVolume = 90 - 15; - // Allocate memory for decoded PCM data -#ifdef STREAM_TO_AUDBOOST - audio_decoded = ICall_malloc(sizeof(int16_t) * (streamVariables.samplesPerFrame * I2SCC26XX_QUEUE_SIZE)); - if (audio_decoded) { - i2sParams.blockSize = streamVariables.samplesPerFrame; - i2sParams.pvContBuffer = (void *) audio_decoded; - i2sParams.ui32conBufTotalSize = sizeof(int16_t) * (streamVariables.samplesPerFrame * I2SCC26XX_QUEUE_SIZE); - I2SCC26XX_open(i2sHandle, &i2sParams); - Display_print0(dispHandle, 5, 0, "Opened I2S driver"); - streamVariables.i2sOpened = TRUE; + if (streamVariables.streamType != BLE_AUDIO_CMD_STOP) { + Display_print0(dispHandle, 5, 0, "Already started stream"); } else { - Display_print0(dispHandle, 5, 0, "Failed to allocate mem for I2S driver on start"); - } + audio_pkt_counter = 0; + PIN_setOutputValue(ledPinHandle, Board_RLED, Board_LED_ON); + streamVariables.streamType = BLE_AUDIO_CMD_START_MSBC; + streamVariables.notificationsPerFrame = BLEAUDIO_NUM_NOT_PER_FRAME_MSBC; + streamVariables.samplesPerFrame = MSBC_SAMPLES_PER_FRAME; + streamVariables.maxVolume = 90 - 15; + // Allocate memory for decoded PCM data +#ifdef STREAM_TO_AUDBOOST + audio_decoded = ICall_malloc(sizeof(int16_t) * (streamVariables.samplesPerFrame * I2SCC26XX_QUEUE_SIZE)); + + if (audio_decoded) { + i2sParams.blockSize = streamVariables.samplesPerFrame; + i2sParams.pvContBuffer = (void *) audio_decoded; + memset(audio_decoded, 0, sizeof(int16_t) * (streamVariables.samplesPerFrame * I2SCC26XX_QUEUE_SIZE)); + i2sParams.ui32conBufTotalSize = sizeof(int16_t) * (streamVariables.samplesPerFrame * I2SCC26XX_QUEUE_SIZE); + I2SCC26XX_open(i2sHandle, &i2sParams); + Display_print0(dispHandle, 5, 0, "Opened I2S driver"); + streamVariables.i2sOpened = TRUE; + } + else { + Display_print0(dispHandle, 5, 0, "Failed to allocate mem for I2S driver on start"); + } #else //STREAM_TO_PC #ifdef UART_DUMP_UNCOMPRESSED - audio_decoded = ICall_malloc(sizeof(int16_t) * streamVariables.samplesPerFrame); + audio_decoded = ICall_malloc(sizeof(int16_t) * streamVariables.samplesPerFrame); #endif //UART_DUMP_UNCOMPRESSED #endif //STREAM_TO_AUDBOOST - // Initialize encoder - sbc_init_msbc(&sbc, 0); - Display_print0(dispHandle, 5, 0, "mSBC Stream"); + // Initialize encoder + sbc_init_msbc(&sbc, 0); + Display_print0(dispHandle, 5, 0, "mSBC Stream"); + } } else if(BLE_AUDIO_CMD_STOP == *(pMsg->msg.handleValueNoti.pValue)) { @@ -1443,9 +1572,6 @@ static void SimpleBLECentral_processGATTMsg(gattMsgEvent_t *pMsg) volume = 0; AudioCodecSpeakerVolCtrl(AUDIO_CODEC_TI_3254, AUDIO_CODEC_SPEAKER_HP, volume); -// /* Clean up output buffers to avoid playing back noise when starting next stream */ -// memset(audio_decoded, 0, sizeof(int16_t) * (streamVariables.samplesPerFrame * I2SCC26XX_QUEUE_SIZE)); - if (streamVariables.streamType == BLE_AUDIO_CMD_START_MSBC) { sbc_finish(&sbc); @@ -2070,8 +2196,10 @@ static uint8 SimpleBLECentral_FindHIDRemote( uint8* pData, uint8 length ) // adjust length as well length -= 2; + streamVariables.sourceIsPDM = FALSE; if (length == sizeof(remoteNameRC)) { resultFindRC = osal_memcmp( remoteNameRC, pData, length ); + streamVariables.sourceIsPDM = TRUE; } else if (length == sizeof(remoteNameTx)) { resultFindRC = osal_memcmp( remoteNameTx, pData, length ); @@ -2086,28 +2214,6 @@ static uint8 SimpleBLECentral_FindHIDRemote( uint8* pData, uint8 length ) 'S', 'e', 'n', 's', 'o', 'r', 'T', 'a', 'g' }; - // // complete name - // 0x11, // length of this data - // GAP_ADTYPE_LOCAL_NAME_COMPLETE, - // 'C', 'C', '2', '6', '5', '0', ' ', - // 'S', 'e', 'n', 's', 'o', 'r', 'T', 'a', 'g', - // - // // connection interval range - // 0x05, // length of this data - // GAP_ADTYPE_SLAVE_CONN_INTERVAL_RANGE, - // LO_UINT16(DEFAULT_DESIRED_MIN_CONN_INTERVAL), - // HI_UINT16(DEFAULT_DESIRED_MIN_CONN_INTERVAL), - // LO_UINT16(DEFAULT_DESIRED_MAX_CONN_INTERVAL), - // HI_UINT16(DEFAULT_DESIRED_MAX_CONN_INTERVAL), - // - // // Tx power level - // 0x02, // length of this data - // GAP_ADTYPE_POWER_LEVEL, - // 0 // 0dBm - - // adjust length as well, totla length is 0x11 + 0xA = 0x1B = 27 - // the needed array size(for the name) is only 16 bytes -// length -= 11; // already moved when search for RC length -= 9; resultFindST = osal_memcmp( remoteNameST, pData, length ); } @@ -2271,13 +2377,38 @@ static void SimpleBLECentral_scanningToggleHandler(UArg arg) #ifdef STREAM_TO_AUDBOOST static void I2SCC26XX_i2sCallbackFxn(I2SCC26XX_Handle handle, I2SCC26XX_StreamNotification *notification) { - if (notification->status == I2SCC26XX_STREAM_BUFFER_READY) { - // Provide buffer - PIN_setOutputValue( ledPinHandle, Board_DIO25_ANALOG, !(PIN_getOutputValue(Board_DIO25_ANALOG))); + static uint8_t lostConsecutively = 0; + uint32_t hwiKey; + if (notification->status == I2SCC26XX_STREAM_BUFFER_READY) { + // Provide buffer + PIN_setOutputValue( ledPinHandle, Board_DIO25_ANALOG, !(PIN_getOutputValue(Board_DIO25_ANALOG))); + lostConsecutively = 0; + streamVariables.maxVolume = 75; + } + else if (notification->status == I2SCC26XX_STREAM_BUFFER_READY_BUT_NO_AVAILABLE_BUFFERS) { + // Provide buffer + lostConsecutively++; + PIN_setOutputValue( ledPinHandle, Board_DIO25_ANALOG, !(PIN_getOutputValue(Board_DIO25_ANALOG))); + if ((lostConsecutively > 5 ) & (lostConsecutively <= 40 )) { + if( volume > 0 ){ + // hwiKey = Hwi_disable(); + // events |= SBC_AUDIO_VOLUMEDOWN_EVT; + // Hwi_restore(hwiKey); + // Semaphore_post(sem); + streamVariables.maxVolume = 0; + } } - else { - PIN_setOutputValue( ledPinHandle, Board_RLED, !(PIN_getOutputValue(Board_RLED))); + else if (lostConsecutively > 40 ) { + hwiKey = Hwi_disable(); + events |= SBC_AUDIO_FORCESTOP_EVT; + lostConsecutively = 0; + Hwi_restore(hwiKey); + Semaphore_post(sem); } + } + else { + PIN_setOutputValue( ledPinHandle, Board_RLED, !(PIN_getOutputValue(Board_RLED))); + } } #endif //STREAM_TO_AUDBOOST diff --git a/src/util/audio_codec/I2SCC26XX.h b/src/util/audio_codec/I2SCC26XX.h index 9b4d025..fced3bf 100644 --- a/src/util/audio_codec/I2SCC26XX.h +++ b/src/util/audio_codec/I2SCC26XX.h @@ -247,7 +247,7 @@ extern "C" { * At least three elements must exist for good flow in driver */ #define I2SCC26XX_MIN_ALLOWED_QUEUE_SIZE 3 -#define I2SCC26XX_QUEUE_SIZE 5 //7 +#define I2SCC26XX_QUEUE_SIZE 7 /*! * PDM block overhead size in number of bytes --> sizeof(queueNodeI2S_t)