Go to previous topic
Go to next topic
Last Post 05 Jul 2007 02:19 PM by  zonque
How to use GPIO0 and GPIO1 on Linux
 1 Replies
Author Messages
s.bencke@terra.com.br
New Member
New Member
Posts:


--
05 Jul 2007 12:52 PM
    Hi,
    Somebody can help me on how to use GPIO on Linux? I'm using Kernel 2.6.19.2! I want to turn on/off the leds of litekit.
    Thanks
    SB
    zonque
    New Member
    New Member
    Posts:


    --
    05 Jul 2007 02:19 PM
    Posted By sbencke on 5 Jul 2007 0:52 PM
    Hi,
    Somebody can help me on how to use GPIO on Linux? I''m using Kernel 2.6.19.2! I want to turn on/off the leds of litekit.
    Thanks
    SB




    from kernel space, these lines will do it:

    mxc_set_gpio_direction(MX31_PIN_CAPTURE, 0);
    mxc_set_gpio_direction(MX31_PIN_COMPARE, 0);
    mxc_set_gpio_dataout(MX31_PIN_CAPTURE, 0);
    mxc_set_gpio_dataout(MX31_PIN_COMPARE, 0);


    note that the lines are low-active, so the above code will switch both LEDs on.

    To get access from user space, you will need to add your own support for sysfs, procfs or as a misc device.

    Hope that helps!
    Daniel


    ---