gdb/features: remove rx.xml from XMLTOC list
[deliverable/binutils-gdb.git] / sim / bfin / dv-bfin_ppi.c
index fc72b947b398852982ce9881b79520669754f7c4..6043c0561ff26d446e6cfd13d9734bcf40509033 100644 (file)
@@ -1,7 +1,7 @@
 /* Blackfin Parallel Port Interface (PPI) model
    For "old style" PPIs on BF53x/etc... parts.
 
-   Copyright (C) 2010-2011 Free Software Foundation, Inc.
+   Copyright (C) 2010-2020 Free Software Foundation, Inc.
    Contributed by Analog Devices, Inc.
 
    This file is part of simulators.
@@ -53,7 +53,8 @@ struct bfin_ppi
 #define mmr_base()      offsetof(struct bfin_ppi, control)
 #define mmr_offset(mmr) (offsetof(struct bfin_ppi, mmr) - mmr_base())
 
-static const char * const mmr_names[] = {
+static const char * const mmr_names[] =
+{
   "PPI_CONTROL", "PPI_STATUS", "PPI_COUNT", "PPI_DELAY", "PPI_FRAME",
 };
 #define mmr_name(off) mmr_names[(off) / 4]
@@ -84,14 +85,16 @@ bfin_ppi_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 - ppi->base;
   valuep = (void *)((unsigned long)ppi + mmr_base() + mmr_off);
 
   HW_TRACE_WRITE ();
 
-  dv_bfin_mmr_require_16 (me, addr, nr_bytes, true);
-
   switch (mmr_off)
     {
     case mmr_offset(control):
@@ -104,11 +107,11 @@ bfin_ppi_io_write_buffer (struct hw *me, const void *source, int space,
       *valuep = value;
       break;
     case mmr_offset(status):
-      dv_w1c_2 (valuep, value, (1 << 10));
+      dv_w1c_2 (valuep, value, ~(1 << 10));
       break;
     default:
       dv_bfin_mmr_invalid (me, addr, nr_bytes, true);
-      break;
+      return 0;
     }
 
   return nr_bytes;
@@ -122,13 +125,15 @@ bfin_ppi_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 - ppi->base;
   valuep = (void *)((unsigned long)ppi + mmr_base() + mmr_off);
 
   HW_TRACE_READ ();
 
-  dv_bfin_mmr_require_16 (me, addr, nr_bytes, false);
-
   switch (mmr_off)
     {
     case mmr_offset(control):
@@ -140,7 +145,7 @@ bfin_ppi_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;
@@ -167,7 +172,8 @@ bfin_ppi_dma_write_buffer (struct hw *me, const void *source,
   return bfin_gui_update (ppi->gui_state, source, nr_bytes);
 }
 
-static const struct hw_port_descriptor bfin_ppi_ports[] = {
+static const struct hw_port_descriptor bfin_ppi_ports[] =
+{
   { "stat", 0, 0, output_port, },
   { NULL, 0, 0, 0, },
 };
@@ -225,7 +231,8 @@ bfin_ppi_finish (struct hw *me)
   ppi->color = bfin_gui_color (color);
 }
 
-const struct hw_descriptor dv_bfin_ppi_descriptor[] = {
+const struct hw_descriptor dv_bfin_ppi_descriptor[] =
+{
   {"bfin_ppi", bfin_ppi_finish,},
   {NULL, NULL},
 };
This page took 0.025859 seconds and 4 git commands to generate.