Hi Takashima,
There really is no limit other than available SRAM.
I tested with the TWR-K64F120M using a 1024 buffer modified in the twrk64f120m.h as follows:
#ifndef BSPCFG_SCI5_QUEUE_SIZE
#define BSPCFG_SCI5_QUEUE_SIZE 1024 //DES was 64
#endif
I also setup to use interrupt mode for my UART5 (ittyf).
My simple test was (NOTE I did modify the BSP serl_int.c code) as follows to return number of characters in the queue:
_mqx_int _io_serial_int_ioctl
(
/* [IN] the handle returned from _fopen */
FILE_DEVICE_STRUCT_PTR fd_ptr,
/* [IN] the ioctl command */
_mqx_uint cmd,
/* [IN] the ioctl parameters */
void *param_ptr
)
{ /* Body */
IO_DEVICE_STRUCT_PTR io_dev_ptr;
IO_SERIAL_INT_DEVICE_STRUCT_PTR int_io_dev_ptr;
_mqx_uint result = MQX_OK;
_mqx_uint_ptr uparam_ptr = (_mqx_uint_ptr)param_ptr;
io_dev_ptr = fd_ptr->DEV_PTR;
int_io_dev_ptr = (void *)io_dev_ptr->DRIVER_INIT_PTR;
switch (cmd) {
case IO_IOCTL_CHAR_AVAIL:
if ( _CHARQ_SIZE(int_io_dev_ptr->IN_QUEUE) ) {
// *((bool *)param_ptr) = TRUE; //DES??? why not return _CHARQ_SIZE ???
*((_mqx_int *)param_ptr) = _CHARQ_SIZE(int_io_dev_ptr->IN_QUEUE); //DES??? why not return _CHARQ_SIZE ???
} else {
*((bool *)param_ptr) = FALSE;
} /* Endif */
break;
Used the MQX hello example and modified hello.c as follows:
void hello_task
(
uint32_t initial_data
)
{
(void)initial_data; /* disable 'unused variable' warning */
int io_param; //DES added
int inchar; //DES added
int rc; //DES added
printf("Hello World\n");
#if 1 //DES 1=test, 0=default code
for (;;)
{
rc = _io_ioctl(stdin,IO_IOCTL_CHAR_AVAIL,&io_param);
while(io_param) //DES was if(io_param)
{
inchar = fgetc(stdin);
fputc(inchar, stdout);
io_param--;
}
_time_delay(5000); //DES block for 5 seconds (5000msec)...give time to fill UART Rx queue
}
#endif
_task_block();
}
Regards,
David