* Re: gpio Interrupt handling for omap5912 [not found] <44D1C3AF.5010004@gmail.com> @ 2006-08-04 2:49 ` Arnold 2006-08-13 14:15 ` Dirk Behme 0 siblings, 1 reply; 7+ messages in thread From: Arnold @ 2006-08-04 2:49 UTC (permalink / raw) To: Dirk Behme; +Cc: Linux-omap-open-source Hi Dirk, > In your first mail you asked for a description/spec > how to > program GPIO. Maybe you can now write a short howto > how to > program and use GPIO API and send it to the list? > Then the > result of our discussion can be helpful for others > as well. > Giving something back to the community must not be > code or > patches, it can be documentation as well. Here's the a little of what I know on howto for gpio. There may be an error, so feel free to edit/modify. GPIO API's How To. INCLUDE #include <asm/arch/gpio.h> I. GPIO Modules/Banks A.) GPIO MODULE/BANK 0 - PIN 0-15 B.) GPIO MODULE/BANK 1 - PIN 16-31 C.) GPIO MODULE/BANK 2 - PIN 32-47 D.) GPIO MODULE/BANK 3 - PIN 48-63 II. GPIO API's A.) omap_request_gpio(int gpio) Description: Parameter: > int gpio - GPIO PIN (Pin 0-63) Note: >Using this function, you dont have to worry about banks/modules where the gpio pin is. B.) omap_set_gpio_direction(int gpio, int is_input) Description: > This function is responsible for setting the gpio pin direction(input or output). Parameter: > int gpio - GPIO PIN (Pin 0-63) > int is_input - pin direction (0=output, 1=input) C.) omap_set_gpio_dataout(int gpio, int enable) Description: > This function is responsible for writing to a pin. Parameter: > int gpio - GPIO PIN (Pin 0-63) > int enable - pin value (0 or 1) D.) omap_get_gpio_datain(int gpio) Description: > This function is responsible for reading pin values. Parameter: > int gpio - GPIO PIN (Pin 0-63) E.) omap_free_gpio(int gpio) Description: > This function is responsible for freeing the pin used. Parameter: > int gpio - GPIO PIN (Pin 0-63) F.) OMAP_GPIO_IRQ(int gpio) Description: > Returns the Interrupt number for the specified gpio pin. Parameter: > int gpio - GPIO PIN (Pin 0-63) G.) set_irq_type(unsigned int irq, unsigned int type) Description: > This function is responsible for setting the type of interrupt(RISING or FALLING). Parameter: > unsigned int irq - The interrupt number for the gpio pin. > unsigned int type - (IRQT_RISING = rising, IRQT_FALLING= falling) Example: 1.) Writing to gpio pin#3 a value 1. and reading the value of gpio pin#3. Request for gpio pin omap_request_gpio(3); Writing a 1 to gpio pin # 3: omap_set_gpio_direction(3,0); omap_set_set_dataout(3,1); Reading the value of pin # 3; ret = omap_get_datain(3); printk("value of pin # 3 = %d\n",ret); Freeing gpio pin # 3; omap_free_gpio(3); 2.) Interrupt Request for gpio pin omap_request_gpio(3); Setting up pin for interrupt omap_set_gpio_direction(3,0); set_irq_type(OMAP_GPIO_IRQ(3),IRQT_RISING); request_irq(OMAP_GPIO_IRQ(3),(void *)&my_int_handler,SA_SHIRQ,....); Freeing interrupt and gpio pin free_irq(OMAP_GPIO_IRQ(3),&id); omap_free_gpio(3); I dont know if this will help. Thanks for all the help. Regards, OJ __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: gpio Interrupt handling for omap5912 2006-08-04 2:49 ` gpio Interrupt handling for omap5912 Arnold @ 2006-08-13 14:15 ` Dirk Behme 2006-08-13 22:22 ` lamikr 0 siblings, 1 reply; 7+ messages in thread From: Dirk Behme @ 2006-08-13 14:15 UTC (permalink / raw) To: Linux-omap-open-source Hi all, to avoid that things like HowTo below are lost, what do you think is the best place to store them? I can imagine - Documentation/arm/OMAP/GPIO - http://tree.celinuxforum.org/CelfPubWiki/OSK - ? Cheers Dirk Arnold wrote: > Here's the a little of what I know on howto for gpio. > There may be an error, so feel free to edit/modify. > > GPIO API's How To. > > INCLUDE > #include <asm/arch/gpio.h> > > I. GPIO Modules/Banks > A.) GPIO MODULE/BANK 0 - PIN 0-15 > B.) GPIO MODULE/BANK 1 - PIN 16-31 > C.) GPIO MODULE/BANK 2 - PIN 32-47 > D.) GPIO MODULE/BANK 3 - PIN 48-63 > > II. GPIO API's > A.) omap_request_gpio(int gpio) > Description: > Parameter: > > int gpio - GPIO PIN (Pin 0-63) > Note: > >Using this function, you dont have to worry > about > banks/modules where the gpio pin is. > B.) omap_set_gpio_direction(int gpio, int is_input) > Description: > > This function is responsible for setting the > gpio pin direction(input or output). > Parameter: > > int gpio - GPIO PIN (Pin 0-63) > > int is_input - pin direction (0=output, > 1=input) > > C.) omap_set_gpio_dataout(int gpio, int enable) > Description: > > This function is responsible for writing to a > pin. > Parameter: > > int gpio - GPIO PIN (Pin 0-63) > > int enable - pin value (0 or 1) > D.) omap_get_gpio_datain(int gpio) > Description: > > This function is responsible for reading pin > values. > Parameter: > > int gpio - GPIO PIN (Pin 0-63) > E.) omap_free_gpio(int gpio) > Description: > > This function is responsible for freeing the pin > used. > Parameter: > > int gpio - GPIO PIN (Pin 0-63) > F.) OMAP_GPIO_IRQ(int gpio) > Description: > > Returns the Interrupt number for the specified > gpio pin. > Parameter: > > int gpio - GPIO PIN (Pin 0-63) > G.) set_irq_type(unsigned int irq, unsigned int type) > Description: > > This function is responsible for setting the > type of interrupt(RISING or FALLING). > Parameter: > > unsigned int irq - The interrupt number for the > gpio pin. > > unsigned int type - (IRQT_RISING = rising, > IRQT_FALLING= falling) > > > Example: > 1.) Writing to gpio pin#3 a value 1. and reading the > value of gpio pin#3. > Request for gpio pin > omap_request_gpio(3); > Writing a 1 to gpio pin # 3: > omap_set_gpio_direction(3,0); > omap_set_set_dataout(3,1); > Reading the value of pin # 3; > ret = omap_get_datain(3); > printk("value of pin # 3 = %d\n",ret); > Freeing gpio pin # 3; > omap_free_gpio(3); > > 2.) Interrupt > Request for gpio pin > omap_request_gpio(3); > Setting up pin for interrupt > omap_set_gpio_direction(3,0); > set_irq_type(OMAP_GPIO_IRQ(3),IRQT_RISING); > > request_irq(OMAP_GPIO_IRQ(3),(void > *)&my_int_handler,SA_SHIRQ,....); > Freeing interrupt and gpio pin > free_irq(OMAP_GPIO_IRQ(3),&id); > omap_free_gpio(3); > > > I dont know if this will help. Thanks for all the > help. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: gpio Interrupt handling for omap5912 2006-08-13 14:15 ` Dirk Behme @ 2006-08-13 22:22 ` lamikr 2006-08-14 7:17 ` Dirk Behme 0 siblings, 1 reply; 7+ messages in thread From: lamikr @ 2006-08-13 22:22 UTC (permalink / raw) To: Dirk Behme; +Cc: Linux-omap-open-source Dirk Behme wrote: > Hi all, > > to avoid that things like HowTo below are lost, what do you think is > the best place to store them? > > I can imagine > > - Documentation/arm/OMAP/GPIO I would prefer this even it might be even too obvious place to search this kind of docs :-) But of course OSK wiki is also good location. Maybe there could also be something from the just added GPIO switch framework usage and omap platforms it should support. (OMAP1, OMAP2?) Another area from which I would be interested in would be ARMIOs, as I have only found my self couple of references to them without good explanation what they really are. They seems to be something that remains GPIO's and I would be interested in to know whether GPIO functions are supposed to handle also them by just using certain high enought ID numbers, or should they be treated diffrerently? Mika ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: gpio Interrupt handling for omap5912 2006-08-13 22:22 ` lamikr @ 2006-08-14 7:17 ` Dirk Behme 0 siblings, 0 replies; 7+ messages in thread From: Dirk Behme @ 2006-08-14 7:17 UTC (permalink / raw) To: lamikr; +Cc: Linux-omap-open-source lamikr wrote: > Dirk Behme wrote: >>to avoid that things like HowTo below are lost, what do you think is >>the best place to store them? >> >>I can imagine >> >>- Documentation/arm/OMAP/GPIO > > I would prefer this even it might be even too obvious place to search > this kind of docs :-) But of course OSK wiki is also good location. Okay, let us put it into Documentation/arm/OMAP (see patch I sent). If it is there, I will add a link to http://tree.celinuxforum.org/CelfPubWiki/OSK#head-0bda81ff448870f0aa282eb95524f2c157ca3e83 Then, we have it at both places ;) > Maybe there could also be something from the just added GPIO switch > framework usage and omap platforms it should support. (OMAP1, OMAP2?) > > Another area from which I would be interested in would be ARMIOs, as I > have only found my self couple of references to them without good > explanation what they really are. They seems to be something that > remains GPIO's and I would be interested in to know whether GPIO > functions are supposed to handle also them by just using certain high > enought ID numbers, or should they be treated diffrerently? Anybody who is familiar with this can add this info to GPIO howto? Thanks Dirk ^ permalink raw reply [flat|nested] 7+ messages in thread
* Reg: OMAP Debugging @ 2006-07-30 16:47 karthik karthik 2006-07-31 8:52 ` gpio Interrupt handling for omap5912 Arnold 0 siblings, 1 reply; 7+ messages in thread From: karthik karthik @ 2006-07-30 16:47 UTC (permalink / raw) To: linux-omap-open-source Hi, I am currently setting up a proper debugging environment on OMAP for development. I installed and tested a gdbserver on my ARM side and it works fine. The hickup is the DSP side. Is there any way of debugging the DSP side other than the JTAG debugger? Or is JTAG a neccessity for anyone working on OMAP? Please do reply as this is the final step that is hindering the start of the development process. Thx and regards S. Karthikeyan -- --------------------------------- How low will we go? Check out Yahoo! Messengers low PC-to-Phone call rates. ^ permalink raw reply [flat|nested] 7+ messages in thread
* gpio Interrupt handling for omap5912 2006-07-30 16:47 Reg: OMAP Debugging karthik karthik @ 2006-07-31 8:52 ` Arnold 2006-07-31 9:22 ` Dirk Behme 0 siblings, 1 reply; 7+ messages in thread From: Arnold @ 2006-07-31 8:52 UTC (permalink / raw) To: linux-omap-open-source Hi, Anybody knows what interrupt number a gpio on omap5912 uses? Is there a specification on gpio interrupt? Thanks, OJ __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: gpio Interrupt handling for omap5912 2006-07-31 8:52 ` gpio Interrupt handling for omap5912 Arnold @ 2006-07-31 9:22 ` Dirk Behme 2006-08-01 9:18 ` Arnold 0 siblings, 1 reply; 7+ messages in thread From: Dirk Behme @ 2006-07-31 9:22 UTC (permalink / raw) To: Arnold; +Cc: linux-omap-open-source Arnold wrote: > Anybody knows what interrupt number a gpio on omap5912 > uses? AFAIK interrupt numbers for GPIO start with 160 and then are numbered starting with first GPIO bank and so on. See include/asm-arm/arch-omap/irqs.h: #define IH2_BASE 32 /* Max. 128 level 2 IRQs (OMAP1610), 192 GPIOs (OMAP730) and * 16 MPUIO lines */ #define OMAP_MAX_GPIO_LINES 192 #define IH_GPIO_BASE (128 + IH2_BASE) #define IH_MPUIO_BASE (OMAP_MAX_GPIO_LINES + IH_GPIO_BASE) #define IH_BOARD_BASE (16 + IH_MPUIO_BASE) Have a look to GPIO framework in gpio.c and its usage in various files which can help you programming GPIO stuff. Cheers Dirk ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: gpio Interrupt handling for omap5912 2006-07-31 9:22 ` Dirk Behme @ 2006-08-01 9:18 ` Arnold 0 siblings, 0 replies; 7+ messages in thread From: Arnold @ 2006-08-01 9:18 UTC (permalink / raw) To: Dirk Behme; +Cc: linux-omap-open-source Hi, I've been playing around the gpio. writing to pins. I encountered an error that is weird. Im not sure if this is cause by writing to a gpio. I tried several gpio pins but I still encountered an error. below is the error encountered: # ./gpio_test Opening gpio driver (OJ) Writing at pin = 49 (OJ) Value of pin = 1 ~ # ~ # ~ # ~ # ~ # ./gpio_test nfs: server 157.184.66.86 not responding, still trying NETDEV WATCHDOG: eth0: transmit timed out NETDEV WATCHDOG: eth0: transmit timed out Do Anyone knows whats wrong here? I have no idea why Im encountering this error. Regards, OJ --- Dirk Behme <dirk.behme@googlemail.com> wrote: > Arnold wrote: > > Anybody knows what interrupt number a gpio on > omap5912 > > uses? > > AFAIK interrupt numbers for GPIO start with 160 and > then are > numbered starting with first GPIO bank and so on. > > See include/asm-arm/arch-omap/irqs.h: > > #define IH2_BASE 32 > > /* Max. 128 level 2 IRQs (OMAP1610), 192 GPIOs > (OMAP730) and > * 16 MPUIO lines */ > #define OMAP_MAX_GPIO_LINES 192 > #define IH_GPIO_BASE (128 + IH2_BASE) > #define IH_MPUIO_BASE (OMAP_MAX_GPIO_LINES > + > IH_GPIO_BASE) > #define IH_BOARD_BASE (16 + IH_MPUIO_BASE) > > Have a look to GPIO framework in gpio.c and its > usage in > various files which can help you programming GPIO > stuff. > > Cheers > > Dirk > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2006-08-14 7:17 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <44D1C3AF.5010004@gmail.com>
2006-08-04 2:49 ` gpio Interrupt handling for omap5912 Arnold
2006-08-13 14:15 ` Dirk Behme
2006-08-13 22:22 ` lamikr
2006-08-14 7:17 ` Dirk Behme
2006-07-30 16:47 Reg: OMAP Debugging karthik karthik
2006-07-31 8:52 ` gpio Interrupt handling for omap5912 Arnold
2006-07-31 9:22 ` Dirk Behme
2006-08-01 9:18 ` Arnold
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox