1 /*******************************************************************************
2 * \file cybt_platform_trace.c
3 *
4 * \brief
5 * Provides platform logging functionality.
6 *
7 ********************************************************************************
8 * \copyright
9 * Copyright 2018-2019 Cypress Semiconductor Corporation
10 * SPDX-License-Identifier: Apache-2.0
11 *
12 * Licensed under the Apache License, Version 2.0 (the "License");
13 * you may not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
15 *
16 * http://www.apache.org/licenses/LICENSE-2.0
17 *
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
23 *******************************************************************************/
24
25 #include <stdint.h>
26 #include <stdio.h>
27
28 #include "cybt_platform_trace.h"
29
30 #if(CYBT_PLATFORM_TRACE_ENABLE == 1)
31
32 /******************************************************************************
33 * Variables Definitions
34 ******************************************************************************/
35 cybt_platform_trace_cb_t trace_cb =
36 {
37 .trace_level =
38 {
39 INITIAL_TRACE_LEVEL_MAIN,
40 INITIAL_TRACE_LEVEL_SPIF,
41 INITIAL_TRACE_LEVEL_HCITX_TASK,
42 INITIAL_TRACE_LEVEL_HCIRX_TASK,
43 INITIAL_TRACE_LEVEL_HCI_DRV,
44 INITIAL_TRACE_LEVEL_HCI_LOG,
45 INITIAL_TRACE_LEVEL_MEMORY,
46 INITIAL_TRACE_LEVEL_PRM,
47 INITIAL_TRACE_LEVEL_STACK,
48 INITIAL_TRACE_LEVEL_APP,
49 INITIAL_TRACE_LEVEL_BT_TASK
50 }
51 };
52
53
54 /******************************************************************************
55 * Function Definitions
56 ******************************************************************************/
57
58 /********************************************************************************
59 **
60 ** Function Name: bt_platform_set_trace_level
61 **
62 ** Purpose: Set trace level
63 **
64 ** Input Parameters: id: trace id
65 ** level: trace level
66 ** Returns:
67 ** Nothing
68 **
69 *********************************************************************************/
70 #endif
cybt_platform_set_trace_level(cybt_trace_id_t id,cybt_trace_level_t level)71 void cybt_platform_set_trace_level(cybt_trace_id_t id,
72 cybt_trace_level_t level
73 )
74 {
75 #if(CYBT_PLATFORM_TRACE_ENABLE == 1)
76 if(CYBT_TRACE_ID_MAX < level)
77 {
78 return;
79 }
80
81 if(CYBT_TRACE_ID_MAX > id)
82 {
83 trace_cb.trace_level[id] = level;
84 }
85 else if(CYBT_TRACE_ID_ALL == id)
86 {
87 uint8_t idx;
88
89 for(idx = 0; idx < CYBT_TRACE_ID_MAX; idx++)
90 {
91 trace_cb.trace_level[idx] = level;
92 }
93 }
94 #else
95 UNUSED_VARIABLE(id);
96 UNUSED_VARIABLE(level);
97 #endif
98 }
99
100