• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Talkweb Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *    http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef _BSP_UART_H
17 #define _BSP_UART_H
18 
19 #include "los_event.h"
20 #include "los_compiler.h"
21 #include <stdio.h>
22 
23 #define CN_RCV_RING_BUFLEN  128
24 typedef struct {
25     int size;
26     int posW;
27     int posR;
28     int dataLen;
29     unsigned char *buf;
30 } RingBuffer;
31 
32 int RingBufRead(RingBuffer *buf, unsigned char *data);
33 int RingBufWrite(RingBuffer *buf, unsigned char data);
34 int RingBufWriteMore(RingBuffer *buf, unsigned char* data, uint32_t size);
35 RingBuffer* RingBufInit(int size);
36 
37 extern UART_HandleTypeDef huart1;
38 extern EVENT_CB_S g_shellInputEvent;
39 
40 extern VOID ShellUartInit(VOID);
41 extern INT32 UartPutc(INT32 c, VOID *file);
42 extern uint8_t UartGetc(VOID);
43 
44 #endif
45