/* Coldfire C Header File
 * Copyright Freescale Semiconductor Inc
 * All rights reserved.
 *
 * 2008/05/23 Revision: 0.81
 *
 * (c) Copyright UNIS, a.s. 1997-2008
 * UNIS, a.s.
 * Jundrovska 33
 * 624 00 Brno
 * Czech Republic
 * http      : www.processorexpert.com
 * mail      : info@processorexpert.com
 */

#ifndef __MCF5475_INTC_H__
#define __MCF5475_INTC_H__


/*********************************************************************
*
* Interrupt Controller (INTC)
*
*********************************************************************/

/* Register read/write macros */
#define MCF_INTC_IPRH                        (*(volatile uint32_t*)(&_MBAR[0x700]))
#define MCF_INTC_IPRL                        (*(volatile uint32_t*)(&_MBAR[0x704]))
#define MCF_INTC_IMRH                        (*(volatile uint32_t*)(&_MBAR[0x708]))
#define MCF_INTC_IMRL                        (*(volatile uint32_t*)(&_MBAR[0x70C]))
#define MCF_INTC_INTFRCH                     (*(volatile uint32_t*)(&_MBAR[0x710]))
#define MCF_INTC_INTFRCL                     (*(volatile uint32_t*)(&_MBAR[0x714]))
#define MCF_INTC_IRLR                        (*(volatile uint8_t *)(&_MBAR[0x718]))
#define MCF_INTC_IACKLPR                     (*(volatile uint8_t *)(&_MBAR[0x719]))
#define MCF_INTC_ICR01                       (*(volatile uint8_t *)(&_MBAR[0x741]))
#define MCF_INTC_ICR02                       (*(volatile uint8_t *)(&_MBAR[0x742]))
#define MCF_INTC_ICR03                       (*(volatile uint8_t *)(&_MBAR[0x743]))
#define MCF_INTC_ICR04                       (*(volatile uint8_t *)(&_MBAR[0x744]))
#define MCF_INTC_ICR05                       (*(volatile uint8_t *)(&_MBAR[0x745]))
#define MCF_INTC_ICR06                       (*(volatile uint8_t *)(&_MBAR[0x746]))
#define MCF_INTC_ICR07                       (*(volatile uint8_t *)(&_MBAR[0x747]))
#define MCF_INTC_ICR08                       (*(volatile uint8_t *)(&_MBAR[0x748]))
#define MCF_INTC_ICR09                       (*(volatile uint8_t *)(&_MBAR[0x749]))
#define MCF_INTC_ICR10                       (*(volatile uint8_t *)(&_MBAR[0x74A]))
#define MCF_INTC_ICR11                       (*(volatile uint8_t *)(&_MBAR[0x74B]))
#define MCF_INTC_ICR12                       (*(volatile uint8_t *)(&_MBAR[0x74C]))
#define MCF_INTC_ICR13                       (*(volatile uint8_t *)(&_MBAR[0x74D]))
#define MCF_INTC_ICR14                       (*(volatile uint8_t *)(&_MBAR[0x74E]))
#define MCF_INTC_ICR15                       (*(volatile uint8_t *)(&_MBAR[0x74F]))
#define MCF_INTC_ICR16                       (*(volatile uint8_t *)(&_MBAR[0x750]))
#define MCF_INTC_ICR17                       (*(volatile uint8_t *)(&_MBAR[0x751]))
#define MCF_INTC_ICR18                       (*(volatile uint8_t *)(&_MBAR[0x752]))
#define MCF_INTC_ICR19                       (*(volatile uint8_t *)(&_MBAR[0x753]))
#define MCF_INTC_ICR20                       (*(volatile uint8_t *)(&_MBAR[0x754]))
#define MCF_INTC_ICR21                       (*(volatile uint8_t *)(&_MBAR[0x755]))
#define MCF_INTC_ICR22                       (*(volatile uint8_t *)(&_MBAR[0x756]))
#define MCF_INTC_ICR23                       (*(volatile uint8_t *)(&_MBAR[0x757]))
#define MCF_INTC_ICR24                       (*(volatile uint8_t *)(&_MBAR[0x758]))
#define MCF_INTC_ICR25                       (*(volatile uint8_t *)(&_MBAR[0x759]))
#define MCF_INTC_ICR26                       (*(volatile uint8_t *)(&_MBAR[0x75A]))
#define MCF_INTC_ICR27                       (*(volatile uint8_t *)(&_MBAR[0x75B]))
#define MCF_INTC_ICR28                       (*(volatile uint8_t *)(&_MBAR[0x75C]))
#define MCF_INTC_ICR29                       (*(volatile uint8_t *)(&_MBAR[0x75D]))
#define MCF_INTC_ICR30                       (*(volatile uint8_t *)(&_MBAR[0x75E]))
#define MCF_INTC_ICR31                       (*(volatile uint8_t *)(&_MBAR[0x75F]))
#define MCF_INTC_ICR32                       (*(volatile uint8_t *)(&_MBAR[0x760]))
#define MCF_INTC_ICR33                       (*(volatile uint8_t *)(&_MBAR[0x761]))
#define MCF_INTC_ICR34                       (*(volatile uint8_t *)(&_MBAR[0x762]))
#define MCF_INTC_ICR35                       (*(volatile uint8_t *)(&_MBAR[0x763]))
#define MCF_INTC_ICR36                       (*(volatile uint8_t *)(&_MBAR[0x764]))
#define MCF_INTC_ICR37                       (*(volatile uint8_t *)(&_MBAR[0x765]))
#define MCF_INTC_ICR38                       (*(volatile uint8_t *)(&_MBAR[0x766]))
#define MCF_INTC_ICR39                       (*(volatile uint8_t *)(&_MBAR[0x767]))
#define MCF_INTC_ICR40                       (*(volatile uint8_t *)(&_MBAR[0x768]))
#define MCF_INTC_ICR41                       (*(volatile uint8_t *)(&_MBAR[0x769]))
#define MCF_INTC_ICR42                       (*(volatile uint8_t *)(&_MBAR[0x76A]))
#define MCF_INTC_ICR43                       (*(volatile uint8_t *)(&_MBAR[0x76B]))
#define MCF_INTC_ICR44                       (*(volatile uint8_t *)(&_MBAR[0x76C]))
#define MCF_INTC_ICR45                       (*(volatile uint8_t *)(&_MBAR[0x76D]))
#define MCF_INTC_ICR46                       (*(volatile uint8_t *)(&_MBAR[0x76E]))
#define MCF_INTC_ICR47                       (*(volatile uint8_t *)(&_MBAR[0x76F]))
#define MCF_INTC_ICR48                       (*(volatile uint8_t *)(&_MBAR[0x770]))
#define MCF_INTC_ICR49                       (*(volatile uint8_t *)(&_MBAR[0x771]))
#define MCF_INTC_ICR50                       (*(volatile uint8_t *)(&_MBAR[0x772]))
#define MCF_INTC_ICR51                       (*(volatile uint8_t *)(&_MBAR[0x773]))
#define MCF_INTC_ICR52                       (*(volatile uint8_t *)(&_MBAR[0x774]))
#define MCF_INTC_ICR53                       (*(volatile uint8_t *)(&_MBAR[0x775]))
#define MCF_INTC_ICR54                       (*(volatile uint8_t *)(&_MBAR[0x776]))
#define MCF_INTC_ICR55                       (*(volatile uint8_t *)(&_MBAR[0x777]))
#define MCF_INTC_ICR56                       (*(volatile uint8_t *)(&_MBAR[0x778]))
#define MCF_INTC_ICR57                       (*(volatile uint8_t *)(&_MBAR[0x779]))
#define MCF_INTC_ICR58                       (*(volatile uint8_t *)(&_MBAR[0x77A]))
#define MCF_INTC_ICR59                       (*(volatile uint8_t *)(&_MBAR[0x77B]))
#define MCF_INTC_ICR60                       (*(volatile uint8_t *)(&_MBAR[0x77C]))
#define MCF_INTC_ICR61                       (*(volatile uint8_t *)(&_MBAR[0x77D]))
#define MCF_INTC_ICR62                       (*(volatile uint8_t *)(&_MBAR[0x77E]))
#define MCF_INTC_ICR63                       (*(volatile uint8_t *)(&_MBAR[0x77F]))
#define MCF_INTC_SWIACK                      (*(volatile uint8_t *)(&_MBAR[0x7E0]))
#define MCF_INTC_L1IACK                      (*(volatile uint8_t *)(&_MBAR[0x7E4]))
#define MCF_INTC_L2IACK                      (*(volatile uint8_t *)(&_MBAR[0x7E8]))
#define MCF_INTC_L3IACK                      (*(volatile uint8_t *)(&_MBAR[0x7EC]))
#define MCF_INTC_L4IACK                      (*(volatile uint8_t *)(&_MBAR[0x7F0]))
#define MCF_INTC_L5IACK                      (*(volatile uint8_t *)(&_MBAR[0x7F4]))
#define MCF_INTC_L6IACK                      (*(volatile uint8_t *)(&_MBAR[0x7F8]))
#define MCF_INTC_L7IACK                      (*(volatile uint8_t *)(&_MBAR[0x7FC]))
#define MCF_INTC_ICR(x)                      (*(volatile uint8_t *)(&_MBAR[0x741 + ((x-1)*0x1)]))
#define MCF_INTC_LIACK(x)                    (*(volatile uint8_t *)(&_MBAR[0x7E4 + ((x-1)*0x4)]))



