Compare commits
6 Commits
bcm2835-1.
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
87dc810e14
|
|||
|
22fe7980d5
|
|||
|
07ea18bf14
|
|||
|
20153a0a4c
|
|||
|
7a33a8f6ca
|
|||
|
e67bfc7c44
|
@@ -1,5 +1,8 @@
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
SUBDIRS = src doc
|
||||
SUBDIRS = src
|
||||
if HAVE_DOCS
|
||||
SUBDIRS += doc
|
||||
endif
|
||||
CLEANFILES = *~
|
||||
EXTRA_DIST = examples/blink/blink.c \
|
||||
examples/input/input.c \
|
||||
@@ -11,7 +14,8 @@ examples/i2c/i2c.c \
|
||||
examples/gpio/gpio.c \
|
||||
examples/spiram/spiram_test.c \
|
||||
examples/spiram/spiram.c \
|
||||
examples/spiram/spiram.h
|
||||
examples/spiram/spiram.h \
|
||||
examples/smi/smi.c
|
||||
|
||||
upload:
|
||||
rsync -avz @PACKAGE_TARNAME@-@VERSION@.tar.gz doc/html/ www.airspayce.com:public_html/mikem/@PACKAGE_NAME@
|
||||
|
||||
35
Makefile.in
35
Makefile.in
@@ -1,7 +1,7 @@
|
||||
# Makefile.in generated by automake 1.16.1 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.16.5 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -85,6 +85,7 @@ POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
@HAVE_DOCS_TRUE@am__append_1 = doc
|
||||
subdir = .
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
||||
@@ -133,8 +134,8 @@ am__recursive_targets = \
|
||||
$(am__extra_recursive_targets)
|
||||
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
|
||||
cscope distdir distdir-am dist dist-all distcheck
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
|
||||
$(LISP)config.h.in
|
||||
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \
|
||||
config.h.in
|
||||
# Read a list of newline-separated strings from the standard input,
|
||||
# and print each of them once, without duplicates. Input order is
|
||||
# *not* preserved.
|
||||
@@ -151,10 +152,7 @@ am__define_uniq_tagged_files = \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | $(am__uniquify_input)`
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
CSCOPE = cscope
|
||||
DIST_SUBDIRS = $(SUBDIRS)
|
||||
DIST_SUBDIRS = src doc
|
||||
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in AUTHORS \
|
||||
COPYING ChangeLog INSTALL NEWS README compile config.guess \
|
||||
config.sub depcomp install-sh ltmain.sh missing
|
||||
@@ -196,6 +194,8 @@ am__relativize = \
|
||||
DIST_ARCHIVES = $(distdir).tar.gz
|
||||
GZIP_ENV = --best
|
||||
DIST_TARGETS = dist-gzip
|
||||
# Exists only to be overridden by the user if desired.
|
||||
AM_DISTCHECK_DVI_TARGET = dvi
|
||||
distuninstallcheck_listfiles = find . -type f -print
|
||||
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
|
||||
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
|
||||
@@ -211,6 +211,8 @@ CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CSCOPE = @CSCOPE@
|
||||
CTAGS = @CTAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
@@ -218,6 +220,7 @@ DOXYGEN = @DOXYGEN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
ETAGS = @ETAGS@
|
||||
EXEEXT = @EXEEXT@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
@@ -288,7 +291,7 @@ top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
SUBDIRS = src doc
|
||||
SUBDIRS = src $(am__append_1)
|
||||
CLEANFILES = *~
|
||||
EXTRA_DIST = examples/blink/blink.c \
|
||||
examples/input/input.c \
|
||||
@@ -300,7 +303,8 @@ examples/i2c/i2c.c \
|
||||
examples/gpio/gpio.c \
|
||||
examples/spiram/spiram_test.c \
|
||||
examples/spiram/spiram.c \
|
||||
examples/spiram/spiram.h
|
||||
examples/spiram/spiram.h \
|
||||
examples/smi/smi.c
|
||||
|
||||
all: config.h
|
||||
$(MAKE) $(AM_MAKEFLAGS) all-recursive
|
||||
@@ -460,7 +464,6 @@ cscopelist-am: $(am__tagged_files)
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
|
||||
|
||||
distdir: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
@@ -544,6 +547,10 @@ dist-xz: distdir
|
||||
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-zstd: distdir
|
||||
tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst
|
||||
$(am__post_remove_distdir)
|
||||
|
||||
dist-tarZ: distdir
|
||||
@echo WARNING: "Support for distribution archives compressed with" \
|
||||
"legacy program 'compress' is deprecated." >&2
|
||||
@@ -586,6 +593,8 @@ distcheck: dist
|
||||
eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\
|
||||
*.zip*) \
|
||||
unzip $(distdir).zip ;;\
|
||||
*.tar.zst*) \
|
||||
zstd -dc $(distdir).tar.zst | $(am__untar) ;;\
|
||||
esac
|
||||
chmod -R a-w $(distdir)
|
||||
chmod u+w $(distdir)
|
||||
@@ -601,7 +610,7 @@ distcheck: dist
|
||||
$(DISTCHECK_CONFIGURE_FLAGS) \
|
||||
--srcdir=../.. --prefix="$$dc_install_base" \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
||||
@@ -763,7 +772,7 @@ uninstall-am:
|
||||
am--refresh check check-am clean clean-cscope clean-generic \
|
||||
cscope cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \
|
||||
dist-gzip dist-lzip dist-shar dist-tarZ dist-xz dist-zip \
|
||||
distcheck distclean distclean-generic distclean-hdr \
|
||||
dist-zstd distcheck distclean distclean-generic distclean-hdr \
|
||||
distclean-tags distcleancheck distdir distuninstallcheck dvi \
|
||||
dvi-am html html-am info info-am install install-am \
|
||||
install-data install-data-am install-dvi install-dvi-am \
|
||||
|
||||
110
aclocal.m4
vendored
110
aclocal.m4
vendored
@@ -1,6 +1,6 @@
|
||||
# generated automatically by aclocal 1.16.1 -*- Autoconf -*-
|
||||
# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
|
||||
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -14,13 +14,13 @@
|
||||
m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])])
|
||||
m4_ifndef([AC_AUTOCONF_VERSION],
|
||||
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
|
||||
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
|
||||
[m4_warning([this file was generated for autoconf 2.69.
|
||||
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],,
|
||||
[m4_warning([this file was generated for autoconf 2.71.
|
||||
You have another version of autoconf. It may work, but is not guaranteed to.
|
||||
If you have problems, you may need to regenerate the build system entirely.
|
||||
To do so, use the procedure documented by the package, typically 'autoreconf'.])])
|
||||
|
||||
# Copyright (C) 2002-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2002-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -35,7 +35,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
|
||||
[am__api_version='1.16'
|
||||
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
|
||||
dnl require some minimum version. Point them to the right macro.
|
||||
m4_if([$1], [1.16.1], [],
|
||||
m4_if([$1], [1.16.5], [],
|
||||
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
|
||||
])
|
||||
|
||||
@@ -51,14 +51,14 @@ m4_define([_AM_AUTOCONF_VERSION], [])
|
||||
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
|
||||
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
|
||||
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
|
||||
[AM_AUTOMAKE_VERSION([1.16.1])dnl
|
||||
[AM_AUTOMAKE_VERSION([1.16.5])dnl
|
||||
m4_ifndef([AC_AUTOCONF_VERSION],
|
||||
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
|
||||
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
|
||||
|
||||
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -110,7 +110,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd`
|
||||
|
||||
# AM_COND_IF -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2008-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2008-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -147,7 +147,7 @@ fi[]dnl
|
||||
|
||||
# AM_CONDITIONAL -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1997-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -178,7 +178,7 @@ AC_CONFIG_COMMANDS_PRE(
|
||||
Usually this means the macro was only invoked conditionally.]])
|
||||
fi])])
|
||||
|
||||
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -369,7 +369,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl
|
||||
|
||||
# Generate code to set up dependency tracking. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -408,7 +408,9 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
done
|
||||
if test $am_rc -ne 0; then
|
||||
AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments
|
||||
for automatic dependency tracking. Try re-running configure with the
|
||||
for automatic dependency tracking. If GNU make was not used, consider
|
||||
re-running the configure script with MAKE="gmake" (or whatever is
|
||||
necessary). You can also try re-running configure with the
|
||||
'--disable-dependency-tracking' option to at least be able to build
|
||||
the package (albeit without support for automatic dependency tracking).])
|
||||
fi
|
||||
@@ -435,7 +437,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
|
||||
# Do all the work for Automake. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -463,6 +465,10 @@ m4_defn([AC_PROG_CC])
|
||||
# release and drop the old call support.
|
||||
AC_DEFUN([AM_INIT_AUTOMAKE],
|
||||
[AC_PREREQ([2.65])dnl
|
||||
m4_ifdef([_$0_ALREADY_INIT],
|
||||
[m4_fatal([$0 expanded multiple times
|
||||
]m4_defn([_$0_ALREADY_INIT]))],
|
||||
[m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
|
||||
dnl Autoconf wants to disallow AM_ names. We explicitly allow
|
||||
dnl the ones we care about.
|
||||
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
|
||||
@@ -499,7 +505,7 @@ m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
|
||||
[_AM_SET_OPTIONS([$1])dnl
|
||||
dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
|
||||
m4_if(
|
||||
m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
|
||||
m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]),
|
||||
[ok:ok],,
|
||||
[m4_fatal([AC_INIT should be called with package and version arguments])])dnl
|
||||
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
|
||||
@@ -551,6 +557,20 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
|
||||
[m4_define([AC_PROG_OBJCXX],
|
||||
m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
|
||||
])
|
||||
# Variables for tags utilities; see am/tags.am
|
||||
if test -z "$CTAGS"; then
|
||||
CTAGS=ctags
|
||||
fi
|
||||
AC_SUBST([CTAGS])
|
||||
if test -z "$ETAGS"; then
|
||||
ETAGS=etags
|
||||
fi
|
||||
AC_SUBST([ETAGS])
|
||||
if test -z "$CSCOPE"; then
|
||||
CSCOPE=cscope
|
||||
fi
|
||||
AC_SUBST([CSCOPE])
|
||||
|
||||
AC_REQUIRE([AM_SILENT_RULES])dnl
|
||||
dnl The testsuite driver may need to know about EXEEXT, so add the
|
||||
dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This
|
||||
@@ -632,7 +652,7 @@ for _am_header in $config_headers :; do
|
||||
done
|
||||
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
|
||||
|
||||
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -653,7 +673,7 @@ if test x"${install_sh+set}" != xset; then
|
||||
fi
|
||||
AC_SUBST([install_sh])])
|
||||
|
||||
# Copyright (C) 2003-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2003-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -674,7 +694,7 @@ AC_SUBST([am__leading_dot])])
|
||||
|
||||
# Check to see how 'make' treats includes. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -717,7 +737,7 @@ AC_SUBST([am__quote])])
|
||||
|
||||
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1997-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -738,12 +758,7 @@ AC_DEFUN([AM_MISSING_HAS_RUN],
|
||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
AC_REQUIRE_AUX_FILE([missing])dnl
|
||||
if test x"${MISSING+set}" != xset; then
|
||||
case $am_aux_dir in
|
||||
*\ * | *\ *)
|
||||
MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
|
||||
*)
|
||||
MISSING="\${SHELL} $am_aux_dir/missing" ;;
|
||||
esac
|
||||
MISSING="\${SHELL} '$am_aux_dir/missing'"
|
||||
fi
|
||||
# Use eval to expand $SHELL
|
||||
if eval "$MISSING --is-lightweight"; then
|
||||
@@ -754,38 +769,9 @@ else
|
||||
fi
|
||||
])
|
||||
|
||||
# -*- Autoconf -*-
|
||||
# Obsolete and "removed" macros, that must however still report explicit
|
||||
# error messages when used, to smooth transition.
|
||||
#
|
||||
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
AC_DEFUN([AM_CONFIG_HEADER],
|
||||
[AC_DIAGNOSE([obsolete],
|
||||
['$0': this macro is obsolete.
|
||||
You should use the 'AC][_CONFIG_HEADERS' macro instead.])dnl
|
||||
AC_CONFIG_HEADERS($@)])
|
||||
|
||||
AC_DEFUN([AM_PROG_CC_STDC],
|
||||
[AC_PROG_CC
|
||||
am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc
|
||||
AC_DIAGNOSE([obsolete],
|
||||
['$0': this macro is obsolete.
|
||||
You should simply use the 'AC][_PROG_CC' macro instead.
|
||||
Also, your code should no longer depend upon 'am_cv_prog_cc_stdc',
|
||||
but upon 'ac_cv_prog_cc_stdc'.])])
|
||||
|
||||
AC_DEFUN([AM_C_PROTOTYPES],
|
||||
[AC_FATAL([automatic de-ANSI-fication support has been removed])])
|
||||
AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES])
|
||||
|
||||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -814,7 +800,7 @@ AC_DEFUN([_AM_SET_OPTIONS],
|
||||
AC_DEFUN([_AM_IF_OPTION],
|
||||
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
|
||||
|
||||
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -861,7 +847,7 @@ AC_LANG_POP([C])])
|
||||
# For backward compatibility.
|
||||
AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])])
|
||||
|
||||
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -880,7 +866,7 @@ AC_DEFUN([AM_RUN_LOG],
|
||||
|
||||
# Check to make sure that the build environment is sane. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -961,7 +947,7 @@ AC_CONFIG_COMMANDS_PRE(
|
||||
rm -f conftest.file
|
||||
])
|
||||
|
||||
# Copyright (C) 2009-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2009-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -1021,7 +1007,7 @@ AC_SUBST([AM_BACKSLASH])dnl
|
||||
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
|
||||
])
|
||||
|
||||
# Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2001-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -1049,7 +1035,7 @@ fi
|
||||
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
|
||||
AC_SUBST([INSTALL_STRIP_PROGRAM])])
|
||||
|
||||
# Copyright (C) 2006-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2006-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -1068,7 +1054,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
|
||||
|
||||
# Check how to create a tarball. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2004-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2004-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
|
||||
6
compile
6
compile
@@ -3,7 +3,7 @@
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
@@ -53,7 +53,7 @@ func_file_conv ()
|
||||
MINGW*)
|
||||
file_conv=mingw
|
||||
;;
|
||||
CYGWIN*)
|
||||
CYGWIN* | MSYS*)
|
||||
file_conv=cygwin
|
||||
;;
|
||||
*)
|
||||
@@ -67,7 +67,7 @@ func_file_conv ()
|
||||
mingw/*)
|
||||
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
||||
;;
|
||||
cygwin/*)
|
||||
cygwin/* | msys/*)
|
||||
file=`cygpath -m "$file" || echo "$file"`
|
||||
;;
|
||||
wine/*)
|
||||
|
||||
22
configure.ac
22
configure.ac
@@ -6,18 +6,28 @@ dnl (C) 2012 Mike McCauley (mikem@airspayce.com)
|
||||
|
||||
dnl Dont forget to update BCM2835_VERSION and .tar.gz in bcm2835.h
|
||||
dnl and the zip file.
|
||||
AC_INIT([bcm2835], [1.71], [mikem@airspayce.com])
|
||||
AC_INIT([bcm2835], [1.75], [mikem@airspayce.com])
|
||||
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AC_CONFIG_HEADERS(config.h:config.h.in)
|
||||
AM_INIT_AUTOMAKE()
|
||||
AC_CHECK_LIB([rt], [clock_gettime])
|
||||
AC_CHECK_PROGS([DOXYGEN], [doxygen])
|
||||
if test -z "$DOXYGEN";
|
||||
then AC_MSG_WARN([Doxygen not found - continuing without Doxygen support])
|
||||
AC_MSG_CHECKING([for docs])
|
||||
AC_ARG_WITH([docs],
|
||||
[AS_HELP_STRING([--with-docs], [generate doxygen docs (default yes)])],
|
||||
[with_docs=$withval],
|
||||
[with_docs=yes])
|
||||
AC_MSG_RESULT([$with_docs])
|
||||
AM_CONDITIONAL([HAVE_DOCS], [test "x$with_docs" = "xyes"])
|
||||
if test "x$with_docs" = "xyes" ; then
|
||||
AC_CHECK_PROGS([DOXYGEN], [doxygen])
|
||||
if test -z "$DOXYGEN";
|
||||
then AC_MSG_WARN([Doxygen not found - continuing without Doxygen support])
|
||||
fi
|
||||
fi
|
||||
AC_PROG_RANLIB
|
||||
AC_PROG_CC
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"])
|
||||
AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([doc/Doxyfile])])
|
||||
AC_OUTPUT(Makefile src/Makefile doc/Makefile)
|
||||
AC_CONFIG_FILES(Makefile src/Makefile doc/Makefile)
|
||||
AC_OUTPUT
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Makefile.in generated by automake 1.16.1 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.16.5 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -128,6 +128,8 @@ CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CSCOPE = @CSCOPE@
|
||||
CTAGS = @CTAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
@@ -135,6 +137,7 @@ DOXYGEN = @DOXYGEN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
ETAGS = @ETAGS@
|
||||
EXEEXT = @EXEEXT@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
@@ -245,7 +248,6 @@ ctags CTAGS:
|
||||
|
||||
cscope cscopelist:
|
||||
|
||||
|
||||
distdir: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
|
||||
82
examples/smi/smi.c
Normal file
82
examples/smi/smi.c
Normal file
@@ -0,0 +1,82 @@
|
||||
// smi.c
|
||||
//
|
||||
// Example program for bcm2835 library
|
||||
// Shows how to send and receive a byte over SMI bus
|
||||
//
|
||||
// A CodeBlocks project is provided for easier tests
|
||||
//
|
||||
// After installing bcm2835, you can build this
|
||||
// with something like:
|
||||
// gcc -o smi smi.c -l bcm2835
|
||||
// sudo ./smi
|
||||
//
|
||||
// Or you can test it before installing with:
|
||||
// gcc -o smi -I ../../src ../../src/bcm2835.c smi.c
|
||||
// sudo ./smi
|
||||
//
|
||||
// This test program must be run with root rights !!
|
||||
// From terminal, use sudo ./smi
|
||||
//
|
||||
// Author: Benoit BOUCHEZ (BEB)
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "bcm2835.h"
|
||||
|
||||
#define SMI_CHANNEL 0
|
||||
|
||||
// Number of SMI clock cycles for each SMI transaction phase
|
||||
#define SMI_SETUP_CLOCKS 10 // setup time = 80ns
|
||||
#define SMI_STROBE_CLOCKS 20 // strobe time = 160ns
|
||||
#define SMI_HOLD_CLOCKS 20 // hold time = 160ns
|
||||
#define SMI_PACE_CLOCKS 1 // pace time = 8ns
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int Address=0;
|
||||
int WriteData;
|
||||
uint8_t ReadData[16];
|
||||
|
||||
if (!bcm2835_init())
|
||||
{
|
||||
printf("bcm2835_init() failed. Are you running as root??\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!bcm2835_smi_begin())
|
||||
{
|
||||
printf("bcm2835_smi_begin() failed. Are you running as root??\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// The following test sequence writes 4096 bytes and reads 16 bytes
|
||||
// With default timing parameters, the complete sequence takes 4.6ms
|
||||
// on a RPi 3B (with O3 optimization), giving a transfer speed of 894kB/s
|
||||
// A SPI interface would require a 7MHz clock to achieve the same results...
|
||||
|
||||
// Change SMI timing parameters for writing
|
||||
bcm2835_smi_set_timing (SMI_CHANNEL, 0, SMI_SETUP_CLOCKS, SMI_STROBE_CLOCKS, SMI_HOLD_CLOCKS, SMI_PACE_CLOCKS);
|
||||
// Change SMI timing parameters for reading
|
||||
bcm2835_smi_set_timing (SMI_CHANNEL, 1, SMI_SETUP_CLOCKS, SMI_STROBE_CLOCKS, SMI_HOLD_CLOCKS, SMI_PACE_CLOCKS);
|
||||
|
||||
// Write a sequence of bytes to each possible address
|
||||
for (Address=0; Address<=15; Address++)
|
||||
{
|
||||
for (WriteData=0; WriteData<=255; WriteData++)
|
||||
{
|
||||
bcm2835_smi_write (SMI_CHANNEL, WriteData, Address);
|
||||
}
|
||||
}
|
||||
|
||||
// Read a sequence of bytes at each possible address
|
||||
for (Address=0; Address<=15; Address++)
|
||||
{
|
||||
ReadData[Address] = bcm2835_smi_read (SMI_CHANNEL, Address);
|
||||
}
|
||||
|
||||
// Release GPIO
|
||||
bcm2835_smi_end();
|
||||
bcm2835_close();
|
||||
|
||||
return 0;
|
||||
}
|
||||
BIN
pdf/BCM2835-ARM-Peripherals.pdf
Normal file
BIN
pdf/BCM2835-ARM-Peripherals.pdf
Normal file
Binary file not shown.
BIN
perl/Device-BCM2835-1.9.tar.gz
Normal file
BIN
perl/Device-BCM2835-1.9.tar.gz
Normal file
Binary file not shown.
BIN
perl/Device-BCM2835-1.94.tar.gz
Normal file
BIN
perl/Device-BCM2835-1.94.tar.gz
Normal file
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
# Makefile.in generated by automake 1.16.1 from Makefile.am.
|
||||
# Makefile.in generated by automake 1.16.5 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
|
||||
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
@@ -195,8 +195,6 @@ am__define_uniq_tagged_files = \
|
||||
unique=`for i in $$list; do \
|
||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||
done | $(am__uniquify_input)`
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
am__tty_colors_dummy = \
|
||||
mgn= red= grn= lgn= blu= brg= std=; \
|
||||
am__color_tests=no
|
||||
@@ -352,6 +350,7 @@ am__set_TESTS_bases = \
|
||||
bases='$(TEST_LOGS)'; \
|
||||
bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
|
||||
bases=`echo $$bases`
|
||||
AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)'
|
||||
RECHECK_LOGS = $(TEST_LOGS)
|
||||
AM_RECURSIVE_TARGETS = check recheck
|
||||
TEST_SUITE_LOG = test-suite.log
|
||||
@@ -388,6 +387,8 @@ CC = @CC@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CSCOPE = @CSCOPE@
|
||||
CTAGS = @CTAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
@@ -395,6 +396,7 @@ DOXYGEN = @DOXYGEN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
ETAGS = @ETAGS@
|
||||
EXEEXT = @EXEEXT@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
@@ -757,7 +759,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
|
||||
test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \
|
||||
fi; \
|
||||
echo "$${col}$$br$${std}"; \
|
||||
echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \
|
||||
echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \
|
||||
echo "$${col}$$br$${std}"; \
|
||||
create_testsuite_report --maybe-color; \
|
||||
echo "$$col$$br$$std"; \
|
||||
@@ -812,7 +814,6 @@ test.log: test$(EXEEXT)
|
||||
@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \
|
||||
@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
|
||||
@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT)
|
||||
|
||||
distdir: $(BUILT_SOURCES)
|
||||
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||
|
||||
|
||||
150
src/bcm2835.c
150
src/bcm2835.c
@@ -6,6 +6,8 @@
|
||||
// Author: Mike McCauley
|
||||
// Copyright (C) 2011-2013 Mike McCauley
|
||||
// $Id: bcm2835.c,v 1.28 2020/01/11 05:07:13 mikem Exp mikem $
|
||||
//
|
||||
// S.Peacock: modified bcm2835_i2c_write() to add a fail safe timer.
|
||||
*/
|
||||
|
||||
// Needed to compile with gcc -std=c99, as reported by John Blaiklock.
|
||||
@@ -467,6 +469,7 @@ void bcm2835_gpio_afen(uint8_t pin)
|
||||
uint32_t value = 1 << shift;
|
||||
bcm2835_peri_set_bits(paddr, value, value);
|
||||
}
|
||||
|
||||
void bcm2835_gpio_clr_afen(uint8_t pin)
|
||||
{
|
||||
volatile uint32_t* paddr = bcm2835_gpio + BCM2835_GPAFEN0/4 + pin/32;
|
||||
@@ -478,14 +481,15 @@ void bcm2835_gpio_clr_afen(uint8_t pin)
|
||||
/* Set pullup/down */
|
||||
void bcm2835_gpio_pud(uint8_t pud)
|
||||
{
|
||||
if( pud_type_rpi4 )
|
||||
if (pud_type_rpi4)
|
||||
{
|
||||
pud_compat_setting = pud;
|
||||
}
|
||||
else {
|
||||
volatile uint32_t* paddr = bcm2835_gpio + BCM2835_GPPUD/4;
|
||||
bcm2835_peri_write(paddr, pud);
|
||||
}
|
||||
else
|
||||
{
|
||||
volatile uint32_t* paddr = bcm2835_gpio + BCM2835_GPPUD/4;
|
||||
bcm2835_peri_write(paddr, pud);
|
||||
}
|
||||
}
|
||||
|
||||
/* Pullup/down clock
|
||||
@@ -493,24 +497,24 @@ void bcm2835_gpio_pud(uint8_t pud)
|
||||
*/
|
||||
void bcm2835_gpio_pudclk(uint8_t pin, uint8_t on)
|
||||
{
|
||||
if( pud_type_rpi4 )
|
||||
if (pud_type_rpi4)
|
||||
{
|
||||
if( on )
|
||||
bcm2835_gpio_set_pud( pin, pud_compat_setting);
|
||||
}
|
||||
if (on)
|
||||
bcm2835_gpio_set_pud( pin, pud_compat_setting);
|
||||
}
|
||||
else
|
||||
{
|
||||
volatile uint32_t* paddr = bcm2835_gpio + BCM2835_GPPUDCLK0/4 + pin/32;
|
||||
uint8_t shift = pin % 32;
|
||||
bcm2835_peri_write(paddr, (on ? 1 : 0) << shift);
|
||||
}
|
||||
{
|
||||
volatile uint32_t* paddr = bcm2835_gpio + BCM2835_GPPUDCLK0/4 + pin/32;
|
||||
uint8_t shift = pin % 32;
|
||||
bcm2835_peri_write(paddr, (on ? 1 : 0) << shift);
|
||||
}
|
||||
}
|
||||
|
||||
/* Read GPIO pad behaviour for groups of GPIOs */
|
||||
uint32_t bcm2835_gpio_pad(uint8_t group)
|
||||
{
|
||||
if (bcm2835_pads == MAP_FAILED)
|
||||
return 0;
|
||||
if (bcm2835_pads == MAP_FAILED)
|
||||
return 0;
|
||||
|
||||
volatile uint32_t* paddr = bcm2835_pads + BCM2835_PADS_GPIO_0_27/4 + group;
|
||||
return bcm2835_peri_read(paddr);
|
||||
@@ -522,8 +526,8 @@ uint32_t bcm2835_gpio_pad(uint8_t group)
|
||||
*/
|
||||
void bcm2835_gpio_set_pad(uint8_t group, uint32_t control)
|
||||
{
|
||||
if (bcm2835_pads == MAP_FAILED)
|
||||
return;
|
||||
if (bcm2835_pads == MAP_FAILED)
|
||||
return;
|
||||
|
||||
volatile uint32_t* paddr = bcm2835_pads + BCM2835_PADS_GPIO_0_27/4 + group;
|
||||
bcm2835_peri_write(paddr, control | BCM2835_PAD_PASSWRD);
|
||||
@@ -560,7 +564,7 @@ void bcm2835_delayMicroseconds(uint64_t micros)
|
||||
start = bcm2835_st_read();
|
||||
|
||||
/* Not allowed to access timer registers (result is not as precise)*/
|
||||
if (start==0)
|
||||
if (start == 0)
|
||||
{
|
||||
t1.tv_sec = 0;
|
||||
t1.tv_nsec = 1000 * (long)(micros);
|
||||
@@ -630,7 +634,7 @@ void bcm2835_gpio_write_mask(uint32_t value, uint32_t mask)
|
||||
*/
|
||||
void bcm2835_gpio_set_pud(uint8_t pin, uint8_t pud)
|
||||
{
|
||||
if( pud_type_rpi4 )
|
||||
if (pud_type_rpi4)
|
||||
{
|
||||
int shiftbits = (pin & 0xf) << 1;
|
||||
uint32_t bits;
|
||||
@@ -652,16 +656,16 @@ void bcm2835_gpio_set_pud(uint8_t pin, uint8_t pud)
|
||||
|
||||
bcm2835_peri_write_nb( paddr, bits );
|
||||
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
bcm2835_gpio_pud(pud);
|
||||
delayMicroseconds(10);
|
||||
bcm2835_gpio_pudclk(pin, 1);
|
||||
delayMicroseconds(10);
|
||||
bcm2835_gpio_pud(BCM2835_GPIO_PUD_OFF);
|
||||
bcm2835_gpio_pudclk(pin, 0);
|
||||
}
|
||||
|
||||
bcm2835_gpio_pud(pud);
|
||||
delayMicroseconds(10);
|
||||
bcm2835_gpio_pudclk(pin, 1);
|
||||
delayMicroseconds(10);
|
||||
bcm2835_gpio_pud(BCM2835_GPIO_PUD_OFF);
|
||||
bcm2835_gpio_pudclk(pin, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -669,7 +673,7 @@ uint8_t bcm2835_gpio_get_pud(uint8_t pin)
|
||||
{
|
||||
uint8_t ret = BCM2835_GPIO_PUD_ERROR;
|
||||
|
||||
if( pud_type_rpi4 )
|
||||
if (pud_type_rpi4)
|
||||
{
|
||||
uint32_t bits;
|
||||
volatile uint32_t* paddr = bcm2835_gpio + BCM2835_GPPUPPDN0/4 + (pin >> 4);
|
||||
@@ -748,9 +752,9 @@ void bcm2835_spi_setClockDivider(uint16_t divider)
|
||||
|
||||
void bcm2835_spi_set_speed_hz(uint32_t speed_hz)
|
||||
{
|
||||
uint16_t divider = (uint16_t) ((uint32_t) BCM2835_CORE_CLK_HZ / speed_hz);
|
||||
divider &= 0xFFFE;
|
||||
bcm2835_spi_setClockDivider(divider);
|
||||
uint16_t divider = (uint16_t) ((uint32_t) BCM2835_CORE_CLK_HZ / speed_hz);
|
||||
divider &= 0xFFFE;
|
||||
bcm2835_spi_setClockDivider(divider);
|
||||
}
|
||||
|
||||
void bcm2835_spi_setDataMode(uint8_t mode)
|
||||
@@ -1105,7 +1109,8 @@ void bcm2835_aux_spi_transfernb(const char *tbuf, char *rbuf, uint32_t len) {
|
||||
|
||||
while ((tx_len > 0) || (rx_len > 0)) {
|
||||
|
||||
while (!(bcm2835_peri_read(stat) & BCM2835_AUX_SPI_STAT_TX_FULL) && (tx_len > 0)) {
|
||||
while (!(bcm2835_peri_read(stat) & BCM2835_AUX_SPI_STAT_TX_FULL) && (tx_len > 0) && (tx_len + BCM2835_AUX_SPI_FIFO_SIZE * 3 > rx_len))
|
||||
{
|
||||
count = MIN(tx_len, 3);
|
||||
data = 0;
|
||||
|
||||
@@ -1125,7 +1130,8 @@ void bcm2835_aux_spi_transfernb(const char *tbuf, char *rbuf, uint32_t len) {
|
||||
|
||||
}
|
||||
|
||||
while (!(bcm2835_peri_read(stat) & BCM2835_AUX_SPI_STAT_RX_EMPTY) && (rx_len > 0)) {
|
||||
while (!(bcm2835_peri_read(stat) & BCM2835_AUX_SPI_STAT_RX_EMPTY) && (rx_len > 0))
|
||||
{
|
||||
count = MIN(rx_len, 3);
|
||||
data = bcm2835_peri_read(io);
|
||||
|
||||
@@ -1147,7 +1153,8 @@ void bcm2835_aux_spi_transfernb(const char *tbuf, char *rbuf, uint32_t len) {
|
||||
rx_len -= count;
|
||||
}
|
||||
|
||||
while (!(bcm2835_peri_read(stat) & BCM2835_AUX_SPI_STAT_BUSY) && (rx_len > 0)) {
|
||||
while (!(bcm2835_peri_read(stat) & BCM2835_AUX_SPI_STAT_BUSY) && (rx_len > 0) && (tx_len == 0))
|
||||
{
|
||||
count = MIN(rx_len, 3);
|
||||
data = bcm2835_peri_read(io);
|
||||
|
||||
@@ -1308,10 +1315,12 @@ uint8_t bcm2835_i2c_write(const char * buf, uint32_t len)
|
||||
volatile uint32_t* control = bcm2835_bsc1 + BCM2835_BSC_C/4;
|
||||
#endif
|
||||
|
||||
uint32_t remaining = len;
|
||||
uint32_t i = 0;
|
||||
uint8_t reason = BCM2835_I2C_REASON_OK;
|
||||
|
||||
uint32_t remaining = len;
|
||||
uint32_t i = 0;
|
||||
uint8_t reason = BCM2835_I2C_REASON_OK;
|
||||
unsigned long Failsafe = len * 10000;
|
||||
int Timeout = 0;
|
||||
|
||||
/* Clear FIFO */
|
||||
bcm2835_peri_set_bits(control, BCM2835_BSC_C_CLEAR_1 , BCM2835_BSC_C_CLEAR_1 );
|
||||
/* Clear Status */
|
||||
@@ -1330,29 +1339,45 @@ uint8_t bcm2835_i2c_write(const char * buf, uint32_t len)
|
||||
bcm2835_peri_write(control, BCM2835_BSC_C_I2CEN | BCM2835_BSC_C_ST);
|
||||
|
||||
/* Transfer is over when BCM2835_BSC_S_DONE */
|
||||
while(!(bcm2835_peri_read(status) & BCM2835_BSC_S_DONE ))
|
||||
while(!Timeout && !(bcm2835_peri_read(status) & BCM2835_BSC_S_DONE ))
|
||||
{
|
||||
while ( remaining && (bcm2835_peri_read(status) & BCM2835_BSC_S_TXD ))
|
||||
while (!Timeout && remaining && (bcm2835_peri_read(status) & BCM2835_BSC_S_TXD ))
|
||||
{
|
||||
/* Write to FIFO */
|
||||
bcm2835_peri_write(fifo, buf[i]);
|
||||
i++;
|
||||
remaining--;
|
||||
/* Make sure we don't loop forever! */
|
||||
if (--Failsafe == 0)
|
||||
{
|
||||
Timeout = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* Make sure we don't loop forever! */
|
||||
if (--Failsafe == 0)
|
||||
{
|
||||
Timeout = 1;
|
||||
break;
|
||||
}
|
||||
/* printf("Failsafe %d %d\n", len, (len * 1000) - Failsafe); */
|
||||
}
|
||||
|
||||
/* Received a NACK */
|
||||
if (bcm2835_peri_read(status) & BCM2835_BSC_S_ERR)
|
||||
if (Timeout)
|
||||
{
|
||||
/* We had a timeout */
|
||||
reason = BCM2835_I2C_REASON_ERROR_TIMEOUT;
|
||||
}
|
||||
else if (bcm2835_peri_read(status) & BCM2835_BSC_S_ERR)
|
||||
{
|
||||
/* Received a NACK */
|
||||
reason = BCM2835_I2C_REASON_ERROR_NACK;
|
||||
}
|
||||
|
||||
/* Received Clock Stretch Timeout */
|
||||
else if (bcm2835_peri_read(status) & BCM2835_BSC_S_CLKT)
|
||||
{
|
||||
reason = BCM2835_I2C_REASON_ERROR_CLKT;
|
||||
}
|
||||
|
||||
/* Not all data is sent */
|
||||
else if (remaining)
|
||||
{
|
||||
@@ -2066,9 +2091,8 @@ int bcm2835_init(void)
|
||||
* the fact that we can only access GPIO
|
||||
* else try for the /dev/mem interface and get access to everything
|
||||
*/
|
||||
memfd = -1;
|
||||
ok = 0;
|
||||
if (geteuid() == 0
|
||||
if ( geteuid() == 0
|
||||
#ifdef BCM2835_HAVE_LIBCAP
|
||||
|| bcm2835_has_capability(CAP_SYS_RAWIO)
|
||||
#endif
|
||||
@@ -2076,11 +2100,11 @@ int bcm2835_init(void)
|
||||
{
|
||||
/* Open the master /dev/mem device */
|
||||
if ((memfd = open("/dev/mem", O_RDWR | O_SYNC) ) < 0)
|
||||
{
|
||||
{
|
||||
fprintf(stderr, "bcm2835_init: Unable to open /dev/mem: %s\n",
|
||||
strerror(errno)) ;
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
/* Base of the peripherals block is mapped to VM */
|
||||
bcm2835_peripherals = mapmem("gpio", bcm2835_peripherals_size, memfd, bcm2835_peripherals_base);
|
||||
@@ -2108,21 +2132,21 @@ int bcm2835_init(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Not root, try /dev/gpiomem */
|
||||
/* Open the master /dev/mem device */
|
||||
if ((memfd = open("/dev/gpiomem", O_RDWR | O_SYNC) ) < 0)
|
||||
/* Not root, try /dev/gpiomem */
|
||||
/* Open the master /dev/mem device */
|
||||
if ((memfd = open("/dev/gpiomem", O_RDWR | O_SYNC) ) < 0)
|
||||
{
|
||||
fprintf(stderr, "bcm2835_init: Unable to open /dev/gpiomem: %s\n",
|
||||
strerror(errno)) ;
|
||||
goto exit;
|
||||
fprintf(stderr, "bcm2835_init: Unable to open /dev/gpiomem: %s\n",
|
||||
strerror(errno)) ;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* Base of the peripherals block is mapped to VM */
|
||||
bcm2835_peripherals_base = 0;
|
||||
bcm2835_peripherals = mapmem("gpio", bcm2835_peripherals_size, memfd, bcm2835_peripherals_base);
|
||||
if (bcm2835_peripherals == MAP_FAILED) goto exit;
|
||||
bcm2835_gpio = bcm2835_peripherals;
|
||||
ok = 1;
|
||||
|
||||
/* Base of the peripherals block is mapped to VM */
|
||||
bcm2835_peripherals_base = 0;
|
||||
bcm2835_peripherals = mapmem("gpio", bcm2835_peripherals_size, memfd, bcm2835_peripherals_base);
|
||||
if (bcm2835_peripherals == MAP_FAILED) goto exit;
|
||||
bcm2835_gpio = bcm2835_peripherals;
|
||||
ok = 1;
|
||||
}
|
||||
|
||||
exit:
|
||||
|
||||
@@ -20,13 +20,14 @@
|
||||
|
||||
Works on all versions up to and including RPI 4.
|
||||
Works with all versions of Debian up to and including Debian Buster 10.
|
||||
Reported to be working on Bullseye (Raspbian v11)
|
||||
|
||||
It is C++ compatible, and installs as a header file and non-shared library on
|
||||
any Linux-based distro (but clearly is no use except on Raspberry Pi or another board with
|
||||
BCM 2835).
|
||||
|
||||
The version of the package that this documentation refers to can be downloaded
|
||||
from http://www.airspayce.com/mikem/bcm2835/bcm2835-1.71.tar.gz
|
||||
from http://www.airspayce.com/mikem/bcm2835/bcm2835-1.75.tar.gz
|
||||
You can find the latest version at http://www.airspayce.com/mikem/bcm2835
|
||||
|
||||
Several example programs are provided.
|
||||
@@ -217,6 +218,15 @@
|
||||
- P1-40 (CLK)
|
||||
- P1-36 (CE2)
|
||||
|
||||
Caution: The bcm2835 library works directly on the SPI/I2C devices. It is not using
|
||||
any Linux device drivers. When relevant Linux drivers are loaded or
|
||||
activated then it can create unexpected behavior from other software like
|
||||
'i2cdetect'.
|
||||
|
||||
Here is a simple utility which detects I2C bus devices with the bcm2835
|
||||
library.
|
||||
https://github.com/gavinlyonsrepo/RPI_Tools/tree/main/src/i2cdetect
|
||||
|
||||
\par I2C Pins
|
||||
|
||||
The bcm2835_i2c_* functions allow you to control the BCM 2835 BSC interface,
|
||||
@@ -612,12 +622,30 @@
|
||||
Patch to ensure compilation with gcc -std=c99, as reported by John Blaiklock.
|
||||
Fix some inconsistencies in version numbers
|
||||
|
||||
version 1.71
|
||||
\version 1.71
|
||||
Added SMI bus support, courtesy of Benoit Bouchez, including new functions:
|
||||
bcm2835_smi_begin(), bcm2835_smi_end(),
|
||||
bcm2835_smi_set_timing(), bcm2835_smi_write(), bcm2835_smi_read().
|
||||
|
||||
\author Mike McCauley (mikem@airspayce.com) DO NOT CONTACT THE AUTHOR DIRECTLY: USE THE LISTS
|
||||
\version 1.72
|
||||
Added examples/smi/smi.c showing how to use new SMI bus support, courtesy Benoit Bouchez.
|
||||
Added support for disabling documentation genetration with "./configure --with-docs=no", courtesy of
|
||||
Christian Zuckschwerdt.
|
||||
|
||||
\version 1.73
|
||||
Fixed some inconsistent indenting in bcm2835.c that triggers warnings for some people.
|
||||
Added Timeout checks to bcm2835_i2c_write() in case of IO problems. New reason cade BCM2835_I2C_REASON_ERROR_TIMEOUT
|
||||
added. Patch courtesy Simon Peacock.
|
||||
|
||||
\version 1.74
|
||||
Timeout in bcm2835_i2c_write() increased by a factor of 10 because some users have reported spurious timeouts at slow speeds.
|
||||
|
||||
\version 1.75
|
||||
Patches to bcm2835_aux_spi_transfernb() from Sean Goff to deal with the case where
|
||||
the process is interrupted between filling the TX FIFO and reading the RX FIFO.
|
||||
|
||||
|
||||
\author Mike McCauley DO NOT CONTACT THE AUTHOR DIRECTLY: USE THE LISTS
|
||||
*/
|
||||
|
||||
|
||||
@@ -632,7 +660,7 @@
|
||||
/* Needed to compile with gcc -std=c99, as reported by John Blaiklock.*/
|
||||
#include <fcntl.h>
|
||||
|
||||
#define BCM2835_VERSION 10071 /* Version 1.71 */
|
||||
#define BCM2835_VERSION 10075 /* Version 1.75 */
|
||||
|
||||
// Define this if you want to use libcap2 to determine if you have the cap_sys_rawio capability
|
||||
// and therefore the capability of opening /dev/mem, even if you are not root.
|
||||
@@ -1203,6 +1231,7 @@ typedef enum
|
||||
#define BCM2835_BSC_S_TA 0x00000001 /*!< Transfer Active */
|
||||
|
||||
#define BCM2835_BSC_FIFO_SIZE 16 /*!< BSC FIFO size */
|
||||
#define BCM2835_AUX_SPI_FIFO_SIZE 4
|
||||
|
||||
/*! \brief bcm2835I2CClockDivider
|
||||
Specifies the divider used to generate the I2C clock from the system clock.
|
||||
@@ -1224,7 +1253,9 @@ typedef enum
|
||||
BCM2835_I2C_REASON_OK = 0x00, /*!< Success */
|
||||
BCM2835_I2C_REASON_ERROR_NACK = 0x01, /*!< Received a NACK */
|
||||
BCM2835_I2C_REASON_ERROR_CLKT = 0x02, /*!< Received Clock Stretch Timeout */
|
||||
BCM2835_I2C_REASON_ERROR_DATA = 0x04 /*!< Not all data is sent / received */
|
||||
BCM2835_I2C_REASON_ERROR_DATA = 0x04, /*!< Not all data is sent / received */
|
||||
BCM2835_I2C_REASON_ERROR_TIMEOUT = 0x08 /*!< Time out occurred during sending */
|
||||
|
||||
} bcm2835I2CReasonCodes;
|
||||
|
||||
/* Registers offets from BCM2835_SMI_BASE */
|
||||
@@ -2186,3 +2217,7 @@ Broadcom bcm2835. Contributed by Shahrooz Shahparnia.
|
||||
Shows how to use the included little library (spiram.c and spiram.h)
|
||||
to read and write SPI RAM chips such as 23K256-I/P
|
||||
*/
|
||||
|
||||
/*! example smi.c
|
||||
Shows how to use the SMI bus calls. Courtesy Benoit Bouchez.
|
||||
*/
|
||||
|
||||
19
test-driver
19
test-driver
@@ -3,7 +3,7 @@
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 2011-2018 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2011-2021 Free Software Foundation, Inc.
|
||||
#
|
||||
# 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
|
||||
@@ -42,11 +42,13 @@ print_usage ()
|
||||
{
|
||||
cat <<END
|
||||
Usage:
|
||||
test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
|
||||
[--expect-failure={yes|no}] [--color-tests={yes|no}]
|
||||
[--enable-hard-errors={yes|no}] [--]
|
||||
test-driver --test-name NAME --log-file PATH --trs-file PATH
|
||||
[--expect-failure {yes|no}] [--color-tests {yes|no}]
|
||||
[--enable-hard-errors {yes|no}] [--]
|
||||
TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS]
|
||||
|
||||
The '--test-name', '--log-file' and '--trs-file' options are mandatory.
|
||||
See the GNU Automake documentation for information.
|
||||
END
|
||||
}
|
||||
|
||||
@@ -103,8 +105,11 @@ trap "st=130; $do_exit" 2
|
||||
trap "st=141; $do_exit" 13
|
||||
trap "st=143; $do_exit" 15
|
||||
|
||||
# Test script is run here.
|
||||
"$@" >$log_file 2>&1
|
||||
# Test script is run here. We create the file first, then append to it,
|
||||
# to ameliorate tests themselves also writing to the log file. Our tests
|
||||
# don't, but others can (automake bug#35762).
|
||||
: >"$log_file"
|
||||
"$@" >>"$log_file" 2>&1
|
||||
estatus=$?
|
||||
|
||||
if test $enable_hard_errors = no && test $estatus -eq 99; then
|
||||
@@ -126,7 +131,7 @@ esac
|
||||
# know whether the test passed or failed simply by looking at the '.log'
|
||||
# file, without the need of also peaking into the corresponding '.trs'
|
||||
# file (automake bug#11814).
|
||||
echo "$res $test_name (exit status: $estatus)" >>$log_file
|
||||
echo "$res $test_name (exit status: $estatus)" >>"$log_file"
|
||||
|
||||
# Report outcome to console.
|
||||
echo "${col}${res}${std}: $test_name"
|
||||
|
||||
Reference in New Issue
Block a user