aboutsummaryrefslogtreecommitdiff
path: root/KSDK_1.2.0/platform/hal/inc/fsl_tpm_hal.h
blob: 17d64a746ca355c17afde123da4dfe34a83a5adc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
/*
 * Copyright (c) 2014, Freescale Semiconductor, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * o Redistributions of source code must retain the above copyright notice, this list
 *   of conditions and the following disclaimer.
 *
 * o Redistributions in binary form must reproduce the above copyright notice, this
 *   list of conditions and the following disclaimer in the documentation and/or
 *   other materials provided with the distribution.
 *
 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
 *   contributors may be used to endorse or promote products derived from this
 *   software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
#if !defined(__FSL_TPM_HAL_H__)
#define __FSL_TPM_HAL_H__

#include "fsl_device_registers.h"
#include <stdbool.h>
#include <assert.h>

#if FSL_FEATURE_SOC_TPM_COUNT

/*!
 * @addtogroup tpm_hal
 * @{
 */

/*******************************************************************************
 * Definitions
 ******************************************************************************/
/*! @brief Table of number of channels for each TPM instance */
extern const uint32_t g_tpmChannelCount[TPM_INSTANCE_COUNT];

/*! @brief TPM clock source selection for TPM_SC[CMOD].*/
typedef enum _tpm_clock_mode
{
     kTpmClockSourceNoneClk = 0,    /*TPM clock mode, None CLK*/
     kTpmClockSourceModuleClk,      /*TPM clock mode, Module CLK*/
     kTpmClockSourceExternalClk,    /*TPM clock mode, External input clock*/
     kTpmClockSourceReservedClk     /*TPM clock mode, Reserved*/
}tpm_clock_mode_t;

/*! @brief TPM counting mode, up or down*/
typedef enum _tpm_counting_mode
{
     kTpmCountingUp = 0,           /*TPM counter mode, Up counting only*/
     kTpmCountingUpDown            /*TPM counter mode, Up/Down counting mode*/
}tpm_counting_mode_t;

/*! @brief TPM prescaler factor selection for clock source*/
typedef enum _tpm_clock_ps
{
     kTpmDividedBy1 = 0,          /*TPM module clock prescaler, by 1*/
     kTpmDividedBy2 ,             /*TPM module clock prescaler, by 2*/
     kTpmDividedBy4 ,             /*TPM module clock prescaler, by 4*/
     kTpmDividedBy8,              /*TPM module clock prescaler, by 8*/
     kTpmDividedBy16,             /*TPM module clock prescaler, by 16*/
     kTpmDividedBy32,             /*TPM module clock prescaler, by 32*/
     kTpmDividedBy64,             /*TPM module clock prescaler, by 64*/
     kTpmDividedBy128             /*TPM module clock prescaler, by 128*/
}tpm_clock_ps_t;

/*! @brief TPM trigger sources, please refer to the chip reference manual for available options */
typedef enum _tpm_trigger_source_t
{
    kTpmTrigSel0 = 0,       /*!< TPM trigger source 0 */
    kTpmTrigSel1,           /*!< TPM trigger source 1 */
    kTpmTrigSel2,           /*!< TPM trigger source 2 */
    kTpmTrigSel3,           /*!< TPM trigger source 3 */
    kTpmTrigSel4,           /*!< TPM trigger source 4 */
    kTpmTrigSel5,           /*!< TPM trigger source 5 */
    kTpmTrigSel6,           /*!< TPM trigger source 6 */
    kTpmTrigSel7,           /*!< TPM trigger source 7 */
    kTpmTrigSel8,           /*!< TPM trigger source 8 */
    kTpmTrigSel9,           /*!< TPM trigger source 8 */
    kTpmTrigSel10,          /*!< TPM trigger source 10 */
    kTpmTrigSel11,          /*!< TPM trigger source 11 */
    kTpmTrigSel12,          /*!< TPM trigger source 12 */
    kTpmTrigSel13,          /*!< TPM trigger source 13 */
    kTpmTrigSel14,          /*!< TPM trigger source 14 */
    kTpmTrigSel15           /*!< TPM trigger source 15 */
}tpm_trigger_source_t;

/*! @brief TPM operation mode */
typedef enum _tpm_pwm_mode_t
{
    kTpmEdgeAlignedPWM = 0, /*!< Edge aligned mode @internal gui name="Edge aligned" */
    kTpmCenterAlignedPWM /*!< Center aligned mode @internal gui name="Center aligned" */
}tpm_pwm_mode_t;

