]> Git Repo - qemu.git/blobdiff - hw/input/tsc210x.c
Merge remote-tracking branch 'remotes/thibault/tags/samuel-thibault' into staging
[qemu.git] / hw / input / tsc210x.c
index aa5b6886ea2a76ee17a768c2afa213ab9edc96ce..93ca374fcd14fbc41c6d38c645bc761c3b4a06fd 100644 (file)
@@ -19,6 +19,7 @@
  * with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "audio/audio.h"
 #include "qemu/timer.h"
@@ -215,36 +216,6 @@ typedef struct {
     int fsref;
 } TSC210xRateInfo;
 
-/*  { rate,  dsor,  fsref } */
-static const TSC210xRateInfo tsc2101_rates[] = {
-    /* Fsref / 6.0 */
-    { 7350,    7,      1 },
-    { 8000,    7,      0 },
-    /* Fsref / 5.5 */
-    { 8018,    6,      1 },
-    { 8727,    6,      0 },
-    /* Fsref / 5.0 */
-    { 8820,    5,      1 },
-    { 9600,    5,      0 },
-    /* Fsref / 4.0 */
-    { 11025,   4,      1 },
-    { 12000,   4,      0 },
-    /* Fsref / 3.0 */
-    { 14700,   3,      1 },
-    { 16000,   3,      0 },
-    /* Fsref / 2.0 */
-    { 22050,   2,      1 },
-    { 24000,   2,      0 },
-    /* Fsref / 1.5 */
-    { 29400,   1,      1 },
-    { 32000,   1,      0 },
-    /* Fsref */
-    { 44100,   0,      1 },
-    { 48000,   0,      0 },
-
-    { 0,       0,      0 },
-};
-
 /*  { rate,   dsor, fsref }    */
 static const TSC210xRateInfo tsc2102_rates[] = {
     /* Fsref / 6.0 */
@@ -864,7 +835,8 @@ static void tsc210x_pin_update(TSC210xState *s)
     s->busy = 1;
     s->precision = s->nextprecision;
     s->function = s->nextfunction;
-    expires = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + (get_ticks_per_sec() >> 10);
+    expires = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
+        (NANOSECONDS_PER_SECOND >> 10);
     timer_mod(s->timer, expires);
 }
 
@@ -1116,9 +1088,7 @@ uWireSlave *tsc2102_init(qemu_irq pint)
 {
     TSC210xState *s;
 
-    s = (TSC210xState *)
-            g_malloc0(sizeof(TSC210xState));
-    memset(s, 0, sizeof(TSC210xState));
+    s = g_new0(TSC210xState, 1);
     s->x = 160;
     s->y = 160;
     s->pressure = 0;
@@ -1165,9 +1135,7 @@ uWireSlave *tsc2301_init(qemu_irq penirq, qemu_irq kbirq, qemu_irq dav)
 {
     TSC210xState *s;
 
-    s = (TSC210xState *)
-            g_malloc0(sizeof(TSC210xState));
-    memset(s, 0, sizeof(TSC210xState));
+    s = g_new0(TSC210xState, 1);
     s->x = 400;
     s->y = 240;
     s->pressure = 0;
This page took 0.024731 seconds and 4 git commands to generate.