lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | /******************************************************************************* |
| 2 | * 版权所有 (C)2023, 中兴通讯股份有限公司。 |
| 3 | * |
| 4 | * 文件名称: sc_rpc.h |
| 5 | * 文件标识: sc_rpc.h |
| 6 | * 内容摘要: rpc头文件 |
| 7 | * 使用方法: #include <sc_rpc.h> |
| 8 | * |
| 9 | * 修改日期 版本号 修改标记 修改人 修改内容 |
| 10 | * ------------------------------------------------------------------------------ |
| 11 | * 2023/03/23 V1.0 Create 周国坡 创建 |
| 12 | * |
| 13 | *******************************************************************************/ |
| 14 | #ifndef _SC_RPC_H |
| 15 | #define _SC_RPC_H |
| 16 | |
| 17 | enum |
| 18 | { |
| 19 | RPC_MSG_TYPE_REQUEST = 0xAA, |
xf.li | 742dd02 | 2023-06-08 01:43:32 -0700 | [diff] [blame] | 20 | RPC_MSG_TYPE_REPLY = 0xBB, |
| 21 | RPC_MSG_TYPE_READY = 0x55 |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 22 | }; |
| 23 | |
| 24 | enum |
| 25 | { |
| 26 | RPC_FUNC_ID_NV = 10 |
| 27 | }; |
| 28 | |
| 29 | typedef struct |
| 30 | { |
| 31 | unsigned int msg_type; |
| 32 | unsigned int func_id; |
lh | 758261d | 2023-07-13 05:52:04 -0700 | [diff] [blame] | 33 | unsigned int file_len; |
| 34 | unsigned int key_len; |
| 35 | unsigned int value_len; |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 36 | unsigned int data_len; |
lh | 758261d | 2023-07-13 05:52:04 -0700 | [diff] [blame] | 37 | |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 38 | } T_sc_rpc_header; |
| 39 | |
lh | 758261d | 2023-07-13 05:52:04 -0700 | [diff] [blame] | 40 | typedef struct |
| 41 | { |
| 42 | T_sc_rpc_header header; |
| 43 | char data[3072]; |
| 44 | } T_sc_rpc_msg; |
| 45 | |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 46 | int sc_rpc_open(const char *rpmsg_dev); |
| 47 | |
| 48 | int sc_rpc_clear(int fd); |
| 49 | |
lh | 758261d | 2023-07-13 05:52:04 -0700 | [diff] [blame] | 50 | int sc_rpc_send(int fd, T_sc_rpc_msg *data, unsigned int flag); |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 51 | |
lh | 758261d | 2023-07-13 05:52:04 -0700 | [diff] [blame] | 52 | int sc_rpc_recv(int fd, T_sc_rpc_msg *data, unsigned int timeout); |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 53 | |
| 54 | int sc_rpc_close(int fd); |
| 55 | |
| 56 | #endif |