| 1 |
-- { dg-do compile } |
| 2 |
-- { dg-options "-O2" } |
| 3 |
|
| 4 |
package Opt6 is |
| 5 |
|
| 6 |
type Timer_Output_Compare_And_PWM_Mode is |
| 7 |
(Frozen, |
| 8 |
Active, |
| 9 |
Inactive, |
| 10 |
Toggle, |
| 11 |
Force_Inactive, |
| 12 |
Force_Active, |
| 13 |
PWM1, |
| 14 |
PWM2); |
| 15 |
|
| 16 |
type Timer_Capture_Compare_Modes is |
| 17 |
(Output, Direct_TI, Indirect_TI, TRC); |
| 18 |
|
| 19 |
type Timer_Input_Capture_Filter is mod 16; |
| 20 |
|
| 21 |
type Timer_Input_Capture_Prescaler is |
| 22 |
(Div1, |
| 23 |
Div2, |
| 24 |
Div4, |
| 25 |
Div8); |
| 26 |
|
| 27 |
type Channel_Output_Descriptor is record |
| 28 |
OCxFast_Enable : Boolean; |
| 29 |
OCxPreload_Enable : Boolean; |
| 30 |
OCxMode : Timer_Output_Compare_And_PWM_Mode; |
| 31 |
OCxClear_Enable : Boolean; |
| 32 |
end record with Size => 6; |
| 33 |
for Channel_Output_Descriptor use record |
| 34 |
OCxFast_Enable at 0 range 0 .. 0; |
| 35 |
OCxPreload_Enable at 0 range 1 .. 1; |
| 36 |
OCxMode at 0 range 2 .. 4; |
| 37 |
OCxClear_Enable at 0 range 5 .. 5; |
| 38 |
end record; |
| 39 |
|
| 40 |
type Channel_Input_Descriptor is record |
| 41 |
ICxFilter : Timer_Input_Capture_Filter; |
| 42 |
ICxPrescaler : Timer_Input_Capture_Prescaler; |
| 43 |
end record with Size => 6; |
| 44 |
for Channel_Input_Descriptor use record |
| 45 |
ICxFilter at 0 range 2 .. 5; |
| 46 |
ICxPrescaler at 0 range 0 .. 1; |
| 47 |
end record; |
| 48 |
|
| 49 |
type IO_Descriptor (CCxSelection : Timer_Capture_Compare_Modes := Output) is |
| 50 |
record |
| 51 |
case CCxSelection is |
| 52 |
when Direct_TI .. TRC => |
| 53 |
Capture : Channel_Input_Descriptor; |
| 54 |
when Output => |
| 55 |
Compare : Channel_Output_Descriptor; |
| 56 |
end case; |
| 57 |
end record with Size => 8; |
| 58 |
for IO_Descriptor use record |
| 59 |
CCxSelection at 0 range 0 .. 1; |
| 60 |
Capture at 0 range 2 .. 7; |
| 61 |
Compare at 0 range 2 .. 7; |
| 62 |
end record; |
| 63 |
|
| 64 |
subtype Lower_Half_Index is Integer range 1 .. 2; |
| 65 |
type TIMx_CCMRx_Lower_Half is |
| 66 |
array (Lower_Half_Index) of IO_Descriptor |
| 67 |
with Volatile_Components, Component_Size => 8, Size => 16; |
| 68 |
|
| 69 |
end Opt6; |