Home | History | Annotate | Download | only in Rx_Xfer
      1 /****************************************************************************
      2 **+-----------------------------------------------------------------------+**
      3 **|                                                                       |**
      4 **| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved.      |**
      5 **| All rights reserved.                                                  |**
      6 **|                                                                       |**
      7 **| Redistribution and use in source and binary forms, with or without    |**
      8 **| modification, are permitted provided that the following conditions    |**
      9 **| are met:                                                              |**
     10 **|                                                                       |**
     11 **|  * Redistributions of source code must retain the above copyright     |**
     12 **|    notice, this list of conditions and the following disclaimer.      |**
     13 **|  * Redistributions in binary form must reproduce the above copyright  |**
     14 **|    notice, this list of conditions and the following disclaimer in    |**
     15 **|    the documentation and/or other materials provided with the         |**
     16 **|    distribution.                                                      |**
     17 **|  * Neither the name Texas Instruments nor the names of its            |**
     18 **|    contributors may be used to endorse or promote products derived    |**
     19 **|    from this software without specific prior written permission.      |**
     20 **|                                                                       |**
     21 **| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   |**
     22 **| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     |**
     23 **| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |**
     24 **| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  |**
     25 **| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |**
     26 **| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      |**
     27 **| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |**
     28 **| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |**
     29 **| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   |**
     30 **| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |**
     31 **| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  |**
     32 **|                                                                       |**
     33 **+-----------------------------------------------------------------------+**
     34 ****************************************************************************/
     35 
     36 /****************************************************************************
     37  *
     38  *   MODULE:  rxXfer.h
     39  *
     40  *   PURPOSE: Rx Xfer module header file.
     41  *
     42  ****************************************************************************/
     43 
     44 #ifndef _RX_XFER_H
     45 #define _RX_XFER_H
     46 
     47 #include "rxXfer_api.h"
     48 #include "whalBus_Defs.h"
     49 #include "TNETWIF.h"
     50 #include "public_descriptors.h"
     51 
     52 #define RX_DESCRIPTOR_SIZE (sizeof(RxIfDescriptor_t))
     53 
     54 typedef struct
     55 {
     56     UINT32      numPacketsRead;
     57     UINT32      numBytesRead;
     58     UINT32      numPacketsDroppedNoMem;
     59     UINT32      numPacketsDroppedPacketIDMismatch;
     60     UINT32      numIrq0;
     61     UINT32      numIrq1;
     62     UINT32      numAck0;
     63     UINT32      numAck1;
     64 } RxXferStats_T;
     65 
     66 typedef enum
     67 {
     68     RX_XFER_STATE_IDLE,
     69     RX_XFER_STATE_READING_HDR,
     70     RX_XFER_STATE_READING_PKT,
     71     RX_XFER_STATE_EXITING       /* Sending Ack to the FW at the end of the packet read */
     72 } RxXferState_e;
     73 
     74 typedef struct
     75 {
     76     TI_HANDLE               hOs;
     77     TI_HANDLE               hReport;
     78     TI_HANDLE               hTNETWIF;
     79     TI_HANDLE               hFwEvent;
     80     TI_HANDLE               hMemMgr;
     81 
     82     RxXferState_e           state;
     83     TI_STATUS               returnValue;
     84 
     85     /* address of the 2 buffers in the Double Buffer */
     86     UINT32                  doubleBuffer[2];
     87     UINT32                  currBuffer;
     88     UINT32                  lastPacketId;
     89     UINT32                  rxPathStatus;
     90 
     91     /* use a struct to read buffers from the bus - used for extra bytes reserving */
     92     PADDING (RxIfDescriptor_t rxDescriptor)
     93 
     94     void                    *pPacketBuffer;
     95     packetReceiveCB_t       ReceivePacketCB;
     96     TI_HANDLE               ReceivePacketCB_handle;
     97     requestForBufferCB_t    RequestForBufferCB;
     98     TI_HANDLE               RequestForBufferCB_handle;
     99     BOOL                    bSync;  			   /* indicate if we are in Synch bus or not */
    100     TI_STATUS               packetStatus; 	 	   /* OK unless an error occurred ... */
    101 
    102 #ifdef TI_DBG
    103     RxXferStats_T           DbgStats;
    104 #endif /* TI_DBG */
    105 
    106 } RxXfer_t;
    107 
    108 
    109 #endif /* _RX_XFER_H */
    110