/* Bit definitions and macros for MCF_INTC_IPRH */
#define MCF_INTC_IPRH_INT32                  (0x1)
#define MCF_INTC_IPRH_INT33                  (0x2)
#define MCF_INTC_IPRH_INT34                  (0x4)
#define MCF_INTC_IPRH_INT35                  (0x8)
#define MCF_INTC_IPRH_INT36                  (0x10)
#define MCF_INTC_IPRH_INT37                  (0x20)
#define MCF_INTC_IPRH_INT38                  (0x40)
#define MCF_INTC_IPRH_INT39                  (0x80)
#define MCF_INTC_IPRH_INT40                  (0x100)
#define MCF_INTC_IPRH_INT41                  (0x200)
#define MCF_INTC_IPRH_INT42                  (0x400)
#define MCF_INTC_IPRH_INT43                  (0x800)
#define MCF_INTC_IPRH_INT44                  (0x1000)
#define MCF_INTC_IPRH_INT45                  (0x2000)
#define MCF_INTC_IPRH_INT46                  (0x4000)
#define MCF_INTC_IPRH_INT47                  (0x8000)
#define MCF_INTC_IPRH_INT48                  (0x10000)
#define MCF_INTC_IPRH_INT49                  (0x20000)
#define MCF_INTC_IPRH_INT50                  (0x40000)
#define MCF_INTC_IPRH_INT51                  (0x80000)
#define MCF_INTC_IPRH_INT52                  (0x100000)
#define MCF_INTC_IPRH_INT53                  (0x200000)
#define MCF_INTC_IPRH_INT54                  (0x400000)
#define MCF_INTC_IPRH_INT55                  (0x800000)
#define MCF_INTC_IPRH_INT56                  (0x1000000)
#define MCF_INTC_IPRH_INT57                  (0x2000000)
#define MCF_INTC_IPRH_INT58                  (0x4000000)
#define MCF_INTC_IPRH_INT59                  (0x8000000)
#define MCF_INTC_IPRH_INT60                  (0x10000000)
#define MCF_INTC_IPRH_INT61                  (0x20000000)
#define MCF_INTC_IPRH_INT62                  (0x40000000)
#define MCF_INTC_IPRH_INT63                  (0x80000000)

