1 /*
2 * proxy_rtl.h
3 *
4 * Created on: Mar 28, 2014
5 * Author: etsam
6 */
8 #ifndef PROXY_RTL_H_
9 #define PROXY_RTL_H_
11 #include <stdio.h>
12 #include <stdlib.h>
14 #define PRINTF 0x00000000
15 #define SCANF 0x00000001
16 #define FOPEN 0x00000002
17 #define FCLOSE 0x00000003
18 #define FREAD 0x00000004
19 #define FWRITE 0x00000005
20 #define COMMAND_ID 0xEF56A55A
21 #define FILE_NAME_LEN 32
22 #define FILE_MOD_LEN 4
24 struct rtl_cmd {
26 /* Unique identifer for command message */
27 unsigned int cmd_id;
29 /* Command code */
30 unsigned int cmd_cc;
32 /* Length of data to to transfer ins response to command */
33 unsigned int data_len;
35 /* Command payload */
36 char buff[0];
38 }__attribute__((__packed__));
40 struct rtl_cmd_ack {
42 /* Command code for which ACK is sent */
43 unsigned int cmd_id;
45 /* Any data - apart from status */
46 unsigned int data;
48 /* Command status */
49 unsigned int status;
50 };
52 struct fopen_data {
53 char name[FILE_NAME_LEN];
54 char mode[FILE_MOD_LEN];
55 };
57 struct proxy_rtl {
58 /* Lock to exclusively accesses RTL functions */
59 void *rtl_lock;
60 /* Command completion lock */
61 void *data_lock;
62 /* Buffer for data transfer */
63 void *buff;
64 /* Current command reference */
65 /* Command completion status */
66 struct rtl_cmd *cmd;
67 struct rtl_cmd_ack cmd_ack;
68 /* Data length yet to transfer */
69 int rem_len;
70 };
72 #endif /* PROXY_RTL_H_ */