Home | History | Annotate | Download | only in Inc
      1 /** \file TNETWArbvSM.h
      2  *  \brief This is the PowerSrv module API.
      3  *  \author Ruthy Zaphir
      4  *  \date 15-May-2005
      5  */
      6 /****************************************************************************
      7 **+-----------------------------------------------------------------------+**
      8 **|                                                                       |**
      9 **| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved.      |**
     10 **| All rights reserved.                                                  |**
     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 
     41 /****************************************************************************
     42  *                                                                          *
     43  *   MODULE:  TNETWArbvSM                                               *
     44  *   PURPOSE: TNETWArbvSM Module API                                    *
     45  *                                                                          *
     46  ****************************************************************************/
     47 
     48 #ifndef _TNETWARBSM_H_
     49 #define _TNETWARBSM_H_
     50 
     51 #include "commonTypes.h"
     52 #include "whalCommon.h"
     53 
     54 /*****************************************************************************
     55  **         Constants                                                       **
     56  *****************************************************************************/
     57 
     58 #define TNETWARB_SM_MODULE_LOG /*POWER_MANAGER_SM_MODULE_LOG*/
     59 
     60 
     61 /*****************************************************************************
     62  **         Enumerations                                                    **
     63  *****************************************************************************/
     64 
     65 
     66 /** \enum TnetwArbSMEvents_e */
     67 enum TnetwArbSMEvents_e
     68 {
     69     TNETWARBSM_EV_START,             /**< move to active command */
     70     TNETWARBSM_EV_BUS_AVAIL,
     71     TNETWARBSM_EV_HW_AVAIL,
     72     TNETWARBSM_EV_RESTART,
     73     TNETWARBSM_EV_FINISH,
     74     TNETWARBSM_EV_TXN_CMPLT,
     75 
     76     TNETWARBSM_EVENT_NUM
     77 };
     78 
     79 /** \enum TnetwArbSMStates_e */
     80 enum TnetwArbSMStates_e
     81 {
     82     TNETWARBSM_STATE_IDLE,              /**< TNETW ARBITER is not running any process */
     83     TNETWARBSM_STATE_WAIT_BUS,          /**< TNETW ARBITER is waiting to receive the Bus Semaphore */
     84     TNETWARBSM_STATE_WAIT_HW,           /**< TNETW ARBITER is waiting for HW to awake */
     85     TNETWARBSM_STATE_WAIT_BUS_AFTER_HW, /**< TNETW ARBITER is waiting for bus */
     86     TNETWARBSM_STATE_WAIT_TXN1,         /**< TNETW ARBITER is waiting for end of bus transaction [1] */
     87     TNETWARBSM_STATE_RUNNING,           /**< TNETW ARBITER is running at least a process */
     88     TNETWARBSM_STATE_WAIT_TXN2,         /**< TNETW ARBITER is waiting for end of bus transaction [2] */
     89 
     90     TNETWARB_SM_STATE_NUM
     91 };
     92 
     93 /*****************************************************************************
     94  **         Typedefs                                                        **
     95  *****************************************************************************/
     96 
     97 typedef enum TnetwArbSMEvents_e TnetwArbSMEvents_e;
     98 
     99 typedef enum TnetwArbSMStates_e TnetwArbSMStates_e;
    100 
    101 
    102 /*****************************************************************************
    103  **         Structures                                                      **
    104  *****************************************************************************/
    105 
    106 /** \struct TNETWArbSM_Config_t */
    107 /*
    108 typedef struct
    109 {
    110 
    111 } TNETWArbSM_Config_t;
    112 */
    113 
    114 /** \struct TNETWArbSM_t */
    115 typedef struct
    116 {
    117     TI_HANDLE           hOS;                    /**<
    118                                                  * Handle to the OS object.
    119                                                  */
    120 
    121     TI_HANDLE           hFSM;                   /**< Handle to the FSM object.
    122                                                  */
    123 
    124     TI_HANDLE           hTNETWArb;              /* Handle to the TNET Arbiter to call it when doing actions with the TODO Queue */
    125 
    126     TI_HANDLE           hReport;                /**<
    127                                                  * Handle to the Report module.
    128                                                  */
    129 
    130 
    131     TI_HANDLE           hELPCtrl;               /**< Handle to the power controller object via the WhalCtrl.
    132                                                  * Need for configure the desired power mode policy in the system.
    133                                                  */
    134 
    135     TI_HANDLE           hBusArbiter;            /**< Handle to the power controller object via the WhalCtrl.
    136                                                  * Need for configure the desired power mode policy in the system.
    137                                                  */
    138 
    139     UINT32              event;                  /**< Last event sent */
    140 
    141     BOOL                bHwAvail;               /**< Is set to TRUE is received HW_AVAIL event */
    142 
    143 	TI_STATUS			SMlastOperationStatus;	/**< Used to store the status of the last SM operation,
    144 												  *	 to allow the use of non-recursive state mahcine */
    145 
    146 } TNETWArbSM_t;
    147 
    148 
    149 /*****************************************************************************
    150  **         External data definitions                                       **
    151  *****************************************************************************/
    152 
    153 
    154 /*****************************************************************************
    155  **         External functions definitions                                  **
    156  *****************************************************************************/
    157 
    158 
    159 /*****************************************************************************
    160  **         Public Function prototypes                                      **
    161  *****************************************************************************/
    162 
    163 /**
    164  * \author Yossi Peery
    165  * \date 15-May-2005\n
    166  * \brief Creates the object of the PowerSrv.
    167  *
    168  * Function Scope \e Public.\n
    169  * Parameters:\n
    170  * 1) TI_HANDLE - handle to the OS.\n
    171  * Return Value: TI_HANDLE - handle to the PowerSrv object.\n
    172  */
    173 TI_HANDLE TNETWArbSM_Create (TI_HANDLE hOs);
    174 
    175 /**
    176  * \author Yossi Peery
    177  * \date 15-May-2005\n
    178  * \brief Destroy the object of the PowerSrvSM.
    179  *
    180  * Function Scope \e Public.\n
    181  * Parameters:\n
    182  * 1) TI_HANDLE - handle to the PowerSrv object.\n
    183  * Return Value: TI_STATUS - OK on success else NOK.\n
    184  */
    185 TI_STATUS TNETWArbSM_Destroy (TI_HANDLE hTNETWArbSM);
    186 
    187 /**
    188  * \author Yossi Peery
    189  * \date 15-May-2005\n
    190  * \brief Initialize the PowerSrvSM module.
    191  *
    192  * Function Scope \e Public.\n
    193  * Parameters:\n
    194  * 1) TI_HANDLE - handle to the PowerSrvSM object.\n
    195  * 2) TI_HANDLE - handle to the Report object.
    196  * 3) TI_HANDLE - handle to the whalCtrl object.
    197  * 4) TI_HANDLE - handle to the QosMgr object.
    198  * 5) TI_HANDLE - handle to the Mlme object.
    199  * 6) TI_HANDLE - handle to the SiteMgr object.
    200  * 7) PowerSrvInitParams_t - the Power Server initialize parameters.\n
    201  * Return Value: TI_STATUS - OK on success else NOK.\n
    202  */
    203 TI_STATUS TNETWArbSM_Init (TI_HANDLE hTNETWArbSM, TI_HANDLE hReport, TI_HANDLE hTNETWArb, TI_HANDLE hELPCtrl, TI_HANDLE hBusArbiter);
    204 
    205 /**
    206  * \author Yossi Peery
    207  * \date 15-May-2005\n
    208  * \brief trigger events from the outside of the module into the state machine.
    209  *
    210  * Function Scope \e Public.\n
    211  * Parameters:\n
    212  * 1) TI_HANDLE - handle to the PowerSrvSM object.\n
    213  * 2) TnetwArbSMEvents_e - the input events to the state machine.
    214  * Return Value: TI_STATUS - OK on success else NOK.\n
    215  * \b Description:\n
    216  * this function will trigger the manager of the state macine (PowerSrvSM_SMEvent()).
    217  */
    218 TI_STATUS TNETWArbSM_SMEvent(TI_HANDLE hTNETWArbSM,
    219                            TnetwArbSMEvents_e theSMEvent);
    220 
    221 
    222 void TNETWArbSM_HwAvailCB(TI_HANDLE hTNETWArbSM);
    223 void TNETWArbSM_TxnCb(TI_HANDLE hTNETWArbSM);
    224 
    225 
    226 #endif /*  _GWSI_POWER_SRV_SM_H_  */
    227