1 static const float cmos_threshold = 2.5;
2 static const float cmos_min = -4.0;
3 static const float cmos_max = 4.0;
4 
FF_JK_4027(int clock)5 float FF_JK_4027(int clock)
6 {
7 	static bool state;
8 	static float buf;
9 
10 	if((buf < 0) && (clock >= cmos_threshold))
11 		state =! state;
12 
13 	buf = clock;
14 
15 	if(state)
16 	{
17 		return cmos_max;
18 	}
19 	else
20 	{
21 		return cmos_min;
22 	}
23 }
24 
FF_D_4013_1(int clock)25 float FF_D_4013_1(int clock)
26 {
27 	static bool state;
28 	static float buf;
29 
30 	if((buf < 0) && (clock >= cmos_threshold))
31 		state =! state;
32 
33 	buf = clock;
34 
35 	if(state)
36 	{
37 		return cmos_max;
38 	}
39 	else
40 	{
41 		return cmos_min;
42 	}
43 }
44 
FF_D_4013_2(int direct_set,int direct_clear)45 float FF_D_4013_2(int direct_set, int direct_clear)
46 {
47 	static bool state;
48 
49 	if((direct_set < cmos_threshold) && (direct_clear < cmos_threshold))
50 	{
51 		if(state)
52 		{
53 			return cmos_max;
54 		}
55 		else
56 		{
57 			return cmos_min;
58 		}
59 	}
60 
61 	if((direct_set < cmos_threshold) && (direct_clear > cmos_threshold))
62 	{
63 		state = false;
64 		return cmos_min;
65 	}
66 
67 	if((direct_set > cmos_threshold) && (direct_clear < cmos_threshold))
68 	{
69 		state = true;
70 		return cmos_max;
71 	}
72 
73 	if((direct_set > cmos_threshold) && (direct_clear > cmos_threshold))
74 	{
75 		if(state)
76 		{
77 			return cmos_max;
78 		}
79 		else
80 		{
81 			return cmos_min;
82 		}
83 	}
84 
85 	return 0;
86 }
87