summaryrefslogtreecommitdiffstats
path: root/com-on-air_cs-linux/sc14421_sniffer.c
blob: d3259160239a654a0165b19293e904d221fa27af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
/*
 * com_on_air_cs - basic driver for the Dosch and Amand "com on air" cards
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * authors:
 * (C) 2008  Andreas Schuler <krater at badterrorist dot com>
 * (C) 2008  Matthias Wenzel <dect at mazzoo dot de>
 *
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/kfifo.h>

#include "sc14421.h"
#include "dip_opcodes.h"
#include "com_on_air.h"
#include "sc14421_sniffer.h"
#include "sc14421_firmware.h"
#include "dect.h"


/* 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};

/* 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};

/* hf register */
unsigned char scan_init4[] = {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 fppacket[53] = {0xAA,0xAA,0xAA,0xE9,0x8A};
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
};
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
};
/* FIXME:end */

int sync_banktable[] = {
	SC14421_RAMBANK1,
	SC14421_RAMBANK1,
	SC14421_RAMBANK1,
	SC14421_RAMBANK1,
	SC14421_RAMBANK2,
	SC14421_RAMBANK2,
	SC14421_RAMBANK2,
	SC14421_RAMBANK2,
	SC14421_RAMBANK3,
	SC14421_RAMBANK3,
	SC14421_RAMBANK3,
	SC14421_RAMBANK3,
	SC14421_RAMBANK4,
	SC14421_RAMBANK4,
	SC14421_RAMBANK4,
	SC14421_RAMBANK4,
	SC14421_RAMBANK5,
	SC14421_RAMBANK5,
	SC14421_RAMBANK5,
	SC14421_RAMBANK5,
	SC14421_RAMBANK6,
	SC14421_RAMBANK6,
	SC14421_RAMBANK6,
	SC14421_RAMBANK6
};


void sniffer_init(struct coa_info *dev)
{
	int ret;

	SC14421_switch_to_bank(
		dev->sc14421_base,
		SC14421_DIPSTOPPED | SC14421_CODEBANK
		);

	ret = SC14421_check_RAM(dev->sc14421_base);
	if (ret)
		printk("Found %u memory r/w errors \n\n", ret);

	switch(dev->sniffer_config->snifftype)
	{
		case SNIFF_SCANFP:
		case SNIFF_SCANPP:
			sniffer_init_sniff_scan(dev);
			break;
		case SNIFF_SYNC:
			sniffer_init_sniff_sync(dev);
			break;
	}
}

void set_channel(struct coa_info *dev, int ch)
{
	int channel;
	if (ch<10)
		channel = 10 - ch;
	else
		channel = ch;

	switch(dev->radio_type)
	{
	case COA_RADIO_TYPE_II:
		radio_II_chan[0] =
			(radio_II_chan[0] & 0xC1) |
			(channel << 1);
		break;
	default:
		printk("ERROR: this radio type is currently not "
			"supported. please update the driver\n");
	}
}

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);

	set_channel(dev, dev->sniffer_config->channel);

	if (dev->sniffer_config->snifftype == SNIFF_SCANPP)
	{
		scan_init1[0] &= 0xFE;
		scan_init5[0] &= 0xFE;
	}
	else
	{
		scan_init1[0] |= 0x01;
		scan_init5[0] |= 0x01;
	}

	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("starting dip\n"); */
	SC14421_switch_to_bank(sc14421_base, SC14421_RAMBANK0);

}


void sniffer_init_sniff_sync(struct coa_info *dev)
{
	volatile uint16_t *sc14421_base = dev->sc14421_base;

	printk("loading sniff_sync firmware\n");

	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));

	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)
		);

	dev->sniffer_config->status = 0;
	sniffer_clear_slottable(dev->sniffer_config->slottable);


	printk("starting dip\n");
	SC14421_switch_to_bank(sc14421_base, SC14421_RAMBANK0);

}

