diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-06-24 08:32:26 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-06-24 08:32:26 -0300 |
commit | 04e2c76f8d845ee90c1e85ee6a170618b22ff933 (patch) | |
tree | dc39e43391782e48e9cc697ccf040cd7e9574509 /v4l_experimental/firesat/avc_api.c | |
parent | de2d21cb87c4d4e3124c02d856e632f355f1a002 (diff) | |
download | mediapointer-dvb-s2-04e2c76f8d845ee90c1e85ee6a170618b22ff933.tar.gz mediapointer-dvb-s2-04e2c76f8d845ee90c1e85ee6a170618b22ff933.tar.bz2 |
Whitespace cleanups
From: Mauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'v4l_experimental/firesat/avc_api.c')
-rw-r--r-- | v4l_experimental/firesat/avc_api.c | 182 |
1 files changed, 91 insertions, 91 deletions
diff --git a/v4l_experimental/firesat/avc_api.c b/v4l_experimental/firesat/avc_api.c index bff42413c..eb597eaa4 100644 --- a/v4l_experimental/firesat/avc_api.c +++ b/v4l_experimental/firesat/avc_api.c @@ -11,7 +11,7 @@ #include <ieee1394_transactions.h> #include <nodemgr.h> -#include <asm/byteorder.h> +#include <asm/byteorder.h> #include <linux/delay.h> #include "firesat.h" #include "avc_api.h" @@ -47,51 +47,51 @@ static int avc_down_timeout(atomic_t *done, int timeout) } static int __AVCWrite(struct firesat *firesat, const AVCCmdFrm *CmdFrm, AVCRspFrm *RspFrm) { - struct hpsb_packet *packet; + struct hpsb_packet *packet; struct node_entry *ne; - + ne = firesat->nodeentry; if(!ne) { printk("%s: lost node!\n",__FUNCTION__); return -EIO; } - + /* need all input data */ if(!firesat || !ne || !CmdFrm) return -EINVAL; - + // printk(KERN_INFO "AVCWrite command %x\n",CmdFrm->opcode); - + // for(k=0;k<CmdFrm->length;k++) // printk(KERN_INFO "CmdFrm[%d] = %08x\n", k, ((quadlet_t*)CmdFrm)[k]); - + packet=hpsb_make_writepacket(ne->host, ne->nodeid, COMMAND_REGISTER, (quadlet_t*)CmdFrm, CmdFrm->length); - + hpsb_set_packet_complete_task(packet, (void (*)(void*))avc_free_packet, packet); - + hpsb_node_fill_packet(ne, packet); - if(RspFrm) + if(RspFrm) atomic_set(&firesat->avc_reply_received, 0); if (hpsb_send_packet(packet) < 0) { - avc_free_packet(packet); - atomic_set(&firesat->avc_reply_received, 1); + avc_free_packet(packet); + atomic_set(&firesat->avc_reply_received, 1); return -EIO; } - + if(RspFrm) { - if(avc_down_timeout(&firesat->avc_reply_received,HZ/2)) { - printk("%s: timeout waiting for avc response\n",__FUNCTION__); - atomic_set(&firesat->avc_reply_received, 1); - return -ETIMEDOUT; - } - + if(avc_down_timeout(&firesat->avc_reply_received,HZ/2)) { + printk("%s: timeout waiting for avc response\n",__FUNCTION__); + atomic_set(&firesat->avc_reply_received, 1); + return -ETIMEDOUT; + } + memcpy(RspFrm,firesat->respfrm,firesat->resp_length); } - + return 0; } @@ -99,9 +99,9 @@ int AVCWrite(struct firesat*firesat, const AVCCmdFrm *CmdFrm, AVCRspFrm *RspFrm) int ret; if(down_interruptible(&firesat->avc_sem)) return -EINTR; - + ret = __AVCWrite(firesat, CmdFrm, RspFrm); - + up(&firesat->avc_sem); return ret; } @@ -111,7 +111,7 @@ DECLARE_TASKLET(schedule_remotecontrol, do_schedule_remotecontrol, 0); static void do_schedule_remotecontrol(unsigned long ignored) { struct firesat *firesat; - unsigned long flags; + unsigned long flags; spin_lock_irqsave(&firesat_list_lock, flags); list_for_each_entry(firesat,&firesat_list,list) { @@ -125,7 +125,7 @@ static void do_schedule_remotecontrol(unsigned long ignored) { tasklet_schedule(&schedule_remotecontrol); up(&firesat->avc_sem); - } + } } } spin_unlock_irqrestore(&firesat_list_lock, flags); @@ -135,8 +135,8 @@ int AVCRecv(struct firesat *firesat, u8 *data, size_t length) { // printk(KERN_INFO "%s\n",__FUNCTION__); // remote control handling - - AVCRspFrm *RspFrm = (AVCRspFrm*)data; + + AVCRspFrm *RspFrm = (AVCRspFrm*)data; if(/*RspFrm->length >= 8 && ###*/ ((RspFrm->operand[0] == SFE_VENDOR_DE_COMPANYID_0 && @@ -144,59 +144,59 @@ int AVCRecv(struct firesat *firesat, u8 *data, size_t length) { RspFrm->operand[2] == SFE_VENDOR_DE_COMPANYID_2) || (RspFrm->operand[0] == SFE_VENDOR_EL_COMPANYID_0 && RspFrm->operand[1] == SFE_VENDOR_EL_COMPANYID_1 && - RspFrm->operand[2] == SFE_VENDOR_EL_COMPANYID_2)) && + RspFrm->operand[2] == SFE_VENDOR_EL_COMPANYID_2)) && RspFrm->operand[3] == SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL) { if(RspFrm->resp == CHANGED) { // printk(KERN_INFO "%s: code = %02x %02x\n",__FUNCTION__,RspFrm->operand[4],RspFrm->operand[5]); firesat_got_remotecontrolcode((((u16)RspFrm->operand[4]) << 8) | ((u16)RspFrm->operand[5])); - // schedule + // schedule atomic_set(&firesat->reschedule_remotecontrol, 1); tasklet_schedule(&schedule_remotecontrol); } else if(RspFrm->resp != INTERIM) printk(KERN_INFO "%s: remote control result = %d\n",__FUNCTION__, RspFrm->resp); return 0; } - + if(atomic_read(&firesat->avc_reply_received) == 1) { printk("%s: received out-of-order AVC response, ignored\n",__FUNCTION__); return -EINVAL; } // AVCRspFrm *resp=(AVCRspFrm *)data; // int k; -/* +/* printk(KERN_INFO "resp=0x%x\n",resp->resp); printk(KERN_INFO "cts=0x%x\n",resp->cts); printk(KERN_INFO "suid=0x%x\n",resp->suid); printk(KERN_INFO "sutyp=0x%x\n",resp->sutyp); printk(KERN_INFO "opcode=0x%x\n",resp->opcode); printk(KERN_INFO "length=%d\n",resp->length); -*/ +*/ // for(k=0;k<2;k++) // printk(KERN_INFO "operand[%d]=%02x\n",k,resp->operand[k]); - + memcpy(firesat->respfrm,data,length); firesat->resp_length=length; atomic_set(&firesat->avc_reply_received, 1); - + return 0; } // tuning command for setting the relative LNB frequency (not supported by the AVC standard) static void AVCTuner_DSD_directcmd(struct firesat *firesat, struct dvb_frontend_parameters *params, AVCCmdFrm *CmdFrm) { memset(CmdFrm, 0, sizeof(AVCCmdFrm)); - + CmdFrm->cts = AVC; CmdFrm->ctype = CONTROL; CmdFrm->sutyp = 0x5; CmdFrm->suid = firesat->subunit; CmdFrm->opcode = VENDOR; - /* ### should check for elgato and use SFE_VENDOR_EL_COMPANYID_0 in this case */ - CmdFrm->operand[0]=SFE_VENDOR_DE_COMPANYID_0; - CmdFrm->operand[1]=SFE_VENDOR_DE_COMPANYID_1; - CmdFrm->operand[2]=SFE_VENDOR_DE_COMPANYID_2; + /* ### should check for elgato and use SFE_VENDOR_EL_COMPANYID_0 in this case */ + CmdFrm->operand[0]=SFE_VENDOR_DE_COMPANYID_0; + CmdFrm->operand[1]=SFE_VENDOR_DE_COMPANYID_1; + CmdFrm->operand[2]=SFE_VENDOR_DE_COMPANYID_2; CmdFrm->operand[3]=0x58; printk(KERN_INFO "%s: tuning to frequency %u\n",__FUNCTION__,params->frequency); @@ -207,7 +207,7 @@ static void AVCTuner_DSD_directcmd(struct firesat *firesat, struct dvb_frontend_ CmdFrm->operand[7] = params->frequency & 0xFF; printk(KERN_INFO "%s: symbol rate = %uBd\n",__FUNCTION__,params->u.qpsk.symbol_rate); - + CmdFrm->operand[8] = ((params->u.qpsk.symbol_rate/1000) >> 8) & 0xFF; CmdFrm->operand[9] = (params->u.qpsk.symbol_rate/1000) & 0xFF; @@ -233,7 +233,7 @@ static void AVCTuner_DSD_directcmd(struct firesat *firesat, struct dvb_frontend_ default: CmdFrm->operand[10] = 0x0; } - + if(firesat->voltage == 0xff) CmdFrm->operand[11] = 0xff; else @@ -242,7 +242,7 @@ static void AVCTuner_DSD_directcmd(struct firesat *firesat, struct dvb_frontend_ CmdFrm->operand[12] = 0xff; else CmdFrm->operand[12] = (firesat->tone==SEC_TONE_ON)?1:0; // band - + CmdFrm->length = 16; } @@ -251,9 +251,9 @@ int AVCTuner_DSD(struct firesat *firesat, struct dvb_frontend_parameters *params AVCRspFrm RspFrm; M_VALID_FLAGS flags; int k; - + // printk(KERN_INFO "%s\n", __FUNCTION__); - + if(firesat->type == FireSAT_DVB_S) AVCTuner_DSD_directcmd(firesat, params, &CmdFrm); else { @@ -290,15 +290,15 @@ int AVCTuner_DSD(struct firesat *firesat, struct dvb_frontend_parameters *params flags.Bits.reserved1 = 0; flags.Bits.Network_ID = 0; } - + memset(&CmdFrm, 0, sizeof(AVCCmdFrm)); - + CmdFrm.cts = AVC; CmdFrm.ctype = CONTROL; CmdFrm.sutyp = 0x5; CmdFrm.suid = firesat->subunit; CmdFrm.opcode = DSD; - + CmdFrm.operand[0] = 0; // source plug CmdFrm.operand[1] = 0xD2; // subfunction replace CmdFrm.operand[2] = 0x20; // system id = DVB @@ -306,7 +306,7 @@ int AVCTuner_DSD(struct firesat *firesat, struct dvb_frontend_parameters *params CmdFrm.operand[4] = (firesat->type == FireSAT_DVB_T)?0x0c:0x11; // system_specific_multiplex selection_length CmdFrm.operand[5] = flags.Valid_Word.ByteHi; // valid_flags [0] CmdFrm.operand[6] = flags.Valid_Word.ByteLo; // valid_flags [1] - + if(firesat->type == FireSAT_DVB_T) { CmdFrm.operand[7] = 0x0; CmdFrm.operand[8] = (params->frequency/10) >> 24; @@ -408,18 +408,18 @@ int AVCTuner_DSD(struct firesat *firesat, struct dvb_frontend_parameters *params default: break; } - + CmdFrm.operand[15] = 0x00; // network_ID[0] CmdFrm.operand[16] = 0x00; // network_ID[1] CmdFrm.operand[17] = 0x00; // Nr_of_dsd_sel_specs = 0 - > No PIDs are transmitted - + CmdFrm.length = 20; } else { CmdFrm.operand[7] = 0x00; CmdFrm.operand[8] = (((firesat->voltage==SEC_VOLTAGE_18)?0:1)<<6); /* 0 = H, 1 = V */ CmdFrm.operand[9] = 0x00; CmdFrm.operand[10] = 0x00; - + if(firesat->type == FireSAT_DVB_S) { /* ### relative frequency -> absolute frequency */ CmdFrm.operand[11] = (((params->frequency/4) >> 16) & 0xFF) | (2 << 6); @@ -430,11 +430,11 @@ int AVCTuner_DSD(struct firesat *firesat, struct dvb_frontend_parameters *params CmdFrm.operand[12] = ((params->frequency/4000) >> 8) & 0xFF; CmdFrm.operand[13] = (params->frequency/4000) & 0xFF; } - + CmdFrm.operand[14] = ((params->u.qpsk.symbol_rate/1000) >> 12) & 0xFF; CmdFrm.operand[15] = ((params->u.qpsk.symbol_rate/1000) >> 4) & 0xFF; CmdFrm.operand[16] = ((params->u.qpsk.symbol_rate/1000) << 4) & 0xF0; - + CmdFrm.operand[17] = 0x00; switch(params->u.qpsk.fec_inner) { case FEC_1_2: @@ -485,7 +485,7 @@ int AVCTuner_DSD(struct firesat *firesat, struct dvb_frontend_parameters *params CmdFrm.operand[20] = 0x00; CmdFrm.operand[21] = 0x00; CmdFrm.operand[22] = 0x00; // Nr_of_dsd_sel_specs = 0 - > No PIDs are transmitted - + CmdFrm.length=28; } } // AVCTuner_DSD_direct @@ -495,7 +495,7 @@ int AVCTuner_DSD(struct firesat *firesat, struct dvb_frontend_parameters *params // msleep(250); mdelay(500); - + if(status) *status=RspFrm.operand[2]; return 0; @@ -505,9 +505,9 @@ int AVCTuner_SetPIDs(struct firesat *firesat, unsigned char pidc, u16 pid[]) { AVCCmdFrm CmdFrm; AVCRspFrm RspFrm; int pos,k; - + printk(KERN_INFO "%s\n", __FUNCTION__); - + if(pidc > 16 && pidc != 0xFF) return -EINVAL; @@ -518,7 +518,7 @@ int AVCTuner_SetPIDs(struct firesat *firesat, unsigned char pidc, u16 pid[]) { CmdFrm.sutyp = 0x5; CmdFrm.suid = firesat->subunit; CmdFrm.opcode = DSD; - + CmdFrm.operand[0] = 0; // source plug CmdFrm.operand[1] = 0xD2; // subfunction replace CmdFrm.operand[2] = 0x20; // system id = DVB @@ -526,7 +526,7 @@ int AVCTuner_SetPIDs(struct firesat *firesat, unsigned char pidc, u16 pid[]) { CmdFrm.operand[4] = 0x11; // system_specific_multiplex selection_length CmdFrm.operand[5] = 0x00; // valid_flags [0] CmdFrm.operand[6] = 0x00; // valid_flags [1] - + if(firesat->type == FireSAT_DVB_T) { /* CmdFrm.operand[7] = 0x00; CmdFrm.operand[8] = 0x00;//(params->frequency/10) >> 24; @@ -536,7 +536,7 @@ int AVCTuner_SetPIDs(struct firesat *firesat, unsigned char pidc, u16 pid[]) { CmdFrm.operand[12] = 0x00; CmdFrm.operand[13] = 0x00; CmdFrm.operand[14] = 0x00; - + CmdFrm.operand[15] = 0x00; // network_ID[0] CmdFrm.operand[16] = 0x00; // network_ID[1] */ CmdFrm.operand[17] = pidc; // Nr_of_dsd_sel_specs @@ -547,22 +547,22 @@ int AVCTuner_SetPIDs(struct firesat *firesat, unsigned char pidc, u16 pid[]) { CmdFrm.operand[8] = 0x00; CmdFrm.operand[9] = 0x00; CmdFrm.operand[10] = 0x00; - + CmdFrm.operand[11] = 0x00;//(((params->frequency/4) >> 16) & 0xFF) | (2 << 6); CmdFrm.operand[12] = 0x00;//((params->frequency/4) >> 8) & 0xFF; CmdFrm.operand[13] = 0x00;//(params->frequency/4) & 0xFF; - + CmdFrm.operand[14] = 0x00;//((params->u.qpsk.symbol_rate/1000) >> 12) & 0xFF; CmdFrm.operand[15] = 0x00;//((params->u.qpsk.symbol_rate/1000) >> 4) & 0xFF; CmdFrm.operand[16] = 0x00;//((params->u.qpsk.symbol_rate/1000) << 4) & 0xF0; - + CmdFrm.operand[17] = 0x00; CmdFrm.operand[18] = 0x00; CmdFrm.operand[19] = 0x00; // modulation CmdFrm.operand[20] = 0x00; CmdFrm.operand[21] = 0x00;*/ CmdFrm.operand[22] = pidc; // Nr_of_dsd_sel_specs - + pos=23; } if(pidc != 0xFF) @@ -576,7 +576,7 @@ int AVCTuner_SetPIDs(struct firesat *firesat, unsigned char pidc, u16 pid[]) { } CmdFrm.length = pos+3; - + if((pos+3)%4) CmdFrm.length += 4 - ((pos+3)%4); @@ -584,14 +584,14 @@ int AVCTuner_SetPIDs(struct firesat *firesat, unsigned char pidc, u16 pid[]) { return k; mdelay(250); - + return 0; } int AVCIdentifySubunit(struct firesat *firesat, unsigned char *systemId, int *transport, int *has_ci) { AVCCmdFrm CmdFrm; AVCRspFrm RspFrm; - + memset(&CmdFrm,0,sizeof(AVCCmdFrm)); CmdFrm.cts = AVC; @@ -612,7 +612,7 @@ int AVCIdentifySubunit(struct firesat *firesat, unsigned char *systemId, int *tr if(AVCWrite(firesat,&CmdFrm,&RspFrm)<0) return -EIO; - + if(RspFrm.resp != STABLE && RspFrm.resp != ACCEPTED) { printk("%s: AVCWrite returned error code %d\n",__FUNCTION__,RspFrm.resp); return -EINVAL; @@ -649,15 +649,15 @@ int AVCTunerStatus(struct firesat *firesat, ANTENNA_INPUT_INFO *antenna_input_in int length; printk(KERN_INFO "%s\n", __FUNCTION__); - + memset(&CmdFrm, 0, sizeof(AVCCmdFrm)); - + CmdFrm.cts=AVC; CmdFrm.ctype=CONTROL; CmdFrm.sutyp=0x05; // tuner CmdFrm.suid=firesat->subunit; CmdFrm.opcode=READ_DESCRIPTOR; - + CmdFrm.operand[0]=DESCRIPTOR_TUNER_STATUS; CmdFrm.operand[1]=0xff; CmdFrm.operand[2]=0x00; @@ -669,7 +669,7 @@ int AVCTunerStatus(struct firesat *firesat, ANTENNA_INPUT_INFO *antenna_input_in //Absenden des AVC request und warten auf response if (AVCWrite(firesat,&CmdFrm,&RspFrm) < 0) return -EIO; - + if(RspFrm.resp != STABLE && RspFrm.resp != ACCEPTED) { printk("%s: AVCWrite returned code %d\n",__FUNCTION__,RspFrm.resp); return -EINVAL; @@ -678,7 +678,7 @@ int AVCTunerStatus(struct firesat *firesat, ANTENNA_INPUT_INFO *antenna_input_in length = (RspFrm.operand[3] << 8) + RspFrm.operand[4]; if(length == sizeof(ANTENNA_INPUT_INFO)) { - memcpy(antenna_input_info,&RspFrm.operand[7],length); + memcpy(antenna_input_info,&RspFrm.operand[7],length); return 0; } printk("%s: invalid info returned from AVC\n",__FUNCTION__); @@ -689,17 +689,17 @@ int AVCLNBControl(struct firesat *firesat, char voltage, char burst, char contto AVCCmdFrm CmdFrm; AVCRspFrm RspFrm; int i,j; - + printk(KERN_INFO "%s: voltage = %x, burst = %x, conttone = %x\n",__FUNCTION__,voltage,burst,conttone); - + memset(&CmdFrm, 0, sizeof(AVCCmdFrm)); - + CmdFrm.cts=AVC; CmdFrm.ctype=CONTROL; CmdFrm.sutyp=0x05; CmdFrm.suid=firesat->subunit; CmdFrm.opcode=VENDOR; - + /* ### should check for elgato and use SFE_VENDOR_EL_COMPANYID_0 in this case */ CmdFrm.operand[0]=SFE_VENDOR_DE_COMPANYID_0; CmdFrm.operand[1]=SFE_VENDOR_DE_COMPANYID_1; @@ -708,40 +708,40 @@ int AVCLNBControl(struct firesat *firesat, char voltage, char burst, char contto CmdFrm.operand[4]=voltage; CmdFrm.operand[5]=nrdiseq; - + i=6; - + for(j=0;j<nrdiseq;j++) { int k; printk(KERN_INFO "%s: diseq %d len %x\n",__FUNCTION__,j,diseqcmd[j].msg_len); CmdFrm.operand[i++]=diseqcmd[j].msg_len; - + for(k=0;k<diseqcmd[j].msg_len;k++) { printk(KERN_INFO "%s: diseq %d msg[%d] = %x\n",__FUNCTION__,j,k,diseqcmd[j].msg[k]); CmdFrm.operand[i++]=diseqcmd[j].msg[k]; } } - + CmdFrm.operand[i++]=burst; CmdFrm.operand[i++]=conttone; - + CmdFrm.length=i+3; if((i+3)%4) CmdFrm.length += 4 - ((i+3)%4); - + /* for(j=0;j<CmdFrm.length;j++) printk(KERN_INFO "%s: CmdFrm.operand[%d]=0x%x\n",__FUNCTION__,j,CmdFrm.operand[j]); - + printk(KERN_INFO "%s: cmdfrm.length = %u\n",__FUNCTION__,CmdFrm.length); */ if(AVCWrite(firesat,&CmdFrm,&RspFrm) < 0) return -EIO; - + if(RspFrm.resp != ACCEPTED) { printk("%s: AVCWrite returned code %d\n",__FUNCTION__,RspFrm.resp); return -EINVAL; } - + return 0; } @@ -780,7 +780,7 @@ int AVCSubUnitInfo(struct firesat*firesat, char *subunitcount) { } static int __AVCRegisterRemoteControl(struct firesat*firesat, int internal) { - AVCCmdFrm CmdFrm; + AVCCmdFrm CmdFrm; // printk(KERN_INFO "%s\n",__FUNCTION__); @@ -807,7 +807,7 @@ static int __AVCRegisterRemoteControl(struct firesat*firesat, int internal) { return -EIO; } else if(AVCWrite(firesat,&CmdFrm,NULL) < 0) - return -EIO; + return -EIO; return 0; } @@ -845,7 +845,7 @@ int AVCResetTPDU(struct firesat*firesat) { if(RspFrm.resp != STABLE) { printk("%s: AVCWrite returned error %d\n", __FUNCTION__, RspFrm.resp); return RspFrm.resp; - } + } return 0; } @@ -881,7 +881,7 @@ int AVCWriteTPDU(struct firesat*firesat, const char *tpdupacket, int length) { if(CmdFrm.length % 4) CmdFrm.length += 4 - (CmdFrm.length % 4); - + if(AVCWrite(firesat, &CmdFrm, &RspFrm) < 0) return -EIO; @@ -912,14 +912,14 @@ int AVCReadTPDU(struct firesat*firesat, char *tpdupacket, int *length) { // CmdFrm.operand[1] = SFE_VENDOR_EL_COMPANYID_1; CmdFrm.operand[1] = SFE_VENDOR_DE_COMPANYID_1; // CmdFrm.operand[2] = SFE_VENDOR_EL_COMPANYID_2; - CmdFrm.operand[2] = SFE_VENDOR_DE_COMPANYID_2; + CmdFrm.operand[2] = SFE_VENDOR_DE_COMPANYID_2; // CmdFrm.operand[3] = SFE_VENDOR_OPCODE_CI_READ_TPDU; CmdFrm.length = 8; if(AVCWrite(firesat, &CmdFrm, &RspFrm) < 0) return -EIO; - + if(RspFrm.resp != STABLE) { printk("%s: AVCWrite returned error %d\n",__FUNCTION__,RspFrm.resp); return RspFrm.resp; |