ISSDK  1.8
IoT Sensing Software Development Kit
comm_if_uart.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016, Freescale Semiconductor, Inc.
3  * Copyright 2016-2017 NXP
4  * All rights reserved.
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  */
8 /**
9 * @file comm_if_uart.c
10 * @brief The comm_if_uart.c file implements comm interface for the UART.
11 */
12 #include <stddef.h>
13 #include <stdint.h>
14 #include <stdbool.h>
15 #include "Driver_USART.h"
16 #include "comm_interface.h"
17 /*******************************************************************************
18  * Variables
19  ******************************************************************************/
20 /*******************************************************************************
21 * Prototypes
22 ******************************************************************************/
23 
24 /*******************************************************************************
25  * Code
26  ******************************************************************************/
27 
29 {
30  // @todo the implementation.
31  return COMM_INTERFACE_OK;
32 }
33 
34 int32_t COMM_UART_Init(comm_handle_t *pHandle, void *pCommInstance, COMM_Event_t event, void *pInitializeData)
35 {
36  // @todo handle the pointers and validation properly.
37  pHandle->pComm = pCommInstance;
38  //@todo use the rest of argument properly.
39  // SDK CMSIS driver adoption; init call will be done by the user application.
40  //((ARM_DRIVER_USART *)(pHandle->pComm))->Initialize(event);
41  return COMM_INTERFACE_OK;
42 }
43 int32_t COMM_UART_Config(comm_handle_t *pHandle, void *pConfigData)
44 {
45  // @todo the implementation.
46  comm_control_t *pControl = (comm_control_t *)pConfigData;
47  return ((ARM_DRIVER_USART *)(pHandle->pComm))->Control(pControl->control, pControl->arg);
48 }
49 int32_t COMM_UART_Send(comm_handle_t *pHandle, void *pData, uint32_t size)
50 {
51  //@todo the validation of the pointer
52  return ((ARM_DRIVER_USART *)(pHandle->pComm))->Send(pData, size);
53 }
54 int32_t COMM_UART_Receive(comm_handle_t *pHandle, void *pData, uint32_t size)
55 {
56  //@todo the validation of the pointer
57  return ((ARM_DRIVER_USART *)(pHandle->pComm))->Receive(pData, size);
58 }
60 {
61  //@todo the validation of the pointer
62  return pHandle->status;
63 }
64 // End USART Interface
65 
68 };
uint32_t size
int32_t COMM_UART_Receive(comm_handle_t *pHandle, void *pData, uint32_t size)
Definition: comm_if_uart.c:54
void(* COMM_Event_t)(uint32_t event)
uint32_t status
typedef int32_t(DATA_FORMAT_Append_t))(void *pData
The interface function to append the data on the formated stream.
The comm_interface.h file describes the interface definition for the communication interface...
int32_t COMM_UART_Config(comm_handle_t *pHandle, void *pConfigData)
Definition: comm_if_uart.c:43
uint32_t control
int32_t COMM_UART_GetCapabilities(comm_handle_t *pHandle)
Definition: comm_if_uart.c:28
int32_t COMM_UART_Send(comm_handle_t *pHandle, void *pData, uint32_t size)
Definition: comm_if_uart.c:49
comm_interface_t commUART
Definition: comm_if_uart.c:66
int32_t COMM_UART_Init(comm_handle_t *pHandle, void *pCommInstance, COMM_Event_t event, void *pInitializeData)
Definition: comm_if_uart.c:34
#define COMM_INTERFACE_OK
Operation succeeded.
int32_t COMM_UART_GetStatus(comm_handle_t *pHandle)
Definition: comm_if_uart.c:59