+++ /dev/null
-/*\r
-* Configuration of module: Pwm (Pwm_Cfg.h)\r
-*\r
-* Created by: ArcCore AB\r
-* Copyright: Copyright ArcCore AB 2010\r
-*\r
-* Configured for (MCU): MPC5567\r
-*\r
-* Module vendor: ArcCore\r
-* Generator version: 2.0.1\r
-*\r
-* Generated by Arctic Studio (http://arccore.com) \r
-* on Thu Mar 10 10:49:01 CET 2011\r
-*/\r
-\r
-
-#if !(((PWM_SW_MAJOR_VERSION == 1) && (PWM_SW_MINOR_VERSION == 0)) )
-#error Pwm: Configuration file expected BSW module version to be 1.0.*
-#endif
-
-\r
-#ifndef PWM_CFG_H_\r
-#define PWM_CFG_H_\r
-\r
-/****************************************************************************\r
- * Global configuration options and defines\r
- */\r
-\r
-#define ON 1\r
-#define OFF 0\r
-\r
-// PWM003\r
-#define PWM_DEV_EROR_DETECT ON\r
-#define PWM_NOTIFICATION_SUPPORTED ON\r
-\r
-// PWM132. Currently only ON is supported.\r
-#define PWM_DUTYCYCLE_UPDATED_ENDPERIOD ON\r
-#define PWM_PERIOD_UPDATED_ENDPERIOD ON\r
-\r
-// Define what functions to enable.\r
-#define PWM_GET_OUTPUT_STATE ON\r
-#define PWM_SET_PERIOD_AND_DUTY ON\r
-#define PWM_DEINIT OFF\r
-#define PWM_DUTYCYCLE ON\r
-#define PWM_SET_OUTPUT_TO_IDLE OFF\r
-#define PWM_VERSION_INFO_API OFF\r
-\r
-\r
-\r
-\r
-/****************************************************************************\r
- * Not defined in AUTOSAR.\r
- */\r
-#define PWM_ISR_PRIORITY 1\r
-#define PWM_PRESCALER 1\r
-\r
-/*\r
- * Setting to ON freezes the current output state of a PWM channel when in\r
- * debug mode.\r
- */\r
-#define PWM_FREEZE_ENABLE ON\r
-\r
-/****************************************************************************\r
- * Enumeration of channels\r
- * Maps a symbolic name to a hardware channel\r
- */\r
-typedef enum {\r
- PWM_CHANNEL_1 = 10,\r
- PWM_CHANNEL_2 = 12,\r
- PWM_NUMBER_OF_CHANNELS = 2\r
-} Pwm_NamedChannelsType;\r
-\r
-\r
-\r
-/*\r
- * PWM106: This is implementation specific but not all values may be valid\r
- * within the type. This shall be chosen in order to have the most efficient\r
- * implementation on a specific microcontroller platform.\r
- *\r
- * PWM106 => Pwm_ChannelType == eemios channel id.\r
- */\r
-typedef uint8 Pwm_ChannelType;\r
-\r
-/*\r
- * PWM070: All time units used within the API services of the PWM module shall\r
- * be of the unit ticks.\r
- */\r
-typedef uint16 Pwm_PeriodType;\r
-\r
-typedef enum {\r
- PWM_CHANNEL_PRESCALER_1=0,\r
- PWM_CHANNEL_PRESCALER_2,\r
- PWM_CHANNEL_PRESCALER_3,\r
- PWM_CHANNEL_PRESCALER_4,\r
-} Pwm_ChannelPrescalerType;\r
-\r
-/*\r
- * Since the AUTOSAR PWM specification uses a different unit for the duty,\r
- * the following macro can be used to convert between that format and the\r
- * mpc5516 format.\r
- */\r
-#define DUTY_AND_PERIOD(_duty,_period) .duty = (_duty*_period)>>15, .period = _period\r
-\r
-#if defined(CFG_MPC5516)\r
- /* Mode is buffered PWM output (OPWM) */\r
- /* Mode is buffered Output PW and frequency modulation mode */\r
-#define PWM_EMIOS_OPWM 0x5A\r
-#elif defined(CFG_MPC5567)\r
- /* Mode is buffered OPWM with frequency modulation (allows change of\r
- * period) */\r
-#define PWM_EMIOS_OPWM 0x19\r
-#endif\r
-\r
-\r
-typedef struct {\r
- /* Number of duty ticks */\r
- uint32_t duty:32;\r
- /* Length of period, in ticks */\r
- uint32_t period:32;\r
- /* Counter */\r
- uint32_t counter:32;\r
- /* Enable freezing the channel when in debug mode */\r
- uint32_t freezeEnable:1;\r
- /* Disable output */\r
- uint32_t outputDisable:1;\r
- /* Select which bus disables the bus\r
- * TODO: Figure out how this works, i.e. what bus does it refer to? */\r
- uint32_t outputDisableSelect:2;\r
- /* Prescale the emios clock some more? */\r
- Pwm_ChannelPrescalerType prescaler:2;\r
- /* Prescale the emios clock some more? */\r
- uint32_t usePrescaler:1;\r
- /* Whether to use DMA. Currently unsupported */\r
- uint32_t useDma:1;\r
- uint32_t reserved_2:1;\r
- /* Input filter. Ignored in output mode. */\r
- uint32_t inputFilter:4;\r
- /* Input filter clock source. Ignored in output mode */\r
- uint32_t filterClockSelect:1;\r
- /* Enable interrupts/flags on this channel? Required for DMA as well. */\r
- uint32_t flagEnable:1;\r
- uint32_t reserved_3:3;\r
- /* Trigger a match on channel A */\r
- uint32_t forceMatchA:1;\r
- /* Triggers a match on channel B */\r
- uint32_t forceMatchB:1;\r
- uint32_t reserved_4:1;\r
- /* We can use different buses for the counter. Use the internal counter */\r
- uint32_t busSelect:2;\r
- /* What edges to flag on? */\r
- uint32_t edgeSelect:1;\r
- /* Polarity of the channel */\r
- uint32_t edgePolarity:1;\r
- /* EMIOS mode. 0x58 for buffered output PWM */\r
- uint32_t mode:7;\r
-} Pwm_ChannelRegisterType;\r
-\r
-typedef struct {\r
- Pwm_ChannelRegisterType r;\r
- Pwm_ChannelType channel;\r
-} Pwm_ChannelConfigurationType;\r
-\r
-\r
-typedef struct {\r
- Pwm_ChannelConfigurationType Channels[PWM_NUMBER_OF_CHANNELS];\r
-#if PWM_NOTIFICATION_SUPPORTED==STD_ON\r
- Pwm_NotificationHandlerType NotificationHandlers[PWM_NUMBER_OF_CHANNELS];\r
-#endif\r
-} Pwm_ConfigType;\r
-\r
-// Channel configuration macro.\r
-#define PWM_CHANNEL_CONFIG(_hwchannel, _period, _duty, _prescaler, _polarity) \\r
- {\\r
- .channel = _hwchannel,\\r
- .r = {\\r
- DUTY_AND_PERIOD(_duty, _period),\\r
- .freezeEnable = 1,\\r
- .outputDisable = 0,\\r
- .usePrescaler = 1,\\r
- .prescaler = _prescaler,\\r
- .useDma = 0,\\r
- .flagEnable = 0, /* See PWM052 */ \\r
- .busSelect = 3, /* Use the internal counter bus */\\r
- .edgePolarity = _polarity,\\r
- .mode = PWM_EMIOS_OPWM\\r
- }\\r
- }\r
-\r
-#endif /* PWM_CFG_H_ */\r