PDL for FM4  Version1.2
Peripheral Driverl Library for FM4
qprc.h
Go to the documentation of this file.
1 /*******************************************************************************
2 * Copyright (C) 2013 Spansion LLC. All Rights Reserved.
3 *
4 * This software is owned and published by:
5 * Spansion LLC, 915 DeGuigne Dr. Sunnyvale, CA 94088-3453 ("Spansion").
6 *
7 * BY DOWNLOADING, INSTALLING OR USING THIS SOFTWARE, YOU AGREE TO BE BOUND
8 * BY ALL THE TERMS AND CONDITIONS OF THIS AGREEMENT.
9 *
10 * This software contains source code for use with Spansion
11 * components. This software is licensed by Spansion to be adapted only
12 * for use in systems utilizing Spansion components. Spansion shall not be
13 * responsible for misuse or illegal use of this software for devices not
14 * supported herein. Spansion is providing this software "AS IS" and will
15 * not be responsible for issues arising from incorrect user implementation
16 * of the software.
17 *
18 * SPANSION MAKES NO WARRANTY, EXPRESS OR IMPLIED, ARISING BY LAW OR OTHERWISE,
19 * REGARDING THE SOFTWARE (INCLUDING ANY ACOOMPANYING WRITTEN MATERIALS),
20 * ITS PERFORMANCE OR SUITABILITY FOR YOUR INTENDED USE, INCLUDING,
21 * WITHOUT LIMITATION, THE IMPLIED WARRANTY OF MERCHANTABILITY, THE IMPLIED
22 * WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE OR USE, AND THE IMPLIED
23 * WARRANTY OF NONINFRINGEMENT.
24 * SPANSION SHALL HAVE NO LIABILITY (WHETHER IN CONTRACT, WARRANTY, TORT,
25 * NEGLIGENCE OR OTHERWISE) FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT
26 * LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION,
27 * LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY LOSS) ARISING FROM USE OR
28 * INABILITY TO USE THE SOFTWARE, INCLUDING, WITHOUT LIMITATION, ANY DIRECT,
29 * INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS OF DATA,
30 * SAVINGS OR PROFITS,
31 * EVEN IF SPANSION HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
32 * YOU ASSUME ALL RESPONSIBILITIES FOR SELECTION OF THE SOFTWARE TO ACHIEVE YOUR
33 * INTENDED RESULTS, AND FOR THE INSTALLATION OF, USE OF, AND RESULTS OBTAINED
34 * FROM, THE SOFTWARE.
35 *
36 * This software may be replicated in part or whole for the licensed use,
37 * with the restriction that this Disclaimer and Copyright notice must be
38 * included with each copy of this software, whether used in part or whole,
39 * at all times.
40 */
41 /******************************************************************************/
51 #ifndef __QPRC_H__
52 #define __QPRC_H__
53 
54 /******************************************************************************/
55 /* Include files */
56 /******************************************************************************/
57 #include "pdl.h"
58 
59 #if (defined(PDL_PERIPHERAL_QPRC_ACTIVE))
60 
147 
148 /******************************************************************************
149  * Global definitions
150  ******************************************************************************/
151 #define stc_qprcn_t FM4_QPRC_TypeDef
152 #define stc_qprc_nfn_t FM4_QPRC_NF_TypeDef
153 
154 #define QPRC0 (*((volatile stc_qprcn_t *) FM4_QPRC0_BASE))
155 #define QPRC1 (*((volatile stc_qprcn_t *) FM4_QPRC1_BASE))
156 #define QPRC2 (*((volatile stc_qprcn_t *) FM4_QPRC2_BASE))
157 #define QPRC3 (*((volatile stc_qprcn_t *) FM4_QPRC3_BASE))
158 
159 #define QPRCNF0 (*((volatile stc_qprc_nfn_t *) FM4_QPRC0_NF_BASE))
160 #define QPRCNF1 (*((volatile stc_qprc_nfn_t *) FM4_QPRC1_NF_BASE))
161 #define QPRCNF2 (*((volatile stc_qprc_nfn_t *) FM4_QPRC2_NF_BASE))
162 #define QPRCNF3 (*((volatile stc_qprc_nfn_t *) FM4_QPRC3_NF_BASE))
163 
164 #define QPRC_PC_OVERFLOW_INT 0
165 #define QPRC_PC_UNDERFLOW_INT 1
166 #define QPRC_PC_ZERO_INDEX_INT 2
167 
173 {
178 
180 
185 typedef enum en_qprc_pcmode
186 {
192 
197 typedef enum en_qprc_rcmode
198 {
204 
209 typedef enum en_qprc_zinedge
210 {
218 
223 typedef enum en_qprc_binedge
224 {
230 
235 typedef enum en_qprc_ainedge
236 {
242 
248 {
254 
259 typedef enum en_qprc_compmode
260 {
264 
269 typedef enum en_qprc_int
270 {
277 
279 
284 typedef struct stc_qprc_int_sel
285 {
292 
294 
299 typedef struct stc_qprc_int_cb
300 {
307 
309 
315 {
324 
326 
331 typedef struct stc_qprc_filter
332 {
336 
338 
343 typedef struct stc_qprc_config
344 {
355 
357 
362 typedef struct stc_qprc_intern_data
363 {
370 
372 
378 {
383 
384 /******************************************************************************/
385 /* Global variable definitions ('extern') */
386 /******************************************************************************/
387 
390 
391 /******************************************************************************/
392 /* Global function prototypes (definition in C source) */
393 /******************************************************************************/
394 /* C binding of definitions if building with C++ compiler */
395 #ifdef __cplusplus
396 extern "C"
397 {
398 #endif
399 
400 /* QPRC init */
401 en_result_t Qprc_Init( volatile stc_qprcn_t* pstcQprc, stc_qprc_config_t* pstcConfig );
402 /* Stop/Restart Pc Count */
403 en_result_t Qprc_StopPcCount(volatile stc_qprcn_t *pstcQprc);
404 en_result_t Qprc_RestartPcCount(volatile stc_qprcn_t *pstcQprc);
405 /* Count write/read */
406 en_result_t Qprc_SetPcCount ( volatile stc_qprcn_t* pstcQprc, uint16_t u16PcValue ) ;
407 uint16_t Qprc_GetPcCount ( volatile stc_qprcn_t* pstcQprc );
408 en_result_t Qprc_SetRcCount ( volatile stc_qprcn_t* pstcQprc, uint16_t u16RcValue );
409 uint16_t Qprc_GetRcCount ( volatile stc_qprcn_t* pstcQprc );
410 en_result_t Qprc_SetPcMaxValue( volatile stc_qprcn_t* pstcQprc, uint16_t u16PcMaxValue ) ;
411 uint16_t Qprc_GetPcMaxValue(volatile stc_qprcn_t *pstcQprc);
412 en_result_t Qprc_SetPcCompareValue( volatile stc_qprcn_t* pstcQprc, uint16_t u16PcValue ) ;
413 uint16_t Qprc_GetPcCompareValue( volatile stc_qprcn_t *pstcQprc);
414 en_result_t Qprc_SetPcRcCompareValue( volatile stc_qprcn_t* pstcQprc, uint16_t u16PcRcValue ) ;
415 uint16_t Qprc_GetPcRcCompareValue(volatile stc_qprcn_t *pstcQprc);
416 /* Mode configuration */
417 en_result_t Qprc_ConfigPcMode( volatile stc_qprcn_t* pstcQprc, en_qprc_pcmode_t enMode );
418 en_result_t Qprc_ConfigRcMode( volatile stc_qprcn_t* pstcQprc, en_qprc_rcmode_t enMode );
419 /* Interrupt configuration */
420 #if (PDL_INTERRUPT_ENABLE_QPRC0 == PDL_ON) || \
421  (PDL_INTERRUPT_ENABLE_QPRC1 == PDL_ON) || \
422  (PDL_INTERRUPT_ENABLE_QPRC2 == PDL_ON) || \
423  (PDL_INTERRUPT_ENABLE_QPRC3 == PDL_ON)
424 en_result_t Qprc_EnableInt( volatile stc_qprcn_t* pstcQprc, stc_qprc_int_sel_t* pstcIntSel,
425  stc_qprc_int_cb_t* pstcIntCallback );
426 en_result_t Qprc_DisableInt( volatile stc_qprcn_t* pstcQprc, stc_qprc_int_sel_t* pstcIntSel );
427 #endif
428 en_int_flag_t Qprc_GetIntFlag( volatile stc_qprcn_t* pstcQprc, en_qprc_int_t enIntType );
429 en_result_t Qprc_ClrIntFlag( volatile stc_qprcn_t *pstcQprc, en_qprc_int_t enIntType );
430 /* status */
431 en_stat_flag_t Qprc_GetPcOfUfDir( volatile stc_qprcn_t* pstcQprc );
432 en_stat_flag_t Qprc_GetPcDir( volatile stc_qprcn_t* pstcQprc );
433 /* IRQ handler */
434 void Qprc_IrqHandler ( volatile stc_qprcn_t* pstcQprc,
435  stc_qprc_intern_data_t* pstcQprcInternData );
436 #ifdef __cplusplus
437 }
438 #endif
439 
441 
442 #endif // #if (defined(PDL_PERIPHERAL_QPRC_ACTIVE))
443 
444 #endif /* __QPRC_H__ */
445 /******************************************************************************/
446 /* EOF (not truncated) */
447 /******************************************************************************/