From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1957 invoked by alias); 12 Mar 2013 14:49:18 -0000 Received: (qmail 1947 invoked by uid 22791); 12 Mar 2013 14:49:17 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,UNPARSEABLE_RELAY X-Spam-Check-By: sourceware.org Received: from mail1.bemta7.messagelabs.com (HELO mail1.bemta7.messagelabs.com) (216.82.254.108) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 12 Mar 2013 14:49:06 +0000 Received: from [216.82.254.67:15800] by server-12.bemta-7.messagelabs.com id EB/10-13595-1604F315; Tue, 12 Mar 2013 14:49:05 +0000 X-Env-Sender: Richard.Morris@lifetech.com X-Msg-Ref: server-15.tower-196.messagelabs.com!1363099744!4138292!1 X-StarScan-Received: X-StarScan-Version: 6.8.6.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 12506 invoked from network); 12 Mar 2013 14:49:05 -0000 Received: from unknown (HELO cbd01exc7ets01.ads.invitrogen.net) (198.160.190.35) by server-15.tower-196.messagelabs.com with RC4-SHA encrypted SMTP; 12 Mar 2013 14:49:05 -0000 Received: from CBD01EXC7HTCA01.ads.invitrogen.net (10.33.67.50) by cbd01exc7ets01.ads.invitrogen.net (172.16.16.35) with Microsoft SMTP Server (TLS) id 8.3.192.1; Tue, 12 Mar 2013 06:54:27 -0700 Received: from CBD01MAIL02.ads.invitrogen.net ([10.33.67.57]) by CBD01EXC7HTCA01.ads.invitrogen.net ([10.33.67.50]) with mapi; Tue, 12 Mar 2013 07:49:04 -0700 From: "Morris, Richard" To: EnneGi CC: "ecos-discuss@ecos.sourceware.org" Date: Tue, 12 Mar 2013 14:49:00 -0000 Message-ID: References: <1362939557386-224910.post@n7.nabble.com> <513CDD92.6060003@siva.com.mk> <1362956256201-224925.post@n7.nabble.com> <1363020733839-225026.post@n7.nabble.com> In-Reply-To: <1363020733839-225026.post@n7.nabble.com> Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: Re: [ECOS] How to create a GPIO driver X-SW-Source: 2013-03/txt/msg00022.txt.bz2 Hi EnneGi, You may want to use the CYGHWR_HAL_LPC1XXX_GPIO_SET(=85), CYGHWR_HAL_LPC1XX= X_GPIO_OUT(=85), and CYGHWR_HAL_LPC1XXX_GPIO_IN(=85) macros. =20 I have found it useful to grep the eCos code base for examples of how to us= e 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/cor= texm/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. =20=20 #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) (((__pi= n)&0x00000700)>>8) #define CYGHWR_HAL_LPC1XXX_GPIO_BIT(__pin) (((__pi= n)>>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 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?=20 -- 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. --=20 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