PDL for FM4
Version1.2
Peripheral Driverl Library for FM4
Main Page
Modules
Data Structures
Files
File List
Globals
ppg.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
/******************************************************************************/
52
#ifndef __PPG_H__
53
#define __PPG_H__
54
55
#include "
pdl.h
"
56
57
#if (defined(PDL_PERIPHERAL_PPG_ACTIVE))
58
138
/******************************************************************************
139
* Global type definitions
140
******************************************************************************/
141
#define PPG_CH0 0
142
#define PPG_CH1 1
143
#define PPG_CH2 2
144
#define PPG_CH3 3
145
#define PPG_CH4 4
146
#define PPG_CH5 5
147
#define PPG_CH6 6
148
#define PPG_CH7 7
149
#define PPG_CH8 8
150
#define PPG_CH9 9
151
#define PPG_CH10 10
152
#define PPG_CH11 11
153
#define PPG_CH12 12
154
#define PPG_CH13 13
155
#define PPG_CH14 14
156
#define PPG_CH15 15
157
#define PPG_CH16 16
158
#define PPG_CH17 17
159
#define PPG_CH18 18
160
#define PPG_CH19 19
161
#define PPG_CH20 20
162
#define PPG_CH21 21
163
#define PPG_CH22 22
164
#define PPG_CH23 23
165
166
#define PPG_COUPLE_CH01 0
167
#define PPG_COUPLE_CH23 2
168
#define PPG_COUPLE_CH45 4
169
#define PPG_COUPLE_CH67 6
170
#define PPG_COUPLE_CH89 8
171
#define PPG_COUPLE_CH1011 10
172
#define PPG_COUPLE_CH1213 12
173
#define PPG_COUPLE_CH1415 14
174
#define PPG_COUPLE_CH1617 16
175
#define PPG_COUPLE_CH1819 18
176
#define PPG_COUPLE_CH2021 20
177
#define PPG_COUPLE_CH2223 22
178
179
#define PPG_INT_MAX_CH 9 // Including channel.0,2,4,8,10,12,16,18,20
180
181
#define PPG_UP_COUNTER_CH0 0
182
#define PPG_UP_COUNTER_CH1 1
183
#define PPG_UP_COUNTER_CH2 2
184
202
typedef
enum
en_ppg_opt_mode
203
{
204
Ppg8Bit8Bit
= 0,
205
Ppg8Bit8Pres
,
206
Ppg16Bit
,
207
Ppg16Bit16Pres
,
208
209
}
en_ppg_opt_mode_t
;
210
215
typedef
enum
en_ppg_clock
216
{
217
PpgPclkDiv1
= 0,
218
PpgPclkDiv4
,
219
PpgPclkDiv16
,
220
PpgPclkDiv64
,
221
222
}
en_ppg_clock_t
;
223
228
typedef
enum
en_ppg_trig
229
{
230
PpgSoftwareTrig
= 0,
231
PpgMftGateTrig
,
232
PpgTimingGenTrig
,
233
234
}
en_ppg_trig_t
;
235
240
typedef
enum
en_ppg_level
241
{
242
PpgNormalLevel
= 0,
243
PpgReverseLevel
,
244
245
}
en_ppg_level_t
;
246
251
typedef
struct
stc_ppg_config
252
{
253
en_ppg_opt_mode_t
enMode
;
254
en_ppg_clock_t
enEvenClock
;
255
en_ppg_clock_t
enOddClock
;
256
en_ppg_level_t
enEvenLevel
;
257
en_ppg_level_t
enOddLevel
;
258
en_ppg_trig_t
enTrig
;
259
260
}
stc_ppg_config_t
;
261
266
typedef
enum
en_ppg_gate_level
267
{
268
PpgGateHighActive
= 0,
269
PpgGateLowActive
,
270
271
}
en_ppg_gate_level_t
;
272
278
typedef
enum
en_ppg_upcnt_clk
279
{
280
PpgUpCntPclkDiv2
= 0,
281
PpgUpCntPclkDiv8
,
282
PpgUpCntPclkDiv32
,
283
PpgUpCntPclkDiv64
,
284
285
}
en_ppg_upcnt_clk_t
;
286
291
typedef
struct
stc_ppg_upcnt0_config
292
{
293
en_ppg_upcnt_clk_t
enClk
;
294
uint8_t
u8CmpValue0
;
295
uint8_t
u8CmpValue2
;
296
uint8_t
u8CmpValue4
;
297
uint8_t
u8CmpValue6
;
298
299
}
stc_ppg_upcnt0_config_t
;
300
305
typedef
struct
stc_timer0_gen_ch
306
{
307
boolean_t
bPpgCh0
;
308
boolean_t
bPpgCh2
;
309
boolean_t
bPpgCh4
;
310
boolean_t
bPpgCh6
;
311
312
}
stc_timer0_gen_ch_t
;
313
318
typedef
struct
stc_ppg_upcnt1_config
319
{
320
en_ppg_upcnt_clk_t
enClk
;
321
uint8_t
u8CmpValue8
;
322
uint8_t
u8CmpValue10
;
323
uint8_t
u8CmpValue12
;
324
uint8_t
u8CmpValue14
;
325
326
}
stc_ppg_upcnt1_config_t
;
327
332
typedef
struct
stc_timer1_gen_ch
333
{
334
boolean_t
bPpgCh8
;
335
boolean_t
bPpgCh10
;
336
boolean_t
bPpgCh12
;
337
boolean_t
bPpgCh14
;
338
339
}
stc_timer1_gen_ch_t
;
340
345
typedef
struct
stc_ppg_upcnt2_config
346
{
347
en_ppg_upcnt_clk_t
enClk
;
348
uint8_t
u8CmpValue16
;
349
uint8_t
u8CmpValue18
;
350
uint8_t
u8CmpValue20
;
351
uint8_t
u8CmpValue22
;
352
353
}
stc_ppg_upcnt2_config_t
;
354
359
typedef
struct
stc_timer2_gen_ch
360
{
361
boolean_t
bPpgCh16
;
362
boolean_t
bPpgCh18
;
363
boolean_t
bPpgCh20
;
364
boolean_t
bPpgCh22
;
365
366
}
stc_timer2_gen_ch_t
;
367
372
typedef
enum
en_ppg_int_mode
373
{
374
PpgHighUnderflow
,
375
PpgHighAndLowUnderflow
,
376
377
}
en_ppg_int_mode_t
;
378
383
typedef
enum
en_igbt_prohibition_mode
384
{
385
IgbtNormalMode
= 0,
386
IgbtStopProhibitionMode
,
387
388
}
en_igbt_prohibition_mode_t
;
389
394
typedef
enum
en_igbt_filter_width
395
{
396
IgbtNoFilter
= 0,
397
IgbtFilter4Pclk
,
398
IgbtFilter8Pclk
,
399
IgbtFilter16Pclk
,
400
IgbtFilter32Pclk
,
401
402
}
en_igbt_filter_width_t
;
403
408
typedef
enum
en_igbt_level
409
{
410
IgbtLevelNormal
= 0,
411
IgbtLevelInvert
,
412
413
}
en_igbt_level_t
;
414
419
typedef
struct
stc_ppg_igbt_config
420
{
421
en_igbt_prohibition_mode_t
enMode
;
422
en_igbt_filter_width_t
enWidth
;
423
en_igbt_level_t
enTrigInputLevel
;
424
en_igbt_level_t
enIgbt0OutputLevel
;
425
en_igbt_level_t
enIgbt1OutputLevel
;
426
427
}
stc_ppg_igbt_config_t
;
428
433
typedef
enum
en_ppg_irq_ch
434
{
435
PpgCh024
,
436
PpgCh81012
,
437
PpgCh161820
,
438
439
}
en_ppg_irq_ch_t
;
440
441
/* C binding of definitions if building with C++ compiler */
442
#ifdef __cplusplus
443
extern
"C"
444
{
445
#endif
446
/* 1. Init */
447
en_result_t
Ppg_Init
( uint8_t u8CoupleCh,
stc_ppg_config_t
*pstcConfig);
448
/* 2. Trigger configuration */
449
/* software */
450
en_result_t
Ppg_StartSoftwareTrig
(uint8_t u8Ch);
451
en_result_t
Ppg_StopSoftwareTrig
(uint8_t u8Ch);
452
/* MFT gate signal */
453
en_result_t
Ppg_SelGateLevel
(uint8_t u8EvenCh,
en_ppg_gate_level_t
enLevel);
454
/* Timing generator configuration */
455
en_result_t
Ppg_ConfigUpCnt0
(
stc_ppg_upcnt0_config_t
* pstcConfig);
456
void
Ppg_StartUpCnt0
(
void
);
457
en_stat_flag_t
Ppg_GetUpCnt0Status
(
void
);
458
en_result_t
Ppg_DisableTimerGen0StartTrig
(
stc_timer0_gen_ch_t
* pstcTimer0GenCh);
459
460
en_result_t
Ppg_ConfigUpCnt1
(
stc_ppg_upcnt1_config_t
* pstcConfig);
461
void
Ppg_StartUpCnt1
(
void
);
462
en_stat_flag_t
Ppg_GetUpCnt1Status
(
void
);
463
en_result_t
Ppg_DisableTimerGen1StartTrig
(
stc_timer1_gen_ch_t
* pstcTimer1GenCh);
464
465
en_result_t
Ppg_ConfigUpCnt2
(
stc_ppg_upcnt2_config_t
* pstcConfig);
466
void
Ppg_StartUpCnt2
(
void
);
467
en_stat_flag_t
Ppg_GetUpCnt2Status
(
void
);
468
en_result_t
Ppg_DisableTimerGen2StartTrig
(
stc_timer2_gen_ch_t
* pstcTimer2GenCh);
469
/* 3. Int */
470
#if (PDL_INTERRUPT_ENABLE_PPG00_02_04 == PDL_ON) || \
471
(PDL_INTERRUPT_ENABLE_PPG08_10_12 == PDL_ON) || \
472
(PDL_INTERRUPT_ENABLE_PPG16_18_20 == PDL_ON)
473
en_result_t
Ppg_EnableInt
(uint8_t u8Ch,
en_ppg_int_mode_t
enIntMode,
func_ptr_t
pfnCallback);
474
en_result_t
Ppg_DisableInt
(uint8_t u8Ch);
475
#endif
476
en_int_flag_t
Ppg_GetIntFlag
(uint8_t u8Ch);
477
en_result_t
Ppg_ClrIntFlag
(uint8_t u8Ch);
478
/* 4. H/L width set */
479
en_result_t
Ppg_SetLevelWidth
(uint8_t u8Ch, uint8_t u8LowWidth, uint8_t u8HighWidth);
480
/* 5. IGBT mode */
481
en_result_t
Ppg_InitIgbt
(
stc_ppg_igbt_config_t
* pstcPpgIgbt);
482
void
Ppg_EnableIgbtMode
(
void
);
483
void
Ppg_DisableIgbtMode
(
void
);
484
/* 6. IRQ handler */
485
void
Ppg_IrqHandler
(
en_ppg_irq_ch_t
u8Ch) ;
486
487
#ifdef __cplusplus
488
}
489
#endif
490
492
493
#endif
494
495
#endif
PDL_1_2
library
driver
ppg
ppg.h
Generated on Wed May 28 2014 09:28:11 for PDL for FM4 by
1.8.3.1