# HG changeset patch # User Florian Pose # Date 1136540966 0 # Node ID f525f7db2d90818656167013e2db9be8c6afd879 # Parent 68d5b57cf03806b624489ac2eb89f1c3bd3d1d5c Verbesserte Makefiles (MODPOST-Warnungen entfernt). diff -r 68d5b57cf038 -r f525f7db2d90 Makefile --- a/Makefile Thu Jan 05 14:13:34 2006 +0000 +++ b/Makefile Fri Jan 06 09:49:26 2006 +0000 @@ -14,27 +14,23 @@ include $(CONFIG_FILE) endif +obj-m := drivers/ mini/ + +ifeq ($(MAKE_RT),yes) +obj-m += rt/ +endif + #---------------------------------------------------------------- -all: .drivers .rt .mini +all: + $(MAKE) -C $(KERNELDIR) M=`pwd` modules + +clean: + $(MAKE) -C $(KERNELDIR) M=`pwd` clean doc docs: doxygen Doxyfile -.drivers: - $(MAKE) -C drivers - -ifeq ($(MAKE_RT),yes) -.rt: - $(MAKE) -C rt -else -.rt: - @echo "Skipping Real-Time." -endif - -.mini: - $(MAKE) -C mini - config conf $(CONFIG_FILE): @echo "# EtherCAT Konfigurationsdatei Kernel 2.6" > $(CONFIG_FILE) @echo >> $(CONFIG_FILE) @@ -46,9 +42,4 @@ @echo >> $(CONFIG_FILE) @echo "$(CONFIG_FILE) erstellt." -clean: - $(MAKE) -C rt clean - $(MAKE) -C drivers clean - $(MAKE) -C mini clean - #---------------------------------------------------------------- diff -r 68d5b57cf038 -r f525f7db2d90 drivers/Makefile --- a/drivers/Makefile Thu Jan 05 14:13:34 2006 +0000 +++ b/drivers/Makefile Fri Jan 06 09:49:26 2006 +0000 @@ -32,13 +32,11 @@ #------------------------------------------------------------------------------ # Default-Abschnitt -include ../ethercat.conf - modules: - $(MAKE) -C $(KERNELDIR) M=`pwd` modules + $(MAKE) -C .. clean: - $(MAKE) -C $(KERNELDIR) M=`pwd` clean + $(MAKE) -C .. clean #------------------------------------------------------------------------------ diff -r 68d5b57cf038 -r f525f7db2d90 rt/msr_module.c --- a/rt/msr_module.c Thu Jan 05 14:13:34 2006 +0000 +++ b/rt/msr_module.c Fri Jan 06 09:49:26 2006 +0000 @@ -19,75 +19,44 @@ * *****************************************************************************/ -#ifndef __KERNEL__ -# define __KERNEL__ -#endif -#ifndef MODULE -# define MODULE -#endif - -#include +// Linux #include - -#include -#include -#include -#include /* everything... */ -#include -#include -#include -#include /* fuer get_cycles */ -#include /* error codes */ -#include /* maschine-specific registers */ -#include /* fuer HZ */ #include -#include "msr_param.h" //wird im Projektverzeichnis erwartet - -//#include -#include -#include +// RT_lib +#include +#include +#include +#include #include -#include -#include -#include -#include -#include - - -#include - +#include "msr_param.h" +#include "msr_jitter.h" + +// EtherCAT #include "../drivers/ec_master.h" #include "../drivers/ec_device.h" #include "../drivers/ec_types.h" #include "../drivers/ec_module.h" -#include "msr_jitter.h" - -#define TSC2US(T) ((unsigned long) (T) * 1000UL / cpu_khz) - -/*--external data------------------------------------------------------------*/ - +// Defines/Makros +#define TSC2US(T1, T2) ((T2 - T1) * 1000UL / cpu_khz) #define HZREDUCTION (MSR_ABTASTFREQUENZ/HZ) -extern wait_queue_head_t msr_read_waitqueue; - -extern struct msr_char_buf *msr_kanal_puffer; - -extern int proc_abtastfrequenz; - -/*--local data---------------------------------------------------------------*/ - +/*****************************************************************************/ +/* Globale Variablen */ + +// RT_lib extern struct timeval process_time; struct timeval msr_time_increment; // Increment per Interrupt -//adeos - +// Adeos static struct ipipe_domain this_domain; - static struct ipipe_sysinfo sys_info; +// EtherCAT + static EtherCAT_master_t *ecat_master = NULL; +static unsigned long ecat_bus_time = 0; static EtherCAT_slave_t ecat_slaves[] = { @@ -178,7 +147,6 @@ return -1; } - /****************************************************************************** * * Function: msr_controller_run() @@ -256,21 +224,23 @@ //EtherCAT_process_data_cycle(ecat_master, 2); + rdtscl(t7); + + ecat_bus_time = TSC2US(t2, t7); + // Daten lesen und skalieren #ifdef USE_MSR_LIB value = EtherCAT_read_value(&ecat_slaves[5], 0) / 3276.0; dig1 = EtherCAT_read_value(&ecat_slaves[2], 0); #endif - rdtscl(t7); - if (debug_counter == MSR_ABTASTFREQUENZ) { printk(KERN_DEBUG "%lu: %luŽµs + %luŽµs + %luŽµs + %luŽµs + %luŽµs +" " %luŽµs = %luŽµs (%u %u)\n", - TSC2US(t1 - lt), - TSC2US(t2 - t1), TSC2US(t3 - t2), TSC2US(t4 - t3), - TSC2US(t5 - t4), TSC2US(t6 - t5), TSC2US(t7 - t6), - TSC2US(t7 - t1), tr1, tr2); + TSC2US(lt, t1), + TSC2US(t1, t2), TSC2US(t2, t3), TSC2US(t3, t4), + TSC2US(t4, t5), TSC2US(t5, t6), TSC2US(t6, t7), + TSC2US(t1, t7), tr1, tr2); debug_counter = 0; } @@ -297,31 +267,25 @@ void msr_run(unsigned irq) { - static int counter = 0; -#ifdef USE_MSR_LIB - - timeval_add(&process_time,&process_time,&msr_time_increment); - - MSR_ADEOS_INTERRUPT_CODE( - msr_controller_run(); - msr_write_kanal_list(); - ); + static int counter = 0; + +#ifdef USE_MSR_LIB + timeval_add(&process_time, &process_time, &msr_time_increment); + MSR_ADEOS_INTERRUPT_CODE(msr_controller_run(); msr_write_kanal_list();); #else msr_controller_run(); #endif - /* und wieder in die Timerliste eintragen */ - /* und neu in die Taskqueue eintragen */ - //timer.expires += 1; - //add_timer(&timer); ipipe_control_irq(irq,0,IPIPE_ENABLE_MASK); //Interrupt bestŽätigen - if(counter++ > HZREDUCTION) { + if (counter++ > HZREDUCTION) { ipipe_propagate_irq(irq); //und weiterreichen counter = 0; } } -void domain_entry (void) +/*****************************************************************************/ + +void domain_entry(void) { printk("Domain %s started.\n", ipipe_current_domain->name); @@ -352,14 +316,10 @@ msr_reg_kanal("/value", "V", &value, TDBL); msr_reg_kanal("/dig1", "", &dig1, TINT); #endif -#if 0 - msr_reg_kanal("/Taskinfo/Ecat/TX-Delay","us",&ecat_tx_delay,TUINT); - msr_reg_kanal("/Taskinfo/Ecat/RX-Delay","us",&ecat_rx_delay,TUINT); - msr_reg_kanal("/Taskinfo/Ecat/TX-Cnt","",&tx_intr,TUINT); - msr_reg_kanal("/Taskinfo/Ecat/RX-Cnt","",&rx_intr,TUINT); - msr_reg_kanal("/Taskinfo/Ecat/Total-Cnt","",&total_intr,TUINT); -#endif - return 0; + + msr_reg_kanal("/Taskinfo/EtherCAT/BusTime", "us", &ecat_bus_time, TUINT); + + return 0; } /****************************************************************************** @@ -434,7 +394,7 @@ msr_print_info("msk_modul: unloading..."); - ipipe_tune_timer(1000000000UL/HZ,0); //alten Timertakt wieder herstellen + ipipe_tune_timer(1000000000UL / HZ, 0); //alten Timertakt wieder herstellen ipipe_unregister_domain(&this_domain); if (ecat_master) diff -r 68d5b57cf038 -r f525f7db2d90 rt/rt_lib --- a/rt/rt_lib Thu Jan 05 14:13:34 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -../../../linux/kernel_space/rt_lib-4.0.0-2.6krnl \ No newline at end of file