Hi,
I made a version of the driver that use the new library usb-atm from 2.6.10.

It drop all the usb, atm ethernet code for sending-receiving data.

Now atm part is managed by kernel, and use of "generic" tool could be use. Moreover it is now possible to receive data for more than one vpi/vci (I am not sure it is very useful, but on free degroupe you have 8.35 (probably a mire) and 8.36 that send data).

To compile the patch, you need to compile the driver with bulk. Then you could look for tutorial for the atm tools (http://www.andesi.org/index.php?node=93 for example) (I have a experimental support for dhcp in routed ip)

It is still experimental and could crash the kernel when unloading/reloading.

I think it is a good way to start to make a driver that we could propose for inclusion in the kernel. With the two other patch I made, and a suppression of the options + CMV it could be a good start...



Matthieu
? .Dsp.o.cmd
? .Me.o.cmd
? .Mpoa.o.cmd
? .Oam.o.cmd
? .Pipes.o.cmd
? .Sar.o.cmd
? .Sm.o.cmd
? .Uni.o.cmd
? .eagle-usb.ko.cmd
? .eagle-usb.mod.o.cmd
? .eagle-usb.o.cmd
? .eu_boot_sm.o.cmd
? .eu_eth.o.cmd
? .eu_main.o.cmd
? .eu_msg.o.cmd
? .eu_utils.o.cmd
? .tmp_versions
? argument
? comp
? conf
? copying
? dhcp
? down
? eagle-usb.ko
? firmware
? old
? run
? t
? user
Index: Makefile
===================================================================
RCS file: /cvs/eagleusb/eagleusb/driver/Makefile,v
retrieving revision 1.5
diff -u -u -r1.5 Makefile
--- Makefile    17 Oct 2004 20:34:38 -0000      1.5
+++ Makefile    4 Jan 2005 19:49:37 -0000
@@ -3,16 +3,10 @@
 
 OBJS = eu_main.o       \
        eu_utils.o      \
-       Pipes.o                 \
        Me.o                    \
        Sm.o                    \
        eu_msg.o        \
        Dsp.o                   \
-       Mpoa.o                  \
-       Uni.o                   \
-       Sar.o                   \
-       Oam.o                   \
-       eu_eth.o         \
        eu_boot_sm.o
 
 
Index: Sm.c
===================================================================
RCS file: /cvs/eagleusb/eagleusb/driver/Sm.c,v
retrieving revision 1.6
diff -u -u -r1.6 Sm.c
--- Sm.c        27 Sep 2004 21:59:07 -0000      1.6
+++ Sm.c        4 Jan 2005 19:49:37 -0000
@@ -26,7 +26,6 @@
 
 #include "Adiutil.h"
 #include "eu_sm.h"
-#include "eu_eth.h"
 #include "Cmv.h"
 #include "macros.h"
 #include "eu_utils.h"
@@ -872,6 +871,9 @@
                         pAdiSM->XferRate0 = pMsg->data;
                         pAdiSM->DownRate = (pMsg->data>>16) *32*1024;
                         pAdiSM->UpRate = (pMsg->data&0xFFFF) *32*1024;
+#ifdef MODULAR
+                       ins->u.atm_dev->link_rate = pAdiSM->DownRate / 424;
+#endif
                         
                         if ( !EU_TEST_FLAG(ins,EU_LOW_RATE) )
                         {
@@ -1009,6 +1011,7 @@
             break;
     }
 
+#ifndef MODULAR
     /*
      * Create ethernet device if not present
      */
@@ -1066,7 +1069,33 @@
         }
     }
     
-    
+#else
+    if ( ( (pAdiSM->CurrentAdiState & 0xFFF0) == STATE_OPERATIONAL ) &&
+                   ins->u.status != UDSL_LOADED_FIRMWARE)
+    {
+ 
+        ins->u.status = UDSL_LOADED_FIRMWARE;
+        tasklet_schedule(&ins->u.receive_tasklet);
+        wake_up_interruptible(&ins->u.firmware_waiters);
+    }
+
+
+       if ( ( (pAdiSM->CurrentAdiState & 0xFFF0) == STATE_OPERATIONAL ) &&
+             ( ins->u.atm_dev->signal != ATM_PHY_SIG_FOUND ) 
+           ) 
+        {
+            eu_dbg (DBG_SM,"** Carrier ON ** \n");
+           ins->u.atm_dev->signal = ATM_PHY_SIG_FOUND;
+        }
+        else if ( ( (tmpState & 0xFFF0) == STATE_OPERATIONAL ) &&
+                  ( ( pAdiSM->CurrentAdiState & 0xFFF0) != STATE_OPERATIONAL )
+                ) 
+        {
+            eu_dbg (DBG_SM,"** Carrier OFF **\n");
+            
+           ins->u.atm_dev->signal = ATM_PHY_SIG_LOST;
+        }
+#endif
     /* refresh previous state to be last known current one*/
     pAdiSM->PrevAdiState = tmpState;
 
