You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(12) |
Jul
(105) |
Aug
(245) |
Sep
(165) |
Oct
(100) |
Nov
(92) |
Dec
(74) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(179) |
Feb
(233) |
Mar
(175) |
Apr
(168) |
May
(146) |
Jun
(165) |
Jul
(18) |
Aug
(95) |
Sep
(134) |
Oct
(120) |
Nov
(51) |
Dec
(65) |
| 2005 |
Jan
(96) |
Feb
(100) |
Mar
(113) |
Apr
(82) |
May
(281) |
Jun
(168) |
Jul
(54) |
Aug
(72) |
Sep
(104) |
Oct
(182) |
Nov
(126) |
Dec
(133) |
| 2006 |
Jan
(211) |
Feb
(252) |
Mar
(291) |
Apr
(199) |
May
(345) |
Jun
(282) |
Jul
(272) |
Aug
(261) |
Sep
(287) |
Oct
(464) |
Nov
(233) |
Dec
(210) |
| 2007 |
Jan
(669) |
Feb
(304) |
Mar
(483) |
Apr
(150) |
May
(293) |
Jun
(215) |
Jul
(178) |
Aug
(138) |
Sep
(159) |
Oct
(301) |
Nov
(367) |
Dec
(165) |
| 2008 |
Jan
(171) |
Feb
(148) |
Mar
(150) |
Apr
(180) |
May
(112) |
Jun
(109) |
Jul
(196) |
Aug
(319) |
Sep
(294) |
Oct
(284) |
Nov
(399) |
Dec
(280) |
| 2009 |
Jan
(536) |
Feb
(454) |
Mar
(382) |
Apr
(255) |
May
(321) |
Jun
(318) |
Jul
(412) |
Aug
(226) |
Sep
(76) |
Oct
(251) |
Nov
(134) |
Dec
(101) |
| 2010 |
Jan
(262) |
Feb
(210) |
Mar
(219) |
Apr
(55) |
May
(180) |
Jun
(225) |
Jul
(151) |
Aug
(184) |
Sep
(54) |
Oct
(160) |
Nov
(237) |
Dec
(115) |
| 2011 |
Jan
(141) |
Feb
(68) |
Mar
(204) |
Apr
(329) |
May
(68) |
Jun
(34) |
Jul
(304) |
Aug
(206) |
Sep
(183) |
Oct
(121) |
Nov
(1125) |
Dec
(934) |
| 2012 |
Jan
(466) |
Feb
(161) |
Mar
(314) |
Apr
(63) |
May
(62) |
Jun
(53) |
Jul
(47) |
Aug
(41) |
Sep
(36) |
Oct
(108) |
Nov
(297) |
Dec
(73) |
| 2013 |
Jan
(236) |
Feb
(81) |
Mar
(422) |
Apr
(441) |
May
(86) |
Jun
(177) |
Jul
(146) |
Aug
(140) |
Sep
(93) |
Oct
(126) |
Nov
(133) |
Dec
(230) |
| 2014 |
Jan
(380) |
Feb
(233) |
Mar
(251) |
Apr
(214) |
May
(168) |
Jun
(670) |
Jul
(538) |
Aug
(459) |
Sep
(330) |
Oct
(327) |
Nov
(339) |
Dec
(456) |
| 2015 |
Jan
(188) |
Feb
(426) |
Mar
(186) |
Apr
(71) |
May
(151) |
Jun
(283) |
Jul
(208) |
Aug
(477) |
Sep
(148) |
Oct
(302) |
Nov
(297) |
Dec
(331) |
| 2016 |
Jan
(474) |
Feb
(55) |
Mar
(92) |
Apr
(118) |
May
(286) |
Jun
(751) |
Jul
(494) |
Aug
(166) |
Sep
(97) |
Oct
(216) |
Nov
(41) |
Dec
(78) |
| 2017 |
Jan
(148) |
Feb
(205) |
Mar
(112) |
Apr
(119) |
May
(125) |
Jun
(102) |
Jul
(242) |
Aug
(26) |
Sep
(53) |
Oct
(28) |
Nov
(38) |
Dec
(97) |
| 2018 |
Jan
(71) |
Feb
(49) |
Mar
(43) |
Apr
(13) |
May
(19) |
Jun
(44) |
Jul
(74) |
Aug
(30) |
Sep
(44) |
Oct
(57) |
Nov
(74) |
Dec
(34) |
| 2019 |
Jan
(41) |
Feb
(50) |
Mar
(30) |
Apr
(24) |
May
(44) |
Jun
(101) |
Jul
(94) |
Aug
(123) |
Sep
(101) |
Oct
(81) |
Nov
(48) |
Dec
(51) |
| 2020 |
Jan
(74) |
Feb
(81) |
Mar
(129) |
Apr
(310) |
May
(176) |
Jun
(97) |
Jul
(137) |
Aug
(205) |
Sep
(84) |
Oct
(71) |
Nov
(106) |
Dec
(138) |
| 2021 |
Jan
(117) |
Feb
(94) |
Mar
(89) |
Apr
(71) |
May
(98) |
Jun
(99) |
Jul
(67) |
Aug
(129) |
Sep
(108) |
Oct
(127) |
Nov
(115) |
Dec
(114) |
| 2022 |
Jan
(115) |
Feb
(85) |
Mar
(97) |
Apr
(92) |
May
(102) |
Jun
(109) |
Jul
(168) |
Aug
(230) |
Sep
(183) |
Oct
(106) |
Nov
(109) |
Dec
(146) |
| 2023 |
Jan
(186) |
Feb
(126) |
Mar
(99) |
Apr
(92) |
May
(158) |
Jun
(74) |
Jul
(113) |
Aug
(93) |
Sep
(84) |
Oct
(163) |
Nov
(72) |
Dec
(81) |
| 2024 |
Jan
(71) |
Feb
(85) |
Mar
(63) |
Apr
(50) |
May
(45) |
Jun
(28) |
Jul
(106) |
Aug
(45) |
Sep
(60) |
Oct
(44) |
Nov
(53) |
Dec
(28) |
| 2025 |
Jan
(87) |
Feb
(58) |
Mar
(71) |
Apr
(37) |
May
(37) |
Jun
(46) |
Jul
(74) |
Aug
(26) |
Sep
(55) |
Oct
(43) |
Nov
(58) |
Dec
(34) |
| 2026 |
Jan
(106) |
Feb
(61) |
Mar
(48) |
Apr
(21) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <jmk...@us...> - 2003-08-15 20:47:53
|
Update of /cvsroot/emc/rtapi/examples/fifo
In directory sc8-pr-cvs1:/tmp/cvs-serv2354/examples/fifo
Modified Files:
common.h fifotask.c
Log Message:
Finished converting rtai_rtapi.c, added watchdog example.
Index: common.h
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/fifo/common.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** common.h 10 Aug 2003 22:42:55 -0000 1.2
--- common.h 15 Aug 2003 20:45:13 -0000 1.3
***************
*** 2,6 ****
#define COMMON_H
! enum { FIFO_KEY = 1 };
enum { FIFO_SIZE = 1024 };
--- 2,6 ----
#define COMMON_H
! enum { FIFO_KEY = 14 };
enum { FIFO_SIZE = 1024 };
Index: fifotask.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/fifo/fifotask.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** fifotask.c 13 Aug 2003 05:55:07 -0000 1.14
--- fifotask.c 15 Aug 2003 20:45:13 -0000 1.15
***************
*** 10,14 ****
static int fifo_task; /* the task ID */
! static rtapi_fifo_handle fifo;
enum { TIMER_PERIOD_NSEC = 10000000 }; /* timer period, in nanoseconds */
enum { FIFO_PERIOD_NSEC = 1000000000 }; /* timer period, in nanoseconds */
--- 10,14 ----
static int fifo_task; /* the task ID */
! static int fifo; /* the fifo ID */
enum { TIMER_PERIOD_NSEC = 10000000 }; /* timer period, in nanoseconds */
enum { FIFO_PERIOD_NSEC = 1000000000 }; /* timer period, in nanoseconds */
***************
*** 62,69 ****
}
/* allocate and initialize the fifo */
! retval = rtapi_fifo_new(FIFO_KEY, FIFO_SIZE, &fifo);
! if (retval != RTAPI_SUCCESS) {
! rtapi_print("fifotask init: rtapi_fifo_new failed with %d\n", retval);
goto no_fifo;
}
--- 62,70 ----
}
+ retval = -1;
/* allocate and initialize the fifo */
! fifo = rtapi_fifo_new(FIFO_KEY, FIFO_SIZE, 'W');
! if (fifo < 0 ) {
! rtapi_print("fifotask init: rtapi_fifo_new failed with %d\n", fifo);
goto no_fifo;
}
***************
*** 105,109 ****
rtapi_task_delete(fifo_task);
no_task:
! rtapi_fifo_delete(fifo);
no_fifo:
return retval;
--- 106,110 ----
rtapi_task_delete(fifo_task);
no_task:
! rtapi_fifo_delete(fifo, 'W');
no_fifo:
return retval;
***************
*** 124,132 ****
rtapi_print("fifotask exit: rtapi_task_delete failed with %d\n", retval);
}
! /* TESTING - Intentionally fail to delete fifo
! retval = rtapi_fifo_delete(fifo);
if (retval != RTAPI_SUCCESS) {
rtapi_print("fifotask exit: rtapi_fifo_delete failed with %d\n", retval);
! } */
rtapi_print("fifotask exit: done\n");
--- 125,133 ----
rtapi_print("fifotask exit: rtapi_task_delete failed with %d\n", retval);
}
! /* TESTING - Intentionally fail to delete fifo */
! retval = rtapi_fifo_delete(fifo, 'W');
if (retval != RTAPI_SUCCESS) {
rtapi_print("fifotask exit: rtapi_fifo_delete failed with %d\n", retval);
! }
rtapi_print("fifotask exit: done\n");
|
|
From: <jmk...@us...> - 2003-08-15 20:47:53
|
Update of /cvsroot/emc/rtapi/examples/watchdog
In directory sc8-pr-cvs1:/tmp/cvs-serv2354/examples/watchdog
Added Files:
Makefile watchdog.c
Log Message:
Finished converting rtai_rtapi.c, added watchdog example.
--- NEW FILE: Makefile ---
# Makefile for watchdog example
# get the defs for CC, CFLAGS, LIB_DIR, etc.
include ../../Makefile.inc
SRCS = watchdog.c
OBJS = $(RTLIB_DIR)/watchdog.o
HEADERS =
BINS =
all : $(OBJS)
$(RTLIB_DIR)/%.o : %.c
$(CC) -c $(RTFLAGS) $< -o $@
headers :
depend :
makedepend -Y -I$(INC_DIR) -p$(RTLIB_DIR)/ $(SRCS) 2> /dev/null
indent :
indent $(SRCS)
clean :
- \rm -f *.bak *~
- \rm -f $(OBJS)
.PHONY: all headers depend indent install clean clean_install
# DO NOT DELETE
/home/John/emcdev/rtapi/rtlib/watchdog.o: /home/John/emcdev/rtapi/include/rtapi.h
/home/John/emcdev/rtapi/rtlib/watchdog.o: /home/John/emcdev/rtapi/include/rtapi_app.h
--- NEW FILE: watchdog.c ---
/*
watchdog.c
A crude but effective watchdog to prevent lockups if realtime tasks
get stuck in infinite loops or otherwise start hogging the CPU.
Theory of operation:
On init, watchdog sets up two periodic tasks. One operates at the
lowest priority, runs once per second, and resets a global variable
to zero. The other operates at the highest priority, runs once
per second, and increments the global variable. If the global
ever reaches 5, the high priority task concludes that some mis-
behaving task(s) are keeping the low priority task from running.
In that case, it takes action. The action is pretty brutal, it
simply pauses ALL tasks, except for the watchdog tasks. That
should be enough to get the user a prompt. Note that the watchdog
cannot protect against a mis-behaving task at the highest or lowest
priority. A highest priority task could prempt the watchdog itself,
and a lowest priority task could time-share with the low priority
watchdog task while blocking all user (Linux) activity. DON'T
run untrusted code at the highest or lowest priority!.
This could be improved - possible features:
User specified delay instead of 5 seconds.
Variable priority for the hi task, so that trusted, time-critical
tasks wouldn't be interrupted by the watchdog hi task.
If it were incorporated directly into the rtapi, the range of
priority permitted by other tasks could be reduced by 1 at
each end, allowing the watchdog tasks to protect all priorities.
A user mode program could be used to "pet" the watchdog, to
provide even more protection against locking Linux out of the
CPU.
Maybe later....
*/
/** Copyright (C) 2003 John Kasunich *
* <jmkasunich AT users DOT sourceforge DOT net> */
/* This program is free software; you can redistribute it and/or *
* modify it under the terms of version 2 of the GNU General Public *
* License as published by the Free Software Foundation. *
* This library 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 this program; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA */
#include "rtapi.h"
#include "rtapi_app.h" /* rtapi_app_main,exit() */
#ifdef MODULE_LICENSE
MODULE_LICENSE("GPL");
#endif
static int hi_task; /* the high priority task ID */
static int lo_task; /* the low priority task ID */
static int watchdog = 0; /* the counter variable */
enum { TIMER_PERIOD_NSEC = 10000000 }; /* timer period, in nanoseconds */
enum { TASK_PERIOD_NSEC = 1000000000 }; /* task period, in nanoseconds */
enum { STACKSIZE = 1024 }; /* how big the stack is */
static void hi_code( int arg )
{
int n;
watchdog = 0;
while (1) {
/* check the dog, loop as long as somebody's petting him */
while ( watchdog++ < 6 ) {
rtapi_wait();
}
/* oops - nobody's petting the dog, and he's getting angry! */
rtapi_print_msg( RTAPI_MSG_ERR, "WATCHDOG: WOOF - pausing all tasks!\n" );
/* loop, deleting tasks (we don't know how many, just try them all */
for ( n = 0 ; n < 256 ; n++ ) {
/* don't want to kill the watchdog tasks */
if ((n != hi_task) && (n != lo_task)) {
rtapi_task_pause ( n );
}
}
/* put the dog back to sleep */
watchdog = 0;
}
return;
}
static void lo_code( int arg )
{
while ( 1 ) {
/* pet the dog. "Nice dog, don't bite me." */
watchdog = 0;
/* wait and do it again. */
rtapi_wait();
}
return;
}
/* part of the Linux kernel module that kicks off the tasks */
int rtapi_app_main(void)
{
int retval;
int prio;
rtapi_print_msg(RTAPI_MSG_INFO, "WATCHDOG: Installing watchdog\n");
if (rtapi_init() != RTAPI_SUCCESS ) {
return -1;
}
/* set the base timer period */
retval = rtapi_clock_set_period(TIMER_PERIOD_NSEC);
if ( retval < 0 ) {
/* See rtapi.h for the error codes returned */
rtapi_print_msg( RTAPI_MSG_ERR,
"watchdog init: rtapi_clock_set_period returned %d\n", retval );
return -1;
}
/* low priority task first */
prio = rtapi_prio_lowest();
lo_task = rtapi_task_new(lo_code, 0 /* arg */, prio, STACKSIZE, RTAPI_NO_FP );
if ( lo_task < 0 ) {
/* See rtapi.h for the error codes returned */
rtapi_print_msg( RTAPI_MSG_ERR,
"watchdog init: rtapi_task_new(lo) returned %d\n", lo_task );
return -1;
}
/* now the high priority task */
prio = rtapi_prio_highest();
hi_task = rtapi_task_new(hi_code, 0 /* arg */, prio, STACKSIZE, RTAPI_NO_FP );
if ( hi_task < 0 ) {
rtapi_print_msg( RTAPI_MSG_ERR,
"watchdog init: rtapi_task_new(hi) returned %d\n", hi_task );
return -1;
}
/* start both tasks running */
retval = rtapi_task_start( lo_task, TASK_PERIOD_NSEC, RTAPI_NOW );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print_msg( RTAPI_MSG_ERR,
"watchdog init: rtapi_task_start(lo) returned %d\n", retval );
return -1;
}
retval = rtapi_task_start( hi_task, TASK_PERIOD_NSEC, RTAPI_NOW );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print_msg( RTAPI_MSG_ERR,
"watchdog init: rtapi_task_start(hi) returned %d\n", retval );
return -1;
}
rtapi_print_msg( RTAPI_MSG_INFO, "WATCHDOG: The watchdog is on duty.\n" );
return 0;
}
/* part of the Linux kernel module that stops the tasks */
void rtapi_app_exit(void)
{
int retval;
rtapi_print_msg( RTAPI_MSG_INFO, "WATCHDOG: The watchdog is going to sleep.\n" );
/* Stop the tasks */
retval = rtapi_task_pause(hi_task);
if ( retval != RTAPI_SUCCESS ) {
rtapi_print_msg( RTAPI_MSG_ERR,
"watchdog exit: rtapi_task_pause(hi) returned %d\n", retval );
}
retval = rtapi_task_pause(lo_task);
if ( retval != RTAPI_SUCCESS ) {
rtapi_print_msg( RTAPI_MSG_ERR,
"watchdog exit: rtapi_task_pause(lo) returned %d\n", retval );
}
/* delete the tasks */
retval = rtapi_task_delete(hi_task);
if ( retval != RTAPI_SUCCESS ) {
rtapi_print_msg( RTAPI_MSG_ERR,
"watchdog exit: rtapi_task_delete(hi) returned %d\n", retval );
}
retval = rtapi_task_delete(lo_task);
if ( retval != RTAPI_SUCCESS ) {
rtapi_print_msg( RTAPI_MSG_ERR,
"watchdog exit: rtapi_task_delete(lo) returned %d\n", retval );
}
rtapi_exit();
rtapi_print_msg(RTAPI_MSG_INFO, "WATCHDOG: Watchdog removed.\n");
}
|
|
From: <pr...@us...> - 2003-08-15 20:16:30
|
Update of /cvsroot/emc/emc/src/emcmot
In directory sc8-pr-cvs1:/tmp/cvs-serv24220
Modified Files:
segmentqueue.c segmentqueue.h emcsegmot.c Makefile
Log Message:
Updated segment queue files, so that they compile and link. In the
emcmot/Makefile, there's a new target, "seg", that builds the stepper
and servo real-time modules.
This was accomplished by taking the latest emcmot.c, and working in
a layer that lets you switch between TC and segment queue algorithms,
using the "use_tc" variable. Eventually this will be an ini file thing.
It's untested! It shouldn't interfere with anyone since it's not built
by default. To build, make ... seg in the emcmot directory. Edit the
"use_tc" variable and make it 0 for segment queue.
Index: segmentqueue.c
===================================================================
RCS file: /cvsroot/emc/emc/src/emcmot/segmentqueue.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** segmentqueue.c 21 Dec 2000 16:22:11 -0000 1.3
--- segmentqueue.c 15 Aug 2003 20:00:58 -0000 1.4
***************
*** 4,7 ****
--- 4,9 ----
Modification history
+ 14-Aug-2003 FMP converted EmcPose to PmPose for use with PmLineInit(),
+ PmCircleInit(), etc.
30-Jun-1999 RSB changed the calculation of the maximum tangential
acceleration for circles (in sqAddCircle)
***************
*** 188,192 ****
pmCartScalDiv ( s1->circle.rHelix, s1->circle.angle, &helix);
pmCartCartAdd ( v1, helix, &v1);
! pmCartNorm ( v1, &v1 );
}
--- 190,194 ----
pmCartScalDiv ( s1->circle.rHelix, s1->circle.angle, &helix);
pmCartCartAdd ( v1, helix, &v1);
! pmCartUnit ( v1, &v1 );
}
***************
*** 200,204 ****
pmCartScalDiv ( s2->circle.rHelix, s2->circle.angle, &helix);
pmCartCartAdd ( s2->circle.rPerp, helix, &v2);
! pmCartNorm ( v2, &v2 );
}
--- 202,206 ----
pmCartScalDiv ( s2->circle.rHelix, s2->circle.angle, &helix);
pmCartCartAdd ( s2->circle.rPerp, helix, &v2);
! pmCartUnit ( v2, &v2 );
}
***************
*** 1166,1169 ****
--- 1168,1192 ----
}
+ static void emcpose_to_pmpose(EmcPose e, PmPose * p)
+ {
+ p->tran = e.tran;
+ p->rot.s = 1;
+ p->rot.x = e.a;
+ p->rot.y = e.b;
+ p->rot.z = e.c;
+
+ return;
+ }
+
+ static void pmpose_to_emcpose(PmPose p, EmcPose * e)
+ {
+ e->tran = p.tran;
+ e->a = p.rot.x;
+ e->b = p.rot.y;
+ e->c = p.rot.z;
+
+ return;
+ }
+
int sqAddLine(SEGMENTQUEUE *sq, EmcPose end, int ID)
{
***************
*** 1171,1175 ****
SEGMENT *newseg;
EmcPose start;
!
/* check if segment queue has been initialized */
--- 1194,1198 ----
SEGMENT *newseg;
EmcPose start;
! PmPose start_pose, end_pose;
/* check if segment queue has been initialized */
***************
*** 1232,1236 ****
/* initialize line */
! pmLineInit( &newseg->line, newseg->start, newseg->end);
/* set the maximum tangential acceleration for this line */
--- 1255,1261 ----
/* initialize line */
! emcpose_to_pmpose(newseg->start, &start_pose);
! emcpose_to_pmpose(newseg->end, &end_pose);
! pmLineInit( &newseg->line, start_pose, end_pose);
/* set the maximum tangential acceleration for this line */
***************
*** 1261,1264 ****
--- 1286,1290 ----
PmCartesian helix;
double absHelix;
+ PmPose start_pose, end_pose;
/* used to calculate the maximum tangential acceleration */
***************
*** 1284,1288 ****
start=sq->queue[(sq->end+sq->size-1)%sq->size].end;
! pmCircleInit(&circle, start, end, center, normal, turn);
if (circle.angle==0)
--- 1310,1316 ----
start=sq->queue[(sq->end+sq->size-1)%sq->size].end;
! emcpose_to_pmpose(start, &start_pose);
! emcpose_to_pmpose(end, &end_pose);
! pmCircleInit(&circle, start_pose, end_pose, center, normal, turn);
if (circle.angle==0)
***************
*** 1387,1390 ****
--- 1415,1420 ----
int turn;
PmCartesian normal, center;
+ PmPose last_point_pose;
+ PmPose start_pose, end_pose;
int npow1, npow2, npow3; /* to speed up cubic calculations */
***************
*** 1528,1537 ****
sq->currentID=sq->cursor->ID;
! if ( sq->cursor->type == SQ_LINEAR )
! pmLinePoint( &sq->cursor->line, sq->dist - sq->offset, &sq->lastPoint);
! else
! pmCirclePoint( &sq->cursor->circle, \
! (sq->dist - sq->offset)/sq->cursor->helixRadius,\
! &sq->lastPoint );
}
--- 1558,1569 ----
sq->currentID=sq->cursor->ID;
! if ( sq->cursor->type == SQ_LINEAR ) {
! pmLinePoint( &sq->cursor->line, sq->dist - sq->offset, &last_point_pose);
! } else {
! pmCirclePoint( &sq->cursor->circle,
! (sq->dist - sq->offset)/sq->cursor->helixRadius,
! &last_point_pose);
! }
! pmpose_to_emcpose(last_point_pose, &sq->lastPoint);
}
***************
*** 1540,1547 ****
things much easier... */
{
! if ( sq->cursor->type == SQ_LINEAR )
! pmLinePoint(&as->line, sq->dist, &sq->lastPoint);
! else
! pmCirclePoint(&as->circle, sq->dist/as->helixRadius, &sq->lastPoint);
}
--- 1572,1581 ----
things much easier... */
{
! if ( sq->cursor->type == SQ_LINEAR ) {
! pmLinePoint(&as->line, sq->dist, &last_point_pose);
! } else {
! pmCirclePoint(&as->circle, sq->dist/as->helixRadius, &last_point_pose);
! }
! pmpose_to_emcpose(last_point_pose, &sq->lastPoint);
}
***************
*** 1606,1610 ****
as->length=sqGiveLength(as->start,as->end);
as->totLength=as->length;
! pmLineInit(&as->line,as->start,as->end);
}
else
--- 1640,1646 ----
as->length=sqGiveLength(as->start,as->end);
as->totLength=as->length;
! emcpose_to_pmpose(as->start, &start_pose);
! emcpose_to_pmpose(as->end, &end_pose);
! pmLineInit(&as->line, start_pose, end_pose);
}
else
***************
*** 1615,1619 ****
normal = as->circle.normal;
center = as->circle.center;
! pmCircleInit( &as->circle, as->start, as->end, \
center, normal, turn);
as->length=as->circle.angle* as->helixRadius;
--- 1651,1657 ----
normal = as->circle.normal;
center = as->circle.center;
! emcpose_to_pmpose(as->start, &start_pose);
! emcpose_to_pmpose(as->end, &end_pose);
! pmCircleInit( &as->circle, start_pose, end_pose,
center, normal, turn);
as->length=as->circle.angle* as->helixRadius;
***************
*** 1749,1752 ****
--- 1787,1791 ----
int turn;
PmCartesian normal, center;
+ PmPose start_pose, end_pose;
if ( sq==0 || sq->queue==0 )
***************
*** 1946,1950 ****
as->length=sqGiveLength(as->start,as->end);
as->totLength=as->length;
! pmLineInit(&as->line,as->start,as->end);
}
else
--- 1985,1991 ----
as->length=sqGiveLength(as->start,as->end);
as->totLength=as->length;
! emcpose_to_pmpose(as->start, &start_pose);
! emcpose_to_pmpose(as->end, &end_pose);
! pmLineInit(&as->line, start_pose, end_pose);
}
else
***************
*** 1954,1958 ****
normal = as->circle.normal;
center = as->circle.center;
! pmCircleInit( &as->circle, as->start, as->end, center, normal, turn);
as->length=as->circle.angle* as->helixRadius;
as->totLength= as->length;
--- 1995,2001 ----
normal = as->circle.normal;
center = as->circle.center;
! emcpose_to_pmpose(as->start, &start_pose);
! emcpose_to_pmpose(as->end, &end_pose);
! pmCircleInit(&as->circle, start_pose, end_pose, center, normal, turn);
as->length=as->circle.angle* as->helixRadius;
as->totLength= as->length;
Index: segmentqueue.h
===================================================================
RCS file: /cvsroot/emc/emc/src/emcmot/segmentqueue.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** segmentqueue.h 21 Dec 2000 16:22:11 -0000 1.3
--- segmentqueue.h 15 Aug 2003 20:00:58 -0000 1.4
***************
*** 29,32 ****
--- 29,34 ----
Modification history:
+
+ 13-Aug-2003 FMP added #include "emcpos.h" for EmcPose
8-Jun-1999 RSB added sqSetMaxFeedOverride()
8-Jun-1999 RSB changed arguments of sqInitQueue, now also the start point
***************
*** 53,56 ****
--- 55,60 ----
#include "posemath.h"
/* #include <linux/cons.h> */
+
+ #include "emcpos.h" /* EmcPose */
#define max(A,B) ( (A) > (B) ? (A) : (B))
Index: emcsegmot.c
===================================================================
RCS file: /cvsroot/emc/emc/src/emcmot/emcsegmot.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** emcsegmot.c 19 May 2002 01:02:48 -0000 1.4
--- emcsegmot.c 15 Aug 2003 20:00:58 -0000 1.5
***************
*** 1,34 ****
! #ifdef rtlinux
! #define MODULE /* make it a module for RT-Linux */
! #endif
!
/*
! emcsegmot.c
!
! Real-time motion controller
! Queued 3-axis motion planning and cubic subinterpolation.
[...8718 lines suppressed...]
! emcmotController(0);
! cur_time = etime();
! delta = cur_time - delta;
! delta = emcmotConfig->servoCycleTime - delta;
! if (delta > 0.0) {
! esleep(delta);
}
+ }
cleanup_module();
***************
*** 3086,3088 ****
}
! #endif /* not EMCMOT_NO_MAIN */
--- 6027,6029 ----
}
! #endif /* not rtlinux */
Index: Makefile
===================================================================
RCS file: /cvsroot/emc/emc/src/emcmot/Makefile,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -d -r1.38 -r1.39
*** Makefile 31 May 2003 11:12:25 -0000 1.38
--- Makefile 15 Aug 2003 20:00:59 -0000 1.39
***************
*** 699,702 ****
--- 699,704 ----
-o $@
+ seg : $(DEVP_LIB_DIR)/steppersegmod.o $(DEVP_LIB_DIR)/stgsegmod.o
+
# Mini-Tetra, stepper motors with hexapod kinematics
$(DEVP_LIB_DIR)/minitetra.o: \
|
|
From: <pr...@us...> - 2003-08-15 20:10:49
|
Update of /cvsroot/emc/emc/src/emcmot
In directory sc8-pr-cvs1:/tmp/cvs-serv26737
Modified Files:
emcsegmot.c
Log Message:
Oops, checked in the wrong version which has some compile errors. This
is the correct one.
Index: emcsegmot.c
===================================================================
RCS file: /cvsroot/emc/emc/src/emcmot/emcsegmot.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** emcsegmot.c 15 Aug 2003 20:00:58 -0000 1.5
--- emcsegmot.c 15 Aug 2003 20:01:54 -0000 1.6
***************
*** 1088,1091 ****
--- 1088,1093 ----
*/
+ static int use_tc = 1;
+
static int coord_set_cycle_time(double secs)
{
***************
*** 1120,1124 ****
}
! static int coord_add_line(PmPose pos, int id)
{
int retval;
--- 1122,1126 ----
}
! static int coord_add_line(EmcPose pos, int id)
{
int retval;
***************
*** 1134,1138 ****
}
! static int coord_add_circle(PmPose pos, PmCartesian center, PmCartesian normal, int turn, int id)
{
int retval;
--- 1136,1140 ----
}
! static int coord_add_circle(EmcPose pos, PmCartesian center, PmCartesian normal, int turn, int id)
{
int retval;
***************
*** 1142,1146 ****
retval = tpAddCircle(&emcmotDebug->queue, pos, center, normal, turn);
} else {
! retval = sqAddLine(&queue, pos, center, normal, turn, id);
}
--- 1144,1148 ----
retval = tpAddCircle(&emcmotDebug->queue, pos, center, normal, turn);
} else {
! retval = sqAddCircle(&queue, pos, center, normal, turn, id);
}
***************
*** 1205,1210 ****
static int coord_step(void)
{
- int retval;
-
if (use_tc) {
tpResume(&emcmotDebug->queue);
--- 1207,1210 ----
***************
*** 1258,1262 ****
}
! static int coord_set_pos(PmPose pos)
{
if (use_tc) {
--- 1258,1262 ----
}
! static int coord_set_pos(EmcPose pos)
{
if (use_tc) {
***************
*** 1280,1284 ****
}
! static int coord_get_pos(PmPose * pos)
{
if (use_tc) {
--- 1280,1284 ----
}
! static int coord_get_pos(EmcPose * pos)
{
if (use_tc) {
***************
*** 1363,1367 ****
/* nothing need be done for segment queue */
! return;
}
--- 1363,1367 ----
/* nothing need be done for segment queue */
! return 0;
}
***************
*** 1383,1387 ****
/* set traj planner */
! coordSetCycleTime(secs);
/* set the free planners, cubic interpolation rate and segment time */
--- 1383,1387 ----
/* set traj planner */
! coord_set_cycle_time(secs);
/* set the free planners, cubic interpolation rate and segment time */
***************
*** 2078,2082 ****
tpResume(&emcmotDebug->freeAxis[axis]);
}
! coord_resume(&emcmotDebug->queue);
emcmotStatus->paused = 0;
break;
--- 2078,2082 ----
tpResume(&emcmotDebug->freeAxis[axis]);
}
! coord_resume();
emcmotStatus->paused = 0;
break;
***************
*** 3440,3444 ****
if (! emcmotDebug->wasOnLimit) {
/* abort everything, regardless of coord or free mode */
! coord_abort()
for (axis = 0; axis < EMCMOT_MAX_AXIS; axis++) {
tpAbort(&emcmotDebug->freeAxis[axis]);
--- 3440,3444 ----
if (! emcmotDebug->wasOnLimit) {
/* abort everything, regardless of coord or free mode */
! coord_abort();
for (axis = 0; axis < EMCMOT_MAX_AXIS; axis++) {
tpAbort(&emcmotDebug->freeAxis[axis]);
|
|
From: <jmk...@us...> - 2003-08-14 04:43:12
|
Update of /cvsroot/emc/rtapi/examples/semaphore
In directory sc8-pr-cvs1:/tmp/cvs-serv13345/examples/semaphore
Modified Files:
README common.h master.c slave.c
Log Message:
Converted shared memory and semaphores from handles to IDs. Added more /proc entries. Examples work under RTAI. Still need to convert fifos.
Index: README
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/semaphore/README,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** README 8 Jul 2003 15:54:39 -0000 1.1.1.1
--- README 14 Aug 2003 04:08:26 -0000 1.2
***************
*** 2,20 ****
processes.
The master process (master.c) creates a semaphore,
'master_sem', and runs a period timer task every millisecond that
gives the semaphore and accumulates a local count of the number of
! times it has been given.
The slave process (slave.c) creates a task that blocks on the global
semaphore 'master_sem' and accumulates a local count of the number of
! times it has been taken. The slave task is not attached to a timer,
! accomplished by passing a 0 for the 'period_nsec' argument of
! rtapi_task_start() and then manually running its first occurrence by
! calling rtapi_task_resume().
Since the slave process references a global variable, 'master_sem',
declared in common.h and defined in master.c, master.o must be loaded
! before slave.o or an undefined symbol will result.
The cumulative counts are printed to the console when the tasks are
--- 2,36 ----
processes.
+ NOTE: The basic concepts of this example haven't changes since
+ this was originally written, but some details have changed.
+ See the notes below.
+
The master process (master.c) creates a semaphore,
'master_sem', and runs a period timer task every millisecond that
gives the semaphore and accumulates a local count of the number of
! times it has been given.
! NOTE: Changed to every 1 second to make prints to the kernel message
! log readable.
The slave process (slave.c) creates a task that blocks on the global
semaphore 'master_sem' and accumulates a local count of the number of
! times it has been taken.
! NOTE: The semaphore is no longer global, instead the master and
! slave share it by opening it with the same key.
!
! The slave task is not attached to a timer, accomplished by passing
! a 0 for the 'period_nsec' argument of rtapi_task_start() and then
! manually running its first occurrence by calling rtapi_task_resume().
! NOTE: The slave is still not attached to a timer. I refer to this
! as being "free-running". However the task_new and task_start api
! has changed, you no longer call task_start for a free-running task,
! instead you call task_resume only.
Since the slave process references a global variable, 'master_sem',
declared in common.h and defined in master.c, master.o must be loaded
! before slave.o or an undefined symbol will result.
! NOTE: No longer true. Since both modules open the semaphore using
! a key, they can be loaded in any order. The semaphore is not global,
! and the only thing in common.h is a #define for the key.
The cumulative counts are printed to the console when the tasks are
***************
*** 32,36 ****
order), and prints the tail of the log file to show output like this:
! Jun 24 07:28:49 letti kernel: slavetask: slave count is 1037
! Jun 24 07:28:49 letti kernel: mastertask: master count is 1048
--- 48,52 ----
order), and prints the tail of the log file to show output like this:
! Jun 24 07:28:49 letti kernel: slavetask: slave count is 1037
! Jun 24 07:28:49 letti kernel: mastertask: master count is 1048
Index: common.h
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/semaphore/common.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** common.h 23 Jul 2003 01:22:49 -0000 1.2
--- common.h 14 Aug 2003 04:08:26 -0000 1.3
***************
*** 2,6 ****
#define COMMON_H
! extern rtapi_sem_handle master_sem; /* the global semaphore */
#endif /* COMMON_H */
--- 2,6 ----
#define COMMON_H
! #define SEM_KEY 101 /* the key used to open the semaphore */
#endif /* COMMON_H */
Index: master.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/semaphore/master.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** master.c 13 Aug 2003 05:55:07 -0000 1.9
--- master.c 14 Aug 2003 04:08:26 -0000 1.10
***************
*** 9,15 ****
#include "rtapi.h"
#include "rtapi_app.h" /* rtapi_app_main,exit() */
! #include "common.h" /* master_sem decl */
! rtapi_sem_handle master_sem; /* the global semaphore */
static int master_task; /* the task ID */
static unsigned int master_count = 0;
--- 9,15 ----
#include "rtapi.h"
#include "rtapi_app.h" /* rtapi_app_main,exit() */
! #include "common.h" /* semaphore key */
! static int master_sem; /* the semaphore ID */
static int master_task; /* the task ID */
static unsigned int master_count = 0;
***************
*** 42,48 ****
/* create the semaphore */
! retval = rtapi_sem_new( &master_sem );
! if ( retval != RTAPI_SUCCESS ) {
! rtapi_print( "sem master init: rtapi_sem_new returned %d\n", retval );
return -1;
}
--- 42,48 ----
/* create the semaphore */
! master_sem = rtapi_sem_new( SEM_KEY );
! if ( master_sem < 0 ) {
! rtapi_print( "sem master init: rtapi_sem_new returned %d\n", master_sem );
return -1;
}
Index: slave.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/semaphore/slave.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** slave.c 13 Aug 2003 05:55:07 -0000 1.7
--- slave.c 14 Aug 2003 04:08:26 -0000 1.8
***************
*** 9,14 ****
#include "rtapi.h"
#include "rtapi_app.h" /* rtapi_app_main,exit() */
! #include "common.h" /* master_sem */
static int slave_task; /* the task ID */
static unsigned int slave_count = 0;
--- 9,15 ----
#include "rtapi.h"
#include "rtapi_app.h" /* rtapi_app_main,exit() */
! #include "common.h" /* semaphore key */
+ static int slave_sem; /* the semaphore ID */
static int slave_task; /* the task ID */
static unsigned int slave_count = 0;
***************
*** 19,23 ****
{
while (1) {
! rtapi_sem_take(master_sem);
slave_count++;
rtapi_print ( "slave: got sem, count = %d\n", slave_count );
--- 20,24 ----
{
while (1) {
! rtapi_sem_take(slave_sem);
slave_count++;
rtapi_print ( "slave: got sem, count = %d\n", slave_count );
***************
*** 37,40 ****
--- 38,48 ----
}
+ /* open the semaphore */
+ slave_sem = rtapi_sem_new( SEM_KEY );
+ if ( slave_sem < 0 ) {
+ rtapi_print( "sem slave init: rtapi_sem_new returned %d\n", slave_sem );
+ return -1;
+ }
+
/* set the task priority to the lowest one; the master is higher */
slave_prio = rtapi_prio_lowest();
***************
*** 76,79 ****
--- 84,92 ----
}
+ retval = rtapi_sem_delete( slave_sem );
+ if ( retval != RTAPI_SUCCESS ) {
+ rtapi_print("sem slave exit: rtapi_sem_delete returned %d\n", retval );
+ return;
+ }
rtapi_print("sem slave exit: slave count is %d\n", slave_count);
|
|
From: <jmk...@us...> - 2003-08-14 04:43:12
|
Update of /cvsroot/emc/rtapi/src/rtapi
In directory sc8-pr-cvs1:/tmp/cvs-serv13345/src/rtapi
Modified Files:
rtai_rtapi.c rtapi.h
Log Message:
Converted shared memory and semaphores from handles to IDs. Added more /proc entries. Examples work under RTAI. Still need to convert fifos.
Index: rtai_rtapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtai_rtapi.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** rtai_rtapi.c 13 Aug 2003 05:55:07 -0000 1.22
--- rtai_rtapi.c 14 Aug 2003 04:08:26 -0000 1.23
***************
*** 77,81 ****
/* These structs hold data associated with objects like tasks, etc. */
- /* Task handles are pointers to these structs. */
typedef enum { EMPTY, PAUSED, PERIODIC, FREERUN, ENDED } state_t;
--- 77,80 ----
***************
*** 87,101 ****
} task_data;
[...1147 lines suppressed...]
+
+ return RTAPI_SUCCESS;
+ }
+
+ /***********************************************************************
+ * I/O RELATED FUNCTIONS *
+ ************************************************************************/
+
+ void rtapi_outb(unsigned char byte, unsigned int port)
+ {
+ outb(byte, port);
+ }
+
+
+ unsigned char rtapi_inb(unsigned int port)
+ {
+ return inb(port);
+ }
+
+
Index: rtapi.h
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtapi.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** rtapi.h 13 Aug 2003 05:55:07 -0000 1.19
--- rtapi.h 14 Aug 2003 04:08:26 -0000 1.20
***************
*** 65,71 ****
/* SEE, it's happening... tasks are now referred to by int task id's */
! /* the others will change soon */
! typedef struct rtapi_shmem *rtapi_shmem_handle;
! typedef struct rtapi_sem *rtapi_sem_handle;
typedef struct rtapi_fifo *rtapi_fifo_handle;
--- 65,69 ----
/* SEE, it's happening... tasks are now referred to by int task id's */
! /* the others will change soon. update - only fifos are left */
typedef struct rtapi_fifo *rtapi_fifo_handle;
***************
*** 182,186 ****
* either rtapi_task_start() for periodic tasks, or rtapi_task_resume() *
* for free-running tasks. *
! * On success, returns a non-negative integer task ID. This ID is used *
* for all subsequent calls that need to act on the task. On failure, *
* returns a negative error code as listed above. *
--- 180,184 ----
* either rtapi_task_start() for periodic tasks, or rtapi_task_resume() *
* for free-running tasks. *
! * On success, returns a positive integer task ID. This ID is used *
* for all subsequent calls that need to act on the task. On failure, *
* returns a negative error code as listed above. *
***************
*** 282,309 ****
/** 'rtapi_shmem_new()' allocates a block of shared memory. 'key' *
! * identifies the memory block, all modules wishing to access the same *
! * memory must use the same key. The block will be at least 'size' *
! * bytes, and may be rounded up. Allocating many small blocks may be *
! * very wasteful. On success, '*shmemptr' becomes a handle pointing *
! * to internal data for the shared memory and is used for subsequent *
! * calls dealing with the block. Remember that '*shmemptr' points to *
! * internal data, not the actual shared memory. To get a pointer to *
! * the shared memory, pass the handle to 'rtapi_shmem_getptr()'. *
! * Returns a status code. */
!
! extern int rtapi_shmem_new(int key, unsigned long int size,
! rtapi_shmem_handle * shmemptr);
- /** 'rtapi_shmem_getptr()' sets '*ptr' to point to the start of the *
- * shared memory block 'mbuf'. Returns a status code. */
! extern int rtapi_shmem_getptr(rtapi_shmem_handle shmem, void **ptr);
! /** 'rtapi_shmem_delete()' frees the shared memory block 'mbuf'. *
! * Returns a status code. */
! extern int rtapi_shmem_delete(rtapi_shmem_handle shmem);
--- 280,304 ----
/** 'rtapi_shmem_new()' allocates a block of shared memory. 'key' *
! * identifies the memory block, and must be non-zero. All modules *
! * wishing to access the same memory must use the same key. *
! * The block will be at least 'size' bytes, and may be rounded up. *
! * Allocating many small blocks may be very wasteful. On success, it *
! * returns a positive integer ID, which is used for all subsequent *
! * calls dealing with the block. On failure it returns a negative *
! * error code. To get a pointer to the shared memory, pass the ID to *
! * 'rtapi_shmem_getptr()'. */
+ extern int rtapi_shmem_new(int key, unsigned long int size );
! /** 'rtapi_shmem_delete()' frees the shared memory block associated *
! * with 'shmem_id'. Returns a status code. */
+ extern int rtapi_shmem_delete(int shmem_id);
! /** 'rtapi_shmem_getptr()' sets '*ptr' to point to shared memory block *
! * associated with 'shmem_id'. Returns a status code. */
! extern int rtapi_shmem_getptr(int shmem_id, void **ptr);
***************
*** 312,328 ****
************************************************************************/
! /** 'rtapi_sem_new()' creates a realtime semaphore. On success, *
! * '*semptr' becomes a semaphore handle, which points to internal data *
! * for the semaphore is used for subsequent calls dealing with it. *
! * Returns a status code. */
! extern int rtapi_sem_new(rtapi_sem_handle * semptr);
/** 'rtapi_sem_delete()' is the counterpart to 'rtapi_sem_new()'. It *
! * destroys the semaphore 'sem'. Any tasks blocked on 'sem' will *
! * resume execution. Returns a status code. */
! extern int rtapi_sem_delete(rtapi_sem_handle sem);
--- 307,325 ----
************************************************************************/
! /** 'rtapi_sem_new()' creates a realtime semaphore. 'key' identifies *
! * identifies the semaphore, and must be non-zero. All modules wishing *
! * to use the same semaphore must specify the same key. On success, it *
! * returns a positive integer ID, which is used for all subsequent *
! * calls dealing with the semaphore. On failure it returns a negative *
! * error code. */
! extern int rtapi_sem_new(int key);
/** 'rtapi_sem_delete()' is the counterpart to 'rtapi_sem_new()'. It *
! * discards the semaphore associated with 'sem_id'. Any tasks blocked *
! * on 'sem' will resume execution. Returns a status code. */
! extern int rtapi_sem_delete(int sem_id);
***************
*** 331,335 ****
* higher priority task will begin to run. Returns a status code. */
! extern int rtapi_sem_give(rtapi_sem_handle sem);
--- 328,332 ----
* higher priority task will begin to run. Returns a status code. */
! extern int rtapi_sem_give(int sem_id);
***************
*** 339,343 ****
* until the semaphore is unlocked, then it returns RTAPI_SUCCESS. */
! extern int rtapi_sem_take(rtapi_sem_handle sem);
--- 336,340 ----
* until the semaphore is unlocked, then it returns RTAPI_SUCCESS. */
! extern int rtapi_sem_take(int sem_id);
***************
*** 348,352 ****
* decide how to deal with the situation. */
! extern int rtapi_sem_try(rtapi_sem_handle sem);
--- 345,349 ----
* decide how to deal with the situation. */
! extern int rtapi_sem_try(int sem_id);
|
|
From: <jmk...@us...> - 2003-08-14 04:23:56
|
Update of /cvsroot/emc/rtapi/examples/timertask
In directory sc8-pr-cvs1:/tmp/cvs-serv13345/examples/timertask
Modified Files:
timertask.c
Log Message:
Converted shared memory and semaphores from handles to IDs. Added more /proc entries. Examples work under RTAI. Still need to convert fifos.
Index: timertask.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/timertask/timertask.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** timertask.c 13 Aug 2003 05:55:07 -0000 1.10
--- timertask.c 14 Aug 2003 04:08:26 -0000 1.11
***************
*** 89,98 ****
/* Remove the task from the list */
! /* TESTING - intentionally skip the task_delete
retval = rtapi_task_delete(timer_task);
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("timertask exit: rtapi_task_delete returned %d\n", retval );
return;
! }*/
/* Print the final count just to show that the task did it's job */
--- 89,98 ----
/* Remove the task from the list */
! /* TESTING - intentionally skip the task_delete */
retval = rtapi_task_delete(timer_task);
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("timertask exit: rtapi_task_delete returned %d\n", retval );
return;
! }
/* Print the final count just to show that the task did it's job */
|
|
From: <jmk...@us...> - 2003-08-14 04:17:19
|
Update of /cvsroot/emc/rtapi/examples/shmem
In directory sc8-pr-cvs1:/tmp/cvs-serv13345/examples/shmem
Modified Files:
shmemtask.c
Log Message:
Converted shared memory and semaphores from handles to IDs. Added more /proc entries. Examples work under RTAI. Still need to convert fifos.
Index: shmemtask.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/shmem/shmemtask.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** shmemtask.c 13 Aug 2003 05:55:07 -0000 1.8
--- shmemtask.c 14 Aug 2003 04:08:26 -0000 1.9
***************
*** 10,14 ****
static int shmem_task; /* the task ID*/
! static rtapi_shmem_handle shmem_mem; /* the shared memory area */
enum { SHMEM_PERIOD_NSEC = 1000000 }; /* timer period, in nanoseconds */
enum { SHMEM_STACKSIZE = 1024 }; /* how big the stack is */
--- 10,14 ----
static int shmem_task; /* the task ID*/
! static int shmem_mem; /* the shared memory ID */
enum { SHMEM_PERIOD_NSEC = 1000000 }; /* timer period, in nanoseconds */
enum { SHMEM_STACKSIZE = 1024 }; /* how big the stack is */
***************
*** 41,47 ****
/* allocate and initialize the shared memory structure */
! retval = rtapi_shmem_new( key, sizeof(SHMEM_STRUCT), &shmem_mem );
! if ( retval != RTAPI_SUCCESS ) {
! rtapi_print( "shmemtask init: rtapi_shmem_new returned %d\n", retval );
return -1;
}
--- 41,47 ----
/* allocate and initialize the shared memory structure */
! shmem_mem = rtapi_shmem_new( key, sizeof(SHMEM_STRUCT) );
! if ( shmem_mem < 0 ) {
! rtapi_print( "shmemtask init: rtapi_shmem_new returned %d\n", shmem_mem );
return -1;
}
|
|
From: <ray...@us...> - 2003-08-13 21:30:37
|
Update of /cvsroot/emc/documents/lyx In directory sc8-pr-cvs1:/tmp/cvs-serv16707 Modified Files: User_BDI_Install.lyx Log Message: added dual boot and more on live Index: User_BDI_Install.lyx =================================================================== RCS file: /cvsroot/emc/documents/lyx/User_BDI_Install.lyx,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** User_BDI_Install.lyx 21 Jul 2003 13:15:02 -0000 1.4 --- User_BDI_Install.lyx 13 Aug 2003 21:24:29 -0000 1.5 *************** *** 89,100 **** this distribution. This is the greatest advantage of the 2.xx series. ! It will run well on very old very slow computers. \layout Standard ! It's biggest limitation is in the graphical interface stuff which will seem ! a bit dated if you are acustomed to state of the art systems. ! A second limitation for2.xx is that it was set up for hardware a couple of years ago. This means that it is limited in the kinds of devices that it will recognize. \layout Standard --- 89,104 ---- this distribution. This is the greatest advantage of the 2.xx series. ! It will run well on very old very slow computers as long as they have a ! pentium processor. \layout Standard ! The biggest limitation of the 2.xx series is in the graphical interface stuff ! which will seem a bit dated if you are acustomed to state of the art systems. ! A second limitation for 2.xx is that it was set up for hardware a couple of years ago. This means that it is limited in the kinds of devices that it will recognize. + This is most often true for the newest on-board graphics and network drivers. + If you have these, the basic install will go okay but you will have to + cast about the web to find drivers for them. \layout Standard *************** *** 123,130 **** will be more than you need. With it you will get some of the features that you may want for networking ! and for browsing about the web. You should think of the TNG as an experimental version rather than one intended for the single task of making a machine move. ! You should also think that this version may not be kept up to date. \layout Subsection --- 127,142 ---- will be more than you need. With it you will get some of the features that you may want for networking ! and for browsing the web. You should think of the TNG as an experimental version rather than one intended for the single task of making a machine move. ! You should also know before you purchase it, that this version may not ! be kept up to date. ! As of March 2003, Paul has indicated that he will probably not be maintaining ! it any more than it was at that time. ! We may make updates rpms available for the emc and rcslib portions of this ! release. ! These will be held in the dropbox at linuxcnc.org and will be named TNG-(emc ! or rcslib)-update(datecode).rpm. ! Source will also be available as .s.rpm. \layout Subsection *************** *** 150,158 **** \layout Standard ! To run from the CD you pop in in the cd drive and reboot your computer. ! It will start up Linux, a simple window manager, and the EMC without doing ! anything to your computer. ! The only big requirement is that your computer be able to boot from a CDROM ! device. \layout Section --- 162,168 ---- \layout Standard ! The most recent copies of this include some ways to customize it so that ! you can use one of these for a specific machine. ! \layout Section *************** *** 387,392 **** BDI Live will boot and run an EMC from the CDROM device if your computer will boot from CD. ! This mode of operation requires not space on a hard drive and does not ! alter the installation of any other OS on the computer. \layout Standard --- 397,402 ---- BDI Live will boot and run an EMC from the CDROM device if your computer will boot from CD. ! This mode of operation requires no space on a hard drive and does not alter ! the installation of any other OS on the computer. \layout Standard *************** *** 394,398 **** you to edit the INI and RUN files and save VAR and TBL values. The addition of these directories to your hard drive do not alter the proper ! operation of any other OS on that hard drive. \layout Section --- 404,577 ---- you to edit the INI and RUN files and save VAR and TBL values. The addition of these directories to your hard drive do not alter the proper ! operation of any other OS used for that hard drive. ! \layout Subsection ! ! Boot Options ! \layout Standard ! ! At boot you have the possibility to enter bootoptions. ! First you specify a label: ! \layout Description ! ! morphix This is the default way of booting morphix. ! ! \layout Description ! ! morphix-ide which disables ide-scsi if you have problems with reading from ! a cdrom burner of this type. ! \layout Description ! ! fb1024x768 To use fixed framebuffer graphics of this resolution ! \layout Description ! ! fb800x600 To use fixed framebuffer graphics at this resolution ! \layout Description ! ! expert Expert lets you configure your hardware interactively. ! Then you specify zero or more of the following options, like so: morphix ! wheelmouse screen=1280x1024 ! \layout Standard ! ! The expert bootoptions: ! \layout Description ! ! wheelmouse Enable wheelmouse support ! \layout Description ! ! forceusb=yes Forces USB to be loaded, fixes certain USB problems. ! \layout Description ! ! lang=us / lang=bg|be|ch|cn|cs|cz|da|de|dk|es|fi|fr|it|ja|nl|pl|ru|sk|tr|tw|uk|us ! might not work for everyone ! \layout Description ! ! keyboard=us loads keymap for a certain language as above. ! \layout Standard ! ! console keyboard boot options ! \layout Description ! ! xkeyboard=us X keyboard ! \layout Description ! ! screen=1280x1024 Define XFree resolution (1600x1200 etc) ! \layout Description ! ! depth=24 Define XFree colordepth ! \layout Description ! ! xvrefresh=60 Set vertical refresh rate ! \layout Description ! ! hsync=60 Set horizontal sync rate (not tested) ! \layout Description ! ! xmodule=ati|radeon|fbdev|vesa|savage|s3|nv|i810|mga|svga|tseng Define XFree ! v4 module ! \layout Description ! ! 2 Runlevel 2, doesn't load mainmodules, debugging. ! \layout Description ! ! floppyconfig start "morphix.sh" from floppydisk ! \layout Description ! ! no?? noapic noagp noapm nodma nomce nofirewire nopcmcia noscsi noswap nousb ! nosmp noaudio Skips loading of item ! \layout Description ! ! pci=biosirq Will force the use of the BIOS assigned Interrupt ReQuests on ! the PCI bus. ! Possible cure for non-functioning hardware. ! Very handy for unruly IRQ conflicts. ! Look at dmesg and cat /proc/pci to find out if you have any such troubles. ! \layout Description ! ! gmt|uce Hardware clock is set to GMT/UCE. ! \layout Description ! ! home=scan Set home directory. ! 'scan' will search for morphix.img in the root of all partitions. ! Be carefull when creating the home-dir, Do NOT use the entire partition ! unless you know what you are doing. ! Other options could be, home=/dev/hda1 home=/mnt/hda1. ! \layout Description ! ! vga=normal Boot without vesa-framebuffer. ! This is default, for the 'old' bootscreen use vga=791 ! \layout Description ! ! alsa attempts to autodetect alsa ! \layout Description ! ! alsa=alsa-module attempts to load a soundcard with this alsa module. ! \layout Description ! ! home=/dev/device / home=/mnt/device / home=scan Attempts to load the persistanth ! ome from fat/ext2/ext3/reiser/xfs device. ! \layout Description ! ! floppyconfig Starts the morphix.sh file from floppy during boottime, for ! quick&dirty hacks. ! ! \layout Description ! ! blocktrans=yes Keeps translucency from being loaded, debugging only (your ! system won't correctly boot X with this option) ! \layout Description ! ! testcd Checks if the CD was burned correctly. ! \layout Description ! ! newx11 Tries to detect different modelines for X, up for testing. ! \layout Description ! ! toram Tries to copy the cdrom to ram at boottime, up for testing. ! Takes a while to copy to ram, limited by speed of cd/dvd. ! ! \layout Description ! ! tohd=hda1 Tries to copy the cdrom to harddisk, a "poor man's installer", ! for when there is enough harddisk space but not enough ram to boot, for ! speeding up. ! up for testing. ! \layout Description ! ! fromhd=hda1 Boots from a system setup using tohd. ! \layout Description ! ! modules-disk This patch adds the interactive functionality like known from ! expert mode to insert a disk with modules to find KNOPPIX-Image, but unlike ! expert mode this has only effect on linuxrc and knoppix-autoconfig runs ! automatically ...". ! Use at your own risk ;) ! \layout Standard ! ! Booting with "morphix-ide" might help those that have had trouble booting ! in the past. ! If this works for the majority, then we will make it the default. ! The current default uses SCSI emulation for the CD-ROM drive which can ! cause a few problems. ! \layout Standard ! ! Also supported is custom ini, var, tbl, and nml files - If any emc.* are ! found in /cdrom/emc, these are copied across to /usr/local/emc and added ! to the menu list. ! N.B. ! ini files *must* be run with "generic.run -ini foo.ini" due in part to the ! BDI-Live changes to the run scripts. ! The Menu & tool bar entries use a name extracted from the MACHINE variable ! within the emc.ini. ! Any files found in /cdrom/emc/programs will be copied across to /usr/local/emc/ ! programs where they will be accessable by the usual methods. ! Also included is the ability to run a customisation script so that menus, ! icons, etc, can be modified to suit a target customer. ! dos2unix has been added just in case any files have been edited on a Windows ! box and the CD has been remastered with MagicISO (or similar Win software). ! \layout Standard ! ! The customising script can be used to modify the menu/tool bar, replace ! icons, or secretly install Linux on the host box. ! \layout Section *************** *** 408,411 **** --- 587,904 ---- (add this and include the lilo problems for the early release candidates) + \layout Standard + + BDI Install Guide + \layout Section + + Dual boot Introduction + \begin_float footnote + \layout Standard + + This section is a copyright work of Sagar Behere, July 2003. + This document is released under the GNU Free Documentation License. + See Appendex for detail. + + \emph on + be...@sa... + \end_float + \layout Standard + + First of all, the title is a misnomer. + BDI stands for + \emph on + brain dead install + \emph default + so you shouldn't need a guide to its installation. + However, there are times when you want a BDI install to coexist with your + existing GNU/Linux or Microsoft installations. + At such times it takes a little tweaking to boot BDI smoothly. + This document explains the procedure. + \layout Standard + + Firstly, backup everything critical. + It is extremely improbable that there will be data loss due to something + going wrong, but still, it is preferable to err on the side of caution. + Data will be safe, but your PC may not boot. + This is often enough to throw people into violent fits of panic. + I mention it here to reassure you that in case something goes wrong (unlikely), + your data is still there :-) + \layout Standard + + People will boot into their OS of choice, normally through one of the following + four methods: LILO, Loadlin, GRUB or a third party boot loader. + I have no experience with the last two, so we'll concentrate on the rest. + + \layout Standard + + Throughout this document I'll be assuming that you have either Microsoft + Windows 95/98 and/or GNU/Linux already installed. + \layout Subsection + + The BDI install + \layout Standard + + Make a separate partition to install BDI on. + It does not matter if this partition is on a separate disk, primary or + logical. + (If you don't know what this means, you don't need to bother with it) A + partition size of about 2.5 GB should be safe for almost all installs. + Now install the BDI as you would install any regular GNU/Linux distribution, + with the exception that if you already have some version of GNU/Linux, + you should not install LILO. + \layout Standard + + IMPORTANT: + \series bold + DO *NOT* INSTALL LILO IF YOU ALREADY HAVE GNU/LINUX INSTALLED!!! + \layout Standard + + Not installing LILO can be achieved by un-checking a box on the same screen + where it asks you if you want to install LILO on the MBR or on another + partition. + \layout Standard + + If you have only MS Windows installed, then you should install LILO into + the MBR. + \layout Standard + + Choose your packages, setup the video and complete the installation. + \layout Subsection + + Booting the BDI + \layout Standard + + A little theory here. + \layout Standard + + At this point, you have installed BDI onto your hard disk, but you lack + the ability to boot into it. + When your PC boots, here is what actually happens. + A small program called the boot loader looks around for a + \emph on + kernel + \emph default + . + The kernel is the core of the operating system. + When you say + \begin_inset Quotes eld + \end_inset + + linux + \begin_inset Quotes erd + \end_inset + + , you are (should be) referring to this kernel. + Now, once the boot loader chooses a kernel, it loads this into memory and + then all kinds of interesting things happen, until you find yourself staring + at a login screen. + When you installed the BDI, you got a kernel which is to be used along + with it. + However, you have not yet told your boot-loader where this kernel is and + how it should be loaded. + \layout Standard + + The technique for instructing the various boot-loaders will now be covered. + \layout Subsubsection + + LILO + \layout Standard + + LILO stands for LInux LOader. + The name is deceptive. + LILO can also boot other operating systems, like MS windows. + If you have GNU/Linux installed, you might be using LILO to boot into it, + or your windows installation. + The configuration file '/etc/lilo.conf' decides how LILO behaves. + The file will have a section like + \layout LyX-Code + + image=/boot/vmlinuz + \layout LyX-Code + + label=linux + \layout LyX-Code + + read-only + \layout LyX-Code + + root=/dev/hda6 + \layout Standard + + The image= line tells LILO where the kernel is located. + In this case, the kernel is the file + \begin_inset Quotes eld + \end_inset + + vmlinuz + \begin_inset Quotes erd + \end_inset + + , in the /boot directory. + (If you check out this file, you might find that it is a link to another + file. + That's quite alright). + The label= field decides what text is displayed at the LILO prompt. + + \begin_inset Quotes eld + \end_inset + + read-only + \begin_inset Quotes erd + \end_inset + + means that the / partition should initially be loaded in read-only mode. + We need not go into the reason for this, but it is essential. + The root= line specifies the root (/) partition which the kernel should + work with. + There can be a number of sections like this, one for each kernel you have. + \layout Standard + + Can you now guess how to make the BDI work with LILO? Its simple. + \layout Standard + + You need to tell LILO where the BDI kernel is. + So get a copy of the BDI kernel and copy it some place where LILO can find + it. + For example, copy it into the /boot directory of your current GNU/Linux + installation. + To do this, you'll have to access the partition where BDI is installed, + grab its kernel from there, and copy it to /boot. + Lets assume that BDI is installed on /dev/hda7. + So + \layout LyX-Code + + # mkdir /bdi + \layout LyX-Code + + # mount /dev/hda7 /bdi + \layout LyX-Code + + # cp -v /bdi/boot/vmlinuz-x.x.xxx-xxx /boot/bdi + \layout LyX-Code + + # umount /bdi + \layout LyX-Code + + # rmdir /bdi + \layout Standard + + Here, vmlinuz-x.x.xxx-xxx is the file to which /bdi/boot/vmlinuz points to. + For example, in BDI-2.18, it is vmlinuz-2.2.18-rtl3.0. + The file /boot/bdi is your required kernel, and its root partition is /dev/hda7. + Now add a section like the one below into your /etc/lilo.conf (back it up + first) + \layout LyX-Code + + image=/boot/bdi + \layout LyX-Code + + label=BDI + \layout LyX-Code + + read-only + \layout LyX-Code + + root=/dev/hda7 + \layout Standard + + Now, you have to make LILO read the configuration file and understand the + new settings. + So run the command + \layout LyX-Code + + # /sbin/lilo -v + \layout Standard + + The next time you boot, you'll see a label + \begin_inset Quotes eld + \end_inset + + BDI + \begin_inset Quotes erd + \end_inset + + . + Hitting it will take you to the BDI. + \layout Subsubsection + + Loadlin + \layout Standard + + Loadlin is a DOS based program that is used to boot the linux kernel. + If you are using Loadlin, you must be already proficient in its use. + Simply copy the BDI kernel into your DOS dir, and use a command like + \layout LyX-Code + + loadlin bdi root=/dev/hda7 + \layout Subsection + + If something goes wrong + \layout Standard + + Ok. + Something happened and the system won't boot anymore. + It happens to all of us. + The important thing is not to panic. + Go get a coffee or take a walk. + Come back when you are calm once again :-) + \layout Standard + + If you only had windows previously, then use its boot disk (you have one, + don't you?) or boot from the Windows CD and at the command prompt type + + \layout LyX-Code + + c:> fdisk /mbr + \layout Standard + + This will return things to their normal state. + \layout Standard + + Or, you might have GNU/Linux previously installed, and now LILO fails to + boot into any OS. + \layout Standard + + In this case, boot into the first install CD (or the BDI CD) and go into + rescue mode when you reach a prompt. + Booting into rescue mode is pretty simple. + Instructions are given on the screen. + Most of the times, it is simply a matter of typing + \layout LyX-Code + + linux rescue + \layout Standard + + at the prompt. + \layout Standard + + Once into rescue mode, you'll land up at a shell. + Mount your original GNU/Linux / partition, chroot to it, replace the lilo.conf + with your back up version and rerun LILO. + \layout LyX-Code + + # mkdir /foo + \layout LyX-Code + + # mount /dev/hda6 /foo + \layout LyX-Code + + # chroot /foo + \layout LyX-Code + + # mv -v /backup/of/lilo.conf /etc/lilo.conf + \layout LyX-Code + + # /sbin/lilo -v + \layout LyX-Code + + # <press ctrl+D> + \layout LyX-Code + + # reboot + \layout Standard + + This will restore LILO to its original state. + Read this section once again, determine what went wrong, and try again. \layout Section *************** *** 487,491 **** \layout Standard ! This sort of failure is normall do to a miss match between the speed at which your computer can run and the speed that is computed from a couple of the variables in the ini file. --- 980,986 ---- \layout Standard ! You're jumping way ahead here. ! The full answers are a part of the setup that you will do in chapter ???. ! This sort of failure is normall do to a miss match between the speed at which your computer can run and the speed that is computed from a couple of the variables in the ini file. *************** *** 494,503 **** Try to run sim.run script and if that's ok, use that .ini file as base for your own ini-file. ! Later on we'll put couple of working ini-files here. ! For now, you can find them from ! \begin_inset LatexCommand \htmlurl[http://www.linuxcnc.org/dropbox]{http://www.linuxcnc.org/dropbox} ! ! \end_inset ! ! \the_end --- 989,992 ---- Try to run sim.run script and if that's ok, use that .ini file as base for your own ini-file. ! \the_end |
|
From: <jmk...@us...> - 2003-08-13 06:06:05
|
Update of /cvsroot/emc/rtapi/examples/timertask
In directory sc8-pr-cvs1:/tmp/cvs-serv29419/examples/timertask
Modified Files:
Makefile timertask.c
Log Message:
major changes to tasks API. Task IDs are now ints, not pointers. More changes on the way. RTAI builds and examples work. RTLinux and sim will be updated once rtai is done.
Index: Makefile
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/timertask/Makefile,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Makefile 10 Aug 2003 21:13:04 -0000 1.4
--- Makefile 13 Aug 2003 05:55:07 -0000 1.5
***************
*** 32,33 ****
--- 32,36 ----
# DO NOT DELETE
+
+ /home/John/emcdev/rtapi/rtlib/timertask.o: /home/John/emcdev/rtapi/include/rtapi.h
+ /home/John/emcdev/rtapi/rtlib/timertask.o: /home/John/emcdev/rtapi/include/rtapi_app.h
Index: timertask.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/timertask/timertask.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** timertask.c 11 Aug 2003 04:58:39 -0000 1.9
--- timertask.c 13 Aug 2003 05:55:07 -0000 1.10
***************
*** 9,14 ****
#include "rtapi_app.h" /* rtapi_app_main,exit() */
! static rtapi_task_handle timer_task; /* the task */
! static int timer_count = 0; /* the output variable */
enum { TIMER_PERIOD_NSEC = 1000000 }; /* timer period, in nanoseconds */
enum { TASK_PERIOD_NSEC = 1000000 }; /* task period, in nanoseconds */
--- 9,14 ----
#include "rtapi_app.h" /* rtapi_app_main,exit() */
! static int timer_task; /* the task ID */
! static int timer_count = 0; /* the output variable */
enum { TIMER_PERIOD_NSEC = 1000000 }; /* timer period, in nanoseconds */
enum { TASK_PERIOD_NSEC = 1000000 }; /* task period, in nanoseconds */
***************
*** 53,73 ****
/* create the timer task */
! /* the address of the pointer needs to be passed rather than it's value */
! retval = rtapi_task_new( &timer_task );
!
! if ( retval != RTAPI_SUCCESS ) {
/* See rtapi.h for the error codes returned */
! rtapi_print( "timertask init: rtapi_task_new returned %d\n", retval );
return -1;
}
!
! /* the third arg is an abitrary int that is passed to the timer task
! on the first iterration */
!
! retval = rtapi_task_start( timer_task, timer_code,
! 0, timer_prio,
! TIMER_STACKSIZE,
! TASK_PERIOD_NSEC, RTAPI_NOW,
! RTAPI_NO_FP );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("timertask init: rtapi_task_start returned %d\n", retval );
--- 53,67 ----
/* create the timer task */
! /* the second arg is an abitrary int that is passed to the timer task
! on the first iterration */
! timer_task = rtapi_task_new(timer_code, 0 /* arg */, timer_prio,
! TIMER_STACKSIZE, RTAPI_NO_FP );
! if ( timer_task < 0 ) {
/* See rtapi.h for the error codes returned */
! rtapi_print( "timertask init: rtapi_task_new returned %d\n", timer_task );
return -1;
}
! /* start the task running */
! retval = rtapi_task_start( timer_task, TASK_PERIOD_NSEC, RTAPI_NOW );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("timertask init: rtapi_task_start returned %d\n", retval );
***************
*** 88,94 ****
/* Stop the task */
! retval = rtapi_task_stop(timer_task);
if ( retval != RTAPI_SUCCESS ) {
! rtapi_print("timertask exit: rtapi_task_stop returned %d\n", retval );
return;
}
--- 82,88 ----
/* Stop the task */
! retval = rtapi_task_pause(timer_task);
if ( retval != RTAPI_SUCCESS ) {
! rtapi_print("timertask exit: rtapi_task_pause returned %d\n", retval );
return;
}
***************
*** 96,100 ****
/* TESTING - intentionally skip the task_delete
! retval = rtapi_task_delete( timer_task );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("timertask exit: rtapi_task_delete returned %d\n", retval );
--- 90,94 ----
/* TESTING - intentionally skip the task_delete
! retval = rtapi_task_delete(timer_task);
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("timertask exit: rtapi_task_delete returned %d\n", retval );
|
|
From: <jmk...@us...> - 2003-08-13 06:06:01
|
Update of /cvsroot/emc/rtapi/examples/fifo
In directory sc8-pr-cvs1:/tmp/cvs-serv29419/examples/fifo
Modified Files:
Makefile fifotask.c
Log Message:
major changes to tasks API. Task IDs are now ints, not pointers. More changes on the way. RTAI builds and examples work. RTLinux and sim will be updated once rtai is done.
Index: Makefile
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/fifo/Makefile,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Makefile 10 Aug 2003 21:13:03 -0000 1.4
--- Makefile 13 Aug 2003 05:55:07 -0000 1.5
***************
*** 50,56 ****
--- 50,62 ----
# DO NOT DELETE
+ /home/John/emcdev/rtapi/lib/fifotask.o: /home/John/emcdev/rtapi/include/rtapi.h
+ /home/John/emcdev/rtapi/lib/fifotask.o: /home/John/emcdev/rtapi/include/rtapi_app.h
/home/John/emcdev/rtapi/lib/fifotask.o: common.h
+ /home/John/emcdev/rtapi/lib/fifousr.o: /home/John/emcdev/rtapi/include/ulapi.h
/home/John/emcdev/rtapi/lib/fifousr.o: common.h
+ /home/John/emcdev/rtapi/rtlib/fifotask.o: /home/John/emcdev/rtapi/include/rtapi.h
+ /home/John/emcdev/rtapi/rtlib/fifotask.o: /home/John/emcdev/rtapi/include/rtapi_app.h
/home/John/emcdev/rtapi/rtlib/fifotask.o: common.h
+ /home/John/emcdev/rtapi/rtlib/fifousr.o: /home/John/emcdev/rtapi/include/ulapi.h
/home/John/emcdev/rtapi/rtlib/fifousr.o: common.h
Index: fifotask.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/fifo/fifotask.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** fifotask.c 11 Aug 2003 04:58:39 -0000 1.13
--- fifotask.c 13 Aug 2003 05:55:07 -0000 1.14
***************
*** 9,13 ****
#include "common.h" /* FIFO_KEY */
! static rtapi_task_handle fifo_task = 0; /* the task structure */
static rtapi_fifo_handle fifo;
enum { TIMER_PERIOD_NSEC = 10000000 }; /* timer period, in nanoseconds */
--- 9,13 ----
#include "common.h" /* FIFO_KEY */
! static int fifo_task; /* the task ID */
static rtapi_fifo_handle fifo;
enum { TIMER_PERIOD_NSEC = 10000000 }; /* timer period, in nanoseconds */
***************
*** 82,97 ****
fifo_prio = rtapi_prio_lowest();
! /* launch the fifo task */
! retval = rtapi_task_new(&fifo_task);
! if (retval != RTAPI_SUCCESS) {
! rtapi_print("fifotask init: rtapi_task_new failed with %d\n", retval);
goto no_task;
}
/* start the fifo task */
! retval = rtapi_task_start(fifo_task, fifo_code,
! 0, fifo_prio,
! FIFO_STACKSIZE, FIFO_PERIOD_NSEC, RTAPI_NOW,
! RTAPI_NO_FP);
if (retval != RTAPI_SUCCESS) {
rtapi_print("fifotask init: rtapi_task_start failed with %d\n", retval);
--- 82,95 ----
fifo_prio = rtapi_prio_lowest();
! /* create the fifo task */
! fifo_task = rtapi_task_new(fifo_code, 0 /* arg */, fifo_prio,
! FIFO_STACKSIZE, RTAPI_NO_FP );
! if (fifo_task < 0) {
! rtapi_print("fifotask init: rtapi_task_new failed with %d\n", fifo_task);
goto no_task;
}
/* start the fifo task */
! retval = rtapi_task_start(fifo_task, FIFO_PERIOD_NSEC, RTAPI_NOW);
if (retval != RTAPI_SUCCESS) {
rtapi_print("fifotask init: rtapi_task_start failed with %d\n", retval);
***************
*** 117,121 ****
int retval;
! retval = rtapi_task_stop(fifo_task);
if (retval != RTAPI_SUCCESS) {
rtapi_print("fifotask exit: rtapi_task_stop failed with %d\n", retval);
--- 115,119 ----
int retval;
! retval = rtapi_task_pause(fifo_task);
if (retval != RTAPI_SUCCESS) {
rtapi_print("fifotask exit: rtapi_task_stop failed with %d\n", retval);
|
|
From: <jmk...@us...> - 2003-08-13 06:06:01
|
Update of /cvsroot/emc/rtapi/examples/shmem
In directory sc8-pr-cvs1:/tmp/cvs-serv29419/examples/shmem
Modified Files:
Makefile shmemtask.c
Log Message:
major changes to tasks API. Task IDs are now ints, not pointers. More changes on the way. RTAI builds and examples work. RTLinux and sim will be updated once rtai is done.
Index: Makefile
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/shmem/Makefile,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Makefile 10 Aug 2003 21:13:04 -0000 1.4
--- Makefile 13 Aug 2003 05:55:07 -0000 1.5
***************
*** 50,56 ****
--- 50,62 ----
# DO NOT DELETE
+ /home/John/emcdev/rtapi/lib/shmemtask.o: /home/John/emcdev/rtapi/include/rtapi.h
+ /home/John/emcdev/rtapi/lib/shmemtask.o: /home/John/emcdev/rtapi/include/rtapi_app.h
/home/John/emcdev/rtapi/lib/shmemtask.o: common.h
+ /home/John/emcdev/rtapi/lib/shmemusr.o: /home/John/emcdev/rtapi/include/ulapi.h
/home/John/emcdev/rtapi/lib/shmemusr.o: common.h
+ /home/John/emcdev/rtapi/rtlib/shmemtask.o: /home/John/emcdev/rtapi/include/rtapi.h
+ /home/John/emcdev/rtapi/rtlib/shmemtask.o: /home/John/emcdev/rtapi/include/rtapi_app.h
/home/John/emcdev/rtapi/rtlib/shmemtask.o: common.h
+ /home/John/emcdev/rtapi/rtlib/shmemusr.o: /home/John/emcdev/rtapi/include/ulapi.h
/home/John/emcdev/rtapi/rtlib/shmemusr.o: common.h
Index: shmemtask.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/shmem/shmemtask.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** shmemtask.c 11 Aug 2003 04:58:39 -0000 1.7
--- shmemtask.c 13 Aug 2003 05:55:07 -0000 1.8
***************
*** 9,13 ****
#include "common.h" /* shmem structure, SHMEM_KEY */
! static rtapi_task_handle shmem_task; /* the task */
static rtapi_shmem_handle shmem_mem; /* the shared memory area */
enum { SHMEM_PERIOD_NSEC = 1000000 }; /* timer period, in nanoseconds */
--- 9,13 ----
#include "common.h" /* shmem structure, SHMEM_KEY */
! static int shmem_task; /* the task ID*/
static rtapi_shmem_handle shmem_mem; /* the shared memory area */
enum { SHMEM_PERIOD_NSEC = 1000000 }; /* timer period, in nanoseconds */
***************
*** 17,21 ****
static SHMEM_STRUCT *shmem_struct = 0;
! /* task code, executed each timer interrupt */
void shmem_code ( int arg )
{
--- 17,21 ----
static SHMEM_STRUCT *shmem_struct = 0;
! /* task code, executed periodically */
void shmem_code ( int arg )
{
***************
*** 65,80 ****
/* create the shmem task */
! retval = rtapi_task_new( &shmem_task );
! if ( retval != RTAPI_SUCCESS ) {
! rtapi_print( "shmemtask init: rtapi_task_new returned %d\n", retval );
return -1;
}
/* start the shmem task */
! retval = rtapi_task_start( shmem_task, shmem_code,
! 0, shmem_prio,
! SHMEM_STACKSIZE,
! SHMEM_PERIOD_NSEC, RTAPI_NOW,
! RTAPI_NO_FP );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("shmemtask init: rtapi_task_start returned %d\n", retval );
--- 65,77 ----
/* create the shmem task */
! shmem_task = rtapi_task_new(shmem_code, 0 /* arg */, shmem_prio,
! SHMEM_STACKSIZE, RTAPI_NO_FP );
! if ( shmem_task < 0 ) {
! rtapi_print( "shmemtask init: rtapi_task_new returned %d\n", shmem_task );
return -1;
}
/* start the shmem task */
! retval = rtapi_task_start( shmem_task, SHMEM_PERIOD_NSEC, RTAPI_NOW );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("shmemtask init: rtapi_task_start returned %d\n", retval );
***************
*** 96,100 ****
}
! retval = rtapi_task_stop( shmem_task );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("shmemtask exit: rtapi_task_stop returned %d\n", retval );
--- 93,97 ----
}
! retval = rtapi_task_pause( shmem_task );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("shmemtask exit: rtapi_task_stop returned %d\n", retval );
***************
*** 106,115 ****
return;
}
! /* TESTING - intentionally skip the shmem_delete
retval = rtapi_shmem_delete( shmem_mem );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("shmemtask exit: rtapi_shmem_delete returned %d\n", retval );
return;
! }*/
/* Clean up and exit */
rtapi_exit();
--- 103,112 ----
return;
}
! /* TESTING - intentionally skip the shmem_delete */
retval = rtapi_shmem_delete( shmem_mem );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("shmemtask exit: rtapi_shmem_delete returned %d\n", retval );
return;
! }
/* Clean up and exit */
rtapi_exit();
|
|
From: <jmk...@us...> - 2003-08-13 06:06:00
|
Update of /cvsroot/emc/rtapi/src/rtapi
In directory sc8-pr-cvs1:/tmp/cvs-serv29419/src/rtapi
Modified Files:
Makefile rtai_rtapi.c rtapi.h
Log Message:
major changes to tasks API. Task IDs are now ints, not pointers. More changes on the way. RTAI builds and examples work. RTLinux and sim will be updated once rtai is done.
Index: Makefile
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/Makefile,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Makefile 19 Jul 2003 02:17:41 -0000 1.3
--- Makefile 13 Aug 2003 05:55:07 -0000 1.4
***************
*** 9,14 ****
rtl_rtapi.c \
rtl_ulapi.c \
! sim_rtapi.c \
! sim_ulapi.c
HEADERS = \
--- 9,15 ----
rtl_rtapi.c \
rtl_ulapi.c \
! # TEMPORARY - not making the sim right now
! #sim_rtapi.c \
! #sim_ulapi.c
HEADERS = \
***************
*** 19,24 ****
OBJS = \
! $(LIB_DIR)/sim_rtapi.o \
! $(LIB_DIR)/sim_ulapi.o
# no LIBS, BINS yet
--- 20,26 ----
OBJS = \
! # TEMPORARY - not making the sim right now
! #$(LIB_DIR)/sim_rtapi.o \
! #$(LIB_DIR)/sim_ulapi.o
# no LIBS, BINS yet
***************
*** 81,86 ****
/home/John/emcdev/rtapi/lib/rtl_rtapi.o: rtapi.h
/home/John/emcdev/rtapi/lib/rtl_ulapi.o: ulapi.h
- /home/John/emcdev/rtapi/lib/sim_rtapi.o: rtapi.h
- /home/John/emcdev/rtapi/lib/sim_ulapi.o: ulapi.h
/home/John/emcdev/rtapi/rtlib/rtai_rtapi.o: rtapi.h
--- 83,86 ----
***************
*** 88,91 ****
/home/John/emcdev/rtapi/rtlib/rtl_rtapi.o: rtapi.h
/home/John/emcdev/rtapi/rtlib/rtl_ulapi.o: ulapi.h
- /home/John/emcdev/rtapi/rtlib/sim_rtapi.o: rtapi.h
- /home/John/emcdev/rtapi/rtlib/sim_ulapi.o: ulapi.h
--- 88,89 ----
Index: rtai_rtapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtai_rtapi.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** rtai_rtapi.c 12 Aug 2003 21:28:22 -0000 1.21
--- rtai_rtapi.c 13 Aug 2003 05:55:07 -0000 1.22
***************
*** 79,87 ****
/* Task handles are pointers to these structs. */
! struct rtapi_task {
! int magic; /* to check for valid handle */
! int started; /* flag set if task has started */
! RT_TASK ostask; /* OS specific task data */
! };
struct rtapi_shmem {
--- 79,89 ----
/* Task handles are pointers to these structs. */
! typedef enum { EMPTY, PAUSED, PERIODIC, FREERUN, ENDED } state_t;
!
! typedef struct {
! state_t state; /* task state */
! void *taskcode; /* task code */
! RT_TASK *ostask; /* pointer to OS specific task data */
! } task_data;
struct rtapi_shmem {
***************
*** 104,109 ****
};
! #define TASK_MAGIC 21979 /* random numbers used as signatures */
! #define SHMEM_MAGIC 25453
#define SEM_MAGIC 27594
#define FIFO_MAGIC 10293
--- 106,110 ----
};
! #define SHMEM_MAGIC 25453 /* random numbers used as signatures */
#define SEM_MAGIC 27594
#define FIFO_MAGIC 10293
***************
*** 117,121 ****
/* lists of resources */
! static rtapi_task_handle task_array[RTAPI_MAX_TASKS];
static rtapi_shmem_handle shmem_array[RTAPI_MAX_SHMEMS];
static rtapi_sem_handle sem_array[RTAPI_MAX_SEMS];
--- 118,122 ----
/* lists of resources */
! static task_data task_array[RTAPI_MAX_TASKS];
static rtapi_shmem_handle shmem_array[RTAPI_MAX_SHMEMS];
static rtapi_sem_handle sem_array[RTAPI_MAX_SEMS];
***************
*** 147,154 ****
but the process is the same... */
! static struct proc_dir_entry *rtapi_proc; /* struct for proc_fs entities */
! static char proc_data[2]; /* Space for one char plus EOF */
! static int proc_read_rtapi(char *page, char **start, off_t off,
! int count, int *eof, void *data)
{
PROC_PRINT_VARS;
--- 148,158 ----
but the process is the same... */
! static struct proc_dir_entry *rtapi_dir = 0; /* /proc/rtapi directory */
! static struct proc_dir_entry *status_file = 0; /* /proc/rtapi/status */
! static struct proc_dir_entry *tasks_file = 0; /* /proc/rtapi/tasks */
! static struct proc_dir_entry *debug_file = 0; /* /proc/rtapi/debug */
!
! static int proc_read_status(char *page, char **start, off_t off,
! int count, int *eof, void *data)
{
PROC_PRINT_VARS;
***************
*** 156,163 ****
PROC_PRINT(" Version = $Revision$\n");
PROC_PRINT(" Modules Loaded = %i\n", rtapi_usage_count);
! PROC_PRINT(" Tasks running = %i\n", task_usage_count);
! PROC_PRINT(" Shared memory = %i\n", shmem_usage_count);
! PROC_PRINT(" FIFO count = %i\n", fifo_usage_count);
! PROC_PRINT(" Semaphores used = %i\n", sem_usage_count);
PROC_PRINT("Active Interrupts = %i\n", int_usage_count);
PROC_PRINT(" Timer period = %li nSec\n", timer_period);
--- 160,167 ----
PROC_PRINT(" Version = $Revision$\n");
PROC_PRINT(" Modules Loaded = %i\n", rtapi_usage_count);
! PROC_PRINT(" Tasks running = %i/%i\n", task_usage_count, RTAPI_MAX_TASKS);
! PROC_PRINT(" Shared memory = %i/%i\n", shmem_usage_count, RTAPI_MAX_SHMEMS);
! PROC_PRINT(" FIFO count = %i/%i\n", fifo_usage_count, RTAPI_MAX_FIFOS);
! PROC_PRINT(" Semaphores used = %i/%i\n", sem_usage_count, RTAPI_MAX_SEMS);
PROC_PRINT("Active Interrupts = %i\n", int_usage_count);
PROC_PRINT(" Timer period = %li nSec\n", timer_period);
***************
*** 172,208 ****
}
! static int proc_write_rtapi(struct file *file,
const char *buffer,
unsigned long count, void *data)
{
! int len;
! char *buf = data; /* Pointer to the data buffer */
! char temp;
! if (count > 2) { /* If more data than expected is present */
! len = 2; /* just use the first char.. */
! } else {
! len = count;
! }
! if (copy_from_user(buf, buffer, len)) { /* copy from user space */
return -1;
}
! sscanf(data, "%s", &temp);
! if (isdigit(temp)) { /* check it is a number */
! /* Kernel implimentation of strtoul is used here.. */
! rtapi_msg_level = (int) simple_strtoul(&temp, NULL, 0);
}
! return len;
}
! #endif
/* For RTAI, all init is done when the rtapi kernel module
is insmoded. The rtapi_init() and rtapi_exit() functions
! do nothing. For other RTOSes, things might be different,
! especially if the RTOS does not use modules. */
/* NOTE: I decided not to use the MOD_INC_USE_COUNT macros at
--- 176,312 ----
}
!
! static int proc_read_tasks(char *page, char **start, off_t off,
! int count, int *eof, void *data)
! {
! int n;
! char *state_str;
!
! PROC_PRINT_VARS;
! PROC_PRINT("******* RTAPI TASKS *******\n");
! PROC_PRINT("ID State Code\n");
! for ( n = 0 ; n < RTAPI_MAX_TASKS ; n++ ) {
! if ( task_array[n].state != EMPTY ) {
! switch ( task_array[n].state ) {
! case PAUSED:
! state_str = "PAUSED ";
! break;
! case PERIODIC:
! state_str = "PERIODIC";
! break;
! case FREERUN:
! state_str = "FREE RUN";
! break;
! case ENDED:
! state_str = "ENDED ";
! break;
! default:
! state_str = "UNKNOWN ";
! break;
! }
! PROC_PRINT("%02d %s %p\n", n, state_str, task_array[n].taskcode);
! }
! }
! PROC_PRINT("\n");
! PROC_PRINT_DONE;
! }
!
!
! static int proc_read_debug(char *page, char **start, off_t off,
! int count, int *eof, void *data)
! {
! PROC_PRINT_VARS;
! PROC_PRINT("RTAPI Debug Message Level: %i\n", rtapi_msg_level);
! PROC_PRINT_DONE;
! }
!
!
! static int proc_write_debug(struct file *file,
const char *buffer,
unsigned long count, void *data)
{
! char c;
! /* copy 1 byte from user space */
! if (copy_from_user(&c, buffer, 1)) {
return -1;
}
+ /* check it is a digit */
+ if (isdigit(c)) {
+ /* convert to a number */
+ rtapi_msg_level = (int) (c - '0');
+ }
+ /* tell whoever called us that we used all the data, even
+ though we really only used the first byte */
+ return count;
+ }
!
! static int proc_init(void)
! {
! /* create the rtapi directory "/proc/rtapi" */
! rtapi_dir = proc_mkdir("rtapi", NULL);
! if ( rtapi_dir == 0 ) {
! return -1;
}
+ rtapi_dir->owner = THIS_MODULE;
+ /* create read only file "/proc/rtapi/status" using convenience function */
+ status_file = create_proc_read_entry("status", 0444, rtapi_dir,
+ proc_read_status, NULL);
+ if ( status_file == NULL) {
+ return -1;
+ }
+ status_file->owner = THIS_MODULE;
+ /* create read only file "/proc/rtapi/tasks" using convenience function */
+ tasks_file = create_proc_read_entry("tasks", 0444, rtapi_dir,
+ proc_read_tasks, NULL);
+ if ( tasks_file == NULL) {
+ return -1;
+ }
+ tasks_file->owner = THIS_MODULE;
+ /* create read/write file "/proc/rtapi/debug" using regular function */
+ debug_file = create_proc_entry("debug", 0644, rtapi_dir );
+ if ( debug_file == NULL) {
+ return -1;
+ }
+ debug_file->owner = THIS_MODULE;
+ debug_file->data = NULL;
+ debug_file->read_proc = proc_read_debug;
+ debug_file->write_proc = proc_write_debug;
+ return 0;
+ }
! static void proc_clean(void)
! {
! /* remove /proc entries, only if they exist */
! if (rtapi_dir != NULL) {
! if (debug_file != NULL) {
! remove_proc_entry("debug", rtapi_dir);
! debug_file = NULL;
! }
! if (status_file != NULL) {
! remove_proc_entry("status", rtapi_dir);
! status_file = NULL;
! }
! if (tasks_file != NULL) {
! remove_proc_entry("tasks", rtapi_dir);
! tasks_file = NULL;
! }
! remove_proc_entry("rtapi", NULL);
! }
}
! #endif /* CONFIG_PROC_FS */
!
! /***********************************************************************
! * GENERAL PURPOSE FUNCTIONS *
! ************************************************************************/
/* For RTAI, all init is done when the rtapi kernel module
is insmoded. The rtapi_init() and rtapi_exit() functions
! do very little, mostly simply register that another module
! is using the RTAPI. For other RTOSes, things might be
! different, especially if the RTOS does not use modules. */
/* NOTE: I decided not to use the MOD_INC_USE_COUNT macros at
***************
*** 238,241 ****
--- 342,346 ----
}
+
/* here is where the real init happens */
***************
*** 248,267 ****
/* say hello */
rtapi_print_msg(RTAPI_MSG_INFO, "RTAPI: Initing\n");
- /* register a proc entry */
#ifdef CONFIG_PROC_FS
! rtapi_proc = create_proc_entry("rtapi", 0644, NULL);
!
! if (rtapi_proc != NULL) { /* It isn't a fatal error if create_proc fails */
! rtapi_proc->data = &proc_data; /* workspace for the input data */
! rtapi_proc->read_proc = proc_read_rtapi; /* The read function */
! rtapi_proc->write_proc = proc_write_rtapi; /* and the write function */
! rtapi_proc->owner = THIS_MODULE;
! } else {
! rtapi_print_msg(RTAPI_MSG_WARN, "Could not open /proc/rtapi\n");
}
#endif
/* clear all the resource arrays */
for (n = 0; n < RTAPI_MAX_TASKS; n++) {
! task_array[n] = NULL;
}
for (n = 0; n < RTAPI_MAX_SHMEMS; n++) {
--- 353,365 ----
/* say hello */
rtapi_print_msg(RTAPI_MSG_INFO, "RTAPI: Initing\n");
#ifdef CONFIG_PROC_FS
! if ( proc_init() != 0 ) {
! rtapi_print_msg(RTAPI_MSG_WARN, "Could not activate /proc entries\n");
! proc_clean();
}
#endif
/* clear all the resource arrays */
for (n = 0; n < RTAPI_MAX_TASKS; n++) {
! task_array[n].state = EMPTY;
}
for (n = 0; n < RTAPI_MAX_SHMEMS; n++) {
***************
*** 288,291 ****
--- 386,392 ----
+ /* This cleanup code attempts to fix any messes left by modules
+ that fail to load properly, or fail to clean up after themselves */
+
void cleanup_module(void)
{
***************
*** 337,342 ****
/* clean up leftover tasks */
for (n = 0; n < RTAPI_MAX_TASKS; n++) {
! if (task_array[n] != NULL) {
! rtapi_task_delete(task_array[n]);
}
}
--- 438,443 ----
/* clean up leftover tasks */
for (n = 0; n < RTAPI_MAX_TASKS; n++) {
! if (task_array[n].state != EMPTY) {
! rtapi_task_delete(n);
}
}
***************
*** 353,361 ****
timer_running = 0;
}
- /* Remove proc dir entry */
#ifdef CONFIG_PROC_FS
! if (rtapi_proc != NULL) {
! remove_proc_entry("rtai/rtapi", NULL);
! }
#endif
rtapi_print_msg(RTAPI_MSG_INFO, "RTAPI: Exit complete\n");
--- 454,459 ----
timer_running = 0;
}
#ifdef CONFIG_PROC_FS
! proc_clean();
#endif
rtapi_print_msg(RTAPI_MSG_INFO, "RTAPI: Exit complete\n");
***************
*** 364,367 ****
--- 462,501 ----
+ /***********************************************************************
+ * CLOCK RELATED FUNCTIONS *
+ ************************************************************************/
+
+ int rtapi_clock_set_period(unsigned long int nsecs)
+ {
+
+ /* limit to a maximum of 1 second (note that RTLinux only
+ allows 0.01 second, so for portability, callers should
+ always ask for 0.01 second or less */
+
+ if (nsecs > 1000000000L) {
+ return RTAPI_INVAL;
+ }
+
+ timer_running = 1;
+ rt_set_periodic_mode();
+ timer_period = count2nano(start_rt_timer(nano2count((RTIME) nsecs)));
+
+ rtapi_print_msg(RTAPI_MSG_INFO,
+ "RTAPI: clock_set_period requested: %d actual: %d\n",
+ nsecs, timer_period);
+
+ return timer_period;
+ }
+
+
+ long long int rtapi_get_time(void)
+ {
+ return rt_get_time_ns();
+ }
+
+ /***********************************************************************
+ * TASK RELATED FUNCTIONS *
+ ************************************************************************/
+
/* Priority functions. RTAI uses 0 as the highest priority, as the
number increases, the actual priority of the task decreases. */
***************
*** 408,679 ****
! int rtapi_clock_set_period(unsigned long int nsecs)
! {
!
! /* limit to a maximum of 1 second (note that RTLinux only
! allows 0.01 second, so for portability, callers should
! always ask for 0.01 second or less */
!
! if (nsecs > 1000000000L) {
! return RTAPI_INVAL;
! }
!
! timer_running = 1;
! rt_set_periodic_mode();
! timer_period = count2nano(start_rt_timer(nano2count((RTIME) nsecs)));
!
! rtapi_print_msg(RTAPI_MSG_INFO,
! "RTAPI: clock_set_period requested: %d actual: %d\n",
! nsecs, timer_period);
!
! return timer_period;
! }
!
! long long int rtapi_get_time(void)
! {
! return rt_get_time_ns();
! }
!
!
! int rtapi_task_new(rtapi_task_handle * taskptr)
{
- rtapi_task_handle task;
int n;
- /* validate taskptr */
- if (taskptr == NULL) {
- return RTAPI_INVAL;
- }
/* find empty spot in task array */
n = 0;
! while ((n < RTAPI_MAX_TASKS) && (task_array[n] != NULL)) {
n++;
}
if (n == RTAPI_MAX_TASKS) {
! return RTAPI_NOMEM;
}
! /* alloc space for task structure */
! task = kmalloc(sizeof(struct rtapi_task), GFP_USER);
! if (task == NULL) {
return RTAPI_NOMEM;
}
! /* add to task array */
! task_array[n] = task;
! /* initialize task structure */
! task->magic = TASK_MAGIC;
! task->started = 0;
! /* increment the usage counter */
task_usage_count++;
! /* and return handle to the caller */
! *taskptr = task;
! rtapi_print_msg(RTAPI_MSG_INFO, "RTAPI: new_task %p, count = %d\n",
! task, task_usage_count);
! return RTAPI_SUCCESS;
}
! int rtapi_task_delete(rtapi_task_handle task)
{
! int n, retval;
! /* validate task handle */
! if (task == NULL) {
! return RTAPI_BADH;
! }
! if (task->magic != TASK_MAGIC) {
! return RTAPI_BADH;
! }
! /* find entry in task array */
! n = 0;
! while ((n < RTAPI_MAX_TASKS) && (task_array[n] != task)) {
! n++;
}
! if (n == RTAPI_MAX_TASKS) {
return RTAPI_INVAL;
}
! /* make sure task is stopped */
! if (task->started != 0) {
! /* stop it */
rtapi_print_msg(RTAPI_MSG_WARN,
! "RTAPI: WARNING: tried to delete_task %p, while running\n",
! task);
! retval = rtapi_task_stop(task);
! if (retval != RTAPI_SUCCESS) {
! return retval;
! }
}
! /* free the task struct */
! task->magic = 0;
! kfree(task);
! /* mark the array entry unused */
! task_array[n] = NULL;
! /* decrement the usage counter */
task_usage_count--;
/* done */
! rtapi_print_msg(RTAPI_MSG_INFO, "RTAPI: delete_task %p, count = %d\n",
! task, task_usage_count);
return RTAPI_SUCCESS;
}
! int rtapi_task_start(rtapi_task_handle task,
! void (*taskcode) (int),
! int arg, int prio,
! unsigned long int stacksize,
unsigned long int period_nsec,
! unsigned long long when, unsigned char uses_fp)
{
int retval;
! /* validate task handle */
! if (task == NULL) {
! return RTAPI_BADH;
! }
! if (task->magic != TASK_MAGIC) {
! return RTAPI_BADH;
}
! /* check requested priority */
! if ((prio < rtapi_prio_highest()) || (prio > rtapi_prio_lowest())) {
return RTAPI_INVAL;
}
! /* call OS to initialize the task */
! retval = rt_task_init(&(task->ostask), taskcode, arg,
! stacksize, prio, (int) uses_fp, 0);
! if (retval != 0) {
! if (retval == EINVAL) {
! /* task already in use */
! return RTAPI_BUSY;
! }
! if (retval == ENOMEM) {
! /* not enough space for stack */
! return RTAPI_NOMEM;
! }
! /* unknown error */
! return RTAPI_FAIL;
! }
! if (period_nsec > 0) {
! /* periodic task */
! if (when == RTAPI_NOW) {
! /* start the task immediately */
! retval = rt_task_make_periodic(&(task->ostask), rt_get_time(),
! nano2count((RTIME) period_nsec));
! if (retval != 0) {
! return RTAPI_FAIL;
! }
! } else {
! /* schedule the task to start when requested */
! retval = rt_task_make_periodic(&(task->ostask),
! nano2count((RTIME) when),
! nano2count((RTIME) period_nsec));
! if (retval != 0) {
! return RTAPI_FAIL;
! }
! /* check to see if we got done in time */
! if (rt_get_time() > nano2count((RTIME) when)) {
! retval = RTAPI_LATE;
! }
}
} else {
! /* If we got this far, a task has been paused and is awaiting
! a wakeup call to resume */
! retval = rt_task_resume(&(task->ostask));
if (retval != 0) {
return RTAPI_FAIL;
}
}
! task->started = 1;
! rtapi_print_msg(RTAPI_MSG_INFO, "RTAPI: start_task %p\n", task);
return retval;
}
! int rtapi_task_stop(rtapi_task_handle task)
{
! int retval;
!
! /* validate task handle */
! if (task == NULL) {
! return RTAPI_BADH;
! }
! if (task->magic != TASK_MAGIC) {
! return RTAPI_BADH;
! }
! /* stop execution of the task */
! retval = rt_task_suspend(&(task->ostask));
! if (retval != 0) {
! return RTAPI_FAIL;
! }
! /* get rid of it */
! retval = rt_task_delete(&(task->ostask));
! if (retval != 0) {
! return RTAPI_FAIL;
! }
! /* done */
! task->started = 0;
! rtapi_print_msg(RTAPI_MSG_INFO, "RTAPI: stop_task %p\n", task);
return RTAPI_SUCCESS;
}
! int rtapi_task_pause(rtapi_task_handle task)
{
int retval;
! /* validate task handle */
! if (task == NULL) {
! return RTAPI_BADH;
}
! if (task->magic != TASK_MAGIC) {
! return RTAPI_BADH;
}
! /* FIXME - depending on the version of rtai, a single
! call to resume() may or may not cancel multiple calls
! to suspend(). */
! retval = rt_task_suspend(&(task->ostask));
if (retval != 0) {
return RTAPI_FAIL;
}
return RTAPI_SUCCESS;
}
! int rtapi_task_resume(rtapi_task_handle task)
{
int retval;
! /* validate task handle */
! if (task == NULL) {
! return RTAPI_BADH;
}
! if (task->magic != TASK_MAGIC) {
! return RTAPI_BADH;
}
! /* FIXME - depending on the version of rtai, a single
! call to resume() may or may not cancel multiple calls
! to suspend(). */
! retval = rt_task_resume(&(task->ostask));
if (retval != 0) {
return RTAPI_FAIL;
}
return RTAPI_SUCCESS;
}
! int rtapi_wait(void)
! {
! rt_task_wait_period();
! return RTAPI_SUCCESS;
! }
!
!
! int rtapi_task_get_handle(rtapi_task_handle * taskptr)
{
RT_TASK *ptr;
int n;
- /* validate taskptr */
- if (taskptr == NULL) {
- return RTAPI_INVAL;
- }
/* ask OS for pointer to its data for the current task */
ptr = rt_whoami();
--- 542,751 ----
! int rtapi_task_new(void (*taskcode) (int),
! int arg, int prio,
! unsigned long int stacksize,
! int uses_fp)
{
int n;
+ int task_id;
+ int retval;
+ task_data *task;
/* find empty spot in task array */
n = 0;
! while ((n < RTAPI_MAX_TASKS) &&
! (task_array[n].state != EMPTY)) {
n++;
}
if (n == RTAPI_MAX_TASKS) {
! /* no room */
! return RTAPI_LIMIT;
}
! /* we have space for the task */
! task_id = n;
! task = &(task_array[n]);
! /* check requested priority */
! if ((prio < rtapi_prio_highest()) || (prio > rtapi_prio_lowest())) {
! return RTAPI_INVAL;
! }
! /* get space for the OS's task data - this is around 900 bytes, */
! /* so we don't want to statically allocate it for unused tasks. */
! task->ostask = kmalloc(sizeof(RT_TASK), GFP_USER);
! if (task->ostask == NULL) {
return RTAPI_NOMEM;
}
! /* call OS to initialize the task - use CPU 0 (the only CPU if
! uni-processor, but I want predictable behavior under SMP) */
! retval = rt_task_init_cpuid(task->ostask, taskcode, arg,
! stacksize, prio, uses_fp,
! 0, /* signal */
! 0 /* cpu id */ );
! if (retval != 0) {
! if (retval == ENOMEM) {
! /* not enough space for stack */
! return RTAPI_NOMEM;
! }
! /* unknown error */
! return RTAPI_FAIL;
! }
! /* the task has been created, update data */
! task->state = PAUSED;
! task->taskcode = taskcode;
task_usage_count++;
! /* announce the birth of a brand new baby task */
! rtapi_print_msg(RTAPI_MSG_INFO, "RTAPI: new_task id: %d, count: %d, code: %p\n",
! task_id, task_usage_count, taskcode);
! /* and return the ID to the proud parent */
! return task_id;
}
! int rtapi_task_delete(task_id)
{
! int retval;
! task_data *task;
! /* validate task ID */
! if ((task_id < 0) || (task_id >= RTAPI_MAX_TASKS)) {
! return RTAPI_BADID;
}
! /* point to the task's data */
! task = &(task_array[task_id]);
! /* check task status */
! if (task->state == EMPTY) {
! /* nothing to delete */
return RTAPI_INVAL;
}
! if ((task->state == PERIODIC ) || (task->state == FREERUN)) {
! /* task is running, need to stop it */
rtapi_print_msg(RTAPI_MSG_WARN,
! "RTAPI: WARNING: tried to delete task %d while running\n",
! task_id);
! rtapi_task_pause(task_id);
}
! /* get rid of it */
! retval = rt_task_delete(task->ostask);
! if (retval != 0) {
! return RTAPI_FAIL;
! }
! /* free kernel memory */
! kfree(task->ostask);
! /* update data */
! task->state = EMPTY;
task_usage_count--;
/* done */
! rtapi_print_msg(RTAPI_MSG_INFO, "RTAPI: delete_task id: %d, count: %d\n",
! task_id, task_usage_count);
return RTAPI_SUCCESS;
}
! int rtapi_task_start(int task_id,
unsigned long int period_nsec,
! unsigned long long when)
{
int retval;
+ task_data *task;
! /* validate task ID */
! if ((task_id < 0) || (task_id >= RTAPI_MAX_TASKS)) {
! return RTAPI_BADID;
}
! /* point to the task's data */
! task = &(task_array[task_id]);
! /* is task ready to be started? */
! if (task->state != PAUSED) {
return RTAPI_INVAL;
}
! if (when == RTAPI_NOW) {
! /* start the task immediately */
! retval = rt_task_make_periodic(task->ostask, rt_get_time(),
! nano2count((RTIME) period_nsec));
! if (retval != 0) {
! return RTAPI_FAIL;
}
} else {
! /* schedule the task to start when requested */
! retval = rt_task_make_periodic(task->ostask,
! nano2count((RTIME) when),
! nano2count((RTIME) period_nsec));
if (retval != 0) {
return RTAPI_FAIL;
}
+ /* check to see if we got done in time */
+ if (rt_get_time() > nano2count((RTIME) when)) {
+ retval = RTAPI_LATE;
+ }
}
! /* ok, task is started (or at least scheduled to start) */
! task->state = PERIODIC;
! rtapi_print_msg(RTAPI_MSG_INFO, "RTAPI: start_task id: %d\n", task_id);
return retval;
}
! int rtapi_wait(void)
{
! rt_task_wait_period();
return RTAPI_SUCCESS;
}
! int rtapi_task_resume(int task_id)
{
int retval;
+ task_data *task;
! /* validate task ID */
! if ((task_id < 0) || (task_id >= RTAPI_MAX_TASKS)) {
! return RTAPI_BADID;
}
! /* point to the task's data */
! task = &(task_array[task_id]);
! /* is task ready to be started? */
! if (task->state != PAUSED) {
! return RTAPI_INVAL;
}
! /* start the task */
! retval = rt_task_resume(task->ostask);
if (retval != 0) {
return RTAPI_FAIL;
}
+ /* update task data */
+ task->state = FREERUN;
return RTAPI_SUCCESS;
}
! int rtapi_task_pause(int task_id)
{
int retval;
+ task_data *task;
! /* validate task ID */
! if ((task_id < 0) || (task_id >= RTAPI_MAX_TASKS)) {
! return RTAPI_BADID;
}
! /* point to the task's data */
! task = &(task_array[task_id]);
! /* is it running? */
! if ((task->state != PERIODIC ) && (task->state != FREERUN)) {
! return RTAPI_INVAL;
}
! retval = rt_task_suspend(task->ostask);
if (retval != 0) {
return RTAPI_FAIL;
}
+ /* update task data */
+ task->state = PAUSED;
return RTAPI_SUCCESS;
}
! int rtapi_task_self(void)
{
RT_TASK *ptr;
int n;
/* ask OS for pointer to its data for the current task */
ptr = rt_whoami();
***************
*** 685,698 ****
n = 0;
while (n < RTAPI_MAX_TASKS) {
! if (task_array[n] != NULL) {
! if (&(task_array[n]->ostask) == ptr) {
! /* found a match */
! *taskptr = task_array[n];
! return RTAPI_SUCCESS;
! }
}
n++;
}
! return RTAPI_INVAL;
}
--- 757,767 ----
n = 0;
while (n < RTAPI_MAX_TASKS) {
! if (task_array[n].ostask == ptr) {
! /* found a match */
! return n;
}
n++;
}
! return RTAPI_FAIL;
}
Index: rtapi.h
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtapi.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** rtapi.h 11 Aug 2003 19:17:06 -0000 1.18
--- rtapi.h 13 Aug 2003 05:55:07 -0000 1.19
***************
*** 46,57 ****
#define RTAPI_SUCCESS 0 /* call successfull */
#define RTAPI_UNSUP -1 /* function not supported */
#define RTAPI_BADH -2 /* bad task, shmem, sem, or fifo handle */
#define RTAPI_INVAL -3 /* invalid argument */
#define RTAPI_NOMEM -4 /* not enough memory */
! #define RTAPI_PERM -5 /* permission denied */
! #define RTAPI_BUSY -6 /* resource is busy or locked */
! #define RTAPI_NOTFND -7 /* object not found */
! #define RTAPI_FAIL -8 /* operation failed */
! #define RTAPI_LATE -9 /* task could not start when requested */
/* NOTE: RTAPI assumes that ints are at least 32 bits long */
--- 46,60 ----
#define RTAPI_SUCCESS 0 /* call successfull */
#define RTAPI_UNSUP -1 /* function not supported */
+ #define RTAPI_BADID -2 /* bad task, shmem, sem, or fifo ID */
+ /* FIXME - remove BADH once everything is converted over to IDs */
#define RTAPI_BADH -2 /* bad task, shmem, sem, or fifo handle */
#define RTAPI_INVAL -3 /* invalid argument */
#define RTAPI_NOMEM -4 /* not enough memory */
! #define RTAPI_LIMIT -5 /* resource limit reached */
! #define RTAPI_PERM -6 /* permission denied */
! #define RTAPI_BUSY -7 /* resource is busy or locked */
! #define RTAPI_NOTFND -8 /* object not found */
! #define RTAPI_FAIL -9 /* operation failed */
! #define RTAPI_LATE -10 /* task could not start when requested */
/* NOTE: RTAPI assumes that ints are at least 32 bits long */
***************
*** 61,65 ****
* In fact, don't even count on handles always being pointers. */
! typedef struct rtapi_task *rtapi_task_handle;
typedef struct rtapi_shmem *rtapi_shmem_handle;
typedef struct rtapi_sem *rtapi_sem_handle;
--- 64,69 ----
* In fact, don't even count on handles always being pointers. */
! /* SEE, it's happening... tasks are now referred to by int task id's */
! /* the others will change soon */
typedef struct rtapi_shmem *rtapi_shmem_handle;
typedef struct rtapi_sem *rtapi_sem_handle;
***************
*** 149,152 ****
--- 153,161 ----
************************************************************************/
+ /* NOTE: The RTAPI is designed to be a _simple_ API. As such, it uses *
+ * a very simple strategy to deal with SMP systems. It ignores them! *
+ * All tasks are scheduled on the first CPU. That doesn't mean that *
+ * additional CPUs are wasted, they will be used for non-realtime code. */
+
/** The 'rtapi_prio_xxxx()' functions provide a portable way to set *
* task priority. The mapping of actual priority to priority number *
***************
*** 169,267 ****
! /** 'rtapi_task_new()' is the first step in creating a task. Allocs *
! * and initializes internal rtapi and rtos data related to the task. *
! * Returns a status code. On success, '*taskptr' becomes a handle *
! * which points to the internal task data. This handle is used for all *
! * subsequent calls that need to act on the task. */
! extern int rtapi_task_new(rtapi_task_handle * taskptr);
! /** 'rtapi_task_delete()' is the counterpart to 'rtapi_task_new()'. *
* It frees memory associated with 'task', and does any other cleanup *
! * needed. If the task has been started, you must stop it before *
! * deleting it, or bad things might happen. Returns a status code. *
! * Call from within module cleanup code or any other task. A task *
! * should not attempt to delete itself! */
! extern int rtapi_task_delete(rtapi_task_handle task);
! /** 'rtapi_task_start()' does the bulk of the work needed to create *
! * and run a realtime task. 'task' is a task handle from a call to *
! * rtapi_task_new(). 'taskcode' is the name of a function taking one *
! * int and returning void, which contains the task code. 'arg' will be *
! * passed to 'taskcode' as an abitrary int value when the task is *
! * invoked. 'prio' is the priority, as determined by one of the *
! * priority functions above. *
! * 'stacksize' is the amount of stack to be reserved for the task - be *
! * generous, hardware interrupts may use the same stack. *
* 'period_nsec' is the task period in nanoseconds, which will be *
! * rounded to the nearest multiple of the global clock period. If *
! * 'period_nsec' is zero, the task is assumed to be in a paused state *
! * and will be resumed immediately. rtapi_task_resume() would be the *
! * prefered method of restarting a paused task. *
! * 'when' is the desired start time for the task. If RTAPI_NOW, the *
! * task will start immediately. Otherwise, the task will be scheduled *
! * to start at the appropriate time. If the RTOS doesn't support *
! * starting tasks at a specific time, it will return RTAPI_UNSUP and *
! * the task will not be started. Otherwise, the task will be scheduled *
! * to start at the desired time. If the desired time has already *
! * passed, the task will start immediately, and function will return *
! * RTAPI_LATE. Be advised that some RTOSs may execute the task once as *
! * soon as it is scheduled, even if it is not to start until some time *
! * in the future. Tasks should use flags or another mechanism to *
! * prevent them from doing anything prematurely. 'when' uses time as *
! * returned by rtapi_get_time(). *
! * If non-zero, 'uses_fp' tells the OS that the task uses floating *
! * point so it can save the FPU registers on a task switch. Failing *
! * to save registers when needed causes the dreaded "NAN bug", so most *
! * tasks should set 'uses_fp' to 1. If a task definitely does not use *
! * floating point, setting 'uses_fp' to zero saves a few microseconds *
! * per task switch. Returns a status code. Call from module init code *
! * (preferred) or within a realtime task. May block. */
- #define RTAPI_NO_FP 0
- #define RTAPI_USES_FP 1
#define RTAPI_NOW 0
! extern int rtapi_task_start(rtapi_task_handle task,
! void (*taskcode) (int),
! int arg, int prio,
! unsigned long int stacksize,
unsigned long int period_nsec,
! unsigned long long when, unsigned char uses_fp);
! /** 'rtapi_task_stop()' is the counterpart to 'rtapi_task_start()'. *
! * Permanently stops 'task', and prepares it to be deleted. Returns *
! * a status code. Call from within module cleanup code or any other *
! * task - a task should not attempt to stop itself! */
! extern int rtapi_task_stop(rtapi_task_handle task);
! /** 'rtapi_task_pause() causes 'task' to temporarily stop execution. *
! * It will resume when 'rtapi_task_resume()' is called with the same *
! * task handle. A task can pause itself, but obviously cannot resume *
! * itself. Returns a status code. */
! extern int rtapi_task_pause(rtapi_task_handle task);
! extern int rtapi_task_resume(rtapi_task_handle task);
! /** 'rtapi_wait()' suspends execution of the current task until the *
! * next period. At the beginning of the next period, execution will *
! * resume immediately after the call to 'rtapi_wait()', instead of at *
! * beginning of the 'taskcode' function. Call only from a task. *
! * Returns a status code. */
! extern int rtapi_wait(void);
! /** 'rtapi_task_get_handle()' sets '*taskptr' equal to the handle of */
! /* the current task. Call only from a task. Returns a status code. */
- extern int rtapi_task_get_handle(rtapi_task_handle * taskptr);
--- 178,278 ----
! /** 'rtapi_task_new()' creates but does not start a realtime task. *
! * The task is created in the "paused" state. To start the task, call *
! * either rtapi_task_start() for periodic tasks, or rtapi_task_resume() *
! * for free-running tasks. *
! * On success, returns a non-negative integer task ID. This ID is used *
! * for all subsequent calls that need to act on the task. On failure, *
! * returns a negative error code as listed above. *
! * 'taskcode' is the name of a function taking one int and returning *
! * void, which contains the task code. 'arg' will be passed to *
! * 'taskcode' as an abitrary int value when the task is started. *
! * 'prio' is the priority, as determined by one of the priority *
! * functions above. 'stacksize' is the amount of stack to be reserved *
! * for the task - be generous, hardware interrupts may use the same *
! * stack. 'uses_fp' is a flag that tells the OS whether the task uses *
! * floating point so it can save the FPU registers on a task switch. *
! * Failing to save registers when needed causes the dreaded "NAN bug", *
! * so most tasks should set 'uses_fp' to RTAPI_USES_FP. If a task *
! * definitely does not use floating point, setting 'uses_fp' to *
! * RTAPI_NO_FP saves a few microseconds per task switch. */
! #define RTAPI_NO_FP 0
! #define RTAPI_USES_FP 1
+ extern int rtapi_task_new(void (*taskcode) (int),
+ int arg, int prio,
+ unsigned long int stacksize,
+ int uses_fp);
!
! /** 'rtapi_task_delete()' is deletes a task. 'task_id' is a task ID *
! * from a previous call to rtapi_task_new(). *
* It frees memory associated with 'task', and does any other cleanup *
! * needed. If the task has been started, you should pause it before *
! * deleting it. Returns a status code. Call from within init or *
! * cleanup code, or from another task. A task cannot delete itself! */
! extern int rtapi_task_delete(int task_id);
! /** 'rtapi_task_start()' starts a task in periodic mode. 'task_id' is *
! * a task ID from a call to rtapi_task_new(). The task must be in *
! * the "paused" state, or it will return RTAPI_INVAL. *
* 'period_nsec' is the task period in nanoseconds, which will be *
! * rounded to the nearest multiple of the global clock period. A task *
! * period less than the clock period (including zero) will be set equal *
! * to the clock period. *
! * If 'when' is RTAPI_NOW, the task will start immediately. Otherwise, *
! * 'when' is assumed to be the desired start time, using the same time- *
! * base as rtapi_get_time(). The task will be scheduled to start at *
! * the desired time. If the desired time has already passed, the task *
! * will start immediately, and function will return RTAPI_LATE. If *
! * 'when' is not RTAPI_NOW, and the RTOS doesn't support starting tasks *
! * at a specific time, it will return RTAPI_UNSUP and the task will not *
! * be started. */
#define RTAPI_NOW 0
! extern int rtapi_task_start(int task_id,
unsigned long int period_nsec,
! unsigned long long when);
! /** 'rtapi_wait()' suspends execution of the current task until the *
! * next period. The task must be periodic, if not, the result is *
! * undefined. The function will return RTAPI_SUCCESS at the beginning *
! * of the next period. Call only from within a task. */
! extern int rtapi_wait(void);
! /** 'rtapi_task_resume() starts a task in free-running mode. 'task_id' *
! * is a task ID from a call to rtapi_task_new(). The task must be in *
! * the "paused" state, or it will return RTAPI_INVAL. *
! * A free running task runs continuously until either 1) It is prempted *
! * by a higher priority task. It will resume as soon as the higher *
! * priority task releases the CPU. Or 2) It calls a blocking function, *
! * like rtapi_sem_take(). It will resume when the function unblocks. *
! * Or 3) it is returned to the "paused" state by rtapi_task_pause(). */
! extern int rtapi_task_resume(int task_id);
! /** 'rtapi_task_pause() causes 'task_id' to stop execution and change *
! * to the "paused" state. 'task_id' can be free-running or periodic. *
! * Note that rtapi_task_pause() may called from any task, or from init *
! * or cleanup code, not just from the task that is to be paused. *
! * The task will resume execution when either rtapi_task_resume() or *
! * rtapi_task_start() is called. */
! extern int rtapi_task_pause(int task_id);
! /** 'rtapi_task_self()' returns the task ID of the current task. *
! * May return a negative error code if called from outside a task. */
!
! extern int rtapi_task_self(void);
|
|
From: <jmk...@us...> - 2003-08-13 05:55:10
|
Update of /cvsroot/emc/rtapi/examples/extint In directory sc8-pr-cvs1:/tmp/cvs-serv29419/examples/extint Modified Files: Makefile Log Message: major changes to tasks API. Task IDs are now ints, not pointers. More changes on the way. RTAI builds and examples work. RTLinux and sim will be updated once rtai is done. Index: Makefile =================================================================== RCS file: /cvsroot/emc/rtapi/examples/extint/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile 10 Aug 2003 21:13:03 -0000 1.4 --- Makefile 13 Aug 2003 05:55:06 -0000 1.5 *************** *** 32,33 **** --- 32,36 ---- # DO NOT DELETE + + /home/John/emcdev/rtapi/rtlib/extint.o: /home/John/emcdev/rtapi/include/rtapi.h + /home/John/emcdev/rtapi/rtlib/extint.o: /home/John/emcdev/rtapi/include/rtapi_app.h |
|
From: <jmk...@us...> - 2003-08-13 05:55:10
|
Update of /cvsroot/emc/rtapi/examples/semaphore
In directory sc8-pr-cvs1:/tmp/cvs-serv29419/examples/semaphore
Modified Files:
Makefile master.c slave.c
Log Message:
major changes to tasks API. Task IDs are now ints, not pointers. More changes on the way. RTAI builds and examples work. RTLinux and sim will be updated once rtai is done.
Index: Makefile
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/semaphore/Makefile,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Makefile 10 Aug 2003 21:13:04 -0000 1.4
--- Makefile 13 Aug 2003 05:55:07 -0000 1.5
***************
*** 43,46 ****
--- 43,50 ----
# DO NOT DELETE
+ /home/John/emcdev/rtapi/rtlib/master.o: /home/John/emcdev/rtapi/include/rtapi.h
+ /home/John/emcdev/rtapi/rtlib/master.o: /home/John/emcdev/rtapi/include/rtapi_app.h
/home/John/emcdev/rtapi/rtlib/master.o: common.h
+ /home/John/emcdev/rtapi/rtlib/slave.o: /home/John/emcdev/rtapi/include/rtapi.h
+ /home/John/emcdev/rtapi/rtlib/slave.o: /home/John/emcdev/rtapi/include/rtapi_app.h
/home/John/emcdev/rtapi/rtlib/slave.o: common.h
Index: master.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/semaphore/master.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** master.c 11 Aug 2003 04:58:39 -0000 1.8
--- master.c 13 Aug 2003 05:55:07 -0000 1.9
***************
*** 12,16 ****
rtapi_sem_handle master_sem; /* the global semaphore */
! rtapi_task_handle master_task; /* the task structure */
static unsigned int master_count = 0;
enum { TIMER_PERIOD_NSEC = 10000000 }; /* timer period, in nanoseconds */
--- 12,16 ----
rtapi_sem_handle master_sem; /* the global semaphore */
! static int master_task; /* the task ID */
static unsigned int master_count = 0;
enum { TIMER_PERIOD_NSEC = 10000000 }; /* timer period, in nanoseconds */
***************
*** 60,75 ****
/* create the master task */
! retval = rtapi_task_new( &master_task );
! if ( retval != RTAPI_SUCCESS ) {
! rtapi_print( "sem master init: rtapi_task_new returned %d\n", retval );
return -1;
}
/* start the master task */
! retval = rtapi_task_start( master_task, master_code,
! 0, master_prio,
! MASTER_STACKSIZE,
! MASTER_PERIOD_NSEC, RTAPI_NOW,
! RTAPI_NO_FP );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("sem master init: rtapi_task_start returned %d\n", retval );
--- 60,72 ----
/* create the master task */
! master_task = rtapi_task_new(master_code, 0 /* arg */, master_prio,
! MASTER_STACKSIZE, RTAPI_NO_FP );
! if ( master_task < 0 ) {
! rtapi_print( "sem master init: rtapi_task_new returned %d\n", master_task );
return -1;
}
/* start the master task */
! retval = rtapi_task_start( master_task, MASTER_PERIOD_NSEC, RTAPI_NOW );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("sem master init: rtapi_task_start returned %d\n", retval );
***************
*** 87,92 ****
int retval;
! /* TESTING - intentionally fail to remove the task and the semaphore
! retval = rtapi_task_stop( master_task );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("sem master exit: rtapi_task_stop returned %d\n", retval );
--- 84,89 ----
int retval;
! /* TESTING - intentionally fail to remove the task and the semaphore */
! retval = rtapi_task_pause( master_task );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("sem master exit: rtapi_task_stop returned %d\n", retval );
***************
*** 103,107 ****
rtapi_print("sem master exit: rtapi_sem_delete returned %d\n", retval );
return;
! }*/
rtapi_print("sem master exit: master count is %d\n", master_count);
--- 100,104 ----
rtapi_print("sem master exit: rtapi_sem_delete returned %d\n", retval );
return;
! }
rtapi_print("sem master exit: master count is %d\n", master_count);
Index: slave.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/semaphore/slave.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** slave.c 11 Aug 2003 04:58:39 -0000 1.6
--- slave.c 13 Aug 2003 05:55:07 -0000 1.7
***************
*** 11,15 ****
#include "common.h" /* master_sem */
! static rtapi_task_handle slave_task; /* the task structure */
static unsigned int slave_count = 0;
enum { SLAVE_STACKSIZE = 1024 }; /* how big the stack is */
--- 11,15 ----
#include "common.h" /* master_sem */
! static int slave_task; /* the task ID */
static unsigned int slave_count = 0;
enum { SLAVE_STACKSIZE = 1024 }; /* how big the stack is */
***************
*** 41,56 ****
/* create the slave task */
! retval = rtapi_task_new( &slave_task );
! if ( retval != RTAPI_SUCCESS ) {
! rtapi_print( "sem slave init: rtapi_task_new returned %d\n", retval );
return -1;
}
/* start the slave task */
! retval = rtapi_task_start( slave_task, slave_code,
! 0, slave_prio,
! SLAVE_STACKSIZE,
! 0 /* not periodic */, RTAPI_NOW,
! RTAPI_NO_FP );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("sem slave init: rtapi_task_start returned %d\n", retval );
--- 41,53 ----
/* create the slave task */
! slave_task = rtapi_task_new(slave_code, 0 /* arg */, slave_prio,
! SLAVE_STACKSIZE, RTAPI_NO_FP );
! if ( slave_task < 0 ) {
! rtapi_print( "sem slave init: rtapi_task_new returned %d\n", slave_task );
return -1;
}
/* start the slave task */
! retval = rtapi_task_resume(slave_task);
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("sem slave init: rtapi_task_start returned %d\n", retval );
***************
*** 68,72 ****
int retval;
! retval = rtapi_task_stop( slave_task );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("sem slave exit: rtapi_task_stop returned %d\n", retval );
--- 65,69 ----
int retval;
! retval = rtapi_task_pause( slave_task );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("sem slave exit: rtapi_task_stop returned %d\n", retval );
|
|
From: <pa...@us...> - 2003-08-12 21:31:34
|
Update of /cvsroot/emc/rtapi/src/rtapi
In directory sc8-pr-cvs1:/tmp/cvs-serv24989
Modified Files:
rtai_rtapi.c
Log Message:
Verbosity can now be changed by 'echo 2 > /proc/rtapi'
Index: rtai_rtapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtai_rtapi.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** rtai_rtapi.c 11 Aug 2003 19:17:06 -0000 1.20
--- rtai_rtapi.c 12 Aug 2003 21:28:22 -0000 1.21
***************
*** 45,48 ****
--- 45,52 ----
#include <linux/proc_fs.h> /* So we can use the /proc file system */
#include <linux/slab.h> /* replaces malloc.h in recent kernels */
+ #include <linux/proc_fs.h> /* proc_fs functions */
+ #include <linux/ctype.h> /* isdigit */
+
+ #include <asm/uaccess.h> /* copy_from_user() */
#include <rtai.h>
#include <rtai_sched.h>
***************
*** 113,120 ****
/* lists of resources */
! static rtapi_task_handle task_array[RTAPI_MAX_TASKS];
! static rtapi_shmem_handle shmem_array[RTAPI_MAX_SHMEMS];
! static rtapi_sem_handle sem_array[RTAPI_MAX_SEMS];
! static rtapi_fifo_handle fifo_array[RTAPI_MAX_FIFOS];
/* Usage counters to keep track of new/delete calls */
--- 117,124 ----
/* lists of resources */
! static rtapi_task_handle task_array[RTAPI_MAX_TASKS];
! static rtapi_shmem_handle shmem_array[RTAPI_MAX_SHMEMS];
! static rtapi_sem_handle sem_array[RTAPI_MAX_SEMS];
! static rtapi_fifo_handle fifo_array[RTAPI_MAX_FIFOS];
/* Usage counters to keep track of new/delete calls */
***************
*** 140,145 ****
/* FIXME - according to my book, this interface is only available
for 2.4 kernels. I'm afraid this code will break on 2.0 or 2.2 */
! static int proc_read(char *page, char **start, off_t off,
! int count, int *eof, void *data)
{
PROC_PRINT_VARS;
--- 144,154 ----
/* FIXME - according to my book, this interface is only available
for 2.4 kernels. I'm afraid this code will break on 2.0 or 2.2 */
! /* The current implimentation may well break on a 2.2 series kernel,
! but the process is the same... */
!
! static struct proc_dir_entry *rtapi_proc; /* struct for proc_fs entities */
! static char proc_data[2]; /* Space for one char plus EOF */
! static int proc_read_rtapi(char *page, char **start, off_t off,
! int count, int *eof, void *data)
{
PROC_PRINT_VARS;
***************
*** 153,157 ****
PROC_PRINT("Active Interrupts = %i\n", int_usage_count);
PROC_PRINT(" Timer period = %li nSec\n", timer_period);
! if ( timer_running ) {
PROC_PRINT(" Timer status = Running\n");
} else {
--- 162,166 ----
PROC_PRINT("Active Interrupts = %i\n", int_usage_count);
PROC_PRINT(" Timer period = %li nSec\n", timer_period);
! if (timer_running) {
PROC_PRINT(" Timer status = Running\n");
} else {
***************
*** 162,165 ****
--- 171,202 ----
PROC_PRINT_DONE;
}
+
+ static int proc_write_rtapi(struct file *file,
+ const char *buffer,
+ unsigned long count, void *data)
+ {
+ int len;
+ char *buf = data; /* Pointer to the data buffer */
+ char temp;
+
+ if (count > 2) { /* If more data than expected is present */
+ len = 2; /* just use the first char.. */
+ } else {
+ len = count;
+ }
+ if (copy_from_user(buf, buffer, len)) { /* copy from user space */
+ return -1;
+ }
+
+ sscanf(data, "%s", &temp);
+ if (isdigit(temp)) { /* check it is a number */
+ /* Kernel implimentation of strtoul is used here.. */
+ rtapi_msg_level = (int) simple_strtoul(&temp, NULL, 0);
+ }
+
+ return len;
+ }
+
+
#endif
***************
*** 179,184 ****
rtapi_usage_count++;
/* MOD_INC_USE_COUNT;*/
! rtapi_print_msg (RTAPI_MSG_INFO, "RTAPI: init called, module count = %d\n",
! rtapi_usage_count );
return RTAPI_SUCCESS;
}
--- 216,221 ----
rtapi_usage_count++;
/* MOD_INC_USE_COUNT;*/
! rtapi_print_msg(RTAPI_MSG_INFO, "RTAPI: init called, module count = %d\n",
! rtapi_usage_count);
return RTAPI_SUCCESS;
}
***************
*** 187,191 ****
{
rtapi_usage_count--;
! if ( rtapi_usage_count == 0 ) {
if (timer_running != 0) {
stop_rt_timer();
--- 224,228 ----
{
rtapi_usage_count--;
! if (rtapi_usage_count == 0) {
if (timer_running != 0) {
stop_rt_timer();
***************
*** 196,201 ****
}
/* MOD_DEC_USE_COUNT;*/
! rtapi_print_msg (RTAPI_MSG_INFO, "RTAPI: exit called, module count = %d\n",
! rtapi_usage_count );
return RTAPI_SUCCESS;
}
--- 233,238 ----
}
/* MOD_DEC_USE_COUNT;*/
! rtapi_print_msg(RTAPI_MSG_INFO, "RTAPI: exit called, module count = %d\n",
! rtapi_usage_count);
return RTAPI_SUCCESS;
}
***************
*** 213,222 ****
/* register a proc entry */
#ifdef CONFIG_PROC_FS
! create_proc_read_entry("rtai/rtapi", /* name */
! 0, /* default mode */
! NULL, /* parent dir */
! proc_read, /* function */
! NULL /* client data */
! );
#endif
/* clear all the resource arrays */
--- 250,263 ----
/* register a proc entry */
#ifdef CONFIG_PROC_FS
! rtapi_proc = create_proc_entry("rtapi", 0644, NULL);
!
! if (rtapi_proc != NULL) { /* It isn't a fatal error if create_proc fails */
! rtapi_proc->data = &proc_data; /* workspace for the input data */
! rtapi_proc->read_proc = proc_read_rtapi; /* The read function */
! rtapi_proc->write_proc = proc_write_rtapi; /* and the write function */
! rtapi_proc->owner = THIS_MODULE;
! } else {
! rtapi_print_msg(RTAPI_MSG_WARN, "Could not open /proc/rtapi\n");
! }
#endif
/* clear all the resource arrays */
***************
*** 262,268 ****
fifo_usage_count);
/* clean up leftover fifos */
! for ( n = 0 ; n < RTAPI_MAX_FIFOS ; n++ ) {
! if ( fifo_array[n] != NULL ) {
! rtapi_fifo_delete(fifo_array[n]);
}
}
--- 303,309 ----
fifo_usage_count);
/* clean up leftover fifos */
! for (n = 0; n < RTAPI_MAX_FIFOS; n++) {
! if (fifo_array[n] != NULL) {
! rtapi_fifo_delete(fifo_array[n]);
}
}
***************
*** 273,279 ****
sem_usage_count);
/* clean up leftover sems */
! for ( n = 0 ; n < RTAPI_MAX_SEMS ; n++ ) {
! if ( sem_array[n] != NULL ) {
! rtapi_sem_delete(sem_array[n]);
}
}
--- 314,320 ----
sem_usage_count);
/* clean up leftover sems */
! for (n = 0; n < RTAPI_MAX_SEMS; n++) {
! if (sem_array[n] != NULL) {
! rtapi_sem_delete(sem_array[n]);
}
}
***************
*** 284,290 ****
shmem_usage_count);
/* clean up leftover shmems */
! for ( n = 0 ; n < RTAPI_MAX_SHMEMS ; n++ ) {
! if ( shmem_array[n] != NULL ) {
! rtapi_shmem_delete(shmem_array[n]);
}
}
--- 325,331 ----
shmem_usage_count);
/* clean up leftover shmems */
! for (n = 0; n < RTAPI_MAX_SHMEMS; n++) {
! if (shmem_array[n] != NULL) {
! rtapi_shmem_delete(shmem_array[n]);
}
}
***************
*** 295,301 ****
task_usage_count);
/* clean up leftover tasks */
! for ( n = 0 ; n < RTAPI_MAX_TASKS ; n++ ) {
! if ( task_array[n] != NULL ) {
! rtapi_task_delete(task_array[n]);
}
}
--- 336,342 ----
task_usage_count);
/* clean up leftover tasks */
! for (n = 0; n < RTAPI_MAX_TASKS; n++) {
! if (task_array[n] != NULL) {
! rtapi_task_delete(task_array[n]);
}
}
***************
*** 314,318 ****
/* Remove proc dir entry */
#ifdef CONFIG_PROC_FS
! remove_proc_entry("rtai/rtapi", NULL);
#endif
rtapi_print_msg(RTAPI_MSG_INFO, "RTAPI: Exit complete\n");
--- 355,361 ----
/* Remove proc dir entry */
#ifdef CONFIG_PROC_FS
! if (rtapi_proc != NULL) {
! remove_proc_entry("rtai/rtapi", NULL);
! }
#endif
rtapi_print_msg(RTAPI_MSG_INFO, "RTAPI: Exit complete\n");
***************
*** 450,460 ****
}
/* make sure task is stopped */
! if ( task->started != 0 ) {
/* stop it */
rtapi_print_msg(RTAPI_MSG_WARN,
! "RTAPI: WARNING: tried to delete_task %p, while running\n",
! task);
retval = rtapi_task_stop(task);
! if ( retval != RTAPI_SUCCESS ) {
return retval;
}
--- 493,503 ----
}
/* make sure task is stopped */
! if (task->started != 0) {
/* stop it */
rtapi_print_msg(RTAPI_MSG_WARN,
! "RTAPI: WARNING: tried to delete_task %p, while running\n",
! task);
retval = rtapi_task_stop(task);
! if (retval != RTAPI_SUCCESS) {
return retval;
}
***************
*** 479,484 ****
unsigned long int stacksize,
unsigned long int period_nsec,
! unsigned long long when,
! unsigned char uses_fp)
{
int retval;
--- 522,526 ----
unsigned long int stacksize,
unsigned long int period_nsec,
! unsigned long long when, unsigned char uses_fp)
{
int retval;
***************
*** 517,521 ****
nano2count((RTIME) period_nsec));
if (retval != 0) {
! return RTAPI_FAIL;
}
} else {
--- 559,563 ----
nano2count((RTIME) period_nsec));
if (retval != 0) {
! return RTAPI_FAIL;
}
} else {
***************
*** 525,533 ****
nano2count((RTIME) period_nsec));
if (retval != 0) {
! return RTAPI_FAIL;
}
/* check to see if we got done in time */
! if (rt_get_time() > nano2count((RTIME)when)) {
! retval = RTAPI_LATE;
}
}
--- 567,575 ----
nano2count((RTIME) period_nsec));
if (retval != 0) {
! return RTAPI_FAIL;
}
/* check to see if we got done in time */
! if (rt_get_time() > nano2count((RTIME) when)) {
! retval = RTAPI_LATE;
}
}
***************
*** 643,651 ****
n = 0;
while (n < RTAPI_MAX_TASKS) {
! if ( task_array[n] != NULL ) {
! if ( &(task_array[n]->ostask) == ptr ) {
! /* found a match */
! *taskptr = task_array[n];
! return RTAPI_SUCCESS;
}
}
--- 685,693 ----
n = 0;
while (n < RTAPI_MAX_TASKS) {
! if (task_array[n] != NULL) {
! if (&(task_array[n]->ostask) == ptr) {
! /* found a match */
! *taskptr = task_array[n];
! return RTAPI_SUCCESS;
}
}
***************
*** 657,661 ****
int rtapi_shmem_new(int key, unsigned long int size,
! rtapi_shmem_handle * shmemptr)
{
rtapi_shmem_handle shmem;
--- 699,703 ----
int rtapi_shmem_new(int key, unsigned long int size,
! rtapi_shmem_handle * shmemptr)
{
rtapi_shmem_handle shmem;
***************
*** 696,701 ****
/* return handle to the caller */
*shmemptr = shmem;
! rtapi_print_msg(RTAPI_MSG_INFO, "RTAPI: new_shmem %p, key = %d, count = %d\n",
! shmem, key, shmem_usage_count);
return RTAPI_SUCCESS;
}
--- 738,744 ----
/* return handle to the caller */
*shmemptr = shmem;
! rtapi_print_msg(RTAPI_MSG_INFO,
! "RTAPI: new_shmem %p, key = %d, count = %d\n", shmem, key,
! shmem_usage_count);
return RTAPI_SUCCESS;
}
***************
*** 745,750 ****
/* decrement the usage counter */
shmem_usage_count--;
! rtapi_print_msg(RTAPI_MSG_INFO, "RTAPI: delete_shmem %p, count = %d\n", shmem,
! shmem_usage_count);
return RTAPI_SUCCESS;
}
--- 788,793 ----
/* decrement the usage counter */
shmem_usage_count--;
! rtapi_print_msg(RTAPI_MSG_INFO, "RTAPI: delete_shmem %p, count = %d\n",
! shmem, shmem_usage_count);
return RTAPI_SUCCESS;
}
|
|
From: <pa...@us...> - 2003-08-11 19:32:26
|
Update of /cvsroot/emc/rtapi/src/rtapi
In directory sc8-pr-cvs1:/tmp/cvs-serv4979
Modified Files:
rtai_rtapi.c rtapi.h
Log Message:
A few comments about rtapi_task_start when period is zero
Index: rtai_rtapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtai_rtapi.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** rtai_rtapi.c 11 Aug 2003 04:58:39 -0000 1.19
--- rtai_rtapi.c 11 Aug 2003 19:17:06 -0000 1.20
***************
*** 533,537 ****
}
} else {
! /* start task in free-running mode */
retval = rt_task_resume(&(task->ostask));
if (retval != 0) {
--- 533,538 ----
}
} else {
! /* If we got this far, a task has been paused and is awaiting
! a wakeup call to resume */
retval = rt_task_resume(&(task->ostask));
if (retval != 0) {
Index: rtapi.h
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtapi.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** rtapi.h 11 Aug 2003 04:58:39 -0000 1.17
--- rtapi.h 11 Aug 2003 19:17:06 -0000 1.18
***************
*** 199,205 ****
* 'period_nsec' is the task period in nanoseconds, which will be *
* rounded to the nearest multiple of the global clock period. If *
! * 'period_nsec' is zero, the task is non-periodic. It will be started *
! * immediately (does not use 'when'), and run until it returns, pauses, *
! * or makes a blocking call. *
* 'when' is the desired start time for the task. If RTAPI_NOW, the *
* task will start immediately. Otherwise, the task will be scheduled *
--- 199,205 ----
* 'period_nsec' is the task period in nanoseconds, which will be *
* rounded to the nearest multiple of the global clock period. If *
! * 'period_nsec' is zero, the task is assumed to be in a paused state *
! * and will be resumed immediately. rtapi_task_resume() would be the *
! * prefered method of restarting a paused task. *
* 'when' is the desired start time for the task. If RTAPI_NOW, the *
* task will start immediately. Otherwise, the task will be scheduled *
|
Update of /cvsroot/emc/rtapi/src/rtapi
In directory sc8-pr-cvs1:/tmp/cvs-serv13330/src/rtapi
Modified Files:
rtai_rtapi.c rtai_ulapi.c rtapi.h rtl_rtapi.c rtl_ulapi.c
sim_rtapi.c sim_ulapi.c ulapi.h
Log Message:
added error recovery and cleanup to rtai_rtapi
Index: rtai_rtapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtai_rtapi.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** rtai_rtapi.c 10 Aug 2003 23:52:35 -0000 1.18
--- rtai_rtapi.c 11 Aug 2003 04:58:39 -0000 1.19
***************
*** 72,78 ****
#include "rtapi.h" /* these decls */
- /* set to 1/0 to enable/disable logging of task creation etc. */
- #define VERBOSE 1
-
/* These structs hold data associated with objects like tasks, etc. */
/* Task handles are pointers to these structs. */
--- 72,75 ----
***************
*** 80,83 ****
[...1045 lines suppressed...]
+ n = 0;
+ while ((n < RTAPI_MAX_FIFOS) && (fifo_array[n] != fifo)) {
+ n++;
+ }
+ if (n == RTAPI_MAX_FIFOS) {
+ return RTAPI_INVAL;
+ }
/* call the OS to destroy the fifo */
rtf_destroy(fifo->fd);
! /* mark the array entry unused */
! fifo_array[n] = NULL;
fifo->magic = 0;
+ /* free the fifo structure */
kfree(fifo);
/* decrement the usage counter */
fifo_usage_count--;
! rtapi_print_msg(RTAPI_MSG_INFO, "RTAPI: delete_fifo %p, count = %d\n",
! fifo, fifo_usage_count);
return RTAPI_SUCCESS;
}
Index: rtai_ulapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtai_ulapi.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** rtai_ulapi.c 10 Aug 2003 21:13:04 -0000 1.5
--- rtai_ulapi.c 11 Aug 2003 04:58:39 -0000 1.6
***************
*** 88,92 ****
! int ulapi_shmem_new(int key, unsigned int size, ulapi_shmem_handle * shmemptr)
{
ulapi_shmem_handle shmem;
--- 88,92 ----
! int ulapi_shmem_new(int key, unsigned long int size, ulapi_shmem_handle * shmemptr)
{
ulapi_shmem_handle shmem;
Index: rtapi.h
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtapi.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** rtapi.h 10 Aug 2003 23:52:35 -0000 1.16
--- rtapi.h 11 Aug 2003 04:58:39 -0000 1.17
***************
*** 1,3 ****
! #ifndef RTAPI__H
#define RTAPI_H
--- 1,3 ----
! #ifndef RTAPI_H
#define RTAPI_H
***************
*** 115,141 ****
/***********************************************************************
! * TASK RELATED FUNCTIONS *
************************************************************************/
- /** The 'rtapi_prio_xxxx()' functions provide a portable way to set *
- * task priority. The mapping of actual priority to priority number *
- * depends on the RTOS. Priorities range from 'rtapi_prio_lowest()' *
- * to 'rtapi_prio_highest()', inclusive. To use this API, use one of *
- * two methods: *
- * *
- * 1) Set your lowest priority task to 'rtapi_prio_lowest()', and for *
- * each task of the next lowest priority, set their priorities to *
- * 'rtapi_prio_next_higher(previous)'. *
- * *
- * 2) Set your highest priority task to 'rtapi_prio_highest()', and for *
- * each task of the next highest priority, set their priorities to *
- * 'rtapi_prio_next_lower(previous)'. */
-
- extern int rtapi_prio_highest(void);
- extern int rtapi_prio_lowest(void);
- extern int rtapi_prio_next_higher(int prio);
- extern int rtapi_prio_next_lower(int prio);
-
-
/** The clock period is the basic time interval for realtime tasks *
* All task periods, whether specified when starting the task, or *
--- 115,121 ----
/***********************************************************************
! * CLOCK RELATED FUNCTIONS *
************************************************************************/
/** The clock period is the basic time interval for realtime tasks *
* All task periods, whether specified when starting the task, or *
***************
*** 165,168 ****
--- 145,172 ----
+ /***********************************************************************
+ * TASK RELATED FUNCTIONS *
+ ************************************************************************/
+
+ /** The 'rtapi_prio_xxxx()' functions provide a portable way to set *
+ * task priority. The mapping of actual priority to priority number *
+ * depends on the RTOS. Priorities range from 'rtapi_prio_lowest()' *
+ * to 'rtapi_prio_highest()', inclusive. To use this API, use one of *
+ * two methods: *
+ * *
+ * 1) Set your lowest priority task to 'rtapi_prio_lowest()', and for *
+ * each task of the next lowest priority, set their priorities to *
+ * 'rtapi_prio_next_higher(previous)'. *
+ * *
+ * 2) Set your highest priority task to 'rtapi_prio_highest()', and for *
+ * each task of the next highest priority, set their priorities to *
+ * 'rtapi_prio_next_lower(previous)'. */
+
+ extern int rtapi_prio_highest(void);
+ extern int rtapi_prio_lowest(void);
+ extern int rtapi_prio_next_higher(int prio);
+ extern int rtapi_prio_next_lower(int prio);
+
+
/** 'rtapi_task_new()' is the first step in creating a task. Allocs *
* and initializes internal rtapi and rtos data related to the task. *
***************
*** 198,213 ****
* immediately (does not use 'when'), and run until it returns, pauses, *
* or makes a blocking call. *
! * 'when' is the desired start time for the task. If zero, the task *
! * will start immediately. Otherwise, the task will be scheduled to *
! * start at the appropriate time. If the RTOS doesn't support starting *
! * tasks at a specific time, it will return RTAPI_UNSUP and the task *
! * will not be started. Otherwise, the task will be scheduled to start *
! * at the desired time. If the desired time has already passed, the *
! * function will return RTAPI_LATE, and the task start time is unknown. *
! * Be advised that some RTOSs may execute the task once as soon as it *
! * is scheduled, even if it is not to start until some time in the *
! * future. Tasks should use flags or another mechanism to prevent them *
! * from doing anything prematurely. 'when' uses time as returned by *
! * rtapi_get_time(). *
* If non-zero, 'uses_fp' tells the OS that the task uses floating *
* point so it can save the FPU registers on a task switch. Failing *
--- 202,217 ----
* immediately (does not use 'when'), and run until it returns, pauses, *
* or makes a blocking call. *
! * 'when' is the desired start time for the task. If RTAPI_NOW, the *
! * task will start immediately. Otherwise, the task will be scheduled *
! * to start at the appropriate time. If the RTOS doesn't support *
! * starting tasks at a specific time, it will return RTAPI_UNSUP and *
! * the task will not be started. Otherwise, the task will be scheduled *
! * to start at the desired time. If the desired time has already *
! * passed, the task will start immediately, and function will return *
! * RTAPI_LATE. Be advised that some RTOSs may execute the task once as *
! * soon as it is scheduled, even if it is not to start until some time *
! * in the future. Tasks should use flags or another mechanism to *
! * prevent them from doing anything prematurely. 'when' uses time as *
! * returned by rtapi_get_time(). *
* If non-zero, 'uses_fp' tells the OS that the task uses floating *
* point so it can save the FPU registers on a task switch. Failing *
***************
*** 220,224 ****
#define RTAPI_NO_FP 0
#define RTAPI_USES_FP 1
! #define NOW 0
extern int rtapi_task_start(rtapi_task_handle task,
--- 224,228 ----
#define RTAPI_NO_FP 0
#define RTAPI_USES_FP 1
! #define RTAPI_NOW 0
extern int rtapi_task_start(rtapi_task_handle task,
***************
*** 277,281 ****
* Returns a status code. */
! extern int rtapi_shmem_new(int key, unsigned int size,
rtapi_shmem_handle * shmemptr);
--- 281,285 ----
* Returns a status code. */
! extern int rtapi_shmem_new(int key, unsigned long int size,
rtapi_shmem_handle * shmemptr);
***************
*** 345,352 ****
* becomes a fifo handle, which points to internal data for the fifo *
* and is used for subsequent calls dealing with it. Returns a status *
! * code. *
! * *
! * NOTE - The fifo requires (stacksize - 256) to avoid oops messages on *
! * removal. (Does this apply to rtlinux as well ?) */
extern int rtapi_fifo_new(int key, unsigned long int size,
--- 349,356 ----
* becomes a fifo handle, which points to internal data for the fifo *
* and is used for subsequent calls dealing with it. Returns a status *
! * code. */
!
! /* NOTE - RTAI fifos require (stacksize - 256) to avoid oops messages *
! * on removal. (Does this apply to rtlinux as well ?) */
extern int rtapi_fifo_new(int key, unsigned long int size,
***************
*** 367,370 ****
--- 371,379 ----
* responsible for the data format and integrity. */
+ /* Additional NOTE: IMHO you should be able to write any amount of *
+ * data to a fifo, from 1 byte up to (and even beyond) the size of the *
+ * fifo. At a future date, the somewhat peculiar RTAI fifos will be *
+ * replaced with something that works better. John Kasunich */
+
/** 'rtapi_fifo_read()' reads data from 'fifo'. 'buf' is a buffer for *
* the data, and 'size' is the maximum number of bytes to read. *
***************
*** 423,427 ****
/** 'rtapi_outb() writes 'byte' to 'port'. *
! * Note: This function does nothing on the simulated RTOS. */
extern void rtapi_outb(unsigned char byte, unsigned int port);
--- 432,437 ----
/** 'rtapi_outb() writes 'byte' to 'port'. *
! * Note: This function does nothing on the simulated RTOS. *
! * Note: Many platforms provide an inline outb() that is faster */
extern void rtapi_outb(unsigned char byte, unsigned int port);
***************
*** 429,433 ****
/** 'rtapi_inb() gets a byte from 'port'. Returns the byte. *
! * Note: This function always returns zero on the simulated RTOS. */
extern unsigned char rtapi_inb(unsigned int port);
--- 439,444 ----
/** 'rtapi_inb() gets a byte from 'port'. Returns the byte. *
! * Note: This function always returns zero on the simulated RTOS. *
! * Note: Many platforms provide an inline inb() that is faster */
extern unsigned char rtapi_inb(unsigned int port);
Index: rtl_rtapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtl_rtapi.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** rtl_rtapi.c 10 Aug 2003 21:13:04 -0000 1.5
--- rtl_rtapi.c 11 Aug 2003 04:58:39 -0000 1.6
***************
*** 5,9 ****
*/
- /* This code is hereby released into the public domain. */
/* NO GUARANTEE OF ANY KIND IS PROVIDED. THE CREATERS OF THIS */
/* CODE ACCEPT ABSOLUTELY NO LIABILITY FOR ANY HARM OR LOSSES */
--- 5,8 ----
***************
*** 47,52 ****
#ifdef MODULE_LICENSE
! MODULE_LICENSE("GPL and additional rights");
! /* The additional rights are you can do anything you want. */
#endif
--- 46,50 ----
#ifdef MODULE_LICENSE
! MODULE_LICENSE("GPL");
#endif
***************
*** 518,531 ****
/* find entry in task array */
n = 0;
! while ((n < RTAPI_MAX_TASKS) && (task_array[n]->ostask != task_id)) {
n++;
}
! if (n == RTAPI_MAX_TASKS) {
! return RTAPI_INVAL;
! }
!
! /* return task handle */
! *taskptr = task_array[n];
! return RTAPI_SUCCESS;
}
--- 516,530 ----
/* find entry in task array */
n = 0;
! while (n < RTAPI_MAX_TASKS) {
! if ( task_array[n] != NULL ) {
! if ( &(task_array[n]->ostask) == task_id ) {
! /* found a match */
! *taskptr = task_array[n];
! return RTAPI_SUCCESS;
! }
! }
n++;
}
! return RTAPI_INVAL;
}
Index: rtl_ulapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtl_ulapi.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** rtl_ulapi.c 10 Aug 2003 21:13:04 -0000 1.5
--- rtl_ulapi.c 11 Aug 2003 04:58:39 -0000 1.6
***************
*** 5,9 ****
*/
- /* This code is hereby released into the public domain. */
/* NO GUARANTEE OF ANY KIND IS PROVIDED. THE CREATERS OF THIS */
/* CODE ACCEPT ABSOLUTELY NO LIABILITY FOR ANY HARM OR LOSSES */
--- 5,8 ----
Index: sim_rtapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/sim_rtapi.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** sim_rtapi.c 10 Aug 2003 23:52:35 -0000 1.7
--- sim_rtapi.c 11 Aug 2003 04:58:39 -0000 1.8
***************
*** 306,310 ****
! int rtapi_shmem_new(int key, unsigned int size, rtapi_shmem_handle * shmemptr)
{
rtapi_shmem_handle shmem;
--- 306,310 ----
! int rtapi_shmem_new(int key, unsigned long int size, rtapi_shmem_handle * shmemptr)
{
rtapi_shmem_handle shmem;
Index: sim_ulapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/sim_ulapi.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** sim_ulapi.c 9 Aug 2003 19:43:09 -0000 1.3
--- sim_ulapi.c 11 Aug 2003 04:58:39 -0000 1.4
***************
*** 40,44 ****
! int ulapi_shmem_new(int key, unsigned int size, ulapi_shmem_handle * shmemptr)
{
ulapi_shmem_handle shmem;
--- 40,44 ----
! int ulapi_shmem_new(int key, unsigned long int size, ulapi_shmem_handle * shmemptr)
{
ulapi_shmem_handle shmem;
Index: ulapi.h
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/ulapi.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** ulapi.h 10 Aug 2003 21:13:04 -0000 1.7
--- ulapi.h 11 Aug 2003 04:58:39 -0000 1.8
***************
*** 95,99 ****
* code. */
! extern int ulapi_shmem_new(int key, unsigned int size,
ulapi_shmem_handle * shmemptr);
--- 95,99 ----
* code. */
! extern int ulapi_shmem_new(int key, unsigned long int size,
ulapi_shmem_handle * shmemptr);
|
|
From: <jmk...@us...> - 2003-08-11 04:58:42
|
Update of /cvsroot/emc/rtapi/examples/timertask
In directory sc8-pr-cvs1:/tmp/cvs-serv13330/examples/timertask
Modified Files:
timertask.c
Log Message:
added error recovery and cleanup to rtai_rtapi
Index: timertask.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/timertask/timertask.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** timertask.c 10 Aug 2003 23:52:35 -0000 1.8
--- timertask.c 11 Aug 2003 04:58:39 -0000 1.9
***************
*** 37,49 ****
int timer_prio;
! /* init is still in a state of change - right now this isn't needed
! if (0 != rtapi_app_init()) {
return -1;
}
- */
/* set the base timer period */
retval = rtapi_clock_set_period(TIMER_PERIOD_NSEC);
! if ( retval != RTAPI_SUCCESS ) {
/* See rtapi.h for the error codes returned */
rtapi_print( "timertask init: rtapi_clock_set_period returned %d\n", retval );
--- 37,47 ----
int timer_prio;
! if (rtapi_init() != RTAPI_SUCCESS ) {
return -1;
}
/* set the base timer period */
retval = rtapi_clock_set_period(TIMER_PERIOD_NSEC);
! if ( retval < 0 ) {
/* See rtapi.h for the error codes returned */
rtapi_print( "timertask init: rtapi_clock_set_period returned %d\n", retval );
***************
*** 60,63 ****
--- 58,62 ----
if ( retval != RTAPI_SUCCESS ) {
/* See rtapi.h for the error codes returned */
+ rtapi_print( "timertask init: rtapi_task_new returned %d\n", retval );
return -1;
}
***************
*** 69,73 ****
0, timer_prio,
TIMER_STACKSIZE,
! TASK_PERIOD_NSEC, NOW,
RTAPI_NO_FP );
if ( retval != RTAPI_SUCCESS ) {
--- 68,72 ----
0, timer_prio,
TIMER_STACKSIZE,
! TASK_PERIOD_NSEC, RTAPI_NOW,
RTAPI_NO_FP );
if ( retval != RTAPI_SUCCESS ) {
***************
*** 95,108 ****
}
/* Remove the task from the list */
retval = rtapi_task_delete( timer_task );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("timertask exit: rtapi_task_delete returned %d\n", retval );
return;
! }
/* Print the final count just to show that the task did it's job */
rtapi_print("timertask exit: timer count is %d\n", timer_count);
/* Clean up and exit */
! rtapi_app_return();
}
--- 94,109 ----
}
/* Remove the task from the list */
+
+ /* TESTING - intentionally skip the task_delete
retval = rtapi_task_delete( timer_task );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("timertask exit: rtapi_task_delete returned %d\n", retval );
return;
! }*/
/* Print the final count just to show that the task did it's job */
rtapi_print("timertask exit: timer count is %d\n", timer_count);
/* Clean up and exit */
! rtapi_exit();
}
|
|
From: <jmk...@us...> - 2003-08-11 04:58:42
|
Update of /cvsroot/emc/rtapi/examples/semaphore
In directory sc8-pr-cvs1:/tmp/cvs-serv13330/examples/semaphore
Modified Files:
master.c slave.c
Log Message:
added error recovery and cleanup to rtai_rtapi
Index: master.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/semaphore/master.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** master.c 10 Aug 2003 23:52:35 -0000 1.7
--- master.c 11 Aug 2003 04:58:39 -0000 1.8
***************
*** 37,45 ****
int master_prio;
! /*
! if (0 != rtapi_app_init()) {
return -1;
}
- */
/* create the semaphore */
--- 37,43 ----
int master_prio;
! if (rtapi_init() != RTAPI_SUCCESS ) {
return -1;
}
/* create the semaphore */
***************
*** 52,56 ****
/* set the base timer period */
retval = rtapi_clock_set_period(TIMER_PERIOD_NSEC);
! if ( retval != RTAPI_SUCCESS ) {
rtapi_print( "sem master init: rtapi_clock_set_period returned %d\n", retval );
return -1;
--- 50,54 ----
/* set the base timer period */
retval = rtapi_clock_set_period(TIMER_PERIOD_NSEC);
! if ( retval < RTAPI_SUCCESS ) {
rtapi_print( "sem master init: rtapi_clock_set_period returned %d\n", retval );
return -1;
***************
*** 72,76 ****
0, master_prio,
MASTER_STACKSIZE,
! MASTER_PERIOD_NSEC, NOW,
RTAPI_NO_FP );
if ( retval != RTAPI_SUCCESS ) {
--- 70,74 ----
0, master_prio,
MASTER_STACKSIZE,
! MASTER_PERIOD_NSEC, RTAPI_NOW,
RTAPI_NO_FP );
if ( retval != RTAPI_SUCCESS ) {
***************
*** 89,92 ****
--- 87,91 ----
int retval;
+ /* TESTING - intentionally fail to remove the task and the semaphore
retval = rtapi_task_stop( master_task );
if ( retval != RTAPI_SUCCESS ) {
***************
*** 104,111 ****
rtapi_print("sem master exit: rtapi_sem_delete returned %d\n", retval );
return;
! }
rtapi_print("sem master exit: master count is %d\n", master_count);
! rtapi_app_return();
}
--- 103,110 ----
rtapi_print("sem master exit: rtapi_sem_delete returned %d\n", retval );
return;
! }*/
rtapi_print("sem master exit: master count is %d\n", master_count);
! rtapi_exit();
}
Index: slave.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/semaphore/slave.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** slave.c 10 Aug 2003 23:52:35 -0000 1.5
--- slave.c 11 Aug 2003 04:58:39 -0000 1.6
***************
*** 33,37 ****
int slave_prio;
! if (0 != rtapi_app_init()) {
return -1;
}
--- 33,37 ----
int slave_prio;
! if (rtapi_init() != RTAPI_SUCCESS ) {
return -1;
}
***************
*** 51,55 ****
0, slave_prio,
SLAVE_STACKSIZE,
! 0 /* not periodic */, NOW,
RTAPI_NO_FP );
if ( retval != RTAPI_SUCCESS ) {
--- 51,55 ----
0, slave_prio,
SLAVE_STACKSIZE,
! 0 /* not periodic */, RTAPI_NOW,
RTAPI_NO_FP );
if ( retval != RTAPI_SUCCESS ) {
***************
*** 81,84 ****
rtapi_print("sem slave exit: slave count is %d\n", slave_count);
! rtapi_app_return();
}
--- 81,84 ----
rtapi_print("sem slave exit: slave count is %d\n", slave_count);
! rtapi_exit();
}
|
|
From: <jmk...@us...> - 2003-08-11 04:58:42
|
Update of /cvsroot/emc/rtapi/examples/shmem
In directory sc8-pr-cvs1:/tmp/cvs-serv13330/examples/shmem
Modified Files:
shmemtask.c
Log Message:
added error recovery and cleanup to rtai_rtapi
Index: shmemtask.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/shmem/shmemtask.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** shmemtask.c 10 Aug 2003 23:52:35 -0000 1.6
--- shmemtask.c 11 Aug 2003 04:58:39 -0000 1.7
***************
*** 36,44 ****
int shmem_prio;
! /*
! if (0 != rtapi_init()) {
return -1;
}
- */
/* allocate and initialize the shared memory structure */
--- 36,42 ----
int shmem_prio;
! if (rtapi_init() != RTAPI_SUCCESS ) {
return -1;
}
/* allocate and initialize the shared memory structure */
***************
*** 58,62 ****
/* set the base timer period */
retval = rtapi_clock_set_period(SHMEM_PERIOD_NSEC);
! if ( retval != RTAPI_SUCCESS ) {
rtapi_print( "shmemtask init: rtapi_clock_set_period returned %d\n", retval );
return -1;
--- 56,60 ----
/* set the base timer period */
retval = rtapi_clock_set_period(SHMEM_PERIOD_NSEC);
! if ( retval < RTAPI_SUCCESS ) {
rtapi_print( "shmemtask init: rtapi_clock_set_period returned %d\n", retval );
return -1;
***************
*** 77,81 ****
0, shmem_prio,
SHMEM_STACKSIZE,
! SHMEM_PERIOD_NSEC, NOW,
RTAPI_NO_FP );
if ( retval != RTAPI_SUCCESS ) {
--- 75,79 ----
0, shmem_prio,
SHMEM_STACKSIZE,
! SHMEM_PERIOD_NSEC, RTAPI_NOW,
RTAPI_NO_FP );
if ( retval != RTAPI_SUCCESS ) {
***************
*** 108,118 ****
return;
}
!
retval = rtapi_shmem_delete( shmem_mem );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("shmemtask exit: rtapi_shmem_delete returned %d\n", retval );
return;
! }
!
! rtapi_app_return();
}
--- 106,116 ----
return;
}
! /* TESTING - intentionally skip the shmem_delete
retval = rtapi_shmem_delete( shmem_mem );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("shmemtask exit: rtapi_shmem_delete returned %d\n", retval );
return;
! }*/
! /* Clean up and exit */
! rtapi_exit();
}
|
|
From: <jmk...@us...> - 2003-08-11 04:58:42
|
Update of /cvsroot/emc/rtapi/examples/fifo
In directory sc8-pr-cvs1:/tmp/cvs-serv13330/examples/fifo
Modified Files:
fifotask.c
Log Message:
added error recovery and cleanup to rtai_rtapi
Index: fifotask.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/fifo/fifotask.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** fifotask.c 10 Aug 2003 23:52:35 -0000 1.12
--- fifotask.c 11 Aug 2003 04:58:39 -0000 1.13
***************
*** 40,44 ****
total += len + 4;
buffer[4 + n] = (char) '\0';
! rtapi_print_msg(2, "fifotask: total %d, wrote '%s',\n", total, buffer);
count++;
len++;
--- 40,44 ----
total += len + 4;
buffer[4 + n] = (char) '\0';
! rtapi_print_msg(2, "fifotask: total %d, wrote '%s'\n", total, buffer);
count++;
len++;
***************
*** 58,61 ****
--- 58,65 ----
int fifo_prio;
+ if (rtapi_init() != RTAPI_SUCCESS ) {
+ return -1;
+ }
+
/* allocate and initialize the fifo */
retval = rtapi_fifo_new(FIFO_KEY, FIFO_SIZE, &fifo);
***************
*** 88,92 ****
retval = rtapi_task_start(fifo_task, fifo_code,
0, fifo_prio,
! FIFO_STACKSIZE, FIFO_PERIOD_NSEC, NOW,
RTAPI_NO_FP);
if (retval != RTAPI_SUCCESS) {
--- 92,96 ----
retval = rtapi_task_start(fifo_task, fifo_code,
0, fifo_prio,
! FIFO_STACKSIZE, FIFO_PERIOD_NSEC, RTAPI_NOW,
RTAPI_NO_FP);
if (retval != RTAPI_SUCCESS) {
***************
*** 122,133 ****
rtapi_print("fifotask exit: rtapi_task_delete failed with %d\n", retval);
}
!
retval = rtapi_fifo_delete(fifo);
if (retval != RTAPI_SUCCESS) {
rtapi_print("fifotask exit: rtapi_fifo_delete failed with %d\n", retval);
! }
rtapi_print("fifotask exit: done\n");
! rtapi_app_return();
}
--- 126,137 ----
rtapi_print("fifotask exit: rtapi_task_delete failed with %d\n", retval);
}
! /* TESTING - Intentionally fail to delete fifo
retval = rtapi_fifo_delete(fifo);
if (retval != RTAPI_SUCCESS) {
rtapi_print("fifotask exit: rtapi_fifo_delete failed with %d\n", retval);
! } */
rtapi_print("fifotask exit: done\n");
! rtapi_exit();
}
|
|
From: <pa...@us...> - 2003-08-10 23:52:38
|
Update of /cvsroot/emc/rtapi/src/rtapi
In directory sc8-pr-cvs1:/tmp/cvs-serv4147/src/rtapi
Modified Files:
rtai_rtapi.c rtapi.h sim_rtapi.c
Log Message:
Checks on rtapi_task_start() start time made..
Index: rtai_rtapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtai_rtapi.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** rtai_rtapi.c 10 Aug 2003 22:44:11 -0000 1.17
--- rtai_rtapi.c 10 Aug 2003 23:52:35 -0000 1.18
***************
*** 397,403 ****
}
if (period_nsec > 0) {
/* start the task in periodic mode */
! retval = rt_task_make_periodic(&(task->ostask), rt_get_time(),
nano2count((RTIME) period_nsec));
if (retval != 0) {
--- 397,410 ----
}
+ if (when == NOW) {
+ when = rt_get_time() + 5; /* give it time to get the task running */
+ } else {
+ if (when < (rt_get_time() + 5)) {
+ return RTAPI_LATE;
+ }
+ }
if (period_nsec > 0) {
/* start the task in periodic mode */
! retval = rt_task_make_periodic(&(task->ostask), when,
nano2count((RTIME) period_nsec));
if (retval != 0) {
Index: rtapi.h
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtapi.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** rtapi.h 10 Aug 2003 22:44:11 -0000 1.15
--- rtapi.h 10 Aug 2003 23:52:35 -0000 1.16
***************
*** 220,223 ****
--- 220,224 ----
#define RTAPI_NO_FP 0
#define RTAPI_USES_FP 1
+ #define NOW 0
extern int rtapi_task_start(rtapi_task_handle task,
***************
*** 358,361 ****
--- 359,369 ----
extern int rtapi_fifo_delete(rtapi_fifo_handle fifo);
+
+ /** FIFO notes. These comments apply to both read and write functions. *
+ * A fifo is a character device, an int is typically four bytes long... *
+ * If less than four bytes are sent to the fifo, expect corrupt data *
+ * out of the other end ! *
+ * The RTAI programming manual clearly states that the programmer is *
+ * responsible for the data format and integrity. */
/** 'rtapi_fifo_read()' reads data from 'fifo'. 'buf' is a buffer for *
Index: sim_rtapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/sim_rtapi.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** sim_rtapi.c 9 Aug 2003 19:43:09 -0000 1.6
--- sim_rtapi.c 10 Aug 2003 23:52:35 -0000 1.7
***************
*** 172,176 ****
int arg, int prio,
unsigned long int stacksize,
! unsigned long int period_nsec, unsigned char uses_fp)
{
int retval;
--- 172,177 ----
int arg, int prio,
unsigned long int stacksize,
! unsigned long int period_nsec,
! unsigned long long when, unsigned char uses_fp)
{
int retval;
|
|
From: <pa...@us...> - 2003-08-10 23:52:38
|
Update of /cvsroot/emc/rtapi/examples/shmem
In directory sc8-pr-cvs1:/tmp/cvs-serv4147/examples/shmem
Modified Files:
shmemtask.c
Log Message:
Checks on rtapi_task_start() start time made..
Index: shmemtask.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/shmem/shmemtask.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** shmemtask.c 10 Aug 2003 22:44:11 -0000 1.5
--- shmemtask.c 10 Aug 2003 23:52:35 -0000 1.6
***************
*** 77,81 ****
0, shmem_prio,
SHMEM_STACKSIZE,
! SHMEM_PERIOD_NSEC, 0, RTAPI_NO_FP );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("shmemtask init: rtapi_task_start returned %d\n", retval );
--- 77,82 ----
0, shmem_prio,
SHMEM_STACKSIZE,
! SHMEM_PERIOD_NSEC, NOW,
! RTAPI_NO_FP );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("shmemtask init: rtapi_task_start returned %d\n", retval );
|
|
From: <pa...@us...> - 2003-08-10 23:52:38
|
Update of /cvsroot/emc/rtapi/examples/timertask
In directory sc8-pr-cvs1:/tmp/cvs-serv4147/examples/timertask
Modified Files:
timertask.c
Log Message:
Checks on rtapi_task_start() start time made..
Index: timertask.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/timertask/timertask.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** timertask.c 10 Aug 2003 22:44:11 -0000 1.7
--- timertask.c 10 Aug 2003 23:52:35 -0000 1.8
***************
*** 69,73 ****
0, timer_prio,
TIMER_STACKSIZE,
! TASK_PERIOD_NSEC, 0, RTAPI_NO_FP );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("timertask init: rtapi_task_start returned %d\n", retval );
--- 69,74 ----
0, timer_prio,
TIMER_STACKSIZE,
! TASK_PERIOD_NSEC, NOW,
! RTAPI_NO_FP );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("timertask init: rtapi_task_start returned %d\n", retval );
|