tizen 2.4 release
[profile/mobile/platform/kernel/u-boot-tm1.git] / arch / arm / include / asm / arch-sc8800g / packet.h
1
2 #ifndef PACKET_H
3 #define PACKET_H
4
5 #include "cmd_def.h"
6 #include "fdl_conf.h"
7
8
9 typedef enum
10 {
11     PKT_NONE = 0,
12     PKT_HEAD,
13     PKT_GATHER,
14     PKT_RECV,
15     PKT_ERROR
16 } pkt_flag_s;
17
18 struct PACKET_BODY_tag
19 {
20     unsigned short  type;
21     unsigned short  size;
22 #ifndef FPGA_TRACE_DOWNLOAD
23     unsigned char   content[ MAX_PKT_SIZE ];
24 #else
25     char*    content;
26 #endif
27 };
28
29 typedef struct PACKET_tag
30 {
31     struct PACKET_tag      *next;
32
33     int     pkt_state;  // used by recv handle, see pkt_flag_s
34     int     data_size;
35     int     ack_flag;
36     struct PACKET_BODY_tag packet_body;
37 #if 0
38     struct PACKET_BODY_tag
39     {
40         unsigned short  type;
41         unsigned short  size;
42         unsigned char   content[ MAX_PKT_SIZE ];
43     } packet_body;
44 #endif
45 } PACKET_T;
46
47 #define PACKET_HEADER_SIZE   4   // (type + size)
48
49
50 void FDL_PacketInit (void);
51
52 PACKET_T *FDL_MallocPacket (void);
53
54 void FDL_FreePacket (PACKET_T *ptr);
55
56 // Receive a packet, after handle it, should call FDL_FreePacket to release it.
57 PACKET_T   *FDL_GetPacket (void);
58
59 //
60 // This function be called when system is in idle to process the input char.
61 //
62 void FDL_PacketDoIdle (void);
63
64 // send the packet.
65 void FDL_SendPacket (PACKET_T *packet_ptr);
66
67 void FDL_SendAckPacket (cmd_pkt_type pkt_type);
68
69 extern struct FDL_ChannelHandler *gFdlUsedChannel;
70 #endif  // PACKET_H
71