/****************************************************************************** 版权所有: 文件名称: myconf.c 文件版本: 01.01 创建作者: xxxxxx 创建日期: 2015-5-5 功能说明: 配置实现文件 使用本框架前,应配置必要参数. 1.配置PROTOCOL_CHNS ------------------- - APP层 - ------------------- - 协议层 - ------------------- - 通道层 - ------------------- - 驱动层 - ------------------- 其它说明: 修改记录: */ #include "head.h" #include "myconf.h" #include "protocol.h" T_channel g_h_boj[PROTOCOL_CHNS]; //static int g_uart_fd = 0; int myuart_init(void) { //uart_open(0, 57600, PARITY_NONE_1, STOPBIT_ONE); return 0; } static int myuart_write(struct channel_obj *h_obj, const char *data, int count) { int ret = 0; (void)h_obj; ret = uart_write(h_obj->fd, data, count); return ret; } static int myuart_read(struct channel_obj *h_obj, char *data, int count) { int ret = 0; (void)h_obj; ret = uart_read(h_obj->fd, data, count); return ret; } /****************************************************************************** 函数名称: user_conf_init 函数版本: 01.01 创建作者: xxxxxx 创建日期: 2015-05-05 函数说明: 用户配置初始化 参数说明: 无 返回值: 无 修改记录: */ void user_conf_init(void) { myuart_init(); g_h_boj[0].read = myuart_read; g_h_boj[0].write = myuart_write; if((g_h_boj[0].fd==CFG_UART_485_0) ||(g_h_boj[0].fd==CFG_UART_485_1) || (g_h_boj[0].fd==CFG_UART_485_2) ) { g_h_boj[0].halfduplex=1; } else { g_h_boj[0].halfduplex=0; } protocol_init(); protocol_add_chan(&g_h_boj[0]); }