/*********************************************************************** * * masterFpgaSerialInit - initialize the Master FPGA serial devices to a quiescent state * * This routine initializes the Master FPGA serial device descriptors and puts the * devices in a quiescent state. It is called from bringup() with * interrupts locked. * * RETURNS: N/A * */ void masterFpgaSerialInit(void) { /* * intialize serial device 0 descriptors (S0) */ ns16550Chan0.regs = (UINT8*) FPGA_UART0_BASE; ns16550Chan0.channelMode = SIO_MODE_INT; ns16550Chan0.level = (UINT8) FPGA_EXT_INT_IRQ; /* a wild guess , this looks good 25 */ ns16550Chan0.regDelta = UART_REG_ADDR_INTERVAL; ns16550Chan0.xtal = 66666666; /* 66 MHz */ ns16550Chan0.baudRate = 9600; /* * intialize serial device 1 descriptors (S1) */ ns16550Chan1.regs = (UINT8*) FPGA_UART1_BASE; ns16550Chan1.channelMode = SIO_MODE_INT; ns16550Chan1.level = (UINT8) FPGA_EXT_INT_IRQ; /*a wild guess, this looks good 25 */ ns16550Chan1.regDelta = UART_REG_ADDR_INTERVAL; ns16550Chan1.xtal = 66666666; ns16550Chan1.baudRate = 9600; /* * intialize serial device 2 descriptors (S2) */ ns16550Chan2.regs = (UINT8*) FPGA_UART2_BASE; ns16550Chan2.channelMode = SIO_MODE_INT; ns16550Chan2.level = (UINT8) FPGA_EXT_INT_IRQ; /*a wild guess, this looks good 25 */ ns16550Chan2.regDelta = UART_REG_ADDR_INTERVAL; ns16550Chan2.xtal = 66666666; ns16550Chan2.baudRate = 9600; /* * intialize serial device 3 descriptors (S3) */ ns16550Chan3.regs = (UINT8*) FPGA_UART3_BASE; ns16550Chan3.channelMode = SIO_MODE_INT; ns16550Chan3.level = (UINT8) FPGA_EXT_INT_IRQ; /*a wild guess, this looks good 25 */ ns16550Chan3.regDelta = UART_REG_ADDR_INTERVAL; ns16550Chan3.xtal = 66666666; ns16550Chan3.baudRate = 9600; /* initialize chan pointer array for interrupt service routine */ ns16550Chans[0] = &ns16550Chan0; ns16550Chans[1] = &ns16550Chan1; ns16550Chans[2] = &ns16550Chan2; ns16550Chans[3] = &ns16550Chan3; /* * reset both devices */ ns16550DevInit(&ns16550Chan0); ns16550DevInit(&ns16550Chan1); ns16550DevInit(&ns16550Chan2); ns16550DevInit(&ns16550Chan3); }
void sysDuartHwInit (void) { int i; eumbbar_base = (char *)CCSBAR; for (i = 0; i < N_DUART_CHANNELS; i++) { ns16550Chan[i].regs = (UINT8 *)devDuartParas[i].baseAdrs; ns16550Chan[i].level = devDuartParas[i].intLevel; ns16550Chan[i].channelMode = SIO_MODE_INT; ns16550Chan[i].regDelta = devDuartParas[i].regSpace; ns16550Chan[i].baudRate = DUART_BAUD; ns16550Chan[i].xtal = sysClkFreqGet(); ns16550DevInit (&ns16550Chan[i]); } if (ns16550Chan[0].channelMode == SIO_MODE_INT) { eumbbar_base[UDCR2] = 0x01; /* set duart mode */ eumbbar_base[ULCR2] = 0x80; /* open DLAB */ eumbbar_base[UAFR2] = 0x00; eumbbar_base[UDMB2] = 0x0a; /* MSB 9600bps @400Mhz */ eumbbar_base[UDLB2] = 0xaa; /* LSB */ eumbbar_base[ULCR2] = 0x03; /* clear DLAB, no-parity, 1stop bit, 8bit data */ eumbbar_base[UMCR2] = 0x02; /* disable loopback mode */ eumbbar_base[UIER2] = 0x03; /* Tx empty, Rx interrupt enable */ } } /* sysDuartHwInit () */