Commit f0084dc0 authored by Jeroen Vreeken's avatar Jeroen Vreeken
Browse files

Merge branch 'beaglebone' of ssh://pe1rxq@acer/home/pe1rxq/shared/src/dt_ctrl into beaglebone

parents 6c9dafc8 5323b511
...@@ -33,15 +33,9 @@ help: ...@@ -33,15 +33,9 @@ help:
echo "golden repository (on eris.camras.nl)." echo "golden repository (on eris.camras.nl)."
libnova/libnova.h: lib/libnova.la
libnova.la: lib/libnova.la
lib/libnova.la:
cd libnova-0.13.0 && ./configure -enable-static -disable-shared --prefix=${CURDIR} $(CONF_HOST) && $(MAKE) && $(MAKE) install
clean: subdirs_CLEAN clean: subdirs_CLEAN
rm -rf lib/* rm -rf lib/*
rm -rf include/libnova rm -rf include/libnova
cd libnova-0.13.0 ; $(MAKE) clean || true
# Rules for building a release # Rules for building a release
...@@ -80,13 +74,7 @@ rel_ctrl: rel_trace rel_log rel_command ...@@ -80,13 +74,7 @@ rel_ctrl: rel_trace rel_log rel_command
echo " Done" echo " Done"
rel_libnova: rel_clone_dir rel_cons: rel_trace rel_log rel_command
@echo "****** Building libnova"; \
(cd $(REL_BUILD_DIR)/libnova-0.13.0 ; ./configure -enable-static -disable-shared --prefix=$(REL_BUILD_DIR) $(CONF_HOST); $(MAKE); $(MAKE) install) >/dev/null; \
echo " Done"
rel_cons: rel_trace rel_libnova rel_log rel_command
@echo "****** Building console"; \ @echo "****** Building console"; \
$(MAKE) -C $(REL_BUILD_DIR)/console >/dev/null; \ $(MAKE) -C $(REL_BUILD_DIR)/console >/dev/null; \
echo " Done" echo " Done"
...@@ -123,7 +111,7 @@ TARGETS:= ...@@ -123,7 +111,7 @@ TARGETS:=
include $(DIR)/$1/build.mk include $(DIR)/$1/build.mk
targets_$$(DIR): $$(TARGETS) targets_$$(DIR): $$(TARGETS)
$$(TARGETS): $(DIR)/$1/build.mk $$(TARGETS): $(DIR)/$1/build.mk Makefile build.mk buildflags.mk
TARGETS:= $$($(DIR)_TMPTARGETS) $$(TARGETS) TARGETS:= $$($(DIR)_TMPTARGETS) $$(TARGETS)
......
...@@ -3,8 +3,12 @@ BUILDSYS=@BUILDSYS@ ...@@ -3,8 +3,12 @@ BUILDSYS=@BUILDSYS@
BUILD_CONSOLE=@BUILD_CONSOLE@ BUILD_CONSOLE=@BUILD_CONSOLE@
BUILD_CONSOLE_HTTPD=@BUILD_CONSOLE_HTTPD@ BUILD_CONSOLE_HTTPD=@BUILD_CONSOLE_HTTPD@
BUILD_CONSOLE_J2000=@BUILD_CONSOLE_J2000@
BUILD_CONSOLE_SATTRACKER=@BUILD_CONSOLE_SATTRACKER@
BUILD_CONSOLE_J2000_INDI=@BUILD_CONSOLE_J2000_INDI@ BUILD_CONSOLE_J2000_INDI=@BUILD_CONSOLE_J2000_INDI@
BUILD_ETHERCAT=@BUILD_ETHERCAT@ BUILD_ETHERCAT=@BUILD_ETHERCAT@
BUILD_VESP=@BUILD_VESP@ BUILD_VESP=@BUILD_VESP@
BUILD_AM335X=@BUILD_AM335X@ BUILD_AM335X=@BUILD_AM335X@
BUILD_TEST=@BUILD_TEST@
...@@ -521,6 +521,8 @@ char *enum_command_ptype2str(enum command_ptype ptype) ...@@ -521,6 +521,8 @@ char *enum_command_ptype2str(enum command_ptype ptype)
return "SPEED"; return "SPEED";
case COMMAND_PTYPE_SETPOINT_TIME: case COMMAND_PTYPE_SETPOINT_TIME:
return "SETPOINT_TIME"; return "SETPOINT_TIME";
case COMMAND_PTYPE_SETPOINT_TRACK:
return "SETPOINT_TRACK";
case COMMAND_PTYPE_MAX: case COMMAND_PTYPE_MAX:
return "MAX"; return "MAX";
default: default:
......
...@@ -35,6 +35,7 @@ enum command_ptype { ...@@ -35,6 +35,7 @@ enum command_ptype {
COMMAND_PTYPE_SETPOINT = 4, /* Simple direct setpoint */ COMMAND_PTYPE_SETPOINT = 4, /* Simple direct setpoint */
COMMAND_PTYPE_SPEED = 5, /* Simple direct 1st derivative setpoint */ COMMAND_PTYPE_SPEED = 5, /* Simple direct 1st derivative setpoint */
COMMAND_PTYPE_SETPOINT_TIME = 6, /* Setpoint to be reached @ time */ COMMAND_PTYPE_SETPOINT_TIME = 6, /* Setpoint to be reached @ time */
COMMAND_PTYPE_SETPOINT_TRACK = 7, /* Use setpoint from track input */
COMMAND_PTYPE_MAX, /* Always the last entry! */ COMMAND_PTYPE_MAX, /* Always the last entry! */
}; };
......
/* /*
Copyright Jeroen Vreeken (pe1rxq@amsat.org), 2008, 2013, 2014 Copyright Jeroen Vreeken (jeroen@vreeken.net), 2008, 2013, 2014, 2015
Copyright Stichting C.A. Muller Radioastronomiestation, 2008, 2013 Copyright Stichting C.A. Muller Radioastronomiestation, 2008, 2013
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
...@@ -226,13 +226,13 @@ static void *log_server(void *arg) ...@@ -226,13 +226,13 @@ static void *log_server(void *arg)
(struct sockaddr *)&sockaddr, sizeof(sockaddr)) < 0) { (struct sockaddr *)&sockaddr, sizeof(sockaddr)) < 0) {
perror("bind() failed"); perror("bind() failed");
close(fd_accept); close(fd_accept);
return NULL; fd_accept = -1;
} }
if (listen(fd_accept, 4) < 0) { if (fd_accept >= 0 && listen(fd_accept, 4) < 0) {
perror("listen() failed"); perror("listen() failed");
close(fd_accept); close(fd_accept);
return NULL; fd_accept = -1;
} }
while (1) { while (1) {
...@@ -247,7 +247,7 @@ static void *log_server(void *arg) ...@@ -247,7 +247,7 @@ static void *log_server(void *arg)
sem_wait(&queue_wait); sem_wait(&queue_wait);
} }
do { if (fd_accept >= 0) do {
FD_ZERO(&fdset_r); FD_ZERO(&fdset_r);
FD_SET(fd_accept, &fdset_r); FD_SET(fd_accept, &fdset_r);
tv.tv_sec = 0; tv.tv_sec = 0;
...@@ -358,9 +358,6 @@ int log_server_start(int port, enum log_type console_level, ...@@ -358,9 +358,6 @@ int log_server_start(int port, enum log_type console_level,
printf("Starting log server on port %d\n", port); printf("Starting log server on port %d\n", port);
pthread_attr_init(&attr); pthread_attr_init(&attr);
#ifndef __FreeBSD__
pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN * 2);
#endif
pthread_create(&thread_id, &attr, log_server, NULL); pthread_create(&thread_id, &attr, log_server, NULL);
......
...@@ -12,20 +12,26 @@ AS_IF([echo "$HOSTSYS_TMP" | grep "arm"],[HAVE_ARM=1],[HAVE_ARM=0]) ...@@ -12,20 +12,26 @@ AS_IF([echo "$HOSTSYS_TMP" | grep "arm"],[HAVE_ARM=1],[HAVE_ARM=0])
# #
AC_ARG_ENABLE([ethercat], AC_ARG_ENABLE([ethercat],
[AS_HELP_STRING([--disable-ethercat], [Enable/Disable Ethercat @<:@yes@:>@])], [AS_HELP_STRING([--disable-ethercat], [Enable/Disable Ethercat master @<:@yes@:>@])],
[:], [:],
[enable_ethercat=yes]) [enable_ethercat=yes])
AC_ARG_ENABLE([vesp], AC_ARG_ENABLE([vesp],
[AS_HELP_STRING([--disable-vesp], [Enable/Disable vesp @<:@yes@:>@])], [AS_HELP_STRING([--disable-vesp], [Enable/Disable vesp bus @<:@yes@:>@])],
[:], [:],
[enable_vesp=yes]) [enable_vesp=yes])
AC_ARG_ENABLE([am335x], AC_ARG_ENABLE([am335x],
[AS_HELP_STRING([--disable-am335x], [Enable/Disable am335x @<:@yes@:>@])], [AS_HELP_STRING([--disable-am335x], [Enable/Disable am335x blocks @<:@yes@:>@])],
[:], [:],
[enable_am335x=yes]) [enable_am335x=yes])
AC_ARG_ENABLE([test],
[AS_HELP_STRING([--disable-test], [Enable/Disable test blocks @<:@yes@:>@])],
[:],
[enable_test=yes])
####################################################################### #######################################################################
# #
# Enable/disable console # Enable/disable console
...@@ -77,9 +83,27 @@ AS_CASE(["$with_libindi"], ...@@ -77,9 +83,27 @@ AS_CASE(["$with_libindi"],
[AC_CHECK_LIB(indi,IDLog,[HAVE_LIBINDI=1],[HAVE_LIBINDI=0])] [AC_CHECK_LIB(indi,IDLog,[HAVE_LIBINDI=1],[HAVE_LIBINDI=0])]
[AC_CHECK_HEADERS([libindi/indidevapi.h])] [AC_CHECK_HEADERS([libindi/indidevapi.h])]
) )
#AS_IF([test "$ac_cv_header_linindi_indidevapi_h" != yes],[HAVE_LIBINDI=0],[])
#######################################################################
#
# Check for libnova
#
AC_ARG_WITH([libnova],
[AS_HELP_STRING([--with-libnova],
[use nova library @<:@default=check@:>@])],
[],
[with_libnova=check])
AS_CASE(["$with_libnova"],
[yes],
[AC_CHECK_LIB(nova,ln_get_version,[HAVE_LIBNOVA=1])]
[AC_CHECK_HEADERS([libnova/libnova.h])],
[no],
[],
[AC_CHECK_LIB(nova,ln_get_version,[HAVE_LIBNOVA=1],[HAVE_LIBNOVA=0])]
[AC_CHECK_HEADERS([libnova/libnova.h])]
)
####################################################################### #######################################################################
# #
...@@ -95,12 +119,19 @@ AS_IF([test "$BUILD_CONSOLE" == "yes" && test "$HAVE_LIBWEBSOCKETS" == "1"], ...@@ -95,12 +119,19 @@ AS_IF([test "$BUILD_CONSOLE" == "yes" && test "$HAVE_LIBWEBSOCKETS" == "1"],
[AC_SUBST(BUILD_CONSOLE_HTTPD,["yes"])], [AC_SUBST(BUILD_CONSOLE_HTTPD,["yes"])],
[AC_SUBST(BUILD_CONSOLE_HTTPD,[""])]) [AC_SUBST(BUILD_CONSOLE_HTTPD,[""])])
AS_IF([test "$BUILD_CONSOLE" = "yes" && test "$HAVE_LIBINDI" = "1"], AS_IF([test "$BUILD_CONSOLE" = "yes" && test "$HAVE_LIBNOVA" = "1"],
[AC_SUBST(BUILD_CONSOLE_J2000,["yes"])],
[AC_SUBST(BUILD_CONSOLE_J2000,[""])])
AS_IF([test "$BUILD_CONSOLE" = "yes" && test "$HAVE_LIBNOVA" = "1"],
[AC_SUBST(BUILD_CONSOLE_SATTRACKER,["yes"])],
[AC_SUBST(BUILD_CONSOLE_SATTRACKER,[""])])
AS_IF([test "$BUILD_CONSOLE_J2000" = "yes" && test "$HAVE_LIBINDI" = "1"],
[AC_SUBST(BUILD_CONSOLE_J2000_INDI,["yes"])], [AC_SUBST(BUILD_CONSOLE_J2000_INDI,["yes"])],
[AC_SUBST(BUILD_CONSOLE_J2000_INDI,[""])]) [AC_SUBST(BUILD_CONSOLE_J2000_INDI,[""])])
AS_IF([test "$enable_ethercat" = "yes"], AS_IF([test "$enable_ethercat" = "yes"],
[AC_SUBST(BUILD_ETHERCAT,["yes"])], [AC_SUBST(BUILD_ETHERCAT,["yes"])],
[AC_SUBST(BUILD_ETHERCAT,[""])]) [AC_SUBST(BUILD_ETHERCAT,[""])])
...@@ -113,6 +144,9 @@ AS_IF([test "$enable_am335x" = "yes" && test "$HAVE_ARM" = "1"], ...@@ -113,6 +144,9 @@ AS_IF([test "$enable_am335x" = "yes" && test "$HAVE_ARM" = "1"],
[AC_SUBST(BUILD_AM335X,["yes"])], [AC_SUBST(BUILD_AM335X,["yes"])],
[AC_SUBST(BUILD_AM335X,[""])]) [AC_SUBST(BUILD_AM335X,[""])])
AS_IF([test "$enable_test" = "yes"],
[AC_SUBST(BUILD_TEST,["yes"])],
[AC_SUBST(BUILD_TEST,[""])])
####################################################################### #######################################################################
# #
...@@ -138,10 +172,17 @@ AS_IF([test "$BUILD_CONSOLE_HTTPD" != ""], ...@@ -138,10 +172,17 @@ AS_IF([test "$BUILD_CONSOLE_HTTPD" != ""],
AC_MSG_NOTICE([ console_httpd: yes]), AC_MSG_NOTICE([ console_httpd: yes]),
AC_MSG_NOTICE([ console_httpd: no])) AC_MSG_NOTICE([ console_httpd: no]))
AS_IF([test "$BUILD_CONSOLE_J2000" != ""],
AC_MSG_NOTICE([ console_j2000_tracker: yes]),
AC_MSG_NOTICE([ console_j2000_tracker: no]))
AS_IF([test "$BUILD_CONSOLE_J2000_INDI" != ""], AS_IF([test "$BUILD_CONSOLE_J2000_INDI" != ""],
AC_MSG_NOTICE([ console_j2000_indi: yes]), AC_MSG_NOTICE([ console_j2000_indi: yes]),
AC_MSG_NOTICE([ console_j2000_indi: no])) AC_MSG_NOTICE([ console_j2000_indi: no]))
AS_IF([test "$BUILD_CONSOLE_SATTRACKER" != ""],
AC_MSG_NOTICE([ console_sattracker: yes]),
AC_MSG_NOTICE([ console_sattracker: no]))
AS_IF([test "$BUILD_ETHERCAT" != ""], AS_IF([test "$BUILD_ETHERCAT" != ""],
AC_MSG_NOTICE([ ethercat: yes]), AC_MSG_NOTICE([ ethercat: yes]),
...@@ -154,3 +195,7 @@ AS_IF([test "$BUILD_VESP" != ""], ...@@ -154,3 +195,7 @@ AS_IF([test "$BUILD_VESP" != ""],
AS_IF([test "$BUILD_AM335X" != ""], AS_IF([test "$BUILD_AM335X" != ""],
AC_MSG_NOTICE([ am335x: yes]), AC_MSG_NOTICE([ am335x: yes]),
AC_MSG_NOTICE([ am335x: no])) AC_MSG_NOTICE([ am335x: no]))
AS_IF([test "$BUILD_TEST" != ""],
AC_MSG_NOTICE([ test: yes]),
AC_MSG_NOTICE([ test: no]))
...@@ -11,8 +11,12 @@ CONSOLE_TARGETS += $(DIR)/command_shell ...@@ -11,8 +11,12 @@ CONSOLE_TARGETS += $(DIR)/command_shell
CONSOLE_TARGETS += $(DIR)/console_moontracker CONSOLE_TARGETS += $(DIR)/console_moontracker
CONSOLE_TARGETS += $(DIR)/trace_proxy CONSOLE_TARGETS += $(DIR)/trace_proxy
CONSOLE_TARGETS += $(DIR)/trace_log CONSOLE_TARGETS += $(DIR)/trace_log
ifdef BUILD_CONSOLE_J2000
CONSOLE_TARGETS += $(DIR)/console_j2000tracker CONSOLE_TARGETS += $(DIR)/console_j2000tracker
CONSOLE_TARGETS += $(DIR)/console_j2000tracer CONSOLE_TARGETS += $(DIR)/console_j2000tracer
endif
CONSOLE_TARGETS += $(DIR)/log_proxy CONSOLE_TARGETS += $(DIR)/log_proxy
CONSOLE_TARGETS += $(DIR)/spg_auth CONSOLE_TARGETS += $(DIR)/spg_auth
CONSOLE_TARGETS += $(DIR)/console_idle CONSOLE_TARGETS += $(DIR)/console_idle
...@@ -22,7 +26,10 @@ CONSOLE_TARGETS += $(DIR)/console_manual ...@@ -22,7 +26,10 @@ CONSOLE_TARGETS += $(DIR)/console_manual
CONSOLE_TARGETS += $(DIR)/console_weather CONSOLE_TARGETS += $(DIR)/console_weather
CONSOLE_TARGETS += $(DIR)/console_dt_model CONSOLE_TARGETS += $(DIR)/console_dt_model
CONSOLE_TARGETS += $(DIR)/await_controller CONSOLE_TARGETS += $(DIR)/await_controller
ifdef BUILD_CONSOLE_SATTRACKER
CONSOLE_TARGETS += $(DIR)/console_sattracker CONSOLE_TARGETS += $(DIR)/console_sattracker
endif
ifdef BUILD_CONSOLE_HTTPD ifdef BUILD_CONSOLE_HTTPD
CONSOLE_TARGETS += $(DIR)/console_httpd CONSOLE_TARGETS += $(DIR)/console_httpd
...@@ -59,30 +66,26 @@ $(DIR)/command_shell: $(DIR)/command_shell.o ...@@ -59,30 +66,26 @@ $(DIR)/command_shell: $(DIR)/command_shell.o
CONSOLE_SRCS += $(DIR)/command_shell.c CONSOLE_SRCS += $(DIR)/command_shell.c
$(DIR)/console_moontracker.o: CFLAGS += -Wall -O3 $(DIR)/console_moontracker.o: CFLAGS += -Wall -O3
$(DIR)/console_moontracker.o: libnova/libnova.h
$(DIR)/console_moontracker_LDFLAGS += -lcommand -lm -laa $(DIR)/console_moontracker_LDFLAGS += -lcommand -lm -laa
$(DIR)/console_moontracker: libcommand.la libaa.la $(DIR)/console_moontracker: libcommand.la libaa.la
$(DIR)/console_moontracker: $(DIR)/console_moontracker.o $(DIR)/console_moontracker: $(DIR)/console_moontracker.o
CONSOLE_SRCS += $(DIR)/console_moontracker.c CONSOLE_SRCS += $(DIR)/console_moontracker.c
$(DIR)/console_j2000tracker.o: CFLAGS += -Wall -O3 $(DIR)/console_j2000tracker.o: CFLAGS += -Wall -O3
$(DIR)/console_j2000tracker.o: libnova/libnova.h
$(DIR)/console_j2000tracker_LDFLAGS += -lcommand -lm -lnova -ltrace $(DIR)/console_j2000tracker_LDFLAGS += -lcommand -lm -lnova -ltrace
$(DIR)/console_j2000tracker: libcommand.la libtrace.la libnova.la $(DIR)/console_j2000tracker: libcommand.la libtrace.la
$(DIR)/console_j2000tracker: $(DIR)/console_j2000tracker.o $(DIR)/console_j2000tracker: $(DIR)/console_j2000tracker.o
CONSOLE_SRCS += $(DIR)/console_j2000tracker.c CONSOLE_SRCS += $(DIR)/console_j2000tracker.c
$(DIR)/console_j2000tracer.o: CFLAGS += -Wall -O3 $(DIR)/console_j2000tracer.o: CFLAGS += -Wall -O3
$(DIR)/console_j2000tracesr.o: libnova/libnova.h
$(DIR)/console_j2000tracer_LDFLAGS += -lm -lnova -lutils $(DIR)/console_j2000tracer_LDFLAGS += -lm -lnova -lutils
$(DIR)/console_j2000tracer: libutils.la libnova.la $(DIR)/console_j2000tracer: libutils.la
$(DIR)/console_j2000tracer: $(DIR)/console_j2000tracer.o $(DIR)/console_j2000tracer: $(DIR)/console_j2000tracer.o
CONSOLE_SRCS += $(DIR)/console_j2000tracer.c CONSOLE_SRCS += $(DIR)/console_j2000tracer.c
$(DIR)/console_j2000_indi.o: CFLAGS += -Wall -O3 $(DIR)/console_j2000_indi.o: CFLAGS += -Wall -O3
$(DIR)/console_j2000_indi.o: libnova/libnova.h
$(DIR)/console_j2000_indi_LDFLAGS += -lm -lindi -lindidriver -lnova -lutils $(DIR)/console_j2000_indi_LDFLAGS += -lm -lindi -lindidriver -lnova -lutils
$(DIR)/console_j2000_indi: libutils.la libnova.la $(DIR)/console_j2000_indi: libutils.la
$(DIR)/console_j2000_indi: $(DIR)/console_j2000_indi.o $(DIR)/console_j2000_indi: $(DIR)/console_j2000_indi.o
CONSOLE_SRCS += $(DIR)/console_j2000_indi.c CONSOLE_SRCS += $(DIR)/console_j2000_indi.c
...@@ -147,9 +150,8 @@ $(DIR)/spg_auth: $(DIR)/spg_auth.o ...@@ -147,9 +150,8 @@ $(DIR)/spg_auth: $(DIR)/spg_auth.o
CONSOLE_SRCS += $(DIR)/spg_auth.c CONSOLE_SRCS += $(DIR)/spg_auth.c
$(DIR)/console_sattracker.o: CFLAGS += -Wall -O3 $(DIR)/console_sattracker.o: CFLAGS += -Wall -O3
$(DIR)/console_sattracker.o: libnova/libnova.h
$(DIR)/console_sattracker_LDFLAGS += -lcommand -lnova -lpredict $(DIR)/console_sattracker_LDFLAGS += -lcommand -lnova -lpredict
$(DIR)/console_sattracker: libcommand.la libpredict.la libnova.la $(DIR)/console_sattracker: libcommand.la libpredict.la
$(DIR)/console_sattracker: $(DIR)/console_sattracker.o $(DIR)/console_sattracker: $(DIR)/console_sattracker.o
CONSOLE_SRCS += $(DIR)/console_sattracker.c CONSOLE_SRCS += $(DIR)/console_sattracker.c
......
...@@ -105,6 +105,27 @@ struct ln_hms track_hms; ...@@ -105,6 +105,27 @@ struct ln_hms track_hms;
struct ln_dms track_dms; struct ln_dms track_dms;
/* Reverse of ln_get_equ_aber() */
static void get_equ_mean_from_aber(struct ln_equ_posn * position, double JD, struct ln_equ_posn * mean_position)
{
struct ln_equ_posn mean;
ln_get_equ_aber(position, JD, &mean);
mean_position->ra = position->ra - (mean.ra - position->ra);
mean_position->dec = position->dec - (mean.dec - position->dec);
if (mean_position->dec > 90.0) {
mean_position->dec = 180.0 - mean_position->dec;
mean_position->ra -= 180.0;
}
while (mean_position->ra < 0.0) {
mean_position->ra += 360.0;
}
while (mean_position->ra >= 360.0) {
mean_position->ra -= 360.0;
}
}
void a2coord(char *ara, char *adec, struct ln_hms *ra, struct ln_dms *dec) void a2coord(char *ara, char *adec, struct ln_hms *ra, struct ln_dms *dec)
...@@ -276,7 +297,7 @@ void output(struct status_server *stat_srv) ...@@ -276,7 +297,7 @@ void output(struct status_server *stat_srv)
ln_get_equ_from_hrz (&hrz, &dwingeloo_pos, JD, &equ_pos_prec); ln_get_equ_from_hrz (&hrz, &dwingeloo_pos, JD, &equ_pos_prec);
/* Calculate inverse precession */ /* Calculate inverse precession */
ln_get_equ_prec2(&equ_pos_prec, JD, JD2000, &equ_pos_aber); ln_get_equ_prec2(&equ_pos_prec, JD, JD2000, &equ_pos_aber);
ln_get_equ_mean_from_aber(&equ_pos_aber, JD, &equ_pos); get_equ_mean_from_aber(&equ_pos_aber, JD, &equ_pos);
ln_deg_to_hms(equ_pos.ra, &hms); ln_deg_to_hms(equ_pos.ra, &hms);
ln_deg_to_dms(equ_pos.dec, &dms); ln_deg_to_dms(equ_pos.dec, &dms);
......
...@@ -37,9 +37,6 @@ ...@@ -37,9 +37,6 @@
#include <errno.h> #include <errno.h>
#include <stdbool.h> #include <stdbool.h>
#include <libnova/julian_day.h>
#include <libnova/refraction.h>
#include <command/command.h> #include <command/command.h>
#include <aalib/aalib.h> #include <aalib/aalib.h>
...@@ -76,14 +73,6 @@ struct compensation_switch compensation_switches[] = { ...@@ -76,14 +73,6 @@ struct compensation_switch compensation_switches[] = {
struct weather *weather; struct weather *weather;
struct lnh_lnlat_posn dwingeloo;
struct ln_lnlat_posn dwingeloo_pos;
struct ln_equ_posn object;
struct ln_equ_posn object_prec;
struct ln_equ_posn object_aber;
struct ln_hms track_hms;
struct ln_dms track_dms;
static int handle_cmd(char *name, char *val) static int handle_cmd(char *name, char *val)
{ {
......
...@@ -37,9 +37,6 @@ ...@@ -37,9 +37,6 @@
#include <errno.h> #include <errno.h>
#include <stdbool.h> #include <stdbool.h>
#include <libnova/julian_day.h>
#include <libnova/refraction.h>
#include <command/command.h> #include <command/command.h>
#include <aalib/aalib.h> #include <aalib/aalib.h>
...@@ -76,14 +73,6 @@ struct compensation_switch compensation_switches[] = { ...@@ -76,14 +73,6 @@ struct compensation_switch compensation_switches[] = {
struct weather *weather; struct weather *weather;
struct lnh_lnlat_posn dwingeloo;
struct ln_lnlat_posn dwingeloo_pos;
struct ln_equ_posn object;
struct ln_equ_posn object_prec;
struct ln_equ_posn object_aber;
struct ln_hms track_hms;
struct ln_dms track_dms;
static int handle_cmd(char *name, char *val) static int handle_cmd(char *name, char *val)
{ {
......
dt_ctrl dt_ctrl
*.dot *.dot
*.pdf *.pdf
*.test.output
test.output
/* /*
Copyright Jeroen Vreeken (jeroen@vreeken.net), 2014 Copyright Jeroen Vreeken (jeroen@vreeken.net), 2014, 2015
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -67,7 +67,10 @@ void *am335x_mem(size_t base, size_t size) ...@@ -67,7 +67,10 @@ void *am335x_mem(size_t base, size_t size)
goto err_open; goto err_open;
} }
map = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, base); map = mmap(NULL, size,
PROT_READ | PROT_WRITE,
MAP_SHARED | MAP_LOCKED,
fd, base);
close(fd); close(fd);
if (!map) { if (!map) {
log_send(LOG_T_ERROR, "am335x: mmap 0x%zx bytes @ 0x%08zx failed", log_send(LOG_T_ERROR, "am335x: mmap 0x%zx bytes @ 0x%08zx failed",
...@@ -78,6 +81,9 @@ void *am335x_mem(size_t base, size_t size) ...@@ -78,6 +81,9 @@ void *am335x_mem(size_t base, size_t size)
log_send(LOG_T_DEBUG, "am335x: 0x%zx bytes mapped @ 0x%08zx", log_send(LOG_T_DEBUG, "am335x: 0x%zx bytes mapped @ 0x%08zx",
size, base); size, base);
entry->base = base;
entry->size = size;
entry->map = map;
entry->next = mapped_list; entry->next = mapped_list;
mapped_list = entry; mapped_list = entry;
...@@ -115,7 +121,7 @@ int am335x_cm_enable(size_t cm_off) ...@@ -115,7 +121,7 @@ int am335x_cm_enable(size_t cm_off)
if (reg == AM335X_CM_IDLEST_FUNCTIONAL) if (reg == AM335X_CM_IDLEST_FUNCTIONAL)
log_send(LOG_T_DEBUG, "am335x: CM 0x%x: state: functional", cm_off); log_send(LOG_T_DEBUG, "am335x: CM 0x%x: state: functional", cm_off);
if (reg == AM335X_CM_IDLEST_TRANSITION) if (reg == AM335X_CM_IDLEST_TRANSITION)
log_send(LOG_T_DEBUG, "am335x: CM 0x%x: state: transitining", cm_off); log_send(LOG_T_DEBUG, "am335x: CM 0x%x: state: transitioning", cm_off);
if (reg == AM335X_CM_IDLEST_IDLE) if (reg == AM335X_CM_IDLEST_IDLE)
log_send(LOG_T_DEBUG, "am335x: CM 0x%x: state: idle", cm_off); log_send(LOG_T_DEBUG, "am335x: CM 0x%x: state: idle", cm_off);
if (reg == AM335X_CM_IDLEST_DISABLED) if (reg == AM335X_CM_IDLEST_DISABLED)
...@@ -127,3 +133,186 @@ int am335x_cm_enable(size_t cm_off) ...@@ -127,3 +133,186 @@ int am335x_cm_enable(size_t cm_off)
return 0; return 0;
} }
static void *control_module_base;
static int am335x_control_module_init(void)
{
control_module_base =
am335x_mem(AM335X_CONTROL_MODULE_BASE, AM335X_CONTROL_MODULE_SIZE);
return control_module_base == NULL;
}
int am335x_control_module_set(size_t offset, uint32_t bits)
{
uint32_t reg;
if (!control_module_base) {
if (am335x_control_module_init()) {
log_send(LOG_T_ERROR,
"am335x: CONTROL_MODULE init failed");
return -1;
}
}