diff -ruN -x 'Entries*' ecos_web_cvs/ecos/packages/devs/can/m68k/mcf52xx/current/ChangeLog ecos/ecos/packages/devs/can/m68k/mcf52xx/current/ChangeLog
--- ecos_web_cvs/ecos/packages/devs/can/m68k/mcf52xx/current/ChangeLog	2006-03-13 15:46:02.000000000 +0100
+++ ecos/ecos/packages/devs/can/m68k/mcf52xx/current/ChangeLog	2007-03-23 16:18:40.000000000 +0100
@@ -1,3 +1,37 @@
+2007-03-23  Uwe Kindler  <uwe_kindler@web.de>
+
+	* cdl/can_mcf52xx.cdl Removed interfaces 
+	  CYGINT_DEVS_CAN_MCF52xx_FLEXCAN_SUPP_STD_CAN_ID and
+	  CYGINT_DEVS_CAN_MCF52xx_FLEXCAN_SUPP_EXT_CAN_ID. The generic
+	  CAN I/O layer provides some similar interfaces now.
+	  Driver now implements the new CAN I/O interfaces 
+	  CYGINT_IO_CAN_TIMESTAMP, CYGINT_IO_CAN_RUNTIME_MBOX_CFG
+	  CYGINT_IO_CAN_REMOTE_BUF and CYGINT_IO_CAN_TX_EVENTS,
+	  CYGINT_IO_CAN_STD_CAN_ID, CYGINT_IO_CAN_EXT_CAN_ID
+	  Removed make commands for removed test cases.
+	  Removed cdl component CYGPKG_DEVS_CAN_MCF52xx_FLEXCAN_OPTIONS
+	  because it did not have any functionality.
+	  
+	* src/can_mcf52xx.c Replaced 
+	  CYGINT_DEVS_CAN_MCF52xx_FLEXCAN_SUPP_EXT_CAN_ID with 
+	  generic CAN I/O option CYGOPT_IO_CAN_EXT_CAN_ID and 
+	  CYGINT_DEVS_CAN_MCF52xx_FLEXCAN_SUPP_STD_CAN_ID with
+	  generic CAN I/O option CYGOPT_IO_CAN_STD_CAN_ID
+	  Implemented CAN mode CYGNUM_CAN_MODE_CONFIG.
+	  Changed old access to CAN data (byte array) to access
+	  to new cyg_can_msg_data type.
+	  
+	* tests/flexcan_filter: removed. This tast case is now part of
+	  generic CAN I/O layer.
+	  
+	* tests/flexcan_load: removed. This tast case is now part of
+	  generic CAN I/O layer.
+	
+	* tests/flexcan_remote: removed. This tast case is now part of
+	  generic CAN I/O layer.
+	
+	* tets/flexcan_wake: Did some code cleaning.
+
 2006-02-15  Uwe Kindler  <uwe_kindler@web.de>
 
 	* cdl/can_mcf52xx.cdl Added two interfaces
diff -ruN -x 'Entries*' ecos_web_cvs/ecos/packages/devs/can/m68k/mcf52xx/current/cdl/can_mcf52xx.cdl ecos/ecos/packages/devs/can/m68k/mcf52xx/current/cdl/can_mcf52xx.cdl
--- ecos_web_cvs/ecos/packages/devs/can/m68k/mcf52xx/current/cdl/can_mcf52xx.cdl	2006-03-13 15:46:02.000000000 +0100
+++ ecos/ecos/packages/devs/can/m68k/mcf52xx/current/cdl/can_mcf52xx.cdl	2007-03-23 17:35:32.000000000 +0100
@@ -64,21 +64,6 @@
         puts $::cdl_system_header "/*****  CAN driver proc output end  *****/"
     }
     
-    cdl_interface CYGINT_DEVS_CAN_MCF52xx_FLEXCAN_SUPP_STD_CAN_ID {
-        display "11 Bit standard ID support"
-        flavor bool
-        description "
-               This interface is implemented if support for CAN
-               messages with 11 Bit standard CAN ID is required."
-    }
-
-    cdl_interface CYGINT_DEVS_CAN_MCF52xx_FLEXCAN_SUPP_EXT_CAN_ID {
-        display "29 Bit extended ID support"
-        flavor bool
-        description "
-               This interface is implemented if support for CAN
-               messages with 29 Bit standard CAN ID is required."
-    }
 
     # Support up to two on-chip FlexCAN modules. The number varies between
     # processor variants
@@ -98,7 +83,10 @@
             flavor      bool
             active_if       CYGINT_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]
             default_value   1
-            implements      CYGINT_IO_CAN_TIMESTAMP
+            implements      CYGINT_IO_CAN_TIMESTAMP       
+            implements      CYGINT_IO_CAN_RUNTIME_MBOX_CFG
+            implements      CYGINT_IO_CAN_REMOTE_BUF  
+            implements      CYGINT_IO_CAN_TX_EVENTS
             
             description "
                 If the application needs to access the on-chip FlexCAN[set ::flexcan]
