Compare commits

...

2 Commits

Author SHA1 Message Date
Ta-Shun Su 66d4a69a74 save 2019-05-08 15:29:46 +08:00
Ta-Shun Su 531580243d copy from origin/NeuLiveSTI 2019-05-08 15:26:58 +08:00
49 changed files with 4599 additions and 4351 deletions
@@ -47,6 +47,8 @@
#include <ti/drivers/PIN.h>
#include <ti/drivers/pin/PINCC26XX.h>
#include <ti/drivers/PWM.h>
#include <ti/drivers/ADC.h>
#include <ti/drivers/adc/ADCCC26XX.h>
#include <ti/drivers/pwm/PWMTimerCC26XX.h>
#include <ti/drivers/timer/GPTimerCC26XX.h>
#include <ti/drivers/Power.h>
@@ -218,8 +220,22 @@ const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[BOOSTXL_CC2650MA_UDMACOUNT] = {
.mosiPin = Board_SPI0_MOSI,
.misoPin = Board_SPI0_MISO,
.clkPin = Board_SPI0_CLK,
.csnPin = Board_SPI0_CS
.csnPin = Board_SPI0_CSN
},
{
.baseAddr = SSI1_BASE,
.intNum = INT_SSI1_COMB,
.intPriority = ~0,
.swiPriority = 0,
.powerMngrId = PowerCC26XX_PERIPH_SSI1,
.defaultTxBufValue = 0,
.rxChannelBitMask = 1<<UDMA_CHAN_SSI1_RX,
.txChannelBitMask = 1<<UDMA_CHAN_SSI1_TX,
.mosiPin = Board_SPI1_MOSI,
.misoPin = Board_SPI1_MISO,
.clkPin = Board_SPI1_CLK,
.csnPin = Board_SPI1_CSN
}
};
/* SPI configuration structure */
@@ -423,3 +439,115 @@ const PWM_Config PWM_config[BOOSTXL_CC2650MA_PWMCOUNT + 1] = {
/*
* ============================= PWM end ======================================
*/
#if defined(__TI_COMPILER_VERSION__)
#pragma DATA_SECTION(ADC_config, ".const:ADC_config")
#pragma DATA_SECTION(adcCC26xxHWAttrs, ".const:adcCC26xxHWAttrs")
#endif
ADCCC26XX_Object adcCC26xxObjects[BOOSTXL_CC2650MA_ADCCOUNT];
const ADCCC26XX_HWAttrs adcCC26xxHWAttrs[BOOSTXL_CC2650MA_ADCCOUNT] = {
{
.adcDIO = DIO7,
.adcCompBInput = ADC_COMPB_IN_AUXIO7,
.refSource = ADCCC26XX_FIXED_REFERENCE,
.samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
.inputScalingEnabled = true,
.triggerSource = ADCCC26XX_TRIGGER_MANUAL
},
{
.adcDIO = DIO8,
.adcCompBInput = ADC_COMPB_IN_AUXIO6,
.refSource = ADCCC26XX_FIXED_REFERENCE,
.samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
.inputScalingEnabled = true,
.triggerSource = ADCCC26XX_TRIGGER_MANUAL
},
{
.adcDIO = DIO9,
.adcCompBInput = ADC_COMPB_IN_AUXIO5,
.refSource = ADCCC26XX_FIXED_REFERENCE,
.samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
.inputScalingEnabled = true,
.triggerSource = ADCCC26XX_TRIGGER_MANUAL
},
{
.adcDIO = PIN_UNASSIGNED,
.adcCompBInput = ADC_COMPB_IN_AUXIO4,
.refSource = ADCCC26XX_FIXED_REFERENCE,
.samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
.inputScalingEnabled = true,
.triggerSource = ADCCC26XX_TRIGGER_MANUAL
},
{
.adcDIO = PIN_UNASSIGNED,
.adcCompBInput = ADC_COMPB_IN_AUXIO3,
.refSource = ADCCC26XX_FIXED_REFERENCE,
.samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
.inputScalingEnabled = true,
.triggerSource = ADCCC26XX_TRIGGER_MANUAL
},
{
.adcDIO = PIN_UNASSIGNED,
.adcCompBInput = ADC_COMPB_IN_AUXIO2,
.refSource = ADCCC26XX_FIXED_REFERENCE,
.samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
.inputScalingEnabled = true,
.triggerSource = ADCCC26XX_TRIGGER_MANUAL
},
{
.adcDIO = PIN_UNASSIGNED,
.adcCompBInput = ADC_COMPB_IN_AUXIO1,
.refSource = ADCCC26XX_FIXED_REFERENCE,
.samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
.inputScalingEnabled = true,
.triggerSource = ADCCC26XX_TRIGGER_MANUAL
},
{
.adcDIO = PIN_UNASSIGNED,
.adcCompBInput = ADC_COMPB_IN_AUXIO0,
.refSource = ADCCC26XX_FIXED_REFERENCE,
.samplingDuration = ADCCC26XX_SAMPLING_DURATION_10P9_MS,
.inputScalingEnabled = true,
.triggerSource = ADCCC26XX_TRIGGER_MANUAL
},
{
.adcDIO = PIN_UNASSIGNED,
.adcCompBInput = ADC_COMPB_IN_DCOUPL,
.refSource = ADCCC26XX_FIXED_REFERENCE,
.samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
.inputScalingEnabled = true,
.triggerSource = ADCCC26XX_TRIGGER_MANUAL
},
{
.adcDIO = PIN_UNASSIGNED,
.adcCompBInput = ADC_COMPB_IN_VSS,
.refSource = ADCCC26XX_FIXED_REFERENCE,
.samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
.inputScalingEnabled = true,
.triggerSource = ADCCC26XX_TRIGGER_MANUAL
},
{
.adcDIO = PIN_UNASSIGNED,
.adcCompBInput = ADC_COMPB_IN_VDDS,
.refSource = ADCCC26XX_FIXED_REFERENCE,
.samplingDuration = ADCCC26XX_SAMPLING_DURATION_2P7_US,
.inputScalingEnabled = true,
.triggerSource = ADCCC26XX_TRIGGER_MANUAL
}
};
const ADC_Config ADC_config[] = {
{&ADCCC26XX_fxnTable, &adcCC26xxObjects[0], &adcCC26xxHWAttrs[0]},
{&ADCCC26XX_fxnTable, &adcCC26xxObjects[1], &adcCC26xxHWAttrs[1]},
{&ADCCC26XX_fxnTable, &adcCC26xxObjects[2], &adcCC26xxHWAttrs[2]},
{&ADCCC26XX_fxnTable, &adcCC26xxObjects[3], &adcCC26xxHWAttrs[3]},
{&ADCCC26XX_fxnTable, &adcCC26xxObjects[4], &adcCC26xxHWAttrs[4]},
{&ADCCC26XX_fxnTable, &adcCC26xxObjects[5], &adcCC26xxHWAttrs[5]},
{&ADCCC26XX_fxnTable, &adcCC26xxObjects[6], &adcCC26xxHWAttrs[6]},
{&ADCCC26XX_fxnTable, &adcCC26xxObjects[7], &adcCC26xxHWAttrs[7]},
{&ADCCC26XX_fxnTable, &adcCC26xxObjects[8], &adcCC26xxHWAttrs[8]},
{&ADCCC26XX_fxnTable, &adcCC26xxObjects[9], &adcCC26xxHWAttrs[9]},
{&ADCCC26XX_fxnTable, &adcCC26xxObjects[10], &adcCC26xxHWAttrs[10]},
{NULL, NULL, NULL},
};
@@ -113,25 +113,26 @@ extern const PIN_Config BoardGpioInitTable[];
*/
/* Connector J1 */
#define Board_BP_AnalogIn_0 Board_BP_Pin_J1_2
#define Board_BP_AnalogIn_0 PIN_UNASSIGNED
#define Board_BP_UART_Rx Board_BP_Pin_J1_3 /* To MCU on LaunchPad */
#define Board_BP_UART_Tx Board_BP_Pin_J1_4 /* From MCU on LauchPad*/
#define Board_BP_GPIO_0 Board_BP_Pin_J1_5
#define Board_BP_AnalogIn_1 Board_BP_Pin_J1_6
#define Board_BP_SPI_CLK Board_BP_Pin_J1_7
#define Board_BP_GPIO_1 Board_BP_Pin_J1_8
#define Board_BP_I2C_SCL Board_BP_Pin_J1_9
#define Board_BP_I2C_SDA Board_BP_Pin_J1_10
#define Board_BP_AnalogIn_1 PIN_UNASSIGNED
#define Board_BP_SPI_CLK PIN_UNASSIGNED
#define Board_BP_GPIO_1 PIN_UNASSIGNED
#define Board_BP_I2C_SCL PIN_UNASSIGNED
#define Board_BP_I2C_SDA PIN_UNASSIGNED
/* Connector J2 */
#define Board_BP_PWM_0 Board_BP_Pin_J2_19
#define Board_BP_SPI_CS_Wireless Board_BP_Pin_J2_18
#define Board_BP_SPI_CS_Wireless PIN_UNASSIGNED
#define Board_BP_GPIO_3 Board_BP_Pin_J2_17
#define Board_BP_SPI_MOSI Board_BP_Pin_J2_15
#define Board_BP_SPI_MISO Board_BP_Pin_J2_14
#define Board_BP_SPI_CS_Display Board_BP_Pin_J2_13
#define Board_BP_SPI_CS_Other Board_BP_Pin_J2_12
#define Board_BP_GPIO_2 Board_BP_Pin_J2_11
#define Board_BP_SPI_MOSI PIN_UNASSIGNED
#define Board_BP_SPI_MISO PIN_UNASSIGNED
#define Board_BP_SPI_CS_Display PIN_UNASSIGNED
#define Board_BP_SPI_CS_Other PIN_UNASSIGNED
#define Board_BP_GPIO_2 PIN_UNASSIGNED
/* Mapping of application specific functionality of the BoosterPack to BoosterPack Pins (application dependent)
@@ -146,14 +147,17 @@ extern const PIN_Config BoardGpioInitTable[];
#define Board_UART_RX Board_BP_UART_Tx /* TXD */
/* SPI Board */
#define Board_SPI0_MISO Board_BP_SPI_MISO
#define Board_SPI0_MOSI Board_BP_SPI_MOSI
#define Board_SPI0_CLK Board_BP_SPI_CLK
#define Board_SPI0_CS Board_BP_SPI_CS_Wireless
#define Board_SPI0_MISO PIN_UNASSIGNED /* RF1.20 */
#define Board_SPI0_MOSI PIN_UNASSIGNED /* RF1.18 */
#define Board_SPI0_CLK PIN_UNASSIGNED /* RF1.16 */
#define Board_SPI0_CSN PIN_UNASSIGNED
#define Board_SPI1_MISO PIN_UNASSIGNED
#define Board_SPI1_MOSI PIN_UNASSIGNED
#define Board_SPI1_CLK PIN_UNASSIGNED
#define Board_SPI1_CSN PIN_UNASSIGNED
/* Power Management Board */
#define Board_SRDY Board_BP_Pin_J2_19
#define Board_MRDY Board_BP_Pin_J1_2
#define Board_SRDY PIN_UNASSIGNED
#define Board_MRDY PIN_UNASSIGNED
/* PWM outputs */
#define Board_PWMPIN0 PIN_UNASSIGNED
@@ -163,13 +167,14 @@ extern const PIN_Config BoardGpioInitTable[];
#define Board_PWMPIN4 PIN_UNASSIGNED
#define Board_PWMPIN5 PIN_UNASSIGNED
#define Board_PWMPIN6 PIN_UNASSIGNED
#define Board_PWMPIN7 PIN_UNASSIGNED
#define Board_PWMPIN7 IOID_4
/** ============================================================================
* Instance identifiers
* ==========================================================================*/
/* Generic SPI instance identifiers */
#define Board_SPI0 BOOSTXL_CC2650MA_SPI0
#define Board_SPI1 BOOSTXL_CC2650MA_SPI1
/* Generic UART instance identifiers */
#define Board_UART BOOSTXL_CC2650MA_UART0
/* Generic TRNG instance identiifer */
@@ -214,7 +219,7 @@ typedef enum BOOSTXL_CC2650MA_CryptoName {
*/
typedef enum BOOSTXL_CC2650MA_SPIName {
BOOSTXL_CC2650MA_SPI0 = 0,
BOOSTXL_CC2650MA_SPI1,
BOOSTXL_CC2650MA_SPICOUNT
} BOOSTXL_CC2650MA_SPIName;
@@ -294,6 +299,25 @@ typedef enum BOOSTXL_CC2650MA_PWM
BOOSTXL_CC2650MA_PWMCOUNT
} BOOSTXL_CC2650MA_PWM;
/*!
* @def CC2650_LAUNCHXL_ADCName
* @brief Enum of ADCs
*/
typedef enum BOOSTXL_CC2650MA_ADCName {
BOOSTXL_CC2650MA_ADC0 = 0,
BOOSTXL_CC2650MA_ADC1,
BOOSTXL_CC2650MA_ADC2,
BOOSTXL_CC2650MA_ADC3,
BOOSTXL_CC2650MA_ADC4,
BOOSTXL_CC2650MA_ADC5,
BOOSTXL_CC2650MA_ADC6,
BOOSTXL_CC2650MA_ADC7,
BOOSTXL_CC2650MA_ADCDCOUPL,
BOOSTXL_CC2650MA_ADCVSS,
BOOSTXL_CC2650MA_ADCVDDS,
BOOSTXL_CC2650MA_ADCCOUNT
} BOOSTXL_CC2650MA_ADCName;
#ifdef __cplusplus
}
#endif
@@ -0,0 +1,425 @@
/*
* 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.
*/
/*
* ====================== BOOSTXL_CC2650MA.c ===================================
* This file is responsible for setting up the board specific items for the
* CC2650 Booster Pack.
*/
/*
* ====================== Includes ============================================
*/
#include <xdc/std.h>
#include <xdc/runtime/System.h>
#include <ti/sysbios/family/arm/m3/Hwi.h>
#include <ti/drivers/PIN.h>
#include <ti/drivers/pin/PINCC26XX.h>
#include <ti/drivers/PWM.h>
#include <ti/drivers/pwm/PWMTimerCC26XX.h>
#include <ti/drivers/timer/GPTimerCC26XX.h>
#include <ti/drivers/Power.h>
#include <ti/drivers/power/PowerCC26XX.h>
#include <inc/hw_memmap.h>
#include <inc/hw_ints.h>
#include <driverlib/ioc.h>
#include <driverlib/udma.h>
#include "Board.h"
/*
* ========================= IO driver initialization =========================
* From main, PIN_init(BoardGpioInitTable) should be called to setup safe
* settings for this board.
* When a pin is allocated and then de-allocated, it will revert to the state
* configured in this table.
*/
/* Place into subsections to allow the TI linker to remove items properly */
#if defined(__TI_COMPILER_VERSION__)
#pragma DATA_SECTION(BoardGpioInitTable, ".const:BoardGpioInitTable")
#pragma DATA_SECTION(PINCC26XX_hwAttrs, ".const:PINCC26XX_hwAttrs")
#endif
const PIN_Config BoardGpioInitTable[] = {
Board_RLED | 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 */
Board_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX */
Board_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX */
Board_SRDY | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* SRDY */
Board_MRDY | PIN_INPUT_EN | PIN_PULLDOWN, /* MRDY */
PIN_TERMINATE
};
const PINCC26XX_HWAttrs PINCC26XX_hwAttrs = {
.intPriority = ~0,
.swiPriority = 0
};
/*============================================================================*/
/*
* ============================= Power begin ==================================
*/
/* Place into subsections to allow the TI linker to remove items properly */
#if defined(__TI_COMPILER_VERSION__)
#pragma DATA_SECTION(PowerCC26XX_config, ".const:PowerCC26XX_config")
#endif
const PowerCC26XX_Config PowerCC26XX_config = {
.policyInitFxn = NULL,
.policyFxn = &PowerCC26XX_standbyPolicy,
.calibrateFxn = &PowerCC26XX_calibrate,
.enablePolicy = TRUE,
.calibrateRCOSC_LF = TRUE,
.calibrateRCOSC_HF = TRUE,
};
/*
* ============================= Power end ====================================
*/
/*
* ============================= UART begin ===================================
*/
/* Place into subsections to allow the TI linker to remove items properly */
#if defined(__TI_COMPILER_VERSION__)
#pragma DATA_SECTION(UART_config, ".const:UART_config")
#pragma DATA_SECTION(uartCC26XXHWAttrs, ".const:uartCC26XXHWAttrs")
#endif
/* Include drivers */
#include <ti/drivers/UART.h>
#include <ti/drivers/uart/UARTCC26XX.h>
/* UART objects */
UARTCC26XX_Object uartCC26XXObjects[BOOSTXL_CC2650MA_UARTCOUNT];
/* UART hardware parameter structure, also used to assign UART pins */
const UARTCC26XX_HWAttrsV2 uartCC26XXHWAttrs[BOOSTXL_CC2650MA_UARTCOUNT] = {
{
.baseAddr = UART0_BASE,
.powerMngrId = PowerCC26XX_PERIPH_UART0,
.intNum = INT_UART0_COMB,
.intPriority = ~0,
.swiPriority = 0,
.txPin = Board_UART_TX,
.rxPin = Board_UART_RX,
.ctsPin = PIN_UNASSIGNED,
.rtsPin = PIN_UNASSIGNED
}
};
/* UART configuration structure */
const UART_Config UART_config[] = {
{
.fxnTablePtr = &UARTCC26XX_fxnTable,
.object = &uartCC26XXObjects[0],
.hwAttrs = &uartCC26XXHWAttrs[0]
},
{NULL, NULL, NULL}
};
/*
* ============================= UART end =====================================
*/
/*
* ============================= UDMA begin ===================================
*/
/* Place into subsections to allow the TI linker to remove items properly */
#if defined(__TI_COMPILER_VERSION__)
#pragma DATA_SECTION(UDMACC26XX_config, ".const:UDMACC26XX_config")
#pragma DATA_SECTION(udmaHWAttrs, ".const:udmaHWAttrs")
#endif
/* Include drivers */
#include <ti/drivers/dma/UDMACC26XX.h>
/* UDMA objects */
UDMACC26XX_Object udmaObjects[BOOSTXL_CC2650MA_UDMACOUNT];
/* UDMA configuration structure */
const UDMACC26XX_HWAttrs udmaHWAttrs[BOOSTXL_CC2650MA_UDMACOUNT] = {
{
.baseAddr = UDMA0_BASE,
.powerMngrId = PowerCC26XX_PERIPH_UDMA,
.intNum = INT_DMA_ERR,
.intPriority = ~0
}
};
/* UDMA configuration structure */
const UDMACC26XX_Config UDMACC26XX_config[] = {
{
.object = &udmaObjects[0],
.hwAttrs = &udmaHWAttrs[0]
},
{NULL, NULL}
};
/*
* ============================= UDMA end =====================================
*/
/*
* ========================== SPI DMA begin ===================================
*/
/* Place into subsections to allow the TI linker to remove items properly */
#if defined(__TI_COMPILER_VERSION__)
#pragma DATA_SECTION(SPI_config, ".const:SPI_config")
#pragma DATA_SECTION(spiCC26XXDMAHWAttrs, ".const:spiCC26XXDMAHWAttrs")
#endif
/* Include drivers */
#include <ti/drivers/spi/SPICC26XXDMA.h>
/* SPI objects */
SPICC26XXDMA_Object spiCC26XXDMAObjects[BOOSTXL_CC2650MA_SPICOUNT];
/* SPI configuration structure, describing which pins are to be used */
const SPICC26XXDMA_HWAttrsV1 spiCC26XXDMAHWAttrs[BOOSTXL_CC2650MA_UDMACOUNT] = {
{
.baseAddr = SSI0_BASE,
.intNum = INT_SSI0_COMB,
.intPriority = ~0,
.swiPriority = 0,
.powerMngrId = PowerCC26XX_PERIPH_SSI0,
.defaultTxBufValue = 0,
.rxChannelBitMask = 1<<UDMA_CHAN_SSI0_RX,
.txChannelBitMask = 1<<UDMA_CHAN_SSI0_TX,
.mosiPin = Board_SPI0_MOSI,
.misoPin = Board_SPI0_MISO,
.clkPin = Board_SPI0_CLK,
.csnPin = Board_SPI0_CS
},
};
/* SPI configuration structure */
const SPI_Config SPI_config[] = {
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[0],
.hwAttrs = &spiCC26XXDMAHWAttrs[0]
},
{
.fxnTablePtr = &SPICC26XXDMA_fxnTable,
.object = &spiCC26XXDMAObjects[1],
.hwAttrs = &spiCC26XXDMAHWAttrs[1]
},
{NULL, NULL, NULL}
};
/*
* ========================== SPI DMA end =====================================
*/
/*
* ========================== Crypto begin ====================================
* NOTE: The Crypto implementation should be considered experimental
* and not validated!
*/
/* Place into subsections to allow the TI linker to remove items properly */
#if defined(__TI_COMPILER_VERSION__)
#pragma DATA_SECTION(CryptoCC26XX_config, ".const:CryptoCC26XX_config")
#pragma DATA_SECTION(cryptoCC26XXHWAttrs, ".const:cryptoCC26XXHWAttrs")
#endif
/* Include drivers */
#include <ti/drivers/crypto/CryptoCC26XX.h>
/* Crypto objects */
CryptoCC26XX_Object cryptoCC26XXObjects[BOOSTXL_CC2650MA_CRYPTOCOUNT];
/* Crypto configuration structure, describing which pins are to be used */
const CryptoCC26XX_HWAttrs cryptoCC26XXHWAttrs[BOOSTXL_CC2650MA_CRYPTOCOUNT] = {
{
.baseAddr = CRYPTO_BASE,
.powerMngrId = PowerCC26XX_PERIPH_CRYPTO,
.intNum = INT_CRYPTO_RESULT_AVAIL_IRQ,
.intPriority = ~0,
}
};
/* Crypto configuration structure */
const CryptoCC26XX_Config CryptoCC26XX_config[] = {
{
.object = &cryptoCC26XXObjects[0],
.hwAttrs = &cryptoCC26XXHWAttrs[0]
},
{NULL, NULL}
};
/*
* ========================== Crypto end ======================================
*/
/*
* ========================= RF driver begin ==================================
*/
/* Place into subsections to allow the TI linker to remove items properly */
#if defined(__TI_COMPILER_VERSION__)
#pragma DATA_SECTION(RFCC26XX_hwAttrs, ".const:RFCC26XX_hwAttrs")
#endif
/* Include drivers */
#include <ti/drivers/rf/RF.h>
/* RF hwi and swi priority */
const RFCC26XX_HWAttrs RFCC26XX_hwAttrs = {
.hwiCpe0Priority = ~0,
.hwiHwPriority = ~0,
.swiCpe0Priority = 5,
.swiHwPriority = 5,
};
/*
* ========================== RF driver end ===================================
*/
/*
* ========================= TRNG begin ====================================
*/
/* Place into subsections to allow the TI linker to remove items properly */
#if defined(__TI_COMPILER_VERSION__)
#pragma DATA_SECTION(TRNGCC26XX_config, ".const:TRNGCC26XX_config")
#pragma DATA_SECTION(TRNGCC26XXHWAttrs, ".const:TRNGCC26XXHWAttrs")
#endif
/* Include drivers */
#include <TRNGCC26XX.h>
/* TRNG objects */
TRNGCC26XX_Object trngCC26XXObjects[BOOSTXL_CC2650MA_TRNGCOUNT];
/* TRNG configuration structure, describing which pins are to be used */
const TRNGCC26XX_HWAttrs TRNGCC26XXHWAttrs[BOOSTXL_CC2650MA_TRNGCOUNT] = {
{
.powerMngrId = PowerCC26XX_PERIPH_TRNG,
}
};
/* TRNG configuration structure */
const TRNGCC26XX_Config TRNGCC26XX_config[] = {
{
.object = &trngCC26XXObjects[0],
.hwAttrs = &TRNGCC26XXHWAttrs[0]
},
{NULL, NULL}
};
/*
* ========================= TRNG end ====================================
*/
/*
* ============================ GPTimer begin =================================
* Remove unused entries to reduce flash usage both in Board.c and Board.h
*/
/* Place into subsections to allow the TI linker to remove items properly */
#if defined(__TI_COMPILER_VERSION__)
#pragma DATA_SECTION(GPTimerCC26XX_config, ".const:GPTimerCC26XX_config")
#pragma DATA_SECTION(gptimerCC26xxHWAttrs, ".const:gptimerCC26xxHWAttrs")
#endif
/* GPTimer hardware attributes, one per timer part (Timer 0A, 0B, 1A, 1B..) */
const GPTimerCC26XX_HWAttrs gptimerCC26xxHWAttrs[BOOSTXL_CC2650MA_GPTIMERPARTSCOUNT] = {
{ .baseAddr = GPT0_BASE, .intNum = INT_GPT0A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0A, },
{ .baseAddr = GPT0_BASE, .intNum = INT_GPT0B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT0, .pinMux = GPT_PIN_0B, },
{ .baseAddr = GPT1_BASE, .intNum = INT_GPT1A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1A, },
{ .baseAddr = GPT1_BASE, .intNum = INT_GPT1B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT1, .pinMux = GPT_PIN_1B, },
{ .baseAddr = GPT2_BASE, .intNum = INT_GPT2A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2A, },
{ .baseAddr = GPT2_BASE, .intNum = INT_GPT2B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT2, .pinMux = GPT_PIN_2B, },
{ .baseAddr = GPT3_BASE, .intNum = INT_GPT3A, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3A, },
{ .baseAddr = GPT3_BASE, .intNum = INT_GPT3B, .intPriority = (~0), .powerMngrId = PowerCC26XX_PERIPH_GPT3, .pinMux = GPT_PIN_3B, },
};
/* GPTimer objects, one per full-width timer (A+B) (Timer 0, Timer 1..) */
GPTimerCC26XX_Object gptimerCC26XXObjects[BOOSTXL_CC2650MA_GPTIMERCOUNT];
/* GPTimer configuration (used as GPTimer_Handle by driver and application) */
const GPTimerCC26XX_Config GPTimerCC26XX_config[BOOSTXL_CC2650MA_GPTIMERPARTSCOUNT] = {
{ &gptimerCC26XXObjects[0], &gptimerCC26xxHWAttrs[0], GPT_A },
{ &gptimerCC26XXObjects[0], &gptimerCC26xxHWAttrs[1], GPT_B },
{ &gptimerCC26XXObjects[1], &gptimerCC26xxHWAttrs[2], GPT_A },
{ &gptimerCC26XXObjects[1], &gptimerCC26xxHWAttrs[3], GPT_B },
{ &gptimerCC26XXObjects[2], &gptimerCC26xxHWAttrs[4], GPT_A },
{ &gptimerCC26XXObjects[2], &gptimerCC26xxHWAttrs[5], GPT_B },
{ &gptimerCC26XXObjects[3], &gptimerCC26xxHWAttrs[6], GPT_A },
{ &gptimerCC26XXObjects[3], &gptimerCC26xxHWAttrs[7], GPT_B },
};
/*
* ============================ GPTimer end ===================================
*/
/*
* ============================= PWM begin ====================================
* Remove unused entries to reduce flash usage both in Board.c and Board.h
*/
/* Place into subsections to allow the TI linker to remove items properly */
#if defined(__TI_COMPILER_VERSION__)
#pragma DATA_SECTION(PWM_config, ".const:PWM_config")
#pragma DATA_SECTION(pwmtimerCC26xxHWAttrs, ".const:pwmtimerCC26xxHWAttrs")
#endif
/* PWM configuration, one per PWM output. */
PWMTimerCC26XX_HwAttrs pwmtimerCC26xxHWAttrs[BOOSTXL_CC2650MA_PWMCOUNT] = {
{ .pwmPin = Board_PWMPIN0, .gpTimerUnit = Board_GPTIMER0A },
{ .pwmPin = Board_PWMPIN1, .gpTimerUnit = Board_GPTIMER0B },
{ .pwmPin = Board_PWMPIN2, .gpTimerUnit = Board_GPTIMER1A },
{ .pwmPin = Board_PWMPIN3, .gpTimerUnit = Board_GPTIMER1B },
{ .pwmPin = Board_PWMPIN4, .gpTimerUnit = Board_GPTIMER2A },
{ .pwmPin = Board_PWMPIN5, .gpTimerUnit = Board_GPTIMER2B },
{ .pwmPin = Board_PWMPIN6, .gpTimerUnit = Board_GPTIMER3A },
{ .pwmPin = Board_PWMPIN7, .gpTimerUnit = Board_GPTIMER3B },
};
/* PWM object, one per PWM output */
PWMTimerCC26XX_Object pwmtimerCC26xxObjects[BOOSTXL_CC2650MA_PWMCOUNT];
extern const PWM_FxnTable PWMTimerCC26XX_fxnTable;
/* PWM configuration (used as PWM_Handle by driver and application) */
const PWM_Config PWM_config[BOOSTXL_CC2650MA_PWMCOUNT + 1] = {
{ &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[0], &pwmtimerCC26xxHWAttrs[0] },
{ &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[1], &pwmtimerCC26xxHWAttrs[1] },
{ &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[2], &pwmtimerCC26xxHWAttrs[2] },
{ &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[3], &pwmtimerCC26xxHWAttrs[3] },
{ &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[4], &pwmtimerCC26xxHWAttrs[4] },
{ &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[5], &pwmtimerCC26xxHWAttrs[5] },
{ &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[6], &pwmtimerCC26xxHWAttrs[6] },
{ &PWMTimerCC26XX_fxnTable, &pwmtimerCC26xxObjects[7], &pwmtimerCC26xxHWAttrs[7] },
{ NULL, NULL, NULL }
};
/*
* ============================= PWM end ======================================
*/
@@ -0,0 +1,301 @@
/*
* 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.
*/
/** ============================================================================
* @file BOOSTXL_CC2650MA.h
*
* @brief CC2650 Booster Pack Board Specific header file.
*
* NB! This is the board file for CC2650 Booster Pack
*
* ============================================================================
*/
#ifndef __BOOSTXL_CC2650MA_BOARD_H__
#define __BOOSTXL_CC2650MA_BOARD_H__
#ifdef __cplusplus
extern "C" {
#endif
/** ============================================================================
* Includes
* ==========================================================================*/
#include <ti/drivers/PIN.h>
#include <driverlib/ioc.h>
/** ============================================================================
* Externs
* ==========================================================================*/
extern const PIN_Config BoardGpioInitTable[];
/** ============================================================================
* Defines
* ==========================================================================*/
#define CC2650M5A // Configures RF front-end
/* Mapping of chip I/Os to DIO (Chip specific for the CC26xx/CC13xx familiy)
*/
#define DIO0 IOID_0
#define DIO1 IOID_1
#define DIO2 IOID_2
#define DIO3 IOID_3
#define DIO4 IOID_4
#define DIO5 IOID_5
#define DIO6 IOID_6
#define DIO7 IOID_7
#define DIO8 IOID_8
#define DIO9 IOID_9
#define DIO10 IOID_10
#define DIO11 IOID_11
#define DIO12 IOID_12
#define DIO13 IOID_13
#define DIO14 IOID_14
/* Mapping of pins to board signals using general board aliases
* <board signal alias> <pin mapping>
*/
/* Mapping of DIOs to BoosterPack Connector Pins (reflecting the schematic of tbe BoosterPack)
*/
/* Connector J1 */
#define Board_BP_Pin_J1_2 DIO7
#define Board_BP_Pin_J1_3 DIO0
#define Board_BP_Pin_J1_4 DIO1
#define Board_BP_Pin_J1_5 DIO2
#define Board_BP_Pin_J1_6 DIO3
#define Board_BP_Pin_J1_7 DIO10
#define Board_BP_Pin_J1_8 DIO4
#define Board_BP_Pin_J1_9 DIO5
#define Board_BP_Pin_J1_10 DIO6
/* Connector J2 */
#define Board_BP_Pin_J2_19 DIO8
#define Board_BP_Pin_J2_18 DIO9 /* CS */
#define Board_BP_Pin_J2_17 IOID_UNUSED /* NC */
#define Board_BP_Pin_J2_15 DIO11 /* MOSI */
#define Board_BP_Pin_J2_14 DIO12 /* MISO */
#define Board_BP_Pin_J2_13 DIO13
#define Board_BP_Pin_J2_12 DIO14
#define Board_BP_Pin_J2_11 IOID_UNUSED /* NC */
/* Mapping of BoosterPack Connector Pins to BoosterPack Standard Functions (reflecting the BoosterPack Standard)
*/
/* Connector J1 */
#define Board_BP_AnalogIn_0 Board_BP_Pin_J1_2
#define Board_BP_UART_Rx Board_BP_Pin_J1_3 /* To MCU on LaunchPad */
#define Board_BP_UART_Tx Board_BP_Pin_J1_4 /* From MCU on LauchPad*/
#define Board_BP_GPIO_0 Board_BP_Pin_J1_5
#define Board_BP_AnalogIn_1 Board_BP_Pin_J1_6
#define Board_BP_SPI_CLK Board_BP_Pin_J1_7
#define Board_BP_GPIO_1 Board_BP_Pin_J1_8
#define Board_BP_I2C_SCL Board_BP_Pin_J1_9
#define Board_BP_I2C_SDA Board_BP_Pin_J1_10
/* Connector J2 */
#define Board_BP_PWM_0 Board_BP_Pin_J2_19
#define Board_BP_SPI_CS_Wireless Board_BP_Pin_J2_18
#define Board_BP_GPIO_3 Board_BP_Pin_J2_17
#define Board_BP_SPI_MOSI Board_BP_Pin_J2_15
#define Board_BP_SPI_MISO Board_BP_Pin_J2_14
#define Board_BP_SPI_CS_Display Board_BP_Pin_J2_13
#define Board_BP_SPI_CS_Other Board_BP_Pin_J2_12
#define Board_BP_GPIO_2 Board_BP_Pin_J2_11
/* Mapping of application specific functionality of the BoosterPack to BoosterPack Pins (application dependent)
*/
/* On-board LEDs */
#define Board_GLED DIO2 /* Green LED */
#define Board_RLED DIO4 /* Red LED */
/* UART Board */
#define Board_UART_TX Board_BP_UART_Rx /* RXD */
#define Board_UART_RX Board_BP_UART_Tx /* TXD */
/* SPI Board */
#define Board_SPI0_MISO Board_BP_SPI_MISO
#define Board_SPI0_MOSI Board_BP_SPI_MOSI
#define Board_SPI0_CLK Board_BP_SPI_CLK
#define Board_SPI0_CS Board_BP_SPI_CS_Wireless
/* Power Management Board */
#define Board_SRDY Board_BP_Pin_J2_19
#define Board_MRDY Board_BP_Pin_J1_2
/* PWM outputs */
#define Board_PWMPIN0 PIN_UNASSIGNED
#define Board_PWMPIN1 PIN_UNASSIGNED
#define Board_PWMPIN2 PIN_UNASSIGNED
#define Board_PWMPIN3 PIN_UNASSIGNED
#define Board_PWMPIN4 PIN_UNASSIGNED
#define Board_PWMPIN5 PIN_UNASSIGNED
#define Board_PWMPIN6 PIN_UNASSIGNED
#define Board_PWMPIN7 PIN_UNASSIGNED
/** ============================================================================
* Instance identifiers
* ==========================================================================*/
/* Generic SPI instance identifiers */
#define Board_SPI0 BOOSTXL_CC2650MA_SPI0
/* Generic UART instance identifiers */
#define Board_UART BOOSTXL_CC2650MA_UART0
/* Generic TRNG instance identiifer */
#define Board_TRNG BOOSTXL_CC2650MA_TRNG0
/* Generic GPTimer instance identifiers */
#define Board_GPTIMER0A BOOSTXL_CC2650MA_GPTIMER0A
#define Board_GPTIMER0B BOOSTXL_CC2650MA_GPTIMER0B
#define Board_GPTIMER1A BOOSTXL_CC2650MA_GPTIMER1A
#define Board_GPTIMER1B BOOSTXL_CC2650MA_GPTIMER1B
#define Board_GPTIMER2A BOOSTXL_CC2650MA_GPTIMER2A
#define Board_GPTIMER2B BOOSTXL_CC2650MA_GPTIMER2B
#define Board_GPTIMER3A BOOSTXL_CC2650MA_GPTIMER3A
#define Board_GPTIMER3B BOOSTXL_CC2650MA_GPTIMER3B
/* Generic PWM instance identifiers */
#define Board_PWM0 BOOSTXL_CC2650MA_PWM0
#define Board_PWM1 BOOSTXL_CC2650MA_PWM1
#define Board_PWM2 BOOSTXL_CC2650MA_PWM2
#define Board_PWM3 BOOSTXL_CC2650MA_PWM3
#define Board_PWM4 BOOSTXL_CC2650MA_PWM4
#define Board_PWM5 BOOSTXL_CC2650MA_PWM5
#define Board_PWM6 BOOSTXL_CC2650MA_PWM6
#define Board_PWM7 BOOSTXL_CC2650MA_PWM7
/** ============================================================================
* Number of peripherals and their names
* ==========================================================================*/
/*!
* @def BOOSTXL_CC2650MA_CryptoName
* @brief Enum of Crypto names on the CC2650 Booster Pack
*/
typedef enum BOOSTXL_CC2650MA_CryptoName {
BOOSTXL_CC2650MA_CRYPTO0 = 0,
BOOSTXL_CC2650MA_CRYPTOCOUNT
} BOOSTXL_CC2650MA_CryptoName;
/*!
* @def BOOSTXL_CC2650MA_SPIName
* @brief Enum of SPI names on the CC2650 Booster Pack
*/
typedef enum BOOSTXL_CC2650MA_SPIName {
BOOSTXL_CC2650MA_SPI0 = 0,
BOOSTXL_CC2650MA_SPICOUNT
} BOOSTXL_CC2650MA_SPIName;
/*!
* @def BOOSTXL_CC2650MA_TRNGName
* @brief Enum of TRNG names on the board
*/
typedef enum BOOSTXL_CC2650MA_TRNGName {
BOOSTXL_CC2650MA_TRNG0 = 0,
BOOSTXL_CC2650MA_TRNGCOUNT
} BOOSTXL_CC2650MA_TRNGName;
/*!
* @def BOOSTXL_CC2650MA_UARTName
* @brief Enum of UARTs on the CC2650 Booster Pack
*/
typedef enum BOOSTXL_CC2650MA_UARTName {
BOOSTXL_CC2650MA_UART0 = 0,
BOOSTXL_CC2650MA_UARTCOUNT
} BOOSTXL_CC2650MA_UARTName;
/*!
* @def BOOSTXL_CC2650MA_UdmaName
* @brief Enum of DMA buffers
*/
typedef enum BOOSTXL_CC2650MA_UdmaName {
BOOSTXL_CC2650MA_UDMA0 = 0,
BOOSTXL_CC2650MA_UDMACOUNT
} BOOSTXL_CC2650MA_UdmaName;
/*!
* @def BOOSTXL_CC2650MA_GPTimerName
* @brief Enum of GPTimer parts
*/
typedef enum BOOSTXL_CC2650MA_GPTimerName
{
BOOSTXL_CC2650MA_GPTIMER0A = 0,
BOOSTXL_CC2650MA_GPTIMER0B,
BOOSTXL_CC2650MA_GPTIMER1A,
BOOSTXL_CC2650MA_GPTIMER1B,
BOOSTXL_CC2650MA_GPTIMER2A,
BOOSTXL_CC2650MA_GPTIMER2B,
BOOSTXL_CC2650MA_GPTIMER3A,
BOOSTXL_CC2650MA_GPTIMER3B,
BOOSTXL_CC2650MA_GPTIMERPARTSCOUNT
} BOOSTXL_CC2650MA_GPTimerName;
/*!
* @def BOOSTXL_CC2650MA_GPTimers
* @brief Enum of GPTimers
*/
typedef enum BOOSTXL_CC2650MA_GPTimers
{
BOOSTXL_CC2650MA_GPTIMER0 = 0,
BOOSTXL_CC2650MA_GPTIMER1,
BOOSTXL_CC2650MA_GPTIMER2,
BOOSTXL_CC2650MA_GPTIMER3,
BOOSTXL_CC2650MA_GPTIMERCOUNT
} BOOSTXL_CC2650MA_GPTimers;
/*!
* @def BOOSTXL_CC2650MA_PWM
* @brief Enum of PWM outputs on the board
*/
typedef enum BOOSTXL_CC2650MA_PWM
{
BOOSTXL_CC2650MA_PWM0 = 0,
BOOSTXL_CC2650MA_PWM1,
BOOSTXL_CC2650MA_PWM2,
BOOSTXL_CC2650MA_PWM3,
BOOSTXL_CC2650MA_PWM4,
BOOSTXL_CC2650MA_PWM5,
BOOSTXL_CC2650MA_PWM6,
BOOSTXL_CC2650MA_PWM7,
BOOSTXL_CC2650MA_PWMCOUNT
} BOOSTXL_CC2650MA_PWM;
#ifdef __cplusplus
}
#endif
#endif /* __BOOSTXL_CC2650MA_BOARD_H__ */
@@ -68,8 +68,8 @@ extern const PIN_Config BoardGpioInitTable[];
*/
/* Discrete outputs */
#define Board_RLED IOID_6
#define Board_GLED IOID_7
#define Board_RLED PIN_UNASSIGNED
#define Board_GLED PIN_UNASSIGNED
#define Board_LED_ON 1
#define Board_LED_OFF 0
@@ -84,9 +84,9 @@ extern const PIN_Config BoardGpioInitTable[];
#define Board_UART_RTS IOID_18 /* RTS */
/* SPI Board */
#define Board_SPI0_MISO IOID_8 /* RF1.20 */
#define Board_SPI0_MOSI IOID_9 /* RF1.18 */
#define Board_SPI0_CLK IOID_10 /* RF1.16 */
#define Board_SPI0_MISO PIN_UNASSIGNED /* RF1.20 */
#define Board_SPI0_MOSI PIN_UNASSIGNED /* RF1.18 */
#define Board_SPI0_CLK PIN_UNASSIGNED /* RF1.16 */
#define Board_SPI0_CSN PIN_UNASSIGNED
#define Board_SPI1_MISO PIN_UNASSIGNED
#define Board_SPI1_MOSI PIN_UNASSIGNED
@@ -94,8 +94,8 @@ extern const PIN_Config BoardGpioInitTable[];
#define Board_SPI1_CSN PIN_UNASSIGNED
/* I2C */
#define Board_I2C0_SCL0 IOID_4
#define Board_I2C0_SDA0 IOID_5
#define Board_I2C0_SCL0 PIN_UNASSIGNED
#define Board_I2C0_SDA0 PIN_UNASSIGNED
/* SPI */
#define Board_SPI_FLASH_CS IOID_20
@@ -130,14 +130,14 @@ extern const PIN_Config BoardGpioInitTable[];
#define Board_LCD_CS_OFF 0
/* PWM outputs */
#define Board_PWMPIN0 Board_RLED
#define Board_PWMPIN1 Board_GLED
#define Board_PWMPIN2 PIN_UNASSIGNED
#define Board_PWMPIN3 PIN_UNASSIGNED
#define Board_PWMPIN4 PIN_UNASSIGNED
#define Board_PWMPIN5 PIN_UNASSIGNED
#define Board_PWMPIN6 PIN_UNASSIGNED
#define Board_PWMPIN7 PIN_UNASSIGNED
#define Board_PWMPIN0 PIN_UNASSIGNED
#define Board_PWMPIN1 PIN_UNASSIGNED
#define Board_PWMPIN2 PIN_UNASSIGNED
#define Board_PWMPIN3 PIN_UNASSIGNED
#define Board_PWMPIN4 PIN_UNASSIGNED
#define Board_PWMPIN5 PIN_UNASSIGNED
#define Board_PWMPIN6 PIN_UNASSIGNED
#define Board_PWMPIN7 IOID_4
/** ============================================================================
* Instance identifiers
View File
View File
View File
View File
View File
View File
View File
@@ -55,7 +55,7 @@ extern "C"
// includes
// ****************************************************************************
#include "hal_types.h"
#include "npi/src/inc/npi_config.h"
#include "inc/npi_config.h"
// ****************************************************************************
// defines
View File
View File
View File
View File
View File
View File
File diff suppressed because it is too large Load Diff
@@ -9,7 +9,7 @@
Target Device: CC2650, CC2640
******************************************************************************
Copyright (c) 2013-2018, Texas Instruments Incorporated
All rights reserved.
@@ -49,37 +49,16 @@
#define HOSTESTAPP_H
#ifdef __cplusplus
extern "C"
{
extern "C" {
#endif
/*********************************************************************
* INCLUDES
*/
/*********************************************************************
* CONSTANTS
*/
/*********************************************************************
* MACROS
*/
/*********************************************************************
* FUNCTIONS
*/
/*
* Task creation function for the Host Test App.
*/
extern void HostTestApp_createTask(void);
/*********************************************************************
*********************************************************************/
#ifdef __cplusplus
}
#endif
#endif /* HOSTESTAPP_H */
#endif
@@ -8,7 +8,7 @@
Target Device: CC2650, CC2640
******************************************************************************
Copyright (c) 2013-2018, Texas Instruments Incorporated
All rights reserved.
@@ -44,26 +44,29 @@
Release Date: 2018-04-02 18:03:35
*****************************************************************************/
/*******************************************************************************
* INCLUDES
*/
#include <xdc/runtime/Error.h>
#include <ti/drivers/Power.h>
#include <ti/drivers/power/PowerCC26XX.h>
#include <ti/sysbios/BIOS.h>
#include "icall.h"
#include "hal_assert.h"
#include "board.h"
#include "hal_assert.h"
#include "icall.h"
#include "inc/npi_task.h"
#include "host_test_app.h"
/* Header files required to enable instruction fetch cache */
#include <inc/hw_memmap.h>
#include <driverlib/vims.h>
#include <inc/hw_memmap.h>
#ifndef USE_DEFAULT_USER_CFG
#include "ble_user_config.h"
@@ -71,70 +74,12 @@
// BLE user defined configuration
bleUserCfg_t user0Cfg = BLE_USER_CFG;
#endif // USE_DEFAULT_USER_CFG
#endif // USE_DEFAULT_USER_CFG
#include <ti/mw/display/Display.h>
#ifdef USE_FPGA
#include <inc/hw_prcm.h>
#endif // USE_FPGA
/*******************************************************************************
* MACROS
*/
/*******************************************************************************
* CONSTANTS
*/
#if defined( USE_FPGA )
#define RFC_MODE_BLE PRCM_RFCMODESEL_CURR_MODE1
#define RFC_MODE_ANT PRCM_RFCMODESEL_CURR_MODE4
#define RFC_MODE_EVERYTHING_BUT_ANT PRCM_RFCMODESEL_CURR_MODE5
#define RFC_MODE_EVERYTHING PRCM_RFCMODESEL_CURR_MODE6
//
#define SET_RFC_BLE_MODE(mode) HWREG( PRCM_BASE + PRCM_O_RFCMODESEL ) = (mode)
#endif // USE_FPGA
/*******************************************************************************
* TYPEDEFS
*/
/*******************************************************************************
* LOCAL VARIABLES
*/
/*******************************************************************************
* 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
*/
extern void AssertHandler(uint8 assertCause, uint8 assertSubcause);
extern Display_Handle dispHandle;
/*******************************************************************************
/*
* @fn Main
*
* @brief Application Main
@@ -149,68 +94,38 @@ extern Display_Handle dispHandle;
*
* @return None.
*/
int main()
{
#if defined( USE_FPGA )
HWREG(PRCM_BASE + PRCM_O_PDCTL0) &= ~PRCM_PDCTL0_RFC_ON;
HWREG(PRCM_BASE + PRCM_O_PDCTL1) &= ~PRCM_PDCTL1_RFC_ON;
#endif // USE_FPGA
int main() {
/* Register Application callback to trap asserts raised in the Stack */
RegisterAssertCback(AssertHandler);
/* Register Application callback to trap asserts raised in the Stack */
RegisterAssertCback(AssertHandler);
PIN_init(BoardGpioInitTable);
PIN_init(BoardGpioInitTable);
#ifdef CC1350_LAUNCHXL
// Enable 2.4GHz Radio
radCtrlHandle = PIN_open(&radCtrlState, radCtrlCfg);
// Enable iCache prefetching
VIMSConfigure(VIMS_BASE, TRUE, TRUE);
#ifdef POWER_SAVING
Power_registerNotify(&rFSwitchPowerNotifyObj,
PowerCC26XX_ENTERING_STANDBY | PowerCC26XX_AWAKE_STANDBY,
(Power_NotifyFxn) rFSwitchNotifyCb, NULL);
#endif //POWER_SAVING
#endif //CC1350_LAUNCHXL
// Enable cache
VIMSModeSet(VIMS_BASE, VIMS_MODE_ENABLED);
#if defined( USE_FPGA )
// set RFC mode to support BLE
// Note: This must be done before the RF Core is released from reset!
SET_RFC_BLE_MODE(RFC_MODE_BLE);
#endif // USE_FPGA
/* Initialize ICall module */
ICall_init();
// Enable iCache prefetching
VIMSConfigure(VIMS_BASE, TRUE, TRUE);
/* Start tasks of external images */
ICall_createRemoteTasks();
// Enable cache
VIMSModeSet(VIMS_BASE, VIMS_MODE_ENABLED);
/* Kick off application */
HostTestApp_createTask();
#if !defined( POWER_SAVING ) || defined( USE_FPGA )
/* Set constraints for Standby, powerdown and idle mode */
// PowerCC26XX_SB_DISALLOW may be redundant
Power_setConstraint(PowerCC26XX_SB_DISALLOW);
Power_setConstraint(PowerCC26XX_IDLE_PD_DISALLOW);
#endif // POWER_SAVING | USE_FPGA
/* Kick off NPI */
NPITask_createTask(ICALL_SERVICE_CLASS_BLE);
/* Initialize ICall module */
ICall_init();
/* enable interrupts and start SYS/BIOS */
BIOS_start();
/* Start tasks of external images */
ICall_createRemoteTasks();
/* Kick off application */
HostTestApp_createTask();
/* Kick off NPI */
NPITask_createTask(ICALL_SERVICE_CLASS_BLE);
/* enable interrupts and start SYS/BIOS */
BIOS_start();
return 0;
return 0;
}
/*******************************************************************************
/*
* @fn AssertHandler
*
* @brief This is the Application's callback handler for asserts raised
@@ -246,57 +161,9 @@ int main()
*
* @return None.
*/
void AssertHandler(uint8 assertCause, uint8 assertSubcause)
{
// Open the display if the app has not already done so
if ( !dispHandle )
{
dispHandle = Display_open(Display_Type_LCD, NULL);
}
void AssertHandler(uint8 assertCause, uint8 assertSubcause) {}
Display_print0(dispHandle, 0, 0, ">>>STACK ASSERT");
// check the assert cause
switch (assertCause)
{
// This assert is raised from the BLE Stack when a malloc failure occurs.
case HAL_ASSERT_CAUSE_OUT_OF_MEMORY:
Display_print0(dispHandle, 0, 0, "***ERROR***");
Display_print0(dispHandle, 2, 0, ">> OUT OF MEMORY!");
break;
case HAL_ASSERT_CAUSE_INTERNAL_ERROR:
// check the subcause
if (assertSubcause == HAL_ASSERT_SUBCAUSE_FW_INERNAL_ERROR)
{
Display_print0(dispHandle, 0, 0, "***ERROR***");
Display_print0(dispHandle, 2, 0, ">> INTERNAL FW ERROR!");
}
else
{
Display_print0(dispHandle, 0, 0, "***ERROR***");
Display_print0(dispHandle, 2, 0, ">> INTERNAL ERROR!");
}
break;
// An assert originating from an ICall failure.
case HAL_ASSERT_CAUSE_ICALL_ABORT:
Display_print0(dispHandle, 0, 0, "***ERROR***");
Display_print0(dispHandle, 2, 0, ">> ICALL ABORT!");
HAL_ASSERT_SPINLOCK;
break;
default:
Display_print0(dispHandle, 0, 0, "***ERROR***");
Display_print0(dispHandle, 2, 0, ">> DEFAULT SPINLOCK!");
HAL_ASSERT_SPINLOCK;
}
return;
}
/*******************************************************************************
/*
* @fn exceptionHandler
*
* @brief Generic spinlock to trap RTOS raised errors.
@@ -311,13 +178,11 @@ void AssertHandler(uint8 assertCause, uint8 assertSubcause)
*
* @return None.
*/
void exceptionHandler( void )
{
volatile uint8 i = 1;
while(i);
void exceptionHandler(void) {
for (;;);
}
/*******************************************************************************
/*
* @fn smallErrorHook
*
* @brief Error handler to be hooked into TI-RTOS.
@@ -332,45 +197,6 @@ void exceptionHandler( void )
*
* @return None.
*/
void smallErrorHook(Error_Block *eb)
{
for (;;);
void smallErrorHook(Error_Block *eb) {
for (;;);
}
#if defined (CC1350_LAUNCHXL) && defined (POWER_SAVING)
/*******************************************************************************
* @fn rFSwitchNotifyCb
*
* @brief Power driver callback to toggle RF switch on Power state
* transitions.
*
* input parameters
*
* @param eventType - The state change.
* @param eventArg - Not used.
* @param clientArg - Not used.
*
* @return Power_NOTIFYDONE to indicate success.
*/
static uint8_t rFSwitchNotifyCb(uint8_t eventType, uint32_t *eventArg,
uint32_t *clientArg)
{
if (eventType == PowerCC26XX_ENTERING_STANDBY)
{
// Power down RF Switch
PIN_setOutputValue(radCtrlHandle, Board_DIO30_SWPWR, 0);
}
else if (eventType == PowerCC26XX_AWAKE_STANDBY)
{
// Power up RF Switch
PIN_setOutputValue(radCtrlHandle, Board_DIO30_SWPWR, 1);
}
// Notification handled successfully
return Power_NOTIFYDONE;
}
#endif //CC1350_LAUNCHXL || POWER_SAVING
/*******************************************************************************
*/
@@ -0,0 +1,520 @@
/*
* headstage_Uni.h
*
* Created on: 2018/10/5
* Author: s8807
*/
/*
===================
SET UP flow
===================
Raspberry Pi3 -> transmit instruction -> echo for set up done -> next instruction
===================
UNI1.2 control flow
===================
state machine architecture
--------------------------
(power on reset)
goto UMC_STATE_IDLE
(any state)
recv VIS_RST
goto UMC_STATE_IDLE
UMC_STATE_IDLE
goto UMC_STATE_HANDSHAKE
UMC_STATE_HANDSHAKE
need to check HANDSHAKE
if (handshake pass)
transmit UMC_HANDSHAKE_RESPONS
goto UMC_STATE_HANDSHAKE_RECEIVE
else
still recv handshake until it pass
UMC_STATE_HANDSHAKE_RECEIVE
cc2650 check PASS or FAIL
if( PASS )
goto UMC_STATE_INITIAL
else
cc2650 send HANDSHAKE_RESPONSE again until it recv pass
UMC_STATE_INITIAL
choose LSK format and define chip ID
goto UMC_STATE_CONFIGURE
UMC_STATE_CONFIGURE
# configuration UMC parameter
# cc2650 configure UMC parameter 1 by 1
# finally , send config done to exit config state
cc2650 recv [pass / fail]
if CONFIG_DONE is sent
goto UMC_STATE_WAIT_START
else
still configure UMC parameter
UMC_STATE_WAIT_START
# and pull-up trigger (gpio)
according to UMC_BHVR :
case : goto UMC_STATE_CONTINUOUS
case : goto UMC_STATE_LIMITED
case : goto UMC_STATE_WAIT_TRIGGER
UMC_STATE_TRIGGER
TODO (implement trigger code to do stimulus)
# DBS do the stimulus when it receive trigger
# otherwise , it will only record data
cc2650 send TRIGGER
goto UMC_STATE_WAIT_TRIGGER
send INTERRUPT
goto UMC_STATE_CONFIGURE
UMC_STATE_CONTINUOUS
# DBS will continuously stimulate brain and record data
send INTERRUPT
goto UMC_STATE_CONFIGURE
UMC_STATE_LIMITED
TODO (need to go back to config data)
# DBS will stimulate several times and record data
send INTERRUPT
goto UMC_STATE_CONFIGURE
*/
/*
// SIS is rebuild
| | 1 | 2 | 3 | |
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0
---------------------------------------------------------------------------------
| SIS | ID | length |0b001|AGN_U| SPW | SRT |S_B| UNI_S_F | UMC specific parameters
SRT
stimulus repeats times
SPW
stimulus pulse width
STI_F
stimulus frequency for uni
AGN_U
amp gain of UMC
S_B
stimulation behavior .
continuous mode , trigger mode or limited mode
*/
/*
* TODO list :
* bluetooth disconnect issue
* OAD : over air download
*/
#ifndef HEADSTAGE_H
#error "headstage.h not include"
#endif
#ifdef HEADSTAGE_H_H
#error "headstage_*.h has be included"
#endif
#ifndef NEULIVESTI_H
#define HEADSTAGE_H_H
#define NEULIVESTI_H
#define UNI
// product information
#define DEVICE_NAME "NeuliveSTI-M0.1"
#define MAJOR_PRODUCT_NUMBER 1
#define MINOR_PRODUCT_NUMBER 2
#define MAJOR_VERSION_NUMBER 0
#define MINOR_VERSION_NUMBER 1
#include <ti/drivers/PIN.h>
#include "board.h"
extern PWM_Handle hPWM;
extern PWM_Params pp;
extern GPTimerCC26XX_Handle hTimer;
extern GPTimerCC26XX_Handle hTimer_1;
extern GPTimerCC26XX_Handle hTimer_2;
extern ADC_Handle adc;
extern ADC_Handle adc_1;
extern ADC_Handle adc_2;
extern ADC_Params params;
extern ADC_Params params_1;
extern ADC_Params params_2;
/* application use SPI parameters and buffers */
/**
* initialize parameter and device.
*/
static void NeuLiveSTI_init() {
GPTimerCC26XX_Params params;
GPTimerCC26XX_Params_init(&params);
params.width = GPT_CONFIG_16BIT;
params.mode = GPT_MODE_PERIODIC_DOWN;
params.debugStallMode = GPTimerCC26XX_DEBUG_STALL_OFF;
hTimer = GPTimerCC26XX_open(BOOSTXL_CC2650MA_GPTIMER0A, &params);
hTimer_1 = GPTimerCC26XX_open(BOOSTXL_CC2650MA_GPTIMER1A, &params);
hTimer_2 = GPTimerCC26XX_open(BOOSTXL_CC2650MA_GPTIMER2A, &params);
// hTimer = GPTimerCC26XX_open(CC2650_LAUNCHXL_GPTIMER0A, &params);
// hTimer_1 = GPTimerCC26XX_open(CC2650_LAUNCHXL_GPTIMER1A, &params);
// hTimer_2 = GPTimerCC26XX_open(CC2650_LAUNCHXL_GPTIMER2A, &params);
GPTimerCC26XX_setLoadValue(hTimer, 0xFFFFFF);
GPTimerCC26XX_setLoadValue(hTimer_1, 0xFFFFFF);
GPTimerCC26XX_setLoadValue(hTimer_2, 0xFFFFFF);
GPTimerCC26XX_registerInterrupt(hTimer, GPTimer_callback, GPT_INT_TIMEOUT);
GPTimerCC26XX_registerInterrupt(hTimer_1, GPTimer_callback_1, GPT_INT_TIMEOUT);
GPTimerCC26XX_registerInterrupt(hTimer_2, GPTimer_callback_2, GPT_INT_TIMEOUT);
GPTimerCC26XX_start(hTimer);
GPTimerCC26XX_start(hTimer_1);
GPTimerCC26XX_start(hTimer_2);
PWM_init();
PWM_Params_init(&pp);
pp.idleLevel = PWM_IDLE_LOW;
pp.periodUnits = PWM_PERIOD_COUNTS;
pp.periodValue = duty_max_value;
pp.dutyUnits = PWM_DUTY_COUNTS;
pp.dutyValue = 1;
hPWM = PWM_open(BOOSTXL_CC2650MA_PWM7,&pp);
// hPWM = PWM_open(CC2650_LAUNCHXL_PWM7,&pp);
PWM_start(hPWM);
ADC_init();
ADC_Params_init(&params);
ADC_Params_init(&params_1);
ADC_Params_init(&params_2);
adc = ADC_open(BOOSTXL_CC2650MA_ADC0, &params);
adc_1 = ADC_open(BOOSTXL_CC2650MA_ADC1, &params_1);
adc_2 = ADC_open(BOOSTXL_CC2650MA_ADC2, &params_2);
// adc = ADC_open( CC2650_LAUNCHXL_ADC0, &params);
// adc_1 = ADC_open( CC2650_LAUNCHXL_ADC1, &params_1);
// adc_2 = ADC_open( CC2650_LAUNCHXL_ADC2, &params_2);
}
static void sti_mode(uint8_t channel,uint8_t mode){
switch(channel){
case(0x00):{
switch(mode){
case(0x00):{
PIN_setOutputValue(Test_handle, IOID_10, 0);
PIN_setOutputValue(Test_handle, IOID_11, 1);
// for(int i=0;i<((INSTRUCTION.first_ch_pulse_width*700)/2)/699-4;i++){
for(int i=0;i<INSTRUCTION.first_ch_pulse_width;i++){
PIN_setOutputValue(Test_handle, IOID_0, 1);
// PIN_setOutputValue(Test_handle, IOID_0, 0);
}
// SBP_collect_recording_data(0x00);
PIN_setOutputValue(Test_handle, IOID_11, 0);
break;
}
case(0x01):{
PIN_setOutputValue(Test_handle, IOID_10, 1);
PIN_setOutputValue(Test_handle, IOID_11, 1);
for(int i=0;i<INSTRUCTION.first_ch_pulse_width;i++){
PIN_setOutputValue(Test_handle, IOID_0, 1);
// PIN_setOutputValue(Test_handle, IOID_0, 0);
}
PIN_setOutputValue(Test_handle, IOID_11, 0);
break;
}
case(0x02):{
PIN_setOutputValue(Test_handle, IOID_10, 0);
PIN_setOutputValue(Test_handle, IOID_11, 1);
for(int i=0;i<INSTRUCTION.first_ch_pulse_width;i++){
PIN_setOutputValue(Test_handle, IOID_0, 1);
// PIN_setOutputValue(Test_handle, IOID_0, 0);
}
PIN_setOutputValue(Test_handle, IOID_10, 1);
for(int i=0;i<INSTRUCTION.first_ch_pulse_width;i++){
PIN_setOutputValue(Test_handle, IOID_0, 1);
// PIN_setOutputValue(Test_handle, IOID_0, 0);
}
PIN_setOutputValue(Test_handle, IOID_11, 0);
break;
}
case(0x03):{
PIN_setOutputValue(Test_handle, IOID_10, 1);
PIN_setOutputValue(Test_handle, IOID_11, 1);
for(int i=0;i<INSTRUCTION.first_ch_pulse_width;i++){
PIN_setOutputValue(Test_handle, IOID_0, 1);
// PIN_setOutputValue(Test_handle, IOID_0, 0);
}
PIN_setOutputValue(Test_handle, IOID_10, 0);
for(int i=0;i<INSTRUCTION.first_ch_pulse_width;i++){
PIN_setOutputValue(Test_handle, IOID_0, 1);
// PIN_setOutputValue(Test_handle, IOID_0, 0);
}
PIN_setOutputValue(Test_handle, IOID_11, 0);
break;
}
}
break;
}
case(0x01):{
switch(mode){
case(0x00):{
PIN_setOutputValue(Test_handle, IOID_6, 0);
PIN_setOutputValue(Test_handle, IOID_5, 1);
for(int i=0;i<INSTRUCTION.second_ch_pulse_width;i++){
PIN_setOutputValue(Test_handle, IOID_1, 1);
// PIN_setOutputValue(Test_handle, IOID_1, 0);
}
PIN_setOutputValue(Test_handle, IOID_5, 0);
break;
}
case(0x01):{
PIN_setOutputValue(Test_handle, IOID_6, 1);
PIN_setOutputValue(Test_handle, IOID_5, 1);
for(int i=0;i<INSTRUCTION.second_ch_pulse_width;i++){
PIN_setOutputValue(Test_handle, IOID_1, 1);
// PIN_setOutputValue(Test_handle, IOID_1, 0);
}
PIN_setOutputValue(Test_handle, IOID_5, 0);
break;
}
case(0x02):{
PIN_setOutputValue(Test_handle, IOID_6, 0);
PIN_setOutputValue(Test_handle, IOID_5, 1);
for(int i=0;i<INSTRUCTION.second_ch_pulse_width;i++){
PIN_setOutputValue(Test_handle, IOID_1, 1);
// PIN_setOutputValue(Test_handle, IOID_1, 0);
}
PIN_setOutputValue(Test_handle, IOID_6, 1);
for(int i=0;i<INSTRUCTION.second_ch_pulse_width;i++){
PIN_setOutputValue(Test_handle, IOID_1, 1);
// PIN_setOutputValue(Test_handle, IOID_1, 0);
}
PIN_setOutputValue(Test_handle, IOID_5, 0);
break;
}
case(0x03):{
PIN_setOutputValue(Test_handle, IOID_6, 1);
PIN_setOutputValue(Test_handle, IOID_5, 1);
for(int i=0;i<INSTRUCTION.second_ch_pulse_width;i++){
PIN_setOutputValue(Test_handle, IOID_1, 1);
// PIN_setOutputValue(Test_handle, IOID_1, 0);
}
PIN_setOutputValue(Test_handle, IOID_6, 0);
for(int i=0;i<INSTRUCTION.second_ch_pulse_width;i++){
PIN_setOutputValue(Test_handle, IOID_1, 1);
// PIN_setOutputValue(Test_handle, IOID_1, 0);
}
PIN_setOutputValue(Test_handle, IOID_5, 0);
break;
}
}
break;
}
NeuLiveSTI_collect_recording_data(0x01);
}
}
static void sti_mode_IPI(uint8_t channel,uint8_t mode){
switch(channel){
case(0x00):{
switch(mode){
case(0x00):{
PIN_setOutputValue(Test_handle, IOID_10, 0);
PIN_setOutputValue(Test_handle, IOID_11, 1);
for(int i=0;i<INSTRUCTION.first_ch_pulse_width;i++){
PIN_setOutputValue(Test_handle, IOID_0, 1);
// PIN_setOutputValue(Test_handle, IOID_0, 0);
}
PIN_setOutputValue(Test_handle, IOID_11, 0);
break;
}
case(0x01):{
PIN_setOutputValue(Test_handle, IOID_10, 1);
PIN_setOutputValue(Test_handle, IOID_11, 1);
for(int i=0;i<INSTRUCTION.first_ch_pulse_width;i++){
PIN_setOutputValue(Test_handle, IOID_0, 1);
// PIN_setOutputValue(Test_handle, IOID_0, 0);
}
PIN_setOutputValue(Test_handle, IOID_11, 0);
break;
}
case(0x02):{
PIN_setOutputValue(Test_handle, IOID_10, 0);
PIN_setOutputValue(Test_handle, IOID_11, 1);
for(int i=0;i<INSTRUCTION.first_ch_pulse_width;i++){
PIN_setOutputValue(Test_handle, IOID_0, 1);
// PIN_setOutputValue(Test_handle, IOID_0, 0);
}
PIN_setOutputValue(Test_handle, IOID_11, 0);
for(int i=0;i<INSTRUCTION.first_ch_pw_IPI;i++){
PIN_setOutputValue(Test_handle, IOID_0, 1);
// PIN_setOutputValue(Test_handle, IOID_0, 0);
}
PIN_setOutputValue(Test_handle, IOID_11, 1);
PIN_setOutputValue(Test_handle, IOID_10, 1);
for(int i=0;i<INSTRUCTION.first_ch_pulse_width;i++){
PIN_setOutputValue(Test_handle, IOID_0, 1);
// PIN_setOutputValue(Test_handle, IOID_0, 0);
}
PIN_setOutputValue(Test_handle, IOID_11, 0);
break;
}
case(0x03):{
PIN_setOutputValue(Test_handle, IOID_10, 1);
PIN_setOutputValue(Test_handle, IOID_11, 1);
for(int i=0;i<INSTRUCTION.first_ch_pulse_width;i++){
PIN_setOutputValue(Test_handle, IOID_0, 1);
// PIN_setOutputValue(Test_handle, IOID_0, 0);
}
PIN_setOutputValue(Test_handle, IOID_11, 0);
for(int i=0;i<INSTRUCTION.first_ch_pw_IPI;i++){
PIN_setOutputValue(Test_handle, IOID_0, 1);
// PIN_setOutputValue(Test_handle, IOID_0, 0);
}
PIN_setOutputValue(Test_handle, IOID_11, 1);
PIN_setOutputValue(Test_handle, IOID_10, 0);
for(int i=0;i<INSTRUCTION.first_ch_pulse_width;i++){
PIN_setOutputValue(Test_handle, IOID_0, 1);
// PIN_setOutputValue(Test_handle, IOID_0, 0);
}
PIN_setOutputValue(Test_handle, IOID_11, 0);
break;
}
}
NeuLiveSTI_collect_recording_data(0x00);
break;
}
case(0x01):{
switch(mode){
case(0x00):{
PIN_setOutputValue(Test_handle, IOID_6, 0);
PIN_setOutputValue(Test_handle, IOID_5, 1);
for(int i=0;i<INSTRUCTION.second_ch_pulse_width;i++){
PIN_setOutputValue(Test_handle, IOID_1, 1);
// PIN_setOutputValue(Test_handle, IOID_1, 0);
}
PIN_setOutputValue(Test_handle, IOID_5, 0);
break;
}
case(0x01):{
PIN_setOutputValue(Test_handle, IOID_6, 1);
PIN_setOutputValue(Test_handle, IOID_5, 1);
for(int i=0;i<INSTRUCTION.second_ch_pulse_width;i++){
PIN_setOutputValue(Test_handle, IOID_1, 1);
// PIN_setOutputValue(Test_handle, IOID_1, 0);
}
PIN_setOutputValue(Test_handle, IOID_5, 0);
break;
}
case(0x02):{
PIN_setOutputValue(Test_handle, IOID_6, 0);
PIN_setOutputValue(Test_handle, IOID_5, 1);
for(int i=0;i<INSTRUCTION.second_ch_pulse_width;i++){
PIN_setOutputValue(Test_handle, IOID_1, 1);
// PIN_setOutputValue(Test_handle, IOID_1, 0);
}
PIN_setOutputValue(Test_handle, IOID_5, 0);
for(int i=0;i<INSTRUCTION.second_ch_pw_IPI;i++){
PIN_setOutputValue(Test_handle, IOID_1, 1);
// PIN_setOutputValue(Test_handle, IOID_1, 0);
}
PIN_setOutputValue(Test_handle, IOID_5, 1);
PIN_setOutputValue(Test_handle, IOID_6, 1);
for(int i=0;i<INSTRUCTION.second_ch_pulse_width;i++){
PIN_setOutputValue(Test_handle, IOID_1, 1);
// PIN_setOutputValue(Test_handle, IOID_1, 0);
}
PIN_setOutputValue(Test_handle, IOID_5, 0);
break;
}
case(0x03):{
PIN_setOutputValue(Test_handle, IOID_6, 1);
PIN_setOutputValue(Test_handle, IOID_5, 1);
for(int i=0;i<INSTRUCTION.second_ch_pulse_width;i++){
PIN_setOutputValue(Test_handle, IOID_1, 1);
// PIN_setOutputValue(Test_handle, IOID_1, 0);
}
PIN_setOutputValue(Test_handle, IOID_5, 0);
for(int i=0;i<INSTRUCTION.second_ch_pw_IPI;i++){
PIN_setOutputValue(Test_handle, IOID_1, 1);
// PIN_setOutputValue(Test_handle, IOID_1, 0);
}
PIN_setOutputValue(Test_handle, IOID_5, 1);
PIN_setOutputValue(Test_handle, IOID_6, 0);
for(int i=0;i<INSTRUCTION.second_ch_pulse_width;i++){
PIN_setOutputValue(Test_handle, IOID_1, 1);
// PIN_setOutputValue(Test_handle, IOID_1, 0);
}
PIN_setOutputValue(Test_handle, IOID_5, 0);
break;
}
}
NeuLiveSTI_collect_recording_data(0x01);
break;
}
}
}
static void PWM_SetValue(uint32_t frequency, uint32_t duty_cycle,PWM_Handle Ph){
PWM_stop(Ph);
PWM_setPeriod(Ph,frequency);
PWM_setDuty(Ph,duty_cycle);
PWM_start(Ph);
}
/*====================================
==== UMC State machine interface ====
===================================*/
/*
* todo: interrupt
* -> stop SPI
* -> transmit interrupt
* -> wait another VIS_STI
*/
/*==========================
==== UMC SPI interface ====
=========================*/
// ASK interface
#endif
@@ -136,7 +136,7 @@ PIN_Handle radCtrlHandle;
extern void AssertHandler(uint8 assertCause, uint8 assertSubcause);
extern Display_Handle dispHandle;
//extern Display_Handle dispHandle;
/*******************************************************************************
* @fn Main
@@ -252,47 +252,47 @@ int main()
void AssertHandler(uint8 assertCause, uint8 assertSubcause)
{
// Open the display if the app has not already done so
if ( !dispHandle )
{
dispHandle = Display_open(Display_Type_LCD, NULL);
}
// if ( !dispHandle )
// {
// dispHandle = Display_open(Display_Type_LCD, NULL);
// }
Display_print0(dispHandle, 0, 0, ">>>STACK ASSERT");
// Display_print0(dispHandle, 0, 0, ">>>STACK ASSERT");
// check the assert cause
switch (assertCause)
{
case HAL_ASSERT_CAUSE_OUT_OF_MEMORY:
Display_print0(dispHandle, 0, 0, "***ERROR***");
Display_print0(dispHandle, 2, 0, ">> OUT OF MEMORY!");
break;
case HAL_ASSERT_CAUSE_INTERNAL_ERROR:
// check the subcause
if (assertSubcause == HAL_ASSERT_SUBCAUSE_FW_INERNAL_ERROR)
{
Display_print0(dispHandle, 0, 0, "***ERROR***");
Display_print0(dispHandle, 2, 0, ">> INTERNAL FW ERROR!");
}
else
{
Display_print0(dispHandle, 0, 0, "***ERROR***");
Display_print0(dispHandle, 2, 0, ">> INTERNAL ERROR!");
}
break;
case HAL_ASSERT_CAUSE_ICALL_ABORT:
Display_print0(dispHandle, 0, 0, "***ERROR***");
Display_print0(dispHandle, 2, 0, ">> ICALL ABORT!");
HAL_ASSERT_SPINLOCK;
break;
default:
Display_print0(dispHandle, 0, 0, "***ERROR***");
Display_print0(dispHandle, 2, 0, ">> DEFAULT SPINLOCK!");
HAL_ASSERT_SPINLOCK;
}
// switch (assertCause)
// {
// case HAL_ASSERT_CAUSE_OUT_OF_MEMORY:
// Display_print0(dispHandle, 0, 0, "***ERROR***");
// Display_print0(dispHandle, 2, 0, ">> OUT OF MEMORY!");
// break;
//
// case HAL_ASSERT_CAUSE_INTERNAL_ERROR:
// // check the subcause
// if (assertSubcause == HAL_ASSERT_SUBCAUSE_FW_INERNAL_ERROR)
// {
// Display_print0(dispHandle, 0, 0, "***ERROR***");
// Display_print0(dispHandle, 2, 0, ">> INTERNAL FW ERROR!");
// }
// else
// {
// Display_print0(dispHandle, 0, 0, "***ERROR***");
// Display_print0(dispHandle, 2, 0, ">> INTERNAL ERROR!");
// }
// break;
//
// case HAL_ASSERT_CAUSE_ICALL_ABORT:
// Display_print0(dispHandle, 0, 0, "***ERROR***");
// Display_print0(dispHandle, 2, 0, ">> ICALL ABORT!");
// HAL_ASSERT_SPINLOCK;
// break;
//
// default:
// Display_print0(dispHandle, 0, 0, "***ERROR***");
// Display_print0(dispHandle, 2, 0, ">> DEFAULT SPINLOCK!");
// HAL_ASSERT_SPINLOCK;
// }
return;
}
@@ -9,7 +9,7 @@
Target Device: CC2650, CC2640
******************************************************************************
Copyright (c) 2010-2018, Texas Instruments Incorporated
All rights reserved.
@@ -137,10 +137,10 @@ static CONST gattAttrType_t simpleProfileService = { ATT_BT_UUID_SIZE, simplePro
// Simple Profile Characteristic 1 Properties
static uint8 simpleProfileChar1Props = GATT_PROP_READ | GATT_PROP_WRITE;
static uint8 simpleProfileChar1Props = GATT_PROP_READ;
// Characteristic 1 Value
static uint8 simpleProfileChar1 = 0;
static uint8 simpleProfileChar1[SIMPLEPROFILE_CHAR1_LEN] = {0};
// Simple Profile Characteristic 1 User Description
static uint8 simpleProfileChar1UserDesp[17] = "Characteristic 1";
@@ -150,7 +150,7 @@ static uint8 simpleProfileChar1UserDesp[17] = "Characteristic 1";
static uint8 simpleProfileChar2Props = GATT_PROP_READ;
// Characteristic 2 Value
static uint8 simpleProfileChar2 = 0;
static uint8 simpleProfileChar2[SIMPLEPROFILE_CHAR2_LEN] = {0};
// Simple Profile Characteristic 2 User Description
static uint8 simpleProfileChar2UserDesp[17] = "Characteristic 2";
@@ -183,10 +183,10 @@ static uint8 simpleProfileChar4UserDesp[17] = "Characteristic 4";
// Simple Profile Characteristic 5 Properties
static uint8 simpleProfileChar5Props = GATT_PROP_READ;
static uint8 simpleProfileChar5Props = GATT_PROP_READ | GATT_PROP_WRITE;
// Characteristic 5 Value
static uint8 simpleProfileChar5[SIMPLEPROFILE_CHAR5_LEN] = { 0, 0, 0, 0, 0 };
static uint8 simpleProfileChar5[SIMPLEPROFILE_CHAR5_LEN] = { 0 };
// Simple Profile Characteristic 5 User Description
static uint8 simpleProfileChar5UserDesp[17] = "Characteristic 5";
@@ -216,9 +216,9 @@ static gattAttribute_t simpleProfileAttrTbl[SERVAPP_NUM_ATTR_SUPPORTED] =
// Characteristic Value 1
{
{ ATT_BT_UUID_SIZE, simpleProfilechar1UUID },
GATT_PERMIT_READ | GATT_PERMIT_WRITE,
GATT_PERMIT_READ,
0,
&simpleProfileChar1
simpleProfileChar1
},
// Characteristic 1 User Description
@@ -242,7 +242,7 @@ static gattAttribute_t simpleProfileAttrTbl[SERVAPP_NUM_ATTR_SUPPORTED] =
{ ATT_BT_UUID_SIZE, simpleProfilechar2UUID },
GATT_PERMIT_READ,
0,
&simpleProfileChar2
simpleProfileChar2
},
// Characteristic 2 User Description
@@ -320,7 +320,7 @@ static gattAttribute_t simpleProfileAttrTbl[SERVAPP_NUM_ATTR_SUPPORTED] =
// Characteristic Value 5
{
{ ATT_BT_UUID_SIZE, simpleProfilechar5UUID },
GATT_PERMIT_AUTHEN_READ,
GATT_PERMIT_READ | GATT_PERMIT_WRITE,
0,
simpleProfileChar5
},
@@ -456,9 +456,9 @@ bStatus_t SimpleProfile_SetParameter( uint8 param, uint8 len, void *value )
switch ( param )
{
case SIMPLEPROFILE_CHAR1:
if ( len == sizeof ( uint8 ) )
if ( len <= SIMPLEPROFILE_CHAR1_LEN )
{
simpleProfileChar1 = *((uint8*)value);
memcpy(simpleProfileChar1,value,len);
}
else
{
@@ -467,9 +467,9 @@ bStatus_t SimpleProfile_SetParameter( uint8 param, uint8 len, void *value )
break;
case SIMPLEPROFILE_CHAR2:
if ( len == sizeof ( uint8 ) )
if ( len <= SIMPLEPROFILE_CHAR2_LEN )
{
simpleProfileChar2 = *((uint8*)value);
memcpy(simpleProfileChar2,value,len);
}
else
{
@@ -491,7 +491,7 @@ bStatus_t SimpleProfile_SetParameter( uint8 param, uint8 len, void *value )
case SIMPLEPROFILE_CHAR4:
if ( len <= SIMPLEPROFILE_CHAR4_LEN )
{
memcpy( simpleProfileChar4, value, len);
memcpy( simpleProfileChar4, value, len);
// See if Notification has been enabled
GATTServApp_ProcessCharCfg( simpleProfileChar4Config, simpleProfileChar4, FALSE,
@@ -505,9 +505,9 @@ bStatus_t SimpleProfile_SetParameter( uint8 param, uint8 len, void *value )
break;
case SIMPLEPROFILE_CHAR5:
if ( len == SIMPLEPROFILE_CHAR5_LEN )
if ( len <= SIMPLEPROFILE_CHAR5_LEN )
{
VOID memcpy( simpleProfileChar5, value, SIMPLEPROFILE_CHAR5_LEN );
memcpy( simpleProfileChar5, value, SIMPLEPROFILE_CHAR5_LEN );
}
else
{
@@ -542,11 +542,11 @@ bStatus_t SimpleProfile_GetParameter( uint8 param, void *value )
switch ( param )
{
case SIMPLEPROFILE_CHAR1:
*((uint8*)value) = simpleProfileChar1;
memcpy( value, simpleProfileChar1, SIMPLEPROFILE_CHAR1_LEN );
break;
case SIMPLEPROFILE_CHAR2:
*((uint8*)value) = simpleProfileChar2;
memcpy( value, simpleProfileChar2, SIMPLEPROFILE_CHAR2_LEN );
break;
case SIMPLEPROFILE_CHAR3:
@@ -558,7 +558,7 @@ bStatus_t SimpleProfile_GetParameter( uint8 param, void *value )
break;
case SIMPLEPROFILE_CHAR5:
VOID memcpy( value, simpleProfileChar5, SIMPLEPROFILE_CHAR5_LEN );
memcpy( value, simpleProfileChar5, SIMPLEPROFILE_CHAR5_LEN );
break;
default:
@@ -613,19 +613,20 @@ static bStatus_t simpleProfile_ReadAttrCB(uint16_t connHandle,
// characteristic 4 does not have read permissions, but because it
// can be sent as a notification, it is included here
case SIMPLEPROFILE_CHAR1_UUID:
*pLen = SIMPLEPROFILE_CHAR1_LEN;
VOID memcpy( pValue, pAttr->pValue, SIMPLEPROFILE_CHAR1_LEN );
break;
case SIMPLEPROFILE_CHAR2_UUID:
*pLen = 1;
pValue[0] = *pAttr->pValue;
*pLen = SIMPLEPROFILE_CHAR2_LEN;
VOID memcpy( pValue, pAttr->pValue, SIMPLEPROFILE_CHAR2_LEN );
break;
case SIMPLEPROFILE_CHAR4_UUID:
*pLen = SIMPLEPROFILE_CHAR4_LEN;
VOID memcpy( pValue, pAttr->pValue, SIMPLEPROFILE_CHAR4_LEN );
VOID memcpy( pValue, pAttr->pValue, SIMPLEPROFILE_CHAR4_LEN );
break;
case SIMPLEPROFILE_CHAR5_UUID:
*pLen = SIMPLEPROFILE_CHAR5_LEN;
VOID memcpy( pValue, pAttr->pValue, SIMPLEPROFILE_CHAR5_LEN );
*pLen = SIMPLEPROFILE_CHAR5_LEN;
VOID memcpy( pValue, pAttr->pValue, SIMPLEPROFILE_CHAR5_LEN );
break;
default:
@@ -673,35 +674,6 @@ static bStatus_t simpleProfile_WriteAttrCB(uint16_t connHandle,
uint16 uuid = BUILD_UINT16( pAttr->type.uuid[0], pAttr->type.uuid[1]);
switch ( uuid )
{
case SIMPLEPROFILE_CHAR1_UUID:
//Validate the value
// Make sure it's not a blob oper
if ( offset == 0 )
{
if ( len != 1 )
{
status = ATT_ERR_INVALID_VALUE_SIZE;
}
}
else
{
status = ATT_ERR_ATTR_NOT_LONG;
}
//Write the value
if ( status == SUCCESS )
{
uint8 *pCurValue = (uint8 *)pAttr->pValue;
*pCurValue = pValue[0];
if( pAttr->pValue == &simpleProfileChar1 )
{
notifyApp = SIMPLEPROFILE_CHAR1;
}
}
break;
case SIMPLEPROFILE_CHAR3_UUID:
if ( offset == 0 )
{
@@ -720,6 +692,7 @@ static bStatus_t simpleProfile_WriteAttrCB(uint16_t connHandle,
{
// Copy pValue into the variable we point to from the attribute table.
memcpy(pAttr->pValue + offset, pValue, len);
memset(pAttr->pValue + len , 0 , SIMPLEPROFILE_CHAR3_LEN-len);
if( pAttr->pValue == simpleProfileChar3 )
{
@@ -727,6 +700,33 @@ static bStatus_t simpleProfile_WriteAttrCB(uint16_t connHandle,
}
}
break;
case SIMPLEPROFILE_CHAR5_UUID:
if ( offset == 0 )
{
if ( len > SIMPLEPROFILE_CHAR5_LEN )
{
status = ATT_ERR_INVALID_VALUE_SIZE;
}
}
else
{
status = ATT_ERR_ATTR_NOT_LONG;
}
//Write the value
if ( status == SUCCESS )
{
// Copy pValue into the variable we point to from the attribute table.
memcpy(pAttr->pValue + offset, pValue, len);
memset(pAttr->pValue + len , 0 , SIMPLEPROFILE_CHAR5_LEN-len);
if( pAttr->pValue == simpleProfileChar5 )
{
notifyApp = SIMPLEPROFILE_CHAR5;
}
}
break;
case GATT_CLIENT_CHAR_CFG_UUID:
status = GATTServApp_ProcessCCCWriteReq( connHandle, pAttr, pValue, len,
@@ -85,9 +85,10 @@ extern "C"
// Length of Characteristic 5 in bytes
#define SIMPLEPROFILE_CHAR5_LEN 5
#define SIMPLEPROFILE_CHAR4_LEN 8
#define SIMPLEPROFILE_CHAR3_LEN 8
#define SIMPLEPROFILE_CHAR4_LEN 20
#define SIMPLEPROFILE_CHAR3_LEN 12
#define SIMPLEPROFILE_CHAR2_LEN 20
#define SIMPLEPROFILE_CHAR1_LEN 20
/*********************************************************************
* TYPEDEFS
*/
View File
View File
View File
View File
View File
View File
View File
View File
View File
View File