diff options
Diffstat (limited to 'com-on-air_cs-linux/sc14421_sniffer.c')
-rw-r--r-- | com-on-air_cs-linux/sc14421_sniffer.c | 542 |
1 files changed, 253 insertions, 289 deletions
diff --git a/com-on-air_cs-linux/sc14421_sniffer.c b/com-on-air_cs-linux/sc14421_sniffer.c index d325916..c1d764b 100644 --- a/com-on-air_cs-linux/sc14421_sniffer.c +++ b/com-on-air_cs-linux/sc14421_sniffer.c @@ -24,30 +24,18 @@ /* dip config register control */ -unsigned char scan_init1[] = {0x27,0x00,0xff,0x00,0x5f,0x04,0x00}; -unsigned char scan_init2[] = {0xc2,0x05,0x00,0x03,0x00,0x00}; +unsigned char dip_ctrl[] = {0xc2,0x05,0x00,0x03,0x00,0x00}; -/* hf register type II card */ -unsigned char radio_II_chan[] = {0x54,0x80,0x09/* patch */,0xa0,0x00,0x00}; -/* hf register type III card */ -unsigned char scan_III_init3[] = {0x54,0x80,0x09/* patch */,0xa0,0x00,0x00}; +/* rf register type II card */ +unsigned char radio_II_chan[] = {0x54,0x80,0x09/* patch */,0xa0,0x00,0x00}; +/* rf register type III card */ +unsigned char radio_III_chan[] = {0x32,0x20,0x28,0x01,0xc1,0x1b}; -/* hf register */ -unsigned char scan_init4[] = {0x15,0xa0,0xff,0x00/* &0x3f */,0x5f,0x04,0x00}; +/* dip register */ +unsigned char dip_register[] = {0x15,0xa0,0xff,0x00/* &0x3f */,0x5f,0x04,0x00}; /* dip control */ -unsigned char scan_init5[] = {0x27,0x00,0xff,0x00,0x5f,0x05,0x00}; - -/* dip control */ -unsigned char sync_init1[] = {0x27,0x00,0xff,0x00,0x5f,0x04,0x00}; -unsigned char sync_init2[] = {0xc2,0x05,0x00,0x03,0x00,0x00}; - -/* hf register type III card */ -unsigned char sync_III_init3[] = {0x54,0x80,0x09/* patch */,0xa0,0x00,0x00}; -/* hf register */ -unsigned char sync_init4[] = {0x15,0xa0,0xff,0x00/* &0x3f */,0x5f,0x04,0x00}; -/* dip control */ -unsigned char sync_init5[] = {0x27,0x00,0xff,0x00,0x5f,0x05,0x00}; +unsigned char dip_mode_fp_pp[] = {0x27,0x00,0xff,0x00,0x5f,0x05,0x00}; unsigned char fppacket[53] = {0xAA,0xAA,0xAA,0xE9,0x8A}; @@ -57,32 +45,32 @@ unsigned char pppacket[53] = {0x55,0x55,0x55,0x16,0x75}; /* FIXME:auto-generate all this stuff */ int sync_jumptable[] = { - JP0, 0, - JP2, 0, - JP4, 0, - JP6, 0, - JP8, 0, - JP10, 0, - JP12, 0, - JP14, 0, - JP16, 0, - JP18, 0, - JP20, 0, - JP22, 0 + JP0II, 0, + JP2II, 0, + JP4II, 0, + JP6II, 0, + JP8II, 0, + JP10II, 0, + JP12II, 0, + JP14II, 0, + JP16II, 0, + JP18II, 0, + JP20II, 0, + JP22II, 0 }; int sync_patchtable[] = { - PP0, 0, - PP2, 0, - PP4, 0, - PP6, 0, - PP8, 0, - PP10, 0, - PP12, 0, - PP14, 0, - PP16, 0, - PP18, 0, - PP20, 0, - PP22, 0 + PP0II, 0, + PP2II, 0, + PP4II, 0, + PP6II, 0, + PP8II, 0, + PP10II, 0, + PP12II, 0, + PP14II, 0, + PP16II, 0, + PP18II, 0, + PP20II, 0, + PP22II, 0 }; /* FIXME:end */ @@ -139,90 +127,106 @@ void sniffer_init(struct coa_info *dev) } } -void set_channel(struct coa_info *dev, int ch) + +void set_channel(struct coa_info *dev, int ch, int sync_slot, int sync_frame, unsigned char dipmode , unsigned char bank) { - int channel; + int channel,memofs; + unsigned short *sc14421_base = dev->sc14421_base; + +// printk("set channel:%u slot:%u frame#:%u dipmode:%u bank:%x\n",ch,sync_slot,sync_frame,dipmode,bank); + + if ( (sync_slot/2) % 2) + memofs = 0x80; + else + memofs = 0x00; + + if (ch<10) channel = 10 - ch; else channel = ch; + SC14421_switch_to_bank(sc14421_base, dipmode | SC14421_RAMBANK0); + to_dip(sc14421_base + 0x10, dip_ctrl, ARRAY_SIZE(dip_ctrl)); + + + SC14421_switch_to_bank(sc14421_base, dipmode | bank); + + switch(dev->sniffer_config->snifftype) + { + case SNIFF_SYNC: + if (sync_slot > 11) + { + dip_mode_fp_pp[0] &= 0xFE; + dip_mode_fp_pp[6] = sync_frame; + }else{ + dip_mode_fp_pp[0] |= 0x01; + dip_mode_fp_pp[6] = sync_frame; + } + break; + case SNIFF_SCANFP: + dip_mode_fp_pp[0] |= 0x01; + break; + case SNIFF_SCANPP: + dip_mode_fp_pp[0] &= 0xFE; + break; + default: + printk("ERROR: this snifftype is currently not " + "supported. please update the driver\n"); + } + switch(dev->radio_type) { case COA_RADIO_TYPE_II: - radio_II_chan[0] = - (radio_II_chan[0] & 0xC1) | - (channel << 1); + radio_II_chan[0] = (radio_II_chan[0] & 0xC1) | (channel << 1); + dip_mode_fp_pp[0] &= 0xF7; + + to_dip(sc14421_base + memofs + 0x4A, radio_II_chan, ARRAY_SIZE(radio_II_chan)); + break; + case COA_RADIO_TYPE_III: + radio_III_chan[2] = channel << 2; + dip_mode_fp_pp[0] |= 0x08; + to_dip(sc14421_base + memofs + 0x4A, radio_III_chan, ARRAY_SIZE(radio_III_chan)); break; default: printk("ERROR: this radio type is currently not " "supported. please update the driver\n"); } + + to_dip(sc14421_base + memofs + 0x58, dip_mode_fp_pp, ARRAY_SIZE(dip_mode_fp_pp)); + to_dip(sc14421_base + memofs + 0x50, dip_register, ARRAY_SIZE(dip_register)); + } void sniffer_init_sniff_scan(struct coa_info *dev) { volatile uint16_t *sc14421_base = dev->sc14421_base; -/* printk("loading sniff_scan firmware\n"); */ - - SC14421_switch_to_bank( - sc14421_base, - SC14421_DIPSTOPPED | SC14421_CODEBANK - ); - to_dip( - sc14421_base, - sc14421_II_sniff_scan_fw, - ARRAY_SIZE(sc14421_II_sniff_scan_fw)); - - SC14421_clear_interrupt(sc14421_base); + /* printk("loading sniff_scan firmware"); */ - set_channel(dev, dev->sniffer_config->channel); + SC14421_switch_to_bank(sc14421_base, SC14421_DIPSTOPPED | SC14421_CODEBANK); - if (dev->sniffer_config->snifftype == SNIFF_SCANPP) - { - scan_init1[0] &= 0xFE; - scan_init5[0] &= 0xFE; - } - else + switch(dev->radio_type) { - scan_init1[0] |= 0x01; - scan_init5[0] |= 0x01; + case COA_RADIO_TYPE_II: + /* printk(" for type II\n"); */ + to_dip(sc14421_base, sc14421_II_sniff_scan_fw, ARRAY_SIZE(sc14421_II_sniff_scan_fw)); + break; + case COA_RADIO_TYPE_III: + /* printk(" for type III\n"); */ + to_dip(sc14421_base, sc14421_III_sniff_scan_fw, ARRAY_SIZE(sc14421_III_sniff_scan_fw)); + break; + default: + printk("ERROR: this radio type is currently not " + "supported. please update the driver\n"); } - SC14421_switch_to_bank( - sc14421_base, - SC14421_DIPSTOPPED | SC14421_RAMBANK0 - ); - to_dip( - sc14421_base + 0x00, - scan_init1, - ARRAY_SIZE(scan_init1)); - to_dip( - sc14421_base + 0x10, - scan_init2, - ARRAY_SIZE(scan_init2) - ); - SC14421_switch_to_bank( - sc14421_base, - SC14421_DIPSTOPPED | SC14421_RAMBANK1 - ); - to_dip( - sc14421_base + 0x4A, - radio_II_chan, - ARRAY_SIZE(radio_II_chan) - ); - to_dip( - sc14421_base + 0x58, - scan_init5, - ARRAY_SIZE(scan_init5) - ); - to_dip( - sc14421_base + 0x50, - scan_init4, - ARRAY_SIZE(scan_init4)); + /* printk("clear interrupt\n"); */ + SC14421_clear_interrupt(sc14421_base); + + set_channel(dev, dev->sniffer_config->channel, -1, -1, SC14421_DIPSTOPPED, SC14421_RAMBANK1); -/* printk("starting dip\n"); */ + /* printk("starting dip\n"); */ SC14421_switch_to_bank(sc14421_base, SC14421_RAMBANK0); } @@ -232,64 +236,33 @@ void sniffer_init_sniff_sync(struct coa_info *dev) { volatile uint16_t *sc14421_base = dev->sc14421_base; - printk("loading sniff_sync firmware\n"); + /* printk("loading sniff_sync firmware"); */ - SC14421_switch_to_bank( - sc14421_base, - SC14421_DIPSTOPPED | SC14421_CODEBANK - ); - to_dip( - sc14421_base, - sc14421_II_sniff_sync_fw, - ARRAY_SIZE(sc14421_II_sniff_sync_fw)); + SC14421_switch_to_bank(sc14421_base, SC14421_DIPSTOPPED | SC14421_CODEBANK); + switch(dev->radio_type) + { + case COA_RADIO_TYPE_II: + /* printk(" for type II\n"); */ + to_dip(sc14421_base, sc14421_II_sniff_sync_fw, ARRAY_SIZE(sc14421_II_sniff_sync_fw)); + break; + case COA_RADIO_TYPE_III: + /* printk(" for type III\n"); */ + to_dip(sc14421_base, sc14421_III_sniff_sync_fw, ARRAY_SIZE(sc14421_III_sniff_sync_fw)); + break; + default: + printk("ERROR: this radio type is currently not " + "supported. please update the driver\n"); + } - printk("clear interrupt\n"); + /* printk("clear interrupt\n"); */ SC14421_clear_interrupt(sc14421_base); - SC14421_switch_to_bank( - sc14421_base, - SC14421_DIPSTOPPED | SC14421_RAMBANK0 - ); - to_dip( - sc14421_base + 0x00, - sync_init1, - ARRAY_SIZE(sync_init1) - ); - to_dip( - sc14421_base + 0x10, - sync_init2, - ARRAY_SIZE(sync_init2)); - - set_channel(dev, dev->sniffer_config->channel); - - sync_init5[0] |= 0x01; - - - SC14421_switch_to_bank( - sc14421_base, - SC14421_DIPSTOPPED | SC14421_RAMBANK1 - ); - to_dip( - sc14421_base + 0x4A, - radio_II_chan, - ARRAY_SIZE(radio_II_chan) - ); - to_dip( - sc14421_base + 0x58, - sync_init5, - ARRAY_SIZE(sync_init5) - ); - to_dip( - sc14421_base + 0x50, - sync_init4, - ARRAY_SIZE(sync_init4) - ); + set_channel(dev, dev->sniffer_config->channel, -1, -1, SC14421_DIPSTOPPED, SC14421_RAMBANK1); dev->sniffer_config->status = 0; sniffer_clear_slottable(dev->sniffer_config->slottable); - - printk("starting dip\n"); + /* printk("starting dip\n"); */ SC14421_switch_to_bank(sc14421_base, SC14421_RAMBANK0); } @@ -329,10 +302,7 @@ void sniffer_sniff_scan_irq(struct coa_info *dev, int irq) if ( (SC14421_READ(1) & 0xc0) == 0xc0) /* Checksum ok */ { uint8_t rssi = SC14421_READ(0); - from_dip( - fppacket + 5, - sc14421_base + 6, - 6); + from_dip(fppacket + 5, sc14421_base + 6, 6); SC14421_WRITE(1, 0); /* Clear Checksum-Flag */ @@ -373,8 +343,8 @@ void sniffer_sniff_sync_irq(struct coa_info *dev, int irq) { #if 0 printk("N:"); - for (r=0; r<16; r++) - printk("%.2x ", SC14421_READ(r)); + for (i=0; i<16; i++) + printk("%.2x ", SC14421_READ(i)); printk("\n"); #endif @@ -382,27 +352,27 @@ void sniffer_sniff_sync_irq(struct coa_info *dev, int irq) { SC14421_WRITE(1, 0); /* clear checksum flag */ - from_dip( - fppacket + 5, - sc14421_base + 6, - 6); + from_dip(fppacket + 5,sc14421_base + 6, 6); if (dect_compare_RFPI(fppacket, config->RFPI)) - { + { printk("found station for sync\n"); - config->status |= - SNIFF_STATUS_FOUNDSTATION; - - SC14421_switch_to_bank( - sc14421_base, - SC14421_CODEBANK - ); - SC14421_write_cmd( - sc14421_base, - sync_label_D4, - BR, - sync_label_D1 - ); + config->status |= SNIFF_STATUS_FOUNDSTATION; + + SC14421_switch_to_bank(sc14421_base,SC14421_CODEBANK); + + switch(dev->radio_type) + { + case COA_RADIO_TYPE_II: + SC14421_write_cmd(sc14421_base, PPFoundII, BR, RecvNextII); + break; + case COA_RADIO_TYPE_III: + SC14421_write_cmd(sc14421_base, PPFoundIII, BR, RecvNextIII); + break; + default: + printk("ERROR: this radio type is currently not " + "supported. please update the driver\n"); + } } } } @@ -421,51 +391,41 @@ void sniffer_sniff_sync_irq(struct coa_info *dev, int irq) if ( (SC14421_READ(1) & 0xc0) == 0xc0) /* Checksum ok */ { SC14421_WRITE(1, 0); /* clear checksum flag */ - from_dip( - fppacket + 5, - sc14421_base + 6, - 48); + from_dip(fppacket + 5, sc14421_base + 6, 48); slot = dect_get_slot(fppacket); if (slot != -1) { - /* printk("station in slot %u\n", slot); */ + printk("station in slot %u\n", slot); config->status |= SNIFF_STATUS_INSYNC; slot %= 12; if (slot%2) - printk("slot not possible " - "with this firmware\n"); + printk("slot not possible with this firmware\n"); config->slottable[slot].active = 1; - config->slottable[slot].channel = - config->channel; - config->slottable[slot].type = - DECT_SLOTTYPE_CARRIER; + config->slottable[slot].channel = config->channel; + config->slottable[slot].type = DECT_SLOTTYPE_CARRIER; config->slottable[slot].errcnt = 0; - sniffer_sync_patchloop( - dev, - config->slottable, - SNIFF_SLOTPATCH_FP - ); - sniffer_sync_patchloop( - dev, - config->slottable, - SNIFF_SLOTPATCH_PP - ); - - SC14421_switch_to_bank( - sc14421_base, - SC14421_CODEBANK - ); - printk("set jump to %u\n", - sync_jumptable[slot]); - SC14421_write_cmd( - sc14421_base, - sync_label_D4, - BR, - sync_jumptable[slot] - ); + sniffer_sync_patchloop(dev,config->slottable,SNIFF_SLOTPATCH_FP); + sniffer_sync_patchloop(dev,config->slottable,SNIFF_SLOTPATCH_PP); + + SC14421_switch_to_bank(sc14421_base,SC14421_CODEBANK); + + printk("set jump to %u\n",sync_jumptable[slot]); + + switch(dev->radio_type) + { + case COA_RADIO_TYPE_II: + SC14421_write_cmd(sc14421_base,PPFoundII,BR,sync_jumptable[slot]); + break; + case COA_RADIO_TYPE_III: + SC14421_write_cmd(sc14421_base,PPFoundIII,BR,sync_jumptable[slot]); + break; + default: + printk("ERROR: this radio type is currently not " + "supported. please update the driver\n"); + } printk("we are in sync :)\n"); @@ -476,12 +436,8 @@ void sniffer_sniff_sync_irq(struct coa_info *dev, int irq) packet.slot = slot; memcpy(packet.data, fppacket, 53); - packet.timestamp = - dev->irq_timestamp; - ret = kfifo_put( - dev->rx_fifo, - (unsigned char*) &packet, - sizeof(struct sniffed_packet)); + packet.timestamp = dev->irq_timestamp; + ret = kfifo_put(dev->rx_fifo,(unsigned char*) &packet,sizeof(struct sniffed_packet)); if (ret <= 0) printk("com_on_air_cs: rx fifo " "full? kfifo_put() " @@ -493,7 +449,7 @@ void sniffer_sniff_sync_irq(struct coa_info *dev, int irq) else { if ( (irq & 0x09) == 0x09) - printk("interrupt too slow , lost packets!\n"); + printk("com_on_air-cs: interrupt processing too slow , lost packets!\n"); if (irq & 0x01) { @@ -502,53 +458,56 @@ void sniffer_sniff_sync_irq(struct coa_info *dev, int irq) { if (config->slottable[a].active) { - SC14421_switch_to_bank( - sc14421_base, - sync_banktable[a]); + SC14421_switch_to_bank(sc14421_base,sync_banktable[a]); if ( (a/2) % 2) memofs = 0x80; else memofs = 0x00; - if ( (SC14421_READ(1+memofs) & 0xc0) == - 0xc0) /* Checksum ok */ +#if 0 + printk("F:"); + for (i=0; i<16; i++) + printk("%.2x ",(unsigned char) SC14421_READ(i+memofs)); + + printk(" : %.2x : %x\n", irq, a); +#endif + + if ( (SC14421_READ(1+memofs) & 0xc0) == 0xc0) /* Checksum ok */ { struct sniffed_packet packet; -/* fixing indention / coding style is useless beyond here - * need to talk to krater about where to cut in functions - * - mazzoo */ - packet.rssi = - SC14421_READ(memofs); - packet.channel = - config->slottable[a].channel; + packet.rssi = SC14421_READ(memofs); + packet.bfok = ((SC14421_READ(1+memofs) & 0x03) == 0x03); + packet.channel = config->slottable[a].channel; packet.slot = a; - packet.framenumber = config->framenumber; - memcpy( - packet.data, - fppacket, - 5); - from_dip( - &packet.data[5], - sc14421_base+memofs+6, - 48); - - if (config->slottable[a].type == - DECT_SLOTTYPE_SCAN) - /* we received data on a scan-slot , channel is incemented before , but we want hear the old channel */ + memcpy(packet.data,fppacket,5); + + from_dip(&packet.data[5],sc14421_base+memofs+6, 48); + + if (config->slottable[a].type == DECT_SLOTTYPE_SCAN) + /* we received data on a scan-slot, + * channel is incemented before, + * but we want hear the old channel */ { packet.channel--; - printk("slot in scanmode\n"); + //printk("slot in scanmode\n"); } - if (dect_is_multiframe_number(packet.data)) /* if there was a multiframe number , then this packet was in frame 8 (0) */ + if (dect_is_multiframe_number(packet.data)) + /* if there was a multiframe number, + * then this packet was in frame 8 (0) */ { - /* printk("found multiframe number\n"); */ + //printk("found multiframe number\n"); config->framenumber = 1; } /* if (dev->open) */ { + if(config->framenumber) + packet.framenumber = config->framenumber-1; + else + packet.framenumber = 7; + packet.timestamp = dev->irq_timestamp; ret = kfifo_put(dev->rx_fifo, (unsigned char*) &packet, sizeof(struct sniffed_packet)); if (ret <= 0) @@ -559,7 +518,7 @@ void sniffer_sniff_sync_irq(struct coa_info *dev, int irq) -#if 0 +#if 0 printk("F:"); for (i=0; i<16; i++) printk("%.2x ", SC14421_READ(i+memofs)); @@ -573,7 +532,7 @@ void sniffer_sniff_sync_irq(struct coa_info *dev, int irq) { config->updateppslots = 1; config->updatefpslots = 1; - /* printk("new slot , must update slots\n"); */ + //printk("new slot , must update slots\n"); } } @@ -583,7 +542,7 @@ void sniffer_sniff_sync_irq(struct coa_info *dev, int irq) { config->updateppslots = 1; config->updatefpslots = 1; - printk("died slot , must update slots\n"); + //printk("1:died slot , must update slots\n"); } } } @@ -591,7 +550,7 @@ void sniffer_sniff_sync_irq(struct coa_info *dev, int irq) if ( (!(irq & 0x08)) && (config->updatefpslots) ) { - /* printk("patching fp slots\n"); */ + //printk("patching fp slots\n"); sniffer_sync_patchloop(dev, config->slottable, SNIFF_SLOTPATCH_FP); config->updatefpslots = 0; } @@ -618,22 +577,29 @@ void sniffer_sniff_sync_irq(struct coa_info *dev, int irq) struct sniffed_packet packet; packet.rssi = SC14421_READ(memofs); - /* FIXME DECT6.0 channels */ + packet.bfok = ((SC14421_READ(1+memofs) & 0x03) == 0x03); packet.channel = config->slottable[a].channel; packet.slot = a; - packet.framenumber = config->framenumber; memcpy(packet.data, pppacket, 5); from_dip(&packet.data[5], sc14421_base+memofs+6, 48); if (config->slottable[a].type == DECT_SLOTTYPE_SCAN) { packet.channel--; - printk("slot in scanmode\n"); + //printk("slot in scanmode\n"); } /* if (dev->open) */ { + if(config->framenumber) + packet.framenumber = config->framenumber-1; + else + packet.framenumber = 7; + packet.timestamp = dev->irq_timestamp; - ret = kfifo_put(dev->rx_fifo, (unsigned char*) &packet, sizeof(struct sniffed_packet)); + ret = kfifo_put( + dev->rx_fifo, + (unsigned char*) &packet, + sizeof(struct sniffed_packet)); if (ret <= 0) { printk("com_on_air_cs: rx fifo full? kfifo_put() = %d\n", ret); @@ -656,7 +622,7 @@ void sniffer_sniff_sync_irq(struct coa_info *dev, int irq) { config->updateppslots = 1; config->updatefpslots = 1; - /* printk("new slot , must update slots\n"); */ + //printk("new slot , must update slots\n"); } } @@ -666,7 +632,7 @@ void sniffer_sniff_sync_irq(struct coa_info *dev, int irq) { config->updateppslots = 1; config->updatefpslots = 1; - /* printk("died slot , must update slots\n"); */ + //printk("8:died slot , must update slots\n"); } } @@ -676,7 +642,7 @@ void sniffer_sniff_sync_irq(struct coa_info *dev, int irq) if ( (!(irq & 0x01)) && (config->updateppslots) ) { - /* printk("patching pp slots\n"); */ + //printk("patching pp slots\n"); sniffer_sync_patchloop(dev, config->slottable, SNIFF_SLOTPATCH_PP); config->updateppslots = 0; } @@ -685,7 +651,7 @@ void sniffer_sniff_sync_irq(struct coa_info *dev, int irq) { config->updateppslots = 1; config->updatefpslots = 1; - /* printk("new slot , must update slots\n"); */ + //printk("new slot , must update slots\n"); } if (config->framenumber >= 7) @@ -707,12 +673,17 @@ void sniffer_sync_patchloop(struct coa_info *dev, struct dect_slot_info *slottab struct sniffer_cfg *config = dev->sniffer_config; int memofs; - if (type == SNIFF_SLOTPATCH_PP) offset = 12; for (slot = offset; slot < (offset+12); slot++) { + + if ( (slot/2) % 2) + memofs = 0x80; + else + memofs = 0x00; + if (slottable[slot].update) { slottable[slot].update = 0; @@ -731,46 +702,34 @@ void sniffer_sync_patchloop(struct coa_info *dev, struct dect_slot_info *slottab if (slottable[slot].active) { - set_channel(dev, slottable[slot].channel); - - if (slot > 11) - sync_init5[0] &= 0xFE; - else - sync_init5[0] |= 0x01; - - if ( (slot/2) % 2) - memofs = 0x80; - else - memofs = 0x00; - - sync_init5[6] = config->framenumber%8; - - SC14421_switch_to_bank(sc14421_base, sync_banktable[slot]); + set_channel(dev,slottable[slot].channel,slot,config->framenumber%8,0,sync_banktable[slot]); - to_dip(sc14421_base + 0x4A + memofs, radio_II_chan, ARRAY_SIZE(radio_II_chan)); - to_dip(sc14421_base + 0x58 + memofs, sync_init5, ARRAY_SIZE(sync_init5)); - to_dip(sc14421_base + 0x50 + memofs, sync_init4, ARRAY_SIZE(sync_init4)); - - - /* printk("patching slot %u at addr %u\n", slot, sync_patchtable[slot]); */ + // printk("patching slot %u at addr %u\n", slot, sync_patchtable[slot]); SC14421_switch_to_bank(sc14421_base, SC14421_CODEBANK); - SC14421_write_cmd(sc14421_base, sync_patchtable[slot], JMP, sync_label_28); - } - else - { + switch(dev->radio_type) + { + case COA_RADIO_TYPE_II: + /* printk(" for type II\n"); */ + SC14421_write_cmd(sc14421_base, sync_patchtable[slot], JMP, RecvII); + break; + case COA_RADIO_TYPE_III: + /* printk(" for type III\n"); */ + SC14421_write_cmd(sc14421_base, sync_patchtable[slot], JMP, RecvIII); + break; + default: + printk("ERROR: this radio type is currently not " + "supported. please update the driver\n"); + } + + }else{ SC14421_switch_to_bank(sc14421_base, SC14421_CODEBANK); SC14421_write_cmd(sc14421_base, sync_patchtable[slot], WNT, 2); - /* printk("patching addr %u for wait\n", sync_patchtable[slot]); */ + // printk("patching addr %u for wait\n", sync_patchtable[slot]); } } else if (slottable[slot].active && (slottable[slot].type == DECT_SLOTTYPE_CARRIER)) { - if ( (slot/2) % 2) - memofs = 0x80; - else - memofs = 0x00; - SC14421_switch_to_bank(sc14421_base, sync_banktable[slot]); SC14421_WRITE(0x5e + memofs, config->framenumber%8); } @@ -789,3 +748,8 @@ void sniffer_clear_slottable(struct dect_slot_info *slottable) } + + + + + |