diff options
Diffstat (limited to 'sim/bfin/dv-bfin_twi.c')
-rw-r--r-- | sim/bfin/dv-bfin_twi.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/sim/bfin/dv-bfin_twi.c b/sim/bfin/dv-bfin_twi.c index e1b4cde..6ceb7f9 100644 --- a/sim/bfin/dv-bfin_twi.c +++ b/sim/bfin/dv-bfin_twi.c @@ -81,14 +81,16 @@ bfin_twi_io_write_buffer (struct hw *me, const void *source, int space, bu32 value; bu16 *valuep; + /* Invalid access mode is higher priority than missing register. */ + if (!dv_bfin_mmr_require_16 (me, addr, nr_bytes, true)) + return 0; + value = dv_load_2 (source); mmr_off = addr - twi->base; valuep = (void *)((unsigned long)twi + mmr_base() + mmr_off); HW_TRACE_WRITE (); - dv_bfin_mmr_require_16 (me, addr, nr_bytes, true); - switch (mmr_off) { case mmr_offset(clkdiv): @@ -120,7 +122,7 @@ bfin_twi_io_write_buffer (struct hw *me, const void *source, int space, break; default: dv_bfin_mmr_invalid (me, addr, nr_bytes, true); - break; + return 0; } return nr_bytes; @@ -134,13 +136,15 @@ bfin_twi_io_read_buffer (struct hw *me, void *dest, int space, bu32 mmr_off; bu16 *valuep; + /* Invalid access mode is higher priority than missing register. */ + if (!dv_bfin_mmr_require_16 (me, addr, nr_bytes, false)) + return 0; + mmr_off = addr - twi->base; valuep = (void *)((unsigned long)twi + mmr_base() + mmr_off); HW_TRACE_READ (); - dv_bfin_mmr_require_16 (me, addr, nr_bytes, false); - switch (mmr_off) { case mmr_offset(clkdiv): @@ -168,7 +172,7 @@ bfin_twi_io_read_buffer (struct hw *me, void *dest, int space, break; default: dv_bfin_mmr_invalid (me, addr, nr_bytes, false); - break; + return 0; } return nr_bytes; |