7 * \copyright Copyright (c) 2013 Infineon Technologies AG. All rights reserved.
8 *
9 *
10 * IMPORTANT NOTICE
11 *
12 *
13 * Infineon Technologies AG (Infineon) is supplying this file for use
14 * exclusively with Infineon's microcontroller products. This file can be freely
15 * distributed within development tools that are supporting such microcontroller
16 * products.
17 *
18 * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
19 * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
21 * INFINEON SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL,
22 * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
23 *
24 * \defgroup IfxLld_Gtm_Tom_Timer_Usage How to use the GTM TOM Timer Driver
25 * \ingroup IfxLld_Gtm_Tom_Timer
26 *
27 * This driver implements the timer functionalities as defined by \ref library_srvsw_stdif_timer.
28 * The user is free to use either the driver specific APIs below or to used the \ref library_srvsw_stdif_timer "standard interface APIs".
29 *
30 * \section specific Specific Implementation
31 * The timer fucntinality is implemented using either a single or 2 TOM channels. The dicision to use 1 or 2 channels is done
32 * depending on the following requirements:
33 * - relative position of the timer channel to the other channels used if any
34 * - need to trigger an other module, for example ADC triggering.
35 *
36 * The figure below show how the TOM is \ref IfxGtm_Tom_Timer_Config "configured" when a single TOM channel is used for the timer and trigger functinalities.
37 * The internal trigger signal (red line) is generated when the counter CN0 reach the CM0 compare register. The value of CM0 act as the period value. This internal
38 * trigger is used to reset the CN0 counter and simultaneously transfer the shadow values for the period value (SR0->CM0)
39 * and trigger edge (SR1->CM1). The internal trigger is used as a trigger input to the next TOM channel.
40 * The trigger signal (output trigger) is generated by the CM0 and CM1 compare values. Depending on the trigger signal active
41 * edge \ref IfxGtm_Tom_Timer_Config "configuiration", the CM0 will reset, and the CM1 will set the trigger signal, or vice versa.
42 *
43 * \image html "IfxGtm_Tom_Timer-0.png" "Timer using one signle TOM channel"
44 *
45 * In case 2 TOM channels are used for the timer and trigger functionalities,
46 * the 1st channel (CHz in the figure below) is used for the generation of the period,
47 * and the 2nd channel (CHz+n the below figure, the figure shows n=1 as example) is used for the trigger generation.
48 *
49 * The CHz TOM channel generates the internal trigger signal (red line) when the counter CN0 reach the CM0 compare register.
50 * The value of CM0 of CHz act as the period value. This internal trigger is used to reset the CN0 counter and simultaneously
51 * transfer the shadow period value (SR0->CM0). The internal trigger is used as an input for the next TOM channel.
52 *
53 * The CHz+n TOM channel, uses the internal trigger signal to simultaneously resets the
54 * counter CN0, and transfer the shadow values used for the generation of the trigger falling and rising edges (SR0->CM0 and SR1->CM1).
55 * The internal trigger is used as a trigger input to the next TOM channel.
56 * Depending on the trigger signal active edge \ref IfxGtm_Tom_Timer_Config "configuiration", the CM0 will reset, and the CM1 will set the trigger signal, or vice versa.
57 * In orter to have a similar behaviour to the single channel implementation,
58 * the CM0 is set to the same value as CHz CM0, and CM1 is used for the trigger edge.
59 *
60 * \image html "IfxGtm_Tom_Timer-1.png" "Timer using two different TOM channels for the timer and the trigger"
61 *
62 *
63 * In order to ensure a coherent update of all registers, the internal trigger must be disable before updating
64 * the timer and trigger shadow values, and enabled once the update is done. The transfer will ocucrs at the next timer reset.
65 *
66 * - Resources used:
67 * - if the trigger channel is identical to the timer channel, only one TOM channels is used
68 * - if the trigger channel is different from the timer channel, 2 TOM channels are used
69 * - All channels used must be own by the same TOM and TOM TGC
70 * - The timer counting direction is limited to \ref IfxStdIf_Timer_CountDir_up
71 * - If the TOM trigger channel is not the same as the TOM timer channels
72 * - The TOM channel used for the trigger must have a lower index than the TOM channels
73 * used for the timer.
74 * - the TOM channels must be contiguous, unless specified by the driver using the timer driver.
75 *
76 * Note: the timer and trigger must bepart of the same TGC, but PWM channels can be of different TGC of the same TOM as the timer
77 *
78 * For a detailed configuration of the microcontroller, see \ref IfxGtm_Tom_Timer_init().
152uint16 channelsMask[2]; /**< \brief Mask for channels to be modified together, The 1st value corresponds to the Timer's TGC, the 2nd value corresponds to the timer's next TGC if any */