TWD/FW_Transfer/Export_Inc/FwEvent_api.h
changeset 0 10c42ec6c05f
equal deleted inserted replaced
-1:000000000000 0:10c42ec6c05f
       
     1 /*
       
     2  * FwEvent_api.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 FwEvent.h
       
    41  *  \brief FwEvent api
       
    42  *
       
    43  *  \see FwEvent.c
       
    44  */
       
    45 
       
    46 
       
    47 #ifndef _FW_EVENT_API_H
       
    48 #define _FW_EVENT_API_H
       
    49 
       
    50 /* Public Function Definitions */
       
    51 
       
    52 /*
       
    53  * \brief	Create the FwEvent module object
       
    54  * 
       
    55  * \param  hOs  - OS module object handle
       
    56  * \return Handle to the created object
       
    57  * 
       
    58  * \par Description
       
    59  * Calling this function creates a FwEvent object
       
    60  * 
       
    61  * \sa fwEvent_Destroy
       
    62  */
       
    63 TI_HANDLE       fwEvent_Create              (TI_HANDLE hOs);
       
    64 
       
    65 
       
    66 /*
       
    67  * \brief	Destroys the FwEvent object
       
    68  * 
       
    69  * \param  hFwEvent  - The object to free
       
    70  * \return TI_OK
       
    71  * 
       
    72  * \par Description
       
    73  * Calling this function destroys a FwEvent object
       
    74  * 
       
    75  * \sa fwEvent_Create
       
    76  */
       
    77 TI_STATUS       fwEvent_Destroy             (TI_HANDLE hFwEvent);
       
    78 
       
    79 
       
    80 /*
       
    81  * \brief	Requests the context engine to schedule the driver task
       
    82  * 
       
    83  * \param  hFwEvent  - FwEvent Driver handle
       
    84  * \return void
       
    85  * 
       
    86  * \par Description
       
    87  * Called by the FW-Interrupt ISR.
       
    88  * Requests the context engine to schedule the driver task 
       
    89  * for handling the FW-Events (FwEvent callback).
       
    90  * 
       
    91  * \sa
       
    92  */
       
    93 void            fwEvent_InterruptRequest    (TI_HANDLE hFwEvent);
       
    94 
       
    95 
       
    96 /*
       
    97  * \brief	Handle the FW interrupts
       
    98  * 
       
    99  * \param  hFwEvent  - FwEvent Driver handle
       
   100  * \return void
       
   101  * 
       
   102  * \par Description
       
   103  * Called from context module upon receiving FW interrupt
       
   104  * The function mask the interrupts and reads the FW status
       
   105  * 
       
   106  * \sa
       
   107  */
       
   108 void            fwEvent_Handle              (TI_HANDLE hFwEvent);
       
   109 
       
   110 
       
   111 /*
       
   112  * \brief	Handle the Fw Status information 
       
   113  * 
       
   114  * \param  hFwEvent  - FwEvent Driver handle
       
   115  * \return void
       
   116  * 
       
   117  * \par Description
       
   118  * This function is called from fwEvent_Handle on a sync read, or from TwIf as a CB on an async read.
       
   119  * It calls fwEvent_CallHandler to handle the triggered interrupts.
       
   120  * 
       
   121  * \sa fwEvent_Handle
       
   122  */
       
   123 void            fwEvent_ReadCompleteCb      (TI_HANDLE hFwEvent);
       
   124 
       
   125 
       
   126 /*
       
   127  * \brief	Config the FwEvent module object
       
   128  * 
       
   129  * \param  hFwEvent  - FwEvent Driver handle
       
   130  * \param  hTWD  - Handle to TWD module
       
   131  * \return TI_OK
       
   132  * 
       
   133  * \par Description
       
   134  * From hTWD we extract : hOs, hReport, hTwIf, hContext,
       
   135  *      hHealthMonitor, hEventMbox, hCmdMbox, hRxXfer, 
       
   136  *      hTxHwQueue, hTxResult
       
   137  * In this function we also register the FwEvent to the context engine
       
   138  * 
       
   139  * \sa
       
   140  */
       
   141 TI_STATUS       fwEvent_Init                (TI_HANDLE hFwEvent, TI_HANDLE hTWD);
       
   142 
       
   143 
       
   144 /*
       
   145  * \brief	Stop & reset FwEvent (called by the driver stop process)
       
   146  * 
       
   147  * \param  hFwEvent  - FwEvent Driver handle
       
   148  * \return TI_OK
       
   149  * 
       
   150  * \par Description
       
   151  *
       
   152  * \sa
       
   153  */
       
   154 TI_STATUS       fwEvent_Stop                (TI_HANDLE hFwEvent);
       
   155 
       
   156 
       
   157 /*
       
   158  * \brief	Translate host to FW time (Usec)
       
   159  * 
       
   160  * \param  hFwEvent  - FwEvent Driver handle
       
   161  * \param  uHostTime - The host time in MS to translate
       
   162  *
       
   163  * \return FW Time in Usec
       
   164  * 
       
   165  * \par Description
       
   166  * 
       
   167  * \sa
       
   168  */
       
   169 TI_UINT32       fwEvent_TranslateToFwTime (TI_HANDLE hFwEvent, TI_UINT32 uHostTime);
       
   170 
       
   171 
       
   172 /*
       
   173  * \brief	Disable the FwEvent client of the context thread handler
       
   174  * 
       
   175  * \param  hFwEvent  - FwEvent Driver handle
       
   176  * \return void
       
   177  * 
       
   178  * \par Description
       
   179  *
       
   180  * \sa
       
   181  */
       
   182 void            fwEvent_DisableInterrupts   (TI_HANDLE hFwEvent);
       
   183 
       
   184 
       
   185 /*
       
   186  * \brief	Enable the FwEvent client of the context thread handler
       
   187  * 
       
   188  * \param  hFwEvent  - FwEvent Driver handle
       
   189  * \return void
       
   190  * 
       
   191  * \par Description
       
   192  *
       
   193  * \sa
       
   194  */
       
   195 void            fwEvent_EnableInterrupts    (TI_HANDLE hFwEvent);
       
   196 
       
   197 
       
   198 /*
       
   199  * \brief	Unmask all interrupts, set Rx interrupt bit and call FwEvent_Handle
       
   200  * 
       
   201  * \param  hFwEvent  - FwEvent Driver handle
       
   202  * \return void
       
   203  * 
       
   204  * \par Description
       
   205  * Called when driver Start or recovery process is completed.
       
   206  * Unmask all interrupts, set Rx interrupt bit and call FwEvent_Handle 
       
   207  * (in case we missed an Rx interrupt in a recovery process).
       
   208  *
       
   209  * \sa
       
   210  */
       
   211 void            fwEvent_EnableExternalEvents(TI_HANDLE hFwEvent);
       
   212 
       
   213 
       
   214 /*
       
   215  * \brief	Unmask only cmd-cmplt and events interrupts (needed for init phase)
       
   216  * 
       
   217  * \param  hFwEvent  - FwEvent Driver handle
       
   218  * \return Event mask
       
   219  * 
       
   220  * \par Description
       
   221  * Unmask only cmd-cmplt and events interrupts (needed for init phase)
       
   222  * and return interrupt enabled bit mask.
       
   223  *
       
   224  * \sa
       
   225  */
       
   226 TI_UINT32       fwEvent_GetInitMask         (TI_HANDLE hFwEvent);
       
   227 
       
   228 
       
   229 /*
       
   230  * \brief	Issue a FW status read (Not in response to any FW interrupt)
       
   231  * 
       
   232  * \param  hFwEvent  - FwEvent Driver handle
       
   233  * \return void
       
   234  * 
       
   235  * \par Description
       
   236  * Issue a FW status read (Not in response to any FW interrupt)
       
   237  * Called also from fwEvent_EnableExternalEvents after recovery.
       
   238  * 
       
   239  * \sa fwEvent_EnableExternalEvents
       
   240  */
       
   241 void            fwEvent_GetFwStatus         (TI_HANDLE hFwEvent);
       
   242 
       
   243 
       
   244 
       
   245 #ifdef TI_DBG
       
   246 
       
   247 void            fwEvent_PrintStat           (TI_HANDLE hFwEvent);
       
   248 
       
   249 #endif  /* TI_DBG */
       
   250 
       
   251 
       
   252 
       
   253 #endif /* _FW_EVENT_API_H */
       
   254 
       
   255 
       
   256 
       
   257 
       
   258 
       
   259 
       
   260