/* Bit definitions and macros for MCF_INTC_IPRL */
#define MCF_INTC_IPRL_INT1                   (0x2)
#define MCF_INTC_IPRL_INT2                   (0x4)
#define MCF_INTC_IPRL_INT3                   (0x8)
#define MCF_INTC_IPRL_INT4                   (0x10)
#define MCF_INTC_IPRL_INT5                   (0x20)
#define MCF_INTC_IPRL_INT6                   (0x40)
#define MCF_INTC_IPRL_INT7                   (0x80)
#define MCF_INTC_IPRL_INT8                   (0x100)
#define MCF_INTC_IPRL_INT9                   (0x200)
#define MCF_INTC_IPRL_INT10                  (0x400)
#define MCF_INTC_IPRL_INT11                  (0x800)
#define MCF_INTC_IPRL_INT12                  (0x1000)
#define MCF_INTC_IPRL_INT13                  (0x2000)
#define MCF_INTC_IPRL_INT14                  (0x4000)
#define MCF_INTC_IPRL_INT15                  (0x8000)
#define MCF_INTC_IPRL_INT16                  (0x10000)
#define MCF_INTC_IPRL_INT17                  (0x20000)
#define MCF_INTC_IPRL_INT18                  (0x40000)
#define MCF_INTC_IPRL_INT19                  (0x80000)
#define MCF_INTC_IPRL_INT20                  (0x100000)
#define MCF_INTC_IPRL_INT21                  (0x200000)
#define MCF_INTC_IPRL_INT22                  (0x400000)
#define MCF_INTC_IPRL_INT23                  (0x800000)
#define MCF_INTC_IPRL_INT24                  (0x1000000)
#define MCF_INTC_IPRL_INT25                  (0x2000000)
#define MCF_INTC_IPRL_INT26                  (0x4000000)
#define MCF_INTC_IPRL_INT27                  (0x8000000)
#define MCF_INTC_IPRL_INT28                  (0x10000000)
#define MCF_INTC_IPRL_INT29                  (0x20000000)
#define MCF_INTC_IPRL_INT30                  (0x40000000)
#define MCF_INTC_IPRL_INT31                  (0x80000000)

