Ignore:
Timestamp:
Oct 18, 2011, 6:37:32 PM (10 years ago)
Author:
Jennifer Averett <Jennifer.Averett@…>
Branches:
4.11, 5, master
Children:
11f7aab
Parents:
e1ddcec0
Message:

2011-10-18 Jennifer Averett <Jennifer.Averett@…>

PR 1917/bsps

  • sh7045/sci/sci_termios.c: Modifications to add dynamic tables for libchip serial drivers.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libcpu/sh/sh7045/sci/sci_termios.c

    re1ddcec0 r7431fdc  
    3939 */
    4040#define SH_SCI_REG_DATA(_data, _minor, _register) \
    41  (write8(_data, Console_Port_Tbl[_minor].ulCtrlPort1 + (_register)))
     41 (write8(_data, Console_Port_Tbl[_minor]->ulCtrlPort1 + (_register)))
    4242
    4343#define SH_SCI_REG_FLAG(_flag, _minor, _register) \
    44  (write8(read8(Console_Port_Tbl[_minor].ulCtrlPort1 + (_register)) | (_flag), \
    45          Console_Port_Tbl[_minor].ulCtrlPort1 + (_register)))
     44 (write8(read8(Console_Port_Tbl[_minor]->ulCtrlPort1 + (_register)) | (_flag), \
     45         Console_Port_Tbl[_minor]->ulCtrlPort1 + (_register)))
    4646
    4747#define SH_SCI_REG_MASK(_flag, _minor, _register) \
    48  (write8(read8(Console_Port_Tbl[_minor].ulCtrlPort1 + (_register)) & ~(_flag), \
    49          Console_Port_Tbl[_minor].ulCtrlPort1 + (_register)))
     48 (write8(read8(Console_Port_Tbl[_minor]->ulCtrlPort1 + (_register)) & ~(_flag),\
     49         Console_Port_Tbl[_minor]->ulCtrlPort1 + (_register)))
    5050
    5151/*
     
    132132
    133133    for (minor = 0; minor < Console_Port_Count; minor++) {
    134         if (Console_Port_Tbl[minor].ulIntVector == vector) {
     134        if (Console_Port_Tbl[minor]->ulIntVector == vector) {
    135135            char   temp8;
    136136
     
    138138             * FIXME: error handling should be added
    139139             */
    140             temp8 = read8(Console_Port_Tbl[minor].ulCtrlPort1 + SCI_RDR);
     140            temp8 = read8(Console_Port_Tbl[minor]->ulCtrlPort1 + SCI_RDR);
    141141
    142142            rtems_termios_enqueue_raw_characters(
     
    159159
    160160    for (minor = 0; minor < Console_Port_Count; minor++) {
    161         if (Console_Port_Tbl[minor].ulDataPort == vector) {
     161        if (Console_Port_Tbl[minor]->ulDataPort == vector) {
    162162            /*
    163163             * FIXME: Error handling should be added
     
    225225     * Disable IRQ of SCIx
    226226     */
    227     status = sh_set_irq_priority( Console_Port_Tbl[minor].ulIntVector, 0);
     227    status = sh_set_irq_priority( Console_Port_Tbl[minor]->ulIntVector, 0);
    228228
    229229    if (status != RTEMS_SUCCESSFUL)
     
    237237    status = rtems_interrupt_catch(
    238238        sh_sci_rx_isr,
    239         Console_Port_Tbl[minor].ulIntVector,
     239        Console_Port_Tbl[minor]->ulIntVector,
    240240        &old_isr);
    241241
     
    245245    status = rtems_interrupt_catch(
    246246        sh_sci_tx_isr,
    247         Console_Port_Tbl[minor].ulDataPort,
     247        Console_Port_Tbl[minor]->ulDataPort,
    248248        &old_isr);
    249249
     
    257257
    258258    status = sh_set_irq_priority(
    259         Console_Port_Tbl[minor].ulIntVector,
    260         Console_Port_Tbl[minor].ulCtrlPort2);
     259        Console_Port_Tbl[minor]->ulIntVector,
     260        Console_Port_Tbl[minor]->ulCtrlPort2);
    261261
    262262    if (status != RTEMS_SUCCESSFUL)
     
    293293
    294294    /* set SMR and BRR - baudrate and format */
    295     sh_sci_set_attributes(minor, Console_Port_Tbl[minor].pDeviceParams);
     295    sh_sci_set_attributes(minor, Console_Port_Tbl[minor]->pDeviceParams);
    296296
    297297    for (a=0; a < 10000L; a++) {                      /* Delay */
     
    300300
    301301    write8((SCI_RE | SCI_TE),              /* enable async. Tx and Rx */
    302            Console_Port_Tbl[minor].ulCtrlPort1 + SCI_SCR);
     302           Console_Port_Tbl[minor]->ulCtrlPort1 + SCI_SCR);
    303303
    304304    /*
    305305     * clear error flags
    306306     */
    307     temp8 = read8(Console_Port_Tbl[minor].ulCtrlPort1 + SCI_SSR);
     307    temp8 = read8(Console_Port_Tbl[minor]->ulCtrlPort1 + SCI_SSR);
    308308    while(temp8 & (SCI_RDRF | SCI_ORER | SCI_FER | SCI_PER)) {
    309309        /* flush input */
    310         temp8 = read8(Console_Port_Tbl[minor].ulCtrlPort1 + SCI_RDR);
     310        temp8 = read8(Console_Port_Tbl[minor]->ulCtrlPort1 + SCI_RDR);
    311311
    312312        /* clear some flags */
    313         SH_SCI_REG_FLAG((SCI_RDRF | SCI_ORER | SCI_FER | SCI_PER), minor, SCI_SSR);
     313        SH_SCI_REG_FLAG((SCI_RDRF|SCI_ORER|SCI_FER|SCI_PER), minor, SCI_SSR);
    314314
    315315        /* check if everything is OK */
    316         temp8 = read8(Console_Port_Tbl[minor].ulCtrlPort1 + SCI_SSR);
     316        temp8 = read8(Console_Port_Tbl[minor]->ulCtrlPort1 + SCI_SSR);
    317317    }
    318318
     
    326326     * Interrupt setup
    327327     */
    328     if (Console_Port_Tbl[minor].pDeviceFns->deviceOutputUsesInterrupts) {
     328    if (Console_Port_Tbl[minor]->pDeviceFns->deviceOutputUsesInterrupts) {
    329329        SH_SCI_REG_FLAG(SCI_RIE, minor, SCI_SCR);
    330330    }
     
    346346
    347347    /* Shutdown interrupts if necessary */
    348     if (Console_Port_Tbl[minor].pDeviceFns->deviceOutputUsesInterrupts)
     348    if (Console_Port_Tbl[minor]->pDeviceFns->deviceOutputUsesInterrupts)
    349349    {
    350350        SH_SCI_REG_MASK((SCI_TIE | SCI_RIE), minor, SCI_SCR);
     
    409409     * Wait for end of previous character
    410410     */
    411     while(!(read8(Console_Port_Tbl[minor].ulCtrlPort1 + SCI_SSR) & SCI_TDRE));
     411    while(!(read8(Console_Port_Tbl[minor]->ulCtrlPort1 + SCI_SSR) & SCI_TDRE));
    412412    /*
    413413     * Send the character
     
    431431     * Check if input buffer is full
    432432     */
    433     if (read8(Console_Port_Tbl[minor].ulCtrlPort1 + SCI_SSR) & SCI_RDRF) {
    434         inbyte = read8(Console_Port_Tbl[minor].ulCtrlPort1 + SCI_RDR);
     433    if (read8(Console_Port_Tbl[minor]->ulCtrlPort1 + SCI_SSR) & SCI_RDRF) {
     434        inbyte = read8(Console_Port_Tbl[minor]->ulCtrlPort1 + SCI_RDR);
    435435        SH_SCI_REG_MASK(SCI_RDRF, minor, SCI_SSR);
    436436
     
    438438         * Check for errors
    439439         */
    440         if (read8(Console_Port_Tbl[minor].ulCtrlPort1 + SCI_SSR) &
     440        if (read8(Console_Port_Tbl[minor]->ulCtrlPort1 + SCI_SSR) &
    441441           (SCI_ORER | SCI_FER | SCI_PER)) {
    442442            SH_SCI_REG_MASK((SCI_ORER | SCI_FER | SCI_PER), minor, SCI_SSR);
Note: See TracChangeset for help on using the changeset viewer.