00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <aversive/timers.h>
00023
00024 #include <timer.h>
00025 #include <timer_definitions.h>
00026 #include <timer_prescaler.h>
00027
00028 #include <timer_config.h>
00029
00030
00031 #if defined TIMER0_ENABLED && ! defined TIMER0_AVAILABLE
00032 #error This arch has no TIMER0
00033 #endif
00034
00035 #if defined TIMER1_ENABLED && ! defined TIMER1_AVAILABLE
00036 #error This arch has no TIMER1
00037 #endif
00038
00039 #if defined TIMER2_ENABLED && ! defined TIMER2_AVAILABLE
00040 #error This arch has no TIMER2
00041 #endif
00042
00043 #if defined TIMER3_ENABLED && ! defined TIMER3_AVAILABLE
00044 #error This arch has no TIMER3
00045 #endif
00046
00047 #if defined TIMER4_ENABLED && ! defined TIMER4_AVAILABLE
00048 #error This arch has no TIMER4
00049 #endif
00050
00051 #if defined TIMER5_ENABLED && ! defined TIMER5_AVAILABLE
00052 #error This arch has no TIMER5
00053 #endif
00054
00055
00056 #if defined TIMER0_ENABLED
00057
00058 #if defined TIMER0_PRESCALER_REG_0 && TIMER0_PRESCALER_REG_0 == TIMER0_PRESCALER_DIV
00059 #define TIMER0_CONF_OK
00060 #endif
00061
00062 #if defined TIMER0_PRESCALER_REG_1 && TIMER0_PRESCALER_REG_1 == TIMER0_PRESCALER_DIV
00063 #define TIMER0_CONF_OK
00064 #endif
00065
00066 #if defined TIMER0_PRESCALER_REG_2 && TIMER0_PRESCALER_REG_2 == TIMER0_PRESCALER_DIV
00067 #define TIMER0_CONF_OK
00068 #endif
00069
00070 #if defined TIMER0_PRESCALER_REG_3 && TIMER0_PRESCALER_REG_3 == TIMER0_PRESCALER_DIV
00071 #define TIMER0_CONF_OK
00072 #endif
00073
00074 #if defined TIMER0_PRESCALER_REG_4 && TIMER0_PRESCALER_REG_4 == TIMER0_PRESCALER_DIV
00075 #define TIMER0_CONF_OK
00076 #endif
00077
00078 #if defined TIMER0_PRESCALER_REG_5 && TIMER0_PRESCALER_REG_5 == TIMER0_PRESCALER_DIV
00079 #define TIMER0_CONF_OK
00080 #endif
00081
00082 #if defined TIMER0_PRESCALER_REG_6 && TIMER0_PRESCALER_REG_6 == TIMER0_PRESCALER_DIV
00083 #define TIMER0_CONF_OK
00084 #endif
00085
00086 #if defined TIMER0_PRESCALER_REG_7 && TIMER0_PRESCALER_REG_7 == TIMER0_PRESCALER_DIV
00087 #define TIMER0_CONF_OK
00088 #endif
00089
00090 #if defined TIMER0_PRESCALER_REG_8 && TIMER0_PRESCALER_REG_8 == TIMER0_PRESCALER_DIV
00091 #define TIMER0_CONF_OK
00092 #endif
00093
00094 #if defined TIMER0_PRESCALER_REG_9 && TIMER0_PRESCALER_REG_9 == TIMER0_PRESCALER_DIV
00095 #define TIMER0_CONF_OK
00096 #endif
00097
00098 #if defined TIMER0_PRESCALER_REG_10 && TIMER0_PRESCALER_REG_10 == TIMER0_PRESCALER_DIV
00099 #define TIMER0_CONF_OK
00100 #endif
00101
00102 #if defined TIMER0_PRESCALER_REG_11 && TIMER0_PRESCALER_REG_11 == TIMER0_PRESCALER_DIV
00103 #define TIMER0_CONF_OK
00104 #endif
00105
00106 #if defined TIMER0_PRESCALER_REG_12 && TIMER0_PRESCALER_REG_12 == TIMER0_PRESCALER_DIV
00107 #define TIMER0_CONF_OK
00108 #endif
00109
00110 #if defined TIMER0_PRESCALER_REG_13 && TIMER0_PRESCALER_REG_13 == TIMER0_PRESCALER_DIV
00111 #define TIMER0_CONF_OK
00112 #endif
00113
00114 #if defined TIMER0_PRESCALER_REG_14 && TIMER0_PRESCALER_REG_14 == TIMER0_PRESCALER_DIV
00115 #define TIMER0_CONF_OK
00116 #endif
00117
00118 #if defined TIMER0_PRESCALER_REG_15 && TIMER0_PRESCALER_REG_15 == TIMER0_PRESCALER_DIV
00119 #define TIMER0_CONF_OK
00120 #endif
00121
00122 #ifndef TIMER0_CONF_OK
00123 #error TIMER0 has a bad prescaler value
00124 #endif
00125
00126 #endif
00127
00128
00129
00130 #if defined TIMER1_ENABLED
00131
00132 #if defined TIMER1_PRESCALER_REG_0 && TIMER1_PRESCALER_REG_0 == TIMER1_PRESCALER_DIV
00133 #define TIMER1_CONF_OK
00134 #endif
00135
00136 #if defined TIMER1_PRESCALER_REG_1 && TIMER1_PRESCALER_REG_1 == TIMER1_PRESCALER_DIV
00137 #define TIMER1_CONF_OK
00138 #endif
00139
00140 #if defined TIMER1_PRESCALER_REG_2 && TIMER1_PRESCALER_REG_2 == TIMER1_PRESCALER_DIV
00141 #define TIMER1_CONF_OK
00142 #endif
00143
00144 #if defined TIMER1_PRESCALER_REG_3 && TIMER1_PRESCALER_REG_3 == TIMER1_PRESCALER_DIV
00145 #define TIMER1_CONF_OK
00146 #endif
00147
00148 #if defined TIMER1_PRESCALER_REG_4 && TIMER1_PRESCALER_REG_4 == TIMER1_PRESCALER_DIV
00149 #define TIMER1_CONF_OK
00150 #endif
00151
00152 #if defined TIMER1_PRESCALER_REG_5 && TIMER1_PRESCALER_REG_5 == TIMER1_PRESCALER_DIV
00153 #define TIMER1_CONF_OK
00154 #endif
00155
00156 #if defined TIMER1_PRESCALER_REG_6 && TIMER1_PRESCALER_REG_6 == TIMER1_PRESCALER_DIV
00157 #define TIMER1_CONF_OK
00158 #endif
00159
00160 #if defined TIMER1_PRESCALER_REG_7 && TIMER1_PRESCALER_REG_7 == TIMER1_PRESCALER_DIV
00161 #define TIMER1_CONF_OK
00162 #endif
00163
00164 #if defined TIMER1_PRESCALER_REG_8 && TIMER1_PRESCALER_REG_8 == TIMER1_PRESCALER_DIV
00165 #define TIMER1_CONF_OK
00166 #endif
00167
00168 #if defined TIMER1_PRESCALER_REG_9 && TIMER1_PRESCALER_REG_9 == TIMER1_PRESCALER_DIV
00169 #define TIMER1_CONF_OK
00170 #endif
00171
00172 #if defined TIMER1_PRESCALER_REG_10 && TIMER1_PRESCALER_REG_10 == TIMER1_PRESCALER_DIV
00173 #define TIMER1_CONF_OK
00174 #endif
00175
00176 #if defined TIMER1_PRESCALER_REG_11 && TIMER1_PRESCALER_REG_11 == TIMER1_PRESCALER_DIV
00177 #define TIMER1_CONF_OK
00178 #endif
00179
00180 #if defined TIMER1_PRESCALER_REG_12 && TIMER1_PRESCALER_REG_12 == TIMER1_PRESCALER_DIV
00181 #define TIMER1_CONF_OK
00182 #endif
00183
00184 #if defined TIMER1_PRESCALER_REG_13 && TIMER1_PRESCALER_REG_13 == TIMER1_PRESCALER_DIV
00185 #define TIMER1_CONF_OK
00186 #endif
00187
00188 #if defined TIMER1_PRESCALER_REG_14 && TIMER1_PRESCALER_REG_14 == TIMER1_PRESCALER_DIV
00189 #define TIMER1_CONF_OK
00190 #endif
00191
00192 #if defined TIMER1_PRESCALER_REG_15 && TIMER1_PRESCALER_REG_15 == TIMER1_PRESCALER_DIV
00193 #define TIMER1_CONF_OK
00194 #endif
00195
00196 #ifndef TIMER1_CONF_OK
00197 #error TIMER1 has a bad prescaler value
00198 #endif
00199
00200 #endif
00201
00202
00203 #if defined TIMER2_ENABLED
00204
00205 #if defined TIMER2_PRESCALER_REG_0 && TIMER2_PRESCALER_REG_0 == TIMER2_PRESCALER_DIV
00206 #define TIMER2_CONF_OK
00207 #endif
00208
00209 #if defined TIMER2_PRESCALER_REG_1 && TIMER2_PRESCALER_REG_1 == TIMER2_PRESCALER_DIV
00210 #define TIMER2_CONF_OK
00211 #endif
00212
00213 #if defined TIMER2_PRESCALER_REG_2 && TIMER2_PRESCALER_REG_2 == TIMER2_PRESCALER_DIV
00214 #define TIMER2_CONF_OK
00215 #endif
00216
00217 #if defined TIMER2_PRESCALER_REG_3 && TIMER2_PRESCALER_REG_3 == TIMER2_PRESCALER_DIV
00218 #define TIMER2_CONF_OK
00219 #endif
00220
00221 #if defined TIMER2_PRESCALER_REG_4 && TIMER2_PRESCALER_REG_4 == TIMER2_PRESCALER_DIV
00222 #define TIMER2_CONF_OK
00223 #endif
00224
00225 #if defined TIMER2_PRESCALER_REG_5 && TIMER2_PRESCALER_REG_5 == TIMER2_PRESCALER_DIV
00226 #define TIMER2_CONF_OK
00227 #endif
00228
00229 #if defined TIMER2_PRESCALER_REG_6 && TIMER2_PRESCALER_REG_6 == TIMER2_PRESCALER_DIV
00230 #define TIMER2_CONF_OK
00231 #endif
00232
00233 #if defined TIMER2_PRESCALER_REG_7 && TIMER2_PRESCALER_REG_7 == TIMER2_PRESCALER_DIV
00234 #define TIMER2_CONF_OK
00235 #endif
00236
00237 #if defined TIMER2_PRESCALER_REG_8 && TIMER2_PRESCALER_REG_8 == TIMER2_PRESCALER_DIV
00238 #define TIMER2_CONF_OK
00239 #endif
00240
00241 #if defined TIMER2_PRESCALER_REG_9 && TIMER2_PRESCALER_REG_9 == TIMER2_PRESCALER_DIV
00242 #define TIMER2_CONF_OK
00243 #endif
00244
00245 #if defined TIMER2_PRESCALER_REG_10 && TIMER2_PRESCALER_REG_10 == TIMER2_PRESCALER_DIV
00246 #define TIMER2_CONF_OK
00247 #endif
00248
00249 #if defined TIMER2_PRESCALER_REG_11 && TIMER2_PRESCALER_REG_11 == TIMER2_PRESCALER_DIV
00250 #define TIMER2_CONF_OK
00251 #endif
00252
00253 #if defined TIMER2_PRESCALER_REG_12 && TIMER2_PRESCALER_REG_12 == TIMER2_PRESCALER_DIV
00254 #define TIMER2_CONF_OK
00255 #endif
00256
00257 #if defined TIMER2_PRESCALER_REG_13 && TIMER2_PRESCALER_REG_13 == TIMER2_PRESCALER_DIV
00258 #define TIMER2_CONF_OK
00259 #endif
00260
00261 #if defined TIMER2_PRESCALER_REG_14 && TIMER2_PRESCALER_REG_14 == TIMER2_PRESCALER_DIV
00262 #define TIMER2_CONF_OK
00263 #endif
00264
00265 #if defined TIMER2_PRESCALER_REG_15 && TIMER2_PRESCALER_REG_15 == TIMER2_PRESCALER_DIV
00266 #define TIMER2_CONF_OK
00267 #endif
00268
00269 #ifndef TIMER2_CONF_OK
00270 #error TIMER2 has a bad prescaler value
00271 #endif
00272
00273 #endif
00274
00275
00276 #if defined TIMER3_ENABLED
00277
00278 #if defined TIMER3_PRESCALER_REG_0 && TIMER3_PRESCALER_REG_0 == TIMER3_PRESCALER_DIV
00279 #define TIMER3_CONF_OK
00280 #endif
00281
00282 #if defined TIMER3_PRESCALER_REG_1 && TIMER3_PRESCALER_REG_1 == TIMER3_PRESCALER_DIV
00283 #define TIMER3_CONF_OK
00284 #endif
00285
00286 #if defined TIMER3_PRESCALER_REG_2 && TIMER3_PRESCALER_REG_2 == TIMER3_PRESCALER_DIV
00287 #define TIMER3_CONF_OK
00288 #endif
00289
00290 #if defined TIMER3_PRESCALER_REG_3 && TIMER3_PRESCALER_REG_3 == TIMER3_PRESCALER_DIV
00291 #define TIMER3_CONF_OK
00292 #endif
00293
00294 #if defined TIMER3_PRESCALER_REG_4 && TIMER3_PRESCALER_REG_4 == TIMER3_PRESCALER_DIV
00295 #define TIMER3_CONF_OK
00296 #endif
00297
00298 #if defined TIMER3_PRESCALER_REG_5 && TIMER3_PRESCALER_REG_5 == TIMER3_PRESCALER_DIV
00299 #define TIMER3_CONF_OK
00300 #endif
00301
00302 #if defined TIMER3_PRESCALER_REG_6 && TIMER3_PRESCALER_REG_6 == TIMER3_PRESCALER_DIV
00303 #define TIMER3_CONF_OK
00304 #endif
00305
00306 #if defined TIMER3_PRESCALER_REG_7 && TIMER3_PRESCALER_REG_7 == TIMER3_PRESCALER_DIV
00307 #define TIMER3_CONF_OK
00308 #endif
00309
00310 #if defined TIMER3_PRESCALER_REG_8 && TIMER3_PRESCALER_REG_8 == TIMER3_PRESCALER_DIV
00311 #define TIMER3_CONF_OK
00312 #endif
00313
00314 #if defined TIMER3_PRESCALER_REG_9 && TIMER3_PRESCALER_REG_9 == TIMER3_PRESCALER_DIV
00315 #define TIMER3_CONF_OK
00316 #endif
00317
00318 #if defined TIMER3_PRESCALER_REG_10 && TIMER3_PRESCALER_REG_10 == TIMER3_PRESCALER_DIV
00319 #define TIMER3_CONF_OK
00320 #endif
00321
00322 #if defined TIMER3_PRESCALER_REG_11 && TIMER3_PRESCALER_REG_11 == TIMER3_PRESCALER_DIV
00323 #define TIMER3_CONF_OK
00324 #endif
00325
00326 #if defined TIMER3_PRESCALER_REG_12 && TIMER3_PRESCALER_REG_12 == TIMER3_PRESCALER_DIV
00327 #define TIMER3_CONF_OK
00328 #endif
00329
00330 #if defined TIMER3_PRESCALER_REG_13 && TIMER3_PRESCALER_REG_13 == TIMER3_PRESCALER_DIV
00331 #define TIMER3_CONF_OK
00332 #endif
00333
00334 #if defined TIMER3_PRESCALER_REG_14 && TIMER3_PRESCALER_REG_14 == TIMER3_PRESCALER_DIV
00335 #define TIMER3_CONF_OK
00336 #endif
00337
00338 #if defined TIMER3_PRESCALER_REG_15 && TIMER3_PRESCALER_REG_15 == TIMER3_PRESCALER_DIV
00339 #define TIMER3_CONF_OK
00340 #endif
00341
00342 #ifndef TIMER3_CONF_OK
00343 #error TIMER3 has a bad prescaler value
00344 #endif
00345
00346 #endif
00347
00348 #if defined TIMER4_ENABLED
00349
00350 #if defined TIMER4_PRESCALER_REG_0 && TIMER4_PRESCALER_REG_0 == TIMER4_PRESCALER_DIV
00351 #define TIMER4_CONF_OK
00352 #endif
00353
00354 #if defined TIMER4_PRESCALER_REG_1 && TIMER4_PRESCALER_REG_1 == TIMER4_PRESCALER_DIV
00355 #define TIMER4_CONF_OK
00356 #endif
00357
00358 #if defined TIMER4_PRESCALER_REG_2 && TIMER4_PRESCALER_REG_2 == TIMER4_PRESCALER_DIV
00359 #define TIMER4_CONF_OK
00360 #endif
00361
00362 #if defined TIMER4_PRESCALER_REG_3 && TIMER4_PRESCALER_REG_3 == TIMER4_PRESCALER_DIV
00363 #define TIMER4_CONF_OK
00364 #endif
00365
00366 #if defined TIMER4_PRESCALER_REG_4 && TIMER4_PRESCALER_REG_4 == TIMER4_PRESCALER_DIV
00367 #define TIMER4_CONF_OK
00368 #endif
00369
00370 #if defined TIMER4_PRESCALER_REG_5 && TIMER4_PRESCALER_REG_5 == TIMER4_PRESCALER_DIV
00371 #define TIMER4_CONF_OK
00372 #endif
00373
00374 #if defined TIMER4_PRESCALER_REG_6 && TIMER4_PRESCALER_REG_6 == TIMER4_PRESCALER_DIV
00375 #define TIMER4_CONF_OK
00376 #endif
00377
00378 #if defined TIMER4_PRESCALER_REG_7 && TIMER4_PRESCALER_REG_7 == TIMER4_PRESCALER_DIV
00379 #define TIMER4_CONF_OK
00380 #endif
00381
00382 #if defined TIMER4_PRESCALER_REG_8 && TIMER4_PRESCALER_REG_8 == TIMER4_PRESCALER_DIV
00383 #define TIMER4_CONF_OK
00384 #endif
00385
00386 #if defined TIMER4_PRESCALER_REG_9 && TIMER4_PRESCALER_REG_9 == TIMER4_PRESCALER_DIV
00387 #define TIMER4_CONF_OK
00388 #endif
00389
00390 #if defined TIMER4_PRESCALER_REG_10 && TIMER4_PRESCALER_REG_10 == TIMER4_PRESCALER_DIV
00391 #define TIMER4_CONF_OK
00392 #endif
00393
00394 #if defined TIMER4_PRESCALER_REG_11 && TIMER4_PRESCALER_REG_11 == TIMER4_PRESCALER_DIV
00395 #define TIMER4_CONF_OK
00396 #endif
00397
00398 #if defined TIMER4_PRESCALER_REG_12 && TIMER4_PRESCALER_REG_12 == TIMER4_PRESCALER_DIV
00399 #define TIMER4_CONF_OK
00400 #endif
00401
00402 #if defined TIMER4_PRESCALER_REG_13 && TIMER4_PRESCALER_REG_13 == TIMER4_PRESCALER_DIV
00403 #define TIMER4_CONF_OK
00404 #endif
00405
00406 #if defined TIMER4_PRESCALER_REG_14 && TIMER4_PRESCALER_REG_14 == TIMER4_PRESCALER_DIV
00407 #define TIMER4_CONF_OK
00408 #endif
00409
00410 #if defined TIMER4_PRESCALER_REG_15 && TIMER4_PRESCALER_REG_15 == TIMER4_PRESCALER_DIV
00411 #define TIMER4_CONF_OK
00412 #endif
00413
00414 #ifndef TIMER4_CONF_OK
00415 #error TIMER4 has a bad prescaler value
00416 #endif
00417
00418 #endif
00419
00420 #if defined TIMER5_ENABLED
00421
00422 #if defined TIMER5_PRESCALER_REG_0 && TIMER5_PRESCALER_REG_0 == TIMER5_PRESCALER_DIV
00423 #define TIMER5_CONF_OK
00424 #endif
00425
00426 #if defined TIMER5_PRESCALER_REG_1 && TIMER5_PRESCALER_REG_1 == TIMER5_PRESCALER_DIV
00427 #define TIMER5_CONF_OK
00428 #endif
00429
00430 #if defined TIMER5_PRESCALER_REG_2 && TIMER5_PRESCALER_REG_2 == TIMER5_PRESCALER_DIV
00431 #define TIMER5_CONF_OK
00432 #endif
00433
00434 #if defined TIMER5_PRESCALER_REG_3 && TIMER5_PRESCALER_REG_3 == TIMER5_PRESCALER_DIV
00435 #define TIMER5_CONF_OK
00436 #endif
00437
00438 #if defined TIMER5_PRESCALER_REG_4 && TIMER5_PRESCALER_REG_4 == TIMER5_PRESCALER_DIV
00439 #define TIMER5_CONF_OK
00440 #endif
00441
00442 #if defined TIMER5_PRESCALER_REG_5 && TIMER5_PRESCALER_REG_5 == TIMER5_PRESCALER_DIV
00443 #define TIMER5_CONF_OK
00444 #endif
00445
00446 #if defined TIMER5_PRESCALER_REG_6 && TIMER5_PRESCALER_REG_6 == TIMER5_PRESCALER_DIV
00447 #define TIMER5_CONF_OK
00448 #endif
00449
00450 #if defined TIMER5_PRESCALER_REG_7 && TIMER5_PRESCALER_REG_7 == TIMER5_PRESCALER_DIV
00451 #define TIMER5_CONF_OK
00452 #endif
00453
00454 #if defined TIMER5_PRESCALER_REG_8 && TIMER5_PRESCALER_REG_8 == TIMER5_PRESCALER_DIV
00455 #define TIMER5_CONF_OK
00456 #endif
00457
00458 #if defined TIMER5_PRESCALER_REG_9 && TIMER5_PRESCALER_REG_9 == TIMER5_PRESCALER_DIV
00459 #define TIMER5_CONF_OK
00460 #endif
00461
00462 #if defined TIMER5_PRESCALER_REG_10 && TIMER5_PRESCALER_REG_10 == TIMER5_PRESCALER_DIV
00463 #define TIMER5_CONF_OK
00464 #endif
00465
00466 #if defined TIMER5_PRESCALER_REG_11 && TIMER5_PRESCALER_REG_11 == TIMER5_PRESCALER_DIV
00467 #define TIMER5_CONF_OK
00468 #endif
00469
00470 #if defined TIMER5_PRESCALER_REG_12 && TIMER5_PRESCALER_REG_12 == TIMER5_PRESCALER_DIV
00471 #define TIMER5_CONF_OK
00472 #endif
00473
00474 #if defined TIMER5_PRESCALER_REG_13 && TIMER5_PRESCALER_REG_13 == TIMER5_PRESCALER_DIV
00475 #define TIMER5_CONF_OK
00476 #endif
00477
00478 #if defined TIMER5_PRESCALER_REG_14 && TIMER5_PRESCALER_REG_14 == TIMER5_PRESCALER_DIV
00479 #define TIMER5_CONF_OK
00480 #endif
00481
00482 #if defined TIMER5_PRESCALER_REG_15 && TIMER5_PRESCALER_REG_15 == TIMER5_PRESCALER_DIV
00483 #define TIMER5_CONF_OK
00484 #endif
00485
00486 #ifndef TIMER5_CONF_OK
00487 #error TIMER5 has a bad prescaler value
00488 #endif
00489
00490 #endif
00491