Annotation of funnyos/arch/sam7s64/dev/gpioled.c, Revision 1.4
1.1 nbrk 1: /*
1.4 ! nbrk 2: * $Id: gpioled.c,v 1.3 2007/11/24 17:43:15 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;
1.4 ! nbrk 32: pin.gp_value = 0; /* LED on */
1.1 nbrk 33:
1.3 nbrk 34: printf("p64 onboard LED (pin %d)\n", pin.gp_pinno);
1.1 nbrk 35:
36: /* talk to gpio controller */
37: gcp->gc_pinset(gcp->gc_selfdd, pin);
38:
39: return(0);
40: }
41:
CVSweb