-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathavr_tpi.c
75 lines (60 loc) · 1.58 KB
/
avr_tpi.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
/**
* @file avr_tpi.c
* @brief
* @details
* @version
* @date Thu 13 Dec 2018 04:04:20 PM EST
* @author
* @copyright The GNU General Public License
*
* 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 2
* of the License, or (at your option) any later version.
*
* This software 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.
*
*
* @note compiler string: cc ftdi_tpi.c avr_tpi.c -lftdi -o avr_tpi
*
*/
/* --- include files --- */
#include <stdio.h>
#ifndef S_SPLINT_S
#include <ftdi.h>
#include <argp.h>
#endif
#include <stdlib.h>
#include "ftdi_tpi.h"
/* --- defines and constants --- */
/* --- global variables --- */
/* --- function prototypes --- */
/* --- main --- */
int main()
{
int result=0;
uint32_t device_id;
result=ftdi_programmer_init();
if (result < 0)
{
fprintf( stderr, "Error: Can't connect to programmer (code: %d)\n", result);
exit(EXIT_FAILURE);
}
result=tpi_init(&device_id);
if (result < 0)
{
fprintf( stderr, "Error: Can't connect to device (code: %d)\n", result);
exit(EXIT_FAILURE);
}
result=tpi_stop();
if (result < 0)
{
fprintf( stderr, "Error: Can't disable tpi access (code: %d)\n", result);
exit(EXIT_FAILURE);
}
return result;
}
/* --- functions --- */