2014-07-09 12:03:17 +02:00
|
|
|
/*
|
|
|
|
* \brief Programmable interrupt controller for core
|
|
|
|
* \author Stefan Kalkowski
|
|
|
|
* \date 2012-10-24
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2012-2013 Genode Labs GmbH
|
|
|
|
*
|
|
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
|
|
* under the terms of the GNU General Public License version 2.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* core includes */
|
|
|
|
#include <pic.h>
|
|
|
|
|
|
|
|
using namespace Genode;
|
|
|
|
|
2015-02-09 11:36:38 +01:00
|
|
|
void Pic::_init()
|
2014-07-09 12:03:17 +02:00
|
|
|
{
|
|
|
|
/* disable device */
|
|
|
|
_distr.write<Distr::Ctlr::Enable>(0);
|
|
|
|
|
|
|
|
/* configure every shared peripheral interrupt */
|
2014-08-08 14:38:27 +02:00
|
|
|
for (unsigned i = min_spi; i <= _max_irq; i++) {
|
2014-07-09 12:03:17 +02:00
|
|
|
_distr.write<Distr::Icfgr::Edge_triggered>(0, i);
|
2014-08-08 14:38:27 +02:00
|
|
|
_distr.write<Distr::Ipriorityr::Priority>(0, i);
|
2015-04-03 17:22:16 +02:00
|
|
|
_distr.write<Distr::Icenabler::Clear_enable>(1, i);
|
2014-07-09 12:03:17 +02:00
|
|
|
}
|
|
|
|
/* enable device */
|
|
|
|
_distr.write<Distr::Ctlr::Enable>(1);
|
|
|
|
}
|
2015-02-09 11:36:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
void Pic::init_cpu_local()
|
|
|
|
{
|
|
|
|
/* disable the priority filter */
|
|
|
|
_cpui.write<Cpui::Pmr::Priority>(_distr.min_priority());
|
|
|
|
|
|
|
|
/* disable preemption of IRQ handling by other IRQs */
|
|
|
|
_cpui.write<Cpui::Bpr::Binary_point>(~0);
|
|
|
|
|
|
|
|
/* enable device */
|
|
|
|
_cpui.write<Cpui::Ctlr::Enable>(1);
|
|
|
|
}
|