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_PHY_TRACE_
21 #define H_BLE_PHY_TRACE_
22
23 #include "os/os_trace_api.h"
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 #define BLE_PHY_TRACE_ID_START_TX 0
30 #define BLE_PHY_TRACE_ID_START_RX 1
31 #define BLE_PHY_TRACE_ID_DISABLE 2
32
33 #if MYNEWT_VAL(BLE_PHY_SYSVIEW)
34
35 extern uint32_t ble_phy_trace_off;
36
37 void ble_phy_trace_init(void);
38
39 static inline void
ble_phy_trace_void(unsigned id)40 ble_phy_trace_void(unsigned id)
41 {
42 os_trace_api_void(ble_phy_trace_off + id);
43 }
44
45 static inline void
ble_phy_trace_u32(unsigned id,uint32_t p1)46 ble_phy_trace_u32(unsigned id, uint32_t p1)
47 {
48 os_trace_api_u32(ble_phy_trace_off + id, p1);
49 }
50
51 static inline void
ble_phy_trace_u32x2(unsigned id,uint32_t p1,uint32_t p2)52 ble_phy_trace_u32x2(unsigned id, uint32_t p1, uint32_t p2)
53 {
54 os_trace_api_u32x2(ble_phy_trace_off + id, p1, p2);
55 }
56
57 static inline void
ble_phy_trace_u32x3(unsigned id,uint32_t p1,uint32_t p2,uint32_t p3)58 ble_phy_trace_u32x3(unsigned id, uint32_t p1, uint32_t p2, uint32_t p3)
59 {
60 os_trace_api_u32x3(ble_phy_trace_off + id, p1, p2, p3);
61 }
62
63 #else
64
65 static inline void
66 ble_phy_trace_init(void)
67 {
68 }
69
70 static inline void
71 ble_phy_trace_void(unsigned id)
72 {
73 }
74
75 static inline void
76 ble_phy_trace_u32(unsigned id, uint32_t p1)
77 {
78 }
79
80 static inline void
81 ble_phy_trace_u32x2(unsigned id, uint32_t p1, uint32_t p2)
82 {
83 }
84
85 static inline void
86 ble_phy_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_PHY_TRACE_ */
97