uint8_t sniffer_irq_handler(struct coa_info *dev)
{
	uint8_t irq = 0;

	if (dev->sc14421_base)
	{
		irq = SC14421_clear_interrupt(dev->sc14421_base);

		switch(dev->sniffer_config->snifftype)
		{
			case SNIFF_SCANFP:
			case SNIFF_SCANPP:
				sniffer_sniff_scan_irq(dev, irq);
				break;
			case SNIFF_SYNC:
				sniffer_sniff_sync_irq(dev, irq);
				break;
		}
	}
	return irq;
}

void sniffer_sniff_scan_irq(struct coa_info *dev, int irq)
{
	volatile uint16_t *sc14421_base = dev->sc14421_base;
	int ret;
	uint8_t station[7];

	if (dev->open)
	{
		SC14421_switch_to_bank(sc14421_base, SC14421_RAMBANK1);

		if ( (SC14421_READ(1) & 0xc0) == 0xc0) /* Checksum ok */
		{
			uint8_t rssi = SC14421_READ(0);
			from_dip(
				fppacket + 5,
				sc14421_base + 6,
				6);

			SC14421_WRITE(1, 0); /* Clear Checksum-Flag */

			if (dect_is_RFPI_Packet(fppacket))
			{

				station[0] = dev->sniffer_config->channel;
				station[1] = rssi;
				memcpy(&station[2], &fppacket[6], 5); /* RFPI */

				ret = kfifo_put(dev->rx_fifo, station, 7);
				if (ret <= 0)
				{
					printk("com_on_air_cs: rx fifo full? "
						"kfifo_put() = %d\n", ret);
				}
			}
		}
	}
}

