diff options
author | Alex Woods <devnull@localhost> | 2003-04-27 12:24:20 +0000 |
---|---|---|
committer | Alex Woods <devnull@localhost> | 2003-04-27 12:24:20 +0000 |
commit | 2b786696ca564f399ff5cfb34cec69f451460d8f (patch) | |
tree | f6e15c8184143a3c03ed8bad1304aefdfd8395e5 /linux | |
parent | 10685632c1050d6702da1e4d1e0690ec906eeda3 (diff) | |
download | mediapointer-dvb-s2-2b786696ca564f399ff5cfb34cec69f451460d8f.tar.gz mediapointer-dvb-s2-2b786696ca564f399ff5cfb34cec69f451460d8f.tar.bz2 |
Clean up ttusb_dec_send_command:
- any non-zero result is now an error
- result length returned via parameter
Additional check for firmware 1.05 to send bootcode
Diffstat (limited to 'linux')
-rw-r--r-- | linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c b/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c index d1f8b0b99..1a2ae9999 100644 --- a/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c +++ b/linux/drivers/media/dvb/ttusb-dec/ttusb_dec.c @@ -32,8 +32,8 @@ static int debug = 0; #define dprintk if (debug) printk static int -ttusb_dec_send_command(ttusb_dec_t * dec, const u8 command, const u8 params[], - int param_length, u8 cmd_result[]) +ttusb_dec_send_command(ttusb_dec_t * dec, const u8 command, int param_length, + const u8 params[], int *result_length, u8 cmd_result[]) { int result, actual_len, i; @@ -70,7 +70,7 @@ ttusb_dec_send_command(ttusb_dec_t * dec, const u8 command, const u8 params[], usb_bulk_msg(dec->udev, dec->command_pipe, b, sizeof (b), &actual_len, HZ); - if (result < 0) { + if (result) { printk("%s: command bulk message failed: error %d\n", __FUNCTION__, result); @@ -83,7 +83,7 @@ ttusb_dec_send_command(ttusb_dec_t * dec, const u8 command, const u8 params[], usb_bulk_msg(dec->udev, dec->result_pipe, c, sizeof (c), &actual_len, HZ); - if (result < 0) { + if (result) { printk("%s: result bulk message failed: error %d\n", __FUNCTION__, result); @@ -101,11 +101,13 @@ ttusb_dec_send_command(ttusb_dec_t * dec, const u8 command, const u8 params[], } + if (result_length) + *result_length = c[3]; if (cmd_result && c[3] > 0) memcpy(cmd_result, &c[4], c[3]); up(&dec->usb_sem); - return c[3]; + return 0; } @@ -141,7 +143,7 @@ ttusb_dec_set_pids(ttusb_dec_t * dec) memcpy(&b[2], &audio, 2); memcpy(&b[4], &video, 2); - ttusb_dec_send_command(dec, 0x50, b, sizeof (b), NULL); + ttusb_dec_send_command(dec, 0x50, sizeof (b), b, NULL, NULL); if (!down_interruptible(&dec->pes2ts_sem)) { @@ -168,8 +170,8 @@ ttusb_dec_i2c_master_xfer(struct dvb_i2c_bus *i2c, const struct i2c_msg msgs[], for (i = 0; i < num; i++) if ((result = ttusb_dec_send_command(i2c->data, msgs[i].addr, - msgs[i].buf, msgs[i].len, - NULL)) < 0) + msgs[i].len, msgs[i].buf, + NULL, NULL))) return result; return 0; @@ -520,7 +522,7 @@ ttusb_dec_stop_iso_xfer(ttusb_dec_t * dec) for (i = 0; i < ISO_BUF_COUNT; i++) usb_unlink_urb(dec->iso_urb[i]); - ttusb_dec_send_command(dec, 0x81, b0, sizeof (b0), NULL); + ttusb_dec_send_command(dec, 0x81, sizeof (b0), b0, NULL, NULL); } @@ -543,7 +545,7 @@ ttusb_dec_start_iso_xfer(ttusb_dec_t *dec) u8 b0[] = { 0x05 }; - ttusb_dec_send_command(dec, 0x80, b0, sizeof (b0), NULL); + ttusb_dec_send_command(dec, 0x80, sizeof (b0), b0, NULL, NULL); ttusb_dec_setup_urbs(dec); @@ -798,16 +800,15 @@ ttusb_dec_boot_dsp(ttusb_dec_t * dec) { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x59, 0x61, 0x00 }; u8 b1[] = { 0x61 }; u8 b[ARM_PACKET_SIZE]; - u8 c[COMMAND_PACKET_SIZE]; u32 dsp_length = htonl(sizeof (dsp_dec2000)); dprintk("%s\n", __FUNCTION__); memcpy(b0, &dsp_length, 4); - result = ttusb_dec_send_command(dec, 0x41, b0, sizeof (b0), c); + result = ttusb_dec_send_command(dec, 0x41, sizeof (b0), b0, NULL, NULL); - if (result < 0) + if (result) return result; trans_count = 0; @@ -845,9 +846,9 @@ ttusb_dec_boot_dsp(ttusb_dec_t * dec) } - result = ttusb_dec_send_command(dec, 0x43, b1, sizeof (b1), c); + result = ttusb_dec_send_command(dec, 0x43, sizeof (b1), b1, NULL, NULL); - return 0; + return result; } @@ -856,14 +857,17 @@ ttusb_dec_init_stb(ttusb_dec_t * dec) { u8 c[COMMAND_PACKET_SIZE]; + int c_length; int result; dprintk("%s\n", __FUNCTION__); - result = ttusb_dec_send_command(dec, 0x08, NULL, 0, c); + result = ttusb_dec_send_command(dec, 0x08, 0, NULL, &c_length, c); - if (result == 0x10) - ttusb_dec_boot_dsp(dec); + if (!result) + if (c_length == 0x10 || /* f/w v0.78 */ + (c_length == 0x0c && c[9] != 0x42)) /* f/w v1.05 */ + ttusb_dec_boot_dsp(dec); } |