forked from wigewige/nvp6114-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoax_protocol.c
803 lines (667 loc) · 24.4 KB
/
coax_protocol.c
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
792
793
794
795
796
797
798
799
800
801
802
803
/*************************************************************************
Project : AWB Mapping One Block Program
File Name: nvp1104.c
Compiler: AVR IAR Compiler
Author : NEXTCHIP(c) cshong
Data : 2008.04.25
Version : 1.00
Dicription
----------------------------------------------------------
Copyright(c) 2001 by Black_List All Rights Reserved
**************************************************************************
Header file include
**************************************************************************/
#include <linux/kernel.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/fcntl.h>
#include <linux/mm.h>
#include <linux/miscdevice.h>
#include <linux/proc_fs.h>
#include <linux/fs.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <asm/uaccess.h>
#include <asm/io.h>
#include <asm/system.h>
#include <linux/interrupt.h>
#include <linux/ioport.h>
#include <linux/string.h>
#include <linux/list.h>
#include <asm/delay.h>
#include <linux/timer.h>
#include <linux/delay.h>
#include <linux/proc_fs.h>
#include <linux/poll.h>
#include <asm/bitops.h>
#include <asm/uaccess.h>
#include <asm/irq.h>
#include <linux/moduleparam.h>
#include <linux/ioport.h>
#include <linux/interrupt.h>
#include "gpio_i2c.h"
#include "common.h"
/*************************************************************************
Global Variables Definition
*************************************************************************/
unsigned char g_system = 1;
/*************************************************************************
SAMSUNG PROTOCOL Regiter set value Definition
*************************************************************************/
// 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0A 0x0B 0x0C 0x0D 0x0E 0x0F
unsigned char SAM_SET_Buf[] ={ /*1*/ 0xAA,0x1C,0x18,0xFF,0xAA,0x3C,0xFF,0xFF,0xAA,0x1B,0x00,0x00,0xAA,0x3B,0x00,0x00 };
unsigned char SAM_OSD_Buf[] ={ /*1*/ 0xAA,0x1C,0x17,0x01,0xAA,0x3C,0xFF,0xFF,0xAA,0x1B,0x00,0x00,0xAA,0x3B,0x00,0x00 };
unsigned char SAM_UP_Buf[] ={ /*1*/ 0xAA,0x1C,0x03,0xFF,0xAA,0x3C,0xFF,0xFF,0xAA,0x1B,0x00,0x00,0xAA,0x3B,0x00,0x00 };
unsigned char SAM_DOWN_Buf[] ={ /*1*/ 0xAA,0x1C,0x09,0xFF,0xAA,0x3C,0xFF,0xFF,0xAA,0x1B,0x00,0x00,0xAA,0x3B,0x00,0x00 };
unsigned char SAM_LEFT_Buf[] ={ /*1*/ 0xAA,0x1C,0x05,0xFF,0xAA,0x3C,0xFF,0xFF,0xAA,0x1B,0x00,0x00,0xAA,0x3B,0x00,0x00 };
unsigned char SAM_RIGHT_Buf[] ={ /*1*/ 0xAA,0x1C,0x07,0xFF,0xAA,0x3C,0xFF,0xFF,0xAA,0x1B,0x00,0x00,0xAA,0x3B,0x00,0x00 };
unsigned char SAM_PTZ_UP_Buf[] ={ /*1*/ 0xAA,0x1B,0x00,0x04,0xAA,0x3B,0x00,0x1F,0xAA,0x1B,0x00,0x00,0xAA,0x3B,0x00,0x00 };
unsigned char SAM_PTZ_DOWN_Buf[] ={ /*1*/ 0xAA,0x1B,0x00,0x08,0xAA,0x3B,0x00,0x1F,0xAA,0x1B,0x00,0x00,0xAA,0x3B,0x00,0x00 };
unsigned char SAM_PTZ_LEFT_Buf[] ={ /*1*/ 0xAA,0x1B,0x00,0x01,0xAA,0x3B,0x1F,0x00,0xAA,0x1B,0x00,0x00,0xAA,0x3B,0x00,0x00 };
unsigned char SAM_PTZ_RIGHT_Buf[] ={ /*1*/ 0xAA,0x1B,0x00,0x02,0xAA,0x3B,0x1F,0x00,0xAA,0x1B,0x00,0x00,0xAA,0x3B,0x00,0x00 };
unsigned char SAM_IRIS_OPEN_Buf[] ={ /*1*/ 0xAA,0x1B,0x08,0x00,0xAA,0x3B,0x00,0x00,0xAA,0x1B,0x00,0x00,0xAA,0x3B,0x00,0x00 };
unsigned char SAM_IRIS_CLOSE_Buf[] ={ /*1*/ 0xAA,0x1B,0x10,0x00,0xAA,0x3B,0x00,0x00,0xAA,0x1B,0x00,0x00,0xAA,0x3B,0x00,0x00 };
unsigned char SAM_FOCUS_NEAR_Buf[] ={ /*1*/ 0xAA,0x1B,0x02,0x00,0xAA,0x3B,0x00,0x00,0xAA,0x1B,0x00,0x00,0xAA,0x3B,0x00,0x00 };
unsigned char SAM_FOCUS_FAR_Buf[] ={ /*1*/ 0xAA,0x1B,0x01,0x00,0xAA,0x3B,0x00,0x00,0xAA,0x1B,0x00,0x00,0xAA,0x3B,0x00,0x00 };
unsigned char SAM_ZOOM_WIDE_Buf[] ={ /*1*/ 0xAA,0x1B,0x40,0x00,0xAA,0x3B,0x00,0x00,0xAA,0x1B,0x00,0x00,0xAA,0x3B,0x00,0x00 };
unsigned char SAM_ZOOM_TELE_Buf[] ={ /*1*/ 0xAA,0x1B,0x20,0x00,0xAA,0x3B,0x00,0x00,0xAA,0x1B,0x00,0x00,0xAA,0x3B,0x00,0x00 };
unsigned char SAM_SCAN_1SR_Buf[] ={ /*1*/ 0xAA,0x1C,0x13,0x01,0xAA,0x3C,0x01,0x00,0xAA,0x1B,0x00,0x00,0xAA,0x3B,0x00,0x00 };
unsigned char SAM_SCAN_1ST_Buf[] ={ /*1*/ 0xAA,0x1C,0x13,0x00,0xAA,0x3C,0x01,0x00,0xAA,0x1B,0x00,0x00,0xAA,0x3B,0x00,0x00 };
unsigned char SAM_PRESET1_Buf[] ={ /*1*/ 0xAA,0x1C,0x19,0x01,0xAA,0x3C,0x00,0x00,0xAA,0x1B,0x00,0x00,0xAA,0x3B,0x00,0x00 };
unsigned char SAM_PRESET2_Buf[] ={ /*1*/ 0xAA,0x1C,0x19,0x02,0xAA,0x3C,0x00,0x00,0xAA,0x1B,0x00,0x00,0xAA,0x3B,0x00,0x00 };
unsigned char SAM_PRESET3_Buf[] ={ /*1*/ 0xAA,0x1C,0x19,0x03,0xAA,0x3C,0x00,0x00,0xAA,0x1B,0x00,0x00,0xAA,0x3B,0x00,0x00 };
unsigned char SAM_PATTERN_1SR_Buf[] ={ /*1*/ 0xAA,0x1C,0x1B,0x01,0xAA,0x3C,0x01,0x00,0xAA,0x1B,0x00,0x00,0xAA,0x3B,0x00,0x00 };
unsigned char SAM_PATTERN_1ST_Buf[] ={ /*1*/ 0xAA,0x1C,0x1B,0x01,0xAA,0x3C,0x00,0x00,0xAA,0x1B,0x00,0x00,0xAA,0x3B,0x00,0x00 };
unsigned char SAM_PATTERN_2SR_Buf[] ={ /*1*/ 0xAA,0x1C,0x1B,0x02,0xAA,0x3C,0x01,0x00,0xAA,0x1B,0x00,0x00,0xAA,0x3B,0x00,0x00 };
unsigned char SAM_PATTERN_2ST_Buf[] ={ /*1*/ 0xAA,0x1C,0x1B,0x02,0xAA,0x3C,0x00,0x00,0xAA,0x1B,0x00,0x00,0xAA,0x3B,0x00,0x00 };
unsigned char SAM_PATTERN_3SR_Buf[] ={ /*1*/ 0xAA,0x1C,0x1B,0x03,0xAA,0x3C,0x01,0x00,0xAA,0x1B,0x00,0x00,0xAA,0x3B,0x00,0x00 };
unsigned char SAM_PATTERN_3ST_Buf[] ={ /*1*/ 0xAA,0x1C,0x1B,0x03,0xAA,0x3C,0x00,0x00,0xAA,0x1B,0x00,0x00,0xAA,0x3B,0x00,0x00 };
/**************************************************************************
Function prototype
**************************************************************************/
void init_OCTOPUS_CTRL( void );
void pelco_reset( void );
void pelco_set( void );
void pelco_up( void );
void pelco_down( void );
void pelco_left( void );
void pelco_right( void );
void pelco_osd( void );
void pelco_iris_open( void );
void pelco_iris_close( void );
void pelco_focus_near( void );
void pelco_focus_far( void );
void pelco_zoom_wide( void );
void pelco_zoom_tele( void );
void pelco_scan_1_sr( void );
void pelco_scan_1_st( void );
void pelco_preset_1( void );
void pelco_preset_2( void );
void pelco_preset_3( void );
void pelco_pattern_1_sr( void );
void pelco_pattern_1_st( void );
void pelco_pattern_2_sr( void );
void pelco_pattern_2_st( void );
void pelco_pattern_3_sr( void );
void pelco_pattern_3_st( void );
void pelco_pattern_run( void );
void samsung_clk_set( void );
void samsung_set( void );
void samsung_up( void );
void samsung_down( void );
void samsung_left( void );
void samsung_right( void );
void samsung_osd( void );
void samsung_ptz_up( void );
void samsung_ptz_down( void );
void samsung_ptz_left( void );
void samsung_ptz_right( void );
void samsung_iris_open( void );
void samsung_iris_close( void );
void samsung_focus_near( void );
void samsung_focus_far( void );
void samsung_zoom_wide( void );
void samsung_zoom_tele( void );
void samsung_scan_1_sr( void );
void samsung_scan_1_st( void );
void samsung_preset_1( void );
void samsung_preset_2( void );
void samsung_preset_3( void );
void samsung_pattern_1_sr( void );
void samsung_pattern_1_st( void );
void samsung_pattern_2_sr( void );
void samsung_pattern_2_st( void );
void samsung_pattern_3_sr( void );
void samsung_pattern_3_st( void );
extern void vdec_write_table(unsigned char chip_addr, unsigned char addr, unsigned char *tbl_ptr, unsigned char tbl_cnt);
void vdec_coaxial_select_ch(unsigned int ch)
{
int i = 0;
gpio_i2c_write( NVP6114+i, 0xFF, 0x01);
gpio_i2c_write( NVP6114+i, 0x8B, ch);
}
void vdec_coaxial_init(void)
{
int i = 0;
gpio_i2c_write( NVP6114+i, 0xFF, 0x01);
gpio_i2c_write( NVP6114+i, 0xBC, 0xDD);
gpio_i2c_write( NVP6114+i, 0xBD, 0xDD);
gpio_i2c_write( NVP6114+i, 0xBE, 0xDD);
gpio_i2c_write( NVP6114+i, 0xBF, 0xDD);
//gpio_i2c_write( NVP6114+i, 0x8B, 0x00);
}
void pelco_coax_mode( void )
{
gpio_i2c_write( FPGA_AFE, 0xFF, 0x01 );
gpio_i2c_write( FPGA_AFE, COAX_BAUD, 0x37 );
gpio_i2c_write( FPGA_AFE, BL_HSP01, 0x46 );
gpio_i2c_write( FPGA_AFE, PACKET_MODE, 0x06 );
gpio_i2c_write( FPGA_AFE, PEL_CTEN, 0x00 );
gpio_i2c_write( FPGA_AFE, HSO_INV, 0x01 );
gpio_i2c_write( FPGA_AFE, EVEN_LINE, 0x01 );
gpio_i2c_write( FPGA_AFE, PEL_TXST1, 0x09 ); //tony 11.26
printk("Pelco 32bit mode\n");
}
void pelco_reset( void )
{
msleep( 20 );
gpio_i2c_write( FPGA_AFE, 0xFF, 0x01 );
gpio_i2c_write( FPGA_AFE, PEL_D0, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D1, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D2, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D3, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x01 );
msleep( 300 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x00 );
msleep( 20 );
}
void pelco_set(void)
{
pelco_reset();
gpio_i2c_write( FPGA_AFE, PEL_D0, 0x40 );
gpio_i2c_write( FPGA_AFE, PEL_D1, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D2, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D3, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x01 );
msleep( 300 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x00 );
printk("Camera Setting mode\n");
}
void pelco_up(void)
{
pelco_reset();
gpio_i2c_write( FPGA_AFE, PEL_D0, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D1, 0x10 ); // PELCO_DATA_02 FIRST
gpio_i2c_write( FPGA_AFE, PEL_D2, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D3, 0x4C );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x01 );
msleep( 300 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x00 );
printk("Camera Up moving mode\n");
}
void pelco_down(void)
{
pelco_reset();
gpio_i2c_write( FPGA_AFE, PEL_D0, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D1, 0x08 );
gpio_i2c_write( FPGA_AFE, PEL_D2, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D3, 0x4C );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x01 );
msleep( 300 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x00 );
printk("Camera Down moving mode\n");
}
void pelco_left(void)
{
pelco_reset();
gpio_i2c_write( FPGA_AFE, PEL_D0, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D1, 0x20 );
gpio_i2c_write( FPGA_AFE, PEL_D2, 0x4C );
gpio_i2c_write( FPGA_AFE, PEL_D3, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x01 );
msleep( 300 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x00 );
printk("Camera Left moving mode\n");
}
void pelco_right(void)
{
pelco_reset();
gpio_i2c_write( FPGA_AFE, PEL_D0, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D1, 0x40 );
gpio_i2c_write( FPGA_AFE, PEL_D2, 0x4C );
gpio_i2c_write( FPGA_AFE, PEL_D3, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x01 );
msleep( 300 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x00 );
printk("Camera Right moving mode\n");
}
void pelco_osd(void)
{
pelco_reset();
gpio_i2c_write( FPGA_AFE, PEL_D0, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D1, 0xC0 );
gpio_i2c_write( FPGA_AFE, PEL_D2, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D3, 0xFA );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x01 );
msleep( 300 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x00 );
printk("PELCO OSD ON mode\n");
}
void pelco_iris_open( void )
{
pelco_reset();
gpio_i2c_write( FPGA_AFE, PEL_D0, 0x40 );
gpio_i2c_write( FPGA_AFE, PEL_D1, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D2, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D3, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x01 );
msleep( 300 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x00 );
printk("PELCO IRIS OPEN mode\n");
}
void pelco_iris_close( void )
{
pelco_reset();
gpio_i2c_write( FPGA_AFE, PEL_D0, 0x20 );
gpio_i2c_write( FPGA_AFE, PEL_D1, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D2, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D3, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x01 );
msleep( 300 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x00 );
printk("PELCO IRIS CLOSE mode\n");
}
void pelco_focus_near( void )
{
pelco_reset();
gpio_i2c_write( FPGA_AFE, PEL_D0, 0x80 );
gpio_i2c_write( FPGA_AFE, PEL_D1, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D2, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D3, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x01 );
msleep( 300 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x00 );
printk("PELCO FOCUS NEAR mode\n");
}
void pelco_focus_far( void )
{
pelco_reset();
gpio_i2c_write( FPGA_AFE, PEL_D0, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D1, 0x01 );
gpio_i2c_write( FPGA_AFE, PEL_D2, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D3, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x01 );
msleep( 300 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x00 );
printk("PELCO FOCUS FAR mode\n");
}
void pelco_zoom_wide( void )
{
pelco_reset();
gpio_i2c_write( FPGA_AFE, PEL_D0, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D1, 0x02 );
gpio_i2c_write( FPGA_AFE, PEL_D2, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D3, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x01 );
msleep( 300 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x00 );
printk("PELCO ZOOM WIDE mode\n");
}
void pelco_zoom_tele( void )
{
pelco_reset();
gpio_i2c_write( FPGA_AFE, PEL_D0, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D1, 0x04 );
gpio_i2c_write( FPGA_AFE, PEL_D2, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D3, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x01 );
msleep( 300 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x00 );
printk("PELCO ZOOM TELE mode\n");
}
void pelco_scan_1_sr( void )
{
pelco_reset();
gpio_i2c_write( FPGA_AFE, PEL_D0, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D1, 0xE0 );
gpio_i2c_write( FPGA_AFE, PEL_D2, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D3, 0x46 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x01 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x00 );
printk("PELCO SCAN 1 SR mode\n");
}
void pelco_scan_1_st( void )
{
pelco_reset();
gpio_i2c_write( FPGA_AFE, PEL_D0, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D1, 0xE0 );
gpio_i2c_write( FPGA_AFE, PEL_D2, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D3, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x01 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x00 );
printk("PELCO SCAN 1 ST mode\n");
}
void pelco_preset_1( void )
{
pelco_reset();
gpio_i2c_write( FPGA_AFE, PEL_D0, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D1, 0xE0 );
gpio_i2c_write( FPGA_AFE, PEL_D2, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D3, 0x80 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x01 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x00 );
printk("PELCO PRESET 1 mode\n");
}
void pelco_preset_2( void )
{
pelco_reset();
gpio_i2c_write( FPGA_AFE, PEL_D0, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D1, 0xE0 );
gpio_i2c_write( FPGA_AFE, PEL_D2, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D3, 0x40 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x01 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x00 );
printk("\r\nPELCO PRESET 2 mode ");
}
void pelco_preset_3( void )
{
pelco_reset();
gpio_i2c_write( FPGA_AFE, PEL_D0, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D1, 0xE0 );
gpio_i2c_write( FPGA_AFE, PEL_D2, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D3, 0xC0 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x01 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x00 );
printk("PELCO PRESET 3 mode\n");
}
void pelco_pattern_1_sr( void )
{
pelco_reset();
gpio_i2c_write( FPGA_AFE, PEL_D0, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D1, 0xF8 );
gpio_i2c_write( FPGA_AFE, PEL_D2, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D3, 0x01 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x01 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x00 );
printk("PELCO PATTERN 1 SR mode\n");
}
void pelco_pattern_1_st( void )
{
pelco_reset();
gpio_i2c_write( FPGA_AFE, PEL_D0, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D1, 0x84 );
gpio_i2c_write( FPGA_AFE, PEL_D2, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D3, 0x01 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x01 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x00 );
printk("PELCO PATTERN 1 ST mode\n");
}
void pelco_pattern_2_sr( void )
{
pelco_reset();
gpio_i2c_write( FPGA_AFE, PEL_D0, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D1, 0xF8 );
gpio_i2c_write( FPGA_AFE, PEL_D2, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D3, 0x02 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x01 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x00 );
printk("PELCO PATTERN 2 SR mode\n");
}
void pelco_pattern_2_st( void )
{
pelco_reset();
gpio_i2c_write( FPGA_AFE, PEL_D0, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D1, 0x84 );
gpio_i2c_write( FPGA_AFE, PEL_D2, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D3, 0x02 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x01 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x00 );
printk("PELCO PATTERN 2 ST mode\n");
}
void pelco_pattern_3_sr( void )
{
pelco_reset();
gpio_i2c_write( FPGA_AFE, PEL_D0, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D1, 0xF8 );
gpio_i2c_write( FPGA_AFE, PEL_D2, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D3, 0x03 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x01 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x00 );
printk("PELCO PATTERN 3 SR mode\n");
}
void pelco_pattern_3_st( void )
{
pelco_reset();
gpio_i2c_write( FPGA_AFE, PEL_D0, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D1, 0x84 );
gpio_i2c_write( FPGA_AFE, PEL_D2, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D3, 0x03 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x01 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x00 );
printk("PELCO PATTERN 3 ST mode\n");
}
void pelco_pattern_run( void )
{
pelco_reset();
gpio_i2c_write( FPGA_AFE, PEL_D0, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D1, 0xC4 );
gpio_i2c_write( FPGA_AFE, PEL_D2, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_D3, 0x00 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x01 );
gpio_i2c_write( FPGA_AFE, PEL_OUT, 0x00 );
printk("PELCO PATTERN RUN mode\n");
}
void samsung_coax_mode( void )
{
gpio_i2c_write( FPGA_AFE, 0xFF, 0x01 );
gpio_i2c_write( FPGA_AFE, COAX_BAUD, 0x37 );
gpio_i2c_write( FPGA_AFE, BL_HSP01, 0x46 );
gpio_i2c_write( FPGA_AFE, TX_START, 0x00 );
gpio_i2c_write( FPGA_AFE, TX_BYTE_LEN, 0x08 ); // 2Line mode
gpio_i2c_write( FPGA_AFE, PACKET_MODE, 0x00 );
// Video format select
gpio_i2c_write( FPGA_AFE, BL_TXST1, g_system? 0x06 : 0x05 ); // TX Line
gpio_i2c_write( FPGA_AFE, BL_RXST1, g_system? 0x08 : 0x07 ); // RX Line
gpio_i2c_write( FPGA_AFE, COAX_BAUD, g_system? 0x23 : 0x37 ); // TX Duty rate
gpio_i2c_write( FPGA_AFE, COAX_RBAUD, g_system? 0x23 : 0x37 ); // TX Duty rate
gpio_i2c_write( FPGA_AFE, EVEN_LINE, 0x01 );
printk("Samsung 2 line mode\n") ;
}
void samsung_clk_set( void )
{
gpio_i2c_write( FPGA_AFE, 0xFF, 0x01 );
gpio_i2c_write( FPGA_AFE, SAM_OUT, 0x01 );
gpio_i2c_write( FPGA_AFE, SAM_OUT, 0x00);
msleep( 200 );
}
void samsung_set( void )
{
gpio_i2c_write( FPGA_AFE, 0xFF, 0x01 );
vdec_write_table(FPGA_AFE, SAM_D0, SAM_SET_Buf, 16);
samsung_clk_set();
printk("***samsung ENTER mode ***\n");
}
void samsung_up( void )
{
gpio_i2c_write( FPGA_AFE, 0xFF, 0x01 );
vdec_write_table(FPGA_AFE, SAM_D0, SAM_UP_Buf, 16);
samsung_clk_set();
printk("\r\n***samsung UP mode***");
}
void samsung_down( void )
{
gpio_i2c_write( FPGA_AFE, 0xFF, 0x01 );
vdec_write_table(FPGA_AFE, SAM_D0, SAM_DOWN_Buf, 16);
samsung_clk_set();
printk("\r\n***samsung DOWN mode***");
}
void samsung_left( void )
{
gpio_i2c_write( FPGA_AFE, 0xFF, 0x01 );
vdec_write_table(FPGA_AFE, SAM_D0, SAM_LEFT_Buf, 16);
samsung_clk_set();
printk("\r\n***samsung LEFT SET ***");
}
void samsung_right( void )
{
gpio_i2c_write( FPGA_AFE, 0xFF, 0x01 );
vdec_write_table(FPGA_AFE, SAM_D0, SAM_RIGHT_Buf, 16);
samsung_clk_set();
printk("\r\n***samsung RIGHT SET ***");
}
void samsung_osd( void )
{
gpio_i2c_write( FPGA_AFE, 0xFF, 0x01 );
vdec_write_table(FPGA_AFE, SAM_D0, SAM_OSD_Buf, 16);
samsung_clk_set();
printk("\r\n***samsung OSD ON SET ***");
}
void samsung_ptz_up( void )
{
gpio_i2c_write( FPGA_AFE, 0xFF, 0x01 );
vdec_write_table(FPGA_AFE, SAM_D0, SAM_PTZ_UP_Buf, 16);
samsung_clk_set();
printk("\r\n***samsung PTZ UP mode***");
}
void samsung_ptz_down( void )
{
gpio_i2c_write( FPGA_AFE, 0xFF, 0x01 );
vdec_write_table(FPGA_AFE, SAM_D0, SAM_PTZ_DOWN_Buf, 16);
samsung_clk_set();
printk("\r\n***samsung PTZ DOWN mode***");
}
void samsung_ptz_left( void )
{
gpio_i2c_write( FPGA_AFE, 0xFF, 0x01 );
vdec_write_table(FPGA_AFE, SAM_D0, SAM_PTZ_LEFT_Buf, 16);
samsung_clk_set();
printk("\r\n***samsung PTZ LEFT SET ***");
}
void samsung_ptz_right( void )
{
gpio_i2c_write( FPGA_AFE, 0xFF, 0x01 );
vdec_write_table(FPGA_AFE, SAM_D0, SAM_PTZ_RIGHT_Buf, 16);
samsung_clk_set();
printk("\r\n***samsung PTZ RIGHT SET ***");
}
void samsung_iris_open( void )
{
gpio_i2c_write( FPGA_AFE, 0xFF, 0x01 );
vdec_write_table(FPGA_AFE, SAM_D0, SAM_IRIS_OPEN_Buf, 16);
samsung_clk_set();
printk("\r\n***samsung IRIS OPEN SET ***");
}
void samsung_iris_close( void )
{
gpio_i2c_write( FPGA_AFE, 0xFF, 0x01 );
vdec_write_table(FPGA_AFE, SAM_D0, SAM_IRIS_CLOSE_Buf, 16);
samsung_clk_set();
printk("\r\n***samsung IRIS CLOSE SET ***");
}
void samsung_focus_near( void )
{
gpio_i2c_write( FPGA_AFE, 0xFF, 0x01 );
vdec_write_table(FPGA_AFE, SAM_D0, SAM_FOCUS_NEAR_Buf, 16);
samsung_clk_set();
printk("\r\n***samsung FOCUS NEAR mode***");
}
void samsung_focus_far( void )
{
gpio_i2c_write( FPGA_AFE, 0xFF, 0x01 );
vdec_write_table(FPGA_AFE, SAM_D0, SAM_FOCUS_FAR_Buf, 16);
samsung_clk_set();
printk("\r\n***samsung FOCUS FAR mode***");
}
void samsung_zoom_wide( void )
{
gpio_i2c_write( FPGA_AFE, 0xFF, 0x01 );
vdec_write_table(FPGA_AFE, SAM_D0, SAM_ZOOM_WIDE_Buf, 16);
samsung_clk_set();
printk("\r\n***samsung ZOOM WIDE SET ***");
}
void samsung_zoom_tele( void )
{
gpio_i2c_write( FPGA_AFE, 0xFF, 0x01 );
vdec_write_table(FPGA_AFE, SAM_D0, SAM_ZOOM_TELE_Buf, 16);
samsung_clk_set();
printk("\r\n***samsung ZOOM TELE SET ***");
}
void samsung_scan_1_sr( void )
{
gpio_i2c_write( FPGA_AFE, 0xFF, 0x01 );
vdec_write_table(FPGA_AFE, SAM_D0, SAM_SCAN_1SR_Buf, 16);
samsung_clk_set();
printk("\r\n***samsung SAM_SCAN_1SR SET ***");
}
void samsung_scan_1_st( void )
{
gpio_i2c_write( FPGA_AFE, 0xFF, 0x01 );
vdec_write_table(FPGA_AFE, SAM_D0, SAM_SCAN_1ST_Buf, 16);
samsung_clk_set();
printk("\r\n***samsung SAM_SCAN_1ST SET ***");
}
void samsung_preset_1( void )
{
gpio_i2c_write( FPGA_AFE, 0xFF, 0x01 );
vdec_write_table(FPGA_AFE, SAM_D0, SAM_PRESET1_Buf, 16);
samsung_clk_set();
printk("\r\n***samsung PRESET1 SET ***");
}
void samsung_preset_2( void )
{
gpio_i2c_write( FPGA_AFE, 0xFF, 0x01 );
vdec_write_table(FPGA_AFE, SAM_D0, SAM_PRESET2_Buf, 16);
samsung_clk_set();
printk("\r\n***samsung PRESET2 SET ***");
}
void samsung_preset_3( void )
{
gpio_i2c_write( FPGA_AFE, 0xFF, 0x01 );
vdec_write_table(FPGA_AFE, SAM_D0, SAM_PRESET3_Buf, 16);
samsung_clk_set();
printk("\r\n***samsung PRESET3 SET ***");
}
void samsung_pattern_1_sr( void )
{
gpio_i2c_write( FPGA_AFE, 0xFF, 0x01 );
vdec_write_table(FPGA_AFE, SAM_D0, SAM_PATTERN_1SR_Buf, 16);
samsung_clk_set();
printk("\r\n***samsung PATTERN_1SR SET ***");
}
void samsung_pattern_1_st( void )
{
gpio_i2c_write( FPGA_AFE, 0xFF, 0x01 );
vdec_write_table(FPGA_AFE, SAM_D0, SAM_PATTERN_1ST_Buf, 16);
samsung_clk_set();
printk("\r\n***samsung PATTERN_1ST SET ***");
}
void samsung_pattern_2_sr( void )
{
gpio_i2c_write( FPGA_AFE, 0xFF, 0x01 );
vdec_write_table(FPGA_AFE, SAM_D0, SAM_PATTERN_2SR_Buf, 16);
samsung_clk_set();
printk("\r\n***samsung PATTERN_2SR SET ***");
}
void samsung_pattern_2_st( void )
{
gpio_i2c_write( FPGA_AFE, 0xFF, 0x01 );
vdec_write_table(FPGA_AFE, SAM_D0, SAM_PATTERN_2ST_Buf, 16);
samsung_clk_set();
printk("\r\n***samsung PATTERN_2ST SET ***") ;
}
void samsung_pattern_3_sr( void )
{
gpio_i2c_write( FPGA_AFE, 0xFF, 0x01 );
vdec_write_table(FPGA_AFE, SAM_D0, SAM_PATTERN_3SR_Buf, 16);
samsung_clk_set();
printk("\r\n***samsung PATTERN_3SR SET ***") ;
}
void samsung_pattern_3_st( void )
{
gpio_i2c_write( FPGA_AFE, 0xFF, 0x01 );
vdec_write_table(FPGA_AFE, SAM_D0, SAM_PATTERN_3ST_Buf, 16);
samsung_clk_set();
printk("\r\n***samsung PATTERN_3ST SET ***") ;
}