FreeCalypso > hg > freecalypso-sw
annotate rvinterf/lowlevel/rviflcd.c @ 988:0654212e5c53
doc/Compal-unlock: documented safe flashing of newer fw versions and
cisversion unlocking
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Sat, 12 Dec 2015 18:40:56 +0000 |
parents | 16ed75e266f2 |
children |
rev | line source |
---|---|
908
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /* |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 * This rvinterf module implements the piping of LCD output to fc-lcdemu |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 */ |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 #include <sys/types.h> |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 #include <stdio.h> |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 #include <string.h> |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 #include <strings.h> |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 #include <stdlib.h> |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 #include <unistd.h> |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 extern u_char rxpkt[]; |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 extern size_t rxpkt_len; |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
14 |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
15 char *extlcd_program; |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
16 FILE *extlcd_pout; |
909
16ed75e266f2
rvinterf LCD output inversion option implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
908
diff
changeset
|
17 u_char extlcd_invert; |
908
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
18 |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
19 void |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
20 open_extlcd_pipe() |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
21 { |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
22 extlcd_pout = popen(extlcd_program, "w"); |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
23 if (!extlcd_pout) { |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
24 perror(extlcd_program); |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
25 exit(1); |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
26 } |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
27 } |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
28 |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
29 void |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
30 output_to_extlcd() |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
31 { |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
32 int i; |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
33 |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
34 fprintf(extlcd_pout, "%u %u ", rxpkt[1], rxpkt[2]); |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
35 for (i = 3; i < rxpkt_len; i += 2) |
909
16ed75e266f2
rvinterf LCD output inversion option implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
908
diff
changeset
|
36 fprintf(extlcd_pout, "%02X%02X", rxpkt[i+1] ^ extlcd_invert, |
16ed75e266f2
rvinterf LCD output inversion option implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
908
diff
changeset
|
37 rxpkt[i] ^ extlcd_invert); |
908
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
38 fputc('\n', extlcd_pout); |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
39 fflush(extlcd_pout); |
ed5dcc53e0b3
rvinterf: hook for fc-lcdemu implemented
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
diff
changeset
|
40 } |