summaryrefslogtreecommitdiff
path: root/firmware/target
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/arm/tcc77x/system-target.h9
-rw-r--r--firmware/target/arm/tcc77x/system-tcc77x.c8
2 files changed, 17 insertions, 0 deletions
diff --git a/firmware/target/arm/tcc77x/system-target.h b/firmware/target/arm/tcc77x/system-target.h
index 16cfb9127d..55dd52ef47 100644
--- a/firmware/target/arm/tcc77x/system-target.h
+++ b/firmware/target/arm/tcc77x/system-target.h
@@ -34,4 +34,13 @@
34#define inw(a) (*(volatile unsigned short *) (a)) 34#define inw(a) (*(volatile unsigned short *) (a))
35#define outw(a,b) (*(volatile unsigned short *) (b) = (a)) 35#define outw(a,b) (*(volatile unsigned short *) (b) = (a))
36 36
37/* TC32 is configured to 1MHz in clock_init() */
38#define USEC_TIMER TC32MCNT
39
40static inline void udelay(unsigned usecs)
41{
42 unsigned stop = USEC_TIMER + usecs;
43 while (TIME_BEFORE(USEC_TIMER, stop));
44}
45
37#endif /* SYSTEM_TARGET_H */ 46#endif /* SYSTEM_TARGET_H */
diff --git a/firmware/target/arm/tcc77x/system-tcc77x.c b/firmware/target/arm/tcc77x/system-tcc77x.c
index 90e53afb14..29227b52a3 100644
--- a/firmware/target/arm/tcc77x/system-tcc77x.c
+++ b/firmware/target/arm/tcc77x/system-tcc77x.c
@@ -187,6 +187,14 @@ static void clock_init(void)
187 "nop \n\t" 187 "nop \n\t"
188 "nop \n\t" 188 "nop \n\t"
189 ); 189 );
190
191 /* Enable Z-Clock */
192 PCLKCFG5 |= (1<<31) | (4<<28); /* Timer Z-Clock enable, XIN direct*/
193
194 /* Set TC32 timer to be our USEC_TIMER (Xin divided by 12 = 1MHz) */
195 TC32MCNT = 0;
196 TC32LDV = 0;
197 TC32EN = (1<<24) | 11;
190} 198}
191 199
192static void cpu_init(void) 200static void cpu_init(void)