usbmodeswitch: Updated to v.1.2.6 from shibby's branch.
[tomato.git] / release / src / router / libbcm / bcmgpio.h
blobd03d9694a81e75161597c12fa88b09b4cf93f345
1 /*
2 * Copyright 2005, Broadcom Corporation
3 * All Rights Reserved.
4 *
5 * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
6 * the contents of this file may not be disclosed to third parties, copied
7 * or duplicated in any form, in whole or in part, without the prior
8 * written permission of Broadcom Corporation.
10 * Header file for GPIO utility functions.
12 * $Id: bcmgpio.h,v 1.1.1.2 2005/03/07 07:31:19 kanki Exp $
14 #ifndef __bcmgpio_h__
15 #define __bcmgpio_h__
17 #include <bcmtimer.h>
20 #define BCMGPIO_MAXPINS 32
21 #define BCMGPIO_MAXINDEX (BCMGPIO_MAXPINS - 1)
23 /* GPIO type */
24 typedef enum bcmgpio_dirn {
25 BCMGPIO_DIRN_IN = 0,
26 BCMGPIO_DIRN_OUT
27 } bcmgpio_dirn_t;
29 /* GPIO strobe information */
30 typedef struct bcmgpio_strobe {
31 int duty_percent; /* duty cycle of strobe in percent of strobe period */
32 bcm_timer_module_id timer_module; /* timer module ID obtained by calling bcm_timer_module_init() */
33 unsigned long strobe_period_in_ms; /* strobe period of the GPIO in milliseconds */
34 unsigned long num_strobes; /* total number of strobes */
35 int *strobe_done; /* pointer to memory which is used to signal strobe completion */
36 } bcmgpio_strobe_t;
38 /* Functions to implement Buttons and LEDs on the AP, using GPIOs */
39 int bcmgpio_connect (int gpio_pin, bcmgpio_dirn_t gpio_dirn);
40 int bcmgpio_disconnect (int gpio_pin);
41 int bcmgpio_in (unsigned long gpio_mask, unsigned long *value);
42 int bcmgpio_out (unsigned long gpio_mask, unsigned long value);
43 int bcmgpio_strobe_start (int gpio_pin, bcmgpio_strobe_t *strobe_info);
44 int bcmgpio_strobe_stop (int gpio_pin);
48 #endif /* __bcmgpio_h__ */