Index: eu_main.c
===================================================================
RCS file: /cvs/eagleusb/eagleusb/driver/eu_main.c,v
retrieving revision 1.24
diff -u -u -r1.24 eu_main.c
--- eu_main.c   7 Nov 2004 09:06:55 -0000       1.24
+++ eu_main.c   4 Jan 2005 19:49:39 -0000
@@ -42,15 +42,10 @@
 #include "macros.h"
 #include "Dsp.h"
 #include "eu_msg.h"
-#include "Pipes.h"
 #include "eu_utils.h"
 #include "eu_sm.h"
-#include "Oam.h"
-#include "Mpoa.h"
 #include "Me.h"
-#include "Uni.h"
 #include "debug.h"
-#include "eu_eth.h"
 #include "eu_boot_sm.h"
 
 /* ------------------------------- Private Macros 
------------------------------- */
@@ -137,7 +132,9 @@
 static eu_instance_t * eu_init_postfirm ( struct usb_device *usb );
 #endif
 static void eu_disconnect_postfirm ( eu_instance_t *ins , struct usb_device 
*usb );
+#ifndef MODULAR
 static void eu_process_rcv ( unsigned long data );
+#endif
 static int eu_check_options ( const eu_options_t opt );
 
 /* ----------------------------- Private Variables 
------------------------------ */
@@ -468,6 +465,18 @@
             
 }
 
+#ifdef MODULAR
+static int firmware_wait(struct udsl_instance_data *instance)
+{
+ //speedtch_firmware_start((void *)instance);
+
+ if (wait_event_interruptible(instance->firmware_waiters, instance->status != 
UDSL_LOADING_FIRMWARE) < 0)
+ return -ERESTARTSYS;
+
+ return (instance->status == UDSL_LOADED_FIRMWARE) ? 0 : -EAGAIN;
+} 
+#endif
+
 /**
  * eu_init_postfirm  - Initialize post firmware device
  *
@@ -550,6 +559,7 @@
         goto free_instance;
     }
     
+#ifndef MODULAR
     ins->segmentation_buffer  = GET_KBUFFER(OUTGOING_DATA_SIZE);
 
     if ( !ins->segmentation_buffer ) 
@@ -557,6 +567,7 @@
         eu_err ("Can't allocate segmentation buffer\n");
         goto free_int_buff;
     }
+#endif
             
     INIT_LIST_HEAD ( &ins->comp_read_q );
     ins->comp_read_q_lock = SPIN_LOCK_UNLOCKED;
@@ -582,6 +593,7 @@
         goto free_seg_buff;
     }
 
+#ifndef MODULAR
     for ( i=0; i < INCOMING_Q_SIZE; i++ ) 
     {
         ins->read_urb[i]   = USB_ALLOC_URB ( nb_frames, GFP_ATOMIC );
@@ -596,7 +608,6 @@
         
     }
             
-
     ins->pOAMCell = GET_KBUFFER(128);
     if (ins->pOAMCell == 0 )
     {
@@ -606,6 +617,7 @@
             
     ins->mru = 0;
             
+#endif
     /*
      * Initialize the CTRL URB queue
      */
@@ -684,9 +696,11 @@
     ins->AdiModemSm.HeartbeatCounter = 0; 
     ins->AdiModemSm.CurrentAdiState  = STATE_JUST_PLUGGED_IN;
 
+#ifndef MODULAR
     init_timer(&ins->OAMTimer);
     ins->OAMTimer.function  = OAMTimerFunction;
     ins->OAMTimer.data      = (unsigned long)ins;
+#endif
 
 
     /*
@@ -756,6 +770,7 @@
      */
     init_waitqueue_head (&ins->thr_wait);            
 