/*! @brief TPM PWM output pulse mode, high-true or low-true on match up */
typedef enum _tpm_pwm_edge_mode_t
{
    kTpmHighTrue = 0, /*!< Clear output on match, set output on reload @internal gui name="High true" */
    kTpmLowTrue /*!< Set output on match, clear output on reload @internal gui name="Low true" */
}tpm_pwm_edge_mode_t;

/*! @brief TPM input capture modes */
typedef enum _tpm_input_capture_mode_t
{
    kTpmRisingEdge = 1,
    kTpmFallingEdge,
    kTpmRiseOrFallEdge
}tpm_input_capture_mode_t;

/*! @brief TPM output compare modes */
typedef enum _tpm_output_compare_mode_t
{
    kTpmOutputNone = 0,
    kTpmToggleOutput,
    kTpmClearOutput,
    kTpmSetOutput,
    kTpmHighPulseOutput,
    kTpmLowPulseOutput
}tpm_output_compare_mode_t;

/*! @brief Error codes for TPM driver. */
typedef enum _tpm_status
{
    kStatusTpmSuccess = 0x00U,        /*!< TPM success status.*/
    kStatusTpmFail    = 0x01U         /*!< TPM error status.*/
} tpm_status_t;

/*!
 * @brief TPM driver PWM parameter
 * @internal gui name="PWM channels configuration" id="tpmPwmCfg"
 */
typedef struct TpmPwmParam
{
    tpm_pwm_mode_t mode;          /*!< TPM PWM operation mode  @internal gui name="Mode" id="PWMmode" */
    tpm_pwm_edge_mode_t edgeMode;    /*!< PWM output mode  @internal gui name="Edge mode" id="ChannelEdgeMode" */
    uint32_t uFrequencyHZ;           /*!< PWM period in Hz  @internal gui name="Frequency" id="Frequency" */
    uint32_t uDutyCyclePercent;      /*!< PWM pulse width, value should be between 0 to 100
                                          0=inactive signal(0% duty cycle)...
                                          100=active signal (100% duty cycle).  @internal gui name="Duty cycle" id="ChannelDuty" */
}tpm_pwm_param_t;

/*******************************************************************************
 * API
 ******************************************************************************/

