当前位置: 首页 > news >正文

手机网站开发框架白城学做网站

手机网站开发框架,白城学做网站,阜宁做网站工作室,找一个免费的网站模块介绍 LPUART 驱动主要实现设备驱动的底层细节#xff0c;并为上层提供一套标准的 API 接口以供使用。 模块配置 配置路径如下: Kernel Setup ---Drivers Setup ---SoC HAL Drivers ---LPUART Devices ---[*] enable lpuart driver源码结构 LPUART 模…模块介绍 LPUART 驱动主要实现设备驱动的底层细节并为上层提供一套标准的 API 接口以供使用。 模块配置 配置路径如下: Kernel Setup ---Drivers Setup ---SoC HAL Drivers ---LPUART Devices ---[*] enable lpuart driver源码结构 LPUART 模块源码结构如下所示 hal/source/lpuart/ ---- 驱动源码 ├── hal_lpuart.c ├── Kconfig ├── Makefile ├── platform │ ├── lpuart-sun20iw2p1.h ---- 平台地址引脚复用等配置 │ └── ... ├── platform-lpuart.h └── lpuart.h include/hal/ ---- 驱动APIs声明头文件 └── hal_lpuart.h模块接口说明 需要包含头文件 #include hal_lpuart.h初始化 LPUART 驱动 函数原型 int32_t hal_lpuart_init(int32_t lpuart_port)参数 lpuart_portLPUART 端口号 返回值 SUNXI_HAL_OK: 成功HAL_LPUART_STATUS_ERROR: 失败 卸载 LPUART 驱动 函数原型 int32_t hal_lpuart_deinit(int32_t lpuart_port)参数 lpuart_portLPUART 端口号 返回值 SUNXI_HAL_OK: 成功 设置波特率及参数 函数原型 int32_t hal_lpuart_control(lpuart_port_t lpuart_port, int cmd, void *args)参数 lpuart_port_tLPUART 端口号cmd预留暂未使用args指向 _lpuart_config_t 类型变量的数组 返回值 SUNXI_HAL_OK: 成功HAL_LPUART_STATUS_ERROR: 失败 接收处理 函数原型 int32_t hal_lpuart_receive(int32_t dev, uint8_t *data, uint32_t num)参数 devLPUART 端口号data: 接收数据缓冲区num: 接收数据长度 返回值 size: 成功接收的字节数 接收对比处理 函数原型 int32_t hal_lpuart_rx_cmp(lpuart_port_t lpuart_port, uint8_t cmp_len, uint8_t *cmp_data);参数 lpuart_portLPUART 端口号cmp_len比较数据的长度cmp_data比较的数据 返回值 SUNXI_HAL_OK: 成功HAL_LPUART_STATUS_ERROR: 失败 启用接收对比处理回调 函数原型 int32_t hal_lpuart_enable_rx_cmp(lpuart_port_t lpuart_port, lpuart_callback_t cb, void *arg);参数 lpuart_portLPUART 端口号cb处理回调函数arg回调函数的参数 返回值 SUNXI_HAL_OK: 成功HAL_LPUART_STATUS_ERROR: 失败 禁用接收对比处理回调 函数原型 int32_t hal_lpuart_disable_rx_cmp(lpuart_port_t lpuart_port);参数 lpuart_portLPUART 端口号 返回值 SUNXI_HAL_OK: 成功HAL_LPUART_STATUS_ERROR: 失败 配置PM绕过模式 函数原型 int32_t HAL_LPUART_SetBypassPmMode(lpuart_port_t lpuart_port, uint8_t mode);参数 lpuart_portLPUART 端口号mode配置模式 返回值 SUNXI_HAL_OK: 成功HAL_LPUART_STATUS_ERROR: 失败 模块使用范例 #include stdio.h #include stdlib.h #include stdint.h #include string.h #include hal_log.h #include hal_cmd.h #include hal_timer.h #include hal_lpuart.h #include hal_uart.h/* find a free uart_port or pc com as source */ #define UART_TEST UART_1 #define TEST_LEN 5static void cmd_usage(void) {printf(Usage:\n\t hal_lpuart port baudrate\n); }void test_recv_data(lpuart_port_t port) {printf(enter recv data test\n);hal_lpuart_enable_rx_data(port, NULL, NULL);/* use uart as source */hal_uart_init(UART_TEST);hal_uart_send(UART_TEST, a, 1);/* use pc com as source */printf(enter\n);hal_sleep(5);hal_lpuart_disable_rx_data(port); }static void compare_callback(void *arg) {printf(data compare success!\n); }void test_cmp_data(lpuart_port_t port) {printf(enter cmp data test\n);char cmp[TEST_LEN 1] abcde;if (hal_lpuart_init(port)) {printf(lpuart %d not inited\n, port);return;}hal_lpuart_rx_cmp(port, TEST_LEN, cmp);hal_lpuart_enable_rx_cmp(port, compare_callback, NULL);/* use uart as source, stop bit of uart should be 2 */hal_uart_init(UART_TEST);hal_uart_send(UART_TEST, cmp, TEST_LEN);/* use pc com as source */printf(enter abcde\n);hal_sleep(5);hal_lpuart_disable_rx_cmp(port); }void lpuart_reset_multiplex() {lpuart_multiplex(LPUART_0, UART_0);lpuart_multiplex(LPUART_1, UART_1); }int cmd_test_lpuart(int argc, char **argv) {if (argc ! 3) {cmd_usage();return -1;}lpuart_port_t port;uint32_t baudrate;port strtol(argv[1], NULL, 0);baudrate strtol(argv[2], NULL, 0);if (hal_lpuart_init(port) ! SUNXI_HAL_OK) {printf(Fail to init lpuart\n);return -1;}if (port 0) {lpuart_multiplex(LPUART_0, UART_TEST);} else if (port 1) {lpuart_multiplex(LPUART_1, UART_TEST);}test_recv_data(port);test_cmp_data(port);lpuart_reset_multiplex();return 0; }FINSH_FUNCTION_EXPORT_CMD(cmd_test_lpuart, hal_lpuart, lpuart hal APIs tests)
http://www.pierceye.com/news/793059/

