diff options
author | marcoveeneman <marco-veeneman@hotmail.com> | 2016-05-12 23:45:41 +0200 |
---|---|---|
committer | marcoveeneman <marco-veeneman@hotmail.com> | 2016-05-12 23:45:41 +0200 |
commit | 0e86736605157335b7df60d8629739451d478646 (patch) | |
tree | a2ccee5ba166099fab37b0afdf1e53af2b588530 /os/hal/ports/TIVA/LLD/hal_i2c_lld.c | |
parent | 32e712aae11da737c52f8739706db1f6fc48217b (diff) | |
download | ChibiOS-Contrib-0e86736605157335b7df60d8629739451d478646.tar.gz ChibiOS-Contrib-0e86736605157335b7df60d8629739451d478646.tar.bz2 ChibiOS-Contrib-0e86736605157335b7df60d8629739451d478646.zip |
Tiva. Wait for peripheral ready after enabling its clock.
This was already done for some peripherals, but not for GPT, I2C, PWM and UART.
Diffstat (limited to 'os/hal/ports/TIVA/LLD/hal_i2c_lld.c')
-rw-r--r-- | os/hal/ports/TIVA/LLD/hal_i2c_lld.c | 40 |
1 files changed, 40 insertions, 0 deletions
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 */ |