From bf3146c8652c32bd5c9b12eaf5e133e6fb4d0739 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 22 Sep 2010 08:34:49 -0700 Subject: [PATCH] Staging: ft1000: remove trailing whitespace Lots of trailing whitespace was removed Cc: Marek Belisko Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ft1000/Kconfig | 4 +- drivers/staging/ft1000/ft1000-pcmcia/boot.h | 26 +- drivers/staging/ft1000/ft1000-pcmcia/ft1000.h | 60 +- .../staging/ft1000/ft1000-pcmcia/ft1000_cs.c | 14 +- .../staging/ft1000/ft1000-pcmcia/ft1000_dev.h | 18 +- .../ft1000/ft1000-pcmcia/ft1000_dnld.c | 28 +- .../staging/ft1000/ft1000-pcmcia/ft1000_hw.c | 82 +- .../ft1000/ft1000-pcmcia/ft1000_proc.c | 4 +- .../staging/ft1000/ft1000-usb/ft1000_chdev.c | 212 ++--- .../ft1000/ft1000-usb/ft1000_download.c | 202 ++--- drivers/staging/ft1000/ft1000-usb/ft1000_hw.c | 756 +++++++++--------- .../staging/ft1000/ft1000-usb/ft1000_ioctl.h | 30 +- .../staging/ft1000/ft1000-usb/ft1000_usb.c | 64 +- .../staging/ft1000/ft1000-usb/ft1000_usb.h | 52 +- 14 files changed, 776 insertions(+), 776 deletions(-) diff --git a/drivers/staging/ft1000/Kconfig b/drivers/staging/ft1000/Kconfig index 7c8af886dd5d..c54b4e83d6e9 100644 --- a/drivers/staging/ft1000/Kconfig +++ b/drivers/staging/ft1000/Kconfig @@ -5,7 +5,7 @@ if FT1000 config FT1000_USB tristate "Driver for ft1000 usb devices." - depends on USB + depends on USB depends on NET help Say Y if you want to have support for Qleadtek FLASH-OFDM USB Modem [LR7F04], @@ -13,7 +13,7 @@ config FT1000_USB config FT1000_PCMCIA tristate "Driver for ft1000 pcmcia device." - depends on PCMCIA + depends on PCMCIA depends on NET help Say Y if you want to have support for Flarion card also called diff --git a/drivers/staging/ft1000/ft1000-pcmcia/boot.h b/drivers/staging/ft1000/ft1000-pcmcia/boot.h index c376daeec0cd..1fc4ac12e247 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/boot.h +++ b/drivers/staging/ft1000/ft1000-pcmcia/boot.h @@ -3,21 +3,21 @@ // // Copyright (C) 2002 Flarion Technologies, All rights reserved. // -// This program is free software; you can redistribute it and/or modify it +// 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. This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -// more details. You should have received a copy of the GNU General Public -// License along with this program; if not, write to the -// Free Software Foundation, Inc., 59 Temple Place - -// Suite 330, Boston, MA 02111-1307, USA. +// Software Foundation; either version 2 of the License, or (at your option) any +// later version. This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. You should have received a copy of the GNU General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., 59 Temple Place - +// Suite 330, Boston, MA 02111-1307, USA. //--------------------------------------------------------------------------- // // File: boot.h // -// Description: boatloader +// Description: boatloader // // History: // 1/11/05 Whc Ported to Linux. @@ -27,7 +27,7 @@ #define _BOOTH_ // Official bootloader -unsigned char bootimage [] = { +unsigned char bootimage [] = { 0x00,0x00,0x01,0x5E,0x00,0x00 ,0x00,0x00,0x00,0x00,0x02,0xD7 ,0x00,0x00,0x01,0x5E,0x46,0xB3 @@ -152,7 +152,7 @@ unsigned char bootimage [] = { ,0x01,0x00,0x00,0xAE,0x62,0xE4 ,0xE5,0x61,0x04,0x48,0x04,0xE5 ,0x63,0x05,0x48,0x04,0x20,0x20 -,0x00,0x00,0x00,0x00 -}; +,0x00,0x00,0x00,0x00 +}; #endif diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h b/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h index 93b0ad35102d..61e1cfc80446 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000.h @@ -3,16 +3,16 @@ // // Copyright (C) 2002 Flarion Technologies, All rights reserved. // -// This program is free software; you can redistribute it and/or modify it +// 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. This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -// more details. You should have received a copy of the GNU General Public -// License along with this program; if not, write to the -// Free Software Foundation, Inc., 59 Temple Place - -// Suite 330, Boston, MA 02111-1307, USA. +// Software Foundation; either version 2 of the License, or (at your option) any +// later version. This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. You should have received a copy of the GNU General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., 59 Temple Place - +// Suite 330, Boston, MA 02111-1307, USA. //--------------------------------------------------------------------------- // // File: ft1000.h @@ -41,7 +41,7 @@ #define CALVERSZ 2 #define CALDATESZ 6 -// Pseudo Header structure +// Pseudo Header structure typedef struct _PSEUDO_HDR { unsigned short length; // length of msg body @@ -58,7 +58,7 @@ typedef struct _PSEUDO_HDR // Dsp Loader = 0xa0 // Dsp MIP = 0xb0 unsigned char portsrc; // software source port id (refer to portdest) - unsigned short sh_str_id; // not used + unsigned short sh_str_id; // not used unsigned char control; // not used unsigned char rsvd1; unsigned char seq_num; // message sequence number @@ -78,7 +78,7 @@ typedef struct _PSEUDO_HDR #define PCHAR u8 * #define UINT u32 -#define ELECTRABUZZ_ID 0 // ASIC ID for Electrabuzz +#define ELECTRABUZZ_ID 0 // ASIC ID for Electrabuzz #define MAGNEMITE_ID 0x1a01 // ASIC ID for Magnemite // MEMORY MAP common to both ELECTRABUZZ and MAGNEMITE @@ -89,7 +89,7 @@ typedef struct _PSEUDO_HDR #define FT1000_REG_SUP_ISR 0x0026 // HISR - Host Interrupt Status Register #define FT1000_REG_SUP_IMASK 0x0028 // HIMASK - Host Interrupt Mask #define FT1000_REG_DOORBELL 0x002a // DBELL - Door Bell Register -#define FT1000_REG_ASIC_ID 0x002e // ASICID - ASIC Identification Number +#define FT1000_REG_ASIC_ID 0x002e // ASICID - ASIC Identification Number // (Electrabuzz=0 Magnemite=0x1A01) // MEMORY MAP FOR ELECTRABUZZ ASIC @@ -113,10 +113,10 @@ typedef struct _PSEUDO_HDR #define FT1000_REG_MAG_DFRL 0x0008 // DFRL - Downlink FIFO Register low-word (16-bits) #define FT1000_REG_MAG_DFRH 0x000a // DFRH - Downlink FIFO Register high-word (16-bits) #define FT1000_REG_MAG_DFSR 0x000c // DFSR - Downlink FIFO Status Register -#define FT1000_REG_MAG_DPDATA 0x0010 // DPDATA - Dual Port RAM Indirect Data Register (32-bits) +#define FT1000_REG_MAG_DPDATA 0x0010 // DPDATA - Dual Port RAM Indirect Data Register (32-bits) #define FT1000_REG_MAG_DPDATAL 0x0010 // DPDATAL - Dual Port RAM Indirect Data Register low-word (16-bits) #define FT1000_REG_MAG_DPDATAH 0x0012 // DPDATAH - Dual Port RAM Indirect Data Register high-word (16-bits) -#define FT1000_REG_MAG_WATERMARK 0x002c // WMARK - Watermark Register +#define FT1000_REG_MAG_WATERMARK 0x002c // WMARK - Watermark Register // Reserved Dual Port RAM offsets for Electrabuzz #define FT1000_DPRAM_TX_BASE 0x0002 // Host to PC Card Messaging Area @@ -136,7 +136,7 @@ typedef struct _PSEUDO_HDR #define FT1000_DPRAM_MAG_TX_BASE 0x0000 // Host to PC Card Messaging Area #define FT1000_DPRAM_MAG_RX_BASE 0x0200 // PC Card to Host Messaging Area #define FT1000_MAG_FIFO_LEN 0x1FF // total length for DSP FIFO tracking -#define FT1000_MAG_FIFO_LEN_INDX 0x1 // low-word index +#define FT1000_MAG_FIFO_LEN_INDX 0x1 // low-word index #define FT1000_MAG_HI_HO 0x1FF // heartbeat with HI/HO #define FT1000_MAG_HI_HO_INDX 0x0 // high-word index #define FT1000_MAG_DSP_LED 0x3FE // dsp led status for PAD device @@ -161,7 +161,7 @@ typedef struct _PSEUDO_HDR #define FT1000_MAG_DSP_TIMER3_INDX 0x0 #define FT1000_MAG_TOTAL_LEN 0x200 -#define FT1000_MAG_TOTAL_LEN_INDX 0x1 +#define FT1000_MAG_TOTAL_LEN_INDX 0x1 #define FT1000_MAG_PH_LEN 0x200 #define FT1000_MAG_PH_LEN_INDX 0x0 @@ -173,17 +173,17 @@ typedef struct _PSEUDO_HDR #define HOST_INTF_BE 0x1 // Host interface big endian mode // PC Card to Host Doorbell assignments -#define FT1000_DB_DPRAM_RX 0x0001 // this value indicates that DSP has - // data for host in DPRAM +#define FT1000_DB_DPRAM_RX 0x0001 // this value indicates that DSP has + // data for host in DPRAM #define FT1000_ASIC_RESET_REQ 0x0004 // DSP requesting host to reset the ASIC #define FT1000_DSP_ASIC_RESET 0x0008 // DSP indicating host that it will reset the ASIC #define FT1000_DB_COND_RESET 0x0010 // DSP request for a card reset. // Host to PC Card Doorbell assignments -#define FT1000_DB_DPRAM_TX 0x0100 // this value indicates that host has - // data for DSP in DPRAM. +#define FT1000_DB_DPRAM_TX 0x0100 // this value indicates that host has + // data for DSP in DPRAM. #define FT1000_ASIC_RESET_DSP 0x0400 // Responds to FT1000_ASIC_RESET_REQ -#define FT1000_DB_HB 0x1000 // Indicates that supervisor +#define FT1000_DB_HB 0x1000 // Indicates that supervisor // has a heartbeat message for DSP. #define FT1000_DPRAM_BASE 0x0000 // Dual Port RAM starting offset @@ -201,27 +201,27 @@ typedef struct _PSEUDO_HDR // Indicate the cause of an interrupt. // #define ISR_EMPTY 0x00 // no bits set -#define ISR_DOORBELL_ACK 0x01 // Doorbell acknowledge from DSP +#define ISR_DOORBELL_ACK 0x01 // Doorbell acknowledge from DSP #define ISR_DOORBELL_PEND 0x02 // Doorbell pending from DSP #define ISR_RCV 0x04 // Packet available in Downlink FIFO -#define ISR_WATERMARK 0x08 // Watermark requirements satisfied +#define ISR_WATERMARK 0x08 // Watermark requirements satisfied // Bit field definition for Host Interrupt Mask #define ISR_MASK_NONE 0x0000 // no bits set #define ISR_MASK_DOORBELL_ACK 0x0001 // Doorbell acknowledge mask #define ISR_MASK_DOORBELL_PEND 0x0002 // Doorbell pending mask #define ISR_MASK_RCV 0x0004 // Downlink Packet available mask -#define ISR_MASK_WATERMARK 0x0008 // Watermark interrupt mask +#define ISR_MASK_WATERMARK 0x0008 // Watermark interrupt mask #define ISR_MASK_ALL 0xffff // Mask all interrupts // Bit field definition for Host Control Register #define DSP_RESET_BIT 0x0001 // Bit field to control dsp reset state // (0 = out of reset 1 = reset) #define ASIC_RESET_BIT 0x0002 // Bit field to control ASIC reset state - // (0 = out of reset 1 = reset) + // (0 = out of reset 1 = reset) -// Default interrupt mask (Enable Doorbell pending and Packet available interrupts) -#define ISR_DEFAULT_MASK 0x7ff9 +// Default interrupt mask (Enable Doorbell pending and Packet available interrupts) +#define ISR_DEFAULT_MASK 0x7ff9 // Application specific IDs #define DSPID 0x20 @@ -241,7 +241,7 @@ typedef struct _PSEUDO_HDR #define MAX_DSP_SESS_REC 1024 -#define DSP_QID_OFFSET 4 +#define DSP_QID_OFFSET 4 #define PSEUDOSZ 16 #define PSEUDOSZWRD 8 @@ -299,7 +299,7 @@ typedef struct _MEDIAMSG { u16 state; u32 ip_addr; u32 net_mask; - u32 gateway; + u32 gateway; u32 dns_1; u32 dns_2; } __attribute__ ((packed)) MEDIAMSG, *PMEDIAMSG; diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c index 20a663ddc90e..2163eae295f7 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_cs.c @@ -13,7 +13,7 @@ by Wai Chan (w.chan@flarion.com). Port for kernel 2.6 created by Patrik Ostrihon (patrik.ostrihon@pwc.sk) - + 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 @@ -182,7 +182,7 @@ static int get_tuple_next(struct pcmcia_device *link, tuple_t * tuple, /*====================================================================== - + ======================================================================*/ static int ft1000_attach(struct pcmcia_device *link) @@ -247,7 +247,7 @@ static void ft1000_detach(struct pcmcia_device *link) ft1000_config() is scheduled to run after a CARD_INSERTION event is received, to configure the PCMCIA socket, and to make the device available to the system. - + ======================================================================*/ #define CS_CHECK(fn, ret) \ @@ -348,7 +348,7 @@ static int ft1000_config(struct pcmcia_device * link) if (last_ret != CS_SUCCESS) { cs_error(link, RequestIO, last_ret); goto failed; - } + } /* Allocate an interrupt line. Note that this does not assign a @@ -415,7 +415,7 @@ failed: After a card is removed, ft1000_release() will unregister the device, and release the PCMCIA configuration. If the device is still open, this will be postponed until it is closed. - + ======================================================================*/ static void ft1000_release(struct pcmcia_device * link) @@ -434,7 +434,7 @@ static void ft1000_release(struct pcmcia_device * link) /* In a normal driver, additional code may be needed to release - other kernel data structures associated with this device. + other kernel data structures associated with this device. */ /* Don't bother checking to see if these succeed or not */ @@ -451,7 +451,7 @@ static void ft1000_release(struct pcmcia_device * link) private flag to block future accesses to this device. All the functions that actually access the device should check this flag to make sure the card is still present. - + ======================================================================*/ static int ft1000_suspend(struct pcmcia_device *link) diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dev.h b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dev.h index 1c9d163ad3e8..4a89bd1bbf74 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dev.h +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dev.h @@ -3,16 +3,16 @@ // // Copyright (C) 2002 Flarion Technologies, All rights reserved. // -// This program is free software; you can redistribute it and/or modify it +// 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. This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -// more details. You should have received a copy of the GNU General Public -// License along with this program; if not, write to the -// Free Software Foundation, Inc., 59 Temple Place - -// Suite 330, Boston, MA 02111-1307, USA. +// Software Foundation; either version 2 of the License, or (at your option) any +// later version. This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. You should have received a copy of the GNU General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., 59 Temple Place - +// Suite 330, Boston, MA 02111-1307, USA. //--------------------------------------------------------------------------- // // File: ft1000_dev.h diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c index be9c749d5edb..0bf398d570dc 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_dnld.c @@ -1,23 +1,23 @@ /*--------------------------------------------------------------------------- FT1000 driver for Flarion Flash OFDM NIC Device - + Copyright (C) 2002 Flarion Technologies, All rights reserved. - - This program is free software; you can redistribute it and/or modify it + + 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. This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. You should have received a copy of the GNU General Public - License along with this program; if not, write to the - Free Software Foundation, Inc., 59 Temple Place - - Suite 330, Boston, MA 02111-1307, USA. + Software Foundation; either version 2 of the License, or (at your option) any + later version. This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. You should have received a copy of the GNU General Public + License along with this program; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - + Suite 330, Boston, MA 02111-1307, USA. -------------------------------------------------------------------------- - Description: This module will handshake with the DSP bootloader to + Description: This module will handshake with the DSP bootloader to download the DSP runtime image. - + ---------------------------------------------------------------------------*/ #define __KERNEL_SYSCALLS__ @@ -890,7 +890,7 @@ int card_download(struct net_device *dev, void *pFileStart, UINT FileLength) memcpy(pbuffer, (void *)pUcFile, (UINT) (usHdrLength + sizeof(PSEUDO_HDR))); - // link provisioning data + // link provisioning data pprov_record = kmalloc(sizeof(PROV_RECORD), GFP_ATOMIC); diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c index d168a73e4e47..a6ba84c242d1 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_hw.c @@ -1,20 +1,20 @@ /*--------------------------------------------------------------------------- FT1000 driver for Flarion Flash OFDM NIC Device - + Copyright (C) 2002 Flarion Technologies, All rights reserved. Copyright (C) 2006 Patrik Ostrihon, All rights reserved. Copyright (C) 2006 ProWeb Consulting, a.s, All rights reserved. - - This program is free software; you can redistribute it and/or modify it + + 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. This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - more details. You should have received a copy of the GNU General Public - License along with this program; if not, write to the - Free Software Foundation, Inc., 59 Temple Place - - Suite 330, Boston, MA 02111-1307, USA. + Software Foundation; either version 2 of the License, or (at your option) any + later version. This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. You should have received a copy of the GNU General Public + License along with this program; if not, write to the + Free Software Foundation, Inc., 59 Temple Place - + Suite 330, Boston, MA 02111-1307, USA. -----------------------------------------------------------------------------*/ #include @@ -86,7 +86,7 @@ MODULE_SUPPORTED_DEVICE("FT1000"); //--------------------------------------------------------------------------- // // Function: ft1000_asic_read -// Descripton: This function will retrieve the value of a specific ASIC +// Descripton: This function will retrieve the value of a specific ASIC // register. // Input: // dev - network device structure @@ -120,7 +120,7 @@ inline void ft1000_asic_write(struct net_device *dev, u16 offset, u16 value) //--------------------------------------------------------------------------- // // Function: ft1000_read_fifo_len -// Descripton: This function will read the ASIC Uplink FIFO status register +// Descripton: This function will read the ASIC Uplink FIFO status register // which will return the number of bytes remaining in the Uplink FIFO. // Sixteen bytes are subtracted to make sure that the ASIC does not // reach its threshold. @@ -409,7 +409,7 @@ static void ft1000_reset_asic(struct net_device *dev) // dev - device structure // Output: // status - FALSE (card reset fail) -// TRUE (card reset successful) +// TRUE (card reset successful) // //--------------------------------------------------------------------------- static int ft1000_reset_card(struct net_device *dev) @@ -449,7 +449,7 @@ static int ft1000_reset_card(struct net_device *dev) (DSP_RESET_BIT | ASIC_RESET_BIT)); } - // Copy DSP session record into info block if this is not a coldstart + // Copy DSP session record into info block if this is not a coldstart if (ft1000_card_present == 1) { spin_lock_irqsave(&info->dpram_lock, flags); if (info->AsicID == ELECTRABUZZ_ID) { @@ -573,7 +573,7 @@ static int ft1000_reset_card(struct net_device *dev) // dev - device structure // Output: // status - FALSE (device is not present) -// TRUE (device is present) +// TRUE (device is present) // //--------------------------------------------------------------------------- static int ft1000_chkcard(struct net_device *dev) @@ -640,7 +640,7 @@ static void ft1000_hbchk(u_long data) else { tempword = ntohs(ft1000_read_dpram_mag_16(dev, FT1000_MAG_HI_HO, FT1000_MAG_HI_HO_INDX)); } - } + } if (tempword != ho) { printk(KERN_INFO "ft1000: heartbeat failed - no ho detected\n"); @@ -689,7 +689,7 @@ static void ft1000_hbchk(u_long data) // Let's check doorbell again if fail if (tempword & FT1000_DB_HB) { tempword = ft1000_read_reg(dev, FT1000_REG_DOORBELL); - } + } if (tempword & FT1000_DB_HB) { printk(KERN_INFO "ft1000: heartbeat doorbell not clear by firmware\n"); @@ -733,7 +733,7 @@ static void ft1000_hbchk(u_long data) add_timer(&poll_timer); return; } - // Set dedicated area to hi and ring appropriate doorbell according + // Set dedicated area to hi and ring appropriate doorbell according // to hi/ho heartbeat protocol if (info->AsicID == ELECTRABUZZ_ID) { ft1000_write_dpram(dev, FT1000_HI_HO, hi); @@ -765,9 +765,9 @@ static void ft1000_hbchk(u_long data) else { tempword = ntohs(ft1000_read_dpram_mag_16(dev, FT1000_MAG_HI_HO, FT1000_MAG_HI_HO_INDX)); } - + } - + if (tempword != hi) { printk(KERN_INFO "ft1000: heartbeat failed - cannot write hi into DPRAM\n"); @@ -824,7 +824,7 @@ static void ft1000_hbchk(u_long data) //--------------------------------------------------------------------------- // // Function: ft1000_send_cmd -// Descripton: +// Descripton: // Input: // Output: // @@ -904,7 +904,7 @@ void ft1000_send_cmd (struct net_device *dev, u16 *ptempbuffer, int size, u16 qt //--------------------------------------------------------------------------- // // Function: ft1000_receive_cmd -// Descripton: This function will read a message from the dpram area. +// Descripton: This function will read a message from the dpram area. // Input: // dev - network device structure // pbuffer - caller supply address to buffer @@ -1105,7 +1105,7 @@ void ft1000_proc_drvmsg(struct net_device *dev) netif_carrier_off(dev); netif_stop_queue(dev); info->ConTm = 0; - } + } } } else { @@ -1196,7 +1196,7 @@ void ft1000_proc_drvmsg(struct net_device *dev) ppseudo_hdr->qos_class = 0; // Insert slow queue sequence number ppseudo_hdr->seq_num = info->squeseqnum++; - // Insert application id + // Insert application id ppseudo_hdr->portsrc = 0; // Calculate new checksum ppseudo_hdr->checksum = *pmsg++; @@ -1244,7 +1244,7 @@ void ft1000_proc_drvmsg(struct net_device *dev) ppseudo_hdr->qos_class = 0; // Insert slow queue sequence number ppseudo_hdr->seq_num = info->squeseqnum++; - // Insert application id + // Insert application id ppseudo_hdr->portsrc = 0; // Calculate new checksum ppseudo_hdr->checksum = *pmsg++; @@ -1286,8 +1286,8 @@ void ft1000_proc_drvmsg(struct net_device *dev) // Input: // dev - device structure // Output: -// status - FAILURE -// SUCCESS +// status - FAILURE +// SUCCESS // //--------------------------------------------------------------------------- int ft1000_parse_dpram_msg(struct net_device *dev) @@ -1392,7 +1392,7 @@ int ft1000_parse_dpram_msg(struct net_device *dev) } if (doorbell & FT1000_DB_COND_RESET) { - // Reset ASIC and DSP + // Reset ASIC and DSP if (info->AsicID == ELECTRABUZZ_ID) { info->DSP_TIME[0] = ft1000_read_dpram(dev, FT1000_DSP_TIMER0); @@ -1583,14 +1583,14 @@ static void ft1000_flush_fifo(struct net_device *dev, u16 DrvErrNum) //--------------------------------------------------------------------------- // // Function: ft1000_copy_up_pkt -// Descripton: This function will pull Flarion packets out of the Downlink +// Descripton: This function will pull Flarion packets out of the Downlink // FIFO and convert it to an ethernet packet. The ethernet packet will // then be deliver to the TCP/IP stack. // Input: // dev - device structure // Output: -// status - FAILURE -// SUCCESS +// status - FAILURE +// SUCCESS // //--------------------------------------------------------------------------- int ft1000_copy_up_pkt(struct net_device *dev) @@ -1767,16 +1767,16 @@ int ft1000_copy_up_pkt(struct net_device *dev) //--------------------------------------------------------------------------- // // Function: ft1000_copy_down_pkt -// Descripton: This function will take an ethernet packet and convert it to -// a Flarion packet prior to sending it to the ASIC Downlink +// Descripton: This function will take an ethernet packet and convert it to +// a Flarion packet prior to sending it to the ASIC Downlink // FIFO. // Input: // dev - device structure // packet - address of ethernet packet // len - length of IP packet // Output: -// status - FAILURE -// SUCCESS +// status - FAILURE +// SUCCESS // //--------------------------------------------------------------------------- int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len) @@ -1792,7 +1792,7 @@ int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len) DEBUG(1, "ft1000_hw: copy_down_pkt()\n"); - // Check if there is room on the FIFO + // Check if there is room on the FIFO if (len > ft1000_read_fifo_len(dev)) { udelay(10); if (len > ft1000_read_fifo_len(dev)) { @@ -1841,12 +1841,12 @@ int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len) // Production Mode if (info->AsicID == ELECTRABUZZ_ID) { - // copy first word to UFIFO_BEG reg + // copy first word to UFIFO_BEG reg ft1000_write_reg(dev, FT1000_REG_UFIFO_BEG, pseudo.buff[0]); DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 0 BEG = 0x%04x\n", pseudo.buff[0]); - // copy subsequent words to UFIFO_MID reg + // copy subsequent words to UFIFO_MID reg ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, pseudo.buff[1]); DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data 1 MID = 0x%04x\n", pseudo.buff[1]); @@ -1879,7 +1879,7 @@ int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len) packet++; } - // Check for odd byte + // Check for odd byte if (len & 0x0001) { ft1000_write_reg(dev, FT1000_REG_UFIFO_MID, htons(*packet)); @@ -1923,7 +1923,7 @@ int ft1000_copy_down_pkt(struct net_device *dev, u16 * packet, u16 len) outl(*plong++, dev->base_addr + FT1000_REG_MAG_UFDR); } - // Check for odd alignment + // Check for odd alignment if (len & 0x0003) { DEBUG(1, "ft1000_hw:ft1000_copy_down_pkt:data = 0x%8x\n", diff --git a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c index 94b2755a3357..b45de9bc1b20 100644 --- a/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c +++ b/drivers/staging/ft1000/ft1000-pcmcia/ft1000_proc.c @@ -1,9 +1,9 @@ /*--------------------------------------------------------------------------- FT1000 driver for Flarion Flash OFDM NIC Device - + Copyright (C) 2006 Patrik Ostrihon, All rights reserved. Copyright (C) 2006 ProWeb Consulting, a.s, All rights reserved. - + 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 diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_chdev.c b/drivers/staging/ft1000/ft1000-usb/ft1000_chdev.c index 5e75ee844860..65087cea3028 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_chdev.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_chdev.c @@ -3,16 +3,16 @@ // // Copyright (C) 2006 Flarion Technologies, All rights reserved. // -// This program is free software; you can redistribute it and/or modify it +// 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. This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -// more details. You should have received a copy of the GNU General Public -// License along with this program; if not, write to the -// Free Software Foundation, Inc., 59 Temple Place - -// Suite 330, Boston, MA 02111-1307, USA. +// Software Foundation; either version 2 of the License, or (at your option) any +// later version. This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. You should have received a copy of the GNU General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., 59 Temple Place - +// Suite 330, Boston, MA 02111-1307, USA. //--------------------------------------------------------------------------- // // File: ft1000_chdev.c @@ -49,10 +49,10 @@ extern inline u16 ft1000_asic_read (struct net_device *dev, u16 offset); extern inline void ft1000_asic_write (struct net_device *dev, u16 offset, u16 value); extern void CardSendCommand(struct ft1000_device *ft1000dev, unsigned short *ptempbuffer, int size); -static int ft1000_ChOpen (struct inode *Inode, struct file *File); +static int ft1000_ChOpen (struct inode *Inode, struct file *File); static unsigned int ft1000_ChPoll(struct file *file, poll_table *wait); static int ft1000_ChIoctl(struct file *File, unsigned int Command, - unsigned long Argument); + unsigned long Argument); static int ft1000_ChRelease (struct inode *Inode, struct file *File); static int ft1000_flarion_cnt = 0; @@ -69,7 +69,7 @@ static struct ft1000_device *pdevobj[MAX_NUM_CARDS + 2]; struct list_head freercvpool; // lock to arbitrate free buffer list for receive command data -spinlock_t free_buff_lock; +spinlock_t free_buff_lock; int numofmsgbuf = 0; @@ -82,8 +82,8 @@ int numofmsgbuf = 0; static struct file_operations ft1000fops = { unlocked_ioctl: ft1000_ChIoctl, - poll: ft1000_ChPoll, - open: ft1000_ChOpen, + poll: ft1000_ChPoll, + open: ft1000_ChOpen, release: ft1000_ChRelease }; @@ -93,7 +93,7 @@ static struct file_operations ft1000fops = //--------------------------------------------------------------------------- // Function: exec_mknod // -// Parameters: +// Parameters: // // Returns: // @@ -102,12 +102,12 @@ static struct file_operations ft1000fops = // Notes: // //--------------------------------------------------------------------------- -static int exec_mknod (void *pdata) +static int exec_mknod (void *pdata) { PFT1000_INFO info; char mjnum[4]; char minornum[4]; - char temp[32]; + char temp[32]; int retcode; // int i; //aelias [-] reason : unused variable char *envp[] = { "HOME=/", "PATH=/usr/bin:/bin", NULL }; @@ -118,20 +118,20 @@ static int exec_mknod (void *pdata) sprintf(temp, "%s%s", "/dev/", info->DeviceName) ; sprintf(mjnum, "%d", info->DeviceMajor); sprintf(minornum, "%d", info->CardNumber); - + //char *argv[]={"mknod","-m 666",temp,"c",mjnum,minornum,NULL}; // char *argv[]={"-m 666",temp,"c",mjnum,minornum,NULL}; //for (i=0; i<7;i++) // DEBUG("argv[%d]=%s\n", i, argv[i]); - + retcode = call_usermodehelper ("/bin/mknod", argv, envp, 1); if (retcode) { DEBUG("ft1000_chdev:exec_mknod failed to make the node: retcode = %d\n", retcode); } - + return retcode; @@ -143,21 +143,21 @@ static int exec_mknod (void *pdata) // Description: This module removes the FT1000 device file // //--------------------------------------------------------------------------- -static int rm_mknod (void *pdata) +static int rm_mknod (void *pdata) { - + PFT1000_INFO info; //char *argv[4]={"rm", "-f", "/dev/FT1000", NULL}; int retcode; - char temp[32]; + char temp[32]; char *argv[]={"rm", "-f", temp, NULL}; info = (PFT1000_INFO)pdata; DEBUG("ft1000_chdev:rm_mknod is called for device %s\n", info->DeviceName); sprintf(temp, "%s%s", "/dev/", info->DeviceName) ; - + // char *argv[]={"rm", "-f", temp, NULL}; - + retcode = call_usermodehelper ("/bin/rm", argv, NULL, 1); if (retcode) { DEBUG("ft1000_chdev:rm_mknod failed to remove the node: retcode = %d\n", retcode); @@ -172,7 +172,7 @@ static int rm_mknod (void *pdata) //--------------------------------------------------------------------------- // Function: ft1000_get_buffer // -// Parameters: +// Parameters: // // Returns: // @@ -185,7 +185,7 @@ PDPRAM_BLK ft1000_get_buffer (struct list_head *bufflist) { unsigned long flags; PDPRAM_BLK ptr; - + spin_lock_irqsave(&free_buff_lock, flags); // Check if buffer is available if ( list_empty(bufflist) ) { @@ -209,7 +209,7 @@ PDPRAM_BLK ft1000_get_buffer (struct list_head *bufflist) //--------------------------------------------------------------------------- // Function: ft1000_free_buffer // -// Parameters: +// Parameters: // // Returns: // @@ -221,7 +221,7 @@ PDPRAM_BLK ft1000_get_buffer (struct list_head *bufflist) void ft1000_free_buffer (PDPRAM_BLK pdpram_blk, struct list_head *plist) { unsigned long flags; - + spin_lock_irqsave(&free_buff_lock, flags); // Put memory back to list list_add_tail(&pdpram_blk->list, plist); @@ -255,15 +255,15 @@ int ft1000_CreateDevice(struct ft1000_device *dev) // Delete any existing FT1000 node pid = kernel_thread (rm_mknod,(void *)info, 0); msleep(1000); - + DEBUG("ft1000_CreateDevice: number of instance = %d\n", ft1000_flarion_cnt); DEBUG("DeviceCreated = %x\n", info->DeviceCreated); - + //save the device info to global array pdevobj[info->CardNumber] = dev; DEBUG("ft1000_CreateDevice: ******SAVED pdevobj[%d]=%x\n", info->CardNumber, (unsigned int)pdevobj[info->CardNumber]); //aelias [+] reason:up - + if (info->DeviceCreated) { DEBUG("ft1000_CreateDevice: \"%s\" already registered\n", info->DeviceName); @@ -274,7 +274,7 @@ int ft1000_CreateDevice(struct ft1000_device *dev) // register the device DEBUG("ft1000_CreateDevice: \"%s\" device registration\n", info->DeviceName); info->DeviceMajor = 0; - + result = register_chrdev(info->DeviceMajor, info->DeviceName, &ft1000fops); if (result < 0) { @@ -293,12 +293,12 @@ int ft1000_CreateDevice(struct ft1000_device *dev) // Create a thread to call user mode app to mknod pid = kernel_thread (exec_mknod, (void *)info, 0); - - // initialize application information + + // initialize application information info->appcnt = 0; - + // if (ft1000_flarion_cnt == 0) { -// +// // DEBUG("Initialize free_buff_lock and freercvpool\n"); // spin_lock_init(&free_buff_lock); // @@ -310,15 +310,15 @@ int ft1000_CreateDevice(struct ft1000_device *dev) // // Get memory for DPRAM_DATA link list // pdpram_blk = kmalloc ( sizeof(DPRAM_BLK), GFP_KERNEL ); // // Get a block of memory to store command data -// pdpram_blk->pbuffer = kmalloc ( MAX_CMD_SQSIZE, GFP_KERNEL ); -// // link provisioning data +// pdpram_blk->pbuffer = kmalloc ( MAX_CMD_SQSIZE, GFP_KERNEL ); +// // link provisioning data // list_add_tail (&pdpram_blk->list, &freercvpool); // } // numofmsgbuf = NUM_OF_FREE_BUFFERS; // } - - // initialize application information + + // initialize application information info->appcnt = 0; for (i=0; iapp_info[i].nTxMsg = 0; @@ -336,7 +336,7 @@ int ft1000_CreateDevice(struct ft1000_device *dev) -// ft1000Handle[info->CardNumber] = devfs_register(NULL, info->DeviceName, DEVFS_FL_AUTO_DEVNUM, 0, 0, +// ft1000Handle[info->CardNumber] = devfs_register(NULL, info->DeviceName, DEVFS_FL_AUTO_DEVNUM, 0, 0, // S_IFCHR | S_IRUGO | S_IWUGO, &ft1000fops, NULL); @@ -364,16 +364,16 @@ void ft1000_DestroyDevice(struct net_device *dev) int i; PDPRAM_BLK pdpram_blk; DPRAM_BLK *ptr; - + DEBUG("ft1000_chdev:ft1000_DestroyDevice called\n"); - - + + if (info->DeviceCreated) { - ft1000_flarion_cnt--; + ft1000_flarion_cnt--; unregister_chrdev(info->DeviceMajor, info->DeviceName); - DEBUG("ft1000_DestroyDevice: unregistered device \"%s\", result = %d\n", + DEBUG("ft1000_DestroyDevice: unregistered device \"%s\", result = %d\n", info->DeviceName, result); pid = kernel_thread (rm_mknod, (void *)info, 0); @@ -381,10 +381,10 @@ void ft1000_DestroyDevice(struct net_device *dev) // Make sure we free any memory reserve for slow Queue for (i=0; iapp_info[i].app_sqlist) == 0) { - pdpram_blk = list_entry(info->app_info[i].app_sqlist.next, DPRAM_BLK, list); + pdpram_blk = list_entry(info->app_info[i].app_sqlist.next, DPRAM_BLK, list); list_del(&pdpram_blk->list); ft1000_free_buffer(pdpram_blk, &freercvpool); - + } wake_up_interruptible(&info->app_info[i].wait_dpram_msg); } @@ -395,39 +395,39 @@ void ft1000_DestroyDevice(struct net_device *dev) ptr = list_entry(freercvpool.next, DPRAM_BLK, list); list_del(&ptr->list); kfree(ptr->pbuffer); - kfree(ptr); + kfree(ptr); } } // devfs_unregister(ft1000Handle[info->CardNumber]); info->DeviceCreated = FALSE; - + pdevobj[info->CardNumber] = NULL; } - - + + } //--------------------------------------------------------------------------- // Function: ft1000_ChOpen // -// Parameters: +// Parameters: // -// Description: +// Description: // // Notes: // //--------------------------------------------------------------------------- -static int ft1000_ChOpen (struct inode *Inode, struct file *File) +static int ft1000_ChOpen (struct inode *Inode, struct file *File) { PFT1000_INFO info; int i,num; - + DEBUG("ft1000_ChOpen called\n"); num = (MINOR(Inode->i_rdev) & 0xf); DEBUG("ft1000_ChOpen: minor number=%d\n", num); - + for (i=0; i<5; i++) DEBUG("pdevobj[%d]=%x\n", i, (unsigned int)pdevobj[i]); //aelias [+] reason: down @@ -477,9 +477,9 @@ static int ft1000_ChOpen (struct inode *Inode, struct file *File) //--------------------------------------------------------------------------- // Function: ft1000_ChPoll // -// Parameters: +// Parameters: // -// Description: +// Description: // // Notes: // @@ -490,7 +490,7 @@ static unsigned int ft1000_ChPoll(struct file *file, poll_table *wait) struct net_device *dev = file->private_data; PFT1000_INFO info; int i; - + //DEBUG("ft1000_ChPoll called\n"); if (ft1000_flarion_cnt == 0) { DEBUG("FT1000:ft1000_ChPoll called when ft1000_flarion_cnt is zero\n"); @@ -498,7 +498,7 @@ static unsigned int ft1000_ChPoll(struct file *file, poll_table *wait) } info = (FT1000_INFO *) netdev_priv (dev); - + // Search for matching file object for (i=0; iapp_info[i].fileobject == (u32)(&file->f_owner) ) { @@ -511,13 +511,13 @@ static unsigned int ft1000_ChPoll(struct file *file, poll_table *wait) if (i == MAX_NUM_APP) { DEBUG("FT1000:ft1000_ChIoctl:Could not find application info block\n"); return ( -EACCES ); - } - + } + if (list_empty(&info->app_info[i].app_sqlist) == 0) { DEBUG("FT1000:ft1000_ChPoll:Message detected in slow queue\n"); return(POLLIN | POLLRDNORM | POLLPRI); } - + poll_wait (file, &info->app_info[i].wait_dpram_msg, wait); //DEBUG("FT1000:ft1000_ChPoll:Polling for data from DSP\n"); @@ -527,24 +527,24 @@ static unsigned int ft1000_ChPoll(struct file *file, poll_table *wait) //--------------------------------------------------------------------------- // Function: ft1000_ChIoctl // -// Parameters: +// Parameters: // -// Description: +// Description: // // Notes: // //--------------------------------------------------------------------------- static int ft1000_ChIoctl (struct file *File, unsigned int Command, - unsigned long Argument) + unsigned long Argument) { struct net_device *dev; PFT1000_INFO info; struct ft1000_device *ft1000dev; int result=0; int cmd; - int i; - u16 tempword; - unsigned long flags; + int i; + u16 tempword; + unsigned long flags; struct timeval tv; IOCTL_GET_VER get_ver_data; IOCTL_GET_DSP_STAT get_stat_data; @@ -556,8 +556,8 @@ static int ft1000_ChIoctl (struct file *File, unsigned int Command, 0x00,0x01,0x00,0x00}; unsigned short ledStat=0; - unsigned short conStat=0; - + unsigned short conStat=0; + //DEBUG("ft1000_ChIoctl called\n"); if (ft1000_flarion_cnt == 0) { @@ -572,7 +572,7 @@ static int ft1000_ChIoctl (struct file *File, unsigned int Command, ft1000dev = info->pFt1000Dev; cmd = _IOC_NR(Command); //DEBUG("FT1000:ft1000_ChIoctl:cmd = 0x%x\n", cmd); - + // process the command switch (cmd) { case IOCTL_REGISTER_CMD: @@ -593,7 +593,7 @@ static int ft1000_ChIoctl (struct file *File, unsigned int Command, } } break; - + case IOCTL_GET_VER_CMD: DEBUG("FT1000:ft1000_ChIoctl: IOCTL_FT1000_GET_VER called\n"); @@ -612,14 +612,14 @@ static int ft1000_ChIoctl (struct file *File, unsigned int Command, // Connect Message DEBUG("FT1000:ft1000_ChIoctl: IOCTL_FT1000_CONNECT\n"); ConnectionMsg[79] = 0xfc; - CardSendCommand(ft1000dev, (unsigned short *)ConnectionMsg, 0x4c); - + CardSendCommand(ft1000dev, (unsigned short *)ConnectionMsg, 0x4c); + break; case IOCTL_DISCONNECT: // Disconnect Message DEBUG("FT1000:ft1000_ChIoctl: IOCTL_FT1000_DISCONNECT\n"); ConnectionMsg[79] = 0xfd; - CardSendCommand(ft1000dev, (unsigned short *)ConnectionMsg, 0x4c); + CardSendCommand(ft1000dev, (unsigned short *)ConnectionMsg, 0x4c); break; case IOCTL_GET_DSP_STAT_CMD: //DEBUG("FT1000:ft1000_ChIoctl: IOCTL_FT1000_GET_DSP_STAT called\n"); @@ -640,22 +640,22 @@ static int ft1000_ChIoctl (struct file *File, unsigned int Command, else { get_stat_data.ConStat = 0x0f; } - - + + get_stat_data.nTxPkts = info->stats.tx_packets; get_stat_data.nRxPkts = info->stats.rx_packets; get_stat_data.nTxBytes = info->stats.tx_bytes; get_stat_data.nRxBytes = info->stats.rx_bytes; do_gettimeofday ( &tv ); get_stat_data.ConTm = (u32)(tv.tv_sec - info->ConTm); - DEBUG("Connection Time = %d\n", (int)get_stat_data.ConTm); + DEBUG("Connection Time = %d\n", (int)get_stat_data.ConTm); if (copy_to_user((PIOCTL_GET_DSP_STAT)Argument, &get_stat_data, sizeof(get_stat_data)) ) { DEBUG("FT1000:ft1000_ChIoctl: copy fault occurred\n"); result = -EFAULT; break; } DEBUG("ft1000_chioctl: GET_DSP_STAT succeed\n"); - break; + break; case IOCTL_SET_DPRAM_CMD: { IOCTL_DPRAM_BLK dpram_data; @@ -669,12 +669,12 @@ static int ft1000_ChIoctl (struct file *File, unsigned int Command, u16 status; //DEBUG("FT1000:ft1000_ChIoctl: IOCTL_FT1000_SET_DPRAM called\n"); - + if (ft1000_flarion_cnt == 0) { return (-EBADF); } - + if (info->DrvMsgPend) { return (-ENOTTY); } @@ -684,16 +684,16 @@ static int ft1000_ChIoctl (struct file *File, unsigned int Command, } info->fAppMsgPend = 1; - + if (info->CardReady) { - + //DEBUG("FT1000:ft1000_ChIoctl: try to SET_DPRAM \n"); // Get the length field to see how many bytes to copy result = get_user(msgsz, (unsigned short *)Argument); msgsz = ntohs (msgsz); //DEBUG("FT1000:ft1000_ChIoctl: length of message = %d\n", msgsz); - + if (msgsz > MAX_CMD_SQSIZE) { DEBUG("FT1000:ft1000_ChIoctl: bad message length = %d\n", msgsz); result = -EINVAL; @@ -731,8 +731,8 @@ static int ft1000_ChIoctl (struct file *File, unsigned int Command, qtype = ntohs(dpram_data.pseudohdr.qos_class) & 0xff; //DEBUG("FT1000_ft1000_ChIoctl: qtype = %d\n", qtype); if (qtype) { - } - else { + } + else { // Put message into Slow Queue // Only put a message into the DPRAM if msg doorbell is available status = ft1000_read_register(ft1000dev, &tempword, FT1000_REG_DOORBELL); @@ -760,9 +760,9 @@ static int ft1000_ChIoctl (struct file *File, unsigned int Command, } } } - + //DEBUG("FT1000_ft1000_ChIoctl: finished reading register\n"); - + // Make sure we are within the limits of the slow queue memory limitation if ( (msgsz < MAX_CMD_SQSIZE) && (msgsz > PSEUDOSZ) ) { // Need to put sequence number plus new checksum for message @@ -773,7 +773,7 @@ static int ft1000_ChIoctl (struct file *File, unsigned int Command, if (total_len & 0x1) { total_len++; } - + // Insert slow queue sequence number ppseudo_hdr->seq_num = info->squeseqnum++; ppseudo_hdr->portsrc = info->app_info[app_index].app_id; @@ -794,11 +794,11 @@ static int ft1000_ChIoctl (struct file *File, unsigned int Command, } #endif //dpram_command.extra = 0; - - //CardSendCommand(ft1000dev,(unsigned char*)&dpram_command,total_len+2); - CardSendCommand(ft1000dev,(unsigned short*)&dpram_data,total_len+2); - + //CardSendCommand(ft1000dev,(unsigned char*)&dpram_command,total_len+2); + CardSendCommand(ft1000dev,(unsigned short*)&dpram_data,total_len+2); + + info->app_info[app_index].nTxMsg++; break; } @@ -846,15 +846,15 @@ static int ft1000_ChIoctl (struct file *File, unsigned int Command, result = 0; pioctl_dpram = (PIOCTL_DPRAM_BLK)Argument; if (list_empty(&info->app_info[i].app_sqlist) == 0) { - //DEBUG("FT1000:ft1000_ChIoctl:Message detected in slow queue\n"); + //DEBUG("FT1000:ft1000_ChIoctl:Message detected in slow queue\n"); spin_lock_irqsave(&free_buff_lock, flags); - pdpram_blk = list_entry(info->app_info[i].app_sqlist.next, DPRAM_BLK, list); + pdpram_blk = list_entry(info->app_info[i].app_sqlist.next, DPRAM_BLK, list); list_del(&pdpram_blk->list); info->app_info[i].NumOfMsg--; //DEBUG("FT1000:ft1000_ChIoctl:NumOfMsg for app %d = %d\n", i, info->app_info[i].NumOfMsg); spin_unlock_irqrestore(&free_buff_lock, flags); msglen = ntohs(*(u16 *)pdpram_blk->pbuffer) + PSEUDOSZ; - pioctl_dpram->total_len = htons(msglen); + pioctl_dpram->total_len = htons(msglen); //DEBUG("FT1000:ft1000_ChIoctl:msg length = %x\n", msglen); if(copy_to_user (&pioctl_dpram->pseudohdr, pdpram_blk->pbuffer, msglen)) { @@ -882,9 +882,9 @@ static int ft1000_ChIoctl (struct file *File, unsigned int Command, //--------------------------------------------------------------------------- // Function: ft1000_ChRelease // -// Parameters: +// Parameters: // -// Description: +// Description: // // Notes: // @@ -895,7 +895,7 @@ static int ft1000_ChRelease (struct inode *Inode, struct file *File) struct net_device *dev; int i; PDPRAM_BLK pdpram_blk; - + DEBUG("ft1000_ChRelease called\n"); dev = File->private_data; @@ -919,16 +919,16 @@ static int ft1000_ChRelease (struct inode *Inode, struct file *File) while (list_empty(&info->app_info[i].app_sqlist) == 0) { DEBUG("Remove and free memory queue up on slow queue\n"); - pdpram_blk = list_entry(info->app_info[i].app_sqlist.next, DPRAM_BLK, list); + pdpram_blk = list_entry(info->app_info[i].app_sqlist.next, DPRAM_BLK, list); list_del(&pdpram_blk->list); ft1000_free_buffer(pdpram_blk, &freercvpool); } - - // initialize application information + + // initialize application information info->appcnt--; DEBUG("ft1000_chdev:%s:appcnt = %d\n", __FUNCTION__, info->appcnt); info->app_info[i].fileobject = 0; - + return 0; } diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c index 4751a1d11d7a..93f75b1d4e50 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_download.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_download.c @@ -47,7 +47,7 @@ #define REQUEST_DONE_CL 0x0004 #define REQUEST_VERSION_INFO 0x0005 #define REQUEST_CODE_BY_VERSION 0x0006 -#define REQUEST_MAILBOX_DATA 0x0007 +#define REQUEST_MAILBOX_DATA 0x0007 #define REQUEST_FILE_CHECKSUM 0x0008 #define STATE_START_DWNLD 0x01 @@ -72,7 +72,7 @@ #define HANDSHAKE_MAG_DSP_DATA 0x02000000 /* Dsp writes this to request for data block */ #define HANDSHAKE_MAG_DSP_DONE 0x03000000 /* Dsp writes this to indicate download done */ -#define HANDSHAKE_MAG_DRV_READY 0xFFFF0000 /* Driver writes this to indicate ready to download */ +#define HANDSHAKE_MAG_DRV_READY 0xFFFF0000 /* Driver writes this to indicate ready to download */ #define HANDSHAKE_MAG_DRV_DATA 0x02FECDAB /* Driver writes this to indicate data available to DSP */ #define HANDSHAKE_MAG_DRV_ENTRY 0x01FECDAB /* Driver writes this to indicate entry point to DSP */ @@ -208,7 +208,7 @@ char *getfw (char *fn, int *pimgsz) // Function: check_usb_db // // Parameters: struct ft1000_device - device structure -// +// // Returns: 0 - success // // Description: This function checks if the doorbell register is cleared @@ -225,32 +225,32 @@ ULONG check_usb_db (struct ft1000_device *ft1000dev) loopcnt = 0; while (loopcnt < 10) { - + status = ft1000_read_register (ft1000dev, &temp, FT1000_REG_DOORBELL); DEBUG("check_usb_db: read FT1000_REG_DOORBELL value is %x\n", temp); - if (temp & 0x0080) + if (temp & 0x0080) { DEBUG("FT1000:Got checkusb doorbell\n"); status = ft1000_write_register (ft1000dev, 0x0080, FT1000_REG_DOORBELL); #if FIFO_DNLD status = ft1000_write_register (ft1000dev, 0x0100, FT1000_REG_DOORBELL); -#endif +#endif status = ft1000_write_register (ft1000dev, 0x8000, FT1000_REG_DOORBELL); break; } - else + else { loopcnt++; msleep (10); } - } //end of while + } //end of while + - loopcnt = 0; while (loopcnt < 20) { - + status = ft1000_read_register (ft1000dev, &temp, FT1000_REG_DOORBELL); DEBUG("FT1000:check_usb_db:Doorbell = 0x%x\n", temp); if (temp & 0x8000) @@ -286,7 +286,7 @@ ULONG check_usb_db (struct ft1000_device *ft1000dev) // // Parameters: struct ft1000_device - device structure // USHORT expected_value - the handshake value expected -// +// // Returns: handshakevalue - success // HANDSHAKE_TIMEOUT_VALUE - failure // @@ -305,17 +305,17 @@ USHORT get_handshake(struct ft1000_device *ft1000dev, USHORT expected_value) loopcnt = 0; while (loopcnt < 100) { - + #if FIFO_DNLD // Need to clear downloader doorbell if Hartley ASIC status = ft1000_write_register (ft1000dev, FT1000_DB_DNLD_RX, FT1000_REG_DOORBELL); //DEBUG("FT1000:get_handshake:doorbell = 0x%x\n", temp); - if (pft1000info->fcodeldr) + if (pft1000info->fcodeldr) { DEBUG(" get_handshake: fcodeldr is %d\n", pft1000info->fcodeldr); pft1000info->fcodeldr = 0; status = check_usb_db(ft1000dev); - if (status != STATUS_SUCCESS) + if (status != STATUS_SUCCESS) { DEBUG("get_handshake: check_usb_db failed\n"); status = STATUS_FAILURE; @@ -332,29 +332,29 @@ USHORT get_handshake(struct ft1000_device *ft1000dev, USHORT expected_value) // Need to clear downloader doorbell if Hartley ASIC status = ft1000_read_register (ft1000dev, &temp, FT1000_REG_DOORBELL); //DEBUG("FT1000:get_handshake:doorbell = 0x%x\n", temp); - if (temp) + if (temp) { if (temp & FT1000_DB_DNLD_RX) { //DEBUG("get_handshake: write FT1000_DB_DNLD_RX to doorbell register\n"); status = ft1000_write_register(ft1000dev, FT1000_DB_DNLD_RX, FT1000_REG_DOORBELL); } - - if (pft1000info->fcodeldr) + + if (pft1000info->fcodeldr) { DEBUG(" get_handshake: fcodeldr is %d\n", pft1000info->fcodeldr); pft1000info->fcodeldr = 0; status = check_usb_db(ft1000dev); - if (status != STATUS_SUCCESS) + if (status != STATUS_SUCCESS) { DEBUG("get_handshake: check_usb_db failed\n"); status = STATUS_FAILURE; break; - } + } status = ft1000_read_register (ft1000dev, &temp, FT1000_REG_DOORBELL); //DEBUG("FT1000:get_handshake:doorbell = 0x%x\n", temp); - if (temp) + if (temp) { if (temp & FT1000_DB_DNLD_RX) status = ft1000_write_register(ft1000dev,FT1000_DB_DNLD_RX, FT1000_REG_DOORBELL); @@ -370,7 +370,7 @@ USHORT get_handshake(struct ft1000_device *ft1000dev, USHORT expected_value) #endif - if (status) + if (status) return HANDSHAKE_TIMEOUT_VALUE; //DEBUG("get_handshake: handshake= %x\n", handshake); @@ -387,7 +387,7 @@ USHORT get_handshake(struct ft1000_device *ft1000dev, USHORT expected_value) //DEBUG("HANDSHKE LOOP: %d\n", loopcnt); } - + //DEBUG("get_handshake: return handshake time out\n"); return HANDSHAKE_TIMEOUT_VALUE; } @@ -397,7 +397,7 @@ USHORT get_handshake(struct ft1000_device *ft1000dev, USHORT expected_value) // // Parameters: struct ft1000_device - device structure // USHORT handshake_value - handshake to be written -// +// // Returns: none // // Description: This function write the handshake value to the handshake location @@ -426,13 +426,13 @@ void put_handshake(struct ft1000_device *ft1000dev,USHORT handshake_value) #if FIFO_DNLD for (i=0; i<1000; i++); #else - for (i=0; i<10; i++) - { + for (i=0; i<10; i++) + { status = ft1000_read_register (ft1000dev, &tempword, FT1000_REG_DOORBELL); if ((tempword & FT1000_DB_DNLD_TX) == 0) break; } - if (i==10) + if (i==10) { DEBUG("FT1000:put_handshake could not clear Tx doorbell\n"); status = ft1000_read_register (ft1000dev, &tempword, FT1000_REG_DOORBELL); @@ -457,7 +457,7 @@ USHORT get_handshake_usb(struct ft1000_device *ft1000dev, USHORT expected_value) if (pft1000info->usbboot == 2) { status = ft1000_read_dpram32 (ft1000dev, 0, (PUCHAR)&(pft1000info->tempbuf[0]), 64); for (temp=0; temp<16; temp++) - DEBUG("tempbuf %d = 0x%x\n", temp, pft1000info->tempbuf[temp]); + DEBUG("tempbuf %d = 0x%x\n", temp, pft1000info->tempbuf[temp]); status = ft1000_read_dpram16 (ft1000dev, DWNLD_MAG1_HANDSHAKE_LOC, (PUCHAR)&handshake, 1); DEBUG("handshake from read_dpram16 = 0x%x\n", handshake); if (pft1000info->dspalive == pft1000info->tempbuf[6]) @@ -493,7 +493,7 @@ void put_handshake_usb(struct ft1000_device *ft1000dev,USHORT handshake_value) // Function: get_request_type // // Parameters: struct ft1000_device - device structure -// +// // Returns: request type - success // // Description: This function returns the request type @@ -569,7 +569,7 @@ USHORT get_request_type_usb(struct ft1000_device *ft1000dev) // Function: get_request_value // // Parameters: struct ft1000_device - device structure -// +// // Returns: request value - success // // Description: This function returns the request value @@ -597,9 +597,9 @@ long get_request_value(struct ft1000_device *ft1000dev) status = ft1000_read_dpram16(ft1000dev, DWNLD_MAG1_SIZE_LOC, (PUCHAR)&tempword, 1); value |= (tempword << 16); value = ntohl(value); - } + } + - //DEBUG("get_request_value: value is %x\n", value); return value; @@ -628,7 +628,7 @@ long get_request_value_usb(struct ft1000_device *ft1000dev) if (pft1000info->usbboot == 1) pft1000info->usbboot = 2; #endif - + //DEBUG("get_request_value_usb: value is %x\n", value); return value; @@ -639,7 +639,7 @@ long get_request_value_usb(struct ft1000_device *ft1000dev) // // Parameters: struct ft1000_device - device structure // long lvalue - value to be put into DPRAM location DWNLD_MAG1_SIZE_LOC -// +// // Returns: none // // Description: This function writes a value to DWNLD_MAG1_SIZE_LOC @@ -656,7 +656,7 @@ void put_request_value(struct ft1000_device *ft1000dev, long lvalue) status = fix_ft1000_write_dpram32(ft1000dev, DWNLD_MAG1_SIZE_LOC, (PUCHAR)&tempx); - + //DEBUG("put_request_value: value is %x\n", lvalue); } @@ -667,7 +667,7 @@ void put_request_value(struct ft1000_device *ft1000dev, long lvalue) // Function: hdr_checksum // // Parameters: PPSEUDO_HDR pHdr - Pseudo header pointer -// +// // Returns: checksum - success // // Description: This function returns the checksum of the pseudo header @@ -680,7 +680,7 @@ USHORT hdr_checksum(PPSEUDO_HDR pHdr) USHORT *usPtr = (USHORT *)pHdr; USHORT chksum; - + chksum = ((((((usPtr[0] ^ usPtr[1]) ^ usPtr[2]) ^ usPtr[3]) ^ usPtr[4]) ^ usPtr[5]) ^ usPtr[6]); @@ -696,7 +696,7 @@ USHORT hdr_checksum(PPSEUDO_HDR pHdr) // UCHAR **pUcFile - DSP image file pointer in UCHAR // long word_length - lenght of the buffer to be written // to DPRAM -// +// // Returns: STATUS_SUCCESS - success // STATUS_FAILURE - failure // @@ -736,9 +736,9 @@ ULONG write_blk (struct ft1000_device *ft1000dev, USHORT **pUsFile, UCHAR **pUcF { loopcnt = 0; - for (i=0; i<32; i++) + for (i=0; i<32; i++) { - if (tempword != 0) + if (tempword != 0) { tempbuffer[i++] = *(*pUsFile); (*pUsFile)++; @@ -748,42 +748,42 @@ ULONG write_blk (struct ft1000_device *ft1000dev, USHORT **pUsFile, UCHAR **pUcF loopcnt++; tempword--; } - else + else { tempbuffer[i++] = 0; tempbuffer[i] = 0; } } - + //DEBUG("write_blk: loopcnt is %d\n", loopcnt); //DEBUG("write_blk: bootmode = %d\n", bootmode); //DEBUG("write_blk: dpram = %x\n", dpram); - if (pft1000info->bootmode == 0) - { - if (dpram >= 0x3F4) + if (pft1000info->bootmode == 0) + { + if (dpram >= 0x3F4) Status = ft1000_write_dpram32 (ft1000dev, dpram, (PUCHAR)&tempbuffer[0], 8); - else + else Status = ft1000_write_dpram32 (ft1000dev, dpram, (PUCHAR)&tempbuffer[0], 64); } - else + else { - for (j=0; j<10; j++) + for (j=0; j<10; j++) { Status = ft1000_write_dpram32 (ft1000dev, dpram, (PUCHAR)&tempbuffer[0], 64); - if (Status == STATUS_SUCCESS) + if (Status == STATUS_SUCCESS) { // Work around for ASIC bit stuffing problem. - if ( (tempbuffer[31] & 0xfe00) == 0xfe00) + if ( (tempbuffer[31] & 0xfe00) == 0xfe00) { Status = ft1000_write_dpram32(ft1000dev, dpram+12, (PUCHAR)&tempbuffer[24], 64); } // Let's check the data written Status = ft1000_read_dpram32 (ft1000dev, dpram, (PUCHAR)&resultbuffer[0], 64); - if ( (tempbuffer[31] & 0xfe00) == 0xfe00) + if ( (tempbuffer[31] & 0xfe00) == 0xfe00) { - for (i=0; i<28; i++) + for (i=0; i<28; i++) { - if (resultbuffer[i] != tempbuffer[i]) + if (resultbuffer[i] != tempbuffer[i]) { //NdisMSleep (100); DEBUG("FT1000:download:DPRAM write failed 1 during bootloading\n"); @@ -793,7 +793,7 @@ ULONG write_blk (struct ft1000_device *ft1000dev, USHORT **pUsFile, UCHAR **pUcF } } Status = ft1000_read_dpram32 (ft1000dev, dpram+12, (PUCHAR)&resultbuffer[0], 64); - for (i=0; i<16; i++) + for (i=0; i<16; i++) { if (resultbuffer[i] != tempbuffer[i+24]) { @@ -805,11 +805,11 @@ ULONG write_blk (struct ft1000_device *ft1000dev, USHORT **pUsFile, UCHAR **pUcF } } } - else + else { - for (i=0; i<32; i++) + for (i=0; i<32; i++) { - if (resultbuffer[i] != tempbuffer[i]) + if (resultbuffer[i] != tempbuffer[i]) { //NdisMSleep (100); DEBUG("FT1000:download:DPRAM write failed 3 during bootloading\n"); @@ -820,13 +820,13 @@ ULONG write_blk (struct ft1000_device *ft1000dev, USHORT **pUsFile, UCHAR **pUcF } } - if (Status == STATUS_SUCCESS) + if (Status == STATUS_SUCCESS) break; - + } } - - if (Status != STATUS_SUCCESS) + + if (Status != STATUS_SUCCESS) { DEBUG("FT1000:download:Write failed tempbuffer[31] = 0x%x\n", tempbuffer[31]); break; @@ -835,7 +835,7 @@ ULONG write_blk (struct ft1000_device *ft1000dev, USHORT **pUsFile, UCHAR **pUcF } dpram = dpram + loopcnt; } - + return Status; } @@ -852,7 +852,7 @@ static void usb_dnld_complete (struct urb *urb) // UCHAR **pUcFile - DSP image file pointer in UCHAR // long word_length - lenght of the buffer to be written // to DPRAM -// +// // Returns: STATUS_SUCCESS - success // STATUS_FAILURE - failure // @@ -894,7 +894,7 @@ ULONG write_blk_fifo (struct ft1000_device *ft1000dev, USHORT **pUsFile, UCHAR * byte_length, &cnt, 10); - DEBUG("write_blk_fifo Status = 0x%8x Bytes Transfer = %d Data = 0x%x\n", Status, cnt, *pblk); + DEBUG("write_blk_fifo Status = 0x%8x Bytes Transfer = %d Data = 0x%x\n", Status, cnt, *pblk); kfree(pblk); #else @@ -907,7 +907,7 @@ ULONG write_blk_fifo (struct ft1000_device *ft1000dev, USHORT **pUsFile, UCHAR * byte_length, usb_dnld_complete, (void*)ft1000dev); - + usb_submit_urb(ft1000dev->tx_urb, GFP_ATOMIC); #endif @@ -962,9 +962,9 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, ULONG FileLe USHORT dpram = 0; PUCHAR pbuffer; PPROV_RECORD pprov_record; - FT1000_INFO *pft1000info = netdev_priv(ft1000dev->net); - - DEBUG("Entered scram_dnldr...\n"); + FT1000_INFO *pft1000info = netdev_priv(ft1000dev->net); + + DEBUG("Entered scram_dnldr...\n"); pft1000info->fcodeldr = 0; pft1000info->usbboot = 0; @@ -988,7 +988,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, ULONG FileLe pBootEnd = (UCHAR *)(pFileStart + pFileHdr5->loader_code_end); loader_code_address = pFileHdr5->loader_code_address; - loader_code_size = pFileHdr5->loader_code_size; + loader_code_size = pFileHdr5->loader_code_size; bGoodVersion = FALSE; while ((Status == STATUS_SUCCESS) && (uiState != STATE_DONE_FILE)) @@ -1031,7 +1031,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, ULONG FileLe { case REQUEST_RUN_ADDRESS: DEBUG("FT1000:REQUEST_RUN_ADDRESS\n"); - put_request_value(ft1000dev, loader_code_address); + put_request_value(ft1000dev, loader_code_address); break; case REQUEST_CODE_LENGTH: DEBUG("FT1000:REQUEST_CODE_LENGTH\n"); @@ -1100,7 +1100,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, ULONG FileLe case STATE_CODE_DWNLD: //DEBUG("FT1000:STATE_CODE_DWNLD\n"); pft1000info->bootmode = 0; - if (pft1000info->usbboot) + if (pft1000info->usbboot) handshake = get_handshake_usb(ft1000dev, HANDSHAKE_REQUEST); else handshake = get_handshake(ft1000dev, HANDSHAKE_REQUEST); @@ -1111,7 +1111,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, ULONG FileLe */ if (pft1000info->usbboot) request = get_request_type_usb(ft1000dev); - else + else request = get_request_type(ft1000dev); switch (request) { @@ -1168,7 +1168,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, ULONG FileLe word_length = get_request_value_usb(ft1000dev); //DEBUG("FT1000:download:word_length = %d\n", (int)word_length); if (word_length > MAX_LENGTH/2) -#else +#else word_length = get_request_value(ft1000dev); //DEBUG("FT1000:download:word_length = %d\n", (int)word_length); if (word_length > MAX_LENGTH) @@ -1207,35 +1207,35 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, ULONG FileLe #else write_blk (ft1000dev, &pUsFile, &pUcFile, word_length); //ft1000_write_dpram32 (ft1000dev, dpram, (PUCHAR)pUcFile, word_length); -#endif +#endif break; case REQUEST_MAILBOX_DATA: DEBUG("FT1000:download: REQUEST_MAILBOX_DATA\n"); // Convert length from byte count to word count. Make sure we round up. - word_length = (long)(pft1000info->DSPInfoBlklen + 1)/2; + word_length = (long)(pft1000info->DSPInfoBlklen + 1)/2; put_request_value(ft1000dev, word_length); pMailBoxData = (PDRVMSG)&(pft1000info->DSPInfoBlk[0]); /* * Position ASIC DPRAM auto-increment pointer. - */ - + */ + pUsData = (USHORT *)&pMailBoxData->data[0]; - dpram = (USHORT)DWNLD_MAG1_PS_HDR_LOC; + dpram = (USHORT)DWNLD_MAG1_PS_HDR_LOC; if (word_length & 0x1) word_length++; - + word_length = (word_length / 2); - + for (; word_length > 0; word_length--) /* In words */ { - + templong = *pUsData++; templong |= (*pUsData++ << 16); - Status = fix_ft1000_write_dpram32 (ft1000dev, dpram++, (PUCHAR)&templong); - + Status = fix_ft1000_write_dpram32 (ft1000dev, dpram++, (PUCHAR)&templong); + } break; @@ -1245,26 +1245,26 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, ULONG FileLe put_request_value(ft1000dev, word_length); /* * Position ASIC DPRAM auto-increment pointer. - */ - + */ + pUsFile = (USHORT *)(pFileStart + pFileHdr5->version_data_offset); - - dpram = (USHORT)DWNLD_MAG1_PS_HDR_LOC; + + dpram = (USHORT)DWNLD_MAG1_PS_HDR_LOC; if (word_length & 0x1) word_length++; - + word_length = (word_length / 2); - + for (; word_length > 0; word_length--) /* In words */ { - + templong = ntohs(*pUsFile++); temp = ntohs(*pUsFile++); templong |= (temp << 16); - Status = fix_ft1000_write_dpram32 (ft1000dev, dpram++, (PUCHAR)&templong); - + Status = fix_ft1000_write_dpram32 (ft1000dev, dpram++, (PUCHAR)&templong); + } break; @@ -1272,12 +1272,12 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, ULONG FileLe DEBUG("FT1000:download:REQUEST_CODE_BY_VERSION\n"); bGoodVersion = FALSE; requested_version = get_request_value(ft1000dev); - - pDspImageInfoV6 = (PDSP_IMAGE_INFO_V6)(pFileStart + sizeof(DSP_FILE_HDR_5)); - + + pDspImageInfoV6 = (PDSP_IMAGE_INFO_V6)(pFileStart + sizeof(DSP_FILE_HDR_5)); + for (imageN = 0; imageN < pFileHdr5->nDspImages; imageN++) { - + temp = (USHORT)(pDspImageInfoV6->version); templong = temp; temp = (USHORT)(pDspImageInfoV6->version >> 16); @@ -1295,10 +1295,10 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, ULONG FileLe break; } pDspImageInfoV6++; - + } //end of for - + if (!bGoodVersion) { /* @@ -1332,7 +1332,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, ULONG FileLe DEBUG("FT1000:download:Code loader is done...\n"); uiState = STATE_SECTION_PROV; break; - + case STATE_SECTION_PROV: DEBUG("FT1000:download:STATE_SECTION_PROV\n"); pHdr = (PPSEUDO_HDR)pUcFile; @@ -1350,7 +1350,7 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, ULONG FileLe pbuffer = kmalloc ( (usHdrLength + sizeof(PSEUDO_HDR) ), GFP_ATOMIC ); if (pbuffer) { memcpy(pbuffer, (void *)pUcFile, (UINT)(usHdrLength + sizeof(PSEUDO_HDR))); - // link provisioning data + // link provisioning data pprov_record = kmalloc( sizeof(PROV_RECORD), GFP_ATOMIC ); if (pprov_record) { pprov_record->pprov_data = pbuffer; @@ -1400,14 +1400,14 @@ u16 scram_dnldr(struct ft1000_device *ft1000dev, void *pFileStart, ULONG FileLe break; } - Status = Harley_Read_Register(&temp, FT1000_REG_ASIC_ID); + Status = Harley_Read_Register(&temp, FT1000_REG_ASIC_ID); if ( (Status != NDIS_STATUS_SUCCESS) || (temp == 0xffff) ) { break; } ****/ } /* End while */ - + DEBUG("Download exiting with status = 0x%8x\n", Status); ft1000_write_register(ft1000dev, FT1000_DB_DNLD_TX, FT1000_REG_DOORBELL); diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c index 3dea39ca3efd..51ed0dd95ac1 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_hw.c @@ -118,12 +118,12 @@ static void ft1000_control_complete(struct urb *urb) return ; } //spin_lock(&ft1000dev->device_lock); - + if(waitqueue_active(&ft1000dev->control_wait)) { wake_up(&ft1000dev->control_wait); } - + //DEBUG("FT1000_CONTROL_COMPLETE RETURNED\n"); //spin_unlock(&ft1000dev->device_lock); } @@ -140,7 +140,7 @@ static void ft1000_control_complete(struct urb *urb) // data - data buffer to hold the read/write values // size - data size // timeout - control message time out value -// +// // Returns: STATUS_SUCCESS - success // STATUS_FAILURE - failure // @@ -149,8 +149,8 @@ static void ft1000_control_complete(struct urb *urb) // Notes: // //--------------------------------------------------------------------------- -static int ft1000_control(struct ft1000_device *ft1000dev,unsigned int pipe, - u8 request, +static int ft1000_control(struct ft1000_device *ft1000dev,unsigned int pipe, + u8 request, u8 requesttype, u16 value, u16 index, @@ -159,7 +159,7 @@ static int ft1000_control(struct ft1000_device *ft1000dev,unsigned int pipe, int timeout) { u16 ret; - + if (ft1000dev == NULL ) { DEBUG("NULL ft1000dev, failure\n"); @@ -170,7 +170,7 @@ static int ft1000_control(struct ft1000_device *ft1000dev,unsigned int pipe, DEBUG("NULL ft1000dev->dev, failure\n"); return STATUS_FAILURE; } - + ret = usb_control_msg(ft1000dev->dev, pipe, request, @@ -180,16 +180,16 @@ static int ft1000_control(struct ft1000_device *ft1000dev,unsigned int pipe, data, size, LARGE_TIMEOUT); - + if (ret>0) ret = STATUS_SUCCESS; else ret = STATUS_FAILURE; - - - return ret; - + + return ret; + + } //--------------------------------------------------------------------------- // Function: ft1000_read_register @@ -197,7 +197,7 @@ static int ft1000_control(struct ft1000_device *ft1000dev,unsigned int pipe, // Parameters: ft1000_device - device structure // Data - data buffer to hold the value read // nRegIndex - register index -// +// // Returns: STATUS_SUCCESS - success // STATUS_FAILURE - failure // @@ -210,10 +210,10 @@ static int ft1000_control(struct ft1000_device *ft1000dev,unsigned int pipe, u16 ft1000_read_register(struct ft1000_device *ft1000dev, short* Data, u16 nRegIndx) { u16 ret = STATUS_SUCCESS; - + //DEBUG("ft1000_read_register: reg index is %d\n", nRegIndx); //DEBUG("ft1000_read_register: spin_lock locked\n"); - ret = ft1000_control(ft1000dev, + ret = ft1000_control(ft1000dev, usb_rcvctrlpipe(ft1000dev->dev,0), HARLEY_READ_REGISTER, //request --READ_REGISTER HARLEY_READ_OPERATION, //requestType @@ -222,16 +222,16 @@ u16 ft1000_read_register(struct ft1000_device *ft1000dev, short* Data, u16 nRegI Data, //data 2, //data size LARGE_TIMEOUT ); //timeout - - //DEBUG("ft1000_read_register: ret is %d \n", ret); - //DEBUG("ft1000_read_register: data is %x \n", *Data); + //DEBUG("ft1000_read_register: ret is %d \n", ret); + + //DEBUG("ft1000_read_register: data is %x \n", *Data); if ( ret != STATUS_SUCCESS ) return STATUS_FAILURE; - + return ret; -} +} //--------------------------------------------------------------------------- // Function: ft1000_write_register @@ -239,7 +239,7 @@ u16 ft1000_read_register(struct ft1000_device *ft1000dev, short* Data, u16 nRegI // Parameters: ft1000_device - device structure // value - value to write into a register // nRegIndex - register index -// +// // Returns: STATUS_SUCCESS - success // STATUS_FAILURE - failure // @@ -253,7 +253,7 @@ u16 ft1000_write_register(struct ft1000_device *ft1000dev, USHORT value, u16 nRe u16 ret = STATUS_SUCCESS; //DEBUG("ft1000_write_register: value is: %d, reg index is: %d\n", value, nRegIndx); - + ret = ft1000_control(ft1000dev, usb_sndctrlpipe(ft1000dev->dev, 0), HARLEY_WRITE_REGISTER, //request -- WRITE_REGISTER @@ -263,10 +263,10 @@ u16 ft1000_write_register(struct ft1000_device *ft1000dev, USHORT value, u16 nRe NULL, 0, LARGE_TIMEOUT ); - + if ( ret != STATUS_SUCCESS ) return STATUS_FAILURE; - + return ret; } @@ -277,7 +277,7 @@ u16 ft1000_write_register(struct ft1000_device *ft1000dev, USHORT value, u16 nRe // indx - starting address to read // buffer - data buffer to hold the data read // cnt - number of byte read from DPRAM -// +// // Returns: STATUS_SUCCESS - success // STATUS_FAILURE - failure // @@ -290,9 +290,9 @@ u16 ft1000_write_register(struct ft1000_device *ft1000dev, USHORT value, u16 nRe u16 ft1000_read_dpram32(struct ft1000_device *ft1000dev, USHORT indx, PUCHAR buffer, USHORT cnt) { u16 ret = STATUS_SUCCESS; - + //DEBUG("ft1000_read_dpram32: indx: %d cnt: %d\n", indx, cnt); - ret =ft1000_control(ft1000dev, + ret =ft1000_control(ft1000dev, usb_rcvctrlpipe(ft1000dev->dev,0), HARLEY_READ_DPRAM_32, //request --READ_DPRAM_32 HARLEY_READ_OPERATION, //requestType @@ -301,16 +301,16 @@ u16 ft1000_read_dpram32(struct ft1000_device *ft1000dev, USHORT indx, PUCHAR buf buffer, //data cnt, //data size LARGE_TIMEOUT ); //timeout - - //DEBUG("ft1000_read_dpram32: ret is %d \n", ret); - - //DEBUG("ft1000_read_dpram32: ret=%d \n", ret); + + //DEBUG("ft1000_read_dpram32: ret is %d \n", ret); + + //DEBUG("ft1000_read_dpram32: ret=%d \n", ret); if ( ret != STATUS_SUCCESS ) return STATUS_FAILURE; return ret; -} +} //--------------------------------------------------------------------------- // Function: ft1000_write_dpram32 @@ -319,7 +319,7 @@ u16 ft1000_read_dpram32(struct ft1000_device *ft1000dev, USHORT indx, PUCHAR buf // indx - starting address to write the data // buffer - data buffer to write into DPRAM // cnt - number of bytes to write -// +// // Returns: STATUS_SUCCESS - success // STATUS_FAILURE - failure // @@ -331,11 +331,11 @@ u16 ft1000_read_dpram32(struct ft1000_device *ft1000dev, USHORT indx, PUCHAR buf u16 ft1000_write_dpram32(struct ft1000_device *ft1000dev, USHORT indx, PUCHAR buffer, USHORT cnt) { u16 ret = STATUS_SUCCESS; - + //DEBUG("ft1000_write_dpram32: indx: %d buffer: %x cnt: %d\n", indx, buffer, cnt); if ( cnt % 4) cnt += cnt - (cnt % 4); - + ret = ft1000_control(ft1000dev, usb_sndctrlpipe(ft1000dev->dev, 0), HARLEY_WRITE_DPRAM_32, //request -- WRITE_DPRAM_32 @@ -346,10 +346,10 @@ u16 ft1000_write_dpram32(struct ft1000_device *ft1000dev, USHORT indx, PUCHAR bu cnt, //buffer size LARGE_TIMEOUT ); - + if ( ret != STATUS_SUCCESS ) return STATUS_FAILURE; - + return ret; } @@ -361,7 +361,7 @@ u16 ft1000_write_dpram32(struct ft1000_device *ft1000dev, USHORT indx, PUCHAR bu // indx - starting address to read // buffer - data buffer to hold the data read // hightlow - high or low 16 bit word -// +// // Returns: STATUS_SUCCESS - success // STATUS_FAILURE - failure // @@ -373,7 +373,7 @@ u16 ft1000_write_dpram32(struct ft1000_device *ft1000dev, USHORT indx, PUCHAR bu u16 ft1000_read_dpram16(struct ft1000_device *ft1000dev, USHORT indx, PUCHAR buffer, u8 highlow) { u16 ret = STATUS_SUCCESS; - + //DEBUG("ft1000_read_dpram16: indx: %d hightlow: %d\n", indx, highlow); u8 request; @@ -382,8 +382,8 @@ u16 ft1000_read_dpram16(struct ft1000_device *ft1000dev, USHORT indx, PUCHAR buf request = HARLEY_READ_DPRAM_LOW; else request = HARLEY_READ_DPRAM_HIGH; - - ret = ft1000_control(ft1000dev, + + ret = ft1000_control(ft1000dev, usb_rcvctrlpipe(ft1000dev->dev,0), request, //request --READ_DPRAM_H/L HARLEY_READ_OPERATION, //requestType @@ -392,17 +392,17 @@ u16 ft1000_read_dpram16(struct ft1000_device *ft1000dev, USHORT indx, PUCHAR buf buffer, //data 2, //data size LARGE_TIMEOUT ); //timeout - - //DEBUG("ft1000_read_dpram16: ret is %d \n", ret); - - - //DEBUG("ft1000_read_dpram16: data is %x \n", *buffer); + + //DEBUG("ft1000_read_dpram16: ret is %d \n", ret); + + + //DEBUG("ft1000_read_dpram16: data is %x \n", *buffer); if ( ret != STATUS_SUCCESS ) return STATUS_FAILURE; return ret; -} +} //--------------------------------------------------------------------------- // Function: ft1000_write_dpram16 @@ -411,7 +411,7 @@ u16 ft1000_read_dpram16(struct ft1000_device *ft1000dev, USHORT indx, PUCHAR buf // indx - starting address to write the data // value - 16bits value to write // hightlow - high or low 16 bit word -// +// // Returns: STATUS_SUCCESS - success // STATUS_FAILURE - failure // @@ -423,14 +423,14 @@ u16 ft1000_read_dpram16(struct ft1000_device *ft1000dev, USHORT indx, PUCHAR buf u16 ft1000_write_dpram16(struct ft1000_device *ft1000dev, USHORT indx, USHORT value, u8 highlow) { u16 ret = STATUS_SUCCESS; - - + + //DEBUG("ft1000_write_dpram16: indx: %d value: %d highlow: %d\n", indx, value, highlow); - + u8 request; - + if ( highlow == 0 ) request = HARLEY_WRITE_DPRAM_LOW; else @@ -445,12 +445,12 @@ u16 ft1000_write_dpram16(struct ft1000_device *ft1000dev, USHORT indx, USHORT va NULL, //buffer 0, //buffer size LARGE_TIMEOUT ); - - + + if ( ret != STATUS_SUCCESS ) return STATUS_FAILURE; - + return ret; } @@ -460,8 +460,8 @@ u16 ft1000_write_dpram16(struct ft1000_device *ft1000dev, USHORT indx, USHORT va // Parameters: ft1000_device - device structure // indx - starting address to read // buffer - data buffer to hold the data read -// -// +// +// // Returns: STATUS_SUCCESS - success // STATUS_FAILURE - failure // @@ -479,7 +479,7 @@ u16 fix_ft1000_read_dpram32(struct ft1000_device *ft1000dev, USHORT indx, PUCHAR //DEBUG("fix_ft1000_read_dpram32: indx: %d \n", indx); pos = (indx / 4)*4; ret = ft1000_read_dpram32(ft1000dev, pos, (PUCHAR)&tempbuffer[0], 16); - if (ret == STATUS_SUCCESS) + if (ret == STATUS_SUCCESS) { pos = (indx % 4)*4; *buffer++ = tempbuffer[pos++]; @@ -487,20 +487,20 @@ u16 fix_ft1000_read_dpram32(struct ft1000_device *ft1000dev, USHORT indx, PUCHAR *buffer++ = tempbuffer[pos++]; *buffer++ = tempbuffer[pos++]; } - else + else { DEBUG("fix_ft1000_read_dpram32: DPRAM32 Read failed\n"); *buffer++ = 0; *buffer++ = 0; *buffer++ = 0; *buffer++ = 0; - + } - //DEBUG("fix_ft1000_read_dpram32: data is %x \n", *buffer); + //DEBUG("fix_ft1000_read_dpram32: data is %x \n", *buffer); return ret; -} +} //--------------------------------------------------------------------------- @@ -509,8 +509,8 @@ u16 fix_ft1000_read_dpram32(struct ft1000_device *ft1000dev, USHORT indx, PUCHAR // Parameters: ft1000_device - device structure // indx - starting address to write // buffer - data buffer to write -// -// +// +// // Returns: STATUS_SUCCESS - success // STATUS_FAILURE - failure // @@ -530,11 +530,11 @@ u16 fix_ft1000_write_dpram32(struct ft1000_device *ft1000dev, USHORT indx, PUCHA u16 ret = STATUS_SUCCESS; //DEBUG("fix_ft1000_write_dpram32: Entered:\n"); - + pos1 = (indx / 4)*4; pdata = buffer; ret = ft1000_read_dpram32(ft1000dev, pos1, (PUCHAR)&tempbuffer[0], 16); - if (ret == STATUS_SUCCESS) + if (ret == STATUS_SUCCESS) { pos2 = (indx % 4)*4; tempbuffer[pos2++] = *buffer++; @@ -543,36 +543,36 @@ u16 fix_ft1000_write_dpram32(struct ft1000_device *ft1000dev, USHORT indx, PUCHA tempbuffer[pos2++] = *buffer++; ret = ft1000_write_dpram32(ft1000dev, pos1, (PUCHAR)&tempbuffer[0], 16); } - else + else { DEBUG("fix_ft1000_write_dpram32: DPRAM32 Read failed\n"); - + return ret; } ret = ft1000_read_dpram32(ft1000dev, pos1, (PUCHAR)&resultbuffer[0], 16); - if (ret == STATUS_SUCCESS) + if (ret == STATUS_SUCCESS) { buffer = pdata; - for (i=0; i<16; i++) + for (i=0; i<16; i++) { if (tempbuffer[i] != resultbuffer[i]){ - + ret = STATUS_FAILURE; } } } - if (ret == STATUS_FAILURE) + if (ret == STATUS_FAILURE) { ret = ft1000_write_dpram32(ft1000dev, pos1, (PUCHAR)&tempbuffer[0], 16); ret = ft1000_read_dpram32(ft1000dev, pos1, (PUCHAR)&resultbuffer[0], 16); - if (ret == STATUS_SUCCESS) + if (ret == STATUS_SUCCESS) { buffer = pdata; - for (i=0; i<16; i++) + for (i=0; i<16; i++) { - if (tempbuffer[i] != resultbuffer[i]) + if (tempbuffer[i] != resultbuffer[i]) { ret = STATUS_FAILURE; DEBUG("fix_ft1000_write_dpram32 Failed to write\n"); @@ -580,7 +580,7 @@ u16 fix_ft1000_write_dpram32(struct ft1000_device *ft1000dev, USHORT indx, PUCHA } } } - + return ret; } @@ -603,14 +603,14 @@ void card_reset_dsp (struct ft1000_device *ft1000dev, BOOLEAN value) status = ft1000_write_register (ft1000dev, HOST_INTF_BE, FT1000_REG_SUP_CTRL); status = ft1000_read_register(ft1000dev, &tempword, FT1000_REG_SUP_CTRL); - if (value) + if (value) { DEBUG("Reset DSP\n"); status = ft1000_read_register(ft1000dev, &tempword, FT1000_REG_RESET); tempword |= DSP_RESET_BIT; status = ft1000_write_register(ft1000dev, tempword, FT1000_REG_RESET); } - else + else { DEBUG("Activate DSP\n"); status = ft1000_read_register(ft1000dev, &tempword, FT1000_REG_RESET); @@ -636,7 +636,7 @@ void card_reset_dsp (struct ft1000_device *ft1000dev, BOOLEAN value) // Parameters: ft1000_device - device structure // ptempbuffer - command buffer // size - command buffer size -// +// // Returns: STATUS_SUCCESS - success // STATUS_FAILURE - failure // @@ -647,49 +647,49 @@ void card_reset_dsp (struct ft1000_device *ft1000dev, BOOLEAN value) //--------------------------------------------------------------------------- void CardSendCommand(struct ft1000_device *ft1000dev, unsigned char *ptempbuffer, int size) { - unsigned short temp; + unsigned short temp; unsigned char *commandbuf; - + DEBUG("CardSendCommand: enter CardSendCommand... size=%d\n", size); - + commandbuf =(unsigned char*) kmalloc(size+2, GFP_KERNEL); //memset((void*)commandbuf, 0, size+2); memcpy((void*)commandbuf+2, (void*)ptempbuffer, size); - + //DEBUG("CardSendCommand: Command Send\n"); /*** - for (i=0; inet); pft1000info->CardReady = 0; - pft1000info->DSP_loading= 1; + pft1000info->DSP_loading= 1; // Program Interrupt Mask register status = ft1000_write_register (ft1000dev, 0xffff, FT1000_REG_SUP_IMASK); @@ -744,7 +744,7 @@ void dsp_reload (struct ft1000_device *ft1000dev) // call codeloader status = scram_dnldr(ft1000dev, pFileStart, FileLength); - + if ( status != STATUS_SUCCESS) return; @@ -752,7 +752,7 @@ void dsp_reload (struct ft1000_device *ft1000dev) pft1000info->DSP_loading= 0; DEBUG("dsp_reload returned\n"); - + } @@ -767,32 +767,32 @@ void dsp_reload (struct ft1000_device *ft1000dev) // none // //--------------------------------------------------------------------------- -static void ft1000_reset_asic (struct net_device *dev) +static void ft1000_reset_asic (struct net_device *dev) { FT1000_INFO *info = netdev_priv(dev); struct ft1000_device *ft1000dev = info->pFt1000Dev; u16 tempword; - + DEBUG("ft1000_hw:ft1000_reset_asic called\n"); - + info->ASICResetNum++; // Let's use the register provided by the Magnemite ASIC to reset the // ASIC and DSP. ft1000_write_register(ft1000dev, (DSP_RESET_BIT | ASIC_RESET_BIT), FT1000_REG_RESET ); - + mdelay(1); // set watermark to -1 in order to not generate an interrrupt ft1000_write_register(ft1000dev, 0xffff, FT1000_REG_MAG_WATERMARK); - + // clear interrupts ft1000_read_register (ft1000dev, &tempword, FT1000_REG_SUP_ISR); DEBUG("ft1000_hw: interrupt status register = 0x%x\n",tempword); ft1000_write_register (ft1000dev, tempword, FT1000_REG_SUP_ISR); ft1000_read_register (ft1000dev, &tempword, FT1000_REG_SUP_ISR); DEBUG("ft1000_hw: interrupt status register = 0x%x\n",tempword); - + } /* //--------------------------------------------------------------------------- @@ -848,10 +848,10 @@ static void ft1000_enable_interrupts(struct net_device *dev) { // dev - device structure // Output: // status - FALSE (card reset fail) -// TRUE (card reset successful) +// TRUE (card reset successful) // //--------------------------------------------------------------------------- -static int ft1000_reset_card (struct net_device *dev) +static int ft1000_reset_card (struct net_device *dev) { FT1000_INFO *info = netdev_priv(dev); struct ft1000_device *ft1000dev = info->pFt1000Dev; @@ -859,7 +859,7 @@ static int ft1000_reset_card (struct net_device *dev) PPROV_RECORD ptr; DEBUG("ft1000_hw:ft1000_reset_card called.....\n"); - + info->fCondResetPend = 1; info->CardReady = 0; info->fProvComplete = 0; @@ -876,32 +876,32 @@ static int ft1000_reset_card (struct net_device *dev) kfree(ptr->pprov_data); kfree(ptr); } - + DEBUG("ft1000_hw:ft1000_reset_card: reset asic\n"); //reset ASIC ft1000_reset_asic(dev); info->DSPResetNum++; - + #if 0 DEBUG("ft1000_hw:ft1000_reset_card:resetting ASIC and DSP\n"); ft1000_write_register (ft1000dev, (DSP_RESET_BIT | ASIC_RESET_BIT), FT1000_REG_RESET ); - // Copy DSP session record into info block if this is not a coldstart + // Copy DSP session record into info block if this is not a coldstart //if (ft1000_card_present == 1) { spin_lock_irqsave(&info->dpram_lock, flags); - + ft1000_write_register(ft1000dev, FT1000_DPRAM_MAG_RX_BASE, FT1000_REG_DPRAM_ADDR); for (i=0;iDSPSess.MagRec[i] = inl(dev->base_addr+FT1000_REG_MAG_DPDATA); ft1000_read_dpram32(ft1000dev, FT1000_REG_MAG_DPDATA, (PCHAR)&(info->DSPSess.MagRec[i]), 4); } - + spin_unlock_irqrestore(&info->dpram_lock, flags); //} info->squeseqnum = 0; - + DEBUG("ft1000_hw:ft1000_reset_card:resetting ASIC\n"); mdelay(10); //reset ASIC @@ -910,17 +910,17 @@ static int ft1000_reset_card (struct net_device *dev) info->DSPResetNum++; DEBUG("ft1000_hw:ft1000_reset_card:downloading dsp image\n"); - - + + // Put dsp in reset and take ASIC out of reset DEBUG("ft1000_hw:ft1000_reset_card:Put DSP in reset and take ASIC out of reset\n"); ft1000_write_register (ft1000dev, DSP_RESET_BIT, FT1000_REG_RESET); - + // Setting MAGNEMITE ASIC to big endian mode - ft1000_write_register (ft1000dev, HOST_INTF_BE, FT1000_REG_SUP_CTRL); + ft1000_write_register (ft1000dev, HOST_INTF_BE, FT1000_REG_SUP_CTRL); // Take DSP out of reset - + ft1000_read_register(ft1000dev, &tempword, FT1000_REG_RESET); tempword |= DSP_ENCRYPTED; tempword &= ~DSP_UNENCRYPTED; @@ -929,11 +929,11 @@ static int ft1000_reset_card (struct net_device *dev) ft1000_write_register(ft1000dev, tempword, FT1000_REG_RESET); tempword &= ~DSP_RESET_BIT; ft1000_write_register(ft1000dev, tempword, FT1000_REG_RESET); - - + + // FLARION_DSP_ACTIVE; mdelay(10); - DEBUG("ft1000_hw:ft1000_reset_card:Take DSP out of reset\n"); + DEBUG("ft1000_hw:ft1000_reset_card:Take DSP out of reset\n"); // Wait for 0xfefe indicating dsp ready before starting download for (i=0; i<50; i++) { @@ -946,35 +946,35 @@ static int ft1000_reset_card (struct net_device *dev) } if (i==50) { - DEBUG("ft1000_hw:ft1000_reset_card:No FEFE detected from DSP\n"); + DEBUG("ft1000_hw:ft1000_reset_card:No FEFE detected from DSP\n"); return FALSE; } - + #endif DEBUG("ft1000_hw:ft1000_reset_card: call dsp_reload\n"); dsp_reload(ft1000dev); - + DEBUG("dsp reload successful\n"); - + mdelay(10); - + // Initialize DSP heartbeat area to ho ft1000_write_dpram16(ft1000dev, FT1000_MAG_HI_HO, ho_mag, FT1000_MAG_HI_HO_INDX); ft1000_read_dpram16(ft1000dev, FT1000_MAG_HI_HO, (PCHAR)&tempword, FT1000_MAG_HI_HO_INDX); DEBUG("ft1000_hw:ft1000_reset_card:hi_ho value = 0x%x\n", tempword); - - + + info->CardReady = 1; //ft1000_enable_interrupts(dev); /* Schedule heartbeat process to run every 2 seconds */ //poll_timer[info->CardNumber].expires = jiffies + (2*HZ); //poll_timer[info->CardNumber].data = (u_long)dev; //add_timer(&poll_timer[info->CardNumber]); - + info->fCondResetPend = 0; return TRUE; @@ -998,7 +998,7 @@ static const struct net_device_ops ftnet_ops = // // Parameters: ft1000dev - device structure // -// +// // Returns: STATUS_SUCCESS - success // STATUS_FAILURE - failure // @@ -1017,7 +1017,7 @@ u16 init_ft1000_netdev(struct ft1000_device *ft1000dev) gCardIndex=0; //mbelian DEBUG("Enter init_ft1000_netdev...\n"); - + netdev = alloc_etherdev( sizeof(FT1000_INFO)); if (!netdev ) @@ -1028,18 +1028,18 @@ u16 init_ft1000_netdev(struct ft1000_device *ft1000dev) //pInfo = (PFT1000_INFO)netdev->priv; pInfo = (FT1000_INFO *) netdev_priv (netdev); - + //DEBUG("init_ft1000_netdev: gFt1000Info=%x, netdev=%x, ft1000dev=%x\n", gFt1000Info, netdev, ft1000dev); memset (pInfo, 0, sizeof(FT1000_INFO)); dev_alloc_name(netdev, netdev->name); - //for the first inserted card, decide the card index beginning number, in case there are existing network interfaces + //for the first inserted card, decide the card index beginning number, in case there are existing network interfaces if ( gCardIndex == 0 ) { DEBUG("init_ft1000_netdev: network device name is %s\n", netdev->name); - + if ( strncmp(netdev->name,"eth", 3) == 0) { //pInfo->CardNumber = atoi(&netdev->name[3]); gCardIndex = atoi(&netdev->name[3]); @@ -1047,7 +1047,7 @@ u16 init_ft1000_netdev(struct ft1000_device *ft1000dev) DEBUG("card number = %d\n", pInfo->CardNumber); } else { - printk(KERN_ERR "ft1000: Invalid device name\n"); + printk(KERN_ERR "ft1000: Invalid device name\n"); kfree(netdev); return STATUS_FAILURE; } @@ -1093,9 +1093,9 @@ u16 init_ft1000_netdev(struct ft1000_device *ft1000dev) //mbelian #ifdef HAVE_NET_DEVICE_OPS - netdev->netdev_ops = &ftnet_ops; + netdev->netdev_ops = &ftnet_ops; #else - netdev->hard_start_xmit = &ft1000_start_xmit; + netdev->hard_start_xmit = &ft1000_start_xmit; netdev->get_stats = &ft1000_netdev_stats; netdev->open = &ft1000_open; netdev->stop = &ft1000_close; @@ -1103,12 +1103,12 @@ u16 init_ft1000_netdev(struct ft1000_device *ft1000dev) //netif_stop_queue(netdev); //mbelian - + ft1000dev->net = netdev; -//init free_buff_lock, freercvpool, numofmsgbuf, pdpram_blk +//init free_buff_lock, freercvpool, numofmsgbuf, pdpram_blk //only init once per card //Jim DEBUG("Initialize free_buff_lock and freercvpool\n"); @@ -1122,15 +1122,15 @@ u16 init_ft1000_netdev(struct ft1000_device *ft1000dev) // Get memory for DPRAM_DATA link list pdpram_blk = kmalloc ( sizeof(DPRAM_BLK), GFP_KERNEL ); // Get a block of memory to store command data - pdpram_blk->pbuffer = kmalloc ( MAX_CMD_SQSIZE, GFP_KERNEL ); - // link provisioning data + pdpram_blk->pbuffer = kmalloc ( MAX_CMD_SQSIZE, GFP_KERNEL ); + // link provisioning data list_add_tail (&pdpram_blk->list, &freercvpool); } numofmsgbuf = NUM_OF_FREE_BUFFERS; - + return STATUS_SUCCESS; - + } @@ -1140,7 +1140,7 @@ u16 init_ft1000_netdev(struct ft1000_device *ft1000dev) // // Parameters: ft1000dev - device structure // -// +// // Returns: STATUS_SUCCESS - success // STATUS_FAILURE - failure // @@ -1164,7 +1164,7 @@ u16 reg_ft1000_netdev(struct ft1000_device *ft1000dev, struct usb_interface *int usb_set_intfdata(intf, pInfo); SET_NETDEV_DEV(netdev, &intf->dev); - + rc = register_netdev(netdev); if (rc) { @@ -1193,13 +1193,13 @@ u16 reg_ft1000_netdev(struct ft1000_device *ft1000dev, struct usb_interface *int netdev->dev_addr[4] = 0; netdev->dev_addr[5] = 0x20 + pInfo->CardNumber; **/ - + DEBUG ("reg_ft1000_netdev returned\n"); pInfo->CardReady = 1; - return STATUS_SUCCESS; + return STATUS_SUCCESS; } int ft1000_reset(struct net_device *dev) @@ -1213,7 +1213,7 @@ int ft1000_reset(struct net_device *dev) // // Parameters: urb - transmitted usb urb // -// +// // Returns: none // // Description: This is the callback function when a urb is transmitted @@ -1242,8 +1242,8 @@ static void ft1000_usb_transmit_complete(struct urb *urb) /**************************************************************** * ft1000_control ****************************************************************/ -static int ft1000_read_fifo_reg(struct ft1000_device *ft1000dev,unsigned int pipe, - u8 request, +static int ft1000_read_fifo_reg(struct ft1000_device *ft1000dev,unsigned int pipe, + u8 request, u8 requesttype, u16 value, u16 index, @@ -1252,7 +1252,7 @@ static int ft1000_read_fifo_reg(struct ft1000_device *ft1000dev,unsigned int pip int timeout) { u16 ret; - + DECLARE_WAITQUEUE(wait, current); struct urb *urb; struct usb_ctrlrequest *dr; @@ -1268,7 +1268,7 @@ static int ft1000_read_fifo_reg(struct ft1000_device *ft1000dev,unsigned int pip DEBUG("NULL ft1000dev->dev, failure\n"); return STATUS_FAILURE; } - + spin_lock(&ft1000dev->device_lock); /*DECLARE_WAITQUEUE(wait, current); @@ -1287,13 +1287,13 @@ static int ft1000_read_fifo_reg(struct ft1000_device *ft1000dev,unsigned int pip if(!urb || !dr) { - if(urb) kfree(urb); - spin_unlock(&ft1000dev->device_lock); + if(urb) kfree(urb); + spin_unlock(&ft1000dev->device_lock); return -ENOMEM; } - - + + dr->bRequestType = requesttype; dr->bRequest = request; dr->wValue = value; @@ -1301,22 +1301,22 @@ static int ft1000_read_fifo_reg(struct ft1000_device *ft1000dev,unsigned int pip dr->wLength = size; usb_fill_control_urb(urb, ft1000dev->dev, pipe, (char*)dr, (void*)data, size, (void *)ft1000_control_complete, (void*)ft1000dev); - + init_waitqueue_head(&ft1000dev->control_wait); //current->state = TASK_INTERRUPTIBLE; //mbelian set_current_state(TASK_INTERRUPTIBLE); - + add_wait_queue(&ft1000dev->control_wait, &wait); - - - + + + status = usb_submit_urb(urb, GFP_KERNEL); - + if(status) - { + { usb_free_urb(urb); kfree(dr); remove_wait_queue(&ft1000dev->control_wait, &wait); @@ -1351,21 +1351,21 @@ static int ft1000_read_fifo_reg(struct ft1000_device *ft1000dev,unsigned int pip if(urb->status) { printk("ft1000 control message failed (urb addr: %x) with error number: %i\n", (int)urb, (int)status); - + usb_clear_halt(ft1000dev->dev, usb_rcvctrlpipe(ft1000dev->dev, 0)); usb_clear_halt(ft1000dev->dev, usb_sndctrlpipe(ft1000dev->dev, 0)); usb_unlink_urb(urb); } } - + usb_free_urb(urb); kfree(dr); spin_unlock(&ft1000dev->device_lock); - return ret; + return ret; + - } //--------------------------------------------------------------------------- @@ -1373,7 +1373,7 @@ static int ft1000_read_fifo_reg(struct ft1000_device *ft1000dev,unsigned int pip // // Parameters: ft1000dev - device structure // -// +// // Returns: none // // Description: read the fifo length register content @@ -1381,20 +1381,20 @@ static int ft1000_read_fifo_reg(struct ft1000_device *ft1000dev,unsigned int pip // Notes: // //--------------------------------------------------------------------------- -static inline u16 ft1000_read_fifo_len (struct net_device *dev) +static inline u16 ft1000_read_fifo_len (struct net_device *dev) { u16 temp; u16 ret; - + //FT1000_INFO *info = (PFT1000_INFO)dev->priv; FT1000_INFO *info = (FT1000_INFO *) netdev_priv (dev); struct ft1000_device *ft1000dev = info->pFt1000Dev; // DEBUG("ft1000_read_fifo_len: enter ft1000dev %x\n", ft1000dev); //aelias [-] reason: warning: format ???%x??? expects type ???unsigned int???, but argument 2 has type ???struct ft1000_device *??? DEBUG("ft1000_read_fifo_len: enter ft1000dev %x\n", (unsigned int)ft1000dev); //aelias [+] reason: up //ft1000_read_register(ft1000dev, &temp, FT1000_REG_MAG_UFSR); - - ret = STATUS_SUCCESS; - + + ret = STATUS_SUCCESS; + ret = ft1000_read_fifo_reg(ft1000dev, usb_rcvctrlpipe(ft1000dev->dev,0), HARLEY_READ_REGISTER, @@ -1404,35 +1404,35 @@ static inline u16 ft1000_read_fifo_len (struct net_device *dev) &temp, 2, LARGE_TIMEOUT); - + if (ret>0) ret = STATUS_SUCCESS; else ret = STATUS_FAILURE; DEBUG("ft1000_read_fifo_len: returned %d\n", temp); - + return (temp- 16); - + } //--------------------------------------------------------------------------- // // Function: ft1000_copy_down_pkt -// Descripton: This function will take an ethernet packet and convert it to -// a Flarion packet prior to sending it to the ASIC Downlink +// Descripton: This function will take an ethernet packet and convert it to +// a Flarion packet prior to sending it to the ASIC Downlink // FIFO. // Input: // dev - device structure // packet - address of ethernet packet // len - length of IP packet // Output: -// status - FAILURE -// SUCCESS +// status - FAILURE +// SUCCESS // //--------------------------------------------------------------------------- -int ft1000_copy_down_pkt (struct net_device *netdev, u8 *packet, u16 len) +int ft1000_copy_down_pkt (struct net_device *netdev, u8 *packet, u16 len) { FT1000_INFO *pInfo = netdev_priv(netdev); struct ft1000_device *pFt1000Dev = pInfo->pFt1000Dev; @@ -1442,49 +1442,49 @@ int ft1000_copy_down_pkt (struct net_device *netdev, u8 *packet, u16 len) USHORT *pTemp; USHORT checksum; u8 *t; - + if (!pInfo->CardReady) { - + DEBUG("ft1000_copy_down_pkt::Card Not Ready\n"); return STATUS_FAILURE; - + } - - //DEBUG("ft1000_copy_down_pkt() entered, len = %d\n", len); - -#if 0 - // Check if there is room on the FIFO - if ( len > ft1000_read_fifo_len (netdev) ) + + //DEBUG("ft1000_copy_down_pkt() entered, len = %d\n", len); + +#if 0 + // Check if there is room on the FIFO + if ( len > ft1000_read_fifo_len (netdev) ) { udelay(10); - if ( len > ft1000_read_fifo_len (netdev) ) + if ( len > ft1000_read_fifo_len (netdev) ) { udelay(20); } - - if ( len > ft1000_read_fifo_len (netdev) ) + + if ( len > ft1000_read_fifo_len (netdev) ) { udelay(20); } - - if ( len > ft1000_read_fifo_len (netdev) ) + + if ( len > ft1000_read_fifo_len (netdev) ) { udelay(20); } - - if ( len > ft1000_read_fifo_len (netdev) ) + + if ( len > ft1000_read_fifo_len (netdev) ) { udelay(20); } - - if ( len > ft1000_read_fifo_len (netdev) ) + + if ( len > ft1000_read_fifo_len (netdev) ) { udelay(20); } - - if ( len > ft1000_read_fifo_len (netdev) ) + + if ( len > ft1000_read_fifo_len (netdev) ) { DEBUG("ft1000_hw:ft1000_copy_down_pkt:Transmit FIFO is fulli - pkt drop\n"); pInfo->stats.tx_errors++; @@ -1492,7 +1492,7 @@ int ft1000_copy_down_pkt (struct net_device *netdev, u8 *packet, u16 len) } } #endif - + count = sizeof (PSEUDO_HDR) + len; if(count > MAX_BUF_SIZE) { @@ -1500,10 +1500,10 @@ int ft1000_copy_down_pkt (struct net_device *netdev, u8 *packet, u16 len) DEBUG("size = %d\n", count); return STATUS_FAILURE; } - + if ( count % 4) count = count + (4- (count %4) ); - + pTemp = (PUSHORT)&(pFt1000Dev->tx_buf[0]); *pTemp ++ = ntohs(count); *pTemp ++ = 0x1020; @@ -1526,44 +1526,44 @@ int ft1000_copy_down_pkt (struct net_device *netdev, u8 *packet, u16 len) netif_stop_queue(netdev); //DEBUG ("ft1000_copy_down_pkt: count = %d\n", count); - + usb_fill_bulk_urb(pFt1000Dev->tx_urb, pFt1000Dev->dev, usb_sndbulkpipe(pFt1000Dev->dev, pFt1000Dev->bulk_out_endpointAddr), pFt1000Dev->tx_buf, count, ft1000_usb_transmit_complete, - (void*)pFt1000Dev); - + (void*)pFt1000Dev); + t = (u8 *)pFt1000Dev->tx_urb->transfer_buffer; //DEBUG("transfer_length=%d\n", pFt1000Dev->tx_urb->transfer_buffer_length); /*for (i=0; itx_urb, GFP_ATOMIC); if(ret) { DEBUG("ft1000 failed tx_urb %d\n", ret); /* pInfo->stats.tx_errors++; - + netif_start_queue(netdev); */ //mbelian return STATUS_FAILURE; - } - else + } + else { //DEBUG("ft1000 sucess tx_urb %d\n", ret); pInfo->stats.tx_packets++; pInfo->stats.tx_bytes += (len+14); } - - //DEBUG("ft1000_copy_down_pkt() exit\n"); - + + //DEBUG("ft1000_copy_down_pkt() exit\n"); + return STATUS_SUCCESS; } @@ -1573,7 +1573,7 @@ int ft1000_copy_down_pkt (struct net_device *netdev, u8 *packet, u16 len) // Parameters: skb - socket buffer to be sent // dev - network device // -// +// // Returns: none // // Description: transmit a ethernet packet @@ -1581,22 +1581,22 @@ int ft1000_copy_down_pkt (struct net_device *netdev, u8 *packet, u16 len) // Notes: // //--------------------------------------------------------------------------- -static int ft1000_start_xmit(struct sk_buff *skb, struct net_device *dev) +static int ft1000_start_xmit(struct sk_buff *skb, struct net_device *dev) { FT1000_INFO *pInfo = netdev_priv(dev); struct ft1000_device *pFt1000Dev= pInfo->pFt1000Dev; u8 *pdata; int maxlen, pipe; - - - //DEBUG(" ft1000_start_xmit() entered\n"); - - if ( skb == NULL ) + + + //DEBUG(" ft1000_start_xmit() entered\n"); + + if ( skb == NULL ) { - DEBUG ("ft1000_hw: ft1000_start_xmit:skb == NULL!!!\n" ); + DEBUG ("ft1000_hw: ft1000_start_xmit:skb == NULL!!!\n" ); return STATUS_FAILURE; } - + if ( pFt1000Dev->status & FT1000_STATUS_CLOSING) { DEBUG("network driver is closed, return\n"); @@ -1613,11 +1613,11 @@ static int ft1000_start_xmit(struct sk_buff *skb, struct net_device *dev) pdata = (u8 *)skb->data; /*for (i=0; ilen; i++) DEBUG("skb->data[%d]=%x ", i, *(skb->data+i)); - + DEBUG("\n");*/ - - - if (pInfo->mediastate == 0) + + + if (pInfo->mediastate == 0) { /* Drop packet is mediastate is down */ DEBUG("ft1000_hw:ft1000_start_xmit:mediastate is down\n"); @@ -1625,23 +1625,23 @@ static int ft1000_start_xmit(struct sk_buff *skb, struct net_device *dev) return STATUS_SUCCESS; } - if ( (skb->len < ENET_HEADER_SIZE) || (skb->len > ENET_MAX_SIZE) ) + if ( (skb->len < ENET_HEADER_SIZE) || (skb->len > ENET_MAX_SIZE) ) { /* Drop packet which has invalid size */ DEBUG("ft1000_hw:ft1000_start_xmit:invalid ethernet length\n"); dev_kfree_skb(skb); return STATUS_SUCCESS; } -//mbelian +//mbelian if(ft1000_copy_down_pkt (dev, (pdata+ENET_HEADER_SIZE-2), skb->len - ENET_HEADER_SIZE + 2) == STATUS_FAILURE) { dev_kfree_skb(skb); return STATUS_SUCCESS; } - + dev_kfree_skb(skb); //DEBUG(" ft1000_start_xmit() exit\n"); - + return 0; } @@ -1654,16 +1654,16 @@ static int ft1000_start_xmit(struct sk_buff *skb, struct net_device *dev) // urb - the receving usb urb // // Output: -// status - FAILURE -// SUCCESS +// status - FAILURE +// SUCCESS // //--------------------------------------------------------------------------- -int ft1000_copy_up_pkt (struct urb *urb) +int ft1000_copy_up_pkt (struct urb *urb) { PFT1000_INFO info = urb->context; struct ft1000_device *ft1000dev = info->pFt1000Dev; struct net_device *net = ft1000dev->net; - + u16 tempword; u16 len; u16 lena; //mbelian @@ -1675,13 +1675,13 @@ int ft1000_copy_up_pkt (struct urb *urb) //DEBUG("ft1000_copy_up_pkt entered\n"); - + if ( ft1000dev->status & FT1000_STATUS_CLOSING) { DEBUG("network driver is closed, return\n"); return STATUS_SUCCESS; } - + // Read length len = urb->transfer_buffer_length; lena = urb->actual_length; //mbelian @@ -1689,15 +1689,15 @@ int ft1000_copy_up_pkt (struct urb *urb) // urb->transfer_buffer_length, urb->actual_length); chksum = (PUSHORT)ft1000dev->rx_buf; - + tempword = *chksum++; for (i=1; i<7; i++) { tempword ^= *chksum++; } - + if (tempword != *chksum) - { + { info->stats.rx_errors ++; ft1000_submit_rx_urb(info); return STATUS_FAILURE; @@ -1705,19 +1705,19 @@ int ft1000_copy_up_pkt (struct urb *urb) //DEBUG("ft1000_copy_up_pkt: checksum is correct %x\n", *chksum); - + skb = dev_alloc_skb(len+12+2); - if (skb == NULL) + if (skb == NULL) { DEBUG("ft1000_copy_up_pkt: No Network buffers available\n"); info->stats.rx_errors++; ft1000_submit_rx_urb(info); return STATUS_FAILURE; } - + pbuffer = (u8 *)skb_put(skb, len+12); - + //subtract the number of bytes read already ptemp = pbuffer; @@ -1734,20 +1734,20 @@ int ft1000_copy_up_pkt (struct urb *urb) *pbuffer++ = 0xff; *pbuffer++ = 0xff; *pbuffer++ = 0xfe; - - - + + + memcpy(pbuffer, ft1000dev->rx_buf+sizeof(PSEUDO_HDR), len-sizeof(PSEUDO_HDR)); //DEBUG("ft1000_copy_up_pkt: Data passed to Protocol layer\n"); - /*for (i=0; idev = net; - + skb->protocol = eth_type_trans(skb, net); skb->ip_summed = CHECKSUM_UNNECESSARY; netif_rx(skb); @@ -1756,7 +1756,7 @@ int ft1000_copy_up_pkt (struct urb *urb) // Add on 12 bytes for MAC address which was removed info->stats.rx_bytes += (lena+12); //mbelian - ft1000_submit_rx_urb(info); + ft1000_submit_rx_urb(info); //DEBUG("ft1000_copy_up_pkt exited\n"); return SUCCESS; } @@ -1770,8 +1770,8 @@ int ft1000_copy_up_pkt (struct urb *urb) // info - a private structure contains the device information // // Output: -// status - FAILURE -// SUCCESS +// status - FAILURE +// SUCCESS // //--------------------------------------------------------------------------- int ft1000_submit_rx_urb(PFT1000_INFO info) @@ -1780,7 +1780,7 @@ int ft1000_submit_rx_urb(PFT1000_INFO info) struct ft1000_device *pFt1000Dev = info->pFt1000Dev; //netif_carrier_on(pFt1000Dev->net); - + //DEBUG ("ft1000_submit_rx_urb entered: sizeof rx_urb is %d\n", sizeof(*pFt1000Dev->rx_urb)); if ( pFt1000Dev->status & FT1000_STATUS_CLOSING) { @@ -1807,7 +1807,7 @@ int ft1000_submit_rx_urb(PFT1000_INFO info) printk("ft1000_submit_rx_urb: submitting rx_urb %d failed\n", result); return STATUS_FAILURE; } - + //DEBUG("ft1000_submit_rx_urb exit: result=%d\n", result); return STATUS_SUCCESS; @@ -1816,10 +1816,10 @@ int ft1000_submit_rx_urb(PFT1000_INFO info) //--------------------------------------------------------------------------- // Function: ft1000_open // -// Parameters: +// Parameters: // dev - network device // -// +// // Returns: none // // Description: open the network driver @@ -1827,7 +1827,7 @@ int ft1000_submit_rx_urb(PFT1000_INFO info) // Notes: // //--------------------------------------------------------------------------- -static int ft1000_open (struct net_device *dev) +static int ft1000_open (struct net_device *dev) { FT1000_INFO *pInfo = (FT1000_INFO *)netdev_priv(dev); struct timeval tv; //mbelian @@ -1842,25 +1842,25 @@ static int ft1000_open (struct net_device *dev) do_gettimeofday(&tv); pInfo->ConTm = tv.tv_sec; pInfo->ProgConStat = 0; //mbelian - - + + netif_start_queue(dev); - + //netif_device_attach(dev); - + netif_carrier_on(dev); //mbelian - - ft1000_submit_rx_urb(pInfo); + + ft1000_submit_rx_urb(pInfo); return 0; } //--------------------------------------------------------------------------- // Function: ft1000_close // -// Parameters: +// Parameters: // net - network device // -// +// // Returns: none // // Description: close the network driver @@ -1874,13 +1874,13 @@ int ft1000_close(struct net_device *net) struct ft1000_device *ft1000dev = pInfo->pFt1000Dev; //DEBUG ("ft1000_close: netdev->refcnt=%d\n", net->refcnt); - + ft1000dev->status |= FT1000_STATUS_CLOSING; //DEBUG("ft1000_close: calling usb_kill_urb \n"); //usb_kill_urb(ft1000dev->rx_urb); //usb_kill_urb(ft1000dev->tx_urb); - + DEBUG("ft1000_close: pInfo=%x, ft1000dev=%x\n", (int)pInfo, (int)ft1000dev); netif_carrier_off(net);//mbelian @@ -1898,7 +1898,7 @@ static struct net_device_stats *ft1000_netdev_stats(struct net_device *dev) { FT1000_INFO *info = (FT1000_INFO *) netdev_priv (dev); //struct ft1000_device *ft1000dev = info->pFt1000Dev; - + //return &(ft1000dev->stats);//mbelian return &(info->stats); //mbelian } @@ -1918,20 +1918,20 @@ Jim // dev - device structure // Output: // status - FALSE (device is not present) -// TRUE (device is present) +// TRUE (device is present) // //--------------------------------------------------------------------------- static int ft1000_chkcard (struct ft1000_device *dev) { u16 tempword; u16 status; FT1000_INFO *info = (FT1000_INFO *) netdev_priv (dev->net); - + if (info->fCondResetPend) { DEBUG("ft1000_hw:ft1000_chkcard:Card is being reset, return FALSE\n"); return TRUE; } - + // Mask register is used to check for device presence since it is never // set to zero. status = ft1000_read_register(dev, &tempword, FT1000_REG_SUP_IMASK); @@ -1967,7 +1967,7 @@ static int ft1000_chkcard (struct ft1000_device *dev) { //--------------------------------------------------------------------------- static void ft1000_hbchk(u_long data) { - struct ft1000_device *dev = (struct ft1000_device *)data; + struct ft1000_device *dev = (struct ft1000_device *)data; FT1000_INFO *info; USHORT tempword; @@ -1975,13 +1975,13 @@ static void ft1000_hbchk(u_long data) info = (FT1000_INFO *) netdev_priv (dev->net); DEBUG("ft1000_hbchk called for CardNumber = %d CardReady = %d\n", info->CardNumber, info->CardReady); - + if (info->fCondResetPend == 1) { - // Reset ASIC and DSP + // Reset ASIC and DSP status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER0, (PUCHAR)&(info->DSP_TIME[0]), FT1000_MAG_DSP_TIMER0_INDX); status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER1, (PUCHAR)&(info->DSP_TIME[1]), FT1000_MAG_DSP_TIMER1_INDX); status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER2, (PUCHAR)&(info->DSP_TIME[2]), FT1000_MAG_DSP_TIMER2_INDX); - status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER3, (PUCHAR)&(info->DSP_TIME[3]), FT1000_MAG_DSP_TIMER3_INDX); + status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER3, (PUCHAR)&(info->DSP_TIME[3]), FT1000_MAG_DSP_TIMER3_INDX); info->DrvErrNum = DSP_CONDRESET_INFO; DEBUG("ft1000_hw:DSP conditional reset requested\n"); @@ -1997,7 +1997,7 @@ static void ft1000_hbchk(u_long data) return; } - + if (info->CardReady == 1) { // Perform dsp heartbeat check status = ntohs(ft1000_read_dpram16(dev, FT1000_MAG_HI_HO, (PUCHAR)&tempword, FT1000_MAG_HI_HO_INDX)); @@ -2011,7 +2011,7 @@ static void ft1000_hbchk(u_long data) status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER0, (PUCHAR)&(info->DSP_TIME[0]), FT1000_MAG_DSP_TIMER0_INDX); status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER1, (PUCHAR)&(info->DSP_TIME[1]), FT1000_MAG_DSP_TIMER1_INDX); status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER2, (PUCHAR)&(info->DSP_TIME[2]), FT1000_MAG_DSP_TIMER2_INDX); - status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER3, (PUCHAR)&(info->DSP_TIME[3]), FT1000_MAG_DSP_TIMER3_INDX); + status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER3, (PUCHAR)&(info->DSP_TIME[3]), FT1000_MAG_DSP_TIMER3_INDX); info->DrvErrNum = DSP_HB_INFO; if (ft1000_reset_card(dev->net) == 0) { printk(KERN_INFO "ft1000: Hardware Failure Detected - PC Card disabled\n"); @@ -2049,7 +2049,7 @@ static void ft1000_hbchk(u_long data) return; } - // Set dedicated area to hi and ring appropriate doorbell according + // Set dedicated area to hi and ring appropriate doorbell according // to hi/ho heartbeat protocol ft1000_write_dpram16(dev, FT1000_MAG_HI_HO, hi_mag, FT1000_MAG_HI_HO_INDX); @@ -2065,7 +2065,7 @@ static void ft1000_hbchk(u_long data) status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER0, (PUCHAR)&(info->DSP_TIME[0]), FT1000_MAG_DSP_TIMER0_INDX); status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER1, (PUCHAR)&(info->DSP_TIME[1]), FT1000_MAG_DSP_TIMER1_INDX); status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER2, (PUCHAR)&(info->DSP_TIME[2]), FT1000_MAG_DSP_TIMER2_INDX); - status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER3, (PUCHAR)&(info->DSP_TIME[3]), FT1000_MAG_DSP_TIMER3_INDX); + status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER3, (PUCHAR)&(info->DSP_TIME[3]), FT1000_MAG_DSP_TIMER3_INDX); info->DrvErrNum = DSP_HB_INFO; if (ft1000_reset_card(dev->net) == 0) { @@ -2082,7 +2082,7 @@ static void ft1000_hbchk(u_long data) ft1000_write_register(dev, FT1000_DB_HB, FT1000_REG_DOORBELL); } - + /* Schedule this module to run every 2 seconds */ poll_timer[info->CardNumber].expires = jiffies + (2*HZ); poll_timer[info->CardNumber].data = (u_long)dev; @@ -2092,7 +2092,7 @@ static void ft1000_hbchk(u_long data) //--------------------------------------------------------------------------- // // Function: ft1000_receive_cmd -// Descripton: This function will read a message from the dpram area. +// Descripton: This function will read a message from the dpram area. // Input: // dev - network device structure // pbuffer - caller supply address to buffer @@ -2120,7 +2120,7 @@ BOOLEAN ft1000_receive_cmd (struct ft1000_device *dev, u16 *pbuffer, int maxsz, ft1000_write_register(dev, FT1000_DPRAM_MAG_RX_BASE, FT1000_REG_DPRAM_ADDR); ret = ft1000_read_register(dev, pbuffer, FT1000_REG_MAG_DPDATAH); //DEBUG("ft1000_hw:received data = 0x%x\n", *pbuffer); - pbuffer++; + pbuffer++; ft1000_write_register(dev, FT1000_DPRAM_MAG_RX_BASE+1, FT1000_REG_DPRAM_ADDR); for (i=0; i<=(size>>2); i++) { ret = ft1000_read_register(dev, pbuffer, FT1000_REG_MAG_DPDATAL); @@ -2151,25 +2151,25 @@ BOOLEAN ft1000_receive_cmd (struct ft1000_device *dev, u16 *pbuffer, int maxsz, if ( (tempword != *ppseudohdr) ) { return FALSE; } - - -#if 0 + + +#if 0 DEBUG("ft1000_receive_cmd:pbuffer\n"); for(i = 0; i < size; i+=5) { - if( (i + 5) < size ) - DEBUG("0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n", tempbuffer[i], tempbuffer[i+1], tempbuffer[i+2], tempbuffer[i+3], tempbuffer[i+4]); + if( (i + 5) < size ) + DEBUG("0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n", tempbuffer[i], tempbuffer[i+1], tempbuffer[i+2], tempbuffer[i+3], tempbuffer[i+4]); else { for (j = i; j < size; j++) - DEBUG("0x%x ", tempbuffer[j]); - DEBUG("\n"); + DEBUG("0x%x ", tempbuffer[j]); + DEBUG("\n"); break; } } - -#endif - + +#endif + return TRUE; } } @@ -2190,8 +2190,8 @@ int ft1000_dsp_prov(void *arg) DEBUG("*** DspProv Entered\n"); - while ( list_empty(&info->prov_list) == 0 - /*&& !kthread_should_stop() */) + while ( list_empty(&info->prov_list) == 0 + /*&& !kthread_should_stop() */) { DEBUG("DSP Provisioning List Entry\n"); @@ -2216,14 +2216,14 @@ int ft1000_dsp_prov(void *arg) if ( !(tempword & FT1000_DB_DPRAM_TX) ) { DEBUG("*** Provision Data Sent to DSP\n"); - + // Send provisioning data ptr = list_entry(info->prov_list.next, PROV_RECORD, list); len = *(u16 *)ptr->pprov_data; len = htons(len); len += PSEUDOSZ; //len = htons(len); - + pmsg = (PUSHORT)ptr->pprov_data; ppseudo_hdr = (PPSEUDO_HDR)pmsg; // Insert slow queue sequence number @@ -2236,17 +2236,17 @@ int ft1000_dsp_prov(void *arg) ppseudo_hdr->checksum ^= *pmsg++; //DEBUG("checksum = 0x%x\n", ppseudo_hdr->checksum); } - + TempShortBuf[0] = 0; TempShortBuf[1] = htons (len); memcpy(&TempShortBuf[2], ppseudo_hdr, len); - + status = ft1000_write_dpram32 (dev, 0, (PUCHAR)&TempShortBuf[0], (unsigned short)(len+2)); - status = ft1000_write_register (dev, FT1000_DB_DPRAM_TX, FT1000_REG_DOORBELL); - + status = ft1000_write_register (dev, FT1000_DB_DPRAM_TX, FT1000_REG_DOORBELL); + list_del(&ptr->list); kfree(ptr->pprov_data); - kfree(ptr); + kfree(ptr); } msleep(10); } @@ -2254,15 +2254,15 @@ int ft1000_dsp_prov(void *arg) DEBUG("DSP Provisioning List Entry finished\n"); msleep(100); - + info->fProvComplete = 1; info->CardReady = 1; info->DSP_loading= 0; return STATUS_SUCCESS; - + } - + int ft1000_proc_drvmsg (struct ft1000_device *dev, u16 size) { FT1000_INFO *info = (FT1000_INFO *) netdev_priv (dev->net); u16 msgtype; @@ -2273,44 +2273,44 @@ int ft1000_proc_drvmsg (struct ft1000_device *dev, u16 size) { u16 i; PPSEUDO_HDR ppseudo_hdr; PUSHORT pmsg; - u16 status; + u16 status; //struct timeval tv; //mbelian union { u8 byte[2]; u16 wrd; } convert; - + char cmdbuffer[1600]; - + status = ft1000_read_dpram32(dev, 0x200, (PUCHAR)&cmdbuffer[0], size); - - //if (ft1000_receive_cmd(dev, &cmdbuffer[0], MAX_CMD_SQSIZE, &tempword)) + + //if (ft1000_receive_cmd(dev, &cmdbuffer[0], MAX_CMD_SQSIZE, &tempword)) { - -#ifdef JDEBUG + +#ifdef JDEBUG DEBUG("ft1000_proc_drvmsg:cmdbuffer\n"); for(i = 0; i < size; i+=5) { - if( (i + 5) < size ) - DEBUG("0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n", cmdbuffer[i], cmdbuffer[i+1], cmdbuffer[i+2], cmdbuffer[i+3], cmdbuffer[i+4]); + if( (i + 5) < size ) + DEBUG("0x%x, 0x%x, 0x%x, 0x%x, 0x%x\n", cmdbuffer[i], cmdbuffer[i+1], cmdbuffer[i+2], cmdbuffer[i+3], cmdbuffer[i+4]); else { for (j = i; j < size; j++) - DEBUG("0x%x ", cmdbuffer[j]); - DEBUG("\n"); + DEBUG("0x%x ", cmdbuffer[j]); + DEBUG("\n"); break; } } -#endif +#endif pdrvmsg = (PDRVMSG)&cmdbuffer[2]; msgtype = ntohs(pdrvmsg->type); DEBUG("ft1000_proc_drvmsg:Command message type = 0x%x\n", msgtype); switch (msgtype) { case MEDIA_STATE: { DEBUG("ft1000_proc_drvmsg:Command message type = MEDIA_STATE"); - + pmediamsg = (PMEDIAMSG)&cmdbuffer[0]; if (info->ProgConStat != 0xFF) { if (pmediamsg->state) { @@ -2319,9 +2319,9 @@ int ft1000_proc_drvmsg (struct ft1000_device *dev, u16 size) { if ( info->NetDevRegDone ) { //netif_carrier_on(dev->net);//mbelian - netif_wake_queue(dev->net); + netif_wake_queue(dev->net); } - info->mediastate = 1; + info->mediastate = 1; /*do_gettimeofday(&tv); info->ConTm = tv.tv_sec;*/ //mbelian } @@ -2343,7 +2343,7 @@ int ft1000_proc_drvmsg (struct ft1000_device *dev, u16 size) { DEBUG("Media is down\n"); if (info->mediastate == 1) { info->mediastate = 0; - if ( info->NetDevRegDone) + if ( info->NetDevRegDone) { //netif_carrier_off(dev->net); //mbelian //netif_stop_queue(dev->net); @@ -2355,7 +2355,7 @@ int ft1000_proc_drvmsg (struct ft1000_device *dev, u16 size) { } case DSP_INIT_MSG: { DEBUG("ft1000_proc_drvmsg:Command message type = DSP_INIT_MSG"); - + pdspinitmsg = (PDSPINITMSG)&cmdbuffer[2]; memcpy(info->DspVer, pdspinitmsg->DspVer, DSPVERSZ); DEBUG("DSPVER = 0x%2x 0x%2x 0x%2x 0x%2x\n", info->DspVer[0], info->DspVer[1], info->DspVer[2], info->DspVer[3]); @@ -2369,7 +2369,7 @@ int ft1000_proc_drvmsg (struct ft1000_device *dev, u16 size) { dev->net->dev_addr[3] = info->eui64[5]; dev->net->dev_addr[4] = info->eui64[6]; dev->net->dev_addr[5] = info->eui64[7]; - + if (ntohs(pdspinitmsg->length) == (sizeof(DSPINITMSG) - 20) ) { memcpy(info->ProductMode, pdspinitmsg->ProductMode, MODESZ); memcpy(info->RfCalVer, pdspinitmsg->RfCalVer, CALVERSZ); @@ -2380,15 +2380,15 @@ int ft1000_proc_drvmsg (struct ft1000_device *dev, u16 size) { } case DSP_PROVISION: { DEBUG("ft1000_proc_drvmsg:Command message type = DSP_PROVISION\n"); - + // kick off dspprov routine to start provisioning // Send provisioning data to DSP - if (list_empty(&info->prov_list) == 0) + if (list_empty(&info->prov_list) == 0) { info->fProvComplete = 0; status = ft1000_dsp_prov(dev); if (status != STATUS_SUCCESS) - return status; + return status; } else { info->fProvComplete = 1; @@ -2400,7 +2400,7 @@ int ft1000_proc_drvmsg (struct ft1000_device *dev, u16 size) { } case DSP_STORE_INFO: { DEBUG("ft1000_proc_drvmsg:Command message type = DSP_STORE_INFO"); - + DEBUG("FT1000:drivermsg:Got DSP_STORE_INFO\n"); tempword = ntohs(pdrvmsg->length); info->DSPInfoBlklen = tempword; @@ -2432,17 +2432,17 @@ int ft1000_proc_drvmsg (struct ft1000_device *dev, u16 size) { if (tempword & FT1000_DB_DPRAM_TX) { break; } - } + } } - + // Put message into Slow Queue // Form Pseudo header pmsg = (PUSHORT)info->DSPInfoBlk; *pmsg++ = 0; - *pmsg++ = htons(info->DSPInfoBlklen+20+info->DSPInfoBlklen); + *pmsg++ = htons(info->DSPInfoBlklen+20+info->DSPInfoBlklen); ppseudo_hdr = (PPSEUDO_HDR)(PUSHORT)&info->DSPInfoBlk[2]; ppseudo_hdr->length = htons(info->DSPInfoBlklen+4+info->DSPInfoBlklen); - ppseudo_hdr->source = 0x10; + ppseudo_hdr->source = 0x10; ppseudo_hdr->destination = 0x20; ppseudo_hdr->portdest = 0; ppseudo_hdr->portsrc = 0; @@ -2453,7 +2453,7 @@ int ft1000_proc_drvmsg (struct ft1000_device *dev, u16 size) { ppseudo_hdr->qos_class = 0; // Insert slow queue sequence number ppseudo_hdr->seq_num = info->squeseqnum++; - // Insert application id + // Insert application id ppseudo_hdr->portsrc = 0; // Calculate new checksum ppseudo_hdr->checksum = *pmsg++; @@ -2463,12 +2463,12 @@ int ft1000_proc_drvmsg (struct ft1000_device *dev, u16 size) { info->DSPInfoBlk[10] = 0x7200; info->DSPInfoBlk[11] = htons(info->DSPInfoBlklen); status = ft1000_write_dpram32 (dev, 0, (PUCHAR)&info->DSPInfoBlk[0], (unsigned short)(info->DSPInfoBlklen+22)); - status = ft1000_write_register (dev, FT1000_DB_DPRAM_TX, FT1000_REG_DOORBELL); + status = ft1000_write_register (dev, FT1000_DB_DPRAM_TX, FT1000_REG_DOORBELL); info->DrvMsgPend = 0; - + break; } - + case GET_DRV_ERR_RPT_MSG: { DEBUG("FT1000:drivermsg:Got GET_DRV_ERR_RPT_MSG\n"); // copy driver error message to dsp @@ -2481,16 +2481,16 @@ int ft1000_proc_drvmsg (struct ft1000_device *dev, u16 size) { status = ft1000_read_register(dev, &tempword, FT1000_REG_DOORBELL); if (tempword & FT1000_DB_DPRAM_TX) { mdelay(10); - } + } } - + if ( (tempword & FT1000_DB_DPRAM_TX) == 0) { // Put message into Slow Queue // Form Pseudo header pmsg = (PUSHORT)&tempbuffer[0]; ppseudo_hdr = (PPSEUDO_HDR)pmsg; ppseudo_hdr->length = htons(0x0012); - ppseudo_hdr->source = 0x10; + ppseudo_hdr->source = 0x10; ppseudo_hdr->destination = 0x20; ppseudo_hdr->portdest = 0; ppseudo_hdr->portsrc = 0; @@ -2501,7 +2501,7 @@ int ft1000_proc_drvmsg (struct ft1000_device *dev, u16 size) { ppseudo_hdr->qos_class = 0; // Insert slow queue sequence number ppseudo_hdr->seq_num = info->squeseqnum++; - // Insert application id + // Insert application id ppseudo_hdr->portsrc = 0; // Calculate new checksum ppseudo_hdr->checksum = *pmsg++; @@ -2527,12 +2527,12 @@ int ft1000_proc_drvmsg (struct ft1000_device *dev, u16 size) { info->DrvErrNum = 0; } info->DrvMsgPend = 0; - - break; + + break; } - + default: - break; + break; } } @@ -2544,24 +2544,24 @@ int ft1000_proc_drvmsg (struct ft1000_device *dev, u16 size) { int ft1000_poll(void* dev_id) { - + //FT1000_INFO *info = (PFT1000_INFO)((struct net_device *)dev_id)->priv; - //struct ft1000_device *dev = (struct ft1000_device *)info->pFt1000Dev; + //struct ft1000_device *dev = (struct ft1000_device *)info->pFt1000Dev; struct ft1000_device *dev = (struct ft1000_device *)dev_id; FT1000_INFO *info = (FT1000_INFO *) netdev_priv (dev->net); - + u16 tempword; u16 status; u16 size; int i; - USHORT data; + USHORT data; USHORT modulo; USHORT portid; u16 nxtph; PDPRAM_BLK pdpram_blk; PPSEUDO_HDR ppseudo_hdr; unsigned long flags; - + //DEBUG("Enter ft1000_poll...\n"); if (ft1000_chkcard(dev) == FALSE) { DEBUG("ft1000_poll::ft1000_chkcard: failed\n"); @@ -2571,42 +2571,42 @@ int ft1000_poll(void* dev_id) { status = ft1000_read_register (dev, &tempword, FT1000_REG_DOORBELL); // DEBUG("ft1000_poll: read FT1000_REG_DOORBELL message 0x%x\n", tempword); - //while ( (tempword) && (!status) ) { - if ( !status ) - { - + //while ( (tempword) && (!status) ) { + if ( !status ) + { + if (tempword & FT1000_DB_DPRAM_RX) { //DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type: FT1000_DB_DPRAM_RX\n"); - + status = ft1000_read_dpram16(dev, 0x200, (PUCHAR)&data, 0); //DEBUG("ft1000_poll:FT1000_DB_DPRAM_RX:ft1000_read_dpram16:size = 0x%x\n", data); size = ntohs(data) + 16 + 2; //wai if (size % 4) { modulo = 4 - (size % 4); size = size + modulo; - } + } status = ft1000_read_dpram16(dev, 0x201, (PUCHAR)&portid, 1); portid &= 0xff; //DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type: FT1000_DB_DPRAM_RX : portid 0x%x\n", portid); - + if (size < MAX_CMD_SQSIZE) { - switch (portid) + switch (portid) { case DRIVERID: DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type: FT1000_DB_DPRAM_RX : portid DRIVERID\n"); - + status = ft1000_proc_drvmsg (dev, size); if (status != STATUS_SUCCESS ) return status; break; case DSPBCMSGID: // This is a dsp broadcast message - // Check which application has registered for dsp broadcast messages + // Check which application has registered for dsp broadcast messages //DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type: FT1000_DB_DPRAM_RX : portid DSPBCMSGID\n"); - + for (i=0; iapp_info[i].DspBCMsgFlag) && (info->app_info[i].fileobject) && - (info->app_info[i].NumOfMsg < MAX_MSG_LIMIT) ) + if ( (info->app_info[i].DspBCMsgFlag) && (info->app_info[i].fileobject) && + (info->app_info[i].NumOfMsg < MAX_MSG_LIMIT) ) { //DEBUG("Dsp broadcast message detected for app id %d\n", i); nxtph = FT1000_DPRAM_RX_BASE + 2; @@ -2633,7 +2633,7 @@ int ft1000_poll(void* dev_id) { DEBUG("Out of memory in free receive command pool\n"); info->app_info[i].nRxMsgMiss++; }//endof if (pdpram_blk != NULL) - }//endof if + }//endof if //else // DEBUG("app_info mismatch\n"); }// endof for @@ -2687,7 +2687,7 @@ int ft1000_poll(void* dev_id) { else { DEBUG("FT1000:dpc:Invalid total length for SlowQ = %d\n", size); } - status = ft1000_write_register (dev, FT1000_DB_DPRAM_RX, FT1000_REG_DOORBELL); + status = ft1000_write_register (dev, FT1000_DB_DPRAM_RX, FT1000_REG_DOORBELL); } else if (tempword & FT1000_DSP_ASIC_RESET) { //DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type: FT1000_DSP_ASIC_RESET\n"); @@ -2716,7 +2716,7 @@ int ft1000_poll(void* dev_id) { } else if (tempword & FT1000_ASIC_RESET_REQ) { DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type: FT1000_ASIC_RESET_REQ\n"); - + // clear ASIC reset request from DSP status = ft1000_write_register (dev, FT1000_ASIC_RESET_REQ, FT1000_REG_DOORBELL); status = ft1000_write_register (dev, HOST_INTF_BE, FT1000_REG_SUP_CTRL); @@ -2724,22 +2724,22 @@ int ft1000_poll(void* dev_id) { status = ft1000_write_dpram32 (dev, 0, (PUCHAR)&info->DSPSess.Rec[0], 1024); // Program WMARK register status = ft1000_write_register (dev, 0x600, FT1000_REG_MAG_WATERMARK); - // ring doorbell to tell DSP that ASIC is out of reset + // ring doorbell to tell DSP that ASIC is out of reset status = ft1000_write_register (dev, FT1000_ASIC_RESET_DSP, FT1000_REG_DOORBELL); - } + } else if (tempword & FT1000_DB_COND_RESET) { - DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type: FT1000_DB_COND_RESET\n"); + DEBUG("ft1000_poll: FT1000_REG_DOORBELL message type: FT1000_DB_COND_RESET\n"); //By Jim -// Reset ASIC and DSP +// Reset ASIC and DSP //MAG if (info->fAppMsgPend == 0) { - // Reset ASIC and DSP - + // Reset ASIC and DSP + status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER0, (PUCHAR)&(info->DSP_TIME[0]), FT1000_MAG_DSP_TIMER0_INDX); status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER1, (PUCHAR)&(info->DSP_TIME[1]), FT1000_MAG_DSP_TIMER1_INDX); status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER2, (PUCHAR)&(info->DSP_TIME[2]), FT1000_MAG_DSP_TIMER2_INDX); - status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER3, (PUCHAR)&(info->DSP_TIME[3]), FT1000_MAG_DSP_TIMER3_INDX); - info->CardReady = 0; + status = ft1000_read_dpram16(dev, FT1000_MAG_DSP_TIMER3, (PUCHAR)&(info->DSP_TIME[3]), FT1000_MAG_DSP_TIMER3_INDX); + info->CardReady = 0; info->DrvErrNum = DSP_CONDRESET_INFO; DEBUG("ft1000_hw:DSP conditional reset requested\n"); info->ft1000_reset(dev->net); @@ -2748,10 +2748,10 @@ int ft1000_poll(void* dev_id) { info->fProvComplete = 0; info->fCondResetPend = 1; } - - ft1000_write_register(dev, FT1000_DB_COND_RESET, FT1000_REG_DOORBELL); + + ft1000_write_register(dev, FT1000_DB_COND_RESET, FT1000_REG_DOORBELL); } - + }//endof if ( !status ) //DEBUG("return from ft1000_poll.\n"); diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_ioctl.h b/drivers/staging/ft1000/ft1000-usb/ft1000_ioctl.h index 2d674a43d65b..e7d3ec8869ac 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_ioctl.h +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_ioctl.h @@ -3,21 +3,21 @@ // // Copyright (C) 2002 Flarion Technologies, All rights reserved. // -// This program is free software; you can redistribute it and/or modify it +// 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. This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for -// more details. You should have received a copy of the GNU General Public -// License along with this program; if not, write to the -// Free Software Foundation, Inc., 59 Temple Place - -// Suite 330, Boston, MA 02111-1307, USA. +// Software Foundation; either version 2 of the License, or (at your option) any +// later version. This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +// more details. You should have received a copy of the GNU General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., 59 Temple Place - +// Suite 330, Boston, MA 02111-1307, USA. //--------------------------------------------------------------------------- // // File: ft1000_ioctl.h // -// Description: Common structures and defines relating to IOCTL +// Description: Common structures and defines relating to IOCTL // // History: // 11/5/02 Whc Created. @@ -37,18 +37,18 @@ // Standard Flarion Pseudo header typedef struct _PSEUDO_HDR -{ +{ unsigned short length; //length of msg body unsigned char source; //source address (0x10=Host 0x20=DSP) unsigned char destination; //destination address (refer to source address) - unsigned char portdest; //destination port id + unsigned char portdest; //destination port id // 0x00=Driver // 0x10=Application Broadcast // 0x20=Network Stack // 0x80=Dsp OAM // 0x90=Dsp Airlink // 0xa0=Dsp Loader - // 0xb0=Dsp MIP + // 0xb0=Dsp MIP unsigned char portsrc; //source port id (refer to portdest) unsigned short sh_str_id; //stream id (Not applicable on Mobile) unsigned char control; //stream id (Not applicable on Mobile) @@ -97,14 +97,14 @@ typedef struct _IOCTL_GET_DSP_STAT unsigned long nRxPkts; // Number of packets received from dsp to host unsigned long nTxBytes; // Number of bytes transmitted from host to dsp unsigned long nRxBytes; // Number of bytes received from dsp to host - unsigned long ConTm; // Current session connection time in seconds + unsigned long ConTm; // Current session connection time in seconds unsigned char CalVer[CALVERSZ]; // Proprietary Calibration Version unsigned char CalDate[CALDATESZ]; // Proprietary Calibration Date } __attribute__ ((packed)) IOCTL_GET_DSP_STAT, *PIOCTL_GET_DSP_STAT; //Data structure for Dual Ported RAM messaging between Host and Dsp typedef struct _IOCTL_DPRAM_BLK -{ +{ unsigned short total_len; PSEUDO_HDR pseudohdr; unsigned char buffer[1780]; diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c index f8085ba09000..4dbc98b3d661 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.c @@ -73,7 +73,7 @@ int ft1000_poll_thread(void *arg) msleep(10); if ( ! gPollingfailed ) { - ret = ft1000_poll(arg); + ret = ft1000_poll(arg); if ( ret != STATUS_SUCCESS ) { DEBUG("ft1000_poll_thread: polling failed\n"); @@ -82,7 +82,7 @@ int ft1000_poll_thread(void *arg) } } //DEBUG("returned from polling thread\n"); - return STATUS_SUCCESS; + return STATUS_SUCCESS; } @@ -104,7 +104,7 @@ static int ft1000_probe(struct usb_interface *interface, const struct usb_device struct usb_host_interface *iface_desc; struct usb_endpoint_descriptor *endpoint; struct usb_device *dev; - unsigned numaltsetting; + unsigned numaltsetting; int i; struct ft1000_device *ft1000dev; @@ -117,7 +117,7 @@ static int ft1000_probe(struct usb_interface *interface, const struct usb_device } memset(ft1000dev, 0, sizeof(*ft1000dev)); - + //get usb device dev = interface_to_usbdev(interface); DEBUG("ft1000_probe: usb device descriptor info:\n"); @@ -134,9 +134,9 @@ static int ft1000_probe(struct usb_interface *interface, const struct usb_device DEBUG("ft1000_probe is called\n"); numaltsetting = interface->num_altsetting; - DEBUG("ft1000_probe: number of alt settings is :%d\n",numaltsetting); + DEBUG("ft1000_probe: number of alt settings is :%d\n",numaltsetting); iface_desc = interface->cur_altsetting; - DEBUG("ft1000_probe: number of endpoints is %d\n", iface_desc->desc.bNumEndpoints); + DEBUG("ft1000_probe: number of endpoints is %d\n", iface_desc->desc.bNumEndpoints); DEBUG("ft1000_probe: descriptor type is %d\n", iface_desc->desc.bDescriptorType); DEBUG("ft1000_probe: interface number is %d\n", iface_desc->desc.bInterfaceNumber); DEBUG("ft1000_probe: alternatesetting is %d\n", iface_desc->desc.bAlternateSetting); @@ -151,7 +151,7 @@ static int ft1000_probe(struct usb_interface *interface, const struct usb_device endpoint = (struct usb_endpoint_descriptor *)&iface_desc->endpoint[i].desc; DEBUG("endpoint %d\n", i); DEBUG("bEndpointAddress=%x, bmAttributes=%x\n", endpoint->bEndpointAddress, endpoint->bmAttributes); - if ( (endpoint->bEndpointAddress & USB_DIR_IN) && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK)) + if ( (endpoint->bEndpointAddress & USB_DIR_IN) && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK)) { ft1000dev->bulk_in_endpointAddr = endpoint->bEndpointAddress; DEBUG("ft1000_probe: in: %d\n", endpoint->bEndpointAddress); @@ -163,7 +163,7 @@ static int ft1000_probe(struct usb_interface *interface, const struct usb_device DEBUG("ft1000_probe: out: %d\n", endpoint->bEndpointAddress); } } - + DEBUG("bulk_in=%d, bulk_out=%d\n", ft1000dev->bulk_in_endpointAddr, ft1000dev->bulk_out_endpointAddr); //read DSP image @@ -177,27 +177,27 @@ static int ft1000_probe(struct usb_interface *interface, const struct usb_device //for ( i=0; i< MAX_NUM_CARDS+2; i++) // pdevobj[i] = NULL; - + //download dsp image DEBUG("ft1000_probe: start downloading dsp image...\n"); init_ft1000_netdev(ft1000dev); pft1000info = (FT1000_INFO *) netdev_priv (ft1000dev->net); -// DEBUG("In probe: pft1000info=%x\n", pft1000info); // aelias [-] reason: warning: format ???%x??? expects type ???unsigned int???, but argument 2 has type ???struct FT1000_INFO *??? +// DEBUG("In probe: pft1000info=%x\n", pft1000info); // aelias [-] reason: warning: format ???%x??? expects type ???unsigned int???, but argument 2 has type ???struct FT1000_INFO *??? DEBUG("In probe: pft1000info=%x\n", (unsigned int)pft1000info); // aelias [+] reason: up - + dsp_reload(ft1000dev); gPollingfailed = FALSE; //mbelian pft1000info->pPollThread = kthread_run(ft1000_poll_thread, ft1000dev, "ft1000_poll"); msleep(500); //mbelian - - + + if ( pft1000info->DSP_loading ) { DEBUG("ERROR!!!! RETURN FROM ft1000_probe **********************\n"); return 0; } - + while (!pft1000info->CardReady) { if ( gPollingfailed ) @@ -211,16 +211,16 @@ static int ft1000_probe(struct usb_interface *interface, const struct usb_device msleep(100); DEBUG("ft1000_probe::Waiting for Card Ready\n"); } - - + + //initialize network device DEBUG("ft1000_probe::Card Ready!!!! Registering network device\n"); reg_ft1000_netdev(ft1000dev, interface); - + pft1000info->NetDevRegDone = 1; - ft1000InitProc(ft1000dev->net);// +mbelian + ft1000InitProc(ft1000dev->net);// +mbelian return 0; } @@ -229,7 +229,7 @@ static int ft1000_probe(struct usb_interface *interface, const struct usb_device // Function: ft1000_disconnect // // Parameters: struct usb_interface *interface - passed by USB core -// +// // Returns: 0 - success // // Description: This function is invoked when the express card is plugged out @@ -240,11 +240,11 @@ static int ft1000_probe(struct usb_interface *interface, const struct usb_device static void ft1000_disconnect(struct usb_interface *interface) { FT1000_INFO *pft1000info; - + DEBUG("ft1000_disconnect is called\n"); - + pft1000info = (PFT1000_INFO)usb_get_intfdata(interface); -// DEBUG("In disconnect pft1000info=%x\n", pft1000info); // aelias [-] reason: warning: format ???%x??? expects type ???unsigned int???, but argument 2 has type ???struct FT1000_INFO *??? +// DEBUG("In disconnect pft1000info=%x\n", pft1000info); // aelias [-] reason: warning: format ???%x??? expects type ???unsigned int???, but argument 2 has type ???struct FT1000_INFO *??? DEBUG("In disconnect pft1000info=%x\n", (unsigned int) pft1000info); // aelias [+] reason: up @@ -256,9 +256,9 @@ static void ft1000_disconnect(struct usb_interface *interface) { kthread_stop(pft1000info->pPollThread ); } - + DEBUG("ft1000_disconnect: threads are terminated\n"); - + if (pft1000info->pFt1000Dev->net) { DEBUG("ft1000_disconnect: destroy char driver\n"); @@ -271,17 +271,17 @@ static void ft1000_disconnect(struct usb_interface *interface) free_netdev(pft1000info->pFt1000Dev->net); } - + usb_free_urb(pft1000info->pFt1000Dev->rx_urb); usb_free_urb(pft1000info->pFt1000Dev->tx_urb); - + DEBUG("ft1000_disconnect: urb freed\n"); kfree(pft1000info->pFt1000Dev); //+mbelian } //terminate other kernel threads - //in multiple instances case, first find the device + //in multiple instances case, first find the device //in the link list /**if (pPollThread) { @@ -304,7 +304,7 @@ static struct usb_driver ft1000_usb_driver = { // Function: usb_ft1000_init // // Parameters: none -// +// // Returns: 0 - success // // Description: The entry point of the module, register the usb driver @@ -315,7 +315,7 @@ static struct usb_driver ft1000_usb_driver = { static int __init usb_ft1000_init(void) { int ret = 0; - + DEBUG("Initialize and register the driver\n"); ret = usb_register(&ft1000_usb_driver); @@ -328,9 +328,9 @@ static int __init usb_ft1000_init(void) //--------------------------------------------------------------------------- // Function: usb_ft1000_exit // -// Parameters: -// -// Returns: +// Parameters: +// +// Returns: // // Description: Moudle unload function, deregister usb driver // diff --git a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h index 417bb1734f1b..b0c611be046f 100644 --- a/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h +++ b/drivers/staging/ft1000/ft1000-usb/ft1000_usb.h @@ -24,7 +24,7 @@ #define MAX_CMD_SQSIZE 1780 #define SLOWQ_TYPE 0 #define PSEUDOSZ 16 -#define DSP_QID_OFFSET 4 +#define DSP_QID_OFFSET 4 // MEMORY MAP FOR ELECTRABUZZ ASIC @@ -58,7 +58,7 @@ typedef struct _MEDIAMSG { u16 state; u32 ip_addr; u32 net_mask; - u32 gateway; + u32 gateway; u32 dns_1; u32 dns_2; } __attribute__ ((packed)) MEDIAMSG, *PMEDIAMSG; @@ -209,7 +209,7 @@ typedef struct _PROV_RECORD { // DSP doorbells -#define FT1000_DB_DPRAM_RX 0x0001 // this value indicates that DSP has +#define FT1000_DB_DPRAM_RX 0x0001 // this value indicates that DSP has // data for host in DPRAM SlowQ @@ -227,15 +227,15 @@ typedef struct _PROV_RECORD { // Host doorbells -#define FT1000_DB_DPRAM_TX 0x0100 // this value indicates that host has +#define FT1000_DB_DPRAM_TX 0x0100 // this value indicates that host has - // data for DSP in DPRAM. + // data for DSP in DPRAM. #define FT1000_DB_DNLD_TX 0x0200 // Downloader handshake doorbell #define FT1000_ASIC_RESET_DSP 0x0400 -#define FT1000_DB_HB 0x1000 // this value indicates that supervisor +#define FT1000_DB_HB 0x1000 // this value indicates that supervisor @@ -267,7 +267,7 @@ typedef struct _PROV_RECORD { #define DSP_TIMESTAMP 0x1FFC // dsp timestamp -#define DSP_TIMESTAMP_DIFF 0x1FFA // difference of dsp timestamp in DPRAM and Pseudo header. +#define DSP_TIMESTAMP_DIFF 0x1FFA // difference of dsp timestamp in DPRAM and Pseudo header. @@ -295,7 +295,7 @@ typedef struct _PROV_RECORD { #define FT1000_MAG_FIFO_LEN 0x1FF // total length for DSP FIFO tracking -#define FT1000_MAG_FIFO_LEN_INDX 0x1 // low-word index +#define FT1000_MAG_FIFO_LEN_INDX 0x1 // low-word index #define FT1000_MAG_HI_HO 0x1FF // heartbeat with HI/HO @@ -345,7 +345,7 @@ typedef struct _PROV_RECORD { #define FT1000_MAG_TOTAL_LEN 0x200 -#define FT1000_MAG_TOTAL_LEN_INDX 0x1 +#define FT1000_MAG_TOTAL_LEN_INDX 0x1 @@ -377,13 +377,13 @@ typedef struct _PROV_RECORD { #define ISR_EMPTY (UCHAR)0x00 // no bits set in ISR -#define ISR_DOORBELL_ACK (UCHAR)0x01 // the doorbell i sent has been recieved. +#define ISR_DOORBELL_ACK (UCHAR)0x01 // the doorbell i sent has been recieved. #define ISR_DOORBELL_PEND (UCHAR)0x02 // doorbell for me #define ISR_RCV (UCHAR)0x04 // packet received with no errors -#define ISR_WATERMARK (UCHAR)0x08 // +#define ISR_WATERMARK (UCHAR)0x08 // @@ -391,15 +391,15 @@ typedef struct _PROV_RECORD { // note these are different from the ISR BIT MAPS. -#define ISR_MASK_NONE 0x0000 +#define ISR_MASK_NONE 0x0000 -#define ISR_MASK_DOORBELL_ACK 0x0001 +#define ISR_MASK_DOORBELL_ACK 0x0001 -#define ISR_MASK_DOORBELL_PEND 0x0002 +#define ISR_MASK_DOORBELL_PEND 0x0002 -#define ISR_MASK_RCV 0x0004 +#define ISR_MASK_RCV 0x0004 -#define ISR_MASK_WATERMARK 0x0008 // Normally we will only mask the watermark interrupt when we want to enable interrupts. +#define ISR_MASK_WATERMARK 0x0008 // Normally we will only mask the watermark interrupt when we want to enable interrupts. #define ISR_MASK_ALL 0xffff @@ -411,7 +411,7 @@ typedef struct _PROV_RECORD { -#define ISR_DEFAULT_MASK 0x7ff9 +#define ISR_DEFAULT_MASK 0x7ff9 @@ -515,7 +515,7 @@ struct ft1000_device u8 tx_buf[MAX_BUF_SIZE]; u8 rx_buf[MAX_BUF_SIZE]; - + u8 bulk_in_endpointAddr; u8 bulk_out_endpointAddr; @@ -527,18 +527,18 @@ struct ft1000_device typedef struct _FT1000_INFO { struct ft1000_device *pFt1000Dev; struct net_device_stats stats; - + struct task_struct *pPollThread; - - unsigned char fcodeldr; + + unsigned char fcodeldr; unsigned char bootmode; unsigned char usbboot; unsigned short dspalive; u16 ASIC_ID; - BOOLEAN fProvComplete; - BOOLEAN fCondResetPend; - BOOLEAN fAppMsgPend; - char *pfwimg; + BOOLEAN fProvComplete; + BOOLEAN fCondResetPend; + BOOLEAN fAppMsgPend; + char *pfwimg; int fwimgsz; u16 DrvErrNum; u8 *pTestImage; @@ -585,7 +585,7 @@ typedef struct _FT1000_INFO { u16 ProgConStat; struct list_head prov_list; int appcnt; - APP_INFO_BLOCK app_info[MAX_NUM_APP]; //Added by Jim + APP_INFO_BLOCK app_info[MAX_NUM_APP]; //Added by Jim u16 DSPInfoBlklen; u16 DrvMsgPend; int (*ft1000_reset)(struct net_device *dev); -- 2.39.5