[BACK]Return to gpioled.c CVS log [TXT][DIR] Up to [local] / funnyos / arch / sam7s64 / dev

Annotation of funnyos/arch/sam7s64/dev/gpioled.c, Revision 1.2

1.1       nbrk        1: /*
1.2     ! nbrk        2:  * $Id: gpioled.c,v 1.1 2007/11/19 10:51:40 nbrk Exp $
1.1       nbrk        3:  */
                      4: #include <sys/types.h>
                      5: #include <sys/device.h>
                      6: #include <sys/gpio.h>
                      7:
                      8: /*
                      9:  * GPIO LED found on my SAM7-P64 development board.
                     10:  */
                     11:
                     12: int    gpioled_attach(struct device *, uint32_t, uint8_t);
                     13:
                     14: struct driver gpioled_dr = {
1.2     ! nbrk       15:        1,
1.1       nbrk       16:        gpioled_attach,
                     17:        NULL,
                     18:        NULL
                     19: };
                     20:
                     21:
                     22: int
                     23: gpioled_attach(struct device *self, uint32_t loc, uint8_t flags)
                     24: {
                     25:        /* grab parent's gpio_controller */
                     26:        struct gpio_controller *gcp = self->dv_parent->dv_aux;
                     27:        struct gpio_pin pin;
                     28:
                     29:        pin.gp_pinno = loc;     /* PA17 or PA18 please */
                     30:        pin.gp_pio = 1;         /* PIO mode */
                     31:        pin.gp_flags = GPIO_PIN_OUTPUT;
                     32:        pin.gp_value = 1;       /* LED on */
                     33:
                     34:        printf("P64 onboard LED (PA17)\n");
                     35:
                     36:        /* talk to gpio controller */
                     37:        gcp->gc_pinset(gcp->gc_selfdd, pin);
                     38:
                     39:        return(0);
                     40: }
                     41:

CVSweb