blob: aaa3e8100d0e12b416dbfc1a6261bf33cc4cdf4e [file] [log] [blame]
Shad Ansari2f7f9be2017-06-07 13:34:53 -07001/*
2<:copyright-BRCM:2016:DUAL/GPL:standard
3
4 Broadcom Proprietary and Confidential.(c) 2016 Broadcom
5 All Rights Reserved
6
7Unless you and Broadcom execute a separate written software license
8agreement governing use of this software, this software is licensed
9to you under the terms of the GNU General Public License version 2
10(the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php,
11with the following added to such license:
12
13 As a special exception, the copyright holders of this software give
14 you permission to link this software with independent modules, and
15 to copy and distribute the resulting executable under terms of your
16 choice, provided that you also meet, for each linked independent
17 module, the terms and conditions of the license of that module.
18 An independent module is a module which is not derived from this
19 software. The special exception does not apply to any modifications
20 of the software.
21
22Not withstanding the above, under no circumstances may you combine
23this software in any way with any other Broadcom software provided
24under a license other than the GPL, without Broadcom's express prior
25written consent.
26
27:>
28 */
29
30#ifndef __BCM_DEV_LOG_TASK_INTERNAL_H_
31#define __BCM_DEV_LOG_TASK_INTERNAL_H_
32
33#ifdef ENABLE_LOG
34
35#include <bcmos_system.h>
36
37#define LOG_NAME_NO_INSTANCE 0xff
38#define LOG_NAME_LENGTH 100
39
40typedef enum
41{
42 BCM_DEV_LOG_STATE_UNINITIALIZED,
43 BCM_DEV_LOG_STATE_DISABLED,
44 BCM_DEV_LOG_STATE_ENABLED,
45} bcm_dev_log_state;
46
47typedef struct
48{
49 bcm_dev_log_parm dev_log_parm;
50 bcm_dev_log_file files[DEV_LOG_MAX_FILES]; /* log files */
51 uint32_t msg_count; /* Message counter */
52 dev_log_id_parm ids[DEV_LOG_MAX_IDS]; /* dev_log IDS array */
53 uint32_t num_ids; /* Number of actually registered ids */
54 bcm_dev_log_state state;
55 bcmos_msg_queue save_queue; /* Log messages to be saved to RAM (first stage of pipeline) */
56 bcmos_msg_queue print_queue; /* Log messages to be printed (second stage of pipeline) */
57 bcmos_task save_task;
58 bcmos_task print_task;
59 bcmos_sem save_task_is_terminated;
60 bcmos_sem print_task_is_terminated;
61 bcmos_msg_pool pool;
62 bcm_dev_log_flags flags; /* General flags applied on the entire feature (unlike file flags which reside in 'files' sub-structure). */
63} bcm_dev_log;
64
65typedef struct
66{
67 dev_log_id_parm *log_id;
68 uint32_t time_stamp;
69 bcm_dev_log_level msg_level;
70 uint32_t flags;
71 union
72 {
73 struct
74 {
75 const char *fmt;
76 /* Room for MAX + 1 arguments since the argument list needs to start on an 8-byte boundary - the first
77 * entry may be unused if the array doesn't naturally start on an 8-byte boundary. */
78 const void *args[DEV_LOG_MAX_ARGS + 1];
79 } fmt_args; /* Relevant in default mode - when not using BCM_LOG_FLAG_CALLER_FMT */
80 char str[MAX_DEV_LOG_STRING_SIZE]; /* Relevant only if using BCM_LOG_FLAG_CALLER_FMT */
81 } u;
82} dev_log_queue_msg;
83
84typedef struct
85{
86 char name[LOG_NAME_LENGTH];
87 uint8_t first_instance;
88 uint8_t last_instance;
89}log_name_table;
90
91extern bcm_dev_log dev_log;
92extern const char *log_level_str;
93
94extern log_name_table logs_names[DEV_LOG_MAX_IDS];
95extern uint8_t log_name_table_index;
96
97bcmos_errno _bcm_dev_log_file_clear_no_lock(uint32_t file_index);
98
99#endif /* ENABLE_LOG */
100
101#endif /* __BCM_DEV_LOG_TASK_INTERNAL_H_ */