1*0561b2d8STREFOU Felix /** 2*0561b2d8STREFOU Felix ****************************************************************************** 3*0561b2d8STREFOU Felix * @file stm_queue.h 4*0561b2d8STREFOU Felix * @author MCD Application Team 5*0561b2d8STREFOU Felix * @brief Header for stm_queue.c 6*0561b2d8STREFOU Felix ****************************************************************************** 7*0561b2d8STREFOU Felix * @attention 8*0561b2d8STREFOU Felix * 9*0561b2d8STREFOU Felix * <h2><center>© Copyright (c) 2019 STMicroelectronics. 10*0561b2d8STREFOU Felix * All rights reserved.</center></h2> 11*0561b2d8STREFOU Felix * 12*0561b2d8STREFOU Felix * This software component is licensed by ST under BSD 3-Clause license, 13*0561b2d8STREFOU Felix * the "License"; You may not use this file except in compliance with the 14*0561b2d8STREFOU Felix * License. You may obtain a copy of the License at: 15*0561b2d8STREFOU Felix * opensource.org/licenses/BSD-3-Clause 16*0561b2d8STREFOU Felix * 17*0561b2d8STREFOU Felix ****************************************************************************** 18*0561b2d8STREFOU Felix */ 19*0561b2d8STREFOU Felix 20*0561b2d8STREFOU Felix 21*0561b2d8STREFOU Felix 22*0561b2d8STREFOU Felix /* Define to prevent recursive inclusion -------------------------------------*/ 23*0561b2d8STREFOU Felix #ifndef __STM_QUEUE_H 24*0561b2d8STREFOU Felix #define __STM_QUEUE_H 25*0561b2d8STREFOU Felix 26*0561b2d8STREFOU Felix /* Includes ------------------------------------------------------------------*/ 27*0561b2d8STREFOU Felix /* Exported define -----------------------------------------------------------*/ 28*0561b2d8STREFOU Felix /* Options flags */ 29*0561b2d8STREFOU Felix #define CIRCULAR_QUEUE_NO_FLAG 0 30*0561b2d8STREFOU Felix #define CIRCULAR_QUEUE_NO_WRAP_FLAG 1 31*0561b2d8STREFOU Felix #define CIRCULAR_QUEUE_SPLIT_IF_WRAPPING_FLAG 2 32*0561b2d8STREFOU Felix 33*0561b2d8STREFOU Felix 34*0561b2d8STREFOU Felix /* Exported types ------------------------------------------------------------*/ 35*0561b2d8STREFOU Felix typedef struct { 36*0561b2d8STREFOU Felix uint8_t* qBuff; /* queue buffer, , provided by init fct */ 37*0561b2d8STREFOU Felix uint32_t queueMaxSize; /* size of the queue, provided by init fct (in bytes)*/ 38*0561b2d8STREFOU Felix uint16_t elementSize; /* -1 variable. If variable elemenet size the size is stored in the 4 first of the queue element */ 39*0561b2d8STREFOU Felix uint32_t first; /* position of first element */ 40*0561b2d8STREFOU Felix uint32_t last; /* position of last element */ 41*0561b2d8STREFOU Felix uint32_t byteCount; /* number of bytes in the queue */ 42*0561b2d8STREFOU Felix uint32_t elementCount; /* number of element in the queue */ 43*0561b2d8STREFOU Felix uint8_t optionFlags; /* option to enable specific features */ 44*0561b2d8STREFOU Felix } queue_t; 45*0561b2d8STREFOU Felix 46*0561b2d8STREFOU Felix /* Exported constants --------------------------------------------------------*/ 47*0561b2d8STREFOU Felix 48*0561b2d8STREFOU Felix /* Exported macro ------------------------------------------------------------*/ 49*0561b2d8STREFOU Felix /* Exported functions ------------------------------------------------------- */ 50*0561b2d8STREFOU Felix int CircularQueue_Init(queue_t *q, uint8_t* queueBuffer, uint32_t queueSize, uint16_t elementSize, uint8_t optionlags); 51*0561b2d8STREFOU Felix uint8_t* CircularQueue_Add(queue_t *q, uint8_t* x, uint16_t elementSize, uint32_t nbElements); 52*0561b2d8STREFOU Felix uint8_t* CircularQueue_Remove(queue_t *q, uint16_t* elementSize); 53*0561b2d8STREFOU Felix uint8_t* CircularQueue_Sense(queue_t *q, uint16_t* elementSize); 54*0561b2d8STREFOU Felix int CircularQueue_Empty(queue_t *q); 55*0561b2d8STREFOU Felix int CircularQueue_NbElement(queue_t *q); 56*0561b2d8STREFOU Felix uint8_t* CircularQueue_Remove_Copy(queue_t *q, uint16_t* elementSize, uint8_t* buffer); 57*0561b2d8STREFOU Felix uint8_t* CircularQueue_Sense_Copy(queue_t *q, uint16_t* elementSize, uint8_t* buffer); 58*0561b2d8STREFOU Felix 59*0561b2d8STREFOU Felix /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/ 60*0561b2d8STREFOU Felix #endif /* __STM_QUEUE_H */ 61