/* Bit definitions and macros for MCF_INTC_IMRH */
#define MCF_INTC_IMRH_INT_MASK32             (0x1)
#define MCF_INTC_IMRH_INT_MASK33             (0x2)
#define MCF_INTC_IMRH_INT_MASK34             (0x4)
#define MCF_INTC_IMRH_INT_MASK35             (0x8)
#define MCF_INTC_IMRH_INT_MASK36             (0x10)
#define MCF_INTC_IMRH_INT_MASK37             (0x20)
#define MCF_INTC_IMRH_INT_MASK38             (0x40)
#define MCF_INTC_IMRH_INT_MASK39             (0x80)
#define MCF_INTC_IMRH_INT_MASK40             (0x100)
#define MCF_INTC_IMRH_INT_MASK41             (0x200)
#define MCF_INTC_IMRH_INT_MASK42             (0x400)
#define MCF_INTC_IMRH_INT_MASK43             (0x800)
#define MCF_INTC_IMRH_INT_MASK44             (0x1000)
#define MCF_INTC_IMRH_INT_MASK45             (0x2000)
#define MCF_INTC_IMRH_INT_MASK46             (0x4000)
#define MCF_INTC_IMRH_INT_MASK47             (0x8000)
#define MCF_INTC_IMRH_INT_MASK48             (0x10000)
#define MCF_INTC_IMRH_INT_MASK49             (0x20000)
#define MCF_INTC_IMRH_INT_MASK50             (0x40000)
#define MCF_INTC_IMRH_INT_MASK51             (0x80000)
#define MCF_INTC_IMRH_INT_MASK52             (0x100000)
#define MCF_INTC_IMRH_INT_MASK53             (0x200000)
#define MCF_INTC_IMRH_INT_MASK54             (0x400000)
#define MCF_INTC_IMRH_INT_MASK55             (0x800000)
#define MCF_INTC_IMRH_INT_MASK56             (0x1000000)
#define MCF_INTC_IMRH_INT_MASK57             (0x2000000)
#define MCF_INTC_IMRH_INT_MASK58             (0x4000000)
#define MCF_INTC_IMRH_INT_MASK59             (0x8000000)
#define MCF_INTC_IMRH_INT_MASK60             (0x10000000)
#define MCF_INTC_IMRH_INT_MASK61             (0x20000000)
#define MCF_INTC_IMRH_INT_MASK62             (0x40000000)
#define MCF_INTC_IMRH_INT_MASK63             (0x80000000)

