RTEMS 6.1-rc5
Loading...
Searching...
No Matches
fsl_pwm.h
1/*
2 * Copyright (c) 2015, Freescale Semiconductor, Inc.
3 * Copyright 2016-2022 NXP
4 * All rights reserved.
5 *
6 * SPDX-License-Identifier: BSD-3-Clause
7 */
8#ifndef _FSL_PWM_H_
9#define _FSL_PWM_H_
10
11#include "fsl_common.h"
12
18/*******************************************************************************
19 * Definitions
20 ******************************************************************************/
23#define FSL_PWM_DRIVER_VERSION (MAKE_VERSION(2, 5, 1))
25
27#define PWM_SUBMODULE_SWCONTROL_WIDTH 2
29#define PWM_SUBMODULE_CHANNEL 2
30
32typedef enum _pwm_submodule
33{
39
41typedef enum _pwm_channels
42{
43 kPWM_PwmB = 0U,
44 kPWM_PwmA,
45 kPWM_PwmX
47
50{
58
61{
67 kPWM_ValueRegisterMask_5 = (1U << 5)
68};
69
72{
77
80{
90
93{
104
107{
114
117{
123
126{
144
147{
153
156{
160 kPWM_FaultDisable_3 = (1U << 3)
162
165{
166 kPWM_faultchannel_0 = 0U,
167 kPWM_faultchannel_1
169
172{
178
181{
187
190{
195
198{
204
207{
213
216{
234 kPWM_Fault3InterruptEnable = (1U << 19)
236
239{
246 kPWM_CaptureX0Flag = (1U << 6),
247 kPWM_CaptureX1Flag = (1U << 7),
248 kPWM_CaptureB0Flag = (1U << 8),
249 kPWM_CaptureB1Flag = (1U << 9),
250 kPWM_CaptureA0Flag = (1U << 10),
251 kPWM_CaptureA1Flag = (1U << 11),
252 kPWM_ReloadFlag = (1U << 12),
253 kPWM_ReloadErrorFlag = (1U << 13),
254 kPWM_RegUpdatedFlag = (1U << 14),
255 kPWM_Fault0Flag = (1U << 16),
256 kPWM_Fault1Flag = (1U << 17),
257 kPWM_Fault2Flag = (1U << 18),
258 kPWM_Fault3Flag = (1U << 19)
260
262typedef enum _pwm_dma_enable
263{
269 kPWM_CaptureA1DMAEnable = (1U << 5)
271
274{
280
283{
287
289typedef enum _pwm_mode
290{
296
299{
303
306{
308 0U,
313
316{
320
323{
328
331{
335 kPWM_Control_Module_3 = (1U << 3)
337
339typedef struct _pwm_signal_param
340{
346 uint16_t deadtimeValue;
350
360typedef struct _pwm_config
361{
364#if !defined(FSL_FEATURE_PWM_HAS_NO_WAITEN) || (!FSL_FEATURE_PWM_HAS_NO_WAITEN)
367#endif /* FSL_FEATURE_PWM_HAS_NO_WAITEN */
378
381{
387
389typedef struct _pwm_fault_param
390{
398
403{
415
416/*******************************************************************************
417 * API
418 ******************************************************************************/
419
420#if defined(__cplusplus)
421extern "C" {
422#endif
423
441
448void PWM_Deinit(PWM_Type *base, pwm_submodule_t subModule);
449
469
496 pwm_submodule_t subModule,
497 const pwm_signal_param_t *chnlParams,
498 uint8_t numOfChnls,
499 pwm_mode_t mode,
500 uint32_t pwmFreq_Hz,
501 uint32_t srcClock_Hz);
502
518 pwm_submodule_t subModule,
519 pwm_channels_t pwmChannel,
520 uint32_t pwmFreq_Hz,
521 uint32_t srcClock_Hz,
522 uint8_t shiftvalue,
523 bool doSync);
524
541 pwm_submodule_t subModule,
542 pwm_channels_t pwmSignal,
543 pwm_mode_t currPwmMode,
544 uint8_t dutyCyclePercent);
545
562 PWM_Type *base, pwm_submodule_t subModule, pwm_channels_t pwmSignal, pwm_mode_t currPwmMode, uint16_t dutyCycle);
563
578 pwm_submodule_t subModule,
579 pwm_channels_t pwmChannel,
580 const pwm_input_capture_param_t *inputCaptureParams);
581
588void PWM_SetupFaultInputFilter(PWM_Type *base, const pwm_fault_input_filter_param_t *faultInputFilterParams);
589
599void PWM_SetupFaults(PWM_Type *base, pwm_fault_input_t faultNum, const pwm_fault_param_t *faultParams);
600
614
627 pwm_submodule_t subModule,
628 pwm_channels_t pwmChannel,
629 pwm_force_signal_t mode);
630
644void PWM_EnableInterrupts(PWM_Type *base, pwm_submodule_t subModule, uint32_t mask);
645
654void PWM_DisableInterrupts(PWM_Type *base, pwm_submodule_t subModule, uint32_t mask);
655
665uint32_t PWM_GetEnabledInterrupts(PWM_Type *base, pwm_submodule_t subModule);
666
681static inline void PWM_DMAFIFOWatermarkControl(PWM_Type *base,
682 pwm_submodule_t subModule,
683 pwm_watermark_control_t pwm_watermark_control)
684{
685 uint16_t reg = base->SM[subModule].DMAEN;
686 if (pwm_watermark_control == kPWM_FIFOWatermarksOR)
687 {
688 reg &= ~((uint16_t)PWM_DMAEN_FAND_MASK);
689 }
690 else
691 {
692 reg |= ((uint16_t)PWM_DMAEN_FAND_MASK);
693 }
694 base->SM[subModule].DMAEN = reg;
695}
696
704static inline void PWM_DMACaptureSourceSelect(PWM_Type *base,
705 pwm_submodule_t subModule,
706 pwm_dma_source_select_t pwm_dma_source_select)
707{
708 uint16_t reg = base->SM[subModule].DMAEN;
709
710 reg &= ~((uint16_t)PWM_DMAEN_CAPTDE_MASK);
711 reg |= (((uint16_t)pwm_dma_source_select << (uint16_t)PWM_DMAEN_CAPTDE_SHIFT) & (uint16_t)PWM_DMAEN_CAPTDE_MASK);
712
713 base->SM[subModule].DMAEN = reg;
714}
715
725static inline void PWM_EnableDMACapture(PWM_Type *base, pwm_submodule_t subModule, uint16_t mask, bool activate)
726{
727 uint16_t reg = base->SM[subModule].DMAEN;
728 if (activate)
729 {
730 reg |= (uint16_t)(mask);
731 }
732 else
733 {
734 reg &= ~((uint16_t)(mask));
735 }
736 base->SM[subModule].DMAEN = reg;
737}
738
746static inline void PWM_EnableDMAWrite(PWM_Type *base, pwm_submodule_t subModule, bool activate)
747{
748 uint16_t reg = base->SM[subModule].DMAEN;
749 if (activate)
750 {
751 reg |= ((uint16_t)PWM_DMAEN_VALDE_MASK);
752 }
753 else
754 {
755 reg &= ~((uint16_t)PWM_DMAEN_VALDE_MASK);
756 }
757 base->SM[subModule].DMAEN = reg;
758}
759
776uint32_t PWM_GetStatusFlags(PWM_Type *base, pwm_submodule_t subModule);
777
786void PWM_ClearStatusFlags(PWM_Type *base, pwm_submodule_t subModule, uint32_t mask);
787
805static inline void PWM_StartTimer(PWM_Type *base, uint8_t subModulesToStart)
806{
807 base->MCTRL |= PWM_MCTRL_RUN(subModulesToStart);
808}
809
820static inline void PWM_StopTimer(PWM_Type *base, uint8_t subModulesToStop)
821{
822 base->MCTRL &= ~(PWM_MCTRL_RUN(subModulesToStop));
823}
824
840static inline void PWM_SetVALxValue(PWM_Type *base,
841 pwm_submodule_t subModule,
842 pwm_value_register_t valueRegister,
843 uint16_t value)
844{
845 switch (valueRegister)
846 {
848 base->SM[subModule].VAL0 = value;
849 break;
851 base->SM[subModule].VAL1 = value;
852 break;
854 base->SM[subModule].VAL2 = value;
855 break;
857 base->SM[subModule].VAL3 = value;
858 break;
860 base->SM[subModule].VAL4 = value;
861 break;
863 base->SM[subModule].VAL5 = value;
864 break;
865 default:
866 assert(false);
867 break;
868 }
869}
870
879static inline uint16_t PWM_GetVALxValue(PWM_Type *base, pwm_submodule_t subModule, pwm_value_register_t valueRegister)
880{
881 uint16_t temp = 0U;
882
883 switch (valueRegister)
884 {
886 temp = base->SM[subModule].VAL0;
887 break;
889 temp = base->SM[subModule].VAL1;
890 break;
892 temp = base->SM[subModule].VAL2;
893 break;
895 temp = base->SM[subModule].VAL3;
896 break;
898 temp = base->SM[subModule].VAL4;
899 break;
901 temp = base->SM[subModule].VAL5;
902 break;
903 default:
904 assert(false);
905 break;
906 }
907
908 return temp;
909}
910
923static inline void PWM_OutputTriggerEnable(PWM_Type *base,
924 pwm_submodule_t subModule,
925 pwm_value_register_t valueRegister,
926 bool activate)
927{
928 if (activate)
929 {
930 base->SM[subModule].TCTRL |= ((uint16_t)1U << (uint16_t)valueRegister);
931 }
932 else
933 {
934 base->SM[subModule].TCTRL &= ~((uint16_t)1U << (uint16_t)valueRegister);
935 }
936}
937
948static inline void PWM_ActivateOutputTrigger(PWM_Type *base, pwm_submodule_t subModule, uint16_t valueRegisterMask)
949{
950 base->SM[subModule].TCTRL |= (PWM_TCTRL_OUT_TRIG_EN_MASK & (valueRegisterMask));
951}
952
963static inline void PWM_DeactivateOutputTrigger(PWM_Type *base, pwm_submodule_t subModule, uint16_t valueRegisterMask)
964{
965 base->SM[subModule].TCTRL &= ~(PWM_TCTRL_OUT_TRIG_EN_MASK & (valueRegisterMask));
966}
967
979static inline void PWM_SetupSwCtrlOut(PWM_Type *base, pwm_submodule_t subModule, pwm_channels_t pwmChannel, bool value)
980{
981 if (value)
982 {
983 base->SWCOUT |=
984 ((uint16_t)1U << (((uint16_t)subModule * (uint16_t)PWM_SUBMODULE_SWCONTROL_WIDTH) + (uint16_t)pwmChannel));
985 }
986 else
987 {
988 base->SWCOUT &=
989 ~((uint16_t)1U << (((uint16_t)subModule * (uint16_t)PWM_SUBMODULE_SWCONTROL_WIDTH) + (uint16_t)pwmChannel));
990 }
991}
992
1006static inline void PWM_SetPwmLdok(PWM_Type *base, uint8_t subModulesToUpdate, bool value)
1007{
1008 if (value)
1009 {
1010 base->MCTRL |= PWM_MCTRL_LDOK(subModulesToUpdate);
1011 }
1012 else
1013 {
1014 base->MCTRL |= PWM_MCTRL_CLDOK(subModulesToUpdate);
1015 }
1016}
1017
1031static inline void PWM_SetPwmFaultState(PWM_Type *base,
1032 pwm_submodule_t subModule,
1033 pwm_channels_t pwmChannel,
1034 pwm_fault_state_t faultState)
1035{
1036 uint16_t reg = base->SM[subModule].OCTRL;
1037 switch (pwmChannel)
1038 {
1039 case kPWM_PwmA:
1040 reg &= ~((uint16_t)PWM_OCTRL_PWMAFS_MASK);
1041 reg |= (((uint16_t)faultState << (uint16_t)PWM_OCTRL_PWMAFS_SHIFT) & (uint16_t)PWM_OCTRL_PWMAFS_MASK);
1042 break;
1043 case kPWM_PwmB:
1044 reg &= ~((uint16_t)PWM_OCTRL_PWMBFS_MASK);
1045 reg |= (((uint16_t)faultState << (uint16_t)PWM_OCTRL_PWMBFS_SHIFT) & (uint16_t)PWM_OCTRL_PWMBFS_MASK);
1046 break;
1047 case kPWM_PwmX:
1048 reg &= ~((uint16_t)PWM_OCTRL_PWMXFS_MASK);
1049 reg |= (((uint16_t)faultState << (uint16_t)PWM_OCTRL_PWMXFS_SHIFT) & (uint16_t)PWM_OCTRL_PWMXFS_MASK);
1050 break;
1051 default:
1052 assert(false);
1053 break;
1054 }
1055 base->SM[subModule].OCTRL = reg;
1056}
1057
1073static inline void PWM_SetupFaultDisableMap(PWM_Type *base,
1074 pwm_submodule_t subModule,
1075 pwm_channels_t pwmChannel,
1076 pwm_fault_channels_t pwm_fault_channels,
1077 uint16_t value)
1078{
1079 uint16_t reg = base->SM[subModule].DISMAP[pwm_fault_channels];
1080 switch (pwmChannel)
1081 {
1082 case kPWM_PwmA:
1083 reg &= ~((uint16_t)PWM_DISMAP_DIS0A_MASK);
1084 reg |= (((uint16_t)(value) << (uint16_t)PWM_DISMAP_DIS0A_SHIFT) & (uint16_t)PWM_DISMAP_DIS0A_MASK);
1085 break;
1086 case kPWM_PwmB:
1087 reg &= ~((uint16_t)PWM_DISMAP_DIS0B_MASK);
1088 reg |= (((uint16_t)(value) << (uint16_t)PWM_DISMAP_DIS0B_SHIFT) & (uint16_t)PWM_DISMAP_DIS0B_MASK);
1089 break;
1090 case kPWM_PwmX:
1091 reg &= ~((uint16_t)PWM_DISMAP_DIS0X_MASK);
1092 reg |= (((uint16_t)(value) << (uint16_t)PWM_DISMAP_DIS0X_SHIFT) & (uint16_t)PWM_DISMAP_DIS0X_MASK);
1093 break;
1094 default:
1095 assert(false);
1096 break;
1097 }
1098 base->SM[subModule].DISMAP[pwm_fault_channels] = reg;
1099}
1100
1110static inline void PWM_OutputEnable(PWM_Type *base, pwm_channels_t pwmChannel, pwm_submodule_t subModule)
1111{
1112 /* Set PWM output */
1113 switch (pwmChannel)
1114 {
1115 case kPWM_PwmA:
1116 base->OUTEN |= ((uint16_t)1U << ((uint16_t)PWM_OUTEN_PWMA_EN_SHIFT + (uint16_t)subModule));
1117 break;
1118 case kPWM_PwmB:
1119 base->OUTEN |= ((uint16_t)1U << ((uint16_t)PWM_OUTEN_PWMB_EN_SHIFT + (uint16_t)subModule));
1120 break;
1121 case kPWM_PwmX:
1122 base->OUTEN |= ((uint16_t)1U << ((uint16_t)PWM_OUTEN_PWMX_EN_SHIFT + (uint16_t)subModule));
1123 break;
1124 default:
1125 assert(false);
1126 break;
1127 }
1128}
1129
1139static inline void PWM_OutputDisable(PWM_Type *base, pwm_channels_t pwmChannel, pwm_submodule_t subModule)
1140{
1141 switch (pwmChannel)
1142 {
1143 case kPWM_PwmA:
1144 base->OUTEN &= ~((uint16_t)1U << ((uint16_t)PWM_OUTEN_PWMA_EN_SHIFT + (uint16_t)subModule));
1145 break;
1146 case kPWM_PwmB:
1147 base->OUTEN &= ~((uint16_t)1U << ((uint16_t)PWM_OUTEN_PWMB_EN_SHIFT + (uint16_t)subModule));
1148 break;
1149 case kPWM_PwmX:
1150 base->OUTEN &= ~((uint16_t)1U << ((uint16_t)PWM_OUTEN_PWMX_EN_SHIFT + (uint16_t)subModule));
1151 break;
1152 default:
1153 assert(false);
1154 break;
1155 }
1156}
1157
1167uint8_t PWM_GetPwmChannelState(PWM_Type *base, pwm_submodule_t subModule, pwm_channels_t pwmChannel);
1168
1181status_t PWM_SetOutputToIdle(PWM_Type *base, pwm_channels_t pwmChannel, pwm_submodule_t subModule, bool idleStatus);
1182
1190void PWM_SetClockMode(PWM_Type *base, pwm_submodule_t subModule, pwm_clock_prescale_t prescaler);
1191
1202 pwm_submodule_t subModule,
1203 pwm_channels_t pwmChannel,
1204 bool forcetozero);
1205
1215 pwm_submodule_t subModule,
1216 pwm_channels_t pwmChannel,
1217 pwm_output_state_t outputstate);
1218
1219#if defined(__cplusplus)
1220}
1221#endif
1222
1225#endif /* _FSL_PWM_H_ */
#define PWM_MCTRL_CLDOK(x)
Definition: MIMXRT1052.h:37610
#define PWM_MCTRL_RUN(x)
Definition: MIMXRT1052.h:37618
#define PWM_MCTRL_LDOK(x)
Definition: MIMXRT1052.h:37604
int32_t status_t
Type used for all status and error return values.
Definition: fsl_common.h:225
struct _pwm_fault_param pwm_fault_param_t
Structure is used to hold the parameters to configure a PWM fault.
enum _pwm_load_frequency pwm_load_frequency_t
PWM load frequency selection.
_pwm_level_select
PWM output pulse mode, high-true or low-true.
Definition: fsl_pwm.h:299
struct _pwm_input_capture_param pwm_input_capture_param_t
Structure is used to hold parameters to configure the capture capability of a signal pin.
enum _pwm_dma_source_select pwm_dma_source_select_t
List of PWM capture DMA enable source select.
enum _pwm_clock_source pwm_clock_source_t
PWM clock source selection.
void PWM_EnableInterrupts(PWM_Type *base, pwm_submodule_t subModule, uint32_t mask)
Enables the selected PWM interrupts.
Definition: fsl_pwm.c:988
_pwm_load_frequency
PWM load frequency selection.
Definition: fsl_pwm.h:126
struct _pwm_fault_input_filter_param pwm_fault_input_filter_param_t
Structure for the user to configure the fault input filter.
enum _pwm_input_capture_edge pwm_input_capture_edge_t
PWM capture edge select.
_pwm_value_register_mask
List of PWM value registers mask.
Definition: fsl_pwm.h:61
void PWM_Deinit(PWM_Type *base, pwm_submodule_t subModule)
Gate the PWM submodule clock.
Definition: fsl_pwm.c:206
enum _pwm_force_signal pwm_force_signal_t
PWM output options when a FORCE_OUT signal is asserted.
enum _pwm_status_flags pwm_status_flags_t
List of PWM status flags.
_pwm_value_register
List of PWM value registers.
Definition: fsl_pwm.h:50
_pwm_interrupt_enable
List of PWM interrupt options.
Definition: fsl_pwm.h:216
_pwm_fault_disable
List of PWM fault disable mapping selections.
Definition: fsl_pwm.h:156
uint32_t PWM_GetEnabledInterrupts(PWM_Type *base, pwm_submodule_t subModule)
Gets the enabled PWM interrupts.
Definition: fsl_pwm.c:1019
enum _pwm_value_register pwm_value_register_t
List of PWM value registers.
void PWM_UpdatePwmDutycycleHighAccuracy(PWM_Type *base, pwm_submodule_t subModule, pwm_channels_t pwmSignal, pwm_mode_t currPwmMode, uint16_t dutyCycle)
Updates the PWM signal's dutycycle with 16-bit accuracy.
Definition: fsl_pwm.c:625
_pwm_fault_channels
List of PWM fault channels.
Definition: fsl_pwm.h:165
void PWM_SetPwmForceOutputToZero(PWM_Type *base, pwm_submodule_t subModule, pwm_channels_t pwmChannel, bool forcetozero)
This function enables-disables the forcing of the output of a given eFlexPwm channel to logic 0.
Definition: fsl_pwm.c:1214
enum _pwm_fault_recovery_mode pwm_fault_recovery_mode_t
Options available on how to re-enable the PWM output when recovering from a fault.
status_t PWM_SetupPwm(PWM_Type *base, pwm_submodule_t subModule, const pwm_signal_param_t *chnlParams, uint8_t numOfChnls, pwm_mode_t mode, uint32_t pwmFreq_Hz, uint32_t srcClock_Hz)
Sets up the PWM signals for a PWM submodule.
Definition: fsl_pwm.c:287
enum _pwm_output_state pwm_output_state_t
PWM channel output status.
enum _pwm_clock_prescale pwm_clock_prescale_t
PWM prescaler factor selection for clock source.
enum _pwm_fault_channels pwm_fault_channels_t
List of PWM fault channels.
_pwm_channels
List of PWM channels in each module.
Definition: fsl_pwm.h:42
_pwm_chnl_pair_operation
Options available for the PWM A & B pair operation.
Definition: fsl_pwm.h:190
void PWM_ClearStatusFlags(PWM_Type *base, pwm_submodule_t subModule, uint32_t mask)
Clears the PWM status flags.
Definition: fsl_pwm.c:1055
_pwm_force_output_trigger
Options that can trigger a PWM FORCE_OUT.
Definition: fsl_pwm.h:93
void PWM_SetupFaults(PWM_Type *base, pwm_fault_input_t faultNum, const pwm_fault_param_t *faultParams)
Sets up the PWM fault protection.
Definition: fsl_pwm.c:848
_pwm_init_source
PWM counter initialization options.
Definition: fsl_pwm.h:117
#define PWM_SUBMODULE_SWCONTROL_WIDTH
Definition: fsl_pwm.h:27
void PWM_SetChannelOutput(PWM_Type *base, pwm_submodule_t subModule, pwm_channels_t pwmChannel, pwm_output_state_t outputstate)
This function set the output state of the PWM pin as requested for the current cycle.
Definition: fsl_pwm.c:1259
_pwm_submodule
List of PWM submodules.
Definition: fsl_pwm.h:33
enum _pwm_channels pwm_channels_t
List of PWM channels in each module.
void PWM_SetupInputCapture(PWM_Type *base, pwm_submodule_t subModule, pwm_channels_t pwmChannel, const pwm_input_capture_param_t *inputCaptureParams)
Sets up the PWM input capture.
Definition: fsl_pwm.c:742
_pwm_watermark_control
PWM FIFO Watermark AND Control.
Definition: fsl_pwm.h:283
_pwm_dma_source_select
List of PWM capture DMA enable source select.
Definition: fsl_pwm.h:274
_pwm_mode
PWM operation mode.
Definition: fsl_pwm.h:290
struct _pwm_config pwm_config_t
PWM config structure.
_pwm_fault_recovery_mode
Options available on how to re-enable the PWM output when recovering from a fault.
Definition: fsl_pwm.h:207
uint32_t PWM_GetStatusFlags(PWM_Type *base, pwm_submodule_t subModule)
Gets the PWM status flags.
Definition: fsl_pwm.c:1037
void PWM_UpdatePwmDutycycle(PWM_Type *base, pwm_submodule_t subModule, pwm_channels_t pwmSignal, pwm_mode_t currPwmMode, uint8_t dutyCyclePercent)
Updates the PWM signal's dutycycle.
Definition: fsl_pwm.c:597
void PWM_FaultDefaultConfig(pwm_fault_param_t *config)
Fill in the PWM fault config struct with the default settings.
Definition: fsl_pwm.c:936
enum _pwm_force_output_trigger pwm_force_output_trigger_t
Options that can trigger a PWM FORCE_OUT.
enum _pwm_submodule pwm_submodule_t
List of PWM submodules.
_pwm_register_reload
Options available on how to load the buffered-registers with new values.
Definition: fsl_pwm.h:198
_pwm_clock_prescale
PWM prescaler factor selection for clock source.
Definition: fsl_pwm.h:80
enum _pwm_reload_source_select pwm_reload_source_select_t
PWM reload source select.
enum _pwm_fault_disable pwm_fault_disable_t
List of PWM fault disable mapping selections.
enum _pwm_module_control pwm_module_control_t
Options for submodule master control operation.
enum _pwm_fault_state pwm_fault_state_t
PWM output fault status.
struct _pwm_signal_param pwm_signal_param_t
Structure for the user to define the PWM signal characteristics.
_pwm_force_signal
PWM output options when a FORCE_OUT signal is asserted.
Definition: fsl_pwm.h:181
enum _pwm_register_reload pwm_register_reload_t
Options available on how to load the buffered-registers with new values.
enum _pwm_init_source pwm_init_source_t
PWM counter initialization options.
void PWM_SetupForceSignal(PWM_Type *base, pwm_submodule_t subModule, pwm_channels_t pwmChannel, pwm_force_signal_t mode)
Selects the signal to output on a PWM pin when a FORCE_OUT signal is asserted.
Definition: fsl_pwm.c:964
enum _pwm_mode pwm_mode_t
PWM operation mode.
status_t PWM_Init(PWM_Type *base, pwm_submodule_t subModule, const pwm_config_t *config)
Ungates the PWM submodule clock and configures the peripheral for basic operation.
Definition: fsl_pwm.c:94
status_t PWM_SetupPwmPhaseShift(PWM_Type *base, pwm_submodule_t subModule, pwm_channels_t pwmChannel, uint32_t pwmFreq_Hz, uint32_t srcClock_Hz, uint8_t shiftvalue, bool doSync)
Set PWM phase shift for PWM channel running on channel PWM_A, PWM_B which with 50% duty cycle....
Definition: fsl_pwm.c:506
enum _pwm_fault_input pwm_fault_input_t
List of PWM fault selections.
enum _pwm_dma_enable pwm_dma_enable_t
List of PWM DMA options.
_pwm_status_flags
List of PWM status flags.
Definition: fsl_pwm.h:239
_pwm_output_state
PWM channel output status.
Definition: fsl_pwm.h:107
void PWM_SetupFaultInputFilter(PWM_Type *base, const pwm_fault_input_filter_param_t *faultInputFilterParams)
Sets up the PWM fault input filter.
Definition: fsl_pwm.c:824
_pwm_fault_input
List of PWM fault selections.
Definition: fsl_pwm.h:147
status_t PWM_SetOutputToIdle(PWM_Type *base, pwm_channels_t pwmChannel, pwm_submodule_t subModule, bool idleStatus)
Set PWM output in idle status (high or low).
Definition: fsl_pwm.c:1081
enum _pwm_watermark_control pwm_watermark_control_t
PWM FIFO Watermark AND Control.
_pwm_input_capture_edge
PWM capture edge select.
Definition: fsl_pwm.h:172
_pwm_clock_source
PWM clock source selection.
Definition: fsl_pwm.h:72
_pwm_reload_source_select
PWM reload source select.
Definition: fsl_pwm.h:316
_pwm_fault_clear
PWM fault clearing options.
Definition: fsl_pwm.h:323
_pwm_module_control
Options for submodule master control operation.
Definition: fsl_pwm.h:331
_pwm_fault_state
PWM output fault status.
Definition: fsl_pwm.h:306
_pwm_dma_enable
List of PWM DMA options.
Definition: fsl_pwm.h:263
enum _pwm_chnl_pair_operation pwm_chnl_pair_operation_t
Options available for the PWM A & B pair operation.
void PWM_SetClockMode(PWM_Type *base, pwm_submodule_t subModule, pwm_clock_prescale_t prescaler)
Set the pwm submodule prescaler.
Definition: fsl_pwm.c:1184
void PWM_DisableInterrupts(PWM_Type *base, pwm_submodule_t subModule, uint32_t mask)
Disables the selected PWM interrupts.
Definition: fsl_pwm.c:1004
void PWM_GetDefaultConfig(pwm_config_t *config)
Fill in the PWM config struct with the default settings.
Definition: fsl_pwm.c:235
enum _pwm_interrupt_enable pwm_interrupt_enable_t
List of PWM interrupt options.
enum _pwm_fault_clear pwm_fault_clear_t
PWM fault clearing options.
uint8_t PWM_GetPwmChannelState(PWM_Type *base, pwm_submodule_t subModule, pwm_channels_t pwmChannel)
Get the dutycycle value.
Definition: fsl_pwm.c:1172
enum _pwm_level_select pwm_level_select_t
PWM output pulse mode, high-true or low-true.
@ kPWM_HighTrue
Definition: fsl_pwm.h:300
@ kPWM_LowTrue
Definition: fsl_pwm.h:301
@ kPWM_LoadEvery12Oportunity
Definition: fsl_pwm.h:138
@ kPWM_LoadEvery11Oportunity
Definition: fsl_pwm.h:137
@ kPWM_LoadEvery7Oportunity
Definition: fsl_pwm.h:133
@ kPWM_LoadEvery8Oportunity
Definition: fsl_pwm.h:134
@ kPWM_LoadEvery9Oportunity
Definition: fsl_pwm.h:135
@ kPWM_LoadEvery5Oportunity
Definition: fsl_pwm.h:131
@ kPWM_LoadEveryOportunity
Definition: fsl_pwm.h:127
@ kPWM_LoadEvery10Oportunity
Definition: fsl_pwm.h:136
@ kPWM_LoadEvery3Oportunity
Definition: fsl_pwm.h:129
@ kPWM_LoadEvery14Oportunity
Definition: fsl_pwm.h:140
@ kPWM_LoadEvery4Oportunity
Definition: fsl_pwm.h:130
@ kPWM_LoadEvery15Oportunity
Definition: fsl_pwm.h:141
@ kPWM_LoadEvery6Oportunity
Definition: fsl_pwm.h:132
@ kPWM_LoadEvery2Oportunity
Definition: fsl_pwm.h:128
@ kPWM_LoadEvery16Oportunity
Definition: fsl_pwm.h:142
@ kPWM_LoadEvery13Oportunity
Definition: fsl_pwm.h:139
@ kPWM_ValueRegisterMask_1
Definition: fsl_pwm.h:63
@ kPWM_ValueRegisterMask_3
Definition: fsl_pwm.h:65
@ kPWM_ValueRegisterMask_0
Definition: fsl_pwm.h:62
@ kPWM_ValueRegisterMask_5
Definition: fsl_pwm.h:67
@ kPWM_ValueRegisterMask_4
Definition: fsl_pwm.h:66
@ kPWM_ValueRegisterMask_2
Definition: fsl_pwm.h:64
@ kPWM_ValueRegister_0
Definition: fsl_pwm.h:51
@ kPWM_ValueRegister_1
Definition: fsl_pwm.h:52
@ kPWM_ValueRegister_3
Definition: fsl_pwm.h:54
@ kPWM_ValueRegister_4
Definition: fsl_pwm.h:55
@ kPWM_ValueRegister_5
Definition: fsl_pwm.h:56
@ kPWM_ValueRegister_2
Definition: fsl_pwm.h:53
@ kPWM_CompareVal3InterruptEnable
Definition: fsl_pwm.h:220
@ kPWM_CaptureA0InterruptEnable
Definition: fsl_pwm.h:227
@ kPWM_CompareVal1InterruptEnable
Definition: fsl_pwm.h:218
@ kPWM_ReloadErrorInterruptEnable
Definition: fsl_pwm.h:230
@ kPWM_Fault3InterruptEnable
Definition: fsl_pwm.h:234
@ kPWM_CaptureB0InterruptEnable
Definition: fsl_pwm.h:225
@ kPWM_CompareVal4InterruptEnable
Definition: fsl_pwm.h:221
@ kPWM_CaptureX1InterruptEnable
Definition: fsl_pwm.h:224
@ kPWM_CompareVal5InterruptEnable
Definition: fsl_pwm.h:222
@ kPWM_CompareVal0InterruptEnable
Definition: fsl_pwm.h:217
@ kPWM_CaptureX0InterruptEnable
Definition: fsl_pwm.h:223
@ kPWM_CaptureB1InterruptEnable
Definition: fsl_pwm.h:226
@ kPWM_ReloadInterruptEnable
Definition: fsl_pwm.h:229
@ kPWM_Fault0InterruptEnable
Definition: fsl_pwm.h:231
@ kPWM_Fault1InterruptEnable
Definition: fsl_pwm.h:232
@ kPWM_CaptureA1InterruptEnable
Definition: fsl_pwm.h:228
@ kPWM_CompareVal2InterruptEnable
Definition: fsl_pwm.h:219
@ kPWM_Fault2InterruptEnable
Definition: fsl_pwm.h:233
@ kPWM_FaultDisable_2
Definition: fsl_pwm.h:159
@ kPWM_FaultDisable_3
Definition: fsl_pwm.h:160
@ kPWM_FaultDisable_0
Definition: fsl_pwm.h:157
@ kPWM_FaultDisable_1
Definition: fsl_pwm.h:158
@ kPWM_ComplementaryPwmA
Definition: fsl_pwm.h:192
@ kPWM_ComplementaryPwmB
Definition: fsl_pwm.h:193
@ kPWM_Independent
Definition: fsl_pwm.h:191
@ kPWM_Force_External
Definition: fsl_pwm.h:101
@ kPWM_Force_ExternalSync
Definition: fsl_pwm.h:102
@ kPWM_Force_LocalReload
Definition: fsl_pwm.h:96
@ kPWM_Force_Local
Definition: fsl_pwm.h:94
@ kPWM_Force_LocalSync
Definition: fsl_pwm.h:99
@ kPWM_Force_Master
Definition: fsl_pwm.h:95
@ kPWM_Force_MasterReload
Definition: fsl_pwm.h:98
@ kPWM_Force_MasterSync
Definition: fsl_pwm.h:100
@ kPWM_Initialize_MasterReload
Definition: fsl_pwm.h:119
@ kPWM_Initialize_MasterSync
Definition: fsl_pwm.h:120
@ kPWM_Initialize_ExtSync
Definition: fsl_pwm.h:121
@ kPWM_Initialize_LocalSync
Definition: fsl_pwm.h:118
@ kPWM_Module_2
Definition: fsl_pwm.h:36
@ kPWM_Module_3
Definition: fsl_pwm.h:37
@ kPWM_Module_1
Definition: fsl_pwm.h:35
@ kPWM_Module_0
Definition: fsl_pwm.h:34
@ kPWM_FIFOWatermarksOR
Definition: fsl_pwm.h:284
@ kPWM_FIFOWatermarksAND
Definition: fsl_pwm.h:285
@ kPWM_DMALocalSync
Definition: fsl_pwm.h:277
@ kPWM_DMARequestDisable
Definition: fsl_pwm.h:275
@ kPWM_DMAWatermarksEnable
Definition: fsl_pwm.h:276
@ kPWM_DMALocalReload
Definition: fsl_pwm.h:278
@ kPWM_SignedEdgeAligned
Definition: fsl_pwm.h:293
@ kPWM_SignedCenterAligned
Definition: fsl_pwm.h:291
@ kPWM_CenterAligned
Definition: fsl_pwm.h:292
@ kPWM_EdgeAligned
Definition: fsl_pwm.h:294
@ kPWM_RecoverHalfAndFullCycle
Definition: fsl_pwm.h:211
@ kPWM_RecoverFullCycle
Definition: fsl_pwm.h:210
@ kPWM_RecoverHalfCycle
Definition: fsl_pwm.h:209
@ kPWM_NoRecovery
Definition: fsl_pwm.h:208
@ kPWM_ReloadImmediate
Definition: fsl_pwm.h:199
@ kPWM_ReloadPwmFullCycle
Definition: fsl_pwm.h:201
@ kPWM_ReloadPwmHalfCycle
Definition: fsl_pwm.h:200
@ kPWM_ReloadPwmHalfAndFullCycle
Definition: fsl_pwm.h:202
@ kPWM_Prescale_Divide_128
Definition: fsl_pwm.h:88
@ kPWM_Prescale_Divide_4
Definition: fsl_pwm.h:83
@ kPWM_Prescale_Divide_2
Definition: fsl_pwm.h:82
@ kPWM_Prescale_Divide_32
Definition: fsl_pwm.h:86
@ kPWM_Prescale_Divide_8
Definition: fsl_pwm.h:84
@ kPWM_Prescale_Divide_64
Definition: fsl_pwm.h:87
@ kPWM_Prescale_Divide_16
Definition: fsl_pwm.h:85
@ kPWM_Prescale_Divide_1
Definition: fsl_pwm.h:81
@ kPWM_UsePwm
Definition: fsl_pwm.h:182
@ kPWM_InvertedPwm
Definition: fsl_pwm.h:183
@ kPWM_SoftwareControl
Definition: fsl_pwm.h:184
@ kPWM_UseExternal
Definition: fsl_pwm.h:185
@ kPWM_CaptureB0Flag
Definition: fsl_pwm.h:248
@ kPWM_ReloadFlag
Definition: fsl_pwm.h:252
@ kPWM_CompareVal0Flag
Definition: fsl_pwm.h:240
@ kPWM_CompareVal4Flag
Definition: fsl_pwm.h:244
@ kPWM_ReloadErrorFlag
Definition: fsl_pwm.h:253
@ kPWM_CompareVal5Flag
Definition: fsl_pwm.h:245
@ kPWM_CompareVal1Flag
Definition: fsl_pwm.h:241
@ kPWM_CaptureA0Flag
Definition: fsl_pwm.h:250
@ kPWM_CaptureB1Flag
Definition: fsl_pwm.h:249
@ kPWM_CompareVal3Flag
Definition: fsl_pwm.h:243
@ kPWM_Fault2Flag
Definition: fsl_pwm.h:257
@ kPWM_Fault0Flag
Definition: fsl_pwm.h:255
@ kPWM_RegUpdatedFlag
Definition: fsl_pwm.h:254
@ kPWM_CaptureA1Flag
Definition: fsl_pwm.h:251
@ kPWM_CompareVal2Flag
Definition: fsl_pwm.h:242
@ kPWM_CaptureX1Flag
Definition: fsl_pwm.h:247
@ kPWM_Fault3Flag
Definition: fsl_pwm.h:258
@ kPWM_CaptureX0Flag
Definition: fsl_pwm.h:246
@ kPWM_Fault1Flag
Definition: fsl_pwm.h:256
@ kPWM_NormalState
Definition: fsl_pwm.h:110
@ kPWM_HighState
Definition: fsl_pwm.h:108
@ kPWM_MaskState
Definition: fsl_pwm.h:112
@ kPWM_InvertState
Definition: fsl_pwm.h:111
@ kPWM_LowState
Definition: fsl_pwm.h:109
@ kPWM_Fault_1
Definition: fsl_pwm.h:149
@ kPWM_Fault_3
Definition: fsl_pwm.h:151
@ kPWM_Fault_2
Definition: fsl_pwm.h:150
@ kPWM_Fault_0
Definition: fsl_pwm.h:148
@ kPWM_RiseAndFallEdge
Definition: fsl_pwm.h:176
@ kPWM_Disable
Definition: fsl_pwm.h:173
@ kPWM_RisingEdge
Definition: fsl_pwm.h:175
@ kPWM_FallingEdge
Definition: fsl_pwm.h:174
@ kPWM_ExternalClock
Definition: fsl_pwm.h:74
@ kPWM_BusClock
Definition: fsl_pwm.h:73
@ kPWM_Submodule0Clock
Definition: fsl_pwm.h:75
@ kPWM_MasterReload
Definition: fsl_pwm.h:318
@ kPWM_LocalReload
Definition: fsl_pwm.h:317
@ kPWM_ManualSafety
Definition: fsl_pwm.h:326
@ kPWM_ManualNormal
Definition: fsl_pwm.h:325
@ kPWM_Automatic
Definition: fsl_pwm.h:324
@ kPWM_Control_Module_0
Definition: fsl_pwm.h:332
@ kPWM_Control_Module_2
Definition: fsl_pwm.h:334
@ kPWM_Control_Module_1
Definition: fsl_pwm.h:333
@ kPWM_Control_Module_3
Definition: fsl_pwm.h:335
@ kPWM_PwmFaultState0
Definition: fsl_pwm.h:307
@ kPWM_PwmFaultState3
Definition: fsl_pwm.h:311
@ kPWM_PwmFaultState2
Definition: fsl_pwm.h:310
@ kPWM_PwmFaultState1
Definition: fsl_pwm.h:309
@ kPWM_CaptureB0DMAEnable
Definition: fsl_pwm.h:266
@ kPWM_CaptureA1DMAEnable
Definition: fsl_pwm.h:269
@ kPWM_CaptureX1DMAEnable
Definition: fsl_pwm.h:265
@ kPWM_CaptureX0DMAEnable
Definition: fsl_pwm.h:264
@ kPWM_CaptureB1DMAEnable
Definition: fsl_pwm.h:267
@ kPWM_CaptureA0DMAEnable
Definition: fsl_pwm.h:268
Definition: MIMXRT1052.h:35990
PWM config structure.
Definition: fsl_pwm.h:361
pwm_load_frequency_t reloadFrequency
Definition: fsl_pwm.h:374
bool enableDebugMode
Definition: fsl_pwm.h:362
pwm_clock_source_t clockSource
Definition: fsl_pwm.h:369
pwm_force_output_trigger_t forceTrigger
Definition: fsl_pwm.h:376
pwm_chnl_pair_operation_t pairOperation
Definition: fsl_pwm.h:371
pwm_clock_prescale_t prescale
Definition: fsl_pwm.h:370
bool enableWait
Definition: fsl_pwm.h:365
pwm_register_reload_t reloadLogic
Definition: fsl_pwm.h:372
pwm_reload_source_select_t reloadSelect
Definition: fsl_pwm.h:373
pwm_init_source_t initializationControl
Definition: fsl_pwm.h:368
Structure for the user to configure the fault input filter.
Definition: fsl_pwm.h:381
bool faultGlitchStretch
Definition: fsl_pwm.h:384
uint8_t faultFilterPeriod
Definition: fsl_pwm.h:383
uint8_t faultFilterCount
Definition: fsl_pwm.h:382
Structure is used to hold the parameters to configure a PWM fault.
Definition: fsl_pwm.h:390
pwm_fault_clear_t faultClearingMode
Definition: fsl_pwm.h:391
bool faultLevel
Definition: fsl_pwm.h:392
bool enableCombinationalPath
Definition: fsl_pwm.h:394
pwm_fault_recovery_mode_t recoverMode
Definition: fsl_pwm.h:396
Structure is used to hold parameters to configure the capture capability of a signal pin.
Definition: fsl_pwm.h:403
uint8_t edgeCompareValue
Definition: fsl_pwm.h:406
pwm_input_capture_edge_t edge1
Definition: fsl_pwm.h:408
bool captureInputSel
Definition: fsl_pwm.h:404
uint8_t fifoWatermark
Definition: fsl_pwm.h:411
bool enableOneShotCapture
Definition: fsl_pwm.h:409
pwm_input_capture_edge_t edge0
Definition: fsl_pwm.h:407
Structure for the user to define the PWM signal characteristics.
Definition: fsl_pwm.h:340
pwm_level_select_t level
Definition: fsl_pwm.h:345
bool pwmchannelenable
Definition: fsl_pwm.h:348
pwm_channels_t pwmChannel
Definition: fsl_pwm.h:341
uint8_t dutyCyclePercent
Definition: fsl_pwm.h:342
pwm_fault_state_t faultState
Definition: fsl_pwm.h:347
uint16_t deadtimeValue
Definition: fsl_pwm.h:346
Definition: deflate.c:114