Ignore:
Timestamp:
2010-07-27T21:42:47Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
69a60c4
Parents:
5a9f4d7 (diff), 1720cf9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge from lp:~jsvoboda/helenos/gta02.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/arm32/src/mach/gta02/gta02.c

    r5a9f4d7 r571addd  
    4343#include <genarch/drivers/s3c24xx_irqc/s3c24xx_irqc.h>
    4444#include <genarch/drivers/s3c24xx_timer/s3c24xx_timer.h>
     45#include <genarch/srln/srln.h>
     46#include <sysinfo/sysinfo.h>
    4547#include <interrupt.h>
    4648#include <ddi/ddi.h>
     
    6870static void gta02_output_init(void);
    6971static void gta02_input_init(void);
     72static size_t gta02_get_irq_count(void);
    7073
    7174static void gta02_timer_irq_init(void);
     
    7477static void gta02_timer_irq_handler(irq_t *irq);
    7578
    76 static void *gta02_scons_out;
    77 static s3c24xx_irqc_t *gta02_irqc;
     79static outdev_t *gta02_scons_dev;
     80static s3c24xx_irqc_t gta02_irqc;
    7881static s3c24xx_timer_t *gta02_timer;
    7982
     
    8891        gta02_frame_init,
    8992        gta02_output_init,
    90         gta02_input_init
     93        gta02_input_init,
     94        gta02_get_irq_count
    9195};
    9296
    9397static void gta02_init(void)
    9498{
    95         gta02_scons_out = (void *) hw_map(GTA02_SCONS_BASE, PAGE_SIZE);
    96         gta02_irqc = (void *) hw_map(S3C24XX_IRQC_ADDRESS, PAGE_SIZE);
     99        s3c24xx_irqc_regs_t *irqc_regs;
     100
    97101        gta02_timer = (void *) hw_map(S3C24XX_TIMER_ADDRESS, PAGE_SIZE);
    98 
    99         /* Make all interrupt sources use IRQ mode (not FIQ). */
    100         pio_write_32(&gta02_irqc->intmod, 0x00000000);
    101 
    102         /* Disable all interrupt sources. */
    103         pio_write_32(&gta02_irqc->intmsk, 0xffffffff);
    104 
    105         /* Disable interrupts from all sub-sources. */
    106         pio_write_32(&gta02_irqc->intsubmsk, 0xffffffff);
     102        irqc_regs = (void *) hw_map(S3C24XX_IRQC_ADDRESS, PAGE_SIZE);
     103
     104        /* Initialize interrupt controller. */
     105        s3c24xx_irqc_init(&gta02_irqc, irqc_regs);
    107106}
    108107
     
    132131        uint32_t inum;
    133132
    134         inum = pio_read_32(&gta02_irqc->intoffset);
     133        /* Determine IRQ number. */
     134        inum = s3c24xx_irqc_inum_get(&gta02_irqc);
     135
     136        /* Clear interrupt condition in the interrupt controller. */
     137        s3c24xx_irqc_clear(&gta02_irqc, inum);
    135138
    136139        irq_t *irq = irq_dispatch_and_lock(inum);
     
    144147                    CPU->id, inum);
    145148        }
    146 
    147         /* Clear interrupt condition in the interrupt controller. */
    148         pio_write_32(&gta02_irqc->srcpnd, S3C24XX_INT_BIT(inum));
    149         pio_write_32(&gta02_irqc->intpnd, S3C24XX_INT_BIT(inum));
    150149}
    151150
     
    176175        }
    177176#endif
    178         outdev_t *scons_dev;
    179 
    180         scons_dev = s3c24xx_uart_init((ioport8_t *) gta02_scons_out);
    181         if (scons_dev)
    182                 stdout_wire(scons_dev);
     177
     178        /* Initialize serial port of the debugging console. */
     179        s3c24xx_uart_io_t *scons_io;
     180
     181        scons_io = (void *) hw_map(GTA02_SCONS_BASE, PAGE_SIZE);
     182        gta02_scons_dev = s3c24xx_uart_init(scons_io, S3C24XX_INT_UART2);
     183
     184        if (gta02_scons_dev) {
     185                /* Create output device. */
     186                stdout_wire(gta02_scons_dev);
     187        }
     188
     189        /*
     190         * This is the necessary evil until the userspace driver is entirely
     191         * self-sufficient.
     192         */
     193        sysinfo_set_item_val("s3c24xx_uart", NULL, true);
     194        sysinfo_set_item_val("s3c24xx_uart.inr", NULL, S3C24XX_INT_UART2);
     195        sysinfo_set_item_val("s3c24xx_uart.address.physical", NULL,
     196            (uintptr_t) GTA02_SCONS_BASE);
     197
    183198}
    184199
    185200static void gta02_input_init(void)
    186201{
     202        s3c24xx_uart_t *scons_inst;
     203
     204        if (gta02_scons_dev) {
     205                /* Create input device. */
     206                scons_inst = (void *) gta02_scons_dev->data;
     207
     208                srln_instance_t *srln_instance = srln_init();
     209                if (srln_instance) {
     210                        indev_t *sink = stdin_wire();
     211                        indev_t *srln = srln_wire(srln_instance, sink);
     212                        s3c24xx_uart_input_wire(scons_inst, srln);
     213
     214                        /* Enable interrupts from UART2 */
     215                        s3c24xx_irqc_src_enable(&gta02_irqc,
     216                            S3C24XX_INT_UART2);
     217
     218                        /* Enable interrupts from UART2 RXD */
     219                        s3c24xx_irqc_subsrc_enable(&gta02_irqc,
     220                            S3C24XX_SUBINT_RXD2);
     221                }
     222        }
     223}
     224
     225size_t gta02_get_irq_count(void)
     226{
     227        return GTA02_IRQ_COUNT;
    187228}
    188229
     
    248289
    249290        /* Enable interrupts from timer0 */
    250         pio_write_32(&gta02_irqc->intmsk, pio_read_32(&gta02_irqc->intmsk) &
    251             ~S3C24XX_INT_BIT(S3C24XX_INT_TIMER0));
     291        s3c24xx_irqc_src_enable(&gta02_irqc, S3C24XX_INT_TIMER0);
    252292
    253293        /* Load data from tcntb0/tcmpb0 into tcnt0/tcmp0. */
Note: See TracChangeset for help on using the changeset viewer.