| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2003-2006, Broadcom Corporation |
|---|
| 3 | * All Rights Reserved |
|---|
| 4 | * Confidential Property of Broadcom Corporation |
|---|
| 5 | * |
|---|
| 6 | * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE |
|---|
| 7 | * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR |
|---|
| 8 | * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 9 | * |
|---|
| 10 | * $brcm_Workfile: $ |
|---|
| 11 | * $brcm_Revision: $ |
|---|
| 12 | * $brcm_Date: $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: $ |
|---|
| 19 | * |
|---|
| 20 | ***************************************************************************/ |
|---|
| 21 | |
|---|
| 22 | #ifndef BSETTOP_GPIO_H__ |
|---|
| 23 | #define BSETTOP_GPIO_H__ |
|---|
| 24 | |
|---|
| 25 | #include "bsettop_types.h" |
|---|
| 26 | |
|---|
| 27 | typedef enum bgpio_interrupt_mode |
|---|
| 28 | { |
|---|
| 29 | eGPIO_Disabled, /* no interrupt */ |
|---|
| 30 | eGPIO_RisingEdge, /* interrupt on 0->1 transition */ |
|---|
| 31 | eGPIO_FallingEdge, /* interrupt on 1->0 transition */ |
|---|
| 32 | eGPIO_Edge, /* interrupt both a 0->1 and a 1->0 transition */ |
|---|
| 33 | eGPIO_Low, /* interrupt on a 0 value */ |
|---|
| 34 | eGPIO_High, /* interrupt on a 1 value */ |
|---|
| 35 | eGPIO_Int_Max |
|---|
| 36 | } bgpio_interrupt_mode; |
|---|
| 37 | |
|---|
| 38 | typedef enum bgpio_mode |
|---|
| 39 | { |
|---|
| 40 | eGPIO_Input, |
|---|
| 41 | eGPIO_OutputOpenDrain, |
|---|
| 42 | eGPIO_OutputPushPull, |
|---|
| 43 | eGPIO_Mode_Max |
|---|
| 44 | } bgpio_mode; |
|---|
| 45 | |
|---|
| 46 | typedef enum bgpio_type |
|---|
| 47 | { |
|---|
| 48 | eGPIO_Standard, /* standard gpio pin */ |
|---|
| 49 | eGPIO_Special, /* special gpio pin */ |
|---|
| 50 | eGPIO_AStandard, /* AON gpio pin */ |
|---|
| 51 | eGPIO_ASpecial, /* AON special gpio pin */ |
|---|
| 52 | eGPIO_Type_Max |
|---|
| 53 | } bgpio_type; |
|---|
| 54 | |
|---|
| 55 | typedef struct bgpio_settings { |
|---|
| 56 | bgpio_type type; |
|---|
| 57 | bgpio_mode mode; |
|---|
| 58 | bgpio_interrupt_mode intMode; |
|---|
| 59 | |
|---|
| 60 | bsettop_callback user_callback; /* callback when interrupt is generated */ |
|---|
| 61 | void *user_callback_context; |
|---|
| 62 | } bgpio_settings; |
|---|
| 63 | |
|---|
| 64 | |
|---|
| 65 | typedef struct bgpio *bgpio_t; |
|---|
| 66 | |
|---|
| 67 | #ifdef __cplusplus |
|---|
| 68 | extern "C" |
|---|
| 69 | { |
|---|
| 70 | #endif |
|---|
| 71 | void bgpio_init(void); |
|---|
| 72 | bgpio_t bgpio_open( |
|---|
| 73 | int gpio_num, /* - gpio number */ |
|---|
| 74 | const bgpio_settings *p_settings |
|---|
| 75 | ); |
|---|
| 76 | |
|---|
| 77 | void bgpio_close( |
|---|
| 78 | bgpio_t gpio |
|---|
| 79 | ); |
|---|
| 80 | |
|---|
| 81 | /* |
|---|
| 82 | * For level trigger interrupt, application should call this function to get additional level triggered interrupt |
|---|
| 83 | */ |
|---|
| 84 | void bgpio_enable_int(bgpio_t gpio); |
|---|
| 85 | |
|---|
| 86 | #ifdef __cplusplus |
|---|
| 87 | } |
|---|
| 88 | #endif |
|---|
| 89 | |
|---|
| 90 | #endif /* BSETTOP_GPIO_H__ */ |
|---|