Hello,
You couldn't need to write a new driver but use the pipe driver. Pipe is an standard driver in MQX, check MQXIOUG.pdf
In some part of the application Init code or first Task, install and open the pipe driver:
MQX_FILE_PTR virtualtty;
if (IO_OK != _io_pipe_install("virtualtty:", 4, 0)) {
printf("Error opening virtualtty\n");
}
if (NULL == (virtualtty = fopen("virtualtty:", NULL))) {
printf("Error opening the driver");
}
The Virtual_Com_App Task() will have to send the data from pipe to USB (if data available) and write USB received data to pipe.
write(virtualtty, &g_curr_recv_buf[i], 1); //Write to pipe
g_send_size = read(virtualtty, g_curr_send_buf, DATA_BUFF_SIZE); //read from pipe
In parallel, the other tasks will be able to make read/write operations in the pipe (virtualtty) like real tty.
One additional thing, read from pipe is a blocking operation, you will have to use ioctl to know the pipe status.
I hope this helps, I don't have a working example.
Regards,
Luis