Changeset 676e833 in mainline for uspace/drv/char/msim-con/msim-con.h


Ignore:
Timestamp:
2017-11-10T14:15:41Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ee98e81
Parents:
7654f3e
Message:

Move receiving side of Msim console to a separate driver. Work around possibility that console character device is not available at the moment input server starts.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/drv/char/msim-con/msim-con.h

    r7654f3e r676e833  
    11/*
    2  * Copyright (c) 2006 Josef Cejka
    3  * Copyright (c) 2011 Jiri Svoboda
     2 * Copyright (c) 2017 Jiri Svoboda
    43 * All rights reserved.
    54 *
     
    2827 */
    2928
    30 /** @addtogroup kbd_port
    31  * @ingroup  kbd
     29/** @addtogroup genarch
    3230 * @{
    3331 */
    3432/** @file
    35  * @brief Msim keyboard port driver.
    3633 */
    3734
     35#ifndef MSIM_CON_H
     36#define MSIM_CON_H
     37
    3838#include <async.h>
    39 #include <sysinfo.h>
    40 #include <ddi.h>
    41 #include <errno.h>
    42 #include "../kbd_port.h"
    43 #include "../kbd.h"
     39#include <ddf/driver.h>
     40#include <loc.h>
     41#include <stdint.h>
    4442
    45 static int msim_port_init(kbd_dev_t *);
    46 static void msim_port_write(uint8_t data);
     43/** MSIM console */
     44typedef struct {
     45        async_sess_t *client_sess;
     46        ddf_dev_t *dev;
     47} msim_con_t;
    4748
    48 kbd_port_ops_t msim_port = {
    49         .init = msim_port_init,
    50         .write = msim_port_write
    51 };
     49extern int msim_con_init(msim_con_t *);
     50extern void msim_con_write(uint8_t data);
    5251
    53 static kbd_dev_t *kbd_dev;
    5452
    55 static irq_pio_range_t msim_ranges[] = {
    56         {
    57                 .base = 0,
    58                 .size = 1
    59         }
    60 };
     53extern int msim_con_add(msim_con_t *);
     54extern int msim_con_remove(msim_con_t *);
     55extern int msim_con_gone(msim_con_t *);
    6156
    62 static irq_cmd_t msim_cmds[] = {
    63         {
    64                 .cmd = CMD_PIO_READ_8,
    65                 .addr = (void *) 0,     /* will be patched in run-time */
    66                 .dstarg = 2
    67         },
    68         {
    69                 .cmd = CMD_ACCEPT
    70         }
    71 };
    72 
    73 static irq_code_t msim_kbd = {
    74         sizeof(msim_ranges) / sizeof(irq_pio_range_t),
    75         msim_ranges,
    76         sizeof(msim_cmds) / sizeof(irq_cmd_t),
    77         msim_cmds
    78 };
    79 
    80 static void msim_irq_handler(ipc_callid_t iid, ipc_call_t *call, void *arg)
    81 {
    82         kbd_push_data(kbd_dev, IPC_GET_ARG2(*call));
    83 }
    84 
    85 static int msim_port_init(kbd_dev_t *kdev)
    86 {
    87         kbd_dev = kdev;
    88 
    89         sysarg_t paddr;
    90         if (sysinfo_get_value("kbd.address.physical", &paddr) != EOK)
    91                 return -1;
    92        
    93         sysarg_t inr;
    94         if (sysinfo_get_value("kbd.inr", &inr) != EOK)
    95                 return -1;
    96        
    97         msim_ranges[0].base = paddr;
    98         msim_cmds[0].addr = (void *) paddr;
    99         async_irq_subscribe(inr, msim_irq_handler, NULL, &msim_kbd);
    100        
    101         return 0;
    102 }
    103 
    104 static void msim_port_write(uint8_t data)
    105 {
    106         (void) data;
    107 }
     57#endif
    10858
    10959/** @}
Note: See TracChangeset for help on using the changeset viewer.