• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** \file Scr.h
2  *  \brief This file includes internal (private) definitions to the SCR module
3  *  \author Ronen Kalish
4  *  \date 01-Dec-2004
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 #ifndef __SCR_H__
42 #define __SCR_H__
43 
44 #include "scrApi.h"
45 
46 /*
47  ***********************************************************************
48  *	Constant definitions.
49  ***********************************************************************
50  */
51 
52  /*
53  ***********************************************************************
54  *	Enums.
55  ***********************************************************************
56  */
57 
58 /** \enum scr_clientState_e
59  * \brief enumerates the different states a client may be in .\n
60  */
61 typedef enum
62 {
63     SCR_CS_IDLE = 0,    /**< client is idle */
64     SCR_CS_PENDING,     /**< client is pending to use the channel */
65     SCR_CS_RUNNING,     /**< client is using the channel */
66     SCR_CS_ABORTING     /**<
67                          * client was using the channel, but was aborted,
68                          * and complete notification is expected.
69                          */
70 } scr_clientState_e;
71 
72 
73 /*
74  ***********************************************************************
75  *	Typedefs.
76  ***********************************************************************
77  */
78 
79 /*
80  ***********************************************************************
81  *	Structure definitions.
82  ***********************************************************************
83  */
84 
85 /** \struct scr_client_t
86  * \brief This structure contains information for a specific client
87  */
88 typedef struct
89 {
90 	scr_clientState_e 	state;                                      /**< the client current state */
91 	scr_callback_t		clientRequestCB;                            /**< the client's callback function */
92 	TI_HANDLE		    ClientRequestCBObj;                         /**< the client's object */
93     scr_pendReason_e    currentPendingReason;                       /**<
94                                                                      * the reason why this client is pending
95                                                                      * (if at all)
96                                                                      */
97 } scr_client_t;
98 
99 /** \struct scr_t
100  * \brief This structure contains the SCR object data
101  */
102 typedef struct
103 {
104     TI_HANDLE		        hOS;                                    /**< a handle to the OS object */
105     TI_HANDLE               hReport;                                /**< a handle to the report object */
106 	BOOLEAN		            statusNotficationPending;               /**<
107                                                                      * whether the SCR is in the process of
108                                                                      * notifying a status change to a client
109                                                                      * (used to solve re-entrance problem)
110                                                                      */
111     scr_clientId_e          runningClient;                          /**<
112                                                                      * The index of the current running client
113                                                                      * (-1 if none)
114                                                                      */
115     scr_groupId_e           currentGroup;                           /**< the current group */
116 	scr_modeId_e			currentMode;							/**< the current mode */
117     scr_client_t	        clientArray[ SCR_CID_NUM_OF_CLIENTS ];  /**< array holding all clients' info */
118 } scr_t;
119 
120 
121 /*
122  ***********************************************************************
123  *	External functions definitions
124  ***********************************************************************
125  */
126 /**
127  * \author Ronen Kalish\n
128  * \date 01-Dec-2004\n
129  * \brief Searches the client database for a client with matching state, from startFrom to endAt\n
130  *
131  * Function Scope \e Private.\n
132  * \param hScr - handle to the SCR object.\n
133  * \param requiredState - the state to match.\n
134  * \param startFrom - the highest priority to begin searching from.\n
135  * \param endAt - the lowest priority to include in the search.\n
136  * \return the client ID if found, SCR_CID_NO_CLIENT otherwise.\n
137  */
138 INT8 scrFindHighest( TI_HANDLE hScr,
139                      scr_clientState_e requiredState,
140                      int startFrom,
141                      int endAt );
142 
143 #endif /* __SCR_H__ */
144