|
From: <jmk...@us...> - 2003-08-16 22:29:00
|
Update of /cvsroot/emc/rtapi/src/rtapi
In directory sc8-pr-cvs1:/tmp/cvs-serv7052/src/rtapi
Modified Files:
rtai_rtapi.c rtapi.h
Log Message:
more tweaks to clock_set_period
Index: rtai_rtapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtai_rtapi.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** rtai_rtapi.c 16 Aug 2003 20:29:39 -0000 1.27
--- rtai_rtapi.c 16 Aug 2003 22:28:57 -0000 1.28
***************
*** 130,136 ****
/* Flag used to keep track of timer state */
static int timer_running = 0;
! static unsigned long timer_period = 0;
#define DEFAULT_MAX_SLEEP 10000
! static unsigned long max_sleep = DEFAULT_MAX_SLEEP;
/* misc vars */
--- 130,136 ----
/* Flag used to keep track of timer state */
static int timer_running = 0;
! static long int timer_period = 0;
#define DEFAULT_MAX_SLEEP 10000
! static long int max_sleep = DEFAULT_MAX_SLEEP;
/* misc vars */
***************
*** 640,655 ****
************************************************************************/
! 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)));
--- 640,658 ----
************************************************************************/
! long int rtapi_clock_set_period(long int nsecs)
{
! if (nsecs == 0) {
! /* it's a query, not a command */
! return timer_period;
! }
! if (timer_running) {
! /* already started, can't restart */
! return RTAPI_INVAL;
! }
! /* limit period to 2 micro-seconds min, 1 second max */
! if ((nsecs < 2000 ) || (nsecs > 1000000000L)) {
return RTAPI_INVAL;
}
rt_set_periodic_mode();
timer_period = count2nano(start_rt_timer(nano2count((RTIME) nsecs)));
***************
*** 658,661 ****
--- 661,665 ----
"RTAPI: clock_set_period requested: %d actual: %d\n",
nsecs, timer_period);
+ timer_running = 1;
max_sleep = timer_period / 4;
return timer_period;
***************
*** 669,673 ****
! void rtapi_sleep(unsigned long int nsec)
{
if ( nsec > max_sleep ) {
--- 673,677 ----
! void rtapi_sleep(long int nsec)
{
if ( nsec > max_sleep ) {
***************
*** 678,682 ****
! unsigned long int rtapi_sleep_max(void)
{
return max_sleep;
--- 682,686 ----
! long int rtapi_sleep_max(void)
{
return max_sleep;
***************
*** 877,884 ****
! int rtapi_wait(void)
{
rt_task_wait_period();
- return RTAPI_SUCCESS;
}
--- 881,887 ----
! void rtapi_wait(void)
{
rt_task_wait_period();
}
Index: rtapi.h
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtapi.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** rtapi.h 16 Aug 2003 22:13:28 -0000 1.23
--- rtapi.h 16 Aug 2003 22:28:57 -0000 1.24
***************
*** 166,171 ****
as one nano-second, or as bad as a several microseconds.
*/
! extern void rtapi_sleep(unsigned long int nsec);
! extern unsigned long int rtapi_sleep_max(void);
--- 166,171 ----
as one nano-second, or as bad as a several microseconds.
*/
! extern void rtapi_sleep(long int nsec);
! extern long int rtapi_sleep_max(void);
|