wifi_rx_queue.h
Go to the documentation of this file.
00001 /*----------------------------------------------------------------------------
00002  *-------------------------      M a R T E   O S      ------------------------
00003  *----------------------------------------------------------------------------
00004  *   Copyright (C) 2003-2005   Universidad de Cantabria, SPAIN
00005  *
00006  *   MaRTE OS web page: http://marte.unican.es
00007  *
00008  *  MaRTE OS  is free software; you can  redistribute it and/or  modify it
00009  *  under the terms of the GNU General Public License  as published by the
00010  *  Free Software Foundation;  either  version 2, or (at  your option) any
00011  *  later version.
00012  *
00013  *  MaRTE OS  is distributed  in the  hope  that  it will be   useful, but
00014  *  WITHOUT  ANY  WARRANTY;     without  even the   implied   warranty  of
00015  *  MERCHANTABILITY  or  FITNESS FOR A  PARTICULAR PURPOSE.    See the GNU
00016  *  General Public License for more details.
00017  *
00018  *  You should have received  a  copy of  the  GNU General Public  License
00019  *  distributed with MaRTE  OS;  see file COPYING.   If not,  write to the
00020  *  Free Software  Foundation,  59 Temple Place  -  Suite 330,  Boston, MA
00021  *  02111-1307, USA.
00022  *
00023  *  As a  special exception, if you  link this  unit  with other  files to
00024  *  produce an   executable,   this unit  does  not  by  itself cause  the
00025  *  resulting executable to be covered by the  GNU General Public License.
00026  *  This exception does  not however invalidate  any other reasons why the
00027  *  executable file might be covered by the GNU Public License.
00028  *----------------------------------------------------------------------------
00029  *
00030  *                            'r x _ q u e u e . h'
00031  *
00032  *                                     C
00033  *
00034  *
00035  * File 'rx_queue.h'                                                  By Chema.
00036  *                                                          Jose Maria Martinez
00037  *                                                            <chema@gmx.net>
00038  * Body fuctions on 'rx_queue.c'
00039 
00040  *---------------------------------------------------------------------------*/
00041 
00042 #ifndef _MARTE_WIFI_RX_QUEUE_H
00043 #define _MARTE_WIFI_RX_QUEUE_H
00044 
00045 
00046 /* This module implements a RING ring queue. It is intended */
00047 /* to be a RING reception queue with a ring storage behavior*/
00048 
00049 #include <semaphore.h>
00050 #include <stdbool.h>
00051 #include "ath5k_interface.h"
00052 
00053 #define RX_RING_ELEMENTS        500
00054 
00055 typedef struct
00056 {
00057         unsigned int head, tail, count;
00058         frame_t frames [RX_RING_ELEMENTS];
00059         bool blocking_read;
00060         sem_t sem;
00061 } wifi_ring_t;
00062 
00063 /*init_ring : This function inicialices the RING queue.*/
00064 /*            you MUST call it BEFORE any access to the queue*/
00065 void ath5k_ring_init (wifi_ring_t *ring);
00066 
00067 /*is_ring_empty : Checks if the queue is empty. Returns FALSE if*/
00068 /*                thereis any frame to be read and TRUE if the  */
00069 /*                queue is empty. */
00070 bool ath5k_ring_empty (wifi_ring_t *ring);
00071 
00072 
00073 /* inset_ring : Stores E in the ring buffer F. The free_pos & frames_num */
00074 /*              variables are updated.                                   */
00075 /*              Return 0 if OK.                                          */
00076 /*              RING_FULL if no room in buffer.                          */
00077 void ath5k_ring_insert (wifi_ring_t *ring, const unsigned char *data,
00078                 const unsigned short len, const int link_quality, const int noise, const unsigned char rate);
00079 
00080 
00081 /*read_ring : Copies in E the the first-in-frame in the buffer.*/
00082 /*            Returns the number of rx bytes. Updates current_pos */
00083 /*            variable.It works under interrupts inhibited. */
00084 /*            this function is blocking y default. If it is configured*/
00085 /*            non blocking QUEUE_EMPTY is returned when empty.*/
00086 void ath5k_ring_extract (wifi_ring_t *ring, frame_t *frame);
00087 
00088 #endif /*_MARTE_WIFI_RX_QUEUE_H*/


ros_rt_wmp
Author(s): Danilo Tardioli, dantard@unizar.es
autogenerated on Fri Jan 3 2014 12:07:56