4 #include <linux/time.h>
7 #define CONFIG_LOG_STP_INTERNAL
9 #if 1//#ifndef CONFIG_LOG_STP_INTERNAL
11 #define STP_DMP_SZ 2048
12 #define STP_PKT_NO 2048
14 #define STP_DBG_LOG_ENTRY_NUM 2048
15 #define STP_DBG_LOG_ENTRY_SZ 2048
23 #define STP_DBG_LOG_ENTRY_NUM 28
24 #define STP_DBG_LOG_ENTRY_SZ 64
34 STP_DBG_FW_ASSERT = 3,
41 STP_DBG_PKT_FIL_ALL = 0,
42 STP_DBG_PKT_FIL_BT = 1,
43 STP_DBG_PKT_FIL_GPS = 2,
44 STP_DBG_PKT_FIL_FM = 3,
45 STP_DBG_PKT_FIL_WMT = 4,
49 static char * const gStpDbgType[]={
74 /*simple log system ++*/
77 int id; /*type: 0. pkt trace 1. fw info 2. assert info 3. trace32 dump . -1. linked to the the previous*/
79 char buffer[STP_DBG_LOG_ENTRY_SZ];
82 typedef struct log_sys {
83 MTKSTP_LOG_ENTRY_T queue[STP_DBG_LOG_ENTRY_NUM];
91 typedef struct stp_dbg_pkt_hdr{
95 unsigned int dbg_type;
109 typedef struct stp_dbg_pkt{
110 struct stp_dbg_pkt_hdr hdr;
111 unsigned char raw[STP_DMP_SZ];
114 typedef struct mtkstp_dbg_t{
119 MTKSTP_LOG_SYS_T *logsys;
122 extern void aed_combo_exception(const int *, int, const int *, int, const char *);
124 #define STP_CORE_DUMP_TIMEOUT 5*60*1000 // default 5minutes
125 #define STP_OJB_NAME_SZ 20
126 #define STP_CORE_DUMP_INFO_SZ 500
127 typedef enum wcn_compress_algorithm_t {
135 typedef INT32 (*COMPRESS_HANDLER)(void *worker, UINT8 *in_buf, INT32 in_sz, UINT8 *out_buf, INT32 *out_sz, INT32 finish);
136 typedef struct wcn_compressor_t {
137 // current object name
138 UINT8 name[STP_OJB_NAME_SZ + 1];
140 // buffer for raw data, named L1
145 // target buffer, named L2
156 // compress algorithm
158 WCN_COMPRESS_ALG_T compress_type;
160 COMPRESS_HANDLER handler;
161 }WCN_COMPRESSOR_T, *P_WCN_COMPRESSOR_T;
163 P_WCN_COMPRESSOR_T wcn_compressor_init(PUINT8 name, INT32 L1_buf_sz, INT32 L2_buf_sz);
164 INT32 wcn_compressor_deinit(P_WCN_COMPRESSOR_T compressor);
165 INT32 wcn_compressor_in(P_WCN_COMPRESSOR_T compressor, PUINT8 buf, INT32 len, INT32 finish);
166 INT32 wcn_compressor_out(P_WCN_COMPRESSOR_T compressor, PUINT8 *pbuf, PINT32 len);
167 INT32 wcn_compressor_reset(P_WCN_COMPRESSOR_T compressor, UINT8 enable, WCN_COMPRESS_ALG_T type);
169 typedef enum core_dump_state_t {
177 typedef struct core_dump_t {
178 // compress dump data and buffered
179 P_WCN_COMPRESSOR_T compressor;
181 // timer for monitor timeout
182 OSAL_TIMER dmp_timer;
185 OSAL_SLEEPABLE_LOCK dmp_lock;
187 // state machine for core dump flow
191 CHAR info[STP_CORE_DUMP_INFO_SZ + 1];
192 } WCN_CORE_DUMP_T, *P_WCN_CORE_DUMP_T;
194 P_WCN_CORE_DUMP_T wcn_core_dump_init(UINT32 timeout);
195 INT32 wcn_core_dump_deinit(P_WCN_CORE_DUMP_T dmp);
196 INT32 wcn_core_dump_in(P_WCN_CORE_DUMP_T dmp, PUINT8 buf, INT32 len);
197 INT32 wcn_core_dump_out(P_WCN_CORE_DUMP_T dmp, PUINT8 *pbuf, PINT32 len);
198 INT32 wcn_core_dump_reset(P_WCN_CORE_DUMP_T dmp, UINT32 timeout);
199 extern INT32 wcn_core_dump_flush(INT32 rst);
201 extern int stp_dbg_enable(MTKSTP_DBG_T *stp_dbg);
202 extern int stp_dbg_disable(MTKSTP_DBG_T *stp_dbg);
203 extern MTKSTP_DBG_T *stp_dbg_init(void *);
204 extern int stp_dbg_deinit(MTKSTP_DBG_T *stp_dbg);
205 extern int stp_dbg_dmp_out_ex (char *buf, int *len);
206 extern int stp_dbg_dmp_out(MTKSTP_DBG_T *stp_dbg, char *buf, int *len);
207 extern int stp_dbg_dmp_printk(MTKSTP_DBG_T *stp_dbg);
214 extern INT32 stp_dbg_aee_send(unsigned char *aucMsg, INT32 len, INT32 cmd);
218 MTKSTP_DBG_T *stp_dbg,
226 const unsigned char *body);
227 extern int stp_dbg_log_ctrl (unsigned int on);
228 #endif /* end of _STP_DEBUG_H_ */