l.yang | b8fdece | 2024-10-10 14:56:17 +0800 | [diff] [blame] | 1 | #ifndef ZV_NET_H
|
| 2 | #define ZV_NET_H
|
| 3 |
|
| 4 | #include <linux/interrupt.h>
|
| 5 | #include <linux/kthread.h>
|
| 6 | #include <linux/spinlock.h>
|
| 7 | #include <linux/semaphore.h>
|
| 8 | #include <linux/netdevice.h>
|
| 9 | #include <linux/skbuff.h>
|
| 10 | #include <linux/soc/zte/rpmsg.h>
|
| 11 |
|
| 12 | //#define ZVNET_DEBUG
|
| 13 | #ifdef ZVNET_DEBUG
|
| 14 | #define zv_dbg(format, arg...) printk(KERN_DEBUG "[zvnet]<%s>: " format "\n" , \
|
| 15 | __func__ , ## arg)
|
| 16 | #define zv_info(format, arg...) printk(KERN_INFO "[zvnet]<%s>: " format "\n" , \
|
| 17 | __func__ , ## arg)
|
| 18 | #else
|
| 19 | #define zv_dbg(format, arg...) do {} while (0)
|
| 20 | #define zv_info(format, arg...) do {} while (0)
|
| 21 | #endif
|
| 22 |
|
| 23 | #define zv_err(format, arg...) printk(KERN_ERR "[zvnet]<%s>: " format "\n" , \
|
| 24 | __func__ , ## arg)
|
| 25 |
|
| 26 | #define zv_warn(format, arg...) printk(KERN_WARNING "[zvnet]<%s>: " format "\n" , \
|
| 27 | __func__ , ## arg)
|
| 28 |
|
| 29 | //zvnetÉ豸×î´óÊý
|
| 30 | #define DDR_ZVNET_DEV_MAX 10
|
| 31 | #define ZVNET_IFNAME_PREFIX "zvnet"
|
| 32 |
|
| 33 | #define ICP_CHN_ZVNET1 20 //ICP_CHANNEL_WAN1
|
| 34 | #define ICP_CHN_ZVNET2 21 //ICP_CHANNEL_WAN2
|
| 35 | #define ICP_CHN_ZVNET3 22 //ICP_CHANNEL_WAN3
|
| 36 | #define ICP_CHN_ZVNET4 23 //ICP_CHANNEL_WAN4
|
| 37 |
|
| 38 | #define ICP_CHANNEL_SIZE (8 * 1024 *2)
|
| 39 |
|
| 40 | #define zvnetCreateChannel rpmsgCreateChannel
|
| 41 | #define zvnetWrite rpmsgWrite
|
| 42 | #define zvnetRead rpmsgRead
|
| 43 |
|
| 44 | struct zvnet_channel {
|
| 45 | T_RpMsg_CoreID core_id;
|
| 46 | T_RpMsg_ChID channel_id;
|
| 47 | unsigned int channel_size;
|
| 48 | struct task_struct *rcv_thread;
|
| 49 | };
|
| 50 |
|
| 51 | struct zvnet {
|
| 52 | struct net_device *net;
|
| 53 | struct sk_buff_head rxq;
|
| 54 | struct tasklet_struct bh;
|
| 55 | void *dev_priv;
|
| 56 | };
|
| 57 |
|
| 58 | struct zvnet_device {
|
| 59 | struct zvnet *dev;
|
| 60 | struct net_device *net;
|
| 61 | //struct zvnet_channel chn_info;
|
| 62 | unsigned char retran_times;
|
| 63 | //int (*write)(struct sk_buff *,struct v2x_hdr *, unsigned int, struct net_device *);
|
| 64 | };
|
| 65 |
|
| 66 | struct zvp_header {
|
| 67 | unsigned int magic_word;
|
| 68 | unsigned short chnid;
|
| 69 | unsigned short tlen;
|
| 70 | };
|
| 71 |
|
| 72 | #define ZVP_MAGIC_WORD 0x5A5A5A5A
|
| 73 | #define ZVP_HEAD_LEN sizeof(struct zvp_header)
|
| 74 |
|
| 75 | #endif
|
| 76 |
|