aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
authorStephane D'Alu <sdalu@sdalu.com>2016-07-07 21:31:22 +0200
committerStephane D'Alu <sdalu@sdalu.com>2016-07-07 21:31:22 +0200
commit60ce974437bd0cd4f59a7bf2617a81644253aacf (patch)
tree0820df5b36bf7645997df9ed0c17b81585928f0f /os
parentf75abd1037a5c2eb119533eb2f4c7c16d874abf2 (diff)
parentc7f7b70596d200afb76c3c8a24d4ddaaa61a2f1e (diff)
downloadChibiOS-Contrib-60ce974437bd0cd4f59a7bf2617a81644253aacf.tar.gz
ChibiOS-Contrib-60ce974437bd0cd4f59a7bf2617a81644253aacf.tar.bz2
ChibiOS-Contrib-60ce974437bd0cd4f59a7bf2617a81644253aacf.zip
Merge branch 'master' into qei
Diffstat (limited to 'os')
-rw-r--r--os/hal/ports/TIVA/LLD/hal_gpt_lld.c48
-rw-r--r--os/hal/ports/TIVA/LLD/hal_i2c_lld.c40
-rw-r--r--os/hal/ports/TIVA/LLD/hal_pwm_lld.c8
-rw-r--r--os/hal/ports/TIVA/LLD/hal_serial_lld.c60
4 files changed, 142 insertions, 14 deletions
diff --git a/os/hal/ports/TIVA/LLD/hal_gpt_lld.c b/os/hal/ports/TIVA/LLD/hal_gpt_lld.c
index 86f2303..870ba12 100644
--- a/os/hal/ports/TIVA/LLD/hal_gpt_lld.c
+++ b/os/hal/ports/TIVA/LLD/hal_gpt_lld.c
@@ -462,6 +462,10 @@ void gpt_lld_start(GPTDriver *gptp)
#if TIVA_GPT_USE_GPT0
if (&GPTD1 == gptp) {
SYSCTL->RCGCTIMER |= (1 << 0);
+
+ while (!(SYSCTL->PRTIMER & (1 << 0)))
+ ;
+
nvicEnableVector(TIVA_GPT0A_NUMBER, TIVA_GPT_GPT0A_IRQ_PRIORITY);
}
#endif
@@ -469,6 +473,10 @@ void gpt_lld_start(GPTDriver *gptp)
#if TIVA_GPT_USE_GPT1
if (&GPTD2 == gptp) {
SYSCTL->RCGCTIMER |= (1 << 1);
+
+ while (!(SYSCTL->PRTIMER & (1 << 1)))
+ ;
+
nvicEnableVector(TIVA_GPT1A_NUMBER, TIVA_GPT_GPT1A_IRQ_PRIORITY);
}
#endif
@@ -476,6 +484,10 @@ void gpt_lld_start(GPTDriver *gptp)
#if TIVA_GPT_USE_GPT2
if (&GPTD3 == gptp) {
SYSCTL->RCGCTIMER |= (1 << 2);
+
+ while (!(SYSCTL->PRTIMER & (1 << 2)))
+ ;
+
nvicEnableVector(TIVA_GPT2A_NUMBER, TIVA_GPT_GPT2A_IRQ_PRIORITY);
}
#endif
@@ -483,6 +495,10 @@ void gpt_lld_start(GPTDriver *gptp)
#if TIVA_GPT_USE_GPT3
if (&GPTD4 == gptp) {
SYSCTL->RCGCTIMER |= (1 << 3);
+
+ while (!(SYSCTL->PRTIMER & (1 << 3)))
+ ;
+
nvicEnableVector(TIVA_GPT3A_NUMBER, TIVA_GPT_GPT3A_IRQ_PRIORITY);
}
#endif
@@ -490,6 +506,10 @@ void gpt_lld_start(GPTDriver *gptp)
#if TIVA_GPT_USE_GPT4
if (&GPTD5 == gptp) {
SYSCTL->RCGCTIMER |= (1 << 4);
+
+ while (!(SYSCTL->PRTIMER & (1 << 4)))
+ ;
+
nvicEnableVector(TIVA_GPT4A_NUMBER, TIVA_GPT_GPT4A_IRQ_PRIORITY);
}
#endif
@@ -497,6 +517,10 @@ void gpt_lld_start(GPTDriver *gptp)
#if TIVA_GPT_USE_GPT5
if (&GPTD6 == gptp) {
SYSCTL->RCGCTIMER |= (1 << 5);
+
+ while (!(SYSCTL->PRTIMER & (1 << 5)))
+ ;
+
nvicEnableVector(TIVA_GPT5A_NUMBER, TIVA_GPT_GPT5A_IRQ_PRIORITY);
}
#endif
@@ -504,6 +528,10 @@ void gpt_lld_start(GPTDriver *gptp)
#if TIVA_GPT_USE_WGPT0
if (&GPTD7 == gptp) {
SYSCTL->RCGCWTIMER |= (1 << 0);
+
+ while (!(SYSCTL->PRWTIMER & (1 << 0)))
+ ;
+
nvicEnableVector(TIVA_WGPT0A_NUMBER, TIVA_GPT_WGPT0A_IRQ_PRIORITY);
}
#endif
@@ -511,6 +539,10 @@ void gpt_lld_start(GPTDriver *gptp)
#if TIVA_GPT_USE_WGPT1
if (&GPTD8 == gptp) {
SYSCTL->RCGCWTIMER |= (1 << 1);
+
+ while (!(SYSCTL->PRWTIMER & (1 << 1)))
+ ;
+
nvicEnableVector(TIVA_WGPT1A_NUMBER, TIVA_GPT_WGPT1A_IRQ_PRIORITY);
}
#endif
@@ -518,6 +550,10 @@ void gpt_lld_start(GPTDriver *gptp)
#if TIVA_GPT_USE_WGPT2
if (&GPTD9 == gptp) {
SYSCTL->RCGCWTIMER |= (1 << 2);
+
+ while (!(SYSCTL->PRWTIMER & (1 << 2)))
+ ;
+
nvicEnableVector(TIVA_WGPT2A_NUMBER, TIVA_GPT_WGPT2A_IRQ_PRIORITY);
}
#endif
@@ -525,6 +561,10 @@ void gpt_lld_start(GPTDriver *gptp)
#if TIVA_GPT_USE_WGPT3
if (&GPTD10 == gptp) {
SYSCTL->RCGCWTIMER |= (1 << 3);
+
+ while (!(SYSCTL->PRWTIMER & (1 << 3)))
+ ;
+
nvicEnableVector(TIVA_WGPT3A_NUMBER, TIVA_GPT_WGPT3A_IRQ_PRIORITY);
}
#endif
@@ -532,6 +572,10 @@ void gpt_lld_start(GPTDriver *gptp)
#if TIVA_GPT_USE_WGPT4
if (&GPTD11 == gptp) {
SYSCTL->RCGCWTIMER |= (1 << 4);
+
+ while (!(SYSCTL->PRWTIMER & (1 << 4)))
+ ;
+
nvicEnableVector(TIVA_WGPT4A_NUMBER, TIVA_GPT_WGPT4A_IRQ_PRIORITY);
}
#endif
@@ -539,6 +583,10 @@ void gpt_lld_start(GPTDriver *gptp)
#if TIVA_GPT_USE_WGPT5
if (&GPTD12 == gptp) {
SYSCTL->RCGCWTIMER |= (1 << 5);
+
+ while (!(SYSCTL->PRWTIMER & (1 << 5)))
+ ;
+
nvicEnableVector(TIVA_WGPT5A_NUMBER, TIVA_GPT_WGPT5A_IRQ_PRIORITY);
}
#endif
diff --git a/os/hal/ports/TIVA/LLD/hal_i2c_lld.c b/os/hal/ports/TIVA/LLD/hal_i2c_lld.c
index 5d80633..cb69861 100644
--- a/os/hal/ports/TIVA/LLD/hal_i2c_lld.c
+++ b/os/hal/ports/TIVA/LLD/hal_i2c_lld.c
@@ -504,6 +504,10 @@ void i2c_lld_start(I2CDriver *i2cp)
#if TIVA_I2C_USE_I2C0
if (&I2CD1 == i2cp) {
SYSCTL->RCGCI2C |= (1 << 0);
+
+ while (!(SYSCTL->PRI2C & (1 << 0)))
+ ;
+
nvicEnableVector(TIVA_I2C0_NUMBER, TIVA_I2C_I2C0_IRQ_PRIORITY);
}
#endif /* TIVA_I2C_USE_I2C0 */
@@ -511,6 +515,10 @@ void i2c_lld_start(I2CDriver *i2cp)
#if TIVA_I2C_USE_I2C1
if (&I2CD2 == i2cp) {
SYSCTL->RCGCI2C |= (1 << 1);
+
+ while (!(SYSCTL->PRI2C & (1 << 1)))
+ ;
+
nvicEnableVector(TIVA_I2C1_NUMBER, TIVA_I2C_I2C1_IRQ_PRIORITY);
}
#endif /* TIVA_I2C_USE_I2C1 */
@@ -518,6 +526,10 @@ void i2c_lld_start(I2CDriver *i2cp)
#if TIVA_I2C_USE_I2C2
if (&I2CD3 == i2cp) {
SYSCTL->RCGCI2C |= (1 << 2);
+
+ while (!(SYSCTL->PRI2C & (1 << 2)))
+ ;
+
nvicEnableVector(TIVA_I2C2_NUMBER, TIVA_I2C_I2C2_IRQ_PRIORITY);
}
#endif /* TIVA_I2C_USE_I2C2 */
@@ -525,6 +537,10 @@ void i2c_lld_start(I2CDriver *i2cp)
#if TIVA_I2C_USE_I2C3
if (&I2CD4 == i2cp) {
SYSCTL->RCGCI2C |= (1 << 3);
+
+ while (!(SYSCTL->PRI2C & (1 << 3)))
+ ;
+
nvicEnableVector(TIVA_I2C3_NUMBER, TIVA_I2C_I2C3_IRQ_PRIORITY);
}
#endif /* TIVA_I2C_USE_I2C3 */
@@ -532,6 +548,10 @@ void i2c_lld_start(I2CDriver *i2cp)
#if TIVA_I2C_USE_I2C4
if (&I2CD5 == i2cp) {
SYSCTL->RCGCI2C |= (1 << 4);
+
+ while (!(SYSCTL->PRI2C & (1 << 4)))
+ ;
+
nvicEnableVector(TIVA_I2C4_NUMBER, TIVA_I2C_I2C4_IRQ_PRIORITY);
}
#endif /* TIVA_I2C_USE_I2C4 */
@@ -539,6 +559,10 @@ void i2c_lld_start(I2CDriver *i2cp)
#if TIVA_I2C_USE_I2C5
if (&I2CD6 == i2cp) {
SYSCTL->RCGCI2C |= (1 << 5);
+
+ while (!(SYSCTL->PRI2C & (1 << 5)))
+ ;
+
nvicEnableVector(TIVA_I2C5_NUMBER, TIVA_I2C_I2C5_IRQ_PRIORITY);
}
#endif /* TIVA_I2C_USE_I2C5 */
@@ -546,6 +570,10 @@ void i2c_lld_start(I2CDriver *i2cp)
#if TIVA_I2C_USE_I2C6
if (&I2CD7 == i2cp) {
SYSCTL->RCGCI2C |= (1 << 6);
+
+ while (!(SYSCTL->PRI2C & (1 << 6)))
+ ;
+
nvicEnableVector(TIVA_I2C6_NUMBER, TIVA_I2C_I2C6_IRQ_PRIORITY);
}
#endif /* TIVA_I2C_USE_I2C6 */
@@ -553,6 +581,10 @@ void i2c_lld_start(I2CDriver *i2cp)
#if TIVA_I2C_USE_I2C7
if (&I2CD8 == i2cp) {
SYSCTL->RCGCI2C |= (1 << 7);
+
+ while (!(SYSCTL->PRI2C & (1 << 7)))
+ ;
+
nvicEnableVector(TIVA_I2C7_NUMBER, TIVA_I2C_I2C7_IRQ_PRIORITY);
}
#endif /* TIVA_I2C_USE_I2C7 */
@@ -560,6 +592,10 @@ void i2c_lld_start(I2CDriver *i2cp)
#if TIVA_I2C_USE_I2C8
if (&I2CD9 == i2cp) {
SYSCTL->RCGCI2C |= (1 << 8);
+
+ while (!(SYSCTL->PRI2C & (1 << 8)))
+ ;
+
nvicEnableVector(TIVA_I2C8_NUMBER, TIVA_I2C_I2C8_IRQ_PRIORITY);
}
#endif /* TIVA_I2C_USE_I2C7 */
@@ -567,6 +603,10 @@ void i2c_lld_start(I2CDriver *i2cp)
#if TIVA_I2C_USE_I2C9
if (&I2CD10 == i2cp) {
SYSCTL->RCGCI2C |= (1 << 9);
+
+ while (!(SYSCTL->PRI2C & (1 << 9)))
+ ;
+
nvicEnableVector(TIVA_I2C9_NUMBER, TIVA_I2C_I2C9_IRQ_PRIORITY);
}
#endif /* TIVA_I2C_USE_I2C7 */
diff --git a/os/hal/ports/TIVA/LLD/hal_pwm_lld.c b/os/hal/ports/TIVA/LLD/hal_pwm_lld.c
index b223a9c..ad7c587 100644
--- a/os/hal/ports/TIVA/LLD/hal_pwm_lld.c
+++ b/os/hal/ports/TIVA/LLD/hal_pwm_lld.c
@@ -341,6 +341,10 @@ void pwm_lld_start(PWMDriver *pwmp)
#if TIVA_PWM_USE_PWM0
if (&PWMD1 == pwmp) {
SYSCTL->RCGCPWM |= (1 << 0);
+
+ while (!(SYSCTL->PRPWM & (1 << 0)))
+ ;
+
nvicEnableVector(TIVA_PWM0FAULT_NUMBER,
TIVA_PWM_PWM0_FAULT_IRQ_PRIORITY);
nvicEnableVector(TIVA_PWM0GEN0_NUMBER, TIVA_PWM_PWM0_0_IRQ_PRIORITY);
@@ -353,6 +357,10 @@ void pwm_lld_start(PWMDriver *pwmp)
#if TIVA_PWM_USE_PWM1
if (&PWMD2 == pwmp) {
SYSCTL->RCGCPWM |= (1 << 1);
+
+ while (!(SYSCTL->PRPWM & (1 << 1)))
+ ;
+
nvicEnableVector(TIVA_PWM1FAULT_NUMBER,
TIVA_PWM_PWM1_FAULT_IRQ_PRIORITY);
nvicEnableVector(TIVA_PWM1GEN0_NUMBER, TIVA_PWM_PWM1_0_IRQ_PRIORITY);
diff --git a/os/hal/ports/TIVA/LLD/hal_serial_lld.c b/os/hal/ports/TIVA/LLD/hal_serial_lld.c
index bd1b81e..89d29da 100644
--- a/os/hal/ports/TIVA/LLD/hal_serial_lld.c
+++ b/os/hal/ports/TIVA/LLD/hal_serial_lld.c
@@ -508,48 +508,80 @@ void sd_lld_start(SerialDriver *sdp, const SerialConfig *config)
#if TIVA_SERIAL_USE_UART0
if (&SD1 == sdp) {
SYSCTL->RCGCUART |= (1 << 0);
+
+ while (!(SYSCTL->PRUART & (1 << 0)))
+ ;
+
nvicEnableVector(TIVA_UART0_NUMBER, TIVA_SERIAL_UART0_PRIORITY);
}
#endif
#if TIVA_SERIAL_USE_UART1
if (&SD2 == sdp) {
- SYSCTL->RCGC.UART |= (1 << 1);
+ SYSCTL->RCGCUART |= (1 << 1);
+
+ while (!(SYSCTL->PRUART & (1 << 1)))
+ ;
+
nvicEnableVector(TIVA_UART1_NUMBER, TIVA_SERIAL_UART1_PRIORITY);
}
#endif
#if TIVA_SERIAL_USE_UART2
if (&SD3 == sdp) {
- SYSCTL->RCGC.UART |= (1 << 2); /* enable UART2 module */
+ SYSCTL->RCGCUART |= (1 << 2);
+
+ while (!(SYSCTL->PRUART & (1 << 2)))
+ ;
+
nvicEnableVector(TIVA_UART2_NUMBER, TIVA_SERIAL_UART2_PRIORITY);
}
#endif
#if TIVA_SERIAL_USE_UART3
if (&SD4 == sdp) {
- SYSCTL->RCGC.UART |= (1 << 3); /* enable UART3 module */
+ SYSCTL->RCGCUART |= (1 << 3);
+
+ while (!(SYSCTL->PRUART & (1 << 3)))
+ ;
+
nvicEnableVector(TIVA_UART3_NUMBER, TIVA_SERIAL_UART3_PRIORITY);
}
#endif
#if TIVA_SERIAL_USE_UART4
if (&SD5 == sdp) {
- SYSCTL->RCGC.UART |= (1 << 4); /* enable UART4 module */
+ SYSCTL->RCGCUART |= (1 << 4);
+
+ while (!(SYSCTL->PRUART & (1 << 4)))
+ ;
+
nvicEnableVector(TIVA_UART4_NUMBER, TIVA_SERIAL_UART4_PRIORITY);
}
#endif
#if TIVA_SERIAL_USE_UART5
if (&SD6 == sdp) {
- SYSCTL->RCGC.UART |= (1 << 5); /* enable UART5 module */
+ SYSCTL->RCGCUART |= (1 << 5);
+
+ while (!(SYSCTL->PRUART & (1 << 5)))
+ ;
+
nvicEnableVector(TIVA_UART5_NUMBER, TIVA_SERIAL_UART5_PRIORITY);
}
#endif
#if TIVA_SERIAL_USE_UART6
if (&SD7 == sdp) {
- SYSCTL->RCGC.UART |= (1 << 6); /* enable UART6 module */
+ SYSCTL->RCGCUART |= (1 << 6);
+
+ while (!(SYSCTL->PRUART & (1 << 6)))
+ ;
+
nvicEnableVector(TIVA_UART6_NUMBER, TIVA_SERIAL_UART6_PRIORITY);
}
#endif
#if TIVA_SERIAL_USE_UART7
if (&SD8 == sdp) {
- SYSCTL->RCGC.UART |= (1 << 7); /* enable UART7 module */
+ SYSCTL->RCGCUART |= (1 << 7);
+
+ while (!(SYSCTL->PRUART & (1 << 7)))
+ ;
+
nvicEnableVector(TIVA_UART7_NUMBER, TIVA_SERIAL_UART7_PRIORITY);
}
#endif
@@ -577,49 +609,49 @@ void sd_lld_stop(SerialDriver *sdp)
#endif
#if TIVA_SERIAL_USE_UART1
if (&SD2 == sdp) {
- SYSCTL->RCGC.UART &= ~(1 << 1); /* disable UART1 module */
+ SYSCTL->RCGCUART &= ~(1 << 1); /* disable UART1 module */
nvicDisableVector(TIVA_UART1_NUMBER);
return;
}
#endif
#if TIVA_SERIAL_USE_UART2
if (&SD3 == sdp) {
- SYSCTL->RCGC.UART &= ~(1 << 2); /* disable UART2 module */
+ SYSCTL->RCGCUART &= ~(1 << 2); /* disable UART2 module */
nvicDisableVector(TIVA_UART2_NUMBER);
return;
}
#endif
#if TIVA_SERIAL_USE_UART3
if (&SD4 == sdp) {
- SYSCTL->RCGC.UART &= ~(1 << 3); /* disable UART3 module */
+ SYSCTL->RCGCUART &= ~(1 << 3); /* disable UART3 module */
nvicDisableVector(TIVA_UART3_NUMBER);
return;
}
#endif
#if TIVA_SERIAL_USE_UART4
if (&SD5 == sdp) {
- SYSCTL->RCGC.UART &= ~(1 << 4); /* disable UART4 module */
+ SYSCTL->RCGCUART &= ~(1 << 4); /* disable UART4 module */
nvicDisableVector(TIVA_UART4_NUMBER);
return;
}
#endif
#if TIVA_SERIAL_USE_UART5
if (&SD6 == sdp) {
- SYSCTL->RCGC.UART &= ~(1 << 5); /* disable UART5 module */
+ SYSCTL->RCGCUART &= ~(1 << 5); /* disable UART5 module */
nvicDisableVector(TIVA_UART5_NUMBER);
return;
}
#endif
#if TIVA_SERIAL_USE_UART6
if (&SD7 == sdp) {
- SYSCTL->RCGC.UART &= ~(1 << 6); /* disable UART6 module */
+ SYSCTL->RCGCUART &= ~(1 << 6); /* disable UART6 module */
nvicDisableVector(TIVA_UART6_NUMBER);
return;
}
#endif
#if TIVA_SERIAL_USE_UART7
if (&SD8 == sdp) {
- SYSCTL->RCGC.UART &= ~(1 << 7); /* disable UART7 module */
+ SYSCTL->RCGCUART &= ~(1 << 7); /* disable UART7 module */
nvicDisableVector(TIVA_UART7_NUMBER);
return;
}