+#ifndef MODULAR
     if ( if_name ) 
     {
         strncpy ( ins->if_name, if_name, IFNAMSIZ-1);
@@ -774,6 +789,13 @@
      */
     INIT_WORK (&ins->create_eth,eu_eth_create, ins);
 #endif
+#else
+    ins->u.data_endpoint = EP_BULK_DATA_OUT;
+    ins->u.driver_name = "eagle-usb";
+    ins->u.firmware_wait = firmware_wait;
+    udsl_instance_setup(usb, &ins->u);
+    memcpy (ins->u.atm_dev->esi, ins->mac, ETH_ALEN );
+#endif
 
     /*
      * And boot SM
@@ -800,11 +822,13 @@
     usb_driver_release_interface(&eu_driver, GET_INTF_PTR(usb,1));    
 
   free_oam_timer:
+#ifndef MODULAR
     if ( timer_pending ( &ins->OAMTimer ) ) 
     {
         del_timer ( &ins->OAMTimer );
     }
-  
+#endif
+
   free_urb_write:
     usb_free_urb ( ins->urb_write );
     ins->urb_write = NULL;
@@ -814,9 +838,10 @@
     ins->urb_int = NULL;
     
   free_oam_cell:
-    FREE_KBUFFER (ins->pOAMCell );
+    //FREE_KBUFFER (ins->pOAMCell );
     
   free_urbs:
+#ifndef MODULAR
     
     for ( i=0; i < INCOMING_Q_SIZE; i++ ) 
     {
@@ -829,11 +854,14 @@
             break;
         }
     }
+#endif
     
     kmem_cache_destroy ( ins->rb_cache );
     
   free_seg_buff:
+#ifndef MODULAR
     FREE_KBUFFER ( ins->segmentation_buffer );
+#endif
 
   free_int_buff:
     FREE_KBUFFER ( ins->intr_data );
@@ -1007,6 +1035,7 @@
      */
     FreeDspData ( &ins->MainPage, &ins->pSwapPages, &ins->SwapPageCount );
            
+#ifndef MODULAR
     if ( timer_pending ( &ins->OAMTimer ) ) 
     {
         del_timer ( &ins->OAMTimer );
@@ -1028,13 +1057,14 @@
     }
     
     EU_CLEAR_FLAG (ins, EU_ETH_REGISTERED);
-
+#endif
     
     /*
      * Free memory we alloced
      */
     FREE_KBUFFER ( ins->intr_data );
 
+#ifndef MODULAR
     for ( i=0; i<INCOMING_Q_SIZE; i++ )
     {
 
@@ -1053,14 +1083,21 @@
             ins->read_urb[i] = NULL;
         }
     }
-            
+#endif
+    
     kmem_cache_destroy ( ins->rb_cache );            
 
 
+#ifndef MODULAR
     tasklet_kill ( &ins->rcv_complete_tasklet);
 
     
     FREE_KBUFFER ( ins->pOAMCell ); 
+#else
+    udsl_instance_disconnect(&ins->u);
+    udsl_put_instance(&ins->u);
+    //XXX
+#endif
 
     unlink_ipg_ctrl_urb ( ins );
     free_queued_urb_ctrl (&ins->ctrl_urb_free_q);
@@ -1077,9 +1114,10 @@
      * Free urb_oam_write
      */
     ins->urb_oam_write->transfer_flags &= ~URB_ASYNC_UNLINK;
+#ifndef MODULAR
     usb_unlink_urb(ins->urb_oam_write);
     usb_free_urb ( ins->urb_oam_write );
-    
+#endif
 
     /*
      * Tell usb that we no longer claim these interfaces as our property
@@ -1461,7 +1499,9 @@
                             }
 
                             eu_msg_initialize ( ins, opt );
+#ifndef MODULAR
                             MpoaInitialize(ins, opt);
+#endif
 
                             EU_SET_FLAG (ins, EU_MSG_INITIALIZED);
                             
@@ -1649,6 +1689,7 @@
                     break;
             
                 case EU_IO_GETITF:             /* Get the network interface 
name */
+#ifndef MODULAR
                 {
                     uint32_t length;
                 
@@ -1665,7 +1706,6 @@
                         retval = -EFAULT;
                         break;
                     }
-                
                     length = strlen(ins->eth->name) + sizeof(char);
                     if ( NULL == pIOCTLinfo->buffer )
                     {
@@ -1693,6 +1733,9 @@
                     }
                     break;
                 }
+#else
+               retval = -EFAULT;
+#endif                
                 break;
             
                 case EU_IO_SYNC:               /* Wait for modem "operational" 
state */
@@ -1752,6 +1795,7 @@
                      ins->usbdev->bus->busnum, ins->usbdev->devnum, 
