source: mainline/kernel/genarch/include/genarch/drivers/pl050/pl050.h

Last change on this file was 6404aca, checked in by Jakub Jermar <jakub@…>, 7 years ago

Disambiguate doxygroup genarch*

  • Property mode set to 100644
File size: 3.3 KB
Line 
1/*
2 * Copyright (c) 2009 Vineeth Pillai
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup kernel_genarch
30 * @{
31 */
32/** @file
33 * @brief Describes the pl050 keyboard/mouse controller
34 */
35
36/**
37 * This file implements pl050 specific functions for keyboard and mouse
38 */
39
40#ifndef KERN_genarch_PL050_H
41#define KERN_genarch_PL050_H
42
43#include <ddi/irq.h>
44#include <console/chardev.h>
45#include <typedefs.h>
46
47/*
48 * pl050 register offsets from the base address
49 */
50#define PL050_CR 0x00
51#define PL050_STAT 0x04
52#define PL050_DATA 0x08
53#define PL050_CLOCKDIV 0x0C
54#define PL050_INTRSTAT 0x10
55
56/*
57 * Control Register Bits
58 */
59#define PL050_CR_TYPE (1 << 5) /* Type 0: PS2/AT mode, 1: No Line control bit mode */
60#define PL050_CR_RXINTR (1 << 4) /* Recieve Interrupt Enable */
61#define PL050_CR_TXINTR (1 << 3) /* Transmit Interrupt Enable */
62#define PL050_CR_INTR (1 << 2) /* Interrupt Enable */
63#define PL050_CR_FKMID (1 << 1) /* Force KMI Data Low */
64#define PL050_CR_FKMIC 1 /* Force KMI Clock Low */
65
66/*
67 * Status register bits
68 */
69#define PL050_STAT_TXEMPTY (1 << 6) /* 1: Transmit register empty */
70#define PL050_STAT_TXBUSY (1 << 5) /* 1: Busy, sending data */
71#define PL050_STAT_RXFULL (1 << 4) /* 1: register Full */
72#define PL050_STAT_RXBUSY (1 << 3) /* 1: Busy, recieving Data */
73#define PL050_STAT_RXPARITY (1 << 2) /* odd parity of the last bit received */
74#define PL050_STAT_KMIC (1 << 1) /* status of KMICLKIN */
75#define PL050_STAT_KMID 1 /* status of KMIDATAIN */
76
77/*
78 * Interrupt status register bits.
79 */
80#define PL050_TX_INTRSTAT (1 << 1) /* Transmit intr asserted */
81#define PL050_RX_INTRSTAT 1 /* Recieve intr asserted */
82
83typedef struct {
84 ioport8_t *base;
85 ioport8_t *data;
86 ioport8_t *status;
87 ioport8_t *ctrl;
88} pl050_t;
89
90typedef struct {
91 irq_t irq;
92 pl050_t *pl050;
93 indev_t *kbrdin;
94} pl050_instance_t;
95
96extern pl050_instance_t *pl050_init(pl050_t *, inr_t);
97extern void pl050_wire(pl050_instance_t *, indev_t *);
98
99#endif
100
101/** @}
102 */
Note: See TracBrowser for help on using the repository browser.