summaryrefslogtreecommitdiff
path: root/firmware/target/arm/as3525/ascodec-as3525.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/as3525/ascodec-as3525.c')
-rw-r--r--firmware/target/arm/as3525/ascodec-as3525.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/firmware/target/arm/as3525/ascodec-as3525.c b/firmware/target/arm/as3525/ascodec-as3525.c
index a8ad9706f8..14c3ee7a36 100644
--- a/firmware/target/arm/as3525/ascodec-as3525.c
+++ b/firmware/target/arm/as3525/ascodec-as3525.c
@@ -675,3 +675,18 @@ void ascodec_init(void)
675 IFRTC_IRQ_RTC | IRQ_ADC); 675 IFRTC_IRQ_RTC | IRQ_ADC);
676#endif 676#endif
677} 677}
678
679void ams_i2c_get_debug_cpsr(unsigned int *i2c_cpsr)
680{
681 int oldlevel = disable_interrupt_save(IRQ_FIQ_STATUS);
682 /* must be on to read regs */
683 bool i2c_enabled = bitset32(&CGU_PERI, CGU_I2C_AUDIO_MASTER_CLOCK_ENABLE) &
684 CGU_I2C_AUDIO_MASTER_CLOCK_ENABLE;
685
686 *i2c_cpsr = (I2C2_CPSR1<<8 | I2C2_CPSR0);
687
688 if (!i2c_enabled) /* put it back how we found it */
689 bitclr32(&CGU_PERI, CGU_I2C_AUDIO_MASTER_CLOCK_ENABLE);
690
691 restore_irq(oldlevel);
692}