📄 sm_drv.h
字号:
/* * src/sm_drv.h * * Copyright (C) 2003 Conexant Americas Inc. All Rights Reserved. * Copyright (C) 2004, 2005, 2006 Nokia Corporation * Author: Samuel Ortiz <samuel.ortiz@nokia.com> * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * */#ifndef _SM_DRV_H#define _SM_DRV_H/* * INCLUDES */#include <linux/skbuff.h>#include <linux/netdevice.h>#include <linux/wireless.h>#include <linux/delay.h>#include <asm/io.h>#include "sm_drv_spi.h"#include "smoid2.h"/* * FUNCTION PROTOTYPES */struct s_sm_frame *skb_to_frame(struct net_device *dev, struct sk_buff *skb);struct sk_buff *frame_to_skb(struct net_device *dev, struct s_sm_frame *framep);int sm_drv_open(struct net_device *dev);int sm_drv_close(struct net_device *dev);int sm_drv_transmit(struct sk_buff *skb, struct net_device *dev);void sm_drv_tx_timeout(struct net_device *dev);struct net_device_stats *sm_drv_statistics(struct net_device *dev);int sm_drv_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);int sm_drv_reset(struct net_device *dev, uint8_t sm_mode);int sm_drv_up(struct net_device *dev, uint8_t mode);int sm_drv_down(struct net_device *dev);struct net_device *sm_drv_netdev_create(int ioaddr, int irq);struct net_device *sm_drv_get_device( uint32_t *context );struct s_sm_frame *frame_skb_alloc(struct net_device *dev, uint32_t length, uint16_t data_offset);void frame_skb_free(struct net_device *dev, struct s_sm_frame *framep);void sm_drv_psm_fsm(struct net_device *dev, int event);void handle_sm_callback(struct net_device *dev, int32_t callb_mask);void driver_timer_expired(unsigned long sm_handle);extern struct net_device *root_sm_drv_device;extern struct net_device *sm_drv_get_device(uint32_t *context);/* * MACROS */#define SM_ALIGN(value) ((value + (sizeof(long) - 1)) & ~(sizeof(long) - 1))#define FRAME_ICMSG(framep) ((struct s_ic_msg *)((char *)(framep) + SM_ALIGN(sizeof(struct s_sm_frame))))/* * DEFINES *//* Configuration Items */#define DEV_MAX_STA 128#define DEV_MAX_BSS 50/* Device State (lower halfword) and device actions (upper half word) */#define DEVSTATE_IDLE 0#define DEVSTATE_BOOTING 1#define DEVSTATE_ACTIVE 2#define DEVSTATE_DEAD 3 /* Crash detecting *//* Power save mode events */#define PSMEVENT_RUN_BH 1#define PSMEVENT_UPDATE 2#define PSMEVENT_IFDOWN 3#define PSMEVENT_IFUP 4#define PSMEVENT_HOST_SLEEP 5#define PSMEVENT_HOST_WAKEUP 6#define PSMEVENT_BOOT 7/* Link state */#define LINK_ASSOCIATED 1#define LINK_DISASSOCIATED 2/* ioctl interface */#define SOFTMACIOCTL SIOCDEVPRIVATE#define SMIOC_IFRESET 1#define SMIOC_CARDRESET 2#define SMIOC_GETOID 3#define SMIOC_SETOID 4#define SMIOC_SET_DBGLEVEL 5#define SMIOC_SETMODE 6#define SMIOC_UMAC_PROFILER 7struct s_softmac_ioctl { uint32_t cmd; uint32_t oid; uint32_t len; uint8_t *data;};/* TX timeout */#define SM_DRV_TX_TIMEOUT (5120*HZ/100)/* Debug flag to get debug information for specific sections */#define DBG_NONE 0x00000000#define DBG_CALLS 0x00000001#define DBG_TRACE 0x00000002#define DBG_IRQ 0x00000004#define DBG_BH 0x00000008#define DBG_SMAC 0x00000010#define DBG_FRAME 0x00000020#define DBG_PWRSAVE 0x00000040#define DBG_IOCTL 0x00000080#define DBG_UARTPCI 0x00000100#define DBG_NETLINK 0x00000200#define DBG_IC 0x00000400#define DBG_LMAC 0x00000800#define DBG_CTRL 0x00001000#define DBG_WDS 0x00002000#define DBG_OFFLOAD 0x00004000#define DBG_TIMER 0x00008000#define DBG_SPI_IO 0x00010000#define DBG_SYSFS 0x00020000#define DBG_WPA 0x00040000#define DBG_PDA 0x00080000/* Use DBG_OFF to initially disable debugging but make it possible to enable it runtime. * use DBG_NONE to compile out all debugging for release builds */#define DBG_OFF 0xF0000000#define DBG_ALL 0xFFFFFFFF/* * DEBUG STUFF. The Makefile should specify if debug should be on or off. * This is done using -DDEBUG_ON in this case the DEBUG_LEVEL will be set to DBG_OFF * which means that by default no debug will be shown, but this can be configured on * the fly using sm_conf or sm_dbg tool. * When a final built is made and no debug should be used (every insturction saved helps) * so when DEBUG_ON in undefined DEBUG_LEVEL will be undefined either. */#ifdef CONFIG_CX3110X_DEBUG#define DEBUG_LEVEL (DBG_CALLS | DBG_TRACE | DBG_IRQ | DBG_BH | DBG_SMAC | DBG_IOCTL | DBG_SYSFS | DBG_IC | DBG_LMAC | DBG_WPA | DBG_PDA)#else//#define DEBUG_LEVEL DBG_ALL#define DEBUG_LEVEL (DBG_LMAC | DBG_SMAC) #undef DEBUG_TIMESTAMP#endif#define K_DEBUG( f, m, args... ) do{ if(( f & m )) printk(args); }while(0)#if DEBUG_LEVEL > DBG_NONE#define DEBUG( f, args... ) K_DEBUG( f, DEBUG_LEVEL, args )#else#define DEBUG( f, args... )#endif/* We have 2 different drivers; MTUM and UMAC */#define SM_DRIVER_TYPE_MTUM 0#define SM_DRIVER_TYPE_UMAC 1#define MAX_BSS_WPA_IE_COUNT 64#define MAX_WPA_IE_LEN 255struct sm_drv_bss_wpa_ie { struct list_head list; unsigned long last_update; u8 bssid[ETH_ALEN]; u8 wpa_ie[MAX_WPA_IE_LEN]; size_t wpa_ie_len;};struct net_local { void* device_id; /* unique ID for shared IRQ */ void* hif_local_data; /* Pointer to the host interface specific data */ struct spi_device * spi_device; spinlock_t sm_lock; /* SoftMAC lock */ unsigned int sm_initialization; uint32_t device_state; /* Powersave/Active */ uint32_t link_state; /* Assciated or not */ struct tasklet_struct tasklet; /* Our bottom halve (BH) handler */ struct work_struct stats_work; /* Wireless stats work queue */ unsigned long stats_timestamp; /* Last stats update */ /* WPA crap */ int wpa; /* WPA mode enabled */ struct list_head bss_wpa_list; int num_bss_wpa; struct semaphore wpa_sem; struct obj_ssid ssid; /* Our current SSID */ uint8_t ap_mac_address[ETH_ALEN]; /* MAC address we're associated with */ uint16_t ext; /* AP frequency extension */ /* * Firmware cache. * We cache the firmware here so that we * don't need to call hotplug and parse_bra * everytime we boot. */ uint8_t * fw_ptr; long fw_len; /* * Above the most frequently used variables are place we try to keep this * in one cache line */ uint8_t sm_mode; /* SoftMAC mode: Client or AP */ uint8_t bss_type; /* BSS type: INFRA or IBSS */ struct s_sm_frame* queued_tx_frame; /* We can queue 1 TX frame if the SoftMAC queue is full */ struct timer_list softmac_timer; /* Timer for SoftMAC */ struct timer_list scan_timer; /* In case we don't get the scan trap... */ struct s_sm_initdata* sm_initdata; /* temporary init structure storage */ struct s_sm_descr sm_descr; /* SoftMAC description */ uint32_t* sm_context; /* handle to SoftMAC context */ struct s_pda* sm_pda; /* Pointer to PDA */ struct net_device_stats stats; /* statistics */ struct iw_statistics iwstatistics; /* Wireless stats */ wait_queue_head_t conf_waitq; /* To wait for configuration to be allowed */ wait_queue_head_t getresp_waitq; /* wait queue and buffer for response ...*/ struct s_sm_conf getresp; /* ...to pending get request */ int (*hif_up) (struct net_device *dev); int (*hif_down) (struct net_device *dev); void (*hif_cli) (struct net_device *dev);};#endif /* _SM_DRV_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -