📄 ib-net.h
字号:
/* iBurst (TM) compatible driver for 2.6 Linux kernel. * based on the original ArrayComm (TM) iBurst (TM) driver. * Nicholas Jefferson <nicholas@pythontraining.com.au> * 11 May 2005 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */#include <linux/netdevice.h>#include <linux/wireless.h>#define IB_PROTO 0xac#define STATUS_READY 0x06/* * if macro is undefined, define it to be a noop */#ifndef SET_MODULE_OWNER#define SET_MODULE_OWNER while (0) {}#endif/** * enum ib_net_flag - radio frame flag field. */enum ib_net_flag{ FLAG_BROADCAST = 0x08, FLAG_EXTENSION = 0x80,};/** * struct ib_net_driver_t - driver callback functions. * @poll: called by ib_net_poll, ib_net_tx_start. * @tx_timeout: called by ib_net_tx_timeout. * @close: called by ib_net_close. */struct ib_net_driver_t { void (*poll)(void*); void (*tx_timeout)(void*); int (*open)(void*); void (*rx_parse)(void*); int (*close)(void*);};/** * struct ib_net_radio_t - radio frame header. * @word: packet length and flags. * word[0].2 word[0].1 word[0].0 word[1]: packet length. * word[0].3: broadcast flag. * word[0].6 word[0].5 word[0].4: priority field (ignore this field). * word[0].7: extension flag (drop packet if set). * @packet: packet identifier. * @check: ones' complement of word[1]. * @proto: next protocol field. * @payload: payload. */struct ib_net_radio_t { unsigned char word[2]; unsigned char packet; unsigned char check; unsigned char proto[2]; unsigned char payload[0];};#define IB_NET_RADIO_HEAD sizeof(struct ib_net_radio_t)#define IB_NET_RADIO_SIZE ((IB_NET_RADIO_HEAD + ETH_DATA_LEN + 31) & ~31)#define IB_NET_NBUF(word0, word1) ((((word0) & 0x07) << 8) | (word1))/** * struct ib_net_ether_t - ethernet frame header. * @dest: destination MAC address. * @source: source MAC address. * @proto: next protocol field. * @payload: payload. */struct ib_net_ether_t { unsigned char dest[ETH_ALEN]; unsigned char source[ETH_ALEN]; unsigned char proto[2]; unsigned char payload[0];};#define IB_NET_ETHER_HEAD sizeof(struct ib_net_ether_t)/** * struct ib_net_modem_t - modem state. * NTJ: 1.3.4: added 1 byte to buffers for possible padding * * @netdev: network device. * @stats: device statistics. * @wstats: wireless statistics. * @status: network device status; used by ib_net_close. * @driver: driver callback functions. * @pdriver: instance for driver callback functions. * @rx_buf: buffer to receive one iBurst radio cell. * @tx_buf: buffer to transmit one iBurst radio cell. * @tx_queue: transmit cell queue. * @task_queue: bottom half handler. */struct ib_net_modem_t { struct net_device *netdev; struct net_device_stats stats; struct iw_statistics wstats; int pc_status, ut_status, uprate, downrate; struct ib_net_driver_t *driver; void *pdriver; unsigned char rx_buf[IB_NET_RADIO_SIZE + 1]; unsigned char tx_buf[IB_NET_RADIO_SIZE + 1]; struct sk_buff_head tx_queue; struct work_struct work_queue;};/** * ib_net_lock - spin lock for entire driver. */extern spinlock_t ib_lock;/** * ib_net_addr - set network device MAC address. * @modem: modem state. * @addr: MAC address. */static inline void ib_net_addr(struct ib_net_modem_t *modem, unsigned char *addr){ memcpy(modem->netdev->dev_addr, addr, ETH_ALEN); modem->netdev->dev_addr[0] &= ~1; /* hack - make unicast */}/** * ib_net_attach - attach network device. * @modem: modem state. */static inline void ib_net_attach(struct ib_net_modem_t *modem){ netif_device_attach(modem->netdev);}/** * ib_net_detach - detach network device. * @modem: modem state. */static inline void ib_net_detach(struct ib_net_modem_t *modem){ netif_device_detach(modem->netdev);}/** * ib_net_schedule - schedule bottom half handler. * @modem: modem state. */static inline void ib_net_schedule(struct ib_net_modem_t *modem){ schedule_work(&modem->work_queue);}/** * ib_net_flush - flush workqueue. * @modem: modem state. */static inline void ib_net_flush(struct ib_net_modem_t *modem){ flush_scheduled_work();}static inline void ib_net_ut_status(struct ib_net_modem_t *modem, int ut_status){ if ((ut_status ^ modem->ut_status) & STATUS_READY) { if (ut_status & STATUS_READY) netif_carrier_on(modem->netdev); else netif_carrier_off(modem->netdev); } modem->ut_status = ut_status;}extern int ib_net_register(struct net_device **netdev);extern void ib_net_deregister(struct ib_net_modem_t *modem);extern void ib_net_rx_parse(struct ib_net_modem_t *modem, int nbuf);extern int ib_net_tx_prepare(struct ib_net_modem_t *modem);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -