![]() |
PDL for FM0+
Version1.0
Peripheral Driverl Library for FM0+
|
00001 /******************************************************************************* 00002 * Copyright (C) 2013 Spansion LLC. All Rights Reserved. 00003 * 00004 * This software is owned and published by: 00005 * Spansion LLC, 915 DeGuigne Dr. Sunnyvale, CA 94088-3453 ("Spansion"). 00006 * 00007 * BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND 00008 * BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT. 00009 * 00010 * This software contains source code for use with Spansion 00011 * components. This software is licensed by Spansion to be adapted only 00012 * for use in systems utilizing Spansion components. Spansion shall not be 00013 * responsible for misuse or illegal use of this software for devices not 00014 * supported herein. Spansion is providing this software "AS IS" and will 00015 * not be responsible for issues arising from incorrect user implementation 00016 * of the software. 00017 * 00018 * SPANSION MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE, 00019 * REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS), 00020 * ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING, 00021 * WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED 00022 * WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED 00023 * WARRANTY OF NONINFRINGEMENT. 00024 * SPANSION SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT, 00025 * NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT 00026 * LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, 00027 * LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR 00028 * INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT, 00029 * INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA, 00030 * SAVINGS OR PROFITS, 00031 * EVEN IF SPANSION HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 00032 * YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR 00033 * INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED 00034 * FROM, THE SOFTWARE. 00035 * 00036 * This software may be replicated in part or whole for the licensed use, 00037 * with the restriction that this Disclaimer and Copyright notice must be 00038 * included with each copy of this software, whether used in part or whole, 00039 * at all times. 00040 */ 00041 /******************************************************************************/ 00051 #ifndef __FGPIO_H__ 00052 #define __FGPIO_H__ 00053 00054 /******************************************************************************/ 00055 /* Include files */ 00056 /******************************************************************************/ 00057 #include "mcu.h" 00058 #include "pdl_user.h" 00059 00060 /* C binding of definitions if building with C++ compiler */ 00061 #ifdef __cplusplus 00062 extern "C" 00063 { 00064 #endif 00065 00084 00085 /******************************************************************************/ 00086 /* \brief Fast GPIO initialization structure */ 00087 /******************************************************************************/ 00088 00089 typedef struct stc_fgpio1pin_init 00090 { 00091 boolean_t bOutput; 00092 boolean_t bInitVal; 00093 boolean_t bPullup; 00094 } stc_fgpio1pin_init_t; 00095 00096 00101 typedef enum en_fgpio_port 00102 { 00103 FGpioPort0 = 0u, 00104 FGpioPort1 = 1u, 00105 FGpioPort2 = 2u, 00106 FGpioPort3 = 3u, 00107 FGpioPort4 = 4u, 00108 FGpioPort5 = 5u, 00109 FGpioPort6 = 6u, 00110 FGpioPort7 = 7u, 00111 FGpioPort8 = 8u, 00112 FGpioPort9 = 9u, 00113 FGpioPortA = 10u, 00114 FGpioPortB = 11u, 00115 FGpioPortC = 12u, 00116 FGpioPortD = 13u, 00117 FGpioPortE = 14u, 00118 FGpioPortF = 15u, 00119 00120 }en_fgpio_port_t; 00121 00122 /******************************************************************************/ 00123 /* Defines */ 00124 /******************************************************************************/ 00125 00126 #define FGpio_EnableOutput(port, pins) do {uint32_t addr; \ 00127 addr = (uint32_t)&FM0P_GPIO->FPOER0 + (uint32_t)port*4u; \ 00128 *(uint16_t*)(addr) = pins; \ 00129 }while(0); 00130 #define FGpio_DisableOutput(port) do {uint32_t addr; \ 00131 addr = (uint32_t)&FM0P_GPIO->FPOER0 + (uint32_t)port*4u; \ 00132 *(uint16_t*)(addr) = 0x0000u; \ 00133 }while(0); 00134 00135 #define FGpio1pin_InitIn(p,settings) do{ stc_fgpio1pin_init_t __v__;\ 00136 __v__.bPullup=0u;__v__.bInitVal=0u;\ 00137 (settings);\ 00138 p##_INITIN(__v__); }while(0) 00139 00140 #define FGpio1pin_InitOut(p,settings) do{ stc_fgpio1pin_init_t __v__;\ 00141 __v__.bPullup=0u;__v__.bInitVal=0u;\ 00142 (settings);\ 00143 p##_INITOUT(__v__); }while(0) 00144 00145 #define FGpio1pin_Init(p,settings) do{ stc_fgpio1pin_init_t __v__;__v__.bOutput=0u;\ 00146 __v__.bPullup=0u;__v__.bInitVal=0u;\ 00147 (settings);\ 00148 p##_INIT( __v__ ); }while(0) 00149 00150 #define FGpio1pin_InitDirectionInput (__v__.bOutput=0u) 00151 #define FGpio1pin_InitDirectionOutput (__v__.bOutput=1u) 00152 #define FGpio1pin_InitPullup(v) (__v__.bPullup=(v)) 00153 #define FGpio1pin_InitVal(v) (__v__.bInitVal=(v)) 00154 00155 00156 00157 #define FGpio1pin_Get(p) p##_GET 00158 #define FGpio1pin_Put(p,v) p##_PUT(v) 00159 00160 00161 /******************************************************************************/ 00162 /* Inclusion of GPIO defines of user defined device */ 00163 /******************************************************************************/ 00164 00165 #if (PDL_MCU_SERIES == PDL_DEVICE_SERIES_S6E1A1) 00166 #if (PDL_PACKAGE == PDL_DEVICE_PACKAGE_B) 00167 #include "gpio_s6e1a1xb0a.h" 00168 #elif (PDL_PACKAGE == PDL_DEVICE_PACKAGE_C) 00169 #include "gpio_s6e1a1xc0a.h" 00170 #else 00171 #error Package for S6E1A1 series not found! 00172 #endif 00173 #else 00174 #error Device not found! 00175 #endif 00176 00177 00178 00179 00181 00182 #ifdef __cplusplus 00183 } 00184 #endif 00185 00186 #endif /* __GPIO_H__ */ 00187 00188 /******************************************************************************/ 00189 /* EOF (not truncated) */ 00190 /******************************************************************************/