Skip to content

Commit 568354c

Browse files
authored
Merge pull request #3918 from LinuxCNC/revert-3908-rtapi_cleanup
Revert "Rtapi cleanup"
2 parents 74e7ea5 + a24f173 commit 568354c

File tree

11 files changed

+1424
-1569
lines changed

11 files changed

+1424
-1569
lines changed

src/rtapi/Submakefile

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ $(patsubst ./rtapi/%,../include/%,$(RTAPIINCS)): ../include/%.h: ./rtapi/%.h
3232
ifeq ($(BUILD_SYS),uspace)
3333

3434
RTAPI_APP_SRCS := \
35-
rtapi/uspace_rtapi_main.cc \
3635
rtapi/uspace_rtapi_app.cc \
3736
rtapi/uspace_rtapi_parport.cc \
3837
rtapi/uspace_rtapi_string.c \
@@ -44,19 +43,10 @@ $(call TOOBJSDEPS, $(RTAPI_APP_SRCS)): EXTRAFLAGS += -DSIM \
4443
-UULAPI -DRTAPI -pthread
4544
../bin/rtapi_app: $(call TOOBJS, $(RTAPI_APP_SRCS))
4645
$(ECHO) Linking $(notdir $@)
47-
$(Q)$(CXX) -rdynamic -o $@ $^ $(LIBDL) -pthread -lrt -lfmt $(LIBUDEV_LIBS) -ldl $(LDFLAGS)
46+
$(Q)$(CXX) -rdynamic -o $@ $^ $(LIBDL) -pthread -lrt $(LIBUDEV_LIBS) -ldl $(LDFLAGS)
4847
TARGETS += ../bin/rtapi_app
4948
endif
5049

51-
USPACE_POSIX_SRCS := rtapi/uspace_posix.cc
52-
USERSRCS += $(USPACE_POSIX_SRCS)
53-
$(call TOOBJSDEPS, $(USPACE_POSIX_SRCS)): EXTRAFLAGS += -pthread -fPIC
54-
../lib/libuspace-posix.so.0: $(call TOOBJS, $(USPACE_POSIX_SRCS))
55-
$(ECHO) Linking $(notdir $@)
56-
$(Q)$(CXX) -shared $(LDFLAGS) -o $@ $^ -Wl,-soname,$(notdir $@)
57-
TARGETS += ../lib/libuspace-posix.so.0
58-
TARGETS += ../lib/libuspace-posix.so
59-
6050
ifeq ($(CONFIG_USPACE_RTAI),y)
6151
USPACE_RTAI_SRCS := rtapi/uspace_rtai.cc
6252
USERSRCS += $(USPACE_RTAI_SRCS)

src/rtapi/rtapi_pci.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include <rtapi.h>
3535
#include <rtapi_pci.h>
3636
#include <rtapi_firmware.h>
37-
#include "uspace_rtapi_app.hh"
37+
#include "rtapi_uspace.hh"
3838

3939
#include <dirent.h>
4040
#include <errno.h>
Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -34,42 +34,42 @@ static inline void rtapi_timespec_add(timespec &result, const timespec &ta, cons
3434
}
3535

3636
static inline bool rtapi_timespec_less(const struct timespec &ta, const struct timespec &tb) {
37-
if (ta.tv_sec < tb.tv_sec)
38-
return 1;
39-
if (ta.tv_sec > tb.tv_sec)
40-
return 0;
37+
if(ta.tv_sec < tb.tv_sec) return 1;
38+
if(ta.tv_sec > tb.tv_sec) return 0;
4139
return ta.tv_nsec < tb.tv_nsec;
4240
}
4341

4442
void rtapi_timespec_advance(struct timespec &result, const struct timespec &src, unsigned long nsec);
4543

