Skip to contentSkip to conversation

why open("dev/console",O_RDWR,0) get stuck

DISCUSSION Wentao Xu 2 participants 2 messages Jun 27, 2000 – Jun 28, 2000

lore
Share & tools
lore

Wentao Xu

author
#0 lore raw

I have the code from Monta Vista on my prietary board, I find
it get stuck in the open("dev/console",..) in fucntion init()
in init/main.c, just before to start the shell from ramdisk.
So I put a printk("ppc405_uic_enable\n") in function ppc405_uic_enable()
and a printk("ppc405_uic_disable_and_ack\n") in function ppc405_uic_disable_and_ack().
both functions are in file arch\ppc\kernel\ppc4xx_pic.c.

At last I found a output of infinite train of
ppc405_uic_enable
ppc405_uic_disable_and_ack
ppc405_uic_enable
ppc405_uic_disable_and_ack
ppc405_uic_enable
ppc405_uic_disable_and_ack
ppc405_uic_enable
ppc405_uic_disable_and_ack
........,

I get lost. Which friends can give me an idea?

Wentao

Get Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

#1 lore raw
Quoted 13 lines · Wentao Xu

I have the code from Monta Vista on my prietary board, I find
it get stuck in the open("dev/console",..) in fucntion init()
in init/main.c, just before to start the shell from ramdisk.
So I put a printk("ppc405_uic_enable\n") in function ppc405_uic_enable()
and a printk("ppc405_uic_disable_and_ack\n") in function ppc405_uic_disable_and_ack().
both functions are in file arch\ppc\kernel\ppc4xx_pic.c.

Quoted 12 lines

At last I found a output of infinite train of
ppc405_uic_enable
ppc405_uic_disable_and_ack
ppc405_uic_enable
ppc405_uic_disable_and_ack
ppc405_uic_enable
ppc405_uic_disable_and_ack
ppc405_uic_enable
ppc405_uic_disable_and_ack
........,

this is occuring because you have not set the polarity/level of the interrupt pin correctly.. you must set the DCRs, UICPR (defines the polarity of the interrupt), and UICTR (which defines whether the pin is level or edge triggered, this is for external interrupts)...

-----------
example: to set an external irq pin to positve, edge triggered:-

unsigned long uicpr, uictr;

uicpr = mfdcr(DCRN_UICPR);
uicpr |= 1 << (31 - IRQ_NO);
mtdcr(DCRN_UICPR, uicpr);
uictr = mfdcr(DCRN_UICTR);
uictr |= 1 << (31 - IRQ_NO);
mtdcr(DCRN_UICTR, uictr);
----------

whats happening is the interrupt is going off constantly, as the pins default to negative, level triggering... see ibm stb guide chapter 6 for more info..

cheers,

ben

-- /\\------------------------------------------------------------------ :::::::::::..ben.b..m2technologyltd.nz..64.9.4448307.130..:::::::::::

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/