summaryrefslogtreecommitdiff
path: root/libthor/thor-proto.h
blob: c4b396512cc1e5a439ce4da97d3750e662f59ec4 (plain)
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
#ifndef __THOR_PROTO_H__
#define __THOR_PROTO_H__

typedef enum {
	RQT_INFO = 200,
	RQT_CMD,
	RQT_DL,
	RQT_UL,
} request_type;

/* Request Data */
/* RQT_INFO */
enum {
	RQT_INFO_VER_PROTOCOL = 1,
	RQT_INFO_VER_HW,
	RQT_INFO_VER_BOOT,
	RQT_INFO_VER_KERNEL,
	RQT_INFO_VER_PLATFORM,
	RQT_INFO_VER_CSC,
};

/* RQT_CMD */
enum {
	RQT_CMD_REBOOT = 1,
	RQT_CMD_POWEROFF,
};

/* RQT_DL */
enum {
	RQT_DL_INIT = 1,
	RQT_DL_FILE_INFO,
	RQT_DL_FILE_START,
	RQT_DL_FILE_END,
	RQT_DL_EXIT,
};

/* RQT_UL */
enum {
	RQT_UL_INIT = 1,
	RQT_UL_START,
	RQT_UL_END,
	RQT_UL_EXIT,
};

enum __binary_type {
	BINARY_TYPE_NORMAL = 0,
	BINARY_TYPE_PIT,
};

struct rqt_pkt {
	int32_t	id;			/* Request Group ID. */
	int32_t	sub_id;			/* Request Data ID. */
	int32_t	int_data[14];		/* Int. Datas. */
	char	str_data[5][32];	/* Str. Data. */
	char	md5[32];		/* MD5 Checksum. */
} __attribute__((__packed__));


struct res_pkt {
	int32_t	id;			/* Response Group ID == Request Group ID. */
	int32_t	sub_id;			/* Response Data ID == Request Data ID. */
	int32_t	ack;			/* Ack. */
	int32_t	int_data[5];		/* Int. Datas. */
	char	str_data[3][32];	/* Str. Data. */
} __attribute__((__packed__));


struct data_res_pkt {
	int32_t	ack;			/* Ack. */
	int32_t	cnt;			/* Int. Datas. */
} __attribute__((__packed__));


#define RQT_PKT_SIZE		sizeof(struct rqt_pkt)
#define RES_PKT_SIZE		sizeof(struct res_pkt)
#define DATA_RES_PKT_SIZE	sizeof(struct data_res_pkt)

#endif /* __THOR_PROTO_H__ */