xref: /nrf52832-nimble/packages/NimBLE-latest/nimble/controller/include/controller/ble_ll_trace.h (revision 042d53a763ad75cb1465103098bb88c245d95138)
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements.  See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership.  The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License.  You may obtain a copy of the License at
9  *
10  *  http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied.  See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 
20 #ifndef H_BLE_LL_TRACE_
21 #define H_BLE_LL_TRACE_
22 
23 #include "os/os_trace_api.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #define BLE_LL_TRACE_ID_SCHED                   0
30 #define BLE_LL_TRACE_ID_RX_START                1
31 #define BLE_LL_TRACE_ID_RX_END                  2
32 #define BLE_LL_TRACE_ID_WFR_EXP                 3
33 #define BLE_LL_TRACE_ID_CTRL_RX                 4
34 #define BLE_LL_TRACE_ID_CONN_EV_START           5
35 #define BLE_LL_TRACE_ID_CONN_EV_END             6
36 #define BLE_LL_TRACE_ID_CONN_END                7
37 #define BLE_LL_TRACE_ID_CONN_TX                 8
38 #define BLE_LL_TRACE_ID_CONN_RX                 9
39 #define BLE_LL_TRACE_ID_ADV_TXDONE              10
40 #define BLE_LL_TRACE_ID_ADV_HALT                11
41 #define BLE_LL_TRACE_ID_AUX_REF                 12
42 #define BLE_LL_TRACE_ID_AUX_UNREF               13
43 
44 #if MYNEWT_VAL(BLE_LL_SYSVIEW)
45 
46 extern uint32_t ble_ll_trace_off;
47 
48 void ble_ll_trace_init(void);
49 
50 static inline void
ble_ll_trace_u32(unsigned id,uint32_t p1)51 ble_ll_trace_u32(unsigned id, uint32_t p1)
52 {
53     os_trace_api_u32(ble_ll_trace_off + id, p1);
54 }
55 
56 static inline void
ble_ll_trace_u32x2(unsigned id,uint32_t p1,uint32_t p2)57 ble_ll_trace_u32x2(unsigned id, uint32_t p1, uint32_t p2)
58 {
59     os_trace_api_u32x2(ble_ll_trace_off + id, p1, p2);
60 }
61 
62 static inline void
ble_ll_trace_u32x3(unsigned id,uint32_t p1,uint32_t p2,uint32_t p3)63 ble_ll_trace_u32x3(unsigned id, uint32_t p1, uint32_t p2, uint32_t p3)
64 {
65     os_trace_api_u32x3(ble_ll_trace_off + id, p1, p2, p3);
66 }
67 
68 #else
69 
70 static inline void
71 ble_ll_trace_init(void)
72 {
73 }
74 
75 static inline void
76 ble_ll_trace_u32(unsigned id, uint32_t p1)
77 {
78 }
79 
80 static inline void
81 ble_ll_trace_u32x2(unsigned id, uint32_t p1, uint32_t p2)
82 {
83 }
84 
85 static inline void
86 ble_ll_trace_u32x3(unsigned id, uint32_t p1, uint32_t p2, uint32_t p3)
87 {
88 }
89 
90 #endif
91 
92 #ifdef __cplusplus
93 }
94 #endif
95 
96 #endif /* H_BLE_LL_TRACE_ */
97