|
From: <jmk...@us...> - 2003-08-05 03:51:04
|
Update of /cvsroot/emc/rtapi/src/rtapi
In directory sc8-pr-cvs1:/tmp/cvs-serv18267/src/rtapi
Modified Files:
rtai_rtapi.c rtapi.h rtl_rtapi.c rtl_ulapi.c ulapi.h
Log Message:
minor tweaks, all examples work except for a fifo overflow bug under rtai
Index: rtai_rtapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtai_rtapi.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** rtai_rtapi.c 4 Aug 2003 06:00:25 -0000 1.12
--- rtai_rtapi.c 5 Aug 2003 03:51:00 -0000 1.13
***************
*** 153,157 ****
}
if (timer_running != 0 ) {
! rt_free_timer();
}
rtapi_print("RTAPI: Shutting down\n");
--- 153,157 ----
}
if (timer_running != 0 ) {
! stop_rt_timer();
}
rtapi_print("RTAPI: Shutting down\n");
***************
*** 173,176 ****
--- 173,185 ----
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;
+ }
+
if ( VERBOSE ) {
rtapi_print ( "RTAPI: clock_set_period ( %ld )\n", nsecs );
***************
*** 178,182 ****
timer_running = 1;
rt_set_periodic_mode();
! return count2nano(start_rt_timer(nano2count((RTIME) nsecs)));
}
--- 187,192 ----
timer_running = 1;
rt_set_periodic_mode();
! start_rt_timer(nano2count((RTIME) nsecs));
! return RTAPI_SUCCESS;
}
Index: rtapi.h
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtapi.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** rtapi.h 4 Aug 2003 06:00:25 -0000 1.11
--- rtapi.h 5 Aug 2003 03:51:00 -0000 1.12
***************
*** 70,86 ****
* multiple realtime tasks in multiple kernel modules. Calling this *
* function after realtime tasks have been started may disrupt the *
! * tasks. Returns a negative error code on failure. On success, *
! * returns either 0, or if the RTOS supports it, the actual timer *
! * period in nanoseconds, (which may not be exactly what was requested *
! * due to hardware limitations). The upper limit for the timer period *
* may be as low as 0.01 seconds, so be sure to check for errors. */
-
- /* FIXME - the request is an unsigned long int, but the return value is
- an ordinary signed int. A request of 3,000,000,000 ( 3 secs) is a
- a legal unsigned number, but when returned as a signed int it will
- be negative, and look like an error to the caller. Possible solutions:
- 1) limit the argument to 1,000,000,000 (1 second), return INVAL if higher
- 2) don't return actual value, just return success or errorcode (as before)
- */
extern int rtapi_clock_set_period(unsigned long int nsecs);
--- 70,75 ----
* multiple realtime tasks in multiple kernel modules. Calling this *
* function after realtime tasks have been started may disrupt the *
! * tasks. Returns a status code. The upper limit for the timer period *
* may be as low as 0.01 seconds, so be sure to check for errors. */
extern int rtapi_clock_set_period(unsigned long int nsecs);
Index: rtl_rtapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtl_rtapi.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** rtl_rtapi.c 4 Aug 2003 06:00:25 -0000 1.2
--- rtl_rtapi.c 5 Aug 2003 03:51:00 -0000 1.3
***************
*** 207,213 ****
task, and instead get one that runs every 0.01 sec, with no
error codes or other way of detecting it. Stupid! To avoid
! this we check here to insure that the timer period is 0.01
! seconds or less. Note that you can still run tasks at slower
! rates, but the timer must run at least 100Hz. */
if ( nsecs > 10000000L ) {
return RTAPI_INVAL;
--- 207,214 ----
task, and instead get one that runs every 0.01 sec, with no
error codes or other way of detecting it. Stupid! To avoid
! this we only allow a timer period of 0.01 seconds or less.
! Note that you can still run tasks at slower rates, but the
! timer must run at least 100Hz. */
!
if ( nsecs > 10000000L ) {
return RTAPI_INVAL;
Index: rtl_ulapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtl_ulapi.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** rtl_ulapi.c 4 Aug 2003 06:00:25 -0000 1.2
--- rtl_ulapi.c 5 Aug 2003 03:51:00 -0000 1.3
***************
*** 90,98 ****
char keystr[KEYSTR_LEN];
/* validate shmemptr */
if (shmemptr == NULL) {
return ULAPI_INVAL;
}
!
/* alloc space for shmem structure */
shmem = malloc(sizeof(struct ulapi_shmem));
--- 90,99 ----
char keystr[KEYSTR_LEN];
+ printf ( "ulapi_shmem_new: entry\n" );
/* validate shmemptr */
if (shmemptr == NULL) {
return ULAPI_INVAL;
}
! printf ( "ulapi_shmem_new: pointer OK\n" );
/* alloc space for shmem structure */
shmem = malloc(sizeof(struct ulapi_shmem));
***************
*** 100,107 ****
--- 101,110 ----
return ULAPI_NOMEM;
}
+ printf ( "ulapi_shmem_new: allocated struct\n" );
/* convert key to a string */
genstr((unsigned int) key, keystr);
/* now get shared memory block from OS */
+ printf ( "ulapi_shmem_new: converted key\n" );
shmem->mem = mbuff_alloc(keystr, size);
if (shmem->mem == NULL) {
***************
*** 109,112 ****
--- 112,116 ----
return ULAPI_NOMEM;
}
+ printf ( "ulapi_shmem_new: opened shmbuf\n" );
/* label as a valid shmem structure */
Index: ulapi.h
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/ulapi.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ulapi.h 19 Jul 2003 07:17:22 -0000 1.4
--- ulapi.h 5 Aug 2003 03:51:00 -0000 1.5
***************
*** 9,15 ****
#define ULAPI_BADH -2 /* bad task, shmem, sem, or fifo handle */
#define ULAPI_INVAL -3 /* invalid argument*/
! #define ULAPI_NOMEM -5 /* not enough memory */
! #define ULAPI_PERM -6 /* permission denied */
! #define ULAPI_BUSY -4 /* resource is busy or locked */
#define ULAPI_NOTFND -7 /* object not found */
#define ULAPI_FAIL -8 /* operation failed */
--- 9,15 ----
#define ULAPI_BADH -2 /* bad task, shmem, sem, or fifo handle */
#define ULAPI_INVAL -3 /* invalid argument*/
! #define ULAPI_NOMEM -4 /* not enough memory */
! #define ULAPI_PERM -5 /* permission denied */
! #define ULAPI_BUSY -6 /* resource is busy or locked */
#define ULAPI_NOTFND -7 /* object not found */
#define ULAPI_FAIL -8 /* operation failed */
|