The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Wed Feb 20 20:53:29 2019 +0000
Revision:
172:65be27845400
mbed library release version 165

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AnnaBridge 172:65be27845400 1 /*
AnnaBridge 172:65be27845400 2 * Copyright (c) 2015, Freescale Semiconductor, Inc.
AnnaBridge 172:65be27845400 3 * Copyright 2016-2017 NXP
AnnaBridge 172:65be27845400 4 *
AnnaBridge 172:65be27845400 5 * Redistribution and use in source and binary forms, with or without modification,
AnnaBridge 172:65be27845400 6 * are permitted provided that the following conditions are met:
AnnaBridge 172:65be27845400 7 *
AnnaBridge 172:65be27845400 8 * o Redistributions of source code must retain the above copyright notice, this list
AnnaBridge 172:65be27845400 9 * of conditions and the following disclaimer.
AnnaBridge 172:65be27845400 10 *
AnnaBridge 172:65be27845400 11 * o Redistributions in binary form must reproduce the above copyright notice, this
AnnaBridge 172:65be27845400 12 * list of conditions and the following disclaimer in the documentation and/or
AnnaBridge 172:65be27845400 13 * other materials provided with the distribution.
AnnaBridge 172:65be27845400 14 *
AnnaBridge 172:65be27845400 15 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
AnnaBridge 172:65be27845400 16 * contributors may be used to endorse or promote products derived from this
AnnaBridge 172:65be27845400 17 * software without specific prior written permission.
AnnaBridge 172:65be27845400 18 *
AnnaBridge 172:65be27845400 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
AnnaBridge 172:65be27845400 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
AnnaBridge 172:65be27845400 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
AnnaBridge 172:65be27845400 22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
AnnaBridge 172:65be27845400 23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
AnnaBridge 172:65be27845400 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
AnnaBridge 172:65be27845400 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
AnnaBridge 172:65be27845400 26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
AnnaBridge 172:65be27845400 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
AnnaBridge 172:65be27845400 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AnnaBridge 172:65be27845400 29 */
AnnaBridge 172:65be27845400 30 #ifndef _DBG_RAM_CAPTURE_H_
AnnaBridge 172:65be27845400 31 /* clang-format off */
AnnaBridge 172:65be27845400 32 #define _DBG_RAM_CAPTURE_H_
AnnaBridge 172:65be27845400 33 /* clang-format on */
AnnaBridge 172:65be27845400 34
AnnaBridge 172:65be27845400 35 #include "fsl_common.h"
AnnaBridge 172:65be27845400 36 #include "fsl_device_registers.h"
AnnaBridge 172:65be27845400 37
AnnaBridge 172:65be27845400 38 /*!
AnnaBridge 172:65be27845400 39 * @addtogroup xcvr
AnnaBridge 172:65be27845400 40 * @{
AnnaBridge 172:65be27845400 41 */
AnnaBridge 172:65be27845400 42
AnnaBridge 172:65be27845400 43 /*! @file*/
AnnaBridge 172:65be27845400 44
AnnaBridge 172:65be27845400 45 /*******************************************************************************
AnnaBridge 172:65be27845400 46 * Definitions
AnnaBridge 172:65be27845400 47 ******************************************************************************/
AnnaBridge 172:65be27845400 48 /* Page definitions */
AnnaBridge 172:65be27845400 49 #define DBG_PAGE_IDLE (0x00)
AnnaBridge 172:65be27845400 50 #define DBG_PAGE_RXDIGIQ (0x01)
AnnaBridge 172:65be27845400 51 #define DBG_PAGE_RAWADCIQ (0x04)
AnnaBridge 172:65be27845400 52 #define DBG_PAGE_DCESTIQ (0x07)
AnnaBridge 172:65be27845400 53 #define DBG_PAGE_RXINPH (0x0A)
AnnaBridge 172:65be27845400 54 #define DBG_PAGE_DEMOD_HARD (0x0B)
AnnaBridge 172:65be27845400 55 #define DBG_PAGE_DEMOD_SOFT (0x0C)
AnnaBridge 172:65be27845400 56 #define DBG_PAGE_DEMOD_DATA (0x0D)
AnnaBridge 172:65be27845400 57 #define DBG_PAGE_DEMOD_CFO_PH (0x0E)
AnnaBridge 172:65be27845400 58
AnnaBridge 172:65be27845400 59 typedef enum _dbgRamStatus
AnnaBridge 172:65be27845400 60 {
AnnaBridge 172:65be27845400 61 DBG_RAM_SUCCESS = 0,
AnnaBridge 172:65be27845400 62 DBG_RAM_FAIL_SAMPLE_NUM_LIMIT = 1,
AnnaBridge 172:65be27845400 63 DBG_RAM_FAIL_PAGE_ERROR = 2,
AnnaBridge 172:65be27845400 64 DBG_RAM_FAIL_NULL_POINTER = 3,
AnnaBridge 172:65be27845400 65 DBG_RAM_INVALID_TRIG_SETTING = 4,
AnnaBridge 172:65be27845400 66 DBG_RAM_FAIL_NOT_ENOUGH_SAMPLES = 5,
AnnaBridge 172:65be27845400 67 DBG_RAM_CAPTURE_NOT_COMPLETE = 6, /* Not an error response, but an indication that capture isn't complete for status polling */
AnnaBridge 172:65be27845400 68 } dbgRamStatus_t;
AnnaBridge 172:65be27845400 69
AnnaBridge 172:65be27845400 70 #if RADIO_IS_GEN_3P0
AnnaBridge 172:65be27845400 71 typedef enum _dbgRamStartTriggerType
AnnaBridge 172:65be27845400 72 {
AnnaBridge 172:65be27845400 73 NO_START_TRIG = 0,
AnnaBridge 172:65be27845400 74 START_ON_FSK_PREAMBLE_FOUND = 1,
AnnaBridge 172:65be27845400 75 START_ON_FSK_AA_MATCH = 2,
AnnaBridge 172:65be27845400 76 START_ON_ZBDEMOD_PREAMBLE_FOUND = 3,
AnnaBridge 172:65be27845400 77 START_ON_ZBDEMOD_SFD_MATCH = 4,
AnnaBridge 172:65be27845400 78 START_ON_AGC_DCOC_GAIN_CHG = 5,
AnnaBridge 172:65be27845400 79 START_ON_TSM_RX_DIG_EN = 6,
AnnaBridge 172:65be27845400 80 START_ON_TSM_SPARE2_EN = 7,
AnnaBridge 172:65be27845400 81 INVALID_START_TRIG = 8
AnnaBridge 172:65be27845400 82 } dbgRamStartTriggerType;
AnnaBridge 172:65be27845400 83
AnnaBridge 172:65be27845400 84 typedef enum _dbgRamStopTriggerType
AnnaBridge 172:65be27845400 85 {
AnnaBridge 172:65be27845400 86 NO_STOP_TRIG = 0,
AnnaBridge 172:65be27845400 87 STOP_ON_FSK_PREAMBLE_FOUND = 1,
AnnaBridge 172:65be27845400 88 STOP_ON_FSK_AA_MATCH = 2,
AnnaBridge 172:65be27845400 89 STOP_ON_ZBDEMOD_PREAMBLE_FOUND = 3,
AnnaBridge 172:65be27845400 90 STOP_ON_ZBDEMOD_SFD_MATCH = 4,
AnnaBridge 172:65be27845400 91 STOP_ON_AGC_DCOC_GAIN_CHG = 5,
AnnaBridge 172:65be27845400 92 STOP_ON_TSM_RX_DIG_EN = 6,
AnnaBridge 172:65be27845400 93 STOP_ON_TSM_SPARE3_EN = 7,
AnnaBridge 172:65be27845400 94 STOP_ON_TSM_PLL_UNLOCK = 8,
AnnaBridge 172:65be27845400 95 STOP_ON_BLE_CRC_ERROR_INC = 9,
AnnaBridge 172:65be27845400 96 STOP_ON_CRC_FAIL_ZGBE_GENFSK = 10,
AnnaBridge 172:65be27845400 97 STOP_ON_GENFSK_HEADER_FAIL = 11,
AnnaBridge 172:65be27845400 98 INVALID_STOP_TRIG = 12
AnnaBridge 172:65be27845400 99 } dbgRamStopTriggerType;
AnnaBridge 172:65be27845400 100 #endif /* RADIO_IS_GEN_3P0 */
AnnaBridge 172:65be27845400 101
AnnaBridge 172:65be27845400 102 /*! *********************************************************************************
AnnaBridge 172:65be27845400 103 * \brief This function prepares for sample capture to packet RAM.
AnnaBridge 172:65be27845400 104 *
AnnaBridge 172:65be27845400 105 * \return None.
AnnaBridge 172:65be27845400 106 *
AnnaBridge 172:65be27845400 107 * \details
AnnaBridge 172:65be27845400 108 * This routine assumes that some other functions in the calling routine both set
AnnaBridge 172:65be27845400 109 * the channel and force RX warmup before calling ::dbg_ram_capture().
AnnaBridge 172:65be27845400 110 ***********************************************************************************/
AnnaBridge 172:65be27845400 111 void dbg_ram_init(void);
AnnaBridge 172:65be27845400 112
AnnaBridge 172:65be27845400 113 /*! *********************************************************************************
AnnaBridge 172:65be27845400 114 * \brief This function performs any state restoration at the completion of PKT RAM capture.
AnnaBridge 172:65be27845400 115 *
AnnaBridge 172:65be27845400 116 * \details
AnnaBridge 172:65be27845400 117 * Any clocks enabled to the packet RAM capture circuitry are disabled.
AnnaBridge 172:65be27845400 118 ***********************************************************************************/
AnnaBridge 172:65be27845400 119 void dbg_ram_release(void);
AnnaBridge 172:65be27845400 120
AnnaBridge 172:65be27845400 121 #if RADIO_IS_GEN_3P0
AnnaBridge 172:65be27845400 122 /*! *********************************************************************************
AnnaBridge 172:65be27845400 123 * \brief This function initiates the capture of transceiver data to the transceiver packet RAM.
AnnaBridge 172:65be27845400 124 *
AnnaBridge 172:65be27845400 125 * \param[in] dbg_page - The page selector (DBG_PAGE).
AnnaBridge 172:65be27845400 126 * \param[in] dbg_start_trigger - The trigger to start acquisition (must be "no trigger" if a stop trigger is enabled).
AnnaBridge 172:65be27845400 127 * \param[in] dbg_stop_trigger - The trigger to stop acquisition (must be "no trigger" if a start trigger is enabled).
AnnaBridge 172:65be27845400 128 *
AnnaBridge 172:65be27845400 129 * \return Status of the request.
AnnaBridge 172:65be27845400 130 *
AnnaBridge 172:65be27845400 131 * \details
AnnaBridge 172:65be27845400 132 * This function starts the process of capturing data to the packet RAM. Depending upon the start and stop trigger
AnnaBridge 172:65be27845400 133 * settings, the actual capture process can take an indeterminate amount of time. Other APIs are provided to
AnnaBridge 172:65be27845400 134 * perform a blocking wait for completion or allow polling for completion of the capture.
AnnaBridge 172:65be27845400 135 * After any capture has completed, a separate routine must be called to postprocess the capture and copy all
AnnaBridge 172:65be27845400 136 * data out of the packet RAM into a normal RAM buffer.
AnnaBridge 172:65be27845400 137 ***********************************************************************************/
AnnaBridge 172:65be27845400 138 dbgRamStatus_t dbg_ram_start_capture(uint8_t dbg_page, dbgRamStartTriggerType start_trig, dbgRamStopTriggerType stop_trig);
AnnaBridge 172:65be27845400 139
AnnaBridge 172:65be27845400 140 /*! *********************************************************************************
AnnaBridge 172:65be27845400 141 * \brief This function performs a blocking wait for completion of the capture of transceiver data to the transceiver packet RAM.
AnnaBridge 172:65be27845400 142 *
AnnaBridge 172:65be27845400 143 * \return Status of the request, DBG_RAM_SUCCESS if capture is complete.
AnnaBridge 172:65be27845400 144 *
AnnaBridge 172:65be27845400 145 * \details
AnnaBridge 172:65be27845400 146 * This function performs a wait loop for capture completion and may take an indeterminate amount of time for
AnnaBridge 172:65be27845400 147 * some capture trigger types.
AnnaBridge 172:65be27845400 148 ***********************************************************************************/
AnnaBridge 172:65be27845400 149 dbgRamStatus_t dbg_ram_wait_for_complete(void); /* Blocking wait for capture completion, no matter what trigger type */
AnnaBridge 172:65be27845400 150
AnnaBridge 172:65be27845400 151 /*! *********************************************************************************
AnnaBridge 172:65be27845400 152 * \brief This function polls the state of the capture of transceiver data to the transceiver packet RAM.
AnnaBridge 172:65be27845400 153 *
AnnaBridge 172:65be27845400 154 * \return Status of the request, DBG_RAM_SUCCESS if capture is complete, DBG_RAM_CAPTURE_NOT_COMPLETE if not complete.
AnnaBridge 172:65be27845400 155 *
AnnaBridge 172:65be27845400 156 ***********************************************************************************/
AnnaBridge 172:65be27845400 157 dbgRamStatus_t dbg_ram_poll_capture_status(void); /* Non-blocking completion check, just reads the current status of the capure */
AnnaBridge 172:65be27845400 158
AnnaBridge 172:65be27845400 159 /*! *********************************************************************************
AnnaBridge 172:65be27845400 160 * \brief This function processes the captured data into a usable order and copies from packet RAM to normal RAM.
AnnaBridge 172:65be27845400 161 *
AnnaBridge 172:65be27845400 162 * \param[in] dbg_page - The page selector (DBG_PAGE).
AnnaBridge 172:65be27845400 163 * \param[in] buffer_sz_bytes - The size of the output buffer (in bytes)
AnnaBridge 172:65be27845400 164 * \param[in] result_buffer - The pointer to the output buffer of a size large enough for the samples.
AnnaBridge 172:65be27845400 165 *
AnnaBridge 172:65be27845400 166 * \return None.
AnnaBridge 172:65be27845400 167 *
AnnaBridge 172:65be27845400 168 * \details
AnnaBridge 172:65be27845400 169 * Data is copied from packet RAM in bytes to ensure no access problems. Data is unpacked from packet RAM
AnnaBridge 172:65be27845400 170 * (either sequentially captured or simultaneously captured) into a linear RAM buffer in system RAM.
AnnaBridge 172:65be27845400 171 * If a start trigger is enabled then the first buffer_sz_bytes that are captured are copied out.
AnnaBridge 172:65be27845400 172 * If a stop trigger is enabled then the last buffer_sz_bytes that are captured are copied out.
AnnaBridge 172:65be27845400 173 ***********************************************************************************/
AnnaBridge 172:65be27845400 174 dbgRamStatus_t dbg_ram_postproc_capture(uint8_t dbg_page, uint16_t buffer_sz_bytes, void * result_buffer); /* postprocess a capture to unpack data */
AnnaBridge 172:65be27845400 175
AnnaBridge 172:65be27845400 176 #else
AnnaBridge 172:65be27845400 177 /*! *********************************************************************************
AnnaBridge 172:65be27845400 178 * \brief This function captures transceiver data to the transceiver packet RAM.
AnnaBridge 172:65be27845400 179 *
AnnaBridge 172:65be27845400 180 * \param[in] dbg_page - The page selector (DBG_PAGE).
AnnaBridge 172:65be27845400 181 * \param[in] buffer_sz_bytes - The size of the output buffer (in bytes)
AnnaBridge 172:65be27845400 182 * \param[in] result_buffer - The pointer to the output buffer of a size large enough for the samples.
AnnaBridge 172:65be27845400 183 *
AnnaBridge 172:65be27845400 184 * \return None.
AnnaBridge 172:65be27845400 185 *
AnnaBridge 172:65be27845400 186 * \details
AnnaBridge 172:65be27845400 187 * The capture to packet RAM always captures a full PKT_RAM worth of samples. The samples will be
AnnaBridge 172:65be27845400 188 * copied to the buffer pointed to by result_buffer parameter until buffer_sz_bytes worth of data have
AnnaBridge 172:65be27845400 189 * been copied. Data will be copied
AnnaBridge 172:65be27845400 190 * NOTE: This routine has a slight hazard of getting stuck waiting for debug RAM to fill up when RX has
AnnaBridge 172:65be27845400 191 * not been enabled or RX ends before the RAM fills up (such as when capturing packet data ). It is
AnnaBridge 172:65be27845400 192 * intended to be used with manually triggered RX where RX data will continue as long as needed.
AnnaBridge 172:65be27845400 193 ***********************************************************************************/
AnnaBridge 172:65be27845400 194 dbgRamStatus_t dbg_ram_capture(uint8_t dbg_page, uint16_t buffer_sz_bytes, void * result_buffer);
AnnaBridge 172:65be27845400 195 #endif /* RADIO_IS_GEN_3P0 */
AnnaBridge 172:65be27845400 196
AnnaBridge 172:65be27845400 197 /* @} */
AnnaBridge 172:65be27845400 198
AnnaBridge 172:65be27845400 199 #if defined(__cplusplus)
AnnaBridge 172:65be27845400 200 }
AnnaBridge 172:65be27845400 201 #endif
AnnaBridge 172:65be27845400 202
AnnaBridge 172:65be27845400 203 /*! @}*/
AnnaBridge 172:65be27845400 204
AnnaBridge 172:65be27845400 205 #endif /* _DBG_RAM_CAPTURE_H_ */
AnnaBridge 172:65be27845400 206