相关文章:

  • 网站专题教程最吸引人的营销广告词
  • 瑞安网站网站建设如何推广自己的店铺
  • 建设网站花都水泥公司网站建设
  • asp网站怎么下载源码农业做的好的网站
  • 导购网站怎么做视频教学网页设计与制作教程第5版
  • 建设部施工安全管理网站网站建设公司如何
  • 企业商城建站公司网站页面加密
  • 昆山教育云平台网站建设软件工程师考试报名
  • ps做网站大小尺寸大连开发区商场
  • 化妆品网站建设网站右键禁止
  • wordpress 没有样式表网站如何免费做SEO优化
  • 青岛有没有专门做淘宝网站中国建设人才网站
  • 网站移动端是什么问题吗怎样自己做免费的网站
  • 做网站没有做退钱宁波品牌策划公司
  • 网站备案 不关站家乡网页制作模板
  • 成都网站建设企业 排名网络营销推广方案ppt
  • 阳西住房和城乡规划建设局网站微信公众号商城制作
  • 石家庄自助建站软件邯郸做紧固件网站
  • 做川菜的网站动画制作网页
  • 网站建设的英文域名注册需要什么条件
  • wordpress管理系统贵州seo和网络推广
  • 网站第二次备案设计方案审核合格后由谁签字确认
  • 网页设计和网站编辑wordpress 页面瀑布流
  • 福田网站建设龙岗网站建设ie的常用网站
  • 网站推广途径和推广要点地产网站方案
  • 用asp做的网站2021互联网公司100强
  • 网站运营无经验可以做吗垂直类网站怎么做
  • 中国站长网站wordpress开启xmlrpc
  • 网站建设的好处建设工程质量管理条例网站
  • asp.net网站建设教程做电影网站 需要进那些群