Sign in

username:

password:



Not a member?

Search c54x



Search tips

Subscribe to c54x



c54x by Keywords

5409 | 5416 | AD5 | ADC | BIOS | Boot | Booting | Bootloader | C540 | C5402 | C5409 | C5416 | CCS | Codec | DMA | Dmad | DSK | DSKPlus | Dsplib | EVM | FFT | FIR | Flash | GPIO | HPI | Initialization | Interrupt | JTAG | LOG_printf | MCBSP | RFFT | RTDX | Sampling | STLM | UART | VC540

Ads

Discussion Groups

Technical discussions about the TI C54x DSPs (including the c5401, c5402, c5402a, c5404, c5407, c5409, c5409a, c5410, c5410a, c5416, c5420, c5421, c5441, c549, c5470 and c5471).

  

Post a new Thread

ioport - Author Unknown - Nov 19 17:57:00 2001



I have a UART chip with two Uarts on it, and the registers are mapped
into memory locations 0-7 for Uart A and 8-15 for Uart B.

I have them defined like this:

#define UART_RBR_A_REG port0
#define UART_THR_A_REG port0
#define UART_IER_A_REG port1
#define UART_IIR_A_REG port2
#define UART_FCR_A_REG port2
#define UART_LCR_A_REG port3
#define UART_MCR_A_REG port4
#define UART_LSR_A_REG port5
#define UART_MSR_A_REG port6
#define UART_SCR_A_REG port7

// uart B registers
#define UART_RBR_B_REG port8
#define UART_THR_B_REG port8
#define UART_IER_B_REG port9
#define UART_IIR_B_REG porta
#define UART_FCR_B_REG porta
#define UART_LCR_B_REG portb
#define UART_MCR_B_REG portc
#define UART_LSR_B_REG portd
#define UART_MSR_B_REG porte
#define UART_SCR_B_REG portf I also have a enumerated type like this :
typedef enum
{
UART_A = 0x00,
UART_B = 0x01,
} UartSelect, *PUartSelect;

with a variable declared as :
UartSelect selectedUart;

what I would like to be able to do is like this:

UART_RBR_A_REG + selectedUart = somevalue I need to write

Instead of doing this

If(selectedUArt == UART_A)
{
UART_RBR_A_REG = somevalue;
}
else
{
UART_RBR_B_REG = somevalue;
} Is there a way of doing this? Carl Chipman
Nomadics, Inc.

http://www.nomadics.com




(You need to be a member of c54x -- send a blank email to c54x-subscribe@yahoogroups.com )

Re: ioport - Dave Helsley - Nov 21 1:45:00 2001

I bet you could do

UART_RBR_A_REG + (8*selectedUart) = somevalue I need to write

I do this kind of branch elimination optimization all the time.

Good luck,
Dave Helsley

----- Original Message -----
From: <>
To: <>
Sent: Monday, November 19, 2001 11:57 AM
Subject: [c54x] ioport > I have a UART chip with two Uarts on it, and the registers are mapped
> into memory locations 0-7 for Uart A and 8-15 for Uart B.
>
> I have them defined like this:
>
> #define UART_RBR_A_REG port0
> #define UART_THR_A_REG port0
> #define UART_IER_A_REG port1
> #define UART_IIR_A_REG port2
> #define UART_FCR_A_REG port2
> #define UART_LCR_A_REG port3
> #define UART_MCR_A_REG port4
> #define UART_LSR_A_REG port5
> #define UART_MSR_A_REG port6
> #define UART_SCR_A_REG port7
>
> // uart B registers
> #define UART_RBR_B_REG port8
> #define UART_THR_B_REG port8
> #define UART_IER_B_REG port9
> #define UART_IIR_B_REG porta
> #define UART_FCR_B_REG porta
> #define UART_LCR_B_REG portb
> #define UART_MCR_B_REG portc
> #define UART_LSR_B_REG portd
> #define UART_MSR_B_REG porte
> #define UART_SCR_B_REG portf > I also have a enumerated type like this :
> typedef enum
> {
> UART_A = 0x00,
> UART_B = 0x01,
> } UartSelect, *PUartSelect;
>
> with a variable declared as :
> UartSelect selectedUart;
>
> what I would like to be able to do is like this:
>
> UART_RBR_A_REG + selectedUart = somevalue I need to write
>
> Instead of doing this
>
> If(selectedUArt == UART_A)
> {
> UART_RBR_A_REG = somevalue;
> }
> else
> {
> UART_RBR_B_REG = somevalue;
> } > Is there a way of doing this? > Carl Chipman
> Nomadics, Inc.
>
> http://www.nomadics.com > _____________________________________




(You need to be a member of c54x -- send a blank email to c54x-subscribe@yahoogroups.com )