The parity IOCTL command isn't fully implemented in FSLMQX3.5.
If you want to add it, try the following steps for polled UART mode.
1) to the mcf522xx_uart.h add the line with comment //DES below:
/*------------------------------------------------------------------------*/
/*
** UART registers
*/
#define MCF52XX_UART_UMR1_RXRTS (0x80)
#define MCF52XX_UART_UMR1_RXIRQ (0x40)
#define MCF52XX_UART_UMR1_ERR (0x20)
#define MCF52XX_UART_UMR1_EVEN_PARITY (0x00)
#define MCF52XX_UART_UMR1_ODD_PARITY (0x04)
#define MCF52XX_UART_UMR1_LOW_PARITY (0x08)
#define MCF52XX_UART_UMR1_HI_PARITY (0x0C)
#define MCF52XX_UART_UMR1_NO_PARITY (0x10)
#define MCF52XX_UART_UMR1_MASK_PARITY_BITS (0x1C) //DES
2) in serl_pol_mcf522xx.c add the following case statements to function _mcf52xx_uart_serial_polled_ioctl():
case IO_IOCTL_SERIAL_SET_PARITY: //DES
tmp = io_info_ptr->INIT.UMR1_VALUE & ~(0x1C); //DES should make 0x1c=MCF52XX_UART_UMR1_MASK_PARITY_BITS
tmp |= (*param_ptr == 0x00)
? MCF52XX_UART_UMR1_EVEN_PARITY : (*param_ptr == 0x04)
? MCF52XX_UART_UMR1_ODD_PARITY : (*param_ptr == 0x08)
? MCF52XX_UART_UMR1_LOW_PARITY : (*param_ptr == 0x0C)
? MCF52XX_UART_UMR1_HI_PARITY : (*param_ptr == 0x10)
? MCF52XX_UART_UMR1_NO_PARITY : MCF52XX_UART_UMR1_NO_PARITY;
uart_ptr->WRITE.UCR = MCF52XX_UART_UCR_RESET_POINTER;
io_info_ptr->INIT.UMR1_VALUE = tmp;
uart_ptr->WRITE.UMR = io_info_ptr->INIT.UMR1_VALUE;
break;
case IO_IOCTL_SERIAL_GET_PARITY: //DES
*param_ptr = io_info_ptr->INIT.UMR1_VALUE & 0x1C;
break;
3) re-compile the build_libs.mcp
4) to your application code you can try the following IOCTL commands:
err = _io_ioctl(fh_ptr, IO_IOCTL_SERIAL_GET_PARITY, &Old_Parity); //Get Parity from default to "Baud_rate"
printf("\nCurrent Parity for alternate UART port is %d\n", Old_Parity); //print to uart0
err = _io_ioctl(fh_ptr, IO_IOCTL_SERIAL_SET_PARITY, &New_Parity); //Change/set Parity from default to "New_Parity"
printf("\nNew Parity for alternate UART port is %d\n", New_Parity); //print to uart0
I've attached the source files as well. The example app came from mqx/examples/io.
NOTE: I've only done limited testing. You should do additional testing to ensure it does what you want. I'm also assuming very similar code for the Interrupt UART mode.
Regards,
David