2 * Copyright (C) 2017 C-SKY Microsystems Co., Ltd. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 #include "drv_usart.h"
21 #include "ck_sys_freq.h"
23 #define CONSOLE_TXD PA10_ADC2_TXD0
24 #define CONSOLE_RXD PA11_ACMP0N_ADC3_RXD0
25 static usart_handle_t console_handle = NULL;
26 extern int32_t csi_usart_putchar(usart_handle_t handle, uint8_t ch);
31 csi_usart_putchar(console_handle, '\r');
34 csi_usart_putchar(console_handle, ch);
39 int fputc(int ch, FILE *fp)
42 csi_usart_putchar(console_handle, '\r');
45 csi_usart_putchar(console_handle, ch);
51 void usart_event_cb(usart_event_e event, void *cb_arg)
60 console_handle = csi_usart_initialize(CONSOLE_TXD, CONSOLE_RXD, usart_event_cb, 0);
62 if (!console_handle) {
66 ret = csi_usart_config(console_handle,
69 USART_MODE_ASYNCHRONOUS,
79 void console_init_ree(uint32_t sysclk)
84 console_handle = csi_usart_initialize(CONSOLE_TXD, CONSOLE_RXD, usart_event_cb, 0);
86 if (!console_handle) {
90 ret = csi_usart_config(console_handle,
93 USART_MODE_ASYNCHRONOUS,