source: mainline/uspace/drv/char/i8042/i8042.h@ 5fd05862

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 5fd05862 was c8ea6eca, checked in by Jakub Jermar <jakub@…>, 7 years ago

Improve doxygen documentation

  • Property mode set to 100644
File size: 2.6 KB
Line 
1/*
2 * Copyright (c) 2006 Josef Cejka
3 * Copyright (c) 2011 Jan Vesely
4 * Copyright (c) 2017 Jiri Svoboda
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * - Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * - Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * - The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31/** @addtogroup i8042
32 * @{
33 */
34
35/** @file
36 * @brief i8042 port driver.
37 */
38
39#ifndef i8042_H_
40#define i8042_H_
41
42#include <adt/circ_buf.h>
43#include <io/chardev_srv.h>
44#include <ddi.h>
45#include <fibril_synch.h>
46#include <ddf/driver.h>
47
48#define NAME "i8042"
49
50#define BUFFER_SIZE 12
51
52/** i8042 HW I/O interface */
53typedef struct {
54 ioport8_t data;
55 uint8_t pad[3];
56 ioport8_t status;
57} __attribute__((packed)) i8042_regs_t;
58
59/** i8042 Port. */
60typedef struct {
61 /** Controller */
62 struct i8042 *ctl;
63 /** Device function */
64 ddf_fun_t *fun;
65 /** Character device server data */
66 chardev_srvs_t cds;
67 /** Circular buffer */
68 circ_buf_t cbuf;
69 /** Buffer data space */
70 uint8_t buf_data[BUFFER_SIZE];
71 /** Protect buffer */
72 fibril_mutex_t buf_lock;
73 /** Signal new data in buffer */
74 fibril_condvar_t buf_cv;
75} i8042_port_t;
76
77/** i8042 Controller. */
78typedef struct i8042 {
79 /**< I/O registers. */
80 i8042_regs_t *regs;
81 /** Keyboard port */
82 i8042_port_t *kbd;
83 /** AUX port */
84 i8042_port_t *aux;
85 /** Prevents simultanous port writes.*/
86 fibril_mutex_t write_guard;
87} i8042_t;
88
89extern errno_t i8042_init(i8042_t *, addr_range_t *, int, int, ddf_dev_t *);
90
91#endif
92
93/**
94 * @}
95 */
Note: See TracBrowser for help on using the repository browser.