FreeCalypso > hg > ffs-editor
comparison src/cs/layer1/gtt_include/ctm/fifo.h @ 0:92470e5d0b9e
src: partial import from FC Selenite
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Fri, 15 May 2020 01:28:16 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:92470e5d0b9e |
|---|---|
| 1 /* | |
| 2 ******************************************************************************* | |
| 3 * | |
| 4 * COPYRIGHT (C) 2000 BY ERICSSON EUROLAB DEUTSCHLAND GmbH | |
| 5 * 90411 NUERNBERG, GERMANY, Tel Int + 49 911 5217 100 | |
| 6 * | |
| 7 * The program(s) may be used and/or copied only with the | |
| 8 * written permission from Ericsson or in accordance | |
| 9 * with the terms and conditions stipulated in the agreement or | |
| 10 * contract under which the program(s) have been supplied. | |
| 11 * | |
| 12 ******************************************************************************* | |
| 13 * | |
| 14 * File : fifo.h | |
| 15 * Author : Matthias Doerbecker | |
| 16 * Tested Platforms : DEC Alpha 250 4/266 (OSF/1 3.2) | |
| 17 * Description : File I/O for float and double (32/64 bit signed) | |
| 18 * values. | |
| 19 * | |
| 20 * Revision history | |
| 21 * | |
| 22 * Rev Date Name Description | |
| 23 * ------------------------------------------------------------------- | |
| 24 * pA1 12-MAR-97 M.Doerbecker initial version | |
| 25 * (based on shortio.h pA2) | |
| 26 * | |
| 27 ******************************************************************************* | |
| 28 */ | |
| 29 #ifndef fifo_h | |
| 30 #define fifo_h "$Id: $" | |
| 31 | |
| 32 /* | |
| 33 ******************************************************************************* | |
| 34 * INCLUDE FILES | |
| 35 ******************************************************************************* | |
| 36 */ | |
| 37 | |
| 38 #include "ctm_typedefs.h" | |
| 39 /* | |
| 40 ******************************************************************************* | |
| 41 * DEFINITION OF CONSTANTS | |
| 42 ******************************************************************************* | |
| 43 */ | |
| 44 | |
| 45 /* | |
| 46 ******************************************************************************* | |
| 47 * DEFINITION OF DATA TYPES | |
| 48 ******************************************************************************* | |
| 49 */ | |
| 50 | |
| 51 // typedef float Float; | |
| 52 // typedef char Char; | |
| 53 | |
| 54 typedef enum {SHORTINT_FIFO, FLOAT_FIFO, CHAR_FIFO} fifo_type_t; | |
| 55 | |
| 56 | |
| 57 /* fifo_state_t is the state variable type that is used for both types */ | |
| 58 /* of fifo structures: Shortint_fifo as well as Float_fifo. */ | |
| 59 | |
| 60 typedef struct | |
| 61 { | |
| 62 WORD16 *buffer_Shortint; /* buffer for Shortint_fifo_xxx() */ | |
| 63 Float *buffer_Float; /* buffer for Float_fifo_xxx() */ | |
| 64 Char *buffer_Char; /* buffer for Char_fifo_xxx() */ | |
| 65 WORD32 length_buffer; /* maximum length of the fifo buffer */ | |
| 66 WORD32 num_entries_actual;/* actual number of elements in fifo */ | |
| 67 fifo_type_t fifo_type; /* either SHORTINT_FIFO or FLOAT_FIFO */ | |
| 68 WORD32 magic_number; /* for detecting wheter fifo is initialized */ | |
| 69 } | |
| 70 fifo_state_t; | |
| 71 | |
| 72 /* | |
| 73 ******************************************************************************* | |
| 74 * DECLARATION OF PROTOTYPES | |
| 75 ******************************************************************************* | |
| 76 */ | |
| 77 | |
| 78 | |
| 79 /* | |
| 80 ******************************************************************************* | |
| 81 * | |
| 82 * Function : Shortint_fifo_init | |
| 83 * In : length_fifo determines maximukm length of the buffer | |
| 84 * Out : fifo_state initialized state variable | |
| 85 * Calls : calloc, fprintf, exit | |
| 86 * Tables : <none> | |
| 87 * Compile Defines : <none> | |
| 88 * Return : 0 on success, 1 in case of an error | |
| 89 * Information : initialization of a fifo structure for buffering | |
| 90 * Shortint data | |
| 91 * | |
| 92 ******************************************************************************* | |
| 93 */ | |
| 94 | |
| 95 int Shortint_fifo_init(fifo_state_t *fifo_state, | |
| 96 WORD32 length_fifo); | |
| 97 | |
| 98 | |
| 99 | |
| 100 /* | |
| 101 ******************************************************************************* | |
| 102 * | |
| 103 * Function : Shortint_fifo_reset | |
| 104 * In : | |
| 105 * In/Out : fifo_state initialized state variable | |
| 106 * Calls : <none> | |
| 107 * Tables : <none> | |
| 108 * Compile Defines : <none> | |
| 109 * Return : 0 on success, 1 in case of an error | |
| 110 * Information : reset of the fifo structure, i.e. all buffered | |
| 111 * elements are removed | |
| 112 * | |
| 113 ******************************************************************************* | |
| 114 */ | |
| 115 | |
| 116 int Shortint_fifo_reset(fifo_state_t *fifo_state); | |
| 117 | |
| 118 | |
| 119 | |
| 120 /* | |
| 121 ******************************************************************************* | |
| 122 * | |
| 123 * Function : Shortint_fifo_exit | |
| 124 * In : length_fifo determines maximum length of the buffer | |
| 125 * In/Out : fifo_state initialized state variable | |
| 126 * Calls : free, fprintf, exit | |
| 127 * Tables : <none> | |
| 128 * Compile Defines : <none> | |
| 129 * Return : 0 on success, 1 in case of an error | |
| 130 * Information : shuts down fifo structure, frees allocated memory | |
| 131 * | |
| 132 ******************************************************************************* | |
| 133 */ | |
| 134 | |
| 135 int Shortint_fifo_exit(fifo_state_t *fifo_state); | |
| 136 | |
| 137 | |
| 138 | |
| 139 /* | |
| 140 ******************************************************************************* | |
| 141 * | |
| 142 * Function : Shortint_fifo_push | |
| 143 * In : elements_to_push vector containing the elements | |
| 144 * In num_elements_to_push number of the elements | |
| 145 * In/Out : fifo_state state variable | |
| 146 * Calls : fprintf, exit | |
| 147 * Tables : <none> | |
| 148 * Compile Defines : <none> | |
| 149 * Return : 0 on success, 1 in case of an error | |
| 150 * Information : pushes elements into the fifo | |
| 151 * | |
| 152 ******************************************************************************* | |
| 153 */ | |
| 154 | |
| 155 int Shortint_fifo_push(fifo_state_t *fifo_state, | |
| 156 WORD16 *elements_to_push, | |
| 157 WORD32 num_elements_to_push); | |
| 158 | |
| 159 | |
| 160 /* | |
| 161 ******************************************************************************* | |
| 162 * | |
| 163 * Function : Shortint_fifo_pop | |
| 164 * In : num_elements_to_pop number of the elements | |
| 165 * Out : popped_elements vector containing the elements | |
| 166 * In/Out : fifo_state state variable | |
| 167 * Calls : fprintf, exit | |
| 168 * Tables : <none> | |
| 169 * Compile Defines : <none> | |
| 170 * Return : 0 on success, 1 in case of an error | |
| 171 * Information : pops elements from the fifo | |
| 172 * | |
| 173 ******************************************************************************* | |
| 174 */ | |
| 175 | |
| 176 int Shortint_fifo_pop(fifo_state_t *fifo_state, | |
| 177 WORD16 *popped_elements, | |
| 178 WORD32 num_elements_to_pop); | |
| 179 | |
| 180 | |
| 181 /* | |
| 182 ******************************************************************************* | |
| 183 * | |
| 184 * Function : Shortint_fifo_peek | |
| 185 * In : num_elements_to_peek number of the elements | |
| 186 * Out : peeked_elements vector containing the elements | |
| 187 * In/Out : fifo_state state variable | |
| 188 * Calls : fprintf, exit | |
| 189 * Tables : <none> | |
| 190 * Compile Defines : <none> | |
| 191 * Return : 0 on success, 1 in case of an error | |
| 192 * Information : similar to pop, but elements are remaining in buffer | |
| 193 * | |
| 194 ******************************************************************************* | |
| 195 */ | |
| 196 | |
| 197 int Shortint_fifo_peek(fifo_state_t *fifo_state, | |
| 198 WORD16 *peeked_elements, | |
| 199 WORD32 num_elements_to_peek); | |
| 200 | |
| 201 | |
| 202 /* | |
| 203 ******************************************************************************* | |
| 204 * | |
| 205 * Function : Shortint_fifo_check | |
| 206 * In/Out : fifo_state state variable | |
| 207 * Calls : <none> | |
| 208 * Tables : <none> | |
| 209 * Compile Defines : <none> | |
| 210 * Return : number of elements in fifo | |
| 211 * Information : determines the number of valid elements in fifo | |
| 212 * | |
| 213 ******************************************************************************* | |
| 214 */ | |
| 215 | |
| 216 WORD32 Shortint_fifo_check(fifo_state_t *fifo_state); | |
| 217 | |
| 218 #endif |
