blob: 98bcfb785f425ab4f68fa6a9054f4b17fa81a4d0 [file] [log] [blame]
yuezonghe824eb0c2024-06-27 02:32:26 -07001#ifndef _PSNET_H_
2#define _PSNET_H_
3
4#include <linux/interrupt.h>
5
6#include <linux/netdevice.h>
7
8#include <linux/kthread.h>
9
10#include <linux/skbuff.h>
11#include <linux/spinlock.h>
12#include <linux/semaphore.h>
13//#include "psnet.h"
14
15#ifdef dbg
16#undef dbg
17#endif
18#if PSNET_DEBUG
19#define dbg(format, arg...) printk(KERN_DEBUG " psnet.c<%s>: " format "\n" , \
20 __func__ , ## arg)
21#else
22#define dbg(format, arg...) do {} while (0)
23#endif
24
25#ifdef err
26#undef err
27#endif
28#define err(format, arg...) printk(KERN_ERR " psnet.c<%s>: " format "\n" , \
29 __func__ , ## arg)
30
31#ifdef warn
32#undef warn
33#endif
34#define warn(format, arg...) printk(KERN_WARNING " psnet.c<%s>: " format "\n" , \
35 __func__ , ## arg)
36
37#ifdef info
38#undef info
39#endif
40#define info(format, arg...) printk(KERN_ERR " psnet.c<%s>: " format "\n" , \
41 __func__ , ## arg)
42
43
44#define NET_LAN 0x10
45#define NET_WAN 0x11
46typedef (*functpye1)(unsigned int);
47typedef (*functpye2)(unsigned int, void*, unsigned int);
48
49struct psnet_msg
50{
51 void *buf;
52 unsigned int len;
53 u32 protocol;
54};
55
56struct psnet {
57 struct net_device *net;
58 //void* IOhandle;
59 int initflag;
60 /*lan0 or wan0*/
61 unsigned char lan;
62 unsigned int index;
63 //struct sk_buff_head txq;
64 struct sk_buff_head rxq;
65 //struct semaphore skb_que_sem;
66 //struct tasklet_struct rx_bh;
67 struct task_struct* rcv_thread;
68 //struct completion rcv_completion;
69 //wait_queue_head_t waitqueue;
70 void (*channelOpen)(unsigned int chid);
71 void (*channelClose)(unsigned int chid);
72 int (*transdataOut)(unsigned int channel, void* buff, unsigned int length);
73};
74
75enum{
76 DDR_DEV_WAN1 = 0,
77 DDR_DEV_WAN2,
78 DDR_DEV_WAN3,
79 DDR_DEV_WAN4,
80 DDR_DEV_WAN5,
81 DDR_DEV_WAN6,
82 DDR_DEV_WAN7,
83 DDR_DEV_WAN8,
84 DDR_DEV_MAX,
85
86};
87void psnet_recv_notify(unsigned int index, const void *buffer, unsigned int length);
88int psnet_registerOpsCallback(unsigned int chID, functpye1* funcOpen, functpye1* funcClose, functpye2* funcOut);
89
90#if 0
91#ifdef USE_PSNET_PACKET
92s32 psnet_skb_xmit_thread(void * __dev);
93#endif
94int psnet_rx_packet(struct net_device *net, struct psnet_msg *psMsg);
95#endif
96#endif /* _PSNET_H_ */
97