1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
///Register `GCCFG` reader
pub type R = crate::R<GCCFGrs>;
///Register `GCCFG` writer
pub type W = crate::W<GCCFGrs>;
///Field `CHGDET` reader - Charger detection, result of the current mode (primary or secondary).
pub type CHGDET_R = crate::BitReader;
///Field `FSVPLUS` reader - Single-Ended DP indicator This bit gives the voltage level on DP (also result of the comparison with V<sub>LGC</sub> threshold as defined in BC v1.2 standard).
pub type FSVPLUS_R = crate::BitReader;
///Field `FSVMINUS` reader - Single-Ended DM indicator This bit gives the voltage level on DM (also result of the comparison with V<sub>LGC</sub> threshold as defined in BC v1.2 standard).
pub type FSVMINUS_R = crate::BitReader;
///Field `SESSVLD` reader - VBUS session indicator Indicates if VBUS is above VBUS session threshold.
pub type SESSVLD_R = crate::BitReader;
///Field `HCDPEN` reader - Host CDP behavior enable
pub type HCDPEN_R = crate::BitReader;
///Field `HCDPEN` writer - Host CDP behavior enable
pub type HCDPEN_W<'a, REG> = crate::BitWriter<'a, REG>;
///Field `HCDPDETEN` reader - Host CDP port voltage detector enable on DP
pub type HCDPDETEN_R = crate::BitReader;
///Field `HCDPDETEN` writer - Host CDP port voltage detector enable on DP
pub type HCDPDETEN_W<'a, REG> = crate::BitWriter<'a, REG>;
///Field `HVDMSRCEN` reader - Host CDP port Voltage source enable on DM
pub type HVDMSRCEN_R = crate::BitReader;
///Field `HVDMSRCEN` writer - Host CDP port Voltage source enable on DM
pub type HVDMSRCEN_W<'a, REG> = crate::BitWriter<'a, REG>;
///Field `DCDEN` reader - Data Contact Detection enable
pub type DCDEN_R = crate::BitReader;
///Field `DCDEN` writer - Data Contact Detection enable
pub type DCDEN_W<'a, REG> = crate::BitWriter<'a, REG>;
///Field `PDEN` reader - Primary detection enable
pub type PDEN_R = crate::BitReader;
///Field `PDEN` writer - Primary detection enable
pub type PDEN_W<'a, REG> = crate::BitWriter<'a, REG>;
///Field `VBDEN` reader - VBUS detection enable Enables VBUS Sensing Comparators in order to detect VBUS presence and/or perform OTG operation.
pub type VBDEN_R = crate::BitReader;
///Field `VBDEN` writer - VBUS detection enable Enables VBUS Sensing Comparators in order to detect VBUS presence and/or perform OTG operation.
pub type VBDEN_W<'a, REG> = crate::BitWriter<'a, REG>;
///Field `SDEN` reader - Secondary detection enable
pub type SDEN_R = crate::BitReader;
///Field `SDEN` writer - Secondary detection enable
pub type SDEN_W<'a, REG> = crate::BitWriter<'a, REG>;
///Field `VBVALOVAL` reader - Software override value of the VBUS B-session detection
pub type VBVALOVAL_R = crate::BitReader;
///Field `VBVALOVAL` writer - Software override value of the VBUS B-session detection
pub type VBVALOVAL_W<'a, REG> = crate::BitWriter<'a, REG>;
///Field `VBVALOVEN` reader - Enables a software override of the VBUS B-session detection.
pub type VBVALOVEN_R = crate::BitReader;
///Field `VBVALOVEN` writer - Enables a software override of the VBUS B-session detection.
pub type VBVALOVEN_W<'a, REG> = crate::BitWriter<'a, REG>;
///Field `FORCEHOSTPD` reader - Force host mode pull-downs If the ID pin functions are enabled, the host mode pull-downs on DP and DM activate automatically. However, whenever that is not the case, yet host mode is required, this bit must be used to force the pull-downs active.
pub type FORCEHOSTPD_R = crate::BitReader;
///Field `FORCEHOSTPD` writer - Force host mode pull-downs If the ID pin functions are enabled, the host mode pull-downs on DP and DM activate automatically. However, whenever that is not the case, yet host mode is required, this bit must be used to force the pull-downs active.
pub type FORCEHOSTPD_W<'a, REG> = crate::BitWriter<'a, REG>;
impl R {
///Bit 0 - Charger detection, result of the current mode (primary or secondary).
#[inline(always)]
pub fn chgdet(&self) -> CHGDET_R {
CHGDET_R::new((self.bits & 1) != 0)
}
///Bit 1 - Single-Ended DP indicator This bit gives the voltage level on DP (also result of the comparison with V<sub>LGC</sub> threshold as defined in BC v1.2 standard).
#[inline(always)]
pub fn fsvplus(&self) -> FSVPLUS_R {
FSVPLUS_R::new(((self.bits >> 1) & 1) != 0)
}
///Bit 2 - Single-Ended DM indicator This bit gives the voltage level on DM (also result of the comparison with V<sub>LGC</sub> threshold as defined in BC v1.2 standard).
#[inline(always)]
pub fn fsvminus(&self) -> FSVMINUS_R {
FSVMINUS_R::new(((self.bits >> 2) & 1) != 0)
}
///Bit 3 - VBUS session indicator Indicates if VBUS is above VBUS session threshold.
#[inline(always)]
pub fn sessvld(&self) -> SESSVLD_R {
SESSVLD_R::new(((self.bits >> 3) & 1) != 0)
}
///Bit 16 - Host CDP behavior enable
#[inline(always)]
pub fn hcdpen(&self) -> HCDPEN_R {
HCDPEN_R::new(((self.bits >> 16) & 1) != 0)
}
///Bit 17 - Host CDP port voltage detector enable on DP
#[inline(always)]
pub fn hcdpdeten(&self) -> HCDPDETEN_R {
HCDPDETEN_R::new(((self.bits >> 17) & 1) != 0)
}
///Bit 18 - Host CDP port Voltage source enable on DM
#[inline(always)]
pub fn hvdmsrcen(&self) -> HVDMSRCEN_R {
HVDMSRCEN_R::new(((self.bits >> 18) & 1) != 0)
}
///Bit 19 - Data Contact Detection enable
#[inline(always)]
pub fn dcden(&self) -> DCDEN_R {
DCDEN_R::new(((self.bits >> 19) & 1) != 0)
}
///Bit 20 - Primary detection enable
#[inline(always)]
pub fn pden(&self) -> PDEN_R {
PDEN_R::new(((self.bits >> 20) & 1) != 0)
}
///Bit 21 - VBUS detection enable Enables VBUS Sensing Comparators in order to detect VBUS presence and/or perform OTG operation.
#[inline(always)]
pub fn vbden(&self) -> VBDEN_R {
VBDEN_R::new(((self.bits >> 21) & 1) != 0)
}
///Bit 22 - Secondary detection enable
#[inline(always)]
pub fn sden(&self) -> SDEN_R {
SDEN_R::new(((self.bits >> 22) & 1) != 0)
}
///Bit 23 - Software override value of the VBUS B-session detection
#[inline(always)]
pub fn vbvaloval(&self) -> VBVALOVAL_R {
VBVALOVAL_R::new(((self.bits >> 23) & 1) != 0)
}
///Bit 24 - Enables a software override of the VBUS B-session detection.
#[inline(always)]
pub fn vbvaloven(&self) -> VBVALOVEN_R {
VBVALOVEN_R::new(((self.bits >> 24) & 1) != 0)
}
///Bit 25 - Force host mode pull-downs If the ID pin functions are enabled, the host mode pull-downs on DP and DM activate automatically. However, whenever that is not the case, yet host mode is required, this bit must be used to force the pull-downs active.
#[inline(always)]
pub fn forcehostpd(&self) -> FORCEHOSTPD_R {
FORCEHOSTPD_R::new(((self.bits >> 25) & 1) != 0)
}
}
impl core::fmt::Debug for R {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("GCCFG")
.field("chgdet", &self.chgdet())
.field("fsvplus", &self.fsvplus())
.field("fsvminus", &self.fsvminus())
.field("sessvld", &self.sessvld())
.field("hcdpen", &self.hcdpen())
.field("hcdpdeten", &self.hcdpdeten())
.field("hvdmsrcen", &self.hvdmsrcen())
.field("dcden", &self.dcden())
.field("pden", &self.pden())
.field("vbden", &self.vbden())
.field("sden", &self.sden())
.field("vbvaloval", &self.vbvaloval())
.field("vbvaloven", &self.vbvaloven())
.field("forcehostpd", &self.forcehostpd())
.finish()
}
}
impl W {
///Bit 16 - Host CDP behavior enable
#[inline(always)]
pub fn hcdpen(&mut self) -> HCDPEN_W<GCCFGrs> {
HCDPEN_W::new(self, 16)
}
///Bit 17 - Host CDP port voltage detector enable on DP
#[inline(always)]
pub fn hcdpdeten(&mut self) -> HCDPDETEN_W<GCCFGrs> {
HCDPDETEN_W::new(self, 17)
}
///Bit 18 - Host CDP port Voltage source enable on DM
#[inline(always)]
pub fn hvdmsrcen(&mut self) -> HVDMSRCEN_W<GCCFGrs> {
HVDMSRCEN_W::new(self, 18)
}
///Bit 19 - Data Contact Detection enable
#[inline(always)]
pub fn dcden(&mut self) -> DCDEN_W<GCCFGrs> {
DCDEN_W::new(self, 19)
}
///Bit 20 - Primary detection enable
#[inline(always)]
pub fn pden(&mut self) -> PDEN_W<GCCFGrs> {
PDEN_W::new(self, 20)
}
///Bit 21 - VBUS detection enable Enables VBUS Sensing Comparators in order to detect VBUS presence and/or perform OTG operation.
#[inline(always)]
pub fn vbden(&mut self) -> VBDEN_W<GCCFGrs> {
VBDEN_W::new(self, 21)
}
///Bit 22 - Secondary detection enable
#[inline(always)]
pub fn sden(&mut self) -> SDEN_W<GCCFGrs> {
SDEN_W::new(self, 22)
}
///Bit 23 - Software override value of the VBUS B-session detection
#[inline(always)]
pub fn vbvaloval(&mut self) -> VBVALOVAL_W<GCCFGrs> {
VBVALOVAL_W::new(self, 23)
}
///Bit 24 - Enables a software override of the VBUS B-session detection.
#[inline(always)]
pub fn vbvaloven(&mut self) -> VBVALOVEN_W<GCCFGrs> {
VBVALOVEN_W::new(self, 24)
}
///Bit 25 - Force host mode pull-downs If the ID pin functions are enabled, the host mode pull-downs on DP and DM activate automatically. However, whenever that is not the case, yet host mode is required, this bit must be used to force the pull-downs active.
#[inline(always)]
pub fn forcehostpd(&mut self) -> FORCEHOSTPD_W<GCCFGrs> {
FORCEHOSTPD_W::new(self, 25)
}
}
/**OTG general core configuration register
You can [`read`](crate::Reg::read) this register and get [`gccfg::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`gccfg::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).*/
pub struct GCCFGrs;
impl crate::RegisterSpec for GCCFGrs {
type Ux = u32;
}
///`read()` method returns [`gccfg::R`](R) reader structure
impl crate::Readable for GCCFGrs {}
///`write(|w| ..)` method takes [`gccfg::W`](W) writer structure
impl crate::Writable for GCCFGrs {
type Safety = crate::Unsafe;
}
///`reset()` method sets GCCFG to value 0
impl crate::Resettable for GCCFGrs {}