1 /**
2   ******************************************************************************
3   * @file    virt_uart.h
4   * @author  MCD Application Team
5   * @brief   Header file of UART VIRT module.
6   ******************************************************************************
7   * @attention
8   *
9   * <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
10   * All rights reserved.</center></h2>
11   *
12   * This software component is licensed by ST under BSD 3-Clause license,
13   * the "License"; You may not use this file except in compliance with the
14   * License. You may obtain a copy of the License at:
15   *                        opensource.org/licenses/BSD-3-Clause
16   *
17   ******************************************************************************
18   */
19 
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef __VIRT_UART_H
22 #define __VIRT_UART_H
23 
24 
25 #ifdef __cplusplus
26  extern "C" {
27 #endif
28 
29 /* Includes ------------------------------------------------------------------*/
30 #include "openamp.h"
31 
32 /* Exported structures --------------------------------------------------------*/
33 typedef struct __VIRT_UART_HandleTypeDef
34 {
35   struct rpmsg_endpoint ept;          /*!< rpmsg endpoint                             */
36   struct rpmsg_virtio_device *rvdev;  /*< pointer to the rpmsg virtio device          */
37   uint8_t              *pRxBuffPtr;   /*!< Pointer to VIRTUAL UART Rx transfer Buffer */
38   uint16_t              RxXferSize;   /*!< VIRTUAL UART Rx Transfer size              */
39   void    (* RxCpltCallback)( struct __VIRT_UART_HandleTypeDef * hppp);    /*!< RX CPLT callback    */
40 }VIRT_UART_HandleTypeDef;
41 
42 
43 typedef enum
44 {
45   VIRT_UART_OK       = 0x00U,
46   VIRT_UART_ERROR    = 0x01U,
47   VIRT_UART_BUSY     = 0x02U,
48   VIRT_UART_TIMEOUT  = 0x03U
49 } VIRT_UART_StatusTypeDef;
50 
51 
52 typedef enum
53 {
54   VIRT_UART_RXCPLT_CB_ID          = 0x00U,    /*!< PPP event 1 callback ID     */
55 }VIRT_UART_CallbackIDTypeDef;
56 
57 
58 /* Exported functions --------------------------------------------------------*/
59 /* Initialization and de-initialization functions  ****************************/
60 VIRT_UART_StatusTypeDef VIRT_UART_Init(VIRT_UART_HandleTypeDef *huart);
61 VIRT_UART_StatusTypeDef VIRT_UART_DeInit (VIRT_UART_HandleTypeDef *huart);
62 VIRT_UART_StatusTypeDef VIRT_UART_RegisterCallback(VIRT_UART_HandleTypeDef *huart,
63                                                    VIRT_UART_CallbackIDTypeDef CallbackID,
64                                                    void (* pCallback)(VIRT_UART_HandleTypeDef *_huart));
65 
66 /* IO operation functions *****************************************************/
67 VIRT_UART_StatusTypeDef VIRT_UART_Transmit(VIRT_UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size);
68 
69 
70 #ifdef __cplusplus
71 }
72 #endif
73 
74 #endif /* __VIRT_UART_H */
75 
76 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
77