1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * 4 * HDF is dual licensed: you can use it either under the terms of 5 * the GPL, or the BSD license, at your option. 6 * See the LICENSE file in the root of this repository for complete details. 7 */ 8 9 #include <string.h> 10 #include "hdf_log.h" 11 #include "osal_mem.h" 12 #include "uart_if.h" 13 14 #define HDF_LOG_TAG hello_uart_dispatch 15 #define UART_PORT 5 16 main()17int main() 18 { 19 const char *info = " HELLO UART! "; 20 21 struct DevHandle *handle = UartOpen(UART_PORT); 22 if (handle == NULL) { 23 HDF_LOGE("Failed to open uart %d", UART_PORT); 24 return HDF_FAILURE; 25 } 26 27 int ret = UartWrite(handle, (uint8_t *)info, strlen(info)); 28 if (ret != HDF_SUCCESS) { 29 HDF_LOGE("Failed to send data to uart"); 30 } 31 32 UartClose(handle); 33 return ret; 34 }