/* Bit definitions and macros for MCF_INTC_IMRL */
#define MCF_INTC_IMRL_MASKALL                (0x1)
#define MCF_INTC_IMRL_INT_MASK1              (0x2)
#define MCF_INTC_IMRL_INT_MASK2              (0x4)
#define MCF_INTC_IMRL_INT_MASK3              (0x8)
#define MCF_INTC_IMRL_INT_MASK4              (0x10)
#define MCF_INTC_IMRL_INT_MASK5              (0x20)
#define MCF_INTC_IMRL_INT_MASK6              (0x40)
#define MCF_INTC_IMRL_INT_MASK7              (0x80)
#define MCF_INTC_IMRL_INT_MASK8              (0x100)
#define MCF_INTC_IMRL_INT_MASK9              (0x200)
#define MCF_INTC_IMRL_INT_MASK10             (0x400)
#define MCF_INTC_IMRL_INT_MASK11             (0x800)
#define MCF_INTC_IMRL_INT_MASK12             (0x1000)
#define MCF_INTC_IMRL_INT_MASK13             (0x2000)
#define MCF_INTC_IMRL_INT_MASK14             (0x4000)
#define MCF_INTC_IMRL_INT_MASK15             (0x8000)
#define MCF_INTC_IMRL_INT_MASK16             (0x10000)
#define MCF_INTC_IMRL_INT_MASK17             (0x20000)
#define MCF_INTC_IMRL_INT_MASK18             (0x40000)
#define MCF_INTC_IMRL_INT_MASK19             (0x80000)
#define MCF_INTC_IMRL_INT_MASK20             (0x100000)
#define MCF_INTC_IMRL_INT_MASK21             (0x200000)
#define MCF_INTC_IMRL_INT_MASK22             (0x400000)
#define MCF_INTC_IMRL_INT_MASK23             (0x800000)
#define MCF_INTC_IMRL_INT_MASK24             (0x1000000)
#define MCF_INTC_IMRL_INT_MASK25             (0x2000000)
#define MCF_INTC_IMRL_INT_MASK26             (0x4000000)
#define MCF_INTC_IMRL_INT_MASK27             (0x8000000)
#define MCF_INTC_IMRL_INT_MASK28             (0x10000000)
#define MCF_INTC_IMRL_INT_MASK29             (0x20000000)
#define MCF_INTC_IMRL_INT_MASK30             (0x40000000)
#define MCF_INTC_IMRL_INT_MASK31             (0x80000000)

/* Bit definitions and macros for MCF_INTC_INTFRCH */
#define MCF_INTC_INTFRCH_INTFRC32            (0x1)
#define MCF_INTC_INTFRCH_INTFRC33            (0x2)
#define MCF_INTC_INTFRCH_INTFRC34            (0x4)
#define MCF_INTC_INTFRCH_INTFRC35            (0x8)
#define MCF_INTC_INTFRCH_INTFRC36            (0x10)
#define MCF_INTC_INTFRCH_INTFRC37            (0x20)
#define MCF_INTC_INTFRCH_INTFRC38            (0x40)
#define MCF_INTC_INTFRCH_INTFRC39            (0x80)
#define MCF_INTC_INTFRCH_INTFRC40            (0x100)
#define MCF_INTC_INTFRCH_INTFRC41            (0x200)
#define MCF_INTC_INTFRCH_INTFRC42            (0x400)
#define MCF_INTC_INTFRCH_INTFRC43            (0x800)
#define MCF_INTC_INTFRCH_INTFRC44            (0x1000)
#define MCF_INTC_INTFRCH_INTFRC45            (0x2000)
#define MCF_INTC_INTFRCH_INTFRC46            (0x4000)
#define MCF_INTC_INTFRCH_INTFRC47            (0x8000)
#define MCF_INTC_INTFRCH_INTFRC48            (0x10000)
#define MCF_INTC_INTFRCH_INTFRC49            (0x20000)
#define MCF_INTC_INTFRCH_INTFRC50            (0x40000)
#define MCF_INTC_INTFRCH_INTFRC51            (0x80000)
#define MCF_INTC_INTFRCH_INTFRC52            (0x100000)
#define MCF_INTC_INTFRCH_INTFRC53            (0x200000)
#define MCF_INTC_INTFRCH_INTFRC54            (0x400000)
#define MCF_INTC_INTFRCH_INTFRC55            (0x800000)
#define MCF_INTC_INTFRCH_INTFRC56            (0x1000000)
#define MCF_INTC_INTFRCH_INTFRC57            (0x2000000)
#define MCF_INTC_INTFRCH_INTFRC58            (0x4000000)
#define MCF_INTC_INTFRCH_INTFRC59            (0x8000000)
#define MCF_INTC_INTFRCH_INTFRC60            (0x10000000)
#define MCF_INTC_INTFRCH_INTFRC61            (0x20000000)
#define MCF_INTC_INTFRCH_INTFRC62            (0x40000000)
#define MCF_INTC_INTFRCH_INTFRC63            (0x80000000)