#if defined(__cplusplus)
extern "C" {
#endif

/*!
 * @brief reset tpm registers
 *
 * @param tpmBase TPM module base address pointer
 * @param instance The TPM peripheral instance number.
 */
void TPM_HAL_Reset(TPM_Type *tpmBase, uint32_t instance);

/*!
 * @brief Enables the TPM PWM output mode.
 *
 * @param tpmBase TPM module base address pointer
 * @param config PWM configuration parameter
 * @param channel The TPM channel number.
 */
void TPM_HAL_EnablePwmMode(TPM_Type *tpmBase, tpm_pwm_param_t *config, uint8_t channel);

/*!
 * @brief Disables the TPM channel.
 *
 * @param tpmBase TPM module base address pointer
 * @param channel The TPM channel number.
 */
void TPM_HAL_DisableChn(TPM_Type *tpmBase, uint8_t channel);

/*!
 * @brief Set TPM clock mode.
 *
 * When disabling the TPM counter, the function will wait till it receives an acknowledge from the
 * TPM clock domain
 *
 * @param tpmBase TPM module base address pointer
 * @param mode The TPM counter clock mode (source).
 */
void TPM_HAL_SetClockMode(TPM_Type *tpmBase, tpm_clock_mode_t mode);

/*!
 * @brief get TPM clock mode.
 * @param tpmBase TPM module base address pointer
 * @return The TPM counter clock mode (source).
 */
static inline tpm_clock_mode_t TPM_HAL_GetClockMode(TPM_Type *tpmBase)
{
    return (tpm_clock_mode_t) TPM_BRD_SC_CMOD(tpmBase);
}

/*!
 * @brief set TPM clock divider.
 * @param tpmBase TPM module base address pointer
 * @param ps  The TPM peripheral clock prescale divider
 */
static inline void TPM_HAL_SetClockDiv(TPM_Type *tpmBase, tpm_clock_ps_t ps)
{
    TPM_BWR_SC_PS(tpmBase, ps);
}

/*!
 * @brief get TPM clock divider.
 * @param tpmBase TPM module base address pointer
 * @return The TPM peripheral clock prescale divider.
 */
static inline tpm_clock_ps_t TPM_HAL_GetClockDiv(TPM_Type *tpmBase)
{
    return (tpm_clock_ps_t)TPM_BRD_SC_PS(tpmBase);
}

/*!
 * @brief Enable the TPM peripheral timer overflow interrupt.
 *
 * @param tpmBase TPM module base address pointer
 */
static inline void TPM_HAL_EnableTimerOverflowInt(TPM_Type *tpmBase)
{
    TPM_BWR_SC_TOIE(tpmBase, 1);
}

/*!
 * @brief Disable the TPM peripheral timer overflow interrupt.
 *
 * @param tpmBase TPM module base address pointer
 */
static inline void TPM_HAL_DisableTimerOverflowInt(TPM_Type *tpmBase)
{
    TPM_BWR_SC_TOIE(tpmBase, 0);
}

/*!
 * @brief Read the bit that controls TPM timer overflow interrupt enablement.
 *
 * @param tpmBase TPM module base address pointer
 * @return true if overflow interrupt is enabled, false if not
 */
static inline bool TPM_HAL_IsOverflowIntEnabled(TPM_Type *tpmBase)
{
    return (bool)(TPM_BRD_SC_TOIE(tpmBase));
}

/*!
 * @brief return TPM peripheral timer overflow interrupt flag.
 * @param tpmBase TPM module base address pointer
 * @return true if overflow, false if not
 */
static inline bool TPM_HAL_GetTimerOverflowStatus(TPM_Type *tpmBase)
{
    return (bool)(TPM_BRD_SC_TOF(tpmBase));
}

/*!
 * @brief Clear the TPM timer overflow interrupt flag.
 * @param tpmBase TPM module base address pointer
 */
static inline void TPM_HAL_ClearTimerOverflowFlag(TPM_Type *tpmBase)
{
    TPM_BWR_SC_TOF(tpmBase, 1);
}

/*!
 * @brief set TPM center-aligned PWM select.
 * @param tpmBase TPM module base address pointer
 * @param mode 1:upcounting mode 0:up_down counting mode.
 */
static inline void TPM_HAL_SetCpwms(TPM_Type *tpmBase, uint8_t mode)
{
    assert(mode < 2);
    TPM_BWR_SC_CPWMS(tpmBase, mode);
}

/*!
 * @brief get TPM center-aligned PWM selection value.
 * @param tpmBase TPM module base address pointer
 * @return Whether the TPM center-aligned PWM is selected or not.
 */
static inline bool TPM_HAL_GetCpwms(TPM_Type *tpmBase)
{
    return (bool)TPM_BRD_SC_CPWMS(tpmBase);
}

/*!
 * @brief clear TPM peripheral current counter value.
 * @param tpmBase TPM module base address pointer
 */
static inline void  TPM_HAL_ClearCounter(TPM_Type *tpmBase)
{
    TPM_BWR_CNT_COUNT(tpmBase, 0);
}

/*!
 * @brief return TPM peripheral current counter value.
 * @param tpmBase TPM module base address pointer
 * @return current TPM timer counter value
 */
static inline uint16_t  TPM_HAL_GetCounterVal(TPM_Type *tpmBase)
{
    return TPM_BRD_CNT_COUNT(tpmBase);
}

/*!
 * @brief set TPM peripheral timer modulo value.
 * @param tpmBase TPM module base address pointer
 * @param val The value to be set to the timer modulo
 */
static inline void TPM_HAL_SetMod(TPM_Type *tpmBase, uint16_t val)
{
    /*As RM mentioned, first clear TPM_CNT then write value to TPM_MOD*/
    TPM_BWR_CNT_COUNT(tpmBase, 0);
    TPM_BWR_MOD_MOD(tpmBase, val);
}

/*!
 * @brief return TPM peripheral counter modulo value.
 * @param tpmBase TPM module base address pointer
 * @return TPM timer modula value
 */
static inline uint16_t  TPM_HAL_GetMod(TPM_Type *tpmBase)
{
    return TPM_BRD_MOD_MOD(tpmBase);
}

/*TPM channel operate mode(Mode, edge and level selection) for capture, output, pwm*/

/*!
 * @brief Set TPM peripheral timer channel mode and edge level,
 *
 * TPM channel operate mode, MSnBA and ELSnBA shoud be set at the same time.
 *
 * @param tpmBase The TPM base address
 * @param channel  The TPM peripheral channel number
 * @param value    The value to set for MSnBA and ELSnBA
 */
static inline void TPM_HAL_SetChnMsnbaElsnbaVal(TPM_Type *tpmBase, uint8_t channel, uint8_t value)
{
    assert(channel < FSL_FEATURE_TPM_CHANNEL_COUNT);

    /* Keep CHIE bit value not changed by this function, so read it first and or with value*/
    value |= TPM_RD_CnSC(tpmBase, channel) & TPM_CnSC_CHIE_MASK;

    TPM_WR_CnSC(tpmBase, channel, value);
}

/*!
 * @brief get TPM peripheral timer channel mode.
 * @param tpmBase TPM module base address pointer
 * @param channel  The TPM peripheral channel number
 * @return The MSnB:MSnA mode value, will be 00,01, 10, 11
 */
static inline uint8_t TPM_HAL_GetChnMsnbaVal(TPM_Type *tpmBase, uint8_t channel)
{
    assert(channel < FSL_FEATURE_TPM_CHANNEL_COUNT);
    return (TPM_RD_CnSC(tpmBase, channel) & (TPM_CnSC_MSA_MASK | TPM_CnSC_MSB_MASK)) >> TPM_CnSC_MSA_SHIFT;
}

/*!
 * @brief get TPM peripheral timer channel edge level.
 * @param tpmBase TPM module base address pointer
 * @param channel  The TPM peripheral channel number
 * @return The ELSnB:ELSnA mode value, will be 00,01, 10, 11
 */
static inline uint8_t TPM_HAL_GetChnElsnbaVal(TPM_Type *tpmBase, uint8_t channel)
{
    assert(channel < FSL_FEATURE_TPM_CHANNEL_COUNT);
    return (TPM_RD_CnSC(tpmBase, channel) & (TPM_CnSC_ELSA_MASK | TPM_CnSC_ELSB_MASK)) >> TPM_CnSC_ELSA_SHIFT;
}

/*!
 * @brief enable TPM peripheral timer channel(n) interrupt.
 * @param tpmBase TPM module base address pointer
 * @param channel  The TPM peripheral channel number
 */
static inline void TPM_HAL_EnableChnInt(TPM_Type *tpmBase, uint8_t channel)
{
    assert(channel < FSL_FEATURE_TPM_CHANNEL_COUNT);
    TPM_BWR_CnSC_CHIE(tpmBase, channel, 1);
}

/*!
 * @brief disable TPM peripheral timer channel(n) interrupt.
 * @param tpmBase TPM module base address pointer
 * @param channel  The TPM peripheral channel number
 */
static inline void TPM_HAL_DisableChnInt(TPM_Type *tpmBase, uint8_t channel)
{
    assert(channel < FSL_FEATURE_TPM_CHANNEL_COUNT);
    TPM_BWR_CnSC_CHIE(tpmBase, channel, 0);
}

/*!
 * @brief get TPM peripheral timer channel(n) interrupt enabled or not.
 * @param tpmBase TPM module base address pointer
 * @param channel  The TPM peripheral channel number
 * @return Whether the TPM peripheral timer channel(n) interrupt is enabled or not.
 */
static inline bool TPM_HAL_IsChnIntEnabled(TPM_Type *tpmBase, uint8_t channel)
{
    assert(channel < FSL_FEATURE_TPM_CHANNEL_COUNT);
    return (bool)(TPM_BRD_CnSC_CHIE(tpmBase, channel));
}

/*!
 * @brief return if any event for TPM peripheral timer channel has occourred ,
 * @param tpmBase TPM module base address pointer
 * @param channel  The TPM peripheral channel number.
 * @return true if event occourred, false otherwise
 */
static inline bool TPM_HAL_GetChnStatus(TPM_Type *tpmBase, uint8_t channel)
{
    assert(channel < FSL_FEATURE_TPM_CHANNEL_COUNT);
    return (bool)(TPM_BRD_CnSC_CHF(tpmBase, channel));
}

/*!
 * @brief return if any event for TPM peripheral timer channel has occourred ,
 * @param tpmBase TPM module base address pointer
 * @param channel  The TPM peripheral channel number.
 */
static inline void TPM_HAL_ClearChnInt(TPM_Type *tpmBase, uint8_t channel)
{
    assert(channel < FSL_FEATURE_TPM_CHANNEL_COUNT);
    TPM_BWR_CnSC_CHF(tpmBase, channel, 0x1);
}

/*TPM Channel control*/
/*!
 * @brief set TPM peripheral timer channel counter value,
 * @param tpmBase TPM module base address pointer
 * @param channel  The TPM peripheral channel number.
 * @param val counter value to be set
 */
static inline void TPM_HAL_SetChnCountVal(TPM_Type *tpmBase, uint8_t channel, uint16_t val)
{
    assert(channel < FSL_FEATURE_TPM_CHANNEL_COUNT);
    TPM_BWR_CnV_VAL(tpmBase, channel, val);
}

/*!
 * @brief get TPM peripheral timer channel counter value.
 * @param tpmBase TPM module base address pointer
 * @param channel  The TPM peripheral channel number.
 * @return The TPM timer channel counter value.
 */
static inline uint16_t TPM_HAL_GetChnCountVal(TPM_Type *tpmBase, uint8_t channel)
{
    assert(channel < FSL_FEATURE_TPM_CHANNEL_COUNT);
    return TPM_BRD_CnV_VAL(tpmBase, channel);
}

/*!
 * @brief get TPM peripheral timer channel event status.
 * @param tpmBase TPM module base address pointer
 * @return The TPM timer channel event status.
 */
static inline uint32_t TPM_HAL_GetStatusRegVal(TPM_Type *tpmBase)
{
    return TPM_RD_STATUS(tpmBase);
}

/*!
 * @brief clear TPM peripheral timer clear status register value,
 * @param tpmBase TPM module base address pointer
 * @param tpm_status tpm channel or overflow flag to clear
 */
static inline void TPM_HAL_ClearStatusReg(TPM_Type *tpmBase, uint16_t tpm_status)
{
    TPM_WR_STATUS(tpmBase, tpm_status);
}

/*!
 * @brief set TPM peripheral timer trigger.
 * @param tpmBase TPM module base address pointer
 * @param trigger_num  0-15
 */
static inline void TPM_HAL_SetTriggerSrc(TPM_Type *tpmBase, tpm_trigger_source_t trigger_num)
{
    TPM_BWR_CONF_TRGSEL(tpmBase, trigger_num);
}

/*!
 * @brief set TPM peripheral timer running on trigger or not .
 * @param tpmBase TPM module base address pointer
 * @param enable true to enable, 1 to enable
 */
static inline void TPM_HAL_SetTriggerMode(TPM_Type *tpmBase, bool enable)
{
    TPM_BWR_CONF_CSOT (tpmBase, enable);
}

/*!
 * @brief enable TPM timer counter reload on selected trigger or not.
 * @param tpmBase TPM module base address pointer
 * @param enable  true to enable, false to disable.
 */
static inline void TPM_HAL_SetReloadOnTriggerMode(TPM_Type *tpmBase, bool enable)
{
    TPM_BWR_CONF_CROT(tpmBase, enable);
}

/*!
 * @brief enable TPM timer counter sotp on selected trigger or not.
 * @param tpmBase TPM module base address pointer
 * @param enable  true to enable, false to disable.
 */
static inline void TPM_HAL_SetStopOnOverflowMode(TPM_Type *tpmBase, bool enable)
{
    TPM_BWR_CONF_CSOO(tpmBase, enable);
}

/*!
 * @brief enable TPM timer global time base.
 * @param tpmBase TPM module base address pointer
 * @param enable  true to enable, false to disable.
 */
static inline void TPM_HAL_EnableGlobalTimeBase(TPM_Type *tpmBase, bool enable)
{
    TPM_BWR_CONF_GTBEEN(tpmBase, enable);
}

/*!
 * @brief set BDM mode.
 * @param tpmBase TPM module base address pointer
 * @param enable  false pause, true continue work
 */
static inline void TPM_HAL_SetDbgMode(TPM_Type *tpmBase, bool enable)
{
    TPM_BWR_CONF_DBGMODE(tpmBase, enable ? 3 : 0);
}

/*!
 * @brief set WAIT mode behavior.
 * @param tpmBase TPM module base address pointer
 * @param enable  0 continue running, 1 stop running
 */
static inline void TPM_HAL_SetWaitMode(TPM_Type *tpmBase, bool enable)
{
    TPM_BWR_CONF_DOZEEN(tpmBase, enable ? 0 : 1);
}

#if defined(__cplusplus)
}
#endif

/*! @}*/

#endif /* FSL_FEATURE_SOC_TPM_COUNT */

#endif /* __FSL_TPM_HAL_H__*/
/*******************************************************************************
 * EOF
 ******************************************************************************/