Fork of my MQTTGateway

Dependencies:   mbed-http

Committer:
vpcola
Date:
Sat Apr 08 14:45:51 2017 +0000
Revision:
0:f1d3878b8dd9
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vpcola 0:f1d3878b8dd9 1 /**
vpcola 0:f1d3878b8dd9 2 ******************************************************************************
vpcola 0:f1d3878b8dd9 3 * @file SPIRIT_LinearFifo.c
vpcola 0:f1d3878b8dd9 4 * @author VMA division - AMS
vpcola 0:f1d3878b8dd9 5 * @version 3.2.2
vpcola 0:f1d3878b8dd9 6 * @date 08-July-2015
vpcola 0:f1d3878b8dd9 7 * @brief Configuration and management of SPIRIT Fifo.
vpcola 0:f1d3878b8dd9 8 * @details
vpcola 0:f1d3878b8dd9 9 *
vpcola 0:f1d3878b8dd9 10 * @attention
vpcola 0:f1d3878b8dd9 11 *
vpcola 0:f1d3878b8dd9 12 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
vpcola 0:f1d3878b8dd9 13 *
vpcola 0:f1d3878b8dd9 14 * Redistribution and use in source and binary forms, with or without modification,
vpcola 0:f1d3878b8dd9 15 * are permitted provided that the following conditions are met:
vpcola 0:f1d3878b8dd9 16 * 1. Redistributions of source code must retain the above copyright notice,
vpcola 0:f1d3878b8dd9 17 * this list of conditions and the following disclaimer.
vpcola 0:f1d3878b8dd9 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
vpcola 0:f1d3878b8dd9 19 * this list of conditions and the following disclaimer in the documentation
vpcola 0:f1d3878b8dd9 20 * and/or other materials provided with the distribution.
vpcola 0:f1d3878b8dd9 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
vpcola 0:f1d3878b8dd9 22 * may be used to endorse or promote products derived from this software
vpcola 0:f1d3878b8dd9 23 * without specific prior written permission.
vpcola 0:f1d3878b8dd9 24 *
vpcola 0:f1d3878b8dd9 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
vpcola 0:f1d3878b8dd9 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
vpcola 0:f1d3878b8dd9 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
vpcola 0:f1d3878b8dd9 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
vpcola 0:f1d3878b8dd9 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
vpcola 0:f1d3878b8dd9 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
vpcola 0:f1d3878b8dd9 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
vpcola 0:f1d3878b8dd9 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
vpcola 0:f1d3878b8dd9 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
vpcola 0:f1d3878b8dd9 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
vpcola 0:f1d3878b8dd9 35 *
vpcola 0:f1d3878b8dd9 36 ******************************************************************************
vpcola 0:f1d3878b8dd9 37 */
vpcola 0:f1d3878b8dd9 38
vpcola 0:f1d3878b8dd9 39 /* Includes ------------------------------------------------------------------*/
vpcola 0:f1d3878b8dd9 40 #include "SPIRIT_LinearFifo.h"
vpcola 0:f1d3878b8dd9 41 #include "MCU_Interface.h"
vpcola 0:f1d3878b8dd9 42
vpcola 0:f1d3878b8dd9 43
vpcola 0:f1d3878b8dd9 44 /**
vpcola 0:f1d3878b8dd9 45 * @addtogroup SPIRIT_Libraries
vpcola 0:f1d3878b8dd9 46 * @{
vpcola 0:f1d3878b8dd9 47 */
vpcola 0:f1d3878b8dd9 48
vpcola 0:f1d3878b8dd9 49
vpcola 0:f1d3878b8dd9 50 /**
vpcola 0:f1d3878b8dd9 51 * @addtogroup SPIRIT_LinearFifo
vpcola 0:f1d3878b8dd9 52 * @{
vpcola 0:f1d3878b8dd9 53 */
vpcola 0:f1d3878b8dd9 54
vpcola 0:f1d3878b8dd9 55
vpcola 0:f1d3878b8dd9 56 /**
vpcola 0:f1d3878b8dd9 57 * @defgroup LinearFifo_Private_TypesDefinitions Linear FIFO Private Types Definitions
vpcola 0:f1d3878b8dd9 58 * @{
vpcola 0:f1d3878b8dd9 59 */
vpcola 0:f1d3878b8dd9 60
vpcola 0:f1d3878b8dd9 61 /**
vpcola 0:f1d3878b8dd9 62 *@}
vpcola 0:f1d3878b8dd9 63 */
vpcola 0:f1d3878b8dd9 64
vpcola 0:f1d3878b8dd9 65
vpcola 0:f1d3878b8dd9 66 /**
vpcola 0:f1d3878b8dd9 67 * @defgroup LinearFifo_Private_Defines Linear FIFO Private Defines
vpcola 0:f1d3878b8dd9 68 * @{
vpcola 0:f1d3878b8dd9 69 */
vpcola 0:f1d3878b8dd9 70
vpcola 0:f1d3878b8dd9 71 /**
vpcola 0:f1d3878b8dd9 72 *@}
vpcola 0:f1d3878b8dd9 73 */
vpcola 0:f1d3878b8dd9 74
vpcola 0:f1d3878b8dd9 75
vpcola 0:f1d3878b8dd9 76 /**
vpcola 0:f1d3878b8dd9 77 * @defgroup LinearFifo_Private_Macros Linear FIFO Private Macros
vpcola 0:f1d3878b8dd9 78 * @{
vpcola 0:f1d3878b8dd9 79 */
vpcola 0:f1d3878b8dd9 80
vpcola 0:f1d3878b8dd9 81 /**
vpcola 0:f1d3878b8dd9 82 *@}
vpcola 0:f1d3878b8dd9 83 */
vpcola 0:f1d3878b8dd9 84
vpcola 0:f1d3878b8dd9 85
vpcola 0:f1d3878b8dd9 86 /**
vpcola 0:f1d3878b8dd9 87 * @defgroup LinearFifo_Private_Variables Linear FIFO Private Variables
vpcola 0:f1d3878b8dd9 88 * @{
vpcola 0:f1d3878b8dd9 89 */
vpcola 0:f1d3878b8dd9 90
vpcola 0:f1d3878b8dd9 91 /**
vpcola 0:f1d3878b8dd9 92 *@}
vpcola 0:f1d3878b8dd9 93 */
vpcola 0:f1d3878b8dd9 94
vpcola 0:f1d3878b8dd9 95
vpcola 0:f1d3878b8dd9 96 /**
vpcola 0:f1d3878b8dd9 97 * @defgroup LinearFifo_Private_FunctionPrototypes Linear FIFO Private Function Prototypes
vpcola 0:f1d3878b8dd9 98 * @{
vpcola 0:f1d3878b8dd9 99 */
vpcola 0:f1d3878b8dd9 100
vpcola 0:f1d3878b8dd9 101 /**
vpcola 0:f1d3878b8dd9 102 *@}
vpcola 0:f1d3878b8dd9 103 */
vpcola 0:f1d3878b8dd9 104
vpcola 0:f1d3878b8dd9 105
vpcola 0:f1d3878b8dd9 106 /**
vpcola 0:f1d3878b8dd9 107 * @defgroup LinearFifo_Private_Functions Linear FIFO Private Functions
vpcola 0:f1d3878b8dd9 108 * @{
vpcola 0:f1d3878b8dd9 109 */
vpcola 0:f1d3878b8dd9 110
vpcola 0:f1d3878b8dd9 111 /**
vpcola 0:f1d3878b8dd9 112 * @brief Returns the number of elements in the Rx FIFO.
vpcola 0:f1d3878b8dd9 113 * @param None.
vpcola 0:f1d3878b8dd9 114 * @retval uint8_t Number of elements in the Rx FIFO.
vpcola 0:f1d3878b8dd9 115 */
vpcola 0:f1d3878b8dd9 116 uint8_t SpiritLinearFifoReadNumElementsRxFifo(void)
vpcola 0:f1d3878b8dd9 117 {
vpcola 0:f1d3878b8dd9 118 uint8_t tempRegValue;
vpcola 0:f1d3878b8dd9 119
vpcola 0:f1d3878b8dd9 120 /* Reads the register value */
vpcola 0:f1d3878b8dd9 121 g_xStatus = SpiritSpiReadRegisters(LINEAR_FIFO_STATUS0_BASE, 1, &tempRegValue);
vpcola 0:f1d3878b8dd9 122
vpcola 0:f1d3878b8dd9 123 /* Build and return value */
vpcola 0:f1d3878b8dd9 124 return (tempRegValue & 0x7F);
vpcola 0:f1d3878b8dd9 125
vpcola 0:f1d3878b8dd9 126 }
vpcola 0:f1d3878b8dd9 127
vpcola 0:f1d3878b8dd9 128
vpcola 0:f1d3878b8dd9 129 /**
vpcola 0:f1d3878b8dd9 130 * @brief Returns the number of elements in the Tx FIFO.
vpcola 0:f1d3878b8dd9 131 * @param None.
vpcola 0:f1d3878b8dd9 132 * @retval uint8_t Number of elements in the Tx FIFO.
vpcola 0:f1d3878b8dd9 133 */
vpcola 0:f1d3878b8dd9 134 uint8_t SpiritLinearFifoReadNumElementsTxFifo(void)
vpcola 0:f1d3878b8dd9 135 {
vpcola 0:f1d3878b8dd9 136 uint8_t tempRegValue;
vpcola 0:f1d3878b8dd9 137
vpcola 0:f1d3878b8dd9 138 /* Reads the number of elements in TX FIFO and return the value */
vpcola 0:f1d3878b8dd9 139 g_xStatus = SpiritSpiReadRegisters(LINEAR_FIFO_STATUS1_BASE, 1, &tempRegValue);
vpcola 0:f1d3878b8dd9 140
vpcola 0:f1d3878b8dd9 141 /* Build and return value */
vpcola 0:f1d3878b8dd9 142 return (tempRegValue & 0x7F);
vpcola 0:f1d3878b8dd9 143 }
vpcola 0:f1d3878b8dd9 144
vpcola 0:f1d3878b8dd9 145
vpcola 0:f1d3878b8dd9 146 /**
vpcola 0:f1d3878b8dd9 147 * @brief Sets the almost full threshold for the Rx FIFO. When the number of elements in RX FIFO reaches this value an interrupt can be generated to the MCU.
vpcola 0:f1d3878b8dd9 148 * @note The almost full threshold is encountered from the top of the FIFO. For example, if it is set to 7 the almost
vpcola 0:f1d3878b8dd9 149 * full FIFO irq will be raised when the number of elements is equals to 96-7 = 89.
vpcola 0:f1d3878b8dd9 150 * @param cThrRxFifo almost full threshold.
vpcola 0:f1d3878b8dd9 151 * This parameter is an uint8_t.
vpcola 0:f1d3878b8dd9 152 * @retval None.
vpcola 0:f1d3878b8dd9 153 */
vpcola 0:f1d3878b8dd9 154 void SpiritLinearFifoSetAlmostFullThresholdRx(uint8_t cThrRxFifo)
vpcola 0:f1d3878b8dd9 155 {
vpcola 0:f1d3878b8dd9 156 uint8_t tempRegValue;
vpcola 0:f1d3878b8dd9 157
vpcola 0:f1d3878b8dd9 158 /* Check the parameters */
vpcola 0:f1d3878b8dd9 159 s_assert_param(IS_FIFO_THR(cThrRxFifo));
vpcola 0:f1d3878b8dd9 160
vpcola 0:f1d3878b8dd9 161 /* Build the register value */
vpcola 0:f1d3878b8dd9 162 tempRegValue = cThrRxFifo & 0x7F;
vpcola 0:f1d3878b8dd9 163
vpcola 0:f1d3878b8dd9 164 /* Writes the Almost Full threshold for RX in the corresponding register */
vpcola 0:f1d3878b8dd9 165 g_xStatus = SpiritSpiWriteRegisters(FIFO_CONFIG3_RXAFTHR_BASE, 1, &tempRegValue);
vpcola 0:f1d3878b8dd9 166
vpcola 0:f1d3878b8dd9 167 }
vpcola 0:f1d3878b8dd9 168
vpcola 0:f1d3878b8dd9 169
vpcola 0:f1d3878b8dd9 170 /**
vpcola 0:f1d3878b8dd9 171 * @brief Returns the almost full threshold for RX FIFO.
vpcola 0:f1d3878b8dd9 172 * @note The almost full threshold is encountered from the top of the FIFO. For example, if it is 7 the almost
vpcola 0:f1d3878b8dd9 173 * full FIFO irq will be raised when the number of elements is equals to 96-7 = 89.
vpcola 0:f1d3878b8dd9 174 * @param None.
vpcola 0:f1d3878b8dd9 175 * @retval uint8_t Almost full threshold for Rx FIFO.
vpcola 0:f1d3878b8dd9 176 */
vpcola 0:f1d3878b8dd9 177 uint8_t SpiritLinearFifoGetAlmostFullThresholdRx(void)
vpcola 0:f1d3878b8dd9 178 {
vpcola 0:f1d3878b8dd9 179 uint8_t tempRegValue;
vpcola 0:f1d3878b8dd9 180
vpcola 0:f1d3878b8dd9 181 /* Reads the almost full threshold for RX FIFO and return the value */
vpcola 0:f1d3878b8dd9 182 g_xStatus = SpiritSpiReadRegisters(FIFO_CONFIG3_RXAFTHR_BASE, 1, &tempRegValue);
vpcola 0:f1d3878b8dd9 183
vpcola 0:f1d3878b8dd9 184 /* Build and return value */
vpcola 0:f1d3878b8dd9 185 return (tempRegValue & 0x7F);
vpcola 0:f1d3878b8dd9 186
vpcola 0:f1d3878b8dd9 187 }
vpcola 0:f1d3878b8dd9 188
vpcola 0:f1d3878b8dd9 189
vpcola 0:f1d3878b8dd9 190 /**
vpcola 0:f1d3878b8dd9 191 * @brief Sets the almost empty threshold for the Rx FIFO. When the number of elements in RX FIFO reaches this value an interrupt can be generated to the MCU.
vpcola 0:f1d3878b8dd9 192 * @param cThrRxFifo almost empty threshold.
vpcola 0:f1d3878b8dd9 193 * This parameter is an uint8_t.
vpcola 0:f1d3878b8dd9 194 * @retval None.
vpcola 0:f1d3878b8dd9 195 */
vpcola 0:f1d3878b8dd9 196 void SpiritLinearFifoSetAlmostEmptyThresholdRx(uint8_t cThrRxFifo)
vpcola 0:f1d3878b8dd9 197 {
vpcola 0:f1d3878b8dd9 198 uint8_t tempRegValue;
vpcola 0:f1d3878b8dd9 199
vpcola 0:f1d3878b8dd9 200 /* Check the parameters */
vpcola 0:f1d3878b8dd9 201 s_assert_param(IS_FIFO_THR(cThrRxFifo));
vpcola 0:f1d3878b8dd9 202
vpcola 0:f1d3878b8dd9 203 /* Build the register value */
vpcola 0:f1d3878b8dd9 204 tempRegValue = cThrRxFifo & 0x7F;
vpcola 0:f1d3878b8dd9 205
vpcola 0:f1d3878b8dd9 206 /* Writes the Almost Empty threshold for RX in the corresponding register */
vpcola 0:f1d3878b8dd9 207 g_xStatus = SpiritSpiWriteRegisters(FIFO_CONFIG2_RXAETHR_BASE, 1, &tempRegValue);
vpcola 0:f1d3878b8dd9 208
vpcola 0:f1d3878b8dd9 209 }
vpcola 0:f1d3878b8dd9 210
vpcola 0:f1d3878b8dd9 211
vpcola 0:f1d3878b8dd9 212 /**
vpcola 0:f1d3878b8dd9 213 * @brief Returns the almost empty threshold for Rx FIFO.
vpcola 0:f1d3878b8dd9 214 * @param None.
vpcola 0:f1d3878b8dd9 215 * @retval uint8_t Almost empty threshold for Rx FIFO.
vpcola 0:f1d3878b8dd9 216 */
vpcola 0:f1d3878b8dd9 217 uint8_t SpiritLinearFifoGetAlmostEmptyThresholdRx(void)
vpcola 0:f1d3878b8dd9 218 {
vpcola 0:f1d3878b8dd9 219 uint8_t tempRegValue;
vpcola 0:f1d3878b8dd9 220
vpcola 0:f1d3878b8dd9 221 /* Reads the almost empty threshold for RX FIFO and returns the value */
vpcola 0:f1d3878b8dd9 222 g_xStatus = SpiritSpiReadRegisters(FIFO_CONFIG2_RXAETHR_BASE, 1, &tempRegValue);
vpcola 0:f1d3878b8dd9 223
vpcola 0:f1d3878b8dd9 224 /* Build and return value */
vpcola 0:f1d3878b8dd9 225 return (tempRegValue & 0x7F);
vpcola 0:f1d3878b8dd9 226
vpcola 0:f1d3878b8dd9 227 }
vpcola 0:f1d3878b8dd9 228
vpcola 0:f1d3878b8dd9 229
vpcola 0:f1d3878b8dd9 230 /**
vpcola 0:f1d3878b8dd9 231 * @brief Sets the almost full threshold for the Tx FIFO. When the number of elements in TX FIFO reaches this value an interrupt can be generated to the MCU.
vpcola 0:f1d3878b8dd9 232 * @note The almost full threshold is encountered from the top of the FIFO. For example, if it is set to 7 the almost
vpcola 0:f1d3878b8dd9 233 * full FIFO irq will be raised when the number of elements is equals to 96-7 = 89.
vpcola 0:f1d3878b8dd9 234 * @param cThrTxFifo almost full threshold.
vpcola 0:f1d3878b8dd9 235 * This parameter is an uint8_t.
vpcola 0:f1d3878b8dd9 236 * @retval None.
vpcola 0:f1d3878b8dd9 237 */
vpcola 0:f1d3878b8dd9 238 void SpiritLinearFifoSetAlmostFullThresholdTx(uint8_t cThrTxFifo)
vpcola 0:f1d3878b8dd9 239 {
vpcola 0:f1d3878b8dd9 240 uint8_t tempRegValue;
vpcola 0:f1d3878b8dd9 241
vpcola 0:f1d3878b8dd9 242 /* Check the parameters */
vpcola 0:f1d3878b8dd9 243 s_assert_param(IS_FIFO_THR(cThrTxFifo));
vpcola 0:f1d3878b8dd9 244
vpcola 0:f1d3878b8dd9 245 /* Reads the register value */
vpcola 0:f1d3878b8dd9 246 g_xStatus = SpiritSpiReadRegisters(FIFO_CONFIG1_TXAFTHR_BASE, 1, &tempRegValue);
vpcola 0:f1d3878b8dd9 247
vpcola 0:f1d3878b8dd9 248 /* Build the register value */
vpcola 0:f1d3878b8dd9 249 tempRegValue &= 0x80;
vpcola 0:f1d3878b8dd9 250 tempRegValue |= cThrTxFifo;
vpcola 0:f1d3878b8dd9 251
vpcola 0:f1d3878b8dd9 252 /* Writes the Almost Full threshold for Tx in the corresponding register */
vpcola 0:f1d3878b8dd9 253 g_xStatus = SpiritSpiWriteRegisters(FIFO_CONFIG1_TXAFTHR_BASE, 1, &tempRegValue);
vpcola 0:f1d3878b8dd9 254
vpcola 0:f1d3878b8dd9 255 }
vpcola 0:f1d3878b8dd9 256
vpcola 0:f1d3878b8dd9 257
vpcola 0:f1d3878b8dd9 258 /**
vpcola 0:f1d3878b8dd9 259 * @brief Returns the almost full threshold for Tx FIFO.
vpcola 0:f1d3878b8dd9 260 * @note The almost full threshold is encountered from the top of the FIFO. For example, if it is set to 7 the almost
vpcola 0:f1d3878b8dd9 261 * full FIFO irq will be raised when the number of elements is equals to 96-7 = 89.
vpcola 0:f1d3878b8dd9 262 * @param None.
vpcola 0:f1d3878b8dd9 263 * @retval uint8_t Almost full threshold for Tx FIFO.
vpcola 0:f1d3878b8dd9 264 */
vpcola 0:f1d3878b8dd9 265 uint8_t SpiritLinearFifoGetAlmostFullThresholdTx(void)
vpcola 0:f1d3878b8dd9 266 {
vpcola 0:f1d3878b8dd9 267 uint8_t tempRegValue;
vpcola 0:f1d3878b8dd9 268
vpcola 0:f1d3878b8dd9 269 /* Reads the almost full threshold for Tx FIFO and returns the value */
vpcola 0:f1d3878b8dd9 270 g_xStatus = SpiritSpiReadRegisters(FIFO_CONFIG1_TXAFTHR_BASE, 1, &tempRegValue);
vpcola 0:f1d3878b8dd9 271
vpcola 0:f1d3878b8dd9 272 /* Build and returns value */
vpcola 0:f1d3878b8dd9 273 return (tempRegValue & 0x7F);
vpcola 0:f1d3878b8dd9 274
vpcola 0:f1d3878b8dd9 275 }
vpcola 0:f1d3878b8dd9 276
vpcola 0:f1d3878b8dd9 277
vpcola 0:f1d3878b8dd9 278 /**
vpcola 0:f1d3878b8dd9 279 * @brief Sets the almost empty threshold for the Tx FIFO. When the number of elements in Tx FIFO reaches this value an interrupt can can be generated to the MCU.
vpcola 0:f1d3878b8dd9 280 * @param cThrTxFifo: almost empty threshold.
vpcola 0:f1d3878b8dd9 281 * This parameter is an uint8_t.
vpcola 0:f1d3878b8dd9 282 * @retval None.
vpcola 0:f1d3878b8dd9 283 */
vpcola 0:f1d3878b8dd9 284 void SpiritLinearFifoSetAlmostEmptyThresholdTx(uint8_t cThrTxFifo)
vpcola 0:f1d3878b8dd9 285 {
vpcola 0:f1d3878b8dd9 286 uint8_t tempRegValue;
vpcola 0:f1d3878b8dd9 287
vpcola 0:f1d3878b8dd9 288 /* Check the parameters */
vpcola 0:f1d3878b8dd9 289 s_assert_param(IS_FIFO_THR(cThrTxFifo));
vpcola 0:f1d3878b8dd9 290
vpcola 0:f1d3878b8dd9 291 /* Reads the register value */
vpcola 0:f1d3878b8dd9 292 g_xStatus = SpiritSpiReadRegisters(FIFO_CONFIG0_TXAETHR_BASE, 1, &tempRegValue);
vpcola 0:f1d3878b8dd9 293
vpcola 0:f1d3878b8dd9 294 /* Build the register value */
vpcola 0:f1d3878b8dd9 295 tempRegValue &= 0x80;
vpcola 0:f1d3878b8dd9 296 tempRegValue |= cThrTxFifo;
vpcola 0:f1d3878b8dd9 297
vpcola 0:f1d3878b8dd9 298 /* Writes the Almost Empty threshold for Tx in the corresponding register */
vpcola 0:f1d3878b8dd9 299 g_xStatus = SpiritSpiWriteRegisters(FIFO_CONFIG0_TXAETHR_BASE, 1, &tempRegValue);
vpcola 0:f1d3878b8dd9 300
vpcola 0:f1d3878b8dd9 301 }
vpcola 0:f1d3878b8dd9 302
vpcola 0:f1d3878b8dd9 303
vpcola 0:f1d3878b8dd9 304 /**
vpcola 0:f1d3878b8dd9 305 * @brief Returns the almost empty threshold for Tx FIFO.
vpcola 0:f1d3878b8dd9 306 * @param None.
vpcola 0:f1d3878b8dd9 307 * @retval uint8_t Almost empty threshold for Tx FIFO.
vpcola 0:f1d3878b8dd9 308 */
vpcola 0:f1d3878b8dd9 309 uint8_t SpiritLinearFifoGetAlmostEmptyThresholdTx(void)
vpcola 0:f1d3878b8dd9 310 {
vpcola 0:f1d3878b8dd9 311 uint8_t tempRegValue;
vpcola 0:f1d3878b8dd9 312
vpcola 0:f1d3878b8dd9 313 /* Reads the almost empty threshold for TX FIFO and returns the value */
vpcola 0:f1d3878b8dd9 314 g_xStatus = SpiritSpiReadRegisters(FIFO_CONFIG0_TXAETHR_BASE, 1, &tempRegValue);
vpcola 0:f1d3878b8dd9 315
vpcola 0:f1d3878b8dd9 316 /* Build and return value */
vpcola 0:f1d3878b8dd9 317 return (tempRegValue & 0x7F);
vpcola 0:f1d3878b8dd9 318
vpcola 0:f1d3878b8dd9 319 }
vpcola 0:f1d3878b8dd9 320
vpcola 0:f1d3878b8dd9 321
vpcola 0:f1d3878b8dd9 322 /**
vpcola 0:f1d3878b8dd9 323 *@}
vpcola 0:f1d3878b8dd9 324 */
vpcola 0:f1d3878b8dd9 325
vpcola 0:f1d3878b8dd9 326 /**
vpcola 0:f1d3878b8dd9 327 *@}
vpcola 0:f1d3878b8dd9 328 */
vpcola 0:f1d3878b8dd9 329
vpcola 0:f1d3878b8dd9 330
vpcola 0:f1d3878b8dd9 331 /**
vpcola 0:f1d3878b8dd9 332 *@}
vpcola 0:f1d3878b8dd9 333 */
vpcola 0:f1d3878b8dd9 334
vpcola 0:f1d3878b8dd9 335
vpcola 0:f1d3878b8dd9 336
vpcola 0:f1d3878b8dd9 337 /******************* (C) COPYRIGHT 2015 STMicroelectronics *****END OF FILE****/