<div dir="ltr">is printk safe to use in the interrupt context? does it blow the stack?<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 9, 2015 at 1:11 PM, Federico Garcia Cruz <span dir="ltr"><<a href="mailto:federico.garciacruz@tallertechnologies.com" target="_blank">federico.garciacruz@tallertechnologies.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi everyone,<div>I'm using the GPIO api for the BBB but I'm having problems with the interrupt handling.</div><div>I'm blinking two leds in the main thread and I have a GPIO input with an interrupt attached that uses printk to print a message. The problem is that the interrupt handler prints the message but never returns (main thread leds stop blinking after that).</div><div>Any suggestion?</div><div>Here's my code:</div><div><br></div><div><div><div>rtems_gpio_irq_state gpio_handler(void* /*arg*/)</div><div>{</div><div>    printk("interrupt handler\n");</div><div>    return IRQ_HANDLED;</div></div><div>}</div><div><br></div><div><br></div><div><div>void* POSIX_Init(void*)</div><div>{</div><div>    rtems_mode previous_mode_set;</div><div>    rtems_task_mode(RTEMS_TIMESLICE | RTEMS_PREEMPT, RTEMS_TIMESLICE_MASK | RTEMS_PREEMPT_MASK, &previous_mode_set);</div><div>    rtems_status_code sc = rtems_gpio_initialize();</div><div>    printk("%d\n", sc);</div><div><br></div><div>    sc = rtems_gpio_request_pin(BBB_LED_USR0, DIGITAL_OUTPUT, true, false, NULL);</div><div>    printk("DIGITAL_OUTPUT: %d\n", sc);</div><div>    sc = rtems_gpio_request_pin(BBB_LED_USR3, DIGITAL_OUTPUT, true, false, NULL);</div><div>    printk("DIGITAL_OUTPUT: %d\n", sc);</div><div><br></div><div>    sc = rtems_gpio_request_pin(BBB_P8_7, DIGITAL_INPUT, false, false, NULL);</div><div>    printk("DIGITAL_INPUT: %d\n", sc);</div><div><br></div><div>    sc = rtems_gpio_enable_interrupt(BBB_P8_7, FALLING_EDGE, UNIQUE_HANDLER, false, gpio_handler, NULL);</div><div>    printk("interrupt install: %d\n", sc);</div><div><br></div><div>    while(1)</div><div>    {</div><div>        sleep(1);</div><div>        rtems_gpio_clear(BBB_LED_USR3);</div><div>        rtems_gpio_set(BBB_LED_USR0);</div><div>        sleep(1);</div><div>        rtems_gpio_set(BBB_LED_USR3);</div><div>        rtems_gpio_clear(BBB_LED_USR0);</div><div>    }</div><div>    return NULL;</div><div>}</div></div><div><br></div><div>Thanks in advance!</div>-- <br><div><div dir="ltr"><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><a href="http://www.tallertechnologies.com" style="text-decoration:none" target="_blank"><span style="font-size:16px;font-family:Arial;color:rgb(17,85,204);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:underline;vertical-align:baseline;white-space:pre-wrap;background-color:transparent"><img src="https://lh6.googleusercontent.com/oWr5yxNDJfjF0N2yhmiSzhU9vstfXfDLCQju49Xj_5frxoG-vk_hKzOt-k3KSsZv5W5cNnZSjNmWi53XYbfiAsytvz44AptjWiDYFTLIhRiRifwjwHtlfPJmhrqmfEub1w" style="border:none" height="77" width="200"></span></a></p><p style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><b style="font-weight:normal"><br></b></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:16px;font-family:Arial;color:rgb(0,0,0);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;background-color:transparent">Federico Garcia Cruz</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;background-color:transparent">Software Engineer</span></p><p style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><b style="font-weight:normal"><br></b></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11px;font-family:Arial;color:rgb(0,0,0);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;background-color:transparent">San Lorenzo 47, 3rd Floor, Office 5</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11px;font-family:Arial;color:rgb(0,0,0);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;background-color:transparent">Córdoba, Argentina</span></p><p style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><b style="font-weight:normal"><br></b></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11px;font-family:Arial;color:rgb(0,0,0);font-weight:bold;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;background-color:transparent">Phone:</span><span style="font-size:11px;font-family:Arial;color:rgb(0,0,0);font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap;background-color:transparent"> <a href="tel:%2B54%20351%204217888" value="+543514217888" target="_blank">+54 351 4217888</a> / <a href="tel:%2B54%20351%204218211" value="+543514218211" target="_blank">+54 351 4218211</a></span></p><p style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><br><a href="http://www.linkedin.com/company/taller-technologies" style="text-decoration:none" target="_blank"><span style="font-size:15px;font-family:Arial;color:rgb(17,85,204);text-decoration:underline;vertical-align:baseline;white-space:pre-wrap;background-color:transparent"><img src="https://lh5.googleusercontent.com/-PNbLrk4FTcGDH9qlK0E9EOXNq30yjxcZdWdV1nrz0nea-2DSHK5Imha-1oItxasCqkHsragWxBQoGaM6htV8ZiSNmtX0zr_6h7l5SAekmvgRly09D1cmbVt4sQ8cKtmIQ" style="border:none" height="20px;" width="20px;"></span></a><a href="https://www.facebook.com/tallertechnologies" style="text-decoration:none" target="_blank"><span style="font-size:15px;font-family:Arial;color:rgb(17,85,204);text-decoration:underline;vertical-align:baseline;white-space:pre-wrap;background-color:transparent"><img src="https://lh6.googleusercontent.com/35gyAmo2veV0QIAK20LuNB8ouSDb62YfPd5NEbXdxvdLdbt8aNQo4c9SSXKUhbi8L69xj0fFH9HgavVbFraoqN04JrxkLfRzwsMLY2nTfDChb5Neflw7ezpE6_LxseIKGw" style="border:none" height="19px;" width="19px;"></span></a><br></p></div></div>
</div></div>
<br>_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br></blockquote></div><br></div>