5fe1cf03fa62d8bcf4bbab602547954852eb0cc2
[gem5.git] / dev / pitreg.h
1 /*
2 * Copyright (c) 2001-2005 The Regents of The University of Michigan
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 are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * 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
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29 /* @file
30 * Device register definitions for a device's PCI config space
31 */
32
33 #ifndef __PITREG_H__
34 #define __PITREG_H__
35
36 #include <sys/types.h>
37
38 // Control Word Format
39
40 #define PIT_SEL_SHFT 0x6
41 #define PIT_RW_SHFT 0x4
42 #define PIT_MODE_SHFT 0x1
43 #define PIT_BCD_SHFT 0x0
44
45 #define PIT_SEL_MASK 0x3
46 #define PIT_RW_MASK 0x3
47 #define PIT_MODE_MASK 0x7
48 #define PIT_BCD_MASK 0x1
49
50 #define GET_CTRL_FIELD(x, s, m) (((x) >> s) & m)
51 #define GET_CTRL_SEL(x) GET_CTRL_FIELD(x, PIT_SEL_SHFT, PIT_SEL_MASK)
52 #define GET_CTRL_RW(x) GET_CTRL_FIELD(x, PIT_RW_SHFT, PIT_RW_MASK)
53 #define GET_CTRL_MODE(x) GET_CTRL_FIELD(x, PIT_MODE_SHFT, PIT_MODE_MASK)
54 #define GET_CTRL_BCD(x) GET_CTRL_FIELD(x, PIT_BCD_SHFT, PIT_BCD_MASK)
55
56 #define PIT_READ_BACK 0x3
57
58 #define PIT_RW_LATCH_COMMAND 0x0
59 #define PIT_RW_LSB_ONLY 0x1
60 #define PIT_RW_MSB_ONLY 0x2
61 #define PIT_RW_16BIT 0x3
62
63 #define PIT_MODE_INTTC 0x0
64 #define PIT_MODE_ONESHOT 0x1
65 #define PIT_MODE_RATEGEN 0x2
66 #define PIT_MODE_SQWAVE 0x3
67 #define PIT_MODE_SWSTROBE 0x4
68 #define PIT_MODE_HWSTROBE 0x5
69
70 #define PIT_BCD_FALSE 0x0
71 #define PIT_BCD_TRUE 0x1
72
73 #endif // __PITREG_H__