-
Notifications
You must be signed in to change notification settings - Fork 1
/
ISO7816_activation_sequences.c
87 lines (74 loc) · 1.18 KB
/
ISO7816_activation_sequences.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
#include "Universal.h"
#include "ISO7816.h"
uint8_t Card_running=0;
void Set_Activated() {
Card_running=1;
}
void Set_Deactivated() {
Card_running=1;
}
uint8_t Is_Card_Active() {
return Card_running;
}
void Warm_Reset(void) {
// reset low
Set_RESET();
// set recieve
//UART_input();
//UART_Enable();
// keep VCC && CLK
// wait
Card_wait();
// reset_high
Clear_RESET();
// if ok
//communicate
// ekse deactivate
//Card_Deactivate();
}
void Card_Activate(void) {
Calc_Default_Baudrate();
Set_Comm_Baudrate(7168);
init_UART();
//
Segger_write_string("Activating\n");
// wait
Card_wait();
// VCC
Set_VCC();
// set recieve
//UART_input();
UART_Enable();
// wait
Card_wait();
// CLK clk
Start_CLK();
// wait
Card_wait();
// reset high
Clear_RESET();
Set_Activated();
}
void Card_Deactivate(void) {
Segger_write_string("Deactivating\n\n");
// reset low
Set_RESET();
// wait
Card_wait();
// clk low
Stop_CLK();
//wait
Card_wait();
// io low
//Clear_UART();
UART_Disable();
// wait
Card_wait();
// vcc low
Clear_VCC();
Set_Deactivated();
}
void Card_Cold_Reset(void) {
Card_Deactivate();
Card_Activate();
}