hi,everybody!I am a freshman in this list.
These days,I need to change my linux to rtlinux.
My linux kernel is 2.2.10 (Turbolinux 4.0),and I
use RTL Version 2.0,Kernel-Version 2.2.13 to update
it.
I install my rtlinux as following steps:
1.tar -xzvf /usr/src/rtlinux-2.0-prepatched.tgz
2.rm /usr/src/linux
ln -s /usr/src/rtlinux-2.0/linux /usr/src/linux
3.make menuconfig(I am sure I select "hard real time" and I disable "APM support")
4.make dep
make bzImage
5.make modules
make modules_install
6.make install
7.modify lilo.conf
run /sbin/lilo
8.shutdown -r now
9.make
make install
Then I try a example to test inserttupts.
I copy and paste this program from www.rtlinux.org
it as follows:
#include <rtl.h>
#include <rtl_sync.h>
#include <time.h>
#include <pthread.h>
#include <asm/io.h>
#include <linux/kd.h>
pthread_t thread;
unsigned int intr_handler(unsigned int irq, struct pt_regs *regs)
{
outb(0, 0x378); //this is our interrupt handler
//which resets the output of 5V on pin 2
rtl_hard_enable_irq(7); //<-- if got an irq, reenable irq
return 0;
}
void * start_routine(void *arg)
{
struct sched_param p;
p . sched_priority = 1;
pthread_setschedparam (pthread_self(), SCHED_FIFO, &p);
pthread_make_periodic_np (pthread_self(), gethrtime(), 100000); //100000ns = 10
kHz
while (1)
{ //we have a periodic trigger which
pthread_wait_np(); //creates a periodic output of
outb(3, 0x378); //+5V on pins 2 & 3.
}
return 0;
}
int init_module(void) { //this init module will enable
int status; //your interrupt
rtl_irqstate_t f;
rtl_no_interrupts(f);
status = rtl_request_irq(7, intr_handler); //if IRQ-handler is OK
rtl_printf("rtl_request_irq: %d\n", status); //this will output 0
//on your console
/* enbable parallel port interrupt */
outb_p(inb_p(0x37A) | 0x10, 0x37A);
outb_p(inb_p(0x21) & (~0x80), 0x21);
outb_p(0x20, 0x20);
rtl_hard_enable_irq(7);
rtl_restore_interrupts(f);
outb(0, 0x378); //before we start reset any output on the parallel port
return pthread_create (&thread, NULL, start_routine, 0);
}
void cleanup_module(void) { //this cleanup module disables
rtl_free_irq(7); //your interrupt
pthread_delete_np (thread);
}
I use "make -f rtl.mk parport" to compile it. however i saw many error information
such as:
/tmp/ccrqTc3c.o In function "intr_handler":
/tmp/ccrqTc3c.o(.text+0xb):undefined reference to "rtl_hard_enable_irq";
/tmp/ccrqTc3c.o(.text+0x32):undefined reference to "rtl_sched";
.........
I don't know Why? and I lose my net card also,it is a common ne2000 compatible.
Thanks in advance!
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/