-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusProtocol.h
51 lines (42 loc) · 1.43 KB
/
usProtocol.h
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
/*
* @note
* Copyright(C) i4season U-Storage, 2016
* Copyright(C) Szitman, 2016
* All rights reserved.
*
*/
#ifndef __USPROTOCOL_H_
#define __USPROTOCOL_H_
#include <ctype.h>
#include <stdio.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#define min(x, y) (((x) < (y)) ? (x) : (y))
#define htons(A) ((((uint16_t)(A) & 0xff00) >> 8) | \
(((uint16_t)(A) & 0x00ff) << 8))
#define htonl(A) ((((uint32_t)(A) & 0xff000000) >> 24) | \
(((uint32_t)(A) & 0x00ff0000) >> 8) | \
(((uint32_t)(A) & 0x0000ff00) << 8) | \
(((uint32_t)(A) & 0x000000ff) << 24))
#define ntohs(A) htons(A)
#define ntohl(A) htonl(A)
enum{
PROTOCOL_REOK=0,
PROTOCOL_REPARA,
PROTOCOL_REGEN,
PROTOCOL_DISCONNECT,
PROTOCOL_REINVAILD
};
uint8_t usProtocol_DeviceDetect(void *os_priv);
uint8_t usProtocol_ConnectPhone(void);
uint8_t usProtocol_DeviceDisConnect(void);
uint8_t usProtocol_SendPackage(void *buffer, uint32_t size);
uint8_t usProtocol_RecvPackage(void **buffer, uint32_t tsize, uint32_t *rsize);
uint8_t usProtocol_GetAvaiableBuffer(void **buffer, uint32_t *size);
uint8_t usProtocol_SetconnectPhoneStatus(uint8_t status);
#ifdef __cplusplus
}
#endif
#endif /* __USPROTOCOL_H_ */