| 1 | /*************************************************************************** |
|---|
| 2 | * (c)2007-2011 Broadcom Corporation |
|---|
| 3 | * |
|---|
| 4 | * This program is the proprietary software of Broadcom Corporation and/or its licensors, |
|---|
| 5 | * and may only be used, duplicated, modified or distributed pursuant to the terms and |
|---|
| 6 | * conditions of a separate, written license agreement executed between you and Broadcom |
|---|
| 7 | * (an "Authorized License"). Except as set forth in an Authorized License, Broadcom grants |
|---|
| 8 | * no license (express or implied), right to use, or waiver of any kind with respect to the |
|---|
| 9 | * Software, and Broadcom expressly reserves all rights in and to the Software and all |
|---|
| 10 | * intellectual property rights therein. IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU |
|---|
| 11 | * HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY |
|---|
| 12 | * NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE. |
|---|
| 13 | * |
|---|
| 14 | * Except as expressly set forth in the Authorized License, |
|---|
| 15 | * |
|---|
| 16 | * 1. This program, including its structure, sequence and organization, constitutes the valuable trade |
|---|
| 17 | * secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof, |
|---|
| 18 | * and to use this information only in connection with your use of Broadcom integrated circuit products. |
|---|
| 19 | * |
|---|
| 20 | * 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" |
|---|
| 21 | * AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR |
|---|
| 22 | * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO |
|---|
| 23 | * THE SOFTWARE. BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES |
|---|
| 24 | * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, |
|---|
| 25 | * LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION |
|---|
| 26 | * OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF |
|---|
| 27 | * USE OR PERFORMANCE OF THE SOFTWARE. |
|---|
| 28 | * |
|---|
| 29 | * 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS |
|---|
| 30 | * LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR |
|---|
| 31 | * EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR |
|---|
| 32 | * USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF |
|---|
| 33 | * THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT |
|---|
| 34 | * ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE |
|---|
| 35 | * LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF |
|---|
| 36 | * ANY LIMITED REMEDY. |
|---|
| 37 | * |
|---|
| 38 | * $brcm_Workfile: nexus_gpio_module.h $ |
|---|
| 39 | * $brcm_Revision: 5 $ |
|---|
| 40 | * $brcm_Date: 2/16/11 2:55p $ |
|---|
| 41 | * |
|---|
| 42 | * Module Description: |
|---|
| 43 | * |
|---|
| 44 | * Revision History: |
|---|
| 45 | * |
|---|
| 46 | * $brcm_Log: /nexus/modules/gpio/7400/src/nexus_gpio_module.h $ |
|---|
| 47 | * |
|---|
| 48 | * 5 2/16/11 2:55p randyjew |
|---|
| 49 | * SW7344-25: Add Gpio register abstraction to support AON Gpio's and |
|---|
| 50 | * other Gpio register ranges. |
|---|
| 51 | * |
|---|
| 52 | * 4 12/6/10 10:53a erickson |
|---|
| 53 | * SW7408-146: add NEXUS_Gpio_GetPinMux |
|---|
| 54 | * |
|---|
| 55 | * 3 4/8/09 4:31p vsilyaev |
|---|
| 56 | * PR 54016: Added support for precompiled header |
|---|
| 57 | * |
|---|
| 58 | * 2 1/26/09 11:29a erickson |
|---|
| 59 | * PR51468: global variable naming convention |
|---|
| 60 | * |
|---|
| 61 | * 1 1/18/08 2:21p jgarrett |
|---|
| 62 | * PR 38808: Merging to main branch |
|---|
| 63 | * |
|---|
| 64 | * Nexus_Devel/3 11/30/07 11:08a jgarrett |
|---|
| 65 | * PR 37801: Adjusting register offsets |
|---|
| 66 | * |
|---|
| 67 | * Nexus_Devel/2 11/26/07 9:45a erickson |
|---|
| 68 | * PR37423: gpio update |
|---|
| 69 | * |
|---|
| 70 | * Nexus_Devel/1 11/20/07 1:28p erickson |
|---|
| 71 | * PR37423: added uart, gpio, spi modules |
|---|
| 72 | * |
|---|
| 73 | **************************************************************************/ |
|---|
| 74 | #ifndef NEXUS_GPIO_MODULE_H__ |
|---|
| 75 | #define NEXUS_GPIO_MODULE_H__ |
|---|
| 76 | |
|---|
| 77 | #include "nexus_base.h" |
|---|
| 78 | #include "nexus_gpio_thunks.h" |
|---|
| 79 | #include "nexus_platform_features.h" |
|---|
| 80 | #include "nexus_gpio.h" |
|---|
| 81 | #include "nexus_gpio_init.h" |
|---|
| 82 | #include "priv/nexus_core.h" |
|---|
| 83 | #include "priv/nexus_gpio_priv.h" |
|---|
| 84 | #ifdef __cplusplus |
|---|
| 85 | extern "C" { |
|---|
| 86 | #endif |
|---|
| 87 | |
|---|
| 88 | #ifdef NEXUS_MODULE_SELF |
|---|
| 89 | #error Cant be in two modules at the same time |
|---|
| 90 | #endif |
|---|
| 91 | |
|---|
| 92 | #define NEXUS_MODULE_NAME gpio |
|---|
| 93 | #define NEXUS_MODULE_SELF g_NEXUS_gpioModule |
|---|
| 94 | #if BCHP_CHIP == 7344 |
|---|
| 95 | #define NEXUS_GPIO_REGISTER_ABSTRACTION 1 |
|---|
| 96 | #endif |
|---|
| 97 | struct NEXUS_Gpio { |
|---|
| 98 | BDBG_OBJECT(NEXUS_Gpio) |
|---|
| 99 | BLST_S_ENTRY(NEXUS_Gpio) link; |
|---|
| 100 | NEXUS_GpioType type; |
|---|
| 101 | unsigned pin; |
|---|
| 102 | NEXUS_GpioSettings settings; |
|---|
| 103 | /*uint32_t offset; *//* register set offset from LO */ |
|---|
| 104 | uint32_t shift; |
|---|
| 105 | NEXUS_IsrCallbackHandle isrCallback; |
|---|
| 106 | struct { |
|---|
| 107 | NEXUS_GpioIsrCallback callback_isr; |
|---|
| 108 | void *context; |
|---|
| 109 | int param; |
|---|
| 110 | }directIsrCallback; |
|---|
| 111 | struct { |
|---|
| 112 | uint32_t iodir, data, oden, mask, ec, ei, level,stat; |
|---|
| 113 | } addr; /* register addresses for GPIO abstraction */ |
|---|
| 114 | }; |
|---|
| 115 | |
|---|
| 116 | /* global handle. there is no global data. */ |
|---|
| 117 | extern NEXUS_ModuleHandle g_NEXUS_gpioModule; |
|---|
| 118 | |
|---|
| 119 | /* These functions must be implemented per-chip */ |
|---|
| 120 | NEXUS_Error NEXUS_Gpio_P_CheckPinmux(NEXUS_GpioType type, unsigned pin); |
|---|
| 121 | #if NEXUS_GPIO_REGISTER_ABSTRACTION |
|---|
| 122 | NEXUS_Error NEXUS_Gpio_P_GetPinData(NEXUS_GpioHandle gpio); |
|---|
| 123 | #else |
|---|
| 124 | NEXUS_Error NEXUS_Gpio_P_GetPinData(NEXUS_GpioType type, unsigned pin, uint32_t *pAddress, uint32_t *pShift); |
|---|
| 125 | #endif |
|---|
| 126 | NEXUS_Error NEXUS_Gpio_P_GetPinMux(NEXUS_GpioType type, unsigned pin, uint32_t *pAddr, uint32_t *pMask, unsigned *pShift); |
|---|
| 127 | |
|---|
| 128 | #ifdef __cplusplus |
|---|
| 129 | } |
|---|
| 130 | #endif |
|---|
| 131 | |
|---|
| 132 | #endif |
|---|