2 * Configuration of module: Pwm (Pwm_Cfg.h)
\r
4 * Created by: Arccore AB
\r
7 * Configured for (MCU): MPC551x
\r
9 * Module vendor: ArcCore
\r
10 * Generator version: 2.0.1
\r
12 * Generated by Arctic Studio (http://arccore.com)
\r
13 * on Thu Mar 10 09:37:44 CET 2011
\r
17 #if !(((PWM_SW_MAJOR_VERSION == 1) && (PWM_SW_MINOR_VERSION == 0)) )
\r
18 #error Pwm: Configuration file expected BSW module version to be 1.0.*
\r
25 /****************************************************************************
\r
26 * Global configuration options and defines
\r
33 #define PWM_DEV_EROR_DETECT ON
\r
34 #define PWM_NOTIFICATION_SUPPORTED OFF
\r
36 // PWM132. Currently only ON is supported.
\r
37 #define PWM_DUTYCYCLE_UPDATED_ENDPERIOD ON
\r
38 #define PWM_PERIOD_UPDATED_ENDPERIOD ON
\r
40 // Define what functions to enable.
\r
41 #define PWM_GET_OUTPUT_STATE ON
\r
42 #define PWM_SET_PERIOD_AND_DUTY ON
\r
43 #define PWM_DEINIT ON
\r
44 #define PWM_DUTYCYCLE ON
\r
45 #define PWM_SET_OUTPUT_TO_IDLE ON
\r
46 #define PWM_VERSION_INFO_API ON
\r
51 /****************************************************************************
\r
52 * Not defined in AUTOSAR.
\r
54 #define PWM_ISR_PRIORITY 1
\r
55 #define PWM_PRESCALER 1
\r
58 * Setting to ON freezes the current output state of a PWM channel when in
\r
61 #define PWM_FREEZE_ENABLE ON
\r
63 /****************************************************************************
\r
64 * Enumeration of channels
\r
65 * Maps a symbolic name to a hardware channel
\r
69 PWM_NUMBER_OF_CHANNELS = 1
\r
70 } Pwm_NamedChannelsType;
\r
75 * PWM106: This is implementation specific but not all values may be valid
\r
76 * within the type. This shall be chosen in order to have the most efficient
\r
77 * implementation on a specific microcontroller platform.
\r
79 * PWM106 => Pwm_ChannelType == eemios channel id.
\r
81 typedef uint8 Pwm_ChannelType;
\r
84 * PWM070: All time units used within the API services of the PWM module shall
\r
85 * be of the unit ticks.
\r
87 typedef uint16 Pwm_PeriodType;
\r
90 PWM_CHANNEL_PRESCALER_1=0,
\r
91 PWM_CHANNEL_PRESCALER_2,
\r
92 PWM_CHANNEL_PRESCALER_3,
\r
93 PWM_CHANNEL_PRESCALER_4,
\r
94 } Pwm_ChannelPrescalerType;
\r
97 * Since the AUTOSAR PWM specification uses a different unit for the duty,
\r
98 * the following macro can be used to convert between that format and the
\r
101 #define DUTY_AND_PERIOD(_duty,_period) .duty = (_duty*_period)>>15, .period = _period
\r
103 #if defined(CFG_MPC5516)
\r
104 /* Mode is buffered PWM output (OPWM) */
\r
105 /* Mode is buffered Output PW and frequency modulation mode */
\r
106 #define PWM_EMIOS_OPWM 0x5A
\r
107 #elif defined(CFG_MPC5567)
\r
108 /* Mode is buffered OPWM with frequency modulation (allows change of
\r
110 #define PWM_EMIOS_OPWM 0x19
\r
115 /* Number of duty ticks */
\r
117 /* Length of period, in ticks */
\r
118 uint32_t period:32;
\r
120 uint32_t counter:32;
\r
121 /* Enable freezing the channel when in debug mode */
\r
122 uint32_t freezeEnable:1;
\r
123 /* Disable output */
\r
124 uint32_t outputDisable:1;
\r
125 /* Select which bus disables the bus
\r
126 * TODO: Figure out how this works, i.e. what bus does it refer to? */
\r
127 uint32_t outputDisableSelect:2;
\r
128 /* Prescale the emios clock some more? */
\r
129 Pwm_ChannelPrescalerType prescaler:2;
\r
130 /* Prescale the emios clock some more? */
\r
131 uint32_t usePrescaler:1;
\r
132 /* Whether to use DMA. Currently unsupported */
\r
134 uint32_t reserved_2:1;
\r
135 /* Input filter. Ignored in output mode. */
\r
136 uint32_t inputFilter:4;
\r
137 /* Input filter clock source. Ignored in output mode */
\r
138 uint32_t filterClockSelect:1;
\r
139 /* Enable interrupts/flags on this channel? Required for DMA as well. */
\r
140 uint32_t flagEnable:1;
\r
141 uint32_t reserved_3:3;
\r
142 /* Trigger a match on channel A */
\r
143 uint32_t forceMatchA:1;
\r
144 /* Triggers a match on channel B */
\r
145 uint32_t forceMatchB:1;
\r
146 uint32_t reserved_4:1;
\r
147 /* We can use different buses for the counter. Use the internal counter */
\r
148 uint32_t busSelect:2;
\r
149 /* What edges to flag on? */
\r
150 uint32_t edgeSelect:1;
\r
151 /* Polarity of the channel */
\r
152 uint32_t edgePolarity:1;
\r
153 /* EMIOS mode. 0x58 for buffered output PWM */
\r
155 } Pwm_ChannelRegisterType;
\r
158 Pwm_ChannelRegisterType r;
\r
159 Pwm_ChannelType channel;
\r
160 } Pwm_ChannelConfigurationType;
\r
164 Pwm_ChannelConfigurationType Channels[PWM_NUMBER_OF_CHANNELS];
\r
165 #if PWM_NOTIFICATION_SUPPORTED==STD_ON
\r
166 Pwm_NotificationHandlerType NotificationHandlers[PWM_NUMBER_OF_CHANNELS];
\r
170 // Channel configuration macro.
\r
171 #define PWM_CHANNEL_CONFIG(_hwchannel, _period, _duty, _prescaler, _polarity) \
\r
173 .channel = _hwchannel,\
\r
175 DUTY_AND_PERIOD(_duty, _period),\
\r
176 .freezeEnable = 1,\
\r
177 .outputDisable = 0,\
\r
178 .usePrescaler = 1,\
\r
179 .prescaler = _prescaler,\
\r
181 .flagEnable = 0, /* See PWM052 */ \
\r
182 .busSelect = 3, /* Use the internal counter bus */\
\r
183 .edgePolarity = _polarity,\
\r
184 .mode = PWM_EMIOS_OPWM\
\r
188 #endif /* PWM_CFG_H_ */
\r