]> Git Repo - qemu.git/blobdiff - hw/tsc210x.c
remove bdrv_aio_read/bdrv_aio_write (Christoph Hellwig)
[qemu.git] / hw / tsc210x.c
index da2efeda89cba2408074b56507045200ea329bcc..41d374fff221d507796598e806cccf9e1b069c16 100644 (file)
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include "hw.h"
 #include "audio/audio.h"
 #include "qemu-timer.h"
 #include "console.h"
-#include "omap.h"
+#include "omap.h"      /* For struct i2s_codec_s and struct uwire_slave_s */
+#include "devices.h"
 
 #define TSC_DATA_REGISTERS_PAGE                0x0
 #define TSC_CONTROL_REGISTERS_PAGE     0x1
@@ -326,7 +326,7 @@ static void tsc2102_audio_rate_update(struct tsc210x_state_s *s)
 static void tsc2102_audio_output_update(struct tsc210x_state_s *s)
 {
     int enable;
-    audsettings_t fmt;
+    struct audsettings fmt;
 
     if (s->dac_voice[0]) {
         tsc210x_out_flush(s, s->codec.out.len);
@@ -939,11 +939,15 @@ static void tsc210x_write(struct tsc210x_state_s *s, uint16_t value)
     }
 }
 
-uint32_t tsc210x_txrx(void *opaque, uint32_t value)
+uint32_t tsc210x_txrx(void *opaque, uint32_t value, int len)
 {
     struct tsc210x_state_s *s = opaque;
     uint32_t ret = 0;
 
+    if (len != 16)
+        cpu_abort(cpu_single_env, "%s: FIXME: bad SPI word width %i\n",
+                        __FUNCTION__, len);
+
     /* TODO: sequential reads etc - how do we make sure the host doesn't
      * unintentionally read out a conversion result from a register while
      * transmitting the command word of the next command?  */
@@ -1042,8 +1046,8 @@ static void tsc210x_save(QEMUFile *f, void *opaque)
     qemu_put_be16s(f, &s->pll[0]);
     qemu_put_be16s(f, &s->pll[1]);
     qemu_put_be16s(f, &s->volume);
-    qemu_put_be64(f, (uint64_t) (s->volume_change - now));
-    qemu_put_be64(f, (uint64_t) (s->powerdown - now));
+    qemu_put_sbe64(f, (s->volume_change - now));
+    qemu_put_sbe64(f, (s->powerdown - now));
     qemu_put_byte(f, s->softstep);
     qemu_put_be16s(f, &s->dac_power);
 
@@ -1088,8 +1092,8 @@ static int tsc210x_load(QEMUFile *f, void *opaque, int version_id)
     qemu_get_be16s(f, &s->pll[0]);
     qemu_get_be16s(f, &s->pll[1]);
     qemu_get_be16s(f, &s->volume);
-    s->volume_change = (int64_t) qemu_get_be64(f) + now;
-    s->powerdown = (int64_t) qemu_get_be64(f) + now;
+    s->volume_change = qemu_get_sbe64(f) + now;
+    s->powerdown = qemu_get_sbe64(f) + now;
     s->softstep = qemu_get_byte(f);
     qemu_get_be16s(f, &s->dac_power);
 
@@ -1103,8 +1107,6 @@ static int tsc210x_load(QEMUFile *f, void *opaque, int version_id)
     return 0;
 }
 
-static int tsc2102_iid = 0;
-
 struct uwire_slave_s *tsc2102_init(qemu_irq pint, AudioState *audio)
 {
     struct tsc210x_state_s *s;
@@ -1124,12 +1126,12 @@ struct uwire_slave_s *tsc2102_init(qemu_irq pint, AudioState *audio)
 
     s->tr[0] = 0;
     s->tr[1] = 1;
-    s->tr[2] = 0;
-    s->tr[3] = 1;
+    s->tr[2] = 1;
+    s->tr[3] = 0;
     s->tr[4] = 1;
     s->tr[5] = 0;
-    s->tr[6] = 0;
-    s->tr[7] = 1;
+    s->tr[6] = 1;
+    s->tr[7] = 0;
 
     s->chip.opaque = s;
     s->chip.send = (void *) tsc210x_write;
@@ -1150,7 +1152,7 @@ struct uwire_slave_s *tsc2102_init(qemu_irq pint, AudioState *audio)
         AUD_register_card(s->audio, s->name, &s->card);
 
     qemu_register_reset((void *) tsc210x_reset, s);
-    register_savevm(s->name, tsc2102_iid ++, 0,
+    register_savevm(s->name, -1, 0,
                     tsc210x_save, tsc210x_load, s);
 
     return &s->chip;
@@ -1178,12 +1180,12 @@ struct uwire_slave_s *tsc2301_init(qemu_irq penirq, qemu_irq kbirq,
 
     s->tr[0] = 0;
     s->tr[1] = 1;
-    s->tr[2] = 0;
-    s->tr[3] = 1;
+    s->tr[2] = 1;
+    s->tr[3] = 0;
     s->tr[4] = 1;
     s->tr[5] = 0;
-    s->tr[6] = 0;
-    s->tr[7] = 1;
+    s->tr[6] = 1;
+    s->tr[7] = 0;
 
     s->chip.opaque = s;
     s->chip.send = (void *) tsc210x_write;
@@ -1204,8 +1206,7 @@ struct uwire_slave_s *tsc2301_init(qemu_irq penirq, qemu_irq kbirq,
         AUD_register_card(s->audio, s->name, &s->card);
 
     qemu_register_reset((void *) tsc210x_reset, s);
-    register_savevm(s->name, tsc2102_iid ++, 0,
-                    tsc210x_save, tsc210x_load, s);
+    register_savevm(s->name, -1, 0, tsc210x_save, tsc210x_load, s);
 
     return &s->chip;
 }
This page took 0.028178 seconds and 4 git commands to generate.