PDL for FM0+  Version1.0
Peripheral Driverl Library for FM0+
C:/pdl_v10/library/driver/pdl.h
Go to the documentation of this file.
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 /******************************************************************************/
00052 #ifndef __PDL_H__
00053 #define __PDL_H__
00054 
00055 /******************************************************************************/
00056 /* Include files                                                              */
00057 /******************************************************************************/
00058 #include "base_types.h"
00059 
00060 /* C binding of definitions if building with C++ compiler                     */
00061 #ifdef __cplusplus
00062 extern "C"
00063 {
00064 #endif
00065 
00066 /******************************************************************************/
00067 /* Global pre-processor symbols/macros ('#define')                            */
00068 /* Macro for initializing local structures to zero                            */  
00069 /******************************************************************************/ 
00070 #define PDL_ZERO_STRUCT(x) pdl_memclr((uint8_t*)&(x), (uint32_t)(sizeof(x)))
00071    
00076 #define PDL_ON            1u    ///< Switches a feature on
00077 #define PDL_OFF           0u    ///< Switches a feature off
00078 
00085 #define PDL_TYPE1 1u  ///< FM0+ device type1
00086 #define PDL_TYPE2 2u  ///< FM0+ device type2
00087 #define PDL_TYPE3 3u  ///< FM0+ device type3
00088 #define PDL_TYPE4 4u  ///< FM0+ device type4
00089 #define PDL_TYPE5 5u  ///< FM0+ device type5
00090 
00095 #define PDL_DEVICE_SERIES_S6E1A1  10u
00096 
00101 #define PDL_DEVICE_PACKAGE_B  10u
00102 #define PDL_DEVICE_PACKAGE_C  20u
00103 
00104 /******************************************************************************/
00105 /* User Device Setting Include file                                           */
00106 /******************************************************************************/
00107 #include "pdl_device.h"  // MUST be included here!
00108 
00113 #if (PDL_MCU_SERIES == PDL_DEVICE_SERIES_S6E1A1)
00114   #if (PDL_PACKAGE == PDL_DEVICE_PACKAGE_B) || \
00115       (PDL_PACKAGE == PDL_DEVICE_PACKAGE_C)
00116     #define PDL_DEVICE_TYPE PDL_TYPE1
00117   #else
00118     #error Device Package not defined!
00119   #endif
00120 #else
00121   #error Device Series not found!
00122 #endif
00123 
00128 #define PDL_DEFAULT_INTERRUPT_LEVEL 0x0Fu
00129 
00135 // ADC
00136 #define PDL_PERIPHERAL_ADC_AVAILABLE          PDL_ON   
00137 
00138 // Base Timer
00139 #define PDL_PERIPHERAL_BT_AVAILABLE           PDL_ON   
00140 
00141 // Clock
00142 #define PDL_PERIPHERAL_CLK_AVAILABLE          PDL_ON      
00143 
00144 // Dual Timer      
00145 #define PDL_PERIPHERAL_DT_AVAILABLE           PDL_ON 
00146 
00147 // DMA     
00148 #define PDL_PERIPHERAL_DMA_AVAILABLE          PDL_ON
00149 
00150 // CR Trimming  
00151 #define PDL_PERIPHERAL_CRTRIM_AVAILABLE       PDL_ON   
00152 
00153 // CSV      
00154 #define PDL_PERIPHERAL_CSV_AVAILABLE          PDL_ON
00155 
00156 // External interrupt       
00157 #define PDL_PERIPHERAL_EXINT_AVAILABLE        PDL_ON  
00158       
00159 // Flash     
00160 #define PDL_PERIPHERAL_FLASH_AVAILABLE        PDL_ON 
00161                         
00162 // LVD    
00163 #define PDL_PERIPHERAL_LVD_AVAILABLE          PDL_ON
00164 
00165 // MFS        
00166 #define PDL_PERIPHERAL_MFS_AVAILABLE          PDL_ON
00167 
00168 // QPRC 
00169 #define PDL_PERIPHERAL_QPRC_AVAILABLE         PDL_ON  
00170 
00171 // RESET       
00172 #define PDL_PERIPHERAL_RESET_AVAILABLE        PDL_ON 
00173 
00174 // Watch counter   
00175 #define PDL_PERIPHERAL_WC_AVAILABLE           PDL_ON   
00176 
00177 // Hardware watchdog        
00178 #define PDL_PERIPHERAL_HWWDG_AVAILABLE        PDL_ON
00179 
00180 // Software watchdog        
00181 #define PDL_PERIPHERAL_SWWDG_AVAILABLE        PDL_ON
00182 
00183 // RTC          
00184 #define PDL_PERIPHERAL_RTC_AVAILABLE          PDL_ON
00185  
00186 // LCD 
00187 #define PDL_PERIPHERAL_LCD_AVAILABLE          PDL_OFF
00188 
00189 // Unique ID  
00190 #define PDL_PERIPHERAL_UID_AVAILABLE          PDL_ON
00191 
00192 
00199 
00200 #define PDL_INT_TYPE_A                      0u
00201 
00202 #define PDL_INT_TYPE_B                      1u
00203 
00204 #define PDL_INT_TYPE_C                      2u
00205 
00206 #if (PDL_DEVICE_TYPE == PDL_TYPE1)
00207     #define PDL_MCU_INT_TYPE       PDL_INT_TYPE_A
00208 #else
00209     #error MCU Interrupt Type not found!
00210 #endif
00211 
00216 #if (PDL_MCU_INT_TYPE == PDL_INT_TYPE_A)
00217     #define CSV_IRQHandler(void)               IRQ000_Handler(void) ///< CSV
00218     #define SWDT_IRQHandler(void)              IRQ001_Handler(void) ///< SW watchdog
00219     #define LVD_IRQHandler(void)               IRQ002_Handler(void) ///< LVD       
00220     #define MFT_WFG_IRQHandler(void)           IRQ003_Handler(void) ///< Interrupt Source Selection 3
00221     #define INT0_7_Handler(void)               IRQ004_Handler(void) ///< Interrupt Source Selection 4
00222     #define INT8_31_Handler(void)              IRQ005_Handler(void) ///< Interrupt Source Selection 5
00223     #define DT_QPRC_Handler(void)              IRQ006_Handler(void) ///< Interrupt Source Selection 6
00224     #define MFS0_8_RX_IRQHandler(void)         IRQ007_Handler(void) ///< Interrupt Source Selection 7
00225     #define MFS0_8_TX_IRQHandler(void)         IRQ008_Handler(void) ///< Interrupt Source Selection 8
00226     #define MFS1_9_RX_IRQHandler(void)         IRQ009_Handler(void) ///< Interrupt Source Selection 9
00227     #define MFS1_9_TX_IRQHandler(void)         IRQ010_Handler(void) ///< Interrupt Source Selection 10
00228     #define MFS2_10_RX_IRQHandler(void)        IRQ011_Handler(void) ///< External Pin Interrupt Ch. 0
00229     #define MFS2_10_TX_IRQHandler(void)        IRQ012_Handler(void) ///< External Pin Interrupt Ch. 1
00230     #define MFS3_11_RX_IRQHandler(void)        IRQ013_Handler(void) ///< External Pin Interrupt Ch. 2
00231     #define MFS3_11_TX_IRQHandler(void)        IRQ014_Handler(void) ///< External Pin Interrupt Ch. 3
00232     #define MFS4_12_RX_IRQHandler(void)        IRQ015_Handler(void) ///< External Pin Interrupt Ch. 4
00233     #define MFS4_12_TX_IRQHandler(void)        IRQ016_Handler(void) ///< External Pin Interrupt Ch. 5
00234     #define MFS5_13_RX_IRQHandler(void)        IRQ017_Handler(void) ///< External Pin Interrupt Ch. 6
00235     #define MFS5_13_TX_IRQHandler(void)        IRQ018_Handler(void) ///< External Pin Interrupt Ch. 7
00236     #define MFS6_14_RX_DMA0_IRQHandler(void)   IRQ019_Handler(void) ///< Quad Position & Revolution Counter Ch. 0
00237     #define MFS6_14_TX_DMA1_IRQHandler(void)   IRQ020_Handler(void) ///< Quad Position & Revolution Counter Ch. 1
00238     #define MFS7_15_RX_DMA2_IRQHandler(void)   IRQ021_Handler(void) ///< MFT Unit 0 Waveform Generator / DTIF Ch. 0
00239     #define MFS7_15_TX_DMA3_IRQHandler(void)   IRQ022_Handler(void) ///< MFT Unit 1 Waveform Generator / DTIF Ch. 1
00240     #define PPG_IRQHandler(void)               IRQ023_Handler(void) ///< PPG 
00241     #define TIM_IRQHandler(void)               IRQ024_Handler(void) ///< Watch Counter/Real Time Counter
00242     #define ADC0_IRQHandler(void)              IRQ025_Handler(void) ///< ADC Unit 0 
00243     #define ADC1_IRQHandler(void)              IRQ026_Handler(void) ///< ADC Unit 1
00244     #define ADC2_LCD_IRQHandler(void)          IRQ027_Handler(void) ///< ADC Unit 2/LCD
00245     #define MFT_FRT_IRQHandler(void)           IRQ028_Handler(void) ///< MFT Unit 0/1/2 Free-Run Timer
00246     #define MFT_IPC_IRQHandler(void)           IRQ029_Handler(void) ///< MFT Unit 0/1/2 Input Capture Unit
00247     #define MFT_OPC_IRQHandler(void)           IRQ030_Handler(void) ///< MFT Unit 0/1/2 Output Compare Unit  
00248     #define BT0_7_FLASH_IRQHandler(void)       IRQ031_Handler(void) ///< Base Timer ch.0~ch.7   
00249 #else
00250     #error Interrupt Type not found!
00251 #endif  
00252         
00253 /******************************************************************************/
00254 /* Global type definitions ('typedef')                                        */
00255 /******************************************************************************/
00263 typedef enum en_level
00264 {
00265     PDLLow      = 0,  
00266     PDLHigh     = 1   
00267 } en_level_t;
00268 
00276 typedef enum en_flag
00277 {
00278     PdlClr = 0,       
00279     PdlSet = 1        
00280 } en_stat_flag_t, en_int_flag_t;   
00281 /*****************************************************************************/
00282 /* Global variable declarations ('extern', definition in C source)           */
00283 /*****************************************************************************/
00284 
00285 /*****************************************************************************/
00286 /* Global function prototypes ('extern', definition in C source)             */
00287 /*****************************************************************************/
00288 
00289 /******************************************************************************
00290  * Global function prototypes
00291  ******************************************************************************/
00292 extern void pdl_memclr(uint8_t* pu32Address, uint32_t u32Count);
00293 
00298 extern void PDL_WAIT_LOOP_HOOK(void);
00299 
00300 #ifdef __cplusplus
00301 }
00302 #endif
00303 
00304 #endif /* __PDL_H__ */
00305 
00306 /******************************************************************************/
00307 /* EOF (not truncated)                                                        */
00308 /******************************************************************************/
00309