Changeset 676e833 in mainline for uspace/drv/char/msim-con/msim-con.h
- Timestamp:
- 2017-11-10T14:15:41Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ee98e81
- Parents:
- 7654f3e
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/char/msim-con/msim-con.h
r7654f3e r676e833 1 1 /* 2 * Copyright (c) 2006 Josef Cejka 3 * Copyright (c) 2011 Jiri Svoboda 2 * Copyright (c) 2017 Jiri Svoboda 4 3 * All rights reserved. 5 4 * … … 28 27 */ 29 28 30 /** @addtogroup kbd_port 31 * @ingroup kbd 29 /** @addtogroup genarch 32 30 * @{ 33 31 */ 34 32 /** @file 35 * @brief Msim keyboard port driver.36 33 */ 37 34 35 #ifndef MSIM_CON_H 36 #define MSIM_CON_H 37 38 38 #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> 44 42 45 static int msim_port_init(kbd_dev_t *); 46 static void msim_port_write(uint8_t data); 43 /** MSIM console */ 44 typedef struct { 45 async_sess_t *client_sess; 46 ddf_dev_t *dev; 47 } msim_con_t; 47 48 48 kbd_port_ops_t msim_port = { 49 .init = msim_port_init, 50 .write = msim_port_write 51 }; 49 extern int msim_con_init(msim_con_t *); 50 extern void msim_con_write(uint8_t data); 52 51 53 static kbd_dev_t *kbd_dev;54 52 55 static irq_pio_range_t msim_ranges[] = { 56 { 57 .base = 0, 58 .size = 1 59 } 60 }; 53 extern int msim_con_add(msim_con_t *); 54 extern int msim_con_remove(msim_con_t *); 55 extern int msim_con_gone(msim_con_t *); 61 56 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 108 58 109 59 /** @}
Note:
See TracChangeset
for help on using the changeset viewer.