# SFBHWPinsBoard.h

Go to the documentation of this file.

    00001 /*                                              -*- mode:C++; fill-column:100 -*-
    00002   SFBHWPinsBoard.h - Board-specific pin definitions
    00003   Copyright (C) 2008 The Regents of the University of New Mexico.  All rights reserved.
    00004
    00005   This library is free software; you can redistribute it and/or
    00006   modify it under the terms of the GNU Lesser General Public
    00007   License as published by the Free Software Foundation; either
    00008   version 2.1 of the License, or (at your option) any later version.
    00009
    00010   This library is distributed in the hope that it will be useful,
    00011   but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013   Lesser General Public License for more details.
    00014
    00015   You should have received a copy of the GNU General Public License
    00016   along with this library; if not, write to the Free Software
    00017   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
    00018   USA
    00019
    00020   $Id$
    00021 */
    00022
    00030 #ifdef SFBHWPINSHOST_H
    00031 #error SFBHWPinsBoard.h and SFBHWPinsHost.h must not be #included together!
    00032 #endif
    00033
    00034 #ifndef SFBHWPINSBOARD_H
    00035 #define SFBHWPINSBOARD_H
    00036
    00037 #include "lpc/LPC23xx.h"
    00038 #include "lpc/fio.h"
    00039
    00040 #ifdef __cplusplus
    00041 extern "C" {
    00042 #endif
    00043
    00044 /* Fast pin access macros. \cond */
    00045
    00046 #define SFB_PORT_IN_MAP(offset, port) (*((volatile u32 *)(((FIO_BASE_ADDR)+(offset))+(port)*0x20)))
    00047 #define SFB_PORT_DIR_REGISTER(port)  SFB_PORT_IN_MAP(0x00,port)
    00048 #define SFB_PORT_MASK_REGISTER(port) SFB_PORT_IN_MAP(0x10,port)
    00049 #define SFB_PORT_PIN_REGISTER(port)  SFB_PORT_IN_MAP(0x14,port)
    00050 #define SFB_PORT_SET_REGISTER(port)  SFB_PORT_IN_MAP(0x18,port)
    00051 #define SFB_PORT_CLR_REGISTER(port)  SFB_PORT_IN_MAP(0x1C,port)
    00052
    00053 #define SFB_PORT_PINMODE_REGISTER(offset) \
    00054   (*((volatile u32 *)((PINMODE_BASE_ADDR)+(offset))))
    00055
    00056 #define SFB_PINSEL_REGISTER(port,pinNumber) \
    00057   (*((volatile u32 *)((PINSEL_BASE_ADDR)+((port)*8)+(pinNumber>15?4:0))))
    00058
    00059 #define SFB_PORT_GET_BIT_MASK(port,mask) (SFB_PORT_PIN_REGISTER(port)&(mask))
    00060
    00061 #define SFB_PORT_SET_BIT_MASK(port,mask) (SFB_PORT_SET_REGISTER(port) = (mask))
    00062 #define SFB_PORT_CLR_BIT_MASK(port,mask) (SFB_PORT_CLR_REGISTER(port) = (mask))
    00063 #define SFB_PORT_WRITE_BIT_MASK(port,mask,value) \
    00064   ((value==LOW)?SFB_PORT_CLR_BIT_MASK(port,mask):SFB_PORT_SET_BIT_MASK(port,mask))
    00065
    00066 #define LED_GREEN_MASK    (1UL<<0)
    00067 #define LED_RED_MASK      (1UL<<1)
    00068 #define LED_BLUE_MASK     (1UL<<2)
    00069
    00070 #define REFLEX_RGB_RED_ON (FIO2CLR = LED_RED_MASK)
    00071 #define REFLEX_RGB_RED_OFF (FIO2SET = LED_RED_MASK)
    00072 #define REFLEX_RGB_GREEN_ON (FIO2CLR = LED_GREEN_MASK)
    00073 #define REFLEX_RGB_GREEN_OFF (FIO2SET = LED_GREEN_MASK)
    00074 #define REFLEX_RGB_BLUE_ON (FIO2CLR = LED_BLUE_MASK)
    00075 #define REFLEX_RGB_BLUE_OFF (FIO2SET = LED_BLUE_MASK)
    00076
    00079 extern void setPinSelFunction(u32 port,u32 pinNumber,u32 function);
    00080
    00084 extern void reenterBootloader() __attribute__ ((noreturn));
    00085
    00089 extern void reenterBrainstem() __attribute__ ((noreturn));
    00090
    00092 extern void hwpins_startup_initialization();
    00093
    00094 /* Low-level last ditch routine to set the rbg leds, bypassing (and
    00095    thereby breaking) all the normal pin management stuff.  So don't
    00096    use this unless the situation is dire enough that you don't case
    00097    about that. */
    00098 extern void debugRGB(int rgbBits, int wait);
    00102 extern void _dieOnBoard_(u32 blinkCode, const char * file, int lineno) __attribute__ ((noreturn));
    00103
    00104 #ifdef __cplusplus
    00105 }
    00106 #endif
    00107
    00108 #endif  /* SFBHWPINSBOARD_H */