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:
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
rm -rf lib/*
rm -rf include/libnova
cd libnova-0.13.0 ; $(MAKE) clean || true
# Rules for building a release
......@@ -80,13 +74,7 @@ rel_ctrl: rel_trace rel_log rel_command
echo " Done"
rel_libnova: rel_clone_dir
@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
rel_cons: rel_trace rel_log rel_command
@echo "****** Building console"; \
$(MAKE) -C $(REL_BUILD_DIR)/console >/dev/null; \
echo " Done"
......@@ -123,7 +111,7 @@ TARGETS:=
include $(DIR)/$1/build.mk
targets_$$(DIR): $$(TARGETS)
$$(TARGETS): $(DIR)/$1/build.mk
$$(TARGETS): $(DIR)/$1/build.mk Makefile build.mk buildflags.mk
TARGETS:= $$($(DIR)_TMPTARGETS) $$(TARGETS)
......
......@@ -3,8 +3,12 @@ BUILDSYS=@BUILDSYS@
BUILD_CONSOLE=@BUILD_CONSOLE@
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_ETHERCAT=@BUILD_ETHERCAT@
BUILD_VESP=@BUILD_VESP@
BUILD_AM335X=@BUILD_AM335X@
BUILD_TEST=@BUILD_TEST@
......@@ -521,6 +521,8 @@ char *enum_command_ptype2str(enum command_ptype ptype)
return "SPEED";
case COMMAND_PTYPE_SETPOINT_TIME:
return "SETPOINT_TIME";
case COMMAND_PTYPE_SETPOINT_TRACK:
return "SETPOINT_TRACK";
case COMMAND_PTYPE_MAX:
return "MAX";
default:
......
......@@ -35,6 +35,7 @@ enum command_ptype {
COMMAND_PTYPE_SETPOINT = 4, /* Simple direct setpoint */
COMMAND_PTYPE_SPEED = 5, /* Simple direct 1st derivative setpoint */
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! */
};
......
/*
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
This program is free software: you can redistribute it and/or modify
......@@ -226,13 +226,13 @@ static void *log_server(void *arg)
(struct sockaddr *)&sockaddr, sizeof(sockaddr)) < 0) {
perror("bind() failed");
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");
close(fd_accept);
return NULL;
fd_accept = -1;
}
while (1) {
......@@ -247,7 +247,7 @@ static void *log_server(void *arg)
sem_wait(&queue_wait);
}
do {
if (fd_accept >= 0) do {
FD_ZERO(&fdset_r);
FD_SET(fd_accept, &fdset_r);
tv.tv_sec = 0;
......@@ -358,9 +358,6 @@ int log_server_start(int port, enum log_type console_level,
printf("Starting log server on port %d\n", port);
pthread_attr_init(&attr);
#ifndef __FreeBSD__
pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN * 2);
#endif
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])
#
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])
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])
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])
AC_ARG_ENABLE([test],
[AS_HELP_STRING([--disable-test], [Enable/Disable test blocks @<:@yes@:>@])],
[:],
[enable_test=yes])
#######################################################################
#
# Enable/disable console
......@@ -77,9 +83,27 @@ AS_CASE(["$with_libindi"],
[AC_CHECK_LIB(indi,IDLog,[HAVE_LIBINDI=1],[HAVE_LIBINDI=0])]
[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"],
[AC_SUBST(BUILD_CONSOLE_HTTPD,["yes"])],
[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,[""])])
AS_IF([test "$enable_ethercat" = "yes"],
[AC_SUBST(BUILD_ETHERCAT,["yes"])],
[AC_SUBST(BUILD_ETHERCAT,[""])])
......@@ -113,6 +144,9 @@ AS_IF([test "$enable_am335x" = "yes" && test "$HAVE_ARM" = "1"],
[AC_SUBST(BUILD_AM335X,["yes"])],
[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" != ""],
AC_MSG_NOTICE([ console_httpd: yes]),
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" != ""],
AC_MSG_NOTICE([ console_j2000_indi: yes]),
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" != ""],
AC_MSG_NOTICE([ ethercat: yes]),
......@@ -154,3 +195,7 @@ AS_IF([test "$BUILD_VESP" != ""],
AS_IF([test "$BUILD_AM335X" != ""],
AC_MSG_NOTICE([ am335x: yes]),
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
CONSOLE_TARGETS += $(DIR)/console_moontracker
CONSOLE_TARGETS += $(DIR)/trace_proxy
CONSOLE_TARGETS += $(DIR)/trace_log
ifdef BUILD_CONSOLE_J2000
CONSOLE_TARGETS += $(DIR)/console_j2000tracker
CONSOLE_TARGETS += $(DIR)/console_j2000tracer
endif
CONSOLE_TARGETS += $(DIR)/log_proxy
CONSOLE_TARGETS += $(DIR)/spg_auth
CONSOLE_TARGETS += $(DIR)/console_idle
......@@ -22,7 +26,10 @@ CONSOLE_TARGETS += $(DIR)/console_manual
CONSOLE_TARGETS += $(DIR)/console_weather
CONSOLE_TARGETS += $(DIR)/console_dt_model
CONSOLE_TARGETS += $(DIR)/await_controller
ifdef BUILD_CONSOLE_SATTRACKER
CONSOLE_TARGETS += $(DIR)/console_sattracker
endif
ifdef BUILD_CONSOLE_HTTPD
CONSOLE_TARGETS += $(DIR)/console_httpd
......@@ -59,30 +66,26 @@ $(DIR)/command_shell: $(DIR)/command_shell.o
CONSOLE_SRCS += $(DIR)/command_shell.c
$(DIR)/console_moontracker.o: CFLAGS += -Wall -O3
$(DIR)/console_moontracker.o: libnova/libnova.h
$(DIR)/console_moontracker_LDFLAGS += -lcommand -lm -laa
$(DIR)/console_moontracker: libcommand.la libaa.la
$(DIR)/console_moontracker: $(DIR)/console_moontracker.o
CONSOLE_SRCS += $(DIR)/console_moontracker.c
$(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: libcommand.la libtrace.la libnova.la
$(DIR)/console_j2000tracker: libcommand.la libtrace.la
$(DIR)/console_j2000tracker: $(DIR)/console_j2000tracker.o
CONSOLE_SRCS += $(DIR)/console_j2000tracker.c
$(DIR)/console_j2000tracer.o: CFLAGS += -Wall -O3
$(DIR)/console_j2000tracesr.o: libnova/libnova.h
$(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
CONSOLE_SRCS += $(DIR)/console_j2000tracer.c
$(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: libutils.la libnova.la
$(DIR)/console_j2000_indi: libutils.la
$(DIR)/console_j2000_indi: $(DIR)/console_j2000_indi.o
CONSOLE_SRCS += $(DIR)/console_j2000_indi.c
......@@ -147,9 +150,8 @@ $(DIR)/spg_auth: $(DIR)/spg_auth.o
CONSOLE_SRCS += $(DIR)/spg_auth.c
$(DIR)/console_sattracker.o: CFLAGS += -Wall -O3
$(DIR)/console_sattracker.o: libnova/libnova.h
$(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
CONSOLE_SRCS += $(DIR)/console_sattracker.c
......
......@@ -105,6 +105,27 @@ struct ln_hms track_hms;
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)
......@@ -276,7 +297,7 @@ void output(struct status_server *stat_srv)
ln_get_equ_from_hrz (&hrz, &dwingeloo_pos, JD, &equ_pos_prec);
/* Calculate inverse precession */
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_dms(equ_pos.dec, &dms);
......
......@@ -37,9 +37,6 @@
#include <errno.h>
#include <stdbool.h>
#include <libnova/julian_day.h>
#include <libnova/refraction.h>
#include <command/command.h>
#include <aalib/aalib.h>
......@@ -76,14 +73,6 @@ struct compensation_switch compensation_switches[] = {
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)
{
......
......@@ -37,9 +37,6 @@
#include <errno.h>
#include <stdbool.h>
#include <libnova/julian_day.h>
#include <libnova/refraction.h>
#include <command/command.h>
#include <aalib/aalib.h>
......@@ -76,14 +73,6 @@ struct compensation_switch compensation_switches[] = {
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)
{
......
dt_ctrl
*.dot
*.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
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)
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);
if (!map) {
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)
log_send(LOG_T_DEBUG, "am335x: 0x%zx bytes mapped @ 0x%08zx",
size, base);
entry->base = base;
entry->size = size;
entry->map = map;
entry->next = mapped_list;
mapped_list = entry;
......@@ -115,7 +121,7 @@ int am335x_cm_enable(size_t cm_off)
if (reg == AM335X_CM_IDLEST_FUNCTIONAL)
log_send(LOG_T_DEBUG, "am335x: CM 0x%x: state: functional", cm_off);
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)
log_send(LOG_T_DEBUG, "am335x: CM 0x%x: state: idle", cm_off);
if (reg == AM335X_CM_IDLEST_DISABLED)
......@@ -127,3 +133,186 @@ int am335x_cm_enable(size_t cm_off)
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;
}
}
reg = am335x_read32(control_module_base, offset);
am335x_write32(control_module_base, offset, reg | bits);
reg = am335x_read32(control_module_base, offset);
if ((reg & bits) != bits) {
log_send(LOG_T_ERROR,
"am335x: CONTROL_MODULE register 0x%x bits %08x could not be set: %08x",
offset, bits, reg);
return -1;
}
return 0;
}
int am335x_pinmux_debug(size_t offset)
{
uint32_t reg;
if (!control_module_base) {
if (am335x_control_module_init()) {
log_send(LOG_T_ERROR, "am335x: CONTROL_MODULE init failed");
return -1;
}
}
reg = am335x_read32(control_module_base,
offset + AM335X_CONTROL_MODULE_CONF);
log_send(LOG_T_DEBUG, "am335x: pin @0x%x: 0x%08x: %s, %s, %s, mode %d",
offset, reg,
reg & AM335X_CONTROL_MODULE_PINMUX_SLEWCTRL_SLOW ? "slow" : "fast",
reg & AM335X_CONTROL_MODULE_PINMUX_RX ? "input" : "output",
reg & AM335X_CONTROL_MODULE_PINMUX_PUEN ?
(reg & AM335X_CONTROL_MODULE_PINMUX_PU ? "pull-up" : "pull-down") :
"open",
reg & AM335X_CONTROL_MODULE_PINMUX_MODE_MASK);
return 0;
}
int am335x_pinmux_set(size_t offset, unsigned mode, unsigned flags)
{
uint32_t reg, regr;
int ret = 0;
if (!control_module_base) {
if (am335x_control_module_init()) {
log_send(LOG_T_ERROR, "am335x: CONTROL_MODULE init failed");
return -1;
}
}
reg = (mode & AM335X_CONTROL_MODULE_PINMUX_MODE_MASK) | flags;
// log_send(LOG_T_DEBUG, "am335x: mode: %d reg: 0x%08x", mode, reg);
am335x_write32(control_module_base, offset + AM335X_CONTROL_MODULE_CONF,
reg);
regr = am335x_read32(control_module_base, offset + AM335X_CONTROL_MODULE_CONF);
if (regr != reg) {
log_send(LOG_T_ERROR, "am335x: pinmux cannot be set to 0x%08x: 0x%08x",
reg, regr);
ret = -1;
}
am335x_pinmux_debug(offset);
return ret;
}
struct am335x_pinmux_gpio_entry {
int gpio;
int pin;
size_t offset;
};
static struct am335x_pinmux_gpio_entry am335x_pinmux_gpio_table[] = {
{ 0, 2, 0x150 },
{ 0, 3, 0x154 },
{ 0, 4, 0x158 },
{ 0, 5, 0x15c },
{ 0, 7, 0x164 },
{ 0, 8, 0x0d0 },
{ 0, 9, 0x0d4 },
{ 0, 10, 0x0d8 },
{ 0, 11, 0x0dc },
{ 0, 12, 0x178 },
{ 0, 13, 0x17c },
{ 0, 14, 0x180 },
{ 0, 15, 0x184 },
{ 0, 20, 0x1b4 },
{ 0, 22, 0x020 },
{ 0, 23, 0x024 },
{ 0, 26, 0x028 },
{ 0, 27, 0x02c },
{ 0, 30, 0x070 },
{ 0, 31, 0x074 },
{ 1, 0, 0x000 },
{ 1, 1, 0x004 },
{ 1, 2, 0x008 },
{ 1, 3, 0x00c },
{ 1, 4, 0x010 },
{ 1, 5, 0x014 },
{ 1, 6, 0x018 },
{ 1, 7, 0x01c },
{ 1, 12, 0x030 },
{ 1, 13, 0x034 },
{ 1, 14, 0x038 },
{ 1, 15, 0x03c },
{ 1, 16, 0x040 },
{ 1, 17, 0x044 },
{ 1, 18, 0x048 },
{ 1, 19, 0x04c },
{ 1, 29, 0x07c },
{ 1, 30, 0x080 },
{ 1, 31, 0x084 },
{ 2, 1, 0x08c },
{ 2, 2, 0x090 },
{ 2, 3, 0x094 },
{ 2, 4, 0x098 },
{ 2, 5, 0x09c },
{ 2, 6, 0x0a0 },
{ 2, 7, 0x0a4 },
{ 2, 8, 0x0a8 },
{ 2, 9, 0x0ac },
{ 2, 10, 0x0b0 },
{ 2, 11, 0x0b4 },
{ 2, 12, 0x0b8 },
{ 2, 13, 0x0bc },
{ 2, 14, 0x0c0 },
{ 2, 15, 0x0c4 },
{ 2, 16, 0x0c8 },
{ 2, 17, 0x0cc },
{ 2, 22, 0x0e0 },
{ 2, 23, 0x0e4 },
{ 2, 24, 0x0e8 },
{ 2, 25, 0x0ec },
{ 3, 14, 0x190 },
{ 3, 15, 0x194 },
{ 3, 16, 0x198 },
{ 3, 17, 0x19c },
{ 3, 18, 0x1a0 },
{ 3, 19, 0x1a4 },
{ 3, 20, 0x1a8 },
{ 3, 21, 0x1ac },
};
int am335x_pinmux_gpio_offset(int gpio, int pin, size_t *offset)
{
int ret = -1;
int i;
for (i = 0; i < sizeof(am335x_pinmux_gpio_table)/sizeof(struct am335x_pinmux_gpio_entry); i++) {
if (am335x_pinmux_gpio_table[i].gpio == gpio &&
am335x_pinmux_gpio_table[i].pin == pin) {
*offset = am335x_pinmux_gpio_table[i].offset;
ret = 0;
break;
}
}
return ret;
}
/*
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
it under the terms of the GNU General Public License as published by
......@@ -38,11 +38,42 @@
#define AM335X_CM_MODULEMODE_DISABLE 0x00000000
#define AM335X_CM_MODULEMODE_ENABLE 0x00000002
#define AM335X_CM_PER_L4LS_CLKCTRL 0x00000060
#define AM335X_CM_PER_GPIO1_CLKCTRL 0x000000ac
#define AM335X_CM_PER_GPIO2_CLKCTRL 0x000000b0
#define AM335X_CM_PER_GPIO3_CLKCTRL 0x000000b4
#define AM335X_CM_PER_EPWMSS1_CLKCTRL 0x000000cc
#define AM335X_CM_PER_EPWMSS0_CLKCTRL 0x000000d4