| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- /******************************************************************************
- 版权所有:
- 文件名称: 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]);
-
- }
-
|