Hi,
I am trying UART communication with MQX RTOS.
There is a structure in mcf52x.h
/*
** MCF52XX_UART_STRUCT
** This structure defines what one uart register look like
*/
typedef union mcf52xx_uart_struct
{
struct {
uchar UMR; // UART mode register
uchar filler1[3];
uchar USR; // UART status register
uchar filler2[3];
uchar filler4a;
uchar filler4[3];
uchar URB; // (Read) UART Receive Buffer
uchar filler5[3];
uchar UIPCR; // (Read) UART Input Port Change Register
uchar filler6[3];
uchar UISR; // (Read) UART Interrupt Status Register
uchar filler7[3];
uchar filler9a;
uchar filler9[3];
uchar filler10a;
uchar filler10[3];
uchar filler11[0x0234 - 0x021C - 3 - 1];
uchar UIP; // (Read) UART Input Port Register
uchar filler12[3];
uchar filler13a;
uchar filler13[3];
uchar filler14a; // (Write) UART Output Port Bit Reset Command Register
uchar filler14[3];
} READ;
struct {
uchar UMR; // UART mode register
uchar filler1[3];
uchar UCSR; // UART status register
uchar filler2[3];
uchar UCR; // (Write) UART Command Register
uchar filler4[3];
uchar UTB; // (Write) UART Transmit Buffer
uchar filler5[3];
uchar UACR; // (Write) UART Auxiliary Control Register
uchar filler6[3];
uchar UIMR; // (Write) UART Interrupt Mask Register
uchar filler7[3];
uchar UBG1; // (Write) UART Baud Rate Generator Register 1
uchar filler9[3];
uchar UBG2; // (Write) UART Baud Rate Generator Register 2
uchar filler10[3];
uchar filler11[0x0234 - 0x021C - 3 - 1];
uchar filler12a;
uchar filler12[3];
uchar UOP1; // (Write) UART Output Port Bit Set Command Register 0
uchar filler13[3];
uchar UIP0; // (Write) UART Output Port Bit Reset Command Register
} WRITE;
} MCF52XX_UART_STRUCT, _PTR_ MCF52XX_UART_STRUCT_PTR;
For the above structure, I created the following instance,
volatile MCF52XX_UART_STRUCT _PTR_ uart_ptr = (MCF52XX_UART_STRUCT _PTR_)BSP_IPSBAR;
Is the above LOC correct? is this the way to access UART registers?
But I am NOT getting the correct value of registers with the above address. For example, if I have to see the value of USR,
usr = uart_ptr->READ.USR;
this isn't giving me the correct value.
Can anyone please correct me?
I am currently working on MCF52233 Demo board.
Thanks