@@ -191,9 +179,10 @@
             cdl_option CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_STD_MBOXES {
                 display "11 Bit standard ID msg. buffers"
                 flavor  booldata
-                implements CYGINT_DEVS_CAN_MCF52xx_FLEXCAN_SUPP_STD_CAN_ID
-                default_value 15
-                legal_values  0 to 15
+                requires CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_STD_MBOXES + CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_EXT_MBOXES < 16
+                implements CYGINT_IO_CAN_STD_CAN_ID
+                default_value 7
+                legal_values  1 to 15
                 description "
                     The FlexCAN module contains 16 message buffers. One message buffer
                     is reserved for message transmission. The remaining 15 buffers are
@@ -210,10 +199,10 @@
             cdl_option CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_EXT_MBOXES {
                 display "29 Bit extended ID msg. buffers"
                 flavor  booldata
-                requires ((CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_STD_MBOXES + CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_EXT_MBOXES) <= 15)
-                implements CYGINT_DEVS_CAN_MCF52xx_FLEXCAN_SUPP_EXT_CAN_ID
-                default_value 0
-                legal_values  0 to 15
+                requires CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_STD_MBOXES + CYGNUM_DEVS_CAN_MCF52xx_FLEXCAN[set ::flexcan]_EXT_MBOXES < 16
+                implements CYGINT_IO_CAN_EXT_CAN_ID
+                default_value 8
+                legal_values  1 to 15
                 description "
                     The FlexCAN module contain 16 message buffers. One message buffer
                     is reserved for message transmission. The remaining 15 buffers are
@@ -268,31 +257,7 @@
             testing infrastructure. All tests require a properly configured
             CAN network with a second CAN node that can send and receive
             CAN messages."
-
-        make -priority 320 {
-            <PREFIX>/bin/flexcan_load : <PACKAGE>/tests/flexcan_load.c
-            @sh -c "mkdir -p tests $(dir $@)"
-            $(CC) -c $(INCLUDE_PATH) -Wp,-MD,deps.tmp -I$(dir $<) $(CFLAGS) -o tests/flexcan_load.o $<
-            @echo $@ ": \\" > $(notdir $@).deps
-            @echo $(wildcard $(PREFIX)/lib/*) " \\" >> $(notdir $@).deps
-            @tail -n +2 deps.tmp >> $(notdir $@).deps
-            @echo >> $(notdir $@).deps
-            @rm deps.tmp
-            $(CC) $(LDFLAGS) -L$(PREFIX)/lib -Ttarget.ld -o $@ tests/flexcan_load.o
-        }
-        
-        make -priority 320 {
-            <PREFIX>/bin/flexcan_remote : <PACKAGE>/tests/flexcan_remote.c
-            @sh -c "mkdir -p tests $(dir $@)"
-            $(CC) -c $(INCLUDE_PATH) -Wp,-MD,deps.tmp -I$(dir $<) $(CFLAGS) -o tests/flexcan_remote.o $<
-            @echo $@ ": \\" > $(notdir $@).deps
-            @echo $(wildcard $(PREFIX)/lib/*) " \\" >> $(notdir $@).deps
-            @tail -n +2 deps.tmp >> $(notdir $@).deps
-            @echo >> $(notdir $@).deps
-            @rm deps.tmp
-            $(CC) $(LDFLAGS) -L$(PREFIX)/lib -Ttarget.ld -o $@ tests/flexcan_remote.o
-        }
-        
+       
         make -priority 320 {
             <PREFIX>/bin/flexcan_wake : <PACKAGE>/tests/flexcan_wake.c
             @sh -c "mkdir -p tests $(dir $@)"
@@ -304,50 +269,5 @@
             @rm deps.tmp
             $(CC) $(LDFLAGS) -L$(PREFIX)/lib -Ttarget.ld -o $@ tests/flexcan_wake.o
         }
-        
-        make -priority 320 {
-            <PREFIX>/bin/flexcan_filter : <PACKAGE>/tests/flexcan_filter.c
-            @sh -c "mkdir -p tests $(dir $@)"
-            $(CC) -c $(INCLUDE_PATH) -Wp,-MD,deps.tmp -I$(dir $<) $(CFLAGS) -o tests/flexcan_filter.o $<
-            @echo $@ ": \\" > $(notdir $@).deps
-            @echo $(wildcard $(PREFIX)/lib/*) " \\" >> $(notdir $@).deps
-            @tail -n +2 deps.tmp >> $(notdir $@).deps
-            @echo >> $(notdir $@).deps
-            @rm deps.tmp
-            $(CC) $(LDFLAGS) -L$(PREFIX)/lib -Ttarget.ld -o $@ tests/flexcan_filter.o
-        }
-    }
-
-
-
-    cdl_component CYGPKG_DEVS_CAN_MCF52xx_FLEXCAN_OPTIONS {
-        display "FlexCAN device driver build options"
-        flavor  none
-        description   "
-        Package specific build options including control over
-        compiler flags used only in building this package,
-        and details of which tests are built."
-
-        cdl_option CYGPKG_DEVS_CAN_MCF52xx_FLEXCAN_CFLAGS_ADD {
-            display "Additional compiler flags"
-            flavor  data
-            no_define
-            default_value { "" }
-            description   "
-                This option modifies the set of compiler flags for
-                building these CAN device drivers. These flags are
-                used in addition to the set of global flags."
-        }
-
-        cdl_option CYGPKG_DEVS_CAN_MCF52xx_FLEXCAN_CFLAGS_REMOVE {
-            display "Suppressed compiler flags"
-            flavor  data
-            no_define
-            default_value { "" }
-            description   "
-                This option modifies the set of compiler flags for
-                building these CAN device drivers. These flags are
-                removed from the set of global flags if present."
-        }
     }
 }
diff -ruN -x 'Entries*' ecos_web_cvs/ecos/packages/devs/can/m68k/mcf52xx/current/src/can_mcf52xx.c ecos/ecos/packages/devs/can/m68k/mcf52xx/current/src/can_mcf52xx.c
--- ecos_web_cvs/ecos/packages/devs/can/m68k/mcf52xx/current/src/can_mcf52xx.c	2006-03-13 15:46:02.000000000 +0100
+++ ecos/ecos/packages/devs/can/m68k/mcf52xx/current/src/can_mcf52xx.c	2007-03-07 00:06:52.000000000 +0100
@@ -562,14 +562,14 @@
 //
 // TX and RX ISRs and DSRs
 //
-#ifdef CYGINT_DEVS_CAN_MCF52xx_FLEXCAN_SUPP_STD_CAN_ID
+#ifdef CYGOPT_IO_CAN_STD_CAN_ID
 static cyg_uint32  flexcan_mbox_rx_std_isr(cyg_vector_t, cyg_addrword_t);
 static void        flexcan_mbox_rx_std_dsr(cyg_vector_t, cyg_ucount32, cyg_addrword_t);
-#endif // #ifdef CYGINT_DEVS_CAN_MCF52xx_FLEXCAN_SUPP_STD_CAN_ID
-#ifdef CYGINT_DEVS_CAN_MCF52xx_FLEXCAN_SUPP_EXT_CAN_ID
+#endif // CYGOPT_IO_CAN_STD_CAN_ID
+#ifdef CYGOPT_IO_CAN_EXT_CAN_ID
 static cyg_uint32  flexcan_mbox_rx_ext_isr(cyg_vector_t, cyg_addrword_t);
 static void        flexcan_mbox_rx_ext_dsr(cyg_vector_t, cyg_ucount32, cyg_addrword_t);
-#endif // CYGINT_DEVS_CAN_MCF52xx_FLEXCAN_SUPP_STD_EXT_ID
+#endif // CYGOPT_IO_CAN_EXT_CAN_ID
 static cyg_uint32  flexcan_mbox_rx_filt_isr(cyg_vector_t, cyg_addrword_t);
 static cyg_uint32  flexcan_mbox_tx_isr(cyg_vector_t, cyg_addrword_t);
 static void        flexcan_mbox_tx_dsr(cyg_vector_t, cyg_ucount32, cyg_addrword_t);
@@ -766,7 +766,7 @@
     // Set state of message buffer accoring to ISR function that
     // will be registered
     //
-#ifdef CYGINT_DEVS_CAN_MCF52xx_FLEXCAN_SUPP_STD_CAN_ID
+#ifdef CYGOPT_IO_CAN_STD_CAN_ID
     if (*isr == flexcan_mbox_rx_std_isr)
     {
         //
@@ -786,8 +786,8 @@
         }
     }
     else
-#endif // CYGINT_DEVS_CAN_MCF52xx_FLEXCAN_SUPP_STD_CAN_ID
-#ifdef CYGINT_DEVS_CAN_MCF52xx_FLEXCAN_SUPP_EXT_CAN_ID
+#endif // CYGOPT_IO_CAN_STD_CAN_ID
+#ifdef CYGOPT_IO_CAN_EXT_CAN_ID
     if (*isr == flexcan_mbox_rx_ext_isr)
     {
         //
@@ -807,7 +807,7 @@
         }
     }
     else
-#endif // CYGINT_DEVS_CAN_MCF52xx_FLEXCAN_SUPP_EXT_CAN_ID
+#endif // CYGOPT_IO_CAN_EXT_CAN_ID
     if (*isr == flexcan_mbox_rx_filt_isr)
     {
         info->mboxes[mbox_id].state = MBOX_STATE_RX_FILT;
@@ -959,24 +959,24 @@
         //
         // configure message buffers for standard frames
         //
-#ifdef CYGINT_DEVS_CAN_MCF52xx_FLEXCAN_SUPP_STD_CAN_ID
+#ifdef CYGOPT_IO_CAN_STD_CAN_ID
         if (i < info->mboxes_std_cnt)
                  {
             filter_param.ext = CYGNUM_CAN_ID_STD;
             flexcan_setup_rxmbox(chan, i, &flexcan_mbox_rx_std_isr, &filter_param, false, true);
                  }
-#endif // CYGINT_DEVS_CAN_MCF52xx_FLEXCAN_SUPP_STD_CAN_ID
+#endif // CYGOPT_IO_CAN_STD_CAN_ID
 
        //
        // configure message buffers for extended frames
        //
-#ifdef CYGINT_DEVS_CAN_MCF52xx_FLEXCAN_SUPP_EXT_CAN_ID
+#ifdef CYGOPT_IO_CAN_EXT_CAN_ID
         else
                  {
             filter_param.ext = CYGNUM_CAN_ID_EXT;
             flexcan_setup_rxmbox(chan, i, &flexcan_mbox_rx_ext_isr, &filter_param, false, true);
                  }
-#endif // CYGINT_DEVS_CAN_MCF52xx_FLEXCAN_SUPP_STD_CAN_ID
+#endif // CYGOPT_IO_CAN_EXT_CAN_ID
             }
        
         //
@@ -991,21 +991,21 @@
     //
     // now finally setup the first active message boxes and enable ist
         //     
-#ifdef CYGINT_DEVS_CAN_MCF52xx_FLEXCAN_SUPP_STD_CAN_ID
+#ifdef CYGOPT_IO_CAN_STD_CAN_ID
     if (info->mboxes_std_cnt)
              { 
         flexcan_setup_rxmbox_circbuf(&info->rxmbox_std_circbuf);
         flexcan_enable_rxmbox(chan, 0);
     }
-#endif // CYGINT_DEVS_CAN_MCF52xx_FLEXCAN_SUPP_STD_CAN_ID
+#endif // CYGOPT_IO_CAN_STD_CAN_ID
                              
-#ifdef CYGINT_DEVS_CAN_MCF52xx_FLEXCAN_SUPP_EXT_CAN_ID
+#ifdef CYGOPT_IO_CAN_EXT_CAN_ID
     if (info->mboxes_ext_cnt)
                  {
         flexcan_setup_rxmbox_circbuf(&info->rxmbox_ext_circbuf);
         flexcan_enable_rxmbox(chan, info->mboxes_std_cnt);
                  }
-#endif // CYGINT_DEVS_CAN_MCF52xx_FLEXCAN_SUPP_STD_CAN_ID
+#endif // CYGOPT_IO_CAN_EXT_CAN_ID
 
 }
 
@@ -1222,6 +1222,10 @@
                     case CYGNUM_CAN_MODE_STANDBY :   // set FlexCAN modul into standby state
                          flexcan_enter_standby(chan, true);
                          break;
+                         
+                    case CYGNUM_CAN_MODE_CONFIG : // stop FlexCAN modul for configuration
+                    	 flexcan_stop_chip(chan);
+                    	 break;
                 }
              }
              break; // case CYG_IO_SET_CONFIG_CAN_MODE :         
@@ -1404,10 +1408,10 @@
         // error interrupt and provide error information to upper layer
         //
         HAL_READ_UINT16(&flexcan->ESTAT, estat);
-        pevent->msg.data[0] = estat & 0xFF;
-        pevent->msg.data[1] = (estat >> 8) & 0xFF; 
-        HAL_READ_UINT8(&flexcan->RXERRCNT, pevent->msg.data[2]);
-        HAL_READ_UINT8(&flexcan->TXERRCNT, pevent->msg.data[3]);
+        pevent->msg.data.bytes[0] = estat & 0xFF;
+        pevent->msg.data.bytes[1] = (estat >> 8) & 0xFF; 
+        HAL_READ_UINT8(&flexcan->RXERRCNT, pevent->msg.data.bytes[2]);
+        HAL_READ_UINT8(&flexcan->TXERRCNT, pevent->msg.data.bytes[3]);
         switch (event_id)
         {
             case FLEXCAN_ERR_EVENT :
@@ -1961,7 +1965,7 @@
 }
 
 
-#ifdef CYGINT_DEVS_CAN_MCF52xx_FLEXCAN_SUPP_EXT_CAN_ID
+#ifdef CYGOPT_IO_CAN_EXT_CAN_ID
 //===========================================================================
 // Flexcan message box isr for extended identifiers if reception of all
 // available messages is enabled
@@ -2076,10 +2080,10 @@
     while (mbox_cnt);
 }
 
-#endif // #ifdef CYGINT_DEVS_CAN_MCF52xx_FLEXCAN_SUPP_EXT_CAN_ID
+#endif // #ifdef CYGOPT_IO_CAN_EXT_CAN_ID
 
 
-#ifdef CYGINT_DEVS_CAN_MCF52xx_FLEXCAN_SUPP_STD_CAN_ID
+#ifdef CYGOPT_IO_CAN_STD_CAN_ID
 //===========================================================================
 // Flexcan message box isr for standard identifiers if reception of all
 // available messages is enabled
@@ -2191,7 +2195,7 @@
     }
     while (mbox_cnt);
 }
-#endif // CYGINT_DEVS_CAN_MCF52xx_FLEXCAN_SUPP_STD_CAN_ID
+#endif // CYGOPT_IO_CAN_STD_CAN_ID
 
 
 //===========================================================================
@@ -2532,7 +2536,7 @@
     //
     // Now copy data bytes into buffer and start transmission
     //
-    HAL_WRITE_UINT8_VECTOR(&pmbox->data, pmsg->data, pmsg->dlc, 1); 
+    HAL_WRITE_UINT8_VECTOR(&pmbox->data, pmsg->data.bytes, pmsg->dlc, 1); 
     
    
     if (rtr)
@@ -2660,7 +2664,7 @@
     //
     // now finally copy data
     //
-    HAL_READ_UINT8_VECTOR(&pmbox->data, pmsg->data, pmsg->dlc, 1);
+    HAL_READ_UINT8_VECTOR(&pmbox->data, pmsg->data.bytes, pmsg->dlc, 1);
        
     //
     // now mark this mbox as empty and read the free running timer
diff -ruN -x 'Entries*' ecos_web_cvs/ecos/packages/devs/can/m68k/mcf52xx/current/tests/can_test_aux.inl ecos/ecos/packages/devs/can/m68k/mcf52xx/current/tests/can_test_aux.inl
--- ecos_web_cvs/ecos/packages/devs/can/m68k/mcf52xx/current/tests/can_test_aux.inl	2005-09-13 15:36:37.000000000 +0200
+++ ecos/ecos/packages/devs/can/m68k/mcf52xx/current/tests/can_test_aux.inl	2007-03-04 10:46:54.000000000 +0100
@@ -68,11 +68,12 @@
     
     if (pmsg->rtr)
     {
-        diag_printf("%s [ID:%03X] [RTR:%d] [EXT:%d]\n",
+        diag_printf("%s [ID:%03X] [RTR:%d] [EXT:%d] [DLC:%d]\n",
                     pMsg,
                     pmsg->id,
                     pmsg->rtr,
-                    pmsg->ext);
+                    pmsg->ext,
+                    pmsg->dlc);
                     
         return;
     }
@@ -91,14 +92,14 @@
                 pmsg->id,
                 pmsg->rtr,
                 pmsg->ext,
-                pmsg->data[0],
-                pmsg->data[1],
-                pmsg->data[2],
-                pmsg->data[3],
-                pmsg->data[4],
-                pmsg->data[5],
-                pmsg->data[6],
-                pmsg->data[7]);
+                pmsg->data.bytes[0],
+                pmsg->data.bytes[1],
+                pmsg->data.bytes[2],
+                pmsg->data.bytes[3],
+                pmsg->data.bytes[4],
+                pmsg->data.bytes[5],
+                pmsg->data.bytes[6],
+                pmsg->data.bytes[7]);
 }
 
 
diff -ruN -x 'Entries*' ecos_web_cvs/ecos/packages/devs/can/m68k/mcf52xx/current/tests/flexcan_filter.c ecos/ecos/packages/devs/can/m68k/mcf52xx/current/tests/flexcan_filter.c
--- ecos_web_cvs/ecos/packages/devs/can/m68k/mcf52xx/current/tests/flexcan_filter.c	2006-03-13 15:46:02.000000000 +0100
+++ ecos/ecos/packages/devs/can/m68k/mcf52xx/current/tests/flexcan_filter.c	1970-01-01 01:00:00.000000000 +0100
@@ -1,356 +0,0 @@
-//==========================================================================
-//
-//        flexcan_filter.c
-//
-//        FlexCAN message filter test
-//
-//==========================================================================
-//####ECOSGPLCOPYRIGHTBEGIN####
-// -------------------------------------------
-// This file is part of eCos, the Embedded Configurable Operating System.
-// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
-//
-// eCos 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 or (at your option) any later version.
-//
-// eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
-// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-//
-// As a special exception, if other files instantiate templates or use macros
-// or inline functions from this file, or you compile this file and link it
-// with other works to produce a work based on this file, this file does not
-// by itself cause the resulting work to be covered by the GNU General Public
-// License. However the source code for this file must still be made available
-// in accordance with section (3) of the GNU General Public License.
-//
-// This exception does not invalidate any other reasons why a work based on
-// this file might be covered by the GNU General Public License.
-//
-// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
-// at http://sources.redhat.com/ecos/ecos-license/
-// -------------------------------------------
-//####ECOSGPLCOPYRIGHTEND####
-//==========================================================================
-//#####DESCRIPTIONBEGIN####
-//
-// Author(s):     Uwe Kindler
-// Contributors:  Uwe Kindler
-// Date:          2005-09-10
-// Description:   FlexCAN hardware filter test
-//####DESCRIPTIONEND####
-
-
-//===========================================================================
-//                                INCLUDES
-//===========================================================================
-#include <pkgconf/system.h>
-
-#include <cyg/infra/testcase.h>         // test macros
-#include <cyg/infra/cyg_ass.h>          // assertion macros
-#include <cyg/infra/diag.h>
-
-// Package requirements
-#if defined(CYGPKG_IO_CAN) && defined(CYGPKG_KERNEL)
-
-#include <pkgconf/kernel.h>
-#include <cyg/io/io.h>
-#include <cyg/io/canio.h>
-
-// Package option requirements
-#if defined(CYGFUN_KERNEL_API_C)
-
-#include <cyg/hal/hal_arch.h>           // CYGNUM_HAL_STACK_SIZE_TYPICAL
-#include <cyg/kernel/kapi.h>
-
-
-//===========================================================================
-//                               DATA TYPES
-//===========================================================================
-typedef struct st_thread_data
-{
-    cyg_thread   obj;
-    long         stack[CYGNUM_HAL_STACK_SIZE_TYPICAL];
-    cyg_handle_t hdl;
-} thread_data_t;
-
-
-//===========================================================================
-//                              LOCAL DATA
-//===========================================================================
-cyg_thread_entry_t can0_thread;
-thread_data_t      can0_thread_data;
-
-
-cyg_io_handle_t    hDrvFlexCAN;
-
-
-//===========================================================================
-//                          LOCAL FUNCTIONS
-//===========================================================================
-#include "can_test_aux.inl" // include CAN test auxiliary functions
-
-
-//===========================================================================
-//                             READER THREAD 
-//===========================================================================
-void can0_thread(cyg_addrword_t data)
-{
-    cyg_uint32             len;
-    cyg_can_event          rx_event;
-    cyg_can_mode           mode;
-    cyg_uint8              i;
-    cyg_can_hdi            hdi;
-    cyg_can_msgbuf_info    msgbox_info;
-    cyg_can_msgbuf_cfg     msgbox_cfg;
-
-    
-    len = sizeof(hdi);
-    if (ENOERR != cyg_io_get_config(hDrvFlexCAN, CYG_IO_GET_CONFIG_CAN_HDI ,&hdi, &len))
-    {
-        CYG_TEST_FAIL_FINISH("Error reading config of /dev/can0");
-    } 
-    
-    //
-    // Normally the FlexCAN modul should support message filters. So the
-    // FULLCAN flag should be set - if it is not, we treat this as an error
-    //
-    if (!(hdi.support_flags & CYGNUM_CAN_HDI_FULLCAN))
-    {
-        CYG_TEST_FAIL_FINISH("/dev/can0 does not support message buffers");
-    }
-    
-    //
-    // We have free message boxes available and now we can setup the message 
-    // filters, during this configuration process we set the FlexCAN modul into
-    // stopped state
-    //
-    mode = CYGNUM_CAN_MODE_STOP;
-    len = sizeof(mode);
-    if (ENOERR != cyg_io_set_config(hDrvFlexCAN, CYG_IO_SET_CONFIG_CAN_MODE ,&mode, &len))
-    {
-        CYG_TEST_FAIL_FINISH("Error writing config of /dev/can0");
-    }
-    
-    //
-    // Now reset message buffer configuration - this is mandatory bevore adding
-    //
-    msgbox_cfg.cfg_id = CYGNUM_CAN_MSGBUF_RESET_ALL;
-    len = sizeof(msgbox_cfg);
-    if (ENOERR != cyg_io_set_config(hDrvFlexCAN, CYG_IO_SET_CONFIG_CAN_MSGBUF ,&msgbox_cfg, &len))
-    {
-        CYG_TEST_FAIL_FINISH("Error restting message buffer configuration of /dev/can0");
-    } 
-    
-    //
-    // Now query number of available and free message boxes
-    //
-    len = sizeof(msgbox_info);
-    if (ENOERR != cyg_io_get_config(hDrvFlexCAN, CYG_IO_GET_CONFIG_CAN_MSGBUF_INFO ,&msgbox_info, &len))
-    {
-        CYG_TEST_FAIL_FINISH("Error reading config of /dev/can0");
-    } 
-    
-    //
-    // if there are no free message boxes available then this is a failure
-    //
-    if (!msgbox_info.free)
-    {
-        CYG_TEST_FAIL_FINISH("No free message boxes available for /dev/can0");
-    }
-    
-    //
-    // Now device is stopped an we can setup all free message buffers
-    // we setup as many standard CAN message filters as there are free
-    // message buffers available.
-    //
-    for (i = 0; i < msgbox_info.free; ++i)
-    {
-        cyg_can_filter rx_filter;
-        
-        rx_filter.cfg_id  = CYGNUM_CAN_MSGBUF_RX_FILTER_ADD;
-        rx_filter.msg.id  = i;
-        
-        if (i % 2)
-        {
-            rx_filter.msg.ext = CYGNUM_CAN_ID_EXT;
-        }
-        else
-        {
-            rx_filter.msg.ext = CYGNUM_CAN_ID_STD;
-        }
-    
-        len = sizeof(rx_filter); 
-        if (ENOERR != cyg_io_set_config(hDrvFlexCAN, CYG_IO_SET_CONFIG_CAN_MSGBUF ,&rx_filter, &len))
-        {
-            CYG_TEST_FAIL_FINISH("Error writing config of /dev/can0");
-        }
-        else if (CYGNUM_CAN_MSGBUF_NA == rx_filter.handle)
-        {
-            CYG_TEST_FAIL_FINISH("Error setting up message filter for /dev/can0");
-        }
-    }
-    
-    //
-    // Now message filters have been setup and we can start the FlexCAN modul again
-    //
-    mode = CYGNUM_CAN_MODE_START;
-    len = sizeof(mode);
-    if (ENOERR != cyg_io_set_config(hDrvFlexCAN, CYG_IO_SET_CONFIG_CAN_MODE ,&mode, &len))
-    {
-        CYG_TEST_FAIL_FINISH("Error writing config of /dev/can0");
-    } 
-    
-    diag_printf("Now try to send CAN messages. The device should only\n"
-                "receive messages identifiers in the range of 0x00 to 0x%X.\n"
-                "All CAN filters with an odd identifier will receive\n"
-                "extended CAN messages. As soon as a standard message\n"
-                "with ID 0 arrives, all message filters will be cleared\n\n", (msgbox_info.free - 1));
-    
-    //
-    // Now receive messages until a message arrives with largest ID of all
-    // available message filters
-    //
-    rx_event.msg.id = 1;
-    while(rx_event.msg.id != 0)
-    {
-        len = sizeof(rx_event); 
-            
-        if (ENOERR != cyg_io_read(hDrvFlexCAN, &rx_event, &len))
-        {
-            CYG_TEST_FAIL_FINISH("Error reading from /dev/can0");
-        }      
-        else if (rx_event.flags & CYGNUM_CAN_EVENT_RX)
-        {
-            print_can_msg(&rx_event.msg, "");    
-        } // if (ENOERR != cyg_io_read(hDrvFlexCAN, &rx_event, &len))
-    } // while(1)
-    
-    //
-    // Stop device in order to clear all message filters and to activate
-    // the receive all message box
-    //
-    mode = CYGNUM_CAN_MODE_STOP;
-    len = sizeof(mode);
-    if (ENOERR != cyg_io_set_config(hDrvFlexCAN, CYG_IO_SET_CONFIG_CAN_MODE ,&mode, &len))
-    {
-        CYG_TEST_FAIL_FINISH("Error writing config of /dev/can0");
-    } 
-    
-    //
-    // Now enable reception of all available CAN messages
-    //
-    cyg_can_filter rx_filter;
-    rx_filter.cfg_id  = CYGNUM_CAN_MSGBUF_RX_FILTER_ALL;
-    len = sizeof(rx_filter);
-    if (ENOERR != cyg_io_set_config(hDrvFlexCAN, CYG_IO_SET_CONFIG_CAN_MSGBUF , &rx_filter, &len))
-    {
-        CYG_TEST_FAIL_FINISH("Error writing config of /dev/can0");
-    }
-    
-    //
-    // Now we can start FlexCAN modul again
-    //
-    mode = CYGNUM_CAN_MODE_START;
-    len = sizeof(mode);
-    if (ENOERR != cyg_io_set_config(hDrvFlexCAN, CYG_IO_SET_CONFIG_CAN_MODE ,&mode, &len))
-    {
-        CYG_TEST_FAIL_FINISH("Error writing config of /dev/can0");
-    } 
-    
-    diag_printf("\nAll message filters have been cleared an now the device\n"
-                "will receive any available CAN message identifier.\n"
-                "Send a CAN message with ID 0x100 to stop this test.\n\n");
-    
-    //
-    // Now receive messages until a message arrives with largest ID of all
-    // available message filters
-    //
-    rx_event.msg.id = 1;
-    while(rx_event.msg.id != 0x100)
-    {
-        len = sizeof(rx_event); 
-            
-        if (ENOERR != cyg_io_read(hDrvFlexCAN, &rx_event, &len))
-        {
-            CYG_TEST_FAIL_FINISH("Error reading from /dev/can0");
-        }      
-        else if (rx_event.flags & CYGNUM_CAN_EVENT_RX)
-        {
-            print_can_msg(&rx_event.msg, "");    
-        } // if (ENOERR != cyg_io_read(hDrvFlexCAN, &rx_event, &len))
-    } // while(1)
-    
-    CYG_TEST_PASS_FINISH("flexcan_filter test OK");
-}
-
-
-void
-cyg_start(void)
-{
-    CYG_TEST_INIT();
-    
-    //
-    // open flexcan device driver
-    //
-    if (ENOERR != cyg_io_lookup("/dev/can0", &hDrvFlexCAN)) 
-    {
-        CYG_TEST_FAIL_FINISH("Error opening /dev/can0");
-    }
-    
-    // We do not setup baudrate and take dafauklt baudrate from config tool instead
-    /*
-    //
-    // setup CAN baudrate 250 KBaud
-    //
-    cyg_uint32     len;
-    cyg_can_info_t can_cfg;
-    can_cfg.baud = CYGNUM_CAN_KBAUD_250;
-    len = sizeof(can_cfg);
-    if (ENOERR != cyg_io_set_config(hDrvFlexCAN, CYG_IO_SET_CONFIG_CAN_INFO ,&can_cfg, &len))
-    {
-        CYG_TEST_FAIL_FINISH("Error writing config of /dev/can0");
-    }*/
-    
-    //
-    // create the two threads which access the CAN device driver
-    // a reader thread with a higher priority and a writer thread
-    // with a lower priority
-    //
-    cyg_thread_create(4, can0_thread, 
-                        (cyg_addrword_t) 0,
-		                "can0_thread", 
-		                (void *) can0_thread_data.stack, 
-		                1024 * sizeof(long),
-		                &can0_thread_data.hdl, 
-		                &can0_thread_data.obj);
-		                
-    cyg_thread_resume(can0_thread_data.hdl);
-    
-    cyg_scheduler_start();
-}
-
-#else // CYGFUN_KERNEL_API_C
-#define N_A_MSG "Needs kernel C API"
-#endif
-
-#else // CYGPKG_IO_CAN && CYGPKG_KERNEL
-#define N_A_MSG "Needs IO/CAN and Kernel"
-#endif
-
-#ifdef N_A_MSG
-void
-cyg_start( void )
-{
-    CYG_TEST_INIT();
-    CYG_TEST_NA( N_A_MSG);
-}
-#endif // N_A_MSG
-
-// EOF flexcan_filter.c
diff -ruN -x 'Entries*' ecos_web_cvs/ecos/packages/devs/can/m68k/mcf52xx/current/tests/flexcan_load.c ecos/ecos/packages/devs/can/m68k/mcf52xx/current/tests/flexcan_load.c
--- ecos_web_cvs/ecos/packages/devs/can/m68k/mcf52xx/current/tests/flexcan_load.c	2006-03-13 15:46:02.000000000 +0100
+++ ecos/ecos/packages/devs/can/m68k/mcf52xx/current/tests/flexcan_load.c	1970-01-01 01:00:00.000000000 +0100
@@ -1,317 +0,0 @@
-//==========================================================================
-//
-//        flexcan_load.c
-//
-//        FlexCAN load test
-//
-//==========================================================================
-//####ECOSGPLCOPYRIGHTBEGIN####
-// -------------------------------------------
-// This file is part of eCos, the Embedded Configurable Operating System.
-// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
-//
-// eCos 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 or (at your option) any later version.
-//
-// eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
-// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-//
-// As a special exception, if other files instantiate templates or use macros
-// or inline functions from this file, or you compile this file and link it
-// with other works to produce a work based on this file, this file does not
-// by itself cause the resulting work to be covered by the GNU General Public
-// License. However the source code for this file must still be made available
-// in accordance with section (3) of the GNU General Public License.
-//
-// This exception does not invalidate any other reasons why a work based on
-// this file might be covered by the GNU General Public License.
-//
-// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
-// at http://sources.redhat.com/ecos/ecos-license/
-// -------------------------------------------
-//####ECOSGPLCOPYRIGHTEND####
-//==========================================================================
-//#####DESCRIPTIONBEGIN####
-//
-// Author(s):     Uwe Kindler
-// Contributors:  Uwe Kindler
-// Date:          2005-08-14
-// Description:   FlexCAN load test
-//####DESCRIPTIONEND####
-
-
-//===========================================================================
-//                                INCLUDES
-//===========================================================================
-#include <pkgconf/system.h>
-
-#include <cyg/infra/testcase.h>         // test macros
-#include <cyg/infra/cyg_ass.h>          // assertion macros
-#include <cyg/infra/diag.h>
-
-// Package requirements
-#if defined(CYGPKG_IO_CAN) && defined(CYGPKG_KERNEL)
-
-#include <pkgconf/kernel.h>
-#include <cyg/io/io.h>
-#include <cyg/io/canio.h>
-
-// Package option requirements
-#if defined(CYGFUN_KERNEL_API_C)
-
-#include <cyg/hal/hal_arch.h>           // CYGNUM_HAL_STACK_SIZE_TYPICAL
-#include <cyg/kernel/kapi.h>
-
-
-//===========================================================================
-//                               DATA TYPES
-//===========================================================================
-typedef struct st_thread_data
-{
-    cyg_thread   obj;
-    long         stack[CYGNUM_HAL_STACK_SIZE_TYPICAL];
-    cyg_handle_t hdl;
-} thread_data_t;
-
-
-//===========================================================================
-//                              LOCAL DATA
-//===========================================================================
-cyg_thread_entry_t can0_thread;
-thread_data_t      can0_thread_data;
-
-cyg_thread_entry_t can1_thread;
-thread_data_t      can1_thread_data;
-
-cyg_io_handle_t    hDrvFlexCAN;
-
-
-//===========================================================================
-//                          LOCAL FUNCTIONS
-//===========================================================================
-#include "can_test_aux.inl" // include CAN test auxiliary functions
-
-
-//===========================================================================
-//                             READER THREAD 
-//===========================================================================
-void can0_thread(cyg_addrword_t data)
-{
-    cyg_uint32             len;
-    cyg_can_event          rx_event;
-    cyg_can_timeout_info_t timeouts;
-
-#if defined(CYGOPT_IO_CAN_SUPPORT_TIMEOUTS)   
-    //
-    // setup large timeout values because we do not need timeouts here
-    //
-    timeouts.rx_timeout = 100000;
-    timeouts.tx_timeout = 100000;
-    
-    len = sizeof(timeouts);
-    if (ENOERR != cyg_io_set_config(hDrvFlexCAN, CYG_IO_SET_CONFIG_CAN_TIMEOUT ,&timeouts, &len))
-    {
-        CYG_TEST_FAIL_FINISH("Error writing config of /dev/can0");
-    }
-#endif // defined(CYGOPT_IO_CAN_SUPPORT_TIMEOUTS)  
-    
-    //
-    // This thread simply receives all CAN events and prints the event flags and the
-    // CAN message if it was a TX or RX event. You can use this test in order to check
-    // when a RX overrun occurs
-    //
-    while (1)
-    {
-        len = sizeof(rx_event); 
-            
-        if (ENOERR != cyg_io_read(hDrvFlexCAN, &rx_event, &len))
-        {
-            CYG_TEST_FAIL_FINISH("Error reading from /dev/can0");
-        }
-        else
-        {
-            print_can_flags(rx_event.flags, "");
-            
-            if ((rx_event.flags & CYGNUM_CAN_EVENT_RX) || (rx_event.flags & CYGNUM_CAN_EVENT_TX))
-            {
-                print_can_msg(&rx_event.msg, "");
-            }
-        }    
-    }             
-}
-
-
-//===========================================================================
-//                            WRITER THREAD
-//===========================================================================
-void can1_thread(cyg_addrword_t data)
-{
-    cyg_uint16      i = 0;
-    cyg_uint32      len;
-    cyg_can_message tx_msg =
-    {
-        0x000,                                               // CAN identifier
-        {0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7},    // 8 data bytes
-        CYGNUM_CAN_ID_STD,                                   // standard frame
-        CYGNUM_CAN_FRAME_DATA,                               // data frame
-        8,                                                   // data length code
-    };
-    
-    //
-    // This thread simply sends CAN messages. It increments the ID for each new CAN messsage
-    // and sends a remote frame after seven data frames. In the first byte of each data frame
-    // the number (0 - 7) of the data frame is stored and the length of the data frame grows
-    // from 1 - 8 data bytes.
-    //
-    // The received pattern should look like this way:
-    // ID    Length    Data
-    // ----------------------------------------------
-    // 000   1         00
-    // 001   2         01 F1
-    // 002   3         02 F1 F2
-    // 003   4         03 F1 F2 F3
-    // 004   5         04 F1 F2 F3 F4
-    // 005   6         05 F1 F2 F3 F4 F5
-    // 006   7         06 F1 F2 F3 F4 F5 F6
-    // 007   8         Remote Request
-    // 008   1         00
-    // 009   2         01 F1
-    // 00A   3         02 F1 F2
-    // ...
-    //
-    while (1)
-    {
-        tx_msg.id      = i;
-        tx_msg.dlc     = (i % 8) + 1;
-        tx_msg.data[0] = (i % 8);
-        i = (i + 1) % 0x7FF;
-        
-        //
-        // the 6th frame is a remote frame
-        //
-        if ((i % 8) == 6)
-        {
-            tx_msg.rtr =  CYGNUM_CAN_FRAME_RTR;
-            tx_msg.ext =  CYGNUM_CAN_ID_STD;
-        }
-        //
-        // the 7th frame is a extended frame
-        //
-        else if ((i % 8) == 7)
-        {
-            tx_msg.ext =  CYGNUM_CAN_ID_EXT;
-            tx_msg.rtr = CYGNUM_CAN_FRAME_DATA;
-        }
-        //
-        // the 8th frame is a extended remote frame
-        //
-        else if (!(i % 8))
-        {
-            tx_msg.ext =  CYGNUM_CAN_ID_EXT;
-            tx_msg.rtr = CYGNUM_CAN_FRAME_RTR;
-        }
-        //
-        // all other frames are standard data framse
-        //
-        else
-        {
-            tx_msg.ext =  CYGNUM_CAN_ID_STD;
-            tx_msg.rtr =  CYGNUM_CAN_FRAME_DATA;
-        }
-        
-        len = sizeof(tx_msg);
-        if (ENOERR != cyg_io_write(hDrvFlexCAN, &tx_msg, &len))
-        {
-            CYG_TEST_FAIL_FINISH("Error writing to /dev/can0");
-        }
-        else
-        {
-            print_can_msg(&tx_msg, "TX: ");
-        } 
-        
-        cyg_thread_delay(100);          
-    } // while (1)
-}
-
-
-
-void
-cyg_start(void)
-{
-    CYG_TEST_INIT();
-    
-    //
-    // open flexcan device driver
-    //
-    if (ENOERR != cyg_io_lookup("/dev/can0", &hDrvFlexCAN)) 
-    {
-        CYG_TEST_FAIL_FINISH("Error opening /dev/can0");
-    }
-    
-    // We do not setup baudrate and take dafauklt baudrate from config tool instead
-    /*
-    //
-    // setup CAN baudrate 250 KBaud
-    //
-    cyg_uint32     len;
-    cyg_can_info_t can_cfg;
-    can_cfg.baud = CYGNUM_CAN_KBAUD_250;
-    len = sizeof(can_cfg);
-    if (ENOERR != cyg_io_set_config(hDrvFlexCAN, CYG_IO_SET_CONFIG_CAN_INFO ,&can_cfg, &len))
-    {
-        CYG_TEST_FAIL_FINISH("Error writing config of /dev/can0");
-    }
-    */
-    
-    //
-    // create the two threads which access the CAN device driver
-    // a reader thread with a higher priority and a writer thread
-    // with a lower priority
-    //
-    cyg_thread_create(4, can0_thread, 
-                        (cyg_addrword_t) 0,
-		                "can0_thread", 
-		                (void *) can0_thread_data.stack, 
-		                1024 * sizeof(long),
-		                &can0_thread_data.hdl, 
-		                &can0_thread_data.obj);
-		                
-    cyg_thread_create(5, can1_thread, 
-                        (cyg_addrword_t) can0_thread_data.hdl,
-		                "can1_thread", 
-		                (void *) can1_thread_data.stack, 
-		                1024 * sizeof(long),
-		                &can1_thread_data.hdl, 
-		                &can1_thread_data.obj);
-		                
-    cyg_thread_resume(can0_thread_data.hdl);
-    cyg_thread_resume(can1_thread_data.hdl);
-    
-    cyg_scheduler_start();
-}
-
-#else // CYGFUN_KERNEL_API_C
-#define N_A_MSG "Needs kernel C API"
-#endif
-
-#else // CYGPKG_IO_CAN && CYGPKG_KERNEL
-#define N_A_MSG "Needs IO/CAN and Kernel"
-#endif
-
-#ifdef N_A_MSG
-void
-cyg_start( void )
-{
-    CYG_TEST_INIT();
-    CYG_TEST_NA( N_A_MSG);
-}
-#endif // N_A_MSG
-
-// EOF flexcan_load.c
diff -ruN -x 'Entries*' ecos_web_cvs/ecos/packages/devs/can/m68k/mcf52xx/current/tests/flexcan_remote.c ecos/ecos/packages/devs/can/m68k/mcf52xx/current/tests/flexcan_remote.c
--- ecos_web_cvs/ecos/packages/devs/can/m68k/mcf52xx/current/tests/flexcan_remote.c	2006-03-13 15:46:02.000000000 +0100
+++ ecos/ecos/packages/devs/can/m68k/mcf52xx/current/tests/flexcan_remote.c	1970-01-01 01:00:00.000000000 +0100
@@ -1,309 +0,0 @@
-//==========================================================================
-//
-//        flexcan_remote.c
-//
-//        FlexCAN remote response buffer test
-//
-//==========================================================================
-//####ECOSGPLCOPYRIGHTBEGIN####
-// -------------------------------------------
-// This file is part of eCos, the Embedded Configurable Operating System.
-// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
-//
-// eCos 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 or (at your option) any later version.
-//
-// eCos 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 eCos; if not, write to the Free Software Foundation, Inc.,
-// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-//
-// As a special exception, if other files instantiate templates or use macros
-// or inline functions from this file, or you compile this file and link it
-// with other works to produce a work based on this file, this file does not
-// by itself cause the resulting work to be covered by the GNU General Public
-// License. However the source code for this file must still be made available
-// in accordance with section (3) of the GNU General Public License.
-//
-// This exception does not invalidate any other reasons why a work based on
-// this file might be covered by the GNU General Public License.
-//
-// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
-// at http://sources.redhat.com/ecos/ecos-license/
-// -------------------------------------------
-//####ECOSGPLCOPYRIGHTEND####
-//==========================================================================
-//#####DESCRIPTIONBEGIN####
-//
-// Author(s):     Uwe Kindler
-// Contributors:  Uwe Kindler
-// Date:          2005-08-14
-// Description:   FlexCAN load test
-//####DESCRIPTIONEND####
-
-
-//===========================================================================
-//                                INCLUDES
-//===========================================================================
-#include <pkgconf/system.h>
-
-#include <cyg/infra/testcase.h>         // test macros
-#include <cyg/infra/cyg_ass.h>          // assertion macros
-#include <cyg/infra/diag.h>
-
-// Package requirements
-#if defined(CYGPKG_IO_CAN) && defined(CYGPKG_KERNEL)
-
-#include <pkgconf/kernel.h>
-#include <cyg/io/io.h>
-#include <cyg/io/canio.h>
-
-// Package option requirements
-#if defined(CYGFUN_KERNEL_API_C)
-
-#include <cyg/hal/hal_arch.h>           // CYGNUM_HAL_STACK_SIZE_TYPICAL
-#include <cyg/kernel/kapi.h>
-
-
-//===========================================================================
-//                               DATA TYPES
-//===========================================================================
-typedef struct st_thread_data
-{
-    cyg_thread   obj;
-    long         stack[CYGNUM_HAL_STACK_SIZE_TYPICAL];
-    cyg_handle_t hdl;
-} thread_data_t;
-
-
-//===========================================================================
-//                              LOCAL DATA
-//===========================================================================
-cyg_thread_entry_t can0_thread;
-thread_data_t      can0_thread_data;
-
-
-cyg_io_handle_t    hDrvFlexCAN;
-
-
-//===========================================================================
-//                          LOCAL FUNCTIONS
-//===========================================================================
-#include "can_test_aux.inl" // include CAN test auxiliary functions
-
-
-//===========================================================================
-//                             READER THREAD 
-//===========================================================================
-void can0_thread(cyg_addrword_t data)
-{
-    cyg_uint32             len;
-    cyg_can_event          rx_event;
-    cyg_can_remote_buf     rtr_buf;
-    cyg_can_remote_buf     rtr_buf2;
-    cyg_can_msgbuf_info    msgbox_info;
-    cyg_can_mode           mode; 
-    cyg_can_state          state;
-    
-    //
-    // before we start configuring the CAN hardware we stop the chip
-    //
-    mode = CYGNUM_CAN_MODE_STOP;
-    len = sizeof(mode);
-    if (ENOERR != cyg_io_set_config(hDrvFlexCAN, CYG_IO_SET_CONFIG_CAN_MODE ,&mode, &len))
-    {
-        CYG_TEST_FAIL_FINISH("Error writing config of /dev/can0");
-    } 
-    
-    //
-    // now check if FlexCAN modul is really stopped
-    //
-    len = sizeof(state);
-    if (ENOERR != cyg_io_get_config(hDrvFlexCAN, CYG_IO_GET_CONFIG_CAN_STATE ,&state, &len))
-    {
-        CYG_TEST_FAIL_FINISH("Error reading config of /dev/can0");
-    } 
-    
-    if (state != CYGNUM_CAN_STATE_STOPPED)
-    {
-        CYG_TEST_FAIL_FINISH("Error stopping FlexCAN /dev/can0");
-    }
-
-    //
-    // We would like to setup 2 remote buffers - check if we have enough
-    // free message buffers
-    //
-    len = sizeof(msgbox_info);
-    if (ENOERR != cyg_io_get_config(hDrvFlexCAN, CYG_IO_GET_CONFIG_CAN_MSGBUF_INFO ,&msgbox_info, &len))
-    {
-        CYG_TEST_FAIL_FINISH("Error reading config of /dev/can0");
-    } 
-    else
-    {
-        diag_printf("Message boxes available: %d    free: %d\n", 
-                    msgbox_info.count, msgbox_info.free);
-    }
-    
-    if (msgbox_info.free < 2)
-    {
-        CYG_TEST_FAIL_FINISH("Not enough free message buffers/dev/can0");
-    }
-
-   
-    //
-    // Setup the first remote response buffer for resception of standard
-    // remote frames
-    //
-    rtr_buf.cfg_id      = CYGNUM_CAN_MSGBUF_REMOTE_BUF_ADD;
-    rtr_buf.msg.id      = 0x7FF;
-    rtr_buf.msg.ext     = CYGNUM_CAN_ID_STD;
-    rtr_buf.msg.rtr     = CYGNUM_CAN_FRAME_DATA;
-    rtr_buf.msg.dlc     = 1;
-    rtr_buf.msg.data[0] = 0xAB;
-    
-    len = sizeof(rtr_buf);
-    if (ENOERR != cyg_io_set_config(hDrvFlexCAN, CYG_IO_SET_CONFIG_CAN_MSGBUF ,&rtr_buf, &len))
-    {
-        CYG_TEST_FAIL_FINISH("Error writing config of /dev/can0");
-    } 
-    
-    //
-    // setup the second remote response buffer for reception of extended
-    // remote frames
-    // 
-    rtr_buf2.cfg_id      = CYGNUM_CAN_MSGBUF_REMOTE_BUF_ADD;
-    rtr_buf2.msg.id      = 0x800;
-    rtr_buf2.msg.ext     = CYGNUM_CAN_ID_EXT;
-    rtr_buf2.msg.rtr     = CYGNUM_CAN_FRAME_DATA;
-    rtr_buf2.msg.dlc     = 4;
-    rtr_buf2.msg.data[0] = 0xAB;
-    
-    len = sizeof(rtr_buf2);
-    if (ENOERR != cyg_io_set_config(hDrvFlexCAN, CYG_IO_SET_CONFIG_CAN_MSGBUF ,&rtr_buf2, &len))
-    {
-        CYG_TEST_FAIL_FINISH("Error writing config of /dev/can0");
-    } 
-    
-    if (rtr_buf.handle == CYGNUM_CAN_MSGBUF_NA)
-    {
-        CYG_TEST_FAIL_FINISH("No free message buffer available for /dev/can0");
-    }
-    
-    //
-    // now configuration is finished and we can start chip again
-    //
-    mode = CYGNUM_CAN_MODE_START;
-    len = sizeof(mode);
-    if (ENOERR != cyg_io_set_config(hDrvFlexCAN, CYG_IO_SET_CONFIG_CAN_MODE ,&mode, &len))
-    {
-        CYG_TEST_FAIL_FINISH("Error writing config of /dev/can0");
-    } 
-    
-    diag_printf("Test of FlexCAN remote response buffer configuration\n"
-                "If a CAN node sends a remote request with ID 0x7FF\n"
-                "or 0x800 then the FlexCAN modul should respond with\n"
-                "data frames.\n");
-    diag_printf("!!! This test can be stopped by sending a data frame with ID 0x100 !!!\n\n");
-    
-    len = sizeof(msgbox_info);
-    if (ENOERR != cyg_io_get_config(hDrvFlexCAN, CYG_IO_GET_CONFIG_CAN_MSGBUF_INFO ,&msgbox_info, &len))
-    {
-        CYG_TEST_FAIL_FINISH("Error writing config of /dev/can0");
-    } 
-    else
-    {
-        diag_printf("Message boxes available: %d    free: %d\n", 
-                    msgbox_info.count, msgbox_info.free);
-    }
-    
-    while (1)
-    {
-        len = sizeof(rx_event); 
-            
-        if (ENOERR != cyg_io_read(hDrvFlexCAN, &rx_event, &len))
-        {
-            CYG_TEST_FAIL_FINISH("Error reading from /dev/can0");
-        }
-        
-        if (0x100 == rx_event.msg.id)
-        {
-            CYG_TEST_PASS_FINISH("flexcan_remote test OK"); 
-        }
-        else
-        {
-            print_can_flags(rx_event.flags, "");
-            print_can_msg(&rx_event.msg, "");    
-        }
-    }
-
-              
-}
-
-
-void
-cyg_start(void)
-{
-    CYG_TEST_INIT();
-    
-    //
-    // open flexcan device driver
-    //
-    if (ENOERR != cyg_io_lookup("/dev/can0", &hDrvFlexCAN)) 
-    {
-        CYG_TEST_FAIL_FINISH("Error opening /dev/can0");
-    }
-    
-    //
-    // setup CAN baudrate 250 KBaud
-    // We do not setup baud rate and use the default baud rate instead
-    /*
-    cyg_uint32     len;
-    cyg_can_info_t can_cfg;
-    can_cfg.baud = CYGNUM_CAN_KBAUD_250;
-    len = sizeof(can_cfg);
-    if (ENOERR != cyg_io_set_config(hDrvFlexCAN, CYG_IO_SET_CONFIG_CAN_INFO ,&can_cfg, &len))
-    {
-        CYG_TEST_FAIL_FINISH("Error writing config of /dev/can0");
-    }*/
-    
-    //
-    // create the two threads which access the CAN device driver
-    // a reader thread with a higher priority and a writer thread
-    // with a lower priority
-    //
-    cyg_thread_create(4, can0_thread, 
-                        (cyg_addrword_t) 0,
-		                "can0_thread", 
-		                (void *) can0_thread_data.stack, 
-		                1024 * sizeof(long),
-		                &can0_thread_data.hdl, 
-		                &can0_thread_data.obj);
-		                
-    cyg_thread_resume(can0_thread_data.hdl);
-    
-    cyg_scheduler_start();
-}
-
-#else // CYGFUN_KERNEL_API_C
-#define N_A_MSG "Needs kernel C API"
-#endif
-
-#else // CYGPKG_IO_CAN && CYGPKG_KERNEL
-#define N_A_MSG "Needs IO/CAN and Kernel"
-#endif
-
-#ifdef N_A_MSG
-void
-cyg_start( void )
-{
-    CYG_TEST_INIT();
-    CYG_TEST_NA( N_A_MSG);
-}
-#endif // N_A_MSG
-
-// EOF flexcan_remote.c
diff -ruN -x 'Entries*' ecos_web_cvs/ecos/packages/devs/can/m68k/mcf52xx/current/tests/flexcan_wake.c ecos/ecos/packages/devs/can/m68k/mcf52xx/current/tests/flexcan_wake.c
--- ecos_web_cvs/ecos/packages/devs/can/m68k/mcf52xx/current/tests/flexcan_wake.c	2006-03-13 15:46:02.000000000 +0100
+++ ecos/ecos/packages/devs/can/m68k/mcf52xx/current/tests/flexcan_wake.c	2007-03-15 23:46:48.000000000 +0100
@@ -105,72 +105,18 @@
     cyg_uint32             len;
     cyg_can_event          rx_event1;
     cyg_can_event          rx_event2;
-    cyg_can_remote_buf     rtr_buf;
     cyg_can_msgbuf_info    msgbox_info;
     cyg_can_mode           mode; 
     cyg_can_state          state;
     
-    //
-    // before we start configuring the CAN hardware we stop the chip
-    //
-    mode = CYGNUM_CAN_MODE_STOP;
-    len = sizeof(mode);
-    if (ENOERR != cyg_io_set_config(hDrvFlexCAN, CYG_IO_SET_CONFIG_CAN_MODE ,&mode, &len))
-    {
-        CYG_TEST_FAIL_FINISH("Error writing config of /dev/can0");
-    } 
-    
-    //
-    // now check if FlexCAN modul is really stopped
-    //
-    len = sizeof(state);
-    if (ENOERR != cyg_io_get_config(hDrvFlexCAN, CYG_IO_GET_CONFIG_CAN_STATE ,&state, &len))
-    {
-        CYG_TEST_FAIL_FINISH("Error reading config of /dev/can0");
-    } 
-    
-    if (state != CYGNUM_CAN_STATE_STOPPED)
-    {
-        CYG_TEST_FAIL_FINISH("Error stopping FlexCAN /dev/can0");
-    }
-
    
-    //
-    // Setup the first remote response buffer for resception of standard
-    // remote frames
-    //
-    rtr_buf.cfg_id      = CYGNUM_CAN_MSGBUF_REMOTE_BUF_ADD;
-    rtr_buf.msg.id      = 0x7FF;
-    rtr_buf.msg.ext     = CYGNUM_CAN_ID_STD;
-    rtr_buf.msg.rtr     = CYGNUM_CAN_FRAME_DATA;
-    rtr_buf.msg.dlc     = 1;
-    rtr_buf.msg.data[0] = 0xAB;
-    
-    len = sizeof(rtr_buf);
-    if (ENOERR != cyg_io_set_config(hDrvFlexCAN, CYG_IO_SET_CONFIG_CAN_MSGBUF ,&rtr_buf, &len))
-    {
-        CYG_TEST_FAIL_FINISH("Error writing config of /dev/can0");
-    } 
-    
-      
-    //
-    // now configuration is finished and we can start chip again
-    //
-    mode = CYGNUM_CAN_MODE_START;
-    len = sizeof(mode);
-    if (ENOERR != cyg_io_set_config(hDrvFlexCAN, CYG_IO_SET_CONFIG_CAN_MODE ,&mode, &len))
-    {
-        CYG_TEST_FAIL_FINISH("Error writing config of /dev/can0");
-    } 
-    
     diag_printf("Test of FlexCAN standby mode with selfwakeup\n"
                 "As soon as a message arrives the FlexCAN modul\n"
                 "will leave standby and generates a leave standby event.\n"
                 "Each time you send a message you should see LSTY first\n"
                 "for \"leaving standby\" and then \"RX\" for the\n"
-                "RX event caused the leave standby event. You can send\n"
-                "a CAN data frame with any ID or a remote frame with ID\n"
-                "0x7FF\n" );
+                "RX event that caused the leave standby event. You can send\n"
+                "a CAN data frame with any ID\n");
                 
     diag_printf("!!! This test can be stopped by sending a data frame with ID 0x100 !!!\n\n");
     
@@ -206,6 +152,7 @@
            CYG_TEST_FAIL_FINISH("Error reading config of /dev/can0");
        } 
     
+   
        if (state != CYGNUM_CAN_STATE_STANDBY)
        {
            CYG_TEST_FAIL_FINISH("Error stopping FlexCAN /dev/can0");
@@ -261,20 +208,7 @@
         CYG_TEST_FAIL_FINISH("Error opening /dev/can0");
     }
     
-    // We do not setup baudrate and take dafauklt baudrate from config tool instead
-    /*
-    //
-    // setup CAN baudrate 250 KBaud
-    //
-    cyg_uint32     len;
-    cyg_can_info_t can_cfg;
-    can_cfg.baud = CYGNUM_CAN_KBAUD_250;
-    len = sizeof(can_cfg);
-    if (ENOERR != cyg_io_set_config(hDrvFlexCAN, CYG_IO_SET_CONFIG_CAN_INFO ,&can_cfg, &len))
-    {
-        CYG_TEST_FAIL_FINISH("Error writing config of /dev/can0");
-    }*/
-    
+   
     //
     // create the two threads which access the CAN device driver
     // a reader thread with a higher priority and a writer thread
