source: svn/newcon3bcm2_21bu/nexus/base/include/nexus_base_os.h

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 8.7 KB
Line 
1/***************************************************************************
2*     (c)2007-2011 Broadcom Corporation
3*
4*  This program is the proprietary software of Broadcom Corporation and/or its licensors,
5*  and may only be used, duplicated, modified or distributed pursuant to the terms and
6*  conditions of a separate, written license agreement executed between you and Broadcom
7*  (an "Authorized License").  Except as set forth in an Authorized License, Broadcom grants
8*  no license (express or implied), right to use, or waiver of any kind with respect to the
9*  Software, and Broadcom expressly reserves all rights in and to the Software and all
10*  intellectual property rights therein.  IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU
11*  HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY
12*  NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE.
13*
14*  Except as expressly set forth in the Authorized License,
15*
16*  1.     This program, including its structure, sequence and organization, constitutes the valuable trade
17*  secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof,
18*  and to use this information only in connection with your use of Broadcom integrated circuit products.
19*
20*  2.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
21*  AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR
22*  WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
23*  THE SOFTWARE.  BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES
24*  OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE,
25*  LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION
26*  OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF
27*  USE OR PERFORMANCE OF THE SOFTWARE.
28*
29*  3.     TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS
30*  LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR
31*  EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR
32*  USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF
33*  THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT
34*  ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE
35*  LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF
36*  ANY LIMITED REMEDY.
37*
38* $brcm_Workfile: nexus_base_os.h $
39* $brcm_Revision: 5 $
40* $brcm_Date: 5/3/11 5:09p $
41*
42* Revision History:
43*
44* $brcm_Log: /nexus/base/include/nexus_base_os.h $
45*
46* 5   5/3/11 5:09p erickson
47* SW7420-1819: repartition so NFE is a standard feature
48*
49* 4   3/16/11 10:11a erickson
50* SW7420-1642: add NEXUS_Base_Settings.driverModuleInit and
51*  .driverModuleUninit
52*
53* 3   9/23/10 2:12p erickson
54* SW7420-943: refactor for driver/firmware partitioning
55*
56* 2   9/15/10 3:39p jtna
57* SW7420-1004: add synthunk for CORE and PLATFORM
58*
59* 1   7/14/10 11:59a erickson
60* SW7405-4621: split out nexus_base_os.h
61*
62***************************************************************************/
63#ifndef NEXUS_BASE_OS_H
64#define NEXUS_BASE_OS_H
65
66/* This is part of the public API. */
67#include "bstd.h"
68#include "bkni.h"
69#include "bkni_multi.h"
70#include "nexus_base_types.h"       /* this is also public API */
71
72/**
73SW services provided by base which can be used inside and outside nexus.
74This is symlinked in nexus/modules/core for use outside nexus.
75This file should not contain any nexus internals, including NEXUS_ModuleHandle, ISR context or magnum non-basemodules.
76**/
77
78#ifdef __cplusplus
79extern "C"
80{
81#endif
82
83/**
84Summary:
85Handle for a thread.
86
87Description:
88
89See Also:
90NEXUS_Thread_Create
91**/
92typedef struct NEXUS_Thread *NEXUS_ThreadHandle;
93
94/**
95Summary:
96Settings used for creating a thread
97
98Description:
99
100See Also:
101NEXUS_Thread_GetDefaultSettings
102NEXUS_Thread_Create
103**/
104typedef struct NEXUS_ThreadSettings
105{
106    unsigned priority;  /* 0=highest, 100=lowest */
107    size_t  stackSize; /* In Bytes, may be rounded up to OS minimum */
108} NEXUS_ThreadSettings;
109
110/**
111Summary:
112Get default settings for the structure.
113
114Description:
115This is required in order to make application code resilient to the addition of new strucutre members in the future.
116
117See Also:
118NEXUS_Thread_Create
119**/
120void NEXUS_Thread_GetDefaultSettings(
121    NEXUS_ThreadSettings *pSettings    /* [out] Default Settings for OS */
122    );
123
124/**
125Summary:
126Create a thread.
127
128Description:
129
130See Also:
131NEXUS_Thread_Destroy
132NEXUS_Thread_GetDefaultSettings
133**/
134NEXUS_ThreadHandle NEXUS_Thread_Create(
135    const char *pThreadName,                 /* Thread Name, optional */
136    void (*pThreadFunc)(void *),             /* Thread Main Routine */
137    void *pContext,                          /* Context provided to callback */
138    const NEXUS_ThreadSettings *pSettings    /* Thread Settings */
139    );
140
141/**
142Summary:
143Destroy a thread after its function has exited.
144
145Description:
146This does not cancel the execution of the pThreadFunc. pThreadFunc must exit on its own, then
147NEXUS_Thread_Destroy can clean up the resources.
148
149See Also:
150NEXUS_Thread_Create
151**/
152void NEXUS_Thread_Destroy(
153    NEXUS_ThreadHandle thread /* Thread Handle, returned from NEXUS_Thread_Create() */
154    );
155
156/**
157Summary:
158Activate gathering of run-time software profile information.
159Profiling support shall be enabled at the compile time.
160**/
161NEXUS_Error NEXUS_Profile_Start(void);
162
163/**
164Summary:
165Finishes gathering of run-time software profile information and prints report.
166**/
167void NEXUS_Profile_Stop(
168    const char *name /* title of the profile report */
169    );
170
171/**
172Summary:
173Mark thread that could originate profiling samples
174**/
175void NEXUS_Profile_MarkThread(
176    const char *name /* thread name */
177    );
178
179/**
180Summary:
181Flush the data cache for an address range.
182
183Description:
184This function will flush and invalidate the address range provided
185from the data cache.  It is guaranteed that at least the address range
186provided will be flushed, however larger amounts may be flushed depending
187on the CPU and underlying OS primitives available.
188****************************************************************************/
189void NEXUS_FlushCache(
190    const void *address, /* cached address to flush */
191    size_t size /* size in bytes to flush */
192    );
193
194/**
195Summary:
196Returns the value for an environment variable.
197
198Description:
199The implementation of this function varies by OS.
200For Linux user mode, this will be environment variables set in the shell.
201For Linux kernel mode, it could be insmod parameters.
202
203Returns:
204A null-terminated string for the environment variable.
205NULL means that it does not exist.
206
207See Also:
208NEXUS_SetEnv
209*/
210const char *NEXUS_GetEnv(
211    const char *name
212    );
213
214/**
215Summary:
216Sets the value for an environment variable.
217
218Description:
219If value is NULL, the internal state for the given name will be cleared.
220
221See Also:
222NEXUS_GetEnv
223*/
224void NEXUS_SetEnv(
225    const char *name,
226    const char *value
227    );
228
229
230/**
231Summary:
232Convert a null-terminated ASCII string to an integer.
233
234Description:
235Nexus wrapper for C89,Posix.1 atoi(3) function
236*/
237int NEXUS_atoi(const char *str);
238
239/**
240Summary:
241Standard string functions
242**/
243int NEXUS_P_Base_StrCmp(const char *str1, const char *str2);
244int b_strlen(const char *s);
245char *b_strncpy(char *dest, const char *src, int n);
246
247/**
248Summary:
249Settings passed into NEXUS_Base_Init
250
251Description:
252NEXUS_Base_Settings must be defined in nexus_base_os.h because NEXUS_Base_GetDefaultSettings is OS-specific.
253**/
254typedef struct NEXUS_Base_Settings
255{
256    NEXUS_ThreadSettings threadSettings[NEXUS_ModulePriority_eMax];
257
258    /* callbacks for per-module driver registration */
259    NEXUS_Error (*driverModuleInit)(void *context, NEXUS_ModuleHandle module, const char *name, const NEXUS_ModuleSettings *pSettings);
260    void (*driverModuleUninit)(void *context, NEXUS_ModuleHandle module, const char *name, const NEXUS_ModuleSettings *pSettings);
261    void *procContext;
262} NEXUS_Base_Settings;
263
264/**
265Summary:
266Get default settings for the structure.
267
268Description:
269The implementation of NEXUS_Base_GetDefaultSettings is OS-specific so that threading can be customized.
270**/
271void NEXUS_Base_GetDefaultSettings(
272    NEXUS_Base_Settings *pSettings /* [out] Default Settings */
273    );
274
275/**
276Summary:
277Used for profiling
278**/
279const char *NEXUS_P_Base_Os_GetTaskNameFromStack(const unsigned long *stack);
280
281/**
282Summary:
283Used for profiling
284**/
285void NEXUS_P_Base_Os_MarkThread(const char *name);
286
287/**
288NEXUS_P_Base_Scheduler_Status is used by the internal and external scheduler interface.
289**/
290typedef struct NEXUS_P_Base_Scheduler_Status {
291    bool exit; /* scheduler has to exit */
292    bool idle; /* there is no activite in the scheduler */
293    unsigned timeout; /* timer's timeout (miliseconds) */
294} NEXUS_P_Base_Scheduler_Status;
295
296#ifdef __cplusplus
297}
298#endif
299
300#endif /* !defined NEXUS_BASE_OS_H */
301
302
Note: See TracBrowser for help on using the repository browser.