]> rtime.felk.cvut.cz Git - arc.git/blob - boards/hcs12x_elmicro_tboard/examples/ledmaster/config/Pwm_Cfg.h
0eef7f4e4b405ff63d1f3f7ebd9d1e4d0fd74e6a
[arc.git] / boards / hcs12x_elmicro_tboard / examples / ledmaster / config / Pwm_Cfg.h
1 /*\r
2 * Configuration of module: Pwm (Pwm_Cfg.h)\r
3 *\r
4 * Created by:              \r
5 * Copyright:               \r
6 *\r
7 * Configured for (MCU):    HCS12\r
8 *\r
9 * Module vendor:           ArcCore\r
10 * Generator version:       2.0.1\r
11 *\r
12 * Generated by Arctic Studio (http://arccore.com) \r
13 *           on Sat Jun 18 21:14:51 CEST 2011\r
14 */\r
15 \r
16
17 #if !(((PWM_SW_MAJOR_VERSION == 1) && (PWM_SW_MINOR_VERSION == 2)) )
18 #error Pwm: Configuration file expected BSW module version to be 1.2.*
19 #endif
20
21         \r
22 \r
23 #ifndef PWM_CFG_H_\r
24 #define PWM_CFG_H_\r
25 \r
26 #define PWM_DEV_ERROR_DETECT        STD_ON\r
27 #define PWM_STATICALLY_CONFIGURED   STD_OFF\r
28 #define PWM_NOTIFICATION_SUPPORTED  STD_OFF\r
29 #define PWM_FREEZE_ENABLE           STD_OFF\r
30 \r
31 // Define what API functions to enable.\r
32 #define PWM_GET_OUTPUT_STATE        STD_OFF\r
33 #define PWM_SET_PERIOD_AND_DUTY     STD_ON\r
34 #define PWM_DEINIT_API              STD_OFF\r
35 #define PWM_SET_DUTY_CYCLE_API      STD_ON\r
36 #define PWM_SET_OUTPUT_TO_IDLE_API  STD_OFF\r
37 #define PWM_VERSION_INFO_API        STD_OFF\r
38 \r
39 \r
40 \r
41 /**\r
42  * PWM132: Switch for enabling the update of duty cycle parameter at the end\r
43  * of the current period.\r
44  *\r
45  * Note: Currently only ON mode is supported.\r
46  */\r
47 #define PWM_DUTYCYCLE_UPDATED_ENDPERIOD STD_ON\r
48 \r
49 /**\r
50  * PWM106: This is implementation specific but not all values may be valid\r
51  * within the type. This shall be chosen in order to have the most efficient\r
52  * implementation on a specific microcontroller platform.\r
53  *\r
54  * PWM106 => Pwm_ChannelType == channel id.\r
55  */\r
56 typedef uint8 Pwm_ChannelType;\r
57 \r
58 /**\r
59  * PWM070: All time units used within the API services of the PWM module shall\r
60  * be of the unit ticks.\r
61  */\r
62 typedef uint16 Pwm_PeriodType;\r
63 \r
64 /****************************************************************************\r
65  * Enumeration of channels\r
66  * Maps a symbolic name to a hardware channel\r
67  */\r
68 typedef enum {\r
69       GREENLED = 1 ,\r
70     PWM_NUMBER_OF_CHANNELS = 1\r
71 } Pwm_NamedChannelsType;\r
72 \r
73 /* 1 =PWMchannel output is high at the beginning of the period, then goes low when the duty count\r
74 is reached. */\r
75 #define POLARITY_NORMAL 1\r
76 #define POLARITY_INVERSED 0\r
77 \r
78 /**\r
79  * Since the AUTOSAR PWM specification uses a different unit for the duty,\r
80  * the following macro can be used to convert between that format and the\r
81  * driver format.\r
82  */\r
83 #define DUTY_AND_PERIOD(_duty,_period) .duty = (uint8)((uint32)((uint32)_duty*(uint32)_period)>>15), .period = _period\r
84 \r
85 \r
86 typedef struct {\r
87         /** Number of duty ticks */\r
88         uint8_t duty;\r
89         /** Length of period, in ticks */\r
90         uint8_t period;\r
91         /** Center or left align */\r
92         uint8_t centerAlign:1;\r
93         /** Polarity of the channel */\r
94         uint8_t polarity:1;\r
95         /** Scaled clock enabled */\r
96         uint8_t scaledClockEnable:1;\r
97         /** idle state */\r
98         uint8_t idleState:1;\r
99 \r
100         uint8_t reserved:4;\r
101 \r
102         Pwm_ChannelClassType class;\r
103 \r
104         Pwm_ChannelType channel;\r
105 } Pwm_ChannelConfigurationType;\r
106 \r
107 typedef enum{\r
108         PRESCALER_1 = 0,\r
109         PRESCALER_2 = 1,\r
110         PRESCALER_4 = 2,\r
111         PRESCALER_8 = 3,\r
112         PRESCALER_16 = 4,\r
113         PRESCALER_32 = 5,\r
114         PRESCALER_64 = 6,\r
115         PRESCALER_128 = 7,\r
116 }Pwm_PrescalerType;\r
117 \r
118 typedef struct {\r
119         Pwm_ChannelConfigurationType channels[PWM_NUMBER_OF_CHANNELS];\r
120         Pwm_PrescalerType busPrescalerA;\r
121         Pwm_PrescalerType busPrescalerB;\r
122         uint8_t prescalerA;\r
123         uint8_t prescalerB;\r
124 } Pwm_ConfigType;\r
125 \r
126 #endif\r
127 \r