RTEMS 6.1-rc5
Loading...
Searching...
No Matches
pic.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
11/*
12 * Copyright (c) 2018 Amaan Cheval <amaan.cheval@gmail.com>
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
16 * are met:
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 */
35
36#ifndef _AMD64_PIC_H
37#define _AMD64_PIC_H
38
39#ifdef __cplusplus
40extern "C" {
41#endif
42
43#define PIC1 0x20 /* IO base address for master PIC */
44#define PIC2 0xA0 /* IO base address for slave PIC */
45#define PIC1_COMMAND PIC1
46#define PIC1_DATA (PIC1+1)
47#define PIC2_COMMAND PIC2
48#define PIC2_DATA (PIC2+1)
49
50/* reinitialize the PIC controllers, giving them specified vector offsets
51 rather than 8h and 70h, as configured by default */
52
53#define PIC_ICW1_ICW4 0x01 /* ICW4 (not) needed */
54#define PIC_ICW1_SINGLE 0x02 /* Single (cascade) mode */
55#define PIC_ICW1_INTERVAL4 0x04 /* Call address interval 4 (8) */
56#define PIC_ICW1_LEVEL 0x08 /* Level triggered (edge) mode */
57#define PIC_ICW1_INIT 0x10 /* Initialization - required! */
58
59#define PIC_ICW4_8086 0x01 /* 8086/88 (MCS-80/85) mode */
60#define PIC_ICW4_AUTO 0x02 /* Auto (normal) EOI */
61#define PIC_ICW4_BUF_SLAVE 0x08 /* Buffered mode/slave */
62#define PIC_ICW4_BUF_MASTER 0x0C /* Buffered mode/master */
63#define PIC_ICW4_SFNM 0x10 /* Special fully nested (not) */
64
65/* This remaps IRQ0 to vector number 0x20 and so on (i.e. IDT[32]) */
66#define PIC1_REMAP_DEST 0x20
67#define PIC2_REMAP_DEST 0x28
68
69/* Remap PIC1's interrupts to offset1 and PIC2's to offset2 */
70void pic_remap(uint8_t offset1, uint8_t offset2);
71
78void pic_disable(void);
79
80#ifdef __cplusplus
81}
82#endif
83
84#endif /* _AMD64_PIC_H */
void pic_disable(void)
Definition: pic.c:80