Hi all,
Can somebody explain me the below extract of code from the LPC17xx.h header file. I am unable to understand clearly what it does exactly during compilation.
/*------------- General Purpose Input/Output (GPIO) --------------------------*/ typedef struct { union { __IO uint32_t FIODIR; struct { __IO uint16_t FIODIRL; __IO uint16_t FIODIRH; }; struct { __IO uint8_t FIODIR0; __IO uint8_t FIODIR1; __IO uint8_t FIODIR2; __IO uint8_t FIODIR3; }; }; uint32_t RESERVED0[3]; union { __IO uint32_t FIOMASK; struct { __IO uint16_t FIOMASKL; __IO uint16_t FIOMASKH; }; struct { __IO uint8_t FIOMASK0; __IO uint8_t FIOMASK1; __IO uint8_t FIOMASK2; __IO uint8_t FIOMASK3; }; }; union { __IO uint32_t FIOPIN; struct { __IO uint16_t FIOPINL; __IO uint16_t FIOPINH; }; struct { __IO uint8_t FIOPIN0; __IO uint8_t FIOPIN1; __IO uint8_t FIOPIN2; __IO uint8_t FIOPIN3; }; }; union { __IO uint32_t FIOSET; struct { __IO uint16_t FIOSETL; __IO uint16_t FIOSETH; }; struct { __IO uint8_t FIOSET0; __IO uint8_t FIOSET1; __IO uint8_t FIOSET2; __IO uint8_t FIOSET3; }; }; union { __O uint32_t FIOCLR; struct { __O uint16_t FIOCLRL; __O uint16_t FIOCLRH; }; struct { __O uint8_t FIOCLR0; __O uint8_t FIOCLR1; __O uint8_t FIOCLR2; __O uint8_t FIOCLR3; }; }; } LPC_GPIO_TypeDef; /******************************************************************************/ /* Peripheral memory map */ /******************************************************************************/ /* Base addresses */ #define LPC_GPIO_BASE (0x2009C000UL) /* GPIOs */ #define LPC_GPIO0_BASE (LPC_GPIO_BASE + 0x00000) #define LPC_GPIO1_BASE (LPC_GPIO_BASE + 0x00020) #define LPC_GPIO2_BASE (LPC_GPIO_BASE + 0x00040) #define LPC_GPIO3_BASE (LPC_GPIO_BASE + 0x00060) #define LPC_GPIO4_BASE (LPC_GPIO_BASE + 0x00080) /******************************************************************************/ /* Peripheral declaration */ /******************************************************************************/ #define LPC_GPIO0 ((LPC_GPIO_TypeDef *) LPC_GPIO0_BASE ) #define LPC_GPIO1 ((LPC_GPIO_TypeDef *) LPC_GPIO1_BASE ) #define LPC_GPIO2 ((LPC_GPIO_TypeDef *) LPC_GPIO2_BASE ) #define LPC_GPIO3 ((LPC_GPIO_TypeDef *) LPC_GPIO3_BASE ) #define LPC_GPIO4 ((LPC_GPIO_TypeDef *) LPC_GPIO4_BASE )
Some 'C' learning & reference resources: blog.antronics.co.uk/.../
As already mentioned, Keil has a book list: http://www.keil.com/books/ - in particular, Joseph Yiu's Definitive Guide series
Keil's learning page: www2.keil.com/.../learn
Chip manufacturer's resources page: www.nxp.com/.../512kb-flash-64kb-sram-ethernet-usb-lqfp100-package:LPC1768FBD100
Look at examples which use that header.
Look for other books, online tutorials, etc, etc, ...