void sniffer_sniff_sync_irq(struct coa_info *dev, int irq)
{
	volatile uint16_t *sc14421_base = dev->sc14421_base;
	struct sniffer_cfg *config = dev->sniffer_config;
	struct sniffed_packet packet;
	int ret;
	int slot;
	int a;
	int memofs;

	SC14421_switch_to_bank(sc14421_base, SC14421_RAMBANK1);


	if (!(config->status & SNIFF_STATUS_FOUNDSTATION))
	{
		if (irq & 0x01)
		{
#if 0
			printk("N:");
			for (r=0; r<16; r++)
				printk("%.2x ", SC14421_READ(r));

			printk("\n");
#endif
			if ( (SC14421_READ(1) & 0xc0) == 0xc0) /* Checksum ok */
			{
				SC14421_WRITE(1, 0); /* clear checksum flag */

				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
						);
				}
			}
		}
	}
	else if (!(config->status & SNIFF_STATUS_INSYNC))
	{
		if (irq & 0x01)
		{

#if 0
			printk("S:");	
			for (i=0; i<16; i++)
				printk("%.2x ", SC14421_READ(i));
			printk("\n");
#endif
			if ( (SC14421_READ(1) & 0xc0) == 0xc0) /* Checksum ok */
			{
				SC14421_WRITE(1, 0); /* clear checksum flag */
				from_dip(
					fppacket + 5,
					sc14421_base + 6,
					48);

				slot = dect_get_slot(fppacket);
				if (slot != -1)
				{
					/* 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");

					config->slottable[slot].active = 1;
					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]
						);

					printk("we are in sync :)\n");



					packet.rssi = SC14421_READ(0x00);
					packet.channel = config->channel;
					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));
					if (ret <= 0)
						printk("com_on_air_cs: rx fifo "
							"full? kfifo_put() "
							"= %d\n", ret);
				}
			}
		}
	}
	else
	{
		if ( (irq & 0x09) == 0x09)
			printk("interrupt too slow , lost packets!\n");

		if (irq & 0x01)
		{

			for (a=0; a<12; a++)
			{
				if (config->slottable[a].active)
				{
					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 */
					{
						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.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 */
						{
							packet.channel--;
							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) */
						{
							/* printk("found multiframe number\n");						 */
							config->framenumber = 1;
						}

						/* if (dev->open) */
						{
							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() = %d\n", ret);
							}
						}



#if 0 
						printk("F:");
			        		for (i=0; i<16; i++)
			        		        printk("%.2x ", SC14421_READ(i+memofs));

			        		printk("  : %.2x : %x\n", irq, a);
#endif
						SC14421_WRITE(1+memofs, 0);	/* clear checksum flag */


						if (dect_update_slottable(config->slottable, a, packet.data))
						{
							config->updateppslots = 1;
							config->updatefpslots = 1;
							/* printk("new slot , must update slots\n"); */
						}

					}
					else
					{
						if (dect_receive_error(config->slottable, a))
						{
							config->updateppslots = 1;
							config->updatefpslots = 1;
							printk("died slot , must update slots\n");
						}
					}
				}
			}

			if ( (!(irq & 0x08)) && (config->updatefpslots) )
			{
				/* printk("patching fp slots\n"); */
				sniffer_sync_patchloop(dev, config->slottable, SNIFF_SLOTPATCH_FP);
				config->updatefpslots = 0;
			}

		}

		if (irq & 0x08)
		{

			for (a=12; a<24; a++)
			{
				if (config->slottable[a].active)
				{

					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 */
					{
						struct sniffed_packet packet;

						packet.rssi = SC14421_READ(memofs);
						/* FIXME DECT6.0 channels */
						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");
						}

						/* if (dev->open) */
						{
							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() = %d\n", ret);
							}
						}


#if 0
						printk("F:");
			        		for (i=0; i<16; i++)
			        		        printk("%.2x ", SC14421_READ(i+memofs));

			        		printk("  : %.2x : %x\n", irq, a);
#endif

						SC14421_WRITE(1+memofs, 0);	/* clear checksum flag */


						if (dect_update_slottable(config->slottable, a, packet.data))
						{
							config->updateppslots = 1;
							config->updatefpslots = 1;
							/* printk("new slot , must update slots\n"); */
						}

					}
					else
					{
						if (dect_receive_error(config->slottable, a))
						{
							config->updateppslots = 1;
							config->updatefpslots = 1;
							/* printk("died slot , must update slots\n"); */
						}
					}

				}

			}

			if ( (!(irq & 0x01)) && (config->updateppslots) )
			{
				/* printk("patching pp slots\n"); */
				sniffer_sync_patchloop(dev, config->slottable, SNIFF_SLOTPATCH_PP);
				config->updateppslots = 0;
			}

			if (dect_update_scanchannels(config->slottable))
			{
				config->updateppslots = 1;
				config->updatefpslots = 1;
				/* printk("new slot , must update slots\n"); */
			}

			if (config->framenumber >= 7)
				config->framenumber = 0;
			else
				config->framenumber++;
		}

	}
}


void sniffer_sync_patchloop(struct coa_info *dev, struct dect_slot_info *slottable, int type)
{
	static int fixme_count = 23;

	int slot, offset = 0;
	volatile uint16_t *sc14421_base = dev->sc14421_base;
	struct sniffer_cfg *config = dev->sniffer_config;
	int memofs;


	if (type == SNIFF_SLOTPATCH_PP)
		offset = 12;

	for (slot = offset; slot < (offset+12); slot++)
	{
		if (slottable[slot].update)
		{
			slottable[slot].update = 0;

			if (slottable[slot].active && (slot%2))
			{
				if (fixme_count)
				{
					fixme_count--;
					printk("can't use slot %u with this firmware !\n", slot);
				}
				continue;
			}


			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]);

				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]); */
				SC14421_switch_to_bank(sc14421_base, SC14421_CODEBANK);
				SC14421_write_cmd(sc14421_base, sync_patchtable[slot], JMP, sync_label_28);

			}
			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]); */
			}
		}
		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);
		}
	}
}


void sniffer_clear_slottable(struct dect_slot_info *slottable)
{
	int i;
	for (i=0; i<24; i++)
	{
		slottable[i].active = 0;
		slottable[i].update = 1;
	}
}