Changeset 4d2dba7 in mainline


Ignore:
Timestamp:
2013-10-15T17:05:26Z (11 years ago)
Author:
Jakub Klama <jakub.klama@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f988a13
Parents:
a73ebf0
Message:

Implementation of IRQMP interrupt controller and UART drivers, part 2.
Modified kernel config files to reflect presence of new drivers.

Files:
6 edited

Legend:

Unmodified
Added
Removed
  • HelenOS.config

    ra73ebf0 r4d2dba7  
    6464% Machine type
    6565@ "leon3" Gaisler Aeroflex LEON3
    66 ! [PLATFORM=sarc32] MACHINE (choice)
     66! [PLATFORM=sparc32] MACHINE (choice)
    6767
    6868% Machine type
     
    504504% Support for OMAP on-chip UART
    505505! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=serial)&PLATFORM=arm32&(MACHINE=beagleboardxm|MACHINE=beaglebone)] CONFIG_OMAP_UART (y/n)
     506
     507% Support for GRLIB UART
     508! [PLATFORM=sparc32&MACHINE=leon3] CONFIG_GRLIB_UART (y)
     509
     510% Support for GRLIB IRQMP
     511! [PLATFORM=sparc32&MACHINE=leon3] CONFIG_GRLIB_IRQMP (y)
    506512
    507513% Support for i8042 controller
     
    639645@ "5" Linux kernel
    640646! [PLATFORM=arm32&MACHINE!=beagleboardxm&MACHINE!=beaglebone] UIMAGE_OS (choice)
     647
     648% uImage OS type
     649@ "5" Linux kernel
     650! [PLATFORM=sparc32] UIMAGE_OS (choice)
  • defaults/sparc32/leon3/Makefile.config

    ra73ebf0 r4d2dba7  
    1010# GRLIB APBUART
    1111CONFIG_GRLIB_UART = y
     12
     13# GRLIB IRQMP
     14CONFIG_GRLIB_IRQMP = y
  • kernel/genarch/include/genarch/drivers/grlib_irqmp/grlib_irqmp.h

    ra73ebf0 r4d2dba7  
    3939
    4040#include <typedefs.h>
     41#include <arch.h>
    4142
    4243#define GRLIB_IRQMP_MASK_OFFSET         0x40
     
    7071} grlib_irqmp_t;
    7172
    72 extern void grlib_irqmp_init(grlib_irqmp_t *, grlib_irqmp_regs_t *);
    73 extern unsigned grlib_irqmp_inum_get(grlib_irqmp_t *);
    74 extern void grlib_irqmp_clear(grlib_irqc_t *, int);
    75 extern void grlib_irqmp_irq_mask(grlib_irqc_t *, int);
    76 extern void grlib_irqmp_irq_unmask(grlib_irqc_t *, int);
     73extern void grlib_irqmp_init(grlib_irqmp_t *, bootinfo_t *);
     74extern int grlib_irqmp_inum_get(grlib_irqmp_t *);
     75extern void grlib_irqmp_clear(grlib_irqmp_t *, int);
     76extern void grlib_irqmp_mask(grlib_irqmp_t *, int);
     77extern void grlib_irqmp_unmask(grlib_irqmp_t *, int);
    7778
    7879#endif
  • kernel/genarch/include/genarch/drivers/grlib_uart/grlib_uart.h

    ra73ebf0 r4d2dba7  
    4444#include <typedefs.h>
    4545
    46 /** GRLIB UART registers */
    47 typedef struct {
    48         uint32_t data;
    49         grlib_uart_status_t status;
    50         grlib_uart_control_t control;
    51         uint32_t scaler;
    52         uint32_t debug;
    53 } grlib_uart_io_t;
    54 
    5546typedef struct {
    5647        unsigned int rcnt: 6;
     
    8879        unsigned int te: 1;
    8980        unsigned int re: 1;
    90 };
     81} grlib_uart_control_t;
     82
     83/** GRLIB UART registers */
     84typedef struct {
     85        uint32_t data;
     86        uint32_t status;
     87        uint32_t control;
     88        uint32_t scaler;
     89        uint32_t debug;
     90} grlib_uart_io_t;
    9191
    9292typedef struct {
  • kernel/genarch/src/drivers/grlib_irqmp/grlib_irqmp.c

    ra73ebf0 r4d2dba7  
    3838#include <arch/asm.h>
    3939
    40 void grlib_irqmp_init(grlib_irqmp_t *irqc, grlib_irqmp_regs_t *regs)
     40#include <mm/km.h>
     41
     42void grlib_irqmp_init(grlib_irqmp_t *irqc, bootinfo_t *bootinfo)
    4143{
    42         irqc->regs = regs;
     44        irqc->regs = (void *) km_map(bootinfo->intc_base, PAGE_SIZE,
     45            PAGE_NOT_CACHEABLE);
     46
     47        /* Mask all interrupts */
     48        pio_write_32((void *)&irqc->regs + GRLIB_IRQMP_MASK_OFFSET, 0);
    4349}
    4450
    45 unsigned grlib_irqmp_inum_get(grlib_irqmp_t *irqc)
     51int grlib_irqmp_inum_get(grlib_irqmp_t *irqc)
    4652{
    47         return 0;
     53        int i;
     54        uint32_t pending = pio_read_32(&irqc->regs->pending);
     55
     56        for (i = 1; i < 16; i++) {
     57                if (pending & (1 << i))
     58                        return i;
     59        }
     60
     61        return -1;
    4862}
    4963
    50 void grlib_irqmp_clear(grlib_irqmp_t *irqc, unsigned inum)
     64void grlib_irqmp_clear(grlib_irqmp_t *irqc, int inum)
    5165{
     66        pio_write_32(&irqc->regs->clear, (1 << inum));
    5267}
    5368
    54 void grlib_irqmp_src_enable(grlib_irqmp_t *irqc, unsigned src)
     69void grlib_irqmp_mask(grlib_irqmp_t *irqc, int src)
    5570{
     71        uint32_t mask = pio_read_32((void *)&irqc->regs + GRLIB_IRQMP_MASK_OFFSET);
     72
     73        mask &= ~(1 << src);
     74
     75        pio_write_32((void *)&irqc->regs + GRLIB_IRQMP_MASK_OFFSET, mask);
    5676}
    5777
    58 void grlib_irqmp_src_disable(grlib_irqmp_t *irqc, unsigned src)
     78void grlib_irqmp_unmask(grlib_irqmp_t *irqc, int src)
    5979{
     80        uint32_t mask = pio_read_32((void *)&irqc->regs + GRLIB_IRQMP_MASK_OFFSET);
     81
     82        mask |= (1 << src);
     83
     84        pio_write_32((void *)&irqc->regs + GRLIB_IRQMP_MASK_OFFSET, mask);
    6085}
    6186
  • kernel/genarch/src/drivers/grlib_uart/grlib_uart.c

    ra73ebf0 r4d2dba7  
    5050static void grlib_uart_sendb(outdev_t *dev, uint8_t byte)
    5151{
     52        uint32_t reg;
    5253        grlib_uart_status_t *status;
    5354        grlib_uart_t *uart =
     
    5657        /* Wait for space becoming available in Tx FIFO. */
    5758        do {
    58                 status = pio_read_32(&uart->io->status);
     59                reg = pio_read_32(&uart->io->status);
     60                status = (grlib_uart_status_t *)&reg;
    5961        } while (status->tf != 0);
    6062
     
    8587static void grlib_uart_irq_handler(irq_t *irq)
    8688{
     89        uint32_t reg;
    8790        grlib_uart_t *uart = irq->instance;
    88         grlib_status_t status;
     91        grlib_uart_status_t *status;
    8992
    90         status = (grlib_status_t)pio_read_32(&uart->io->status);
     93        reg = pio_read_32(&uart->io->status);
     94        status = (grlib_uart_status_t *)&reg;
    9195
    9296        while (status->dr != 0) {
    9397                uint32_t data = pio_read_32(&uart->io->data);
    94                 status = (grlib_status_t)pio_read_32(&uart->io->status);
     98                reg = pio_read_32(&uart->io->status);
     99                status = (grlib_uart_status_t *)&reg;
    95100                indev_push_character(uart->indev, data & 0xff);
    96101        }
     
    131136
    132137        /* Enable FIFO, Tx trigger level: empty, Rx trigger level: 1 byte. */
    133         grlib_control_t control =
     138        grlib_uart_control_t control =
    134139                { .fa = 1, .rf = 1, .tf = 1, .ri = 1,
    135140                  .te = 1, .re = 1};
    136141
    137         pio_write_32(&uart->io->control, control);
     142        uint32_t *reg = (uint32_t *)&control;
     143        pio_write_32(&uart->io->control, *reg);
    138144
    139145        link_initialize(&uart->parea.link);
Note: See TracChangeset for help on using the changeset viewer.