lpcmanager

Default UART buffer is now short and baudrate is 19200. Modules that use short uart buffer should not have buffer size and baudrate redefined in xml module description file. This is necessary for compatibility with MC8.
int err;
char *serialdev = "/dev/ttyAPP1";
int RS485_GPIO_NUM = 102;
uartDevWriteBuf_plc_state = EMPTY;
uartDevReadBuf_plc_state = EMPTY;
bzero(&uartDev, sizeof(uartDev));
bzero(&uartDevReadBufA, sizeof(uartDevReadBuf_t));
bzero(&uartDevReadBufB, sizeof(uartDevReadBuf_t));
uartDevReadBuf_drv = &uartDevReadBufA;
uartDevReadBuf_plc = &uartDevReadBufB;
bzero(&uartDevWriteBufA, sizeof(uartDevWriteBuf_t));
bzero(&uartDevWriteBufB, sizeof(uartDevWriteBuf_t));
uartDevWriteBuf_drv = &uartDevWriteBufA;
uartDevWriteBuf_plc = &uartDevWriteBufB;
bzero(&uartCommStatusBuf, sizeof(uartCommStatusBuf));
bzero(&uartCommErrCntBuf, sizeof(uartCommErrCntBuf));
%(init_code)s
if((err = rt_mutex_create (&UART_WriteMutex, "UART_WriteMutex")))
return err;
if((err = rt_mutex_create (&UART_ReadMutex, "UART_ReadMutex")))
return err;
RS485_GPIO_dev = gpio_open(RS485_GPIO_NUM);
if (!RS485_GPIO_dev) {
fprintf(stderr, "Error while initializing RS485 GPIO.\n");
return 1;
}
UART_fd = openserial(serialdev, uartBaudrate); /* uartBaudrate is initialized from Composer */
if (!UART_fd) {
fprintf(stderr, "Error while initializing %%s.\n", serialdev);
return 1;
}
if(uartBufSize == UART_BUFSIZE_LONG) /* uartBufSize is initialized from Composer */
InitUartPortDevices_longBuffer();
else
InitUartPortDevices_shortBuffer();
if((err = rt_task_create(&UART_task, "UART_task", 0, 50, T_JOINABLE)))
return err;
if((err = rt_task_start(&UART_task, &UART_task_proc, NULL)))
return err;