Merge branch 'fixes' of git://git.linaro.org/people/rmk/linux-arm
[cascardo/linux.git] / drivers / staging / csr / csr_log_configure.h
1 #ifndef CSR_LOG_CONFIGURE_H__
2 #define CSR_LOG_CONFIGURE_H__
3 /*****************************************************************************
4
5             (c) Cambridge Silicon Radio Limited 2010
6             All rights reserved and confidential information of CSR
7
8             Refer to LICENSE.txt included with this source for details
9             on the license terms.
10
11 *****************************************************************************/
12
13 #include "csr_log.h"
14
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18
19 /*---------------------------------*/
20 /* Log init/deinit                 */
21 /*---------------------------------*/
22 void CsrLogInit(u8 size);
23 void CsrLogDeinit(void);
24
25 /*---------------------------------*/
26 /* Log Framework Tech info         */
27 /*---------------------------------*/
28 void CsrLogTechInfoRegister(void);
29
30 /* Set the logging level for the environment outside the scheduler context */
31 void CsrLogLevelEnvironmentSet(CsrLogLevelEnvironment environmentLogLevel);
32
33
34 /* Set the logging level for all scheduler tasks */
35 /* This function call takes precedence over all previous calls to CsrLogLevelTaskSetSpecific() */
36 void CsrLogLevelTaskSetAll(CsrLogLevelTask tasksLogLevelMask);
37
38 /* Set the logging level for a given Task */
39 /* This function can be used as a complement to CsrLogLevelTaskSetAll() to add more _or_ less log from a given task than what is set
40 generally with CsrLogLevelTaskSetAll(). */
41 void CsrLogLevelTaskSetSpecific(CsrSchedQid taskId, CsrLogLevelTask taskLogLevelMask);
42
43
44 /*--------------------------------------------*/
45 /*  Filtering on log text warning levels      */
46 /*--------------------------------------------*/
47 typedef u32 CsrLogLevelText;
48 #define CSR_LOG_LEVEL_TEXT_OFF       ((CsrLogLevelText) 0x0000)
49
50 #define CSR_LOG_LEVEL_TEXT_CRITICAL  ((CsrLogLevelText) 0x0001)
51 #define CSR_LOG_LEVEL_TEXT_ERROR     ((CsrLogLevelText) 0x0002)
52 #define CSR_LOG_LEVEL_TEXT_WARNING   ((CsrLogLevelText) 0x0004)
53 #define CSR_LOG_LEVEL_TEXT_INFO      ((CsrLogLevelText) 0x0008)
54 #define CSR_LOG_LEVEL_TEXT_DEBUG     ((CsrLogLevelText) 0x0010)
55
56 #define CSR_LOG_LEVEL_TEXT_ALL       ((CsrLogLevelText) 0xFFFF)
57
58 /* The log text interface is used by both scheduler tasks and components outside the scheduler context.
59  * Therefore a CsrLogTextTaskId is introduced. It is effectively considered as two u16's. The lower
60  * 16 bits corresponds one2one with the scheduler queueId's (CsrSchedQid) and as such these bits can not be used
61  * by components outside scheduler tasks. The upper 16 bits are allocated for use of components outside the
62  * scheduler like drivers etc. Components in this range is defined independently by each technology. To avoid
63  * clashes the technologies are only allowed to assign values within the same restrictive range as allies to
64  * primitive identifiers. eg. for the framework components outside the scheduler is only allowed to assign
65  * taskId's in the range 0x0600xxxx to 0x06FFxxxx. And so on for other technologies. */
66 typedef u32 CsrLogTextTaskId;
67
68 /* Set the text logging level for all Tasks */
69 /* This function call takes precedence over all previous calls to CsrLogLevelTextSetTask() and CsrLogLevelTextSetTaskSubOrigin() */
70 void CsrLogLevelTextSetAll(CsrLogLevelText warningLevelMask);
71
72 /* Set the text logging level for a given Task */
73 /* This function call takes precedence over all previous calls to CsrLogLevelTextSetTaskSubOrigin(), but it can be used as a complement to
74  * CsrLogLevelTextSetAll() to add more _or_ less log from a given task than what is set generally with CsrLogLevelTextSetAll(). */
75 void CsrLogLevelTextSetTask(CsrLogTextTaskId taskId, CsrLogLevelText warningLevelMask);
76
77 /* Set the text logging level for a given tasks subOrigin */
78 /* This function can be used as a complement to CsrLogLevelTextSetAll() and CsrLogLevelTextSetTask() to add more _or_ less log from a given
79  * subOrigin within a task than what is set generally with CsrLogLevelTextSetAll() _or_ CsrLogLevelTextSetTask(). */
80 void CsrLogLevelTextSetTaskSubOrigin(CsrLogTextTaskId taskId, u16 subOrigin, CsrLogLevelText warningLevelMask);
81
82 /*******************************************************************************
83
84     NAME
85         CsrLogLevelTextSet
86
87     DESCRIPTION
88         Set the text logging level for a given origin and optionally sub origin
89         by name. If either string is NULL or zero length, it is interpreted as
90         all origins and/or all sub origins respectively. If originName is NULL
91         or zero length, subOriginName is ignored.
92
93         Passing NULL or zero length strings in both originName and subOriginName
94         is equivalent to calling CsrLogLevelTextSetAll, and overrides all
95         previous filter configurations for all origins and sub origins.
96
97         Passing NULL or a zero length string in subOriginName overrides all
98         previous filter configurations for all sub origins of the specified
99         origin.
100
101         Note: the supplied strings may be accessed after the function returns
102         and must remain valid and constant until CsrLogDeinit is called.
103
104         Note: when specifying an origin (originName is not NULL and not zero
105         length), this function can only be used for origins that use the
106         csr_log_text_2.h interface for registration and logging. Filtering for
107         origins that use the legacy csr_log_text.h interface must be be
108         configured using the legacy filter configuration functions that accept
109         a CsrLogTextTaskId as origin specifier. However, when not specifying an
110         origin this function also affects origins that have been registered with
111         the legacy csr_log_text.h interface. Furthermore, using this function
112         and the legacy filter configuration functions on the same origin is not
113         allowed.
114
115     PARAMETERS
116         originName - a string containing the name of the origin. Can be NULL or
117             zero length to set the log level for all origins. In this case, the
118             subOriginName parameter will be ignored.
119         subOriginName - a string containing the name of the sub origin. Can be
120             NULL or zero length to set the log level for all sub origins of the
121             specified origin.
122         warningLevelMask - The desired log level for the specified origin(s) and
123             sub origin(s).
124
125 *******************************************************************************/
126 void CsrLogLevelTextSet(const char *originName,
127     const char *subOriginName,
128     CsrLogLevelText warningLevelMask);
129
130 #ifdef __cplusplus
131 }
132 #endif
133
134 #endif