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
(82) |
May
(78) |
Jun
(100) |
Jul
(96) |
Aug
(170) |
Sep
(13) |
Oct
|
Nov
|
Dec
|
|
From: <jmk...@us...> - 2003-08-04 06:00:27
|
Update of /cvsroot/emc/rtapi/examples/semaphore
In directory sc8-pr-cvs1:/tmp/cvs-serv30223/examples/semaphore
Modified Files:
master.c
Log Message:
RTLinux version now uses new API, everything builds, only timertask is tested
Index: master.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/semaphore/master.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** master.c 2 Aug 2003 19:37:17 -0000 1.3
--- master.c 4 Aug 2003 06:00:25 -0000 1.4
***************
*** 50,54 ****
--- 50,57 ----
/* set the base timer period */
retval = rtapi_clock_set_period(MASTER_PERIOD_NSEC);
+ if ( retval != RTAPI_SUCCESS ) {
rtapi_print( "sem master init: rtapi_clock_set_period returned %d\n", retval );
+ return -1;
+ }
/* set the task priority to one above the lowest; the slave
|
|
From: <jmk...@us...> - 2003-08-04 06:00:27
|
Update of /cvsroot/emc/rtapi/examples/fifo
In directory sc8-pr-cvs1:/tmp/cvs-serv30223/examples/fifo
Modified Files:
fifotask.c
Log Message:
RTLinux version now uses new API, everything builds, only timertask is tested
Index: fifotask.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/fifo/fifotask.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** fifotask.c 3 Aug 2003 02:41:44 -0000 1.6
--- fifotask.c 4 Aug 2003 06:00:24 -0000 1.7
***************
*** 53,58 ****
/* set the base timer period */
retval = rtapi_clock_set_period(FIFO_PERIOD_NSEC);
! rtapi_print("fifotask init: rtapi_clock_set_period returned %d\n",
! retval);
/* set the task priority to lowest, since we only have one task */
--- 53,60 ----
/* set the base timer period */
retval = rtapi_clock_set_period(FIFO_PERIOD_NSEC);
! if (retval != RTAPI_SUCCESS) {
! rtapi_print("fifotask init: rtapi_clock_set_period returned %d\n", retval);
! return -1;
! }
/* set the task priority to lowest, since we only have one task */
|
|
From: <pa...@us...> - 2003-08-03 18:19:42
|
Update of /cvsroot/emc/emc/src/emcmot
In directory sc8-pr-cvs1:/tmp/cvs-serv24097
Modified Files:
emcstepmot.c
Log Message:
EMCMOT_SETUP_PARAMS added to the command handler to prevent iniaxis aborting
Index: emcstepmot.c
===================================================================
RCS file: /cvsroot/emc/emc/src/emcmot/emcstepmot.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** emcstepmot.c 7 May 2003 19:49:50 -0000 1.25
--- emcstepmot.c 3 Aug 2003 18:19:39 -0000 1.26
***************
*** 13,16 ****
--- 13,18 ----
Modification history:
+ 3-Aug-2003 P.C. Added Matt Shaver's EMCMOT_SETUP_PARAMS to the command
+ handler. Without it, iniaxis will abort and bring the whole run down.
14-Dec-2001 FMP set coarseJointPos[] to be the homed position at the
instant it homes. This was left out and caused a one-cycle setting of
***************
*** 991,994 ****
--- 993,1000 ----
break;
+ case EMCMOT_TELEOP:
+ /* Dummy entry to get rid of Comand 36 error.. */
+ break;
+
case EMCMOT_SET_NUM_AXES:
MARK_EMCMOT_CONFIG_CHANGE();
***************
*** 1875,1878 ****
--- 1881,1907 ----
break;
#endif /* ENABLE_PROBING */
+
+ case EMCMOT_SET_STEP_PARAMS:
+ MARK_EMCMOT_CONFIG_CHANGE();
+ /* configure the step pulse times */
+ axis = emcmotCommand->axis;
+ if (axis < 0 ||
+ axis >= EMCMOT_MAX_AXIS) {
+ break;
+ }
+
+ emcmotConfig->setup_time[axis] = emcmotCommand->setup_time;
+ emcmotConfig->hold_time[axis] = emcmotCommand->hold_time;
+ if (emcmotConfig->setup_time[axis] < 1.0)
+ {
+ emcmotConfig->setup_time[axis] = 1.0;
+ }
+
+ if (emcmotConfig->hold_time[axis] < 1.0)
+ {
+ emcmotConfig->hold_time[axis] = 1.0;
+ }
+ break;
+
default:
|
|
From: <jmk...@us...> - 2003-08-03 02:41:47
|
Update of /cvsroot/emc/rtapi/src/rtapi
In directory sc8-pr-cvs1:/tmp/cvs-serv28730/src/rtapi
Modified Files:
rtai_rtapi.c rtapi.h
Log Message:
more tweaking of rtai_rtapi, added debugging printfs
Index: rtai_rtapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtai_rtapi.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** rtai_rtapi.c 2 Aug 2003 23:30:43 -0000 1.10
--- rtai_rtapi.c 3 Aug 2003 02:41:44 -0000 1.11
***************
*** 8,15 ****
#include <linux/module.h>
#include <linux/kernel.h>
! /* FIXME - on my system malloc.h is deprecated, use slab.h instead */
! /* #include <linux/malloc.h> *//* kmalloc(), kfree(), GFP_USER */
! #include <linux/slab.h>
!
#include <rtai.h>
#include <rtai_sched.h>
--- 8,12 ----
#include <linux/module.h>
#include <linux/kernel.h>
! #include <linux/slab.h> /* replaces malloc.h in recent kernels */
#include <rtai.h>
#include <rtai_sched.h>
***************
*** 28,33 ****
--- 25,36 ----
#endif
+ /* declare vsprintf() explicitly instead of including all of <stdio.h>,
+ since we don't need all of it and it may cause problems */
+ extern int vsprintf(char *s, const char *format, va_list arg);
+
#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. */
***************
*** 63,72 ****
#define FIFO_MAGIC 10293
! /* Usage counter so that we don't kill the periodic timer too soon */
! static int usage_count = 0;
! /* declare vsprintf() explicitly instead of including all of <stdio.h>,
! since we don't need all of it and it may cause problems */
! extern int vsprintf(char *s, const char *format, va_list arg);
/* Priority functions. RTAI uses 0 as the highest priority, as the
--- 66,78 ----
#define FIFO_MAGIC 10293
! /* Usage counters to keep track of new/delete calls */
! static int task_usage_count = 0;
! static int shmem_usage_count = 0;
! static int sem_usage_count = 0;
! static int fifo_usage_count = 0;
! static int int_usage_count = 0;
! /* Flag used to keep track of timer state */
! static int timer_running = 0;
/* Priority functions. RTAI uses 0 as the highest priority, as the
***************
*** 117,121 ****
static int rtapi_init(void)
{
! rtapi_print("Initing RTAPI\n");
rt_linux_use_fpu(1);
return RTAPI_SUCCESS;
--- 123,133 ----
static int rtapi_init(void)
{
! rtapi_print("RTAPI: Initing\n");
! task_usage_count = 0;
! shmem_usage_count = 0;
! sem_usage_count = 0;
! fifo_usage_count = 0;
! int_usage_count = 0;
! timer_running = 0;
rt_linux_use_fpu(1);
return RTAPI_SUCCESS;
***************
*** 125,132 ****
static int rtapi_exit(void)
{
! if (usage_count != 0 ) {
! rtapi_print(" Warning, you have %d task handlers active", usage_count);
}
! rtapi_print("Removing RTAPI\n");
return RTAPI_SUCCESS;
}
--- 137,159 ----
static int rtapi_exit(void)
{
! if (task_usage_count != 0 ) {
! rtapi_print("RTAPI: ERROR: %d task(s) allocated but not deleted", task_usage_count);
}
! if (shmem_usage_count != 0 ) {
! rtapi_print("RTAPI: ERROR: %d shared memory block(s) allocated but not deleted", shmem_usage_count);
! }
! if (sem_usage_count != 0 ) {
! rtapi_print("RTAPI: ERROR: %d semaphores(s) allocated but not deleted", sem_usage_count);
! }
! if (fifo_usage_count != 0 ) {
! rtapi_print("RTAPI: ERROR: %d fifo(s) allocated but not deleted", fifo_usage_count);
! }
! if (int_usage_count != 0 ) {
! rtapi_print("RTAPI: ERROR: %d interrupt handler(s) installed but not removed", int_usage_count);
! }
! if (timer_running != 0 ) {
! rt_free_timer();
! }
! rtapi_print("RTAPI: Shutting down\n");
return RTAPI_SUCCESS;
}
***************
*** 146,149 ****
--- 173,180 ----
int rtapi_clock_set_period(unsigned long int nsecs)
{
+ if ( VERBOSE ) {
+ rtapi_print ( "RTAPI: clock_set_period ( %ld )\n", nsecs );
+ }
+ timer_running = 1;
rt_set_periodic_mode();
return count2nano(start_rt_timer(nano2count((RTIME) nsecs)));
***************
*** 176,180 ****
/* increment the usage counter */
! usage_count++;
return RTAPI_SUCCESS;
--- 207,215 ----
/* increment the usage counter */
! task_usage_count++;
!
! if ( VERBOSE ) {
! rtapi_print ( "RTAPI: new_task %p, count = %d\n", task, task_usage_count );
! }
return RTAPI_SUCCESS;
***************
*** 196,200 ****
/* decrement the usage counter */
! usage_count--;
return RTAPI_SUCCESS;
--- 231,239 ----
/* decrement the usage counter */
! task_usage_count--;
!
! if ( VERBOSE ) {
! rtapi_print ( "RTAPI: delete_task %p, count = %d\n", task, task_usage_count );
! }
return RTAPI_SUCCESS;
***************
*** 268,280 ****
}
- /* P.C.
- Added these lines to release the 8254 IRQ and stop the timer
- as it was causing a kernel panic after removing rtai_sched.
- */
-
- if (usage_count == 0) {
- rt_free_timer();
- }
-
retval = rt_task_delete(&(task->ostask));
if (retval != 0) {
--- 307,310 ----
***************
*** 413,416 ****
--- 443,454 ----
/* return handle to the caller */
*shmemptr = shmem;
+
+ /* increment the usage counter */
+ shmem_usage_count++;
+
+ if ( VERBOSE ) {
+ rtapi_print ( "RTAPI: new_shmem %p, key = %d, count = %d\n", shmem, key, shmem_usage_count );
+ }
+
return RTAPI_SUCCESS;
}
***************
*** 448,451 ****
--- 486,497 ----
shmem->magic = 0;
kfree(shmem);
+
+ /* decrement the usage counter */
+ shmem_usage_count--;
+
+ if ( VERBOSE ) {
+ rtapi_print ( "RTAPI: delete_shmem %p, count = %d\n", shmem, shmem_usage_count );
+ }
+
return RTAPI_SUCCESS;
}
***************
*** 492,495 ****
--- 538,549 ----
}
}
+
+ /* increment the usage counter */
+ int_usage_count++;
+
+ if ( VERBOSE ) {
+ rtapi_print ( "RTAPI: assign_interrupt_handler for int %d, count = %d\n", irq, int_usage_count );
+ }
+
return RTAPI_SUCCESS;
}
***************
*** 505,508 ****
--- 559,570 ----
return RTAPI_FAIL;
}
+
+ /* decrement the usage counter */
+ int_usage_count--;
+
+ if ( VERBOSE ) {
+ rtapi_print ( "RTAPI: free_interrupt_handler for int %d, count = %d\n", irq, int_usage_count );
+ }
+
return RTAPI_SUCCESS;
}
***************
*** 558,561 ****
--- 620,631 ----
/* return handle to the caller */
*semptr = sem;
+
+ /* increment the usage counter */
+ sem_usage_count++;
+
+ if ( VERBOSE ) {
+ rtapi_print ( "RTAPI: new_sem %p, count = %d\n", sem, sem_usage_count );
+ }
+
return RTAPI_SUCCESS;
}
***************
*** 577,580 ****
--- 647,658 ----
sem->magic = 0;
kfree(sem);
+
+ /* decrement the usage counter */
+ sem_usage_count--;
+
+ if ( VERBOSE ) {
+ rtapi_print ( "RTAPI: delete_sem %p, count = %d\n", sem, sem_usage_count );
+ }
+
return RTAPI_SUCCESS;
}
***************
*** 652,657 ****
/* create failed */
kfree(fifo);
- rtapi_print("rtapi_fifo_new: rtf_create ( %d, %d ) returned %d\n", key,
- size, retval);
if (retval == ENOMEM) {
/* couldn't allocate memory */
--- 730,733 ----
***************
*** 669,672 ****
--- 745,756 ----
/* return handle to the caller */
*fifoptr = fifo;
+
+ /* increment the usage counter */
+ fifo_usage_count++;
+
+ if ( VERBOSE ) {
+ rtapi_print ( "RTAPI: new_fifo %p, count = %d\n", fifo, fifo_usage_count );
+ }
+
return RTAPI_SUCCESS;
}
***************
*** 688,691 ****
--- 772,783 ----
fifo->magic = 0;
kfree(fifo);
+
+ /* decrement the usage counter */
+ fifo_usage_count--;
+
+ if ( VERBOSE ) {
+ rtapi_print ( "RTAPI: delete_fifo %p, count = %d\n", fifo, fifo_usage_count );
+ }
+
return RTAPI_SUCCESS;
}
Index: rtapi.h
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtapi.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** rtapi.h 2 Aug 2003 19:37:18 -0000 1.9
--- rtapi.h 3 Aug 2003 02:41:44 -0000 1.10
***************
*** 70,74 ****
* multiple realtime tasks in multiple kernel modules. Calling this *
* function after realtime tasks have been started may disrupt the *
! * tasks. Returns a status code. */
extern int rtapi_clock_set_period(unsigned long int nsecs);
--- 70,85 ----
* 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). */
!
! /* 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);
|
|
From: <jmk...@us...> - 2003-08-03 02:41:47
|
Update of /cvsroot/emc/rtapi/examples/fifo
In directory sc8-pr-cvs1:/tmp/cvs-serv28730/examples/fifo
Modified Files:
fifotask.c
Log Message:
more tweaking of rtai_rtapi, added debugging printfs
Index: fifotask.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/fifo/fifotask.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** fifotask.c 2 Aug 2003 19:37:17 -0000 1.5
--- fifotask.c 3 Aug 2003 02:41:44 -0000 1.6
***************
*** 44,65 ****
int fifo_prio;
- /*
- if (0 != rtapi_init()) {
- return -1;
- }
- */
-
/* allocate and initialize the fifo */
- /* debug, remove when working */
- rtapi_print("debug - Calling rtapi_fifo_new()\n");
retval = rtapi_fifo_new(FIFO_KEY, FIFO_SIZE, &fifo);
- /* debug, remove when working */
- rtapi_print("debug - fifotask init: rtapi_fifo_new returned %d\n",
- retval);
if (retval != RTAPI_SUCCESS) {
rtapi_print("fifotask init: rtapi_fifo_new returned %d\n", retval);
return -1;
}
- rtapi_print("fifotask init: created fifo\n");
/* set the base timer period */
--- 44,53 ----
|
|
From: <pa...@us...> - 2003-08-02 23:30:46
|
Update of /cvsroot/emc/rtapi/src/rtapi
In directory sc8-pr-cvs1:/tmp/cvs-serv5224
Modified Files:
rtai_rtapi.c
Log Message:
Usage counter required
Index: rtai_rtapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtai_rtapi.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** rtai_rtapi.c 2 Aug 2003 19:37:18 -0000 1.9
--- rtai_rtapi.c 2 Aug 2003 23:30:43 -0000 1.10
***************
*** 63,66 ****
--- 63,68 ----
#define FIFO_MAGIC 10293
+ /* Usage counter so that we don't kill the periodic timer too soon */
+ static int usage_count = 0;
/* declare vsprintf() explicitly instead of including all of <stdio.h>,
***************
*** 123,126 ****
--- 125,131 ----
static int rtapi_exit(void)
{
+ if (usage_count != 0 ) {
+ rtapi_print(" Warning, you have %d task handlers active", usage_count);
+ }
rtapi_print("Removing RTAPI\n");
return RTAPI_SUCCESS;
***************
*** 170,173 ****
--- 175,181 ----
*taskptr = task;
+ /* increment the usage counter */
+ usage_count++;
+
return RTAPI_SUCCESS;
}
***************
*** 186,189 ****
--- 194,201 ----
task->magic = 0;
kfree(task);
+
+ /* decrement the usage counter */
+ usage_count--;
+
return RTAPI_SUCCESS;
}
***************
*** 257,268 ****
/* P.C.
! Added these two lines to release the 8254 IRQ and stop the timer
as it was causing a kernel panic after removing rtai_sched.
- May well need to impliment a task counter to prevent the timer
- being stopped if calls are made to rtapi_task_stop() by other
- realtime tasks (Do we need a Fix Me here ?).
*/
! rt_reset_irq_to_sym_mode(TIMER_8254_IRQ);
! rt_free_timer();
retval = rt_task_delete(&(task->ostask));
--- 269,279 ----
/* P.C.
! Added these lines to release the 8254 IRQ and stop the timer
as it was causing a kernel panic after removing rtai_sched.
*/
!
! if (usage_count == 0) {
! rt_free_timer();
! }
retval = rt_task_delete(&(task->ostask));
|
|
From: <pa...@us...> - 2003-08-02 19:37:21
|
Update of /cvsroot/emc/rtapi/src/rtapi
In directory sc8-pr-cvs1:/tmp/cvs-serv5825/src/rtapi
Modified Files:
rtai_rtapi.c rtapi.h
Log Message:
Fixes to prevent a kernel panic when removing the rtai_sched
Index: rtai_rtapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtai_rtapi.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** rtai_rtapi.c 25 Jul 2003 22:04:20 -0000 1.8
--- rtai_rtapi.c 2 Aug 2003 19:37:18 -0000 1.9
***************
*** 142,147 ****
{
rt_set_periodic_mode();
! start_rt_timer(nano2count((RTIME) nsecs));
! return RTAPI_SUCCESS;
}
--- 142,151 ----
{
rt_set_periodic_mode();
! return count2nano(start_rt_timer(nano2count((RTIME) nsecs)));
! }
!
! long long int rtapi_get_time(void)
! {
! return rt_get_time_ns();
}
***************
*** 251,254 ****
--- 255,269 ----
return RTAPI_BADH;
}
+
+ /* P.C.
+ Added these two lines to release the 8254 IRQ and stop the timer
+ as it was causing a kernel panic after removing rtai_sched.
+ May well need to impliment a task counter to prevent the timer
+ being stopped if calls are made to rtapi_task_stop() by other
+ realtime tasks (Do we need a Fix Me here ?).
+ */
+ rt_reset_irq_to_sym_mode(TIMER_8254_IRQ);
+ rt_free_timer();
+
retval = rt_task_delete(&(task->ostask));
if (retval != 0) {
Index: rtapi.h
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtapi.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** rtapi.h 25 Jul 2003 01:40:38 -0000 1.8
--- rtapi.h 2 Aug 2003 19:37:18 -0000 1.9
***************
*** 74,77 ****
--- 74,81 ----
extern int rtapi_clock_set_period(unsigned long int nsecs);
+ /** rtapi_get_time returns the time in nano seconds since the timer *
+ * started. Returns an integer value as a 2^63 value. */
+
+ extern long long int rtapi_get_time(void);
/** 'rtapi_task_new()' is the first step in creating a task. Allocs *
|
|
From: <pa...@us...> - 2003-08-02 19:37:21
|
Update of /cvsroot/emc/rtapi/examples/timertask
In directory sc8-pr-cvs1:/tmp/cvs-serv5825/examples/timertask
Modified Files:
timertask.c
Log Message:
Fixes to prevent a kernel panic when removing the rtai_sched
Index: timertask.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/timertask/timertask.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** timertask.c 25 Jul 2003 22:04:34 -0000 1.4
--- timertask.c 2 Aug 2003 19:37:18 -0000 1.5
***************
*** 42,49 ****
/* set the base timer period */
retval = rtapi_clock_set_period(TIMER_PERIOD_NSEC);
! if ( retval != RTAPI_SUCCESS ) {
! rtapi_print( "timertask init: rtapi_clock_set_period returned %d\n", retval );
! return -1;
! }
/* set the task priority to lowest, since we only have one task */
--- 42,46 ----
/* set the base timer period */
retval = rtapi_clock_set_period(TIMER_PERIOD_NSEC);
! rtapi_print( "timertask init: rtapi_clock_set_period returned %d\n", retval );
/* set the task priority to lowest, since we only have one task */
|
|
From: <pa...@us...> - 2003-08-02 19:37:21
|
Update of /cvsroot/emc/rtapi/examples/shmem
In directory sc8-pr-cvs1:/tmp/cvs-serv5825/examples/shmem
Modified Files:
shmemtask.c
Log Message:
Fixes to prevent a kernel panic when removing the rtai_sched
Index: shmemtask.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/shmem/shmemtask.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** shmemtask.c 23 Jul 2003 01:22:49 -0000 1.2
--- shmemtask.c 2 Aug 2003 19:37:18 -0000 1.3
***************
*** 58,65 ****
/* 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;
- }
/* set the task priority to lowest, since we only have one task */
--- 58,62 ----
|
|
From: <pa...@us...> - 2003-08-02 19:37:21
|
Update of /cvsroot/emc/rtapi/examples/semaphore
In directory sc8-pr-cvs1:/tmp/cvs-serv5825/examples/semaphore
Modified Files:
master.c
Log Message:
Fixes to prevent a kernel panic when removing the rtai_sched
Index: master.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/semaphore/master.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** master.c 23 Jul 2003 01:22:49 -0000 1.2
--- master.c 2 Aug 2003 19:37:17 -0000 1.3
***************
*** 50,57 ****
/* set the base timer period */
retval = rtapi_clock_set_period(MASTER_PERIOD_NSEC);
- if ( retval != RTAPI_SUCCESS ) {
rtapi_print( "sem master init: rtapi_clock_set_period returned %d\n", retval );
- return -1;
- }
/* set the task priority to one above the lowest; the slave
--- 50,54 ----
|
|
From: <pa...@us...> - 2003-08-02 19:37:21
|
Update of /cvsroot/emc/rtapi/examples/fifo
In directory sc8-pr-cvs1:/tmp/cvs-serv5825/examples/fifo
Modified Files:
fifotask.c
Log Message:
Fixes to prevent a kernel panic when removing the rtai_sched
Index: fifotask.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/fifo/fifotask.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** fifotask.c 27 Jul 2003 16:33:42 -0000 1.4
--- fifotask.c 2 Aug 2003 19:37:17 -0000 1.5
***************
*** 65,73 ****
/* set the base timer period */
retval = rtapi_clock_set_period(FIFO_PERIOD_NSEC);
- if (retval != RTAPI_SUCCESS) {
rtapi_print("fifotask init: rtapi_clock_set_period returned %d\n",
retval);
- return -1;
- }
/* set the task priority to lowest, since we only have one task */
--- 65,70 ----
|
|
From: <pa...@us...> - 2003-08-02 19:37:21
|
Update of /cvsroot/emc/rtapi
In directory sc8-pr-cvs1:/tmp/cvs-serv5825
Modified Files:
install_realtime_base
Log Message:
Fixes to prevent a kernel panic when removing the rtai_sched
Index: install_realtime_base
===================================================================
RCS file: /cvsroot/emc/rtapi/install_realtime_base,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** install_realtime_base 27 Jul 2003 15:56:43 -0000 1.3
--- install_realtime_base 2 Aug 2003 19:37:17 -0000 1.4
***************
*** 57,63 ****
fi
fi
! if /sbin/modprobe rtai_sched_up 1> ${nullfile} 2>${nullfile} ; then
! echo Installed rtai_sched_up
! fi
if ! /sbin/lsmod | awk '{print $1}' | grep rtai_sched 1> ${nullfile} 2> ${nullfile} ; then
if ! /sbin/modprobe rtai_sched 1> ${nullfile} 2>${nullfile} ; then
--- 57,63 ----
fi
fi
!
! # running setsched in the rtai directory links rtai_sched to the correct
! # scheduler, be it the smp, or up scheduler...
if ! /sbin/lsmod | awk '{print $1}' | grep rtai_sched 1> ${nullfile} 2> ${nullfile} ; then
if ! /sbin/modprobe rtai_sched 1> ${nullfile} 2>${nullfile} ; then
|
|
From: <mag...@us...> - 2003-07-31 18:58:56
|
Update of /cvsroot/emc/emc/src/emcmot
In directory sc8-pr-cvs1:/tmp/cvs-serv16658
Modified Files:
scarakins.c
Log Message:
fixed bug in kinematicsInverse()
Index: scarakins.c
===================================================================
RCS file: /cvsroot/emc/emc/src/emcmot/scarakins.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** scarakins.c 31 May 2003 11:12:25 -0000 1.1
--- scarakins.c 31 Jul 2003 18:58:53 -0000 1.2
***************
*** 73,78 ****
joint[0] = q0;
joint[1] = q1;
! joint[3] = SCARA_D1 - world->tran.z;
! joint[4] = world->c;
*fflags = 0;
--- 73,78 ----
joint[0] = q0;
joint[1] = q1;
! joint[2] = SCARA_D1 - world->tran.z;
! joint[3] = world->c;
*fflags = 0;
***************
*** 82,86 ****
/*
+-------------------------------------------------------+
! | Blindly copied from puma560kins.c |
+-------------------------------------------------------+
*/
--- 82,86 ----
/*
+-------------------------------------------------------+
! | Blindly copied from puma560kins.c |
+-------------------------------------------------------+
*/
***************
*** 98,100 ****
{
return KINEMATICS_BOTH;
! }
\ No newline at end of file
--- 98,100 ----
{
return KINEMATICS_BOTH;
! }
|
|
From: <mag...@us...> - 2003-07-31 18:50:12
|
Update of /cvsroot/emc/documents/lyx In directory sc8-pr-cvs1:/tmp/cvs-serv8803 Modified Files: bdi-install.lyx Log Message: dded copyright notice. Index: bdi-install.lyx =================================================================== RCS file: /cvsroot/emc/documents/lyx/bdi-install.lyx,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** bdi-install.lyx 31 Jul 2003 17:57:37 -0000 1.1 --- bdi-install.lyx 31 Jul 2003 18:15:59 -0000 1.2 *************** *** 332,339 **** \layout Standard ! This document is released under the GNU Free Documentation License. \layout Standard ! See http://www.gnu.org/licenses/fdl.html for detail. \layout Standard --- 332,340 ---- \layout Standard ! This document is a copyright work of Sagar Behere, July 2003. \layout Standard ! This document is released under the GNU Free Documentation License. ! See http://www.gnu.org/licenses/fdl.html for detail. \layout Standard |
|
From: <mag...@us...> - 2003-07-31 18:07:35
|
Update of /cvsroot/emc/documents/lyx In directory sc8-pr-cvs1:/tmp/cvs-serv5013 Added Files: bdi-install.lyx Log Message: getting BDI to work with existing systems --- NEW FILE: bdi-install.lyx --- #LyX 1.1 created this file. For more info see http://www.lyx.org/ \lyxformat 218 \textclass article \language english \inputencoding auto \fontscheme times \graphics dvips \paperfontsize 12 \spacing onehalf \papersize a4paper \paperpackage a4 \use_geometry 0 \use_amsmath 0 \paperorientation portrait \secnumdepth 3 \tocdepth 3 \paragraph_separation indent \defskip medskip \quotes_language english \quotes_times 2 \papercolumns 1 \papersides 1 \paperpagestyle default \layout Title BDI Install Guide \layout Section Introduction \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 Section 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 Section 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 Subsection 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 Subsection 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 Section 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 document once again, determine what went wrong, and try again. \layout Section License and blurbs \layout Standard This document is released under the GNU Free Documentation License. \layout Standard See http://www.gnu.org/licenses/fdl.html for detail. \layout Standard If you find any errors in the document or want to provide feedback, let me know at \emph on be...@sa... \the_end |
|
From: <pa...@us...> - 2003-07-29 22:24:45
|
Update of /cvsroot/emc/emc
In directory sc8-pr-cvs1:/tmp/cvs-serv26695
Modified Files:
emc.run generic.run install_realtime_base remove_realtime_base
Log Message:
Minor change to get the run scripts to work with ADEOS
Index: emc.run
===================================================================
RCS file: /cvsroot/emc/emc/emc.run,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** emc.run 10 Nov 2002 00:08:26 -0000 1.8
--- emc.run 29 Jul 2003 22:24:42 -0000 1.9
***************
*** 101,109 ****
DATESTRING=`date +%Y%m%d%H%M%S`
! # rthal is a symbol inserted by the rtai patch
! # if it is one of the kernel symbols we will use rtai stuff
# otherwise look for rtlinux info.
! if [ $PLATBASE = "linux" ] ; then
! if /sbin/ksyms -a | grep rthal >/dev/null 2>/dev/null ; then
PLAT=linux_rtai;
RTPLAT=rtai;
--- 101,109 ----
DATESTRING=`date +%Y%m%d%H%M%S`
! # rthal or adeos are symbols inserted by one of the rtai patches
! # if either is one of the kernel symbols we will use rtai stuff
# otherwise look for rtlinux info.
! if [ $PLATBASE = "linux" ] ; then
! if /sbin/ksyms -a | grep -E '(rthal|adeos)' > /dev/null 2>/dev/null ; then
PLAT=linux_rtai;
RTPLAT=rtai;
Index: generic.run
===================================================================
RCS file: /cvsroot/emc/emc/generic.run,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** generic.run 7 May 2003 19:49:49 -0000 1.42
--- generic.run 29 Jul 2003 22:24:42 -0000 1.43
***************
*** 95,109 ****
if test x$PLAT = x ; then
! PLATBASE=`uname -s | gawk '{ printf ( "%s",tolower ( $1 ) ) }'`
! PLAT=`uname -sr | sed "y/ /_/" | sed "y/./_/" | sed s/-rtl.\*\$// | sed "y/-/_/" | gawk '{ printf ( "%s",tolower ( $1 ) ) }'`
else
! PLATBASE=`uname -s | gawk '{ printf ( "%s",tolower ( $1 ) ) }'`
fi
! # rthal is a symbol inserted by the rtai patch
! # if it is one of the kernel symbols we will use rtai stuff
# otherwise look for rtlinux info.
if [ $PLATBASE = "linux" ] ; then
! if /sbin/ksyms -a | grep rthal >/dev/null 2>/dev/null ; then
PLAT=linux_rtai;
RTPLAT=rtai;
--- 95,109 ----
if test x$PLAT = x ; then
! PLATBASE=`uname -s | awk '{ printf ( "%s",tolower ( $1 ) ) }'`
! PLAT=`uname -sr | sed "y/ /_/" | sed "y/./_/" | sed s/-rtl.\*\$// | sed "y/-/_/" | awk '{ printf ( "%s",tolower ( $1 ) ) }'`
else
! PLATBASE=`uname -s | awk '{ printf ( "%s",tolower ( $1 ) ) }'`
fi
! # rthal or adeos are symbols inserted by one of the rtai patches
! # if either is one of the kernel symbols we will use rtai stuff
# otherwise look for rtlinux info.
if [ $PLATBASE = "linux" ] ; then
! if /sbin/ksyms -a | grep -E '(rthal|adeos)' > /dev/null 2>/dev/null ; then
PLAT=linux_rtai;
RTPLAT=rtai;
***************
*** 379,389 ****
nmlfile=`$inivar -ini $INIFILE -var NML_FILE -sec EMC`
! ipckeys=`grep SHMEM $nmlfile | gawk '{printf("%x ",$10);}'`
# define the cleanup function
function cleanup() {
! kill -INT `ps -ae | grep lt- | gawk '{print $1}'` >/dev/null 2>/dev/null
sleep 2
! kill -KILL `ps -ae | grep lt- | gawk '{print $1}'` >/dev/null 2>/dev/null
# Kill any displays lying around
--- 379,389 ----
nmlfile=`$inivar -ini $INIFILE -var NML_FILE -sec EMC`
! ipckeys=`grep SHMEM $nmlfile | awk '{printf("%x ",$10);}'`
# define the cleanup function
function cleanup() {
! kill -INT `ps -ae | grep lt- | awk '{print $1}'` >/dev/null 2>/dev/null
sleep 2
! kill -KILL `ps -ae | grep lt- | awk '{print $1}'` >/dev/null 2>/dev/null
# Kill any displays lying around
***************
*** 519,523 ****
# Delete sharedmemory segments and semaphores
for key in $ipckeys ; do
! id=`ipcs -m | grep $key | gawk '{print $2}'`
if [ ${#id} -gt 1 ] ; then
echo "Removing shared memory " $id
--- 519,523 ----
# Delete sharedmemory segments and semaphores
for key in $ipckeys ; do
! id=`ipcs -m | grep $key | awk '{print $2}'`
if [ ${#id} -gt 1 ] ; then
echo "Removing shared memory " $id
***************
*** 528,532 ****
fi
fi
! id=`ipcs -s | grep $key | gawk '{print $2}'`
if [ ${#id} -gt 1 ] ; then
echo "Removing semaphore" $id
--- 528,532 ----
fi
fi
! id=`ipcs -s | grep $key | awk '{print $2}'`
if [ ${#id} -gt 1 ] ; then
echo "Removing semaphore" $id
***************
*** 568,572 ****
if [ -z "$PURE_SIMULATION" ] ; then
if [ "x${PLAT}" = "xautoconf" ] ; then
! REAL_PLATBASE=`uname -s | gawk '{ printf ( "%s",tolower ( $1 ) ) }'`
if [ "x${REAL_PLATBASE}" = "xlinux" ] ; then
./install_realtime_base;
--- 568,572 ----
if [ -z "$PURE_SIMULATION" ] ; then
if [ "x${PLAT}" = "xautoconf" ] ; then
! REAL_PLATBASE=`uname -s | awk '{ printf ( "%s",tolower ( $1 ) ) }'`
if [ "x${REAL_PLATBASE}" = "xlinux" ] ; then
./install_realtime_base;
Index: install_realtime_base
===================================================================
RCS file: /cvsroot/emc/emc/install_realtime_base,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** install_realtime_base 7 May 2003 19:49:49 -0000 1.8
--- install_realtime_base 29 Jul 2003 22:24:42 -0000 1.9
***************
*** 5,9 ****
# It should work with all the different versions of rtlinux and rtai.
# It requires the following utilities:
! # bash,sed,gawk,grep,objdump,modprobe, lsmod, insmod, modinfo and ksyms.
--- 5,9 ----
# It should work with all the different versions of rtlinux and rtai.
# It requires the following utilities:
! # bash,sed,awk,grep,objdump,modprobe, lsmod, insmod, modinfo and ksyms.
***************
*** 22,28 ****
! # If the symbol rthal is found in ksyms assume we are using
# rtai instead of rtlinux.
! if /sbin/ksyms -a | grep rthal >${nullfile} 2>${nullfile} ; then
# Check to see if the rtai module is already installed..
--- 22,28 ----
! # If the symbol rthal or adeos is found in ksyms assume we are using
# rtai instead of rtlinux.
! if /sbin/ksyms -a | grep -E '(rthal|adeos)' >${nullfile} 2>${nullfile} ; then
# Check to see if the rtai module is already installed..
***************
*** 34,38 ****
for i in $rtai_files; do
if [ -f $i ] ; then
! iver=`objdump -s -j .modinfo $i | gawk '{printf("%s", $6)} END {printf("%s\n",$NF);}'| sed 's/[.]parm.*$//' | sed 's/kernel_version=//' | sed 's/[.]$//'`
if [ $iver = $rev ] ; then
/sbin/insmod $i;
--- 34,38 ----
for i in $rtai_files; do
if [ -f $i ] ; then
! iver=`objdump -s -j .modinfo $i | awk '{printf("%s", $6)} END {printf("%s\n",$NF);}'| sed 's/[.]parm.*$//' | sed 's/kernel_version=//' | sed 's/[.]$//'`
if [ $iver = $rev ] ; then
/sbin/insmod $i;
***************
*** 48,52 ****
for i in $rtai_sched_files; do
if [ -f $i ] ; then
! iver=`objdump -s -j .modinfo $i | gawk '{printf("%s", $6)} END {printf("%s\n",$NF);}'| sed 's/[.]parm.*$//' | sed 's/kernel_version=//' | sed 's/[.]$//'`
if [ $iver = $rev ] ; then
/sbin/insmod $i
--- 48,52 ----
for i in $rtai_sched_files; do
if [ -f $i ] ; then
! iver=`objdump -s -j .modinfo $i | awk '{printf("%s", $6)} END {printf("%s\n",$NF);}'| sed 's/[.]parm.*$//' | sed 's/kernel_version=//' | sed 's/[.]$//'`
if [ $iver = $rev ] ; then
/sbin/insmod $i
***************
*** 65,69 ****
for i in $rtai_sched_files; do
if [ -f $i ] ; then
! iver=`objdump -s -j .modinfo $i | gawk '{printf("%s", $6)} END {printf("%s\n",$NF);}'| sed 's/[.]parm.*$//' | sed 's/kernel_version=//' | sed 's/[.]$//'`
if [ $iver = $rev ] ; then
/sbin/insmod $i
--- 65,69 ----
for i in $rtai_sched_files; do
if [ -f $i ] ; then
! iver=`objdump -s -j .modinfo $i | awk '{printf("%s", $6)} END {printf("%s\n",$NF);}'| sed 's/[.]parm.*$//' | sed 's/kernel_version=//' | sed 's/[.]$//'`
if [ $iver = $rev ] ; then
/sbin/insmod $i
***************
*** 79,83 ****
for i in $rtai_shm_files; do
if [ -f $i ] ; then
! iver=`objdump -s -j .modinfo $i | gawk '{printf("%s", $6)} END {printf("%s\n",$NF);}'| sed 's/[.]parm.*$//' | sed 's/kernel_version=//' | sed 's/[.]$//'`
if [ $iver = $rev ] ; then
/sbin/insmod $i;
--- 79,83 ----
for i in $rtai_shm_files; do
if [ -f $i ] ; then
! iver=`objdump -s -j .modinfo $i | awk '{printf("%s", $6)} END {printf("%s\n",$NF);}'| sed 's/[.]parm.*$//' | sed 's/kernel_version=//' | sed 's/[.]$//'`
if [ $iver = $rev ] ; then
/sbin/insmod $i;
***************
*** 93,97 ****
for i in $rtai_shm_files; do
if [ -f $i ] ; then
! iver=`objdump -s -j .modinfo $i | gawk '{printf("%s", $6)} END {printf("%s\n",$NF);}'| sed 's/[.]parm.*$//' | sed 's/kernel_version=//' | sed 's/[.]$//'`
if [ $iver = $rev ] ; then
/sbin/insmod $i;
--- 93,97 ----
for i in $rtai_shm_files; do
if [ -f $i ] ; then
! iver=`objdump -s -j .modinfo $i | awk '{printf("%s", $6)} END {printf("%s\n",$NF);}'| sed 's/[.]parm.*$//' | sed 's/kernel_version=//' | sed 's/[.]$//'`
if [ $iver = $rev ] ; then
/sbin/insmod $i;
Index: remove_realtime_base
===================================================================
RCS file: /cvsroot/emc/emc/remove_realtime_base,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** remove_realtime_base 17 Dec 2002 13:58:28 -0000 1.6
--- remove_realtime_base 29 Jul 2003 22:24:42 -0000 1.7
***************
*** 14,18 ****
# Get a list of currently installed modules.
! modules=`/sbin/lsmod | gawk '{print $1}'`
for mod in $modules ; do
--- 14,18 ----
# Get a list of currently installed modules.
! modules=`/sbin/lsmod | awk '{print $1}'`
for mod in $modules ; do
***************
*** 22,26 ****
continue;
fi
! depends=`/sbin/lsmod | sed 'y/[/ /' | sed 'y/]/ /' | sed 's#(unused)##' | sed 's#unused##' | gawk '/^'$mod'/ {print $4 " " $5 " " $6 " " $7 " " $8}'`
dependcount=`echo $depends | wc -w`
if [ $dependcount -gt 0 ] ; then
--- 22,26 ----
continue;
fi
! depends=`/sbin/lsmod | sed 'y/[/ /' | sed 'y/]/ /' | sed 's#(unused)##' | sed 's#unused##' | awk '/^'$mod'/ {print $4 " " $5 " " $6 " " $7 " " $8}'`
dependcount=`echo $depends | wc -w`
if [ $dependcount -gt 0 ] ; then
|
|
From: <pa...@us...> - 2003-07-27 16:37:45
|
Update of /cvsroot/emc/rtapi In directory sc8-pr-cvs1:/tmp/cvs-serv26551 Removed Files: NOTES Log Message: Deleted redundant junk file --- NOTES DELETED --- |
|
From: <pa...@us...> - 2003-07-27 16:33:45
|
Update of /cvsroot/emc/rtapi/src/rtapi In directory sc8-pr-cvs1:/tmp/cvs-serv26019/src/rtapi Removed Files: localdefs.h Log Message: Deleted auto-generated files --- localdefs.h DELETED --- |
|
From: <pa...@us...> - 2003-07-27 16:33:45
|
Update of /cvsroot/emc/rtapi/examples/fifo
In directory sc8-pr-cvs1:/tmp/cvs-serv26019/examples/fifo
Modified Files:
fifotask.c fifousr.c
Log Message:
Deleted auto-generated files
Index: fifotask.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/fifo/fifotask.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** fifotask.c 25 Jul 2003 04:11:55 -0000 1.3
--- fifotask.c 27 Jul 2003 16:33:42 -0000 1.4
***************
*** 17,21 ****
/* task code, executed each timer interrupt */
! void fifo_code( int arg )
{
int n;
--- 17,21 ----
/* task code, executed each timer interrupt */
! void fifo_code(int arg)
{
int n;
***************
*** 23,34 ****
while (1) {
! for ( n = 0 ; n < count ; n++ ) {
buffer[n] = '0' + count;
}
! rtapi_fifo_write ( fifo, buffer, count );
buffer[n] = '\0';
! rtapi_print ( "fifotask: wrote '%s'\n", buffer );
count++;
! if ( count > 9 )
count = 1;
rtapi_wait();
--- 23,34 ----
while (1) {
! for (n = 0; n < count; n++) {
buffer[n] = '0' + count;
}
! rtapi_fifo_write(fifo, buffer, count);
buffer[n] = '\0';
! rtapi_print("fifotask: wrote '%s'\n", buffer);
count++;
! if (count > 9)
count = 1;
rtapi_wait();
***************
*** 45,67 ****
/*
! if (0 != rtapi_init()) {
! return -1;
! }
! */
/* allocate and initialize the fifo */
! /* debug, remove when working */ rtapi_print ( "debug - Calling rtapi_fifo_new()\n" );
! retval = rtapi_fifo_new( FIFO_KEY, FIFO_SIZE, &fifo );
! /* debug, remove when working */ rtapi_print( "debug - fifotask init: rtapi_fifo_new returned %d\n", retval );
! if ( retval != RTAPI_SUCCESS ) {
! rtapi_print( "fifotask init: rtapi_fifo_new returned %d\n", retval );
return -1;
}
! rtapi_print("fifotask init: created fifo\n" );
/* set the base timer period */
retval = rtapi_clock_set_period(FIFO_PERIOD_NSEC);
! if ( retval != RTAPI_SUCCESS ) {
! rtapi_print( "fifotask init: rtapi_clock_set_period returned %d\n", retval );
return -1;
}
--- 45,71 ----
/*
! if (0 != rtapi_init()) {
! return -1;
! }
! */
/* allocate and initialize the fifo */
! /* debug, remove when working */
! rtapi_print("debug - Calling rtapi_fifo_new()\n");
! retval = rtapi_fifo_new(FIFO_KEY, FIFO_SIZE, &fifo);
! /* debug, remove when working */
! rtapi_print("debug - fifotask init: rtapi_fifo_new returned %d\n",
! retval);
! if (retval != RTAPI_SUCCESS) {
! rtapi_print("fifotask init: rtapi_fifo_new returned %d\n", retval);
return -1;
}
! rtapi_print("fifotask init: created fifo\n");
/* set the base timer period */
retval = rtapi_clock_set_period(FIFO_PERIOD_NSEC);
! if (retval != RTAPI_SUCCESS) {
! rtapi_print("fifotask init: rtapi_clock_set_period returned %d\n",
! retval);
return -1;
}
***************
*** 71,87 ****
/* launch the fifo task */
! retval = rtapi_task_new( &fifo_task );
! if ( retval != RTAPI_SUCCESS ) {
! rtapi_print( "fifotask init: rtapi_task_new returned %d\n", retval );
return -1;
}
/* start the fifo task */
! retval = rtapi_task_start( fifo_task, fifo_code,
! 0, fifo_prio,
! FIFO_STACKSIZE,
! FIFO_PERIOD_NSEC, RTAPI_NO_FP );
! if ( retval != RTAPI_SUCCESS ) {
! rtapi_print("fifotask init: rtapi_task_start returned %d\n", retval );
return -1;
}
--- 75,90 ----
/* launch the fifo task */
! retval = rtapi_task_new(&fifo_task);
! if (retval != RTAPI_SUCCESS) {
! rtapi_print("fifotask init: rtapi_task_new returned %d\n", retval);
return -1;
}
/* start the fifo task */
! retval = rtapi_task_start(fifo_task, fifo_code,
! 0, fifo_prio,
! FIFO_STACKSIZE, FIFO_PERIOD_NSEC, RTAPI_NO_FP);
! if (retval != RTAPI_SUCCESS) {
! rtapi_print("fifotask init: rtapi_task_start returned %d\n", retval);
return -1;
}
***************
*** 97,118 ****
int retval;
! retval = rtapi_task_stop( fifo_task );
! if ( retval != RTAPI_SUCCESS ) {
! rtapi_print("fifotask exit: rtapi_task_stop returned %d\n", retval );
return;
}
! retval = rtapi_task_delete( fifo_task );
! if ( retval != RTAPI_SUCCESS ) {
! rtapi_print("fifotask exit: rtapi_task_delete returned %d\n", retval );
return;
}
! retval = rtapi_fifo_delete( fifo );
! if ( retval != RTAPI_SUCCESS ) {
! rtapi_print("fifotask exit: rtapi_fifo_delete returned %d\n", retval );
return;
}
! rtapi_print("fifotask exit: done\n" );
rtapi_app_return();
--- 100,121 ----
int retval;
! retval = rtapi_task_stop(fifo_task);
! if (retval != RTAPI_SUCCESS) {
! rtapi_print("fifotask exit: rtapi_task_stop returned %d\n", retval);
return;
}
! retval = rtapi_task_delete(fifo_task);
! if (retval != RTAPI_SUCCESS) {
! rtapi_print("fifotask exit: rtapi_task_delete returned %d\n", retval);
return;
}
! retval = rtapi_fifo_delete(fifo);
! if (retval != RTAPI_SUCCESS) {
! rtapi_print("fifotask exit: rtapi_fifo_delete returned %d\n", retval);
return;
}
! rtapi_print("fifotask exit: done\n");
rtapi_app_return();
Index: fifousr.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/fifo/fifousr.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** fifousr.c 25 Jul 2003 04:11:55 -0000 1.3
--- fifousr.c 27 Jul 2003 16:33:42 -0000 1.4
***************
*** 25,37 ****
retval = ulapi_init();
! if ( retval != ULAPI_SUCCESS ) {
! printf("fifousr main: ulapi_init returned %d\n", retval );
return -1;
}
/* open the fifo */
! retval = ulapi_fifo_new( FIFO_KEY, FIFO_SIZE, 'R', &fifo );
! if ( retval != ULAPI_SUCCESS ) {
! printf( "fifousr main: ulapi_fifo_new returned %d\n", retval );
return -1;
}
--- 25,37 ----
retval = ulapi_init();
! if (retval != ULAPI_SUCCESS) {
! printf("fifousr main: ulapi_init returned %d\n", retval);
return -1;
}
/* open the fifo */
! retval = ulapi_fifo_new(FIFO_KEY, FIFO_SIZE, 'R', &fifo);
! if (retval != ULAPI_SUCCESS) {
! printf("fifousr main: ulapi_fifo_new returned %d\n", retval);
return -1;
}
***************
*** 41,54 ****
signal(SIGINT, quit);
! printf ( "waiting for fifo data, ctrl-C to quit\n" );
while (1) {
! nchars = ulapi_fifo_read( fifo, buffer, FIFO_SIZE );
! if ( retval < 0 ) {
! printf ( "fifousr main: ulapi_fifo_read returned %d\n", nchars );
! }
! else {
! buffer[nchars] = '\0';
! printf("fifousr main: read %d chars: '%s'\n", nchars, buffer);
}
}
--- 41,53 ----
signal(SIGINT, quit);
! printf("waiting for fifo data, ctrl-C to quit\n");
while (1) {
! nchars = ulapi_fifo_read(fifo, buffer, FIFO_SIZE);
! if (retval < 0) {
! printf("fifousr main: ulapi_fifo_read returned %d\n", nchars);
! } else {
! buffer[nchars] = '\0';
! printf("fifousr main: read %d chars: '%s'\n", nchars, buffer);
}
}
***************
*** 56,64 ****
END:
! printf( "shutting down\n" );
! retval = ulapi_fifo_delete( fifo );
! if ( retval != ULAPI_SUCCESS ) {
! printf( "fifousr main: ulapi_fifo_delete returned %d\n", retval );
return -1;
}
--- 55,63 ----
END:
! printf("shutting down\n");
! retval = ulapi_fifo_delete(fifo);
! if (retval != ULAPI_SUCCESS) {
! printf("fifousr main: ulapi_fifo_delete returned %d\n", retval);
return -1;
}
|
|
From: <pa...@us...> - 2003-07-27 16:33:45
|
Update of /cvsroot/emc/rtapi In directory sc8-pr-cvs1:/tmp/cvs-serv26019 Removed Files: Makefile.inc Log Message: Deleted auto-generated files --- Makefile.inc DELETED --- |
|
From: <jmk...@us...> - 2003-07-27 15:56:46
|
Update of /cvsroot/emc/rtapi/src/rtapi In directory sc8-pr-cvs1:/tmp/cvs-serv19600/src/rtapi Modified Files: localdefs.h Log Message: modified install_realtime_base and remove_realtime_base to install/remove RTAPI Index: localdefs.h =================================================================== RCS file: /cvsroot/emc/rtapi/src/rtapi/localdefs.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** localdefs.h 25 Jul 2003 01:40:38 -0000 1.6 --- localdefs.h 27 Jul 2003 15:56:43 -0000 1.7 *************** *** 2,6 **** #define LOCALDEFS_H ! /* automatically generated by config script on Thu Jul 24 21:36:47 EDT 2003 */ #define LOCAL_MHZ 233.866 --- 2,6 ---- #define LOCALDEFS_H ! /* automatically generated by config script on Fri Jul 25 22:14:05 EDT 2003 */ #define LOCAL_MHZ 233.866 |
|
From: <jmk...@us...> - 2003-07-27 15:56:46
|
Update of /cvsroot/emc/rtapi
In directory sc8-pr-cvs1:/tmp/cvs-serv19600
Modified Files:
install_realtime_base remove_realtime_base
Log Message:
modified install_realtime_base and remove_realtime_base to install/remove RTAPI
Index: install_realtime_base
===================================================================
RCS file: /cvsroot/emc/rtapi/install_realtime_base,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** install_realtime_base 22 Jul 2003 17:20:21 -0000 1.2
--- install_realtime_base 27 Jul 2003 15:56:43 -0000 1.3
***************
*** 102,105 ****
--- 102,109 ----
fi
fi
+ # start up the RTAPI if present
+ if [ -f rtlib/rtai_rtapi.o ] ; then
+ /sbin/insmod rtlib/rtai_rtapi.o
+ fi
exit 0
fi
***************
*** 176,179 ****
--- 180,188 ----
/sbin/insmod -f /lib/modules/$rev/misc/rtl_fifo.o
fi
+ fi
+
+ # start up the RTAPI if present
+ if [ -f rtlib/rtl_rtapi.o ] ; then
+ /sbin/insmod rtlib/rtl_rtapi.o
fi
Index: remove_realtime_base
===================================================================
RCS file: /cvsroot/emc/rtapi/remove_realtime_base,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** remove_realtime_base 8 Jul 2003 15:54:38 -0000 1.1.1.1
--- remove_realtime_base 27 Jul 2003 15:56:43 -0000 1.2
***************
*** 9,16 ****
fi
! if [ -e /dev/mbuff ] ; then
/sbin/fuser -v /dev/mbuff 2>/dev/null && echo "Can't remove realtime modules, kill the above processes first". && exit 0
fi
# Get a list of currently installed modules.
modules=`/sbin/lsmod | gawk '{print $1}'`
--- 9,40 ----
fi
! if [ -e /dev/mbuff ] ; then
/sbin/fuser -v /dev/mbuff 2>/dev/null && echo "Can't remove realtime modules, kill the above processes first". && exit 0
fi
+ # check for the presence of RTAPI
+ RTAPI_STR=$(/sbin/lsmod | grep -E '(^rtl_rtapi|^rtai_rtapi)')
+ if [ "$RTAPI_STR" ] ; then
+ # check for application(s) using RTAPI
+ RTAPI_BUSY=$(echo $RTAPI_STR | grep [[] | wc -l )
+ if [ $RTAPI_BUSY -gt 0 ] ; then
+ # can't remove anything, realtime tasks might be running
+ # get name(s) of running apps - between '[' and ']'
+ RTAPI_APP=$(echo $RTAPI_STR | sed s/^.*[[]/[/)
+ echo "Can't remove realtime base, shut down $RTAPI_APP first"
+ exit -1
+ fi
+ echo Removing RTAPI
+ RTAPI_RTL=$(echo $RTAPI_STR | grep rtl | wc -l)
+ if [ $RTAPI_RTL -gt 0 ] ; then
+ /sbin/rmmod rtl_rtapi
+ fi
+ RTAPI_RTAI=$(echo $RTAPI_STR | grep rtai | wc -l)
+ if [ $RTAPI_RTAI -gt 0 ] ; then
+ /sbin/rmmod rtai_rtapi
+ fi
+ fi
+
+
# Get a list of currently installed modules.
modules=`/sbin/lsmod | gawk '{print $1}'`
***************
*** 23,28 ****
fi
depends=`/sbin/lsmod | sed 'y/[/ /' | sed 'y/]/ /' | sed 's#(unused)##' | sed 's#unused##' | gawk '/^'$mod'/ {print $4 " " $5 " " $6 " " $7 " " $8}'`
! dependcount=`echo $depends | wc -w`
! if [ $dependcount -gt 0 ] ; then
echo Removing kernel module $mod and anything that depends on it.
echo Including $depends
--- 47,52 ----
fi
depends=`/sbin/lsmod | sed 'y/[/ /' | sed 'y/]/ /' | sed 's#(unused)##' | sed 's#unused##' | gawk '/^'$mod'/ {print $4 " " $5 " " $6 " " $7 " " $8}'`
! dependcount=`echo $depends | wc -w`
! if [ $dependcount -gt 0 ] ; then
echo Removing kernel module $mod and anything that depends on it.
echo Including $depends
***************
*** 31,35 ****
echo Removing kernel module $mod
/sbin/rmmod $mod
! fi
;;
*)
--- 55,59 ----
echo Removing kernel module $mod
/sbin/rmmod $mod
! fi
;;
*)
***************
*** 37,41 ****
esac
done
!
exit 0
--- 61,65 ----
esac
done
!
exit 0
|
|
From: <pa...@us...> - 2003-07-26 22:06:29
|
Update of /cvsroot/emc/rtapi
In directory sc8-pr-cvs1:/tmp/cvs-serv21491
Added Files:
CodingStyle
Log Message:
Initial version
--- NEW FILE: CodingStyle ---
Version: $Id: CodingStyle,v 1.1 2003/07/26 22:06:26 paul_c Exp $
Introduction
Most of this style guide has been copied wholesale from the linux kernel
documents - See linux/Documentation/CodingStyle for the full text.
Indentation
Rationale: The whole idea behind indentation is to clearly define where
a block of control starts and ends. Especially when you've been looking
at your screen for 20 straight hours, you'll find it a lot easier to see
how the indentation works if you have large indentations.
Now, some people will claim that having 8-character indentations makes
the code move too far to the right, and makes it hard to read on a
80-character terminal screen. The answer to that is that if you need
more than 3 levels of indentation, you're screwed anyway, and should fix
your program.
Placing Braces
The other issue that always comes up in C styling is the placement of
braces. Unlike the indent size, there are few technical reasons to
choose one placement strategy over the other, but the preferred way, as
shown to us by the prophets Kernighan and Ritchie, is to put the opening
brace last on the line, and put the closing brace first, thusly:
if (x is true) {
we do y
}
However, there is one special case, namely functions: they have the
opening brace at the beginning of the next line, thus:
int function(int x)
{
body of function
}
Note that the closing brace is empty on a line of its own, _except_ in
the cases where it is followed by a continuation of the same statement,
ie a "while" in a do-statement or an "else" in an if-statement, like
this:
do {
body of do-loop
} while (condition);
and
if (x == y) {
..
} else if (x > y) {
...
} else {
....
}
Also, note that this brace-placement also minimizes the number of empty
(or almost empty) lines, without any loss of readability. Thus, as the
supply of new-lines on your screen is not a renewable resource (think
25-line terminal screens here), you have more empty lines to put
comments on.
Naming
C is a Spartan language, and so should your naming be. Unlike Modula-2
and Pascal programmers, C programmers do not use cute names like
ThisVariableIsATemporaryCounter. A C programmer would call that
variable "tmp", which is much easier to write, and not the least more
difficult to understand.
HOWEVER, while mixed-case names are frowned upon, descriptive names for
global variables are a must. To call a global function "foo" is a
shooting offense.
GLOBAL variables (to be used only if you _really_ need them) need to
have descriptive names, as do global functions. If you have a function
that counts the number of active users, you should call that
"count_active_users()" or similar, you should _not_ call it "cntusr()".
Encoding the type of a function into the name (so-called Hungarian
notation) is brain damaged - the compiler knows the types anyway and can
check those, and it only confuses the programmer. No wonder MicroSoft
makes buggy programs.
LOCAL variable names should be short, and to the point. If you have
some random integer loop counter, it should probably be called "i".
Calling it "loop_counter" is non-productive, if there is no chance of it
being mis-understood. Similarly, "tmp" can be just about any type of
variable that is used to hold a temporary value.
If you are afraid to mix up your local variable names, you have another
problem, which is called the function-growth-hormone-imbalance syndrome.
See next chapter.
Functions
Functions should be short and sweet, and do just one thing. They should
fit on one or two screenfuls of text (the ISO/ANSI screen size is 80x24,
as we all know), and do one thing and do that well.
The maximum length of a function is inversely proportional to the
complexity and indentation level of that function. So, if you have a
conceptually simple function that is just one long (but simple)
case-statement, where you have to do lots of small things for a lot of
different cases, it's OK to have a longer function.
However, if you have a complex function, and you suspect that a
less-than-gifted first-year high-school student might not even
understand what the function is all about, you should adhere to the
maximum limits all the more closely. Use helper functions with
descriptive names (you can ask the compiler to in-line them if you think
it's performance-critical, and it will probably do a better job of it
that you would have done).
Another measure of the function is the number of local variables. They
shouldn't exceed 5-10, or you're doing something wrong. Re-think the
function, and split it into smaller pieces. A human brain can
generally easily keep track of about 7 different things, anything more
and it gets confused. You know you're brilliant, but maybe you'd like
to understand what you did 2 weeks from now.
Commenting
Comments are good, but there is also a danger of over-commenting. NEVER
try to explain HOW your code works in a comment: it's much better to
write the code so that the _working_ is obvious, and it's a waste of
time to explain badly written code.
Generally, you want your comments to tell WHAT your code does, not HOW.
Also, try to avoid putting comments inside a function body: if the
function is so complex that you need to separately comment parts of it,
you should probably re-read the Functions section again. You can make
small comments to note or warn about something particularly clever (or
ugly), but try to avoid excess. Instead, put the comments at the head
of the function, telling people what it does, and possibly WHY it does
it.
If comments along the lines of /* Fix me */ are used, please, please, say
why something needs fixing. When a change has been made to the affected
portion of code, either remove the comment, or amend it indicate a change
has been made and needs testing.
Shell Scripts & Makefiles
Not everyone has the same tools and packages installed. Some people use
vi, others emacs - A few even avoid having either package installed,
prefering a lightweight text editor such as nano or the one built in to
Midnight Commander.
gawk versus mawk - Again, not everyone will have gawk installed, mawk is
nearly a tenth of the size and yet conforms to the Posix AWK standard. If
some obscure gawk specific command is needed that mawk does not provide,
than the script will break for some users. The same would apply to mawk.
In short, use the generic awk invocation in preference to gawk or mawk.
CVS Notes
cvs is a very powefull tool that many developers fail to use to it's full
potential. http://www.red-bean/cvsbook should be compulsory reading for
anyone wanting to use cvs. The chapters on tags, branching, and merging
can appear daunting at first. Chapters covering administration, however,
can be skipped.
CVS Tags
Tagging files within the cvs repository enables us to mark a set of files
with a specific marker. This provides a simple mechanism to retrive code
thus marked. The tags could indicate a stable version, or be a precursor to
branching. Apart from branch tags, the recommendation is to prefix all tags
with the developers initials.
Note: Tags prefixed with bdi or BDI are reserved for use in conjunction with
the Brain Dead Install project.
Do not put anything below this point. The revision log is automatically appended
################################################################################
Revision Log
################################################################################
$Log: CodingStyle,v $
Revision 1.1 2003/07/26 22:06:26 paul_c
Initial version
|
|
From: <pa...@us...> - 2003-07-26 01:47:19
|
Update of /cvsroot/emc/rtapi/src/rtapi
In directory sc8-pr-cvs1:/tmp/cvs-serv8211/rtapi
Modified Files:
rtai_rtapi.c rtai_ulapi.c
Log Message:
Added braces to some of the conditional routines
Index: rtai_rtapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtai_rtapi.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** rtai_rtapi.c 25 Jul 2003 04:11:55 -0000 1.7
--- rtai_rtapi.c 25 Jul 2003 22:04:20 -0000 1.8
***************
*** 9,13 ****
#include <linux/kernel.h>
/* FIXME - on my system malloc.h is deprecated, use slab.h instead */
! /* #include <linux/malloc.h> */ /* kmalloc(), kfree(), GFP_USER */
#include <linux/slab.h>
--- 9,13 ----
#include <linux/kernel.h>
/* FIXME - on my system malloc.h is deprecated, use slab.h instead */
! /* #include <linux/malloc.h> *//* kmalloc(), kfree(), GFP_USER */
#include <linux/slab.h>
[...1053 lines suppressed...]
! int rtapi_fifo_write(rtapi_fifo_handle fifo, char *buf,
! unsigned long int size)
{
! int retval;
/* validate fifo handle */
! if (fifo == NULL) {
return RTAPI_BADH;
! }
! if (fifo->magic != FIFO_MAGIC) {
return RTAPI_BADH;
! }
/* get whatever data is available */
! retval = rtf_put(fifo->fd, buf, size);
! if (retval < 0) {
return RTAPI_INVAL;
+ }
return retval;
}
Index: rtai_ulapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtai_ulapi.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** rtai_ulapi.c 19 Jul 2003 07:17:22 -0000 1.2
--- rtai_ulapi.c 25 Jul 2003 22:04:20 -0000 1.3
***************
*** 19,38 ****
struct ulapi_shmem {
! int magic; /* to check for valid handle */
! int key; /* key to shared memory area */
! unsigned long int size; /* size of shared memory area */
! void *mem; /* pointer to the memory */
! };
struct ulapi_fifo {
! int magic; /* to check for valid handle */
! int key; /* key to fifo */
! int fd; /* file descripter for fifo */
! int mode; /* O_RDONLY or O_WRONLY */
! unsigned long int size; /* size of fifo area */
! };
! #define SHMEM_MAGIC 25453 /* random numbers used as signatures */
#define FIFO_MAGIC 10293
--- 19,38 ----
struct ulapi_shmem {
! int magic; /* to check for valid handle */
! int key; /* key to shared memory area */
! unsigned long int size; /* size of shared memory area */
! void *mem; /* pointer to the memory */
! };
struct ulapi_fifo {
! int magic; /* to check for valid handle */
! int key; /* key to fifo */
! int fd; /* file descripter for fifo */
! int mode; /* O_RDONLY or O_WRONLY */
! unsigned long int size; /* size of fifo area */
! };
! #define SHMEM_MAGIC 25453 /* random numbers used as signatures */
#define FIFO_MAGIC 10293
***************
*** 52,73 ****
! int ulapi_shmem_new( int key, unsigned int size,
! ulapi_shmem_handle *shmemptr )
{
! ulapi_shmem_handle shmem;
/* validate shmemptr */
! if ( shmemptr == NULL )
return ULAPI_INVAL;
!
/* alloc space for shmem structure */
! shmem = malloc( sizeof(struct ulapi_shmem) );
! if ( shmem == NULL )
return ULAPI_NOMEM;
!
/* now get shared memory block from OS */
shmem->mem = rtai_malloc(key, size);
! if ( shmem->mem == NULL ) {
! free ( shmem );
return ULAPI_NOMEM;
}
--- 52,72 ----
! int ulapi_shmem_new(int key, unsigned int size, ulapi_shmem_handle * shmemptr)
{
! ulapi_shmem_handle shmem;
/* validate shmemptr */
! if (shmemptr == NULL) {
return ULAPI_INVAL;
! }
/* alloc space for shmem structure */
! shmem = malloc(sizeof(struct ulapi_shmem));
! if (shmem == NULL) {
return ULAPI_NOMEM;
! }
/* now get shared memory block from OS */
shmem->mem = rtai_malloc(key, size);
! if (shmem->mem == NULL) {
! free(shmem);
return ULAPI_NOMEM;
}
***************
*** 85,96 ****
! int ulapi_shmem_getptr ( ulapi_shmem_handle shmem, void **ptr )
{
/* validate shmem handle */
! if ( shmem == NULL )
return ULAPI_BADH;
! if ( shmem->magic != SHMEM_MAGIC )
return ULAPI_BADH;
!
/* pass memory address back to caller */
*ptr = shmem->mem;
--- 84,96 ----
! int ulapi_shmem_getptr(ulapi_shmem_handle shmem, void **ptr)
{
/* validate shmem handle */
! if (shmem == NULL) {
return ULAPI_BADH;
! }
! if (shmem->magic != SHMEM_MAGIC) {
return ULAPI_BADH;
! }
/* pass memory address back to caller */
*ptr = shmem->mem;
***************
*** 100,153 ****
! int ulapi_shmem_delete( ulapi_shmem_handle shmem )
{
/* validate shmem handle */
! if ( shmem == NULL )
return ULAPI_BADH;
! if ( shmem->magic != SHMEM_MAGIC )
return ULAPI_BADH;
!
/* free the shared memory */
! rtai_free( shmem->key, shmem->mem );
/* free the shmem structure */
shmem->magic = 0;
! free ( shmem );
return ULAPI_SUCCESS;
}
! int ulapi_fifo_new( int key, unsigned long int size, char mode,
! ulapi_fifo_handle *fifoptr )
{
! ulapi_fifo_handle fifo;
! int retval, flags;
! enum { DEVSTR_LEN = 256 };
! char devstr[DEVSTR_LEN];
/* validate fifoptr */
! if ( fifoptr == NULL )
return ULAPI_INVAL;
!
/* alloc space for fifo structure */
! fifo = malloc( sizeof(struct ulapi_fifo) );
! if ( fifo == NULL )
return ULAPI_NOMEM;
!
/* determine system name for fifo */
sprintf(devstr, "/dev/rtf%d", key);
/* determine mode for fifo */
! if ( mode == 'R' )
flags = O_RDONLY;
! else if ( mode == 'W' )
! flags = O_WRONLY;
! else
! return ULAPI_INVAL;
/* open the fifo */
! retval = open( devstr, flags );
! if ( retval < 0 ) {
/* open failed */
! free ( fifo );
return ULAPI_NOTFND;
}
--- 100,158 ----
! int ulapi_shmem_delete(ulapi_shmem_handle shmem)
{
/* validate shmem handle */
! if (shmem == NULL) {
return ULAPI_BADH;
! }
! if (shmem->magic != SHMEM_MAGIC) {
return ULAPI_BADH;
! }
/* free the shared memory */
! rtai_free(shmem->key, shmem->mem);
/* free the shmem structure */
shmem->magic = 0;
! free(shmem);
return ULAPI_SUCCESS;
}
! int ulapi_fifo_new(int key, unsigned long int size, char mode,
! ulapi_fifo_handle * fifoptr)
{
! ulapi_fifo_handle fifo;
! int retval, flags;
! enum { DEVSTR_LEN = 256 };
! char devstr[DEVSTR_LEN];
/* validate fifoptr */
! if (fifoptr == NULL) {
return ULAPI_INVAL;
! }
/* alloc space for fifo structure */
! fifo = malloc(sizeof(struct ulapi_fifo));
! if (fifo == NULL) {
return ULAPI_NOMEM;
! }
/* determine system name for fifo */
sprintf(devstr, "/dev/rtf%d", key);
/* determine mode for fifo */
! if (mode == 'R') {
flags = O_RDONLY;
! } else {
! if (mode == 'W') {
! flags = O_WRONLY;
! }
+ else {
+ return ULAPI_INVAL;
+ }
+ }
/* open the fifo */
! retval = open(devstr, flags);
! if (retval < 0) {
/* open failed */
! free(fifo);
return ULAPI_NOTFND;
}
***************
*** 166,227 ****
! int ulapi_fifo_delete( ulapi_fifo_handle fifo )
{
/* validate fifo handle */
! if ( fifo == NULL )
return ULAPI_BADH;
! if ( fifo->magic != FIFO_MAGIC )
return ULAPI_BADH;
!
/* close the fifo */
! if ( close( fifo->fd ) < 0 )
return ULAPI_NOTFND;
!
/* free the fifo structure */
fifo->magic = 0;
! free ( fifo );
return ULAPI_SUCCESS;
}
! int ulapi_fifo_read( ulapi_fifo_handle fifo,
! char *buf, unsigned long int size)
{
! int retval;
/* validate fifo handle */
! if ( fifo == NULL )
return ULAPI_BADH;
! if ( fifo->magic != FIFO_MAGIC )
return ULAPI_BADH;
! if ( fifo->mode != O_RDONLY )
return ULAPI_UNSUP;
!
/* get whatever data is available */
! retval = read( fifo->fd, buf, size );
! if ( retval < 0 )
return ULAPI_FAIL;
return retval;
}
! int ulapi_fifo_write( ulapi_fifo_handle fifo,
! char *buf, unsigned long int size)
{
! int retval;
/* validate fifo handle */
! if ( fifo == NULL )
return ULAPI_BADH;
! if ( fifo->magic != FIFO_MAGIC )
return ULAPI_BADH;
! if ( fifo->mode != O_WRONLY )
return ULAPI_UNSUP;
/* get whatever data is available */
! retval = write( fifo->fd, buf, size );
! if ( retval < 0 )
return ULAPI_FAIL;
return retval;
}
-
--- 171,238 ----
! int ulapi_fifo_delete(ulapi_fifo_handle fifo)
{
/* validate fifo handle */
! if (fifo == NULL) {
return ULAPI_BADH;
! }
! if (fifo->magic != FIFO_MAGIC) {
return ULAPI_BADH;
! }
/* close the fifo */
! if (close(fifo->fd) < 0) {
return ULAPI_NOTFND;
! }
/* free the fifo structure */
fifo->magic = 0;
! free(fifo);
return ULAPI_SUCCESS;
}
! int ulapi_fifo_read(ulapi_fifo_handle fifo, char *buf, unsigned long int size)
{
! int retval;
/* validate fifo handle */
! if (fifo == NULL) {
return ULAPI_BADH;
! }
! if (fifo->magic != FIFO_MAGIC) {
return ULAPI_BADH;
! }
! if (fifo->mode != O_RDONLY) {
return ULAPI_UNSUP;
! }
/* get whatever data is available */
! retval = read(fifo->fd, buf, size);
! if (retval < 0) {
return ULAPI_FAIL;
+ }
return retval;
}
! int ulapi_fifo_write(ulapi_fifo_handle fifo,
! char *buf, unsigned long int size)
{
! int retval;
/* validate fifo handle */
! if (fifo == NULL) {
return ULAPI_BADH;
! }
! if (fifo->magic != FIFO_MAGIC) {
return ULAPI_BADH;
! }
! if (fifo->mode != O_WRONLY) {
return ULAPI_UNSUP;
+ }
/* get whatever data is available */
! retval = write(fifo->fd, buf, size);
! if (retval < 0) {
return ULAPI_FAIL;
+ }
return retval;
}
|
|
From: <pa...@us...> - 2003-07-26 01:47:19
|
Update of /cvsroot/emc/rtapi/examples/timertask
In directory sc8-pr-cvs1:/tmp/cvs-serv8246/timertask
Modified Files:
timertask.c
Log Message:
Added braces to some of the conditional routines
Index: timertask.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/timertask/timertask.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** timertask.c 23 Jul 2003 01:22:49 -0000 1.3
--- timertask.c 25 Jul 2003 22:04:34 -0000 1.4
***************
*** 17,21 ****
--- 17,23 ----
{
while (1) {
+ /* a simple counter... */
timer_count++;
+ /* put the task to sleep untill the next interrupt */
rtapi_wait();
}
***************
*** 25,28 ****
--- 27,32 ----
/* part of the Linux kernel module that kicks off the timer task */
+ /* rtapi_app_main() is expanded to init_module() via a macro in
+ rtapi_app.h */
int rtapi_app_main(void)
{
***************
*** 47,56 ****
--- 51,64 ----
/* 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,
***************
*** 68,75 ****
--- 76,86 ----
/* part of the Linux kernel module that stops the timer task */
+ /* rtapi_app_exit() is substituted for cleanup_module() by a
+ macro in rtapi_app.h */
void rtapi_app_exit(void)
{
int retval;
+ /* Stop the task */
retval = rtapi_task_stop(timer_task);
if ( retval != RTAPI_SUCCESS ) {
***************
*** 77,80 ****
--- 88,92 ----
return;
}
+ /* Remove the task from the list */
retval = rtapi_task_delete( timer_task );
if ( retval != RTAPI_SUCCESS ) {
***************
*** 83,88 ****
}
rtapi_print("timertask exit: timer count is %d\n", timer_count);
!
rtapi_app_return();
}
--- 95,102 ----
}
+ /* 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();
+
}
|