2015-04-11 07:44:37 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2010-2015 Wind River Systems, Inc.
|
|
|
|
*
|
2015-10-07 00:00:37 +08:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
2015-04-11 07:44:37 +08:00
|
|
|
*
|
2015-10-07 00:00:37 +08:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2015-04-11 07:44:37 +08:00
|
|
|
*
|
2015-10-07 00:00:37 +08:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
2015-04-11 07:44:37 +08:00
|
|
|
*/
|
|
|
|
|
2015-12-04 23:09:39 +08:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* @brief Disable Intel 8259A PIC (Programmable Interrupt Controller)
|
|
|
|
*
|
2015-10-21 00:42:33 +08:00
|
|
|
* This module disables the Intel 8259A PIC (Programmable Interrupt Controller)
|
|
|
|
* to prevent it from generating spurious interrupts.
|
|
|
|
*/
|
2015-04-11 07:44:37 +08:00
|
|
|
|
|
|
|
|
2016-12-05 04:59:37 +08:00
|
|
|
#include <kernel.h>
|
2015-05-29 01:56:47 +08:00
|
|
|
#include <arch/cpu.h>
|
2015-04-11 07:44:37 +08:00
|
|
|
#include <toolchain.h>
|
|
|
|
#include <sections.h>
|
2015-09-16 00:17:38 +08:00
|
|
|
#include <device.h>
|
2015-12-09 03:17:56 +08:00
|
|
|
#include <init.h>
|
2015-04-11 07:44:37 +08:00
|
|
|
|
|
|
|
#include <board.h>
|
|
|
|
|
2015-12-09 03:17:56 +08:00
|
|
|
/* programmable interrupt controller info (pair of cascaded 8259A devices) */
|
|
|
|
#define PIC_MASTER_BASE_ADRS 0x20
|
|
|
|
#define PIC_SLAVE_BASE_ADRS 0xa0
|
|
|
|
#define PIC_REG_ADDR_INTERVAL 1
|
|
|
|
|
|
|
|
/* register definitions */
|
|
|
|
#define PIC_ADRS(baseAdrs, reg) (baseAdrs + (reg * PIC_REG_ADDR_INTERVAL))
|
|
|
|
|
|
|
|
#define PIC_PORT2(base) PIC_ADRS(base, 0x01) /* port 2 */
|
|
|
|
|
2015-07-25 01:46:21 +08:00
|
|
|
#define PIC_DISABLE 0xff /* Disable PIC command */
|
2015-04-11 07:44:37 +08:00
|
|
|
|
2015-07-25 01:46:21 +08:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @brief Initialize the Intel 8259A PIC device driver
|
|
|
|
*
|
|
|
|
* This routine disables the 8259A PIC device to prevent it from
|
|
|
|
* generating spurious interrupts.
|
|
|
|
*
|
|
|
|
* @return N/A
|
|
|
|
*/
|
|
|
|
|
2015-09-16 00:17:38 +08:00
|
|
|
int _i8259_init(struct device *unused)
|
2015-07-25 01:46:21 +08:00
|
|
|
{
|
2015-09-16 00:17:38 +08:00
|
|
|
ARG_UNUSED(unused);
|
2015-09-10 23:37:53 +08:00
|
|
|
sys_out8(PIC_DISABLE, PIC_PORT2(PIC_SLAVE_BASE_ADRS));
|
|
|
|
sys_out8(PIC_DISABLE, PIC_PORT2(PIC_MASTER_BASE_ADRS));
|
2015-09-16 00:17:38 +08:00
|
|
|
return 0;
|
2015-07-25 01:46:21 +08:00
|
|
|
}
|
2015-12-09 03:17:56 +08:00
|
|
|
|
2016-11-09 03:06:55 +08:00
|
|
|
SYS_INIT(_i8259_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
|