TWD/FW_Transfer/CmdMBox.h
changeset 0 10c42ec6c05f
equal deleted inserted replaced
-1:000000000000 0:10c42ec6c05f
       
     1 /*
       
     2  * CmdMBox.h
       
     3  *
       
     4  * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
       
     5  * All rights reserved.      
       
     6  * 
       
     7  * This program and the accompanying materials are made available under the 
       
     8  * terms of the Eclipse Public License v1.0 or BSD License which accompanies
       
     9  * this distribution. The Eclipse Public License is available at
       
    10  * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
       
    11  *                                                                       
       
    12  * Redistribution and use in source and binary forms, with or without    
       
    13  * modification, are permitted provided that the following conditions    
       
    14  * are met:                                                              
       
    15  *                                                                       
       
    16  *  * Redistributions of source code must retain the above copyright     
       
    17  *    notice, this list of conditions and the following disclaimer.      
       
    18  *  * Redistributions in binary form must reproduce the above copyright  
       
    19  *    notice, this list of conditions and the following disclaimer in    
       
    20  *    the documentation and/or other materials provided with the         
       
    21  *    distribution.                                                      
       
    22  *  * Neither the name Texas Instruments nor the names of its            
       
    23  *    contributors may be used to endorse or promote products derived    
       
    24  *    from this software without specific prior written permission.      
       
    25  *                                                                       
       
    26  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   
       
    27  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     
       
    28  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
       
    29  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  
       
    30  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
       
    31  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      
       
    32  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
       
    33  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
       
    34  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   
       
    35  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
       
    36  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
       
    37  */
       
    38 
       
    39 
       
    40 /** \file CmdMBox.h
       
    41  *  \brief CmdMbox internal defenitions
       
    42  *
       
    43  *  \see CmdMBox.c
       
    44  */
       
    45 
       
    46 #ifndef _CMDMBOX_H_
       
    47 #define _CMDMBOX_H_
       
    48 
       
    49 #include "TwIf.h"
       
    50 
       
    51 /*****************************************************************************
       
    52  **          Defines                                                        **
       
    53  *****************************************************************************/
       
    54  /* wait for a Mail box command to complete, ms */
       
    55 #define CMDMBOX_WAIT_TIMEOUT            15000
       
    56 #define CMDMBOX_HEADER_LEN              4
       
    57 #define MAX_CMD_MBOX_CONSECUTIVE_TXN    5
       
    58 #define CMD_NUM                         2
       
    59 
       
    60 
       
    61 
       
    62 typedef struct
       
    63 {   
       
    64     TTxnStruct          tTxnStruct;
       
    65     TI_UINT8            *pCmdMbox;
       
    66 }TCmdTxn;
       
    67 
       
    68 typedef struct
       
    69 {   
       
    70     TTxnStruct          tTxnStruct;
       
    71     TI_UINT8            *pRegister;
       
    72 }TRegTxn;
       
    73 
       
    74 
       
    75 /*****************************************************************************
       
    76  **         Structures                                                      **
       
    77  *****************************************************************************/
       
    78 
       
    79 /** \struct TCmdMbox
       
    80  * \brief CmdMbox structure
       
    81  * 
       
    82  * \par Description
       
    83  * 
       
    84  * \sa	
       
    85  */ 
       
    86 typedef struct
       
    87 {   
       
    88     /* handles */
       
    89     TI_HANDLE           hOs;
       
    90     TI_HANDLE           hReport;
       
    91     TI_HANDLE           hTwIf;
       
    92     TI_HANDLE           hTimer; 
       
    93     TI_HANDLE           hCmdQueue;
       
    94     TI_HANDLE           hCmdMboxTimer;
       
    95     fnotify_t           fCb;
       
    96     TI_HANDLE           hCb;
       
    97     TCmdMboxErrorCb     fErrorCb;
       
    98     
       
    99     /* HW params */
       
   100     /* use a struct to read buffers from the bus - used for extra bytes reserving */
       
   101 
       
   102     TCmdTxn             aCmdTxn[CMD_NUM];
       
   103     TRegTxn             aRegTxn[CMD_NUM];
       
   104 
       
   105     /* Holds the module state */
       
   106     TI_BOOL             bCmdInProgress;
       
   107     TI_UINT32           uFwAddr;
       
   108     TI_UINT32           uWriteLen;
       
   109     TI_UINT32           uReadLen;
       
   110 
       
   111 } TCmdMbox;
       
   112 
       
   113 #endif
       
   114 
       
   115