/* Bit definitions and macros for MCF_INTC_INTFRCL */
#define MCF_INTC_INTFRCL_INTFRC1             (0x2)
#define MCF_INTC_INTFRCL_INTFRC2             (0x4)
#define MCF_INTC_INTFRCL_INTFRC3             (0x8)
#define MCF_INTC_INTFRCL_INTFRC4             (0x10)
#define MCF_INTC_INTFRCL_INTFRC5             (0x20)
#define MCF_INTC_INTFRCL_INTFRC6             (0x40)
#define MCF_INTC_INTFRCL_INTFRC7             (0x80)
#define MCF_INTC_INTFRCL_INTFRC8             (0x100)
#define MCF_INTC_INTFRCL_INTFRC9             (0x200)
#define MCF_INTC_INTFRCL_INTFRC10            (0x400)
#define MCF_INTC_INTFRCL_INTFRC11            (0x800)
#define MCF_INTC_INTFRCL_INTFRC12            (0x1000)
#define MCF_INTC_INTFRCL_INTFRC13            (0x2000)
#define MCF_INTC_INTFRCL_INTFRC14            (0x4000)
#define MCF_INTC_INTFRCL_INTFRC15            (0x8000)
#define MCF_INTC_INTFRCL_INTFRC16            (0x10000)
#define MCF_INTC_INTFRCL_INTFRC17            (0x20000)
#define MCF_INTC_INTFRCL_INTFRC18            (0x40000)
#define MCF_INTC_INTFRCL_INTFRC19            (0x80000)
#define MCF_INTC_INTFRCL_INTFRC20            (0x100000)
#define MCF_INTC_INTFRCL_INTFRC21            (0x200000)
#define MCF_INTC_INTFRCL_INTFRC22            (0x400000)
#define MCF_INTC_INTFRCL_INTFRC23            (0x800000)
#define MCF_INTC_INTFRCL_INTFRC24            (0x1000000)
#define MCF_INTC_INTFRCL_INTFRC25            (0x2000000)
#define MCF_INTC_INTFRCL_INTFRC26            (0x4000000)
#define MCF_INTC_INTFRCL_INTFRC27            (0x8000000)
#define MCF_INTC_INTFRCL_INTFRC28            (0x10000000)
#define MCF_INTC_INTFRCL_INTFRC29            (0x20000000)
#define MCF_INTC_INTFRCL_INTFRC30            (0x40000000)
#define MCF_INTC_INTFRCL_INTFRC31            (0x80000000)

/* Bit definitions and macros for MCF_INTC_IRLR */
#define MCF_INTC_IRLR_IRQ(x)                 (((x)&0x7F)<<0x1)

/* Bit definitions and macros for MCF_INTC_IACKLPR */
#define MCF_INTC_IACKLPR_PRI(x)              (((x)&0xF)<<0)
#define MCF_INTC_IACKLPR_LEVEL(x)            (((x)&0x7)<<0x4)

/* Bit definitions and macros for MCF_INTC_ICR */
#define MCF_INTC_ICR_IP(x)                   (((x)&0x7)<<0)
#define MCF_INTC_ICR_IL(x)                   (((x)&0x7)<<0x3)

/* Bit definitions and macros for MCF_INTC_SWIACK */
#define MCF_INTC_SWIACK_VECTOR(x)            (((x)&0xFF)<<0)

/* Bit definitions and macros for MCF_INTC_LIACK */
#define MCF_INTC_LIACK_VECTOR(x)             (((x)&0xFF)<<0)


#endif /* __MCF5475_INTC_H__ */
