File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -501,15 +501,23 @@ func (i2c *I2C) Reply(buf []byte) error {
501
501
}
502
502
503
503
for txPtr < len (buf ) {
504
- if stat & rp . I2C0_IC_INTR_MASK_M_TX_EMPTY != 0 {
505
- i2c .Bus .IC_DATA_CMD . Set (uint32 (buf [txPtr ]))
504
+ if i2c . Bus . GetIC_RAW_INTR_STAT_TX_EMPTY () != 0 {
505
+ i2c .Bus .SetIC_DATA_CMD_DAT (uint32 (buf [txPtr ]))
506
506
txPtr ++
507
+ // The DW_apb_i2c flushes/resets/empties the
508
+ // TX_FIFO and RX_FIFO whenever there is a transmit abort
509
+ // caused by any of the events tracked by the
510
+ // IC_TX_ABRT_SOURCE register.
511
+ // In other words, it's safe to block until TX FIFO is
512
+ // EMPTY--it will empty from being transmitted or on error.
513
+ for i2c .Bus .GetIC_RAW_INTR_STAT_TX_EMPTY () == 0 {
514
+ }
507
515
}
508
516
509
517
// This Tx abort is a normal case - we're sending more
510
518
// data than controller wants to receive
511
- if stat & rp . I2C0_IC_INTR_MASK_M_TX_ABRT != 0 {
512
- i2c .Bus .IC_CLR_TX_ABRT . Get ()
519
+ if i2c . Bus . GetIC_RAW_INTR_STAT_TX_ABRT () != 0 {
520
+ i2c .Bus .GetIC_CLR_TX_ABRT_CLR_TX_ABRT ()
513
521
return nil
514
522
}
515
523
You can’t perform that action at this time.
0 commit comments