74 lines
2.9 KiB
C
74 lines
2.9 KiB
C
/*
|
|
|
|
Part of the Raspberry-Pi Bare Metal Tutorials
|
|
Copyright (c) 2013, Brian Sidebotham
|
|
All rights reserved.
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
|
modification, are permitted provided that the following conditions are met:
|
|
|
|
1. Redistributions of source code must retain the above copyright notice,
|
|
this list of conditions and the following disclaimer.
|
|
|
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
this list of conditions and the following disclaimer in the
|
|
documentation and/or other materials provided with the distribution.
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
#ifndef RPI_INTERRUPTS_H
|
|
#define RPI_INTERRUPTS_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "rpi-base.h"
|
|
|
|
/** @brief See Section 7.5 of the BCM2836 ARM Peripherals documentation, the base
|
|
address of the controller is actually xxxxB000, but there is a 0x200 offset
|
|
to the first addressable register for the interrupt controller, so offset the
|
|
base to the first register */
|
|
#define RPI_INTERRUPT_CONTROLLER_BASE ( PERIPHERAL_BASE + 0xB200 )
|
|
|
|
/** @brief Bits in the Enable_Basic_IRQs register to enable various interrupts.
|
|
See the BCM2835 ARM Peripherals manual, section 7.5 */
|
|
#define RPI_BASIC_ARM_TIMER_IRQ (1 << 0)
|
|
#define RPI_BASIC_ARM_MAILBOX_IRQ (1 << 1)
|
|
#define RPI_BASIC_ARM_DOORBELL_0_IRQ (1 << 2)
|
|
#define RPI_BASIC_ARM_DOORBELL_1_IRQ (1 << 3)
|
|
#define RPI_BASIC_GPU_0_HALTED_IRQ (1 << 4)
|
|
#define RPI_BASIC_GPU_1_HALTED_IRQ (1 << 5)
|
|
#define RPI_BASIC_ACCESS_ERROR_1_IRQ (1 << 6)
|
|
#define RPI_BASIC_ACCESS_ERROR_0_IRQ (1 << 7)
|
|
|
|
|
|
/** @brief The interrupt controller memory mapped register set */
|
|
typedef struct {
|
|
volatile uint32_t IRQ_basic_pending;
|
|
volatile uint32_t IRQ_pending_1;
|
|
volatile uint32_t IRQ_pending_2;
|
|
volatile uint32_t FIQ_control;
|
|
volatile uint32_t Enable_IRQs_1;
|
|
volatile uint32_t Enable_IRQs_2;
|
|
volatile uint32_t Enable_Basic_IRQs;
|
|
volatile uint32_t Disable_IRQs_1;
|
|
volatile uint32_t Disable_IRQs_2;
|
|
volatile uint32_t Disable_Basic_IRQs;
|
|
} rpi_irq_controller_t;
|
|
|
|
extern rpi_irq_controller_t* RPI_GetIrqController( void );
|
|
|
|
extern void reboot_now(void);
|
|
|
|
#endif
|