Changes in / [571addd:5a9f4d7] in mainline


Ignore:
Files:
4 deleted
17 edited

Legend:

Unmodified
Added
Removed
  • HelenOS.config

    r571addd r5a9f4d7  
    441441! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=serial)&PLATFORM=arm32&MACHINE=gta02] CONFIG_S3C24XX_UART (y/n)
    442442
    443 % Support for Samsung S3C24XX on-chip interrupt controller
    444 ! [PLATFORM=arm32&MACHINE=gta02] CONFIG_S3C24XX_IRQC (y)
    445 
    446443% Support for Z8530 controller
    447444! [(CONFIG_HID_IN=generic|CONFIG_HID_IN=keyboard)&PLATFORM=sparc64&MACHINE=generic] CONFIG_Z8530 (y/n)
     
    472469
    473470% Serial line input module
    474 ! [CONFIG_DSRLNIN=y|(PLATFORM=arm32&MACHINE=gta02)|(PLATFORM=ia64&MACHINE=i460GX&CONFIG_NS16550=y)|(PLATFORM=ia64&MACHINE=ski)|(PLATFORM=sparc64&MACHINE=serengeti&CONFIG_SGCN_KBD=y)|(PLATFORM=sparc64&PROCESSOR=sun4v)] CONFIG_SRLN (y)
     471! [CONFIG_DSRLNIN=y|(PLATFORM=ia64&MACHINE=i460GX&CONFIG_NS16550=y)|(PLATFORM=ia64&MACHINE=ski)|(PLATFORM=sparc64&MACHINE=serengeti&CONFIG_SGCN_KBD=y)|(PLATFORM=sparc64&PROCESSOR=sun4v)] CONFIG_SRLN (y)
    475472
    476473% EGA support
  • boot/arch/arm32/Makefile.inc

    r571addd r5a9f4d7  
    4141PAGE_SIZE = 4096
    4242
    43 RD_SRVS_ESSENTIAL += \
    44         $(USPACE_PATH)/srv/hw/char/s3c24xx_uart/s3c24ser
     43RD_SRVS_ESSENTIAL +=
    4544
    4645RD_SRVS_NON_ESSENTIAL += \
  • kernel/arch/arm32/include/mach/integratorcp/integratorcp.h

    r571addd r5a9f4d7  
    105105extern void icp_get_memory_extents(uintptr_t *, uintptr_t *);
    106106extern void icp_frame_init(void);
    107 extern size_t icp_get_irq_count(void);
    108107
    109108extern struct arm_machine_ops icp_machine_ops;
  • kernel/arch/arm32/include/mach/testarm/testarm.h

    r571addd r5a9f4d7  
    7373extern void gxemul_get_memory_extents(uintptr_t *, uintptr_t *);
    7474extern void gxemul_frame_init(void);
    75 extern size_t gxemul_get_irq_count(void);
    7675
    7776extern struct arm_machine_ops gxemul_machine_ops;
  • kernel/arch/arm32/include/machine_func.h

    r571addd r5a9f4d7  
    5555        void (*machine_output_init)(void);
    5656        void (*machine_input_init)(void);
    57         size_t (*machine_get_irq_count)(void);
    5857};
    5958
  • kernel/arch/arm32/src/mach/gta02/gta02.c

    r571addd r5a9f4d7  
    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>
    4745#include <interrupt.h>
    4846#include <ddi/ddi.h>
     
    7068static void gta02_output_init(void);
    7169static void gta02_input_init(void);
    72 static size_t gta02_get_irq_count(void);
    7370
    7471static void gta02_timer_irq_init(void);
     
    7774static void gta02_timer_irq_handler(irq_t *irq);
    7875
    79 static outdev_t *gta02_scons_dev;
    80 static s3c24xx_irqc_t gta02_irqc;
     76static void *gta02_scons_out;
     77static s3c24xx_irqc_t *gta02_irqc;
    8178static s3c24xx_timer_t *gta02_timer;
    8279
     
    9188        gta02_frame_init,
    9289        gta02_output_init,
    93         gta02_input_init,
    94         gta02_get_irq_count
     90        gta02_input_init
    9591};
    9692
    9793static void gta02_init(void)
    9894{
    99         s3c24xx_irqc_regs_t *irqc_regs;
    100 
     95        gta02_scons_out = (void *) hw_map(GTA02_SCONS_BASE, PAGE_SIZE);
     96        gta02_irqc = (void *) hw_map(S3C24XX_IRQC_ADDRESS, PAGE_SIZE);
    10197        gta02_timer = (void *) hw_map(S3C24XX_TIMER_ADDRESS, PAGE_SIZE);
    102         irqc_regs = (void *) hw_map(S3C24XX_IRQC_ADDRESS, PAGE_SIZE);
    103 
    104         /* Initialize interrupt controller. */
    105         s3c24xx_irqc_init(&gta02_irqc, irqc_regs);
     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);
    106107}
    107108
     
    131132        uint32_t inum;
    132133
    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);
     134        inum = pio_read_32(&gta02_irqc->intoffset);
    138135
    139136        irq_t *irq = irq_dispatch_and_lock(inum);
     
    147144                    CPU->id, inum);
    148145        }
     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));
    149150}
    150151
     
    175176        }
    176177#endif
    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 
     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);
    198183}
    199184
    200185static void gta02_input_init(void)
    201186{
    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 
    225 size_t gta02_get_irq_count(void)
    226 {
    227         return GTA02_IRQ_COUNT;
    228187}
    229188
     
    289248
    290249        /* Enable interrupts from timer0 */
    291         s3c24xx_irqc_src_enable(&gta02_irqc, S3C24XX_INT_TIMER0);
     250        pio_write_32(&gta02_irqc->intmsk, pio_read_32(&gta02_irqc->intmsk) &
     251            ~S3C24XX_INT_BIT(S3C24XX_INT_TIMER0));
    292252
    293253        /* Load data from tcntb0/tcmpb0 into tcnt0/tcmp0. */
  • kernel/arch/arm32/src/mach/integratorcp/integratorcp.c

    r571addd r5a9f4d7  
    6464        icp_frame_init,
    6565        icp_output_init,
    66         icp_input_init,
    67         icp_get_irq_count
     66        icp_input_init
    6867};
    6968
     
    337336}
    338337
    339 size_t icp_get_irq_count(void)
    340 {
    341         return ICP_IRQ_COUNT;
    342 }
    343338
    344339/** @}
  • kernel/arch/arm32/src/mach/testarm/testarm.c

    r571addd r5a9f4d7  
    6464        gxemul_frame_init,
    6565        gxemul_output_init,
    66         gxemul_input_init,
    67         gxemul_get_irq_count
     66        gxemul_input_init
    6867};
    6968
     
    127126}
    128127
    129 size_t gxemul_get_irq_count(void)
    130 {
    131         return GXEMUL_IRQ_COUNT;
    132 }
    133 
    134128/** Starts gxemul Real Time Clock device, which asserts regular interrupts.
    135129 *
  • kernel/arch/arm32/src/machine_func.c

    r571addd r5a9f4d7  
    128128size_t machine_get_irq_count(void)
    129129{
    130         return (machine_ops->machine_get_irq_count)();
     130        size_t irq_count;
     131 
     132#if defined(MACHINE_gta02)
     133        irq_count = GTA02_IRQ_COUNT;
     134#elif defined(MACHINE_testarm)
     135        irq_count = GXEMUL_IRQ_COUNT;
     136#elif defined(MACHINE_integratorcp)
     137        irq_count = ICP_IRQ_COUNT;
     138#else
     139#error Machine type not defined.
     140#endif
     141        return irq_count;
    131142}
    132143
  • kernel/genarch/Makefile.inc

    r571addd r5a9f4d7  
    9090endif
    9191
    92 ifeq ($(CONFIG_S3C24XX_IRQC),y)
    93         GENARCH_SOURCES += \
    94                 genarch/src/drivers/s3c24xx_irqc/s3c24xx_irqc.c
    95 endif
    96 
    9792ifeq ($(CONFIG_S3C24XX_UART),y)
    9893        GENARCH_SOURCES += \
  • kernel/genarch/include/drivers/s3c24xx_irqc/s3c24xx_irqc.h

    r571addd r5a9f4d7  
    5353        ioport32_t subsrcpnd;   /**< Sub source pending */
    5454        ioport32_t intsubmsk;   /** Interrupt sub mask */
    55 } s3c24xx_irqc_regs_t;
     55} s3c24xx_irqc_t;
    5656
    5757/** S3C24xx Interrupt source numbers.
     
    120120#define S3C24XX_SUBINT_BIT(subsource) (1 << (subsource))
    121121
    122 typedef struct {
    123         s3c24xx_irqc_regs_t *regs;
    124 } s3c24xx_irqc_t;
    125 
    126 extern void s3c24xx_irqc_init(s3c24xx_irqc_t *, s3c24xx_irqc_regs_t *);
    127 extern unsigned s3c24xx_irqc_inum_get(s3c24xx_irqc_t *);
    128 extern void s3c24xx_irqc_clear(s3c24xx_irqc_t *, unsigned);
    129 extern void s3c24xx_irqc_src_enable(s3c24xx_irqc_t *, unsigned);
    130 extern void s3c24xx_irqc_src_disable(s3c24xx_irqc_t *, unsigned);
    131 extern void s3c24xx_irqc_subsrc_enable(s3c24xx_irqc_t *, unsigned);
    132 extern void s3c24xx_irqc_subsrc_disable(s3c24xx_irqc_t *, unsigned);
    133 
    134122#endif
    135123
  • kernel/genarch/include/drivers/s3c24xx_uart/s3c24xx_uart.h

    r571addd r5a9f4d7  
    3838#define KERN_S3C24XX_UART_H_
    3939
    40 #include <ddi/irq.h>
     40#include <typedefs.h>
    4141#include <console/chardev.h>
    42 #include <typedefs.h>
    4342
    44 /** S3C24xx UART I/O */
    45 typedef struct {
    46         uint32_t ulcon;
    47         uint32_t ucon;
    48         uint32_t ufcon;
    49         uint32_t umcon;
    50 
    51         uint32_t utrstat;
    52         uint32_t uerstat;
    53         uint32_t ufstat;
    54         uint32_t umstat;
    55 
    56         uint32_t utxh;
    57         uint32_t urxh;
    58 
    59         uint32_t ubrdiv;
    60 } s3c24xx_uart_io_t;
    61 
    62 /** S3C24xx UART instance */
    63 typedef struct {
    64         s3c24xx_uart_io_t *io;
    65         indev_t *indev;
    66         irq_t irq;
    67 } s3c24xx_uart_t;
    68 
    69 extern outdev_t *s3c24xx_uart_init(s3c24xx_uart_io_t *, inr_t inr);
    70 extern void s3c24xx_uart_input_wire(s3c24xx_uart_t *,
    71     indev_t *);
     43extern outdev_t *s3c24xx_uart_init(ioport8_t *);
    7244
    7345#endif
  • kernel/genarch/src/drivers/s3c24xx_uart/s3c24xx_uart.c

    r571addd r5a9f4d7  
    4040#include <genarch/drivers/s3c24xx_uart/s3c24xx_uart.h>
    4141#include <console/chardev.h>
    42 #include <console/console.h>
    43 #include <ddi/device.h>
    4442#include <arch/asm.h>
    4543#include <mm/slab.h>
     44#include <console/console.h>
    4645#include <sysinfo/sysinfo.h>
    4746#include <str.h>
    4847
    49 /* Bits in UTRSTAT register */
    50 #define S3C24XX_UTRSTAT_TX_EMPTY        0x4
    51 #define S3C24XX_UTRSTAT_RDATA           0x1
     48/** S3C24xx UART register offsets */
     49#define S3C24XX_UTRSTAT         0x10
     50#define S3C24XX_UTXH            0x20
    5251
    53 #define S3C24XX_UFSTAT_TX_FULL          0x4000
    54 #define S3C24XX_UFSTAT_RX_FULL          0x0040
    55 #define S3C24XX_UFSTAT_RX_COUNT         0x002f
     52/* Bits in UTXH register */
     53#define S3C24XX_UTXH_TX_EMPTY   0x4
     54
     55typedef struct {
     56        ioport8_t *base;
     57} s3c24xx_uart_instance_t;
    5658
    5759static void s3c24xx_uart_sendb(outdev_t *dev, uint8_t byte)
    5860{
    59         s3c24xx_uart_t *uart =
    60             (s3c24xx_uart_t *) dev->data;
     61        s3c24xx_uart_instance_t *instance =
     62            (s3c24xx_uart_instance_t *) dev->data;
     63        ioport32_t *utrstat, *utxh;
    6164
    62         /* Wait for space becoming available in Tx FIFO. */
    63         while ((pio_read_32(&uart->io->ufstat) & S3C24XX_UFSTAT_TX_FULL) != 0)
     65        utrstat = (ioport32_t *) (instance->base + S3C24XX_UTRSTAT);
     66        utxh = (ioport32_t *) (instance->base + S3C24XX_UTXH);
     67
     68        /* Wait for transmitter to be empty. */
     69        while ((pio_read_32(utrstat) & S3C24XX_UTXH_TX_EMPTY) == 0)
    6470                ;
    6571
    66         pio_write_32(&uart->io->utxh, byte);
     72        pio_write_32(utxh, byte);
    6773}
    6874
     
    8086}
    8187
    82 static irq_ownership_t s3c24xx_uart_claim(irq_t *irq)
    83 {
    84         return IRQ_ACCEPT;
    85 }
    86 
    87 static void s3c24xx_uart_irq_handler(irq_t *irq)
    88 {
    89         s3c24xx_uart_t *uart = irq->instance;
    90 
    91         while ((pio_read_32(&uart->io->ufstat) & S3C24XX_UFSTAT_RX_COUNT) != 0) {
    92                 uint32_t data = pio_read_32(&uart->io->urxh);
    93                 pio_read_32(&uart->io->uerstat);
    94                 indev_push_character(uart->indev, data & 0xff);
    95         }
    96 }
    97 
    9888static outdev_operations_t s3c24xx_uart_ops = {
    9989        .write = s3c24xx_uart_putchar,
     
    10191};
    10292
    103 outdev_t *s3c24xx_uart_init(s3c24xx_uart_io_t *io, inr_t inr)
     93outdev_t *s3c24xx_uart_init(ioport8_t *base)
    10494{
    10595        outdev_t *uart_dev = malloc(sizeof(outdev_t), FRAME_ATOMIC);
     
    10797                return NULL;
    10898
    109         s3c24xx_uart_t *uart =
    110             malloc(sizeof(s3c24xx_uart_t), FRAME_ATOMIC);
    111         if (!uart) {
     99        s3c24xx_uart_instance_t *instance =
     100            malloc(sizeof(s3c24xx_uart_instance_t), FRAME_ATOMIC);
     101        if (!instance) {
    112102                free(uart_dev);
    113103                return NULL;
     
    115105
    116106        outdev_initialize("s3c24xx_uart_dev", uart_dev, &s3c24xx_uart_ops);
    117         uart_dev->data = uart;
     107        uart_dev->data = instance;
    118108
    119         uart->io = io;
    120         uart->indev = NULL;
    121 
    122         /* Initialize IRQ structure. */
    123         irq_initialize(&uart->irq);
    124         uart->irq.devno = device_assign_devno();
    125         uart->irq.inr = inr;
    126         uart->irq.claim = s3c24xx_uart_claim;
    127         uart->irq.handler = s3c24xx_uart_irq_handler;
    128         uart->irq.instance = uart;
    129 
    130         /* Enable FIFO, Tx trigger level: empty, Rx trigger level: 1 byte. */
    131         pio_write_32(&uart->io->ufcon, 0x01);
    132 
    133         /* Set RX interrupt to pulse mode */
    134         pio_write_32(&uart->io->ucon,
    135             pio_read_32(&uart->io->ucon) & ~(1 << 8));
     109        instance->base = base;
    136110
    137111        if (!fb_exported) {
     
    142116                sysinfo_set_item_val("fb", NULL, true);
    143117                sysinfo_set_item_val("fb.kind", NULL, 3);
    144                 sysinfo_set_item_val("fb.address.physical", NULL, KA2PA(io));
     118                sysinfo_set_item_val("fb.address.physical", NULL, KA2PA(base));
    145119
    146120                fb_exported = true;
     
    150124}
    151125
    152 void s3c24xx_uart_input_wire(s3c24xx_uart_t *uart, indev_t *indev)
    153 {
    154         ASSERT(uart);
    155         ASSERT(indev);
    156 
    157         uart->indev = indev;
    158         irq_register(&uart->irq);
    159 }
    160 
    161126/** @}
    162127 */
  • uspace/Makefile

    r571addd r5a9f4d7  
    6969        srv/hid/kbd \
    7070        srv/hw/char/i8042 \
    71         srv/hw/char/s3c24xx_uart \
    7271        srv/hw/netif/dp8390 \
    7372        srv/net/cfg \
  • uspace/app/init/init.c

    r571addd r5a9f4d7  
    274274        srv_start("/srv/cuda_adb");
    275275        srv_start("/srv/i8042");
    276         srv_start("/srv/s3c24ser");
    277276        srv_start("/srv/adb_ms");
    278277        srv_start("/srv/char_ms");
  • uspace/srv/hid/kbd/Makefile

    r571addd r5a9f4d7  
    6060        ifeq ($(MACHINE),gta02)
    6161                SOURCES += \
    62                         port/chardev.c \
    63                         ctl/stty.c
     62                        port/dummy.c \
     63                        ctl/pc.c
    6464        endif
    6565        ifeq ($(MACHINE),testarm)
  • uspace/srv/hid/kbd/port/chardev.c

    r571addd r5a9f4d7  
    4141#include <kbd.h>
    4242#include <vfs/vfs.h>
    43 #include <sys/stat.h>
    4443#include <fcntl.h>
    4544#include <errno.h>
     
    5150#define NAME "kbd"
    5251
    53 /** List of devices to try connecting to. */
    54 static const char *in_devs[] = {
    55         "/dev/char/ps2a",
    56         "/dev/char/s3c24ser"
    57 };
    58 
    59 static const int num_devs = sizeof(in_devs) / sizeof(in_devs[0]);
    60 
    6152int kbd_port_init(void)
    6253{
     54        const char *input = "/dev/char/ps2a";
    6355        int input_fd;
    64         int i;
    6556
    66         input_fd = -1;
    67         for (i = 0; i < num_devs; i++) {
    68                 struct stat s;
     57        printf(NAME ": open %s\n", input);
    6958
    70                 if (stat(in_devs[i], &s) == EOK)
    71                         break;
    72         }
    73 
    74         if (i >= num_devs) {
    75                 printf(NAME ": Could not find any suitable input device.\n");
    76                 return -1;
    77         }
    78 
    79         input_fd = open(in_devs[i], O_RDONLY);
     59        input_fd = open(input, O_RDONLY);
    8060        if (input_fd < 0) {
    81                 printf(NAME ": failed opening device %s (%d).\n", in_devs[i],
    82                     input_fd);
    83                 return -1;
     61                printf(NAME ": Failed opening %s (%d)\n", input, input_fd);
     62                return false;
    8463        }
    8564
    8665        dev_phone = fd_phone(input_fd);
    8766        if (dev_phone < 0) {
    88                 printf(NAME ": Failed connecting to device\n");
    89                 return -1;
     67                printf(NAME ": Failed to connect to device\n");
     68                return false;
    9069        }
    9170
     
    9473        if (ipc_connect_to_me(dev_phone, 0, 0, 0, &phonehash) != 0) {
    9574                printf(NAME ": Failed to create callback from device\n");
    96                 return -1;
     75                return false;
    9776        }
    9877
Note: See TracChangeset for help on using the changeset viewer.