-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmain.c
90 lines (72 loc) · 1.9 KB
/
main.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
/*
* ccp_linuxgcc
* Copyright (C) 2015 Grzegorz Mazurkiewicz
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ccp.h"
#include <stdio.h>
unsigned char gDebugLevel = 255;
unsigned char database[8] = { 0xDE, 0xDE, 0xDE, 0xDE, 0xDE, 0xDE, 0xDE, 0xDE };
int main(int argc, const char* argv[])
{
ccpInit();
unsigned char cmd[8];
/* connect */
cmd[0] = CC_CONNECT;
cmd[1] = 1;
cmd[2] = 0;
cmd[3] = 0;
ccpCommand(cmd);
printf("======================\n");
/* get version */
cmd[0] = 0x1B;
cmd[1] = 2;
ccpCommand(cmd);
printf("======================\n");
/* set mta */
cmd[0] = CC_SET_MTA;
cmd[1] = 3;
cmd[2] = 0; /* MTA0 */
cmd[3] = 2; /* address extension */
cmd[4] = 1;
cmd[5] = 2;
cmd[6] = 3;
cmd[7] = 4;
ccpCommand(cmd);
printf("======================\n");
/* upload */
cmd[0] = CC_UPLOAD;
cmd[1] = 4;
cmd[2] = 5;
ccpCommand(cmd);
printf("======================\n");
return 0;
}
void ccpSend( CCP_BYTEPTR msg )
{
printf("ccpSend: %02x %02x %02x %02x %02x %02x %02x %02x\n",
msg[0], msg[1], msg[2], msg[3],
msg[4], msg[5], msg[6], msg[7]);
ccpSendCallBack();
}
void ccpUserBackground(void)
{
printf("ccpUserBackground\n");
}
CCP_MTABYTEPTR ccpGetPointer( CCP_BYTE addr_ext, CCP_DWORD addr )
{
printf("ccpGetPointer: addr_ext = %u, addr = %lu\n", addr_ext, addr);
return database;
}