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: <wsh...@us...> - 2003-08-22 03:34:34
|
Update of /cvsroot/emc/rcslib/src
In directory sc8-pr-cvs1:/tmp/cvs-serv13430/src
Modified Files:
Tag: wps_multiplat_dev_branch
rcs_config_include.h
Log Message:
.
Index: rcs_config_include.h
===================================================================
RCS file: /cvsroot/emc/rcslib/src/rcs_config_include.h,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** rcs_config_include.h 21 Aug 2003 20:24:14 -0000 1.1.2.2
--- rcs_config_include.h 22 Aug 2003 03:34:26 -0000 1.1.2.3
***************
*** 184,187 ****
--- 184,190 ----
#if HAVE_PROCESS_H
+ #ifndef MULTITHREADED
+ #define MULTITHREADED 1
+ #endif
#include <process.h>
#endif
***************
*** 189,192 ****
--- 192,199 ----
#if HAVE_DOS_H
#include <dos.h>
+ #endif
+
+ #if HAVE_IO_H
+ #include <io.h>
#endif
|
|
From: <wsh...@us...> - 2003-08-22 02:32:57
|
Update of /cvsroot/emc/rcslib/src
In directory sc8-pr-cvs1:/tmp/cvs-serv11714/src
Modified Files:
Tag: wps_multiplat_dev_branch
Makefile rcs_config_include.h
Log Message:
.
Index: Makefile
===================================================================
RCS file: /cvsroot/emc/rcslib/src/Makefile,v
retrieving revision 4.79.2.2
retrieving revision 4.79.2.3
diff -C2 -d -r4.79.2.2 -r4.79.2.3
*** Makefile 8 Aug 2003 15:08:47 -0000 4.79.2.2
--- Makefile 21 Aug 2003 20:24:14 -0000 4.79.2.3
***************
*** 8,12 ****
clean distclean check distcheck install:
! ../etc/multiplatbuild.sh config $@
.PHONY: all config clean distclean check distcheck install
--- 8,12 ----
clean distclean check distcheck install:
! ../etc/multiplatbuild.sh $@
.PHONY: all config clean distclean check distcheck install
Index: rcs_config_include.h
===================================================================
RCS file: /cvsroot/emc/rcslib/src/rcs_config_include.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** rcs_config_include.h 8 Aug 2003 14:21:06 -0000 1.1.2.1
--- rcs_config_include.h 21 Aug 2003 20:24:14 -0000 1.1.2.2
***************
*** 148,153 ****
--- 148,155 ----
#endif
#else
+ #ifndef WIN32
#define NO_THREADS 1
#endif
+ #endif
#if HAVE_DIRENT_H
***************
*** 158,161 ****
--- 160,216 ----
#define USE_ITIMER_SIGNALS 1
#endif
+
+ #ifdef WIN32
+
+ #if HAVE_WINDOWS_H
+ #include <windows.h>
+ #endif
+
+ #if HAVE_WINSOCK2_H
+ #include <winsock2.h>
+ #else
+ #if HAVE_WINSOCK_H
+ #include <winsock.h>
+ #endif
+ #endif
+
+ #if HAVE_WINBASE_H
+ #include <winbase.h>
+ #endif
+
+ #if HAVE_WINVER_H
+ #include <winver.h>
+ #endif
+
+ #if HAVE_PROCESS_H
+ #include <process.h>
+ #endif
+
+ #if HAVE_DOS_H
+ #include <dos.h>
+ #endif
+
+ #endif
+ // # ifdef WIN32
+
+ #if HAVE_RPC_RPC_H
+ #include <rpc/rpc.h> /* struct XDR */
+ #else
+ #if HAVE_RPC_TYPES_H
+ #include <rpc/types.h>
+ #endif
+ #if HAVE_RPC_XDR_H
+ #include <rpc/xdr.h> // struct XDR
+ #else
+
+ #if HAVE_XDR_H
+ #include "xdr.h"
+ #endif
+
+ #endif
+ // if HAVE_RPC_XDR_H
+
+ #endif
+ // if HAVE_RPC_RPC_H
#ifndef RCS_FAR
|
|
From: <wsh...@us...> - 2003-08-22 02:32:56
|
Update of /cvsroot/emc/rcslib/etc
In directory sc8-pr-cvs1:/tmp/cvs-serv11714/etc
Modified Files:
Tag: wps_multiplat_dev_branch
multiplatbuild.sh
Log Message:
.
Index: multiplatbuild.sh
===================================================================
RCS file: /cvsroot/emc/rcslib/etc/Attic/multiplatbuild.sh,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** multiplatbuild.sh 8 Aug 2003 14:52:51 -0000 1.1.2.1
--- multiplatbuild.sh 21 Aug 2003 20:24:13 -0000 1.1.2.2
***************
*** 52,60 ****
! CC_NAME=`${CC} -v 2>&1 | tail -n 1 | sed 'y# #_#' | sed 'y#-#_#' | sed 'y#:#_#' | sed 'y#(#_#' | sed 'y#)#_#' `
UNAME_S=`uname -s | sed 'y# #_#' | sed 'y#-#_#' | sed 'y#:#_#' | sed 'y#(#_#' | sed 'y#)#_#' `
UNAME_R=`uname -r | sed 'y# #_#' | sed 'y#-#_#' | sed 'y#:#_#' | sed 'y#(#_#' | sed 'y#)#_#'`
UNAME_M=`uname -m | sed 'y# #_#' | sed 'y#-#_#' | sed 'y#:#_#' | sed 'y#(#_#' | sed 'y#)#_#'`
if test "x${UNAME_S}" = "xLinux" ; then
if test "x`${rcsdir}/etc/havertlinux.sh | head -n 1`" = "xYES" ; then
--- 52,108 ----
! CC_NAME=`echo ${CC}_\`${CC} -v 2>&1 | tail -n 1 \` | sed 'y# #_#' | sed 'y#-#_#' | sed 'y#:#_#' | sed 'y#(#_#' | sed 'y#)#_#' | sed 's#gcc_gcc#gcc#g' | sed 's#${CC}_${CC}#${CC}#g'`
UNAME_S=`uname -s | sed 'y# #_#' | sed 'y#-#_#' | sed 'y#:#_#' | sed 'y#(#_#' | sed 'y#)#_#' `
UNAME_R=`uname -r | sed 'y# #_#' | sed 'y#-#_#' | sed 'y#:#_#' | sed 'y#(#_#' | sed 'y#)#_#'`
UNAME_M=`uname -m | sed 'y# #_#' | sed 'y#-#_#' | sed 'y#:#_#' | sed 'y#(#_#' | sed 'y#)#_#'`
+ host_arg_found=no;
+ for arg in $* ; do
+ if test "x${host_arg_found}" = "xyes" ; then
+ host_arg=${arg};
+ break;
+ fi
+ if test "x${arg}" = "x--host" ; then
+ host_arg_found=yes;
+ fi
+ done
+
+ (# set -x ;
+ if test "x${REBUILD_RCSLIB_CONFIGURE}" = "xyes" ; then
+ if test ${rcsdir}/configure -ot ${rcsdir}/aclocal.m4 -o \
+ ${rcsdir}/configure -ot ${rcsdir}/acinclude.m4 ; then
+
+ (set -x ; aclocal || (echo "aclocal failed." >&2 ; exit 1 ) || exit 1) || exit 1;
+ fi
+
+ if test ${rcsdir}/Makefile.in -ot ${rcsdir}/Makefile.am ; then
+ (set -x ; automake || (echo "automake failed." >&2 ; exit 1 ) || exit 1) || exit 1;
+ fi
+
+ if test ${rcsdir}/rcs_config.h.in -ot ${rcsdir}/configure.ac ; then
+ (set -x ; autoheader || (echo "autoheader failed." >&2 ; exit 1 ) || exit 1) || exit 1;
+ touch ${rcsdir}/rcs_config.h.in
+ fi
+
+ if test ${rcsdir}/configure -ot ${rcsdir}/aclocal.m4 -o \
+ ${rcsdir}/configure -ot ${rcsdir}/acinclude.m4 -o \
+ ${rcsdir}/configure -ot ${rcsdir}/Makefile.in -o \
+ ${rcsdir}/configure -ot ${rcsdir}/configure.ac -o \
+ ${rcsdir}/configure -ot ${rcsdir}/rcs_config.h.in ; then
+
+ (set -x ; autoconf || (echo "autoconf failed." ; exit 1 ) || exit 1) || exit 1;
+ fi
+ fi
+ )
+
+ if test "x${CC}" = "xmingw32-gcc" -a "x${host_arg_found}" = "xno" -a "x${UNAME_S}" = "xLinux" ; then
+ host_arg='i386-pc-mingw32';
+ host_arg_to_add="--host ${host_arg}";
+ fi
+
+ if test "x${host_arg}" != "x" ; then
+ UNAME_S=${host_arg}_cross_compiled_under_${UNAME_S};
+ fi
+
if test "x${UNAME_S}" = "xLinux" ; then
if test "x`${rcsdir}/etc/havertlinux.sh | head -n 1`" = "xYES" ; then
***************
*** 67,71 ****
LIBC_NAME=NOT_GLIBC
! if test -f /usr/include/features.h ; then
if grep _GLIBC /usr/include/features.h >/dev/null 2>/dev/null ; then
GLIBC_MAJOR_VERSION=`grep __GLIBC__ /usr/include/features.h | grep '#define' | grep -v PREREQ | head -n 1 | awk '{printf("%s",$3);}'`
--- 115,119 ----
LIBC_NAME=NOT_GLIBC
! if test -f /usr/include/features.h -a "x${host_arg}" = "x" ; then
if grep _GLIBC /usr/include/features.h >/dev/null 2>/dev/null ; then
GLIBC_MAJOR_VERSION=`grep __GLIBC__ /usr/include/features.h | grep '#define' | grep -v PREREQ | head -n 1 | awk '{printf("%s",$3);}'`
***************
*** 79,83 ****
fi
! install_dir=${rcsdir}/multiplatinstalls/${UNAME_S}/${UNAME_R}/${UNAME_M}/${LIBC_NAME}/${CC_NAME}
echo "install_dir=${install_dir}" >&2
if test ! -d ${install_dir} ; then
--- 127,138 ----
fi
! if test "x${host_arg}" = "x" ; then
! install_dir=${rcsdir}/.multiplatinstalls/${UNAME_S}/${UNAME_R}/${UNAME_M}/${LIBC_NAME}/${CC_NAME}/
!
! else
! install_dir=${rcsdir}/.multiplatinstalls/`echo ${host_arg}| sed y#-#/#`/${CC_NAME}/
!
! fi
!
echo "install_dir=${install_dir}" >&2
if test ! -d ${install_dir} ; then
***************
*** 85,89 ****
fi
! build_dir=${rcsdir}/multiplatbuilds/${UNAME_S}/${UNAME_R}/${UNAME_M}/${LIBC_NAME}/${CC_NAME}
echo "build_dir=${build_dir}" >&2
if test ! -d ${build_dir} ; then
--- 140,150 ----
fi
! if test "x${host_arg}" = "x" ; then
! build_dir=${rcsdir}/.multiplatbuilds/${UNAME_S}/${UNAME_R}/${UNAME_M}/${LIBC_NAME}/${CC_NAME}/
! else
! build_dir=${rcsdir}/.multiplatbuilds/`echo ${host_arg} | sed y#-#/#`/${CC_NAME}/
!
! fi
!
echo "build_dir=${build_dir}" >&2
if test ! -d ${build_dir} ; then
***************
*** 93,97 ****
cd ${build_dir} || (echo "cd ${build_dir} failed." >&2 ; exit 127 ) || exit 127
! PLAT=`(cd ${rcsdir}; mkdir_cmd=true; . ${rcsdir}/etc/platname)`
export PLAT
--- 154,163 ----
cd ${build_dir} || (echo "cd ${build_dir} failed." >&2 ; exit 127 ) || exit 127
! if test "x${host_arg}" = "x" ; then
! PLAT=`(set -x ;cd ${rcsdir}; mkdir_cmd=true; export mkdir_cmd; . ${rcsdir}/etc/platname)`
! else
! PLAT=${UNAME_S}
! fi
!
export PLAT
***************
*** 122,191 ****
( cd ${rcsdir}/plat && ln -s ${install_dir} ${PLAT} || exit 127 ) || ( echo "Can not setup symbolic link." >&2 ; exit 127 ) || exit 127
! ( cd ${rcsdir} ; PLAT=; rm ~/.platname* ; mkdir_cmd=true; . ${rcsdir}/etc/platname >/dev/null; 2>/dev/null;
! if test "x${ORIG_PLAT}" != "x" -a "x${ORIG_PLAT}" != "x${PLAT}" ; then
! if test ${LINK_FLAG} ${rcsdir}/plat/${ORIG_PLAT} ; then
! rm ${rcsdir}/plat/${ORIG_PLAT} ;
! elif test -d ${rcsdir}/plat/${ORIG_PLAT} ; then
! ( mkdir -p ${rcsdir}/plat/.moved.$$/ ) >/dev/null 2>/dev/null;
! mv ${rcsdir}/plat/${ORIG_PLAT} ${rcsdir}/plat/.moved.$$/
fi
! (cd ${rcsdir}/plat/ ; ln -s ${install_dir} ${ORIG_PLAT}; )
! fi
! if test "x${ETC_RELEASE_PLAT}" != "x" -a "x${ETC_RELEASE_PLAT}" != "x${PLAT}" ; then
! if test ${LINK_FLAG} ${rcsdir}/plat/${ETC_RELEASE_PLAT} ; then
rm ${rcsdir}/plat/${ETC_RELEASE_PLAT} ;
! elif test -d ${rcsdir}/plat/${ETC_RELEASE_PLAT} ; then
! ( mkdir -p ${rcsdir}/plat/.moved.$$/ ) >/dev/null 2>/dev/null;
! mv ${rcsdir}/plat/${ETC_RELEASE_PLAT} ${rcsdir}/plat/.moved.$$/
! fi
! (cd ${rcsdir}/plat/ ; ln -s ${install_dir} ${ETC_RELEASE_PLAT}; )
! fi
! if test "x${DEBIAN_PLAT}" != "x" -a "x${DEBIAN_PLAT}" != "x${PLAT}" ; then
! if test ${LINK_FLAG} ${rcsdir}/plat/${DEBIAN_PLAT} ; then
! rm ${rcsdir}/plat/${DEBIAN_PLAT} ;
! elif test -d ${rcsdir}/plat/${DEBIAN_PLAT} ; then
! ( mkdir -p ${rcsdir}/plat/.moved.$$/ ) >/dev/null 2>/dev/null;
! mv ${rcsdir}/plat/${DEBIAN_PLAT} ${rcsdir}/plat/.moved.$$/
fi
(cd ${rcsdir}/plat/ ; ln -s ${install_dir} ${DEBIAN_PLAT}; )
! fi
! if test "x${REDHAT_PLAT}" != "x" -a "x${REDHAT_PLAT}" != "x${PLAT}" ; then
! if test ${LINK_FLAG} ${rcsdir}/plat/${REDHAT_PLAT} ; then
! rm ${rcsdir}/plat/${REDHAT_PLAT} ;
! elif test -d ${rcsdir}/plat/${REDHAT_PLAT} ; then
! ( mkdir -p ${rcsdir}/plat/.moved.$$/ ) >/dev/null 2>/dev/null;
mv ${rcsdir}/plat/${REDHAT_PLAT} ${rcsdir}/plat/.moved.$$/
fi
! (cd ${rcsdir}/plat/ ; ln -s ${install_dir} ${REDHAT_PLAT}; )
! fi
! if test "x${OLD_PLAT}" != "x" -a "x${OLD_PLAT}" != "x${PLAT}" ; then
! if test ${LINK_FLAG} ${rcsdir}/plat/${OLD_PLAT} ; then
! rm ${rcsdir}/plat/${OLD_PLAT} ;
! elif test -d ${rcsdir}/plat/${OLD_PLAT} ; then
! ( mkdir -p ${rcsdir}/plat/.moved.$$/ ) >/dev/null 2>/dev/null;
! mv ${rcsdir}/plat/${OLD_PLAT} ${rcsdir}/plat/.moved.$$/
fi
! (cd ${rcsdir}/plat/ ; ln -s ${install_dir} ${OLD_PLAT}; )
! fi
! if test "x${PLATBASE}" != "x" -a "x${PLATBASE}" != "x${PLAT}" ; then
! if test ${LINK_FLAG} ${rcsdir}/plat/${PLATBASE} ; then
! rm ${rcsdir}/plat/${PLATBASE} ;
! elif test -d ${rcsdir}/plat/${PLATBASE} ; then
! ( mkdir -p ${rcsdir}/plat/.moved.$$/ ) >/dev/null 2>/dev/null;
! mv ${rcsdir}/plat/${PLATBASE} ${rcsdir}/plat/.moved.$$/
fi
! (cd ${rcsdir}/plat/ ; ln -s ${install_dir} ${PLATBASE}; )
! fi
! )>/dev/null 2>/dev/null;
!
if test $# -lt 1 ; then
! if test ! -f Makefile ; then
! ${rcsdir}/configure --prefix=${install_dir} || (echo "configure failed." >&2 ; exit 127 ) || exit 127
fi
make || (echo "make failed." >&2 ; exit 127 ) || exit 127
--- 188,270 ----
( cd ${rcsdir}/plat && ln -s ${install_dir} ${PLAT} || exit 127 ) || ( echo "Can not setup symbolic link." >&2 ; exit 127 ) || exit 127
! if test "x${host_arg}" = "x" ; then
!
! ( cd ${rcsdir} ; PLAT=; rm ~/.platname* ; mkdir_cmd=true; . ${rcsdir}/etc/platname >/dev/null; 2>/dev/null;
! if test "x${ORIG_PLAT}" != "x" -a "x${ORIG_PLAT}" != "x${PLAT}" ; then
! if test ${LINK_FLAG} ${rcsdir}/plat/${ORIG_PLAT} ; then
! rm ${rcsdir}/plat/${ORIG_PLAT} ;
! elif test -d ${rcsdir}/plat/${ORIG_PLAT} ; then
! ( mkdir -p ${rcsdir}/plat/.moved.$$/ ) >/dev/null 2>/dev/null;
! mv ${rcsdir}/plat/${ORIG_PLAT} ${rcsdir}/plat/.moved.$$/
! fi
! (cd ${rcsdir}/plat/ ; ln -s ${install_dir} ${ORIG_PLAT}; )
fi
! if test "x${ETC_RELEASE_PLAT}" != "x" -a "x${ETC_RELEASE_PLAT}" != "x${PLAT}" ; then
! if test ${LINK_FLAG} ${rcsdir}/plat/${ETC_RELEASE_PLAT} ; then
rm ${rcsdir}/plat/${ETC_RELEASE_PLAT} ;
! elif test -d ${rcsdir}/plat/${ETC_RELEASE_PLAT} ; then
! ( mkdir -p ${rcsdir}/plat/.moved.$$/ ) >/dev/null 2>/dev/null;
! mv ${rcsdir}/plat/${ETC_RELEASE_PLAT} ${rcsdir}/plat/.moved.$$/
! fi
! (cd ${rcsdir}/plat/ ; ln -s ${install_dir} ${ETC_RELEASE_PLAT}; )
fi
+ if test "x${DEBIAN_PLAT}" != "x" -a "x${DEBIAN_PLAT}" != "x${PLAT}" ; then
+ if test ${LINK_FLAG} ${rcsdir}/plat/${DEBIAN_PLAT} ; then
+ rm ${rcsdir}/plat/${DEBIAN_PLAT} ;
+ elif test -d ${rcsdir}/plat/${DEBIAN_PLAT} ; then
+ ( mkdir -p ${rcsdir}/plat/.moved.$$/ ) >/dev/null 2>/dev/null;
+ mv ${rcsdir}/plat/${DEBIAN_PLAT} ${rcsdir}/plat/.moved.$$/
+ fi
(cd ${rcsdir}/plat/ ; ln -s ${install_dir} ${DEBIAN_PLAT}; )
! fi
! if test "x${REDHAT_PLAT}" != "x" -a "x${REDHAT_PLAT}" != "x${PLAT}" ; then
! if test ${LINK_FLAG} ${rcsdir}/plat/${REDHAT_PLAT} ; then
! rm ${rcsdir}/plat/${REDHAT_PLAT} ;
! elif test -d ${rcsdir}/plat/${REDHAT_PLAT} ; then
! ( mkdir -p ${rcsdir}/plat/.moved.$$/ ) >/dev/null 2>/dev/null;
mv ${rcsdir}/plat/${REDHAT_PLAT} ${rcsdir}/plat/.moved.$$/
+ fi
+ (cd ${rcsdir}/plat/ ; ln -s ${install_dir} ${REDHAT_PLAT}; )
fi
! if test "x${OLD_PLAT}" != "x" -a "x${OLD_PLAT}" != "x${PLAT}" ; then
! if test ${LINK_FLAG} ${rcsdir}/plat/${OLD_PLAT} ; then
! rm ${rcsdir}/plat/${OLD_PLAT} ;
! elif test -d ${rcsdir}/plat/${OLD_PLAT} ; then
! ( mkdir -p ${rcsdir}/plat/.moved.$$/ ) >/dev/null 2>/dev/null;
! mv ${rcsdir}/plat/${OLD_PLAT} ${rcsdir}/plat/.moved.$$/
! fi
! (cd ${rcsdir}/plat/ ; ln -s ${install_dir} ${OLD_PLAT}; )
fi
! if test "x${PLATBASE}" != "x" -a "x${PLATBASE}" != "x${PLAT}" ; then
! if test ${LINK_FLAG} ${rcsdir}/plat/${PLATBASE} ; then
! rm ${rcsdir}/plat/${PLATBASE} ;
! elif test -d ${rcsdir}/plat/${PLATBASE} ; then
! ( mkdir -p ${rcsdir}/plat/.moved.$$/ ) >/dev/null 2>/dev/null;
! mv ${rcsdir}/plat/${PLATBASE} ${rcsdir}/plat/.moved.$$/
! fi
! (cd ${rcsdir}/plat/ ; ln -s ${install_dir} ${PLATBASE}; )
fi
! )>/dev/null 2>/dev/null;
+ fi
+ if test ${LINK_FLAG} ${rcsdir}/.lastbuild ; then
+ \rm -f ${rcsdir}/.lastbuild >/dev/null 2>/dev/null ;
+ fi
+ if test -e ${rcsdir}/.lastbuild ; then
+ (cd ${rcsdir} ; mv .lastbuild .lastbuild.$$ ) >/dev/null 2>/dev/null;
+ fi
+ if test -d ${build_dir} ; then
+ (cd ${rcsdir} ; ln -s ${build_dir} .lastbuild)
+ fi
if test $# -lt 1 ; then
! if test ! -f Makefile -o Makefile -ot ${rcsdir}/configure ; then
! ( set -x ; ${rcsdir}/configure --prefix=${install_dir} ${host_arg_to_add} ) || (echo "configure failed." >&2 ; exit 127 ) || exit 127
! \rm -f ${build_dir}/*.{a,la,so}
! \rm -f ${build_dir}/.libs/*.{a,la,so}
fi
make || (echo "make failed." >&2 ; exit 127 ) || exit 127
***************
*** 193,206 ****
elif test "x${1}" = "xconfig" ; then
! ${rcsdir}/configure --prefix=${install_dir} $2 $3 $4 $5 || (echo "configure failed." >&2 ; exit 127 ) || exit 127
elif test "x${1}" = "xmake" ; then
! if test ! -f Makefile ; then
! ${rcsdir}/configure --prefix=${install_dir} || (echo "configure failed." >&2 ; exit 127 ) || exit 127
fi
make || (echo "make failed." >&2 ; exit 127 ) || exit 127
else
! if test ! -f Makefile -a "xdistclean" != "x${1}" ; then
${rcsdir}/configure --prefix=${install_dir} || exit 127
fi
--- 272,291 ----
elif test "x${1}" = "xconfig" ; then
! ( set -x ;
! ${rcsdir}/configure --prefix=${install_dir} ${host_arg_to_add} $2 $3 $4 $5 ) || (echo "configure failed." >&2 ; exit 127 ) || exit 127
! \rm -f ${build_dir}/*.{a,la,so}
! \rm -f ${build_dir}/.libs/*.{a,la,so}
elif test "x${1}" = "xmake" ; then
! if test ! -f Makefile -o Makefile -ot ${rcsdir}/configure ; then
! ( set -x ; ${rcsdir}/configure --prefix=${install_dir} ${host_arg_to_add} ) || (echo "configure failed." >&2 ; exit 127 ) || exit 127
! \rm -f ${build_dir}/*.{a,la,so}
! \rm -f ${build_dir}/.libs/*.{a,la,so}
fi
make || (echo "make failed." >&2 ; exit 127 ) || exit 127
else
!
! if test ! -f Makefile -o Makefile -ot ${rcsdir}/configure -a "xdistclean" != "x${1}" ; then
${rcsdir}/configure --prefix=${install_dir} || exit 127
fi
***************
*** 210,213 ****
--- 295,373 ----
fi
+
+ if test ! -d ${rcsdir}/plat/java/lib ; then
+ mkdir -p ${rcsdir}/plat/java/lib 2>/dev/null
+ fi
+
+ (cd ${rcsdir}/plat/java/lib && \
+ for jarfile in *.jar ; do
+ if test "x${jarfile}" != 'x*.jar' -a ${LINK_FLAG} ${jarfile} ; then
+ rm ${jarfile};
+ fi
+ done
+ ) >/dev/null 2>/dev/null
+
+ if test -d ${install_dir}/bin ; then
+
+ ( set -x ; cd ${install_dir}/bin && \
+ for jarfile in *.jar ; do \
+ if test "x${jarfile}" != 'x*.jar' -a "x${jarfile}" != "x" ; then \
+ (cd ${rcsdir}/plat/java/lib && \
+ ln -s ${install_dir}/bin/${jarfile} .; ); \
+ fi; \
+ done; \
+ ) >/dev/null 2>/dev/null
+ fi
+
+ if test -d ${install_dir}/lib ; then
+
+ (cd ${install_dir}/lib && \
+ if test -f librcs.a -a ! -f librcsd.a ; then \
+ if test ${LINK_FLAG} librcsd.a ; then \
+ rm librcsd.a; \
+ fi; \
+ ln -s librcs.a librcsd.a; \
+ fi \
+ ) >/dev/null 2>/dev/null
+
+ fi
+
+ if test ${LINK_FLAG} ${rcsdir}/lib ; then
+ \rm -f ${rcsdir}/lib >/dev/null 2>/dev/null ;
+ fi
+
+ if test -e ${rcsdir}/lib ; then
+ (cd ${rcsdir} ; mv lib .lib.$$ ) >/dev/null 2>/dev/null;
+ fi
+
+ if test -d ${install_dir}/lib ; then
+ (cd ${rcsdir} ; ln -s ${install_dir}/lib .)
+ fi
+
+ if test ${LINK_FLAG} ${rcsdir}/bin ; then
+ \rm -f ${rcsdir}/bin >/dev/null 2>/dev/null ;
+ fi
+
+ if test -e ${rcsdir}/bin ; then
+ (cd ${rcsdir} ; mv bin .bin.$$ ) >/dev/null 2>/dev/null;
+ fi
+
+ if test -d ${install_dir}/bin ; then
+ (cd ${rcsdir} ; ln -s ${install_dir}/bin .)
+ fi
+
+ if test ${LINK_FLAG} ${rcsdir}/include ; then
+ \rm -f ${rcsdir}/include >/dev/null 2>/dev/null ;
+ fi
+
+ if test -e ${rcsdir}/include ; then
+ (cd ${rcsdir} ; mv include .include.$$ ) >/dev/null 2>/dev/null;
+ fi
+
+
+ if test -d ${install_dir}/bin ; then
+ (cd ${rcsdir} ; ln -s ${install_dir}/include .)
+ fi
+
echo "rcsdir=${rcsdir}" >&2
|
|
From: <wsh...@us...> - 2003-08-21 21:28:10
|
Update of /cvsroot/emc/rcslib/etc
In directory sc8-pr-cvs1:/tmp/cvs-serv12571/etc
Added Files:
Tag: wps_multiplat_dev_branch
Makefile
Log Message:
.
--- NEW FILE: Makefile ---
all:
../etc/multiplatbuild.sh
config:
../etc/multiplatbuild.sh config $(CONFIG_ARGS)
clean distclean check distcheck install:
../etc/multiplatbuild.sh $@
.PHONY: all config clean distclean check distcheck install
|
|
From: <wsh...@us...> - 2003-08-20 16:14:15
|
Update of /cvsroot/emc/rcslib/src/os_intf
In directory sc8-pr-cvs1:/tmp/cvs-serv3980
Added Files:
Tag: wps_multiplat_dev_branch
_timer_no_config.h timer_no_config.h
Log Message:
.
--- NEW FILE: _timer_no_config.h ---
#ifndef _TIMER_NO_CONFIG_H
#define _TIMER_NO_CONFIG_H
#include "rcs_defs.hh"
#include "rcs_prnt.hh" /* rcs_print_error */
#if !HAVE_CONFIG_H
#ifndef NO_STDIO
#include <stdio.h> /* NULL */
#endif
#include <errno.h> /* errno */
#include <string.h> /* strerror() */
#ifdef VXWORKS
#include <vxWorks.h>
#include <taskLib.h> /* taskDelay() */
#include <tickLib.h> /* tickGet() */
#include <sysLib.h> /* sysClkRateGet() */
#include <timers.h> /* clock_gettime */
#ifndef POWERPC
#include "gtimer.hh" /* global_timer_available, get_Global_time() */
#endif
#endif /* VXWORKS */
#ifdef LYNX
#include <errno.h> /* EINTR */
#include <unistd.h> /* select() */
#include <time.h> /* CLK_TCK, since no _SC_CLK_TCK */
#include <sys/time.h> /* struct timeval, gettimeofday(),
struct itimerval, setitimer(),
ITIMER_REAL */
#endif /* LYNX */
#if defined(SUN) || defined(SGI) || defined(sparcworks) || defined(darwin) || defined(qnx) || defined(linux)
#include <errno.h> /* EINTR */
#include <unistd.h> /* select(), sysconf(), _SC_CLK_TCK */
#ifndef irix6
#include <sys/time.h> /* struct timeval, gettimeofday(),
struct itimerval, setitimer(),
ITIMER_REAL */
#endif
#endif /* SUN */
#ifdef linux
#include <linux/version.h>
#if defined(LINUX_VERSION_CODE) && defined(KERNEL_VERSION)
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,2,0)
#define LINUX_KERNEL_2_2_OR_LATER
#include <sched.h>
#endif
#endif
#endif
#ifdef irix6
#include <time.h>
#endif
#ifdef __MSDOS__
#ifdef _Windows
#ifdef USE_TOOL_HELP
/* The timerCount function is more accurate than the GetTickCount() function
but you need toolhelp.dll which comes with Windows 3.1 but not Windows 3.0 or
Windows NT */
#include "toolhelp.h" /* timerCount() */
#else
#if defined(WIN32) && !defined(USE_OLD_WINSOCK)
/* Lame problem if windows.h is included before winsock2.h many redefined
compiler errors result. */
#include <winsock2.h>
#endif
#include <windows.h> /* GetTickCount() */
#endif
#endif
#include <time.h> /* clock(), CLK_TCK */
#ifndef _Windows
#include <dos.h> /* delay() */
#endif
#endif
#if defined(mingw32)
#include <windows.h>
#endif
#endif
// #ifndef TIMER_NO_CONFIG_H
--- NEW FILE: timer_no_config.h ---
#ifndef TIMER_NO_CONFIG_H
#define TIMER_NO_CONFIG_H
#include "rcs_defs.hh" // __MSDOS__
#include "dbg_mem.h" // DEBUG_MALLOC,DEBUG_FREE
#ifdef VXWORKS
extern "C"
{
#include <vxWorks.h>
#ifndef NO_STDIO
#include <stdio.h>
#endif
#include <string.h> // strtok(), strncmp()
#include <stdlib.h> // atof()
#include <taskLib.h> /* taskDelay() */
#include <tickLib.h> /* tickGet() */
#include <sysLib.h> /* sysClkRateGet() */
}
#endif /* VXWORKS */
#ifdef LYNX
extern "C"
{
#include <string.h> // strtok(), strncmp()
#include <stdlib.h> // atof()
#ifndef NO_STDIO
#include <stdio.h> /* NULL */
#endif
#include <stdlib.h> /* exit() */
#include <signal.h> /* struct sigaction, sigaction(), SIGALRM,
sigset_t */
#include <errno.h> /* perror(), EINTR */
#include <unistd.h> /* select() */
#include <time.h> /* CLK_TCK, since no _SC_CLK_TCK, */
/* setitimer() */
#include <sys/time.h> /* struct timeval, gettimeofday(),
struct itimerval,
ITIMER_REAL */
}
#endif /* LYNX */
#if defined(SUN) || defined(LINUX)
extern "C"
{
#include <stdlib.h> // atof()
#include <string.h> // strtok(), strncmp()
#ifndef NO_STDIO
#include <stdio.h> /* NULL */
#endif
#include <stdlib.h> /* exit() */
#include <signal.h> /* struct sigaction, sigaction(), SIGALRM,
sigset_t */
#include <errno.h> /* perror(), EINTR */
#include <unistd.h> /* select(), sysconf(), _SC_CLK_TCK */
#include <sys/time.h> /* struct timeval, gettimeofday(),
struct itimerval, setitimer(),
ITIMER_REAL */
#include <sys/types.h>
#include <sys/wait.h> // waitpid()
}
#endif /* SUN */
#ifdef __MSDOS__
#include <stdlib.h> // atof()
#include <string.h> // strtok(), strncmp()
#include <time.h> /* clock(), CLK_TCK */
#ifndef _WINDOWS
#include <dos.h> /* delay() */
#endif
#endif
#endif
// #ifndef TIMER_NO_CONFIG_H
|
|
From: <jmk...@us...> - 2003-08-20 08:35:40
|
Update of /cvsroot/emc/rtapi/src/rtapi
In directory sc8-pr-cvs1:/tmp/cvs-serv10049/src/rtapi
Modified Files:
rtai_rtapi.c rtai_ulapi.c rtapi.h rtapi_common.h ulapi.h
Added Files:
rtapi_proc.h
Log Message:
moved proc stuff from rtapi_common.h to rtapi_proc.h, put most rtapi internal data in shared memory and put corresponding decls in rtapi_common.h
--- NEW FILE: rtapi_proc.h ---
#ifndef RTAPI_PROC_H
#define RTAPI_PROC_H
/** RTAPI is a library providing a uniform API for several real time
operating systems. As of ver 2.0, RTLinux and RTAI are supported.
*/
/** This file, 'rtapi_proc.h', contains code that implements several
/proc filesystem entries that can display the status of the RTAPI.
This code is common to both the RTAI and RTLinux implementations,
and most likely to any other implementations under Linux. This
data is INTERNAL to the RTAPI implementation, and should not be
included in any application modules. This data also applies
only to kernel modules, and should be included only in the
real-time portion of the implementation. Items that are common
to both the realtime and user-space portions of the implementation
are in rtapi_common.h.
*/
/** Copyright (C) 2003 John Kasunich
<jmkasunich AT users DOT sourceforge DOT net>
Copyright (C) 2003 Paul Corner
<paul_c AT users DOT sourceforge DOT net>
This library is based on version 1.0, which was released into
the public domain by its author, Fred Proctor. Thanks Fred!
*/
/* This library is free software; you can redistribute it and/or
modify it under the terms of version 2.1 of the GNU Lesser 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
*/
/** THE AUTHORS OF THIS LIBRARY ACCEPT ABSOLUTELY NO LIABILITY FOR
ANY HARM OR LOSS RESULTING FROM ITS USE. IT IS _EXTREMELY_ UNWISE
TO RELY ON SOFTWARE ALONE FOR SAFETY. Any machinery capable of
harming persons must have provisions for completely removing power
from all motors, etc, before persons enter any danger area. All
machinery must be designed to comply with local and national safety
codes, and the authors of this software can not, and do not, take
any responsibility for such compliance.
*/
/** This code was written as part of the EMC HAL project. For more
information, go to www.linuxcnc.org.
*/
#include <linux/proc_fs.h>
#ifdef CONFIG_PROC_FS
/* proc print macros - Contributed by: Erwin Rol (er...@mu...)
and shamelessly ripped from rtai_proc_fs.h, part of the RTAI
project. See http://www.rtai.org for more details.
macro that holds the local variables that
we use in the PROC_PRINT_* macros. We have
this macro so we can add variables with out
changing the users of this macro, of course
only when the names don't colide!
*/
#define PROC_PRINT_VARS \
off_t pos = 0; \
off_t begin = 0; \
int len = 0 /* no ";" */
/* macro that prints in the procfs read buffer.
this macro expects the function arguments to be
named as follows.
static int FOO(char *page, char **start,
off_t off, int count, int *eof, void *data) */
#define PROC_PRINT(fmt,args...) \
len += sprintf(page + len , fmt, ##args); \
pos += len; \
if(pos < off) { \
len = 0; \
begin = pos; \
} \
if(pos > off + count) \
goto done;
/* macro to leave the read function from another
place than at the end. */
#define PROC_PRINT_RETURN \
*eof = 1; \
goto done // no ";"
/* macro that should only used once at the end of the
read function, to return from another place in the
read function use the PROC_PRINT_RETURN macro. */
#define PROC_PRINT_DONE \
*eof = 1; \
done: \
*start = page + (off - begin); \
len -= (off - begin); \
if(len > count) \
len = count; \
if(len < 0) \
len = 0; \
return len // no ";"
/* Internal function for the proc_fs system. */
/* 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_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 *shmem_file = 0; /* /proc/rtapi/shmem */
static struct proc_dir_entry *sems_file = 0; /* /proc/rtapi/sems */
static struct proc_dir_entry *fifos_file = 0; /* /proc/rtapi/fifos */
static struct proc_dir_entry *debug_file = 0; /* /proc/rtapi/debug */
/** The following are callback functions for the /proc filesystem
When someone reads a /proc file, the appropriate function below
is called, and it must generate output for the reader on the fly.
These functions use the MOD_INC_USE_COUNT and MOD_DEC_USE_COUNT
macros to make sure the RTAPI module is not removed while servicing
a /proc request.
*/
static int proc_read_status(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
PROC_PRINT_VARS;
MOD_INC_USE_COUNT;
PROC_PRINT("******* RTAPI STATUS ********\n");
PROC_PRINT(" RT Modules = %i\n", rtapi_data->rt_module_count);
PROC_PRINT(" UL Modules = %i\n", rtapi_data->ul_module_count);
PROC_PRINT(" Tasks = %i/%i\n", rtapi_data->task_count, RTAPI_MAX_TASKS);
PROC_PRINT("Shared memory = %i/%i\n", rtapi_data->shmem_count, RTAPI_MAX_SHMEMS);
PROC_PRINT(" FIFOs = %i/%i\n", rtapi_data->fifo_count, RTAPI_MAX_FIFOS);
PROC_PRINT(" Semaphores = %i/%i\n", rtapi_data->sem_count, RTAPI_MAX_SEMS);
PROC_PRINT(" Interrupts = %i\n", rtapi_data->irq_count);
if (rtapi_data->timer_running) {
PROC_PRINT(" Timer status = Running\n");
PROC_PRINT(" Timer period = %li nSec\n", rtapi_data->timer_period);
} else {
PROC_PRINT(" Timer status = Stopped\n");
}
PROC_PRINT("Message level = %i\n", rtapi_msg_level);
PROC_PRINT("\n");
MOD_DEC_USE_COUNT;
PROC_PRINT_DONE;
}
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;
MOD_INC_USE_COUNT;
PROC_PRINT("******** RTAPI TASKS ********\n");
PROC_PRINT("ID State Code\n");
for (n = 1; 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");
MOD_DEC_USE_COUNT;
PROC_PRINT_DONE;
}
static int proc_read_shmem(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
int n;
PROC_PRINT_VARS;
MOD_INC_USE_COUNT;
PROC_PRINT("**** RTAPI SHARED MEMORY ****\n");
PROC_PRINT("ID Users Key Size\n");
PROC_PRINT(" RT/UL \n");
for ( n = 1 ; n <= RTAPI_MAX_SHMEMS ; n++ ) {
if ( shmem_array[n].key != 0 ) {
PROC_PRINT("%02d %2d/%-2d %-10d %-10lu\n",
n, shmem_array[n].rtusers, shmem_array[n].ulusers,
shmem_array[n].key, shmem_array[n].size);
}
}
PROC_PRINT("\n");
MOD_DEC_USE_COUNT;
PROC_PRINT_DONE;
}
static int proc_read_sems(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
int n;
PROC_PRINT_VARS;
MOD_INC_USE_COUNT;
PROC_PRINT("***** RTAPI SEMAPHORES ******\n");
PROC_PRINT("ID Users Key\n");
for (n = 1; n <= RTAPI_MAX_SEMS; n++) {
if (sem_array[n].users != 0) {
PROC_PRINT("%02d %3d %-10d\n",
n, sem_array[n].users, sem_array[n].key);
}
}
PROC_PRINT("\n");
MOD_DEC_USE_COUNT;
PROC_PRINT_DONE;
}
static int proc_read_fifos(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
int n;
char *state_str;
PROC_PRINT_VARS;
MOD_INC_USE_COUNT;
PROC_PRINT("******** RTAPI FIFOS ********\n");
PROC_PRINT("ID State Key Size\n");
for (n = 1; n <= RTAPI_MAX_FIFOS; n++) {
if (fifo_array[n].state != UNUSED) {
switch (fifo_array[n].state) {
case HAS_READER:
state_str = "R-";
break;
case HAS_WRITER:
state_str = "-W";
break;
case HAS_BOTH:
state_str = "RW";
break;
default:
state_str = "UNKNOWN ";
break;
}
PROC_PRINT("%02d %s %-10d %-10ld\n",
n, state_str, fifo_array[n].key, fifo_array[n].size);
}
}
PROC_PRINT("\n");
MOD_DEC_USE_COUNT;
PROC_PRINT_DONE;
}
static int proc_read_debug(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
PROC_PRINT_VARS;
MOD_INC_USE_COUNT;
PROC_PRINT("******* RTAPI MESSAGES ******\n");
PROC_PRINT(" Message Level = %i\n", rtapi_msg_level);
PROC_PRINT(" ERROR messages = %s\n",
rtapi_msg_level > RTAPI_MSG_ERR ? "ON" : "OFF");
PROC_PRINT("WARNING messages = %s\n",
rtapi_msg_level > RTAPI_MSG_WARN ? "ON" : "OFF");
PROC_PRINT(" INFO messages = %s\n",
rtapi_msg_level > RTAPI_MSG_INFO ? "ON" : "OFF");
PROC_PRINT(" DEBUG messages = %s\n",
rtapi_msg_level > RTAPI_MSG_DBG ? "ON" : "OFF");
PROC_PRINT("\n");
MOD_DEC_USE_COUNT;
PROC_PRINT_DONE;
}
static int proc_write_debug(struct file *file,
const char *buffer,
unsigned long count, void *data)
{
char c;
MOD_INC_USE_COUNT;
/* copy 1 byte from user space */
if (copy_from_user(&c, buffer, 1)) {
MOD_DEC_USE_COUNT;
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 */
MOD_DEC_USE_COUNT;
return count;
}
/** proc_init() initializes the /proc filesystem entries,
creating the directory and files, and linking them
to the appropriate callback functions. This function
is called from the init_module() function of the
RTAPI implementation.
*/
static int proc_init(void)
{
/* create the rtapi directory "/proc/rtapi" */
rtapi_dir = create_proc_entry("rtapi", S_IFDIR, NULL);
if (rtapi_dir == 0) {
return -1;
}
// rtapi_dir->owner = THIS_MODULE;
/* create read only file "/proc/rtapi/status" */
status_file = create_proc_entry("status", S_IRUGO, rtapi_dir);
if (status_file == NULL) {
return -1;
}
status_file->read_proc = proc_read_status;
/* create read only file "/proc/rtapi/tasks" */
tasks_file = create_proc_entry("tasks", S_IRUGO, rtapi_dir);
if (tasks_file == NULL) {
return -1;
}
tasks_file->read_proc = proc_read_tasks;
/* create read only file "/proc/rtapi/shmem" */
shmem_file = create_proc_entry("shmem", S_IRUGO, rtapi_dir);
if (shmem_file == NULL) {
return -1;
}
shmem_file->read_proc = proc_read_shmem;
/* create read only file "/proc/rtapi/sems" */
sems_file = create_proc_entry("sems", S_IRUGO, rtapi_dir);
if (sems_file == NULL) {
return -1;
}
sems_file->read_proc = proc_read_sems;
/* create read only file "/proc/rtapi/fifos" */
fifos_file = create_proc_entry("fifos", S_IRUGO, rtapi_dir);
if (fifos_file == NULL) {
return -1;
}
fifos_file->read_proc = proc_read_fifos;
/* create read/write file "/proc/rtapi/debug" */
debug_file = create_proc_entry("debug", S_IRUGO | S_IWUGO, 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;
}
/** proc_clean() is called from the cleanup_module function of
of the RTAPI implementation. It removes the rtapi entries
from the /proc filesystem. Failing to remove a /proc
entry before the module is removed may cause kernel panics.
*/
static void proc_clean(void)
{
/* remove /proc entries, only if they exist */
if (rtapi_dir != 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;
}
if (shmem_file != NULL) {
remove_proc_entry("shmem", rtapi_dir);
shmem_file = NULL;
}
if (sems_file != NULL) {
remove_proc_entry("sems", rtapi_dir);
sems_file = NULL;
}
if (fifos_file != NULL) {
remove_proc_entry("fifos", rtapi_dir);
fifos_file = NULL;
}
if (debug_file != NULL) {
remove_proc_entry("debug", rtapi_dir);
debug_file = NULL;
}
remove_proc_entry("rtapi", NULL);
}
}
#endif /* CONFIG_PROC_FS */
#endif /* RTAPI_COMMON_H */
Index: rtai_rtapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtai_rtapi.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** rtai_rtapi.c 19 Aug 2003 17:29:50 -0000 1.29
--- rtai_rtapi.c 20 Aug 2003 03:16:21 -0000 1.30
***************
*** 1,41 ****
! /** RTAPI is a library providing a uniform API for several real time *
! * operating systems. As of ver 2.0, RTLinux and RTAI are supported. */
! /** This file, 'rtai_rtapi.c', implements the realtime portion of the *
! * API for the RTAI platform. The realtime API is defined in rtapi.h, *
! * which includes documentation for the API functions. The non-real- *
! * time portion of the API is defined in ulapi.h and implemented in *
! * rtai_ulapi.c (for the RTAI platform). */
! /** Copyright (C) 2003 John Kasunich *
[...1126 lines suppressed...]
*** 1105,1113 ****
/* decrement the usage counter */
! int_usage_count--;
rtapi_print_msg(RTAPI_MSG_DBG,
"RTAPI: free_interrupt_handler for int %d, count = %d\n",
! irq, int_usage_count);
return RTAPI_SUCCESS;
--- 1160,1168 ----
/* decrement the usage counter */
! rtapi_data->irq_count--;
rtapi_print_msg(RTAPI_MSG_DBG,
"RTAPI: free_interrupt_handler for int %d, count = %d\n",
! irq, rtapi_data->irq_count);
return RTAPI_SUCCESS;
Index: rtai_ulapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtai_ulapi.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** rtai_ulapi.c 19 Aug 2003 17:29:50 -0000 1.7
--- rtai_ulapi.c 20 Aug 2003 03:16:21 -0000 1.8
***************
*** 1,41 ****
! /** RTAPI is a library providing a uniform API for several real time *
! * operating systems. As of ver 2.0, RTLinux and RTAI are supported. */
! /** This file, 'rtai_ulapi.c', implements the non-realtime portion of *
! * the API for the RTAI platform. The non-realtime API is defined in *
! * ulapi.h, which includes documentation for the API functions. The *
! * realtime portion of the API is defined in rtapi.h and implemented *
! * in rtai_rtapi.c (for the RTAI platform). */
! /** Copyright (C) 2003 John Kasunich *
! * <jmkasunich AT users DOT sourceforge DOT net> *
! * Copyright (C) 2003 Paul Corner *
! * <paul_c AT users DOT sourceforge DOT net> *
! * This library is based on version 1.0, which was released into *
! * the public domain by its author, Fred Proctor. Thanks Fred! */
! /* This library is free software; you can redistribute it and/or *
! * modify it under the terms of version 2.1 of the GNU Lesser 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 *
! * Lesser General Public License for more details. *
! * *
! * You should have received a copy of the GNU General Lesser Public *
! * License along with this library; if not, write to the Free Software *
! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA */
! /** THE AUTHORS OF THIS LIBRARY ACCEPT ABSOLUTELY NO LIABILITY FOR *
! * ANY HARM OR LOSS RESULTING FROM ITS USE. IT IS _EXTREMELY_ UNWISE *
! * TO RELY ON SOFTWARE ALONE FOR SAFETY. Any machinery capable of *
! * harming persons must have provisions for completely removing power *
! * from all motors, etc, before persons enter any danger area. All *
! * machinery must be designed to comply with local and national safety *
! * codes, and the authors of this software can not, and do not, take *
! * any responsibility for such compliance. */
! /** This code was written as part of the EMC HAL project. For more *
! * information, go to www.linuxcnc.org. */
--- 1,46 ----
! /** RTAPI is a library providing a uniform API for several real time
! operating systems. As of ver 2.0, RTLinux and RTAI are supported.
! */
! /** This file, 'rtai_ulapi.c', implements the non-realtime portion of
! the API for the RTAI platform. The non-realtime API is defined in
! ulapi.h, which includes documentation for the API functions. The
! realtime portion of the API is defined in rtapi.h and implemented
! in rtai_rtapi.c (for the RTAI platform).
! */
! /** Copyright (C) 2003 John Kasunich
! <jmkasunich AT users DOT sourceforge DOT net>
! Copyright (C) 2003 Paul Corner
! <paul_c AT users DOT sourceforge DOT net>
! This library is based on version 1.0, which was released into
! the public domain by its author, Fred Proctor. Thanks Fred!
! */
! /* This library is free software; you can redistribute it and/or
! modify it under the terms of version 2.1 of the GNU Lesser 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 Lesser General Public License for more details.
! You should have received a copy of the GNU General Lesser Public
! License along with this library; if not, write to the Free Software
! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
! */
! /** THE AUTHORS OF THIS LIBRARY ACCEPT ABSOLUTELY NO LIABILITY FOR
! ANY HARM OR LOSS RESULTING FROM ITS USE. IT IS _EXTREMELY_ UNWISE
! TO RELY ON SOFTWARE ALONE FOR SAFETY. Any machinery capable of
! harming persons must have provisions for completely removing power
! from all motors, etc, before persons enter any danger area. All
! machinery must be designed to comply with local and national safety
! codes, and the authors of this software can not, and do not, take
! any responsibility for such compliance.
!
! This code was written as part of the EMC HAL project. For more
! information, go to www.linuxcnc.org.
! */
***************
*** 48,80 ****
#include <rtai_shm.h> /* rtai_malloc,free() */
#include <malloc.h> /* malloc(), free() */
- #include "ulapi.h"
! /* These structs hold data associated with objects like tasks, etc. */
! /* Task handles are pointers to these structs. */
!
! 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
int ulapi_init(void)
{
! /* does nothing, for now */
return ULAPI_SUCCESS;
}
--- 53,91 ----
#include <rtai_shm.h> /* rtai_malloc,free() */
#include <malloc.h> /* malloc(), free() */
! #include "ulapi.h" /* public ULAPI decls */
! #include "rtapi_common.h" /* private RTAPI/ULAPI decls */
! /* resource data unique to this process */
! static void *shmem_addr_array[RTAPI_MAX_SHMEMS+1];
! static int fifo_fd_array[RTAPI_MAX_FIFOS+1];
int ulapi_init(void)
{
! int n;
!
! /* get shared memory block from OS and save its address */
! rtapi_data = rtai_malloc(RTAPI_KEY, sizeof(rtapi_data_t));
! if (rtapi_data == NULL) {
! return ULAPI_NOMEM;
! }
! /* perform a global init if needed */
! init_rtapi_data ( rtapi_data );
! /* set up local pointers to global data */
! task_array = rtapi_data->task_array;
! shmem_array = rtapi_data->shmem_array;
! sem_array = rtapi_data->sem_array;
! fifo_array = rtapi_data->fifo_array;
! irq_array = rtapi_data->irq_array;
! /* perform local init */
! for (n = 0; n <= RTAPI_MAX_SHMEMS; n++) {
! shmem_addr_array[n] = NULL;
! }
! /* update module count */
! mutex_get ( &(rtapi_data->mutex) );
! rtapi_data->ul_module_count++;
! mutex_give ( &(rtapi_data->mutex) );
return ULAPI_SUCCESS;
}
***************
*** 83,247 ****
int ulapi_exit(void)
{
! /* does nothing, for now */
return ULAPI_SUCCESS;
}
! int ulapi_shmem_new(int key, unsigned long 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;
}
!
! /* label as a valid shmem structure */
! shmem->magic = SHMEM_MAGIC;
! /* fill in the other fields */
! shmem->size = size;
shmem->key = key;
!
! /* return handle to the caller */
! *shmemptr = shmem;
! return ULAPI_SUCCESS;
}
! 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;
return ULAPI_SUCCESS;
-
}
! 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;
}
!
! /* label as a valid fifo structure */
! fifo->magic = FIFO_MAGIC;
! /* fill in the rest of the struct */
fifo->key = key;
! fifo->fd = retval;
! fifo->mode = flags;
!
! /* return handle to the caller */
! *fifoptr = fifo;
! return ULAPI_SUCCESS;
}
! 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;
--- 94,401 ----
int ulapi_exit(void)
{
! if (rtapi_data == NULL) {
! /* no inited */
! return ULAPI_INVAL;
! }
! /* do cleanup here, nothing implemented yet */
!
! /* update module count */
! mutex_get ( &(rtapi_data->mutex) );
! rtapi_data->ul_module_count--;
! mutex_give ( &(rtapi_data->mutex) );
return ULAPI_SUCCESS;
}
! /***********************************************************************
! * SHARED MEMORY RELATED FUNCTIONS *
! ************************************************************************/
!
! int ulapi_shmem_new(int key, unsigned long int size)
{
! int n;
! int shmem_id;
! shmem_data *shmem;
! /* key must be non-zero, and also cannot match the key that RTAPI uses */
! if (( key == 0 ) || ( key == RTAPI_KEY )) {
return ULAPI_INVAL;
}
! /* check if a block is already open for this key */
! for ( n = 1; n <= RTAPI_MAX_SHMEMS ; n++ ) {
! if ( shmem_array[n].key == key ) {
! /* found a match */
! shmem_id = n;
! shmem = &(shmem_array[n]);
! /* is it big enough? */
! if (shmem->size < size) {
! return ULAPI_INVAL;
! }
! /* yes, has this process already mapped it? */
! if (shmem_addr_array[shmem_id] != 0 ) {
! /* can't map twice */
! return ULAPI_FAIL;
! }
! /* no, map it */
! shmem_addr_array[shmem_id] = rtai_malloc(key, shmem->size);
! if (shmem_addr_array[shmem_id] == NULL) {
! /* map failed */
! return ULAPI_NOMEM;
! }
! /* update usage data */
! shmem->ulusers++;
! /* done */
! return shmem_id;
! }
}
! /* find empty spot in shmem array */
! n = 1;
! while ((n <= RTAPI_MAX_SHMEMS) &&
! (shmem_array[n].key != 0)) {
! n++;
! }
! if (n > RTAPI_MAX_SHMEMS) {
! /* no room */
! return ULAPI_LIMIT;
! }
! /* we have space for the block data */
! shmem_id = n;
! shmem = &(shmem_array[n]);
! /* now get shared memory block from OS and save its address */
! shmem_addr_array[shmem_id] = rtai_malloc(key, size);
! if (shmem_addr_array[shmem_id] == NULL) {
return ULAPI_NOMEM;
}
! /* fill in the data */
shmem->key = key;
! shmem->rtusers = 0;
! shmem->ulusers = 1;
! shmem->size = size;
! rtapi_data->shmem_count++;
! /* done */
! return shmem_id;
}
! int ulapi_shmem_delete(int shmem_id)
{
! shmem_data *shmem;
!
! /* validate shmem ID */
! if ((shmem_id < 1) || (shmem_id > RTAPI_MAX_SHMEMS)) {
! return ULAPI_BADID;
}
! /* point to the shmem's data */
! shmem = &(shmem_array[shmem_id]);
! /* is the block valid? */
! if (shmem->key == 0 ) {
! return ULAPI_BADID;
}
! /* unmap the block */
! rtai_free(shmem->key, shmem_addr_array[shmem_id]);
! shmem_addr_array[shmem_id] = NULL;
! /* update data */
! shmem->ulusers--;
! /* is somebody else still using the block? */
! if ((shmem->ulusers > 0 ) || (shmem->rtusers > 0 )) {
! /* yes, we're done for now */
! return ULAPI_SUCCESS;
! }
! /* update the data array and usage count */
! shmem->key = 0;
! shmem->size = 0;
! rtapi_data->shmem_count--;
return ULAPI_SUCCESS;
}
! int ulapi_shmem_getptr(int shmem_id, void **ptr)
{
! /* validate shmem ID */
! if ((shmem_id < 1) || (shmem_id > RTAPI_MAX_SHMEMS)) {
! return ULAPI_BADID;
}
! /* is the block mapped? */
! if (shmem_addr_array[shmem_id] == NULL ) {
! return ULAPI_BADID;
}
! /* pass memory address back to caller */
! *ptr = shmem_addr_array[shmem_id];
return ULAPI_SUCCESS;
}
!
! int ulapi_fifo_new(int key, unsigned long int size, char mode)
{
enum { DEVSTR_LEN = 256 };
char devstr[DEVSTR_LEN];
+ int n, flags;
+ int fifo_id;
+ fifo_data *fifo;
! /* key must be non-zero */
! if ( key == 0 ) {
return ULAPI_INVAL;
}
! /* mode must be "R" or "W" */
! if (( mode != 'R' ) && ( mode != 'W' )) {
! return ULAPI_INVAL;
}
/* determine mode for fifo */
if (mode == 'R') {
flags = O_RDONLY;
! }
! else /* mode == 'W' */ {
! flags = O_WRONLY;
! }
! /* check if a fifo already exists for this key */
! for ( n = 1; n <= RTAPI_MAX_FIFOS ; n++ ) {
! if ((fifo_array[n].state != UNUSED) && (fifo_array[n].key == key)) {
! /* found a match */
! fifo_id = n;
! fifo = &(fifo_array[n]);
! /* is the desired mode available */
! if ( mode == 'R' ) {
! if ( fifo->state & HAS_READER ) {
! return ULAPI_BUSY;
! }
! /* determine system name for fifo */
! sprintf(devstr, "/dev/rtf%d", fifo_id);
! /* open the fifo */
! fifo_fd_array[fifo_id] = open(devstr, flags);
! if (fifo_fd_array[fifo_id] < 0) {
! /* open failed */
! return ULAPI_NOTFND;
! }
! /* fifo opened, update status */
! fifo->state |= HAS_READER;
! return fifo_id;
! }
! else /* mode == 'W' */ {
! if ( fifo->state & HAS_WRITER ) {
! return ULAPI_BUSY;
! }
! /* determine system name for fifo */
! sprintf(devstr, "/dev/rtf%d", fifo_id);
! /* open the fifo */
! fifo_fd_array[fifo_id] = open(devstr, flags);
! if (fifo_fd_array[fifo_id] < 0) {
! /* open failed */
! return ULAPI_NOTFND;
! }
! /* fifo opened, update status */
! fifo->state |= HAS_WRITER;
! return fifo_id;
! }
}
}
+ /* find empty spot in fifo array */
+ n = 1;
+ while ((n <= RTAPI_MAX_FIFOS) &&
+ (fifo_array[n].state != UNUSED)) {
+ n++;
+ }
+ if (n > RTAPI_MAX_FIFOS) {
+ /* no room */
+ return ULAPI_LIMIT;
+ }
+ /* we have a free ID for the fifo */
+ fifo_id = n;
+ fifo = &(fifo_array[n]);
+ /* determine system name for fifo */
+ sprintf(devstr, "/dev/rtf%d", fifo_id);
/* open the fifo */
! fifo_fd_array[fifo_id] = open(devstr, flags);
! if (fifo_fd_array[fifo_id] < 0) {
/* open failed */
return ULAPI_NOTFND;
}
! /* the fifo has been created, update data */
! if ( mode == 'R' ) {
! fifo->state = HAS_READER;
! }
! else /* mode == 'W' */ {
! fifo->state = HAS_WRITER;
! }
fifo->key = key;
! fifo->size = size;
! rtapi_data->fifo_count++;
! /* done */
! return fifo_id;
}
! int ulapi_fifo_delete(int fifo_id, char mode)
{
! fifo_data *fifo;
!
! /* validate fifo ID */
! if ((fifo_id < 1) || (fifo_id > RTAPI_MAX_FIFOS)) {
! return ULAPI_BADID;
}
! /* point to the fifo's data */
! fifo = &(fifo_array[fifo_id]);
! /* is the fifo valid? */
! if (fifo->state == UNUSED ) {
! return ULAPI_BADID;
}
! /* check fifo state */
! if ( mode == 'R' ) {
! if (( fifo->state & HAS_READER ) == 0 ) {
! return ULAPI_INVAL;
! }
! /* close the fifo */
! if (close(fifo_id) < 0) {
! return ULAPI_NOTFND;
! }
! /* update fifo state */
! fifo->state &= ~HAS_READER;
}
! else if ( mode == 'W' ) {
! if (( fifo->state & HAS_WRITER ) == 0 ) {
! return ULAPI_INVAL;
! }
! /* close the fifo */
! if (close(fifo_id) < 0) {
! return ULAPI_NOTFND;
! }
! /* update fifo state */
! fifo->state &= ~HAS_WRITER;
! }
! else {
! return ULAPI_INVAL;
! }
! /* is somebody else still using the fifo */
! if ( fifo->state != UNUSED ) {
! /* yes, done for now */
! return ULAPI_SUCCESS;
! }
! /* no other users, update the data array and usage count */
! fifo->state = UNUSED;
! fifo->key = 0;
! fifo->size = 0;
! rtapi_data->fifo_count--;
return ULAPI_SUCCESS;
}
!
! int ulapi_fifo_read(int fifo_id, char *buf, unsigned long int size)
{
int retval;
! fifo_data *fifo;
!
! /* validate fifo ID */
! if ((fifo_id < 1) || (fifo_id > RTAPI_MAX_FIFOS)) {
! return ULAPI_BADID;
}
! /* point to the fifo's data */
! fifo = &(fifo_array[fifo_id]);
! /* is the fifo valid? */
! if ((fifo->state & HAS_READER) == 0 ) {
! return ULAPI_BADID;
}
/* get whatever data is available */
! retval = read(fifo_fd_array[fifo_id], buf, size);
if (retval <= 0) {
return ULAPI_FAIL;
***************
*** 251,272 ****
}
! 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;
}
-
/* put whatever data will fit */
! retval = write(fifo->fd, buf, size);
if (retval < 0) {
return ULAPI_FAIL;
--- 405,425 ----
}
! int ulapi_fifo_write(int fifo_id, char *buf, unsigned long int size)
{
int retval;
+ fifo_data *fifo;
! /* validate fifo ID */
! if ((fifo_id < 1) || (fifo_id > RTAPI_MAX_FIFOS)) {
! return ULAPI_BADID;
}
! /* point to the fifo's data */
! fifo = &(fifo_array[fifo_id]);
! /* is the fifo valid? */
! if ((fifo->state & HAS_WRITER) == 0 ) {
! return ULAPI_BADID;
}
/* put whatever data will fit */
! retval = write(fifo_fd_array[fifo_id], buf, size);
if (retval < 0) {
return ULAPI_FAIL;
Index: rtapi.h
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtapi.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** rtapi.h 19 Aug 2003 17:29:50 -0000 1.25
--- rtapi.h 20 Aug 2003 03:16:21 -0000 1.26
***************
*** 66,70 ****
/** 'rtapi_init() sets up the RTAPI. It must be called by any module
that intends to use the API, before any other RTAPI calls. Returns
! a status code, as defined above. Increments a usage count.
*/
extern int rtapi_init(void);
--- 66,71 ----
/** 'rtapi_init() sets up the RTAPI. It must be called by any module
that intends to use the API, before any other RTAPI calls. Returns
! a status code, as defined above. Increments a usage count. Call
! only from within init/cleanup code, not from realtime tasks.
*/
extern int rtapi_init(void);
***************
*** 74,78 ****
called prior to exit by any module that called rtapi_init.
Returns a status code. Decrements the usage count maintained
! by rtapi_init.
*/
extern int rtapi_exit(void);
--- 75,80 ----
called prior to exit by any module that called rtapi_init.
Returns a status code. Decrements the usage count maintained
! by rtapi_init. Call only from within init/cleanup code, not
! from realtime tasks.
*/
extern int rtapi_exit(void);
***************
*** 86,90 ****
format line and arguments should not produce a line more than
255 bytes long. Does not block, but can take a fairly long
! time, depending on the format string and OS.
*/
extern void rtapi_print(const char *fmt, ...);
--- 88,93 ----
format line and arguments should not produce a line more than
255 bytes long. Does not block, but can take a fairly long
! time, depending on the format string and OS. May be called from
! init/cleanup code, and from within realtime tasks.
*/
extern void rtapi_print(const char *fmt, ...);
***************
*** 95,99 ****
'rtapi_msg_level' is a global. The default is 7, but it may be
changed. The defines below are used for RTAPI messages, and are
! recommended for user messages as well.
*/
extern int rtapi_msg_level;
--- 98,103 ----
'rtapi_msg_level' is a global. The default is 7, but it may be
changed. The defines below are used for RTAPI messages, and are
! recommended for user messages as well. May be called from
! init/cleanup code, and from within realtime tasks.
*/
extern int rtapi_msg_level;
***************
*** 109,130 ****
************************************************************************/
- /* OLD VERSION */
-
- /** The clock period is the basic time interval for realtime tasks
- All task periods, whether specified when starting the task, or
- changed later, will be rounded to an integer multiple of the
- period set by 'rtapi_clock_set_period()'. Note that there may be
- only one hardware clock in the system, and this call may stop and
- reset it. So this function only needs to be called once, even if
- there are multiple realtime tasks in multiple modules. Calling this
- function after realtime tasks have been started may disrupt the
- tasks. If the call fails, it returns a negative status code. On
- success, it either returns 0, or (if the RTOS supports it), the
- actual period, which may not be exactly what was requested. The
- upper and lower limits for the timer period are RTOS dependent, so
- be sure to check for errors. */
-
- /* NEW VERSION */
-
/** 'rtapi_clock_set_period() sets the basic time interval for realtime
tasks. All periodic tasks will run at an integer multiple of this
--- 113,116 ----
***************
*** 140,144 ****
no effect. Calling 'rtapi_clock_set_period() with 'nsecs' set to
zero queries the clock, returning the current clock period, or zero
! if the clock has not yet been started.
*/
extern long int rtapi_clock_set_period(long int nsecs);
--- 126,131 ----
no effect. Calling 'rtapi_clock_set_period() with 'nsecs' set to
zero queries the clock, returning the current clock period, or zero
! if the clock has not yet been started. Call only from within
! init/cleanup code, not from realtime tasks.
*/
extern long int rtapi_clock_set_period(long int nsecs);
***************
*** 152,155 ****
--- 139,143 ----
Returns a 2^63 value. The resolution of the returned value may
be as good as one nano-second, or as poor as several microseconds.
+ May be called from init/cleanup code, and from within realtime tasks.
*/
extern long long int rtapi_get_time(void);
***************
*** 164,168 ****
called befure using 'rtapi_sleep()' to make sure the required delays
can be achieved. The actual resolution of the delay may be as good
! as one nano-second, or as bad as a several microseconds.
*/
extern void rtapi_sleep(long int nsec);
--- 152,157 ----
called befure using 'rtapi_sleep()' to make sure the required delays
can be achieved. The actual resolution of the delay may be as good
! as one nano-second, or as bad as a several microseconds. May be
! called from init/cleanup code, and from within realtime tasks.
*/
extern void rtapi_sleep(long int nsec);
***************
*** 193,196 ****
--- 182,188 ----
for each task of the next highest priority, set their priorities
to 'rtapi_prio_next_lower(previous)'.
+
+ Call these functions only from within init/cleanup code, not from
+ realtime tasks.
*/
extern int rtapi_prio_highest(void);
***************
*** 219,222 ****
--- 211,215 ----
definitely does not use floating point, setting 'uses_fp' to
RTAPI_NO_FP saves a few microseconds per task switch.
+ Call only from within init/cleanup code, not from realtime tasks.
*/
#define RTAPI_NO_FP 0
***************
*** 231,236 ****
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);
--- 224,229 ----
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 only from within init/cleanup
! code, not from realtime tasks.
*/
extern int rtapi_task_delete(int task_id);
***************
*** 252,255 ****
--- 245,249 ----
at a specific time, it will return RTAPI_UNSUP and the task will not
be started.
+ Call only from within init/cleanup code, not from realtime tasks.
*/
#define RTAPI_NOW 0
***************
*** 262,266 ****
next period. The task must be periodic, if not, the result is
undefined. The function will return at the beginning of the
! next period. Call only from within a task.
*/
extern void rtapi_wait(void);
--- 256,260 ----
next period. The task must be periodic, if not, the result is
undefined. The function will return at the beginning of the
! next period. Call only from within a realtime task.
*/
extern void rtapi_wait(void);
***************
*** 276,279 ****
--- 270,274 ----
resume when the function unblocks.
3) it is returned to the "paused" state by rtapi_task_pause().
+ May be called from init/cleanup code, and from within realtime tasks.
*/
extern int rtapi_task_resume(int task_id);
***************
*** 285,289 ****
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);
--- 280,285 ----
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. May be called from init/cleanup code,
! and from within realtime tasks.
*/
extern int rtapi_task_pause(int task_id);
***************
*** 291,295 ****
/** '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);
--- 287,291 ----
/** 'rtapi_task_self()' returns the task ID of the current task.
! Call only from a realtime task.
*/
extern int rtapi_task_self(void);
***************
*** 307,312 ****
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);
--- 303,308 ----
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. Call only from within init/cleanup code, not from
! realtime tasks.
*/
extern int rtapi_shmem_new(int key, unsigned long int size);
***************
*** 314,323 ****
/** '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);
--- 310,321 ----
/** 'rtapi_shmem_delete()' frees the shared memory block associated
! with 'shmem_id'. Returns a status code. Call only from within
! init/cleanup code, not from realtime tasks.
*/
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. May be called
! from init/cleanup code, and from within realtime tasks.
*/
extern int rtapi_shmem_getptr(int shmem_id, void **ptr);
***************
*** 333,337 ****
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);
--- 331,336 ----
returns a positive integer ID, which is used for all subsequent
calls dealing with the semaphore. On failure it returns a negative
! error code. Call only from within init/cleanup code, not from
! realtime tasks.
*/
extern int rtapi_sem_new(int key);
***************
*** 340,344 ****
/** '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);
--- 339,344 ----
/** '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. Call only
! from within init/cleanup code, not from realtime tasks.
*/
extern int rtapi_sem_delete(int sem_id);
***************
*** 348,351 ****
--- 348,352 ----
is blocked on the semaphore, the calling task will block and the
higher priority task will begin to run. Returns a status code.
+ May be called from init/cleanup code, and from within realtime tasks.
*/
extern int rtapi_sem_give(int sem_id);
***************
*** 356,359 ****
--- 357,361 ----
immediately. If the semaphore is locked, the calling task blocks
until the semaphore is unlocked, then it returns RTAPI_SUCCESS.
+ Call only from within a realtime task.
*/
extern int rtapi_sem_take(int sem_id);
***************
*** 364,368 ****
is unlocked, it returns RTAPI_SUCCESS. If the semaphore is locked
it does not block, instead it returns RTAPI_BUSY, and the caller
! can decide how to deal with the situation.
*/
extern int rtapi_sem_try(int sem_id);
--- 366,371 ----
is unlocked, it returns RTAPI_SUCCESS. If the semaphore is locked
it does not block, instead it returns RTAPI_BUSY, and the caller
! can decide how to deal with the situation. Call only from within
! a realtime task.
*/
extern int rtapi_sem_try(int sem_id);
***************
*** 379,382 ****
--- 382,386 ----
returns a positive integer ID, which is used for subsequent calls
dealing with the fifo. On failure, returns a negative error code.
+ Call only from within init/cleanup code, not from realtime tasks.
*/
***************
*** 390,393 ****
--- 394,398 ----
It closes the fifo associated with 'fifo_ID'. 'mode' is the mode
that was specified when the fifo was created. Returns status code.
+ Call only from within init/cleanup code, not from realtime tasks.
*/
extern int rtapi_fifo_delete(int fifo_id, char mode);
***************
*** 411,415 ****
Returns the number of bytes actually read, or RTAPI_BADH. Does not
block. If 'size' bytes are not available, it will read whatever is
! available, and return that count (which could be zero).
*/
extern int rtapi_fifo_read(int fifo_id, char *buf, unsigned long int size);
--- 416,421 ----
Returns the number of bytes actually read, or RTAPI_BADH. Does not
block. If 'size' bytes are not available, it will read whatever is
! available, and return that count (which could be zero). Call only
! from within a realtime task.
*/
extern int rtapi_fifo_read(int fifo_id, char *buf, unsigned long int size);
***************
*** 420,424 ****
actually written, or RTAPI_BADH. Does not block. If 'size' bytes
of space are not available in the fifo, it will write as many bytes
! as it can and return that count (which may be zero).
*/
extern int rtapi_fifo_write(int fifo_id, char *buf, unsigned long int size);
--- 426,431 ----
actually written, or RTAPI_BADH. Does not block. If 'size' bytes
of space are not available in the fifo, it will write as many bytes
! as it can and return that count (which may be zero). Call only from
! within a realtime task.
*/
extern int rtapi_fifo_write(int fifo_id, char *buf, unsigned long int size);
***************
*** 434,437 ****
--- 441,445 ----
'handler will be called when the interrupt occurs. Returns a status
code. Note: The simulated RTOS does not support interrupts.
+ Call only from within init/cleanup code, not from realtime tasks.
*/
extern int rtapi_assign_interrupt_handler(unsigned int irq,
***************
*** 443,447 ****
is the interrupt number. Removing a realtime module without freeing
any handlers it has installed will almost certainly crash the box.
! Returns RTAPI_SUCCESS or RTAPI_INVAL.
*/
extern int rtapi_free_interrupt_handler(unsigned int irq);
--- 451,456 ----
is the interrupt number. Removing a realtime module without freeing
any handlers it has installed will almost certainly crash the box.
! Returns RTAPI_SUCCESS or RTAPI_INVAL. Call only from within
! init/cleanup code, not from realtime tasks.
*/
extern int rtapi_free_interrupt_handler(unsigned int irq);
***************
*** 450,454 ****
/** 'rtapi_enable_interrupt()' and 'rtapi_disable_interrupt()' are
are used to enable and disable interrupts, presumably ones that
! have handlers assigned to them. Returns a status code.
*/
extern int rtapi_enable_interrupt(unsigned int irq);
--- 459,465 ----
/** 'rtapi_enable_interrupt()' and 'rtapi_disable_interrupt()' are
are used to enable and disable interrupts, presumably ones that
! have handlers assigned to them. Returns a status code. May be
! called from init/cleanup code, and from within realtime tasks.
!
*/
extern int rtapi_enable_interrupt(unsigned int irq);
***************
*** 459,463 ****
************************************************************************/
! /** '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.
--- 470,475 ----
************************************************************************/
! /** 'rtapi_outb() writes 'byte' to 'port'. May be called from
! init/cleanup code, and from within realtime tasks.
Note: This function does nothing on the simulated RTOS.
Note: Many platforms provide an inline outb() that is faster.
***************
*** 466,534 ****
! /** '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);
-
- /***********************************************************************
- * PROC_FS MACROS *
- ************************************************************************/
- #include <linux/proc_fs.h>
-
- /* proc print macros - Contributed by: Erwin Rol (er...@mu...)
- and shamelessly ripped from rtai_proc_fs.h, part of the RTAI project.
- See http://www.rtai.org for more details.
-
- macro that holds the local variables that
- we use in the PROC_PRINT_* macros. We have
- this macro so we can add variables with out
- changing the users of this macro, of course
- only when the names don't colide! */
-
- #define PROC_PRINT_VARS \
- off_t pos = 0; \
- off_t begin = 0; \
- int len = 0 /* no ";" */
-
- /* macro that prints in the procfs read buffer.
- this macro expects the function arguments to be
- named as follows.
- static int FOO(char *page, char **start,
- off_t off, int count, int *eof, void *data) */
-
- #define PROC_PRINT(fmt,args...) \
- len += sprintf(page + len , fmt, ##args); \
- pos += len; \
- if(pos < off) { \
- len = 0; \
- begin = pos; \
- } \
- if(pos > off + count) \
- goto done;
-
- /* macro to leave the read function for a other
- place than at the end. */
- #define PROC_PRINT_RETURN \
- *eof = 1; \
- goto done // no ";"
-
- /* macro that should only used ones at the end of the
- read function, to return from a other place in the
- read function use the PROC_PRINT_RETURN macro. */
- #define PROC_PRINT_DONE \
- *eof = 1; \
- done: \
- *start = page + (off - begin); \
- len -= (off - begin); \
- if(len > count) \
- len = count; \
- if(len < 0) \
- len = 0; \
- return len // no ";"
-
- /***********************************************************************
- * End of rtapi.h *
- ************************************************************************/
#endif /* RTAPI_H */
--- 478,487 ----
! /** 'rtapi_inb() gets a byte from 'port'. Returns the byte. May
! be called from init/cleanup code, and from within realtime tasks.
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);
#endif /* RTAPI_H */
Index: rtapi_common.h
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtapi_common.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** rtapi_common.h 19 Aug 2003 17:29:51 -0000 1.1
--- rtapi_common.h 20 Aug 2003 03:16:21 -0000 1.2
***************
*** 3,10 ****
/** RTAPI is a library providing a uniform API for several real time
! operating systems. As of ver 2.0, RTLinux and RTAI are supported. */
! /** This file, 'rtapi_common.h', contains data structures and functions
! used by the rtapi internally. Do NOT include this file in any user app. */
/** Copyright (C) 2003 John Kasunich
--- 3,17 ----
/** RTAPI is a library providing a uniform API for several real time
! operating systems. As of ver 2.0, RTLinux and RTAI are supported.
! */
! /** This file, 'rtapi_common.h', contains typedefs and other items
! common to both the realtime and non-realtime portions of the
! implementation. These items are also common to both the RTAI
! and RTLinux implementations, and most likely to any other
! implementations in the Linux environment. This data is INTERNAL
! to the RTAPI implementation, and should not be included in any
! application modules.
! */
/** Copyright (C) 2003 John Kasunich
***************
*** 12,17 ****
Copyright (C) 2003 Paul Corner
<paul_c AT users DOT sourceforge DOT net>
This library is based on version 1.0, which was released into
! the public domain by its author, Fred Proctor. Thanks Fred! */
/* This library is free software; you can redistribute it and/or
--- 19,26 ----
Copyright (C) 2003 Paul Corner
<paul_c AT users DOT sourceforge DOT net>
+
This library is based on version 1.0, which was released into
! the public domain by its author, Fred Proctor. Thanks Fred!
! */
/* This library is free software; you can redistribute it and/or
***************
*** 25,30 ****
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA */
!
/** THE AUTHORS OF THIS LIBRARY ACCEPT ABSOLUTELY NO LIABILITY FOR
ANY HARM OR LOSS RESULTING FROM ITS USE. IT IS _EXTREMELY_ UNWISE
--- 34,40 ----
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
! */
!
/** THE AUTHORS OF THIS LIBRARY ACCEPT ABSOLUTELY NO LIABILITY FOR
ANY HARM OR LOSS RESULTING FROM ITS USE. IT IS _EXTREMELY_ UNWISE
***************
*** 34,133 ****
machinery must be designed to comply with local and national safety
codes, and the authors of this software can not, and do not, take
! any responsibility for such compliance. */
/** This code was written as part of the EMC HAL project. For more
! information, go to www.linuxcnc.org. */
!
! #include <linux/proc_fs.h>
!
! static int msg = 7; /* short name, for use in insmod command */
!
! /* module information */
! MODULE_PARM(msg, "i");
! MODULE_PARM_DESC(msg, "debug message level (default=7)");
! MODULE_AUTHOR("John Kasunich, Fred Proctor, & Paul Corner");
!
! /* proc print macros - Contributed by: Erwin Rol (er...@mu...)
! and shamelessly ripped from rtai_proc_fs.h, part of the RTAI project.
! See http://www.rtai.org for more details.
!
! macro that holds the local variables that
! we use in the PROC_PRINT_* macros. We have
! this macro so we can add variables with out
! changing the users of this macro, of course
! only when the names don't colide! */
!
! #define PROC_PRINT_VARS \
! off_t pos = 0; \
! off_t begin = 0; \
! int len = 0 /* no ";" */
!
! /* macro that prints in the procfs read buffer.
! this macro expects the function arguments to be
! named as follows.
! static int FOO(char *page, char **start,
! off_t off, int count, int *eof, void *data) */
!
! #define PROC_PRINT(fmt,args...) \
! len += sprintf(page + len , fmt, ##args); ...
[truncated message content] |
|
From: <jmk...@us...> - 2003-08-20 08:34:16
|
Update of /cvsroot/emc/rtapi/examples/shmem
In directory sc8-pr-cvs1:/tmp/cvs-serv10049/examples/shmem
Modified Files:
shmemtask.c shmemusr.c
Log Message:
moved proc stuff from rtapi_common.h to rtapi_proc.h, put most rtapi internal data in shared memory and put corresponding decls in rtapi_common.h
Index: shmemtask.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/shmem/shmemtask.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** shmemtask.c 14 Aug 2003 04:08:26 -0000 1.9
--- shmemtask.c 20 Aug 2003 03:16:20 -0000 1.10
***************
*** 11,15 ****
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 */
--- 11,16 ----
static int shmem_task; /* the task ID*/
static int shmem_mem; /* the shared memory ID */
! enum { TIMER_PERIOD_NSEC = 1000000 }; /* timer period, in nanoseconds */
! enum { SHMEM_PERIOD_NSEC = 1000000 }; /* task period, in nanoseconds */
enum { SHMEM_STACKSIZE = 1024 }; /* how big the stack is */
***************
*** 35,38 ****
--- 36,40 ----
int retval;
int shmem_prio;
+ long period;
if (rtapi_init() != RTAPI_SUCCESS ) {
***************
*** 54,63 ****
shmem_struct->heartbeat = 0;
! /* 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 */
--- 56,79 ----
shmem_struct->heartbeat = 0;
! /* is timer started? if so, what period? */
! period = rtapi_clock_set_period(0);
! if ( period == 0 ) {
! /* not running, start it */
! rtapi_print("shmemtask init: starting timer with period %ld\n", TIMER_PERIOD_NSEC);
! period = rtapi_clock_set_period(TIMER_PERIOD_NSEC);
! if (period < 0) {
! rtapi_print("shmemtask init: rtapi_clock_set_period failed with %ld\n",
! period);
! return -1;
! }
! }
! /* make sure period <= desired period (allow 1% roundoff error) */
! if ( period > (TIMER_PERIOD_NSEC+(TIMER_PERIOD_NSEC/100))) {
! /* timer period too long */
! rtapi_print("shmemtask init: clock period too long: %ld\n", period );
return -1;
}
+ rtapi_print("shmemtask init: desired clock %ld, actual %ld\n",
+ TIMER_PERIOD_NSEC, period );
/* set the task priority to lowest, since we only have one task */
Index: shmemusr.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/shmem/shmemusr.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** shmemusr.c 23 Jul 2003 01:22:49 -0000 1.2
--- shmemusr.c 20 Aug 2003 03:16:20 -0000 1.3
***************
*** 6,10 ****
static int key = SHMEM_KEY;
! static ulapi_shmem_handle shmem_mem;
static SHMEM_STRUCT *shmem_struct;
--- 6,10 ----
static int key = SHMEM_KEY;
! static int shmem_id;
static SHMEM_STRUCT *shmem_struct;
***************
*** 26,36 ****
/* allocate the shared memory structure */
! retval = ulapi_shmem_new( key, sizeof(SHMEM_STRUCT), &shmem_mem );
! if ( retval != ULAPI_SUCCESS ) {
! printf( "shmemusr main: ulapi_shmem_new returned %d\n", retval );
return -1;
}
! retval = ulapi_shmem_getptr( shmem_mem, (void **)&shmem_struct );
! if ( retval != ULAPI_SUCCESS ) {
printf( "shmemusr main: ulapi_shmem_getptr returned %d\n", retval );
return -1;
--- 26,36 ----
/* allocate the shared memory structure */
! shmem_id = ulapi_shmem_new( key, sizeof(SHMEM_STRUCT) );
! if (shmem_id < 0) {
! printf( "shmemusr main: ulapi_shmem_new returned %d\n", shmem_id );
return -1;
}
! retval = ulapi_shmem_getptr( shmem_id, (void **)&shmem_struct );
! if (retval != ULAPI_SUCCESS) {
printf( "shmemusr main: ulapi_shmem_getptr returned %d\n", retval );
return -1;
***************
*** 43,48 ****
}
! retval = ulapi_shmem_delete( shmem_mem );
! if ( retval != ULAPI_SUCCESS ) {
printf("shmemusr main: ulapi_free_shmem returned %d\n", retval );
return -1;
--- 43,48 ----
}
! retval = ulapi_shmem_delete( shmem_id );
! if (retval != ULAPI_SUCCESS) {
printf("shmemusr main: ulapi_free_shmem returned %d\n", retval );
return -1;
|
|
From: <jmk...@us...> - 2003-08-20 08:34:15
|
Update of /cvsroot/emc/rtapi/examples/fifo
In directory sc8-pr-cvs1:/tmp/cvs-serv10049/examples/fifo
Modified Files:
fifotask.c fifousr.c
Log Message:
moved proc stuff from rtapi_common.h to rtapi_proc.h, put most rtapi internal data in shared memory and put corresponding decls in rtapi_common.h
Index: fifotask.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/fifo/fifotask.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** fifotask.c 15 Aug 2003 20:45:13 -0000 1.15
--- fifotask.c 20 Aug 2003 03:16:20 -0000 1.16
***************
*** 57,60 ****
--- 57,61 ----
int retval;
int fifo_prio;
+ long period;
if (rtapi_init() != RTAPI_SUCCESS ) {
***************
*** 72,82 ****
rtapi_print("fifotask: created fifo\n");
! /* set the base timer period */
! retval = rtapi_clock_set_period(TIMER_PERIOD_NSEC);
! if (retval < 0) {
! rtapi_print("fifotask init: rtapi_clock_set_period failed with %d\n",
! retval);
goto no_task;
}
/* set the task priority to lowest, since we only have one task */
--- 73,96 ----
rtapi_print("fifotask: created fifo\n");
! /* is timer started? if so, what period? */
! period = rtapi_clock_set_period(0);
! if ( period == 0 ) {
! /* not running, start it */
! rtapi_print("fifotask init: starting timer with period %ld\n", TIMER_PERIOD_NSEC);
! period = rtapi_clock_set_period(TIMER_PERIOD_NSEC);
! if (period < 0) {
! rtapi_print("fifotask init: rtapi_clock_set_period failed with %ld\n",
! period);
! goto no_task;
! }
! }
! /* make sure period <= desired period (allow 1% roundoff error) */
! if ( period > (TIMER_PERIOD_NSEC+(TIMER_PERIOD_NSEC/100))) {
! /* timer period too long */
! rtapi_print("fifotask init: clock period too long: %ld\n", period );
goto no_task;
}
+ rtapi_print("fifotask init: desired clock %ld, actual %ld\n",
+ TIMER_PERIOD_NSEC, period );
/* set the task priority to lowest, since we only have one task */
Index: fifousr.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/fifo/fifousr.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** fifousr.c 10 Aug 2003 12:06:05 -0000 1.5
--- fifousr.c 20 Aug 2003 03:16:20 -0000 1.6
***************
*** 19,23 ****
int main()
{
! ulapi_fifo_handle fifo;
char buffer[FIFO_SIZE + 1];
int nchars;
--- 19,23 ----
int main()
{
! int fifo;
char buffer[FIFO_SIZE + 1];
int nchars;
***************
*** 31,37 ****
/* 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;
}
--- 31,37 ----
/* open the fifo */
! fifo = ulapi_fifo_new(FIFO_KEY, FIFO_SIZE, 'R');
! if (fifo < 0) {
! printf("fifousr main: ulapi_fifo_new returned %d\n", fifo);
return -1;
}
***************
*** 57,61 ****
printf("shutting down\n");
! retval = ulapi_fifo_delete(fifo);
if (retval != ULAPI_SUCCESS) {
printf("fifousr main: ulapi_fifo_delete returned %d\n", retval);
--- 57,61 ----
printf("shutting down\n");
! retval = ulapi_fifo_delete(fifo, 'R');
if (retval != ULAPI_SUCCESS) {
printf("fifousr main: ulapi_fifo_delete returned %d\n", retval);
|
|
From: <jmk...@us...> - 2003-08-20 07:08:17
|
Update of /cvsroot/emc/rtapi/examples/timertask
In directory sc8-pr-cvs1:/tmp/cvs-serv10049/examples/timertask
Modified Files:
timertask.c
Log Message:
moved proc stuff from rtapi_common.h to rtapi_proc.h, put most rtapi internal data in shared memory and put corresponding decls in rtapi_common.h
Index: timertask.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/timertask/timertask.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** timertask.c 15 Aug 2003 20:45:13 -0000 1.12
--- timertask.c 20 Aug 2003 03:16:21 -0000 1.13
***************
*** 36,39 ****
--- 36,40 ----
int retval;
int timer_prio;
+ long period;
if (rtapi_init() != RTAPI_SUCCESS ) {
***************
*** 41,51 ****
}
! /* 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 );
return -1;
}
/* set the task priority to second lowest, since we only have one task */
--- 42,65 ----
}
! /* is timer started? if so, what period? */
! period = rtapi_clock_set_period(0);
! if ( period == 0 ) {
! /* not running, start it */
! rtapi_print("timertask init: starting timer with period %ld\n", TIMER_PERIOD_NSEC);
! period = rtapi_clock_set_period(TIMER_PERIOD_NSEC);
! if (period < 0) {
! rtapi_print("timertask init: rtapi_clock_set_period failed with %ld\n",
! period);
! return -1;
! }
! }
! /* make sure period <= desired period (allow 1% roundoff error) */
! if ( period > (TIMER_PERIOD_NSEC+(TIMER_PERIOD_NSEC/100))) {
! /* timer period too long */
! rtapi_print("timertask init: clock period too long: %ld\n", period );
return -1;
}
+ rtapi_print("timertask init: desired clock %ld, actual %ld\n",
+ TIMER_PERIOD_NSEC, period );
/* set the task priority to second lowest, since we only have one task */
|
|
From: <jmk...@us...> - 2003-08-20 07:08:16
|
Update of /cvsroot/emc/rtapi/examples/semaphore
In directory sc8-pr-cvs1:/tmp/cvs-serv10049/examples/semaphore
Modified Files:
master.c
Log Message:
moved proc stuff from rtapi_common.h to rtapi_proc.h, put most rtapi internal data in shared memory and put corresponding decls in rtapi_common.h
Index: master.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/semaphore/master.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** master.c 14 Aug 2003 04:08:26 -0000 1.10
--- master.c 20 Aug 2003 03:16:20 -0000 1.11
***************
*** 36,39 ****
--- 36,40 ----
int retval;
int master_prio;
+ long period;
if (rtapi_init() != RTAPI_SUCCESS ) {
***************
*** 48,57 ****
}
! /* 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;
}
/* set the task priority to one above the lowest; the slave
--- 49,72 ----
}
! /* is timer started? if so, what period? */
! period = rtapi_clock_set_period(0);
! if ( period == 0 ) {
! /* not running, start it */
! rtapi_print("sem master init: starting timer with period %ld\n", TIMER_PERIOD_NSEC);
! period = rtapi_clock_set_period(TIMER_PERIOD_NSEC);
! if (period < 0) {
! rtapi_print("sem master init: rtapi_clock_set_period failed with %ld\n",
! period);
! return -1;
! }
! }
! /* make sure period <= desired period (allow 1% roundoff error) */
! if ( period > (TIMER_PERIOD_NSEC+(TIMER_PERIOD_NSEC/100))) {
! /* timer period too long */
! rtapi_print("sem master init: clock period too long: %ld\n", period );
return -1;
}
+ rtapi_print("sem master init: desired clock %ld, actual %ld\n",
+ TIMER_PERIOD_NSEC, period );
/* set the task priority to one above the lowest; the slave
|
|
From: <pa...@us...> - 2003-08-19 20:13:11
|
Update of /cvsroot/emc/rtapi/src/rtapi
In directory sc8-pr-cvs1:/tmp/cvs-serv9283
Modified Files:
Makefile rtai_rtapi.c rtai_ulapi.c rtapi.h rtl_rtapi.c
Added Files:
rtapi_common.h
Log Message:
Split some common code & structures out
--- NEW FILE: rtapi_common.h ---
#ifndef RTAPI_COMMON_H
#define RTAPI_COMMON_H
/** RTAPI is a library providing a uniform API for several real time
operating systems. As of ver 2.0, RTLinux and RTAI are supported. */
/** This file, 'rtapi_common.h', contains data structures and functions
used by the rtapi internally. Do NOT include this file in any user app. */
/** Copyright (C) 2003 John Kasunich
<jmkasunich AT users DOT sourceforge DOT net>
Copyright (C) 2003 Paul Corner
<paul_c AT users DOT sourceforge DOT net>
This library is based on version 1.0, which was released into
the public domain by its author, Fred Proctor. Thanks Fred! */
/* This library is free software; you can redistribute it and/or
modify it under the terms of version 2.1 of the GNU Lesser 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA */
/** THE AUTHORS OF THIS LIBRARY ACCEPT ABSOLUTELY NO LIABILITY FOR
ANY HARM OR LOSS RESULTING FROM ITS USE. IT IS _EXTREMELY_ UNWISE
TO RELY ON SOFTWARE ALONE FOR SAFETY. Any machinery capable of
harming persons must have provisions for completely removing power
from all motors, etc, before persons enter any danger area. All
machinery must be designed to comply with local and national safety
codes, and the authors of this software can not, and do not, take
any responsibility for such compliance. */
/** This code was written as part of the EMC HAL project. For more
information, go to www.linuxcnc.org. */
#include <linux/proc_fs.h>
static int msg = 7; /* short name, for use in insmod command */
/* module information */
MODULE_PARM(msg, "i");
MODULE_PARM_DESC(msg, "debug message level (default=7)");
MODULE_AUTHOR("John Kasunich, Fred Proctor, & Paul Corner");
/* proc print macros - Contributed by: Erwin Rol (er...@mu...)
and shamelessly ripped from rtai_proc_fs.h, part of the RTAI project.
See http://www.rtai.org for more details.
macro that holds the local variables that
we use in the PROC_PRINT_* macros. We have
this macro so we can add variables with out
changing the users of this macro, of course
only when the names don't colide! */
#define PROC_PRINT_VARS \
off_t pos = 0; \
off_t begin = 0; \
int len = 0 /* no ";" */
/* macro that prints in the procfs read buffer.
this macro expects the function arguments to be
named as follows.
static int FOO(char *page, char **start,
off_t off, int count, int *eof, void *data) */
#define PROC_PRINT(fmt,args...) \
len += sprintf(page + len , fmt, ##args); \
pos += len; \
if(pos < off) { \
len = 0; \
begin = pos; \
} \
if(pos > off + count) \
goto done;
/* macro to leave the read function for a other
place than at the end. */
#define PROC_PRINT_RETURN \
*eof = 1; \
goto done // no ";"
/* macro that should only used ones at the end of the
read function, to return from a other place in the
read function use the PROC_PRINT_RETURN macro. */
#define PROC_PRINT_DONE \
*eof = 1; \
done: \
*start = page + (off - begin); \
len -= (off - begin); \
if(len > count) \
len = count; \
if(len < 0) \
len = 0; \
return len // no ";"
/* These structs hold data associated with objects like tasks, etc. */
typedef enum { EMPTY = 0, PAUSED, PERIODIC, FREERUN, ENDED } task_state_t;
typedef struct {
task_state_t state; /* task state */
void *taskcode; /* task code */
RT_TASK *ostask; /* pointer to OS specific task data */
} task_data;
typedef struct {
int users; /* number of modules using the area */
int key; /* key to shared memory area */
unsigned long size; /* size of shared memory area */
void *mem; /* pointer to the memory */
} shmem_data;
typedef struct {
int users; /* number of modules using the area */
int key; /* key to shared memory area */
#ifdef _RTAI_NEWFIFOS_H_
SEM ossem; /* OS specific semaphore data */
#endif
} sem_data;
typedef enum { UNUSED = 0,
HAS_READER = 1,
HAS_WRITER = 2,
HAS_BOTH = 3
} fifo_state_t; /* used as bitmasks */
typedef struct {
fifo_state_t state; /* task state */
int key; /* key to fifo */
unsigned long int size; /* size of fifo area */
int fd; /* file descripter for fifo */
} fifo_data;
/* maximum number of various resources */
#define RTAPI_MAX_TASKS 64
#define RTAPI_MAX_SHMEMS 32
#define RTAPI_MAX_SEMS 64
#define RTAPI_MAX_FIFOS 32
#define RTAPI_MAX_IRQS 16
/* lists of resources - one extra entry because we don't use entry 0 */
static task_data task_array[RTAPI_MAX_TASKS + 1];
static shmem_data shmem_array[RTAPI_MAX_SHMEMS + 1];
static sem_data sem_array[RTAPI_MAX_SEMS + 1];
static fifo_data fifo_array[RTAPI_MAX_FIFOS + 1];
/* Usage counters to keep track of new/delete calls */
static int rtapi_usage_count = 0;
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;
static long int timer_period = 0;
#define DEFAULT_MAX_SLEEP 10000
static long int max_sleep = DEFAULT_MAX_SLEEP;
/* misc vars */
static char *rev_str; /* version of RTAPI */
/* global used for message printing */
int rtapi_msg_level;
/* Internal function for the proc_fs system. */
#ifdef CONFIG_PROC_FS
/* 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_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 *shmem_file = 0; /* /proc/rtapi/shmem */
static struct proc_dir_entry *sems_file = 0; /* /proc/rtapi/sems */
static struct proc_dir_entry *fifos_file = 0; /* /proc/rtapi/fifos */
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;
PROC_PRINT("******* RTAPI STATUS ********\n");
PROC_PRINT(" Platform = RTAI\n");
PROC_PRINT(" Version = %s\n", rev_str);
PROC_PRINT(" Modules = %i\n", rtapi_usage_count);
PROC_PRINT(" Tasks = %i/%i\n", task_usage_count, RTAPI_MAX_TASKS);
PROC_PRINT("Shared memory = %i/%i\n", shmem_usage_count, RTAPI_MAX_SHMEMS);
PROC_PRINT(" FIFOs = %i/%i\n", fifo_usage_count, RTAPI_MAX_FIFOS);
PROC_PRINT(" Semaphores = %i/%i\n", sem_usage_count, RTAPI_MAX_SEMS);
PROC_PRINT(" Interrupts = %i\n", int_usage_count);
if (timer_running) {
PROC_PRINT(" Timer status = Running\n");
PROC_PRINT(" Timer period = %li nSec\n", timer_period);
} else {
PROC_PRINT(" Timer status = Stopped\n");
}
PROC_PRINT("Message level = %i\n", rtapi_msg_level);
PROC_PRINT("\n");
PROC_PRINT_DONE;
}
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 = 1; 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_shmem(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
int n;
PROC_PRINT_VARS;
PROC_PRINT("**** RTAPI SHARED MEMORY ****\n");
PROC_PRINT("ID Users Key Size\n");
for (n = 1; n <= RTAPI_MAX_SHMEMS; n++) {
if (shmem_array[n].users != 0) {
PROC_PRINT("%02d %3d %-10d %-10lu\n",
n, shmem_array[n].users,
shmem_array[n].key, shmem_array[n].size);
}
}
PROC_PRINT("\n");
PROC_PRINT_DONE;
}
static int proc_read_sems(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
int n;
PROC_PRINT_VARS;
PROC_PRINT("***** RTAPI SEMAPHORES ******\n");
PROC_PRINT("ID Users Key\n");
for (n = 1; n <= RTAPI_MAX_SEMS; n++) {
if (sem_array[n].users != 0) {
PROC_PRINT("%02d %3d %-10d\n",
n, sem_array[n].users, sem_array[n].key);
}
}
PROC_PRINT("\n");
PROC_PRINT_DONE;
}
static int proc_read_fifos(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
int n;
char *state_str;
PROC_PRINT_VARS;
PROC_PRINT("******** RTAPI FIFOS ********\n");
PROC_PRINT("ID State Key Size\n");
for (n = 1; n <= RTAPI_MAX_FIFOS; n++) {
if (fifo_array[n].state != UNUSED) {
switch (fifo_array[n].state) {
case HAS_READER:
state_str = "R-";
break;
case HAS_WRITER:
state_str = "-W";
break;
case HAS_BOTH:
state_str = "RW";
break;
default:
state_str = "UNKNOWN ";
break;
}
PROC_PRINT("%02d %s %-10d %-10ld\n",
n, state_str, fifo_array[n].key, fifo_array[n].size);
}
}
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 MESSAGES ******\n");
PROC_PRINT(" Message Level = %i\n", rtapi_msg_level);
PROC_PRINT(" ERROR messages = %s\n",
rtapi_msg_level > RTAPI_MSG_ERR ? "ON" : "OFF");
PROC_PRINT("WARNING messages = %s\n",
rtapi_msg_level > RTAPI_MSG_WARN ? "ON" : "OFF");
PROC_PRINT(" INFO messages = %s\n",
rtapi_msg_level > RTAPI_MSG_INFO ? "ON" : "OFF");
PROC_PRINT(" DEBUG messages = %s\n",
rtapi_msg_level > RTAPI_MSG_DBG ? "ON" : "OFF");
PROC_PRINT("\n");
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 = create_proc_entry("rtapi", S_IFDIR, 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_entry("status", S_IRUGO, rtapi_dir);
if (status_file == NULL) {
return -1;
}
status_file->read_proc = proc_read_status;
/* create read only file "/proc/rtapi/tasks" using convenience function */
tasks_file = create_proc_entry("tasks", S_IRUGO, rtapi_dir);
if (tasks_file == NULL) {
return -1;
}
tasks_file->read_proc = proc_read_tasks;
/* create read only file "/proc/rtapi/shmem" using convenience function */
shmem_file = create_proc_entry("shmem", S_IRUGO, rtapi_dir);
if (shmem_file == NULL) {
return -1;
}
shmem_file->read_proc = proc_read_shmem;
/* create read only file "/proc/rtapi/sems" using convenience function */
sems_file = create_proc_entry("sems", S_IRUGO, rtapi_dir);
if (sems_file == NULL) {
return -1;
}
sems_file->read_proc = proc_read_sems;
/* create read only file "/proc/rtapi/fifos" using convenience function */
fifos_file = create_proc_entry("fifos", S_IRUGO, rtapi_dir);
if (fifos_file == NULL) {
return -1;
}
fifos_file->read_proc = proc_read_fifos;
/* create read/write file "/proc/rtapi/debug" using regular function */
debug_file = create_proc_entry("debug", S_IRUGO | S_IWUGO, 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 (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;
}
if (shmem_file != NULL) {
remove_proc_entry("shmem", rtapi_dir);
shmem_file = NULL;
}
if (sems_file != NULL) {
remove_proc_entry("sems", rtapi_dir);
sems_file = NULL;
}
if (fifos_file != NULL) {
remove_proc_entry("fifos", rtapi_dir);
fifos_file = NULL;
}
if (debug_file != NULL) {
remove_proc_entry("debug", rtapi_dir);
debug_file = NULL;
}
remove_proc_entry("rtapi", NULL);
}
}
#endif /* CONFIG_PROC_FS */
#endif /* RTAPI_COMMON_H */
Index: Makefile
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/Makefile,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Makefile 13 Aug 2003 05:55:07 -0000 1.4
--- Makefile 19 Aug 2003 17:29:50 -0000 1.5
***************
*** 8,12 ****
rtai_ulapi.c \
rtl_rtapi.c \
! rtl_ulapi.c \
# TEMPORARY - not making the sim right now
#sim_rtapi.c \
--- 8,12 ----
rtai_ulapi.c \
rtl_rtapi.c \
! rtl_ulapi.c
# TEMPORARY - not making the sim right now
#sim_rtapi.c \
***************
*** 17,23 ****
rtapi.h \
ulapi.h \
! rtapi_app.h
! OBJS = \
# TEMPORARY - not making the sim right now
#$(LIB_DIR)/sim_rtapi.o \
--- 17,24 ----
rtapi.h \
ulapi.h \
! rtapi_app.h \
! rtapi_common.h
! OBJS =
# TEMPORARY - not making the sim right now
#$(LIB_DIR)/sim_rtapi.o \
***************
*** 78,89 ****
# DO NOT DELETE
-
- /home/John/emcdev/rtapi/lib/rtai_rtapi.o: rtapi.h
- /home/John/emcdev/rtapi/lib/rtai_ulapi.o: ulapi.h
- /home/John/emcdev/rtapi/lib/rtl_rtapi.o: rtapi.h
- /home/John/emcdev/rtapi/lib/rtl_ulapi.o: ulapi.h
-
- /home/John/emcdev/rtapi/rtlib/rtai_rtapi.o: rtapi.h
- /home/John/emcdev/rtapi/rtlib/rtai_ulapi.o: ulapi.h
- /home/John/emcdev/rtapi/rtlib/rtl_rtapi.o: rtapi.h
- /home/John/emcdev/rtapi/rtlib/rtl_ulapi.o: ulapi.h
--- 79,80 ----
Index: rtai_rtapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtai_rtapi.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** rtai_rtapi.c 16 Aug 2003 22:28:57 -0000 1.28
--- rtai_rtapi.c 19 Aug 2003 17:29:50 -0000 1.29
***************
*** 53,57 ****
#include <rtai_shm.h>
#include <rtai_fifos.h>
- #include <rtai_proc_fs.h> /* handy proc_fs print macros */
#ifndef KERNEL_VERSION
--- 53,56 ----
***************
*** 66,428 ****
#endif
[...973 lines suppressed...]
***************
*** 1416,1420 ****
fifo = &(fifo_array[fifo_id]);
/* is the fifo valid? */
! if (fifo->state == UNUSED ) {
return RTAPI_BADID;
}
--- 1057,1061 ----
fifo = &(fifo_array[fifo_id]);
/* is the fifo valid? */
! if (fifo->state == UNUSED) {
return RTAPI_BADID;
}
***************
*** 1503,1506 ****
return inb(port);
}
-
-
--- 1144,1145 ----
Index: rtai_ulapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtai_ulapi.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** rtai_ulapi.c 11 Aug 2003 04:58:39 -0000 1.6
--- rtai_ulapi.c 19 Aug 2003 17:29:50 -0000 1.7
***************
*** 88,92 ****
! int ulapi_shmem_new(int key, unsigned long int size, ulapi_shmem_handle * shmemptr)
{
ulapi_shmem_handle shmem;
--- 88,93 ----
! 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.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** rtapi.h 16 Aug 2003 22:28:57 -0000 1.24
--- rtapi.h 19 Aug 2003 17:29:50 -0000 1.25
***************
*** 224,229 ****
extern int rtapi_task_new(void (*taskcode) (int),
int arg, int prio,
! unsigned long int stacksize,
! int uses_fp);
--- 224,228 ----
extern int rtapi_task_new(void (*taskcode) (int),
int arg, int prio,
! unsigned long int stacksize, int uses_fp);
***************
*** 311,315 ****
to 'rtapi_shmem_getptr()'.
*/
! extern int rtapi_shmem_new(int key, unsigned long int size );
--- 310,314 ----
to 'rtapi_shmem_getptr()'.
*/
! extern int rtapi_shmem_new(int key, unsigned long int size);
***************
*** 456,460 ****
extern int rtapi_disable_interrupt(unsigned int irq);
-
/***********************************************************************
* I/O RELATED FUNCTIONS *
--- 455,458 ----
***************
*** 473,476 ****
--- 471,534 ----
*/
extern unsigned char rtapi_inb(unsigned int port);
+
+ /***********************************************************************
+ * PROC_FS MACROS *
+ ************************************************************************/
+ #include <linux/proc_fs.h>
+
+ /* proc print macros - Contributed by: Erwin Rol (er...@mu...)
+ and shamelessly ripped from rtai_proc_fs.h, part of the RTAI project.
+ See http://www.rtai.org for more details.
+
+ macro that holds the local variables that
+ we use in the PROC_PRINT_* macros. We have
+ this macro so we can add variables with out
+ changing the users of this macro, of course
+ only when the names don't colide! */
+
+ #define PROC_PRINT_VARS \
+ off_t pos = 0; \
+ off_t begin = 0; \
+ int len = 0 /* no ";" */
+
+ /* macro that prints in the procfs read buffer.
+ this macro expects the function arguments to be
+ named as follows.
+ static int FOO(char *page, char **start,
+ off_t off, int count, int *eof, void *data) */
+
+ #define PROC_PRINT(fmt,args...) \
+ len += sprintf(page + len , fmt, ##args); \
+ pos += len; \
+ if(pos < off) { \
+ len = 0; \
+ begin = pos; \
+ } \
+ if(pos > off + count) \
+ goto done;
+
+ /* macro to leave the read function for a other
+ place than at the end. */
+ #define PROC_PRINT_RETURN \
+ *eof = 1; \
+ goto done // no ";"
+
+ /* macro that should only used ones at the end of the
+ read function, to return from a other place in the
+ read function use the PROC_PRINT_RETURN macro. */
+ #define PROC_PRINT_DONE \
+ *eof = 1; \
+ done: \
+ *start = page + (off - begin); \
+ len -= (off - begin); \
+ if(len > count) \
+ len = count; \
+ if(len < 0) \
+ len = 0; \
+ return len // no ";"
+
+ /***********************************************************************
+ * End of rtapi.h *
+ ************************************************************************/
#endif /* RTAPI_H */
Index: rtl_rtapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtl_rtapi.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** rtl_rtapi.c 11 Aug 2003 04:58:39 -0000 1.6
--- rtl_rtapi.c 19 Aug 2003 17:29:51 -0000 1.7
***************
*** 54,114 ****
#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. */
!
! struct rtapi_task {
! int magic; /* to check for valid handle */
! pthread_t ostask; /* OS specific task data */
! int arg; /* argument for task function */
! void (*taskcode) (int); /* pointer to task function */
! };
!
! struct rtapi_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 rtapi_sem {
! int magic; /* to check for valid handle */
! sem_t ossem; /* OS specific semaphore data */
! };
!
! struct rtapi_fifo {
! int magic; /* to check for valid handle */
! int key; /* key to fifo */
! int fd; /* file descripter for fifo */
! unsigned long int size; /* size of fifo area */
! };
!
! #define TASK_MAGIC 21979 /* random numbers used as signatures */
! #define SHMEM_MAGIC 25453
! #define SEM_MAGIC 27594
! #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;
!
! int debug = 1;
! MODULE_PARM(debug, "i");
! MODULE_PARM_DESC(debug, "Sets the verbosity of the debug prints");
!
! /* maximum number of tasks */
! #define RTAPI_MAX_TASKS 64
!
! /* list of created tasks */
! static rtapi_task_handle task_array[RTAPI_MAX_TASKS];
/* Priority functions. RTL uses 1 as the highest priority, as the
--- 54,58 ----
#include "rtapi.h" /* these decls */
! #include "rtapi_common.h"
/* Priority functions. RTL uses 1 as the highest priority, as the
***************
*** 517,525 ****
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;
}
}
--- 461,469 ----
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;
}
}
|
|
From: <wsh...@us...> - 2003-08-18 23:19:55
|
Update of /cvsroot/emc/rcslib/src/os_intf
In directory sc8-pr-cvs1:/tmp/cvs-serv9848/src/os_intf
Modified Files:
Tag: wps_multiplat_dev_branch
Makefile.lib _timer.c timer.cc
Log Message:
.
Index: Makefile.lib
===================================================================
RCS file: /cvsroot/emc/rcslib/src/os_intf/Makefile.lib,v
retrieving revision 4.34.2.1
retrieving revision 4.34.2.2
diff -C2 -d -r4.34.2.1 -r4.34.2.2
*** Makefile.lib 8 Aug 2003 14:21:14 -0000 4.34.2.1
--- Makefile.lib 18 Aug 2003 23:19:52 -0000 4.34.2.2
***************
*** 99,102 ****
--- 99,104 ----
inifile.h \
dbg_mem.h \
+ timer_no_config.h \
+ _timer_no_config.h \
fileops.h
Index: _timer.c
===================================================================
RCS file: /cvsroot/emc/rcslib/src/os_intf/_timer.c,v
retrieving revision 4.42.2.1
retrieving revision 4.42.2.2
diff -C2 -d -r4.42.2.1 -r4.42.2.2
*** _timer.c 8 Aug 2003 14:21:14 -0000 4.42.2.1
--- _timer.c 18 Aug 2003 23:19:52 -0000 4.42.2.2
***************
*** 22,119 ****
#if HAVE_CONFIG_H
#include "rcs_config_include.h"
- #endif
-
- #include "rcs_defs.hh"
- #include "rcs_prnt.hh" /* rcs_print_error */
-
- #if !HAVE_CONFIG_H
-
- #ifndef NO_STDIO
- #include <stdio.h> /* NULL */
- #endif
-
- #include <errno.h> /* errno */
- #include <string.h> /* strerror() */
-
- #ifdef VXWORKS
-
- #include <vxWorks.h>
- #include <taskLib.h> /* taskDelay() */
- #include <tickLib.h> /* tickGet() */
- #include <sysLib.h> /* sysClkRateGet() */
- #include <timers.h> /* clock_gettime */
- #ifndef POWERPC
- #include "gtimer.hh" /* global_timer_available, get_Global_time() */
- #endif
-
- #endif /* VXWORKS */
-
- #ifdef LYNX
-
-
- #include <errno.h> /* EINTR */
- #include <unistd.h> /* select() */
- #include <time.h> /* CLK_TCK, since no _SC_CLK_TCK */
- #include <sys/time.h> /* struct timeval, gettimeofday(),
- struct itimerval, setitimer(),
- ITIMER_REAL */
-
-
- #endif /* LYNX */
-
- #if defined(SUN) || defined(SGI) || defined(sparcworks) || defined(darwin) || defined(qnx) || defined(linux)
- #include <errno.h> /* EINTR */
- #include <unistd.h> /* select(), sysconf(), _SC_CLK_TCK */
- #ifndef irix6
- #include <sys/time.h> /* struct timeval, gettimeofday(),
- struct itimerval, setitimer(),
- ITIMER_REAL */
- #endif
-
- #endif /* SUN */
-
- #ifdef linux
- #include <linux/version.h>
-
- #if defined(LINUX_VERSION_CODE) && defined(KERNEL_VERSION)
- #if LINUX_VERSION_CODE > KERNEL_VERSION(2,2,0)
- #define LINUX_KERNEL_2_2_OR_LATER
- #include <sched.h>
- #endif
- #endif
- #endif
-
-
-
- #ifdef irix6
- #include <time.h>
- #endif
-
- #ifdef __MSDOS__
- #ifdef _Windows
- #ifdef USE_TOOL_HELP
- /* The timerCount function is more accurate than the GetTickCount() function
- but you need toolhelp.dll which comes with Windows 3.1 but not Windows 3.0 or
- Windows NT */
- #include "toolhelp.h" /* timerCount() */
#else
! #if defined(WIN32) && !defined(USE_OLD_WINSOCK)
! /* Lame problem if windows.h is included before winsock2.h many redefined
! compiler errors result. */
! #include <winsock2.h>
! #endif
! #include <windows.h> /* GetTickCount() */
! #endif
! #endif
! #include <time.h> /* clock(), CLK_TCK */
! #ifndef _Windows
! #include <dos.h> /* delay() */
! #endif
! #endif
!
! #if defined(mingw32)
! #include <windows.h>
! #endif
!
#endif /* ! HAVE_CONFIG_H */
--- 22,27 ----
#if HAVE_CONFIG_H
#include "rcs_config_include.h"
#else
! #include "_timer_no_config.h"
#endif /* ! HAVE_CONFIG_H */
Index: timer.cc
===================================================================
RCS file: /cvsroot/emc/rcslib/src/os_intf/timer.cc,v
retrieving revision 4.36
retrieving revision 4.36.2.1
diff -C2 -d -r4.36 -r4.36.2.1
*** timer.cc 6 May 2003 15:18:21 -0000 4.36
--- timer.cc 18 Aug 2003 23:19:52 -0000 4.36.2.1
***************
*** 14,98 ****
! #include "rcs_defs.hh" // __MSDOS__
! #include "dbg_mem.h" // DEBUG_MALLOC,DEBUG_FREE
!
! #ifdef VXWORKS
!
! extern "C"
! {
! #include <vxWorks.h>
!
! #ifndef NO_STDIO
! #include <stdio.h>
! #endif
!
! #include <string.h> // strtok(), strncmp()
! #include <stdlib.h> // atof()
! #include <taskLib.h> /* taskDelay() */
! #include <tickLib.h> /* tickGet() */
! #include <sysLib.h> /* sysClkRateGet() */
! }
!
! #endif /* VXWORKS */
!
! #ifdef LYNX
!
! extern "C"
! {
! #include <string.h> // strtok(), strncmp()
! #include <stdlib.h> // atof()
!
! #ifndef NO_STDIO
! #include <stdio.h> /* NULL */
! #endif
!
! #include <stdlib.h> /* exit() */
! #include <signal.h> /* struct sigaction, sigaction(), SIGALRM,
! sigset_t */
! #include <errno.h> /* perror(), EINTR */
! #include <unistd.h> /* select() */
! #include <time.h> /* CLK_TCK, since no _SC_CLK_TCK, */
! /* setitimer() */
! #include <sys/time.h> /* struct timeval, gettimeofday(),
! struct itimerval,
! ITIMER_REAL */
!
! }
!
! #endif /* LYNX */
!
! #if defined(SUN) || defined(LINUX)
!
! extern "C"
! {
! #include <stdlib.h> // atof()
! #include <string.h> // strtok(), strncmp()
!
! #ifndef NO_STDIO
! #include <stdio.h> /* NULL */
! #endif
!
! #include <stdlib.h> /* exit() */
! #include <signal.h> /* struct sigaction, sigaction(), SIGALRM,
! sigset_t */
! #include <errno.h> /* perror(), EINTR */
! #include <unistd.h> /* select(), sysconf(), _SC_CLK_TCK */
! #include <sys/time.h> /* struct timeval, gettimeofday(),
! struct itimerval, setitimer(),
! ITIMER_REAL */
! #include <sys/types.h>
! #include <sys/wait.h> // waitpid()
! }
!
! #endif /* SUN */
!
! #ifdef __MSDOS__
! #include <stdlib.h> // atof()
! #include <string.h> // strtok(), strncmp()
! #include <time.h> /* clock(), CLK_TCK */
! #ifndef _WINDOWS
! #include <dos.h> /* delay() */
! #endif
! #endif
#include "inetfile.hh" // inet_file_open(), inet_file_gets()
--- 14,22 ----
! #if HAVE_CONFIG_H
! #include "rcs_config_include.h"
! #else
! #include "timer_no_config.h"
! #endif /* ! HAVE_CONFIG_H */
#include "inetfile.hh" // inet_file_open(), inet_file_gets()
|
|
From: <wsh...@us...> - 2003-08-18 23:19:55
|
Update of /cvsroot/emc/rcslib
In directory sc8-pr-cvs1:/tmp/cvs-serv9848
Modified Files:
Tag: wps_multiplat_dev_branch
Makefile.am Makefile.in configure configure.ac rcs_config.h.in
Log Message:
.
Index: Makefile.am
===================================================================
RCS file: /cvsroot/emc/rcslib/Makefile.am,v
retrieving revision 1.7.2.5
retrieving revision 1.7.2.6
diff -C2 -d -r1.7.2.5 -r1.7.2.6
*** Makefile.am 10 Aug 2003 12:49:47 -0000 1.7.2.5
--- Makefile.am 18 Aug 2003 23:19:51 -0000 1.7.2.6
***************
*** 654,657 ****
--- 654,659 ----
src/os_intf/fileops.h\
src/os_intf/inifile.h\
+ src/os_intf/timer_no_config.h \
+ src/os_intf/_timer_no_config.h \
src/posemath/mathprnt.h\
src/posemath/posemath.h\
Index: Makefile.in
===================================================================
RCS file: /cvsroot/emc/rcslib/Makefile.in,v
retrieving revision 1.7.2.5
retrieving revision 1.7.2.6
diff -C2 -d -r1.7.2.5 -r1.7.2.6
*** Makefile.in 10 Aug 2003 12:49:47 -0000 1.7.2.5
--- Makefile.in 18 Aug 2003 23:19:51 -0000 1.7.2.6
***************
*** 747,750 ****
--- 747,752 ----
src/os_intf/fileops.h\
src/os_intf/inifile.h\
+ src/os_intf/timer_no_config.h \
+ src/os_intf/_timer_no_config.h \
src/posemath/mathprnt.h\
src/posemath/posemath.h\
Index: configure
===================================================================
RCS file: /cvsroot/emc/rcslib/configure,v
retrieving revision 1.3.2.2
retrieving revision 1.3.2.3
diff -C2 -d -r1.3.2.2 -r1.3.2.3
*** configure 8 Aug 2003 16:38:59 -0000 1.3.2.2
--- configure 18 Aug 2003 23:19:51 -0000 1.3.2.3
***************
*** 2262,2266 ****
if test "x${enable_shmem}" = "xyes" ; then
! LTLIBOBJS="${LTLIBOBJS} shmem.lo _shm.lo shm.lo unix_sem.lo sem.lo memsem.lo autokey.lo"
{ echo "$as_me:$LINENO: LTLIBOBJS : ${LTLIBOBJS}" >&5
echo "$as_me: LTLIBOBJS : ${LTLIBOBJS}" >&6;}
--- 2262,2266 ----
if test "x${enable_shmem}" = "xyes" ; then
! LTLIBOBJS="${LTLIBOBJS} shmem.lo _shm.lo shm.lo sem.lo memsem.lo autokey.lo"
{ echo "$as_me:$LINENO: LTLIBOBJS : ${LTLIBOBJS}" >&5
[...1197 lines suppressed...]
{ (exit 1); exit 1; }; }
fi
+ if test -z "${WINDOWS_SHAREDMEM_AVAILABLE_TRUE}" && test -z "${WINDOWS_SHAREDMEM_AVAILABLE_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"WINDOWS_SHAREDMEM_AVAILABLE\" was never defined.
+ Usually this means the macro was only invoked conditionally." >&5
+ echo "$as_me: error: conditional \"WINDOWS_SHAREDMEM_AVAILABLE\" was never defined.
+ Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
if test -z "${POSIX_SHAREDMEM_AVAILABLE_TRUE}" && test -z "${POSIX_SHAREDMEM_AVAILABLE_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"POSIX_SHAREDMEM_AVAILABLE\" was never defined.
***************
*** 14885,14888 ****
--- 16004,16009 ----
s,@HAVE_RTAI_FALSE@,$HAVE_RTAI_FALSE,;t t
s,@CXXCPP@,$CXXCPP,;t t
+ s,@WINDOWS_SHAREDMEM_AVAILABLE_TRUE@,$WINDOWS_SHAREDMEM_AVAILABLE_TRUE,;t t
+ s,@WINDOWS_SHAREDMEM_AVAILABLE_FALSE@,$WINDOWS_SHAREDMEM_AVAILABLE_FALSE,;t t
s,@POSIX_SHAREDMEM_AVAILABLE_TRUE@,$POSIX_SHAREDMEM_AVAILABLE_TRUE,;t t
s,@POSIX_SHAREDMEM_AVAILABLE_FALSE@,$POSIX_SHAREDMEM_AVAILABLE_FALSE,;t t
Index: configure.ac
===================================================================
RCS file: /cvsroot/emc/rcslib/configure.ac,v
retrieving revision 1.3.2.1
retrieving revision 1.3.2.2
diff -C2 -d -r1.3.2.1 -r1.3.2.2
*** configure.ac 8 Aug 2003 14:21:06 -0000 1.3.2.1
--- configure.ac 18 Aug 2003 23:19:51 -0000 1.3.2.2
***************
*** 304,308 ****
if test "x${enable_shmem}" = "xyes" ; then
! LTLIBOBJS="${LTLIBOBJS} shmem.lo _shm.lo shm.lo unix_sem.lo sem.lo memsem.lo autokey.lo"
AC_MSG_NOTICE([LTLIBOBJS : ${LTLIBOBJS}])
CPPFLAGS="${CPPFLAGS} -DCMS_USE_SHMEM"
--- 304,308 ----
if test "x${enable_shmem}" = "xyes" ; then
! LTLIBOBJS="${LTLIBOBJS} shmem.lo _shm.lo shm.lo sem.lo memsem.lo autokey.lo"
AC_MSG_NOTICE([LTLIBOBJS : ${LTLIBOBJS}])
CPPFLAGS="${CPPFLAGS} -DCMS_USE_SHMEM"
***************
*** 499,502 ****
--- 499,506 ----
AC_PROG_LIBTOOL
+ check_for_windows_stuff=no
+
+ AC_CHECK_HEADER([windows.h],check_for_windows_stuff=yes)
+
if test "x${enable_nml_codegen}" = "xyes" ; then
AM_PROG_GCJ
***************
*** 584,587 ****
--- 588,737 ----
])
+ if test "x${check_for_windows_stuff}" = "xyes" ; then
+
+ {
+ ORIG_LDFLAGS=${LDFLAGS}
+ AC_CACHE_CHECK([for winsock2.h],
+ ac_cv_have_winsock2,
+ AC_CHECK_HEADER([winsock2.h],
+ [
+ LDFLAGS="${LDFLAGS} -lws2_32"
+ AC_TRY_LINK(
+ [
+ #include <winsock2.h>
+ #include <windows.h>
+ ],
+ [
+ short winsock_version;
+ WSADATA startup_data;
+
+ winsock_version = MAKEWORD (2, 0);
+ WSAStartup(winsock_version, &startup_data);
+ WSAGetLastError()
+ socket (AF_INET, SOCK_STREAM, 0);
+ ],
+ [
+ AC_DEFINE(HAVE_WINSOCK2,1,[Define to 1 you have a working winsock2.h system.])
+ ac_cv_have_winsock2=yes
+ ],
+ [
+ ac_cv_have_winsock2=no
+ LDFLAGS=${ORIG_LDFLAGS}
+ ]
+ )
+ ],
+ [ac_cv_have_winsock2=no]
+ )
+ )
+
+ if test "x${ac_cv_have_winsock}" = "xno" ; then
+ AC_CACHE_CHECK([for winsock.h],
+ ac_cv_have_winsock,
+ AC_CHECK_HEADER([winsock.h],
+ [
+ LDFLAGS="${LDFLAGS} -lwsock32"
+ AC_TRY_LINK(
+ [
+ #include <winsock.h>
+ #include <windows.h>
+ ],
+ [
+ short winsock_version;
+ WSADATA startup_data;
+
+ winsock_version = MAKEWORD (2, 0);
+ WSAStartup(winsock_version, &startup_data);
+ WSAGetLastError()
+ socket (AF_INET, SOCK_STREAM, 0);
+ ],
+ [
+ AC_DEFINE(HAVE_WINSOCK,1, [Define to 1 you have a working winsock.h system.])
+ ac_cv_have_winsock=yes
+ ],
+ [
+ ac_cv_have_winsock=no
+ LDFLAGS=${ORIG_LDFLAGS}
+ ]
+ )
+ ],
+ [ac_cv_have_winsock=no]
+ )
+ )
+ fi
+
+ AC_CHECK_HEADERS([winver.h toolhelp.h dos.h])
+ AC_CACHE_CHECK([for GetTickCount],
+ ac_cv_have_gettickcount,
+ AC_TRY_LINK([
+ #include <windows.h>
+ #include <winbase.h>
+ ],
+ [
+ GetTickCount();
+ ],
+ [
+ AC_DEFINE(HAVE_GETTICKCOUNT,1,[Define to 1 if you have the GetTickCount function.])
+ ac_cv_have_gettickcount=yes
+ ],
+ [ac_cv_have_gettickcount=no])
+ )
+ AC_CACHE_CHECK([for QueryPerformanceCounter],
+ ac_cv_have_queryperformancecounter,
+ AC_TRY_LINK([
+ #include <windows.h>
+ #include <winbase.h>
+ ],
+ [
+ BOOL frequency_ok = 0;
+ BOOL counter_ok = 0;
+ LARGE_INTEGER frequency;
+ LARGE_INTEGER counter;
+
+ frequency_ok = QueryPerformanceFrequency (&frequency);
+ counter_ok = QueryPerformanceCounter (&counter);
+ ],
+ [
+ AC_DEFINE(HAVE_QUERYPERFORMANCEFREQUENCY,1, [Define to 1 if you have the QueryPerformanceFrequency function.])
+ AC_DEFINE(HAVE_QUERYPERFORMANCECOUNTER,1,[Define to 1 if you have the QueryPerformanceCounter function.])
+ ac_cv_have_queryperformancecounter=yes
+ ],
+ [ac_cv_have_queryperformancecounter=no]
+ )
+ )
+ AC_CACHE_CHECK([for SleepEx],
+ ac_cv_have_sleepex,
+ AC_TRY_LINK([
+ #include <windows.h>
+ #include <winbase.h>
+ ],
+ [
+ SleepEx(1000,FALSE);
+ ],
+ [
+ AC_DEFINE(HAVE_SLEEPEX,1,[Define to 1 if you have the SleepEx function.])
+ ac_cv_have_sleepex=yes
+ ],
+ [ac_cv_have_sleepex=no]
+ )
+ )
+ AC_CACHE_CHECK([for Yield],
+ ac_cv_have_yield,
+ AC_TRY_LINK([
+ #include <windows.h>
+ #include <winbase.h>
+ ],
+ [
+ Yield();
+ ],
+ [
+ AC_DEFINE(HAVE_YIELD,1,[Define to 1 if you have the Yield function.])
+ ac_cv_have_yield=yes
+ ],
+ [ac_cv_have_yield=no]
+ )
+ )
+
+ }
+ fi
***************
*** 672,675 ****
--- 822,828 ----
fi
+ if test "x${enable_shmem}" = "xyes" ; then
+
+ windows_shared_memory_available=no
sys_v_shared_memory_available=no
***************
*** 978,982 ****
AC_DEFINE(SYS_V_SHARED_MEMORY,1,[Should we use POSIX Shared_Memory])
else
! AC_MSG_ERROR([Neither POSIX nor System V shared memory seem to be useable])
fi
fi
--- 1131,1183 ----
AC_DEFINE(SYS_V_SHARED_MEMORY,1,[Should we use POSIX Shared_Memory])
else
! AC_MSG_NOTICE([Neither POSIX nor System V shared memory seem to be useable])
! AC_MSG_NOTICE([Checking for windows shared memory.])
! windows_check_failed=false;
! if test "x${check_for_widows_stuff}" != "xyes" ;then
! windows_check_failed=true
! fi
! if test "x${windows_check_failed}" != "xtrue" ; then
! AC_CHECK_HEADER([winbase.h],,windows_check_failed=true,[#include<windows.h>])
! fi
! if test "x${windows_check_failed}" != "xtrue" ; then
! AC_TRY_LINK([
! #include <windows.h>
! #include <winbase.h>
! ],
! [
! SECURITY_ATTRIBUTES sa;
! SECURITY_DESCRIPTOR sd;
! size_t size=0x1000;
! HANDLE hFileMap;
! const char *name="config_test_shm";
! void *addr;
!
! InitializeSecurityDescriptor (&sd, SECURITY_DESCRIPTOR_REVISION);
! sa.nLength = sizeof (SECURITY_ATTRIBUTES);
! sa.lpSecurityDescriptor = &sd;
! sa.bInheritHandle = TRUE;
!
! hFileMap = CreateFileMapping ((HANDLE) (0xFFFFFFFF), &sa, PAGE_READWRITE, 0,size, name);
! addr=MapViewOfFile (hFileMap, FILE_MAP_ALL_ACCESS, 0, 0, size);
! UnmapViewOfFile(addr);
! CloseHandle(hFileMap);
! ],
! [
! AC_DEFINE(HAVE_INITIALIZESECURITYDESCRIPTOR,1,[Define to 1 if you have the InitializeSecurityDescriptor function.])
! AC_DEFINE(HAVE_CREATEFILEMAPPING,1,[Define to 1 if you have the CreateFileMapping function.])
! AC_DEFINE(HAVE_MAPVEIWOFFILE,1,[Define to 1 if you have the MapViewOfFile function.])
! AC_DEFINE(HAVE_UNMAPVEIWOFFILE,1,[Define to 1 if you have the UnmapViewOfFile function.])
! AC_DEFINE(HAVE_CLOSEHANDLE,1,[Define to 1 if you have the CloseHandle function.])
! ]
! ,[windows_check_failed=true])
! fi
! if test "x${windows_check_failed}" != "xtrue" ; then
! AC_MSG_NOTICE([Using windows shared memory.])
! windows_shared_memory_available=yes;
! CPPFLAGS="${CPPFLAGS} -DWIN32"
! AC_MSG_NOTICE([CPPFLAGS=${CPPFLAGS}])
! else
! AC_MSG_ERROR([NO Shared Memory seems go be available. Consider --disable-shmem])
! fi
fi
fi
***************
*** 984,987 ****
--- 1185,1189 ----
fi
+ AM_CONDITIONAL(WINDOWS_SHAREDMEM_AVAILABLE,[test "x${windows_shared_memory_available}" = "xyes"])
AM_CONDITIONAL(POSIX_SHAREDMEM_AVAILABLE,[test x$posix_shared_memory_available = xyes])
***************
*** 1003,1006 ****
--- 1205,1210 ----
#semget
+ windows_semaphores_available=no
+
AC_MSG_NOTICE([checking POSIX semaphores])
***************
*** 1092,1102 ****
AC_DEFINE(SYS_V_SEMAPHORES,1,[Should we use POSIX Semaphores])
else
! AC_MSG_ERROR([Neither POSIX nor System V semaphores seem to be useable])
fi
fi
-
fi
AC_CXX_NAMESPACES
--- 1296,1361 ----
AC_DEFINE(SYS_V_SEMAPHORES,1,[Should we use POSIX Semaphores])
else
! AC_MSG_NOTICE([Neither POSIX nor System V semaphores seem to be useable])
! if test "x${windows_shared_memory_available}" = "xyes" ; then
! AC_MSG_NOTICE([Checking for windows semaphores/mutexes.])
! windows_check_failed=false;
! if test "x${windows_check_failed}" != "xtrue" ; then
! AC_TRY_LINK([
! #include <windows.h>
! #include <winbase.h>
! ],
! [
! HANDLE handle;
! HANDLE handle2;
! SECURITY_ATTRIBUTES sa;
! SECURITY_DESCRIPTOR sd;
!
! InitializeSecurityDescriptor (&sd, SECURITY_DESCRIPTOR_REVISION);
! sa.nLength = sizeof (SECURITY_ATTRIBUTES);
! sa.lpSecurityDescriptor = &sd;
! sa.bInheritHandle = TRUE;
!
! handle=CreateMutex (&sa, FALSE,"config_test_mutex");
!
! WaitForSingleObject (handle,1000);
! ReleaseMutex (handle);
!
! handle2=OpenMutex (MUTEX_ALL_ACCESS, TRUE,"config_test_mutex");
!
! CloseHandle(handle);
! CloseHandle(handle2);
! ],
! [
! # AC_DEFINE(HAVE_INITIALIZESECURITYDESCRIPTOR,[Define if you have the InitializeSecurityDescriptor function.])
! AC_DEFINE(HAVE_CREATEMUTEX,1,[Define to 1 if you have the CreateMutex function.])
! AC_DEFINE(HAVE_WAITFORSINGLEOBJECT,1,[Define to 1 if you have the WaitForSingleObject function.])
! AC_DEFINE(HAVE_RELEASEMUTEX,1,[Define to 1 if you have the ReleaseMutex function.])
! AC_DEFINE(HAVE_OPENMUTEX,1,[Define to 1 if you have the OpenMutex function.])
! ],[windows_check_failed=true])
! fi
! if test "x${windows_check_failed}" != "xtrue" ; then
! AC_MSG_NOTICE([Using windows shared memory.])
! windows_semaphores_available=yes;
! else
! AC_MSG_ERROR([NO Semaphore/mutex seems go be available.Consider --disable-shmem])
! fi
! else
! AC_MSG_ERROR([NO Semaphore/mutex seems go be available. Consider --disable-shmem])
! fi
fi
fi
fi
+ fi
+ # end of if shmem enabled.
+ if test "x${enable_shmem}" = "xyes" ; then
+ if test "x${windows_semaphores_available}" = "xyes" ; then
+ LTLIBOBJS="${LTLIBOBJS} win32_sem.lo"
+ else
+ LTLIBOBJS="${LTLIBOBJS} unix_sem.lo"
+ fi
+ AC_MSG_NOTICE([LTLIBOBJS : ${LTLIBOBJS}])
+ fi
AC_CXX_NAMESPACES
Index: rcs_config.h.in
===================================================================
RCS file: /cvsroot/emc/rcslib/rcs_config.h.in,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** rcs_config.h.in 8 Aug 2003 16:38:59 -0000 1.1.2.2
--- rcs_config.h.in 18 Aug 2003 23:19:51 -0000 1.1.2.3
***************
*** 16,19 ****
--- 16,28 ----
#undef HAVE_CLOCK_GETTIME
+ /* Define to 1 if you have the CloseHandle function. */
+ #undef HAVE_CLOSEHANDLE
+
+ /* Define to 1 if you have the CreateFileMapping function. */
+ #undef HAVE_CREATEFILEMAPPING
+
+ /* Define to 1 if you have the CreateMutex function. */
+ #undef HAVE_CREATEMUTEX
+
/* Define to 1 if you have the <ctype.h> header file. */
#undef HAVE_CTYPE_H
***************
*** 25,28 ****
--- 34,40 ----
#undef HAVE_DLFCN_H
+ /* Define to 1 if you have the <dos.h> header file. */
+ #undef HAVE_DOS_H
+
/* Define to 1 if you have the <errno.h> header file. */
#undef HAVE_ERRNO_H
***************
*** 52,55 ****
--- 64,70 ----
#undef HAVE_GETPASS
+ /* Define to 1 if you have the GetTickCount function. */
+ #undef HAVE_GETTICKCOUNT
+
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
***************
*** 61,64 ****
--- 76,82 ----
#undef HAVE_INET_NTOA
+ /* Define to 1 if you have the InitializeSecurityDescriptor function. */
+ #undef HAVE_INITIALIZESECURITYDESCRIPTOR
+
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
***************
*** 76,79 ****
--- 94,100 ----
#undef HAVE_LOCALTIME_R
+ /* Define to 1 if you have the MapViewOfFile function. */
+ #undef HAVE_MAPVEIWOFFILE
+
/* Define to 1 if you have the <math.h> header file. */
#undef HAVE_MATH_H
***************
*** 109,118 ****
--- 130,151 ----
#undef HAVE_OPENDIR
+ /* Define to 1 if you have the OpenMutex function. */
+ #undef HAVE_OPENMUTEX
+
/* Define to 1 if you have the <pthread.h> header file. */
#undef HAVE_PTHREAD_H
+ /* Define to 1 if you have the QueryPerformanceCounter function. */
+ #undef HAVE_QUERYPERFORMANCECOUNTER
+
+ /* Define to 1 if you have the QueryPerformanceFrequency function. */
+ #undef HAVE_QUERYPERFORMANCEFREQUENCY
+
/* Define to 1 if you have the `readdir' function. */
#undef HAVE_READDIR
+ /* Define to 1 if you have the ReleaseMutex function. */
+ #undef HAVE_RELEASEMUTEX
+
/* Is this platfrom running a linux kernel with the rtai patch */
#undef HAVE_RTAI
***************
*** 139,142 ****
--- 172,178 ----
#undef HAVE_SLEEP
+ /* Define to 1 if you have the SleepEx function. */
+ #undef HAVE_SLEEPEX
+
/* Define to 1 if you have the `socket' function. */
#undef HAVE_SOCKET
***************
*** 264,267 ****
--- 300,306 ----
#undef HAVE_TERMIOS_H
+ /* Define to 1 if you have the <toolhelp.h> header file. */
+ #undef HAVE_TOOLHELP_H
+
/* Define to 1 if you have the `toupper' function. */
#undef HAVE_TOUPPER
***************
*** 276,281 ****
--- 315,338 ----
#undef HAVE_UNISTD_H
+ /* Define to 1 if you have the UnmapViewOfFile function. */
+ #undef HAVE_UNMAPVEIWOFFILE
+
/* Define to 1 if you have the `usleep' function. */
#undef HAVE_USLEEP
+
+ /* Define to 1 if you have the WaitForSingleObject function. */
+ #undef HAVE_WAITFORSINGLEOBJECT
+
+ /* Define to 1 you have a working winsock.h system. */
+ #undef HAVE_WINSOCK
+
+ /* Define to 1 you have a working winsock2.h system. */
+ #undef HAVE_WINSOCK2
+
+ /* Define to 1 if you have the <winver.h> header file. */
+ #undef HAVE_WINVER_H
+
+ /* Define to 1 if you have the Yield function. */
+ #undef HAVE_YIELD
/* if no thread system is available */
|
|
From: <wsh...@us...> - 2003-08-18 23:19:55
|
Update of /cvsroot/emc/rcslib/src/print
In directory sc8-pr-cvs1:/tmp/cvs-serv9848/src/print
Modified Files:
Tag: wps_multiplat_dev_branch
rcs_prnt.cc
Log Message:
.
Index: rcs_prnt.cc
===================================================================
RCS file: /cvsroot/emc/rcslib/src/print/rcs_prnt.cc,v
retrieving revision 4.43.2.1
retrieving revision 4.43.2.2
diff -C2 -d -r4.43.2.1 -r4.43.2.2
*** rcs_prnt.cc 8 Aug 2003 14:21:14 -0000 4.43.2.1
--- rcs_prnt.cc 18 Aug 2003 23:19:52 -0000 4.43.2.2
***************
*** 916,919 ****
--- 916,920 ----
break;
+ #ifdef HAVE_WSAGETLASTERROR
case WSAGETLASTERROR_ERROR_SOURCE:
{
***************
*** 936,939 ****
--- 937,941 ----
rcs_puts (message_string);
break;
+ #endif
#endif
|
|
From: <wsh...@us...> - 2003-08-18 23:19:54
|
Update of /cvsroot/emc/rcslib/src/cms
In directory sc8-pr-cvs1:/tmp/cvs-serv9848/src/cms
Modified Files:
Tag: wps_multiplat_dev_branch
sokintrf_no_config.h
Log Message:
.
Index: sokintrf_no_config.h
===================================================================
RCS file: /cvsroot/emc/rcslib/src/cms/Attic/sokintrf_no_config.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** sokintrf_no_config.h 8 Aug 2003 14:26:42 -0000 1.1.2.1
--- sokintrf_no_config.h 18 Aug 2003 23:19:52 -0000 1.1.2.2
***************
*** 69,72 ****
--- 69,74 ----
#else
#include <winsock2.h>
+ #define USE_WINSOCK 1
+
#endif
***************
*** 96,99 ****
--- 98,102 ----
#include <unistd.h> /* close() */
#endif /* gnuwin32 */
+
#endif /* _WINDOWS */
|
|
From: <jmk...@us...> - 2003-08-16 22:55:12
|
Update of /cvsroot/emc/rtapi/src/rtapi In directory sc8-pr-cvs1:/tmp/cvs-serv4529/src/rtapi Modified Files: rtapi.h Log Message: reformat rtapi.h, new definition for clock_set_period() Index: rtapi.h =================================================================== RCS file: /cvsroot/emc/rtapi/src/rtapi/rtapi.h,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** rtapi.h 16 Aug 2003 20:29:39 -0000 1.22 --- rtapi.h 16 Aug 2003 22:13:28 -0000 1.23 *************** *** 2,44 **** #define RTAPI_H ! /** RTAPI is a library providing a uniform API for several real time * ! * operating systems. As of ver 2.0, RTLinux and RTAI are supported. */ ! /** This file, 'rtapi.h', defines the API as seen by realtime tasks. * ! * The non-realtime version of the API is defined in 'ulapi.h'. The * ! * realtime interface is implemented in files named 'xxx_rtapi.c', * ! * where xxx is the RTOS. Likewise, the non-realtime interface is * ! * implemented in files named 'xxx_ulapi.c' */ ! /** Copyright (C) 2003 John Kasunich * ! * <jmkasunich AT users DOT sourceforge DOT net> * ! * Copyright (C) 2003 Paul Corner * ! * <paul_c AT users DOT sourceforge DOT net> * ! * This library is based on version 1.0, which was released into * ! * the public domain by its author, Fred Proctor. Thanks Fred! */ ! /* This library is free software; you can redistribute it and/or * ! * modify it under the terms of version 2.1 of the GNU Lesser 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 * ! * Lesser General Public License for more details. * ! * * ! * You should have received a copy of the GNU Lesser General Public * ! * License along with this library; if not, write to the Free Software * ! * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA */ ! /** THE AUTHORS OF THIS LIBRARY ACCEPT ABSOLUTELY NO LIABILITY FOR * ! * ANY HARM OR LOSS RESULTING FROM ITS USE. IT IS _EXTREMELY_ UNWISE * ! * TO RELY ON SOFTWARE ALONE FOR SAFETY. Any machinery capable of * ! * harming persons must have provisions for completely removing power * ! * from all motors, etc, before persons enter any danger area. All * ! * machinery must be designed to comply with local and national safety * ! * codes, and the authors of this software can not, and do not, take * ! * any responsibility for such compliance. */ ! /** This code was written as part of the EMC HAL project. For more * ! * information, go to www.linuxcnc.org. */ /** These status codes are returned by many RTAPI functions. */ --- 2,48 ---- #define RTAPI_H ! /** RTAPI is a library providing a uniform API for several real time ! operating systems. As of ver 2.0, RTLinux and RTAI are supported. ! */ ! /** This file, 'rtapi.h', defines the API as seen by realtime tasks. ! The non-realtime version of the API is defined in 'ulapi.h'. The ! realtime interface is implemented in files named 'xxx_rtapi.c', ! where xxx is the RTOS. Likewise, the non-realtime interface is ! implemented in files named 'xxx_ulapi.c' ! */ ! /** Copyright (C) 2003 John Kasunich ! <jmkasunich AT users DOT sourceforge DOT net> ! Copyright (C) 2003 Paul Corner ! <paul_c AT users DOT sourceforge DOT net> ! This library is based on version 1.0, which was released into ! the public domain by its author, Fred Proctor. Thanks Fred! ! */ ! /** This library is free software; you can redistribute it and/or ! modify it under the terms of version 2.1 of the GNU Lesser 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 Lesser General Public License for more details. ! You should have received a copy of the GNU Lesser General Public ! License along with this library; if not, write to the Free Software ! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA ! THE AUTHORS OF THIS LIBRARY ACCEPT ABSOLUTELY NO LIABILITY FOR ! ANY HARM OR LOSS RESULTING FROM ITS USE. IT IS _EXTREMELY_ UNWISE ! TO RELY ON SOFTWARE ALONE FOR SAFETY. Any machinery capable of ! harming persons must have provisions for completely removing power ! from all motors, etc, before persons enter any danger area. All ! machinery must be designed to comply with local and national safety ! codes, and the authors of this software can not, and do not, take ! any responsibility for such compliance. ! ! This code was written as part of the EMC HAL project. For more ! information, go to www.linuxcnc.org. ! */ /** These status codes are returned by many RTAPI functions. */ *************** *** 56,151 **** #define RTAPI_LATE -10 /* task could not start when requested */ - /* NOTE: RTAPI assumes that ints are at least 32 bits long */ - /* FIXME - need to review the API, and change everything that needs - to be 32 bits to long int. */ - /*********************************************************************** * GENERAL PURPOSE FUNCTIONS * ************************************************************************/ ! /** 'rtapi_init() sets up the RTAPI. It must be called by any module * ! * that intends to use the API, before any other RTAPI calls. Returns a * ! * status code, as defined above. Increments a usage count. */ ! extern int rtapi_init(void); ! /** 'rtapi_exit()' shuts down and cleans up the RTAPI. It must be * ! * called prior to exit by any module that called rtapi_init. Returns * ! * a status code. Decrements the usage count maintined by rtapi_init. */ ! extern int rtapi_exit(void); ! /** 'rtapi_print()' prints a printf style message. Depending on the * ! * RTOS, the message may be printed to stdout, or to the kernel message * ! * log, etc. The calling syntax and format string is similar to printf * ! * except that floating point and longlongs may not be supported. For * ! * some RTOS's, a 256 byte buffer is used, so the format line and * ! * arguments should not produce a line more than 255 bytes long. Does * ! * not block, but can take a fairly long time, depending on the format * ! * string and OS. */ ! extern void rtapi_print(const char *fmt, ...); ! /** 'rtapi_print_msg()' prints debug messages. Works like rtapi_print * ! * but only prints if 'level' is less than 'rtapi_msg_level'. * ! * 'rtapi_msg_level' is a global. The default is 7, but it may be * ! * changed. The rtapi uses the same levels for its own messages. * ! * The defines below are used for rtapi messages, and recommended for * ! * user messages as well. */ ! extern int rtapi_msg_level; - #define RTAPI_MSG_ERR 3 #define RTAPI_MSG_WARN 4 #define RTAPI_MSG_INFO 6 #define RTAPI_MSG_DBG 7 - extern void rtapi_print_msg(int level, const char *fmt, ...); /*********************************************************************** ! * CLOCK RELATED FUNCTIONS * ************************************************************************/ ! /** The clock period is the basic time interval for realtime tasks * ! * All task periods, whether specified when starting the task, or * ! * changed later, will be rounded to an integer multiple of the * ! * period set by 'rtapi_clock_set_period()'. Note that there may be * ! * only one hardware clock in the system, and this call may stop and * ! * resets it. So this function only needs to be called once, even if * ! * there are multiple realtime tasks in multiple modules. Calling this * ! * function after realtime tasks have been started may disrupt the * ! * tasks. If the call fails, it returns a negative status code. On * ! * success, it either returns 0, or (if the RTOS supports it), the * ! * actual period, which may not be exactly what was requested. The * ! * upper and lower limits for the timer period are RTOS dependent, so * ! * be sure to check for errors. */ ! extern int rtapi_clock_set_period(unsigned long int nsecs); ! /** rtapi_get_time returns the current time in nanoseconds. Depending * ! * on the RTOS, this may be time since boot, or time since the clock * ! * period was set, or some other time. Its absolute value means * ! * nothing, but it is monotonically increasing (at least for the first * ! * 200 years or so), and can be used to schedule future events, or to * ! * time the duration of some activity. Returns a 2^63 value. The * ! * resolution of the returned value may be as good as one nano-second, * ! * or as poor as several microseconds. */ extern long long int rtapi_get_time(void); - /** rtapi_sleep() is a simple delay. It is intended only for short * - * delays, since it simply loops, wasting CPU cycles. 'nsec' is the * - * desired delay, in nano-seconds. 'rtapi_sleep_max() returns the max * - * delay permitted (usually approximately 1/4 of the timer period). * - * Any call to 'rtapi_sleep()' requesting a delay longer than the max * - * will delay for the max time only. 'rtapi_sleep_max()' should be * - * called befure using 'rtapi_sleep()' to make sure the required delays * - * can be achieved. */ extern void rtapi_sleep(unsigned long int nsec); extern unsigned long int rtapi_sleep_max(void); --- 60,169 ---- #define RTAPI_LATE -10 /* task could not start when requested */ /*********************************************************************** * GENERAL PURPOSE FUNCTIONS * ************************************************************************/ ! /** 'rtapi_init() sets up the RTAPI. It must be called by any module ! that intends to use the API, before any other RTAPI calls. Returns ! a status code, as defined above. Increments a usage count. ! */ extern int rtapi_init(void); ! /** 'rtapi_exit()' shuts down and cleans up the RTAPI. It must be ! called prior to exit by any module that called rtapi_init. ! Returns a status code. Decrements the usage count maintained ! by rtapi_init. ! */ extern int rtapi_exit(void); ! /** 'rtapi_print()' prints a printf style message. Depending on the ! RTOS, the message may be printed to stdout, or to the kernel ! message log, etc. The calling syntax and format string is similar ! to printf except that floating point and longlongs may not be ! supported. For some RTOS's, a 256 byte buffer is used, so the ! format line and arguments should not produce a line more than ! 255 bytes long. Does not block, but can take a fairly long ! time, depending on the format string and OS. ! */ extern void rtapi_print(const char *fmt, ...); ! /** 'rtapi_print_msg()' prints debug messages. Works like rtapi_print ! but only prints if 'level' is less than 'rtapi_msg_level'. ! 'rtapi_msg_level' is a global. The default is 7, but it may be ! changed. The defines below are used for RTAPI messages, and are ! recommended for user messages as well. ! */ extern int rtapi_msg_level; #define RTAPI_MSG_ERR 3 #define RTAPI_MSG_WARN 4 #define RTAPI_MSG_INFO 6 #define RTAPI_MSG_DBG 7 extern void rtapi_print_msg(int level, const char *fmt, ...); /*********************************************************************** ! * TIME RELATED FUNCTIONS * ************************************************************************/ ! /* OLD VERSION */ ! /** The clock period is the basic time interval for realtime tasks ! All task periods, whether specified when starting the task, or ! changed later, will be rounded to an integer multiple of the ! period set by 'rtapi_clock_set_period()'. Note that there may be ! only one hardware clock in the system, and this call may stop and ! reset it. So this function only needs to be called once, even if ! there are multiple realtime tasks in multiple modules. Calling this ! function after realtime tasks have been started may disrupt the ! tasks. If the call fails, it returns a negative status code. On ! success, it either returns 0, or (if the RTOS supports it), the ! actual period, which may not be exactly what was requested. The ! upper and lower limits for the timer period are RTOS dependent, so ! be sure to check for errors. */ + /* NEW VERSION */ ! /** 'rtapi_clock_set_period() sets the basic time interval for realtime ! tasks. All periodic tasks will run at an integer multiple of this ! period. The first call to 'rtapi_clock_set_period() with 'nsecs' ! greater than zero will start the clock, using 'nsecs' as the clock ! period in nano-seconds. Due to hardware and RTOS limitations, the ! actual period may not be exactly what was requested. On success, ! the function will return the actual clock period if it is available, ! otherwise it returns the requested period. If the requested period ! is outside the limits imposed by the hardware or RTOS, it returns ! RTAPI_INVAL and does not start the clock. Once the clock is started, ! subsequent calls with non-zero 'nsecs' return RTAPI_INVAL and have ! no effect. Calling 'rtapi_clock_set_period() with 'nsecs' set to ! zero queries the clock, returning the current clock period, or zero ! if the clock has not yet been started. ! */ ! extern long int rtapi_clock_set_period(long int nsecs); + + /** rtapi_get_time returns the current time in nanoseconds. Depending + on the RTOS, this may be time since boot, or time since the clock + period was set, or some other time. Its absolute value means + nothing, but it is monotonically increasing and can be used to + schedule future events, or to time the duration of some activity. + Returns a 2^63 value. The resolution of the returned value may + be as good as one nano-second, or as poor as several microseconds. + */ extern long long int rtapi_get_time(void); + /** rtapi_sleep() is a simple delay. It is intended only for short + delays, since it simply loops, wasting CPU cycles. 'nsec' is the + desired delay, in nano-seconds. 'rtapi_sleep_max() returns the + max delay permitted (usually approximately 1/4 of the clock period). + Any call to 'rtapi_sleep()' requesting a delay longer than the max + will delay for the max time only. 'rtapi_sleep_max()' should be + called befure using 'rtapi_sleep()' to make sure the required delays + can be achieved. The actual resolution of the delay may be as good + 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); *************** *** 156,178 **** ************************************************************************/ ! /* 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 * ! * 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); --- 174,197 ---- ************************************************************************/ ! /** 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 ! 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); *************** *** 181,207 **** ! /** '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 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. * ! * '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, --- 200,225 ---- ! /** 'rtapi_task_new()' creates but does not start a realtime task. ! The task is created in the "paused" state. To start it, call ! 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. '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 used ! 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, *************** *** 210,241 **** ! /** '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, --- 228,258 ---- ! /** 'rtapi_task_delete()' 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, *************** *** 243,308 **** ! /** '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); - /*********************************************************************** * SHARED MEMORY RELATED FUNCTIONS * ************************************************************************/ ! /** '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); --- 260,325 ---- ! /** '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 at the beginning of the ! next period. Call only from within a task. ! */ ! extern void 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. ! 2) It calls a blocking function, like rtapi_sem_take(). It will ! resume when the function unblocks. ! 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); /*********************************************************************** * SHARED MEMORY RELATED FUNCTIONS * ************************************************************************/ ! /** '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,353 **** ************************************************************************/ ! /** '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); ! /** 'rtapi_sem_give()' unlocks a semaphore. If a higher priority task * ! * is blocked on the semaphore, the calling task will block and the * ! * higher priority task will begin to run. Returns a status code. */ ! extern int rtapi_sem_give(int sem_id); ! /** 'rtapi_sem_take()' locks a semaphore. Returns RTAPI_SUCCESS or * ! * RTAPI_BADH. If the semaphore is unlocked it returns RTAPI_SUCCESS * ! * immediately. If the semaphore is locked, the calling task blocks * ! * until the semaphore is unlocked, then it returns RTAPI_SUCCESS. */ ! extern int rtapi_sem_take(int sem_id); ! /** 'rtapi_sem_try()' does a non-blocking attempt to lock a semaphore. * ! * Returns RTAPI_SUCCESS, RTAPI_BADH, or RTAPI_BUSY. If the semaphore * ! * is unlocked, it returns RTAPI_SUCCESS. If the semaphore is locked * ! * it does not block, instead it returns RTAPI_BUSY, and the caller can * ! * decide how to deal with the situation. */ ! extern int rtapi_sem_try(int sem_id); --- 329,370 ---- ************************************************************************/ ! /** '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); ! /** 'rtapi_sem_give()' unlocks a semaphore. If a higher priority task ! is blocked on the semaphore, the calling task will block and the ! higher priority task will begin to run. Returns a status code. ! */ extern int rtapi_sem_give(int sem_id); ! /** 'rtapi_sem_take()' locks a semaphore. Returns RTAPI_SUCCESS or ! RTAPI_BADH. If the semaphore is unlocked it returns RTAPI_SUCCESS ! immediately. If the semaphore is locked, the calling task blocks ! until the semaphore is unlocked, then it returns RTAPI_SUCCESS. ! */ extern int rtapi_sem_take(int sem_id); ! /** 'rtapi_sem_try()' does a non-blocking attempt to lock a semaphore. ! Returns RTAPI_SUCCESS, RTAPI_BADH, or RTAPI_BUSY. If the semaphore ! is unlocked, it returns RTAPI_SUCCESS. If the semaphore is locked ! it does not block, instead it returns RTAPI_BUSY, and the caller ! can decide how to deal with the situation. ! */ extern int rtapi_sem_try(int sem_id); *************** *** 357,407 **** ************************************************************************/ ! /** 'rtapi_fifo_new()' creates a realtime fifo. 'key' identifies the * ! * fifo, all modules wishing to access the same fifo must use the same * ! * key. 'size' is the depth of the fifo. 'mode' is either 'R' or 'W', * ! * to request either read or write access to the fifo. On success, it * ! * returns a positive integer ID, which is used for subsequent calls * ! * dealing with the fifo. On failure, returns a negative error code. */ ! ! /* NOTE - RTAI fifos require (stacksize >= fifosze + 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, char mode); ! /** 'rtapi_fifo_delete()' is the counterpart to 'rtapi_fifo_new()'. * ! * It closes the fifo associated with 'fifo_ID'. 'mode' is the mode * ! * that was specified when the fifo was created. Returns status code. */ ! extern int rtapi_fifo_delete(int fifo_id, char mode); ! /** 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. */ ! ! /* 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_id'. 'buf' is a buffer * ! * for the data, and 'size' is the maximum number of bytes to read. * ! * Returns the number of bytes actually read, or RTAPI_BADH. Does not * ! * block. If 'size' bytes are not available, it will read whatever is * ! * available, and return that count (which could be zero). */ extern int rtapi_fifo_read(int fifo_id, char *buf, unsigned long int size); ! /** 'rtapi_fifo_write()' writes data to 'fifo_id'. Up to 'size' bytes * ! * are taken from the buffer at 'buf'. Returns the number of bytes * ! * actually written, or RTAPI_BADH. Does not block. If 'size' bytes * ! * of space are not available in the fifo, it will write as many bytes * ! * as it can and return that count (which may be zero). */ ! extern int rtapi_fifo_write(int fifo_id, char *buf, unsigned long int size); --- 374,426 ---- ************************************************************************/ ! /** 'rtapi_fifo_new()' creates a realtime fifo. 'key' identifies the ! fifo, all modules wishing to access the same fifo must use the same ! key. 'size' is the depth of the fifo. 'mode' is either 'R' or 'W', ! to request either read or write access to the fifo. On success, it ! returns a positive integer ID, which is used for subsequent calls ! dealing with the fifo. On failure, returns a negative error code. ! */ + /* NOTE - RTAI fifos require (stacksize >= fifosze + 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, char mode); ! /** 'rtapi_fifo_delete()' is the counterpart to 'rtapi_fifo_new()'. ! It closes the fifo associated with 'fifo_ID'. 'mode' is the mode ! that was specified when the fifo was created. Returns status code. ! */ extern int rtapi_fifo_delete(int fifo_id, char mode); ! /** 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. ! 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_id'. 'buf' is a buffer + for the data, and 'size' is the maximum number of bytes to read. + Returns the number of bytes actually read, or RTAPI_BADH. Does not + block. If 'size' bytes are not available, it will read whatever is + available, and return that count (which could be zero). + */ extern int rtapi_fifo_read(int fifo_id, char *buf, unsigned long int size); ! /** 'rtapi_fifo_write()' writes data to 'fifo_id'. Up to 'size' bytes ! are taken from the buffer at 'buf'. Returns the number of bytes ! actually written, or RTAPI_BADH. Does not block. If 'size' bytes ! of space are not available in the fifo, it will write as many bytes ! as it can and return that count (which may be zero). ! */ extern int rtapi_fifo_write(int fifo_id, char *buf, unsigned long int size); *************** *** 411,437 **** ************************************************************************/ ! /** 'rtapi_assign_interrupt_handler()' is used to set up a handler for * ! * a hardware interrupt. 'irq' is the interrupt number, and 'handler' * ! * is a pointer to a function taking no arguements and returning void. * ! * 'handler will be called when the interrupt occurs. Returns a status * ! * code. Note: The simulated RTOS does not support interrupts. */ ! extern int rtapi_assign_interrupt_handler(unsigned int irq, void (*handler) (void)); ! /** 'rtapi_free_interrupt_handler()' removes an interrupt handler that * ! * was previously installed by rtapi_assign_interrupt_handler(). 'irq' * ! * is the interrupt number. Removing a realtime module without freeing * ! * any handlers it has installed will almost certainly crash the box. * ! * Returns RTAPI_SUCCESS or RTAPI_INVAL. */ ! extern int rtapi_free_interrupt_handler(unsigned int irq); ! /** 'rtapi_enable_interrupt()' and 'rtapi_disable_interrupt()' are * ! * are used to enable and disable interrupts, presumably ones that have * ! * handlers assigned to them. Returns a status code. */ ! extern int rtapi_enable_interrupt(unsigned int irq); extern int rtapi_disable_interrupt(unsigned int irq); --- 430,456 ---- ************************************************************************/ ! /** 'rtapi_assign_interrupt_handler()' is used to set up a handler for ! a hardware interrupt. 'irq' is the interrupt number, and 'handler' ! is a pointer to a function taking no arguements and returning void. ! 'handler will be called when the interrupt occurs. Returns a status ! code. Note: The simulated RTOS does not support interrupts. ! */ extern int rtapi_assign_interrupt_handler(unsigned int irq, void (*handler) (void)); ! /** 'rtapi_free_interrupt_handler()' removes an interrupt handler that ! was previously installed by rtapi_assign_interrupt_handler(). 'irq' ! is the interrupt number. Removing a realtime module without freeing ! any handlers it has installed will almost certainly crash the box. ! Returns RTAPI_SUCCESS or RTAPI_INVAL. ! */ extern int rtapi_free_interrupt_handler(unsigned int irq); ! /** 'rtapi_enable_interrupt()' and 'rtapi_disable_interrupt()' are ! are used to enable and disable interrupts, presumably ones that ! have handlers assigned to them. Returns a status code. ! */ extern int rtapi_enable_interrupt(unsigned int irq); extern int rtapi_disable_interrupt(unsigned int irq); *************** *** 442,456 **** ************************************************************************/ ! /** '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); ! /** '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); --- 461,475 ---- ************************************************************************/ ! /** '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); ! /** '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); |
|
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);
|
|
From: <jmk...@us...> - 2003-08-16 20:48:56
|
Update of /cvsroot/emc/rtapi/src/rtapi
In directory sc8-pr-cvs1:/tmp/cvs-serv22692/src/rtapi
Modified Files:
rtai_rtapi.c rtapi.h rtapi_app.h
Log Message:
added sleep() functions
Index: rtai_rtapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtai_rtapi.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** rtai_rtapi.c 16 Aug 2003 20:08:33 -0000 1.26
--- rtai_rtapi.c 16 Aug 2003 20:29:39 -0000 1.27
***************
*** 127,141 ****
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;
! static long int timer_period = 0;
/* global used for message printing */
int rtapi_msg_level;
- char *rev_str; /* version of RTAPI */
-
static int msg = 7; /* short name, for use in insmod command */
MODULE_PARM(msg, "i");
! MODULE_PARM_DESC(msg, "Verbosity, higher value = more messages (default=7)");
! MODULE_DESCRIPTION("Portable realtime API for RTAI");
MODULE_AUTHOR("John Kasunich, Fred Proctor, & Paul Corner");
--- 127,148 ----
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;
! static unsigned long timer_period = 0;
! #define DEFAULT_MAX_SLEEP 10000
! static unsigned long max_sleep = DEFAULT_MAX_SLEEP;
!
! /* misc vars */
! static char *rev_str; /* version of RTAPI */
!
/* global used for message printing */
int rtapi_msg_level;
static int msg = 7; /* short name, for use in insmod command */
MODULE_PARM(msg, "i");
! MODULE_PARM_DESC(msg, "debug message level (default=7)");
!
! /* other module information */
! MODULE_DESCRIPTION("Portable Real Time API for RTAI");
MODULE_AUTHOR("John Kasunich, Fred Proctor, & Paul Corner");
***************
*** 451,454 ****
--- 458,462 ----
rt_free_timer();
timer_period = 0;
+ max_sleep = DEFAULT_MAX_SLEEP;
timer_running = 0;
}
***************
*** 511,514 ****
--- 519,524 ----
int_usage_count = 0;
timer_running = 0;
+ max_sleep = DEFAULT_MAX_SLEEP;
+ timer_period = 0;
rt_linux_use_fpu(1);
/* done */
***************
*** 585,588 ****
--- 595,599 ----
rt_free_timer();
timer_period = 0;
+ max_sleep = DEFAULT_MAX_SLEEP;
timer_running = 0;
}
***************
*** 647,651 ****
"RTAPI: clock_set_period requested: %d actual: %d\n",
nsecs, timer_period);
!
return timer_period;
}
--- 658,662 ----
"RTAPI: clock_set_period requested: %d actual: %d\n",
nsecs, timer_period);
! max_sleep = timer_period / 4;
return timer_period;
}
***************
*** 656,659 ****
--- 667,686 ----
return rt_get_time_ns();
}
+
+
+ void rtapi_sleep(unsigned long int nsec)
+ {
+ if ( nsec > max_sleep ) {
+ nsec = max_sleep;
+ }
+ rt_busy_sleep(nsec);
+ }
+
+
+ unsigned long int rtapi_sleep_max(void)
+ {
+ return max_sleep;
+ }
+
/***********************************************************************
Index: rtapi.h
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtapi.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** rtapi.h 15 Aug 2003 20:45:13 -0000 1.21
--- rtapi.h 16 Aug 2003 20:29:39 -0000 1.22
***************
*** 133,139 ****
* nothing, but it is monotonically increasing (at least for the first *
* 200 years or so), and can be used to schedule future events, or to *
! * time the duration of some activity. Returns a 2^63 value. */
extern long long int rtapi_get_time(void);
--- 133,153 ----
* nothing, but it is monotonically increasing (at least for the first *
* 200 years or so), and can be used to schedule future events, or to *
! * time the duration of some activity. Returns a 2^63 value. The *
! * resolution of the returned value may be as good as one nano-second, *
! * or as poor as several microseconds. */
extern long long int rtapi_get_time(void);
+
+ /** rtapi_sleep() is a simple delay. It is intended only for short *
+ * delays, since it simply loops, wasting CPU cycles. 'nsec' is the *
+ * desired delay, in nano-seconds. 'rtapi_sleep_max() returns the max *
+ * delay permitted (usually approximately 1/4 of the timer period). *
+ * Any call to 'rtapi_sleep()' requesting a delay longer than the max *
+ * will delay for the max time only. 'rtapi_sleep_max()' should be *
+ * called befure using 'rtapi_sleep()' to make sure the required delays *
+ * can be achieved. */
+
+ extern void rtapi_sleep(unsigned long int nsec);
+ extern unsigned long int rtapi_sleep_max(void);
Index: rtapi_app.h
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtapi_app.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** rtapi_app.h 16 Aug 2003 20:08:33 -0000 1.3
--- rtapi_app.h 16 Aug 2003 20:29:39 -0000 1.4
***************
*** 14,19 ****
#define rtapi_app_exit(a) cleanup_module(a)
- extern int rtapi_app_init(void);
- extern void rtapi_app_return(void);
-
#endif /* RTAPI_APP_H */
--- 14,16 ----
|
|
From: <jmk...@us...> - 2003-08-16 20:34:31
|
Update of /cvsroot/emc/rtapi/examples/watchdog In directory sc8-pr-cvs1:/tmp/cvs-serv22692/examples/watchdog Modified Files: watchdog.c Log Message: added sleep() functions Index: watchdog.c =================================================================== RCS file: /cvsroot/emc/rtapi/examples/watchdog/watchdog.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** watchdog.c 15 Aug 2003 20:45:13 -0000 1.1 --- watchdog.c 16 Aug 2003 20:29:39 -0000 1.2 *************** *** 47,51 **** * 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 * --- 47,51 ---- * modify it under the terms of version 2 of the GNU General Public * * License as published by the Free Software Foundation. * ! * This program 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 * |
|
From: <pa...@us...> - 2003-08-16 20:10:50
|
Update of /cvsroot/emc/rtapi/src/rtapi
In directory sc8-pr-cvs1:/tmp/cvs-serv20328
Modified Files:
rtai_rtapi.c rtapi_app.h
Log Message:
Changed vsprintf to use the kernel implimentation, vsnprintf
Index: rtai_rtapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtai_rtapi.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** rtai_rtapi.c 16 Aug 2003 19:38:25 -0000 1.25
--- rtai_rtapi.c 16 Aug 2003 20:08:33 -0000 1.26
***************
*** 70,77 ****
#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 */
--- 70,73 ----
***************
*** 602,609 ****
/* using a static buffer means that these functions are not
re-entrant, would be better to allocate buffer on the stack */
- /* the call to vsprintf() will put arbitrarily many characters into
- 'buffer', and we can't easily check how many beforehand. This may
- cause a buffer overflow. The correct way to do this is as in
- Exercise 7-3 in K&R's _C Language, 2nd Ed_ book */
#define BUFFERLEN 256
--- 598,601 ----
***************
*** 615,619 ****
va_start(args, fmt);
! vsprintf(buffer, fmt, args);
rt_printk(buffer);
va_end(args);
--- 607,611 ----
va_start(args, fmt);
! vsnprintf(buffer, BUFFERLEN, fmt, args);
rt_printk(buffer);
va_end(args);
Index: rtapi_app.h
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtapi_app.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** rtapi_app.h 16 Aug 2003 19:38:25 -0000 1.2
--- rtapi_app.h 16 Aug 2003 20:08:33 -0000 1.3
***************
*** 17,23 ****
extern void rtapi_app_return(void);
- #ifndef MODULE_LICENSE
- MODULE_LICENSE("GPL");
- #endif
-
#endif /* RTAPI_APP_H */
--- 17,19 ----
|
|
From: <pa...@us...> - 2003-08-16 20:05:58
|
Update of /cvsroot/emc/rtapi/src/rtapi
In directory sc8-pr-cvs1:/tmp/cvs-serv15914
Modified Files:
rtai_rtapi.c rtapi_app.h
Log Message:
Module description and authors added
Index: rtai_rtapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtai_rtapi.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** rtai_rtapi.c 15 Aug 2003 20:45:13 -0000 1.24
--- rtai_rtapi.c 16 Aug 2003 19:38:25 -0000 1.25
***************
*** 141,145 ****
MODULE_PARM(msg, "i");
MODULE_PARM_DESC(msg, "Verbosity, higher value = more messages (default=7)");
!
/* Internal function for the proc_fs system. */
--- 141,146 ----
MODULE_PARM(msg, "i");
MODULE_PARM_DESC(msg, "Verbosity, higher value = more messages (default=7)");
! MODULE_DESCRIPTION("Portable realtime API for RTAI");
! MODULE_AUTHOR("John Kasunich, Fred Proctor, & Paul Corner");
/* Internal function for the proc_fs system. */
Index: rtapi_app.h
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtapi_app.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** rtapi_app.h 8 Jul 2003 15:54:39 -0000 1.1.1.1
--- rtapi_app.h 16 Aug 2003 19:38:25 -0000 1.2
***************
*** 17,19 ****
--- 17,23 ----
extern void rtapi_app_return(void);
+ #ifndef MODULE_LICENSE
+ MODULE_LICENSE("GPL");
+ #endif
+
#endif /* RTAPI_APP_H */
|
|
From: <jmk...@us...> - 2003-08-16 01:05:26
|
Update of /cvsroot/emc/rtapi/examples/watchdog In directory sc8-pr-cvs1:/tmp/cvs-serv17788/watchdog Log Message: Directory /cvsroot/emc/rtapi/examples/watchdog added to the repository |
|
From: <jmk...@us...> - 2003-08-15 20:51:10
|
Update of /cvsroot/emc/rtapi/examples/timertask
In directory sc8-pr-cvs1:/tmp/cvs-serv2354/examples/timertask
Modified Files:
timertask.c
Log Message:
Finished converting rtai_rtapi.c, added watchdog example.
Index: timertask.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/timertask/timertask.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** timertask.c 14 Aug 2003 04:08:26 -0000 1.11
--- timertask.c 15 Aug 2003 20:45:13 -0000 1.12
***************
*** 49,54 ****
}
! /* set the task priority to lowest, since we only have one task */
! timer_prio = rtapi_prio_lowest();
/* create the timer task */
--- 49,54 ----
}
! /* set the task priority to second lowest, since we only have one task */
! timer_prio = rtapi_prio_next_higher(rtapi_prio_lowest());
/* create the timer task */
***************
*** 85,89 ****
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("timertask exit: rtapi_task_pause returned %d\n", retval );
- return;
}
/* Remove the task from the list */
--- 85,88 ----
***************
*** 93,97 ****
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("timertask exit: rtapi_task_delete returned %d\n", retval );
- return;
}
--- 92,95 ----
|
|
From: <jmk...@us...> - 2003-08-15 20:50:23
|
Update of /cvsroot/emc/rtapi
In directory sc8-pr-cvs1:/tmp/cvs-serv2354
Modified Files:
Makefile
Log Message:
Finished converting rtai_rtapi.c, added watchdog example.
Index: Makefile
===================================================================
RCS file: /cvsroot/emc/rtapi/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** Makefile 8 Jul 2003 15:54:38 -0000 1.1.1.1
--- Makefile 15 Aug 2003 20:45:13 -0000 1.2
***************
*** 8,11 ****
--- 8,12 ----
(cd examples/semaphore; make -k $@)
(cd examples/fifo; make -k $@)
+ (cd examples/watchdog; make -k $@)
clean :
***************
*** 16,19 ****
--- 17,21 ----
(cd examples/shmem; make -k $@)
(cd examples/fifo; make -k $@)
+ (cd examples/watchdog; make -k $@)
- \find . -name "*~" -exec \rm -f {} \;
- \find . -name "*.bak" -exec \rm -f {} \;
|
|
From: <jmk...@us...> - 2003-08-15 20:47:53
|
Update of /cvsroot/emc/rtapi/src/rtapi
In directory sc8-pr-cvs1:/tmp/cvs-serv2354/src/rtapi
Modified Files:
rtai_rtapi.c rtapi.h
Log Message:
Finished converting rtai_rtapi.c, added watchdog example.
Index: rtai_rtapi.c
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtai_rtapi.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** rtai_rtapi.c 14 Aug 2003 04:08:26 -0000 1.23
--- rtai_rtapi.c 15 Aug 2003 20:45:13 -0000 1.24
***************
*** 78,85 ****
/* These structs hold data associated with objects like tasks, etc. */
! 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 */
--- 78,85 ----
/* These structs hold data associated with objects like tasks, etc. */
! typedef enum { EMPTY = 0, PAUSED, PERIODIC, FREERUN, ENDED } task_state_t;
typedef struct {
! task_state_t state; /* task state */
void *taskcode; /* task code */
RT_TASK *ostask; /* pointer to OS specific task data */
***************
*** 99,110 ****
} sem_data;
! struct rtapi_fifo {
! int magic; /* to check for valid handle */
int key; /* key to fifo */
- int fd; /* file descripter for fifo */
unsigned long int size; /* size of fifo area */
! };
!
! #define FIFO_MAGIC 10293
/* maximum number of various resources */
--- 99,113 ----
} sem_data;
! typedef enum { UNUSED = 0,
! HAS_READER = 1,
! HAS_WRITER = 2,
! HAS_BOTH = 3 } fifo_state_t; /* used as bitmasks */
!
! typedef struct {
! fifo_state_t state; /* task state */
int key; /* key to fifo */
unsigned long int size; /* size of fifo area */
! int fd; /* file descripter for fifo */
! } fifo_data;
/* maximum number of various resources */
***************
*** 119,123 ****
static shmem_data shmem_array[RTAPI_MAX_SHMEMS+1];
static sem_data sem_array[RTAPI_MAX_SEMS+1];
! static rtapi_fifo_handle fifo_array[RTAPI_MAX_FIFOS+1];
/* Usage counters to keep track of new/delete calls */
--- 122,126 ----
static shmem_data shmem_array[RTAPI_MAX_SHMEMS+1];
static sem_data sem_array[RTAPI_MAX_SEMS+1];
! static fifo_data fifo_array[RTAPI_MAX_FIFOS+1];
/* Usage counters to keep track of new/delete calls */
***************
*** 133,136 ****
--- 136,140 ----
/* global used for message printing */
int rtapi_msg_level;
+ char *rev_str; /* version of RTAPI */
static int msg = 7; /* short name, for use in insmod command */
***************
*** 151,154 ****
--- 155,159 ----
static struct proc_dir_entry *shmem_file = 0; /* /proc/rtapi/shmem */
static struct proc_dir_entry *sems_file = 0; /* /proc/rtapi/sems */
+ static struct proc_dir_entry *fifos_file = 0; /* /proc/rtapi/fifos */
static struct proc_dir_entry *debug_file = 0; /* /proc/rtapi/debug */
***************
*** 157,175 ****
{
PROC_PRINT_VARS;
! PROC_PRINT("******* RTAI rtapi usage *******\n");
! 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);
if (timer_running) {
! PROC_PRINT(" Timer status = Running\n");
} else {
! PROC_PRINT(" Timer status = Stopped\n");
}
! PROC_PRINT(" Message level = %i\n", rtapi_msg_level);
PROC_PRINT("\n");
PROC_PRINT_DONE;
--- 162,181 ----
{
PROC_PRINT_VARS;
! PROC_PRINT("******* RTAPI STATUS ********\n");
! PROC_PRINT(" Platform = RTAI\n");
! PROC_PRINT(" Version = %s\n", rev_str);
! PROC_PRINT(" Modules = %i\n", rtapi_usage_count);
! PROC_PRINT(" Tasks = %i/%i\n", task_usage_count, RTAPI_MAX_TASKS);
! PROC_PRINT("Shared memory = %i/%i\n", shmem_usage_count, RTAPI_MAX_SHMEMS);
! PROC_PRINT(" FIFOs = %i/%i\n", fifo_usage_count, RTAPI_MAX_FIFOS);
! PROC_PRINT(" Semaphores = %i/%i\n", sem_usage_count, RTAPI_MAX_SEMS);
! PROC_PRINT(" Interrupts = %i\n", int_usage_count);
if (timer_running) {
! PROC_PRINT(" Timer status = Running\n");
! PROC_PRINT(" Timer period = %li nSec\n", timer_period);
} else {
! PROC_PRINT(" Timer status = Stopped\n");
}
! PROC_PRINT("Message level = %i\n", rtapi_msg_level);
PROC_PRINT("\n");
PROC_PRINT_DONE;
***************
*** 184,188 ****
PROC_PRINT_VARS;
! PROC_PRINT("******* RTAPI TASKS *******\n");
PROC_PRINT("ID State Code\n");
for ( n = 1 ; n <= RTAPI_MAX_TASKS ; n++ ) {
--- 190,194 ----
PROC_PRINT_VARS;
! PROC_PRINT("******** RTAPI TASKS ********\n");
PROC_PRINT("ID State Code\n");
for ( n = 1 ; n <= RTAPI_MAX_TASKS ; n++ ) {
***************
*** 239,243 ****
PROC_PRINT_VARS;
! PROC_PRINT("***** RTAPI SEMAPHORES *****\n");
PROC_PRINT("ID Users Key\n");
for ( n = 1 ; n <= RTAPI_MAX_SEMS ; n++ ) {
--- 245,249 ----
PROC_PRINT_VARS;
! PROC_PRINT("***** RTAPI SEMAPHORES ******\n");
PROC_PRINT("ID Users Key\n");
for ( n = 1 ; n <= RTAPI_MAX_SEMS ; n++ ) {
***************
*** 252,260 ****
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\n", rtapi_msg_level);
PROC_PRINT_DONE;
}
--- 258,310 ----
+ static int proc_read_fifos(char *page, char **start, off_t off,
+ int count, int *eof, void *data)
+ {
+ int n;
+ char *state_str;
+
+ PROC_PRINT_VARS;
+ PROC_PRINT("******** RTAPI FIFOS ********\n");
+ PROC_PRINT("ID State Key Size\n");
+ for ( n = 1 ; n <= RTAPI_MAX_FIFOS ; n++ ) {
+ if ( fifo_array[n].state != UNUSED ) {
+ switch ( fifo_array[n].state ) {
+ case HAS_READER:
+ state_str = "R-";
+ break;
+ case HAS_WRITER:
+ state_str = "-W";
+ break;
+ case HAS_BOTH:
+ state_str = "RW";
+ break;
+ default:
+ state_str = "UNKNOWN ";
+ break;
+ }
+ PROC_PRINT("%02d %s %-10d %-10ld\n",
+ n, state_str, fifo_array[n].key, fifo_array[n].size);
+ }
+ }
+ 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 MESSAGES ******\n");
! PROC_PRINT(" Message Level = %i\n", rtapi_msg_level);
! PROC_PRINT(" ERROR messages = %s\n",
! rtapi_msg_level > RTAPI_MSG_ERR ? "ON" : "OFF" );
! PROC_PRINT("WARNING messages = %s\n",
! rtapi_msg_level > RTAPI_MSG_WARN ? "ON" : "OFF" );
! PROC_PRINT(" INFO messages = %s\n",
! rtapi_msg_level > RTAPI_MSG_INFO ? "ON" : "OFF" );
! PROC_PRINT(" DEBUG messages = %s\n",
! rtapi_msg_level > RTAPI_MSG_DBG ? "ON" : "OFF" );
! PROC_PRINT("\n");
PROC_PRINT_DONE;
}
***************
*** 318,321 ****
--- 368,378 ----
}
sems_file->owner = THIS_MODULE;
+ /* create read only file "/proc/rtapi/fifos" using convenience function */
+ fifos_file = create_proc_read_entry("fifos", 0444, rtapi_dir,
+ proc_read_fifos, NULL);
+ if ( fifos_file == NULL) {
+ return -1;
+ }
+ fifos_file->owner = THIS_MODULE;
/* create read/write file "/proc/rtapi/debug" using regular function */
debug_file = create_proc_entry("debug", 0644, rtapi_dir );
***************
*** 334,348 ****
/* 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 (sems_file != NULL) {
! remove_proc_entry("sems", rtapi_dir);
! sems_file = NULL;
}
if (shmem_file != NULL) {
--- 391,401 ----
/* remove /proc entries, only if they exist */
if (rtapi_dir != 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;
}
if (shmem_file != NULL) {
***************
*** 350,356 ****
shmem_file = NULL;
}
! if (tasks_file != NULL) {
! remove_proc_entry("tasks", rtapi_dir);
! tasks_file = NULL;
}
remove_proc_entry("rtapi", NULL);
--- 403,417 ----
shmem_file = NULL;
}
! if (sems_file != NULL) {
! remove_proc_entry("sems", rtapi_dir);
! sems_file = NULL;
! }
! if (fifos_file != NULL) {
! remove_proc_entry("fifos", rtapi_dir);
! fifos_file = NULL;
! }
! if (debug_file != NULL) {
! remove_proc_entry("debug", rtapi_dir);
! debug_file = NULL;
}
remove_proc_entry("rtapi", NULL);
***************
*** 380,384 ****
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;
--- 441,445 ----
rtapi_usage_count++;
/* MOD_INC_USE_COUNT;*/
! rtapi_print_msg(RTAPI_MSG_DBG, "RTAPI: init called, module count = %d\n",
rtapi_usage_count);
return RTAPI_SUCCESS;
***************
*** 397,401 ****
}
/* MOD_DEC_USE_COUNT;*/
! rtapi_print_msg(RTAPI_MSG_INFO, "RTAPI: exit called, module count = %d\n",
rtapi_usage_count);
return RTAPI_SUCCESS;
--- 458,462 ----
}
/* MOD_DEC_USE_COUNT;*/
! rtapi_print_msg(RTAPI_MSG_DBG, "RTAPI: exit called, module count = %d\n",
rtapi_usage_count);
return RTAPI_SUCCESS;
***************
*** 411,417 ****
--- 472,485 ----
/* get the message level from insmod command line */
rtapi_msg_level = msg;
+ /* CVS automatically updates this string */
+ rev_str = "$Revision$";
+ /* extract the revision number from it */
+ rev_str += 11;
+ rev_str[5] = '\0';
/* say hello */
+ rtapi_print_msg(RTAPI_MSG_INFO, "RTAPI: Version %s\n", rev_str);
rtapi_print_msg(RTAPI_MSG_INFO, "RTAPI: Initing\n");
#ifdef CONFIG_PROC_FS
+ /* set up /proc/rtapi */
if ( proc_init() != 0 ) {
rtapi_print_msg(RTAPI_MSG_WARN, "Could not activate /proc entries\n");
***************
*** 436,440 ****
}
for (n = 0; n <= RTAPI_MAX_FIFOS; n++) {
! fifo_array[n] = NULL;
}
/* zero all the counters */
--- 504,509 ----
}
for (n = 0; n <= RTAPI_MAX_FIFOS; n++) {
! fifo_array[n].state = UNUSED;
! fifo_array[n].size = 0;
}
/* zero all the counters */
***************
*** 469,476 ****
"RTAPI: WARNING: %d fifo(s) allocated but not deleted\n",
fifo_usage_count);
! /* clean up leftover fifos (start at 1, we don't use task ID 0 */
for (n = 1; n <= RTAPI_MAX_FIFOS; n++) {
! if (fifo_array[n] != NULL) {
! rtapi_fifo_delete(fifo_array[n]);
}
}
--- 538,546 ----
"RTAPI: WARNING: %d fifo(s) allocated but not deleted\n",
fifo_usage_count);
! /* clean up leftover fifos (start at 1, we don't use fifo ID 0 */
for (n = 1; n <= RTAPI_MAX_FIFOS; n++) {
! if (fifo_array[n].state != UNUSED) {
! rtapi_fifo_delete(n, 'W');
! rtapi_fifo_delete(n, 'R');
}
}
***************
*** 510,515 ****
}
if (rtapi_usage_count != 0) {
! rtapi_print_msg(RTAPI_MSG_ERR,
! "RTAPI: ERROR: %d modules called init() but not exit()\n",
rtapi_usage_count);
}
--- 580,585 ----
}
if (rtapi_usage_count != 0) {
! rtapi_print_msg(RTAPI_MSG_WARN,
! "RTAPI: WARN: %d modules called init() but not exit()\n",
rtapi_usage_count);
}
***************
*** 581,585 ****
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);
--- 651,655 ----
timer_period = count2nano(start_rt_timer(nano2count((RTIME) nsecs)));
! rtapi_print_msg(RTAPI_MSG_DBG,
"RTAPI: clock_set_period requested: %d actual: %d\n",
nsecs, timer_period);
***************
*** 694,698 ****
task_usage_count++;
/* announce the birth of a brand new baby task */
! rtapi_print_msg(RTAPI_MSG_INFO, "RTAPI: new_task id: %02d, count: %d, code: %p\n",
task_id, task_usage_count, taskcode);
/* and return the ID to the proud parent */
--- 764,768 ----
task_usage_count++;
/* announce the birth of a brand new baby task */
! rtapi_print_msg(RTAPI_MSG_DBG, "RTAPI: new_task id: %02d, count: %d, code: %p\n",
task_id, task_usage_count, taskcode);
/* and return the ID to the proud parent */
***************
*** 737,741 ****
task_usage_count--;
/* done */
! rtapi_print_msg(RTAPI_MSG_INFO, "RTAPI: delete_task id: %02d, count: %d\n",
task_id, task_usage_count);
return RTAPI_SUCCESS;
--- 807,811 ----
task_usage_count--;
/* done */
! rtapi_print_msg(RTAPI_MSG_DBG, "RTAPI: delete_task id: %02d, count: %d\n",
task_id, task_usage_count);
return RTAPI_SUCCESS;
***************
*** 782,786 ****
/* ok, task is started (or at least scheduled to start) */
task->state = PERIODIC;
! rtapi_print_msg(RTAPI_MSG_INFO, "RTAPI: start_task id: %02d\n", task_id);
return retval;
}
--- 852,856 ----
/* ok, task is started (or at least scheduled to start) */
task->state = PERIODIC;
! rtapi_print_msg(RTAPI_MSG_DBG, "RTAPI: start_task id: %02d\n", task_id);
return retval;
}
***************
*** 895,899 ****
shmem->users++;
/* announce another user for this shmem */
! rtapi_print_msg(RTAPI_MSG_INFO,
"RTAPI: new_shmem id: %02d, users: %d, key: %d, size %lu\n",
shmem_id, shmem->users, key, size);
--- 965,969 ----
shmem->users++;
/* announce another user for this shmem */
! rtapi_print_msg(RTAPI_MSG_DBG,
"RTAPI: new_shmem id: %02d, users: %d, key: %d, size %lu\n",
shmem_id, shmem->users, key, size);
***************
*** 925,929 ****
shmem_usage_count++;
/* announce the birth of a brand new baby shmem */
! rtapi_print_msg(RTAPI_MSG_INFO,
"RTAPI: new_shmem id: %02d, count: %d, key: %d, size: %lu\n",
shmem_id, shmem_usage_count, key, size);
--- 995,999 ----
shmem_usage_count++;
/* announce the birth of a brand new baby shmem */
! rtapi_print_msg(RTAPI_MSG_DBG,
"RTAPI: new_shmem id: %02d, count: %d, key: %d, size: %lu\n",
shmem_id, shmem_usage_count, key, size);
***************
*** 951,955 ****
if (shmem->users > 0 ) {
/* yes, we're done for now */
! rtapi_print_msg(RTAPI_MSG_INFO, "RTAPI: delete_shmem id: %02d, users: %d\n",
shmem_id, shmem->users);
return RTAPI_SUCCESS;
--- 1021,1025 ----
if (shmem->users > 0 ) {
/* yes, we're done for now */
! rtapi_print_msg(RTAPI_MSG_DBG, "RTAPI: delete_shmem id: %02d, users: %d\n",
shmem_id, shmem->users);
return RTAPI_SUCCESS;
***************
*** 963,967 ****
shmem->mem = NULL;
shmem_usage_count--;
! rtapi_print_msg(RTAPI_MSG_INFO, "RTAPI: delete_shmem id: %02d, count: %d\n",
shmem_id, shmem_usage_count);
return RTAPI_SUCCESS;
--- 1033,1037 ----
shmem->mem = NULL;
shmem_usage_count--;
! rtapi_print_msg(RTAPI_MSG_DBG, "RTAPI: delete_shmem id: %02d, count: %d\n",
shmem_id, shmem_usage_count);
return RTAPI_SUCCESS;
***************
*** 1011,1015 ****
sem->users++;
/* announce another user for this semaphore */
! rtapi_print_msg(RTAPI_MSG_INFO,
"RTAPI: new_sem id: %02d, users: %d, key: %d\n",
sem_id, sem->users, key);
--- 1081,1085 ----
sem->users++;
/* announce another user for this semaphore */
! rtapi_print_msg(RTAPI_MSG_DBG,
"RTAPI: new_sem id: %02d, users: %d, key: %d\n",
sem_id, sem->users, key);
***************
*** 1037,1041 ****
sem_usage_count++;
/* announce the birth of a brand new baby semaphore */
! rtapi_print_msg(RTAPI_MSG_INFO,
"RTAPI: new_sem id: %02d, count: %d, key: %d\n",
sem_id, sem_usage_count, key);
--- 1107,1111 ----
sem_usage_count++;
/* announce the birth of a brand new baby semaphore */
! rtapi_print_msg(RTAPI_MSG_DBG,
"RTAPI: new_sem id: %02d, count: %d, key: %d\n",
sem_id, sem_usage_count, key);
***************
*** 1063,1067 ****
if (sem->users > 0 ) {
/* yes, we're done for now */
! rtapi_print_msg(RTAPI_MSG_INFO, "RTAPI: delete_sem id: %02d, users: %d\n",
sem_id, sem->users);
return RTAPI_SUCCESS;
--- 1133,1137 ----
if (sem->users > 0 ) {
/* yes, we're done for now */
! rtapi_print_msg(RTAPI_MSG_DBG, "RTAPI: delete_sem id: %02d, users: %d\n",
sem_id, sem->users);
return RTAPI_SUCCESS;
***************
*** 1073,1077 ****
sem->key = 0;
sem_usage_count--;
! rtapi_print_msg(RTAPI_MSG_INFO, "RTAPI: delete_sem id: %02d, count: %d\n",
sem_id, sem_usage_count);
return RTAPI_SUCCESS;
--- 1143,1147 ----
sem->key = 0;
sem_usage_count--;
! rtapi_print_msg(RTAPI_MSG_DBG, "RTAPI: delete_sem id: %02d, count: %d\n",
sem_id, sem_usage_count);
return RTAPI_SUCCESS;
***************
*** 1145,1250 ****
************************************************************************/
! int rtapi_fifo_new(int key, unsigned long int size,
! rtapi_fifo_handle * fifoptr)
{
! rtapi_fifo_handle fifo;
! int retval;
! int n;
! /* validate fifoptr */
! if (fifoptr == NULL) {
return RTAPI_INVAL;
}
/* find empty spot in fifo array */
! n = 0;
! while ((n < RTAPI_MAX_FIFOS) && (fifo_array[n] != NULL)) {
n++;
}
! if (n == RTAPI_MAX_FIFOS) {
! return RTAPI_NOMEM;
! }
! /* alloc space for fifo structure */
! fifo = kmalloc(sizeof(struct rtapi_fifo), GFP_USER);
! if (fifo == NULL) {
! return RTAPI_NOMEM;
}
/* create the fifo */
! retval = rtf_create(key, size);
/* rtf_create() returns 0 on success */
if (retval != 0) {
/* create failed */
- kfree(fifo);
if (retval == ENOMEM) {
/* couldn't allocate memory */
return RTAPI_NOMEM;
}
! return RTAPI_INVAL;
}
- /* add to fifo array */
- fifo_array[n] = fifo;
- /* label as a valid fifo structure */
- fifo->magic = FIFO_MAGIC;
- /* fill in the rest of the struct */
fifo->key = key;
! fifo->fd = key;
! /* increment the usage counter */
fifo_usage_count++;
! /* return handle to the caller */
! *fifoptr = fifo;
! rtapi_print_msg(RTAPI_MSG_INFO, "RTAPI: new_fifo %p, count = %d\n",
! fifo, fifo_usage_count);
! return RTAPI_SUCCESS;
}
! int rtapi_fifo_delete(rtapi_fifo_handle fifo)
{
! int n;
! /* validate fifo handle */
! if (fifo == NULL) {
! return RTAPI_BADH;
}
! if (fifo->magic != FIFO_MAGIC) {
! return RTAPI_BADH;
}
! /* find entry in fifo array */
! 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;
}
! int rtapi_fifo_read(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_get(fifo->fd, &buf, size);
if (retval < 0) {
! return RTAPI_INVAL;
}
return retval;
--- 1215,1379 ----
************************************************************************/
! int rtapi_fifo_new(int key, unsigned long int size, char mode)
{
! int n, retval;
! int fifo_id;
! fifo_data *fifo;
! /* key must be non-zero */
! if ( key == 0 ) {
! return RTAPI_INVAL;
! }
! /* mode must be "R" or "W" */
! if (( mode != 'R' ) && ( mode != 'W' )) {
return RTAPI_INVAL;
}
+ /* check if a fifo already exists for this key */
+ for ( n = 1; n <= RTAPI_MAX_FIFOS ; n++ ) {
+ if ((fifo_array[n].state != UNUSED) && (fifo_array[n].key == key)) {
+ /* found a match */
+ fifo_id = n;
+ fifo = &(fifo_array[n]);
+ /* is the desired mode available */
+ if ( mode == 'R' ) {
+ if ( fifo->state & HAS_READER ) {
+ return RTAPI_BUSY;
+ }
+ /* available, update status */
+ fifo->state |= HAS_READER;
+ /* announce */
+ rtapi_print_msg(RTAPI_MSG_DBG,
+ "RTAPI: new_fifo id: %02d, add reader\n", fifo_id);
+ return fifo_id;
+ }
+ else /* mode == 'W' */ {
+ if ( fifo->state & HAS_WRITER ) {
+ return RTAPI_BUSY;
+ }
+ /* available, update status */
+ fifo->state |= HAS_WRITER;
+ /* announce */
+ rtapi_print_msg(RTAPI_MSG_DBG,
+ "RTAPI: new_fifo id: %02d, add writer\n", fifo_id);
+ return fifo_id;
+ }
+ }
+ }
/* find empty spot in fifo array */
! n = 1;
! while ((n <= RTAPI_MAX_FIFOS) &&
! (fifo_array[n].state != UNUSED)) {
n++;
}
! if (n > RTAPI_MAX_FIFOS) {
! /* no room */
! return RTAPI_LIMIT;
}
+ /* we have space for the fifo */
+ fifo_id = n;
+ fifo = &(fifo_array[n]);
/* create the fifo */
! retval = rtf_create(fifo_id, size);
/* rtf_create() returns 0 on success */
if (retval != 0) {
/* create failed */
if (retval == ENOMEM) {
/* couldn't allocate memory */
return RTAPI_NOMEM;
}
! /* some other failure */
! return RTAPI_FAIL;
! }
! /* the fifo has been created, update data */
! if ( mode == 'R' ) {
! fifo->state = HAS_READER;
! }
! else /* mode == 'W' */ {
! fifo->state = HAS_WRITER;
}
fifo->key = key;
! fifo->size = size;
! fifo->fd = fifo_id;
fifo_usage_count++;
! /* announce a new fifo */
! rtapi_print_msg(RTAPI_MSG_DBG,
! "RTAPI: new_fifo id: %02d, count: %d, mode %c, key: %d, size: %ld\n",
! fifo_id, fifo_usage_count, mode, key, size);
! /* and return the ID */
! return fifo_id;
}
! int rtapi_fifo_delete(int fifo_id, char mode)
{
! fifo_data *fifo;
! /* validate sem ID */
! if ((fifo_id < 1) || (fifo_id > RTAPI_MAX_FIFOS)) {
! return RTAPI_BADID;
}
! /* point to the fifo's data */
! fifo = &(fifo_array[fifo_id]);
! /* is the fifo valid? */
! if (fifo->state == UNUSED ) {
! return RTAPI_BADID;
}
! /* update fifo state */
! if ( mode == 'R' ) {
! if (( fifo->state & HAS_READER ) == 0 ) {
! return RTAPI_INVAL;
! }
! fifo->state &= ~HAS_READER;
}
! else if ( mode == 'W' ) {
! if (( fifo->state & HAS_WRITER ) == 0 ) {
! return RTAPI_INVAL;
! }
! fifo->state &= ~HAS_WRITER;
! }
! else {
return RTAPI_INVAL;
}
! /* is somebody else still using the fifo */
! if ( fifo->state != UNUSED ) {
! /* yes, done for now */
! rtapi_print_msg(RTAPI_MSG_DBG, "RTAPI: delete_fifo id: %02d, for %c\n",
! fifo_id, mode);
! return RTAPI_SUCCESS;
! }
! /* no other users, call the OS to destroy the fifo */
! /* OS returns open count, loop until truly destroyed */
! while ( rtf_destroy(fifo->fd) > 0 );
! /* update the data array and usage count */
! fifo->state = UNUSED;
! fifo->key = 0;
! fifo->size = 0;
! fifo->fd = 0;
fifo_usage_count--;
! rtapi_print_msg(RTAPI_MSG_DBG, "RTAPI: delete_fifo id: %02d, count: %d\n",
! fifo_id, fifo_usage_count);
return RTAPI_SUCCESS;
}
! int rtapi_fifo_read(int fifo_id, char *buf, unsigned long int size)
{
int retval;
+ fifo_data *fifo;
! /* validate fifo ID */
! if ((fifo_id < 1) || (fifo_id > RTAPI_MAX_FIFOS)) {
! return RTAPI_BADID;
}
! /* point to the fifo's data */
! fifo = &(fifo_array[fifo_id]);
! /* is the fifo valid? */
! if (fifo->state == UNUSED ) {
! return RTAPI_BADID;
}
/* get whatever data is available */
retval = rtf_get(fifo->fd, &buf, size);
if (retval < 0) {
! return RTAPI_FAIL;
}
return retval;
***************
*** 1252,1268 ****
! 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) {
--- 1381,1400 ----
! int rtapi_fifo_write(int fifo_id, char *buf, unsigned long int size)
{
int retval;
+ fifo_data *fifo;
! /* validate fifo ID */
! if ((fifo_id < 1) || (fifo_id > RTAPI_MAX_FIFOS)) {
! return RTAPI_BADID;
}
! /* point to the fifo's data */
! fifo = &(fifo_array[fifo_id]);
! /* is the fifo valid? */
! if (fifo->state == UNUSED ) {
! return RTAPI_BADID;
}
! /* put as much data as possible */
retval = rtf_put(fifo->fd, buf, size);
if (retval < 0) {
***************
*** 1291,1295 ****
int_usage_count++;
! rtapi_print_msg(RTAPI_MSG_INFO,
"RTAPI: assign_interrupt_handler for int %d, count = %d\n",
irq, int_usage_count);
--- 1423,1427 ----
int_usage_count++;
! rtapi_print_msg(RTAPI_MSG_DBG,
"RTAPI: assign_interrupt_handler for int %d, count = %d\n",
irq, int_usage_count);
***************
*** 1311,1315 ****
int_usage_count--;
! rtapi_print_msg(RTAPI_MSG_INFO,
"RTAPI: free_interrupt_handler for int %d, count = %d\n",
irq, int_usage_count);
--- 1443,1447 ----
int_usage_count--;
! rtapi_print_msg(RTAPI_MSG_DBG,
"RTAPI: free_interrupt_handler for int %d, count = %d\n",
irq, int_usage_count);
Index: rtapi.h
===================================================================
RCS file: /cvsroot/emc/rtapi/src/rtapi/rtapi.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** rtapi.h 14 Aug 2003 04:08:26 -0000 1.20
--- rtapi.h 15 Aug 2003 20:45:13 -0000 1.21
***************
*** 47,52 ****
#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 */
--- 47,50 ----
***************
*** 59,71 ****
/* NOTE: RTAPI assumes that ints are at least 32 bits long */
!
! /** Typedefs for object handles. The structs to which these handles *
! * refer are private, and may vary from one RTOS to another. *
! * 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. update - only fifos are left */
! typedef struct rtapi_fifo *rtapi_fifo_handle;
!
/***********************************************************************
--- 57,62 ----
/* NOTE: RTAPI assumes that ints are at least 32 bits long */
! /* FIXME - need to review the API, and change everything that needs
! to be 32 bits to long int. */
/***********************************************************************
***************
*** 354,373 ****
/** 'rtapi_fifo_new()' creates a realtime fifo. 'key' identifies the *
* fifo, all modules wishing to access the same fifo must use the same *
! * key. 'size' is the depth of the fifo. On success, '*fifoptr' *
! * 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,
! rtapi_fifo_handle * fifoptr);
/** 'rtapi_fifo_delete()' is the counterpart to 'rtapi_fifo_new()'. *
! * It destroys the fifo 'fifo'. Returns a status code. */
! extern int rtapi_fifo_delete(rtapi_fifo_handle fifo);
--- 345,364 ----
/** 'rtapi_fifo_new()' creates a realtime fifo. 'key' identifies the *
* fifo, all modules wishing to access the same fifo must use the same *
! * key. 'size' is the depth of the fifo. 'mode' is either 'R' or 'W', *
! * to request either read or write access to the fifo. On success, it *
! * returns a positive integer ID, which is used for subsequent calls *
! * dealing with the fifo. On failure, returns a negative error code. */
! /* NOTE - RTAI fifos require (stacksize >= fifosze + 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, char mode);
/** 'rtapi_fifo_delete()' is the counterpart to 'rtapi_fifo_new()'. *
! * It closes the fifo associated with 'fifo_ID'. 'mode' is the mode *
! * that was specified when the fifo was created. Returns status code. */
! extern int rtapi_fifo_delete(int fifo_id, char mode);
***************
*** 384,405 ****
* 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. *
* Returns the number of bytes actually read, or RTAPI_BADH. Does not *
* block. If 'size' bytes are not available, it will read whatever is *
* available, and return that count (which could be zero). */
! extern int rtapi_fifo_read(rtapi_fifo_handle fifo,
! char *buf, unsigned long int size);
! /** 'rtapi_fifo_write()' writes data to 'fifo'. Up to 'size' bytes are *
! * taken from the buffer at 'buf'. Returns the count of bytes actually *
! * written, or RTAPI_BADH. Does not block. If 'size' bytes of space *
! * are not available in the fifo, rtapi_fifo_write() will write as many *
! * bytes as it can and return that count (which may be zero). */
! extern int rtapi_fifo_write(rtapi_fifo_handle fifo,
! char *buf, unsigned long int size);
--- 375,394 ----
* replaced with something that works better. John Kasunich */
! /** 'rtapi_fifo_read()' reads data from 'fifo_id'. 'buf' is a buffer *
! * for the data, and 'size' is the maximum number of bytes to read. *
* Returns the number of bytes actually read, or RTAPI_BADH. Does not *
* block. If 'size' bytes are not available, it will read whatever is *
* available, and return that count (which could be zero). */
! extern int rtapi_fifo_read(int fifo_id, char *buf, unsigned long int size);
! /** 'rtapi_fifo_write()' writes data to 'fifo_id'. Up to 'size' bytes *
! * are taken from the buffer at 'buf'. Returns the number of bytes *
! * actually written, or RTAPI_BADH. Does not block. If 'size' bytes *
! * of space are not available in the fifo, it will write as many bytes *
! * as it can and return that count (which may be zero). */
! extern int rtapi_fifo_write(int fifo_id, char *buf, unsigned long int size);
|