Xmega Application Note | |||||
00001 /*This file is prepared for Doxygen automatic documentation generation.*/ 00022 /* Copyright (c) 2010 Atmel Corporation. All rights reserved. 00023 * 00024 * Redistribution and use in source and binary forms, with or without 00025 * modification, are permitted provided that the following conditions are met: 00026 * 00027 * 1. Redistributions of source code must retain the above copyright notice, this 00028 * list of conditions and the following disclaimer. 00029 * 00030 * 2. Redistributions in binary form must reproduce the above copyright notice, 00031 * this list of conditions and the following disclaimer in the documentation 00032 * and/or other materials provided with the distribution. 00033 * 00034 * 3. The name of Atmel may not be used to endorse or promote products derived 00035 * from this software without specific prior written permission. 00036 * 00037 * 4. This software may only be redistributed and used in connection with an Atmel 00038 * AVR product. 00039 * 00040 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 00041 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00042 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 00043 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 00044 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00045 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00046 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00047 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00048 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00049 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE 00050 * 00051 */ 00052 00053 #ifndef _FIFO_H_ 00054 #define _FIFO_H_ 00055 00057 enum { 00058 FIFO_OK = 0, 00059 FIFO_ERROR_OVERFLOW, 00060 FIFO_ERROR_UNDERFLOW, 00061 FIFO_ERROR 00063 }; 00064 00066 enum { 00067 FIFO_ELEMENT_8BITS = 0, 00068 FIFO_ELEMENT_16BITS, 00069 FIFO_ELEMENT_32BITS 00071 }; 00072 00074 typedef struct { 00075 volatile UnionVPtr buffer; 00076 volatile uint16_t rd_id; 00077 volatile uint16_t wr_id; 00078 uint16_t size; 00079 uint8_t align; 00080 } fifo_desc_t; 00081 00099 int fifo_init_no_malloc(fifo_desc_t *fifo_desc, void *buffer, uint16_t size, 00100 uint16_t element_size); 00101 00118 extern int fifo_init_malloc(fifo_desc_t **fifo_desc, uint16_t size, 00119 uint16_t element_size); 00120 00125 extern void fifo_stop_malloc(fifo_desc_t **fifo_desc); 00126 00133 extern uint16_t fifo_get_used_size(fifo_desc_t *fifo_desc); 00134 00141 extern uint16_t fifo_get_free_size(fifo_desc_t *fifo_desc); 00142 00152 extern int fifo_push(fifo_desc_t *fifo_desc, uint32_t item); 00153 00163 extern int fifo_pull(fifo_desc_t *fifo_desc, void *item); 00164 00168 extern void fifo_reset(fifo_desc_t *fifo_desc); 00169 #endif // _FIFO_H_
Generated on Fri Oct 22 12:15:25 2010 for AVR1300 Using the Xmega ADC by ![]() |