RTEC-0.3 - a concurrent realtime task system ############################################ 1. Changes to RTEC-0.2: 2. Introduction 3. API description 4. Download 5. Installation 1. Changes to RTEC-0.2: ======================= o Timing Bugfix o Added soft-interrupt support o rearranged the core (rt_core.c) o created a better understandable demo (rt_application.c) o more convenient "API" 2. Introduction =============== RTEC is a try to port RTLinux to uClinux. Actually, there is no priority task-scheduler, but you can have up to 16 concurrent periodic tasks (only limited by #define) running at a desired periodizity. Every task has it's own stack, currently limited to 16KB (hardcoded). This is the basis for a scheduler. Additionaly, you can send an emulated interrupt to the standard linux kernel. This is the basis for a FIFO-handler (dev/rtf*). Currently, the system is limited to MC68328. 3. API decription ================= There are only a view functions that are interessting for the user: RT-Task handling: ----------------- void rt_task_create(RTTASK *task,void (*code)(void),int add_to_list); void rt_task_sleep(void); void rt_start_concurrent_task_system(hrtime_t period); void rt_switch_to_task(RTTASK *new_task); RT-Interrupt handling: ---------------------- int rt_request_irq(unsigned int irq, void (*handler)(void)); void rt_free_irq(unsigned int irq); Soft-Interrupt handling: ------------------------ void rt_pend_soft_irq(irq) void rt_reset_soft_irq(irq) Have a look at the Demo-Application to understand for what these functions are used for: /* ../linux/arch/m68knommu/platform/68328/rt_application.c */ #include <asm/system.h> #include <asm/MC68328.h> #include <linux/rtl.h> #include <linux/sched.h> #include <asm/irq.h> unsigned long fb_data[160][5]; /* -------- soft interrupt emulation --------- */ #define MY_SOFT_RT_IRQ_NUM 31 int my_soft_rt_irq_handler(int vec, struct pt_regs *fp) { printk("soft irq occured\n"); rt_reset_soft_irq(MY_SOFT_RT_IRQ_NUM); return 0; }; /* rt-handler for pen */ void rt_pen_demo(void) { /* just do something */ fb_data[20][2]--; /* pen-irq doesn't seem to be resetable ? */ /* send software interrupt to linux kernel */ rt_pend_soft_irq(MY_SOFT_RT_IRQ_NUM); }; /* --------- concurrent task system demo ----------- */ RTTASK rt_listed_task1,rt_listed_task2; RTTASK rt_circular_task1,rt_circular_task2; /* this two "listed" tasks will be called every 2 ms automaticaly */ void rt_listed_task1_code(void) { while(1) { fb_data[5][0]--; rt_task_sleep(); }; }; void rt_listed_task2_code(void) { while(1) { rt_switch_to_task(&rt_circular_task1); }; }; /* circular_task1 will be started by rt_listed_task2. circular_task2 will be started by rt_circular_task1. circular_task2 will go back to rtlinuxtask */ void rt_circular_task1_code(void) { while(1) { fb_data[5][2]++; rt_switch_to_task(&rt_circular_task2); }; }; void rt_circular_task2_code(void) { while(1) { fb_data[5][4]-=5000; rt_switch_to_task(&rtlinuxtask); }; }; /* -------------- init ------------- */ void rt_init_app(void) { /* set LCD-Display output area */ LSSA = fb_data; /* request handler for pen-interrupt */ rt_request_irq(PEN_IRQ_NUM,rt_pen_demo); rt_task_create(&rt_listed_task1,rt_listed_task1_code,1); rt_task_create(&rt_listed_task2,rt_listed_task2_code,1); rt_task_create(&rt_circular_task1,rt_circular_task1_code,0); rt_task_create(&rt_circular_task2,rt_circular_task2_code,0); request_irq(IRQ_MACHSPEC | MY_SOFT_RT_IRQ_NUM, my_soft_rt_irq_handler, IRQ_FLG_LOCK, "my_irq", NULL); /* start timer1 and request handler */ rt_start_concurrent_task_system(2000000); /* 2ms */ }; 4. Download =========== This is a patch against uClinux-2.0.38.1pre1: wget http://www.rcs.ei.tum.de/~kuhn/uclinux/uClinux-2.0.38.1pre1_rt-0.3.diff.gz 5. Installation =============== Just unpack a clean linux-2.0.38 and patch it with uClinux-2.0.38.1pre1 and then apply the patch above. For a more detailed installation instruction, refer to the readme-file of rtec-0.1: wget http://www.rcs.ei.tum.de/~kuhn/uclinux/rtec-0.1.txt --- [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/