2017-07-25 23:14:35 +02:00
|
|
|
/******************************************************************************
|
2021-03-08 22:39:04 +01:00
|
|
|
* drivers/wireless/spirit/include/spirit_linearfifo.h
|
2017-07-25 23:14:35 +02:00
|
|
|
*
|
|
|
|
* Copyright(c) 2015 STMicroelectronics
|
|
|
|
* Author: VMA division - AMS
|
|
|
|
* Version 3.2.2 08-July-2015
|
|
|
|
*
|
2021-04-04 11:58:11 +02:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are
|
|
|
|
* met:
|
2017-07-25 23:14:35 +02:00
|
|
|
*
|
2021-04-04 11:58:11 +02:00
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. Neither the name of STMicroelectronics nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived from
|
|
|
|
* this software without specific prior written permission.
|
2017-07-25 23:14:35 +02:00
|
|
|
*
|
2021-04-04 11:58:11 +02:00
|
|
|
* 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 HOLDER 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.
|
2017-07-25 23:14:35 +02:00
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
2022-01-15 03:44:35 +01:00
|
|
|
#ifndef __DRIVERS_WIRELESS_SPIRIT_INCLUDE_SPIRIT_LINEARFIFO_H
|
|
|
|
#define __DRIVERS_WIRELESS_SPIRIT_INCLUDE_SPIRIT_LINEARFIFO_H
|
2017-07-25 23:14:35 +02:00
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* Included Files
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
#include "spirit_regs.h"
|
|
|
|
#include "spirit_types.h"
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
/* Macros used in assertions */
|
|
|
|
|
|
|
|
#define IS_FIFO_THR(val) ((val) <= 96)
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* Public Function Prototypes
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* Name: spirit_fifo_get_rxcount
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Returns the number of elements in the Rx FIFO.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* spirit - Reference to a Spirit library state structure instance
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Number of elements in the Rx FIFO.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
uint8_t spirit_fifo_get_rxcount(FAR struct spirit_library_s *spirit);
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* Name: spirit_fifo_get_txcount
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Returns the number of elements in the Tx FIFO.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* spirit - Reference to a Spirit library state structure instance
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Number of elements in the Tx FIFO.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
uint8_t spirit_fifo_get_txcount(FAR struct spirit_library_s *spirit);
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* Name: spirit_fifo_set_rxalmostfull
|
|
|
|
*
|
|
|
|
* Description:
|
2017-08-06 18:10:55 +02:00
|
|
|
* Sets the almost full threshold for the Rx FIFO. When the number of
|
2017-07-25 23:14:35 +02:00
|
|
|
* elements in RX FIFO reaches this value an interrupt can be generated to
|
|
|
|
* the MCU.
|
|
|
|
*
|
|
|
|
* NOTE: The almost full threshold is encountered from the top of the FIFO.
|
|
|
|
* For example, if it is set to 7 the almost full FIFO irq will be raised
|
|
|
|
* when the number of elements is equals to 96-7 = 89.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
2017-08-06 18:10:55 +02:00
|
|
|
* spirit - Reference to a Spirit library state structure instance
|
|
|
|
* threshold - Almost full threshold.
|
2017-07-25 23:14:35 +02:00
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero (OK) on success; a negated errno value on failure.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
int spirit_fifo_set_rxalmostfull(FAR struct spirit_library_s *spirit,
|
|
|
|
uint8_t threshold);
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* Name: spirit_fifo_get_rxalmostfull
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Returns the almost full threshold for RX FIFO.
|
|
|
|
*
|
|
|
|
* NOTE: The almost full threshold is encountered from the top of the FIFO.
|
|
|
|
* For example, if it is 7 the almost full FIFO irq will be raised when the
|
|
|
|
* number of elements is equals to 96-7 = 89.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* spirit - Reference to a Spirit library state structure instance
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Almost full threshold for Rx FIFO.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
uint8_t spirit_fifo_get_rxalmostfull(FAR struct spirit_library_s *spirit);
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* Name: spirit_fifo_set_rxalmostempty
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
2017-08-06 18:10:55 +02:00
|
|
|
* spirit - Reference to a Spirit library state structure instance
|
|
|
|
* threshold - Almost empty threshold.
|
2017-07-25 23:14:35 +02:00
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero (OK) on success; a negated errno value on failure.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
int spirit_fifo_set_rxalmostempty(FAR struct spirit_library_s *spirit,
|
|
|
|
uint8_t threshold);
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* Name: spirit_fifo_get_rxalmostempty
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Returns the almost empty threshold for Rx FIFO.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* spirit - Reference to a Spirit library state structure instance
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Almost empty threshold for Rx FIFO.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
uint8_t spirit_fifo_get_rxalmostempty(FAR struct spirit_library_s *spirit);
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* Name: spirit_fifo_set_txalmostfull
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* NOTE: The almost full threshold is encountered from the top of the FIFO.
|
|
|
|
* For example, if it is set to 7 the almost full FIFO irq will be raised
|
|
|
|
* when the number of elements is equals to 96-7 = 89.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
2017-08-06 18:10:55 +02:00
|
|
|
* spirit - Reference to a Spirit library state structure instance
|
|
|
|
* threshold - Almost full threshold.
|
2017-07-25 23:14:35 +02:00
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero (OK) on success; a negated errno value on failure.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
int spirit_fifo_set_txalmostfull(FAR struct spirit_library_s *spirit,
|
|
|
|
uint8_t threshold);
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* Name: spirit_fifo_get_txalmostfull
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Returns the almost full threshold for Tx FIFO.
|
|
|
|
*
|
|
|
|
* NOTE: The almost full threshold is encountered from the top of the FIFO.
|
|
|
|
* For example, if it is set to 7 the almost full FIFO irq will be raised
|
|
|
|
* when the number of elements is equals to 96-7 = 89.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* spirit - Reference to a Spirit library state structure instance
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Almost full threshold for Tx FIFO.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
uint8_t spirit_fifo_get_txalmostfull(FAR struct spirit_library_s *spirit);
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* Name: spirit_fifo_set_txalmostempty
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
2017-08-06 18:10:55 +02:00
|
|
|
* spirit - Reference to a Spirit library state structure instance
|
|
|
|
* threshold - Almost empty threshold.
|
2017-07-25 23:14:35 +02:00
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Zero (OK) on success; a negated errno value on failure.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
int spirit_fifo_set_txalmostempty(FAR struct spirit_library_s *spirit,
|
|
|
|
uint8_t threshold);
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* Name: spirit_fifo_get_txalmostempty
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Returns the almost empty threshold for Tx FIFO.
|
|
|
|
*
|
|
|
|
* Input Parameters:
|
|
|
|
* spirit - Reference to a Spirit library state structure instance
|
|
|
|
*
|
|
|
|
* Returned Value:
|
|
|
|
* Almost empty threshold for Tx FIFO.
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
uint8_t spirit_fifo_get_txalmostempty(FAR struct spirit_library_s *spirit);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2022-01-15 03:44:35 +01:00
|
|
|
#endif /* __DRIVERS_WIRELESS_SPIRIT_INCLUDE_SPIRIT_LINEARFIFO_H */
|