ChibiOS/RT Architecture - Reference Manual - Guides |
00001 /* 00002 ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010 Giovanni Di Sirio. 00003 00004 This file is part of ChibiOS/RT. 00005 00006 ChibiOS/RT is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 3 of the License, or 00009 (at your option) any later version. 00010 00011 ChibiOS/RT is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program. If not, see <http://www.gnu.org/licenses/>. 00018 00019 --- 00020 00021 A special exception to the GPL can be applied should you wish to distribute 00022 a combined work that includes ChibiOS/RT, without being obliged to provide 00023 the source code for any proprietary components. See the file exception.txt 00024 for full details of how and when the exception can be applied. 00025 */ 00026 00027 /** 00028 * @file LPC214x/vic.c 00029 * @brief LPC214x VIC peripheral support code. 00030 * 00031 * @addtogroup LPC214x_VIC 00032 * @{ 00033 */ 00034 00035 #include "ch.h" 00036 00037 /** 00038 * @brief VIC Initialization. 00039 * @note Better reset everything in the VIC, it is a HUGE source of trouble. 00040 */ 00041 void vic_init(void) { 00042 int i; 00043 00044 VIC *vic = VICBase; 00045 vic->VIC_IntSelect = 0; /* All sources assigned to IRQ. */ 00046 vic->VIC_SoftIntClear = ALLINTMASK; /* No interrupts enforced */ 00047 vic->VIC_IntEnClear = ALLINTMASK; /* All sources disabled. */ 00048 for (i = 0; i < 16; i++) { 00049 vic->VIC_VectCntls[i] = 0; 00050 vic->VIC_VectAddrs[i] = 0; 00051 vic->VIC_VectAddr = 0; 00052 } 00053 } 00054 00055 /** 00056 * @brief Initializes a VIC vector. 00057 * @details Set a vector for an interrupt source and enables it. 00058 * 00059 * @param[in] handler the pointer to the IRQ service routine 00060 * @param[in] vector the vector number 00061 * @param[in] source the IRQ source to be associated to the vector 00062 */ 00063 void SetVICVector(void *handler, int vector, int source) { 00064 00065 VIC *vicp = VICBase; 00066 vicp->VIC_VectAddrs[vector] = (IOREG32)handler; 00067 vicp->VIC_VectCntls[vector] = (IOREG32)(source | 0x20); 00068 } 00069 00070 /** @} */