Hi EnneGi, You may want to use the CYGHWR_HAL_LPC1XXX_GPIO_SET(…), CYGHWR_HAL_LPC1XXX_GPIO_OUT(…), and CYGHWR_HAL_LPC1XXX_GPIO_IN(…) macros. I have found it useful to grep the eCos code base for examples of how to use macros, etc.
For examples, you can see code that uses them here: ./packages/hal/cortexm/lpc1xxx/var/v3_1_33/src/lpc1xxx_misc.c ./packages/devs/eth/arm/lpc2xxx/v3_1_33/src/if_lpc2xxx-lwip.c Here are the related macros for the LPC1766, found in: .../packages/hal/cortexm/lpc1xxx/var/v3_1_33/include/var_io.h: // This macro packs the port number, bit number and mode for a GPIO // pin into a single word. The packing puts the mode in the ls 8 bits, // the bit number in 16:20 and the GPIO port number bits 8:10. The // mode is only specified using the last component of the name to // keep definitions short. #define CYGHWR_HAL_LPC1XXX_GPIO(__port, __bit, __mode ) \ (((__port)<< 8) | \ ((__bit)<<16) | \ (CYGHWR_HAL_LPC1XXX_GPIO_MODE_##__mode) ) // Macros to extract encoded values #define CYGHWR_HAL_LPC1XXX_GPIO_PORT(__pin) (((__pin)&0x00000700)>>8) #define CYGHWR_HAL_LPC1XXX_GPIO_BIT(__pin) (((__pin)>>16)&0x1F) #define CYGHWR_HAL_LPC1XXX_GPIO_MODE(__pin) ((__pin)&0xFF) #define CYGHWR_HAL_LPC1XXX_GPIO_NONE (0xFFFFFFFF) // Functions and macros to configure GPIO ports. __externC void hal_lpc1xxx_gpio_set( cyg_uint32 pin ); __externC void hal_lpc1xxx_gpio_out( cyg_uint32 pin, int val ); __externC void hal_lpc1xxx_gpio_in ( cyg_uint32 pin, int *val ); #define CYGHWR_HAL_LPC1XXX_GPIO_SET(__pin ) hal_lpc1xxx_gpio_set( __pin ) #define CYGHWR_HAL_LPC1XXX_GPIO_OUT(__pin, __val ) hal_lpc1xxx_gpio_out( __pin, __val ) #define CYGHWR_HAL_LPC1XXX_GPIO_IN(__pin, __val ) hal_lpc1xxx_gpio_in( __pin, __val ) Hope this helps. --Richard ------ On Mar 11, 2013, at 9:52 AM, EnneGi <enricogiordano1...@gmail.com> wrote: Thanks a lot! So, for my work, I "copy" the instruction of stm32 in the "var_io.h" file of lpc1766 (changing adress) and define the function of GPIO set in a file on the directory devs/ right? -- View this message in context: http://sourceware-org.1504.n7.nabble.com/How-to-create-a-GPIO-driver-tp224910p225026.html Sent from the Sourceware - ecos-discuss mailing list archive at Nabble.com. -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss