Path: blob/master/drivers/media/dvb/dvb-usb/anysee.h
15111 views
/*1* DVB USB Linux driver for Anysee E30 DVB-C & DVB-T USB2.0 receiver2*3* Copyright (C) 2007 Antti Palosaari <[email protected]>4*5* This program is free software; you can redistribute it and/or modify6* it under the terms of the GNU General Public License as published by7* the Free Software Foundation; either version 2 of the License, or8* (at your option) any later version.9*10* This program is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13* GNU General Public License for more details.14*15* You should have received a copy of the GNU General Public License16* along with this program; if not, write to the Free Software17* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.18*19* TODO:20* - add smart card reader support for Conditional Access (CA)21*22* Card reader in Anysee is nothing more than ISO 7816 card reader.23* There is no hardware CAM in any Anysee device sold.24* In my understanding it should be implemented by making own module25* for ISO 7816 card reader, like dvb_ca_en50221 is implemented. This26* module registers serial interface that can be used to communicate27* with any ISO 7816 smart card.28*29* Any help according to implement serial smart card reader support30* is highly welcome!31*/3233#ifndef _DVB_USB_ANYSEE_H_34#define _DVB_USB_ANYSEE_H_3536#define DVB_USB_LOG_PREFIX "anysee"37#include "dvb-usb.h"3839#define deb_info(args...) dprintk(dvb_usb_anysee_debug, 0x01, args)40#define deb_xfer(args...) dprintk(dvb_usb_anysee_debug, 0x02, args)41#define deb_rc(args...) dprintk(dvb_usb_anysee_debug, 0x04, args)42#define deb_reg(args...) dprintk(dvb_usb_anysee_debug, 0x08, args)43#define deb_i2c(args...) dprintk(dvb_usb_anysee_debug, 0x10, args)44#define deb_fw(args...) dprintk(dvb_usb_anysee_debug, 0x20, args)4546enum cmd {47CMD_I2C_READ = 0x33,48CMD_I2C_WRITE = 0x31,49CMD_REG_READ = 0xb0,50CMD_REG_WRITE = 0xb1,51CMD_STREAMING_CTRL = 0x12,52CMD_LED_AND_IR_CTRL = 0x16,53CMD_GET_IR_CODE = 0x41,54CMD_GET_HW_INFO = 0x19,55CMD_SMARTCARD = 0x34,56};5758struct anysee_state {59u8 hw; /* PCB ID */60u8 seq;61};6263#define ANYSEE_HW_02 2 /* E30 */64#define ANYSEE_HW_507CD 6 /* E30 Plus */65#define ANYSEE_HW_507DC 10 /* E30 C Plus */66#define ANYSEE_HW_507SI 11 /* E30 S2 Plus */67#define ANYSEE_HW_507FA 15 /* E30 Combo Plus / E30 C Plus */68#define ANYSEE_HW_508TC 18 /* E7 TC */69#define ANYSEE_HW_508S2 19 /* E7 S2 */7071#define REG_IOA 0x80 /* Port A (bit addressable) */72#define REG_IOB 0x90 /* Port B (bit addressable) */73#define REG_IOC 0xa0 /* Port C (bit addressable) */74#define REG_IOD 0xb0 /* Port D (bit addressable) */75#define REG_IOE 0xb1 /* Port E (NOT bit addressable) */76#define REG_OEA 0xb2 /* Port A Output Enable */77#define REG_OEB 0xb3 /* Port B Output Enable */78#define REG_OEC 0xb4 /* Port C Output Enable */79#define REG_OED 0xb5 /* Port D Output Enable */80#define REG_OEE 0xb6 /* Port E Output Enable */8182#endif8384/***************************************************************************85* USB API description (reverse engineered)86***************************************************************************8788Transaction flow:89=================90BULK[00001] >>> REQUEST PACKET 64 bytes91BULK[00081] <<< REPLY PACKET #1 64 bytes (PREVIOUS TRANSACTION REPLY)92BULK[00081] <<< REPLY PACKET #2 64 bytes (CURRENT TRANSACTION REPLY)9394General reply packet(s) are always used if not own reply defined.9596============================================================================97| 00-63 | GENERAL REPLY PACKET #1 (PREVIOUS REPLY)98============================================================================99| 00 | reply data (if any) from previous transaction100| | Just same reply packet as returned during previous transaction.101| | Needed only if reply is missed in previous transaction.102| | Just skip normally.103----------------------------------------------------------------------------104| 01-59 | don't care105----------------------------------------------------------------------------106| 60 | packet sequence number107----------------------------------------------------------------------------108| 61-63 | don't care109----------------------------------------------------------------------------110111============================================================================112| 00-63 | GENERAL REPLY PACKET #2 (CURRENT REPLY)113============================================================================114| 00 | reply data (if any)115----------------------------------------------------------------------------116| 01-59 | don't care117----------------------------------------------------------------------------118| 60 | packet sequence number119----------------------------------------------------------------------------120| 61-63 | don't care121----------------------------------------------------------------------------122123============================================================================124| 00-63 | I2C WRITE REQUEST PACKET125============================================================================126| 00 | 0x31 I2C write command127----------------------------------------------------------------------------128| 01 | i2c address129----------------------------------------------------------------------------130| 02 | data length131| | 0x02 (for typical I2C reg / val pair)132----------------------------------------------------------------------------133| 03 | 0x01134----------------------------------------------------------------------------135| 04- | data136----------------------------------------------------------------------------137| -59 | don't care138----------------------------------------------------------------------------139| 60 | packet sequence number140----------------------------------------------------------------------------141| 61-63 | don't care142----------------------------------------------------------------------------143144============================================================================145| 00-63 | I2C READ REQUEST PACKET146============================================================================147| 00 | 0x33 I2C read command148----------------------------------------------------------------------------149| 01 | i2c address + 1150----------------------------------------------------------------------------151| 02 | register152----------------------------------------------------------------------------153| 03 | 0x00154----------------------------------------------------------------------------155| 04 | 0x00156----------------------------------------------------------------------------157| 05 | data length158----------------------------------------------------------------------------159| 06-59 | don't care160----------------------------------------------------------------------------161| 60 | packet sequence number162----------------------------------------------------------------------------163| 61-63 | don't care164----------------------------------------------------------------------------165166============================================================================167| 00-63 | USB CONTROLLER REGISTER WRITE REQUEST PACKET168============================================================================169| 00 | 0xb1 register write command170----------------------------------------------------------------------------171| 01-02 | register172----------------------------------------------------------------------------173| 03 | 0x01174----------------------------------------------------------------------------175| 04 | value176----------------------------------------------------------------------------177| 05-59 | don't care178----------------------------------------------------------------------------179| 60 | packet sequence number180----------------------------------------------------------------------------181| 61-63 | don't care182----------------------------------------------------------------------------183184============================================================================185| 00-63 | USB CONTROLLER REGISTER READ REQUEST PACKET186============================================================================187| 00 | 0xb0 register read command188----------------------------------------------------------------------------189| 01-02 | register190----------------------------------------------------------------------------191| 03 | 0x01192----------------------------------------------------------------------------193| 04-59 | don't care194----------------------------------------------------------------------------195| 60 | packet sequence number196----------------------------------------------------------------------------197| 61-63 | don't care198----------------------------------------------------------------------------199200============================================================================201| 00-63 | LED CONTROL REQUEST PACKET202============================================================================203| 00 | 0x16 LED and IR control command204----------------------------------------------------------------------------205| 01 | 0x01 (LED)206----------------------------------------------------------------------------207| 03 | 0x00 blink208| | 0x01 lights continuously209----------------------------------------------------------------------------210| 04 | blink interval211| | 0x00 fastest (looks like LED lights continuously)212| | 0xff slowest213----------------------------------------------------------------------------214| 05-59 | don't care215----------------------------------------------------------------------------216| 60 | packet sequence number217----------------------------------------------------------------------------218| 61-63 | don't care219----------------------------------------------------------------------------220221============================================================================222| 00-63 | IR CONTROL REQUEST PACKET223============================================================================224| 00 | 0x16 LED and IR control command225----------------------------------------------------------------------------226| 01 | 0x02 (IR)227----------------------------------------------------------------------------228| 03 | 0x00 IR disabled229| | 0x01 IR enabled230----------------------------------------------------------------------------231| 04-59 | don't care232----------------------------------------------------------------------------233| 60 | packet sequence number234----------------------------------------------------------------------------235| 61-63 | don't care236----------------------------------------------------------------------------237238============================================================================239| 00-63 | STREAMING CONTROL REQUEST PACKET240============================================================================241| 00 | 0x12 streaming control command242----------------------------------------------------------------------------243| 01 | 0x00 streaming disabled244| | 0x01 streaming enabled245----------------------------------------------------------------------------246| 02 | 0x00247----------------------------------------------------------------------------248| 03-59 | don't care249----------------------------------------------------------------------------250| 60 | packet sequence number251----------------------------------------------------------------------------252| 61-63 | don't care253----------------------------------------------------------------------------254255============================================================================256| 00-63 | REMOTE CONTROL REQUEST PACKET257============================================================================258| 00 | 0x41 remote control command259----------------------------------------------------------------------------260| 01-59 | don't care261----------------------------------------------------------------------------262| 60 | packet sequence number263----------------------------------------------------------------------------264| 61-63 | don't care265----------------------------------------------------------------------------266267============================================================================268| 00-63 | REMOTE CONTROL REPLY PACKET269============================================================================270| 00 | 0x00 code not received271| | 0x01 code received272----------------------------------------------------------------------------273| 01 | remote control code274----------------------------------------------------------------------------275| 02-59 | don't care276----------------------------------------------------------------------------277| 60 | packet sequence number278----------------------------------------------------------------------------279| 61-63 | don't care280----------------------------------------------------------------------------281282============================================================================283| 00-63 | GET HARDWARE INFO REQUEST PACKET284============================================================================285| 00 | 0x19 get hardware info command286----------------------------------------------------------------------------287| 01-59 | don't care288----------------------------------------------------------------------------289| 60 | packet sequence number290----------------------------------------------------------------------------291| 61-63 | don't care292----------------------------------------------------------------------------293294============================================================================295| 00-63 | GET HARDWARE INFO REPLY PACKET296============================================================================297| 00 | hardware id298----------------------------------------------------------------------------299| 01-02 | firmware version300----------------------------------------------------------------------------301| 03-59 | don't care302----------------------------------------------------------------------------303| 60 | packet sequence number304----------------------------------------------------------------------------305| 61-63 | don't care306----------------------------------------------------------------------------307308============================================================================309| 00-63 | SMART CARD READER PACKET310============================================================================311| 00 | 0x34 smart card reader command312----------------------------------------------------------------------------313| xx |314----------------------------------------------------------------------------315| xx-59 | don't care316----------------------------------------------------------------------------317| 60 | packet sequence number318----------------------------------------------------------------------------319| 61-63 | don't care320----------------------------------------------------------------------------321322*/323324325