arm: async uart writes & fixes
This commit is contained in:
24
arm/timer.h
24
arm/timer.h
@@ -3,18 +3,18 @@
|
||||
struct TimerControl {
|
||||
union {
|
||||
struct {
|
||||
uint32_t MDT0 : 1;
|
||||
uint32_t UDT0 : 1;
|
||||
uint32_t MDT0 : 1;
|
||||
uint32_t UDT0 : 1;
|
||||
uint32_t GENT0 : 1;
|
||||
uint32_t CAPT0 : 1;
|
||||
uint32_t ARHT0 : 1;
|
||||
uint32_t LOAD0 : 1;
|
||||
uint32_t ENIT0 : 1;
|
||||
uint32_t ENT0 : 1;
|
||||
uint32_t ENT0 : 1;
|
||||
uint32_t T0INT : 1;
|
||||
uint32_t PWMA0 : 1;
|
||||
uint32_t ENALL : 1;
|
||||
uint32_t CASC : 1;
|
||||
uint32_t CASC : 1;
|
||||
|
||||
uint32_t reserved : 20;
|
||||
};
|
||||
@@ -38,18 +38,16 @@ struct Timer {
|
||||
TCSR1.ENT0 = 1;
|
||||
}
|
||||
|
||||
uint32_t GetT1Ticks() {
|
||||
return TCR1;
|
||||
}
|
||||
uint32_t GetT1Ticks() { return TCR1; }
|
||||
|
||||
void SetupAsWdt(uint32_t timeout_ticks) {
|
||||
TLR0 = timeout_ticks;
|
||||
TCSR0.LOAD0 = 1; // reset counter
|
||||
TCSR0.UDT0 = 1; // count backwards from the load value
|
||||
TCSR0.ENIT0 = 1; // enable interrupt
|
||||
TCSR0.LOAD0 = 1; // reset counter
|
||||
TCSR0.UDT0 = 1; // count backwards from the load value
|
||||
TCSR0.ENIT0 = 1; // enable interrupt
|
||||
|
||||
TCSR0.LOAD0 = 0; // allow counter to run
|
||||
TCSR0.ENT0 = 1; // enable timer
|
||||
TCSR0.LOAD0 = 0; // allow counter to run
|
||||
TCSR0.ENT0 = 1; // enable timer
|
||||
}
|
||||
|
||||
void Pet() {
|
||||
@@ -60,4 +58,4 @@ struct Timer {
|
||||
}
|
||||
};
|
||||
|
||||
#define timer0 ((Timer*) 0x40002000)
|
||||
#define timer0 ((Timer*)0x40002000)
|
||||
|
||||
Reference in New Issue
Block a user