SFBHWPinsBoard.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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/fio.h"
00038 #include "lpc/timer.h"
00039
00040 #ifdef __cplusplus
00041 extern "C" {
00042 #endif
00043
00044
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
00077 extern void setPinSelFunction(u32 port,u32 pinNumber,u32 function);
00078
00084 extern void reenterBootloader() __attribute__ ((noreturn));
00085
00089 extern void reenterBrainstem() __attribute__ ((noreturn));
00090
00092 extern void hwpins_startup_initialization();
00093
00094
00095
00096
00097
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