1 /*
2  * Copyright (C) 2015-2019 Alibaba Group Holding Limited
3  */
4 
5 #ifndef AMP_RECOVERY_H
6 #define AMP_RECOVERY_H
7 
8 #include <stddef.h>
9 #include <stdint.h>
10 #include "amp_config.h"
11 
12 /* recovery switch & status led. default for esp32 */
13 #ifndef AMP_REC_UART
14 #define AMP_REC_UART 2
15 #endif
16 
17 #ifndef AMP_STATUS_IO
18 #define AMP_STATUS_IO 33
19 #endif
20 
21 #ifndef AMP_STATUS_IO_ON
22 #define AMP_STATUS_IO_ON 1
23 #endif
24 
25 /* recovery switch */
26 #ifndef AMP_REC_IO
27 #define AMP_REC_IO 11
28 #endif
29 
30 #ifndef AMP_REC_IO_ON
31 #define AMP_REC_IO_ON 1
32 #endif
33 
34 typedef enum{
35     AMP_STATUS_NORMAL = 0,
36     AMP_STATUS_SERVICE_AVAILABLE, // 1
37     AMP_STATUS_RECOVERY,		// 2
38     AMP_STATUS_UPDATING,	// 3
39     AMP_STATUS_JSERROR,	// 4
40     AMP_STATUS_COREDUMP,	// 5
41     AMP_STATUS_END
42 }AMP_STATUS;
43 
44 int amp_recovery_init(void);
45 
46 int amp_recovery_entry(void);
47 
48 int amp_recovery_appbin(void);
49 
50 void uart_send_byte(unsigned char c);
51 
52 unsigned char uart_recv_byte(unsigned char *c);
53 
54 #endif /* AMP_RECOVERY_H */