Skip to content
Snippets Groups Projects
Commit fd928a65 authored by Florian Pose's avatar Florian Pose
Browse files

Verbesserte Makefiles (MODPOST-Warnungen entfernt).

parent c522a8a1
No related branches found
No related tags found
No related merge requests found
...@@ -14,26 +14,22 @@ ifeq ($(CONFIG_FILE),$(wildcard $(CONFIG_FILE))) ...@@ -14,26 +14,22 @@ ifeq ($(CONFIG_FILE),$(wildcard $(CONFIG_FILE)))
include $(CONFIG_FILE) include $(CONFIG_FILE)
endif endif
#---------------------------------------------------------------- obj-m := drivers/ mini/
all: .drivers .rt .mini ifeq ($(MAKE_RT),yes)
obj-m += rt/
endif
doc docs: #----------------------------------------------------------------
doxygen Doxyfile
.drivers: all:
$(MAKE) -C drivers $(MAKE) -C $(KERNELDIR) M=`pwd` modules
ifeq ($(MAKE_RT),yes) clean:
.rt: $(MAKE) -C $(KERNELDIR) M=`pwd` clean
$(MAKE) -C rt
else
.rt:
@echo "Skipping Real-Time."
endif
.mini: doc docs:
$(MAKE) -C mini doxygen Doxyfile
config conf $(CONFIG_FILE): config conf $(CONFIG_FILE):
@echo "# EtherCAT Konfigurationsdatei Kernel 2.6" > $(CONFIG_FILE) @echo "# EtherCAT Konfigurationsdatei Kernel 2.6" > $(CONFIG_FILE)
...@@ -46,9 +42,4 @@ config conf $(CONFIG_FILE): ...@@ -46,9 +42,4 @@ config conf $(CONFIG_FILE):
@echo >> $(CONFIG_FILE) @echo >> $(CONFIG_FILE)
@echo "$(CONFIG_FILE) erstellt." @echo "$(CONFIG_FILE) erstellt."
clean:
$(MAKE) -C rt clean
$(MAKE) -C drivers clean
$(MAKE) -C mini clean
#---------------------------------------------------------------- #----------------------------------------------------------------
...@@ -32,13 +32,11 @@ else ...@@ -32,13 +32,11 @@ else
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Default-Abschnitt # Default-Abschnitt
include ../ethercat.conf
modules: modules:
$(MAKE) -C $(KERNELDIR) M=`pwd` modules $(MAKE) -C ..
clean: clean:
$(MAKE) -C $(KERNELDIR) M=`pwd` clean $(MAKE) -C .. clean
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
......
...@@ -19,75 +19,44 @@ ...@@ -19,75 +19,44 @@
* *
*****************************************************************************/ *****************************************************************************/
#ifndef __KERNEL__ // Linux
# define __KERNEL__
#endif
#ifndef MODULE
# define MODULE
#endif
#include <linux/config.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/vmalloc.h>
#include <linux/fs.h> /* everything... */
#include <linux/proc_fs.h>
#include <linux/time.h>
#include <linux/timer.h>
#include <linux/timex.h> /* fuer get_cycles */
#include <linux/errno.h> /* error codes */
#include <asm/msr.h> /* maschine-specific registers */
#include <linux/param.h> /* fuer HZ */
#include <linux/ipipe.h> #include <linux/ipipe.h>
#include "msr_param.h" //wird im Projektverzeichnis erwartet // RT_lib
//#include <msr_control.h>
#include <msr_lists.h>
#include <msr_charbuf.h>
#include <msr_reg.h>
#include <msr_error_reg.h>
#include <msr_messages.h>
#include <msr_proc.h>
#include <msr_utils.h>
#include <msr_main.h> #include <msr_main.h>
#include <msr_utils.h>
#include <msr_messages.h>
#include <msr_float.h> #include <msr_float.h>
#include <msr_reg.h>
#include "msr_param.h"
#include "msr_jitter.h"
// EtherCAT
#include "../drivers/ec_master.h" #include "../drivers/ec_master.h"
#include "../drivers/ec_device.h" #include "../drivers/ec_device.h"
#include "../drivers/ec_types.h" #include "../drivers/ec_types.h"
#include "../drivers/ec_module.h" #include "../drivers/ec_module.h"
#include "msr_jitter.h" // Defines/Makros
#define TSC2US(T1, T2) ((T2 - T1) * 1000UL / cpu_khz)
#define TSC2US(T) ((unsigned long) (T) * 1000UL / cpu_khz)
/*--external data------------------------------------------------------------*/
#define HZREDUCTION (MSR_ABTASTFREQUENZ/HZ) #define HZREDUCTION (MSR_ABTASTFREQUENZ/HZ)
extern wait_queue_head_t msr_read_waitqueue; /*****************************************************************************/
/* Globale Variablen */
extern struct msr_char_buf *msr_kanal_puffer;
extern int proc_abtastfrequenz;
/*--local data---------------------------------------------------------------*/
// RT_lib
extern struct timeval process_time; extern struct timeval process_time;
struct timeval msr_time_increment; // Increment per Interrupt struct timeval msr_time_increment; // Increment per Interrupt
//adeos // Adeos
static struct ipipe_domain this_domain; static struct ipipe_domain this_domain;
static struct ipipe_sysinfo sys_info; static struct ipipe_sysinfo sys_info;
// EtherCAT
static EtherCAT_master_t *ecat_master = NULL; static EtherCAT_master_t *ecat_master = NULL;
static unsigned long ecat_bus_time = 0;
static EtherCAT_slave_t ecat_slaves[] = static EtherCAT_slave_t ecat_slaves[] =
{ {
...@@ -178,7 +147,6 @@ static int next2004(int *wrap) ...@@ -178,7 +147,6 @@ static int next2004(int *wrap)
return -1; return -1;
} }
/****************************************************************************** /******************************************************************************
* *
* Function: msr_controller_run() * Function: msr_controller_run()
...@@ -256,21 +224,23 @@ static void msr_controller_run(void) ...@@ -256,21 +224,23 @@ static void msr_controller_run(void)
//EtherCAT_process_data_cycle(ecat_master, 2); //EtherCAT_process_data_cycle(ecat_master, 2);
rdtscl(t7);
ecat_bus_time = TSC2US(t2, t7);
// Daten lesen und skalieren // Daten lesen und skalieren
#ifdef USE_MSR_LIB #ifdef USE_MSR_LIB
value = EtherCAT_read_value(&ecat_slaves[5], 0) / 3276.0; value = EtherCAT_read_value(&ecat_slaves[5], 0) / 3276.0;
dig1 = EtherCAT_read_value(&ecat_slaves[2], 0); dig1 = EtherCAT_read_value(&ecat_slaves[2], 0);
#endif #endif
rdtscl(t7);
if (debug_counter == MSR_ABTASTFREQUENZ) { if (debug_counter == MSR_ABTASTFREQUENZ) {
printk(KERN_DEBUG "%lu: %lus + %lus + %lus + %lus + %lus +" printk(KERN_DEBUG "%lu: %lus + %lus + %lus + %lus + %lus +"
" %lus = %lus (%u %u)\n", " %lus = %lus (%u %u)\n",
TSC2US(t1 - lt), TSC2US(lt, t1),
TSC2US(t2 - t1), TSC2US(t3 - t2), TSC2US(t4 - t3), TSC2US(t1, t2), TSC2US(t2, t3), TSC2US(t3, t4),
TSC2US(t5 - t4), TSC2US(t6 - t5), TSC2US(t7 - t6), TSC2US(t4, t5), TSC2US(t5, t6), TSC2US(t6, t7),
TSC2US(t7 - t1), tr1, tr2); TSC2US(t1, t7), tr1, tr2);
debug_counter = 0; debug_counter = 0;
} }
...@@ -297,31 +267,25 @@ static void msr_controller_run(void) ...@@ -297,31 +267,25 @@ static void msr_controller_run(void)
void msr_run(unsigned irq) void msr_run(unsigned irq)
{ {
static int counter = 0; static int counter = 0;
#ifdef USE_MSR_LIB
timeval_add(&process_time,&process_time,&msr_time_increment);
MSR_ADEOS_INTERRUPT_CODE( #ifdef USE_MSR_LIB
msr_controller_run(); timeval_add(&process_time, &process_time, &msr_time_increment);
msr_write_kanal_list(); MSR_ADEOS_INTERRUPT_CODE(msr_controller_run(); msr_write_kanal_list(););
);
#else #else
msr_controller_run(); msr_controller_run();
#endif #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 besttigen ipipe_control_irq(irq,0,IPIPE_ENABLE_MASK); //Interrupt besttigen
if(counter++ > HZREDUCTION) { if (counter++ > HZREDUCTION) {
ipipe_propagate_irq(irq); //und weiterreichen ipipe_propagate_irq(irq); //und weiterreichen
counter = 0; counter = 0;
} }
} }
void domain_entry (void) /*****************************************************************************/
void domain_entry(void)
{ {
printk("Domain %s started.\n", ipipe_current_domain->name); printk("Domain %s started.\n", ipipe_current_domain->name);
...@@ -352,14 +316,10 @@ int msr_globals_register(void) ...@@ -352,14 +316,10 @@ int msr_globals_register(void)
msr_reg_kanal("/value", "V", &value, TDBL); msr_reg_kanal("/value", "V", &value, TDBL);
msr_reg_kanal("/dig1", "", &dig1, TINT); msr_reg_kanal("/dig1", "", &dig1, TINT);
#endif #endif
#if 0
msr_reg_kanal("/Taskinfo/Ecat/TX-Delay","us",&ecat_tx_delay,TUINT); msr_reg_kanal("/Taskinfo/EtherCAT/BusTime", "us", &ecat_bus_time, TUINT);
msr_reg_kanal("/Taskinfo/Ecat/RX-Delay","us",&ecat_rx_delay,TUINT);
msr_reg_kanal("/Taskinfo/Ecat/TX-Cnt","",&tx_intr,TUINT); return 0;
msr_reg_kanal("/Taskinfo/Ecat/RX-Cnt","",&rx_intr,TUINT);
msr_reg_kanal("/Taskinfo/Ecat/Total-Cnt","",&total_intr,TUINT);
#endif
return 0;
} }
/****************************************************************************** /******************************************************************************
...@@ -434,7 +394,7 @@ void __exit cleanup_module() ...@@ -434,7 +394,7 @@ void __exit cleanup_module()
msr_print_info("msk_modul: unloading..."); 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); ipipe_unregister_domain(&this_domain);
if (ecat_master) if (ecat_master)
......
../../../linux/kernel_space/rt_lib-4.0.0-2.6krnl
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment