Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset a9b5b5f in mainline


Ignore:
Timestamp:
2010-07-27T19:00:20Z (11 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master
Children:
3d9d948
Parents:
ecf083dd
Message:

Userspace S3C24xx UART driver. Use for kbd input from gta02 serial console.

Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • boot/arch/arm32/Makefile.inc

    recf083dd ra9b5b5f  
    4141PAGE_SIZE = 4096
    4242
    43 RD_SRVS_ESSENTIAL +=
     43RD_SRVS_ESSENTIAL += \
     44        $(USPACE_PATH)/srv/hw/char/s3c24xx_uart/s3c24ser
    4445
    4546RD_SRVS_NON_ESSENTIAL += \
  • kernel/arch/arm32/src/mach/gta02/gta02.c

    recf083dd ra9b5b5f  
    4444#include <genarch/drivers/s3c24xx_timer/s3c24xx_timer.h>
    4545#include <genarch/srln/srln.h>
     46#include <sysinfo/sysinfo.h>
    4647#include <interrupt.h>
    4748#include <ddi/ddi.h>
     
    185186                stdout_wire(gta02_scons_dev);
    186187        }
     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
    187198}
    188199
  • uspace/Makefile

    recf083dd ra9b5b5f  
    6969        srv/hid/kbd \
    7070        srv/hw/char/i8042 \
     71        srv/hw/char/s3c24xx_uart \
    7172        srv/hw/netif/dp8390 \
    7273        srv/net/cfg \
  • uspace/app/init/init.c

    recf083dd ra9b5b5f  
    274274        srv_start("/srv/cuda_adb");
    275275        srv_start("/srv/i8042");
     276        srv_start("/srv/s3c24ser");
    276277        srv_start("/srv/adb_ms");
    277278        srv_start("/srv/char_ms");
  • uspace/srv/hid/kbd/Makefile

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

    recf083dd ra9b5b5f  
    4141#include <kbd.h>
    4242#include <vfs/vfs.h>
     43#include <sys/stat.h>
    4344#include <fcntl.h>
    4445#include <errno.h>
     
    5051#define NAME "kbd"
    5152
     53/** List of devices to try connecting to. */
     54static const char *in_devs[] = {
     55        "/dev/char/ps2a",
     56        "/dev/char/s3c24ser"
     57};
     58
     59static const int num_devs = sizeof(in_devs) / sizeof(in_devs[0]);
     60
    5261int kbd_port_init(void)
    5362{
    54         const char *input = "/dev/char/ps2a";
    5563        int input_fd;
     64        int i;
    5665
    57         printf(NAME ": open %s\n", input);
     66        input_fd = -1;
     67        for (i = 0; i < num_devs; i++) {
     68                struct stat s;
    5869
    59         input_fd = open(input, O_RDONLY);
     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);
    6080        if (input_fd < 0) {
    61                 printf(NAME ": Failed opening %s (%d)\n", input, input_fd);
    62                 return false;
     81                printf(NAME ": failed opening device %s (%d).\n", in_devs[i],
     82                    input_fd);
     83                return -1;
    6384        }
    6485
    6586        dev_phone = fd_phone(input_fd);
    6687        if (dev_phone < 0) {
    67                 printf(NAME ": Failed to connect to device\n");
    68                 return false;
     88                printf(NAME ": Failed connecting to device\n");
     89                return -1;
    6990        }
    7091
     
    7394        if (ipc_connect_to_me(dev_phone, 0, 0, 0, &phonehash) != 0) {
    7495                printf(NAME ": Failed to create callback from device\n");
    75                 return false;
     96                return -1;
    7697        }
    7798
Note: See TracChangeset for help on using the changeset viewer.