• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  * Copyright (c) 2022 Telink Semiconductor (Shanghai) Co., Ltd. ("TELINK")
3  * All rights reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *****************************************************************************/
18 #include "common_dbg.h"
19 #include "tl_common.h"
20 
21 #if (APP_DUMP_EN)
22 
23 MYFIFO_INIT_IRAM(print_fifo, 288, 32);
24 
app_dmup_debug_init(void)25 void app_dmup_debug_init(void)
26 {
27     my_usb_init(0x120, &print_fifo);
28     usb_set_pin_en();
29 }
30 
31 #endif
32 
33 #if (UART_LOW_POWER_DEBUG_EN)
34 
35 #define UART0_DMA_CHANNEL_TX DMA4
36 #define UART0_BAUDRATE       1000000  // 115200
37 
38 int lp_uart_init = 0;  // attention: can not be retention data !!!
low_power_uart_debug_init(void)39 void low_power_uart_debug_init(void)
40 {
41 #if (UART_LOW_POWER_DEBUG_EN)
42     uart0_init(UART0_BAUDRATE);
43     uart_set_tx_dma_config(UART0, UART0_DMA_CHANNEL_TX);
44     uart_clr_tx_done(UART0);
45     dma_clr_irq_mask(UART0_DMA_CHANNEL_TX, TC_MASK | ABT_MASK | ERR_MASK);
46 
47     lp_uart_init = 1;
48 #endif
49 }
50 
51 #endif
52