#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/irq.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/slab.h>
#include "hardware.h"
#include "setup_protocol.h"
#include "network.h"
#include "main.h"
static void ipw_send_setup_packet(struct ipw_hardware *hw);
static void handle_received_SETUP_packet(struct ipw_hardware *ipw,
unsigned int address,
const unsigned char *data, int len,
int is_last);
static void ipwireless_setup_timer(struct timer_list *t);
static void handle_received_CTRL_packet(struct ipw_hardware *hw,
unsigned int channel_idx, const unsigned char *data, int len);
#ifdef TIMING_DIAGNOSTICS
static struct timing_stats {
unsigned long last_report_time;
unsigned long read_time;
unsigned long write_time;
unsigned long read_bytes;
unsigned long write_bytes;
unsigned long start_time;
};
static void start_timing(void)
{
timing_stats.start_time = jiffies;
}
static void end_read_timing(unsigned length)
{
timing_stats.read_time += (jiffies - start_time);
timing_stats.read_bytes += length + 2;
report_timing();
}
static void end_write_timing(unsigned length)
{
timing_stats.write_time += (jiffies - start_time);
timing_stats.write_bytes += length + 2;
report_timing();
}
static void report_timing(void)
{
unsigned long since = jiffies - timing_stats.last_report_time;
if (since >= HZ) {
int first = (timing_stats.last_report_time == 0);
timing_stats.last_report_time = jiffies;
if (!first)
printk(KERN_INFO IPWIRELESS_PCCARD_NAME
": %u us elapsed - read %lu bytes in %u us, wrote %lu bytes in %u us\n",
jiffies_to_usecs(since),
timing_stats.read_bytes,
jiffies_to_usecs(timing_stats.read_time),
timing_stats.write_bytes,
jiffies_to_usecs(timing_stats.write_time));
timing_stats.read_time = 0;
timing_stats.write_time = 0;
timing_stats.read_bytes = 0;
timing_stats.write_bytes = 0;
}
}
#else
static void start_timing(void) { … }
static void end_read_timing(unsigned length) { … }
static void end_write_timing(unsigned length) { … }
#endif
#define LL_MTU_V1 …
#define LL_MTU_V2 …
#define LL_MTU_MAX …
#define PRIO_DATA …
#define PRIO_CTRL …
#define PRIO_SETUP …
#define ADDR_SETUP_PROT …
enum { … };
#define NL_FIRST_PACKET_HEADER_SIZE …
#define NL_FOLLOWING_PACKET_HEADER_SIZE …
struct nl_first_packet_header { … };
struct nl_packet_header { … };
#define NL_INTERMEDIATE_PACKET …
#define NL_LAST_PACKET …
#define NL_FIRST_PACKET …
nl_packet __attribute__ ((packed));
#define HW_VERSION_UNKNOWN …
#define HW_VERSION_1 …
#define HW_VERSION_2 …
#define IOIER …
#define IOIR …
#define IODCR …
#define IODRR …
#define IODWR …
#define IOESR …
#define IORXR …
#define IOTXR …
#define IER_RXENABLED …
#define IER_TXENABLED …
#define IR_RXINTR …
#define IR_TXINTR …
#define DCR_RXDONE …
#define DCR_TXDONE …
#define DCR_RXRESET …
#define DCR_TXRESET …
struct MEMCCR { … };
struct MEMINFREG { … };
#define CARD_PRESENT_VALUE …
#define MEMTX_TX …
#define MEMRX_RX …
#define MEMRX_RX_DONE …
#define MEMRX_PCINTACKK …
#define NL_NUM_OF_PRIORITIES …
#define NL_NUM_OF_PROTOCOLS …
#define NL_NUM_OF_ADDRESSES …
struct ipw_hardware { … };
struct ipw_tx_packet { … };
#define COMCTRL_RTS …
#define COMCTRL_DTR …
#define COMCTRL_CTS …
#define COMCTRL_DCD …
#define COMCTRL_DSR …
#define COMCTRL_RI …
struct ipw_control_packet_body { … } __attribute__ ((packed));
struct ipw_control_packet { … };
struct ipw_rx_packet { … };
static char *data_type(const unsigned char *buf, unsigned length)
{ … }
#define DUMP_MAX_BYTES …
static void dump_data_bytes(const char *type, const unsigned char *data,
unsigned length)
{ … }
static void swap_packet_bitfield_to_le(unsigned char *data)
{ … }
static void swap_packet_bitfield_from_le(unsigned char *data)
{ … }
static void do_send_fragment(struct ipw_hardware *hw, unsigned char *data,
unsigned length)
{ … }
static void do_send_packet(struct ipw_hardware *hw, struct ipw_tx_packet *packet)
{ … }
static void ipw_setup_hardware(struct ipw_hardware *hw)
{ … }
static struct ipw_rx_packet *pool_allocate(struct ipw_hardware *hw,
struct ipw_rx_packet *packet,
int minimum_free_space)
{ … }
static void pool_free(struct ipw_hardware *hw, struct ipw_rx_packet *packet)
{ … }
static void queue_received_packet(struct ipw_hardware *hw,
unsigned int protocol,
unsigned int address,
const unsigned char *data, int length,
int is_last)
{ … }
static void ipw_receive_data_work(struct work_struct *work_rx)
{ … }
static void handle_received_CTRL_packet(struct ipw_hardware *hw,
unsigned int channel_idx,
const unsigned char *data, int len)
{ … }
static void handle_received_packet(struct ipw_hardware *hw,
const union nl_packet *packet,
unsigned short len)
{ … }
static void acknowledge_data_read(struct ipw_hardware *hw)
{ … }
static void do_receive_packet(struct ipw_hardware *hw)
{ … }
static int get_current_packet_priority(struct ipw_hardware *hw)
{ … }
static int get_packets_from_hw(struct ipw_hardware *hw)
{ … }
static int send_pending_packet(struct ipw_hardware *hw, int priority_limit)
{ … }
static void ipwireless_do_tasklet(struct tasklet_struct *t)
{ … }
static int is_card_present(struct ipw_hardware *hw)
{ … }
static irqreturn_t ipwireless_handle_v1_interrupt(int irq,
struct ipw_hardware *hw)
{ … }
static void acknowledge_pcmcia_interrupt(struct ipw_hardware *hw)
{ … }
static irqreturn_t ipwireless_handle_v2_v3_interrupt(int irq,
struct ipw_hardware *hw)
{ … }
irqreturn_t ipwireless_interrupt(int irq, void *dev_id)
{ … }
static void flush_packets_to_hw(struct ipw_hardware *hw)
{ … }
static void send_packet(struct ipw_hardware *hw, int priority,
struct ipw_tx_packet *packet)
{ … }
static void *alloc_data_packet(int data_size,
unsigned char dest_addr,
unsigned char protocol)
{ … }
static void *alloc_ctrl_packet(int header_size,
unsigned char dest_addr,
unsigned char protocol,
unsigned char sig_no)
{ … }
int ipwireless_send_packet(struct ipw_hardware *hw, unsigned int channel_idx,
const u8 *data, unsigned int length,
void (*callback) (void *cb, unsigned int length),
void *callback_data)
{ … }
static int set_control_line(struct ipw_hardware *hw, int prio,
unsigned int channel_idx, int line, int state)
{ … }
static int set_DTR(struct ipw_hardware *hw, int priority,
unsigned int channel_idx, int state)
{ … }
static int set_RTS(struct ipw_hardware *hw, int priority,
unsigned int channel_idx, int state)
{ … }
int ipwireless_set_DTR(struct ipw_hardware *hw, unsigned int channel_idx,
int state)
{ … }
int ipwireless_set_RTS(struct ipw_hardware *hw, unsigned int channel_idx,
int state)
{ … }
struct ipw_setup_get_version_query_packet { … };
struct ipw_setup_config_packet { … };
struct ipw_setup_config_done_packet { … };
struct ipw_setup_open_packet { … };
struct ipw_setup_info_packet { … };
struct ipw_setup_reboot_msg_ack { … };
static void __handle_setup_get_version_rsp(struct ipw_hardware *hw)
{ … }
static void handle_setup_get_version_rsp(struct ipw_hardware *hw,
unsigned char vers_no)
{ … }
static void ipw_send_setup_packet(struct ipw_hardware *hw)
{ … }
static void handle_received_SETUP_packet(struct ipw_hardware *hw,
unsigned int address,
const unsigned char *data, int len,
int is_last)
{ … }
static void do_close_hardware(struct ipw_hardware *hw)
{ … }
struct ipw_hardware *ipwireless_hardware_create(void)
{ … }
void ipwireless_init_hardware_v1(struct ipw_hardware *hw,
unsigned int base_port,
void __iomem *attr_memory,
void __iomem *common_memory,
int is_v2_card,
void (*reboot_callback) (void *data),
void *reboot_callback_data)
{ … }
void ipwireless_init_hardware_v2_v3(struct ipw_hardware *hw)
{ … }
static void ipwireless_setup_timer(struct timer_list *t)
{ … }
void ipwireless_stop_interrupts(struct ipw_hardware *hw)
{ … }
void ipwireless_hardware_free(struct ipw_hardware *hw)
{ … }
void ipwireless_associate_network(struct ipw_hardware *hw,
struct ipw_network *network)
{ … }