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