module_dbg_mask);
     }
     
+#ifndef MODULAR
     if (ins->eth->name)
     {
         p += sprintf(p, "Ethernet Interface : %s\n",ins->eth->name);
@@ -1760,6 +1804,7 @@
     {
         p += sprintf(p, "Ethernet Interface : none\n");
     }
+#endif
     p += sprintf(p, "MAC: %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x\n",
                  ins->mac[0],ins->mac[1],ins->mac[2],ins->mac[3],ins->mac[4],
                  ins->mac[5]);
@@ -1776,8 +1821,10 @@
                  ins->AdiModemSm.INFO08,
                  ins->AdiModemSm.DIAG03);
 
+#ifndef MODULAR
     p += sprintf(p, "VPI      %10d  VCI      %10d  Delin         ", 
                  ins->Vc.vpi, ins->Vc.vci);
+#endif
 
     /*Delineation is the only one where we print a string instead of a number*/
     if (ins->AdiModemSm.flags & 0x0C00)
@@ -1863,7 +1910,7 @@
     return size;
 }
 
-
+#ifndef MODULAR
 /**
  * eu_process_rcv  -  Process completed receive queue
  *                    Called as a tasklet
@@ -1966,6 +2013,7 @@
     eu_leaves ( DBG_READ );
     
 }
+#endif
 
 
 /* ------------------------------------ Misc 
------------------------------------ */
Index: eu_types.h
===================================================================
RCS file: /cvs/eagleusb/eagleusb/driver/eu_types.h,v
retrieving revision 1.8
diff -u -u -r1.8 eu_types.h
--- eu_types.h  7 Nov 2004 09:06:55 -0000       1.8
+++ eu_types.h  4 Jan 2005 19:49:39 -0000
@@ -28,6 +28,9 @@
 #include <linux/if_ether.h>
 #include <asm/bitops.h>
 #include <linux/types.h>
+#include "../drivers/usb/atm/usb_atm.h"
+
+#define MODULAR
 
 /**
  * eu_ioctl_info  -  Used to exchange data between kernl and user space via
@@ -699,7 +702,7 @@
     struct urb  *urb_int;
     struct urb  *urb_write;
     struct urb  *urb_oam_write;
-    struct urb  *read_urb[INCOMING_Q_SIZE];      /* Array of receive urbs  */
+    //struct urb  *read_urb[INCOMING_Q_SIZE];      /* Array of receive urbs  */
 
 
     /*
@@ -725,18 +728,18 @@
     /*
      * Maximum Receive Unit - depends on the encapsulation
      */
-    unsigned int mru;
+    //unsigned int mru;
 
     /*
      * Size of the header to prepend in front of inbound data
      */
-    unsigned int eth_hdr;
+    //unsigned int eth_hdr;
     
 
     /*
      * To hold outbound data
      */
-    uint8_t   *segmentation_buffer;
+    //uint8_t   *segmentation_buffer;
     
     
 
@@ -770,13 +773,13 @@
     /*
      * Tasklets
      */
-    struct tasklet_struct rcv_complete_tasklet;
+    //struct tasklet_struct rcv_complete_tasklet;
     
 #ifdef LINUX_2_6
     /*
      * Work queue for eth creation
      */
-    struct work_struct   create_eth;
+    //struct work_struct   create_eth;
 #endif
 
     /*
@@ -816,22 +819,24 @@
 #ifdef DELAY_ISO_STARTUP
     uint32_t          IsReadPipeStarted;
 #endif
-    uint32_t           MpoaMode;
+    //uint32_t           MpoaMode;
     uint8_t            mac[ETH_ALEN];
 
     /*
      * Ethernet interface data
      */
+#ifndef MODULAR
     uint32_t                 out_pkt_size;
     struct net_device       *eth;
     struct net_device_stats  LinuxStats;
     char                     if_name[IFNAMSIZ];
-    
+#endif    
     /*
      * Statistics
      */
     uint32_t Statistics[STAT_COUNT];
 
+#ifndef MODULAR
     /*
      * ATM data
      */
@@ -849,6 +854,8 @@
     uint8_t           *pOAMCell;
     uint8_t            OAMCellHeader[ATM_CELL_HEADER_SIZE*2];
     struct timer_list  OAMTimer;
+#endif
+    struct udsl_instance_data u;
 
 } eu_instance_t;
 

Reply via email to