46-
struct WithRoot {
44+
struct WithRoot
45+
{
4746
WithRoot();
4847
~WithRoot();
4948
static std::atomic_int level;
5049
};
5150

5251
struct rtapi_task {
53-
rtapi_task();
52+
rtapi_task();
5453

55-
int magic; /* to check for valid handle */
56-
int id;
57-
int owner;
58-
int uses_fp;
59-
size_t stacksize;
60-
int prio;
61-
long period;
62-
struct timespec nextstart;
63-
long pll_correction;
64-
long pll_correction_limit;
65-
void *arg;
66-
void (*taskcode)(void *); /* pointer to task function */
54+
int magic; /* to check for valid handle */
55+
int id;
56+
int owner;
57+
int uses_fp;
58+
size_t stacksize;
59+
int prio;
60+
long period;
61+
struct timespec nextstart;
62+
unsigned ratio;
63+
long pll_correction;
64+
long pll_correction_limit;
65+
void *arg;
66+
void (*taskcode) (void*); /* pointer to task function */
6767
};
6868

69-
struct RtapiApp {
69+
struct RtapiApp
70+
{
7071

71-
RtapiApp(int policy = SCHED_OTHER) : policy(policy), period(0) {
72-
}
72+
RtapiApp(int policy = SCHED_OTHER) : policy(policy), period(0) {}
7373

7474
virtual int prio_highest() const;
7575
virtual int prio_lowest() const;
@@ -79,11 +79,12 @@ struct RtapiApp {
7979
int prio_next_higher(int prio) const;
8080
int prio_next_lower(int prio) const;
8181
long clock_set_period(long int period_nsec);
82-
int task_new(void (*taskcode)(void *), void *arg, int prio, int owner, unsigned long int stacksize, int uses_fp);
82+
int task_new(void (*taskcode)(void*), void *arg,
83+
int prio, int owner, unsigned long int stacksize, int uses_fp);
8384
virtual rtapi_task *do_task_new() = 0;
8485
static int allocate_task_id();
8586
static struct rtapi_task *get_task(int task_id);
86-
void unexpected_realtime_delay(rtapi_task *task, int nperiod = 1);
87+
void unexpected_realtime_delay(rtapi_task *task, int nperiod=1);
8788
virtual int task_delete(int id) = 0;
8889
virtual int task_start(int task_id, unsigned long period_nsec) = 0;
8990
virtual int task_pause(int task_id) = 0;
@@ -101,20 +102,18 @@ struct RtapiApp {
101102
long period;
102103
};
103104

104-
template <class T = rtapi_task> T *rtapi_get_task(int task_id) {
105-
return static_cast<T *>(RtapiApp::get_task(task_id));
105+
template<class T=rtapi_task>
106+
T *rtapi_get_task(int task_id) {
107+
return static_cast<T*>(RtapiApp::get_task(task_id));
106108
}
107109

108110
int find_rt_cpu_number();
109-
void set_namef(const char *fmt, ...);
110111

111-
#define MAX_TASKS 64
112-
#define TASK_MAGIC 21979 /* random numbers used as signatures */
113-
#define TASK_MAGIC_INIT ((rtapi_task *)(-1))
112+
#define MAX_TASKS 64
113+
#define TASK_MAGIC 21979 /* random numbers used as signatures */
114+
#define TASK_MAGIC_INIT ((rtapi_task*)(-1))
114115

115116
extern struct rtapi_task *task_array[MAX_TASKS];
116117

117-
extern uid_t euid, ruid; //ToDo: Improve
118-
119118
#define WITH_ROOT WithRoot root
120119
#endif

src/rtapi/uspace_common.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include <sys/time.h>
2222
#include <time.h>
2323
#include <stdio.h>
24-
#include <stdlib.h>
2524
#include <sys/utsname.h>
2625
#include <string.h>
2726
#include <unistd.h>
@@ -40,7 +39,7 @@ static msg_level_t msg_level = RTAPI_MSG_ERR; /* message printing level */
4039
#include "config.h"
4140

4241
#ifdef RTAPI
43-
#include "uspace_rtapi_app.hh"
42+
#include "rtapi_uspace.hh"
4443
#endif
4544

4645
typedef struct {

0 commit comments

Comments
 (0)