aboutsummaryrefslogtreecommitdiff
path: root/hw/tsc210x.c
diff options
context:
space:
mode:
authorPaul Brook <paul@codesourcery.com>2009-05-10 01:44:56 +0100
committerPaul Brook <paul@codesourcery.com>2009-05-10 01:44:56 +0100
commitbc24a225af2464dc30f88d6f930779cbf0e22b67 (patch)
tree6df682b479f89863159f836e1dc292623ab577e1 /hw/tsc210x.c
parentd4ec5228821b8bdd8019cb5dafa2ea3659ddb1f9 (diff)
Follow coding conventions
Remove explicit struct qualifiers and rename structure types. Signed-off-by: Paul Brook <paul@codesourcery.com>
Diffstat (limited to 'hw/tsc210x.c')
-rw-r--r--hw/tsc210x.c96
1 files changed, 48 insertions, 48 deletions
diff --git a/hw/tsc210x.c b/hw/tsc210x.c
index 55e1214128..76e36d61e9 100644
--- a/hw/tsc210x.c
+++ b/hw/tsc210x.c
@@ -24,7 +24,7 @@
#include "audio/audio.h"
#include "qemu-timer.h"
#include "console.h"
-#include "omap.h" /* For struct i2s_codec_s and struct uwire_slave_s */
+#include "omap.h" /* For I2SCodec and uWireSlave */
#include "devices.h"
#define TSC_DATA_REGISTERS_PAGE 0x0
@@ -35,14 +35,14 @@
#define TSC_CUT_RESOLUTION(value, p) ((value) >> (16 - resolution[p]))
-struct tsc210x_state_s {
+typedef struct {
qemu_irq pint;
qemu_irq kbint;
qemu_irq davint;
QEMUTimer *timer;
QEMUSoundCard card;
- struct uwire_slave_s chip;
- struct i2s_codec_s codec;
+ uWireSlave chip;
+ I2SCodec codec;
uint8_t in_fifo[16384];
uint8_t out_fifo[16384];
uint16_t model;
@@ -94,7 +94,7 @@ struct tsc210x_state_s {
int mode;
int intr;
} kb;
-};
+} TSC210xState;
static const int resolution[4] = { 12, 8, 10, 12 };
@@ -153,7 +153,7 @@ static const uint16_t mode_regs[16] = {
#define TSC_POWEROFF_DELAY 50
#define TSC_SOFTSTEP_DELAY 50
-static void tsc210x_reset(struct tsc210x_state_s *s)
+static void tsc210x_reset(TSC210xState *s)
{
s->state = 0;
s->pin_func = 2;
@@ -211,14 +211,14 @@ static void tsc210x_reset(struct tsc210x_state_s *s)
qemu_irq_raise(s->kbint);
}
-struct tsc210x_rate_info_s {
+typedef struct {
int rate;
int dsor;
int fsref;
-};
+} TSC210xRateInfo;
/* { rate, dsor, fsref } */
-static const struct tsc210x_rate_info_s tsc2101_rates[] = {
+static const TSC210xRateInfo tsc2101_rates[] = {
/* Fsref / 6.0 */
{ 7350, 7, 1 },
{ 8000, 7, 0 },
@@ -248,7 +248,7 @@ static const struct tsc210x_rate_info_s tsc2101_rates[] = {
};
/* { rate, dsor, fsref } */
-static const struct tsc210x_rate_info_s tsc2102_rates[] = {
+static const TSC210xRateInfo tsc2102_rates[] = {
/* Fsref / 6.0 */
{ 7350, 63, 1 },
{ 8000, 63, 0 },
@@ -277,7 +277,7 @@ static const struct tsc210x_rate_info_s tsc2102_rates[] = {
{ 0, 0, 0 },
};
-static inline void tsc210x_out_flush(struct tsc210x_state_s *s, int len)
+static inline void tsc210x_out_flush(TSC210xState *s, int len)
{
uint8_t *data = s->codec.out.fifo + s->codec.out.start;
uint8_t *end = data + len;
@@ -291,7 +291,7 @@ static inline void tsc210x_out_flush(struct tsc210x_state_s *s, int len)
s->codec.out.start = 0;
}
-static void tsc210x_audio_out_cb(struct tsc210x_state_s *s, int free_b)
+static void tsc210x_audio_out_cb(TSC210xState *s, int free_b)
{
if (s->codec.out.len >= free_b) {
tsc210x_out_flush(s, free_b);
@@ -302,9 +302,9 @@ static void tsc210x_audio_out_cb(struct tsc210x_state_s *s, int free_b)
qemu_irq_raise(s->codec.tx_start);
}
-static void tsc2102_audio_rate_update(struct tsc210x_state_s *s)
+static void tsc2102_audio_rate_update(TSC210xState *s)
{
- const struct tsc210x_rate_info_s *rate;
+ const TSC210xRateInfo *rate;
s->codec.tx_rate = 0;
s->codec.rx_rate = 0;
@@ -323,7 +323,7 @@ static void tsc2102_audio_rate_update(struct tsc210x_state_s *s)
s->codec.tx_rate = rate->rate;
}
-static void tsc2102_audio_output_update(struct tsc210x_state_s *s)
+static void tsc2102_audio_output_update(TSC210xState *s)
{
int enable;
struct audsettings fmt;
@@ -357,7 +357,7 @@ static void tsc2102_audio_output_update(struct tsc210x_state_s *s)
}
}
-static uint16_t tsc2102_data_register_read(struct tsc210x_state_s *s, int reg)
+static uint16_t tsc2102_data_register_read(TSC210xState *s, int reg)
{
switch (reg) {
case 0x00: /* X */
@@ -433,7 +433,7 @@ static uint16_t tsc2102_data_register_read(struct tsc210x_state_s *s, int reg)
}
static uint16_t tsc2102_control_register_read(
- struct tsc210x_state_s *s, int reg)
+ TSC210xState *s, int reg)
{
switch (reg) {
case 0x00: /* TSC ADC */
@@ -483,7 +483,7 @@ static uint16_t tsc2102_control_register_read(
}
}
-static uint16_t tsc2102_audio_register_read(struct tsc210x_state_s *s, int reg)
+static uint16_t tsc2102_audio_register_read(TSC210xState *s, int reg)
{
int l_ch, r_ch;
uint16_t val;
@@ -565,7 +565,7 @@ static uint16_t tsc2102_audio_register_read(struct tsc210x_state_s *s, int reg)
}
static void tsc2102_data_register_write(
- struct tsc210x_state_s *s, int reg, uint16_t value)
+ TSC210xState *s, int reg, uint16_t value)
{
switch (reg) {
case 0x00: /* X */
@@ -589,7 +589,7 @@ static void tsc2102_data_register_write(
}
static void tsc2102_control_register_write(
- struct tsc210x_state_s *s, int reg, uint16_t value)
+ TSC210xState *s, int reg, uint16_t value)
{
switch (reg) {
case 0x00: /* TSC ADC */
@@ -673,7 +673,7 @@ static void tsc2102_control_register_write(
}
static void tsc2102_audio_register_write(
- struct tsc210x_state_s *s, int reg, uint16_t value)
+ TSC210xState *s, int reg, uint16_t value)
{
switch (reg) {
case 0x00: /* Audio Control 1 */
@@ -804,7 +804,7 @@ static void tsc2102_audio_register_write(
}
/* This handles most of the chip logic. */
-static void tsc210x_pin_update(struct tsc210x_state_s *s)
+static void tsc210x_pin_update(TSC210xState *s)
{
int64_t expires;
int pin_state;
@@ -873,7 +873,7 @@ static void tsc210x_pin_update(struct tsc210x_state_s *s)
qemu_mod_timer(s->timer, expires);
}
-static uint16_t tsc210x_read(struct tsc210x_state_s *s)
+static uint16_t tsc210x_read(TSC210xState *s)
{
uint16_t ret = 0x0000;
@@ -904,7 +904,7 @@ static uint16_t tsc210x_read(struct tsc210x_state_s *s)
return ret;
}
-static void tsc210x_write(struct tsc210x_state_s *s, uint16_t value)
+static void tsc210x_write(TSC210xState *s, uint16_t value)
{
/*
* This is a two-state state machine for reading
@@ -940,7 +940,7 @@ static void tsc210x_write(struct tsc210x_state_s *s, uint16_t value)
uint32_t tsc210x_txrx(void *opaque, uint32_t value, int len)
{
- struct tsc210x_state_s *s = opaque;
+ TSC210xState *s = opaque;
uint32_t ret = 0;
if (len != 16)
@@ -959,7 +959,7 @@ uint32_t tsc210x_txrx(void *opaque, uint32_t value, int len)
static void tsc210x_timer_tick(void *opaque)
{
- struct tsc210x_state_s *s = opaque;
+ TSC210xState *s = opaque;
/* Timer ticked -- a set of conversions has been finished. */
@@ -975,7 +975,7 @@ static void tsc210x_timer_tick(void *opaque)
static void tsc210x_touchscreen_event(void *opaque,
int x, int y, int z, int buttons_state)
{
- struct tsc210x_state_s *s = opaque;
+ TSC210xState *s = opaque;
int p = s->pressure;
if (buttons_state) {
@@ -993,7 +993,7 @@ static void tsc210x_touchscreen_event(void *opaque,
tsc210x_pin_update(s);
}
-static void tsc210x_i2s_swallow(struct tsc210x_state_s *s)
+static void tsc210x_i2s_swallow(TSC210xState *s)
{
if (s->dac_voice[0])
tsc210x_out_flush(s, s->codec.out.len);
@@ -1001,7 +1001,7 @@ static void tsc210x_i2s_swallow(struct tsc210x_state_s *s)
s->codec.out.len = 0;
}
-static void tsc210x_i2s_set_rate(struct tsc210x_state_s *s, int in, int out)
+static void tsc210x_i2s_set_rate(TSC210xState *s, int in, int out)
{
s->i2s_tx_rate = out;
s->i2s_rx_rate = in;
@@ -1009,7 +1009,7 @@ static void tsc210x_i2s_set_rate(struct tsc210x_state_s *s, int in, int out)
static void tsc210x_save(QEMUFile *f, void *opaque)
{
- struct tsc210x_state_s *s = (struct tsc210x_state_s *) opaque;
+ TSC210xState *s = (TSC210xState *) opaque;
int64_t now = qemu_get_clock(vm_clock);
int i;
@@ -1055,7 +1055,7 @@ static void tsc210x_save(QEMUFile *f, void *opaque)
static int tsc210x_load(QEMUFile *f, void *opaque, int version_id)
{
- struct tsc210x_state_s *s = (struct tsc210x_state_s *) opaque;
+ TSC210xState *s = (TSC210xState *) opaque;
int64_t now = qemu_get_clock(vm_clock);
int i;
@@ -1105,13 +1105,13 @@ static int tsc210x_load(QEMUFile *f, void *opaque, int version_id)
return 0;
}
-struct uwire_slave_s *tsc2102_init(qemu_irq pint, AudioState *audio)
+uWireSlave *tsc2102_init(qemu_irq pint, AudioState *audio)
{
- struct tsc210x_state_s *s;
+ TSC210xState *s;
- s = (struct tsc210x_state_s *)
- qemu_mallocz(sizeof(struct tsc210x_state_s));
- memset(s, 0, sizeof(struct tsc210x_state_s));
+ s = (TSC210xState *)
+ qemu_mallocz(sizeof(TSC210xState));
+ memset(s, 0, sizeof(TSC210xState));
s->x = 160;
s->y = 160;
s->pressure = 0;
@@ -1156,14 +1156,14 @@ struct uwire_slave_s *tsc2102_init(qemu_irq pint, AudioState *audio)
return &s->chip;
}
-struct uwire_slave_s *tsc2301_init(qemu_irq penirq, qemu_irq kbirq,
+uWireSlave *tsc2301_init(qemu_irq penirq, qemu_irq kbirq,
qemu_irq dav, AudioState *audio)
{
- struct tsc210x_state_s *s;
+ TSC210xState *s;
- s = (struct tsc210x_state_s *)
- qemu_mallocz(sizeof(struct tsc210x_state_s));
- memset(s, 0, sizeof(struct tsc210x_state_s));
+ s = (TSC210xState *)
+ qemu_mallocz(sizeof(TSC210xState));
+ memset(s, 0, sizeof(TSC210xState));
s->x = 400;
s->y = 240;
s->pressure = 0;
@@ -1209,9 +1209,9 @@ struct uwire_slave_s *tsc2301_init(qemu_irq penirq, qemu_irq kbirq,
return &s->chip;
}
-struct i2s_codec_s *tsc210x_codec(struct uwire_slave_s *chip)
+I2SCodec *tsc210x_codec(uWireSlave *chip)
{
- struct tsc210x_state_s *s = (struct tsc210x_state_s *) chip->opaque;
+ TSC210xState *s = (TSC210xState *) chip->opaque;
return &s->codec;
}
@@ -1221,10 +1221,10 @@ struct i2s_codec_s *tsc210x_codec(struct uwire_slave_s *chip)
* from the touchscreen. Assuming 12-bit precision was used during
* tslib calibration.
*/
-void tsc210x_set_transform(struct uwire_slave_s *chip,
- struct mouse_transform_info_s *info)
+void tsc210x_set_transform(uWireSlave *chip,
+ MouseTransformInfo *info)
{
- struct tsc210x_state_s *s = (struct tsc210x_state_s *) chip->opaque;
+ TSC210xState *s = (TSC210xState *) chip->opaque;
#if 0
int64_t ltr[8];
@@ -1283,9 +1283,9 @@ void tsc210x_set_transform(struct uwire_slave_s *chip,
#endif
}
-void tsc210x_key_event(struct uwire_slave_s *chip, int key, int down)
+void tsc210x_key_event(uWireSlave *chip, int key, int down)
{
- struct tsc210x_state_s *s = (struct tsc210x_state_s *) chip->opaque;
+ TSC210xState *s = (TSC210xState *) chip->opaque;
if (down)
s->kb.down |= 1 << key;