/* * source.c * * Created on: Mar 30, 2020 * Author: Andy Fung */ //############################################################################# // // FILE: driverlib.h // // TITLE: C28x Driverlib Header File // //############################################################################# // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //############################################################################# //########################################################################### // // FILE: hw_memmap.h // // TITLE: Macros defining the memory map of the C28x. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the base address of the memories and // peripherals. // //***************************************************************************** //########################################################################### // // FILE: adc.h // // TITLE: C28x ADC driver. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup adc_api ADC //! @{ // //***************************************************************************** /* * Copyright (c) 2000 Jeroen Ruigrok van der Werven * All rights reserved. * * Copyright (c) 2014-2014 Texas Instruments Incorporated * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD: release/10.0.0/include/stdbool.h 228878 2011-12-25 20:15:41Z ed $ */ /*****************************************************************************/ /* STDINT.H */ /* */ /* Copyright (c) 2002 Texas Instruments Incorporated */ /* http://www.ti.com/ */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions */ /* are met: */ /* */ /* Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* */ /* Redistributions in binary form must reproduce the above copyright */ /* notice, this list of conditions and the following disclaimer in */ /* the documentation and/or other materials provided with the */ /* distribution. */ /* */ /* Neither the name of Texas Instruments Incorporated nor the names */ /* of its contributors may be used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */ /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */ /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */ /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */ /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */ /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /*****************************************************************************/ /*****************************************************************************/ /* _STDINT40.H */ /* */ /* Copyright (c) 2018 Texas Instruments Incorporated */ /* http://www.ti.com/ */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions */ /* are met: */ /* */ /* Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* */ /* Redistributions in binary form must reproduce the above copyright */ /* notice, this list of conditions and the following disclaimer in */ /* the documentation and/or other materials provided with the */ /* distribution. */ /* */ /* Neither the name of Texas Instruments Incorporated nor the names */ /* of its contributors may be used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */ /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */ /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */ /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */ /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */ /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /*****************************************************************************/ /* According to footnotes in the 1999 C standard, "C++ implementations should define these macros only when __STDC_LIMIT_MACROS is defined before is included." */ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2001 Mike Barcroft * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ /*- * SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Berkeley Software Design, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)cdefs.h 8.8 (Berkeley) 1/9/95 * $FreeBSD$ */ #pragma diag_push #pragma CHECK_MISRA("none") /* * Testing against Clang-specific extensions. */ /* * This code has been put in place to help reduce the addition of * compiler specific defines in FreeBSD code. It helps to aid in * having a compiler-agnostic source tree. */ /* * Macro to test if we're using a specific version of gcc or later. */ /* * The __CONCAT macro is used to concatenate parts of symbol names, e.g. * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. * The __CONCAT macro is a bit tricky to use if it must work in non-ANSI * mode -- there must be no spaces between its arguments, and for nested * __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also * concatenate double-quoted strings produced by the __STRING macro, but * this only works with ANSI C. * * __XSTRING is like __STRING, but it expands any macros in its argument * first. It is only available with ANSI C. */ /* * Compiler-dependent macros to help declare dead (non-returning) and * pure (no side effects) functions, and unused variables. They are * null except for versions of gcc that are known to support the features * properly (old versions of gcc-2 supported the dead and pure features * in a different (wrong) way). If we do not provide an implementation * for a given compiler, let the compile fail if it is told to use * a feature that we cannot live without. */ /* * TI ADD - check that __GNUC__ is defined before referencing it to avoid * generating an error when __GNUC__ treated as zero warning is * promoted to an error via -pdse195 option. */ /* * Keywords added in C11. */ /* * No native support for _Atomic(). Place object in structure to prevent * most forms of direct non-atomic access. */ /* * XXX: Some compilers (Clang 3.3, GCC 4.7) falsely announce C++11 mode * without actually supporting the thread_local keyword. Don't check for * the presence of C++11 when defining _Thread_local. */ /* * Emulation of C11 _Generic(). Unlike the previously defined C11 * keywords, it is not possible to implement this using exactly the same * syntax. Therefore implement something similar under the name * __generic(). Unlike _Generic(), this macro can only distinguish * between a single type, so it requires nested invocations to * distinguish multiple cases. */ /* * C99 Static array indices in function parameter declarations. Syntax such as: * void bar(int myArray[static 10]); * is allowed in C99 but not in C++. Define __min_size appropriately so * headers using it can be compiled in either language. Use like this: * void bar(int myArray[__min_size(10)]); */ /* XXX: should use `#if __STDC_VERSION__ < 199901'. */ /* C++11 exposes a load of C99 stuff */ /* * GCC 2.95 provides `__restrict' as an extension to C90 to support the * C99-specific `restrict' type qualifier. We happen to use `__restrict' as * a way to define the `restrict' type qualifier without disturbing older * software that is unaware of C99 keywords. * The TI compiler supports __restrict in all compilation modes. */ /* * GNU C version 2.96 adds explicit branch prediction so that * the CPU back-end can hint the processor and also so that * code blocks can be reordered such that the predicted path * sees a more linear flow, thus improving cache behavior, etc. * * The following two macros provide us with a way to utilize this * compiler feature. Use __predict_true() if you expect the expression * to evaluate to true, and __predict_false() if you expect the * expression to evaluate to false. * * A few notes about usage: * * * Generally, __predict_false() error condition checks (unless * you have some _strong_ reason to do otherwise, in which case * document it), and/or __predict_true() `no-error' condition * checks, assuming you want to optimize for the no-error case. * * * Other than that, if you don't know the likelihood of a test * succeeding from empirical or other `hard' evidence, don't * make predictions. * * * These are meant to be used in places that are run `a lot'. * It is wasteful to make predictions in code that is run * seldomly (e.g. at subsystem initialization time) as the * basic block reordering that this affects can often generate * larger code. */ /* * We define this here since , , and * require it. */ /* * Given the pointer x to the member m of the struct s, return * a pointer to the containing structure. When using GCC, we first * assign pointer x to a local variable, to check that its type is * compatible with member m. */ /* * Compiler-dependent macros to declare that functions take printf-like * or scanf-like arguments. They are null except for versions of gcc * that are known to support the features properly (old versions of gcc-2 * didn't permit keeping the keywords out of the application namespace). */ /* Compiler-dependent macros that rely on FreeBSD-specific extensions. */ /* * The following definition might not work well if used in header files, * but it should be better than nothing. If you want a "do nothing" * version, then it should generate some harmless declaration, such as: * #define __IDSTRING(name,string) struct __hack */ /* * Embed the rcs id of a source file in the resulting library. Note that in * more recent ELF binutils, we use .ident allowing the ID to be stripped. * Usage: * __FBSDID("$FreeBSD$"); */ /*- * The following definitions are an extension of the behavior originally * implemented in , but with a different level of granularity. * POSIX.1 requires that the macros we test be defined before any standard * header file is included. * * Here's a quick run-down of the versions: * defined(_POSIX_SOURCE) 1003.1-1988 * _POSIX_C_SOURCE == 1 1003.1-1990 * _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option * _POSIX_C_SOURCE == 199309 1003.1b-1993 * _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995, * and the omnibus ISO/IEC 9945-1: 1996 * _POSIX_C_SOURCE == 200112 1003.1-2001 * _POSIX_C_SOURCE == 200809 1003.1-2008 * * In addition, the X/Open Portability Guide, which is now the Single UNIX * Specification, defines a feature-test macro which indicates the version of * that specification, and which subsumes _POSIX_C_SOURCE. * * Our macros begin with two underscores to avoid namespace screwage. */ /* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. */ /* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. */ /* Deal with various X/Open Portability Guides and Single UNIX Spec. */ /* * Deal with all versions of POSIX. The ordering relative to the tests above is * important. */ /*- * Deal with _ANSI_SOURCE: * If it is defined, and no other compilation environment is explicitly * requested, then define our internal feature-test macros to zero. This * makes no difference to the preprocessor (undefined symbols in preprocessing * expressions are defined to have value zero), but makes it more convenient for * a test program to print out the values. * * If a program mistakenly defines _ANSI_SOURCE and some other macro such as * _POSIX_C_SOURCE, we will assume that it wants the broader compilation * environment (and in fact we will never get here). */ /* User override __EXT1_VISIBLE */ /* * Old versions of GCC use non-standard ARM arch symbols; acle-compat.h * translates them to __ARM_ARCH and the modern feature symbols defined by ARM. */ /* * Nullability qualifiers: currently only supported by Clang. */ /* * Type Safety Checking * * Clang provides additional attributes to enable checking type safety * properties that cannot be enforced by the C type system. */ /* * Lock annotations. * * Clang provides support for doing basic thread-safety tests at * compile-time, by marking which locks will/should be held when * entering/leaving a functions. * * Furthermore, it is also possible to annotate variables and structure * members to enforce that they are only accessed when certain locks are * held. */ /* Structure implements a lock. */ /* Function acquires an exclusive or shared lock. */ /* Function attempts to acquire an exclusive or shared lock. */ /* Function releases a lock. */ /* Function asserts that an exclusive or shared lock is held. */ /* Function requires that an exclusive or shared lock is or is not held. */ /* Function should not be analyzed. */ /* Guard variables and structure members by lock. */ #pragma diag_pop /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2002 Mike Barcroft * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ /*****************************************************************************/ /* _TYPES.H */ /* */ /* Copyright (c) 2017 Texas Instruments Incorporated */ /* http://www.ti.com/ */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions */ /* are met: */ /* */ /* Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* */ /* Redistributions in binary form must reproduce the above copyright */ /* notice, this list of conditions and the following disclaimer in */ /* the documentation and/or other materials provided with the */ /* distribution. */ /* */ /* Neither the name of Texas Instruments Incorporated nor the names */ /* of its contributors may be used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */ /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */ /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */ /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */ /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */ /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /*****************************************************************************/ #pragma diag_push /* This file is required to use base types */ #pragma CHECK_MISRA("-6.3") /* * Basic types upon which most other types are built. */ typedef int __int16_t; typedef unsigned int __uint16_t; typedef long __int32_t; typedef unsigned long __uint32_t; /* LONGLONG */ typedef long long __int64_t; /* LONGLONG */ typedef unsigned long long __uint64_t; /* * Standard type definitions. */ typedef __uint32_t __clock_t; /* clock()... */ typedef __int32_t __critical_t; typedef double __double_t; typedef float __float_t; typedef __int32_t __intfptr_t; typedef __int64_t __intmax_t; typedef __int32_t __intptr_t; typedef __int16_t __int_fast8_t; typedef __int16_t __int_fast16_t; typedef __int32_t __int_fast32_t; typedef __int64_t __int_fast64_t; typedef __int16_t __int_least8_t; typedef __int16_t __int_least16_t; typedef __int32_t __int_least32_t; typedef __int64_t __int_least64_t; typedef long __ptrdiff_t; /* ptr1 - ptr2 */ typedef __int16_t __register_t; typedef __int32_t __segsz_t; /* segment size (in pages) */ typedef unsigned long __size_t; /* sizeof() */ typedef __int32_t __ssize_t; /* byte count or error */ typedef __int64_t __time_t; /* time()... */ typedef __uint32_t __uintfptr_t; typedef __uint64_t __uintmax_t; typedef __uint32_t __uintptr_t; typedef __uint16_t __uint_fast8_t; typedef __uint16_t __uint_fast16_t; typedef __uint32_t __uint_fast32_t; typedef __uint64_t __uint_fast64_t; typedef __uint16_t __uint_least8_t; typedef __uint16_t __uint_least16_t; typedef __uint32_t __uint_least32_t; typedef __uint64_t __uint_least64_t; typedef __uint16_t __u_register_t; typedef __uint32_t __vm_offset_t; typedef __uint32_t __vm_paddr_t; typedef __uint32_t __vm_size_t; typedef unsigned long ___wchar_t; /* * Unusual type definitions. */ typedef char* __va_list; #pragma diag_pop #pragma diag_push /* This file is required to use types without size and signedness */ #pragma CHECK_MISRA("-6.3") /* * Standard type definitions. */ typedef __int32_t __blksize_t; /* file block size */ typedef __int64_t __blkcnt_t; /* file block count */ typedef __int32_t __clockid_t; /* clock_gettime()... */ typedef __uint32_t __fflags_t; /* file flags */ typedef __uint64_t __fsblkcnt_t; typedef __uint64_t __fsfilcnt_t; typedef __uint32_t __gid_t; typedef __int64_t __id_t; /* can hold a gid_t, pid_t, or uid_t */ typedef __uint64_t __ino_t; /* inode number */ typedef long __key_t; /* IPC key (for Sys V IPC) */ typedef __int32_t __lwpid_t; /* Thread ID (a.k.a. LWP) */ typedef __uint16_t __mode_t; /* permissions */ typedef int __accmode_t; /* access permissions */ typedef int __nl_item; typedef __uint64_t __nlink_t; /* link count */ typedef __int64_t __off_t; /* file offset */ typedef __int64_t __off64_t; /* file offset (alias) */ typedef __int32_t __pid_t; /* process [group] */ typedef __int64_t __rlim_t; /* resource limit - intentionally */ /* signed, because of legacy code */ /* that uses -1 for RLIM_INFINITY */ typedef __uint16_t __sa_family_t; typedef __uint32_t __socklen_t; typedef long __suseconds_t; /* microseconds (signed) */ typedef struct __timer *__timer_t; /* timer_gettime()... */ typedef struct __mq *__mqd_t; /* mq_open()... */ typedef __uint32_t __uid_t; typedef unsigned int __useconds_t; /* microseconds (unsigned) */ typedef int __cpuwhich_t; /* which parameter for cpuset. */ typedef int __cpulevel_t; /* level parameter for cpuset. */ typedef int __cpusetid_t; /* cpuset identifier. */ /* * Unusual type definitions. */ /* * rune_t is declared to be an ``int'' instead of the more natural * ``unsigned long'' or ``long''. Two things are happening here. It is not * unsigned so that EOF (-1) can be naturally assigned to it and used. Also, * it looks like 10646 will be a 31 bit standard. This means that if your * ints cannot hold 32 bits, you will be in trouble. The reason an int was * chosen over a long is that the is*() and to*() routines take ints (says * ANSI C), but they use __ct_rune_t instead of int. * * NOTE: rune_t is not covered by ANSI nor other standards, and should not * be instantiated outside of lib/libc/locale. Use wchar_t. wint_t and * rune_t must be the same type. Also, wint_t should be able to hold all * members of the largest character set plus one extra value (WEOF), and * must be at least 16 bits. */ typedef unsigned long __ct_rune_t; /* arg type for ctype funcs */ typedef __ct_rune_t __rune_t; /* rune_t (see above) */ typedef __ct_rune_t __wint_t; /* wint_t (see above) */ /* Clang already provides these types as built-ins, but only in C++ mode. */ typedef __uint_least16_t __char16_t; typedef __uint_least32_t __char32_t; /* In C++11, char16_t and char32_t are built-in types. */ typedef struct { long long __max_align1 __attribute__((aligned(__alignof__(long long)))); long double __max_align2 __attribute__((aligned(__alignof__(long double)))); } __max_align_t; typedef __uint64_t __dev_t; /* device number */ typedef __uint32_t __fixpt_t; /* fixed point number */ /* * mbstate_t is an opaque object to keep conversion state during multibyte * stream conversions. */ typedef int _Mbstatet; typedef _Mbstatet __mbstate_t; typedef __uintmax_t __rman_res_t; /* * When the following macro is defined, the system uses 64-bit inode numbers. * Programs can use this to avoid including , with its associated * namespace pollution. */ #pragma diag_pop /*****************************************************************************/ /* _STDINT.H */ /* */ /* Copyright (c) 2019 Texas Instruments Incorporated */ /* http://www.ti.com/ */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions */ /* are met: */ /* */ /* Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* */ /* Redistributions in binary form must reproduce the above copyright */ /* notice, this list of conditions and the following disclaimer in */ /* the documentation and/or other materials provided with the */ /* distribution. */ /* */ /* Neither the name of Texas Instruments Incorporated nor the names */ /* of its contributors may be used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */ /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */ /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */ /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */ /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */ /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /*****************************************************************************/ /*- * SPDX-License-Identifier: BSD-2-Clause-NetBSD * * Copyright (c) 2001, 2002 Mike Barcroft * Copyright (c) 2001 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation * by Klaus Klein. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD$ */ #pragma diag_push /* 19.4 is issued for macros that are defined in terms of other macros. */ #pragma CHECK_MISRA("-19.4") /* * ISO/IEC 9899:1999 * 7.18.2.1 Limits of exact-width integer types */ /* Minimum values of exact-width signed integer types. */ /* Maximum values of exact-width signed integer types. */ /* Maximum values of exact-width unsigned integer types. */ /* * ISO/IEC 9899:1999 * 7.18.2.2 Limits of minimum-width integer types */ /* Minimum values of minimum-width signed integer types. */ /* Maximum values of minimum-width signed integer types. */ /* Maximum values of minimum-width unsigned integer types. */ /* * ISO/IEC 9899:1999 * 7.18.2.3 Limits of fastest minimum-width integer types */ /* Minimum values of fastest minimum-width signed integer types. */ /* Maximum values of fastest minimum-width signed integer types. */ /* Maximum values of fastest minimum-width unsigned integer types. */ /* * ISO/IEC 9899:1999 * 7.18.2.4 Limits of integer types capable of holding object pointers */ /* * ISO/IEC 9899:1999 * 7.18.2.5 Limits of greatest-width integer types */ /* * ISO/IEC 9899:1999 * 7.18.3 Limits of other integer types */ /* Limits of ptrdiff_t. */ /* Limits of sig_atomic_t. */ /* Limit of size_t. */ /* Limits of wint_t. */ #pragma diag_pop /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2011 David E. O'Brien * Copyright (c) 2001 Mike Barcroft * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ typedef __int16_t int16_t; typedef __int32_t int32_t; typedef __int64_t int64_t; typedef __uint16_t uint16_t; typedef __uint32_t uint32_t; typedef __uint64_t uint64_t; typedef __intptr_t intptr_t; typedef __uintptr_t uintptr_t; typedef __intmax_t intmax_t; typedef __uintmax_t uintmax_t; typedef __int_least8_t int_least8_t; typedef __int_least16_t int_least16_t; typedef __int_least32_t int_least32_t; typedef __int_least64_t int_least64_t; typedef __uint_least8_t uint_least8_t; typedef __uint_least16_t uint_least16_t; typedef __uint_least32_t uint_least32_t; typedef __uint_least64_t uint_least64_t; typedef __int_fast8_t int_fast8_t; typedef __int_fast16_t int_fast16_t; typedef __int_fast32_t int_fast32_t; typedef __int_fast64_t int_fast64_t; typedef __uint_fast8_t uint_fast8_t; typedef __uint_fast16_t uint_fast16_t; typedef __uint_fast32_t uint_fast32_t; typedef __uint_fast64_t uint_fast64_t; /* GNU and Darwin define this and people seem to think it's portable */ #pragma diag_push #pragma CHECK_MISRA("-19.4") /* Limits of wchar_t. */ #pragma diag_pop /* ISO/IEC 9899:2011 K.3.4.4 */ //########################################################################### // // FILE: hw_adc.h // // TITLE: Definitions for the ADC registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the ADC register offsets // //***************************************************************************** // Register // Register // Register // Selection Register // Selection Register // Register // Register // Register // Register // Register // Stamp Register // Register // Register // Time Stamp Register // Stamp Register // Register // Register // Time Stamp Register // Stamp Register // Register // Register // Time Stamp Register // Stamp Register // Register // Register // Time Stamp Register // Generation Cycle // Result Register // Result Register // Result Register // Result Register //***************************************************************************** // // The following are defines for the bit fields in the ADCCTL1 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ADCCTL2 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ADCBURSTCTL register // //***************************************************************************** // Select //***************************************************************************** // // The following are defines for the bit fields in the ADCINTFLG register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ADCINTFLGCLR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ADCINTOVF register // //***************************************************************************** // Flags // Flags // Flags // Flags //***************************************************************************** // // The following are defines for the bit fields in the ADCINTOVFCLR register // //***************************************************************************** // Clear Bits // Clear Bits // Clear Bits // Clear Bits //***************************************************************************** // // The following are defines for the bit fields in the ADCINTSEL1N2 register // //***************************************************************************** // Mode // Mode //***************************************************************************** // // The following are defines for the bit fields in the ADCINTSEL3N4 register // //***************************************************************************** // Mode // Mode //***************************************************************************** // // The following are defines for the bit fields in the ADCSOCPRICTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ADCINTSOCSEL1 register // //***************************************************************************** // Select // Select // Select // Select // Select // Select // Select // Select //***************************************************************************** // // The following are defines for the bit fields in the ADCINTSOCSEL2 register // //***************************************************************************** // Select // Select // Select // Select // Select // Select // Select // Select //***************************************************************************** // // The following are defines for the bit fields in the ADCSOCFLG1 register // //***************************************************************************** // Flag // Flag // Flag // Flag // Flag // Flag //***************************************************************************** // // The following are defines for the bit fields in the ADCSOCFRC1 register // //***************************************************************************** // Conversion Bit // Conversion Bit // Conversion Bit // Conversion Bit // Conversion Bit // Conversion Bit // Conversion Bit // Conversion Bit // Conversion Bit // Conversion Bit // Conversion Bit // Conversion Bit // Conversion Bit // Conversion Bit // Conversion Bit // Conversion Bit //***************************************************************************** // // The following are defines for the bit fields in the ADCSOCOVF1 register // //***************************************************************************** // Overflow Flag // Overflow Flag // Overflow Flag // Overflow Flag // Overflow Flag // Overflow Flag // Overflow Flag // Overflow Flag // Overflow Flag // Overflow Flag // Overflow Flag // Overflow Flag // Overflow Flag // Overflow Flag // Overflow Flag // Overflow Flag //***************************************************************************** // // The following are defines for the bit fields in the ADCSOCOVFCLR1 register // //***************************************************************************** // Conversion Overflow Bit // Conversion Overflow Bit // Conversion Overflow Bit // Conversion Overflow Bit // Conversion Overflow Bit // Conversion Overflow Bit // Conversion Overflow Bit // Conversion Overflow Bit // Conversion Overflow Bit // Conversion Overflow Bit // Conversion Overflow Bit // Conversion Overflow Bit // Conversion Overflow Bit // Conversion Overflow Bit // Conversion Overflow Bit // Conversion Overflow Bit //***************************************************************************** // // The following are defines for the bit fields in the ADCSOC0CTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ADCSOC1CTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ADCSOC2CTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ADCSOC3CTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ADCSOC4CTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ADCSOC5CTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ADCSOC6CTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ADCSOC7CTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ADCSOC8CTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ADCSOC9CTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ADCSOC10CTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ADCSOC11CTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ADCSOC12CTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ADCSOC13CTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ADCSOC14CTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ADCSOC15CTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ADCEVTSTAT register // //***************************************************************************** // High Flag // Low Flag // Crossing Flag // High Flag // Low Flag // Crossing Flag // High Flag // Low Flag // Crossing Flag // High Flag // Low Flag // Crossing Flag //***************************************************************************** // // The following are defines for the bit fields in the ADCEVTCLR register // //***************************************************************************** // High Clear // Low Clear // Crossing Clear // High Clear // Low Clear // Crossing Clear // High Clear // Low Clear // Crossing Clear // High Clear // Low Clear // Crossing Clear //***************************************************************************** // // The following are defines for the bit fields in the ADCEVTSEL register // //***************************************************************************** // High Event Enable // Low Event Enable // Crossing Event Enable // High Event Enable // Low Event Enable // Crossing Event Enable // High Event Enable // Low Event Enable // Crossing Event Enable // High Event Enable // Low Event Enable // Crossing Event Enable //***************************************************************************** // // The following are defines for the bit fields in the ADCEVTINTSEL register // //***************************************************************************** // High Interrupt Enable // Low Interrupt Enable // Crossing Interrupt Enable // High Interrupt Enable // Low Interrupt Enable // Crossing Interrupt Enable // High Interrupt Enable // Low Interrupt Enable // Crossing Interrupt Enable // High Interrupt Enable // Low Interrupt Enable // Crossing Interrupt Enable //***************************************************************************** // // The following are defines for the bit fields in the ADCCOUNTER register // //***************************************************************************** // Value //***************************************************************************** // // The following are defines for the bit fields in the ADCREV register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ADCOFFTRIM register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ADCPPB1CONFIG register // //***************************************************************************** // Configuration // Two's Complement Enable //***************************************************************************** // // The following are defines for the bit fields in the ADCPPB1STAMP register // //***************************************************************************** // Delay Time Stamp //***************************************************************************** // // The following are defines for the bit fields in the ADCPPB1OFFCAL register // //***************************************************************************** // Offset Correction //***************************************************************************** // // The following are defines for the bit fields in the ADCPPB1TRIPHI register // //***************************************************************************** // Trip High Limit //***************************************************************************** // // The following are defines for the bit fields in the ADCPPB1TRIPLO register // //***************************************************************************** // Trip Low Limit // Request Time Stamp //***************************************************************************** // // The following are defines for the bit fields in the ADCPPB2CONFIG register // //***************************************************************************** // Configuration // Two's Complement Enable //***************************************************************************** // // The following are defines for the bit fields in the ADCPPB2STAMP register // //***************************************************************************** // Delay Time Stamp //***************************************************************************** // // The following are defines for the bit fields in the ADCPPB2OFFCAL register // //***************************************************************************** // Offset Correction //***************************************************************************** // // The following are defines for the bit fields in the ADCPPB2TRIPHI register // //***************************************************************************** // Trip High Limit //***************************************************************************** // // The following are defines for the bit fields in the ADCPPB2TRIPLO register // //***************************************************************************** // Trip Low Limit // Request Time Stamp //***************************************************************************** // // The following are defines for the bit fields in the ADCPPB3CONFIG register // //***************************************************************************** // Configuration // Two's Complement Enable //***************************************************************************** // // The following are defines for the bit fields in the ADCPPB3STAMP register // //***************************************************************************** // Delay Time Stamp //***************************************************************************** // // The following are defines for the bit fields in the ADCPPB3OFFCAL register // //***************************************************************************** // Offset Correction //***************************************************************************** // // The following are defines for the bit fields in the ADCPPB3TRIPHI register // //***************************************************************************** // Trip High Limit //***************************************************************************** // // The following are defines for the bit fields in the ADCPPB3TRIPLO register // //***************************************************************************** // Trip Low Limit // Request Time Stamp //***************************************************************************** // // The following are defines for the bit fields in the ADCPPB4CONFIG register // //***************************************************************************** // Configuration // Two's Complement Enable //***************************************************************************** // // The following are defines for the bit fields in the ADCPPB4STAMP register // //***************************************************************************** // Delay Time Stamp //***************************************************************************** // // The following are defines for the bit fields in the ADCPPB4OFFCAL register // //***************************************************************************** // Offset Correction //***************************************************************************** // // The following are defines for the bit fields in the ADCPPB4TRIPHI register // //***************************************************************************** // Trip High Limit //***************************************************************************** // // The following are defines for the bit fields in the ADCPPB4TRIPLO register // //***************************************************************************** // Trip Low Limit // Request Time Stamp //***************************************************************************** // // The following are defines for the bit fields in the ADCPPB1RESULT register // //***************************************************************************** // Result //***************************************************************************** // // The following are defines for the bit fields in the ADCPPB2RESULT register // //***************************************************************************** // Result //***************************************************************************** // // The following are defines for the bit fields in the ADCPPB3RESULT register // //***************************************************************************** // Result //***************************************************************************** // // The following are defines for the bit fields in the ADCPPB4RESULT register // //***************************************************************************** // Result //########################################################################### // // FILE: hw_sysctl.h // // TITLE: Definitions for the SYSCTL registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the SYSCTL register offsets // //***************************************************************************** // Register // register-1 // register-2 // register-3 // register // Select register // Selet register // register // Prescalar // Register // Address register // Registers // Registers // Registers // Registers // Registers // Registers // Registers // Registers // Registers // Registers // Registers // Registers // Registers // Registers // Registers // Registers // Registers // Registers // Registers // Registers // registers // registers // functionality control register // Select Lock Register // Select Lock Register // Select Register-1 // Select Register-2 // Select Register-1 // Select Register-2 // Identification Number // Identification Number // register // Reset register // register // register // register // register // register // register // register // register // register // register // register // register // Reset register // Reset register // register // register // register // common peripherals // common peripherals // common peripherals // common peripherals // common peripherals // common peripherals // common peripherals // common peripherals // common peripherals // common peripherals // common peripherals // common peripherals // common peripherals // common peripherals // common peripherals // common peripherals // secondary C28x CPUs // secondary C28x CPUs // programmed by CPU1. // device // device // device // for the device // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Control Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // access to peripheral Access // register. // register // register // Register. // Lock // multiple sources of Cortex-M4 // reset. // register // register // multiple different errors in // the system. // register // Register // Select Register // Lock register //***************************************************************************** // // The following are defines for the bit fields in the CLKSEM register // //***************************************************************************** // Ownership by CPU1 or CPU2 // this register //***************************************************************************** // // The following are defines for the bit fields in the CLKCFGLOCK1 register // //***************************************************************************** // register // register // register // register // register // register // register // register // register // register // register // register // register // register // register //***************************************************************************** // // The following are defines for the bit fields in the CLKSRCCTL1 register // //***************************************************************************** // Off Bit //***************************************************************************** // // The following are defines for the bit fields in the CLKSRCCTL2 register // //***************************************************************************** // Source Select Bit //***************************************************************************** // // The following are defines for the bit fields in the CLKSRCCTL3 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SYSPLLCTL1 register // //***************************************************************************** // in the PLLSYSCLK path //***************************************************************************** // // The following are defines for the bit fields in the SYSPLLMULT register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SYSPLLSTS register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the AUXPLLCTL1 register // //***************************************************************************** // in the AUXPLLCLK path //***************************************************************************** // // The following are defines for the bit fields in the AUXPLLMULT register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the AUXPLLSTS register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SYSCLKDIVSEL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the AUXCLKDIVSEL register // //***************************************************************************** // Clock and CANFD Bit CLK //***************************************************************************** // // The following are defines for the bit fields in the PERCLKDIVSEL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the XCLKOUTDIVSEL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLBCLKCTL register // //***************************************************************************** // configuration. // configuration. //***************************************************************************** // // The following are defines for the bit fields in the LOSPCP register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the MCDCR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the X1CNT register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the XTALCR register // //***************************************************************************** // Single-Ended mode //***************************************************************************** // // The following are defines for the bit fields in the ETHERCATCLKCTL register // //***************************************************************************** // etherCAT clock divider. // configuration. //***************************************************************************** // // The following are defines for the bit fields in the CMCLKCTL register // //***************************************************************************** // CM clock divider. // configuration. // etherNET clock divider. // configuration //***************************************************************************** // // The following are defines for the bit fields in the CPUSYSLOCK1 register // //***************************************************************************** // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register //***************************************************************************** // // The following are defines for the bit fields in the CPUSYSLOCK2 register // //***************************************************************************** // register //***************************************************************************** // // The following are defines for the bit fields in the PIEVERRADDR register // //***************************************************************************** // Handler Routine Address //***************************************************************************** // // The following are defines for the bit fields in the ETHERCATCTL register // //***************************************************************************** // IP to I2C_A. //***************************************************************************** // // The following are defines for the bit fields in the PCLKCR0 register // //***************************************************************************** // sync //***************************************************************************** // // The following are defines for the bit fields in the PCLKCR1 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PCLKCR2 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PCLKCR3 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PCLKCR4 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PCLKCR6 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PCLKCR7 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PCLKCR8 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PCLKCR9 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PCLKCR10 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PCLKCR11 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PCLKCR13 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PCLKCR14 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PCLKCR16 register // //***************************************************************************** // Bit // Bit // Bit //***************************************************************************** // // The following are defines for the bit fields in the PCLKCR17 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PCLKCR18 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PCLKCR20 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PCLKCR21 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PCLKCR22 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PCLKCR23 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SIMRESET register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the LPMCR register // //***************************************************************************** // Qualification Setting // STANDBY //***************************************************************************** // // The following are defines for the bit fields in the GPIOLPMSEL0 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPIOLPMSEL1 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the TMR2CLKCTL register // //***************************************************************************** // Select Bit // Value //***************************************************************************** // // The following are defines for the bit fields in the RESCCLR register // //***************************************************************************** // Bit // Bit // Bit // Indication Bit // Indication Bit // Indication Bit // Indication Bit // Indication Bit // Indication Bit //***************************************************************************** // // The following are defines for the bit fields in the RESC register // //***************************************************************************** // Bit // Bit // Bit // Indication Bit // Indication Bit // Indication Bit // Indication Bit // Indication Bit // Indication Bit //***************************************************************************** // // The following are defines for the bit fields in the CLA1TASKSRCSELLOCK register // //***************************************************************************** // bit // bit //***************************************************************************** // // The following are defines for the bit fields in the DMACHSRCSELLOCK register // //***************************************************************************** // bit // bit //***************************************************************************** // // The following are defines for the bit fields in the CLA1TASKSRCSEL1 register // //***************************************************************************** // for TASK1 of CLA1 // for TASK2 of CLA1 // for TASK3 of CLA1 // for TASK4 of CLA1 //***************************************************************************** // // The following are defines for the bit fields in the CLA1TASKSRCSEL2 register // //***************************************************************************** // for TASK5 of CLA1 // for TASK6 of CLA1 // for TASK7 of CLA1 // for TASK8 of CLA1 //***************************************************************************** // // The following are defines for the bit fields in the DMACHSRCSEL1 register // //***************************************************************************** // Source CH1 of DMA // Source CH2 of DMA // Source CH3 of DMA // Source CH4 of DMA //***************************************************************************** // // The following are defines for the bit fields in the DMACHSRCSEL2 register // //***************************************************************************** // Source CH5 of DMA // Source CH6 of DMA //***************************************************************************** // // The following are defines for the bit fields in the DEVCFGLOCK1 register // //***************************************************************************** // register // register // register // register // register // register // register //***************************************************************************** // // The following are defines for the bit fields in the PARTIDL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PARTIDH register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the REVID register // //***************************************************************************** // specific to the Device //***************************************************************************** // // The following are defines for the bit fields in the PERCNF1 register // //***************************************************************************** // bit // bit // bit // bit //***************************************************************************** // // The following are defines for the bit fields in the FUSEERR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SOFTPRES0 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SOFTPRES1 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SOFTPRES2 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SOFTPRES3 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SOFTPRES4 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SOFTPRES6 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SOFTPRES7 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SOFTPRES8 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SOFTPRES9 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SOFTPRES10 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SOFTPRES11 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SOFTPRES13 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SOFTPRES14 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SOFTPRES16 register // //***************************************************************************** // reset bit // reset bit // reset bit //***************************************************************************** // // The following are defines for the bit fields in the SOFTPRES17 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SOFTPRES18 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SOFTPRES20 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SOFTPRES21 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SOFTPRES23 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CPUSEL0 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CPUSEL1 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CPUSEL2 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CPUSEL4 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CPUSEL5 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CPUSEL6 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CPUSEL7 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CPUSEL8 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CPUSEL9 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CPUSEL11 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CPUSEL12 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CPUSEL14 register // //***************************************************************************** // bit // bit // bit //***************************************************************************** // // The following are defines for the bit fields in the CPUSEL15 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CPUSEL16 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CPUSEL18 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CPUSEL25 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CPU2RESCTL register // //***************************************************************************** // this register //***************************************************************************** // // The following are defines for the bit fields in the RSTSTAT register // //***************************************************************************** // reset was issued to CPU2 or not // was issued to CPU2 or not //***************************************************************************** // // The following are defines for the bit fields in the LPMSTAT register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the BANKSEL register // //***************************************************************************** // programmed by CPU1 FMC. //***************************************************************************** // // The following are defines for the bit fields in the USBTYPE register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ECAPTYPE register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SDFMTYPE register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the MEMMAPTYPE register // //***************************************************************************** // features related to memory map. //***************************************************************************** // // The following are defines for the bit fields in the ADCA_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the ADCB_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the ADCC_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the ADCD_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the CMPSS1_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the CMPSS2_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the CMPSS3_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the CMPSS4_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the CMPSS5_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the CMPSS6_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the CMPSS7_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the CMPSS8_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the DACA_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the DACB_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the DACC_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the EPWM1_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the EPWM2_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the EPWM3_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the EPWM4_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the EPWM5_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the EPWM6_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the EPWM7_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the EPWM8_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the EPWM9_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the EPWM10_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the EPWM11_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the EPWM12_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the EPWM13_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the EPWM14_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the EPWM15_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the EPWM16_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the EQEP1_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the EQEP2_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the EQEP3_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the ECAP1_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the ECAP2_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the ECAP3_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the ECAP4_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the ECAP5_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the ECAP6_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the ECAP7_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the SDFM1_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the SDFM2_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the CLB1_AC register // //***************************************************************************** // peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the CLB2_AC register // //***************************************************************************** // peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the CLB3_AC register // //***************************************************************************** // peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the CLB4_AC register // //***************************************************************************** // peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the SPIA_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the SPIB_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the SPIC_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the SPID_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the PMBUS_A_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the CAN_A_AC register // //***************************************************************************** // peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the CAN_B_AC register // //***************************************************************************** // peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the MCBSPA_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the MCBSPB_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the USBA_AC register // //***************************************************************************** // peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the HRPWM_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the ETHERCAT_AC register // //***************************************************************************** // peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the FSIATX_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the FSIARX_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the FSIBTX_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the FSIBRX_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the FSICRX_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the FSIDRX_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the FSIERX_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the FSIFRX_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the FSIGRX_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the FSIHRX_AC register // //***************************************************************************** // peripheral // Peripheral // Peripheral //***************************************************************************** // // The following are defines for the bit fields in the PERIPH_AC_LOCK register // //***************************************************************************** // control registers write. //***************************************************************************** // // The following are defines for the bit fields in the CMRESCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CMTOCPU1NMICTL register // //***************************************************************************** // enables nmi generation to C28x //***************************************************************************** // // The following are defines for the bit fields in the CMTOCPU1INTCTL register // //***************************************************************************** // bit, enables interrupt to C28x // bit, enables interrupt to C28x // bit, enables interrupt to C28x //***************************************************************************** // // The following are defines for the bit fields in the PALLOCATE0 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CM_CONF_REGS_LOCK register // //***************************************************************************** // configuration registers. //***************************************************************************** // // The following are defines for the bit fields in the CM_STATUS_INT_FLG register // //***************************************************************************** // CM // of CM // CM //***************************************************************************** // // The following are defines for the bit fields in the CM_STATUS_INT_CLR register // //***************************************************************************** // bit // clear bit // clear bit // clear bit //***************************************************************************** // // The following are defines for the bit fields in the CM_STATUS_INT_SET register // //***************************************************************************** // bit // set bit // set bit //***************************************************************************** // // The following are defines for the bit fields in the CM_STATUS_MASK register // //***************************************************************************** // set bit // set bit //***************************************************************************** // // The following are defines for the bit fields in the SYS_ERR_INT_FLG register // //***************************************************************************** // flag. //***************************************************************************** // // The following are defines for the bit fields in the SYS_ERR_INT_CLR register // //***************************************************************************** // bit // bit // flag clear bit // interrupt flag clear bit // clear bit // clear bit // clear bit //***************************************************************************** // // The following are defines for the bit fields in the SYS_ERR_INT_SET register // //***************************************************************************** // flag set bit // interrupt flag set bit // set bit // set bit // set bit //***************************************************************************** // // The following are defines for the bit fields in the SYS_ERR_MASK register // //***************************************************************************** // bit // mask bit //***************************************************************************** // // The following are defines for the bit fields in the SYNCSELECT register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ADCSOCOUTSELECT register // //***************************************************************************** // ADCSOCAOn // ADCSOCAOn // ADCSOCAOn // ADCSOCAOn // ADCSOCAOn // ADCSOCAOn // ADCSOCAOn // ADCSOCAOn // ADCSOCAOn // ADCSOCAOn // ADCSOCAOn // ADCSOCAOn // ADCSOCAOn // ADCSOCAOn // ADCSOCAOn // ADCSOCAOn // ADCSOCBOn // ADCSOCBOn // ADCSOCBOn // ADCSOCBOn // ADCSOCBOn // ADCSOCBOn // ADCSOCBOn // ADCSOCBOn // ADCSOCBOn // ADCSOCBOn // ADCSOCBOn // ADCSOCBOn // ADCSOCBOn // ADCSOCBOn // ADCSOCBOn // ADCSOCBOn //***************************************************************************** // // The following are defines for the bit fields in the SYNCSOCLOCK register // //***************************************************************************** // bit //########################################################################### // // FILE: hw_types.h // // TITLE: Type definitions used in driverlib functions. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // Define dummy 8 bit types for USB Driver code. // //***************************************************************************** typedef uint16_t uint8_t; typedef int16_t int8_t; //***************************************************************************** // // Macros for hardware access // //***************************************************************************** // // Emulated Bitbanded write // // // Emulated Bitbanded read // // // Emulated Bitbanded write // // // Emulated Bitbanded read // //***************************************************************************** // // SUCCESS and FAILURE for API return value // //***************************************************************************** //**************************************************************************** // // For checking NULL pointers // //**************************************************************************** //***************************************************************************** // // 32-bit float type // //***************************************************************************** typedef float float32_t; typedef double float64_t; //***************************************************************************** // // Extern compiler intrinsic prototypes. See compiler User's Guide for details. // These are provided to satisfy static analysis tools. The #ifndef is required // because the '&' is for a C++-style reference, and although it is the correct // prototype, it will not build in C code. // //***************************************************************************** //########################################################################### // // FILE: cpu.h // // TITLE: Useful C28x CPU defines. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** // // External reference to the interrupt flag register (IFR) register // extern __cregister volatile uint16_t IFR; // // External reference to the interrupt enable register (IER) register // extern __cregister volatile uint16_t IER; // // Define to enable interrupts // // // Define to disable interrupts // // // Define to enable debug events // // // Define to disable debug events // // // Define to allow writes to protected registers // // // Define to disable writes to protected registers // // // Define for emulation stop // // // Define for emulation stop // // // Define for no operation // // // Define for putting processor into a low-power mode // //***************************************************************************** // // Extern compiler intrinsic prototypes. See compiler User's Guide for details. // //***************************************************************************** extern void __eallow(void); extern void __edis(void); //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //########################################################################### // // FILE: debug.h // // TITLE: Assert definition macro for debug. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // Prototype for the function that is called when an invalid argument is passed // to an API. This is only used when doing a DEBUG build. It is the // application's responsibility to define the __error__ function. // //***************************************************************************** extern void __error__(char *filename, uint32_t line); //***************************************************************************** // // The ASSERT macro, which does the actual assertion checking. Typically, this // will be for procedure arguments. // //***************************************************************************** //***************************************************************************** // // Useful defines used within the driver functions. Not intended for use by // application code. // //***************************************************************************** // // Slope of the temperature sensor // // // Offset of the temp sensor output // //***************************************************************************** // // Values that can be passed to ADC_enablePPBEvent(), ADC_disablePPBEvent(), // ADC_enablePPBEventInterrupt(), ADC_disablePPBEventInterrupt(), and // ADC_clearPPBEventStatus() as the intFlags and evtFlags parameters. They also // make up the enumerated bit field returned by ADC_getPPBEventStatus(). // //***************************************************************************** //***************************************************************************** // // Values that can be passed to ADC_forceMultipleSOC() as socMask parameter. // These values can be OR'd together to trigger multiple SOCs at a time. // //***************************************************************************** //***************************************************************************** // //! Values that can be passed to ADC_setPrescaler() as the \e clkPrescale //! parameter. // //***************************************************************************** typedef enum { ADC_CLK_DIV_1_0 = 0, //!< ADCCLK = (input clock) / 1.0 ADC_CLK_DIV_2_0 = 2, //!< ADCCLK = (input clock) / 2.0 ADC_CLK_DIV_2_5 = 3, //!< ADCCLK = (input clock) / 2.5 ADC_CLK_DIV_3_0 = 4, //!< ADCCLK = (input clock) / 3.0 ADC_CLK_DIV_3_5 = 5, //!< ADCCLK = (input clock) / 3.5 ADC_CLK_DIV_4_0 = 6, //!< ADCCLK = (input clock) / 4.0 ADC_CLK_DIV_4_5 = 7, //!< ADCCLK = (input clock) / 4.5 ADC_CLK_DIV_5_0 = 8, //!< ADCCLK = (input clock) / 5.0 ADC_CLK_DIV_5_5 = 9, //!< ADCCLK = (input clock) / 5.5 ADC_CLK_DIV_6_0 = 10, //!< ADCCLK = (input clock) / 6.0 ADC_CLK_DIV_6_5 = 11, //!< ADCCLK = (input clock) / 6.5 ADC_CLK_DIV_7_0 = 12, //!< ADCCLK = (input clock) / 7.0 ADC_CLK_DIV_7_5 = 13, //!< ADCCLK = (input clock) / 7.5 ADC_CLK_DIV_8_0 = 14, //!< ADCCLK = (input clock) / 8.0 ADC_CLK_DIV_8_5 = 15 //!< ADCCLK = (input clock) / 8.5 } ADC_ClkPrescale; //***************************************************************************** // //! Values that can be passed to ADC_setMode() as the \e resolution //! parameter. // //***************************************************************************** typedef enum { ADC_RESOLUTION_12BIT = 0x00, //!< 12-bit conversion resolution ADC_RESOLUTION_16BIT = 0x40 //!< 16-bit conversion resolution } ADC_Resolution; //***************************************************************************** // //! Values that can be passed to ADC_setMode() as the \e signalMode //! parameter. // //***************************************************************************** typedef enum { ADC_MODE_SINGLE_ENDED = 0x00, //!< Sample on single pin with VREFLO ADC_MODE_DIFFERENTIAL = 0x80 //!< Sample on pair of pins } ADC_SignalMode; //***************************************************************************** // //! Values that can be passed to ADC_setupSOC() as the \e trigger //! parameter to specify the event that will trigger a conversion to start. //! It is also used with ADC_setBurstModeConfig(). // //***************************************************************************** typedef enum { ADC_TRIGGER_SW_ONLY = 0, //!< Software only ADC_TRIGGER_CPU1_TINT0 = 1, //!< CPU1 Timer 0, TINT0 ADC_TRIGGER_CPU1_TINT1 = 2, //!< CPU1 Timer 1, TINT1 ADC_TRIGGER_CPU1_TINT2 = 3, //!< CPU1 Timer 2, TINT2 ADC_TRIGGER_GPIO = 4, //!< GPIO, ADCEXTSOC ADC_TRIGGER_EPWM1_SOCA = 5, //!< ePWM1, ADCSOCA ADC_TRIGGER_EPWM1_SOCB = 6, //!< ePWM1, ADCSOCB ADC_TRIGGER_EPWM2_SOCA = 7, //!< ePWM2, ADCSOCA ADC_TRIGGER_EPWM2_SOCB = 8, //!< ePWM2, ADCSOCB ADC_TRIGGER_EPWM3_SOCA = 9, //!< ePWM3, ADCSOCA ADC_TRIGGER_EPWM3_SOCB = 10, //!< ePWM3, ADCSOCB ADC_TRIGGER_EPWM4_SOCA = 11, //!< ePWM4, ADCSOCA ADC_TRIGGER_EPWM4_SOCB = 12, //!< ePWM4, ADCSOCB ADC_TRIGGER_EPWM5_SOCA = 13, //!< ePWM5, ADCSOCA ADC_TRIGGER_EPWM5_SOCB = 14, //!< ePWM5, ADCSOCB ADC_TRIGGER_EPWM6_SOCA = 15, //!< ePWM6, ADCSOCA ADC_TRIGGER_EPWM6_SOCB = 16, //!< ePWM6, ADCSOCB ADC_TRIGGER_EPWM7_SOCA = 17, //!< ePWM7, ADCSOCA ADC_TRIGGER_EPWM7_SOCB = 18, //!< ePWM7, ADCSOCB ADC_TRIGGER_EPWM8_SOCA = 19, //!< ePWM8, ADCSOCA ADC_TRIGGER_EPWM8_SOCB = 20, //!< ePWM8, ADCSOCB ADC_TRIGGER_EPWM9_SOCA = 21, //!< ePWM9, ADCSOCA ADC_TRIGGER_EPWM9_SOCB = 22, //!< ePWM9, ADCSOCB ADC_TRIGGER_EPWM10_SOCA = 23, //!< ePWM10, ADCSOCA ADC_TRIGGER_EPWM10_SOCB = 24, //!< ePWM10, ADCSOCB ADC_TRIGGER_EPWM11_SOCA = 25, //!< ePWM11, ADCSOCA ADC_TRIGGER_EPWM11_SOCB = 26, //!< ePWM11, ADCSOCB ADC_TRIGGER_EPWM12_SOCA = 27, //!< ePWM12, ADCSOCA ADC_TRIGGER_EPWM12_SOCB = 28, //!< ePWM12, ADCSOCB ADC_TRIGGER_CPU2_TINT0 = 29, //!< CPU2 Timer 0, TINT0 ADC_TRIGGER_CPU2_TINT1 = 30, //!< CPU2 Timer 1, TINT1 ADC_TRIGGER_CPU2_TINT2 = 31, //!< CPU2 Timer 2, TINT2 ADC_TRIGGER_EPWM13_SOCA = 32, //!< ePWM13, ADCSOCA ADC_TRIGGER_EPWM13_SOCB = 33, //!< ePWM13, ADCSOCB ADC_TRIGGER_EPWM14_SOCA = 34, //!< ePWM14, ADCSOCA ADC_TRIGGER_EPWM14_SOCB = 35, //!< ePWM14, ADCSOCB ADC_TRIGGER_EPWM15_SOCA = 36, //!< ePWM15, ADCSOCA ADC_TRIGGER_EPWM15_SOCB = 37, //!< ePWM15, ADCSOCB ADC_TRIGGER_EPWM16_SOCA = 38, //!< ePWM16, ADCSOCA ADC_TRIGGER_EPWM16_SOCB = 39 //!< ePWM16, ADCSOCB } ADC_Trigger; //***************************************************************************** // //! Values that can be passed to ADC_setupSOC() as the \e channel //! parameter. This is the input pin on which the signal to be converted is //! located. // //***************************************************************************** typedef enum { ADC_CH_ADCIN0 = 0, //!< single-ended, ADCIN0 ADC_CH_ADCIN1 = 1, //!< single-ended, ADCIN1 ADC_CH_ADCIN2 = 2, //!< single-ended, ADCIN2 ADC_CH_ADCIN3 = 3, //!< single-ended, ADCIN3 ADC_CH_ADCIN4 = 4, //!< single-ended, ADCIN4 ADC_CH_ADCIN5 = 5, //!< single-ended, ADCIN5 ADC_CH_ADCIN6 = 6, //!< single-ended, ADCIN6 ADC_CH_ADCIN7 = 7, //!< single-ended, ADCIN7 ADC_CH_ADCIN8 = 8, //!< single-ended, ADCIN8 ADC_CH_ADCIN9 = 9, //!< single-ended, ADCIN9 ADC_CH_ADCIN10 = 10, //!< single-ended, ADCIN10 ADC_CH_ADCIN11 = 11, //!< single-ended, ADCIN11 ADC_CH_ADCIN12 = 12, //!< single-ended, ADCIN12 ADC_CH_ADCIN13 = 13, //!< single-ended, ADCIN13 ADC_CH_ADCIN14 = 14, //!< single-ended, ADCIN14 ADC_CH_ADCIN15 = 15, //!< single-ended, ADCIN15 ADC_CH_ADCIN0_ADCIN1 = 0, //!< differential, ADCIN0 and ADCIN1 ADC_CH_ADCIN2_ADCIN3 = 2, //!< differential, ADCIN2 and ADCIN3 ADC_CH_ADCIN4_ADCIN5 = 4, //!< differential, ADCIN4 and ADCIN5 ADC_CH_ADCIN6_ADCIN7 = 6, //!< differential, ADCIN6 and ADCIN7 ADC_CH_ADCIN8_ADCIN9 = 8, //!< differential, ADCIN8 and ADCIN9 ADC_CH_ADCIN10_ADCIN11 = 10, //!< differential, ADCIN10 and ADCIN11 ADC_CH_ADCIN12_ADCIN13 = 12, //!< differential, ADCIN12 and ADCIN13 ADC_CH_ADCIN14_ADCIN15 = 14 //!< differential, ADCIN14 and ADCIN15 } ADC_Channel; //***************************************************************************** // //! Values that can be passed to ADC_setInterruptPulseMode() as the //! \e pulseMode parameter. // //***************************************************************************** typedef enum { //! Occurs at the end of the acquisition window ADC_PULSE_END_OF_ACQ_WIN = 0x00, //! Occurs at the end of the conversion ADC_PULSE_END_OF_CONV = 0x04 } ADC_PulseMode; //***************************************************************************** // //! Values that can be passed to ADC_enableInterrupt(), ADC_disableInterrupt(), //! and ADC_getInterruptStatus() as the \e adcIntNum parameter. // //***************************************************************************** typedef enum { ADC_INT_NUMBER1, //!< ADCINT1 Interrupt ADC_INT_NUMBER2, //!< ADCINT2 Interrupt ADC_INT_NUMBER3, //!< ADCINT3 Interrupt ADC_INT_NUMBER4 //!< ADCINT4 Interrupt } ADC_IntNumber; //***************************************************************************** // //! Values that can be passed in as the \e ppbNumber parameter for several //! functions. // //***************************************************************************** typedef enum { ADC_PPB_NUMBER1, //!< Post-processing block 1 ADC_PPB_NUMBER2, //!< Post-processing block 2 ADC_PPB_NUMBER3, //!< Post-processing block 3 ADC_PPB_NUMBER4 //!< Post-processing block 4 } ADC_PPBNumber; //***************************************************************************** // //! Values that can be passed in as the \e socNumber parameter for several //! functions. This value identifies the start-of-conversion (SOC) that a //! function is configuring or accessing. Note that in some cases (for example, //! ADC_setInterruptSource()) \e socNumber is used to refer to the //! corresponding end-of-conversion (EOC). // //***************************************************************************** typedef enum { ADC_SOC_NUMBER0, //!< SOC/EOC number 0 ADC_SOC_NUMBER1, //!< SOC/EOC number 1 ADC_SOC_NUMBER2, //!< SOC/EOC number 2 ADC_SOC_NUMBER3, //!< SOC/EOC number 3 ADC_SOC_NUMBER4, //!< SOC/EOC number 4 ADC_SOC_NUMBER5, //!< SOC/EOC number 5 ADC_SOC_NUMBER6, //!< SOC/EOC number 6 ADC_SOC_NUMBER7, //!< SOC/EOC number 7 ADC_SOC_NUMBER8, //!< SOC/EOC number 8 ADC_SOC_NUMBER9, //!< SOC/EOC number 9 ADC_SOC_NUMBER10, //!< SOC/EOC number 10 ADC_SOC_NUMBER11, //!< SOC/EOC number 11 ADC_SOC_NUMBER12, //!< SOC/EOC number 12 ADC_SOC_NUMBER13, //!< SOC/EOC number 13 ADC_SOC_NUMBER14, //!< SOC/EOC number 14 ADC_SOC_NUMBER15 //!< SOC/EOC number 15 } ADC_SOCNumber; //***************************************************************************** // //! Values that can be passed in as the \e trigger parameter for the //! ADC_setInterruptSOCTrigger() function. // //***************************************************************************** typedef enum { ADC_INT_SOC_TRIGGER_NONE, //!< No ADCINT will trigger the SOC ADC_INT_SOC_TRIGGER_ADCINT1, //!< ADCINT1 will trigger the SOC ADC_INT_SOC_TRIGGER_ADCINT2 //!< ADCINT2 will trigger the SOC } ADC_IntSOCTrigger; //***************************************************************************** // //! Values that can be passed to ADC_setSOCPriority() as the \e priMode //! parameter. // //***************************************************************************** typedef enum { ADC_PRI_ALL_ROUND_ROBIN, //!< Round robin mode is used for all ADC_PRI_SOC0_HIPRI, //!< SOC 0 hi pri, others in round robin ADC_PRI_THRU_SOC1_HIPRI, //!< SOC 0-1 hi pri, others in round robin ADC_PRI_THRU_SOC2_HIPRI, //!< SOC 0-2 hi pri, others in round robin ADC_PRI_THRU_SOC3_HIPRI, //!< SOC 0-3 hi pri, others in round robin ADC_PRI_THRU_SOC4_HIPRI, //!< SOC 0-4 hi pri, others in round robin ADC_PRI_THRU_SOC5_HIPRI, //!< SOC 0-5 hi pri, others in round robin ADC_PRI_THRU_SOC6_HIPRI, //!< SOC 0-6 hi pri, others in round robin ADC_PRI_THRU_SOC7_HIPRI, //!< SOC 0-7 hi pri, others in round robin ADC_PRI_THRU_SOC8_HIPRI, //!< SOC 0-8 hi pri, others in round robin ADC_PRI_THRU_SOC9_HIPRI, //!< SOC 0-9 hi pri, others in round robin ADC_PRI_THRU_SOC10_HIPRI, //!< SOC 0-10 hi pri, others in round robin ADC_PRI_THRU_SOC11_HIPRI, //!< SOC 0-11 hi pri, others in round robin ADC_PRI_THRU_SOC12_HIPRI, //!< SOC 0-12 hi pri, others in round robin ADC_PRI_THRU_SOC13_HIPRI, //!< SOC 0-13 hi pri, others in round robin ADC_PRI_THRU_SOC14_HIPRI, //!< SOC 0-14 hi pri, SOC15 in round robin ADC_PRI_ALL_HIPRI //!< All priorities based on SOC number } ADC_PriorityMode; //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** //***************************************************************************** // //! \internal //! Checks an ADC base address. //! //! \param base specifies the ADC module base address. //! //! This function determines if a ADC module base address is valid. //! //! \return Returns \b true if the base address is valid and \b false //! otherwise. // //***************************************************************************** static inline _Bool ADC_isBaseValid(uint32_t base) { return((base == 0x00007400U) || (base == 0x00007480U) || (base == 0x00007500U) || (base == 0x00007580U)); } //***************************************************************************** // //! Configures the analog-to-digital converter module prescaler. //! //! \param base is the base address of the ADC module. //! \param clkPrescale is the ADC clock prescaler. //! //! This function configures the ADC module's ADCCLK. //! //! The \e clkPrescale parameter specifies the value by which the input clock //! is divided to make the ADCCLK. The value can be specified with the value //! \b ADC_CLK_DIV_1_0, \b ADC_CLK_DIV_2_0, \b ADC_CLK_DIV_2_5, ..., //! \b ADC_CLK_DIV_7_5, \b ADC_CLK_DIV_8_0, or \b ADC_CLK_DIV_8_5. //! //! \return None. // //***************************************************************************** static inline void ADC_setPrescaler(uint32_t base, ADC_ClkPrescale clkPrescale) { // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 440); } } while(0); // // Set the configuration of the ADC module prescaler. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x1U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x1U)))) & ~0xFU) | (uint16_t)clkPrescale; __edis(); } //***************************************************************************** // //! Configures a start-of-conversion (SOC) in the ADC. //! //! \param base is the base address of the ADC module. //! \param socNumber is the number of the start-of-conversion. //! \param trigger the source that will cause the SOC. //! \param channel is the number associated with the input signal. //! \param sampleWindow is the acquisition window duration. //! //! This function configures the a start-of-conversion (SOC) in the ADC module. //! //! The \e socNumber number is a value \b ADC_SOC_NUMBERX where X is a number //! from 0 to 15 specifying which SOC is to be configured on the ADC module //! specified by \e base. //! //! The \e trigger specifies the event that causes the SOC such as software, a //! timer interrupt, an ePWM event, or an ADC interrupt. It should be a value //! in the format of \b ADC_TRIGGER_XXXX where XXXX is the event such as //! \b ADC_TRIGGER_SW_ONLY, \b ADC_TRIGGER_CPU1_TINT0, \b ADC_TRIGGER_GPIO, //! \b ADC_TRIGGER_EPWM1_SOCA, and so on. //! //! The \e channel parameter specifies the channel to be converted. In //! single-ended mode this is a single pin given by \b ADC_CH_ADCINx where x is //! the number identifying the pin between 0 and 15 inclusive. In differential //! mode, two pins are used as inputs and are passed in the \e channel //! parameter as \b ADC_CH_ADCIN0_ADCIN1, \b ADC_CH_ADCIN2_ADCIN3, ..., or //! \b ADC_CH_ADCIN14_ADCIN15. //! //! The \e sampleWindow parameter is the acquisition window duration in SYSCLK //! cycles. It should be a value between 1 and 512 cycles inclusive. The //! selected duration must be at least as long as one ADCCLK cycle. Also, the //! datasheet will specify a minimum window duration requirement in //! nanoseconds. //! //! \return None. // //***************************************************************************** static inline void ADC_setupSOC(uint32_t base, ADC_SOCNumber socNumber, ADC_Trigger trigger, ADC_Channel channel, uint32_t sampleWindow) { uint32_t ctlRegAddr; // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 498); } } while(0); do { if(!((sampleWindow >= 1U) && (sampleWindow <= 512U))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 499); } } while(0); // // Calculate address for the SOC control register. // ctlRegAddr = base + 0x10U + ((uint32_t)socNumber * 2U); // // Set the configuration of the specified SOC. // __eallow(); (*((volatile uint32_t *)((uintptr_t)(ctlRegAddr)))) = ((uint32_t)channel << 15U) | ((uint32_t)trigger << 20U) | (sampleWindow - 1U); __edis(); } //***************************************************************************** // //! Configures the interrupt SOC trigger of an SOC. //! //! \param base is the base address of the ADC module. //! \param socNumber is the number of the start-of-conversion. //! \param trigger the interrupt source that will cause the SOC. //! //! This function configures the interrupt start-of-conversion trigger in //! the ADC module. //! //! The \e socNumber number is a value \b ADC_SOC_NUMBERX where X is a number //! from 0 to 15 specifying which SOC is to be configured on the ADC module //! specified by \e base. //! //! The \e trigger specifies the interrupt that causes a start of conversion or //! none. It should be one of the following values. //! //! - \b ADC_INT_SOC_TRIGGER_NONE //! - \b ADC_INT_SOC_TRIGGER_ADCINT1 //! - \b ADC_INT_SOC_TRIGGER_ADCINT2 //! //! This functionality is useful for creating continuous conversions. //! //! \return None. // //***************************************************************************** static inline void ADC_setInterruptSOCTrigger(uint32_t base, ADC_SOCNumber socNumber, ADC_IntSOCTrigger trigger) { uint16_t shiftVal; // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 552); } } while(0); // // Each SOC has a 2-bit field in this register. // shiftVal = (uint16_t)socNumber << 1U; // // Set the configuration of the specified SOC. Not that we're treating // ADCINTSOCSEL1 and ADCINTSOCSEL2 as one 32-bit register here. // __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0xAU)))) = ((*((volatile uint32_t *)((uintptr_t)(base + 0xAU)))) & ~((uint32_t)0x3U << shiftVal)) | ((uint32_t)trigger << shiftVal); __edis(); } //***************************************************************************** // //! Sets the timing of the end-of-conversion pulse //! //! \param base is the base address of the ADC module. //! \param pulseMode is the generation mode of the EOC pulse. //! //! This function configures the end-of-conversion (EOC) pulse generated by ADC. //! This pulse will be generated either at the end of the acquisition window //! plus a number of SYSCLK cycles configured by ADC_setInterruptCycleOffset() //! (pass \b ADC_PULSE_END_OF_ACQ_WIN into \e pulseMode) or at the end of the //! voltage conversion, one cycle prior to the ADC result latching into it's //! result register (pass \b ADC_PULSE_END_OF_CONV into \e pulseMode). //! //! \return None. // //***************************************************************************** static inline void ADC_setInterruptPulseMode(uint32_t base, ADC_PulseMode pulseMode) { // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 594); } } while(0); // // Set the position of the pulse. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) & ~0x4U) | (uint16_t)pulseMode; __edis(); } //***************************************************************************** // //! Sets the timing of early interrupt generation. //! //! \param base is the base address of the ADC module. //! \param cycleOffset is the cycles from an SOC falling edge to an early //! interrupt pulse. //! //! This function configures cycle offset between the negative edge of a sample //! pulse and an early interrupt pulse being generated. This number of cycles //! is specified with the \e cycleOffset parameter. //! //! This function only applies when early interrupt generation is enabled. That //! means the ADC_setInterruptPulseMode() function \e pulseMode parameter is //! configured as \b ADC_PULSE_END_OF_ACQ_WIN. //! //! \return None. // //***************************************************************************** static inline void ADC_setInterruptCycleOffset(uint32_t base, uint16_t cycleOffset) { // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 630); } } while(0); // // Set the position of the pulse. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x6FU)))) = cycleOffset; __edis(); } //***************************************************************************** // //! Powers up the analog-to-digital converter core. //! //! \param base is the base address of the ADC module. //! //! This function powers up the analog circuitry inside the analog core. //! //! \note Allow at least a 500us delay before sampling after calling this API. //! If you enable multiple ADCs, you can delay after they all have begun //! powering up. //! //! \return None. // //***************************************************************************** static inline void ADC_enableConverter(uint32_t base) { // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 661); } } while(0); // // Set the bit that powers up the analog circuitry. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) |= 0x80U; __edis(); } //***************************************************************************** // //! Powers down the analog-to-digital converter module. //! //! \param base is the base address of the ADC module. //! //! This function powers down the analog circuitry inside the analog core. //! //! \return None. // //***************************************************************************** static inline void ADC_disableConverter(uint32_t base) { // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 688); } } while(0); // // Clear the bit that powers down the analog circuitry. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) &= ~0x80U; __edis(); } //***************************************************************************** // //! Forces a SOC flag to a 1 in the analog-to-digital converter. //! //! \param base is the base address of the ADC module. //! \param socNumber is the number of the start-of-conversion. //! //! This function forces the SOC flag associated with the SOC specified by //! \e socNumber. This initiates a conversion once that SOC is given //! priority. This software trigger can be used whether or not the SOC has been //! configured to accept some other specific trigger. //! //! \return None. // //***************************************************************************** static inline void ADC_forceSOC(uint32_t base, ADC_SOCNumber socNumber) { // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 719); } } while(0); // // Write to the register that will force a 1 to the corresponding SOC flag // (*((volatile uint16_t *)((uintptr_t)(base + 0xDU)))) = (1U << (uint16_t)socNumber); } //***************************************************************************** // //! Forces multiple SOC flags to 1 in the analog-to-digital converter. //! //! \param base is the base address of the ADC module. //! \param socMask is the SOCs to be forced through software //! //! This function forces the SOCFRC1 flags associated with the SOCs specified //! by \e socMask. This initiates a conversion once the desired SOCs are given //! priority. This software trigger can be used whether or not the SOC has been //! configured to accept some other specific trigger. //! Valid values for \e socMask parameter can be any of the individual //! ADC_FORCE_SOCx values or any of their OR'd combination to trigger multiple //! SOCs. //! //! \note To trigger SOC0, SOC1 and SOC2, value (ADC_FORCE_SOC0 | //! ADC_FORCE_SOC1 | ADC_FORCE_SOC2) should be passed as socMask. //! //! \return None. // //***************************************************************************** static inline void ADC_forceMultipleSOC(uint32_t base, uint16_t socMask) { // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 754); } } while(0); // // Write to the register that will force a 1 to desired SOCs // (*((volatile uint16_t *)((uintptr_t)(base + 0xDU)))) = socMask; } //***************************************************************************** // //! Gets the current ADC interrupt status. //! //! \param base is the base address of the ADC module. //! \param adcIntNum is interrupt number within the ADC wrapper. //! //! This function returns the interrupt status for the analog-to-digital //! converter. //! //! \e adcIntNum takes a one of the values \b ADC_INT_NUMBER1, //! \b ADC_INT_NUMBER2, \b ADC_INT_NUMBER3, or \b ADC_INT_NUMBER4 to express //! which of the four interrupts of the ADC module should be cleared. //! //! \return \b true if the interrupt flag for the specified interrupt number is //! set and \b false if it is not. // //***************************************************************************** static inline _Bool ADC_getInterruptStatus(uint32_t base, ADC_IntNumber adcIntNum) { // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 786); } } while(0); // // Get the specified ADC interrupt status. // return(((*((volatile uint16_t *)((uintptr_t)(base + 0x3U)))) & (1U << (uint16_t)adcIntNum)) != 0U); } //***************************************************************************** // //! Clears ADC interrupt sources. //! //! \param base is the base address of the ADC module. //! \param adcIntNum is interrupt number within the ADC wrapper. //! //! This function clears the specified ADC interrupt sources so that they no //! longer assert. If not in continuous mode, this function must be called //! before any further interrupt pulses may occur. //! //! \e adcIntNum takes a one of the values \b ADC_INT_NUMBER1, //! \b ADC_INT_NUMBER2, \b ADC_INT_NUMBER3, or \b ADC_INT_NUMBER4 to express //! which of the four interrupts of the ADC module should be cleared. //! //! \return None. // //***************************************************************************** static inline void ADC_clearInterruptStatus(uint32_t base, ADC_IntNumber adcIntNum) { // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 818); } } while(0); // // Clear the specified interrupt. // (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) = 1U << (uint16_t)adcIntNum; } //***************************************************************************** // //! Gets the current ADC interrupt overflow status. //! //! \param base is the base address of the ADC module. //! \param adcIntNum is interrupt number within the ADC wrapper. //! //! This function returns the interrupt overflow status for the //! analog-to-digital converter. An overflow condition is generated //! irrespective of the continuous mode. //! //! \e adcIntNum takes a one of the values \b ADC_INT_NUMBER1, //! \b ADC_INT_NUMBER2, \b ADC_INT_NUMBER3, or \b ADC_INT_NUMBER4 to express //! which of the four interrupts of the ADC module should be cleared. //! //! \return \b true if the interrupt overflow flag for the specified interrupt //! number is set and \b false if it is not. // //***************************************************************************** static inline _Bool ADC_getInterruptOverflowStatus(uint32_t base, ADC_IntNumber adcIntNum) { // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 851); } } while(0); // // Get the specified ADC interrupt status. // return(((*((volatile uint16_t *)((uintptr_t)(base + 0x5U)))) & (1U << (uint16_t)adcIntNum)) != 0U); } //***************************************************************************** // //! Clears ADC interrupt overflow sources. //! //! \param base is the base address of the ADC module. //! \param adcIntNum is interrupt number within the ADC wrapper. //! //! This function clears the specified ADC interrupt overflow sources so that //! they no longer assert. If software tries to clear the overflow in the same //! cycle that hardware tries to set the overflow, then hardware has priority. //! //! \e adcIntNum takes a one of the values \b ADC_INT_NUMBER1, //! \b ADC_INT_NUMBER2, \b ADC_INT_NUMBER3, or \b ADC_INT_NUMBER4 to express //! which of the four interrupts of the ADC module should be cleared. //! //! \return None. // //***************************************************************************** static inline void ADC_clearInterruptOverflowStatus(uint32_t base, ADC_IntNumber adcIntNum) { // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 883); } } while(0); // // Clear the specified interrupt overflow bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0x6U)))) = 1U << (uint16_t)adcIntNum; } //***************************************************************************** // //! Reads the conversion result. //! //! \param resultBase is the base address of the ADC results. //! \param socNumber is the number of the start-of-conversion. //! //! This function returns the conversion result that corresponds to the base //! address passed into \e resultBase and the SOC passed into \e socNumber. //! //! The \e socNumber number is a value \b ADC_SOC_NUMBERX where X is a number //! from 0 to 15 specifying which SOC's result is to be read. //! //! \note Take care that you are using a base address for the result registers //! (ADCxRESULT_BASE) and not a base address for the control registers. //! //! \return Returns the conversion result. // //***************************************************************************** static inline uint16_t ADC_readResult(uint32_t resultBase, ADC_SOCNumber socNumber) { // // Check the arguments. // do { if(!((resultBase == 0x00000B00U) || (resultBase == 0x00000B20U) || (resultBase == 0x00000B40U) || (resultBase == 0x00000B60U))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 919); } } while(0); // // Return the ADC result for the selected SOC. // return((*((volatile uint16_t *)((uintptr_t)(resultBase + 0x0U + socNumber))))); } //***************************************************************************** // //! Determines whether the ADC is busy or not. //! //! \param base is the base address of the ADC. //! //! This function allows the caller to determine whether or not the ADC is //! busy and can sample another channel. //! //! \return Returns \b true if the ADC is sampling or \b false if all //! samples are complete. // //***************************************************************************** static inline _Bool ADC_isBusy(uint32_t base) { // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 946); } } while(0); // // Determine if the ADC is busy. // return(((*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) & 0x2000U) != 0U); } //***************************************************************************** // //! Set SOC burst mode. //! //! \param base is the base address of the ADC. //! \param trigger the source that will cause the burst conversion sequence. //! \param burstSize is the number of SOCs converted during a burst sequence. //! //! This function configures the burst trigger and burstSize of an ADC module. //! Burst mode allows a single trigger to walk through the round-robin SOCs one //! or more at a time. When burst mode is enabled, the trigger selected by the //! ADC_setupSOC() API will no longer have an effect on the SOCs in round-robin //! mode. Instead, the source specified through the \e trigger parameter will //! cause a burst of \e burstSize conversions to occur. //! //! The \e trigger parameter takes the same values as the ADC_setupSOC() API //! The \e burstSize parameter should be a value between 1 and 16 inclusive. //! //! \return None. // //***************************************************************************** static inline void ADC_setBurstModeConfig(uint32_t base, ADC_Trigger trigger, uint16_t burstSize) { uint16_t regValue; // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 983); } } while(0); do { if(!((trigger & ~0x1FU) == 0U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 984); } } while(0); do { if(!((burstSize >= 1U) && (burstSize <= 16U))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 985); } } while(0); // // Write the burst mode configuration to the register. // __eallow(); regValue = (uint16_t)trigger | ((burstSize - 1U) << 8U); (*((volatile uint16_t *)((uintptr_t)(base + 0x2U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x2U)))) & ~((uint16_t)0x3FU | 0xF00U)) | regValue; __edis(); } //***************************************************************************** // //! Enables SOC burst mode. //! //! \param base is the base address of the ADC. //! //! This function enables SOC burst mode operation of the ADC. Burst mode //! allows a single trigger to walk through the round-robin SOCs one or more at //! a time. When burst mode is enabled, the trigger selected by the //! ADC_setupSOC() API will no longer have an effect on the SOCs in round-robin //! mode. Use ADC_setBurstMode() to configure the burst trigger and size. //! //! \return None. // //***************************************************************************** static inline void ADC_enableBurstMode(uint32_t base) { // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 1023); } } while(0); // // Enable burst mode. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x2U)))) |= 0x8000U; __edis(); } //***************************************************************************** // //! Disables SOC burst mode. //! //! \param base is the base address of the ADC. //! //! This function disables SOC burst mode operation of the ADC. SOCs in //! round-robin mode will be triggered by the trigger configured using the //! ADC_setupSOC() API. //! //! \return None. // //***************************************************************************** static inline void ADC_disableBurstMode(uint32_t base) { // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 1052); } } while(0); // // Disable burst mode. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x2U)))) &= ~0x8000U; __edis(); } //***************************************************************************** // //! Sets the priority mode of the SOCs. //! //! \param base is the base address of the ADC. //! \param priMode is the priority mode of the SOCs. //! //! This function sets the priority mode of the SOCs. There are three main //! modes that can be passed in the \e priMode parameter //! //! - All SOCs are in round-robin mode. This means no SOC has an inherent //! higher priority over another. This is selected by passing in the value //! \b ADC_PRI_ALL_ROUND_ROBIN. //! - All priorities are in high priority mode. This means that the priority of //! the SOC is determined by its SOC number. This option is selected by passing //! in the value \b ADC_PRI_ALL_HIPRI. //! - A range of SOCs are assigned high priority, with all others in round //! robin mode. High priority mode means that an SOC with high priority will //! interrupt the round robin wheel and insert itself as the next conversion. //! Passing in the value \b ADC_PRI_SOC0_HIPRI will make SOC0 highest priority, //! \b ADC_PRI_THRU_SOC1_HIPRI will put SOC0 and SOC 1 in high priority, and so //! on up to \b ADC_PRI_THRU_SOC14_HIPRI where SOCs 0 through 14 are in high //! priority. //! //! \return None. // //***************************************************************************** static inline void ADC_setSOCPriority(uint32_t base, ADC_PriorityMode priMode) { // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 1095); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x9U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x9U)))) & ~0x1FU) | (uint16_t)priMode; __edis(); } //***************************************************************************** // //! Configures a post-processing block (PPB) in the ADC. //! //! \param base is the base address of the ADC module. //! \param ppbNumber is the number of the post-processing block. //! \param socNumber is the number of the start-of-conversion. //! //! This function associates a post-processing block with a SOC. //! //! The \e ppbNumber is a value \b ADC_PPB_NUMBERX where X is a value from 1 to //! 4 inclusive that identifies a PPB to be configured. The \e socNumber //! number is a value \b ADC_SOC_NUMBERX where X is a number from 0 to 15 //! specifying which SOC is to be configured on the ADC module specified by //! \e base. //! //! \note You can have more that one PPB associated with the same SOC, but a //! PPB can only be configured to correspond to one SOC at a time. Also note //! that when you have multiple PPBs for the same SOC, the calibration offset //! that actually gets applied will be that of the PPB with the highest number. //! Since SOC0 is the default for all PPBs, look out for unintentional //! overwriting of a lower numbered PPB's offset. //! //! \return None. // //***************************************************************************** static inline void ADC_setupPPB(uint32_t base, ADC_PPBNumber ppbNumber, ADC_SOCNumber socNumber) { uint32_t ppbOffset; // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 1140); } } while(0); // // Get the offset to the appropriate PPB configuration register. // ppbOffset = ((0x48U - 0x40U) * (uint32_t)ppbNumber) + 0x40U; // // Write the configuration to the register. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + ppbOffset)))) = ((*((volatile uint16_t *)((uintptr_t)(base + ppbOffset)))) & ~0xFU) | ((uint16_t)socNumber & 0xFU); __edis(); } //***************************************************************************** // //! Enables individual ADC PPB event sources. //! //! \param base is the base address of the ADC module. //! \param ppbNumber is the number of the post-processing block. //! \param evtFlags is a bit mask of the event sources to be enabled. //! //! This function enables the indicated ADC PPB event sources. This will allow //! the specified events to propagate through the X-BAR to a pin or to an ePWM //! module. The \e evtFlags parameter can be any of the \b ADC_EVT_TRIPHI, //! \b ADC_EVT_TRIPLO, or \b ADC_EVT_ZERO values. //! //! \return None. // //***************************************************************************** static inline void ADC_enablePPBEvent(uint32_t base, ADC_PPBNumber ppbNumber, uint16_t evtFlags) { // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 1179); } } while(0); do { if(!((evtFlags & ~0x7U) == 0U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 1180); } } while(0); // // Enable the specified event. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x34U)))) |= evtFlags << ((uint16_t)ppbNumber * 4U); __edis(); } //***************************************************************************** // //! Disables individual ADC PPB event sources. //! //! \param base is the base address of the ADC module. //! \param ppbNumber is the number of the post-processing block. //! \param evtFlags is a bit mask of the event sources to be enabled. //! //! This function disables the indicated ADC PPB event sources. This will stop //! the specified events from propagating through the X-BAR to other modules. //! The \e evtFlags parameter can be any of the \b ADC_EVT_TRIPHI, //! \b ADC_EVT_TRIPLO, or \b ADC_EVT_ZERO values. //! //! \return None. // //***************************************************************************** static inline void ADC_disablePPBEvent(uint32_t base, ADC_PPBNumber ppbNumber, uint16_t evtFlags) { // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 1212); } } while(0); do { if(!((evtFlags & ~0x7U) == 0U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 1213); } } while(0); // // Disable the specified event. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x34U)))) &= ~(evtFlags << ((uint16_t)ppbNumber * 4U)); __edis(); } //***************************************************************************** // //! Enables individual ADC PPB event interrupt sources. //! //! \param base is the base address of the ADC module. //! \param ppbNumber is the number of the post-processing block. //! \param intFlags is a bit mask of the interrupt sources to be enabled. //! //! This function enables the indicated ADC PPB interrupt sources. Only the //! sources that are enabled can be reflected to the processor interrupt. //! Disabled sources have no effect on the processor. The \e intFlags //! parameter can be any of the \b ADC_EVT_TRIPHI, \b ADC_EVT_TRIPLO, or //! \b ADC_EVT_ZERO values. //! //! \return None. // //***************************************************************************** static inline void ADC_enablePPBEventInterrupt(uint32_t base, ADC_PPBNumber ppbNumber, uint16_t intFlags) { // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 1247); } } while(0); do { if(!((intFlags & ~0x7U) == 0U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 1248); } } while(0); // // Enable the specified event interrupts. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x36U)))) |= intFlags << ((uint16_t)ppbNumber * 4U); __edis(); } //***************************************************************************** // //! Disables individual ADC PPB event interrupt sources. //! //! \param base is the base address of the ADC module. //! \param ppbNumber is the number of the post-processing block. //! \param intFlags is a bit mask of the interrupt source to be disabled. //! //! This function disables the indicated ADC PPB interrupt sources. Only the //! sources that are enabled can be reflected to the processor interrupt. //! Disabled sources have no effect on the processor. The \e intFlags //! parameter can be any of the \b ADC_EVT_TRIPHI, \b ADC_EVT_TRIPLO, or //! \b ADC_EVT_ZERO values. //! //! \return None. // //***************************************************************************** static inline void ADC_disablePPBEventInterrupt(uint32_t base, ADC_PPBNumber ppbNumber, uint16_t intFlags) { // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 1282); } } while(0); do { if(!((intFlags & ~0x7U) == 0U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 1283); } } while(0); // // Disable the specified event interrupts. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x36U)))) &= ~(intFlags << ((uint16_t)ppbNumber * 4U)); __edis(); } //***************************************************************************** // //! Gets the current ADC event status. //! //! \param base is the base address of the ADC module. //! \param ppbNumber is the number of the post-processing block. //! //! This function returns the event status for the analog-to-digital converter. //! //! \return Returns the current event status, enumerated as a bit field of //! \b ADC_EVT_TRIPHI, \b ADC_EVT_TRIPLO, and \b ADC_EVT_ZERO. // //***************************************************************************** static inline uint16_t ADC_getPPBEventStatus(uint32_t base, ADC_PPBNumber ppbNumber) { // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 1313); } } while(0); // // Get the event status for the specified post-processing block. // return(((*((volatile uint16_t *)((uintptr_t)(base + 0x30U)))) >> ((uint16_t)ppbNumber * 4U)) & 0x7U); } //***************************************************************************** // //! Clears ADC event flags. //! //! \param base is the base address of the ADC module. //! \param ppbNumber is the number of the post-processing block. //! \param evtFlags is a bit mask of the event source to be cleared. //! //! This function clears the indicated ADC PPB event flags. After an event //! occurs this function must be called to allow additional events to be //! produced. The \e evtFlags parameter can be any of the \b ADC_EVT_TRIPHI, //! \b ADC_EVT_TRIPLO, or \b ADC_EVT_ZERO values. //! //! \return None. // //***************************************************************************** static inline void ADC_clearPPBEventStatus(uint32_t base, ADC_PPBNumber ppbNumber, uint16_t evtFlags) { // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 1345); } } while(0); do { if(!((evtFlags & ~0x7U) == 0U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 1346); } } while(0); // // Clear the specified event interrupts. // (*((volatile uint16_t *)((uintptr_t)(base + 0x32U)))) |= evtFlags << ((uint16_t)ppbNumber * 4U); } //***************************************************************************** // //! Reads the processed conversion result from the PPB. //! //! \param resultBase is the base address of the ADC results. //! \param ppbNumber is the number of the post-processing block. //! //! This function returns the processed conversion result that corresponds to //! the base address passed into \e resultBase and the PPB passed into //! \e ppbNumber. //! //! \note Take care that you are using a base address for the result registers //! (ADCxRESULT_BASE) and not a base address for the control registers. //! //! \return Returns the signed 32-bit conversion result. // //***************************************************************************** static inline int32_t ADC_readPPBResult(uint32_t resultBase, ADC_PPBNumber ppbNumber) { // // Check the arguments. // do { if(!((resultBase == 0x00000B00U) || (resultBase == 0x00000B20U) || (resultBase == 0x00000B40U) || (resultBase == 0x00000B60U))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 1380); } } while(0); // // Return the result of selected PPB. // return((int32_t)(*((volatile uint32_t *)((uintptr_t)(resultBase + 0x10U + ppbNumber))))); } //***************************************************************************** // //! Reads sample delay time stamp from a PPB. //! //! \param base is the base address of the ADC module. //! \param ppbNumber is the number of the post-processing block. //! //! This function returns the sample delay time stamp. This delay is the number //! of system clock cycles between the SOC being triggered and when it began //! converting. //! //! \return Returns the delay time stamp. // //***************************************************************************** static inline uint16_t ADC_getPPBDelayTimeStamp(uint32_t base, ADC_PPBNumber ppbNumber) { uint32_t ppbOffset; // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 1410); } } while(0); // // Get the offset to the appropriate delay. // ppbOffset = ((0x49U - 0x41U) * (uint32_t)ppbNumber) + 0x41U; // // Return the delay time stamp. // return((*((volatile uint16_t *)((uintptr_t)(base + ppbOffset)))) & 0xFFFU); } //***************************************************************************** // //! Sets the post processing block offset correction. //! //! \param base is the base address of the ADC module. //! \param ppbNumber is the number of the post-processing block. //! \param offset is the 10-bit signed value subtracted from ADC the output. //! //! This function sets the PPB offset correction value. This value can be used //! to digitally remove any system-level offset inherent in the ADCIN circuit //! before it is stored in the appropriate result register. The \e offset //! parameter is \b subtracted from the ADC output and is a signed value from //! -512 to 511 inclusive. For example, when \e offset = 1, ADCRESULT = ADC //! output - 1. When \e offset = -512, ADCRESULT = ADC output - (-512) or ADC //! output + 512. //! //! Passing a zero in to the \e offset parameter will effectively disable the //! calculation, allowing the raw ADC result to be passed unchanged into the //! result register. //! //! \note If multiple PPBs are applied to the same SOC, the offset that will be //! applied will be that of the PPB with the highest number. //! //! \return None // //***************************************************************************** static inline void ADC_setPPBCalibrationOffset(uint32_t base, ADC_PPBNumber ppbNumber, int16_t offset) { uint32_t ppbOffset; // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 1458); } } while(0); // // Get the offset to the appropriate offset register. // ppbOffset = ((0x4AU - 0x42U) * (uint32_t)ppbNumber) + 0x42U; // // Write the offset amount. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + ppbOffset)))) = ((*((volatile uint16_t *)((uintptr_t)(base + ppbOffset)))) & ~0x3FFU) | ((uint16_t)offset & 0x3FFU); __edis(); } //***************************************************************************** // //! Sets the post processing block reference offset. //! //! \param base is the base address of the ADC module. //! \param ppbNumber is the number of the post-processing block. //! \param offset is the 16-bit unsigned value subtracted from ADC the output. //! //! This function sets the PPB reference offset value. This can be used to //! either calculate the feedback error or convert a unipolar signal to bipolar //! by subtracting a reference value. The result will be stored in the //! appropriate PPB result register which can be read using ADC_readPPBResult(). //! //! Passing a zero in to the \e offset parameter will effectively disable the //! calculation and will pass the ADC result to the PPB result register //! unchanged. //! //! \note If in 12-bit mode, you may only pass a 12-bit value into the \e offset //! parameter. //! //! \return None // //***************************************************************************** static inline void ADC_setPPBReferenceOffset(uint32_t base, ADC_PPBNumber ppbNumber, uint16_t offset) { uint32_t ppbOffset; // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 1507); } } while(0); // // Get the offset to the appropriate offset register. // ppbOffset = ((0x4BU - 0x43U) * (uint32_t)ppbNumber) + 0x43U; // // Write the offset amount. // (*((volatile uint16_t *)((uintptr_t)(base + ppbOffset)))) = offset; } //***************************************************************************** // //! Enables two's complement capability in the PPB. //! //! \param base is the base address of the ADC module. //! \param ppbNumber is the number of the post-processing block. //! //! This function enables two's complement in the post-processing block //! specified by the \e ppbNumber parameter. When enabled, a two's complement //! will be performed on the output of the offset subtraction before it is //! stored in the appropriate PPB result register. In other words, the PPB //! result will be the reference offset value minus the the ADC result value //! (ADCPPBxRESULT = ADCSOCxOFFREF - ADCRESULTx). //! //! \return None // //***************************************************************************** static inline void ADC_enablePPBTwosComplement(uint32_t base, ADC_PPBNumber ppbNumber) { uint32_t ppbOffset; // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 1545); } } while(0); // // Get the offset to the appropriate PPB configuration register. // ppbOffset = ((0x48U - 0x40U) * (uint32_t)ppbNumber) + 0x40U; // // Return the delay time stamp. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + ppbOffset)))) |= 0x10U; __edis(); } //***************************************************************************** // //! Disables two's complement capability in the PPB. //! //! \param base is the base address of the ADC module. //! \param ppbNumber is the number of the post-processing block. //! //! This function disables two's complement in the post-processing block //! specified by the \e ppbNumber parameter. When disabled, a two's complement //! will \b NOT be performed on the output of the offset subtraction before it //! is stored in the appropriate PPB result register. In other words, the PPB //! result will be the ADC result value minus the reference offset value //! (ADCPPBxRESULT = ADCRESULTx - ADCSOCxOFFREF). //! //! \return None // //***************************************************************************** static inline void ADC_disablePPBTwosComplement(uint32_t base, ADC_PPBNumber ppbNumber) { uint32_t ppbOffset; // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 1585); } } while(0); // // Get the offset to the appropriate PPB configuration register. // ppbOffset = ((0x48U - 0x40U) * (uint32_t)ppbNumber) + 0x40U; // // Return the delay time stamp. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + ppbOffset)))) &= ~0x10U; __edis(); } //***************************************************************************** // //! Enables an ADC interrupt source. //! //! \param base is the base address of the ADC module. //! \param adcIntNum is interrupt number within the ADC wrapper. //! //! This function enables the indicated ADC interrupt source. Only the //! sources that are enabled can be reflected to the processor interrupt. //! Disabled sources have no effect on the processor. //! //! \e adcIntNum can take the value \b ADC_INT_NUMBER1, \b ADC_INT_NUMBER2, //! \b ADC_INT_NUMBER3, or \b ADC_INT_NUMBER4 to express which of the four //! interrupts of the ADC module should be enabled. //! //! \return None. // //***************************************************************************** static inline void ADC_enableInterrupt(uint32_t base, ADC_IntNumber adcIntNum) { uint32_t intRegAddr; uint16_t shiftVal; // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 1627); } } while(0); // // Each INTSEL register manages two interrupts. If the interrupt number is // even, we'll be accessing the upper byte and will need to shift. // intRegAddr = base + 0x7U + ((uint32_t)adcIntNum >> 1); shiftVal = ((uint16_t)adcIntNum & 0x1U) << 3U; // // Enable the specified ADC interrupt. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(intRegAddr)))) |= 0x20U << shiftVal; __edis(); } //***************************************************************************** // //! Disables an ADC interrupt source. //! //! \param base is the base address of the ADC module. //! \param adcIntNum is interrupt number within the ADC wrapper. //! //! This function disables the indicated ADC interrupt source. //! Only the sources that are enabled can be reflected to the processor //! interrupt. Disabled sources have no effect on the processor. //! //! \e adcIntNum can take the value \b ADC_INT_NUMBER1, \b ADC_INT_NUMBER2, //! \b ADC_INT_NUMBER3, or \b ADC_INT_NUMBER4 to express which of the four //! interrupts of the ADC module should be disabled. //! //! \return None. // //***************************************************************************** static inline void ADC_disableInterrupt(uint32_t base, ADC_IntNumber adcIntNum) { uint32_t intRegAddr; uint16_t shiftVal; // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 1673); } } while(0); // // Each INTSEL register manages two interrupts. If the interrupt number is // even, we'll be accessing the upper byte and will need to shift. // intRegAddr = base + 0x7U + ((uint32_t)adcIntNum >> 1); shiftVal = ((uint16_t)adcIntNum & 0x1U) << 3U; // // Disable the specified ADC interrupt. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(intRegAddr)))) &= ~(0x20U << shiftVal); __edis(); } //***************************************************************************** // //! Sets the source EOC for an analog-to-digital converter interrupt. //! //! \param base is the base address of the ADC module. //! \param adcIntNum is interrupt number within the ADC wrapper. //! \param socNumber is the number of the start-of-conversion. //! //! This function sets which conversion is the source of an ADC interrupt. //! //! The \e socNumber number is a value \b ADC_SOC_NUMBERX where X is a number //! from 0 to 15 specifying which EOC is to be configured on the ADC module //! specified by \e base. //! //! \e adcIntNum can take the value \b ADC_INT_NUMBER1, \b ADC_INT_NUMBER2, //! \b ADC_INT_NUMBER3, or \b ADC_INT_NUMBER4 to express which of the four //! interrupts of the ADC module is being configured. //! //! \return None. // //***************************************************************************** static inline void ADC_setInterruptSource(uint32_t base, ADC_IntNumber adcIntNum, ADC_SOCNumber socNumber) { uint32_t intRegAddr; uint16_t shiftVal; // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 1723); } } while(0); // // Each INTSEL register manages two interrupts. If the interrupt number is // even, we'll be accessing the upper byte and will need to shift. // intRegAddr = base + 0x7U + ((uint32_t)adcIntNum >> 1); shiftVal = ((uint16_t)adcIntNum & 0x1U) << 3U; // // Set the specified ADC interrupt source. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(intRegAddr)))) = ((*((volatile uint16_t *)((uintptr_t)(intRegAddr)))) & ~(0xFU << shiftVal)) | ((uint16_t)socNumber << shiftVal); __edis(); } //***************************************************************************** // //! Enables continuous mode for an ADC interrupt. //! //! \param base is the base address of the ADC. //! \param adcIntNum is interrupt number within the ADC wrapper. //! //! This function enables continuous mode for the ADC interrupt passed into //! \e adcIntNum. This means that pulses will be generated for the specified //! ADC interrupt whenever an EOC pulse is generated irrespective of whether or //! not the flag bit is set. //! //! \e adcIntNum can take the value \b ADC_INT_NUMBER1, \b ADC_INT_NUMBER2, //! \b ADC_INT_NUMBER3, or \b ADC_INT_NUMBER4 to express which of the four //! interrupts of the ADC module is being configured. //! //! \return None. // //***************************************************************************** static inline void ADC_enableContinuousMode(uint32_t base, ADC_IntNumber adcIntNum) { uint32_t intRegAddr; uint16_t shiftVal; // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 1772); } } while(0); // // Each INTSEL register manages two interrupts. If the interrupt number is // even, we'll be accessing the upper byte and will need to shift. // intRegAddr = base + 0x7U + ((uint32_t)adcIntNum >> 1); shiftVal = ((uint16_t)adcIntNum & 0x1U) << 3U; // // Enable continuous mode for the specified ADC interrupt. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(intRegAddr)))) |= 0x40U << shiftVal; __edis(); } //***************************************************************************** // //! Disables continuous mode for an ADC interrupt. //! //! \param base is the base address of the ADC. //! \param adcIntNum is interrupt number within the ADC wrapper. //! //! This function disables continuous mode for the ADC interrupt passed into //! \e adcIntNum. This means that pulses will not be generated for the //! specified ADC interrupt until the corresponding interrupt flag for the //! previous interrupt occurrence has been cleared using //! ADC_clearInterruptStatus(). //! //! \e adcIntNum can take the value \b ADC_INT_NUMBER1, \b ADC_INT_NUMBER2, //! \b ADC_INT_NUMBER3, or \b ADC_INT_NUMBER4 to express which of the four //! interrupts of the ADC module is being configured. //! //! \return None. // //***************************************************************************** static inline void ADC_disableContinuousMode(uint32_t base, ADC_IntNumber adcIntNum) { uint32_t intRegAddr; uint16_t shiftVal; // // Check the arguments. // do { if(!(ADC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/adc.h", 1820); } } while(0); // // Each INTSEL register manages two interrupts. If the interrupt number is // even, we'll be accessing the upper byte and will need to shift. // intRegAddr = base + 0x7U + ((uint32_t)adcIntNum >> 1); shiftVal = ((uint16_t)adcIntNum & 0x1U) << 3U; // // Disable continuous mode for the specified ADC interrupt. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(intRegAddr)))) &= ~(0x40U << shiftVal); __edis(); } //***************************************************************************** // //! Converts temperature from sensor reading to degrees C //! //! \param tempResult is the raw ADC A conversion result from the temp sensor. //! \param vref is the reference voltage being used (for example 3.3 for 3.3V). //! //! This function converts temperature from temp sensor reading to degrees C. //! Temp sensor values in production test are derived with 2.5V reference. //! The \b vref argument in the function is used to scale the temp sensor //! reading accordingly if temp sensor value is read at a different VREF //! setting. //! //! \return Returns the temperature sensor reading converted to degrees C. // //***************************************************************************** static inline int16_t ADC_getTemperatureC(uint16_t tempResult, float32_t vref) { // // Read temp sensor slope and offset locations from OTP and convert // return((int16_t)((((float32_t)tempResult * vref / 4096.0F) - (*(float32_t *)((uintptr_t)0x701CA))) / (*(float32_t *)((uintptr_t)0x701C8)))); } //***************************************************************************** // //! Converts temperature from sensor reading to degrees K //! //! \param tempResult is the raw ADC A conversion result from the temp sensor. //! \param vref is the reference voltage being used (for example 3.3 for 3.3V). //! //! This function converts temperature from temp sensor reading to degrees K. //! Temp sensor values in production test are derived with 2.5V reference. //! The \b vref argument in the function is used to scale the temp sensor //! reading accordingly if temp sensor value is read at a different VREF //! setting. //! //! \return Returns the temperature sensor reading converted to degrees K. // //***************************************************************************** static inline int16_t ADC_getTemperatureK(uint16_t tempResult, float32_t vref) { // // Read temp sensor slope and offset locations from OTP and convert // return((int16_t)(((((float32_t)tempResult * vref / 4096.0F) - (*(float32_t *)((uintptr_t)0x701CA))) / (*(float32_t *)((uintptr_t)0x701C8))) + 273)); } //***************************************************************************** // //! Configures the analog-to-digital converter resolution and signal mode. //! //! \param base is the base address of the ADC module. //! \param resolution is the resolution of the converter (12 or 16 bits). //! \param signalMode is the input signal mode of the converter. //! //! This function configures the ADC module's conversion resolution and input //! signal mode and ensures that the corresponding trims are loaded. //! //! The \e resolution parameter specifies the resolution of the conversion. //! It can be 12-bit or 16-bit specified by \b ADC_RESOLUTION_12BIT //! or \b ADC_RESOLUTION_16BIT. //! //! The \e signalMode parameter specifies the signal mode. In single-ended //! mode, which is indicated by \b ADC_MODE_SINGLE_ENDED, the input voltage is //! sampled on a single pin referenced to VREFLO. In differential mode, which //! is indicated by \b ADC_MODE_DIFFERENTIAL, the input voltage to the //! converter is sampled on a pair of input pins, a positive and a negative. //! //! \b Note: In this device, differential signal conversions are supported //! only in 16-bit resolution mode and single-ended signal conversions //! are supported in both 12-bit & 16-bit resolution mode. //! //! \return None. // //***************************************************************************** extern void ADC_setMode(uint32_t base, ADC_Resolution resolution, ADC_SignalMode signalMode); //***************************************************************************** // //! Sets the windowed trip limits for a PPB. //! //! \param base is the base address of the ADC module. //! \param ppbNumber is the number of the post-processing block. //! \param tripHiLimit is the value is the digital comparator trip high limit. //! \param tripLoLimit is the value is the digital comparator trip low limit. //! //! This function sets the windowed trip limits for a PPB. These values set //! the digital comparator so that when one of the values is exceeded, either a //! high or low trip event will occur. //! //! The \e ppbNumber is a value \b ADC_PPB_NUMBERX where X is a value from 1 to //! 4 inclusive that identifies a PPB to be configured. //! //! If using 16-bit mode, you may pass a 17-bit number into the \e tripHiLimit //! and \e tripLoLimit parameters where the 17th bit is the sign bit (that is //! a value from -65536 and 65535). In 12-bit mode, only bits 12:0 will be //! compared against bits 12:0 of the PPB result. //! //! //! \return None. // //***************************************************************************** extern void ADC_setPPBTripLimits(uint32_t base, ADC_PPBNumber ppbNumber, int32_t tripHiLimit, int32_t tripLoLimit); //***************************************************************************** // // Close the Doxygen group. //! @} // //***************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //########################################################################### // // FILE: asysctl.h // // TITLE: C28x driver for Analog System Control. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup asysctl_api ASysCtl //! @{ // //***************************************************************************** //########################################################################### // // FILE: hw_asysctl.h // // TITLE: Definitions for the ASYSCTL registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the ASYSCTL register offsets // //***************************************************************************** // Register // Register // Register // Register // Register // Register // Register //***************************************************************************** // // The following are defines for the bit fields in the INTOSC1TRIM register // //***************************************************************************** // Bits //***************************************************************************** // // The following are defines for the bit fields in the INTOSC2TRIM register // //***************************************************************************** // Bits //***************************************************************************** // // The following are defines for the bit fields in the TSNSCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the LOCK register // //***************************************************************************** // Register Lock //***************************************************************************** // // The following are defines for the bit fields in the ANAREFTRIMA register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ANAREFTRIMB register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ANAREFTRIMC register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ANAREFTRIMD register // //***************************************************************************** //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** //***************************************************************************** // //! Enable temperature sensor. //! //! This function enables the temperature sensor output to the ADC. //! //! \return None. // //***************************************************************************** static inline void ASysCtl_enableTemperatureSensor(void) { __eallow(); // // Set the temperature sensor enable bit. // (*((volatile uint16_t *)((uintptr_t)(0x0005D700U + 0x26U)))) |= 0x1U; __edis(); } //***************************************************************************** // //! Disable temperature sensor. //! //! This function disables the temperature sensor output to the ADC. //! //! \return None. // //***************************************************************************** static inline void ASysCtl_disableTemperatureSensor(void) { __eallow(); // // Clear the temperature sensor enable bit. // (*((volatile uint16_t *)((uintptr_t)(0x0005D700U + 0x26U)))) &= ~(0x1U); __edis(); } //***************************************************************************** // //! Locks the temperature sensor control register. //! //! \return None. // //***************************************************************************** static inline void ASysCtl_lockTemperatureSensor(void) { __eallow(); // // Write a 1 to the lock bit in the LOCK register. // (*((volatile uint16_t *)((uintptr_t)(0x0005D700U + 0x2EU)))) |= 0x8U; __edis(); } //***************************************************************************** // // Close the Doxygen group. //! @} // //***************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //########################################################################### // // FILE: bgcrc.h // // TITLE: C28x BGCRC driver. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup bgcrc_api BGCRC //! \brief This module is used for configuring BGCRC. //! @{ // //***************************************************************************** //########################################################################### // // FILE: hw_bgcrc.h // // TITLE: Definitions for the BGCRC registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the BGCRC register offsets // //***************************************************************************** // check // against // configuration // value // value // lockconfiguration // configuration //***************************************************************************** // // The following are defines for the bit fields in the BGCRC_EN register // //***************************************************************************** // CRC calculations //***************************************************************************** // // The following are defines for the bit fields in the BGCRC_CTRL1 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the BGCRC_CTRL2 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the BGCRC_WD_CFG register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the BGCRC_NMIFLG register // //***************************************************************************** // during memory data read. // obtained during memory data read. // before BGCRC_WD_MIN // complete within BGCRC_WD_MAX //***************************************************************************** // // The following are defines for the bit fields in the BGCRC_NMICLR register // //***************************************************************************** // clear // clear //***************************************************************************** // // The following are defines for the bit fields in the BGCRC_NMIFRC register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the BGCRC_INTEN register // //***************************************************************************** // register // register // enable register // enable register // register // register //***************************************************************************** // // The following are defines for the bit fields in the BGCRC_INTFLG register // //***************************************************************************** // flag // during memory data read. // obtained during memory data read. // before BGCRC_WD_MIN // complete within BGCRC_WD_MAX //***************************************************************************** // // The following are defines for the bit fields in the BGCRC_INTCLR register // //***************************************************************************** // clear // clear //***************************************************************************** // // The following are defines for the bit fields in the BGCRC_INTFRC register // //***************************************************************************** // force // force //***************************************************************************** // // The following are defines for the bit fields in the BGCRC_LOCK register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the BGCRC_COMMIT register // //***************************************************************************** //***************************************************************************** // //! Values that can be passed to BGCRC_setConfig() as the \e nmiConfig //! parameter // //***************************************************************************** //! min)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/bgcrc.h", 322); } } while(0); // // Set the min and max values // __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0x1EU)))) = min; (*((volatile uint32_t *)((uintptr_t)(base + 0x20U)))) = max; __edis(); } //***************************************************************************** // //! Configures the memory region for check //! //! \param base is the BGCRC module base address. //! \param startAddr is the start address of the block //! \param blockSize is the size of the block //! \param mode is the BGCRC test mode //! //! This function configures the memory region to be checked //! //! \e blockSize can take values \b BGCRC_SIZE_KBYTES(x) and/or //! \b BGCRC_SIZE_BYTES_x. For example, to configure a region of size 2.5KB, //! set \e blockSize as BGCRC_SIZE_KBYTES(2) + BGCRC_SIZE_BYTES_512 //! //! \e mode can take values \b BGCRC_SCRUB_MODE or \b BGCRC_CRC_MODE. In Scrub //! mode, CRC of data is not compared with the golden CRC. Error check is done //! using the ECC/Parity logic. In CRC mode, value is compared with golden CRC //! at the end in addition to the data correctness check by ECC/Parity logic. //! //! \return None. // //***************************************************************************** static inline void BGCRC_setRegion(uint32_t base, uint32_t startAddr, uint32_t blockSize, uint32_t mode) { // // Check the arguments. // do { if(!(BGCRC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/bgcrc.h", 362); } } while(0); do { if(!((blockSize > 0U) && (blockSize <= (4U * (256U))))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/bgcrc.h", 364); } } while(0); do { if(!((mode == 0xAU) || (mode == 0x5U))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/bgcrc.h", 365); } } while(0); // // Set the start address and size of the block. Set the mode of operation // __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0x6U)))) = startAddr; (*((volatile uint32_t *)((uintptr_t)(base + 0x4U)))) = ((blockSize - 1U) << 0U) | (mode << 16U); __edis(); } //***************************************************************************** // //! Gets the BGCRC watchdog counter value //! //! \param base is the BGCRC module base address. //! //! This function returns the BGCRC watchdog counter value //! //! \return Watchdog counter value. // //***************************************************************************** static inline uint32_t BGCRC_getWatchdogCounterValue(uint32_t base) { // // Check the arguments. // do { if(!(BGCRC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/bgcrc.h", 397); } } while(0); return((*((volatile uint32_t *)((uintptr_t)(base + 0x22U))))); } //***************************************************************************** // //! Enables individual BGCRC interrupt sources //! //! \param base is the BGCRC module base address. //! \param intFlags is the bit mask of the interrupt sources to be disabled. //! //! This function enables the indicated BGCRC interrupt sources. Only the //! sources that are enabled can be reflected to the processor interrupt, //! disabled sources have no effect on the processor. //! //! The \e intFlags parameter is the logical OR of any of the following: //! //! - \b BGCRC_TEST_DONE - Test done interrupt //! - \b BGCRC_CRC_FAIL - CRC Fail Interrupt //! - \b BGCRC_UNCORR_ERR - Uncorrectable Error Interrupt //! - \b BGCRC_CORR_ERR - Correctable Error Interrupt //! - \b BGCRC_WD_UNDERFLOW - Watchdog Underflow Error Interrupt //! - \b BGCRC_WD_OVERFLOW - Watchdog Overflow Error Interrupt //! //! \return None // //***************************************************************************** static inline void BGCRC_enableInterrupt(uint32_t base, uint32_t intFlags) { // // Check the arguments. // do { if(!(BGCRC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/bgcrc.h", 431); } } while(0); do { if(!((intFlags & (0x02U | (0x04U | 0x08U | 0x10U | 0x20U | 0x40U))) == intFlags)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/bgcrc.h", 432); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0x34U)))) |= intFlags; __edis(); } //***************************************************************************** // //! Disables individual BGCRC interrupt sources. //! //! \param base is the BGCRC module base address. //! \param intFlags is the bit mask of the interrupt sources to be disabled. //! //! This function disables the indicated BGCRC interrupt sources. Only the //! sources that are enabled can be reflected to the processor interrupt //! disabled sources have no effect on the processor. //! //! The \e intFlags parameter has the same definition as the //! \e intFlags parameter to BGCRC_enableInterrupt(). //! //! \return None. // //***************************************************************************** static inline void BGCRC_disableInterrupt(uint32_t base, uint32_t intFlags) { // // Check the arguments. // do { if(!(BGCRC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/bgcrc.h", 462); } } while(0); do { if(!((intFlags & (0x02U | (0x04U | 0x08U | 0x10U | 0x20U | 0x40U))) == intFlags)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/bgcrc.h", 463); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0x34U)))) &= ~intFlags; __edis(); } //***************************************************************************** // //! Gets the current BGCRC interrupt status //! //! \param base is the BGCRC module base address //! //! This function returns the status of the BGCRC interrupts //! //! \return The current interrupt status, which is a logical OR of any of the //! following: //! //! - \b BGCRC_GLOBAL_INT - Global Interrupt //! - \b BGCRC_TEST_DONE - Test done interrupt //! - \b BGCRC_CRC_FAIL - CRC Fail Interrupt //! - \b BGCRC_UNCORR_ERR - Uncorrectable Error Interrupt //! - \b BGCRC_CORR_ERR - Correctable Error Interrupt //! - \b BGCRC_WD_UNDERFLOW - Watchdog Underflow Error Interrupt //! - \b BGCRC_WD_OVERFLOW - Watchdog Overflow Error Interrupt // //***************************************************************************** static inline uint32_t BGCRC_getInterruptStatus(uint32_t base) { return((*((volatile uint32_t *)((uintptr_t)(base + 0x36U))))); } //***************************************************************************** // //! Clears the BGCRC interrupt sources //! //! \param base is the BGCRC module base address //! \param intFlags is a bit mask of the interrupt sources to be cleared. //! //! The specified BGCRC interrupt sources are cleared, so that they no longer //! assert. This function must be called in the interrupt handler to keep the //! interrupt from being triggered again immediately upon exit. //! //! The \e intFlags parameter has the same definition as the //! \e intFlags parameter to BGCRC_getInterruptStatus(). //! //! \return None. // //***************************************************************************** static inline void BGCRC_clearInterruptStatus(uint32_t base, uint32_t intFlags) { // // Check the arguments. // do { if(!(BGCRC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/bgcrc.h", 519); } } while(0); do { if(!((intFlags & (0x01U | 0x02U | (0x04U | 0x08U | 0x10U | 0x20U | 0x40U))) == intFlags)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/bgcrc.h", 521); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0x38U)))) = intFlags; __edis(); } //***************************************************************************** // //! Force the BGCRC interrupt flag //! //! \param base is the BGCRC module base address //! \param intFlags is a bit mask of the interrupt flags to be forced. //! //! This function forces the specified interrupt flags //! //! The \e intFlags parameter has the same definition as the //! \e intFlags parameter to BGCRC_enableInterrupt(). //! //! \return None. // //***************************************************************************** static inline void BGCRC_forceInterrupt(uint32_t base, uint32_t intFlags) { // // Check the arguments. // do { if(!(BGCRC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/bgcrc.h", 549); } } while(0); do { if(!((intFlags & (0x02U | (0x04U | 0x08U | 0x10U | 0x20U | 0x40U))) == intFlags)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/bgcrc.h", 550); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0x3AU)))) = intFlags; __edis(); } //***************************************************************************** // //! Gets the current BGCRC NMI status //! //! \param base is the BGCRC module base address //! //! This function returns the status of the BGCRC NMI flags //! //! \return The current NMI status, which is a logical OR of any of the //! following: //! //! - \b BGCRC_CRC_FAIL - CRC Fail NMI //! - \b BGCRC_UNCORR_ERR - Uncorrectable Error NMI //! - \b BGCRC_CORR_ERR - Correctable Error NMI //! - \b BGCRC_WD_UNDERFLOW - Watchdog Underflow Error NMI //! - \b BGCRC_WD_OVERFLOW - Watchdog Overflow Error NMI // //***************************************************************************** static inline uint32_t BGCRC_getNMIStatus(uint32_t base) { return((*((volatile uint32_t *)((uintptr_t)(base + 0x2AU))))); } //***************************************************************************** // //! Clears the BGCRC NMI sources //! //! \param base is the BGCRC module base address //! \param nmiFlags is a bit mask of the NMI sources to be cleared. //! //! The specified BGCRC NMI sources are cleared, so that they no longer //! assert. This function must be called in the NMI handler to keep the //! NMI from being triggered again immediately upon exit. //! //! The \e nmiFlags parameter has the same definition as the //! \e nmiFlags parameter to BGCRC_getNMIStatus(). //! //! \return None. // //***************************************************************************** static inline void BGCRC_clearNMIStatus(uint32_t base, uint32_t nmiFlags) { // // Check the arguments. // do { if(!(BGCRC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/bgcrc.h", 604); } } while(0); do { if(!((nmiFlags & (0x04U | 0x08U | 0x10U | 0x20U | 0x40U)) == nmiFlags)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/bgcrc.h", 605); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0x2CU)))) = nmiFlags; __edis(); } //***************************************************************************** // //! Force the BGCRC NMI flag //! //! \param base is the BGCRC module base address //! \param nmiFlags is a bit mask of the NMI flags to be forced. //! //! This function forces the specified interrupt flags //! //! The \e nmiFlags parameter has the same definition as the //! \e nmiFlags parameter to BGCRC_getNMIStatus(). //! //! \return None. // //***************************************************************************** static inline void BGCRC_forceNMI(uint32_t base, uint32_t nmiFlags) { // // Check the arguments. // do { if(!(BGCRC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/bgcrc.h", 633); } } while(0); do { if(!((nmiFlags & (0x04U | 0x08U | 0x10U | 0x20U | 0x40U)) == nmiFlags)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/bgcrc.h", 634); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0x2EU)))) = nmiFlags; __edis(); } //***************************************************************************** // //! Sets the golden CRC value //! //! \param base is the BGCRC module base address //! \param crcVal is a golden CRC value to be programmed //! //! This function sets the golden CRC value of the memory block being tested. //! If run in CRC mode, the calculated CRC value is compared with golden CRC //! and status is updated. //! //! \return None. // //***************************************************************************** static inline void BGCRC_setGoldenCRCValue(uint32_t base, uint32_t crcVal) { // // Check the arguments. // do { if(!(BGCRC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/bgcrc.h", 661); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0xEU)))) = crcVal; __edis(); } //***************************************************************************** // //! Starts the module operation //! //! \param base is the BGCRC module base address //! //! This function starts the module operation. Calling this function during //! the CRC calculation will reset and re-start the CRC calculation. //! This also resets the watchdog timer. //! //! \return None. // //***************************************************************************** static inline void BGCRC_start(uint32_t base) { // // Check the arguments. // do { if(!(BGCRC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/bgcrc.h", 687); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0x0U)))) = 0xAU; __edis(); } //***************************************************************************** // //! Halts the module operation //! //! \param base is the BGCRC module base address //! //! This function halts the module operation. This function does not stall the //! watchdog timer. //! //! \return None. // //***************************************************************************** static inline void BGCRC_halt(uint32_t base) { // // Check the arguments. // do { if(!(BGCRC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/bgcrc.h", 712); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0x4U)))) = ((*((volatile uint32_t *)((uintptr_t)(base + 0x4U)))) & ~0xF000U) | (0xAU << 12U); __edis(); } //***************************************************************************** // //! Resumes the module operation //! //! \param base is the BGCRC module base address //! //! This function resumes the module operation. The CRC calculation will //! continue/resume from where it was halted //! //! \return None. // //***************************************************************************** static inline void BGCRC_resume(uint32_t base) { // // Check the arguments. // do { if(!(BGCRC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/bgcrc.h", 739); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0x4U)))) &= ~0xF000U; __edis(); } //***************************************************************************** // //! Gets the running status of the module //! //! \param base is the BGCRC module base address //! //! This function returns whether the module is in ACTIVE or IDLE state //! //! \return \b BGCRC_ACTIVE if CRC module is active, //! \b BGCRC_IDLE if CRC module is idle // //***************************************************************************** static inline uint32_t BGCRC_getRunStatus(uint32_t base) { // // Check the arguments. // do { if(!(BGCRC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/bgcrc.h", 764); } } while(0); return((*((volatile uint32_t *)((uintptr_t)(base + 0x0U)))) & 0x80000000U); } //***************************************************************************** // //! Sets the seed value for CRC calculations //! //! \param base is the BGCRC module base address //! \param seed is the seed value to be set //! //! This function sets the seed value for the CRC calculations //! //! \return None // //***************************************************************************** static inline void BGCRC_setSeedValue(uint32_t base, uint32_t seed) { // // Check the arguments. // do { if(!(BGCRC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/bgcrc.h", 786); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0x8U)))) = seed; __edis(); } //***************************************************************************** // //! Gets the calculated CRC value //! //! \param base is the BGCRC module base address //! //! This function returns the calculated CRC value //! //! \return 32-bit CRC result // //***************************************************************************** static inline uint32_t BGCRC_getResult(uint32_t base) { // // Check the arguments. // do { if(!(BGCRC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/bgcrc.h", 810); } } while(0); return((*((volatile uint32_t *)((uintptr_t)(base + 0x10U))))); } //***************************************************************************** // //! Gets the current address //! //! \param base is the BGCRC module base address //! //! This function returns the current address from where the data is fetched //! //! \return 32-bit address // //***************************************************************************** static inline uint32_t BGCRC_getCurrentAddress(uint32_t base) { // // Check the arguments. // do { if(!(BGCRC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/bgcrc.h", 832); } } while(0); return((*((volatile uint32_t *)((uintptr_t)(base + 0x12U))))); } //***************************************************************************** // //! Locks the register configuration //! //! \param base is the BGCRC module base address //! \param regs is the configuration registers to be locked //! //! This function locks the register configuration. The register once //! locked, cannot be updated until the lock is removed //! //! The \e regs parameter is the logical OR of any of the following: //! //! - \b BGCRC_REG_EN //! - \b BGCRC_REG_CTRL1 //! - \b BGCRC_REG_CTRL2 //! - \b BGCRC_REG_START_ADDR //! - \b BGCRC_REG_SEED //! - \b BGCRC_REG_GOLDEN //! - \b BGCRC_REG_WD_CFG //! - \b BGCRC_REG_WD_MIN //! - \b BGCRC_REG_WD_MAX //! - \b BGCRC_REG_NMIFRC //! - \b BGCRC_REG_INTEN //! - \b BGCRC_REG_INTFRC //! - \b BGCRC_REG_ALL //! //! \return None // //***************************************************************************** static inline void BGCRC_lockRegister(uint32_t base, uint32_t regs) { // // Check the arguments. // do { if(!(BGCRC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/bgcrc.h", 872); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0x3CU)))) |= regs; __edis(); } //***************************************************************************** // //! Unlocks the register configuration //! //! \param base is the BGCRC module base address //! \param regs is the configuration registers to be unlocked //! //! This function unlocks the register configuration. //! //! The \e regs parameter has the same definition as the \e regs parameter //! to BGCRC_lockRegister(). //! //! \return None // //***************************************************************************** static inline void BGCRC_unlockRegister(uint32_t base, uint32_t regs) { // // Check the arguments. // do { if(!(BGCRC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/bgcrc.h", 900); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0x3CU)))) &= ~regs; __edis(); } //***************************************************************************** // //! Commits the register configuration //! //! \param base is the BGCRC module base address //! \param regs is the configuration registers to be unlocked //! //! This function commits the register configuration. Once configuration is //! committed, only reset can change the configuration. //! //! The \e regs parameter has the same definition as the \e regs parameter //! to BGCRC_lockRegister(). //! //! \return None // //***************************************************************************** static inline void BGCRC_commitRegisterLock(uint32_t base, uint32_t regs) { // // Check the arguments. // do { if(!(BGCRC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/bgcrc.h", 929); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0x3EU)))) |= regs; __edis(); } //***************************************************************************** // // Close the Doxygen group. //! @} // //***************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //########################################################################### // // FILE: can.h // // TITLE: C28x CAN driver. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup can_api CAN //! @{ // //***************************************************************************** //########################################################################### // // FILE: hw_can.h // // TITLE: Definitions for the CAN registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the CAN register offsets // //***************************************************************************** // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register //***************************************************************************** // // The following are defines for the bit fields in the CAN_CTL register // //***************************************************************************** // Enable // Retransmission // Enable // Disabled //***************************************************************************** // // The following are defines for the bit fields in the CAN_ES register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CAN_ERRC register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CAN_BTR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CAN_INT register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CAN_TEST register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CAN_PERR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CAN_RAM_INIT register // //***************************************************************************** // complete //***************************************************************************** // // The following are defines for the bit fields in the CAN_GLB_INT_EN register // //***************************************************************************** // CANINT0 // CANINT1 //***************************************************************************** // // The following are defines for the bit fields in the CAN_GLB_INT_FLG register // //***************************************************************************** // CANINT0 // CANINT1 //***************************************************************************** // // The following are defines for the bit fields in the CAN_GLB_INT_CLR register // //***************************************************************************** // for CANINT0 // for CANINT1 //***************************************************************************** // // The following are defines for the bit fields in the CAN_TXRQ_X register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CAN_NDAT_X register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CAN_IPEN_X register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CAN_MVAL_X register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CAN_IF1CMD register // //***************************************************************************** // Bit //***************************************************************************** // // The following are defines for the bit fields in the CAN_IF1MSK register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CAN_IF1ARB register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CAN_IF1MCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CAN_IF1DATA register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CAN_IF1DATB register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CAN_IF2CMD register // //***************************************************************************** // Bit //***************************************************************************** // // The following are defines for the bit fields in the CAN_IF2MSK register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CAN_IF2ARB register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CAN_IF2MCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CAN_IF2DATA register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CAN_IF2DATB register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CAN_IF3OBS register // //***************************************************************************** // observation // access // data read access // read access // access // access //***************************************************************************** // // The following are defines for the bit fields in the CAN_IF3MSK register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CAN_IF3ARB register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CAN_IF3MCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CAN_IF3DATA register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CAN_IF3DATB register // //***************************************************************************** //########################################################################### // // FILE: sysctl.h // // TITLE: C28x system control driver. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup sysctl_api SysCtl //! @{ // //***************************************************************************** //########################################################################### // // FILE: hw_nmi.h // // TITLE: Definitions for the NMI registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the NMI register offsets // //***************************************************************************** // Clear) // registers. //***************************************************************************** // // The following are defines for the bit fields in the NMICFG register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the NMIFLG register // //***************************************************************************** // Flag // Flag // Flag // Indication Flag // out. //***************************************************************************** // // The following are defines for the bit fields in the NMIFLGCLR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the NMIFLGFRC register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the NMISHDFLG register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ERRORSTS register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ERRORSTSCLR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ERRORSTSFRC register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ERRORCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ERRORLOCK register // //***************************************************************************** //########################################################################### // // FILE: hw_wwd.h // // TITLE: Definitions for the SYSCTL registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the SYSCTL register offsets // //***************************************************************************** // Register // Register //***************************************************************************** // // The following are defines for the bit fields in the SCSR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the WDCNTR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the WDKEY register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the WDCR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the WDWCR register // //***************************************************************************** // Windowed Watchdog // functionality //########################################################################### // // FILE: interrupt.h // // TITLE: C28x Interrupt (PIE) driver. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup interrupt_api Interrupt //! @{ // //***************************************************************************** //########################################################################### // // FILE: hw_ints.h // // TITLE: Definitions of interrupt numbers for use with interrupt.c. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ //########################################################################### //***************************************************************************** // // PIE Interrupt Numbers // // 0x00FF = PIE Table Row # // 0xFF00 = PIE Table Column # // 0xFFFF0000 = PIE Vector ID // //***************************************************************************** //########################################################################### // // FILE: hw_pie.h // // TITLE: Definitions for the PIE registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the PIE register offsets // //***************************************************************************** // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register //***************************************************************************** // // The following are defines for the bit fields in the PIECTRL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PIEACK register // //***************************************************************************** // Group 1 // Group 2 // Group 3 // Group 4 // Group 5 // Group 6 // Group 7 // Group 8 // Group 9 // Group 10 // Group 11 // Group 12 //***************************************************************************** // // The following are defines for the bit fields in the PIEIER1 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PIEIFR1 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PIEIER2 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PIEIFR2 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PIEIER3 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PIEIFR3 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PIEIER4 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PIEIFR4 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PIEIER5 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PIEIFR5 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PIEIER6 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PIEIFR6 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PIEIER7 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PIEIFR7 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PIEIER8 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PIEIFR8 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PIEIER9 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PIEIFR9 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PIEIER10 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PIEIFR10 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PIEIER11 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PIEIFR11 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PIEIER12 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PIEIFR12 register // //***************************************************************************** //***************************************************************************** // // The following are values that can be passed to the Interrupt_enableInCPU() // and Interrupt_disableInCPU() functions as the cpuInterrupt parameter. // //***************************************************************************** //***************************************************************************** // // The following are values that can be passed to the Interrupt_clearACKGroup() // function as the group parameter. // //***************************************************************************** //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** //***************************************************************************** // //! \internal //! The default interrupt handler. //! //! This is the default interrupt handler. The Interrupt_initVectorTable() //! function sets all vectors to this function. Also, when an interrupt is //! unregistered using the Interrupt_unregister() function, this handler takes //! its place. This should never be called during normal operation. //! //! The ESTOP0 statement is for debug purposes only. Remove and replace with an //! appropriate error handling routine for your program. //! //! \return None. // //***************************************************************************** static void Interrupt_defaultHandler(void) { uint16_t pieVect; uint16_t vectID; // // Calculate the vector ID. If the vector is in the lower PIE, it's the // offset of the vector that was fetched (bits 7:1 of PIECTRL.PIEVECT) // divided by two. // pieVect = (*((volatile uint16_t *)((uintptr_t)(0x00000CE0U + 0x0U)))); vectID = (pieVect & 0xFEU) >> 1U; // // If the vector is in the upper PIE, the vector ID is 128 or higher. // if(pieVect >= 0x0E00U) { vectID += 128U; } // // Something has gone wrong. An interrupt without a proper registered // handler function has occurred. To help you debug the issue, local // variable vectID contains the vector ID of the interrupt that occurred. // __asm(" ESTOP0"); for(;;) { ; } } //***************************************************************************** // //! \internal //! The default illegal instruction trap interrupt handler. //! //! This is the default interrupt handler for an illegal instruction trap //! (ITRAP). The Interrupt_initVectorTable() function sets the appropriate //! vector to this function. This should never be called during normal //! operation. //! //! The ESTOP0 statement is for debug purposes only. Remove and replace with //! an appropriate error handling routine for your program. //! //! \return None. // //***************************************************************************** static void Interrupt_illegalOperationHandler(void) { // // Something has gone wrong. The CPU has tried to execute an illegal // instruction, generating an illegal instruction trap (ITRAP). // __asm(" ESTOP0"); for(;;) { ; } } //***************************************************************************** // //! \internal //! The default non-maskable interrupt handler. //! //! This is the default interrupt handler for a non-maskable interrupt (NMI). //! The Interrupt_initVectorTable() function sets the appropriate vector to //! this function. This should never be called during normal operation. //! //! The ESTOP0 statement is for debug purposes only. Remove and replace with an //! appropriate error handling routine for your program. //! //! \return None. // //***************************************************************************** static void Interrupt_nmiHandler(void) { // // A non-maskable interrupt has occurred, indicating that a hardware error // has occurred in the system. You can use SysCtl_getNMIFlagStatus() to // to read the NMIFLG register and determine what caused the NMI. // __asm(" ESTOP0"); for(;;) { ; } } //***************************************************************************** // //! Allows the CPU to process interrupts. //! //! This function clears the global interrupt mask bit (INTM) in the CPU, //! allowing the processor to respond to interrupts. //! //! \return Returns \b true if interrupts were disabled when the function was //! called or \b false if they were initially enabled. // //***************************************************************************** static inline _Bool Interrupt_enableMaster(void) { // // Enable processor interrupts. // return(((__enable_interrupts() & 0x1U) != 0U) ? 1 : 0); } //***************************************************************************** // //! Stops the CPU from processing interrupts. //! //! This function sets the global interrupt mask bit (INTM) in the CPU, //! preventing the processor from receiving maskable interrupts. //! //! \return Returns \b true if interrupts were already disabled when the //! function was called or \b false if they were initially enabled. // //***************************************************************************** static inline _Bool Interrupt_disableMaster(void) { // // Disable processor interrupts. // return(((__disable_interrupts() & 0x1U) != 0U) ? 1 : 0); } //***************************************************************************** // //! Registers a function to be called when an interrupt occurs. //! //! \param interruptNumber specifies the interrupt in question. //! \param handler is a pointer to the function to be called. //! //! This function is used to specify the handler function to be called when the //! given interrupt is asserted to the processor. When the interrupt occurs, //! if it is enabled (via Interrupt_enable()), the handler function will be //! called in interrupt context. Since the handler function can preempt other //! code, care must be taken to protect memory or peripherals that are accessed //! by the handler and other non-handler code. //! //! The available \e interruptNumber values are supplied in //! inc/hw_ints.h. //! //! \note This function assumes that the PIE has been enabled. See //! Interrupt_initModule(). //! //! \return None. // //***************************************************************************** static inline void Interrupt_register(uint32_t interruptNumber, void (*handler)(void)) { uint32_t address; // // Calculate appropriate address for the interrupt number // address = (uint32_t)0x00000D00U + (((interruptNumber & 0xFFFF0000U) >> 16U) * 2U); // // Copy ISR address into PIE table // __eallow(); (*((volatile uint32_t *)((uintptr_t)(address)))) = (uint32_t)handler; __edis(); } //***************************************************************************** // //! Unregisters the function to be called when an interrupt occurs. //! //! \param interruptNumber specifies the interrupt in question. //! //! This function is used to indicate that a default handler //! Interrupt_defaultHandler() should be called when the given interrupt is //! asserted to the processor. Call Interrupt_disable() to disable //! the interrupt before calling this function. //! //! The available \e interruptNumber values are supplied in //! inc/hw_ints.h. //! //! \sa Interrupt_register() for important information about registering //! interrupt handlers. //! //! \return None. // //***************************************************************************** static inline void Interrupt_unregister(uint32_t interruptNumber) { uint32_t address; // // Calculate appropriate address for the interrupt number // address = (uint32_t)0x00000D00U + (((interruptNumber & 0xFFFF0000U) >> 16U) * 2U); // // Copy default ISR address into PIE table // __eallow(); (*((volatile uint32_t *)((uintptr_t)(address)))) = (uint32_t)Interrupt_defaultHandler; __edis(); } //***************************************************************************** // //! Enables CPU interrupt channels //! //! \param cpuInterrupt specifies the CPU interrupts to be enabled. //! //! This function enables the specified interrupts in the CPU. The //! \e cpuInterrupt parameter is a logical OR of the values //! \b INTERRUPT_CPU_INTx where x is the interrupt number between 1 and 14, //! \b INTERRUPT_CPU_DLOGINT, and \b INTERRUPT_CPU_RTOSINT. //! //! \note Note that interrupts 1-12 correspond to the PIE groups with those //! same numbers. //! //! \return None. // //***************************************************************************** static inline void Interrupt_enableInCPU(uint16_t cpuInterrupt) { // // Set the interrupt bits in the CPU. // IER |= cpuInterrupt; } //***************************************************************************** // //! Disables CPU interrupt channels //! //! \param cpuInterrupt specifies the CPU interrupts to be disabled. //! //! This function disables the specified interrupts in the CPU. The //! \e cpuInterrupt parameter is a logical OR of the values //! \b INTERRUPT_CPU_INTx where x is the interrupt number between 1 and 14, //! \b INTERRUPT_CPU_DLOGINT, and \b INTERRUPT_CPU_RTOSINT. //! //! \note Note that interrupts 1-12 correspond to the PIE groups with those //! same numbers. //! //! \return None. // //***************************************************************************** static inline void Interrupt_disableInCPU(uint16_t cpuInterrupt) { // // Clear the interrupt bits in the CPU. // IER &= ~cpuInterrupt; } //***************************************************************************** // //! Acknowledges PIE Interrupt Group //! //! \param group specifies the interrupt group to be acknowledged. //! //! The specified interrupt group is acknowledged and clears any interrupt //! flag within that respective group. //! //! The \e group parameter must be a logical OR of the following: //! \b INTERRUPT_ACK_GROUP1, \b INTERRUPT_ACK_GROUP2, \b INTERRUPT_ACK_GROUP3 //! \b INTERRUPT_ACK_GROUP4, \b INTERRUPT_ACK_GROUP5, \b INTERRUPT_ACK_GROUP6 //! \b INTERRUPT_ACK_GROUP7, \b INTERRUPT_ACK_GROUP8, \b INTERRUPT_ACK_GROUP9 //! \b INTERRUPT_ACK_GROUP10, \b INTERRUPT_ACK_GROUP11, //! \b INTERRUPT_ACK_GROUP12. //! //! \return None. // //***************************************************************************** static inline void Interrupt_clearACKGroup(uint16_t group) { // // Set interrupt group acknowledge bits // (*((volatile uint16_t *)((uintptr_t)(0x00000CE0U + 0x1U)))) = group; } //***************************************************************************** // //! Enables the PIE block. //! //! This function enables the vector fetching for the peripheral interrupts by //! enabling the PIE block. //! //! \return None. // //***************************************************************************** static inline void Interrupt_enablePIE(void) { (*((volatile uint16_t *)((uintptr_t)(0x00000CE0U + 0x0U)))) |= 0x1U; } //***************************************************************************** // //! Disables the PIE block. //! //! This function disables the vector fetching for the peripheral interrupts by //! disabling the PIE block. PIEACK, PIEIFR, and PIEIER registers can be //! accessed even when the PIE block is disabled. //! //! \return None. // //***************************************************************************** static inline void Interrupt_disablePIE(void) { (*((volatile uint16_t *)((uintptr_t)(0x00000CE0U + 0x0U)))) &= ~0x1U; } //***************************************************************************** // //! Initializes the PIE control registers by setting them to a known state. //! //! This function initializes the PIE control registers. After globally //! disabling interrupts and enabling the PIE, it clears all of the PIE //! interrupt enable bits and interrupt flags. //! //! \return None. // //***************************************************************************** extern void Interrupt_initModule(void); //***************************************************************************** // //! Initializes the PIE vector table by setting all vectors to a default //! handler function. //! //! \return None. // //***************************************************************************** extern void Interrupt_initVectorTable(void); //***************************************************************************** // //! Enables an interrupt. //! //! \param interruptNumber specifies the interrupt to be enabled. //! //! The specified interrupt is enabled in the interrupt controller. Other //! enables for the interrupt (such as at the peripheral level) are unaffected //! by this function. //! //! The available \e interruptNumber values are supplied in //! inc/hw_ints.h. //! //! \return None. // //***************************************************************************** extern void Interrupt_enable(uint32_t interruptNumber); //***************************************************************************** // //! Disables an interrupt. //! //! \param interruptNumber specifies the interrupt to be disabled. //! //! The specified interrupt is disabled in the interrupt controller. Other //! enables for the interrupt (such as at the peripheral level) are unaffected //! by this function. //! //! The available \e interruptNumber values are supplied in //! inc/hw_ints.h. //! //! \return None. // //***************************************************************************** extern void Interrupt_disable(uint32_t interruptNumber); //***************************************************************************** // // Extern compiler intrinsic prototypes. See compiler User's Guide for details. // //***************************************************************************** extern uint16_t __disable_interrupts(void); extern uint16_t __enable_interrupts(void); //***************************************************************************** // // Close the Doxygen group. //! @} // //***************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //***************************************************************************** // // Defines for system control functions. Not intended for use by application // code. // //***************************************************************************** // // Shifted pattern for WDCR register's WDCHK field. // // // Keys for WDKEY field. The first enables resets and the second resets. // // // Values to help decode peripheral parameter // // //Keys for the System control registers write protection // // //Values to help access shifting of bits // // //Enable / disable the ETHERCAT I2C Loopback // // // LPM defines for LPMCR.LPM // // // Bit shift for DAC to configure the CPUSEL register // // // Default internal oscillator frequency, 10 MHz // // // Boot ROM Booting and Reset Status // // // Device_cal function which is available in OTP memory // This function is called in SysCtl_resetPeripheral after resetting // analog peripherals // //***************************************************************************** // // The following are values that can be passed to the SysCtl_setClock() API as // the config parameter. // //***************************************************************************** // // System clock divider (SYSDIV) // // // Mask and shift for Reference Clock Divider value in config // // // Mask and shift for Output Clock Divider value in config // //! Macro to format Clock divider value. x is a number from 1 to 32. //! //! Macro to format Clock divider value. x is a number from 1 to 32. //! //! Macro to format system clock divider value. x must be 1 or even values up //! to 126. // // Integer multiplier (IMULT) // // // Mask for IMULT value in config // //! Macro to format integer multiplier value. x is a number from 1 to 127. //! // // Fractional multiplier (FMULT) // // // DCC module selection for checking PLL clock validity // // Mask and shift for DCC module base address in config // // // Oscillator source // // Also used with the SysCtl_selectOscSource(), SysCtl_turnOnOsc(), // and SysCtl_turnOffOsc() functions as the oscSource parameter. // //! Internal oscillator INTOSC2 //! External oscillator (XTAL) in crystal mode //! External oscillator (XTAL) in single-ended mode //! Internal oscillator INTOSC1 // // Enable/disable PLL // // //Mask to check the PLL configuration selected // //***************************************************************************** // // The following are values that can be passed to the SysCtl_setAuxClock() API // as the config parameter. // //***************************************************************************** // // Auxiliary clock divider (AUXCLKDIV) // //! Macro to format Clock divider value. x is a number from 1 to 32. //! //! Macro to format Clock divider value. x is a number from 1 to 32. //! // // Integer multiplier (IMULT) // //! Macro to format integer multiplier value. x is a number from 1 to 127. //! // // Fractional multiplier (FMULT) // // // Oscillator source // //! Internal oscillator INTOSC2 as auxiliary clock input //! External oscillator (XTAL) as auxiliary clock input //! AUXCLKIN (from GPIO) as auxiliary clock input //! External oscillator (XTAL) in single-ended mode // // Enable/disable PLL // //***************************************************************************** // // Values that can be passed to SysCtl_clearNMIStatus(), // SysCtl_forceNMIFlags(), SysCtl_isNMIFlagSet(), and // SysCtl_isNMIShadowFlagSet() as the nmiFlags parameter and returned by // SysCtl_getNMIFlagStatus() and SysCtl_getNMIShadowFlagStatus(). // //***************************************************************************** //***************************************************************************** // // Values that can be passed to SysCtl_enableCMtoCPUNMI() & // SysCtl_enableCMtoCPUInterrupt() as the Flags parameter // //***************************************************************************** //***************************************************************************** // // Values that can be passed to/returned from SysCtl_getCMInterruptStatus() // SysCtl_clearCMInterruptStatus() or SysCtl_setCMInterruptStatus() // as the intFlags parameter // //***************************************************************************** //***************************************************************************** // // Values that can be passed to/returned from SysCtl_getInterruptStatus() // SysCtl_clearInterruptStatus() or SysCtl_setInterruptStatus() // as the intFlags parameter // //***************************************************************************** //***************************************************************************** // // The following are values that can be passed to the SysCtl_clearResetCause() // or SysCtl_simulateReset() // API as rstCauses or returned by the SysCtl_getResetCause() API. // //***************************************************************************** //***************************************************************************** // // The following are one of the values that can be passed // to the SysCtl_clearCPU2ResetStatus() API as rstCauses or returned // by the SysCtl_getCPU2ResetStatus() API. // //***************************************************************************** //***************************************************************************** // // The following values define the adcsocSrc parameter for // SysCtl_enableExtADCSOCSource() and SysCtl_disableExtADCSOCSource(). // //***************************************************************************** // // ADCSOCAO // // // ADCSOCBO // //***************************************************************************** // //! The following are values that can be passed to SysCtl_enablePeripheral() //! and SysCtl_disablePeripheral() as the \e peripheral parameter. // //***************************************************************************** typedef enum { // // PCLKCR0 // SYSCTL_PERIPH_CLK_CLA1 = 0x0000, //!< CLA1 clock SYSCTL_PERIPH_CLK_DMA = 0x0200, //!< DMA clock SYSCTL_PERIPH_CLK_TIMER0 = 0x0300, //!< CPUTIMER0 clock SYSCTL_PERIPH_CLK_TIMER1 = 0x0400, //!< CPUTIMER1 clock SYSCTL_PERIPH_CLK_TIMER2 = 0x0500, //!< CPUTIMER2 clock SYSCTL_PERIPH_CLK_CPUBGCRC = 0x0D00, //!< CPUBGCRC clock SYSCTL_PERIPH_CLK_CLA1BGCRC = 0x0E00, //!< CLA1BGCRC clock SYSCTL_PERIPH_CLK_HRCAL = 0x1000, //!< HRPWM clock SYSCTL_PERIPH_CLK_TBCLKSYNC = 0x1200, //!< ePWM time base clock sync SYSCTL_PERIPH_CLK_GTBCLKSYNC = 0x1300, //!< ePWM global time base sync SYSCTL_PERIPH_CLK_ERAD = 0x1800, //!< ERAD module clock // // PCLKCR1 // SYSCTL_PERIPH_CLK_EMIF1 = 0x0001, //!< EMIF1 clock SYSCTL_PERIPH_CLK_EMIF2 = 0x0101, //!< EMIF2 clock // // PCLKCR2 // SYSCTL_PERIPH_CLK_EPWM1 = 0x0002, //!< ePWM1 clock SYSCTL_PERIPH_CLK_EPWM2 = 0x0102, //!< ePWM2 clock SYSCTL_PERIPH_CLK_EPWM3 = 0x0202, //!< ePWM3 clock SYSCTL_PERIPH_CLK_EPWM4 = 0x0302, //!< ePWM4 clock SYSCTL_PERIPH_CLK_EPWM5 = 0x0402, //!< ePWM5 clock SYSCTL_PERIPH_CLK_EPWM6 = 0x0502, //!< ePWM6 clock SYSCTL_PERIPH_CLK_EPWM7 = 0x0602, //!< ePWM7 clock SYSCTL_PERIPH_CLK_EPWM8 = 0x0702, //!< ePWM8 clock SYSCTL_PERIPH_CLK_EPWM9 = 0x0802, //!< ePWM9 clock SYSCTL_PERIPH_CLK_EPWM10 = 0x0902, //!< ePWM10 clock SYSCTL_PERIPH_CLK_EPWM11 = 0x0A02, //!< ePWM11 clock SYSCTL_PERIPH_CLK_EPWM12 = 0x0B02, //!< ePWM12 clock SYSCTL_PERIPH_CLK_EPWM13 = 0x0C02, //!< ePWM13 clock SYSCTL_PERIPH_CLK_EPWM14 = 0x0D02, //!< ePWM14 clock SYSCTL_PERIPH_CLK_EPWM15 = 0x0E02, //!< ePWM15 clock SYSCTL_PERIPH_CLK_EPWM16 = 0x0F02, //!< ePWM16 clock // // PCLKCR3 // SYSCTL_PERIPH_CLK_ECAP1 = 0x0003, //!< eCAP1 clock SYSCTL_PERIPH_CLK_ECAP2 = 0x0103, //!< eCAP2 clock SYSCTL_PERIPH_CLK_ECAP3 = 0x0203, //!< eCAP3 clock SYSCTL_PERIPH_CLK_ECAP4 = 0x0303, //!< eCAP4 clock SYSCTL_PERIPH_CLK_ECAP5 = 0x0403, //!< eCAP5 clock SYSCTL_PERIPH_CLK_ECAP6 = 0x0503, //!< eCAP6 clock SYSCTL_PERIPH_CLK_ECAP7 = 0x0603, //!< eCAP7 clock // // PCLKCR4 // SYSCTL_PERIPH_CLK_EQEP1 = 0x0004, //!< eQEP1 clock SYSCTL_PERIPH_CLK_EQEP2 = 0x0104, //!< eQEP2 clock SYSCTL_PERIPH_CLK_EQEP3 = 0x0204, //!< eQEP3 clock // // PCLKCR5 // // Reserved // // // PCLKCR6 // SYSCTL_PERIPH_CLK_SD1 = 0x0006, //!< SDFM1 clock SYSCTL_PERIPH_CLK_SD2 = 0x0106, //!< SDFM2 clock // // PCLKCR7 // SYSCTL_PERIPH_CLK_SCIA = 0x0007, //!< SCIA clock SYSCTL_PERIPH_CLK_SCIB = 0x0107, //!< SCIB clock SYSCTL_PERIPH_CLK_SCIC = 0x0207, //!< SCIC clock SYSCTL_PERIPH_CLK_SCID = 0x0307, //!< SCID clock // // PCLKCR8 // SYSCTL_PERIPH_CLK_SPIA = 0x0008, //!< SPIA clock SYSCTL_PERIPH_CLK_SPIB = 0x0108, //!< SPIB clock SYSCTL_PERIPH_CLK_SPIC = 0x0208, //!< SPIC clock SYSCTL_PERIPH_CLK_SPID = 0x0308, //!< SPID clock // // PCLKCR9 // SYSCTL_PERIPH_CLK_I2CA = 0x0009, //!< I2CA clock SYSCTL_PERIPH_CLK_I2CB = 0x0109, //!< I2CB clock // // PCLKCR10 // SYSCTL_PERIPH_CLK_CANA = 0x000A, //!< CANA clock SYSCTL_PERIPH_CLK_CANB = 0x010A, //!< CANB clock // // PCLKCR11 // SYSCTL_PERIPH_CLK_MCBSPA = 0x000B, //!< McBSPA clock SYSCTL_PERIPH_CLK_MCBSPB = 0x010B, //!< McBSPB clock SYSCTL_PERIPH_CLK_USBA = 0x100B, //!< USBA clock // // PCLKCR12 // // // PCLKCR13 // SYSCTL_PERIPH_CLK_ADCA = 0x000D, //!< ADCA clock SYSCTL_PERIPH_CLK_ADCB = 0x010D, //!< ADCB clock SYSCTL_PERIPH_CLK_ADCC = 0x020D, //!< ADCC clock SYSCTL_PERIPH_CLK_ADCD = 0x030D, //!< ADCD clock // // PCLKCR14 // SYSCTL_PERIPH_CLK_CMPSS1 = 0x000E, //!< CMPSS1 clock SYSCTL_PERIPH_CLK_CMPSS2 = 0x010E, //!< CMPSS2 clock SYSCTL_PERIPH_CLK_CMPSS3 = 0x020E, //!< CMPSS3 clock SYSCTL_PERIPH_CLK_CMPSS4 = 0x030E, //!< CMPSS4 clock SYSCTL_PERIPH_CLK_CMPSS5 = 0x040E, //!< CMPSS5 clock SYSCTL_PERIPH_CLK_CMPSS6 = 0x050E, //!< CMPSS6 clock SYSCTL_PERIPH_CLK_CMPSS7 = 0x060E, //!< CMPSS7 clock SYSCTL_PERIPH_CLK_CMPSS8 = 0x070E, //!< CMPSS8 clock // // PCLKCR15 // // Reserved // // // PCLKCR16 // SYSCTL_PERIPH_CLK_DACA = 0x1010, //!< DACA clock SYSCTL_PERIPH_CLK_DACB = 0x1110, //!< DACB clock SYSCTL_PERIPH_CLK_DACC = 0x1210, //!< DACC clock // // PCLKCR17 // SYSCTL_PERIPH_CLK_CLB1 = 0x0011, //!< CLB1 clock SYSCTL_PERIPH_CLK_CLB2 = 0x0111, //!< CLB2 clock SYSCTL_PERIPH_CLK_CLB3 = 0x0211, //!< CLB3 clock SYSCTL_PERIPH_CLK_CLB4 = 0x0311, //!< CLB4 clock // // PCLKCR18 // SYSCTL_PERIPH_CLK_FSITXA = 0x0012, //!< FSITXA clock SYSCTL_PERIPH_CLK_FSITXB = 0x0112, //!< FSITXB clock SYSCTL_PERIPH_CLK_FSIRXA = 0x1012, //!< FSIRXA clock SYSCTL_PERIPH_CLK_FSIRXB = 0x1112, //!< FSIRXB clock SYSCTL_PERIPH_CLK_FSIRXC = 0x1212, //!< FSIRXC clock SYSCTL_PERIPH_CLK_FSIRXD = 0x1312, //!< FSIRXD clock SYSCTL_PERIPH_CLK_FSIRXE = 0x1412, //!< FSIRXE clock SYSCTL_PERIPH_CLK_FSIRXF = 0x1512, //!< FSIRXF clock SYSCTL_PERIPH_CLK_FSIRXG = 0x1612, //!< FSIRXG clock SYSCTL_PERIPH_CLK_FSIRXH = 0x1712, //!< FSIRXH clock // // PCLKCR19 // // Reserved // // // PCLKCR20 // SYSCTL_PERIPH_CLK_PMBUSA = 0x0014, //!< PMBusA clock // // PCLKCR21 // SYSCTL_PERIPH_CLK_DCC0 = 0x0015, //!< DCC0 clock SYSCTL_PERIPH_CLK_DCC1 = 0x0115, //!< DCC1 clock SYSCTL_PERIPH_CLK_DCC2 = 0x0215, //!< DCC2 clock // // PCLKCR23 // SYSCTL_PERIPH_CLK_ECAT = 0x0017 //!< Ethercat clock } SysCtl_PeripheralPCLOCKCR; //***************************************************************************** // //! The following are values that can be passed to SysCtl_resetPeripheral() as //! the \e peripheral parameter. // //***************************************************************************** typedef enum { // // SOFTPRES0 // SYSCTL_PERIPH_RES_CPU1_CLA1 = 0x0000, //!< Reset CPU1 CLA1 SYSCTL_PERIPH_RES_CPU2_CLA1 = 0x0200, //!< Reset CPU2 CLA1 SYSCTL_PERIPH_RES_CPUBGCRC = 0x0D00, //!< Reset CPUBGCRC SYSCTL_PERIPH_RES_CLA1BGCRC = 0x0E00, //!< Reset CLA1BGCRC SYSCTL_PERIPH_RES_ERAD = 0x1800, //!< Reset ERAD // // SOFTPRES1 // SYSCTL_PERIPH_RES_EMIF1 = 0x0001, //!< Reset EMIF1 SYSCTL_PERIPH_RES_EMIF2 = 0x0101, //!< Reset EMIF2 // // SOFTPRES2 // SYSCTL_PERIPH_RES_EPWM1 = 0x0002, //!< Reset ePWM1 SYSCTL_PERIPH_RES_EPWM2 = 0x0102, //!< Reset ePWM2 SYSCTL_PERIPH_RES_EPWM3 = 0x0202, //!< Reset ePWM3 SYSCTL_PERIPH_RES_EPWM4 = 0x0302, //!< Reset ePWM4 SYSCTL_PERIPH_RES_EPWM5 = 0x0402, //!< Reset ePWM5 SYSCTL_PERIPH_RES_EPWM6 = 0x0502, //!< Reset ePWM6 SYSCTL_PERIPH_RES_EPWM7 = 0x0602, //!< Reset ePWM7 SYSCTL_PERIPH_RES_EPWM8 = 0x0702, //!< Reset ePWM8 SYSCTL_PERIPH_RES_EPWM9 = 0x0802, //!< Reset ePWM9 SYSCTL_PERIPH_RES_EPWM10 = 0x0902, //!< Reset ePWM10 SYSCTL_PERIPH_RES_EPWM11 = 0x0A02, //!< Reset ePWM11 SYSCTL_PERIPH_RES_EPWM12 = 0x0B02, //!< Reset ePWM12 SYSCTL_PERIPH_RES_EPWM13 = 0x0C02, //!< Reset ePWM13 SYSCTL_PERIPH_RES_EPWM14 = 0x0D02, //!< Reset ePWM14 SYSCTL_PERIPH_RES_EPWM15 = 0x0E02, //!< Reset ePWM15 SYSCTL_PERIPH_RES_EPWM16 = 0x0F02, //!< Reset ePWM16 // // SOFTPRES3 // SYSCTL_PERIPH_RES_ECAP1 = 0x0003, //!< Reset eCAP1 SYSCTL_PERIPH_RES_ECAP2 = 0x0103, //!< Reset eCAP2 SYSCTL_PERIPH_RES_ECAP3 = 0x0203, //!< Reset eCAP3 SYSCTL_PERIPH_RES_ECAP4 = 0x0303, //!< Reset eCAP4 SYSCTL_PERIPH_RES_ECAP5 = 0x0403, //!< Reset eCAP5 SYSCTL_PERIPH_RES_ECAP6 = 0x0503, //!< Reset eCAP6 SYSCTL_PERIPH_RES_ECAP7 = 0x0603, //!< Reset eCAP7 // // SOFTPRES4 // SYSCTL_PERIPH_RES_EQEP1 = 0x0004, //!< Reset eQEP1 SYSCTL_PERIPH_RES_EQEP2 = 0x0104, //!< Reset eQEP2 SYSCTL_PERIPH_RES_EQEP3 = 0x0204, //!< Reset eQEP3 // // SOFTPRES5 // Reserved // // // SOFTPRES6 // SYSCTL_PERIPH_RES_SD1 = 0x0006, //!< Reset SDFM1 SYSCTL_PERIPH_RES_SD2 = 0x0106, //!< Reset SDFM2 // // SOFTPRES7 // SYSCTL_PERIPH_RES_SCIA = 0x0007, //!< Reset SCIA SYSCTL_PERIPH_RES_SCIB = 0x0107, //!< Reset SCIB SYSCTL_PERIPH_RES_SCIC = 0x0207, //!< Reset SCIC SYSCTL_PERIPH_RES_SCID = 0x0307, //!< Reset SCID // // SOFTPRES8 // SYSCTL_PERIPH_RES_SPIA = 0x0008, //!< Reset SPIA SYSCTL_PERIPH_RES_SPIB = 0x0108, //!< Reset SPIB SYSCTL_PERIPH_RES_SPIC = 0x0208, //!< Reset SPIC SYSCTL_PERIPH_RES_SPID = 0x0308, //!< Reset SPID // // SOFTPRES9 // SYSCTL_PERIPH_RES_I2CA = 0x0009, //!< Reset I2CA SYSCTL_PERIPH_RES_I2CB = 0x0109, //!< Reset I2CB // // SOFTPRES10 // SYSCTL_PERIPH_RES_CANA = 0x000A, //!< Reset CANA SYSCTL_PERIPH_RES_CANB = 0x010A, //!< Reset CANB // // SOFTPRES11 // SYSCTL_PERIPH_RES_MCBSPA = 0x000B, //!< Reset McBSPA SYSCTL_PERIPH_RES_MCBSPB = 0x010B, //!< Reset McBSPB SYSCTL_PERIPH_RES_USBA = 0x100B, //!< Reset USBA // // SOFTPRES12 // Reserved // // // SOFTPRES13 // SYSCTL_PERIPH_RES_ADCA = 0x000D, //!< Reset ADCA SYSCTL_PERIPH_RES_ADCB = 0x010D, //!< Reset ADCB SYSCTL_PERIPH_RES_ADCC = 0x020D, //!< Reset ADCC SYSCTL_PERIPH_RES_ADCD = 0x030D, //!< Reset ADCD // // SOFTPRES14 // SYSCTL_PERIPH_RES_CMPSS1 = 0x000E, //!< Reset CMPSS1 SYSCTL_PERIPH_RES_CMPSS2 = 0x010E, //!< Reset CMPSS2 SYSCTL_PERIPH_RES_CMPSS3 = 0x020E, //!< Reset CMPSS3 SYSCTL_PERIPH_RES_CMPSS4 = 0x030E, //!< Reset CMPSS4 SYSCTL_PERIPH_RES_CMPSS5 = 0x040E, //!< Reset CMPSS5 SYSCTL_PERIPH_RES_CMPSS6 = 0x050E, //!< Reset CMPSS6 SYSCTL_PERIPH_RES_CMPSS7 = 0x060E, //!< Reset CMPSS7 SYSCTL_PERIPH_RES_CMPSS8 = 0x070E, //!< Reset CMPSS8 // // SOFTPRES15 // Reserved // // // SOFTPRES16 // SYSCTL_PERIPH_RES_DACA = 0x1010, //!< Reset DACA SYSCTL_PERIPH_RES_DACB = 0x1110, //!< Reset DACB SYSCTL_PERIPH_RES_DACC = 0x1210, //!< Reset DACC // // SOFTPRES17 // SYSCTL_PERIPH_RES_CLB1 = 0x0011, //!< Reset CLB1 SYSCTL_PERIPH_RES_CLB2 = 0x0111, //!< Reset CLB2 SYSCTL_PERIPH_RES_CLB3 = 0x0211, //!< Reset CLB3 SYSCTL_PERIPH_RES_CLB4 = 0x0311, //!< Reset CLB4 // // SOFTPRES18 // SYSCTL_PERIPH_RES_FSITXA = 0x0012, //!< Reset FSITXA SYSCTL_PERIPH_RES_FSITXB = 0x0112, //!< Reset FSITXB SYSCTL_PERIPH_RES_FSIRXA = 0x1012, //!< Reset FSIRXA SYSCTL_PERIPH_RES_FSIRXB = 0x1112, //!< Reset FSIRXB SYSCTL_PERIPH_RES_FSIRXC = 0x1212, //!< Reset FSIRXC SYSCTL_PERIPH_RES_FSIRXD = 0x1312, //!< Reset FSIRXD SYSCTL_PERIPH_RES_FSIRXE = 0x1412, //!< Reset FSIRXE SYSCTL_PERIPH_RES_FSIRXF = 0x1512, //!< Reset FSIRXF SYSCTL_PERIPH_RES_FSIRXG = 0x1612, //!< Reset FSIRXG SYSCTL_PERIPH_RES_FSIRXH = 0x1712, //!< Reset FSIRXH // // SOFTPRES20 // SYSCTL_PERIPH_RES_PMBUS_A = 0x0014, //!< Reset PMBUSA // // SOFTPRES21 // SYSCTL_PERIPH_RES_DCC0 = 0x0015, //!< Reset DCC0 SYSCTL_PERIPH_RES_DCC1 = 0x0115, //!< Reset DCC1 SYSCTL_PERIPH_RES_DCC2 = 0x0215, //!< Reset DCC2 // // SOFTPRES23 // SYSCTL_PERIPH_RES_ECAT = 0x0017 //!< Reset Ethercat } SysCtl_PeripheralSOFTPRES; //***************************************************************************** // //! The following are values that can be passed to //! SysCtl_selectCPUForPeripheral() & SysCtl_lockCPUSelectRegs() //! as the \e peripheral parameter. // //***************************************************************************** typedef enum { //! Configure CPU Select for EPWM SYSCTL_CPUSEL0_EPWM = 0x0U, //! Configure CPU Select for ECAP SYSCTL_CPUSEL1_ECAP = 0x1U, //! Configure CPU Select for EQEP SYSCTL_CPUSEL2_EQEP = 0x2U, //! Configure CPU Select for SD SYSCTL_CPUSEL4_SD = 0x4U, //! Configure CPU Select for SCI SYSCTL_CPUSEL5_SCI = 0x5U, //! Configure CPU Select for SPI SYSCTL_CPUSEL6_SPI = 0x6U, //! Configure CPU Select for I2C SYSCTL_CPUSEL7_I2C = 0x7U, //! Configure CPU Select for CAN SYSCTL_CPUSEL8_CAN = 0x8U, //! Configure CPU Select for MCBSP SYSCTL_CPUSEL9_MCBSP = 0x9U, //! Configure CPU Select for ADC SYSCTL_CPUSEL11_ADC = 0xBU, //! Configure CPU Select for CMPSS SYSCTL_CPUSEL12_CMPSS = 0xCU, //! Configure CPU Select for DAC SYSCTL_CPUSEL14_DAC = 0xEU, //! Configure CPU Select for CLB SYSCTL_CPUSEL15_CLB = 0xFU, //! Configure CPU Select for FSI SYSCTL_CPUSEL16_FSI = 0x10U, //! Configure CPU Select for PMBUS SYSCTL_CPUSEL18_PMBUS = 0x12U, //! Configure CPU Select for HRCAL SYSCTL_CPUSEL25_HRCAL = 0x19U } SysCtl_CPUSelPeripheral; //***************************************************************************** // //! The following are values that can be passed to //! SysCtl_selectCPUForPeripheral() as \e cpuInst parameter. // //***************************************************************************** typedef enum { //! Connect the peripheral (indicated by SysCtl_CPUSelPeripheral) to CPU1 SYSCTL_CPUSEL_CPU1 = 0x0U, //! Connect the peripheral (indicated by SysCtl_CPUSelPeripheral) to CPU2 SYSCTL_CPUSEL_CPU2 = 0x1U } SysCtl_CPUSel; //***************************************************************************** // //! The following are values that can be passed to //! SysCtl_setWatchdogPredivider() as the \e predivider parameter. // //***************************************************************************** typedef enum { SYSCTL_WD_PREDIV_2 = 0x800, //!< PREDIVCLK = INTOSC1 / 2 SYSCTL_WD_PREDIV_4 = 0x900, //!< PREDIVCLK = INTOSC1 / 4 SYSCTL_WD_PREDIV_8 = 0xA00, //!< PREDIVCLK = INTOSC1 / 8 SYSCTL_WD_PREDIV_16 = 0xB00, //!< PREDIVCLK = INTOSC1 / 16 SYSCTL_WD_PREDIV_32 = 0xC00, //!< PREDIVCLK = INTOSC1 / 32 SYSCTL_WD_PREDIV_64 = 0xD00, //!< PREDIVCLK = INTOSC1 / 64 SYSCTL_WD_PREDIV_128 = 0xE00, //!< PREDIVCLK = INTOSC1 / 128 SYSCTL_WD_PREDIV_256 = 0xF00, //!< PREDIVCLK = INTOSC1 / 256 SYSCTL_WD_PREDIV_512 = 0x000, //!< PREDIVCLK = INTOSC1 / 512 SYSCTL_WD_PREDIV_1024 = 0x100, //!< PREDIVCLK = INTOSC1 / 1024 SYSCTL_WD_PREDIV_2048 = 0x200, //!< PREDIVCLK = INTOSC1 / 2048 SYSCTL_WD_PREDIV_4096 = 0x300 //!< PREDIVCLK = INTOSC1 / 4096 } SysCtl_WDPredivider; //***************************************************************************** // //! The following are values that can be passed to //! SysCtl_setWatchdogPrescaler() as the \e prescaler parameter. // //***************************************************************************** typedef enum { SYSCTL_WD_PRESCALE_1 = 1, //!< WDCLK = PREDIVCLK / 1 SYSCTL_WD_PRESCALE_2 = 2, //!< WDCLK = PREDIVCLK / 2 SYSCTL_WD_PRESCALE_4 = 3, //!< WDCLK = PREDIVCLK / 4 SYSCTL_WD_PRESCALE_8 = 4, //!< WDCLK = PREDIVCLK / 8 SYSCTL_WD_PRESCALE_16 = 5, //!< WDCLK = PREDIVCLK / 16 SYSCTL_WD_PRESCALE_32 = 6, //!< WDCLK = PREDIVCLK / 32 SYSCTL_WD_PRESCALE_64 = 7 //!< WDCLK = PREDIVCLK / 64 } SysCtl_WDPrescaler; //***************************************************************************** // //! The following are values that can be passed to //! SysCtl_setWatchdogMode() as the \e prescaler parameter. // //***************************************************************************** typedef enum { //! Watchdog can generate a reset signal SYSCTL_WD_MODE_RESET, //! Watchdog can generate an interrupt signal; reset signal is disabled SYSCTL_WD_MODE_INTERRUPT } SysCtl_WDMode; //***************************************************************************** // //! The following are values that can be passed to SysCtl_setLowSpeedClock() as //! the \e prescaler parameter. // //***************************************************************************** typedef enum { SYSCTL_LSPCLK_PRESCALE_1 = 0, //!< LSPCLK = SYSCLK / 1 SYSCTL_LSPCLK_PRESCALE_2 = 1, //!< LSPCLK = SYSCLK / 2 SYSCTL_LSPCLK_PRESCALE_4 = 2, //!< LSPCLK = SYSCLK / 4 (default) SYSCTL_LSPCLK_PRESCALE_6 = 3, //!< LSPCLK = SYSCLK / 6 SYSCTL_LSPCLK_PRESCALE_8 = 4, //!< LSPCLK = SYSCLK / 8 SYSCTL_LSPCLK_PRESCALE_10 = 5, //!< LSPCLK = SYSCLK / 10 SYSCTL_LSPCLK_PRESCALE_12 = 6, //!< LSPCLK = SYSCLK / 12 SYSCTL_LSPCLK_PRESCALE_14 = 7 //!< LSPCLK = SYSCLK / 14 } SysCtl_LSPCLKPrescaler; //***************************************************************************** // //! The following are values that can be passed to SysCtl_setEPWMClockDivider() //! as the \e divider parameter. // //***************************************************************************** typedef enum { SYSCTL_EPWMCLK_DIV_1, //!< EPWMCLK = PLLSYSCLK / 1 SYSCTL_EPWMCLK_DIV_2 //!< EPWMCLK = PLLSYSCLK / 2 } SysCtl_EPWMCLKDivider; //***************************************************************************** // //! The following are values that can be passed to //! SysCtl_setEMIF1ClockDivider() as the \e divider parameter. // //***************************************************************************** typedef enum { SYSCTL_EMIF1CLK_DIV_1, //!< EMIF1CLK = PLLSYSCLK / 1 SYSCTL_EMIF1CLK_DIV_2 //!< EMIF1CLK = PLLSYSCLK / 2 } SysCtl_EMIF1CLKDivider; //***************************************************************************** // //! The following are values that can be passed to //! SysCtl_setEMIF2ClockDivider() as the \e divider parameter. // //***************************************************************************** typedef enum { SYSCTL_EMIF2CLK_DIV_1, //!< EMIF2CLK = PLLSYSCLK / 1 SYSCTL_EMIF2CLK_DIV_2 //!< EMIF2CLK = PLLSYSCLK / 2 } SysCtl_EMIF2CLKDivider; //***************************************************************************** // //! The following are values that can be passed to //! SysCtl_setPeripheralAccessControl() and SysCtl_getPeripheralAccessControl() //! as the \e peripheral parameter. // //***************************************************************************** typedef enum { // // ADC // SYSCTL_ACCESS_ADCA = 0x0, //!< ADCA access SYSCTL_ACCESS_ADCB = 0x2, //!< ADCB access SYSCTL_ACCESS_ADCC = 0x4, //!< ADCC access SYSCTL_ACCESS_ADCD = 0x6, //!< ADCD access // // CMPSS // SYSCTL_ACCESS_CMPSS1 = 0x10, //!< CMPSS1 access SYSCTL_ACCESS_CMPSS2 = 0x12, //!< CMPSS2 access SYSCTL_ACCESS_CMPSS3 = 0x14, //!< CMPSS3 access SYSCTL_ACCESS_CMPSS4 = 0x16, //!< CMPSS4 access SYSCTL_ACCESS_CMPSS5 = 0x18, //!< CMPSS5 access SYSCTL_ACCESS_CMPSS6 = 0x1A, //!< CMPSS6 access SYSCTL_ACCESS_CMPSS7 = 0x1C, //!< CMPSS7 access SYSCTL_ACCESS_CMPSS8 = 0x1E, //!< CMPSS8 access // // DAC // SYSCTL_ACCESS_DACA = 0x28, //!< DACA access SYSCTL_ACCESS_DACB = 0x2A, //!< DACB access SYSCTL_ACCESS_DACC = 0x2C, //!< DACC access // // EPWM // SYSCTL_ACCESS_EPWM1 = 0x48, //!< ePWM1 access SYSCTL_ACCESS_EPWM2 = 0x4A, //!< ePWM2 access SYSCTL_ACCESS_EPWM3 = 0x4C, //!< ePWM3 access SYSCTL_ACCESS_EPWM4 = 0x4E, //!< ePWM4 access SYSCTL_ACCESS_EPWM5 = 0x50, //!< ePWM5 access SYSCTL_ACCESS_EPWM6 = 0x52, //!< ePWM6 access SYSCTL_ACCESS_EPWM7 = 0x54, //!< ePWM7 access SYSCTL_ACCESS_EPWM8 = 0x56, //!< ePWM8 access SYSCTL_ACCESS_EPWM9 = 0x58, //!< ePWM9 access SYSCTL_ACCESS_EPWM10 = 0x5A, //!< ePWM10 access SYSCTL_ACCESS_EPWM11 = 0x5C, //!< ePWM11 access SYSCTL_ACCESS_EPWM12 = 0x5E, //!< ePWM12 access SYSCTL_ACCESS_EPWM13 = 0x60, //!< ePWM13 access SYSCTL_ACCESS_EPWM14 = 0x62, //!< ePWM14 access SYSCTL_ACCESS_EPWM15 = 0x64, //!< ePWM15 access SYSCTL_ACCESS_EPWM16 = 0x66, //!< ePWM16 access // // EQEP // SYSCTL_ACCESS_EQEP1 = 0x70, //!< eQEP1 access SYSCTL_ACCESS_EQEP2 = 0x72, //!< eQEP2 access SYSCTL_ACCESS_EQEP3 = 0x74, //!< eQEP3 access // // ECAP // SYSCTL_ACCESS_ECAP1 = 0x80, //!< eCAP1 access SYSCTL_ACCESS_ECAP2 = 0x82, //!< eCAP2 access SYSCTL_ACCESS_ECAP3 = 0x84, //!< eCAP3 access SYSCTL_ACCESS_ECAP4 = 0x86, //!< eCAP4 access SYSCTL_ACCESS_ECAP5 = 0x88, //!< eCAP5 access SYSCTL_ACCESS_ECAP6 = 0x8A, //!< eCAP6 access SYSCTL_ACCESS_ECAP7 = 0x8C, //!< eCAP7 access // // SDFM // SYSCTL_ACCESS_SDFM1 = 0xA8, //!< SDFM1 access SYSCTL_ACCESS_SDFM2 = 0xAA, //!< SDFM2 access // // CLB // SYSCTL_ACCESS_CLB1 = 0xB0, //!< CLB1 access SYSCTL_ACCESS_CLB2 = 0xB2, //!< CLB2 access SYSCTL_ACCESS_CLB3 = 0xB4, //!< CLB3 access SYSCTL_ACCESS_CLB4 = 0xB6, //!< CLB4 access // // SPI // SYSCTL_ACCESS_SPIA = 0x110, //!< SPIA access SYSCTL_ACCESS_SPIB = 0x112, //!< SPIB access SYSCTL_ACCESS_SPIC = 0x114, //!< SPIC access SYSCTL_ACCESS_SPID = 0x116, //!< SPID access // // PMBUS // SYSCTL_ACCESS_PMBUS_A = 0x130, //!< PMBusA access // // CAN // SYSCTL_ACCESS_CANA = 0x140, //!< CANA access SYSCTL_ACCESS_CANB = 0x142, //!< CANB access // // MCBSP // SYSCTL_ACCESS_MCBSPA = 0x150, //!< MCBSPA access SYSCTL_ACCESS_MCBSPB = 0x152, //!< MCBSPB access // // USBA // SYSCTL_ACCESS_USBA = 0x180, //!< USBA access // // HRPWM // SYSCTL_ACCESS_HRPWM_A = 0x1A8, //!< HRPWM access // // ECAT // SYSCTL_ACCESS_ECAT = 0x1AA, //!< ECAT access // // FSI // SYSCTL_ACCESS_FSIATX = 0x1B0, //!< FSITXA access SYSCTL_ACCESS_FSIARX = 0x1B2, //!< FSIRXA access SYSCTL_ACCESS_FSIBTX = 0x1B4, //!< FSITXB access SYSCTL_ACCESS_FSIBRX = 0x1B6, //!< FSIRXB access SYSCTL_ACCESS_FSICRX = 0x1BA, //!< FSIRXC access SYSCTL_ACCESS_FSIDRX = 0x1BE, //!< FSIRXD access SYSCTL_ACCESS_FSIERX = 0x1C2, //!< FSIRXE access SYSCTL_ACCESS_FSIFRX = 0x1C6, //!< FSIRXF access SYSCTL_ACCESS_FSIGRX = 0x1CA, //!< FSIRXG access SYSCTL_ACCESS_FSIHRX = 0x1CE //!< FSIRXH access } SysCtl_AccessPeripheral; //***************************************************************************** // //! The following are values that can be passed to //! SysCtl_setPeripheralAccessControl() and SysCtl_getPeripheralAccessControl() //! as the \e master parameter. // //***************************************************************************** typedef enum { SYSCTL_ACCESS_CPUX = 0U, //!< CPU access to the peripheral SYSCTL_ACCESS_CLA1 = 2U, //!< CLA1 access to the peripheral SYSCTL_ACCESS_DMA1 = 4U //!< DMA access to the peripheral } SysCtl_AccessMaster; //***************************************************************************** // //! The following are values that can be passed to //! SysCtl_setPeripheralAccessControl() as the \e permission parameter. // //***************************************************************************** typedef enum { //! Full Access for both read and write. SYSCTL_ACCESS_FULL = 3U, //! Protected RD access such that FIFOs. Clear on read, registers are not //! changed and no write access. SYSCTL_ACCESS_PROTECTED = 2U, //! No read or write access. SYSCTL_ACCESS_NONE = 0U } SysCtl_AccessPermission; //***************************************************************************** // //! The following are values that can be passed to //! SysCtl_selectClockOutSource() as the \e source parameter. // //***************************************************************************** typedef enum { SYSCTL_CLOCKOUT_PLLSYS = 0U, //!< PLL System Clock post SYSCLKDIV SYSCTL_CLOCKOUT_PLLRAW = 1U, //!< PLL Raw Clock SYSCTL_CLOCKOUT_SYSCLK = 2U, //!< CPU System Clock SYSCTL_CLOCKOUT_SYSCLK2 = 3U, //!< CPU 2 System Clock SYSCTL_CLOCKOUT_AUXPLLCLK = 4U, //!< Aux PLL Clock SYSCTL_CLOCKOUT_INTOSC1 = 5U, //!< Internal Oscillator 1 SYSCTL_CLOCKOUT_INTOSC2 = 6U, //!< Internal Oscillator 2 SYSCTL_CLOCKOUT_XTALOSC = 7U, //!< External Oscillator SYSCTL_CLOCKOUT_CMCLK = 8U, //!< CMCLK SYSCTL_CLOCKOUT_PUMPOSC = 9U, //!< PUMPOSC SYSCTL_SYSPLLCLK_AUX = 10U, //!< Test Clk of the System APLL SYSCTL_AUXPLLCLK_AUX = 11U, //!< Test Clk of the Auxillary APLL SYSCTL_SYSPLLCLKOUT = 12U, //!< PLL System Clock pre SYSCLKDIV SYSCTL_AUXPLLCLKOUT = 13U //!< PLL System Clock pre AUXCLKDIV } SysCtl_ClockOut; //***************************************************************************** // //! The following are values that can be passed to //! SysCtl_setExternalOscMode() as the \e mode parameter. // //***************************************************************************** typedef enum { SYSCTL_XTALMODE_CRYSTAL = 1U, //!< XTAL Oscillator Crystal Mode SYSCTL_XTALMODE_SINGLE = 2U //!< XTAL Oscillator Single-Ended Mode } SysCtl_ExternalOscMode; //***************************************************************************** // //! The following values define the \e syncSrc parameter for //! SysCtl_setSyncOutputConfig(). // //***************************************************************************** typedef enum { SYSCTL_SYNC_OUT_SRC_EPWM1SYNCOUT = 0X0U, //!< EPWM1SYNCOUT --> EXTSYNCOUT SYSCTL_SYNC_OUT_SRC_EPWM2SYNCOUT = 0X1U, //!< EPWM2SYNCOUT --> EXTSYNCOUT SYSCTL_SYNC_OUT_SRC_EPWM3SYNCOUT = 0X2U, //!< EPWM3SYNCOUT --> EXTSYNCOUT SYSCTL_SYNC_OUT_SRC_EPWM4SYNCOUT = 0X3U, //!< EPWM4SYNCOUT --> EXTSYNCOUT SYSCTL_SYNC_OUT_SRC_EPWM5SYNCOUT = 0X4U, //!< EPWM5SYNCOUT --> EXTSYNCOUT SYSCTL_SYNC_OUT_SRC_EPWM6SYNCOUT = 0X5U, //!< EPWM6SYNCOUT --> EXTSYNCOUT SYSCTL_SYNC_OUT_SRC_EPWM7SYNCOUT = 0X6U, //!< EPWM7SYNCOUT --> EXTSYNCOUT SYSCTL_SYNC_OUT_SRC_EPWM8SYNCOUT = 0X7U, //!< EPWM8SYNCOUT --> EXTSYNCOUT SYSCTL_SYNC_OUT_SRC_EPWM9SYNCOUT = 0X8U, //!< EPWM9SYNCOUT --> EXTSYNCOUT SYSCTL_SYNC_OUT_SRC_EPWM10SYNCOUT = 0X9U, //!< EPWM10SYNCOUT --> EXTSYNCOUT SYSCTL_SYNC_OUT_SRC_EPWM11SYNCOUT = 0XAU, //!< EPWM11SYNCOUT --> EXTSYNCOUT SYSCTL_SYNC_OUT_SRC_EPWM12SYNCOUT = 0XBU, //!< EPWM12SYNCOUT --> EXTSYNCOUT SYSCTL_SYNC_OUT_SRC_EPWM13SYNCOUT = 0XCU, //!< EPWM13SYNCOUT --> EXTSYNCOUT SYSCTL_SYNC_OUT_SRC_EPWM14SYNCOUT = 0XDU, //!< EPWM14SYNCOUT --> EXTSYNCOUT SYSCTL_SYNC_OUT_SRC_EPWM15SYNCOUT = 0XEU, //!< EPWM15SYNCOUT --> EXTSYNCOUT SYSCTL_SYNC_OUT_SRC_EPWM16SYNCOUT = 0XFU, //!< EPWM16SYNCOUT --> EXTSYNCOUT SYSCTL_SYNC_OUT_SRC_ECAP1SYNCOUT = 0x18, //!< ECAP1SYNCOUT --> EXTSYNCOUT SYSCTL_SYNC_OUT_SRC_ECAP2SYNCOUT = 0x19, //!< ECAP2SYNCOUT --> EXTSYNCOUT SYSCTL_SYNC_OUT_SRC_ECAP3SYNCOUT = 0x20, //!< ECAP3SYNCOUT --> EXTSYNCOUT SYSCTL_SYNC_OUT_SRC_ECAP4SYNCOUT = 0x21, //!< ECAP4SYNCOUT --> EXTSYNCOUT SYSCTL_SYNC_OUT_SRC_ECAP5SYNCOUT = 0x22, //!< ECAP5SYNCOUT --> EXTSYNCOUT SYSCTL_SYNC_OUT_SRC_ECAP6SYNCOUT = 0x23, //!< ECAP6SYNCOUT --> EXTSYNCOUT SYSCTL_SYNC_OUT_SRC_ECAP7SYNCOUT = 0x24 //!< ECAP7SYNCOUT --> EXTSYNCOUT } SysCtl_SyncOutputSource; //***************************************************************************** // //! The following values define the \e parametric parameter for //! SysCtl_getDeviceParametric(). // //***************************************************************************** typedef enum { SYSCTL_DEVICE_QUAL, //!< Device Qualification Status SYSCTL_DEVICE_PINCOUNT, //!< Device Pin Count SYSCTL_DEVICE_INSTASPIN, //!< Device InstaSPIN Feature Set SYSCTL_DEVICE_FLASH, //!< Device Flash size (KB) SYSCTL_DEVICE_PARTID, //!< Device Part ID Format Revision SYSCTL_DEVICE_FAMILY, //!< Device Family SYSCTL_DEVICE_PARTNO, //!< Device Part Number SYSCTL_DEVICE_CLASSID //!< Device Class ID } SysCtl_DeviceParametric; //***************************************************************************** // //! The following are values that can be passed to //! SysCtl_lockConfigRegs() as the \e master parameter. // //***************************************************************************** typedef enum { SYSCTL_DC_PERCNF_PARTID, //!< Allows/Blocks write to Device config registers SYSCTL_BANKSEL //!< Allows/Blocks write to BANKSEL registers }SysCtl_DeviceConf; //***************************************************************************** // //! The following are values that can be passed to SysCtl_controlCMReset() & //! SysCtl_CPU2Reset() as the \e master parameter. // //***************************************************************************** typedef enum { SYSCTL_CORE_DEACTIVE, //!< Core reset is deactivated SYSCTL_CORE_ACTIVE //!< Core is held in reset }SysCtl_CoreReset; //***************************************************************************** // //! The following are values that can be passed to //! SysCtl_readADCWrapper as the \e peripheral parameter. // //***************************************************************************** typedef enum { // // ADC // SYSCTL_SELECT_ADCA, //!< ADCA access SYSCTL_SELECT_ADCB, //!< ADCB access SYSCTL_SELECT_ADCC, //!< ADCC access SYSCTL_SELECT_ADCD //!< ADCD access }SysCtl_SelADC; //***************************************************************************** // //! The following are values that can be passed to //! SysCtl_selectbank() as the \e prescaler parameter. // //***************************************************************************** typedef enum { //! CPU1BANK SYSCTL_CPU1BANK, //! CPU2BANK (CPU1BANK in read mode) SYSCTL_CPU2BANK, //! CMBANK (CPU1BANK in read mode) SYSCTL_CMBANK }SysCtl_CPUBank; //***************************************************************************** // //! The following are values that can be passed to SysCtl_configureType() //! as the \e peripheral parameter. // //***************************************************************************** typedef enum { //!Configure USB Type for the device SYSCTL_USBTYPE = 0x0, //!Configure ECAP Type for the device SYSCTL_ECAPTYPE = 0x1, //!Configure SDFM Type for the device SYSCTL_SDFMTYPE = 0x2, //! Configure MEMMAP Type for the device SYSCTL_MEMMAPTYPE = 0x4 }SysCtl_SelType; //***************************************************************************** // //! The following are values that can be passed to //! SysCtl_allocateSharedPeripheral() as the \e peripheral parameter. // //***************************************************************************** typedef enum { SYSCTL_PALLOCATE_USBA, //!< Allocate USB_A to CM SYSCTL_PALLOCATE_ETHERCAT, //!< Allocate ETHERCAT to CM SYSCTL_PALLOCATE_CAN_A, //!< Allocate CAN_A to CM SYSCTL_PALLOCATE_CAN_B, //!< Allocate CAN_B to CM }SysCtl_SharedPeripheral; //***************************************************************************** // //! The following are values that can be passed to //! SysCtl_setXClk() as \e divider parameter. // //***************************************************************************** typedef enum { SYSCTL_XCLKOUT_DIV_1, //!< XCLKOUT = XCLKOUT / 1 SYSCTL_XCLKOUT_DIV_2, //!< XCLKOUT = XCLKOUT / 2 SYSCTL_XCLKOUT_DIV_4, //!< XCLKOUT = XCLKOUT / 4 SYSCTL_XCLKOUT_DIV_8 //!< XCLKOUT = XCLKOUT / 8 }SysCtl_XClkDivider; //***************************************************************************** // //! The following are values that can be passed to //! SysCtl_setCMClk() as \e divider parameter. // //***************************************************************************** typedef enum { SYSCTL_CMCLKOUT_DIV_1, //!< CM clock = CM clock / 1 SYSCTL_CMCLKOUT_DIV_2, //!< CM clock = CM clock / 2 SYSCTL_CMCLKOUT_DIV_3, //!< CM clock = CM clock / 3 SYSCTL_CMCLKOUT_DIV_4, //!< CM clock = CM clock / 4 SYSCTL_CMCLKOUT_DIV_5, //!< CM clock = CM clock / 5 SYSCTL_CMCLKOUT_DIV_6, //!< CM clock = CM clock / 6 SYSCTL_CMCLKOUT_DIV_7, //!< CM clock = CM clock / 7 SYSCTL_CMCLKOUT_DIV_8 //!< CM clock = CM clock / 8 }SysCtl_CMClkDivider; //***************************************************************************** // //! The following are values that can be passed to //! SysCtl_setECatClk() as \e divider parameter. // //***************************************************************************** typedef enum { SYSCTL_ECATCLKOUT_DIV_1, //!< ECat clock = ECat clock / 1 SYSCTL_ECATCLKOUT_DIV_2, //!< ECat clock = ECat clock / 2 SYSCTL_ECATCLKOUT_DIV_3, //!< ECat clock = ECat clock / 3 SYSCTL_ECATCLKOUT_DIV_4, //!< ECat clock = ECat clock / 4 SYSCTL_ECATCLKOUT_DIV_5, //!< ECat clock = ECat clock / 5 SYSCTL_ECATCLKOUT_DIV_6, //!< ECat clock = ECat clock / 6 SYSCTL_ECATCLKOUT_DIV_7, //!< ECat clock = ECat clock / 7 SYSCTL_ECATCLKOUT_DIV_8 //!< ECat clock = ECat clock / 8 }SysCtl_ECatClkDivider; //***************************************************************************** // //! The following are values that can be passed to //! SysCtl_setEnetClk() as \e divider parameter. // //***************************************************************************** typedef enum { SYSCTL_ENETCLKOUT_DIV_1, //!< Enet clock = Enet clock / 1 SYSCTL_ENETCLKOUT_DIV_2, //!< Enet clock = Enet clock / 2 SYSCTL_ENETCLKOUT_DIV_3, //!< Enet clock = Enet clock / 3 SYSCTL_ENETCLKOUT_DIV_4, //!< Enet clock = Enet clock / 4 SYSCTL_ENETCLKOUT_DIV_5, //!< Enet clock = Enet clock / 5 SYSCTL_ENETCLKOUT_DIV_6, //!< Enet clock = Enet clock / 6 SYSCTL_ENETCLKOUT_DIV_7, //!< Enet clock = Enet clock / 7 SYSCTL_ENETCLKOUT_DIV_8 //!< Enet clock = Enet clock / 8 }SysCtl_EnetClkDivider; //***************************************************************************** // //! The following are values that can be passed to SysCtl_setCMClk(), //! SysCtl_setECatClk() & SysCtl_isPLLValid() as \e source parameter. // //***************************************************************************** typedef enum { //! Auxillary PLL SYSCTL_SOURCE_AUXPLL, //! System PLL SYSCTL_SOURCE_SYSPLL }SysCtl_PLLClockSource; //***************************************************************************** // //! The following are values that can be passed to //! SysCtl_setMCANClk() as \e divider parameter. // //***************************************************************************** typedef enum { SYSCTL_MCANCLK_DIV_1 = 0x0, //!< MCAN clock = MCAN clock / 1 SYSCTL_MCANCLK_DIV_2 = 0x1, //!< MCAN clock = MCAN clock / 2 SYSCTL_MCANCLK_DIV_3 = 0x2, //!< MCAN clock = MCAN clock / 3 SYSCTL_MCANCLK_DIV_4 = 0x3, //!< MCAN clock = MCAN clock / 4 SYSCTL_MCANCLK_DIV_5 = 0x4, //!< MCAN clock = MCAN clock / 5 SYSCTL_MCANCLK_DIV_6 = 0x5, //!< MCAN clock = MCAN clock / 6 SYSCTL_MCANCLK_DIV_7 = 0x6, //!< MCAN clock = MCAN clock / 7 SYSCTL_MCANCLK_DIV_8 = 0x7, //!< MCAN clock = MCAN clock / 8 SYSCTL_MCANCLK_DIV_9 = 0x8, //!< MCAN clock = MCAN clock / 9 SYSCTL_MCANCLK_DIV_10 = 0x9, //!< MCAN clock = MCAN clock / 10 SYSCTL_MCANCLK_DIV_11 = 0xA, //!< MCAN clock = MCAN clock / 11 SYSCTL_MCANCLK_DIV_12 = 0xB, //!< MCAN clock = MCAN clock / 12 SYSCTL_MCANCLK_DIV_13 = 0xC, //!< MCAN clock = MCAN clock / 13 SYSCTL_MCANCLK_DIV_14 = 0xD, //!< MCAN clock = MCAN clock / 14 SYSCTL_MCANCLK_DIV_15 = 0xE, //!< MCAN clock = MCAN clock / 15 SYSCTL_MCANCLK_DIV_16 = 0xF, //!< MCAN clock = MCAN clock / 16 SYSCTL_MCANCLK_DIV_17 = 0x10, //!< MCAN clock = MCAN clock / 17 SYSCTL_MCANCLK_DIV_18 = 0x11, //!< MCAN clock = MCAN clock / 18 SYSCTL_MCANCLK_DIV_19 = 0x12, //!< MCAN clock = MCAN clock / 19 SYSCTL_MCANCLK_DIV_20 = 0x13 //!< MCAN clock = MCAN clock / 20 }SysCtl_MCANClkDivider; //***************************************************************************** // //! The following are values that can be passed to //! SysCtl_setAuxPLLClk() as \e divider parameter. // //***************************************************************************** typedef enum { SYSCTL_AUXPLLCLK_DIV_1, //!< AUXPLL clock = AUXPLL clock / 1 SYSCTL_AUXPLLCLK_DIV_2, //!< AUXPLL clock = AUXPLL clock / 2 SYSCTL_AUXPLLCLK_DIV_4, //!< AUXPLL clock = AUXPLL clock / 4 SYSCTL_AUXPLLCLK_DIV_8, //!< AUXPLL clock = AUXPLL clock / 8 SYSCTL_AUXPLLCLK_DIV_3, //!< AUXPLL clock = AUXPLL clock / 3 SYSCTL_AUXPLLCLK_DIV_5, //!< AUXPLL clock = AUXPLL clock / 5 SYSCTL_AUXPLLCLK_DIV_6, //!< AUXPLL clock = AUXPLL clock / 6 SYSCTL_AUXPLLCLK_DIV_7 //!< AUXPLL clock = AUXPLL clock / 7 }SysCtl_AuxPLLClkDivider; //***************************************************************************** // //! The following are values that can be passed to //! SysCtl_setCputimer2Clk() as \e divider parameter. // //***************************************************************************** typedef enum { SYSCTL_TMR2CLKPRESCALE_1, //!< Cputimer2 clock = Cputimer2 clock / 1 SYSCTL_TMR2CLKPRESCALE_2, //!< Cputimer2 clock = Cputimer2 clock / 2 SYSCTL_TMR2CLKPRESCALE_4, //!< Cputimer2 clock = Cputimer2 clock / 4 SYSCTL_TMR2CLKPRESCALE_8, //!< Cputimer2 clock = Cputimer2 clock / 8 SYSCTL_TMR2CLKPRESCALE_16 //!< Cputimer2 clock = Cputimer2 clock / 16 }SysCtl_Cputimer2ClkDivider; //***************************************************************************** // //! The following are values that can be passed to SysCtl_setCputimer2Clk() //! as \e source parameter. // //***************************************************************************** typedef enum { SYSCTL_TMR2CLKSRCSEL_SYSCLK = 0U, //!< System Clock SYSCTL_TMR2CLKSRCSEL_INTOSC1 = 1U, //!< Internal Oscillator 1 SYSCTL_TMR2CLKSRCSEL_INTOSC2 = 2U, //!< Internal Oscillator 2 SYSCTL_TMR2CLKSRCSEL_XTAL = 3U, //!< Crystal oscillator SYSCTL_TMR2CLKSRCSEL_AUXPLLCLK = 6U //!< Aux PLL CLock }SysCtl_Cputimer2ClkSource; //***************************************************************************** // //! The following are values that can be passed to SysCtl_lockClkConfig() //! as the \e peripheral parameter. // //***************************************************************************** typedef enum { // // CLKCFGLOCK1 // SYSCTL_REG_SEL_CLKSRCCTL1 = 0x0000, //!< CLKSRCCTL1 lock SYSCTL_REG_SEL_CLKSRCCTL2 = 0x0100, //!< CLKSRCCTL2 lock SYSCTL_REG_SEL_CLKSRCCTL3 = 0x0200, //!< CLKSRCCTL3 lock SYSCTL_REG_SEL_SYSPLLCTL1 = 0x0300, //!< SYSPLLCTL1 lock SYSCTL_REG_SEL_SYSPLLMULT = 0x0600, //!< SYSPLLMULTlock SYSCTL_REG_SEL_AUXPLLCTL1 = 0x0700, //!< AUXPLLCTL1 lock SYSCTL_REG_SEL_AUXPLLMULT = 0x0A00, //!< AUXPLLMULT lock SYSCTL_REG_SEL_SYSCLKDIVSEL = 0x0B00, //!< SYSCLKDIVSEL lock SYSCTL_REG_SEL_AUXCLKDIVSEL = 0x0C00, //!< AUXCLKDIVSEL lock SYSCTL_REG_SEL_PERCLKDIVSEL = 0x0D00, //!< PERCLKDIVSEL lock SYSCTL_REG_SEL_CLBCLKCTL = 0x0E00, //!< CLBCLKCTL lock SYSCTL_REG_SEL_LOSPCP = 0x0F00, //!< LOSPCP lock SYSCTL_REG_SEL_XTALCR = 0x1000, //!< XTALCR lock SYSCTL_REG_SEL_ETHERCATCLKCTL = 0x1100, //!< ETHERCATCLKCTL lock SYSCTL_REG_SEL_CMCLKCTL = 0x1200 //!< CMCLKCTL lock } SysCtl_ClkRegSel; //***************************************************************************** // //! The following are values that can be passed to SysCtl_lockSysConfig() //! as the \e peripheral parameter. // //***************************************************************************** typedef enum { // // CPUSYSLOCK1 // SYSCTL_REG_SEL_PIEVERRADDR = 0x0200, //!< PIEVERRADDR lock SYSCTL_REG_SEL_PCLKCR0 = 0x0300, //!< PCLKCR0 lock SYSCTL_REG_SEL_PCLKCR1 = 0x0400, //!< PCLKCR1 lock SYSCTL_REG_SEL_PCLKCR2 = 0x0500, //!< PCLKCR2 lock SYSCTL_REG_SEL_PCLKCR3 = 0x0600, //!< PCLKCR3 lock SYSCTL_REG_SEL_PCLKCR4 = 0x0700, //!< PCLKCR4 lock SYSCTL_REG_SEL_PCLKCR6 = 0x0900, //!< PCLKCR6 lock SYSCTL_REG_SEL_PCLKCR7 = 0x0A00, //!< PCLKCR7 lock SYSCTL_REG_SEL_PCLKCR8 = 0x0B00, //!< PCLKCR8 lock SYSCTL_REG_SEL_PCLKCR9 = 0x0C00, //!< PCLKCR9 lock SYSCTL_REG_SEL_PCLKCR10 = 0x0D00, //!< PCLKCR10 lock SYSCTL_REG_SEL_PCLKCR11 = 0x0E00, //!< PCLKCR11 lock SYSCTL_REG_SEL_PCLKCR13 = 0x1000, //!< PCLKCR13 lock SYSCTL_REG_SEL_PCLKCR14 = 0x1100, //!< PCLKCR14 lock SYSCTL_REG_SEL_PCLKCR16 = 0x1300, //!< PCLKCR16 lock SYSCTL_REG_SEL_SECMSEL = 0x1400, //!< SECMSEL lock SYSCTL_REG_SEL_LPMCR = 0x1500, //!< LPMCR lock SYSCTL_REG_SEL_GPIOLPMSEL0 = 0x1600, //!< GPIOLPMSEL0 lock SYSCTL_REG_SEL_GPIOLPMSEL1 = 0x1700, //!< GPIOLPMSEL1 lock SYSCTL_REG_SEL_PCLKCR17 = 0x1800, //!< PCLKCR17 lock SYSCTL_REG_SEL_PCLKCR18 = 0x1900, //!< PCLKCR18 lock SYSCTL_REG_SEL_PCLKCR20 = 0x1B00, //!< PCLKCR20 lock SYSCTL_REG_SEL_PCLKCR21 = 0x1C00, //!< PCLKCR21 lock SYSCTL_REG_SEL_PCLKCR22 = 0x1D00, //!< PCLKCR22 lock SYSCTL_REG_SEL_PCLKCR23 = 0x1E00, //!< PCLKCR23 lock // //CPUSYSLOCK2 // SYSCTL_REG_SEL_ETHERCATCTL = 0x0001 //!< ETHERCATCTL lock } SysCtl_CpuRegSel; //***************************************************************************** // //! The following are values that can be passed to //! SysCtl_setCLBClk() as \e cpuInst parameter. // //***************************************************************************** typedef enum { SYSCTL_CLBCLKOUT_DIV_1, //!< CLB clock = CLB clock / 1 SYSCTL_CLBCLKOUT_DIV_2, //!< CLB clock = CLB clock / 2 SYSCTL_CLBCLKOUT_DIV_3, //!< CLB clock = CLB clock / 3 SYSCTL_CLBCLKOUT_DIV_4, //!< CLB clock = CLB clock / 4 SYSCTL_CLBCLKOUT_DIV_5, //!< CLB clock = CLB clock / 5 SYSCTL_CLBCLKOUT_DIV_6, //!< CLB clock = CLB clock / 6 SYSCTL_CLBCLKOUT_DIV_7, //!< CLB clock = CLB clock / 7 SYSCTL_CLBCLKOUT_DIV_8 //!< CLB clock = CLB clock / 8 }SysCtl_CLBClkDivider; typedef enum { SYSCTL_CLBTCLKOUT_DIV_1, //!< CLBTCLKOUT = CLB clock / 1 SYSCTL_CLBTCLKOUT_DIV_2 //!< CLBTCLKOUT = CLB clock / 2 }SysCtl_CLBTClkDivider; typedef enum { SYSCTL_CLB1 = 0x10, //!< CLB 1 instance SYSCTL_CLB2 = 0x11, //!< CLB 2 instance SYSCTL_CLB3 = 0x12, //!< CLB 3 instance SYSCTL_CLB4 = 0x13, //!< CLB 4 instance }SysCtl_CLBInst; typedef enum { SYSCTL_CLBCLK_SYNC, //!< CLB is synchronous to SYSCLK SYSCTL_CLBCLK_ASYNC //!< CLB runs of asynchronous clock }SysCtl_CLBClkm; //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** //***************************************************************************** // //! Wrapper function for Device_cal function //! //! \param None //! //! This is a wrapper function for the Device_cal function available in the OTP //! memory. The function saves and restores the core registers which are being //! used by the Device_cal function //! //! \return None. // //***************************************************************************** static inline void SysCtl_deviceCal(void) { // // Save the core registers used by Device_cal function in the stack // asm(" PUSH ACC"); asm(" PUSH DP"); asm(" PUSH XAR0"); asm(" PUSH XAR2"); asm(" PUSH XAR3"); asm(" PUSH XAR4"); asm(" PUSH XAR5"); // // Call the Device_cal function // ((void (*)(void))((uintptr_t)0x70260))(); // // Restore the core registers // asm(" POP XAR5"); asm(" POP XAR4"); asm(" POP XAR3"); asm(" POP XAR2"); asm(" POP XAR0"); asm(" POP DP"); asm(" POP ACC"); } //***************************************************************************** // //! Resets a peripheral //! //! \param peripheral is the peripheral to reset. //! //! This function uses the SOFTPRESx registers to reset a specified peripheral. //! Module registers will be returned to their reset states. //! //! \note This includes registers containing trim values.The peripheral //! software reset needed by CPU2 can be communicated to CPU1 via //! IPC for all shared peripherals. //! //! \return None. // //***************************************************************************** static inline void SysCtl_resetPeripheral(SysCtl_PeripheralSOFTPRES peripheral) { uint16_t regIndex; uint16_t bitIndex; // // Decode the peripheral variable. // regIndex = (uint16_t)2U * ((uint16_t)peripheral & (uint16_t)0x001FU); bitIndex = ((uint16_t)peripheral & 0x1F00U) >> 0x0008U; __eallow(); // // Sets the appropriate reset bit and then clears it. // (*((volatile uint32_t *)((uintptr_t)(0x0005D000U + 0x82U + regIndex)))) |= ((uint32_t)1U << bitIndex); (*((volatile uint32_t *)((uintptr_t)(0x0005D000U + 0x82U + regIndex)))) &= ~((uint32_t)1U << bitIndex); // // Call Deive_cal function // if(((peripheral & 0x001FU) == 0xDU) || // ADCx ((peripheral & 0x001FU) == 0x10U) // DACx ) { SysCtl_deviceCal(); } __edis(); } //***************************************************************************** // //! Enables a peripheral. //! //! \param peripheral is the peripheral to enable. //! //! Peripherals are enabled with this function. At power-up, all peripherals //! are disabled; they must be enabled in order to operate or respond to //! register reads/writes. //! //! \return None. // //***************************************************************************** static inline void SysCtl_enablePeripheral(SysCtl_PeripheralPCLOCKCR peripheral) { uint16_t regIndex; uint16_t bitIndex; // // Decode the peripheral variable. // regIndex = (uint16_t)2U * ((uint16_t)peripheral & (uint16_t)0x001FU); bitIndex = ((uint16_t)peripheral & 0x1F00U) >> 0x0008U; __eallow(); // // Turn on the module clock. // (*((volatile uint32_t *)((uintptr_t)(0x0005D300U + 0x22U + regIndex)))) |= ((uint32_t)1U << bitIndex); __edis(); } //***************************************************************************** // //! Disables a peripheral. //! //! \param peripheral is the peripheral to disable. //! //! Peripherals are disabled with this function. Once disabled, they will not //! operate or respond to register reads/writes. //! //! \return None. // //***************************************************************************** static inline void SysCtl_disablePeripheral(SysCtl_PeripheralPCLOCKCR peripheral) { uint16_t regIndex; uint16_t bitIndex; // // Decode the peripheral variable. // regIndex = (uint16_t)2U * ((uint16_t)peripheral & (uint16_t)0x001FU); bitIndex = ((uint16_t)peripheral & 0x1F00U) >> 0x0008U; __eallow(); // // Turn off the module clock. // (*((volatile uint32_t *)((uintptr_t)(0x0005D300U + 0x22U + regIndex)))) &= ~((uint32_t)1U << bitIndex); __edis(); } //***************************************************************************** // //! Resets the device. //! //! This function performs a watchdog reset of the device. //! //! \return This function does not return. // //***************************************************************************** static inline void SysCtl_resetDevice(void) { // // Write an incorrect check value to the watchdog control register // This will cause a device reset // __eallow(); // // Enable the watchdog // (*((volatile uint16_t *)((uintptr_t)(0x00007000U + 0x29U)))) = 0x0028U; // // Write a bad check value // (*((volatile uint16_t *)((uintptr_t)(0x00007000U + 0x29U)))) = 0U; __edis(); // // The device should have reset, so this should never be reached. Just in // case, loop forever. // while(1) { } } //***************************************************************************** // //! Gets the reason for a reset. //! //! This function will return the reason(s) for a reset. Since the reset //! reasons are sticky until either cleared by software or an external reset, //! multiple reset reasons may be returned if multiple resets have occurred. //! The reset reason will be a logical OR of //! - \b SYSCTL_CAUSE_POR - Power-on reset //! - \b SYSCTL_CAUSE_XRS - External reset pin //! - \b SYSCTL_CAUSE_WDRS - Watchdog reset //! - \b SYSCTL_CAUSE_NMIWDRS - NMI watchdog reset //! - \b SYSCTL_CAUSE_SCCRESET - SCCRESETn reset from DCSM //! - \b SYSCTL_CAUSE_HWBISTN - HWBISTn reset //! - \b SYSCTL_CAUSE_ECAT_RESET_OUT - Ethercat Reset //! - \b SYSCTL_CAUSE_SIMRESET_CPU1RSN - SIMRESET from CPU1 //! - \b SYSCTL_CAUSE_SIMRESET_XRSN - SIMRESET from XRSn //! - \b SYSCTL_RESC_XRSN_PIN_STATUS - XRSN Pin Status //! - \b SYSCTL_RESC_TRSTN_PIN_STATUS -TRSTN Pin Status //! //! \note If you re-purpose the reserved boot ROM RAM, the POR and XRS reset //! statuses won't be accurate. //! //! \return Returns the reason(s) for a reset. // //***************************************************************************** static inline uint32_t SysCtl_getResetCause(void) { uint32_t resetCauses; // // Read CPU reset register // resetCauses = (*((volatile uint32_t *)((uintptr_t)(0x0005D300U + 0x80U)))) & ((uint32_t)0x1U | (uint32_t)0x2U | (uint32_t)0x4U | (uint32_t)0x8U | (uint32_t)0x100U | (uint32_t)0x20U | (uint32_t)0x200U | (uint32_t)0x400U | (uint32_t)0x800U | (uint32_t)0x40000000U | (uint32_t)0x80000000U ); // // Set POR and XRS Causes from boot ROM Status // if(((*((volatile uint32_t *)((uintptr_t)(0x0002U)))) & (uint32_t)0x8000U) == (uint32_t)0x8000U) { resetCauses |= 0x1U; } if(((*((volatile uint32_t *)((uintptr_t)(0x0002U)))) & (uint32_t)0x4000U) == (uint32_t)0x4000U) { resetCauses |= 0x2U; } // // Return the reset reasons. // return(resetCauses); } //***************************************************************************** // //! Clears reset reasons. //! //! \param rstCauses are the reset causes to be cleared; must be a logical //! OR of \b SYSCTL_CAUSE_POR, \b SYSCTL_CAUSE_XRS, \b SYSCTL_CAUSE_WDRS, //! \b SYSCTL_CAUSE_NMIWDRS, //! \b SYSCTL_CAUSE_HWBISTN, //! \b SYSCTL_CAUSE_ECAT_RESET_OUT,\b SYSCTL_CAUSE_SIMRESET_CPU1RSN, //! \b SYSCTL_CAUSE_SIMRESET_XRSN //! and/or \b SYSCTL_CAUSE_SCCRESET. //! //! This function clears the specified sticky reset reasons. Once cleared, //! another reset for the same reason can be detected, and a reset for a //! different reason can be distinguished (instead of having two reset causes //! set). If the reset reason is used by an application, all reset causes //! should be cleared after they are retrieved with SysCtl_getResetCause(). //! //! \note Some reset causes are cleared by the boot ROM. //! //! \return None. // //***************************************************************************** static inline void SysCtl_clearResetCause(uint32_t rstCauses) { // // Clear the given reset reasons. // (*((volatile uint32_t *)((uintptr_t)(0x0005D300U + 0x80U)))) = rstCauses; } //***************************************************************************** // //! Sets the low speed peripheral clock rate prescaler. //! //! \param prescaler is the LSPCLK rate relative to SYSCLK //! //! This function configures the clock rate of the low speed peripherals. The //! \e prescaler parameter is the value by which the SYSCLK rate is divided to //! get the LSPCLK rate. For example, a \e prescaler of //! \b SYSCTL_LSPCLK_PRESCALE_4 will result in a LSPCLK rate that is a quarter //! of the SYSCLK rate. //! //! \return None. // //***************************************************************************** static inline void SysCtl_setLowSpeedClock(SysCtl_LSPCLKPrescaler prescaler) { // // Write the divider selection to the appropriate register. // __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x0005D200U + 0x2CU)))) = ((*((volatile uint32_t *)((uintptr_t)(0x0005D200U + 0x2CU)))) & ~0x7U) | (uint32_t)prescaler; __edis(); } //***************************************************************************** // //! Sets the ePWM clock divider. //! //! \param divider is the value by which PLLSYSCLK is divided //! //! This function configures the clock rate of the EPWMCLK. The //! \e divider parameter is the value by which the SYSCLK rate is divided to //! get the EPWMCLK rate. For example, \b SYSCTL_EPWMCLK_DIV_2 will select an //! EPWMCLK rate that is half the PLLSYSCLK rate. //! //! \return None. // //***************************************************************************** static inline void SysCtl_setEPWMClockDivider(SysCtl_EPWMCLKDivider divider) { // // Write the divider selection to the appropriate register. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x26U)))) = ((*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x26U)))) & ~0x3U) | (uint16_t)divider; __edis(); } //***************************************************************************** // //! Sets the EMIF1 clock divider. //! //! \param divider is the value by which PLLSYSCLK (or CPU1.SYSCLK on a dual //! core device) is divided //! //! This function configures the clock rate of the EMIF1CLK. The //! \e divider parameter is the value by which the SYSCLK rate is divided to //! get the EMIF1CLK rate. For example, \b SYSCTL_EMIF1CLK_DIV_2 will select an //! EMIF1CLK rate that is half the PLLSYSCLK (or CPU1.SYSCLK on a dual //! core device) rate. //! //! \return None. // //***************************************************************************** static inline void SysCtl_setEMIF1ClockDivider(SysCtl_EMIF1CLKDivider divider) { // // Write the divider selection to the appropriate register. // __eallow(); if(divider == SYSCTL_EMIF1CLK_DIV_2) { (*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x26U)))) |= 0x10U; } else { (*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x26U)))) &= ~0x10U; } __edis(); } //***************************************************************************** // //! Sets the EMIF2 clock divider. //! //! \param divider is the value by which PLLSYSCLK (or CPU1.SYSCLK on a dual //! core device) is divided //! //! This function configures the clock rate of the EMIF2CLK. The //! \e divider parameter is the value by which the SYSCLK rate is divided to //! get the EMIF2CLK rate. For example, \b SYSCTL_EMIF2CLK_DIV_2 will select an //! EMIF2CLK rate that is half the PLLSYSCLK (or CPU1.SYSCLK on a dual //! core device) rate. //! //! \return None. // //***************************************************************************** static inline void SysCtl_setEMIF2ClockDivider(SysCtl_EMIF2CLKDivider divider) { // // Write the divider selection to the appropriate register. // __eallow(); if(divider == SYSCTL_EMIF2CLK_DIV_2) { (*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x26U)))) |= 0x40U; } else { (*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x26U)))) &= ~0x40U; } __edis(); } //***************************************************************************** // //! Selects a clock source to mux to an external GPIO pin (XCLKOUT). //! //! \param source is the internal clock source to be configured. //! //! This function configures the specified clock source to be muxed to an //! external clock out (XCLKOUT) GPIO pin. The \e source parameter may take a //! value of one of the following values: //! - \b SYSCTL_CLOCKOUT_PLLSYS //! - \b SYSCTL_CLOCKOUT_PLLRAW //! - \b SYSCTL_CLOCKOUT_SYSCLK //! - \b SYSCTL_CLOCKOUT_SYSCLK2 //! - \b SYSCTL_CLOCKOUT_AUXPLLCLK //! - \b SYSCTL_CLOCKOUT_INTOSC1 //! - \b SYSCTL_CLOCKOUT_INTOSC2 //! - \b SYSCTL_CLOCKOUT_XTALOSC //! - \b SYSCTL_CLOCKOUT_CMCLK //! - \b SYSCTL_CLOCKOUT_PUMPOSC //! //! \return None. // //***************************************************************************** static inline void SysCtl_selectClockOutSource(SysCtl_ClockOut source) { __eallow(); // // Clear clock out source // (*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0xCU)))) &= ~0xFU; // // Set clock out source // (*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0xCU)))) |= (uint16_t)source; __edis(); } //***************************************************************************** // //! Set the external oscillator mode. //! //! \param mode is the external oscillator mode to be configured. //! //! This function sets the external oscillator mode specified by the \e mode //! parameter which may take one of two values: //! - \b SYSCTL_XTALMODE_CRYSTAL - Crystal Mode //! - \b SYSCTL_XTALMODE_SINGLE - Single-Ended Mode //! //! \note The external oscillator must be powered off before this configuration //! can be performed. //! //! \return None. // //***************************************************************************** static inline void SysCtl_setExternalOscMode(SysCtl_ExternalOscMode mode) { __eallow(); switch(mode) { case SYSCTL_XTALMODE_CRYSTAL: // // Set mode to Crystal // (*((volatile uint32_t *)((uintptr_t)(0x0005D200U + 0x32U)))) &= ~0x2U; break; case SYSCTL_XTALMODE_SINGLE: // // Set mode to Single-Ended // (*((volatile uint32_t *)((uintptr_t)(0x0005D200U + 0x32U)))) |= 0x2U; break; default: // // Do nothing. Not a valid mode value. // break; } __edis(); } //***************************************************************************** // //! Gets the external oscillator counter value. //! //! This function returns the X1 clock counter value. When the return value //! reaches 0x3FF, it freezes. Before switching from INTOSC2 to an external //! oscillator (XTAL), an application should call this function to make sure //! the counter is saturated. //! //! \return Returns the value of the 10-bit X1 clock counter. // //***************************************************************************** static inline uint16_t SysCtl_getExternalOscCounterValue(void) { return((*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x30U)))) & 0x3FFU); } //***************************************************************************** // //! Clears the external oscillator counter value. //! //! \return None. // //***************************************************************************** static inline void SysCtl_clearExternalOscCounterValue(void) { (*((volatile uint32_t *)((uintptr_t)(0x0005D200U + 0x30U)))) |= 0x10000U; } //***************************************************************************** // //! Turns on the specified oscillator sources. //! //! \param oscSource is the oscillator source to be configured. //! //! This function turns on the oscillator specified by the \e oscSource //! parameter which may take a value of \b SYSCTL_OSCSRC_OSC2 or //! \b SYSCTL_OSCSRC_XTAL. //! //! \note \b SYSCTL_OSCSRC_OSC1 is not a valid value for \e oscSource. //! //! \return None. // //***************************************************************************** static inline void SysCtl_turnOnOsc(uint32_t oscSource) { do { if(!((oscSource == 0x00000000U) | (oscSource == 0x00010000U))) { __error__("C:\\ti\\c2000\\C2000Ware_2_01_00_00\\driverlib\\f2838x\\driverlib\\sysctl.h", 2232); } } while(0); __eallow(); switch(oscSource) { case 0x00000000U: // // Turn on INTOSC2 // (*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x8U)))) &= ~0x8U; break; case 0x00010000U: // // Turn on XTALOSC // (*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x8U)))) &= ~0x10U; (*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x32U)))) &= ~0x1U; break; default: // // Do nothing. Not a valid oscSource value. // break; } __edis(); } //***************************************************************************** // //! Turns off the specified oscillator sources. //! //! \param oscSource is the oscillator source to be configured. //! //! This function turns off the oscillator specified by the \e oscSource //! parameter which may take a value of \b SYSCTL_OSCSRC_OSC2 or //! \b SYSCTL_OSCSRC_XTAL. //! //! \note \b SYSCTL_OSCSRC_OSC1 is not a valid value for \e oscSource. //! //! \return None. // //***************************************************************************** static inline void SysCtl_turnOffOsc(uint32_t oscSource) { do { if(!((oscSource == 0x00000000U) | (oscSource == 0x00010000U))) { __error__("C:\\ti\\c2000\\C2000Ware_2_01_00_00\\driverlib\\f2838x\\driverlib\\sysctl.h", 2285); } } while(0); __eallow(); switch(oscSource) { case 0x00000000U: // // Turn off INTOSC2 // (*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x8U)))) |= 0x8U; break; case 0x00010000U: // // Turn off XTALOSC // (*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x8U)))) |= 0x10U; break; default: // // Do nothing. Not a valid oscSource value. // break; } __edis(); } //***************************************************************************** // //! Enters IDLE mode. //! //! This function puts the device into IDLE mode. The CPU clock is gated while //! all peripheral clocks are left running. Any enabled interrupt will wake the //! CPU up from IDLE mode. //! //! \return None. // //***************************************************************************** static inline void SysCtl_enterIdleMode(void) { __eallow(); // // Configure the device to go into IDLE mode when IDLE is executed. // (*((volatile uint32_t *)((uintptr_t)(0x0005D300U + 0x76U)))) = ((*((volatile uint32_t *)((uintptr_t)(0x0005D300U + 0x76U)))) & ~0x3U) | 0x0000U; __edis(); __asm(" IDLE"); } //***************************************************************************** // //! Enters STANDBY mode. //! //! This function puts the device into STANDBY mode. This will gate both the //! CPU clock and any peripheral clocks derived from SYSCLK. The watchdog is //! left active, and an NMI or an optional watchdog interrupt will wake the //! CPU subsystem from STANDBY mode. //! //! GPIOs may be configured to wake the CPU subsystem. See //! SysCtl_enableLPMWakeupPin(). //! //! The CPU will receive an interrupt (WAKEINT) on wakeup. //! //! \return None. // //***************************************************************************** static inline void SysCtl_enterStandbyMode(void) { __eallow(); // // Configure the device to go into STANDBY mode when IDLE is executed. // (*((volatile uint32_t *)((uintptr_t)(0x0005D300U + 0x76U)))) = ((*((volatile uint32_t *)((uintptr_t)(0x0005D300U + 0x76U)))) & ~0x3U) | 0x0001U; __edis(); __asm(" IDLE"); } //***************************************************************************** //! //! \param pin is the identifying number of the pin. //! //! This function connects a pin to the LPM circuit, allowing an event on the //! //! The pin is specified by its numerical value. For example, GPIO34 is //! specified by passing 34 as \e pin. Only GPIOs 0 through 63 are capable of //! being connected to the LPM circuit. //! //! \return None. // //***************************************************************************** static inline void SysCtl_enableLPMWakeupPin(uint32_t pin) { uint32_t pinMask; // // Check the arguments. // do { if(!(pin <= 63U)) { __error__("C:\\ti\\c2000\\C2000Ware_2_01_00_00\\driverlib\\f2838x\\driverlib\\sysctl.h", 2408); } } while(0); pinMask = (uint32_t)1U << (uint32_t)(pin % 32U); __eallow(); if(pin < 32U) { (*((volatile uint32_t *)((uintptr_t)(0x0005D300U + 0x78U)))) |= pinMask; } else { (*((volatile uint32_t *)((uintptr_t)(0x0005D300U + 0x7AU)))) |= pinMask; } __edis(); } //***************************************************************************** //! //! \param pin is the identifying number of the pin. //! //! This function disconnects a pin to the LPM circuit, disallowing an event on //! //! The pin is specified by its numerical value. For example, GPIO34 is //! specified by passing 34 as \e pin. Only GPIOs 0 through 63 are valid. //! //! \return None. // //***************************************************************************** static inline void SysCtl_disableLPMWakeupPin(uint32_t pin) { uint32_t pinMask; // // Check the arguments. // do { if(!(pin <= 63U)) { __error__("C:\\ti\\c2000\\C2000Ware_2_01_00_00\\driverlib\\f2838x\\driverlib\\sysctl.h", 2446); } } while(0); pinMask = (uint32_t)1U << (uint32_t)(pin % 32U); __eallow(); if(pin < 32U) { (*((volatile uint32_t *)((uintptr_t)(0x0005D300U + 0x78U)))) &= ~pinMask; } else { (*((volatile uint32_t *)((uintptr_t)(0x0005D300U + 0x7AU)))) &= ~pinMask; } __edis(); } //***************************************************************************** // //! Sets the number of cycles to qualify an input on waking from STANDBY mode. //! //! \param cycles is the number of OSCCLK cycles. //! //! This function sets the number of OSCCLK clock cycles used to qualify the //! selected inputs when waking from STANDBY mode. The \e cycles parameter //! should be passed a cycle count between 2 and 65 cycles inclusive. //! //! \return None. // //***************************************************************************** static inline void SysCtl_setStandbyQualificationPeriod(uint16_t cycles) { // // Check the arguments. // do { if(!((cycles >= 2U) && (cycles <= 65U))) { __error__("C:\\ti\\c2000\\C2000Ware_2_01_00_00\\driverlib\\f2838x\\driverlib\\sysctl.h", 2483); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(0x0005D300U + 0x76U)))) = ((*((volatile uint16_t *)((uintptr_t)(0x0005D300U + 0x76U)))) & ~(uint16_t)0xFCU) | ((cycles - (uint16_t)2U) << 2U); __edis(); } //***************************************************************************** // //! Enable the device to wake from STANDBY mode upon a watchdog interrupt. //! //! \note In order to use this option, you must configure the watchdog to //! generate an interrupt using SysCtl_setWatchdogMode(). //! //! \return None. // //***************************************************************************** static inline void SysCtl_enableWatchdogStandbyWakeup(void) { __eallow(); // // Set the bit enables the watchdog to wake up the device from STANDBY. // (*((volatile uint16_t *)((uintptr_t)(0x0005D300U + 0x76U)))) |= 0x8000U; __edis(); } //***************************************************************************** // //! Disable the device from waking from STANDBY mode upon a watchdog interrupt. //! //! \return None. // //***************************************************************************** static inline void SysCtl_disableWatchdogStandbyWakeup(void) { __eallow(); // // Clear the bit enables the watchdog to wake up the device from STANDBY. // (*((volatile uint16_t *)((uintptr_t)(0x0005D300U + 0x76U)))) &= ~0x8000U; __edis(); } //***************************************************************************** // //! Configures whether the watchdog generates a reset or an interrupt signal. //! //! \param mode is a flag to select the watchdog mode. //! //! This function configures the action taken when the watchdog counter reaches //! its maximum value. When the \e mode parameter is //! \b SYSCTL_WD_MODE_INTERRUPT, the watchdog is enabled to generate a watchdog //! interrupt signal and disables the generation of a reset signal. This will //! //! When the \e mode parameter is \b SYSCTL_WD_MODE_RESET, the watchdog will //! be put into reset mode and generation of a watchdog interrupt signal will //! be disabled. This is how the watchdog is configured by default. //! //! \note Check the status of the watchdog interrupt using //! SysCtl_isWatchdogInterruptActive() before calling this function. If the //! interrupt is still active, switching from interrupt mode to reset mode will //! immediately reset the device. //! //! \return None. // //***************************************************************************** static inline void SysCtl_setWatchdogMode(SysCtl_WDMode mode) { __eallow(); // // Either set or clear the WDENINT bit to that will determine whether the // watchdog will generate a reset signal or an interrupt signal. Take care // not to write a 1 to WDOVERRIDE. // if(mode == SYSCTL_WD_MODE_INTERRUPT) { (*((volatile uint16_t *)((uintptr_t)(0x00007000U + 0x22U)))) = ((*((volatile uint16_t *)((uintptr_t)(0x00007000U + 0x22U)))) & ~0x1U) | 0x2U; } else { (*((volatile uint16_t *)((uintptr_t)(0x00007000U + 0x22U)))) &= ~(0x2U | 0x1U); } __edis(); } //***************************************************************************** // //! Gets the status of the watchdog interrupt signal. //! //! This function returns the status of the watchdog interrupt signal. If the //! interrupt is active, this function will return \b true. If \b false, the //! interrupt is NOT active. //! //! \note Make sure to call this function to ensure that the interrupt is not //! active before making any changes to the configuration of the watchdog to //! prevent any unexpected behavior. For instance, switching from interrupt //! mode to reset mode while the interrupt is active will immediately reset the //! device. //! //! \return \b true if the interrupt is active and \b false if it is not. // //***************************************************************************** static inline _Bool SysCtl_isWatchdogInterruptActive(void) { // // If the status bit is cleared, the WDINTn signal is active. // return(((*((volatile uint16_t *)((uintptr_t)(0x00007000U + 0x22U)))) & 0x4U) == 0U); } //***************************************************************************** // //! Disables the watchdog. //! //! This function disables the watchdog timer. Note that the watchdog timer is //! enabled on reset. //! //! \return None. // //***************************************************************************** static inline void SysCtl_disableWatchdog(void) { __eallow(); // // Set the disable bit. // (*((volatile uint16_t *)((uintptr_t)(0x00007000U + 0x29U)))) |= 0x0028U | 0x40U; __edis(); } //***************************************************************************** // //! Enables the watchdog. //! //! This function enables the watchdog timer. Note that the watchdog timer is //! enabled on reset. //! //! \return None. // //***************************************************************************** static inline void SysCtl_enableWatchdog(void) { __eallow(); // // Clear the disable bit. // (*((volatile uint16_t *)((uintptr_t)(0x00007000U + 0x29U)))) = ((*((volatile uint16_t *)((uintptr_t)(0x00007000U + 0x29U)))) & ~0x40U) | 0x0028U; __edis(); } //***************************************************************************** // //! Services the watchdog. //! //! This function resets the watchdog. //! //! \return None. // //***************************************************************************** static inline void SysCtl_serviceWatchdog(void) { __eallow(); // // Enable the counter to be reset and then reset it. // (*((volatile uint16_t *)((uintptr_t)(0x00007000U + 0x25U)))) = 0x0055U; (*((volatile uint16_t *)((uintptr_t)(0x00007000U + 0x25U)))) = 0x00AAU; __edis(); } //***************************************************************************** // //! Sets up watchdog clock (WDCLK) pre-divider. //! //! \param predivider is the value that configures the pre-divider. //! //! This function sets up the watchdog clock (WDCLK) pre-divider. There are two //! dividers that scale INTOSC1 to WDCLK. The \e predivider parameter divides //! INTOSC1 down to PREDIVCLK and the prescaler (set by the //! SysCtl_setWatchdogPrescaler() function) divides PREDIVCLK down to WDCLK. //! //! \return None. // //***************************************************************************** static inline void SysCtl_setWatchdogPredivider(SysCtl_WDPredivider predivider) { uint16_t regVal; regVal = (uint16_t)predivider | (uint16_t)0x0028U; __eallow(); // // Write the predivider to the appropriate register. // (*((volatile uint16_t *)((uintptr_t)(0x00007000U + 0x29U)))) = ((*((volatile uint16_t *)((uintptr_t)(0x00007000U + 0x29U)))) & ~(0xF00U)) | regVal; __edis(); } //***************************************************************************** // //! Sets up watchdog clock (WDCLK) prescaler. //! //! \param prescaler is the value that configures the watchdog clock relative //! to the value from the pre-divider. //! //! This function sets up the watchdog clock (WDCLK) prescaler. There are two //! dividers that scale INTOSC1 to WDCLK. The predivider (set with the //! SysCtl_setWatchdogPredivider() function) divides INTOSC1 down to PREDIVCLK //! and the \e prescaler parameter divides PREDIVCLK down to WDCLK. //! //! \return None. // //***************************************************************************** static inline void SysCtl_setWatchdogPrescaler(SysCtl_WDPrescaler prescaler) { uint16_t regVal; regVal = (uint16_t)prescaler | (uint16_t)0x0028U; __eallow(); // // Write the prescaler to the appropriate register. // (*((volatile uint16_t *)((uintptr_t)(0x00007000U + 0x29U)))) = ((*((volatile uint16_t *)((uintptr_t)(0x00007000U + 0x29U)))) & ~(0x7U)) | regVal; __edis(); } //***************************************************************************** // //! Gets the watchdog counter value. //! //! \return Returns the current value of the 8-bit watchdog counter. If this //! count value overflows, a watchdog output pulse is generated. // //***************************************************************************** static inline uint16_t SysCtl_getWatchdogCounterValue(void) { // // Read and return the value of the watchdog counter. // return((*((volatile uint16_t *)((uintptr_t)(0x00007000U + 0x23U))))); } //***************************************************************************** // //! Gets the watchdog reset status. //! //! This function returns the watchdog reset status. If this function returns //! \b true, that indicates that a watchdog reset generated the last reset //! condition. Otherwise, it was an external device or power-up reset //! condition. //! //! \return Returns \b true if the watchdog generated the last reset condition. // //***************************************************************************** static inline _Bool SysCtl_getWatchdogResetStatus(void) { // // Read and return the status of the watchdog reset status flag. // return(((*((volatile uint16_t *)((uintptr_t)(0x0005D300U + 0x80U)))) & 0x4U) != 0U); } //***************************************************************************** // //! Clears the watchdog reset status. //! //! This function clears the watchdog reset status. To check if it was set //! first, see SysCtl_getWatchdogResetStatus(). //! //! \return None. // //***************************************************************************** static inline void SysCtl_clearWatchdogResetStatus(void) { __eallow(); // // Read and return the status of the watchdog reset status flag. // (*((volatile uint16_t *)((uintptr_t)(0x0005D300U + 0x7EU)))) = 0x4U; __edis(); } //***************************************************************************** // //! Set the minimum threshold value for windowed watchdog //! //! \param value is the value to set the window threshold //! //! This function sets the minimum threshold value used to define the lower //! limit of the windowed watchdog functionality. //! //! \return None. // //***************************************************************************** static inline void SysCtl_setWatchdogWindowValue(uint16_t value) { __eallow(); // // Clear the windowed value // (*((volatile uint16_t *)((uintptr_t)(0x00007000U + 0x2AU)))) &= ~0xFFU; // // Set the windowed value // (*((volatile uint16_t *)((uintptr_t)(0x00007000U + 0x2AU)))) |= (value & 0xFFU); __edis(); } //***************************************************************************** // //! Clears the watchdog override. //! //! This function clears the watchdog override and locks the watchdog timer //! module to remain in its prior state which could be either enable /disable. //! The watchdog timer will remain in this state until the next system reset. //! //! \return None. // //***************************************************************************** static inline void SysCtl_clearWatchdogOverride(void) { __eallow(); (*((volatile uint16_t *)((uintptr_t)(0x00007000U + 0x22U)))) |= 0x1U; __edis(); } //***************************************************************************** // //! Enable the NMI Global interrupt bit //! //! \b Note: This bit should be set after the device security related //! initialization is complete. //! //! \return None. // //***************************************************************************** static inline void SysCtl_enableNMIGlobalInterrupt(void) { __eallow(); (*((volatile uint16_t *)((uintptr_t)(0x00007060U + 0x0U)))) |= 0x1U; __edis(); } //***************************************************************************** // //! Read NMI interrupts. //! //! Read the current state of NMI interrupt. //! //! \return \b true if NMI interrupt is triggered, \b false if not. // //***************************************************************************** static inline _Bool SysCtl_getNMIStatus(void) { // // Read and return the current value of the NMI flag register, masking out // all but the NMI bit. // return(((*((volatile uint16_t *)((uintptr_t)(0x00007060U + 0x1U)))) & 0x1U) != 0U); } //***************************************************************************** // //! Read NMI Flags. //! //! Read the current state of individual NMI interrupts //! //! \return Value of NMIFLG register. These defines are provided to decode //! the value: //! - \b SYSCTL_NMI_NMIINT - Non-maskable interrupt //! - \b SYSCTL_NMI_CLOCKFAIL - Clock Failure //! - \b SYSCTL_NMI_RAMUNCERR - Uncorrectable RAM error //! - \b SYSCTL_NMI_FLUNCERR - Uncorrectable Flash error //! - \b SYSCTL_NMI_PIEVECTERR - PIE Vector Fetch Error //! - \b SYSCTL_NMI_CLBNMI - Configurable Logic Block NMI Flag //! - \b SYSCTL_NMI_CPU2WDRSN - CPU2 WDRSn Reset //! - \b SYSCTL_NMI_CPU2NMIWDRSN - CPU2 NMIWDRSn Reset //! - \b SYSCTL_NMI_CPU1HWBISTERR - HW BIST Error NMI Flag //! - \b SYSCTL_NMI_CPU2HWBISTERR - HW BIST Error NMI Flag //! - \b SYSCTL_NMI_ERADNMI - ERAD Module NMI Flag //! - \b SYSCTL_NMI_CMNMIWDRSN - CM NMIWDRSn Reset Indication //! - \b SYSCTL_NMI_ECATNMI - NMI from EtherCAT reset out //! - \b SYSCTL_NMI_CRC_FAIL - CRC calculation failed flag // //***************************************************************************** static inline uint16_t SysCtl_getNMIFlagStatus(void) { // // Read and return the current value of the NMI flag register. // return((*((volatile uint16_t *)((uintptr_t)(0x00007060U + 0x1U))))); } //***************************************************************************** // //! Check if the individual NMI interrupts are set. //! //! \param nmiFlags Bit mask of the NMI interrupts that user wants to clear. //! The bit format of this parameter is same as of the NMIFLG register. These //! defines are provided: //! - \b SYSCTL_NMI_NMIINT - Non-maskable interrupt //! - \b SYSCTL_NMI_CLOCKFAIL - Clock Failure //! - \b SYSCTL_NMI_RAMUNCERR - Uncorrectable RAM error //! - \b SYSCTL_NMI_FLUNCERR - Uncorrectable Flash error //! - \b SYSCTL_NMI_PIEVECTERR - PIE vector Fetch error //! - \b SYSCTL_NMI_CLBNMI - Configurable Logic Block NMI Flag //! - \b SYSCTL_NMI_CPU2WDRSN - CPU2 WDRSn Reset //! - \b SYSCTL_NMI_CPU2NMIWDRSN - CPU2 NMIWDRSn Reset //! - \b SYSCTL_NMI_CPU1HWBISTERR - HW BIST Error NMI Flag //! - \b SYSCTL_NMI_CPU2HWBISTERR - HW BIST Error NMI Flag //! - \b SYSCTL_NMI_ERADNMI - ERAD Module NMI Flag //! - \b SYSCTL_NMI_CMNMIWDRSN - CM NMIWDRSn Reset Indication //! - \b SYSCTL_NMI_ECATNMI - NMI from EtherCAT reset out //! - \b SYSCTL_NMI_CRC_FAIL - CRC calculation failed flag //! //! Check if interrupt flags corresponding to the passed in bit mask are //! asserted. //! //! \return \b true if any of the NMI asked for in the parameter bit mask //! is set. \b false if none of the NMI requested in the parameter bit mask are //! set. // //***************************************************************************** static inline _Bool SysCtl_isNMIFlagSet(uint32_t nmiFlags) { // // Check the arguments. // Make sure if reserved bits are not set in nmiFlags. // do { if(!((nmiFlags & ~(0x0001U | 0x0002U | 0x0004U | 0x0008U | 0x0010U | 0x0020U | 0x2000U | 0x4000U | 0x0080U | 0x0040U | 0x1000U | 0x0200U | 0x0100U | 0x0400U)) == 0)) { __error__("C:\\ti\\c2000\\C2000Ware_2_01_00_00\\driverlib\\f2838x\\driverlib\\sysctl.h", 2977); } } while(0); // // Read the flag register and return true if any of them are set. // return(((*((volatile uint16_t *)((uintptr_t)(0x00007060U + 0x1U)))) & nmiFlags) != 0U); } //***************************************************************************** // //! Function to clear individual NMI interrupts. //! //! \param nmiFlags Bit mask of the NMI interrupts that user wants to clear. //! The bit format of this parameter is same as of the NMIFLG register. These //! defines are provided: //! - \b SYSCTL_NMI_CLOCKFAIL //! - \b SYSCTL_NMI_RAMUNCERR //! - \b SYSCTL_NMI_FLUNCERR //! - \b SYSCTL_NMI_PIEVECTERR //! - \b SYSCTL_NMI_CLBNMI //! - \b SYSCTL_NMI_CPU2WDRSN //! - \b SYSCTL_NMI_CPU2NMIWDRSN //! - \b SYSCTL_NMI_CPU1HWBISTERR //! - \b SYSCTL_NMI_CPU2HWBISTERR //! - \b SYSCTL_NMI_ERADNMI //! - \b SYSCTL_NMI_CMNMIWDRSN //! - \b SYSCTL_NMI_ECATNMI //! - \b SYSCTL_NMI_CRC_FAIL //! //! Clear NMI interrupt flags that correspond with the passed in bit mask. //! //! \b Note: The NMI Interrupt flag is always cleared by default and //! therefore doesn't have to be included in the bit mask. //! //! \return None. // //***************************************************************************** static inline void SysCtl_clearNMIStatus(uint32_t nmiFlags) { // // Check the arguments. // Make sure if reserved bits are not set in nmiFlags. // do { if(!((nmiFlags & ~(0x0001U | 0x0002U | 0x0004U | 0x0008U | 0x0010U | 0x0020U | 0x2000U | 0x4000U | 0x0080U | 0x0040U | 0x1000U | 0x0200U | 0x0100U | 0x0400U)) == 0)) { __error__("C:\\ti\\c2000\\C2000Ware_2_01_00_00\\driverlib\\f2838x\\driverlib\\sysctl.h", 3028); } } while(0); __eallow(); // // Clear the individual flags as well as NMI Interrupt flag // (*((volatile uint16_t *)((uintptr_t)(0x00007060U + 0x2U)))) = nmiFlags; (*((volatile uint16_t *)((uintptr_t)(0x00007060U + 0x2U)))) = 0x1U; __edis(); } //***************************************************************************** // //! Clear all the NMI Flags that are currently set. //! //! \return None. // //***************************************************************************** static inline void SysCtl_clearAllNMIFlags(void) { uint16_t nmiFlags; // // Read the flag status register and then write to the clear register, // clearing all the flags that were returned plus the NMI flag. // __eallow(); nmiFlags = SysCtl_getNMIFlagStatus(); (*((volatile uint16_t *)((uintptr_t)(0x00007060U + 0x2U)))) = nmiFlags; (*((volatile uint16_t *)((uintptr_t)(0x00007060U + 0x2U)))) = 0x1U; __edis(); } //***************************************************************************** // //! Function to force individual NMI interrupt fail flags //! //! \param nmiFlags Bit mask of the NMI interrupts that user wants to clear. //! The bit format of this parameter is same as of the NMIFLG register. These //! defines are provided: //! - \b SYSCTL_NMI_CLOCKFAIL //! - \b SYSCTL_NMI_RAMUNCERR //! - \b SYSCTL_NMI_FLUNCERR //! - \b SYSCTL_NMI_PIEVECTERR //! - \b SYSCTL_NMI_CLBNMI //! - \b SYSCTL_NMI_CPU2WDRSN //! - \b SYSCTL_NMI_CPU2NMIWDRSN //! - \b SYSCTL_NMI_CPU1HWBISTERR //! - \b SYSCTL_NMI_CPU2HWBISTERR //! - \b SYSCTL_NMI_ERADNMI //! - \b SYSCTL_NMI_CMNMIWDRSN //! - \b SYSCTL_NMI_ECATNMI //! - \b SYSCTL_NMI_CRC_FAIL //! //! \return None. // //***************************************************************************** static inline void SysCtl_forceNMIFlags(uint32_t nmiFlags) { // // Check the arguments. // Make sure if reserved bits are not set in nmiFlags. // do { if(!((nmiFlags & ~(0x0001U | 0x0002U | 0x0004U | 0x0008U | 0x0010U | 0x0020U | 0x2000U | 0x4000U | 0x0080U | 0x0040U | 0x1000U | 0x0200U | 0x0100U | 0x0400U)) == 0)) { __error__("C:\\ti\\c2000\\C2000Ware_2_01_00_00\\driverlib\\f2838x\\driverlib\\sysctl.h", 3104); } } while(0); __eallow(); // // Set the Flags for the individual interrupts in the NMI flag // force register // (*((volatile uint16_t *)((uintptr_t)(0x00007060U + 0x3U)))) |= nmiFlags; __edis(); } //***************************************************************************** // //! Gets the NMI watchdog counter value. //! //! \b Note: The counter is clocked at the SYSCLKOUT rate. //! //! \return Returns the NMI watchdog counter register's current value. // //***************************************************************************** static inline uint16_t SysCtl_getNMIWatchdogCounter(void) { // // Read and return the NMI watchdog counter register's value. // return((*((volatile uint16_t *)((uintptr_t)(0x00007060U + 0x4U))))); } //***************************************************************************** // //! Sets the NMI watchdog period value. //! //! \param wdPeriod is the 16-bit value at which a reset is generated. //! //! This function writes to the NMI watchdog period register that holds the //! value to which the NMI watchdog counter is compared. When the two registers //! match, a reset is generated. By default, the period is 0xFFFF. //! //! \note If a value smaller than the current counter value is passed into the //! \e wdPeriod parameter, a NMIRSn will be forced. //! //! \return None. // //***************************************************************************** static inline void SysCtl_setNMIWatchdogPeriod(uint16_t wdPeriod) { __eallow(); // // Write to the period register. // (*((volatile uint16_t *)((uintptr_t)(0x00007060U + 0x5U)))) = wdPeriod; __edis(); } //***************************************************************************** // //! Gets the NMI watchdog period value. //! //! \return Returns the NMI watchdog period register's current value. // //***************************************************************************** static inline uint16_t SysCtl_getNMIWatchdogPeriod(void) { // // Read and return the NMI watchdog period register's value. // return((*((volatile uint16_t *)((uintptr_t)(0x00007060U + 0x5U))))); } //***************************************************************************** // //! Read NMI Shadow Flags. //! //! Read the current state of individual NMI interrupts //! //! \return Value of NMISHDFLG register. These defines are provided to decode //! the value: //! - \b SYSCTL_NMI_NMIINT - Non-maskable interrupt //! - \b SYSCTL_NMI_CLOCKFAIL - Clock Failure //! - \b SYSCTL_NMI_RAMUNCERR - Uncorrectable RAM error //! - \b SYSCTL_NMI_FLUNCERR - Uncorrectable Flash error //! - \b SYSCTL_NMI_PIEVECTERR - PIE Vector Fetch Error //! - \b SYSCTL_NMI_CLBNMI - Configurable Logic Block NMI Flag //! - \b SYSCTL_NMI_CPU2WDRSN - CPU2 WDRSn Reset //! - \b SYSCTL_NMI_CPU2NMIWDRSN - CPU2 NMIWDRSn Reset //! - \b SYSCTL_NMI_CPU1HWBISTERR - HW BIST Error NMI Flag //! - \b SYSCTL_NMI_CPU2HWBISTERR - HW BIST Error NMI Flag //! - \b SYSCTL_NMI_ERADNMI - ERAD Module NMI Flag //! - \b SYSCTL_NMI_CMNMIWDRSN - CM NMIWDRSn Reset Indication //! - \b SYSCTL_NMI_ECATNMI - NMI from EtherCAT reset out //! - \b SYSCTL_NMI_CRC_FAIL - CRC calculation failed flag // //***************************************************************************** static inline uint32_t SysCtl_getNMIShadowFlagStatus(void) { // // Read and return the current value of the NMI shadow flag register. // return((*((volatile uint16_t *)((uintptr_t)(0x00007060U + 0x6U))))); } //***************************************************************************** // //! Check if the individual NMI shadow flags are set. //! //! \param nmiFlags Bit mask of the NMI interrupts that user wants to clear. //! The bit format of this parameter is same as of the NMIFLG register. These //! defines are provided: //! - \b SYSCTL_NMI_NMIINT //! - \b SYSCTL_NMI_CLOCKFAIL //! - \b SYSCTL_NMI_RAMUNCERR //! - \b SYSCTL_NMI_FLUNCERR //! - \b SYSCTL_NMI_PIEVECTERR //! - \b SYSCTL_NMI_CLBNMI //! - \b SYSCTL_NMI_CPU2WDRSN //! - \b SYSCTL_NMI_CPU2NMIWDRSN //! - \b SYSCTL_NMI_CPU1HWBISTERR //! - \b SYSCTL_NMI_CPU2HWBISTERR //! - \b SYSCTL_NMI_ERADNMI //! - \b SYSCTL_NMI_CMNMIWDRSN //! - \b SYSCTL_NMI_ECATNMI //! - \b SYSCTL_NMI_CRC_FAIL //! //! Check if interrupt flags corresponding to the passed in bit mask are //! asserted. //! //! \return \b true if any of the NMI asked for in the parameter bit mask //! is set. \b false if none of the NMI requested in the parameter bit mask are //! set. // //***************************************************************************** static inline _Bool SysCtl_isNMIShadowFlagSet(uint32_t nmiFlags) { // // Check the arguments. // Make sure if reserved bits are not set in nmiFlags. // do { if(!((nmiFlags & ~(0x0001U | 0x0002U | 0x0004U | 0x0008U | 0x0010U | 0x0020U | 0x2000U | 0x4000U | 0x0080U | 0x0040U | 0x1000U | 0x0200U | 0x0100U | 0x0400U)) == 0)) { __error__("C:\\ti\\c2000\\C2000Ware_2_01_00_00\\driverlib\\f2838x\\driverlib\\sysctl.h", 3257); } } while(0); // // Read the flag register and return true if any of them are set. // return(((*((volatile uint16_t *)((uintptr_t)(0x00007060U + 0x6U)))) & nmiFlags) != 0U); } //***************************************************************************** // //! Enable the missing clock detection (MCD) Logic //! //! \return None. // //***************************************************************************** static inline void SysCtl_enableMCD(void) { __eallow(); (*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x2EU)))) &= ~(0x4U); __edis(); } //***************************************************************************** // //! Disable the missing clock detection (MCD) Logic //! //! \return None. // //***************************************************************************** static inline void SysCtl_disableMCD(void) { __eallow(); (*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x2EU)))) |= 0x4U; __edis(); } //***************************************************************************** // //! Get the missing clock detection Failure Status //! //! \note A failure means the oscillator clock is missing //! //! \return Returns \b true if a failure is detected or \b false if a //! failure isn't detected // //***************************************************************************** static inline _Bool SysCtl_isMCDClockFailureDetected(void) { // // Check the status bit to determine failure // return(((*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x2EU)))) & 0x1U) != 0U); } //***************************************************************************** // //! Reset the missing clock detection logic after clock failure //! //! \return None. // //***************************************************************************** static inline void SysCtl_resetMCD(void) { __eallow(); (*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x2EU)))) |= 0x2U; __edis(); } //***************************************************************************** // //! Re-connect missing clock detection clock source to stop simulating clock //! failure //! //! \return None. // //***************************************************************************** static inline void SysCtl_connectMCDClockSource(void) { __eallow(); (*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x2EU)))) &= ~(0x8U); __edis(); } //***************************************************************************** // //! Disconnect missing clock detection clock source to simulate clock failure. //! This is for testing the MCD functionality. //! //! \return None. // //***************************************************************************** static inline void SysCtl_disconnectMCDClockSource(void) { __eallow(); (*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x2EU)))) |= 0x8U; __edis(); } //***************************************************************************** // //! Lock the Access Control Registers //! //! This function locks the access control registers and puts them in a //! read-only state. //! //! \note Only a reset can unlock the access control registers. //! //! \return None. // //***************************************************************************** static inline void SysCtl_lockAccessControlRegs(void) { __eallow(); (*((volatile uint16_t *)((uintptr_t)(0x0005D500U + 0x1FEU)))) |= 0x1U; __edis(); } //***************************************************************************** // //! Set the peripheral access control permissions //! //! \param peripheral is the selected peripheral //! \param master is the selected master (CPU1, CLA1, or DMA1) //! \param permission is the selected access permissions //! //! This function sets the specified peripheral access control permissions for //! the the specified master (CPU1, CLA1, or DMA1) //! //! The \e peripheral parameter can have one enumerated value in the format of //! \b SYSCTL_ACCESS_X where X is the name of the peripheral instance to be //! configured such as \b SYSCTL_ACCESS_ADCA. //! //! The \e master parameter can have one the following enumerated values: //! - \b SYSCTL_ACCESS_CPU1 - CPU1 Master //! - \b SYSCTL_ACCESS_CLA1 - CLA1 Master //! - \b SYSCTL_ACCESS_DMA1 - DMA1 Master //! //! The \e permission parameter can have one the following enumerated values: //! - \b SYSCTL_ACCESS_FULL - Full Access for both read and write //! - \b SYSCTL_ACCESS_PROTECTED - Protected read access such that FIFOs, clear //! on read registers are not changed, and no //! write access //! - \b SYSCTL_ACCESS_NONE - No read or write access //! //! \return None. // //***************************************************************************** static inline void SysCtl_setPeripheralAccessControl(SysCtl_AccessPeripheral peripheral, SysCtl_AccessMaster master, SysCtl_AccessPermission permission) { // // Set master permissions for specified peripheral. Each master has // two bits dedicated to its permission setting. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(0x0005D500U + (uint16_t)peripheral)))) = ((*((volatile uint16_t *)((uintptr_t)(0x0005D500U + (uint16_t)peripheral)))) & ~(0x3U << (uint16_t)master)) | ((uint32_t)permission << (uint16_t)master); __edis(); } //***************************************************************************** // //! Get the peripheral access control permissions //! //! \param peripheral is the selected peripheral //! \param master is the selected master (CPU1, CLA1, or DMA1) //! //! This function gets the specified peripheral access control permissions for //! the the specified master (CPU1, CLA1, or DMA1) //! //! The \e peripheral parameter can have one enumerated value in the format of //! \b SYSCTL_ACCESS_X where X is the name of the peripheral instance to be //! configured such as \b SYSCTL_ACCESS_ADCA. //! //! The \e master parameter can have one the following enumerated values: //! - \b SYSCTL_ACCESS_CPU1 - CPU1 Master //! - \b SYSCTL_ACCESS_CLA1 - CLA1 Master //! - \b SYSCTL_ACCESS_DMA1 - DMA1 Master //! //! \return Returns one of the following enumerated permission values: //! - \b SYSCTL_ACCESS_FULL - Full Access for both read and write //! - \b SYSCTL_ACCESS_PROTECTED - Protected read access such that FIFOs, clear //! on read registers are not changed, and no //! write access //! - \b SYSCTL_ACCESS_NONE - No read or write access // //***************************************************************************** static inline uint32_t SysCtl_getPeripheralAccessControl(SysCtl_AccessPeripheral peripheral, SysCtl_AccessMaster master) { // // Read master permissions for specified peripheral. Each master has // two bits dedicated to its permission setting. // return(((*((volatile uint16_t *)((uintptr_t)(0x0005D500U + (uint16_t)peripheral)))) >> (uint16_t)master) & 0x3U); } //***************************************************************************** // //! Configures the sync output source. //! //! \param syncSrc is sync output source selection. //! //! This function configures the sync output source from the ePWM modules. The //! \e syncSrc parameter is a value \b SYSCTL_SYNC_OUT_SRC_XXXX, where XXXX is //! a sync signal coming from an ePWM such as SYSCTL_SYNC_OUT_SRC_EPWM1SYNCOUT //! //! \return None. // //***************************************************************************** static inline void SysCtl_setSyncOutputConfig(SysCtl_SyncOutputSource syncSrc) { // // Write the sync output source selection to the appropriate register. // __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x00007940U + 0x0U)))) = ((*((volatile uint32_t *)((uintptr_t)(0x00007940U + 0x0U)))) & ~((uint32_t)0x1F000000U)) | ((uint32_t)syncSrc << 24U); __edis(); } //***************************************************************************** // //! Enables ePWM SOC signals to drive an external (off-chip) ADCSOC signal. //! //! \param adcsocSrc is a bit field of the selected signals to be enabled //! //! This function configures which ePWM SOC signals are enabled as a source for //! either ADCSOCAO or ADCSOCBO. The \e adcsocSrc parameter takes a logical OR //! of \b SYSCTL_ADCSOC_SRC_PWMxSOCA/B values that correspond to different //! signals. //! //! \return None. // //***************************************************************************** static inline void SysCtl_enableExtADCSOCSource(uint32_t adcsocSrc) { // // Set the bits that correspond to signal to be enabled. // __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x00007940U + 0x2U)))) |= adcsocSrc; __edis(); } //***************************************************************************** // //! Disables ePWM SOC signals from driving an external ADCSOC signal. //! //! \param adcsocSrc is a bit field of the selected signals to be disabled //! //! This function configures which ePWM SOC signals are disabled as a source //! for either ADCSOCAO or ADCSOCBO. The \e adcsocSrc parameter takes a logical //! OR of \b SYSCTL_ADCSOC_SRC_PWMxSOCA/B values that correspond to different //! signals. //! //! \return None. // //***************************************************************************** static inline void SysCtl_disableExtADCSOCSource(uint32_t adcsocSrc) { // // Clear the bits that correspond to signal to be disabled. // __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x00007940U + 0x2U)))) &= ~adcsocSrc; __edis(); } //***************************************************************************** // //! Locks the SOC Select of the Trig X-BAR. //! //! This function locks the external ADC SOC select of the Trig X-BAR. //! //! \return None. // //***************************************************************************** static inline void SysCtl_lockExtADCSOCSelect(void) { // // Lock the ADCSOCOUTSELECT bit of the SYNCSOCLOCK register. // __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x00007940U + 0x4U)))) = 0x2U; __edis(); } //***************************************************************************** // //! Locks the Sync Select of the Trig X-BAR. //! //! This function locks Sync Input and Output Select of the Trig X-BAR. //! //! \return None. // //***************************************************************************** static inline void SysCtl_lockSyncSelect(void) { // // Lock the SYNCSELECT register. // __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x00007940U + 0x4U)))) = 0x1U; __edis(); } //***************************************************************************** // //! Configures whether a peripheral is connected to CPU1 or CPU2. //! //! \param peripheral is the peripheral for which CPU needs to be configured. //! \param peripheralInst is the instance for which CPU needs to be configured. //! \param cpuInst is the CPU to which the peripheral instance need to be //! connected. //! //! The \e peripheral parameter can have one enumerated value from //! SysCtl_CPUSelPeripheral //! //! The \e peripheralInst parameter is the instance number for example //! 1 for EPWM1, 2 for EPWM2 so on.For instances which are named with alphabets //! (instead of numbers) the following convention needs to be followed. //! 1 for A (SPI_A), 2 for B (SPI_B), 3 for C (SPI_C) so on... //! For peripherals with different RX and TX instances which are named //! with alphabets, the following convention needs to be followed. //! 1 for TX_A (FSITX_A), 2 for TX_B (FSITX_B) and so on... //! 17 for RX_A (FSIRX_A), 18 for RX_B (FSIRX_B) and so on... //! //! The \e cpuInst parameter can have one the following values: //! - \b SYSCTL_CPUSEL_CPU1 - to connect to CPU1 //! - \b SYSCTL_CPUSEL_CPU2 - to connect to CPU2 //! //! \note This API is applicable only for the CPU1 subsystem. //! //! \return None. // //***************************************************************************** static inline void SysCtl_selectCPUForPeripheral(SysCtl_CPUSelPeripheral peripheral, uint16_t peripheralInst, SysCtl_CPUSel cpuInst) { uint32_t tempValue; uint16_t shift; if(SYSCTL_CPUSEL14_DAC == peripheral) { shift = peripheralInst + 0x10U - 1U; } else { shift = peripheralInst - 1U; } tempValue = (*((volatile uint32_t *)((uintptr_t)(0x0005D000U + 0xD6U + ((uint32_t)peripheral * 2U))))) & (~((uint32_t)1U << shift)); __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x0005D000U + 0xD6U + ((uint32_t)peripheral * 2U))))) = tempValue | ((uint32_t)cpuInst << shift); __edis(); } //***************************************************************************** // //! Get the Device Silicon Revision ID //! //! This function returns the silicon revision ID for the device. //! //! \note This API is applicable only for the CPU1 subsystem. //! //! \return Returns the silicon revision ID value. // //***************************************************************************** static inline uint32_t SysCtl_getDeviceRevision(void) { // // Returns the device silicon revision ID // return((*((volatile uint32_t *)((uintptr_t)(0x0005D000U + 0xCU))))); } //***************************************************************************** // //! Locks the CPU select registers for the peripherals //! //! \param peripheral is the peripheral for which CPU needs to be selected. //! //! The \e peripheral parameter can have one enumerated value from //! SysCtl_CPUSelPeripheral //! //! \note This API is applicable only for the CPU1 subsystem. //! //! \return None. // //***************************************************************************** static inline void SysCtl_lockCPUSelectRegs(SysCtl_CPUSelPeripheral peripheral) { __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x0005D000U + 0x0U)))) |= ((uint32_t)1U << peripheral); __edis(); } //***************************************************************************** // //! Reads the ADC wrapper mode for the provided ADC //! //! \param peripheral is the ADC for which the configuration is to be read. //! //! The \e peripheral parameter can have one enumerated value from //! SysCtl_SelADC //! //! \note This API is applicable only for the CPU1 subsystem. //! //! \return Returns the supported resolution of the particular ADC. //! This can be either of the 2 resolutions below: //! 1. Operate in 16-bit or 12-bit configurable (0x0U) //! 2. Operate only in 12-bit configurable (0x1U) // //***************************************************************************** static inline uint32_t SysCtl_readADCWrapper(SysCtl_SelADC peripheral) { // // Reads the ADC wrapper mode // return(((*((volatile uint32_t *)((uintptr_t)(0x0005D000U + 0x60U)))) & (0x1U << (uint32_t)peripheral)) >> (uint32_t)peripheral); } //***************************************************************************** // //! Gets the error status of the Efuse //! //! The function provides both the Efuse Autoload & the Efuse Self Test //! Error Status. //! //! \note This API is applicable only for the CPU1 subsystem. //! //! \return Fuse Error status. // //***************************************************************************** static inline uint16_t SysCtl_getEfuseError(void) { return((*((volatile uint16_t *)((uintptr_t)(0x0005D000U + 0x74U))))); } //***************************************************************************** // //! Check if the CPU2 is held in reset or not //! //! Provides the reset status of CPU2 to CPU1 //! //! \note This API is applicable only for the CPU1 subsystem. //! //! \return \b true if CPU2 core is in reset \b false if CPU2 core //! is out of reset // //***************************************************************************** static inline _Bool SysCtl_isCPU2Reset(void) { return(((*((volatile uint16_t *)((uintptr_t)(0x0005D000U + 0x124U)))) & 0x1U) == 0U); } //***************************************************************************** // //! Gets the status/causes of the CPU2 reset. //! //! The function provides causes of the CPU2 being in reset / not. //! This could be either of the following values or a combination of both: //! //! - SYSCTL_RSTSTAT_CPU2RES //! - SYSCTL_RSTSTAT_CPU2NMIWDRST //! - SYSCTL_RSTSTAT_CPU2HWBISTRST //! //! \note This API is applicable only for the CPU1 subsystem. //! //! \return Reset cause of CPU2. // //***************************************************************************** static inline uint16_t SysCtl_getCPU2ResetStatus(void) { return((*((volatile uint16_t *)((uintptr_t)(0x0005D000U + 0x124U))))); } //***************************************************************************** // //! Clears the CPU2 reset status. //! //! \param rstCauses are the reset causes to be cleared //! //! This function clears the CPU2 reset status. This could be either of the //! following values or a combination of both: //! //! - SYSCTL_RSTSTAT_CPU2NMIWDRST //! - SYSCTL_RSTSTAT_CPU2HWBISTRST. //! //! To check if it was set first, see SysCtl_getCPU2ResetStatus(). //! //! \note This API is applicable only for the CPU1 subsystem. //! //! \return None. // //***************************************************************************** static inline void SysCtl_clearCPU2ResetStatus(uint16_t rstCauses ) { (*((volatile uint16_t *)((uintptr_t)(0x0005D000U + 0x124U)))) |= rstCauses; } //***************************************************************************** // //! Gets the state of the CPU2. //! //! The function indicates the power mode of the CPU2. It could be either in //! ACTIVE , IDLE or STANDBY mode. //! //! \note This API is applicable only for the CPU1 subsystem. //! //! \return Power mode of CPU2. // //***************************************************************************** static inline uint16_t SysCtl_getCPU2LPMStatus(void) { return((*((volatile uint16_t *)((uintptr_t)(0x0005D000U + 0x125U))))); } //***************************************************************************** // //! Selects the BANK to be programmed by CPU1. //! //! \param bank is the BANK to be programmed. //! //! The \e bank parameter can have one enumerated value from //! SysCtl_CPUBank //! //! \note This API is applicable only for the CPU1 subsystem. //! //! \return None. // //***************************************************************************** static inline void SysCtl_selectBank(SysCtl_CPUBank bank) { __eallow(); (*((volatile uint16_t *)((uintptr_t)(0x0005D000U + 0x184U)))) = (uint16_t)bank; __edis(); } //***************************************************************************** // //! Gets the Ownership details for clock configuration //! //! A CPU can perform read/writes to any of the CLKCFG registers only //! if it owns the semaphore. Otherwise, writes are ignored and reads //! will return 0x0. //! //! \note Reads and writes of this ownership register are always //! allowed from both CPU1 and CPU2. //! //! \return Clock control Ownership details // //***************************************************************************** static inline uint16_t SysCtl_getSemOwner(void) { return((*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x0U))))); } //***************************************************************************** // //! Sets up XCLK divider. //! //! \param divider is the value that configures the divider. //! //! This function sets up the XCLK divider. There is only one //! divider that scales INTOSC1 to XCLK. //! //! The \e divider parameter can have one enumerated value from //! SysCtl_XClkDivider //! //! \return None. // //***************************************************************************** static inline void SysCtl_setXClk(SysCtl_XClkDivider divider) { // // Clears the divider then configures it. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x28U)))) = ((*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x28U)))) & ~(0x3U)) | (uint16_t)divider; __edis(); } //***************************************************************************** // //! Sets up CM CLK source & divider. //! //! \param divider is the value that configures the divider. //! \param source is the source for the clock divider //! //! This function sets up the CM CLK divider based on the source that //! is selected. There is only one divider that scales the "source" to CM CLK. //! //! The \e divider parameter can have one enumerated value from //! SysCtl_CMClkDivider //! The \e source parameter can have one enumerated value from //! SysCtl_PLLClockSource //! //! \return None. // //***************************************************************************** static inline void SysCtl_setCMClk(SysCtl_CMClkDivider divider, SysCtl_PLLClockSource source) { // // Clears the divider & the source, then configures it. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x38U)))) = ((*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x38U)))) & ~(0xEU | 0x1U)); (*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x38U)))) |= ((uint16_t)divider << 1U) | ((uint16_t)source << 0x0U); __edis(); } //***************************************************************************** // //! Sets up Ethernet CLK source & divider. //! //! \param divider is the value that configures the divider. //! \param source is the source for the clock divider //! //! This function sets up the Ethernet CLK divider based on the source that //! is selected. There is only one divider that scales the "source" to //! Ethernet CLK. //! //! The \e divider parameter can have one enumerated value from //! SysCtl_EnetClkDivider //! The \e source parameter can have one enumerated value from //! SysCtl_PLLClockSource //! //! \return None. // //***************************************************************************** static inline void SysCtl_setEnetClk(SysCtl_EnetClkDivider divider, SysCtl_PLLClockSource source) { // // Clears the divider & the source, then configures it. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x38U)))) = ((*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x38U)))) & ~(0xE0U | 0x10U)); (*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x38U)))) |= ((uint16_t)divider << 5U) | ((uint16_t)source << 0X4U); __edis(); } //***************************************************************************** // //! Sets up Ethercat CLK source, divider & PHY clock. //! //! \param divider is the value that configures the divider. //! \param source is the source for the clock divider //! \param enable enables/disables the etherCAT PHY clock //! //! This function sets up the Ethercat CLK divider based on the source that //! is selected. There is only one divider that scales the "source" to //! Ethercat CLK. //! This also enables/disables the etherCAT PHY clock. //! //! The \e divider parameter can have one enumerated value from //! SysCtl_ECatClkDivider //! The \e source parameter can have one enumerated value from //! SysCtl_PLLClockSource //! The \e enable parameter can be either of these values: //! 0x0U: etherCAT PHY clock is disabled //! 0x1U: etherCAT PHY clock is enabled //! //! \return None. // //***************************************************************************** static inline void SysCtl_setECatClk(SysCtl_ECatClkDivider divider, SysCtl_PLLClockSource source, uint16_t enable) { // // Clears the divider & the source, then configures it. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x36U)))) = ((*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x36U)))) & ~(0x100U | 0xEU | 0x1U)); (*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x36U)))) |= ((uint16_t)divider << 1U) | ((uint16_t)source << 0x0U) | (enable << 0x8U); __edis(); } //***************************************************************************** // //! Sets up PLLSYSCLK divider. //! //! \param divider is the value that configures the divider. //! //! This function sets up the PLLSYSCLK divider. There is only one //! divider that scales PLLSYSCLK to generate the system clock. //! //! The \e divider parameter can have one value from the set below: //! 0x0 = /1 //! 0x1 = /2 //! 0x2 = /4 (default on reset) //! 0x3 = /6 //! 0x4 = /8 //! ...... //! 0x3F =/126 //! //! \return None. //! //! \note Please make sure to check if the PLL is locked and valid using the //! SysCtl_isPLLValid() before setting the divider. // //***************************************************************************** static inline void SysCtl_setPLLSysClk(uint16_t divider) { // // Clears the divider then configures it. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x22U)))) = ((*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x22U)))) & ~(0x3FU)) | divider; __edis(); } //***************************************************************************** // //! Sets up AUXPLLCLK divider. //! //! \param divider is the value that configures the divider. //! //! This function sets up the AUXPLLCLK divider. There is only one //! divider that scales AUXPLLCLK to generate the system clock. //! //! The \e divider parameter can have one enumerated value from //! SysCtl_AuxPLLClkDivider //! //! \return None. //! //! \note Please make sure to check if the PLL is locked and valid using the //! SysCtl_isPLLValid() before setting the divider. // //***************************************************************************** static inline void SysCtl_setAuxPLLClk(SysCtl_AuxPLLClkDivider divider) { // // Clears the divider then configures it. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x24U)))) = ((*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x24U)))) & ~(0x7U)) | (uint16_t)divider; __edis(); } //***************************************************************************** // //! Sets up MCAN Clk divider. //! //! \param divider is the value that configures the divider. //! //! This function sets up the MCANCLK divider. There is only one //! divider that scales MCAN clock. //! //! The \e divider parameter can have one enumerated value from //! SysCtl_MCANClkDivider //! //! \return None. // //***************************************************************************** static inline void SysCtl_setMCANClk(SysCtl_MCANClkDivider divider) { // // Clears the divider then configures it. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x24U)))) = ((*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0x24U)))) & ~(0x1F00U)) | ((uint16_t)divider << 8U); __edis(); } //***************************************************************************** // //! Sets up CPU Timer 2 CLK source & divider. //! //! \param divider is the value that configures the divider. //! \param source is the source for the clock divider //! //! This function sets up the CPU Timer 2 CLK divider based on the source that //! is selected. There is only one divider that scales the "source" to //! CPU Timer 2 CLK. //! //! The \e divider parameter can have one enumerated value from //! SysCtl_Cputimer2ClkDivider //! The \e source parameter can have one enumerated value from //! SysCtl_Cputimer2ClkSource //! //! \return None. // //***************************************************************************** static inline void SysCtl_setCputimer2Clk(SysCtl_Cputimer2ClkDivider divider, SysCtl_Cputimer2ClkSource source) { // // Clears the divider & the source, then configures it. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(0x0005D300U + 0x7CU)))) = ((*((volatile uint16_t *)((uintptr_t)(0x0005D300U + 0x7CU)))) & ~(0x7U | 0x38U)); (*((volatile uint16_t *)((uintptr_t)(0x0005D300U + 0x7CU)))) |= ((uint16_t)divider << 3U) | ((uint16_t)source << 0U); __edis(); } //***************************************************************************** // //! Enables the Ethercat I2C loopback. //! //! This function enables the Ethercat I2C loopback. Note that the Ethercat I2C //! loopback is disabled on reset. //! //! \return None. // //***************************************************************************** static inline void SysCtl_enableEthercatI2Cloopback(void) { // // Set the I2C loopback enable bit. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(0x0005D300U + 0xCU)))) |= 0x1U; __edis(); } //***************************************************************************** // //! Disables the Ethercat I2C loopback. //! //! This function disables the Ethercat I2C loopback.Note that the Ethercat I2C //! loopback is enabled on reset. //! //! \return None. // //***************************************************************************** static inline void SysCtl_disableEthercatI2Cloopback(void) { // // Clear the I2C loopback enable bit. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(0x0005D300U + 0xCU)))) &= ~0x1U; __edis(); } //***************************************************************************** // //! Gets the PIE Vector Fetch Error Handler Routine Address. //! //! The function indicates the address of the PIE Vector Fetch Error //! handler routine. //! //! \return Error Handler Address. //! //! \note Its the responsibility of user to initialize this register. If this //! register is not initialized, a default error handler at address //! 0x3fffbe will get executed. // //***************************************************************************** static inline uint32_t SysCtl_getPIEVErrAddr(void) { return((*((volatile uint32_t *)((uintptr_t)(0x0005D300U + 0xAU))))); } //***************************************************************************** // //! Simulates a reset to the CPU1 //! //! \param rstCauses is the cause for the reset. //! //! The \e rstCauses parameter can be one/ more of these values: //! SYSCTL_CAUSE_CPU1RSN or SYSCTL_CAUSE_XRS //! //! \return None. //! //! \note This API exists only on CPU1 // //***************************************************************************** static inline void SysCtl_simulateReset(uint32_t rstCauses) { // //Write will succeed only if a matching key value is written //to the KEY field //Sets the appropriate reset bit. // (*((volatile uint32_t *)((uintptr_t)(0x0005D300U + 0x70U)))) = (rstCauses | (0xA5A50000U & 0xFFFF0000U)); } //***************************************************************************** // //! Check if the CM is held in reset or not //! //! Provides the reset status of CM to the CPU //! //! \note This API is applicable only for the CPU1 subsystem. //! //! \return \b true if CM is in reset \b false if CM is out of reset // //***************************************************************************** static inline _Bool SysCtl_isCMReset(void) { return(((*((volatile uint16_t *)((uintptr_t)(0x0005DC00U + 0x0U)))) & 0x2U)== 0U); } //***************************************************************************** // //! Enables the NMI generation to the C28x core //! //! \param Flags is the Bit mask of the NMI interrupts that user //! wants, to generate an NMI to the C28x. //! //! The \e Flags parameter can be the value : //! SYSCTL_FLAG_CMNMIWDRST. //! //! \note This API is applicable only for the CPU1 subsystem. //! //! \return None. // //***************************************************************************** static inline void SysCtl_enableCMtoCPUNMI (uint32_t Flags) { __eallow(); (*((volatile uint16_t *)((uintptr_t)(0x0005DC00U + 0x2U))))|= Flags ; __edis(); } //***************************************************************************** // //! Enables the Interrupt generation to the C28x core //! //! \param Flags is the Bit mask of the Interrupts that user //! wants, to generate an Interrupt to the C28x. //! //! The \e Flags parameter can be the value : //! SYSCTL_FLAG_CMNMIWDRST. //! //! \note This API is applicable only for the CPU1 subsystem. //! //! \return None. // //***************************************************************************** static inline void SysCtl_enableCMtoCPUInterrupt (uint32_t Flags) { __eallow(); (*((volatile uint16_t *)((uintptr_t)(0x0005DC00U + 0x4U))))|= Flags ; __edis(); } //***************************************************************************** // //! Disables the NMI generation to the C28x core //! //! \param Flags is the Bit mask of the NMI interrupts that user //! wants, to generate an NMI to the C28x. //! //! The \e Flags parameter can be the value : //! SYSCTL_FLAG_CMNMIWDRST. //! //! \note This API is applicable only for the CPU1 subsystem. //! //! \return None. // //***************************************************************************** static inline void SysCtl_disableCMtoCPUNMI (uint32_t Flags) { __eallow(); (*((volatile uint16_t *)((uintptr_t)(0x0005DC00U + 0x2U)))) &= ~Flags ; __edis(); } //***************************************************************************** // //! Disables the Interrupt generation to the C28x core //! //! \param Flags is the Bit mask of the Interrupts that user //! wants, to generate an Interrupt to the C28x. //! //! The \e Flags parameter can be the value : //! SYSCTL_FLAG_CMNMIWDRST. //! //! \note This API is applicable only for the CPU1 subsystem. //! //! \return None. // //***************************************************************************** static inline void SysCtl_disableCMtoCPUInterrupt (uint32_t Flags) { __eallow(); (*((volatile uint16_t *)((uintptr_t)(0x0005DC00U + 0x4U)))) &= ~Flags ; __edis(); } //***************************************************************************** // //! Gets the NMI generated on the C28x core //! //! \note This API is applicable only for the CPU1 subsystem. //! //! \return the NMI generated to the C28x. The value can be: //! SYSCTL_FLAG_CMNMIWDRST. // //***************************************************************************** static inline uint16_t SysCtl_getCMtoCPUNMI (void) { return((*((volatile uint16_t *)((uintptr_t)(0x0005DC00U + 0x2U))))); } //***************************************************************************** // //! Gets the Interrupt generated on the C28x core //! //! \note This API is applicable only for the CPU1 subsystem. //! //! \return the Interrupt generated to the C28x. The value can be: //! SYSCTL_FLAG_CMNMIWDRST. // //***************************************************************************** static inline uint16_t SysCtl_getCMtoCPUInterrupt (void) { return((*((volatile uint16_t *)((uintptr_t)(0x0005DC00U + 0x4U))))); } //***************************************************************************** // //! Configures the CM Peripheral Allocation for shared peripherals. //! //! \param peripheral is the peripheral being allocated to CM. //! \param allocate decides if the peripheral is allocated to the C28x CPU1/2 //! or the CM. //! //! The \e peripheral parameter can have one enumerated value from //! SysCtl_SharedPeripheral //! //! The \e allocate parameter can have one of the values from: //! 0x0U: Peripheral is allocated to C28x CPU1/2, CM accesses to it will //! be ignored and interrupts from it will not be generated to CM. //! 0x1U: Peripheral is allocated to CM, C28x CPU1/2 accesses to it will //! be ignored and interrupts from it will not be generated to C28x CPU1/2. //! //! \return None. //! //! \note This API must be configured prior to enabling the //! peripheral clocks. CPU2 does not have access to this API for MCAN //! EtherCAT & USB peripherals. // //***************************************************************************** static inline void SysCtl_allocateSharedPeripheral(SysCtl_SharedPeripheral peripheral, uint16_t allocate) { __eallow(); // // Allocates the peripheral based on if the C28x or CM need access // if(allocate != 0x0U) { (*((volatile uint32_t *)((uintptr_t)(0x0005DC00U + 0x20U)))) |= ((uint32_t)1U << peripheral); } else { (*((volatile uint32_t *)((uintptr_t)(0x0005DC00U + 0x20U)))) &= ~((uint32_t)1U << peripheral); } __edis(); } //***************************************************************************** // //! Locks the CM configuration registers //! //! This function locks the CM configuration registers below. //! 1. PALLOCATE0 //! 2. CMTOCPU1NMICTL //! 3. CMTOCPU1INTCTL //! //! \note This API is applicable only for the CPU1 subsystem. //! //! \return None. // //***************************************************************************** static inline void SysCtl_lockCMConfig(void) { __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x0005DC00U + 0x3FEU)))) = 0x1U; __edis(); } //***************************************************************************** // //! Gets the status of interrupts due to multiple sources of Cortex-M4 reset. //! //! \return the Interrupt generated on reset of the CM. The values can be //! one/ more from: //! SYSCTL_STATUS_CMGINT , SYSCTL_STATUS_CMNMIWDRST , //! SYSCTL_STATUS_CMSYSRESETREQ or SYSCTL_STATUS_CMVECTRESET. //! //! \note This API is present only on CPU1. // //***************************************************************************** static inline uint32_t SysCtl_getCMInterruptStatus(void) { return((*((volatile uint32_t *)((uintptr_t)(0x0005D400U + 0x0U))))); } //***************************************************************************** // //! Clears the interrupts due to multiple sources of Cortex-M4 reset. //! //! \param intFlags is the interrupt that needs to be cleared. //! //! The \e intFlags parameter are the Interrupts generated on reset of the CM //! that need to be cleared. The values can be one/ more from: //! SYSCTL_STATUS_CMGINT , SYSCTL_STATUS_CMNMIWDRST , //! SYSCTL_STATUS_CMSYSRESETREQ or SYSCTL_STATUS_CMVECTRESET. //! //! \return None. //! //! \note This API is present only on CPU1. // //***************************************************************************** static inline void SysCtl_clearCMInterruptStatus(uint32_t intFlags) { (*((volatile uint16_t *)((uintptr_t)(0x0005D400U + 0x2U)))) |= intFlags; } //***************************************************************************** // //! Sets the interrupt for the multiple sources of Cortex-M4 reset. //! //! \param intFlags is the interrupt that needs to be set. //! //! The \e intFlags parameter are the Interrupts generated on reset of the CM //! that need to be set. The values can be one/ more from: //! SYSCTL_STATUS_CMGINT , SYSCTL_STATUS_CMNMIWDRST , //! SYSCTL_STATUS_CMSYSRESETREQ or SYSCTL_STATUS_CMVECTRESET. //! //! \return None. //! //! \note This API is present only on CPU1. // //***************************************************************************** static inline void SysCtl_setCMInterruptStatus(uint32_t intFlags) { __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x0005D400U + 0x4U)))) = (intFlags | (0xA5A50000U & 0xFFFF0000U)); __edis(); } //***************************************************************************** // //! Gets the masked interrupts due to multiple sources of Cortex-M4 reset. //! //! \return the Interrupt generated on reset of the CM. The values can be //! one/ more from: //! SYSCTL_STATUS_CMGINT , SYSCTL_STATUS_CMNMIWDRST , //! SYSCTL_STATUS_CMSYSRESETREQ or SYSCTL_STATUS_CMVECTRESET. //! //! \note This API is present only on CPU1. // //***************************************************************************** static inline uint32_t SysCtl_getCMInterruptStatusMask(void) { return((*((volatile uint32_t *)((uintptr_t)(0x0005D400U + 0x6U))))); } //***************************************************************************** // //! Sets the interrupt mask for the multiple sources of Cortex-M4 reset. //! //! \param intFlags is the interrupt that needs to be set. //! //! The \e intFlags parameter are the Interrupts generated on reset of the CM //! that need to be masked. The values can be one/ more from: //! SYSCTL_STATUS_CMGINT , SYSCTL_STATUS_CMNMIWDRST , //! SYSCTL_STATUS_CMSYSRESETREQ or SYSCTL_STATUS_CMVECTRESET. //! //! \return None. //! //! \note This API is present only on CPU1. // //***************************************************************************** static inline void SysCtl_setCMInterruptStatusMask(uint32_t intFlags) { __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x0005D400U + 0x6U)))) = (intFlags | (0xA5A50000U & 0xFFFF0000U)); __edis(); } //***************************************************************************** // //! Gets the status of interrupts due to multiple different //! errors in the system. //! //! \return the Interrupt generated on the system. //! The values can be one/ more from: //! - SYSCTL_STATUS_GINT //! - SYSCTL_STATUS_EMIF_ERR //! - SYSCTL_STATUS_RAM_CORRECTABLE_ERR //! - SYSCTL_STATUS_FLASH_CORRECTABLE_ERR //! - SYSCTL_STATUS_RAM_ACC_VIOL //! - SYSCTL_STATUS_SYS_PLL_SLIP //! - SYSCTL_STATUS_AUX_PLL_SLIP //! - SYSCTL_STATUS_DCC0 //! - SYSCTL_STATUS_DCC1 //! - SYSCTL_STATUS_DCC2 // //***************************************************************************** static inline uint32_t SysCtl_getInterruptStatus(void) { return((*((volatile uint32_t *)((uintptr_t)(0x0005D400U + 0x10U))))); } //***************************************************************************** // //! Clears the interrupts due to multiple different errors in the system. //! //! \param intFlags is the interrupt that needs to be cleared. //! //! The \e intFlags parameter are the Interrupts generated on errors in //! the system that need to be cleared. The values can be one or more from: //! - SYSCTL_STATUS_GINT //! - SYSCTL_STATUS_EMIF_ERR //! - SYSCTL_STATUS_RAM_CORRECTABLE_ERR //! - SYSCTL_STATUS_FLASH_CORRECTABLE_ERR //! - SYSCTL_STATUS_RAM_ACC_VIOL //! - SYSCTL_STATUS_SYS_PLL_SLIP //! - SYSCTL_STATUS_AUX_PLL_SLIP //! - SYSCTL_STATUS_DCC0 //! - SYSCTL_STATUS_DCC1 //! - SYSCTL_STATUS_DCC2 //! //! \return None. // //***************************************************************************** static inline void SysCtl_clearInterruptStatus(uint32_t intFlags) { (*((volatile uint16_t *)((uintptr_t)(0x0005D400U + 0x12U)))) |= intFlags; } //***************************************************************************** // //! Sets the interrupts for the multiple different errors in the system. //! //! \param intFlags is the interrupt that needs to be set. //! //! The \e intFlags parameter are the Interrupts that can be set //! for the errors in the system. The values can be one/ more from: //! - SYSCTL_STATUS_GINT //! - SYSCTL_STATUS_EMIF_ERR //! - SYSCTL_STATUS_RAM_CORRECTABLE_ERR //! - SYSCTL_STATUS_FLASH_CORRECTABLE_ERR //! - SYSCTL_STATUS_RAM_ACC_VIOL //! - SYSCTL_STATUS_SYS_PLL_SLIP //! - SYSCTL_STATUS_AUX_PLL_SLIP //! - SYSCTL_STATUS_DCC0 //! - SYSCTL_STATUS_DCC1 //! - SYSCTL_STATUS_DCC2 //! //! \return None. //! //! \note This API is present only on CPU1. // //***************************************************************************** static inline void SysCtl_setInterruptStatus(uint32_t intFlags) { __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x0005D400U + 0x14U)))) = (intFlags | (0xA5A50000U & 0xFFFF0000U)); __edis(); } //***************************************************************************** // //! Gets the masked interrupts due to multiple different //! errors in the system. //! //! \return the Interrupt generated on the system. //! The values can be one/ more from: //! - SYSCTL_STATUS_EMIF_ERR //! - SYSCTL_STATUS_RAM_CORRECTABLE_ERR //! - SYSCTL_STATUS_FLASH_CORRECTABLE_ERR //! - SYSCTL_STATUS_RAM_ACC_VIOL //! - SYSCTL_STATUS_SYS_PLL_SLIP //! - SYSCTL_STATUS_AUX_PLL_SLIP //! - SYSCTL_STATUS_DCC0 //! - SYSCTL_STATUS_DCC1 //! - SYSCTL_STATUS_DCC2 // //***************************************************************************** static inline uint32_t SysCtl_getInterruptStatusMask(void) { return((*((volatile uint32_t *)((uintptr_t)(0x0005D400U + 0x16U))))); } //***************************************************************************** // //! Masks the interrupts for the multiple different errors in the system. //! //! \param intFlags is the interrupt that needs to be set. //! //! The \e intFlags parameter are the Interrupts that can be masked //! for the errors in the system. The values can be one/ more from: //! - SYSCTL_STATUS_EMIF_ERR //! - SYSCTL_STATUS_RAM_CORRECTABLE_ERR //! - SYSCTL_STATUS_FLASH_CORRECTABLE_ERR //! - SYSCTL_STATUS_RAM_ACC_VIOL //! - SYSCTL_STATUS_SYS_PLL_SLIP //! - SYSCTL_STATUS_AUX_PLL_SLIP //! - SYSCTL_STATUS_DCC0 //! - SYSCTL_STATUS_DCC1 //! - SYSCTL_STATUS_DCC2 //! //! \return None. //! //! \note This API is present only on CPU1. // //***************************************************************************** static inline void SysCtl_setInterruptStatusMask(uint32_t intFlags) { __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x0005D400U + 0x16U)))) = (intFlags | (0xA5A50000U & 0xFFFF0000U)); __edis(); } //***************************************************************************** // //! Sets up CLB CLK dividers & configurations for a particuler CLB. //! //! \param divider is the value that configures the clock divider. //! \param tdivider is the value that configures the tile clock divider. //! \param inst is the CLB instance that needs clock settings. //! \param config is the mode for the clock //! //! This function sets up the CLB CLK configurations based on the instance //! that is selected. There are 2 dividers that scales the "source" to CLB //! CLK. The first one is the divider & the other the tile divider. //! //! The \e divider parameter can have one enumerated value from //! SysCtl_CLBClkDivider //! The \e tdivider parameter can have one enumerated value from //! SysCtl_CLBTClkDivider //! The \e inst parameter can have one enumerated value from //! SysCtl_CLBInst //! The \e config parameter can have one enumerated value from //! SysCtl_CLBClkm //! //! \return None. // //***************************************************************************** static inline void SysCtl_setCLBClk (SysCtl_CLBClkDivider divider, SysCtl_CLBTClkDivider tdivider, SysCtl_CLBInst inst, SysCtl_CLBClkm config) { __eallow(); // //clear the CLB clk configurations // (*((volatile uint32_t *)((uintptr_t)(0x0005D200U + 0x2AU)))) = ((*((volatile uint32_t *)((uintptr_t)(0x0005D200U + 0x2AU)))) & ~(0x7U | 0x10U | (0x1U << inst))); // //set the clock configurations for the particular CLB // (*((volatile uint32_t *)((uintptr_t)(0x0005D200U + 0x2AU)))) |= ((uint32_t)divider << 0U) | ((uint32_t)tdivider << 0x4U) | ((uint32_t)config << inst); __edis(); } //***************************************************************************** // //! Check if One or more of the error sources triggered //! //! Following are the events/triggers that can indicate an error: //!1. nmi interrupt on C28x //!2. Watchdog reset //!3. Error on a Pie vector fetch //!4. Efuse error //!5. nmi interrupt on CM //! //! \return \b true if the error is triggered //! \b false if the error is not triggered // //***************************************************************************** static inline uint16_t SysCtl_isErrorTriggered(void) { return(((*((volatile uint16_t *)((uintptr_t)(0x00007060U + 0x7U)))) & 0x1U) != 0U); } //***************************************************************************** // //! Check if Error status pin is high or not //! //! \return \b true if the error status pin is high //! \b false if the error status pin is low // //***************************************************************************** static inline uint16_t SysCtl_getErrorPinStatus(void) { // // Read and return the status of the ErrorPin // return(((*((volatile uint16_t *)((uintptr_t)(0x00007060U + 0x7U)))) & 0x2U) != 0U); } //***************************************************************************** // //! Forces an error flag to set to indicate an error being generated. //! //! \return None. // //***************************************************************************** static inline void SysCtl_forceError(void) { __eallow(); (*((volatile uint16_t *)((uintptr_t)(0x00007060U + 0x9U)))) |= 0x1U; __edis(); } //***************************************************************************** // //! Clears any error flag set due to error generated. //! //! \return None. // //***************************************************************************** static inline void SysCtl_clearError(void) { __eallow(); (*((volatile uint16_t *)((uintptr_t)(0x00007060U + 0x8U)))) |= 0x1U; __edis(); } //***************************************************************************** // //! Selects the polarity of the error pin //! //! \param pol is the ERROR pin polarity //! //! The \e pol parameter can take any of the below values: //! 0x0U: If an error is already triggered, Error pin will be driven //! with a value of 0, else 1. //! 0x1U: If an error is already triggered, Error pin will be driven //! with a value of 1, else 0. //! //! \return None. // //***************************************************************************** static inline void SysCtl_selectErrPinPolarity(uint16_t pol) { __eallow(); // //Configures the error pin polarity based on the provided polarity // if(pol == 1U) { (*((volatile uint16_t *)((uintptr_t)(0x00007060U + 0xAU)))) |= 0x1U; } else { (*((volatile uint16_t *)((uintptr_t)(0x00007060U + 0xAU)))) &= ~0x1U; } __edis(); } //***************************************************************************** // //! Locks the Error control registers //! //! This function locks the Error configuration registers. //! //! \return None. //! //! \note The lock register is cleared only on a system reset. // //***************************************************************************** static inline void SysCtl_lockErrControl(void) { __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x00007060U + 0xBU)))) = 0x1U; __edis(); } //***************************************************************************** // //! Delays for a fixed number of cycles. //! //! \param count is the number of delay loop iterations to perform. //! //! This function generates a constant length delay using assembly code. The //! loop takes 5 cycles per iteration plus 9 cycles of overhead. //! //! \note If count is equal to zero, the loop will underflow and run for a //! very long time. //! //! \return None. // //***************************************************************************** extern void SysCtl_delay(uint32_t count); //***************************************************************************** // //! Calculates the system clock frequency (SYSCLK). //! //! \param clockInHz is the frequency of the oscillator clock source (OSCCLK). //! //! This function determines the frequency of the system clock based on the //! frequency of the oscillator clock source (from \e clockInHz) and the PLL //! and clock divider configuration registers. //! //! \return Returns the system clock frequency. If a missing clock is detected, //! the function will return the INTOSC1 frequency. This needs to be //! corrected and cleared (see SysCtl_resetMCD()) before trying to call this //! function again. // //***************************************************************************** extern uint32_t SysCtl_getClock(uint32_t clockInHz); //***************************************************************************** // //! Calculates the system auxiliary clock frequency (AUXPLLCLK). //! //! \param clockInHz is the frequency of the oscillator clock source //! (AUXOSCCLK). //! //! This function determines the frequency of the auxiliary clock based on the //! frequency of the oscillator clock source (from \e clockInHz) and the AUXPLL //! and clock divider configuration registers. //! //! \return Returns the auxiliary clock frequency. // //***************************************************************************** extern uint32_t SysCtl_getAuxClock(uint32_t clockInHz); //***************************************************************************** // //! Configures the clocking of the device. //! //! \param config is the required configuration of the device clocking. //! //! This function configures the clocking of the device. The input crystal //! frequency, oscillator to be used, use of the PLL, and the system clock //! divider are all configured with this function. //! //! The \e config parameter is the OR of several different values, many of //! which are grouped into sets where only one can be chosen. //! //! - The system clock divider is chosen with the macro \b SYSCTL_SYSDIV(x) //! where x is either 1 or an even value up to 126. //! //! - The use of the PLL is chosen with ONLY one of the below modes: //! \b SYSCTL_PLL_ENABLE - This is to Enable the PLL Clock to the System //! or //! \b SYSCTL_PLL_BYPASS -This is to Bypass the PLLCLK from the System, //! this will also power up the PLL if the user desires to power up the PLL //! but not use it for System. //! or //! \b SYSCTL_PLL_DISABLE-This is to Power Down the PLL and Bypass the //! PLLCLK to the System. //! //! - The integer multiplier is chosen \b SYSCTL_IMULT(x) where x is a value //! from 1 to 127. //! //! - The reference clock divider is chosen \b SYSCTL_REFDIV(x) where //! x is a value from 1 to 32. //! //! - The output clock divider is chosen \b SYSCTL_ODIV(x) where x //! is a value from 1 to 32. //! //! - The DCC module selected for checking PLL clock validity chosen with //! either \b SYSCTL_DCC_BASE_0, \b SYSCTL_DCC_BASE_1, //! or \b SYSCTL_DCC_BASE_2. //! //! - The oscillator source chosen with \b SYSCTL_OSCSRC_OSC2, //! \b SYSCTL_OSCSRC_XTAL, \b SYSCTL_OSCSRC_XTAL_SE or \b SYSCTL_OSCSRC_OSC1. //! //! This function uses the DCC to check that the PLLRAWCLK is running at the //! expected rate. If you are using the DCC, you must back up its configuration //! before calling this function and restore it afterward. //! Locking PLL sequence is only done if the multipliers are updated. //! //! \note See your device errata for more details about locking the PLL. //! Please note the PLL can take inputs from 2Mhz to 48Mhz. //! PLL can be locked from 220Mhz to 800Mhz. //! The output of PLL cannot be more than 500Mhz (after ODIV). //! //! \return Returns \b false if a missing clock error is detected. This needs //! to be cleared (see SysCtl_resetMCD()) before trying to call this function //! again. Also, returns \b false if the PLLRAWCLK is not running and its //! expected rate. Otherwise, returns \b true. // //***************************************************************************** extern _Bool SysCtl_setClock(uint32_t config); //***************************************************************************** // //! Validates PLL Raw Clock Frequency (PLLRAWCLK) //! //! \param base is the DCC module base address //! \param oscSource is the Clock Source for the PLL that is also used for DCC //! \param pllclk is the PLL Clock which has to be validated. //! \param pllMultDiv has the PLL Multiplier Register configuration which //! include integer multiplier and divider values used to configure the //! DCC Counter1 clock //! This function uses DCC module to validate the PLL clock frequency. //! It uses oscSource as a reference clock for DCC, and PLL is used as clock //! under test. As long as the Counter0 (running of oscSource) & Counter1 //! (running of PLL) expire at the same time, DCC will not generate an Error. //! This function gives 100 attempts for PLL to lock and make sure frequency //! is as expected. //! //! \note This function does not validate if PLL output frequency (PLLRAWCLK) //! is within the operating range as per the datasheet. //! //! - The \e oscSource parameter is the oscillator source chosen with //! \b SYSCTL_OSCSRC_OSC2, \b SYSCTL_OSCSRC_XTAL, \b SYSCTL_OSCSRC_XTAL_SE //! or \b SYSCTL_OSCSRC_OSC1. //! //! - The \e pllclk parameter can have one enumerated value from //! SysCtl_PLLClockSource //! - The \e pllMultDiv parameter is a bitwise OR of \b SYSCTL_IMULT(x) //! where x is a value from 1 to 127 and both of the following divider //! values which is chosen with the macro \b SYSCTL_REFDIV(x) and //! SYSCTL_ODIV(x) where x is a value from 1 to 32 and can be different //! for both macros. //! //! \return Returns \b true if the DCCSTATUS error flag is not set. //! Otherwise, returns \b false. // //***************************************************************************** extern _Bool SysCtl_isPLLValid(uint32_t base, uint32_t oscSource, SysCtl_PLLClockSource pllclk, uint32_t pllMultDiv); //***************************************************************************** // //! Configures the external oscillator for the clocking of the device. //! //! This function configures the external oscillator (XTAL) to be used for the //! clocking of the device in crystal mode. It follows the procedure to turn on //! the oscillator, wait for it to power up, and select it as the source of the //! system clock. //! //! Please note that this function blocks while it waits for the XTAL to power //! up. If the XTAL does not manage to power up properly, the function will //! loop for a long time. It is recommended that you modify this function to //! add an appropriate timeout and error-handling procedure. //! //! \return None. // //***************************************************************************** extern void SysCtl_selectXTAL(void); //***************************************************************************** // //! Configures the external oscillator for the clocking of the device in //! single-ended mode. //! //! This function configures the external oscillator (XTAL) to be used for the //! clocking of the device in single-ended mode. It follows the procedure to //! turn on the oscillator, wait for it to power up, and select it as the //! source of the system clock. //! //! Please note that this function blocks while it waits for the XTAL to power //! up. If the XTAL does not manage to power up properly, the function will //! loop for a long time. It is recommended that you modify this function to //! add an appropriate timeout and error-handling procedure. //! //! \return None. // //***************************************************************************** extern void SysCtl_selectXTALSingleEnded(void); //***************************************************************************** // //! Selects the oscillator to be used for the clocking of the device. //! //! \param oscSource is the oscillator source to be configured. //! //! This function configures the oscillator to be used in the clocking of the //! device. The \e oscSource parameter may take a value of //! \b SYSCTL_OSCSRC_OSC2, \b SYSCTL_OSCSRC_XTAL, \b SYSCTL_OSCSRC_XTAL_SE, or //! \b SYSCTL_OSCSRC_OSC1. //! //! \sa SysCtl_turnOnOsc() //! //! \return None. // //***************************************************************************** extern void SysCtl_selectOscSource(uint32_t oscSource); //***************************************************************************** // //! Calculates the low-speed peripheral clock frequency (LSPCLK). //! //! \param clockInHz is the frequency of the oscillator clock source (OSCCLK). //! //! This function determines the frequency of the low-speed peripheral clock //! based on the frequency of the oscillator clock source (from \e clockInHz) //! and the PLL and clock divider configuration registers. //! //! \return Returns the low-speed peripheral clock frequency. // //***************************************************************************** extern uint32_t SysCtl_getLowSpeedClock(uint32_t clockInHz); //***************************************************************************** // //! Get the device part parametric value //! //! \param parametric is the requested device parametric value //! //! This function gets the device part parametric value. //! //! The \e parametric parameter can have one the following enumerated values: //! - \b SYSCTL_DEVICE_QUAL - Device Qualification Status //! - \b SYSCTL_DEVICE_PINCOUNT - Device Pin Count //! - \b SYSCTL_DEVICE_INSTASPIN - Device InstaSPIN Feature Set //! - \b SYSCTL_DEVICE_FLASH - Device Flash size (KB) //! - \b SYSCTL_DEVICE_PARTID - Device PARTID Format Revision //! - \b SYSCTL_DEVICE_FAMILY - Device Family //! - \b SYSCTL_DEVICE_PARTNO - Device Part Number //! - \b SYSCTL_DEVICE_CLASSID - Device Class ID //! //! \note This API is applicable only for the CPU1 subsystem. //! //! \return Returns the specified parametric value. // //***************************************************************************** extern uint16_t SysCtl_getDeviceParametric(SysCtl_DeviceParametric parametric); //***************************************************************************** // //! Configures the auxiliary PLL. //! //! \param config is the required configuration of the device clocking. //! //! This function configures the clock source for auxiliary PLL, the integer //! multiplier, fractional multiplier and divider. //! //! The \e config parameter is the OR of several different values, many of //! which are grouped into sets where only one can be chosen. //! //! - The system clock divider is chosen with one of the following macros: //! \b SYSCTL_AUXPLL_DIV_1, //! \b SYSCTL_AUXPLL_DIV_2, //! \b SYSCTL_AUXPLL_DIV_4, //! \b SYSCTL_AUXPLL_DIV_8 //! \b SYSCTL_AUXPLL_DIV_3, //! \b SYSCTL_AUXPLL_DIV_5, //! \b SYSCTL_AUXPLL_DIV_6, //! \b SYSCTL_AUXPLL_DIV_7 //! //! - The use of the PLL is chosen with ONLY one of the below modes: //! \b SYSCTL_AUXPLL_ENABLE - This is to Enable the PLL Clock to the System //! or //! \b SYSCTL_AUXPLL_BYPASS -This is to Bypass the PLLCLK from the System, //! this will also power up the PLL if the user desires to power up the PLL //! but not use it for System. //! or //! \b SYSCTL_AUXPLL_DISABLE-This is to Power Down the PLL and Bypass the //! PLLCLK to the System. //! //! - The integer multiplier is chosen with \b SYSCTL_AUXPLL_IMULT(x) where x //! is a value from 1 to 127. //! //! - The reference clock divider is chosen \b SYSCTL_AUXPLL_REFDIV((x) where //! x is a value from 1 to 32. //! //! - The output clock divider is chosen \b SYSCTL_AUXPLL_ODIV(x) where x //! is a value from 1 to 32. //! //! - The DCC module selected for checking PLL clock validity chosen with //! either \b SYSCTL_DCC_BASE_0, \b SYSCTL_DCC_BASE_1, //! or \b SYSCTL_DCC_BASE_2. //! //! - The oscillator source chosen with one of //! \b SYSCTL_AUXPLL_OSCSRC_OSC2, //! \b SYSCTL_AUXPLL_OSCSRC_XTAL, //! \b SYSCTL_AUXPLL_OSCSRC_AUXCLKIN, //! \b SYSCTL_AUXPLL_OSCSRC_XTAL_SE //! //! \note This function uses the DCC to check that the AUXPLLRAWCLK is //! expected rate. If you are using the DCC, you must back up its configuration //! before calling this function and restore it afterward. //! Locking PLL sequence is only done if the multipliers are updated. //! //! Please note the PLL can take inputs from 2Mhz to 48Mhz. //! PLL can be locked from 220Mhz to 800Mhz. //! The output of PLL cannot be more than 500Mhz (after ODIV). //! //! \note See your device errata for more details about locking the PLL. //! //! \return None. // //***************************************************************************** extern void SysCtl_setAuxClock(uint32_t config); //***************************************************************************** // //! Controls the reset of CPU2 by CPU1 //! //! \param control is to deactivate / activate the reset to the CPU2. //! //! The \e control parameter can be a value from the enumeration //! SysCtl_CoreReset //! //! \note This API is applicable only for the CPU1 subsystem. //! //! \return None. // //***************************************************************************** extern void SysCtl_controlCPU2Reset(SysCtl_CoreReset control); //***************************************************************************** // //! Configures & locks/unlocks the peripheral type //! //! \param type is the peripheral type that needs to be configured. //! \param config is the configuration done to the peripheral which is //! dependent on the peripheral type. //! \param lock is to decide if writes for any further configuration is to //! be allowed or not. //! //! The \e type parameter can be a value from the enumeration //! SysCtl_SelType //! The \e config parameter can be a value from the ones below: //! 0x0U : disables the feature for the type. //! 0x1U : enables the feature for the type. //! //! For USB : Global interrupt feature is enabled or not //! For ECAP: ECAP registers are EALLOW protected or not. //! For SDFM: Data Ready conditions do not generate the SDFMINT. //! & Each filter generates a separate data ready interrupts. //! For MEMMAP: Enables remapping SDRAM in lower 64kb of address space or not. //! //! The \e lock parameter can be a value from the ones below: //! 0x1U : Write for any further configuration is not allowed. //! 0x0U : Write for any further configuration is allowed. //! //! \note This API is applicable only for the CPU1 subsystem. //! //! \return None. // //***************************************************************************** extern void SysCtl_configureType(SysCtl_SelType type , uint16_t config, uint16_t lock); //***************************************************************************** // //! Check if writes for any further configuration of peripheral types is to //! be allowed or not. //! //! \param type is the peripheral type for which permissions are being checked //! //! \note This API is applicable only for the CPU1 subsystem. //! //! \return \b true if Write for any further configuration is not allowed. //! \b false if Write for any further configuration is allowed. // //***************************************************************************** extern _Bool SysCtl_isConfigTypeLocked(SysCtl_SelType type); //***************************************************************************** // //! Sets the owner for clock configuration //! //! \param cpuInst is owner for the clock configuration. //! //! The \e cpuInst parameter can be a value from the enumeration //! SysCtl_CPUSel //! //! \return None. // //***************************************************************************** extern void SysCtl_setSemOwner (SysCtl_CPUSel cpuInst); //***************************************************************************** // //! Locks the Clock configuration registers //! //! \param registerName is clock configuration register which needs to //! be locked. //! //! The \e registerName parameter can be a value from the enumeration //! SysCtl_ClkRegSel //! //! \return None. //! //! \note The register is unlocked only on a system reset. // //***************************************************************************** extern void SysCtl_lockClkConfig(SysCtl_ClkRegSel registerName); //***************************************************************************** // //! Locks the CPU system configuration registers //! //! \param registerName is CPU system configuration register which needs to //! be locked. //! //! The \e registerName parameter can be a value from the enumeration //! SysCtl_CpuRegSel //! //! \return None. //! //! \note The register is unlocked only on a system reset. // //***************************************************************************** extern void SysCtl_lockSysConfig (SysCtl_CpuRegSel registerName); //***************************************************************************** // //! Controls the reset of CM //! //! \param control is to deactivate /activate the reset to the CM. //! //! The \e control parameter can be a value from the enumeration //! SysCtl_CoreReset //! //! \return None. //! //! \note This API should activate reset to CM until CM is not in reset. //! This API is applicable only for the CPU1 subsystem. //! // //***************************************************************************** extern void SysCtl_controlCMReset(SysCtl_CoreReset control); //***************************************************************************** // // Close the Doxygen group. //! @} // //**************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** // // The key value for RAM initialization // // // RAM Initialization Register Mask // // // The Parity disable key value // //***************************************************************************** // // Miscellaneous defines for Message ID Types // //***************************************************************************** //***************************************************************************** // // These are the flags used by the flags parameter when calling // the CAN_setupMessageObject() function. // //***************************************************************************** //! This indicates that transmit interrupts should be enabled, or are enabled. //! This indicates that receive interrupts should be enabled, or are //! enabled. //! This indicates that a message object will use or is using filtering //! based on the object's message identifier. //! This indicates that a message object will use or is using filtering //! based on the direction of the transfer. //! This indicates that a message object will use or is using message //! identifier filtering based on the extended identifier. //! This indicates that this message object is part of a FIFO structure and //! not the final message object in a FIFO. //! This indicates that a message object has no flags set. //***************************************************************************** // // These definitions are used to specify interrupt sources to // CAN_enableInterrupt() and CAN_disableInterrupt(). // //***************************************************************************** //! This flag is used to allow a CAN controller to generate error //! interrupts. //! This flag is used to allow a CAN controller to generate status //! interrupts. //! This flag is used to allow a CAN controller to generate interrupts //! on interrupt line 0 //! This flag is used to allow a CAN controller to generate interrupts //! on interrupt line 1 //***************************************************************************** // // The following definitions contain all error or status indicators that can // be returned when calling the CAN_getStatus() function. // //***************************************************************************** //! CAN controller has detected a parity error. //! CAN controller has entered a Bus Off state. //! CAN controller error level has reached warning level. //! CAN controller error level has reached error passive level. //! A message was received successfully since the last read of this status. //! A message was transmitted successfully since the last read of this //! status. //! This is the mask for the last error code field. //! There was no error. //! A bit stuffing error has occurred. //! A formatting error has occurred. //! An acknowledge error has occurred. //! The bus remained a bit level of 1 for longer than is allowed. //! The bus remained a bit level of 0 for longer than is allowed. //! A CRC error has occurred. //***************************************************************************** // // The following macros are added for the Global Interrupt EN/FLG/CLR // register // //***************************************************************************** //! CANINT0 global interrupt bit //! CANINT1 global interrupt bit //***************************************************************************** // // The following macros are added for accessing the interrupt register and // the standard arbitration ID in the interface registers. // //***************************************************************************** //! Status of INT0ID //! IF1 Arbitration Standard ID Shift Offset //! IF1 Arbitration Standard ID Mask //! IF2 Arbitration Standard ID Shift Offset //! IF2 Arbitration Standard ID Mask //***************************************************************************** // //! This data type is used to decide between STD_ID or EXT_ID for a mailbox. //! This is used when calling the CAN_setupMessageObject() function. // //***************************************************************************** typedef enum { //! Set the message ID frame to standard. CAN_MSG_FRAME_STD, //! Set the message ID frame to extended. CAN_MSG_FRAME_EXT } CAN_MsgFrameType; //***************************************************************************** // //! This definition is used to determine the type of message object that will //! be set up via a call to the CAN_setupMessageObject() API. // //***************************************************************************** typedef enum { //! Transmit message object. CAN_MSG_OBJ_TYPE_TX, //! Transmit remote request message object CAN_MSG_OBJ_TYPE_TX_REMOTE, //! Receive message object. CAN_MSG_OBJ_TYPE_RX, //! Remote frame receive remote, with auto-transmit message object. CAN_MSG_OBJ_TYPE_RXTX_REMOTE } CAN_MsgObjType; //***************************************************************************** // //! This definition is used to determine the clock source that will //! be set up via a call to the CAN_selectClockSource() API. // //***************************************************************************** typedef enum { //! Peripheral System Clock Source CAN_CLOCK_SOURCE_SYS = 0x0, //! External Oscillator Clock Source CAN_CLOCK_SOURCE_XTAL = 0x1, //! Auxiliary Clock Input Source CAN_CLOCK_SOURCE_AUX = 0x2 } CAN_ClockSource; //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** //***************************************************************************** // //! \internal //! //! Checks a CAN base address. //! //! \param base is the base address of the CAN controller. //! //! This function determines if a CAN controller base address is valid. //! //! \return Returns \b true if the base address is valid and \b false //! otherwise. // //***************************************************************************** static inline _Bool CAN_isBaseValid(uint32_t base) { return((base == 0x00048000U) || (base == 0x0004A000U)); } //***************************************************************************** // //! \internal //! //! Copies data from the CAN Data registers to a buffer. //! //! \param data is a pointer to the data to be written out to the CAN //! controller's data registers. //! \param address is a uint32_t value for the first register of the //! CAN controller's data registers. For example, in order to use the IF1 //! register set on CAN controller 0, the value would be: \b CANA_BASE \b + //! \b CAN_O_IF1DATA. //! \param size is the number of bytes to copy into the CAN controller. //! //! This function takes the steps necessary to copy data from a contiguous //! buffer in memory into the non-contiguous data registers used by the CAN //! controller. //! //! \return None. // //***************************************************************************** static inline void CAN_writeDataReg(const uint16_t *const data, uint32_t address, uint32_t size) { uint32_t idx; uint32_t dataReg = address; // // Loop always copies 1 byte per iteration. // for(idx = 0U; idx < size; idx++) { // // Write out the data 8 bits at a time. // if(dataReg != 0U) { __byte((int16_t *)(dataReg),0) = data[idx]; dataReg++; } } } //***************************************************************************** // //! \internal //! //! Copies data from the CAN Data registers to a buffer. //! //! \param data is a pointer to the location to store the data read from the //! CAN controller's data registers. //! \param address is a uint32_t value for the first register of the //! CAN controller's data registers. For example, in order to use the IF1 //! register set on CAN controller 1, the value would be: \b CANA_BASE \b + //! \b CAN_O_IF1DATA. //! \param size is the number of bytes to copy from the CAN controller. //! //! This function takes the steps necessary to copy data to a contiguous buffer //! in memory from the non-contiguous data registers used by the CAN //! controller. //! //! \return None. // //***************************************************************************** static inline void CAN_readDataReg(uint16_t *data, const uint32_t address, uint32_t size) { uint32_t idx; uint32_t dataReg = address; // // Loop always copies 1 byte per iteration. // for(idx = 0U; idx < size; idx++) { // // Read out the data // data[idx] = __byte((int16_t *)(dataReg),0); dataReg++; } } //***************************************************************************** // //! Initializes the CAN controller's RAM. //! //! \param base is the base address of the CAN controller. //! //! Performs the initialization of the RAM used for the CAN message objects. //! //! \return None. // //***************************************************************************** static inline void CAN_initRAM(uint32_t base) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 421); } } while(0); (*((volatile uint16_t *)((uintptr_t)(base + 0x40U)))) = 0x10U | (0xAU); while(!(((*((volatile uint16_t *)((uintptr_t)(base + 0x40U)))) & (0x003FU)) == (0x20U | 0x4U | 0x1U))) { // // Wait until RAM Init is complete // } } //***************************************************************************** // //! Select CAN Clock Source //! //! \param base is the base address of the CAN controller. //! \param source is the clock source to use for the CAN controller. //! //! This function selects the specified clock source for the CAN controller. //! //! The \e source parameter can be any one of the following: //! - \b CAN_CLOCK_SOURCE_SYS - Peripheral System Clock //! - \b CAN_CLOCK_SOURCE_XTAL - External Oscillator //! - \b CAN_CLOCK_SOURCE_AUX - Auxiliary Clock Input from GPIO //! //! \return None. // //***************************************************************************** static inline void CAN_selectClockSource(uint32_t base, CAN_ClockSource source) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 459); } } while(0); // // Determine the CAN controller and set specified clock source // __eallow(); switch(base) { case 0x00048000U: (*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0xAU)))) &= ~0xCU; (*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0xAU)))) |= ((uint16_t)source << 2U); break; case 0x0004A000U: (*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0xAU)))) &= ~0x30U; (*((volatile uint16_t *)((uintptr_t)(0x0005D200U + 0xAU)))) |= ((uint16_t)source << 4U); break; default: // // Do nothing. Not a valid mode value. // break; } __edis(); } //***************************************************************************** // //! Starts the CAN Module's Operations //! //! \param base is the base address of the CAN controller. //! //! This function starts the CAN module's operations after initialization, //! which includes the CAN protocol controller state machine of the CAN core //! and the message handler state machine to begin controlling the CAN's //! internal data flow. //! //! \return None. // //***************************************************************************** static inline void CAN_startModule(uint32_t base) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 515); } } while(0); // // Clear Init and CCE bits // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) &= ~(0x1U | 0x40U); } //***************************************************************************** // //! Enables the CAN controller. //! //! \param base is the base address of the CAN controller to enable. //! //! Enables the CAN controller for message processing. Once enabled, the //! controller will automatically transmit any pending frames, and process any //! received frames. The controller can be stopped by calling //! CAN_disableController(). //! //! \return None. // //***************************************************************************** static inline void CAN_enableController(uint32_t base) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 543); } } while(0); // // Clear the init bit in the control register. // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) &= ~0x1U; } //***************************************************************************** // //! Disables the CAN controller. //! //! \param base is the base address of the CAN controller to disable. //! //! Disables the CAN controller for message processing. When disabled, the //! controller will no longer automatically process data on the CAN bus. The //! controller can be restarted by calling CAN_enableController(). The state //! of the CAN controller and the message objects in the controller are left as //! they were before this call was made. //! //! \return None. // //***************************************************************************** static inline void CAN_disableController(uint32_t base) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 572); } } while(0); // // Set the init bit in the control register. // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) |= 0x1U; } //***************************************************************************** // //! Enables the test modes of the CAN controller. //! //! \param base is the base address of the CAN controller. //! \param mode are the the test modes to enable. //! //! Enables test modes within the controller. The following valid options for //! \e mode can be OR'ed together: //! - \b CAN_TEST_SILENT - Silent Mode //! - \b CAN_TEST_LBACK - Loopback Mode //! - \b CAN_TEST_EXL - External Loopback Mode //! //! \note Loopback mode and external loopback mode \b can \b not be //! enabled at the same time. //! //! \return None. // //***************************************************************************** static inline void CAN_enableTestMode(uint32_t base, uint16_t mode) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 605); } } while(0); do { if(!((mode & (0x10U | 0x100U)) != (0x10U | 0x100U))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 607); } } while(0); // // Clear the bits in the test register. // (*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) &= ~((uint16_t)0x8U | (uint16_t)0x10U | (uint16_t)0x100U); // // Enable test mode and set the bits in the test register. // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) |= 0x80U; (*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) |= mode; } //***************************************************************************** // //! Disables the test modes of the CAN controller. //! //! \param base is the base address of the CAN controller. //! //! Disables test modes within the controller and clears the test bits. //! //! \return None. // //***************************************************************************** static inline void CAN_disableTestMode(uint32_t base) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 640); } } while(0); // // Clear the bits in the test register. // (*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) &= ~((uint16_t)0x8U | (uint16_t)0x10U | (uint16_t)0x100U); // // Clear the test mode enable bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) &= ~0x80U; } //***************************************************************************** // //! Get the current settings for the CAN controller bit timing. //! //! \param base is the base address of the CAN controller. //! //! This function reads the current configuration of the CAN controller bit //! clock timing. //! //! \return Returns the value of the bit timing register. // //***************************************************************************** static inline uint32_t CAN_getBitTiming(uint32_t base) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 673); } } while(0); // // Read and return BTR register // return(__byte_peripheral_32((uint32_t *)(base + 0xCU))); } //***************************************************************************** // //! Enables direct access to the RAM. //! //! \param base is the base address of the CAN controller. //! //! Enables direct access to the RAM while in Test mode. //! //! \note Test Mode must first be enabled to use this function. //! //! \return None. // //***************************************************************************** static inline void CAN_enableMemoryAccessMode(uint32_t base) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 700); } } while(0); // // Set the RAM direct access bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) |= 0x200U; } //***************************************************************************** // //! Disables direct access to the RAM. //! //! \param base is the base address of the CAN controller. //! //! Disables direct access to the RAM while in Test mode. //! //! \return None. // //***************************************************************************** static inline void CAN_disableMemoryAccessMode(uint32_t base) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 725); } } while(0); // // Clear the RAM direct access bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) &= ~0x200U; } //***************************************************************************** // //! Sets the interruption debug mode of the CAN controller. //! //! \param base is the base address of the CAN controller. //! \param enable is a flag to enable or disable the interruption debug mode. //! //! This function sets the interruption debug mode of the CAN controller. When //! the \e enable parameter is \b true, CAN will be configured to interrupt any //! transmission or reception and enter debug mode immediately after it is //! requested. When \b false, CAN will wait for a started transmission or //! reception to be completed before entering debug mode. //! //! \return None. // //***************************************************************************** static inline void CAN_setInterruptionDebugMode(uint32_t base, _Bool enable) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 755); } } while(0); if(enable) { // // Enable interrupt debug support // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) |= 0x100U; } else { // // Disable interrupt debug support // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) &= ~0x100U; } } //***************************************************************************** // //! Enables DMA Requests from the CAN controller. //! //! \param base is the base address of the CAN controller to enable. //! //! Enables the CAN controller DMA request lines for each of the 3 interface //! register sets. To actually assert the request line, the DMA Active bit //! must be set in the corresponding interface CMD register. //! //! \return None. // //***************************************************************************** static inline void CAN_enableDMARequests(uint32_t base) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 792); } } while(0); // // Set the DMA enable bits in the control register. // __byte_peripheral_32((uint32_t *)(base + 0x0U)) |= (0x40000U | (uint32_t)0x80000U | (uint32_t)0x100000U); } //***************************************************************************** // //! Disables DMA Requests from the CAN controller. //! //! \param base is the base address of the CAN controller to enable. //! //! Disables the CAN controller DMA request lines for each of the 3 interface //! register sets. //! //! \return None. // //***************************************************************************** static inline void CAN_disableDMARequests(uint32_t base) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 819); } } while(0); // // Clear the DMA enable bits in the control register. // __byte_peripheral_32((uint32_t *)(base + 0x0U)) &= ~(0x40000U | (uint32_t)0x80000U | (uint32_t)0x100000U); } //***************************************************************************** // //! Disables Auto-Bus-On. //! //! \param base is the base address of the CAN controller. //! //! Disables the Auto-Bus-On feature of the CAN controller. //! //! \return None. // //***************************************************************************** static inline void CAN_disableAutoBusOn(uint32_t base) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 845); } } while(0); // // Clear the ABO bit in the control register. // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) &= ~0x200U; } //***************************************************************************** // //! Enables Auto-Bus-On. //! //! \param base is the base address of the CAN controller. //! //! Enables the Auto-Bus-On feature of the CAN controller. Be sure to also //! configure the Auto-Bus-On time using the CAN_setAutoBusOnTime function. //! //! \return None. // //***************************************************************************** static inline void CAN_enableAutoBusOn(uint32_t base) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 871); } } while(0); // // Set the ABO bit in the control register. // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) |= 0x200U; } //***************************************************************************** // //! Sets the time before a Bus-Off recovery sequence is started. //! //! \param base is the base address of the CAN controller. //! \param time is number of clock cycles before a Bus-Off recovery sequence //! is started. //! //! This function sets the number of clock cycles before a Bus-Off recovery //! sequence is started by clearing the Init bit. //! //! \note To enable this functionality, use CAN_enableAutoBusOn(). //! //! \return None. // //***************************************************************************** static inline void CAN_setAutoBusOnTime(uint32_t base, uint32_t time) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 901); } } while(0); // // Set bus-off timer value // __byte_peripheral_32((uint32_t *)(base + 0x80U)) = time; } //***************************************************************************** // //! Enables individual CAN controller interrupt sources. //! //! \param base is the base address of the CAN controller. //! \param intFlags is the bit mask of the interrupt sources to be enabled. //! //! Enables specific interrupt sources of the CAN controller. Only enabled //! sources will cause a processor interrupt. //! //! The \e intFlags parameter is the logical OR of any of the following: //! - \b CAN_INT_ERROR - a controller error condition has occurred //! - \b CAN_INT_STATUS - a message transfer has completed, or a bus error has //! been detected //! - \b CAN_INT_IE0 - allow CAN controller to generate interrupts on interrupt //! line 0 //! - \b CAN_INT_IE1 - allow CAN controller to generate interrupts on interrupt //! line 1 //! //! \return None. // //***************************************************************************** static inline void CAN_enableInterrupt(uint32_t base, uint32_t intFlags) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 937); } } while(0); do { if(!((intFlags & ~((0x00000008UL) | (0x00000004UL) | (0x00000002UL) | (0x00020000UL))) == 0U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 939); } } while(0); // // Enable the specified interrupts. // __byte_peripheral_32((uint32_t *)(base + 0x0U)) |= intFlags; } //***************************************************************************** // //! Disables individual CAN controller interrupt sources. //! //! \param base is the base address of the CAN controller. //! \param intFlags is the bit mask of the interrupt sources to be disabled. //! //! Disables the specified CAN controller interrupt sources. Only enabled //! interrupt sources can cause a processor interrupt. //! //! The \e intFlags parameter has the same definition as in the //! CAN_enableInterrupt() function. //! //! \return None. // //***************************************************************************** static inline void CAN_disableInterrupt(uint32_t base, uint32_t intFlags) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 969); } } while(0); do { if(!((intFlags & ~((0x00000008UL) | (0x00000004UL) | (0x00000002UL) | (0x00020000UL))) == 0U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 971); } } while(0); // // Disable the specified interrupts. // __byte_peripheral_32((uint32_t *)(base + 0x0U)) &= ~(intFlags); } //***************************************************************************** // //! Get the CAN controller Interrupt Line set for each mailbox //! //! \param base is the base address of the CAN controller. //! //! Gets which interrupt line each message object should assert when an //! interrupt occurs. Bit 0 corresponds to message object 32 and then bits //! 1 to 31 correspond to message object 1 through 31 respectively. Bits that //! are asserted indicate the message object should generate an interrupt on //! interrupt line 1, while bits that are not asserted indicate the message //! object should generate an interrupt on line 0. //! //! \return Returns the value of the interrupt muxing register. // //***************************************************************************** static inline uint32_t CAN_getInterruptMux(uint32_t base) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 1001); } } while(0); // // Get the interrupt muxing for the CAN peripheral // return(__byte_peripheral_32((uint32_t *)(base + 0xD8U))); } //***************************************************************************** // //! Set the CAN controller Interrupt Line for each mailbox //! //! \param base is the base address of the CAN controller. //! \param mux bit packed representation of which message objects should //! generate an interrupt on a given interrupt line. //! //! Selects which interrupt line each message object should assert when an //! interrupt occurs. Bit 0 corresponds to message object 32 and then bits //! 1 to 31 correspond to message object 1 through 31 respectively. Bits that //! are asserted indicate the message object should generate an interrupt on //! interrupt line 1, while bits that are not asserted indicate the message //! object should generate an interrupt on line 0. //! //! \return None. // //***************************************************************************** static inline void CAN_setInterruptMux(uint32_t base, uint32_t mux) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 1033); } } while(0); // // Set the interrupt muxing for the CAN peripheral // __byte_peripheral_32((uint32_t *)(base + 0xD8U)) = mux; } //***************************************************************************** // //! Enables the CAN controller automatic retransmission behavior. //! //! \param base is the base address of the CAN controller. //! //! Enables the automatic retransmission of messages with detected errors. //! //! \return None. // //***************************************************************************** static inline void CAN_enableRetry(uint32_t base) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 1058); } } while(0); // // Clearing the DAR bit tells the controller to not disable the // auto-retry of messages which were not transmitted or received // correctly. // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) &= ~0x20U; } //***************************************************************************** // //! Disables the CAN controller automatic retransmission behavior. //! //! \param base is the base address of the CAN controller. //! //! Disables the automatic retransmission of messages with detected errors. //! //! \return None. // //***************************************************************************** static inline void CAN_disableRetry(uint32_t base) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 1085); } } while(0); // // Setting the DAR bit tells the controller to disable the auto-retry // of messages which were not transmitted or received correctly. // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) |= 0x20U; } //***************************************************************************** // //! Returns the current setting for automatic retransmission. //! //! \param base is the base address of the CAN controller. //! //! Reads the current setting for the automatic retransmission in the CAN //! controller and returns it to the caller. //! //! \return Returns \b true if automatic retransmission is enabled, \b false //! otherwise. // //***************************************************************************** static inline _Bool CAN_isRetryEnabled(uint32_t base) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 1113); } } while(0); // // Read the disable automatic retry setting from the CAN controller. // return((_Bool)(((*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) & 0x20U) != 0x20U)); } //***************************************************************************** // //! Reads the CAN controller error counter register. //! //! \param base is the base address of the CAN controller. //! \param rxCount is a pointer to storage for the receive error counter. //! \param txCount is a pointer to storage for the transmit error counter. //! //! Reads the error counter register and returns the transmit and receive error //! counts to the caller along with a flag indicating if the controller receive //! counter has reached the error passive limit. The values of the receive and //! transmit error counters are returned through the pointers provided as //! parameters. //! //! After this call, \e rxCount will hold the current receive error count //! and \e txCount will hold the current transmit error count. //! //! \return Returns \b true if the receive error count has reached the error //! passive limit, and \b false if the error count is below the error passive //! limit. // //***************************************************************************** static inline _Bool CAN_getErrorCount(uint32_t base, uint32_t *rxCount, uint32_t *txCount) { uint32_t canError = 0U; // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 1151); } } while(0); // // Read the current count of transmit/receive errors. // canError = __byte_peripheral_32((uint32_t *)(base + 0x8U)); // // Extract the error numbers from the register value. // *rxCount = (canError & 0x7F00U) >> 8U; *txCount = (canError & 0xFFU) >> 0U; return((_Bool)((canError & 0x8000U) != 0U)); } //***************************************************************************** // //! Reads the CAN controller error and status register. //! //! \param base is the base address of the CAN controller. //! //! Reads the error and status register of the CAN controller. //! //! \return Returns the value of the register. // //***************************************************************************** static inline uint16_t CAN_getStatus(uint32_t base) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 1184); } } while(0); // // Return error and status register value // return((*((volatile uint16_t *)((uintptr_t)(base + 0x4U))))); } //***************************************************************************** // //! Reads the CAN controller TX request register. //! //! \param base is the base address of the CAN controller. //! //! Reads the TX request register of the CAN controller. //! //! \return Returns the value of the register. // //***************************************************************************** static inline uint32_t CAN_getTxRequests(uint32_t base) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 1209); } } while(0); // // Return Tx requests register value // return(__byte_peripheral_32((uint32_t *)(base + 0x88U))); } //***************************************************************************** // //! Reads the CAN controller new data status register. //! //! \param base is the base address of the CAN controller. //! //! Reads the new data status register of the CAN controller for all message //! objects. //! //! \return Returns the value of the register. // //***************************************************************************** static inline uint32_t CAN_getNewDataFlags(uint32_t base) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 1235); } } while(0); // // Return new data register value // return(__byte_peripheral_32((uint32_t *)(base + 0x9CU))); } //***************************************************************************** // //! Reads the CAN controller valid message object register. //! //! \param base is the base address of the CAN controller. //! //! Reads the valid message object register of the CAN controller. //! //! \return Returns the value of the register. // //***************************************************************************** static inline uint32_t CAN_getValidMessageObjects(uint32_t base) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 1260); } } while(0); // // Return the valid message register value // return(__byte_peripheral_32((uint32_t *)(base + 0xC4U))); } //***************************************************************************** // //! Get the CAN controller interrupt cause. //! //! \param base is the base address of the CAN controller. //! //! This function returns the value of the interrupt register that indicates //! the cause of the interrupt. //! //! \return Returns the value of the interrupt register. // //***************************************************************************** static inline uint32_t CAN_getInterruptCause(uint32_t base) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 1286); } } while(0); // // Read interrupt identifier status // return(__byte_peripheral_32((uint32_t *)(base + 0x10U))); } //***************************************************************************** // //! Get the CAN controller pending interrupt message source. //! //! \param base is the base address of the CAN controller. //! //! Returns the value of the pending interrupts register that indicates //! which messages are the source of pending interrupts. //! //! \return Returns the value of the pending interrupts register. // //***************************************************************************** static inline uint32_t CAN_getInterruptMessageSource(uint32_t base) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 1312); } } while(0); // // Read message object interrupt status // return(__byte_peripheral_32((uint32_t *)(base + 0xB0U))); } //***************************************************************************** // //! CAN Global interrupt Enable function. //! //! \param base is the base address of the CAN controller. //! \param intFlags is the bit mask of the interrupt sources to be enabled. //! //! Enables specific CAN interrupt in the global interrupt enable register //! //! The \e intFlags parameter is the logical OR of any of the following: //! - \b CAN_GLOBAL_INT_CANINT0 - Global Interrupt Enable bit for CAN INT0 //! - \b CAN_GLOBAL_INT_CANINT1 - Global Interrupt Enable bit for CAN INT1 //! //! \return None. // //***************************************************************************** static inline void CAN_enableGlobalInterrupt(uint32_t base, uint16_t intFlags) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 1342); } } while(0); do { if(!((intFlags & ~((0x00000001U) | (0x00000002U))) == 0U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 1344); } } while(0); // // Enable the requested interrupts // (*((volatile uint16_t *)((uintptr_t)(base + 0x50U)))) |= intFlags; } //***************************************************************************** // //! CAN Global interrupt Disable function. //! //! \param base is the base address of the CAN controller. //! \param intFlags is the bit mask of the interrupt sources to be disabled. //! //! Disables the specific CAN interrupt in the global interrupt enable register //! //! The \e intFlags parameter is the logical OR of any of the following: //! - \b CAN_GLOBAL_INT_CANINT0 - Global Interrupt bit for CAN INT0 //! - \b CAN_GLOBAL_INT_CANINT1 - Global Interrupt bit for CAN INT1 //! //! \return None. // //***************************************************************************** static inline void CAN_disableGlobalInterrupt(uint32_t base, uint16_t intFlags) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 1374); } } while(0); do { if(!((intFlags & ~((0x00000001U) | (0x00000002U))) == 0U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 1376); } } while(0); // // Disable the requested interrupts // (*((volatile uint16_t *)((uintptr_t)(base + 0x50U)))) &= ~intFlags; } //***************************************************************************** // //! CAN Global interrupt Clear function. //! //! \param base is the base address of the CAN controller. //! \param intFlags is the bit mask of the interrupt sources to be cleared. //! //! Clear the specific CAN interrupt bit in the global interrupt flag register. //! //! The \e intFlags parameter is the logical OR of any of the following: //! - \b CAN_GLOBAL_INT_CANINT0 - Global Interrupt bit for CAN INT0 //! - \b CAN_GLOBAL_INT_CANINT1 - Global Interrupt bit for CAN INT1 //! //! \return None. // //***************************************************************************** static inline void CAN_clearGlobalInterruptStatus(uint32_t base, uint16_t intFlags) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 1406); } } while(0); do { if(!((intFlags & ~((0x00000001U) | (0x00000002U))) == 0U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 1408); } } while(0); // // Clear the requested interrupts // (*((volatile uint16_t *)((uintptr_t)(base + 0x58U)))) |= intFlags; } //***************************************************************************** // //! Get the CAN Global Interrupt status. //! //! \param base is the base address of the CAN controller. //! \param intFlags is the bit mask of the interrupt sources to be enabled. //! //! Check if any interrupt bit is set in the global interrupt flag register. //! //! The \e intFlags parameter is the logical OR of any of the following: //! - \b CAN_GLOBAL_INT_CANINT0 - Global Interrupt bit for CAN INT0 //! - \b CAN_GLOBAL_INT_CANINT1 - Global Interrupt bit for CAN INT1 //! //! \return True if any of the requested interrupt bits are set. False, if //! none of the requested bits are set. // //***************************************************************************** static inline _Bool CAN_getGlobalInterruptStatus(uint32_t base, uint16_t intFlags) { // // Check the arguments. // do { if(!(CAN_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 1439); } } while(0); do { if(!((intFlags & ~((0x00000001U) | (0x00000002U))) == 0U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/can.h", 1441); } } while(0); // // Read and return the global interrupt flag register // return((_Bool)(((*((volatile uint16_t *)((uintptr_t)(base + 0x54U)))) & intFlags) != 0U)); } //***************************************************************************** // //! Initializes the CAN controller //! //! \param base is the base address of the CAN controller. //! //! This function initializes the message RAM, which also clears all the //! message objects, and places the CAN controller in an init state. Write //! access to the configuration registers is available as a result, allowing //! the bit timing and message objects to be setup. //! //! \note To exit the initialization mode and start the CAN module, use the //! CAN_startModule() function. //! //! \return None. // //***************************************************************************** extern void CAN_initModule(uint32_t base); //***************************************************************************** // //! Sets the CAN Bit Timing based on requested Bit Rate. //! //! \param base is the base address of the CAN controller. //! \param clock is the CAN module clock frequency before the bit rate //! prescaler (Hertz) //! \param bitRate is the desired bit rate (bits/sec) //! \param bitTime is the number of time quanta per bit required for desired //! bit time (Tq) and must be in the range from 8 to 25 //! //! This function sets the CAN bit timing values for the bit rate passed in the //! \e bitRate and \e bitTime parameters based on the \e clock parameter. The //! CAN bit clock is calculated to be an average timing value that should work //! for most systems. If tighter timing requirements are needed, then the //! CAN_setBitTiming() function is available for full customization of all of //! the CAN bit timing values. //! //! \note The CANBTR register values calculated by the function CAN_setBitRate //! may not be suitable for your network parameters. If this is the case //! and you have computed the correct values for your network, you could //! directly write those parameters in CANBTR register using the //! function CAN_setBitTiming. //! //! \return None. // //***************************************************************************** extern void CAN_setBitRate(uint32_t base, uint32_t clock, uint32_t bitRate, uint16_t bitTime); //***************************************************************************** // //! Manually set the CAN controller bit timing. //! //! \param base is the base address of the CAN controller. //! \param prescaler is the baud rate prescaler //! \param prescalerExtension is the baud rate prescaler extension //! \param tSeg1 is the time segment 1 //! \param tSeg2 is the time segment 2 //! \param sjw is the synchronization jump width //! //! This function sets the various timing parameters for the CAN bus bit //! timing: baud rate prescaler, prescaler extension, time segment 1, //! time segment 2, and the Synchronization Jump Width. //! //! \return None. // //***************************************************************************** extern void CAN_setBitTiming(uint32_t base, uint16_t prescaler, uint16_t prescalerExtension, uint16_t tSeg1, uint16_t tSeg2, uint16_t sjw); //***************************************************************************** // //! Clears a CAN interrupt source. //! //! \param base is the base address of the CAN controller. //! \param intClr is a value indicating which interrupt source to clear. //! //! This function can be used to clear a specific interrupt source. The //! \e intClr parameter should be either a number from 1 to 32 to clear a //! specific message object interrupt or can be the following: //! - \b CAN_INT_INT0ID_STATUS - Clears a status interrupt. //! //! It is not necessary to use this function to clear an interrupt. This //! should only be used if the application wants to clear an interrupt source //! without taking the normal interrupt action. //! //! \return None. // //***************************************************************************** extern void CAN_clearInterruptStatus(uint32_t base, uint32_t intClr); //***************************************************************************** // //! Setup a Message Object //! //! \param base is the base address of the CAN controller. //! \param objID is the message object number to configure (1-32). //! \param msgID is the CAN message identifier used for the 11 or 29 bit //! identifiers //! \param frame is the CAN ID frame type //! \param msgType is the message object type //! \param msgIDMask is the CAN message identifier mask used when identifier //! filtering is enabled //! \param flags is the various flags and settings to be set for the message //! object //! \param msgLen is the number of bytes of data in the message object (0-8) //! //! This function sets the various values required for a message object. //! //! The \e frame parameter can be one of the following values: //! - \b CAN_MSG_FRAME_STD - Standard 11 bit identifier //! - \b CAN_MSG_FRAME_EXT - Extended 29 bit identifier //! //! The \e msgType parameter can be one of the following values: //! - \b CAN_MSG_OBJ_TYPE_TX - Transmit Message //! - \b CAN_MSG_OBJ_TYPE_TX_REMOTE - Transmit Remote Message //! - \b CAN_MSG_OBJ_TYPE_RX - Receive Message //! - \b CAN_MSG_OBJ_TYPE_RXTX_REMOTE - Receive Remote message with //! auto-transmit //! //! The \e flags parameter can be set as \b CAN_MSG_OBJ_NO_FLAGS if no flags //! are required or the parameter can be a logical OR of any of the following //! values: //! - \b CAN_MSG_OBJ_TX_INT_ENABLE - Enable Transmit Interrupts //! - \b CAN_MSG_OBJ_RX_INT_ENABLE - Enable Receive Interrupts //! - \b CAN_MSG_OBJ_USE_ID_FILTER - Use filtering based on the Message ID //! - \b CAN_MSG_OBJ_USE_EXT_FILTER - Use filtering based on the Extended //! Message ID //! - \b CAN_MSG_OBJ_USE_DIR_FILTER - Use filtering based on the direction of //! the transfer //! - \b CAN_MSG_OBJ_FIFO - Message object is part of a FIFO //! structure and isn't the final message //! object in FIFO //! //! If filtering is based on message identifier, the value //! \b CAN_MSG_OBJ_USE_ID_FILTER has to be logically ORed with the \e flag //! parameter and \b CAN_MSG_OBJ_USE_EXT_FILTER also has to be ORed for //! message identifier filtering to be based on the extended identifier. //! //! \note The \b msgLen Parameter for the Receive Message Object is a "don't //! care" but its value should be between 0-8 due to the assert. //! //! \return None. // //***************************************************************************** extern void CAN_setupMessageObject(uint32_t base, uint32_t objID, uint32_t msgID, CAN_MsgFrameType frame, CAN_MsgObjType msgType, uint32_t msgIDMask, uint32_t flags, uint16_t msgLen); //***************************************************************************** // //! Sends a Message Object //! //! \param base is the base address of the CAN controller. //! \param objID is the object number to configure (1-32). //! \param msgLen is the number of bytes of data in the message object (0-8) //! \param msgData is a pointer to the message object's data //! //! This function is used to transmit a message object and the message data, //! if applicable. //! //! \note The message object requested by the \e objID must first be setup //! using the CAN_setupMessageObject() function. //! //! \return None. // //***************************************************************************** extern void CAN_sendMessage(uint32_t base, uint32_t objID, uint16_t msgLen, const uint16_t *msgData); //***************************************************************************** // //! Reads the data in a Message Object //! //! \param base is the base address of the CAN controller. //! \param objID is the object number to read (1-32). //! \param msgData is a pointer to the array to store the message data //! //! This function is used to read the data contents of the specified message //! object in the CAN controller. The data returned is stored in the //! \e msgData parameter. //! //! \note //! -# The message object requested by the \e objID must first be setup //! using the CAN_setupMessageObject() function. //! -# If the DLC of the received message is larger than the \e msgData //! buffer provided, then it is possible for a buffer overflow to occur. //! //! \return Returns \b true if new data was retrieved, else returns //! \b false to indicate no new data was retrieved. // //***************************************************************************** extern _Bool CAN_readMessage(uint32_t base, uint32_t objID, uint16_t *msgData); //***************************************************************************** // //! Transfers a CAN message between the IF registers and Message RAM. //! //! \param base is the base address of the CAN controller. //! \param interface is the interface to use for the transfer. Valid value are //! 1 or 2. //! \param objID is the object number to transfer (1-32). //! \param direction is the of the transfer. False is Message RAM to IF, True //! is IF to Message RAM. //! \param dmaRequest asserts the DMA request line after a transfer if //! set to True. //! //! This function transfers the contents of the interface registers to message //! RAM or vice versa depending on the value passed to direction. This //! function is designed to be used with DMA transfers. //! //! \return None. // //***************************************************************************** extern void CAN_transferMessage(uint32_t base, uint16_t interface, uint32_t objID, _Bool direction, _Bool dmaRequest); //***************************************************************************** // //! Clears a message object so that it is no longer used. //! //! \param base is the base address of the CAN controller. //! \param objID is the message object number to disable (1-32). //! //! This function frees the specified message object from use. Once a message //! object has been cleared, it will no longer automatically send or //! receive messages, or generate interrupts. //! //! \return None. // //***************************************************************************** extern void CAN_clearMessage(uint32_t base, uint32_t objID); //***************************************************************************** // // Close the Doxygen group. //! @} // //***************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //########################################################################### // // FILE: cla.h // // TITLE: CLA Driver Implementation File // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup cla_api CLA //! \brief This module is used for configurating CLA. //! @{ // //***************************************************************************** //########################################################################### // // FILE: hw_cla.h // // TITLE: Definitions for the CLA registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the CLA register offsets // //***************************************************************************** // MVECTBGRND. // Register // ground task. // ground task. // task. // Register // Register // Register // Register 0 // Register 1 // Register 2 // Register 3 //***************************************************************************** // // The following are defines for the bit fields in the MCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SOFTINTEN register // //***************************************************************************** // or End of Task interrupt. // or End of Task interrupt. // or End of Task interrupt. // or End of Task interrupt. // or End of Task interrupt. // or End of Task interrupt. // or End of Task interrupt. // or End of Task interrupt. //***************************************************************************** // // The following are defines for the bit fields in the _MSTSBGRND register // //***************************************************************************** // bit. // task can be interrupted. // trigger overflow. //***************************************************************************** // // The following are defines for the bit fields in the _MCTLBGRND register // //***************************************************************************** // trigger enable //***************************************************************************** // // The following are defines for the bit fields in the MIFR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the MIOVF register // //***************************************************************************** // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag //***************************************************************************** // // The following are defines for the bit fields in the MIFRC register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the MICLR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the MICLROVF register // //***************************************************************************** // Flag Clear // Flag Clear // Flag Clear // Flag Clear // Flag Clear // Flag Clear // Flag Clear // Flag Clear //***************************************************************************** // // The following are defines for the bit fields in the MIER register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the MIRUN register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the _MSTF register // //***************************************************************************** // Mode //***************************************************************************** // // The following are defines for the bit fields in the _MPSACTL register // //***************************************************************************** // every cycle or when PAB // changes. // every cycle. //***************************************************************************** // // Useful defines used within the driver functions. Not intended for use by // application code. // //***************************************************************************** //***************************************************************************** // //! Values that can be passed to CLA_getBackgroundTaskStatus() as the //! \e stsFlag parameter. // //***************************************************************************** typedef enum { //! Run status CLA_BGSTS_RUNNING = 0x1U, //! Can BG task be interrupted? CLA_BGSTS_CANNOT_INTERRUPT = 0x2U, //! BG task hardware trigger overflow - if a second trigger occurs //! while the BG is already running, the overflow is set CLA_BGSTS_OVERFLOW = 0x4U } CLA_BGTaskStatus; //***************************************************************************** // // Values that can be passed to CLA_clearTaskFlags(), CLA_forceTasks(), // and CLA_enableTasks(), CLA_disableTasks(), and CLA_enableSoftwareInterrupt() // as the taskFlags parameter. // //***************************************************************************** //***************************************************************************** // //! Values that can be passed to CLA_getPendingTaskFlag(), //! CLA_getTaskOverflowFlag(), CLA_getTaskRunStatus(), CLA_setTriggerSource(), //! CLA_registerEndOfTaskInterrupt(), and CLA_unregisterEndOfTaskInterrupt() //! as the taskNumber parameter. // //***************************************************************************** typedef enum { CLA_TASK_1, //!< CLA Task 1 CLA_TASK_2, //!< CLA Task 2 CLA_TASK_3, //!< CLA Task 3 CLA_TASK_4, //!< CLA Task 4 CLA_TASK_5, //!< CLA Task 5 CLA_TASK_6, //!< CLA Task 6 CLA_TASK_7, //!< CLA Task 7 CLA_TASK_8 //!< CLA Task 8 } CLA_TaskNumber; //***************************************************************************** // //! Values that can be passed to CLA_mapTaskVector() as the \e claIntVect //! parameter. // //***************************************************************************** typedef enum { CLA_MVECT_1 = 0x0U, //!< Task Interrupt Vector 1 CLA_MVECT_2 = 0x1U, //!< Task Interrupt Vector 2 CLA_MVECT_3 = 0x2U, //!< Task Interrupt Vector 3 CLA_MVECT_4 = 0x3U, //!< Task Interrupt Vector 4 CLA_MVECT_5 = 0x4U, //!< Task Interrupt Vector 5 CLA_MVECT_6 = 0x5U, //!< Task Interrupt Vector 6 CLA_MVECT_7 = 0x6U, //!< Task Interrupt Vector 7 CLA_MVECT_8 = 0x7U //!< Task Interrupt Vector 8 } CLA_MVECTNumber; //***************************************************************************** // //! Values that can be passed to CLA_setTriggerSource() as the \e trigger //! parameter. // //***************************************************************************** typedef enum { CLA_TRIGGER_SOFTWARE = 0U, //!< CLA Task Trigger Source is Software CLA_TRIGGER_ADCA1 = 1U, //!< CLA Task Trigger Source is ADCA1 CLA_TRIGGER_ADCA2 = 2U, //!< CLA Task Trigger Source is ADCA2 CLA_TRIGGER_ADCA3 = 3U, //!< CLA Task Trigger Source is ADCA3 CLA_TRIGGER_ADCA4 = 4U, //!< CLA Task Trigger Source is ADCA4 CLA_TRIGGER_ADCAEVT = 5U, //!< CLA Task Trigger Source is ADCAEVT CLA_TRIGGER_ADCB1 = 6U, //!< CLA Task Trigger Source is ADCB1 CLA_TRIGGER_ADCB2 = 7U, //!< CLA Task Trigger Source is ADCB2 CLA_TRIGGER_ADCB3 = 8U, //!< CLA Task Trigger Source is ADCB3 CLA_TRIGGER_ADCB4 = 9U, //!< CLA Task Trigger Source is ADCB4 CLA_TRIGGER_ADCBEVT = 10U, //!< CLA Task Trigger Source is ADCBEVT CLA_TRIGGER_ADCC1 = 11U, //!< CLA Task Trigger Source is ADCC1 CLA_TRIGGER_ADCC2 = 12U, //!< CLA Task Trigger Source is ADCC2 CLA_TRIGGER_ADCC3 = 13U, //!< CLA Task Trigger Source is ADCC3 CLA_TRIGGER_ADCC4 = 14U, //!< CLA Task Trigger Source is ADCC4 CLA_TRIGGER_ADCCEVT = 15U, //!< CLA Task Trigger Source is ADCCEVT CLA_TRIGGER_ADCD1 = 16U, //!< CLA Task Trigger Source is ADCD1 CLA_TRIGGER_ADCD2 = 17U, //!< CLA Task Trigger Source is ADCD2 CLA_TRIGGER_ADCD3 = 18U, //!< CLA Task Trigger Source is ADCD3 CLA_TRIGGER_ADCD4 = 19U, //!< CLA Task Trigger Source is ADCD4 CLA_TRIGGER_ADCDEVT = 20U, //!< CLA Task Trigger Source is ADCDEVT CLA_TRIGGER_XINT1 = 29U, //!< CLA Task Trigger Source is XINT1 CLA_TRIGGER_XINT2 = 30U, //!< CLA Task Trigger Source is XINT2 CLA_TRIGGER_XINT3 = 31U, //!< CLA Task Trigger Source is XINT3 CLA_TRIGGER_XINT4 = 32U, //!< CLA Task Trigger Source is XINT4 CLA_TRIGGER_XINT5 = 33U, //!< CLA Task Trigger Source is XINT5 CLA_TRIGGER_EPWM1INT = 36U, //!< CLA Task Trigger Source is EPWM1INT CLA_TRIGGER_EPWM2INT = 37U, //!< CLA Task Trigger Source is EPWM2INT CLA_TRIGGER_EPWM3INT = 38U, //!< CLA Task Trigger Source is EPWM3INT CLA_TRIGGER_EPWM4INT = 39U, //!< CLA Task Trigger Source is EPWM4INT CLA_TRIGGER_EPWM5INT = 40U, //!< CLA Task Trigger Source is EPWM5INT CLA_TRIGGER_EPWM6INT = 41U, //!< CLA Task Trigger Source is EPWM6INT CLA_TRIGGER_EPWM7INT = 42U, //!< CLA Task Trigger Source is EPWM7INT CLA_TRIGGER_EPWM8INT = 43U, //!< CLA Task Trigger Source is EPWM8INT CLA_TRIGGER_EPWM9INT = 44U, //!< CLA Task Trigger Source is EPWM9INT CLA_TRIGGER_EPWM10INT = 45U, //!< CLA Task Trigger Source is EPWM10INT CLA_TRIGGER_EPWM11INT = 46U, //!< CLA Task Trigger Source is EPWM11INT CLA_TRIGGER_EPWM12INT = 47U, //!< CLA Task Trigger Source is EPWM12INT CLA_TRIGGER_EPWM13INT = 48U, //!< CLA Task Trigger Source is EPWM13INT CLA_TRIGGER_EPWM14INT = 49U, //!< CLA Task Trigger Source is EPWM14INT CLA_TRIGGER_EPWM15INT = 50U, //!< CLA Task Trigger Source is EPWM15INT CLA_TRIGGER_EPWM16INT = 51U, //!< CLA Task Trigger Source is EPWM16INT CLA_TRIGGER_MCANA_FEVT0 = 52U, //!< CLA Task Trigger Source is MCANAFEVT0 CLA_TRIGGER_MCANA_FEVT1 = 53U, //!< CLA Task Trigger Source is MCANAFEVT1 CLA_TRIGGER_MCANA_FEVT2 = 54U, //!< CLA Task Trigger Source is MCANAFEVT2 CLA_TRIGGER_TINT0 = 68U, //!< CLA Task Trigger Source is TINT0 CLA_TRIGGER_TINT1 = 69U, //!< CLA Task Trigger Source is TINT1 CLA_TRIGGER_TINT2 = 70U, //!< CLA Task Trigger Source is TINT2 CLA_TRIGGER_MXINTA = 71U, //!< CLA Task Trigger Source is MXINTA CLA_TRIGGER_MRINTA = 72U, //!< CLA Task Trigger Source is MRINTA CLA_TRIGGER_MXINTB = 73U, //!< CLA Task Trigger Source is MXINTB CLA_TRIGGER_MRINTB = 74U, //!< CLA Task Trigger Source is MRINTB CLA_TRIGGER_ECAP1INT = 75U, //!< CLA Task Trigger Source is ECAP1INT CLA_TRIGGER_ECAP2INT = 76U, //!< CLA Task Trigger Source is ECAP2INT CLA_TRIGGER_ECAP3INT = 77U, //!< CLA Task Trigger Source is ECAP3INT CLA_TRIGGER_ECAP4INT = 78U, //!< CLA Task Trigger Source is ECAP4INT CLA_TRIGGER_ECAP5INT = 79U, //!< CLA Task Trigger Source is ECAP5INT CLA_TRIGGER_ECAP6INT = 80U, //!< CLA Task Trigger Source is ECAP6INT CLA_TRIGGER_ECAP7INT = 81U, //!< CLA Task Trigger Source is ECAP7INT CLA_TRIGGER_EQEP1INT = 83U, //!< CLA Task Trigger Source is EQEP1INT CLA_TRIGGER_EQEP2INT = 84U, //!< CLA Task Trigger Source is EQEP2INT CLA_TRIGGER_EQEP3INT = 85U, //!< CLA Task Trigger Source is EQEP3INT CLA_TRIGGER_ECAP6INT2 = 92U, //!< CLA Task Trigger Source is ECAP6INT2 CLA_TRIGGER_ECAP7INT2 = 93U, //!< CLA Task Trigger Source is ECAP7INT2 CLA_TRIGGER_SDFM1INT = 95U, //!< CLA Task Trigger Source is SDFM1INT CLA_TRIGGER_SDFM2INT = 96U, //!< CLA Task Trigger Source is SDFM2INT CLA_TRIGGER_ECATSYNC0INT = 103U, //!< CLA Task Trigger Src is ECATSYNC0INT CLA_TRIGGER_ECATSYNC1INT = 104U, //!< CLA Task Trigger Src is ECATSYNC1INT CLA_TRIGGER_PMBUSAINT = 105U, //!< CLA Task Trigger Source is PMBUSAINT CLA_TRIGGER_SPITXAINT = 109U, //!< CLA Task Trigger Source is SPITXAINT CLA_TRIGGER_SPIRXAINT = 110U, //!< CLA Task Trigger Source is SPIRXAINT CLA_TRIGGER_SPITXBINT = 111U, //!< CLA Task Trigger Source is SPITXBINT CLA_TRIGGER_SPIRXBINT = 112U, //!< CLA Task Trigger Source is SPIRXBINT CLA_TRIGGER_SPITXCINT = 113U, //!< CLA Task Trigger Source is SPITXCINT CLA_TRIGGER_SPIRXCINT = 114U, //!< CLA Task Trigger Source is SPIRXCINT CLA_TRIGGER_SPITXDINT = 115U, //!< CLA Task Trigger Source is SPITXDINT CLA_TRIGGER_SPIRXDINT = 116U, //!< CLA Task Trigger Source is SPIRXDINT CLA_TRIGGER_CLA1CRCINT = 121U, //!< CLA Task Trigger Srce is CLA1CRCINT CLA_TRIGGER_FSITXAINT1 = 123U, //!< CLA Task Trigger Source is FSITXAINT1 CLA_TRIGGER_FSITXAINT2 = 124U, //!< CLA Task Trigger Source is FSITXAINT2 CLA_TRIGGER_FSIRXAINT1 = 125U, //!< CLA Task Trigger Source is FSIRXAINT1 CLA_TRIGGER_FSIRXAINT2 = 126U, //!< CLA Task Trigger Source is FSIRXAINT2 CLA_TRIGGER_CLB1INT = 127, //!< CLA Task Trigger Source is CLB1INT CLA_TRIGGER_CLB2INT = 128, //!< CLA Task Trigger Source is CLB2INT CLA_TRIGGER_CLB3INT = 129, //!< CLA Task Trigger Source is CLB3INT CLA_TRIGGER_CLB4INT = 130, //!< CLA Task Trigger Source is CLB4INT CLA_TRIGGER_SDFM1DRINT1 = 143U, //!< CLA Task Trigger Srce is SDFM1DRINT1 CLA_TRIGGER_SDFM1DRINT2 = 144U, //!< CLA Task Trigger Srce is SDFM1DRINT2 CLA_TRIGGER_SDFM1DRINT3 = 145U, //!< CLA Task Trigger Srce is SDFM1DRINT3 CLA_TRIGGER_SDFM1DRINT4 = 146U, //!< CLA Task Trigger Srce is SDFM1DRINT4 CLA_TRIGGER_SDFM2DRINT1 = 147U, //!< CLA Task Trigger Srce is SDFM2DRINT1 CLA_TRIGGER_SDFM2DRINT2 = 148U, //!< CLA Task Trigger Srce is SDFM2DRINT2 CLA_TRIGGER_SDFM2DRINT3 = 149U, //!< CLA Task Trigger Srce is SDFM2DRINT3 CLA_TRIGGER_SDFM2DRINT4 = 150U, //!< CLA Task Trigger Srce is SDFM2DRINT4 CLA_TRIGGER_FSITXBINT1 = 155U, //!< CLA Task Trigger Source is FSITXBINT1 CLA_TRIGGER_FSITXBINT2 = 156U, //!< CLA Task Trigger Source is FSITXBINT2 CLA_TRIGGER_FSIRXBINT1 = 157U, //!< CLA Task Trigger Source is FSIRXBINT1 CLA_TRIGGER_FSIRXBINT2 = 158U, //!< CLA Task Trigger Source is FSIRXBINT2 CLA_TRIGGER_FSIRXCINT1 = 159U, //!< CLA Task Trigger Source is FSIRXCINT1 CLA_TRIGGER_FSIRXCINT2 = 160U, //!< CLA Task Trigger Source is FSIRXCINT2 CLA_TRIGGER_FSIRXDINT1 = 161U, //!< CLA Task Trigger Source is FSIRXDINT1 CLA_TRIGGER_FSIRXDINT2 = 162U, //!< CLA Task Trigger Source is FSIRXDINT2 CLA_TRIGGER_FSIRXEINT1 = 163U, //!< CLA Task Trigger Source is FSIRXEINT1 CLA_TRIGGER_FSIRXEINT2 = 164U, //!< CLA Task Trigger Source is FSIRXEINT2 CLA_TRIGGER_FSIRXFINT1 = 165U, //!< CLA Task Trigger Source is FSIRXFINT1 CLA_TRIGGER_FSIRXFINT2 = 166U, //!< CLA Task Trigger Source is FSIRXFINT2 CLA_TRIGGER_FSIRXGINT1 = 167U, //!< CLA Task Trigger Source is FSIRXGINT1 CLA_TRIGGER_FSIRXGINT2 = 168U, //!< CLA Task Trigger Source is FSIRXGINT2 CLA_TRIGGER_FSIRXHINT1 = 169U, //!< CLA Task Trigger Source is FSIRXHINT1 CLA_TRIGGER_FSIRXHINT2 = 170U //!< CLA Task Trigger Source is FSIRXHINT2 } CLA_Trigger; //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** //***************************************************************************** // //! \internal //! Checks a CLA base address. //! //! \param base is the base address of the CLA controller. //! //! This function determines if a CLA controller base address is valid. //! //! \return Returns \b true if the base address is valid and \b false //! otherwise. // //***************************************************************************** static inline _Bool CLA_isBaseValid(uint32_t base) { return(base == 0x00001400U); } //***************************************************************************** // //! Map CLA Task Interrupt Vector //! //! \param base is the base address of the CLA controller. //! \param claIntVect is CLA interrupt vector (MVECT1 to MVECT8) //! the value of claIntVect can be any of the following: //! - \b CLA_MVECT_1 - Task Interrupt Vector 1 //! - \b CLA_MVECT_2 - Task Interrupt Vector 2 //! - \b CLA_MVECT_3 - Task Interrupt Vector 3 //! - \b CLA_MVECT_4 - Task Interrupt Vector 4 //! - \b CLA_MVECT_5 - Task Interrupt Vector 5 //! - \b CLA_MVECT_6 - Task Interrupt Vector 6 //! - \b CLA_MVECT_7 - Task Interrupt Vector 7 //! - \b CLA_MVECT_8 - Task Interrupt Vector 8 //! \param claTaskAddr is the start address of the code for task //! //! Each CLA Task (1 to 8) has its own MVECTx register. When a task is //! triggered, the CLA loads the MVECTx register of the task in question //! to the MPC (CLA program counter) and begins execution from that point. //! The CLA has a 16-bit address bus, and can therefore, access the lower //! 64 KW space. The MVECTx registers take an address anywhere in this space. //! //! \return None. // //***************************************************************************** static inline void CLA_mapTaskVector(uint32_t base, CLA_MVECTNumber claIntVect, uint16_t claTaskAddr) { // // Check the arguments. // do { if(!(CLA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cla.h", 355); } } while(0); // // Modify protected register // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + (uint16_t)claIntVect)))) = claTaskAddr; __edis(); } //***************************************************************************** // //! Hard Reset //! //! \param base is the base address of the CLA controller. //! //! This function will cause a hard reset of the CLA and set all CLA registers //! to their default state. //! //! \return None. // //***************************************************************************** static inline void CLA_performHardReset(uint32_t base) { // // Check the arguments. // do { if(!(CLA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cla.h", 385); } } while(0); // // Modify protected register // __eallow(); // // Hard reset of the CLA // (*((volatile uint16_t *)((uintptr_t)(base + 0x10U)))) |= 0x1U; __edis(); // // Wait for few cycles till the reset is complete // __asm(" NOP"); __asm(" NOP"); __asm(" NOP"); } //***************************************************************************** // //! Soft Reset //! //! \param base is the base address of the CLA controller. //! //! This function will cause a soft reset of the CLA. This will stop the //! current task, clear the MIRUN flag and clear all bits in the MIER register. //! //! \return None. // //***************************************************************************** static inline void CLA_performSoftReset(uint32_t base) { // // Check the arguments. // do { if(!(CLA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cla.h", 425); } } while(0); // // Modify protected register // __eallow(); // // Soft reset of the CLA // (*((volatile uint16_t *)((uintptr_t)(base + 0x10U)))) |= 0x2U; __edis(); // // Wait for few cycles till the reset is complete // __asm(" NOP"); __asm(" NOP"); __asm(" NOP"); } //***************************************************************************** // //! IACK enable //! //! \param base is the base address of the CLA controller. //! //! This function enables the main CPU to use the IACK #16bit instruction to //! set MIFR bits in the same manner as writing to the MIFRC register. //! //! \return None. // //***************************************************************************** static inline void CLA_enableIACK(uint32_t base) { // // Check the arguments. // do { if(!(CLA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cla.h", 465); } } while(0); // // Modify protected register // __eallow(); // // Enable the main CPU to use the IACK #16bit instruction // (*((volatile uint16_t *)((uintptr_t)(base + 0x10U)))) |= 0x4U; __edis(); } //***************************************************************************** // //! IACK disable //! //! \param base is the base address of the CLA controller. //! //! This function disables the main CPU to use the IACK #16bit instruction to //! set MIFR bits in the same manner as writing to the MIFRC register. //! //! \return None. // //***************************************************************************** static inline void CLA_disableIACK(uint32_t base) { // // Check the arguments. // do { if(!(CLA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cla.h", 498); } } while(0); // // Modify protected register // __eallow(); // // Enable the main CPU to use the IACK #16bit instruction // (*((volatile uint16_t *)((uintptr_t)(base + 0x10U)))) &= ~0x4U; __edis(); } //***************************************************************************** // //! Query task N to see if it is flagged and pending execution //! //! \param base is the base address of the CLA controller. //! \param taskNumber is the number of the task CLA_TASK_N where N is a number //! from 1 to 8. Do not use CLA_TASKFLAG_ALL. //! //! This function gets the status of each bit in the interrupt flag register //! corresponds to a CLA task. The corresponding bit is automatically set //! when the task is triggered (either from a peripheral, through software, or //! through the MIFRC register). The bit gets cleared when the CLA starts to //! execute the flagged task. //! //! \return \b True if the queried task has been triggered but pending //! execution. // //***************************************************************************** static inline _Bool CLA_getPendingTaskFlag(uint32_t base, CLA_TaskNumber taskNumber) { // // Check the arguments. // do { if(!(CLA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cla.h", 537); } } while(0); // // Read the run status register and return the appropriate value. // return((((*((volatile uint16_t *)((uintptr_t)(base + 0x20U)))) >> (uint16_t)taskNumber) & 1U) != 0U); } //***************************************************************************** // //! Get status of All Task Interrupt Flag //! //! \param base is the base address of the CLA controller. //! //! This function gets the value of the interrupt flag register (MIFR) //! //! \return the value of Interrupt Flag Register (MIFR) // //***************************************************************************** static inline uint16_t CLA_getAllPendingTaskFlags(uint32_t base) { uint16_t status; // // Check the arguments. // do { if(!(CLA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cla.h", 564); } } while(0); // // Just return the Interrupt Flag Register (MIFR) since that is what was // requested. // status = (*((volatile uint16_t *)((uintptr_t)(base + 0x20U)))); // // Return the Interrupt Flag Register value // return(status); } //***************************************************************************** // //! Get status of Task n Interrupt Overflow Flag //! //! \param base is the base address of the CLA controller. //! \param taskNumber is the number of the task CLA_TASK_N where N is a number //! from 1 to 8. Do not use CLA_TASKFLAG_ALL. //! //! This function gets the status of each bit in the overflow flag register //! corresponds to a CLA task, This bit is set when an interrupt overflow event //! has occurred for the specific task. //! //! \return True if any of task interrupt overflow has occurred. // //***************************************************************************** static inline _Bool CLA_getTaskOverflowFlag(uint32_t base, CLA_TaskNumber taskNumber) { // // Check the arguments. // do { if(!(CLA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cla.h", 599); } } while(0); // // Read the run status register and return the appropriate value. // return((((*((volatile uint16_t *)((uintptr_t)(base + 0x21U)))) >> (uint16_t)taskNumber) & 1U) != 0U); } //***************************************************************************** // //! Get status of All Task Interrupt Overflow Flag //! //! \param base is the base address of the CLA controller. //! //! This function gets the value of the Interrupt Overflow Flag Register //! //! \return the value of Interrupt Overflow Flag Register(MIOVF) // //***************************************************************************** static inline uint16_t CLA_getAllTaskOverflowFlags(uint32_t base) { uint16_t status; // // Check the arguments. // do { if(!(CLA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cla.h", 626); } } while(0); // // Just return Interrupt Overflow Flag Register(MIOVF) since that is what // was requested. // status = (*((volatile uint16_t *)((uintptr_t)(base + 0x21U)))); // // Return the Interrupt Overflow Flag Register // return(status); } //***************************************************************************** // //! Clear the task interrupt flag //! //! \param base is the base address of the CLA controller. //! \param taskFlags is the bitwise OR of the tasks' flags to be cleared //! CLA_TASKFLAG_N where N is the task number from 1 to 8, or CLA_TASKFLAG_ALL //! to clear all flags. //! //! This function is used to manually clear bits in the interrupt //! flag (MIFR) register //! //! \return None. // //***************************************************************************** static inline void CLA_clearTaskFlags(uint32_t base, uint16_t taskFlags) { // // Check the arguments. // do { if(!(CLA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cla.h", 661); } } while(0); // //Modify protected register // __eallow(); // // Clear the task interrupt flag // (*((volatile uint16_t *)((uintptr_t)(base + 0x23U)))) |= taskFlags; __edis(); } //***************************************************************************** // //! Force a CLA Task //! //! \param base is the base address of the CLA controller. //! \param taskFlags is the bitwise OR of the tasks' flags to be forced //! CLA_TASKFLAG_N where N is the task number from 1 to 8, or CLA_TASKFLAG_ALL //! to force all tasks. //! //! This function forces a task through software. //! //! \return None. // //***************************************************************************** static inline void CLA_forceTasks(uint32_t base, uint16_t taskFlags) { // // Check the arguments. // do { if(!(CLA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cla.h", 696); } } while(0); // // Modify protected register // __eallow(); // // Force the task interrupt. // (*((volatile uint16_t *)((uintptr_t)(base + 0x22U)))) |= taskFlags; __edis(); } //***************************************************************************** // //! Enable CLA task(s) //! //! \param base is the base address of the CLA controller. //! \param taskFlags is the bitwise OR of the tasks' flags to be enabled //! CLA_TASKFLAG_N where N is the task number from 1 to 8, or CLA_TASKFLAG_ALL //! to enable all tasks //! //! This function allows an incoming interrupt or main CPU software to //! start the corresponding CLA task. //! //! \return None. // //***************************************************************************** static inline void CLA_enableTasks(uint32_t base, uint16_t taskFlags) { // // Check the arguments. // do { if(!(CLA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cla.h", 732); } } while(0); // // Modify protected register // __eallow(); // // Enable CLA task // (*((volatile uint16_t *)((uintptr_t)(base + 0x25U)))) |= taskFlags; __edis(); } //***************************************************************************** // //! Disable CLA task interrupt //! //! \param base is the base address of the CLA controller. //! \param taskFlags is the bitwise OR of the tasks' flags to be disabled //! CLA_TASKFLAG_N where N is the task number from 1 to 8, or CLA_TASKFLAG_ALL //! to disable all tasks //! //! This function disables CLA task interrupt by setting the MIER register bit //! to 0, while the corresponding task is executing this will have no effect //! on the task. The task will continue to run until it hits the MSTOP //! instruction. //! //! \return None. // //***************************************************************************** static inline void CLA_disableTasks(uint32_t base, uint16_t taskFlags) { // // Check the arguments. // do { if(!(CLA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cla.h", 770); } } while(0); // // Modify protected register // __eallow(); // // Disable CLA task interrupt // (*((volatile uint16_t *)((uintptr_t)(base + 0x25U)))) &= ~taskFlags; __edis(); } //***************************************************************************** // //! Get the value of a task run status //! //! \param base is the base address of the CLA controller. //! \param taskNumber is the number of the task CLA_TASK_N where N is a number //! from 1 to 8. Do not use CLA_TASKFLAG_ALL. //! //! This function gets the status of each bit in the Interrupt Run Status //! Register which indicates whether the task is currently executing //! //! \return True if the task is executing. // //***************************************************************************** static inline _Bool CLA_getTaskRunStatus(uint32_t base, CLA_TaskNumber taskNumber) { // // Check the arguments. // do { if(!(CLA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cla.h", 805); } } while(0); // // Read the run status register and return the appropriate value. // return((((*((volatile uint16_t *)((uintptr_t)(base + 0x26U)))) >> (uint16_t)taskNumber) & 1U) != 0U); } //***************************************************************************** // //! Get the value of all task run status //! //! \param base is the base address of the CLA controller. //! //! This function indicates which task is currently executing. //! //! \return the value of Interrupt Run Status Register (MIRUN) // //***************************************************************************** static inline uint16_t CLA_getAllTaskRunStatus(uint32_t base) { uint16_t status; // // Check the arguments. // do { if(!(CLA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cla.h", 832); } } while(0); // // Just return the Interrupt Run Status Register since that is what was // requested. // status = (*((volatile uint16_t *)((uintptr_t)(base + 0x26U)))); // // Return the Interrupt Run Status Register (MIRUN) // return(status); } //***************************************************************************** // //! Get the value of Active register for MVECTBGRNDACTIVE //! //! \param base is the base address of the CLA controller. //! //! This function gives the current interrupted MPC value of the background //! task. //! //! \return the value of Active register for the Background Task Vector // //***************************************************************************** static inline uint16_t CLA_getBackgroundActiveVector(uint32_t base) { uint16_t status; // // Check the arguments. // do { if(!(CLA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cla.h", 865); } } while(0); // // Just return the Active register for the Background Task Vector since // that is what was requested. // status = (*((volatile uint16_t *)((uintptr_t)(base + 0x1BU)))); // // Return the value of Active register for the Background Task Vector // return(status); } //***************************************************************************** // //! Enable the background task //! //! \param base is the base address of the CLA controller. //! //! This function enables the background task //! //! \return None. // //***************************************************************************** static inline void CLA_enableBackgroundTask(uint32_t base) { // // Check the arguments. // do { if(!(CLA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cla.h", 896); } } while(0); // // Modify protected register // __eallow(); // // Enable background task // (*((volatile uint16_t *)((uintptr_t)(base + 0x1EU)))) |= 0x8000U; __edis(); } //***************************************************************************** // //! Disable background task //! //! \param base is the base address of the CLA controller. //! //! This function disables the background task //! //! \return None. // //***************************************************************************** static inline void CLA_disableBackgroundTask(uint32_t base) { // // Check the arguments. // do { if(!(CLA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cla.h", 928); } } while(0); // // Modify protected register // __eallow(); // // Disables background task // (*((volatile uint16_t *)((uintptr_t)(base + 0x1EU)))) &= ~0x8000U; __edis(); } //***************************************************************************** // //! Start background task //! //! \param base is the base address of the CLA controller. //! //! This function will start the background task, provided there are no other //! pending tasks. //! //! \return None. // //***************************************************************************** static inline void CLA_startBackgroundTask(uint32_t base) { // // Check the arguments. // do { if(!(CLA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cla.h", 961); } } while(0); // // Modify protected register // __eallow(); // // Start background task // (*((volatile uint16_t *)((uintptr_t)(base + 0x1EU)))) |= 0x1U; __edis(); } //***************************************************************************** // //! Enable background task hardware trigger //! //! \param base is the base address of the CLA controller. //! //! This function enables hardware trigger for background task //! \note Trigger source for the background task will be MPERINT8.1. //! //! \return None. // //***************************************************************************** static inline void CLA_enableHardwareTrigger(uint32_t base) { // // Check the arguments. // do { if(!(CLA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cla.h", 994); } } while(0); // // Modify protected register // __eallow(); // // Enable background task hardware trigger // (*((volatile uint16_t *)((uintptr_t)(base + 0x1EU)))) |= 0x2U; __edis(); } //***************************************************************************** // //! Disable background task hardware trigger //! //! \param base is the base address of the CLA controller. //! //! This function disables hardware trigger for background task //! //! \return None. // //***************************************************************************** static inline void CLA_disableHardwareTrigger(uint32_t base) { // // Check the arguments. // do { if(!(CLA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cla.h", 1026); } } while(0); // // Modify protected register // __eallow(); // // Disables hardware trigger for background task // (*((volatile uint16_t *)((uintptr_t)(base + 0x1EU)))) &= ~0x2U; __edis(); } //***************************************************************************** // //! Map background task vector //! //! \param base is the base address of the CLA controller. //! \param claTaskAddr is the start address of the code for task //! //! This function specifies the start address for the background task //! //! \return None. // //***************************************************************************** static inline void CLA_mapBackgroundTaskVector(uint32_t base, uint16_t claTaskAddr) { // // Check the arguments. // do { if(!(CLA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cla.h", 1059); } } while(0); // // Modify protected register // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x1FU)))) = (uint16_t)claTaskAddr; __edis(); } //***************************************************************************** // //! Get Status register for the back ground task. //! //! \param base is the base address of the CLA controller. //! \param stsFlag is status item to be returned. //! //! The value of \e stsFlag can be any of the following: //! - \b CLA_BGSTS_RUNNING //! - \b CLA_BGSTS_CANNOT_INTERRUPT //! - \b CLA_BGSTS_OVERFLOW //! //! This function gets the status of background task //! //! \return Based on the value of \e stsFlag, the function will return: //! - \b CLA_BGSTS_RUNNING - The function will return \b true if the background //! task is running. //! - \b CLA_BGSTS_CANNOT_INTERRUPT - The function will return \b true if the //! background task will not be interrupted (when MSETC BGINTM is executed). //! - \b CLA_BGSTS_OVERFLOW - This function will return \b true if an enabled //! hardware trigger occurred while _MCTLBGRND.BGSTART is set. // //***************************************************************************** static inline _Bool CLA_getBackgroundTaskStatus(uint32_t base, CLA_BGTaskStatus stsFlag) { // // Check the arguments. // do { if(!(CLA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cla.h", 1100); } } while(0); do { if(!((stsFlag == CLA_BGSTS_RUNNING) || (stsFlag == CLA_BGSTS_CANNOT_INTERRUPT) || (stsFlag == CLA_BGSTS_OVERFLOW))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cla.h", 1103); } } while(0); // // Return the background task status value // return(((*((volatile uint16_t *)((uintptr_t)(base + 0x1DU)))) & (uint16_t)stsFlag) != 0U); } // // These functions are accessible only from the CLA (Type - 1/2) // // // These functions can only be called from the C28x // //***************************************************************************** // //! Configures CLA task triggers. //! //! \param taskNumber is the number of the task CLA_TASK_N where N is a number //! from 1 to 8. //! \param trigger is the trigger source to be assigned to the selected task. //! //! This function configures the trigger source of a CLA task. The //! \e taskNumber parameter indicates which task is being configured, and the //! \e trigger parameter is the interrupt source from a specific peripheral //! interrupt (or software) that will trigger the task. //! //! \return None. // //***************************************************************************** extern void CLA_setTriggerSource(CLA_TaskNumber taskNumber, CLA_Trigger trigger); //***************************************************************************** // // Close the Doxygen group. //! @} // //***************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //########################################################################### // // FILE: clb.h // // TITLE: C28x CLB driver. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup clb_api CLB //! @{ // //***************************************************************************** //########################################################################### // // FILE: hw_clb.h // // TITLE: Definitions for the CLB registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the CLB register offsets // //***************************************************************************** // and Unit 0 // of Unit 1 and 0 // of Unit 2 // Unit 0 // Unit 1 // Unit 2 // the High Level controller // and match2 outputs // for output 0 // for output 1 // for output 2 // for output 3 // for output 4 // for output 5 // for output 6 // for output 7 // enable control // High // enable control // both edge detection and // synchronizers // between Signals and GP register // mux // mux // CELL inputs // inputs // inputs // final asynchronous outputs // the Cell //***************************************************************************** // // The following are defines for the bit fields in the CLB_COUNT_RESET register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_COUNT_MODE_1 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_COUNT_MODE_0 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_COUNT_EVENT register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_FSM_EXTRA_IN0 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_FSM_EXTERNAL_IN0 register // //***************************************************************************** // unit 0 // unit 1 // unit 2 //***************************************************************************** // // The following are defines for the bit fields in the CLB_FSM_EXTERNAL_IN1 register // //***************************************************************************** // unit 0 // unit 1 // unit 2 //***************************************************************************** // // The following are defines for the bit fields in the CLB_FSM_EXTRA_IN1 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_LUT4_IN0 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_LUT4_IN1 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_LUT4_IN2 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_LUT4_IN3 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_FSM_LUT_FN1_0 register // //***************************************************************************** // unit 0 // unit 1 //***************************************************************************** // // The following are defines for the bit fields in the CLB_FSM_LUT_FN2 register // //***************************************************************************** // unit 2 //***************************************************************************** // // The following are defines for the bit fields in the CLB_LUT4_FN1_0 register // //***************************************************************************** // 0 // 1 //***************************************************************************** // // The following are defines for the bit fields in the CLB_LUT4_FN2 register // //***************************************************************************** // 2 //***************************************************************************** // // The following are defines for the bit fields in the CLB_FSM_NEXT_STATE_0 register // //***************************************************************************** // S0 // S1 //***************************************************************************** // // The following are defines for the bit fields in the CLB_FSM_NEXT_STATE_1 register // //***************************************************************************** // S0 // S1 //***************************************************************************** // // The following are defines for the bit fields in the CLB_FSM_NEXT_STATE_2 register // //***************************************************************************** // S0 // S1 //***************************************************************************** // // The following are defines for the bit fields in the CLB_MISC_CONTROL register // //***************************************************************************** // 0 // 1 // 2 // 0 // 1 // 2 // 0 // 1 // 2 //***************************************************************************** // // The following are defines for the bit fields in the CLB_OUTPUT_LUT_0 register // //***************************************************************************** // output LUT // output LUT // output LUT // LUT //***************************************************************************** // // The following are defines for the bit fields in the CLB_OUTPUT_LUT_1 register // //***************************************************************************** // output LUT // output LUT // output LUT // LUT //***************************************************************************** // // The following are defines for the bit fields in the CLB_OUTPUT_LUT_2 register // //***************************************************************************** // output LUT // output LUT // output LUT // LUT //***************************************************************************** // // The following are defines for the bit fields in the CLB_OUTPUT_LUT_3 register // //***************************************************************************** // output LUT // output LUT // output LUT // LUT //***************************************************************************** // // The following are defines for the bit fields in the CLB_OUTPUT_LUT_4 register // //***************************************************************************** // output LUT // output LUT // output LUT // LUT //***************************************************************************** // // The following are defines for the bit fields in the CLB_OUTPUT_LUT_5 register // //***************************************************************************** // output LUT // output LUT // output LUT // LUT //***************************************************************************** // // The following are defines for the bit fields in the CLB_OUTPUT_LUT_6 register // //***************************************************************************** // output LUT // output LUT // output LUT // LUT //***************************************************************************** // // The following are defines for the bit fields in the CLB_OUTPUT_LUT_7 register // //***************************************************************************** // output LUT // output LUT // output LUT // LUT //***************************************************************************** // // The following are defines for the bit fields in the CLB_HLC_EVENT_SEL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_COUNT_MATCH_TAP_SEL register // //***************************************************************************** // 0 // 1 // 2 // 0 // 1 // 2 //***************************************************************************** // // The following are defines for the bit fields in the CLB_OUTPUT_COND_CTRL_0 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_OUTPUT_COND_CTRL_1 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_OUTPUT_COND_CTRL_2 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_OUTPUT_COND_CTRL_3 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_OUTPUT_COND_CTRL_4 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_OUTPUT_COND_CTRL_5 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_OUTPUT_COND_CTRL_6 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_OUTPUT_COND_CTRL_7 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_MISC_ACCESS_CTRL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_SPI_DATA_CTRL_HI register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_LOAD_EN register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_LOAD_ADDR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_INPUT_FILTER register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_IN_MUX_SEL_0 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_LCL_MUX_SEL_1 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_LCL_MUX_SEL_2 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_BUF_PTR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_GP_REG register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_GLBL_MUX_SEL_1 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_GLBL_MUX_SEL_2 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_PRESCALE_CTRL register // //***************************************************************************** // generator // operation //***************************************************************************** // // The following are defines for the bit fields in the CLB_INTR_TAG_REG register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_LOCK register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_HLC_INSTR_READ_PTR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_HLC_INSTR_VALUE register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_DBG_OUT_2 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CLB_DBG_OUT register // //***************************************************************************** //***************************************************************************** // // Address offsets from LOGICCFG to LOGICCTL and DATAEXCH register memory maps // //***************************************************************************** //***************************************************************************** // // Address offsets for CLB-internal memory space // //***************************************************************************** //***************************************************************************** // // PUSH/PULL FIFO size (32-bit registers) // //***************************************************************************** //***************************************************************************** // // Key to enable writes to the CLB registers // //***************************************************************************** //***************************************************************************** // // Shift and masks needed by the API for Input selection // //***************************************************************************** //***************************************************************************** // //! Values that can be passed to control the CLB output enable signal. It can //! be passed to CLB_setOutputMask() as the \e outputMask parameter. // //***************************************************************************** //***************************************************************************** // //! Values that can be passed to select CLB input signal // //***************************************************************************** typedef enum { CLB_IN0 = 0, //!< Input 0 CLB_IN1 = 1, //!< Input 1 CLB_IN2 = 2, //!< Input 2 CLB_IN3 = 3, //!< Input 3 CLB_IN4 = 4, //!< Input 4 CLB_IN5 = 5, //!< Input 5 CLB_IN6 = 6, //!< Input 6 CLB_IN7 = 7 //!< Input 7 } CLB_Inputs; //***************************************************************************** // //! Values that can be passed to select CLB output signal. It can be passed to //! CLB_configOutputLUT() as the \e outID parameter. // //***************************************************************************** typedef enum { CLB_OUT0 = 0, //!< Output 0 CLB_OUT1 = 1, //!< Output 1 CLB_OUT2 = 2, //!< Output 2 CLB_OUT3 = 3, //!< Output 3 CLB_OUT4 = 4, //!< Output 4 CLB_OUT5 = 5, //!< Output 5 CLB_OUT6 = 6, //!< Output 6 CLB_OUT7 = 7 //!< Output 7 } CLB_Outputs; //***************************************************************************** // //! Values that can be passed to select CLB counter. It can be passed to //! CLB_configCounterLoadMatch() as the \e counterID parameter. // //***************************************************************************** typedef enum { CLB_CTR0 = 0, //!< Counter 0 CLB_CTR1 = 1, //!< Counter 1 CLB_CTR2 = 2 //!< Counter 2 } CLB_Counters; //***************************************************************************** // //! Values that can be passed to CLB_getRegisters() as the \e registerID //! parameter. // //***************************************************************************** typedef enum { CLB_REG_HLC_R0 = 0x30U, //!< HLC R0 register CLB_REG_HLC_R1 = 0x32U, //!< HLC R1 register CLB_REG_HLC_R2 = 0x34U, //!< HLC R2 register CLB_REG_HLC_R3 = 0x36U, //!< HLC R3 register CLB_REG_CTR_C0 = 0x38U, //!< Counter 0 register CLB_REG_CTR_C1 = 0x3AU, //!< Counter 1 register CLB_REG_CTR_C2 = 0x3CU //!< Counter 2 register } CLB_Register; //***************************************************************************** // //! Values that can be passed to CLB_selectInputFilter() as the \e filterType //! parameter. // //***************************************************************************** typedef enum { CLB_FILTER_NONE = 0, //!< No filtering CLB_FILTER_RISING_EDGE = 1, //!< Rising edge detect CLB_FILTER_FALLING_EDGE = 2, //!< Falling edge detect CLB_FILTER_ANY_EDGE = 3 //!< Any edge detect } CLB_FilterType; //***************************************************************************** // //! Values that can be passed to CLB_configGPInputMux() as the \e gpMuxCfg //! parameter. // //***************************************************************************** typedef enum { CLB_GP_IN_MUX_EXTERNAL = 0, //!< Use external input path CLB_GP_IN_MUX_GP_REG = 1 //!< Use CLB_GP_REG bit value as input } CLB_GPInputMux; //***************************************************************************** // //! Values that can be passed to CLB_configLocalInputMux() as the //! \e localMuxCfg parameter. // //***************************************************************************** typedef enum { CLB_LOCAL_IN_MUX_GLOBAL_IN = 0, //!< Global input mux selection CLB_LOCAL_IN_MUX_EPWM_DCAEVT1 = 1, //!< EPWMx DCAEVT1 CLB_LOCAL_IN_MUX_EPWM_DCAEVT2 = 2, //!< EPWMx DCAEVT2 CLB_LOCAL_IN_MUX_EPWM_DCBEVT1 = 3, //!< EPWMx DCBEVT1 CLB_LOCAL_IN_MUX_EPWM_DCBEVT2 = 4, //!< EPWMx DCBEVT2 CLB_LOCAL_IN_MUX_EPWM_DCAH = 5, //!< EPWMx DCAH CLB_LOCAL_IN_MUX_EPWM_DCAL = 6, //!< EPWMx DCAL CLB_LOCAL_IN_MUX_EPWM_DCBH = 7, //!< EPWMx DCBH CLB_LOCAL_IN_MUX_EPWM_DCBL = 8, //!< EPWMx DCBL CLB_LOCAL_IN_MUX_EPWM_OST = 9, //!< EPWMx OST CLB_LOCAL_IN_MUX_EPWM_CBC = 10, //!< EPWMx CBC CLB_LOCAL_IN_MUX_ECAP_ECAPIN = 11, //!< ECAPx ECAPIN CLB_LOCAL_IN_MUX_ECAP_ECAP_OUT = 12, //!< ECAPx ECAP_OUT CLB_LOCAL_IN_MUX_ECAP_ECAP_OUT_EN = 13, //!< ECAPx ECAP_OUT_EN CLB_LOCAL_IN_MUX_ECAP_CEVT1 = 14, //!< ECAPx CEVT1 CLB_LOCAL_IN_MUX_ECAP_CEVT2 = 15, //!< ECAPx CEVT2 CLB_LOCAL_IN_MUX_ECAP_CEVT3 = 16, //!< ECAPx CEVT3 CLB_LOCAL_IN_MUX_ECAP_CEVT4 = 17, //!< ECAPx CEVT4 CLB_LOCAL_IN_MUX_EQEP_EQEPA = 18, //!< EQEPx EQEPA CLB_LOCAL_IN_MUX_EQEP_EQEPB = 19, //!< EQEPx EQEPB (CLB 1-4) CLB_LOCAL_IN_MUX_EQEP_EQEPI = 20, //!< EQEPx EQEPI (CLB 1-4) CLB_LOCAL_IN_MUX_EQEP_EQEPS = 21, //!< EQEPx EQEPS (CLB 1-4) CLB_LOCAL_IN_MUX_CPU1_TBCLKSYNC = 22, //!< CPU1.TBCLKSYNC CLB_LOCAL_IN_MUX_CPU2_TBCLKSYNC = 23, //!< CPU2.TBCLKSYNC CLB_LOCAL_IN_MUX_CPU1_HALT = 24, //!< CPU1.HALT CLB_LOCAL_IN_MUX_CPU2_HALT = 25, //!< CPU2.HALT } CLB_LocalInputMux; //***************************************************************************** // //! Values that can be passed to CLB_configGlobalInputMux() as the //! \e globalMuxCfg parameter. // //***************************************************************************** typedef enum { CLB_GLOBAL_IN_MUX_EPWM1A = 0, //!< EPWM1A CLB_GLOBAL_IN_MUX_EPWM1A_OE = 1, //!< EPWM1A trip output CLB_GLOBAL_IN_MUX_EPWM1B = 2, //!< EPWM1B CLB_GLOBAL_IN_MUX_EPWM1B_OE = 3, //!< EPWM1B trip output CLB_GLOBAL_IN_MUX_EPWM1_CTR_ZERO = 4, //!< EPWM1 TBCTR = Zero CLB_GLOBAL_IN_MUX_EPWM1_CTR_PRD = 5, //!< EPWM1 TBCTR = TBPRD CLB_GLOBAL_IN_MUX_EPWM1_CTRDIR = 6, //!< EPWM1 CTRDIR CLB_GLOBAL_IN_MUX_EPWM1_TBCLK = 7, //!< EPWM1 TBCLK CLB_GLOBAL_IN_MUX_EPWM1_CTR_CMPA = 8, //!< EPWM1 TBCTR = CMPA CLB_GLOBAL_IN_MUX_EPWM1_CTR_CMPB = 9, //!< EPWM1 TBCTR = CMPB CLB_GLOBAL_IN_MUX_EPWM1_CTR_CMPC = 10, //!< EPWM1 TBCTR = CMPC CLB_GLOBAL_IN_MUX_EPWM1_CTR_CMPD = 11, //!< EPWM1 TBCTR = CMPD CLB_GLOBAL_IN_MUX_EPWM1A_AQ = 12, //!< EPWM1A AQ submodule output CLB_GLOBAL_IN_MUX_EPWM1B_AQ = 13, //!< EPWM1B AQ submodule output CLB_GLOBAL_IN_MUX_EPWM1A_DB = 14, //!< EPWM1A DB submodule output CLB_GLOBAL_IN_MUX_EPWM1B_DB = 15, //!< EPWM1B DB submodule output CLB_GLOBAL_IN_MUX_EPWM2A = 16, //!< EPWM2A CLB_GLOBAL_IN_MUX_EPWM2A_OE = 17, //!< EPWM2A trip output CLB_GLOBAL_IN_MUX_EPWM2B = 18, //!< EPWM2B CLB_GLOBAL_IN_MUX_EPWM2B_OE = 19, //!< EPWM2B trip output CLB_GLOBAL_IN_MUX_EPWM2_CTR_ZERO = 20, //!< EPWM2 TBCTR = Zero CLB_GLOBAL_IN_MUX_EPWM2_CTR_PRD = 21, //!< EPWM2 TBCTR = TBPRD CLB_GLOBAL_IN_MUX_EPWM2_CTRDIR = 22, //!< EPWM2 CTRDIR CLB_GLOBAL_IN_MUX_EPWM2_TBCLK = 23, //!< EPWM2 TBCLK CLB_GLOBAL_IN_MUX_EPWM2_CTR_CMPA = 24, //!< EPWM2 TBCTR = CMPA CLB_GLOBAL_IN_MUX_EPWM2_CTR_CMPB = 25, //!< EPWM2 TBCTR = CMPB CLB_GLOBAL_IN_MUX_EPWM2_CTR_CMPC = 26, //!< EPWM2 TBCTR = CMPC CLB_GLOBAL_IN_MUX_EPWM2_CTR_CMPD = 27, //!< EPWM2 TBCTR = CMPD CLB_GLOBAL_IN_MUX_EPWM2A_AQ = 28, //!< EPWM2A AQ submodule output CLB_GLOBAL_IN_MUX_EPWM2B_AQ = 29, //!< EPWM2B AQ submodule output CLB_GLOBAL_IN_MUX_EPWM2A_DB = 30, //!< EPWM2A DB submodule output CLB_GLOBAL_IN_MUX_EPWM2B_DB = 31, //!< EPWM2B DB submodule output CLB_GLOBAL_IN_MUX_EPWM3A = 32, //!< EPWM3A CLB_GLOBAL_IN_MUX_EPWM3A_OE = 33, //!< EPWM3A trip output CLB_GLOBAL_IN_MUX_EPWM3B = 34, //!< EPWM3B CLB_GLOBAL_IN_MUX_EPWM3B_OE = 35, //!< EPWM3B trip output CLB_GLOBAL_IN_MUX_EPWM3_CTR_ZERO = 36, //!< EPWM3 TBCTR = Zero CLB_GLOBAL_IN_MUX_EPWM3_CTR_PRD = 37, //!< EPWM3 TBCTR = TBPRD CLB_GLOBAL_IN_MUX_EPWM3_CTRDIR = 38, //!< EPWM3 CTRDIR CLB_GLOBAL_IN_MUX_EPWM3_TBCLK = 39, //!< EPWM3 TBCLK CLB_GLOBAL_IN_MUX_EPWM3_CTR_CMPA = 40, //!< EPWM3 TBCTR = CMPA CLB_GLOBAL_IN_MUX_EPWM3_CTR_CMPB = 41, //!< EPWM3 TBCTR = CMPB CLB_GLOBAL_IN_MUX_EPWM3_CTR_CMPC = 42, //!< EPWM3 TBCTR = CMPC CLB_GLOBAL_IN_MUX_EPWM3_CTR_CMPD = 43, //!< EPWM3 TBCTR = CMPD CLB_GLOBAL_IN_MUX_EPWM3A_AQ = 44, //!< EPWM3A AQ submodule output CLB_GLOBAL_IN_MUX_EPWM3B_AQ = 45, //!< EPWM3B AQ submodule output CLB_GLOBAL_IN_MUX_EPWM3A_DB = 46, //!< EPWM3A DB submodule output CLB_GLOBAL_IN_MUX_EPWM3B_DB = 47, //!< EPWM3B DB submodule output CLB_GLOBAL_IN_MUX_EPWM4A = 48, //!< EPWM4A CLB_GLOBAL_IN_MUX_EPWM4A_OE = 49, //!< EPWM4A trip output CLB_GLOBAL_IN_MUX_EPWM4B = 50, //!< EPWM4B CLB_GLOBAL_IN_MUX_EPWM4B_OE = 51, //!< EPWM4B trip output CLB_GLOBAL_IN_MUX_EPWM4_CTR_ZERO = 52, //!< EPWM4 TBCTR = Zero CLB_GLOBAL_IN_MUX_EPWM4_CTR_PRD = 53, //!< EPWM4 TBCTR = TBPRD CLB_GLOBAL_IN_MUX_EPWM4_CTRDIR = 54, //!< EPWM4 CTRDIR CLB_GLOBAL_IN_MUX_EPWM4_TBCLK = 55, //!< EPWM4 TBCLK CLB_GLOBAL_IN_MUX_EPWM4_CTR_CMPA = 56, //!< EPWM4 TBCTR = CMPA CLB_GLOBAL_IN_MUX_EPWM4_CTR_CMPB = 57, //!< EPWM4 TBCTR = CMPB CLB_GLOBAL_IN_MUX_EPWM4_CTR_CMPC = 58, //!< EPWM4 TBCTR = CMPC CLB_GLOBAL_IN_MUX_EPWM4_CTR_CMPD = 59, //!< EPWM4 TBCTR = CMPD CLB_GLOBAL_IN_MUX_EPWM4A_AQ = 60, //!< EPWM4A AQ submodule output CLB_GLOBAL_IN_MUX_EPWM4B_AQ = 61, //!< EPWM4B AQ submodule output CLB_GLOBAL_IN_MUX_EPWM4A_DB = 62, //!< EPWM4A DB submodule output CLB_GLOBAL_IN_MUX_EPWM4B_DB = 63, //!< EPWM4B DB submodule output CLB_GLOBAL_IN_MUX_CLB_AUXSIG0 = 64, //!< CLB X-BAR AUXSIG0 CLB_GLOBAL_IN_MUX_CLB_AUXSIG1 = 65, //!< CLB X-BAR AUXSIG1 CLB_GLOBAL_IN_MUX_CLB_AUXSIG2 = 66, //!< CLB X-BAR AUXSIG2 CLB_GLOBAL_IN_MUX_CLB_AUXSIG3 = 67, //!< CLB X-BAR AUXSIG3 CLB_GLOBAL_IN_MUX_CLB_AUXSIG4 = 68, //!< CLB X-BAR AUXSIG4 CLB_GLOBAL_IN_MUX_CLB_AUXSIG5 = 69, //!< CLB X-BAR AUXSIG5 CLB_GLOBAL_IN_MUX_CLB_AUXSIG6 = 70, //!< CLB X-BAR AUXSIG6 CLB_GLOBAL_IN_MUX_CLB_AUXSIG7 = 71 //!< CLB X-BAR AUXSIG7 } CLB_GlobalInputMux; //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** // //! //! Checks the CLB base address. //! //! \param base is the base address of a CLB tile's logic config register. //! //! This function determines if a CLB base address is valid. //! //! \return Returns \b true if the base address is valid and \b false //! otherwise. // //***************************************************************************** static inline _Bool CLB_isBaseValid(uint32_t base) { return((base == 0x00003000U) || (base == 0x00003200U) || (base == 0x00003400U) || (base == 0x00003600U)); } //***************************************************************************** // //! //! Checks the CLB internal memory address. //! //! \param base is the base address of a CLB tile's logic config register. //! //! This function determines if a CLB base address is valid. //! //! \return Returns \b true if the address is valid and \b false otherwise. // //***************************************************************************** static inline _Bool CLB_isAddressValid(uint32_t address) { return(address <= (0x20U + 31U)); } //***************************************************************************** // //! Set global enable. //! //! \param base is the base address of a CLB tile's logic config register. //! //! This function enables the CLB via global enable register. //! //! \return None. // //***************************************************************************** static inline void CLB_enableCLB(uint32_t base) { do { if(!(CLB_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/clb.h", 435); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0100U + 0x0U)))) |= 0x2U; __edis(); } //***************************************************************************** // //! Enable CLB lock. //! //! \param base is the base address of a CLB tile's logic config register. //! //! This function enables the lock bit of the lock register. The lock can only //! be set once and can only be cleared by a device reset. //! //! \return None. // //***************************************************************************** static inline void CLB_enableLock(uint32_t base) { do { if(!(CLB_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/clb.h", 456); } } while(0); // // Setting the lock bit requires key 0x5A5A to be written at the same time // __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0x0100U + 0x22U)))) = (uint32_t)0x1U | ((uint32_t)0x5A5AU << 16U); __edis(); } //***************************************************************************** // //! Write value to address. //! //! \param base is the base address of a CLB tile's logic config register. //! \param address is the address of CLB internal memory. //! \param value is the value to write to specified address. //! //! This function writes the specified value to CLB internal memory. //! //! \return None. // //***************************************************************************** static inline void CLB_writeInterface(uint32_t base, uint32_t address, uint32_t value) { do { if(!(CLB_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/clb.h", 483); } } while(0); do { if(!(CLB_isAddressValid(address))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/clb.h", 484); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0x0100U + 0x2U)))) = address; (*((volatile uint32_t *)((uintptr_t)(base + 0x0100U + 0x4U)))) = value; (*((volatile uint32_t *)((uintptr_t)(base + 0x0100U + 0x0U)))) |= 0x1U; __edis(); } //***************************************************************************** // //! Select input filter type. //! //! \param base is the base address of a CLB tile's logic config register. //! \param inID is the specified CLB tile input signal. //! \param filterType is the selected type of filter applied to the input. //! //! This function configures the filter selection for the specified input. //! The \e inID parameter can have one enumeration value from CLB_Inputs. //! The \e filterType parameter can have one enumeration value from //! CLB_FilterType. //! //! \return None. // //***************************************************************************** static inline void CLB_selectInputFilter(uint32_t base, CLB_Inputs inID, CLB_FilterType filterType) { uint16_t shiftVal; do { if(!(CLB_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/clb.h", 514); } } while(0); // // Each input has a 2-bit field in this register so need to calculate // shift amount accordingly. // shiftVal = (uint16_t)inID << 1; (*((volatile uint16_t *)((uintptr_t)(base + 0x0100U + 0x6U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x0100U + 0x6U)))) & ~(0x3U << shiftVal)) | ((uint16_t)filterType << shiftVal); } //***************************************************************************** // //! Enables synchronization of an input signal. //! //! \param base is the base address of a CLB tile's logic config register. //! \param inID is the specified CLB tile input signal. //! //! This function enables synchronization on the specified input signal. //! The \e inID parameter can have one enumeration value from CLB_Inputs. //! //! \return None. // //***************************************************************************** static inline void CLB_enableSynchronization(uint32_t base, CLB_Inputs inID) { do { if(!(CLB_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/clb.h", 543); } } while(0); (*((volatile uint16_t *)((uintptr_t)(base + 0x0100U + 0x6U + 1U)))) |= (1U << (uint16_t)inID); } //***************************************************************************** // //! Disables synchronization of an input signal. //! //! \param base is the base address of a CLB tile's logic config register. //! \param inID is the specified CLB tile input signal. //! //! This function disables synchronization on the specified input signal. //! The \e inID parameter can have one enumeration value from CLB_Inputs. //! //! \return None. // //***************************************************************************** static inline void CLB_disableSynchronization(uint32_t base, CLB_Inputs inID) { do { if(!(CLB_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/clb.h", 564); } } while(0); (*((volatile uint16_t *)((uintptr_t)(base + 0x0100U + 0x6U + 1U)))) &= ~(1U << (uint16_t)inID); } //***************************************************************************** // //! Configures the general purpose input mux. //! //! \param base is the base address of a CLB tile's logic config register. //! \param inID is the specified CLB tile input signal. //! \param gpMuxCfg is the mux selection for the general purpose input mux. //! //! This function configures the general purpose input mux. The \e gpMuxCfg //! parameter can select either the use of an external input signal //! (\b CLB_GP_IN_MUX_EXTERNAL) or the use of the corresponding CLB_GP_REG bit //! as an input (\b CLB_GP_IN_MUX_GP_REG). //! The \e inID parameter can have one enumeration value from CLB_Inputs. //! //! \sa CLB_setGPREG() to write to the CLB_GP_REG. //! //! \return None. // //***************************************************************************** static inline void CLB_configGPInputMux(uint32_t base, CLB_Inputs inID, CLB_GPInputMux gpMuxCfg) { do { if(!(CLB_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/clb.h", 592); } } while(0); (*((volatile uint16_t *)((uintptr_t)(base + 0x0100U + 0x8U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x0100U + 0x8U)))) & ~(0x1U << inID)) | (gpMuxCfg << inID); } //***************************************************************************** // //! Sets the CLB_GP_REG register value. //! //! \param base is the base address of a CLB tile's logic config register. //! \param gpRegVal is the value to be written to CLB_GP_REG. //! //! This function writes to the CLB_GP_REG register. When the general purpose //! input mux is configured to use CLB_GP_REG, each bit in \e gpRegVal //! corresponds to an input signal (bit 0 to Input 0, bit 1 to Input 1, and //! so on). //! //! \sa CLB_configGPInputMux() to select the CLB_GP_REG as the source for //! an input signal. //! //! \return None. // //***************************************************************************** static inline void CLB_setGPREG(uint32_t base, uint32_t gpRegVal) { do { if(!(CLB_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/clb.h", 619); } } while(0); (*((volatile uint32_t *)((uintptr_t)(base + 0x0100U + 0x10U)))) = gpRegVal; } //***************************************************************************** // //! Configures the local input mux. //! //! \param base is the base address of a CLB tile's logic config register. //! \param inID is the specified CLB tile input signal. //! \param localMuxCfg is the mux selection for the local input mux. //! //! This function configures the local input mux for the specified input //! signal. //! //! The \e inID parameter can have one enumeration value from CLB_Inputs. //! The \e localMuxCfg parameter can have one enumeration value from //! CLB_LocalInputMux. //! //! \note The local input mux options' peripheral sources depend on which //! instance of the CLB (\e base) you are using. For example, for CLB1 the //! EPWM signal selections come from EPWM1 but for CLB2 they come from EPWM2. //! See your technical reference manual for details. //! //! \return None. // //***************************************************************************** static inline void CLB_configLocalInputMux(uint32_t base, CLB_Inputs inID, CLB_LocalInputMux localMuxCfg) { uint16_t shiftVal; do { if(!(CLB_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/clb.h", 652); } } while(0); // // Each local input has a 5-bit field in this register so need to calculate // shift amount accordingly. // shiftVal = (uint16_t)inID * 5U; if(inID < CLB_IN4) { (*((volatile uint32_t *)((uintptr_t)(base + 0x0100U + 0xAU)))) = ((*((volatile uint32_t *)((uintptr_t)(base + 0x0100U + 0xAU)))) & ~((uint32_t)0x1FU << shiftVal)) | ((uint32_t)localMuxCfg << shiftVal); } else { // // Calculating shift amount for inputs > input3 // shiftVal -= 4U * 5U; (*((volatile uint32_t *)((uintptr_t)(base + 0x0100U + 0xCU)))) = ((*((volatile uint32_t *)((uintptr_t)(base + 0x0100U + 0xCU)))) & ~((uint32_t)0x1FU << shiftVal)) | ((uint32_t)localMuxCfg << shiftVal); } } //***************************************************************************** // //! Configures the global input mux. //! //! \param base is the base address of a CLB tile's logic config register. //! \param inID is the specified CLB tile input signal. //! \param globalMuxCfg is the mux selection for the global input mux. //! //! This function configures the global input mux for the specified input //! signal. //! The \e inID parameter can have one enumeration value from CLB_Inputs. //! The \e globalMuxCfg parameter can have one enumeration value from //! CLB_GlobalInputMux. //! //! \note The global input mux options' peripheral sources depend on which //! instance of the CLB (\e base) you are using. For example, for CLB1 the //! EPWM signal selections come from EPWM1 but for CLB2 they come from EPWM2. //! See your technical reference manual for details. //! //! \return None. // //***************************************************************************** static inline void CLB_configGlobalInputMux(uint32_t base, CLB_Inputs inID, CLB_GlobalInputMux globalMuxCfg) { uint16_t shiftVal; do { if(!(CLB_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/clb.h", 707); } } while(0); // // Each input has a 5-bit field in this register so need to calculate // shift amount accordingly. // shiftVal = (uint16_t)inID * 7U; if(inID < CLB_IN4) { (*((volatile uint32_t *)((uintptr_t)(base + 0x0100U + 0x14U)))) = ((*((volatile uint32_t *)((uintptr_t)(base + 0x0100U + 0x14U)))) & ~((uint32_t)0x7FU << shiftVal)) | ((uint32_t)globalMuxCfg << shiftVal); } else { shiftVal -= 4U * 7U; (*((volatile uint32_t *)((uintptr_t)(base + 0x0100U + 0x16U)))) = ((*((volatile uint32_t *)((uintptr_t)(base + 0x0100U + 0x16U)))) & ~((uint32_t)0x7FU << shiftVal)) | ((uint32_t)globalMuxCfg << shiftVal); } } //***************************************************************************** // //! Controls the output enable. //! //! \param base is the base address of a CLB tile's logic config register. //! \param outputMask is a mask of the outputs to be enabled. //! \param enable is a switch to decide if the CLB outputs need to be enabled //! or not. //! //! This function is used to enable and disable CLB outputs by writing a mask //! to CLB_OUT_EN. Each bit corresponds to a CLB output. When a bit is 1, the //! corresponding output is enabled; when a bit is 0, the output is disabled. //! //! The \e outputMask parameter takes a logical OR of any of the CLB_OUTPUT_0x //! values that correspond to the CLB OUTPUT ENABLE for the respective outputs. //! The \e enable parameter can have one of the values from: //! false: Disable the respective CLB outputs //! true: Enable the respective CLB outputs //! //! \note Note that the 8 CLB outputs are replicated to create more output //! paths. See your technical reference manual for more details. //! If no further modifications are expected, then it is advised to set the //! block writes bit of the MISC_ACCESS_CTRL Register. This will prevent //! accidental writes. //! //! \return None. // //***************************************************************************** static inline void CLB_setOutputMask(uint32_t base, uint32_t outputMask , _Bool enable) { do { if(!(CLB_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/clb.h", 763); } } while(0); if(enable == 1) { (*((volatile uint32_t *)((uintptr_t)(base + 0x0100U + 0x12U)))) |= outputMask; } else { (*((volatile uint32_t *)((uintptr_t)(base + 0x0100U + 0x12U)))) &= ~outputMask; } } //***************************************************************************** // //! Reads the interrupt tag register. //! //! \param base is the base address of a CLB tile's logic config register. //! //! \return Returns the value in the interrupt tag register which is a 6-bit //! constant set by the HLC. // //***************************************************************************** static inline uint16_t CLB_getInterruptTag(uint32_t base) { do { if(!(CLB_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/clb.h", 787); } } while(0); return((*((volatile uint16_t *)((uintptr_t)(base + 0x0100U + 0x20U))))); } //***************************************************************************** // //! Clears the interrupt tag register. //! //! \param base is the base address of a CLB tile's logic config register. //! //! This function clears the interrupt tag register, setting it to 0. //! //! \return None. // //***************************************************************************** static inline void CLB_clearInterruptTag(uint32_t base) { do { if(!(CLB_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/clb.h", 805); } } while(0); (*((volatile uint16_t *)((uintptr_t)(base + 0x0100U + 0x20U)))) = 0U; } //***************************************************************************** // //! Selects LUT4 inputs. //! //! \param base is the base address of a CLB tile's logic config register. //! \param lut4In0 is the value for LUT4 input signal 0. Generated by tool as //! \b TILEx_CFG_LUT4_IN0. //! \param lut4In1 is the value for LUT4 input signal 1. Generated by tool as //! \b TILEx_CFG_LUT4_IN1. //! \param lut4In2 is the value for LUT4 input signal 2. Generated by tool as //! \b TILEx_CFG_LUT4_IN2. //! \param lut4In3 is the value for LUT4 input signal 3. Generated by tool as //! \b TILEx_CFG_LUT4_IN3. //! //! This function configures the LUT4 block's input signals. //! //! \return None. // //***************************************************************************** static inline void CLB_selectLUT4Inputs(uint32_t base, uint32_t lut4In0, uint32_t lut4In1, uint32_t lut4In2, uint32_t lut4In3) { do { if(!(CLB_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/clb.h", 833); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0x12U)))) = lut4In0; (*((volatile uint32_t *)((uintptr_t)(base + 0x14U)))) = lut4In1; (*((volatile uint32_t *)((uintptr_t)(base + 0x16U)))) = lut4In2; (*((volatile uint32_t *)((uintptr_t)(base + 0x18U)))) = lut4In3; __edis(); } //***************************************************************************** // //! Configures LUT4 functions. //! //! \param base is the base address of a CLB tile's logic config register. //! \param lut4Fn10 is the equation value for LUT4 blocks 0 and 1. Generated by //! tool as \b TILEx_CFG_LUT4_FN10. //! \param lut4Fn2 is the equation value for LUT4 block2. Generated by tool as //! \b TILEx_CFG_LUT4_FN2. //! //! This function configures the LUT4 block's equations. //! //! \return None. // //***************************************************************************** static inline void CLB_configLUT4Function(uint32_t base, uint32_t lut4Fn10, uint32_t lut4Fn2) { do { if(!(CLB_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/clb.h", 861); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0x20U)))) = lut4Fn10; (*((volatile uint32_t *)((uintptr_t)(base + 0x22U)))) = lut4Fn2; __edis(); } //***************************************************************************** // //! Selects FSM inputs. //! //! \param base is the base address of a CLB tile's logic config register. //! \param external0 is the value for FSM external 0 input. Generated by tool //! as \b TILEx_CFG_FSM_EXT_IN0. //! \param external1 is the value for FSM external 1 input. Generated by tool //! as \b TILEx_CFG_FSM_EXT_IN1. //! \param extra0 is the value for FSM extra 0 input. Generated by tool //! as \b TILEx_CFG_FSM_EXTRA_IN0. //! \param extra1 is the value for FSM extra 1 input. Generated by tool //! as \b TILEx_CFG_FSM_EXTRA_IN1. //! //! This function configures the FSM block's external inputs and extra external //! inputs. //! //! \return None. // //***************************************************************************** static inline void CLB_selectFSMInputs(uint32_t base, uint32_t external0, uint32_t external1, uint32_t extra0, uint32_t extra1) { do { if(!(CLB_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/clb.h", 893); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0xCU)))) = external0; (*((volatile uint32_t *)((uintptr_t)(base + 0xEU)))) = external1; (*((volatile uint32_t *)((uintptr_t)(base + 0xAU)))) = extra0; (*((volatile uint32_t *)((uintptr_t)(base + 0x10U)))) = extra1; __edis(); } //***************************************************************************** // //! Configures FSM LUT function. //! //! \param base is the base address of a CLB tile's logic config register. //! \param fsmLutFn10 is the value for FSM 0 & FSM 1 LUT function. Generated //! by tool as \b TILEx_CFG_FSM_LUT_FN10. //! \param fsmLutFn2 is the value for FSM 2 LUT function. Generated by tool as //! \b TILEx_CFG_FSM_LUT_FN2. //! //! This function configures the FSM block's LUT equations. //! //! \return None. // //***************************************************************************** static inline void CLB_configFSMLUTFunction(uint32_t base, uint32_t fsmLutFn10, uint32_t fsmLutFn2) { do { if(!(CLB_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/clb.h", 921); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0x1CU)))) = fsmLutFn10; (*((volatile uint32_t *)((uintptr_t)(base + 0x1EU)))) = fsmLutFn2; __edis(); } //***************************************************************************** // //! Configures FSM next state. //! //! \param base is the base address of a CLB tile's logic config register. //! \param nextState0 is the value for FSM 0's next state. Generated by tool as //! \b TILEx_CFG_FSM_NEXT_STATE_0. //! \param nextState1 is the value for FSM 1's next state. Generated by tool as //! \b TILEx_CFG_FSM_NEXT_STATE_1. //! \param nextState2 is the value for FSM 2's next state. Generated by tool as //! \b TILEx_CFG_FSM_NEXT_STATE_2. //! //! This function configures the FSM's next state equation. //! //! \return None. // //***************************************************************************** static inline void CLB_configFSMNextState(uint32_t base, uint32_t nextState0, uint32_t nextState1, uint32_t nextState2) { do { if(!(CLB_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/clb.h", 950); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0x24U)))) = nextState0; (*((volatile uint32_t *)((uintptr_t)(base + 0x26U)))) = nextState1; (*((volatile uint32_t *)((uintptr_t)(base + 0x28U)))) = nextState2; __edis(); } //***************************************************************************** // //! Selects Counter inputs. //! //! \param base is the base address of a CLB tile's logic config register. //! \param reset is the value for counter's reset inputs. Generated by tool as //! \b TILEx_CFG_COUNTER_RESET. //! \param event is the value for counter's event inputs. Generated by tool as //! \b TILEx_CFG_COUNTER_EVENT. //! \param mode0 is the value for counter's mode 0 inputs. Generated by tool as //! \b TILEx_CFG_COUNTER_MODE_0. //! \param mode1 is the value for counter's mode 1 inputs. Generated by tool as //! \b TILEx_CFG_COUNTER_MODE_1. //! //! This function selects the input signals to the counter block. //! //! \return None. // //***************************************************************************** static inline void CLB_selectCounterInputs(uint32_t base, uint32_t reset, uint32_t event, uint32_t mode0, uint32_t mode1) { do { if(!(CLB_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/clb.h", 982); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0x2U)))) = reset; (*((volatile uint32_t *)((uintptr_t)(base + 0x8U)))) = event; (*((volatile uint32_t *)((uintptr_t)(base + 0x6U)))) = mode0; (*((volatile uint32_t *)((uintptr_t)(base + 0x4U)))) = mode1; __edis(); } //***************************************************************************** // //! Configures Counter and FSM modes. //! //! \param base is the base address of a CLB tile's logic config register. //! \param miscCtrl is the value to represent counter and FSM modes. //! Generated by tool as \b TILEx_CFG_MISC_CONTROL. //! //! This function configures the counter mode, particularly add/shift, load //! modes. The function also configures whether the FSM should use state inputs //! or an extra external input. //! //! \return None. // //***************************************************************************** static inline void CLB_configMiscCtrlModes(uint32_t base, uint32_t miscCtrl) { do { if(!(CLB_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/clb.h", 1009); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0x2AU)))) = miscCtrl; __edis(); } //***************************************************************************** // //! Configures Output LUT functions. //! //! \param base is the base address of a CLB tile's logic config register. //! \param outID is the specified CLB tile output signal. //! \param outputCfg is the value for the output LUT signal function and input //! signal selections. Generated by tool as \b TILEx_CFG_OUTLUT_n where //! n is the output number. //! //! This function configures the input signals and equations of the output LUT //! corresponding to the /e outID parameter. //! //! \return None. // //***************************************************************************** static inline void CLB_configOutputLUT(uint32_t base, CLB_Outputs outID, uint32_t outputCfg) { do { if(!(CLB_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/clb.h", 1035); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0x2CU + (sizeof(uint32_t) * outID))))) = outputCfg; __edis(); } //***************************************************************************** // //! Configures HLC event selection. //! //! \param base is the base address of a CLB tile's logic config register. //! \param eventSel is the value for HLC event selection. Generated by tool as //! \b TILEx_HLC_EVENT_SEL. //! //! This function configures the event selection for the High Level Controller. //! //! \return None. // //***************************************************************************** static inline void CLB_configHLCEventSelect(uint32_t base, uint32_t eventSel) { do { if(!(CLB_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/clb.h", 1057); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0x3CU)))) = eventSel; __edis(); } //***************************************************************************** // //! Program HLC instruction. //! //! \param base is the base address of a CLB tile's logic config register. //! \param instructionNum is the index into the HLC instruction memory. For //! example, a value of 0 corresponds to instruction 0 of event 0, //! a value of 1 corresponds to instruction 1 of event 0, and so on up //! to a value of 31 which corresponds to instruction 7 of event 3. //! \param instruction is the instruction to be programmed. Generated by tool //! as \b TILEx_HLCINSTR_n where n is the instruction number. //! //! This function configures the CLB internal memory corresponding to the //! specified HLC instruction number with the given instruction. //! //! \return None. // //***************************************************************************** static inline void CLB_programHLCInstruction(uint32_t base, uint32_t instructionNum, uint32_t instruction) { do { if(!(CLB_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/clb.h", 1086); } } while(0); do { if(!(instructionNum < 32)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/clb.h", 1087); } } while(0); CLB_writeInterface(base, 0x20U + instructionNum, instruction); } //***************************************************************************** // //! Set HLC registers. //! //! \param base is the base address of a CLB tile's logic config register. //! \param r0Init is the value to write to HLC register R0. Generated by tool //! as \b TILEx_HLC_R0_INIT. //! \param r1Init is the value to write to HLC register R1. Generated by tool //! as \b TILEx_HLC_R1_INIT. //! \param r2Init is the value to write to HLC register R2. Generated by tool //! as \b TILEx_HLC_R2_INIT. //! \param r3Init is the value to write to HLC register R3. Generated by tool //! as \b TILEx_HLC_R3_INIT. //! //! This function configures the CLB internal memory corresponding to the HLC //! registers R0-R3 with the specified values. //! //! \return None. // //***************************************************************************** static inline void CLB_setHLCRegisters(uint32_t base, uint32_t r0Init, uint32_t r1Init, uint32_t r2Init, uint32_t r3Init) { do { if(!(CLB_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/clb.h", 1116); } } while(0); CLB_writeInterface(base, 0xCU, r0Init); CLB_writeInterface(base, 0xDU, r1Init); CLB_writeInterface(base, 0xEU, r2Init); CLB_writeInterface(base, 0xFU, r3Init); } //***************************************************************************** // //! Get HLC or counter register values. //! //! \param base is the base address of a CLB tile's logic config register. //! \param registerID is the internal register from which to read. Can be //! either an HLC register (\b CLB_REG_HLC_Rn) or a counter value //! (\b CLB_REG_CTR_Cn). //! //! \return Returns the value in the specified HLC register or counter. // //***************************************************************************** static inline uint32_t CLB_getRegister(uint32_t base, CLB_Register registerID) { do { if(!(CLB_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/clb.h", 1138); } } while(0); return((*((volatile uint32_t *)((uintptr_t)(base + 0x0100U + (uint32_t)registerID))))); } //***************************************************************************** // //! Get output status. //! //! \param base is the base address of a CLB tile's logic config register. //! //! \return Returns the output status of various components within the CLB tile //! such as a counter match or LUT output. Use the \b CLB_DBG_OUT_* //! masks from hw_clb.h to decode the bits. // //***************************************************************************** static inline uint32_t CLB_getOutputStatus(uint32_t base) { do { if(!(CLB_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/clb.h", 1156); } } while(0); return((*((volatile uint32_t *)((uintptr_t)(base + 0x0100U + 0x3EU))))); } //***************************************************************************** // //! Configures Counter load and match. //! //! \param base is the base address of a CLB tile's logic config register. //! \param counterID is the specified counter unit. //! \param load is the value for counter's load mode. Generated by tool as //! \b TILEx_COUNTER_n_LOAD_VAL where n is the counter number. //! \param match1 is the value for counter's match 1. Generated by tool as //! \b TILEx_COUNTER_n_MATCH1_VAL where n is the counter number. //! \param match2 is the value for counter's match 2. Generated by tool as //! \b TILEx_COUNTER_n_MATCH2_VAL where n is the counter number. //! //! This function configures the CLB internal memory corresponding to the //! counter block's load and match values. //! //! \return None. // //***************************************************************************** extern void CLB_configCounterLoadMatch(uint32_t base, CLB_Counters counterID, uint32_t load, uint32_t match1, uint32_t match2); //***************************************************************************** // //! Clear FIFO registers. //! //! \param base is the base address of a CLB tile's logic config register. //! //! This function clears the PUSH/PULL FIFOs as well as its pointers. //! //! \return None. // //***************************************************************************** extern void CLB_clearFIFOs(uint32_t base); //***************************************************************************** // //! Configure the FIFO registers. //! //! \param base is the base address of a CLB tile's logic config register. //! \param pullData[] is a pointer to an array of bytes which needs to be //! written into the FIFO. The 0th FIFO data is in the 0th index. //! //! This function writes to the PULL FIFO. This also clears the FIFOs and //! its pointer using the CLB_clearFIFOs() API prior to writing to //! the FIFO. //! //! \return None. // //***************************************************************************** extern void CLB_writeFIFOs(uint32_t base ,const uint32_t pullData[]); //***************************************************************************** // //! Read FIFO registers. //! //! \param base is the base address of a CLB tile's logic config register. //! \param pushData[] is a pointer to an array of bytes which needs to be //! read from the FIFO. //! //! This function reads from the PUSH FIFO. The 0th FIFO data would be in //! the 0th index. //! //! \return None. // //***************************************************************************** extern void CLB_readFIFOs(uint32_t base , uint32_t pushData[]); //***************************************************************************** // // Close the Doxygen group. //! @} // //***************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //########################################################################### // // FILE: cmpss.h // // TITLE: C28x CMPSS driver. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup cmpss_api CMPSS //! @{ // //***************************************************************************** //########################################################################### // // FILE: hw_cmpss.h // // TITLE: Definitions for the CMPSS registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the CMPSS register offsets // //***************************************************************************** // Register // Control Register // Register // Register // Register // Register // Active Register // Shadow Register // Active Register // Shadow Register // Register // Register // Register // Register // Register // Register // Register // Register //***************************************************************************** // // The following are defines for the bit fields in the COMPCTL register // //***************************************************************************** // Select // Path Enable // Select // Path Enable //***************************************************************************** // // The following are defines for the bit fields in the COMPHYSCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the COMPSTS register // //***************************************************************************** // Status //***************************************************************************** // // The following are defines for the bit fields in the COMPSTSCLR register // //***************************************************************************** // Status Clear // Clear Enable // Clear // Clear Enable //***************************************************************************** // // The following are defines for the bit fields in the COMPDACCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the DACHVALS register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the DACHVALA register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the DACLVALS register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the DACLVALA register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the RAMPDLYA register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the RAMPDLYS register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CTRIPLFILCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CTRIPLFILCLKCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CTRIPHFILCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CTRIPHFILCLKCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the COMPLOCK register // //***************************************************************************** //***************************************************************************** // // Useful defines used within the driver functions. Not intended for use by // application code. // //***************************************************************************** //***************************************************************************** // // Values that can be passed to CMPSS_configLowComparator() and // CMPSS_configHighComparator() as the config parameter. // //***************************************************************************** // // Comparator negative input source // //! Input driven by internal DAC //! Input driven by external pin // // Extra options // //! Comparator output is inverted //! Asynch comparator output feeds into OR with latched digital filter output //***************************************************************************** // // Values that can be passed to CMPSS_configOutputsLow() and // CMPSS_configOutputsHigh() as the config parameter. // //***************************************************************************** // // Signal driving CTRIPOUT // //! Asynchronous comparator output drives CTRIPOUT //! Synchronous comparator output drives CTRIPOUT //! Filter output drives CTRIPOUT //! Latched filter output drives CTRIPOUT // // Signal driving CTRIP // //! Asynchronous comparator output drives CTRIP //! Synchronous comparator output drives CTRIP //! Filter output drives CTRIP //! Latched filter output drives CTRIP //***************************************************************************** // // Values that can be returned by CMPSS_getStatus(). // //***************************************************************************** //! High digital filter output //! Latched value of high digital filter output //! Low digital filter output //! Latched value of low digital filter output //***************************************************************************** // // Values that can be passed to CMPSS_configDAC() the config parameter. // //***************************************************************************** // // When is DAC value loaded from shadow register // //! DAC value updated from SYSCLK //! DAC value updated from PWMSYNC // // DAC reference voltage // //! VDDA is the voltage reference //! VDAC is the voltage reference // // DAC value source // //! DAC value updated from shadow register //! DAC value is updated from the ramp register //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** //***************************************************************************** // //! \internal //! Checks a CMPSS base address. //! //! \param base is the base address of the CMPSS module. //! //! This function determines if a CMPSS base address is valid. //! //! \return Returns \b true if the base address is valid and \b false //! otherwise. // //***************************************************************************** static inline _Bool CMPSS_isBaseValid(uint32_t base) { return((base == 0x00005C80U) || (base == 0x00005CA0U) || (base == 0x00005CC0U) || (base == 0x00005CE0U) || (base == 0x00005D00U) || (base == 0x00005D20U) || (base == 0x00005D40U) || (base == 0x00005D60U)); } //***************************************************************************** // //! Enables the CMPSS module. //! //! \param base is the base address of the CMPSS module. //! //! This function enables the CMPSS module passed into the \e base parameter. //! //! \return None. // //***************************************************************************** static inline void CMPSS_enableModule(uint32_t base) { // // Check the arguments. // do { if(!(CMPSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cmpss.h", 229); } } while(0); // // Set the bit that enables the CMPSS module. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) |= 0x8000U; __edis(); } //***************************************************************************** // //! Disables the CMPSS module. //! //! \param base is the base address of the CMPSS module. //! //! This function disables the CMPSS module passed into the \e base parameter. //! //! \return None. // //***************************************************************************** static inline void CMPSS_disableModule(uint32_t base) { // // Check the arguments. // do { if(!(CMPSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cmpss.h", 258); } } while(0); // // Clear the bit that enables the CMPSS module. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) &= ~0x8000U; __edis(); } //***************************************************************************** // //! Sets the configuration for the high comparator. //! //! \param base is the base address of the CMPSS module. //! \param config is the configuration of the high comparator. //! //! This function configures a comparator. The \e config parameter is the //! result of a logical OR operation between a \b CMPSS_INSRC_xxx value and if //! desired, \b CMPSS_INV_INVERTED and \b CMPSS_OR_ASYNC_OUT_W_FILT values. //! //! The \b CMPSS_INSRC_xxx term can take on the following values to specify //! the high comparator negative input source: //! - \b CMPSS_INSRC_DAC - The internal DAC. //! - \b CMPSS_INSRC_PIN - An external pin. //! //! \b CMPSS_INV_INVERTED may be ORed into \e config if the comparator output //! should be inverted. //! //! \b CMPSS_OR_ASYNC_OUT_W_FILT may be ORed into \e config if the //! asynchronous comparator output should be fed into an OR gate with the //! latched digital filter output before it is made available for CTRIPH or //! CTRIPOUTH. //! //! \return None. // //***************************************************************************** static inline void CMPSS_configHighComparator(uint32_t base, uint16_t config) { // // Check the arguments. // do { if(!(CMPSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cmpss.h", 303); } } while(0); // // Write the high comparator configuration to the appropriate register. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) & ~(0x1U | 0x2U | 0x40U)) | config; __edis(); } //***************************************************************************** // //! Sets the configuration for the low comparator. //! //! \param base is the base address of the CMPSS module. //! \param config is the configuration of the low comparator. //! //! This function configures a comparator. The \e config parameter is the //! result of a logical OR operation between a \b CMPSS_INSRC_xxx value and if //! desired, \b CMPSS_INV_INVERTED and \b CMPSS_OR_ASYNC_OUT_W_FILT values. //! //! The \b CMPSS_INSRC_xxx term can take on the following values to specify //! the low comparator negative input source: //! - \b CMPSS_INSRC_DAC - The internal DAC. //! - \b CMPSS_INSRC_PIN - An external pin. //! //! \b CMPSS_INV_INVERTED may be ORed into \e config if the comparator output //! should be inverted. //! //! \b CMPSS_OR_ASYNC_OUT_W_FILT may be ORed into \e config if the //! asynchronous comparator output should be fed into an OR gate with the //! latched digital filter output before it is made available for CTRIPL or //! CTRIPOUTL. //! //! \return None. // //***************************************************************************** static inline void CMPSS_configLowComparator(uint32_t base, uint16_t config) { // // Check the arguments. // do { if(!(CMPSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cmpss.h", 349); } } while(0); // // Write the low comparator configuration to the appropriate register. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) & ~(0x100U | 0x200U | 0x4000U)) | (config << 8U); __edis(); } //***************************************************************************** // //! Sets the output signal configuration for the high comparator. //! //! \param base is the base address of the CMPSS module. //! \param config is the configuration of the high comparator output signals. //! //! This function configures a comparator's output signals CTRIP and CTRIPOUT. //! The \e config parameter is the result of a logical OR operation between the //! \b CMPSS_TRIPOUT_xxx and \b CMPSS_TRIP_xxx values. //! //! The \b CMPSS_TRIPOUT_xxx term can take on the following values to specify //! which signal drives CTRIPOUTH: //! - \b CMPSS_TRIPOUT_ASYNC_COMP - The asynchronous comparator output. //! - \b CMPSS_TRIPOUT_SYNC_COMP - The synchronous comparator output. //! - \b CMPSS_TRIPOUT_FILTER - The output of the digital filter. //! - \b CMPSS_TRIPOUT_LATCH - The latched output of the digital filter. //! //! The \b CMPSS_TRIP_xxx term can take on the following values to specify //! which signal drives CTRIPH: //! - \b CMPSS_TRIP_ASYNC_COMP - The asynchronous comparator output. //! - \b CMPSS_TRIP_SYNC_COMP - The synchronous comparator output. //! - \b CMPSS_TRIP_FILTER - The output of the digital filter. //! - \b CMPSS_TRIP_LATCH - The latched output of the digital filter. //! //! \return None. // //***************************************************************************** static inline void CMPSS_configOutputsHigh(uint32_t base, uint16_t config) { // // Check the arguments. // do { if(!(CMPSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cmpss.h", 396); } } while(0); // // Write the high comparator output settings to the appropriate register. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) & ~(0x30U | 0xCU)) | config; __edis(); } //***************************************************************************** // //! Sets the output signal configuration for the low comparator. //! //! \param base is the base address of the CMPSS module. //! \param config is the configuration of the low comparator output signals. //! //! This function configures a comparator's output signals CTRIP and CTRIPOUT. //! The \e config parameter is the result of a logical OR operation between the //! \b CMPSS_TRIPOUT_xxx and \b CMPSS_TRIP_xxx values. //! //! The \b CMPSS_TRIPOUT_xxx term can take on the following values to specify //! which signal drives CTRIPOUTL: //! - \b CMPSS_TRIPOUT_ASYNC_COMP - The asynchronous comparator output. //! - \b CMPSS_TRIPOUT_SYNC_COMP - The synchronous comparator output. //! - \b CMPSS_TRIPOUT_FILTER - The output of the digital filter. //! - \b CMPSS_TRIPOUT_LATCH - The latched output of the digital filter. //! //! The \b CMPSS_TRIP_xxx term can take on the following values to specify //! which signal drives CTRIPL: //! - \b CMPSS_TRIP_ASYNC_COMP - The asynchronous comparator output. //! - \b CMPSS_TRIP_SYNC_COMP - The synchronous comparator output. //! - \b CMPSS_TRIP_FILTER - The output of the digital filter. //! - \b CMPSS_TRIP_LATCH - The latched output of the digital filter. //! //! \return None. // //***************************************************************************** static inline void CMPSS_configOutputsLow(uint32_t base, uint16_t config) { // // Check the arguments. // do { if(!(CMPSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cmpss.h", 445); } } while(0); // // Write the low comparator output settings to the appropriate register. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) & ~(0x3000U | 0xC00U)) | (config << 8U); __edis(); } //***************************************************************************** // //! Gets the current comparator status. //! //! \param base is the base address of the comparator module. //! //! This function returns the current status for the comparator, specifically //! the digital filter output and latched digital filter output. //! //! \return Returns the current interrupt status, enumerated as a bit field of //! the following values: //! - \b CMPSS_STS_HI_FILTOUT - High digital filter output //! - \b CMPSS_STS_HI_LATCHFILTOUT - Latched value of high digital filter //! output //! - \b CMPSS_STS_LO_FILTOUT - Low digital filter output //! - \b CMPSS_STS_LO_LATCHFILTOUT - Latched value of low digital filter output // //***************************************************************************** static inline uint16_t CMPSS_getStatus(uint32_t base) { // // Check the arguments. // do { if(!(CMPSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cmpss.h", 484); } } while(0); // // Return contents of the status register. // return((*((volatile uint16_t *)((uintptr_t)(base + 0x2U))))); } //***************************************************************************** // //! Sets the configuration for the internal comparator DACs. //! //! \param base is the base address of the CMPSS module. //! \param config is the configuration of the internal DAC. //! //! This function configures the comparator's internal DAC. The \e config //! parameter is the result of a logical OR operation between the //! \b CMPSS_DACVAL_xxx, \b CMPSS_DACREF_xxx, and \b CMPSS_DACSRC_xxx. //! //! The \b CMPSS_DACVAL_xxx term can take on the following values to specify //! when the DAC value is loaded from its shadow register: //! - \b CMPSS_DACVAL_SYSCLK - Value register updated on system clock. //! - \b CMPSS_DACVAL_PWMSYNC - Value register updated on PWM sync. //! //! The \b CMPSS_DACREF_xxx term can take on the following values to specify //! which voltage supply is used as reference for the DACs: //! - \b CMPSS_DACREF_VDDA - VDDA is the voltage reference for the DAC. //! - \b CMPSS_DACREF_VDAC - VDAC is the voltage reference for the DAC. //! //! The \b CMPSS_DACSRC_xxx term can take on the following values to specify //! the DAC value source for the high comparator's internal DAC: //! - \b CMPSS_DACSRC_SHDW - The user-programmed DACVALS register. //! - \b CMPSS_DACSRC_RAMP - The ramp generator RAMPSTS register //! //! \note The \b CMPSS_DACVAL_xxx and \b CMPSS_DACREF_xxx terms apply to //! both the high and low comparators. \b CMPSS_DACSRC_xxx will only affect //! the high comparator's internal DAC. //! //! \return None. // //***************************************************************************** static inline void CMPSS_configDAC(uint32_t base, uint16_t config) { // // Check the arguments. // do { if(!(CMPSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cmpss.h", 531); } } while(0); // // Write the DAC configuration to the appropriate register. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) & ~(0x80U | 0x20U | 0x1U)) | config; __edis(); } //***************************************************************************** // //! Sets the value of the internal DAC of the high comparator. //! //! \param base is the base address of the comparator module. //! \param value is the value actively driven by the DAC. //! //! This function sets the 12-bit value driven by the internal DAC of the high //! comparator. This function will load the value into the shadow register from //! which the actual DAC value register will be loaded. To configure which //! event causes this shadow load to take place, use CMPSS_configDAC(). //! //! \return None. // //***************************************************************************** static inline void CMPSS_setDACValueHigh(uint32_t base, uint16_t value) { // // Check the arguments. // do { if(!(CMPSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cmpss.h", 567); } } while(0); do { if(!(value < 4096U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cmpss.h", 568); } } while(0); // // Write the DAC value to the DAC value shadow register. // (*((volatile uint16_t *)((uintptr_t)(base + 0x6U)))) = value; } //***************************************************************************** // //! Sets the value of the internal DAC of the low comparator. //! //! \param base is the base address of the comparator module. //! \param value is the value actively driven by the DAC. //! //! This function sets the 12-bit value driven by the internal DAC of the low //! comparator. This function will load the value into the shadow register from //! which the actual DAC value register will be loaded. To configure which //! event causes this shadow load to take place, use CMPSS_configDAC(). //! //! \return None. // //***************************************************************************** static inline void CMPSS_setDACValueLow(uint32_t base, uint16_t value) { // // Check the arguments. // do { if(!(CMPSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cmpss.h", 597); } } while(0); do { if(!(value < 4096U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cmpss.h", 598); } } while(0); // // Write the DAC value to the DAC value shadow register. // (*((volatile uint16_t *)((uintptr_t)(base + 0x12U)))) = value; } //***************************************************************************** // //! Initializes the digital filter of the high comparator. //! //! \param base is the base address of the comparator module. //! //! This function initializes all the samples in the high comparator digital //! filter to the filter input value. //! //! \note See CMPSS_configFilterHigh() for the proper initialization sequence //! to avoid glitches. //! //! \return None. // //***************************************************************************** static inline void CMPSS_initFilterHigh(uint32_t base) { // // Check the arguments. // do { if(!(CMPSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cmpss.h", 627); } } while(0); // // Set the high comparator filter initialization bit. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x18U)))) |= 0x8000U; __edis(); } //***************************************************************************** // //! Initializes the digital filter of the low comparator. //! //! \param base is the base address of the comparator module. //! //! This function initializes all the samples in the low comparator digital //! filter to the filter input value. //! //! \note See CMPSS_configFilterLow() for the proper initialization sequence //! to avoid glitches. //! //! \return None. // //***************************************************************************** static inline void CMPSS_initFilterLow(uint32_t base) { // // Check the arguments. // do { if(!(CMPSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cmpss.h", 660); } } while(0); // // Set the low comparator filter initialization bit. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x16U)))) |= 0x8000U; __edis(); } //***************************************************************************** // //! Gets the value of the internal DAC of the high comparator. //! //! \param base is the base address of the comparator module. //! //! This function gets the value of the internal DAC of the high comparator. //! The value is read from the \e active register--not the shadow register to //! which CMPSS_setDACValueHigh() writes. //! //! \return Returns the value driven by the internal DAC of the high comparator. // //***************************************************************************** static inline uint16_t CMPSS_getDACValueHigh(uint32_t base) { // // Check the arguments. // do { if(!(CMPSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cmpss.h", 691); } } while(0); // // Write the DAC value to the DAC value shadow register. // return((*((volatile uint16_t *)((uintptr_t)(base + 0x7U))))); } //***************************************************************************** // //! Gets the value of the internal DAC of the low comparator. //! //! \param base is the base address of the comparator module. //! //! This function gets the value of the internal DAC of the low comparator. //! The value is read from the \e active register--not the shadow register to //! which CMPSS_setDACValueLow() writes. //! //! \return Returns the value driven by the internal DAC of the low comparator. // //***************************************************************************** static inline uint16_t CMPSS_getDACValueLow(uint32_t base) { // // Check the arguments. // do { if(!(CMPSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cmpss.h", 718); } } while(0); // // Write the DAC value to the DAC value shadow register. // return((*((volatile uint16_t *)((uintptr_t)(base + 0x13U))))); } //***************************************************************************** // //! Causes a software reset of the high comparator digital filter output latch. //! //! \param base is the base address of the comparator module. //! //! This function causes a software reset of the high comparator digital filter //! output latch. It will generate a single pulse of the latch reset signal. //! //! \return None. // //***************************************************************************** static inline void CMPSS_clearFilterLatchHigh(uint32_t base) { // // Check the arguments. // do { if(!(CMPSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cmpss.h", 744); } } while(0); // // Set the bit that generates a reset pulse to the digital filter latch. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x3U)))) |= 0x2U; __edis(); } //***************************************************************************** // //! Causes a software reset of the low comparator digital filter output latch. //! //! \param base is the base address of the comparator module. //! //! This function causes a software reset of the low comparator digital filter //! output latch. It will generate a single pulse of the latch reset signal. //! //! \return None. // //***************************************************************************** static inline void CMPSS_clearFilterLatchLow(uint32_t base) { // // Check the arguments. // do { if(!(CMPSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cmpss.h", 774); } } while(0); // // Set the bit that generates a reset pulse to the digital filter latch. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x3U)))) |= 0x200U; __edis(); } //***************************************************************************** // //! Sets the ramp generator maximum reference value. //! //! \param base is the base address of the comparator module. //! \param value the ramp maximum reference value. //! //! This function sets the ramp maximum reference value that will be loaded //! into the ramp generator. //! //! \return None. // //***************************************************************************** static inline void CMPSS_setMaxRampValue(uint32_t base, uint16_t value) { // // Check the arguments. // do { if(!(CMPSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cmpss.h", 805); } } while(0); // // Write the maximum ramp value to the shadow register. // (*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) = value; } //***************************************************************************** // //! Gets the ramp generator maximum reference value. //! //! \param base is the base address of the comparator module. //! //! \return Returns the latched ramp maximum reference value that will be //! loaded into the ramp generator. // //***************************************************************************** static inline uint16_t CMPSS_getMaxRampValue(uint32_t base) { // // Check the arguments. // do { if(!(CMPSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cmpss.h", 829); } } while(0); // // Read the maximum ramp value from the register. // return((*((volatile uint16_t *)((uintptr_t)(base + 0x8U))))); } //***************************************************************************** // //! Sets the ramp generator decrement value. //! //! \param base is the base address of the comparator module. //! \param value is the ramp decrement value. //! //! This function sets the value that is subtracted from the ramp value on //! every system clock cycle. //! //! \return None. // //***************************************************************************** static inline void CMPSS_setRampDecValue(uint32_t base, uint16_t value) { // // Check the arguments. // do { if(!(CMPSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cmpss.h", 856); } } while(0); // // Write the ramp decrement value to the shadow register. // (*((volatile uint16_t *)((uintptr_t)(base + 0xEU)))) = value; } //***************************************************************************** // //! Gets the ramp generator decrement value. //! //! \param base is the base address of the comparator module. //! //! \return Returns the latched ramp decrement value that is subtracted from //! the ramp value on every system clock cycle. // //***************************************************************************** static inline uint16_t CMPSS_getRampDecValue(uint32_t base) { // // Check the arguments. // do { if(!(CMPSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cmpss.h", 880); } } while(0); // // Read the ramp decrement value from the register. // return((*((volatile uint16_t *)((uintptr_t)(base + 0xCU))))); } //***************************************************************************** // //! Sets the ramp generator delay value. //! //! \param base is the base address of the comparator module. //! \param value is the 13-bit ramp delay value. //! //! This function sets the value that configures the number of system clock //! cycles to delay the start of the ramp generator decrementer after a PWMSYNC //! event is received. Delay value can be no greater than 8191. //! //! \return None. // //***************************************************************************** static inline void CMPSS_setRampDelayValue(uint32_t base, uint16_t value) { // // Check the arguments. // do { if(!(CMPSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cmpss.h", 908); } } while(0); do { if(!(value < 8192U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cmpss.h", 909); } } while(0); // // Write the ramp delay value to the shadow register. // (*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) = value; } //***************************************************************************** // //! Gets the ramp generator delay value. //! //! \param base is the base address of the comparator module. //! //! \return Returns the latched ramp delay value that is subtracted from //! the ramp value on every system clock cycle. // //***************************************************************************** static inline uint16_t CMPSS_getRampDelayValue(uint32_t base) { // // Check the arguments. // do { if(!(CMPSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cmpss.h", 933); } } while(0); // // Read the ramp delay value from the register. // return((*((volatile uint16_t *)((uintptr_t)(base + 0x14U))))); } //***************************************************************************** // //! Sets the comparator hysteresis settings. //! //! \param base is the base address of the comparator module. //! \param value is the amount of hysteresis on the comparator inputs. //! //! This function sets the amount of hysteresis on the comparator inputs. The //! \e value parameter indicates the amount of hysteresis desired. Passing in 0 //! results in none, passing in 1 results in typical hysteresis, passing in 2 //! results in 2x of typical hysteresis, and so on where \e value x of typical //! hysteresis is the amount configured. //! //! \return None. // //***************************************************************************** static inline void CMPSS_setHysteresis(uint32_t base, uint16_t value) { // // Check the arguments. // do { if(!(CMPSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cmpss.h", 963); } } while(0); do { if(!(value <= 4U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cmpss.h", 964); } } while(0); // // Read the ramp delay value from the register. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x1U)))) = value; __edis(); } //***************************************************************************** // //! Sets the ePWM module blanking signal that holds trip in reset. //! //! \param base is the base address of the comparator module. //! \param pwmBlankSrc is the number of the PWMBLANK source. //! //! This function configures which PWMBLANK signal from the ePWM module will //! hold trip in reset when blanking is enabled. //! //! The number of the PWMBLANK signal to be used to reset the ramp generator //! should be specified by passing it into the \e pwmBlankSrc parameter. For //! instance, passing a 2 into \e pwmBlankSrc will select PWMBLANK2. //! //! \return None. // //***************************************************************************** static inline void CMPSS_configBlanking(uint32_t base, uint16_t pwmBlankSrc) { // // Check the arguments. // do { if(!(CMPSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cmpss.h", 999); } } while(0); do { if(!((pwmBlankSrc >= 1U) && (pwmBlankSrc <= 16U))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cmpss.h", 1000); } } while(0); // // Write the blank source number to the appropriate register. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) & ~0xF00U) | ((pwmBlankSrc - 1U) << 8U); __edis(); } //***************************************************************************** // //! Enables an ePWM blanking signal to hold trip in reset. //! //! \param base is the base address of the comparator module. //! //! This function enables a selected ePWM blanking signal to hold trip in //! reset. //! //! \return None. // //***************************************************************************** static inline void CMPSS_enableBlanking(uint32_t base) { // // Check the arguments. // do { if(!(CMPSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cmpss.h", 1032); } } while(0); // // Set the bit that enables the PWMBLANK signal. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) |= 0x1000U; __edis(); } //***************************************************************************** // //! Disables an ePWM blanking signal from holding trip in reset. //! //! \param base is the base address of the comparator module. //! //! This function disables a selected ePWM blanking signal from holding trip in //! reset. //! //! \return None. // //***************************************************************************** static inline void CMPSS_disableBlanking(uint32_t base) { // // Check the arguments. // do { if(!(CMPSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cmpss.h", 1060); } } while(0); // // Clear the bit that enables the PWMBLANK signal. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) &= ~0x1000U; __edis(); } //***************************************************************************** // //! Configures the digital filter of the high comparator. //! //! \param base is the base address of the comparator module. //! \param samplePrescale is the number of system clock cycles between samples. //! \param sampleWindow is the number of FIFO samples to monitor. //! \param threshold is the majority threshold of samples to change state. //! //! This function configures the operation of the digital filter of the high //! comparator. //! //! The \e samplePrescale parameter specifies the number of system clock cycles //! between samples. It is a 10-bit value so a number higher than 1023 should //! not be passed as this parameter. The prescale used by digital filter is 1 //! more than \e samplePrescale value. So, the input provided should be 1 less //! than the expected prescale. //! //! The \e sampleWindow parameter configures the size of the window of FIFO //! samples taken from the input that will be monitored to determine when to //! change the filter output. This sample window may be no larger than 32 //! samples. //! //! The threshold used by digital filter is 1 more than \e threshold parameter //! value. So, the input provided should be 1 less than the expected threshold. //! //! The filter output resolves to the majority value of the sample window where //! majority is defined by the value passed into the \e threshold parameter. //! For proper operation, the value of \e threshold must be greater than //! sampleWindow / 2. //! //! To ensure proper operation of the filter, the following is the recommended //! function call sequence for initialization: //! //! -# Configure and enable the comparator using CMPSS_configHighComparator() //! and CMPSS_enableModule() //! -# Configure the digital filter using CMPSS_configFilterHigh() //! -# Initialize the sample values using CMPSS_initFilterHigh() //! -# Configure the module output signals CTRIP and CTRIPOUT using //! CMPSS_configOutputsHigh() //! //! \return None. // //***************************************************************************** extern void CMPSS_configFilterHigh(uint32_t base, uint16_t samplePrescale, uint16_t sampleWindow, uint16_t threshold); //***************************************************************************** // //! Configures the digital filter of the low comparator. //! //! \param base is the base address of the comparator module. //! \param samplePrescale is the number of system clock cycles between samples. //! \param sampleWindow is the number of FIFO samples to monitor. //! \param threshold is the majority threshold of samples to change state. //! //! This function configures the operation of the digital filter of the low //! comparator. //! //! The \e samplePrescale parameter specifies the number of system clock cycles //! between samples. It is a 10-bit value so a number higher than 1023 should //! not be passed as this parameter. The prescale used by digital filter is 1 //! more than \e samplePrescale value. So, the input provided should be 1 less //! than the expected prescale. //! //! The \e sampleWindow parameter configures the size of the window of FIFO //! samples taken from the input that will be monitored to determine when to //! change the filter output. This sample window may be no larger than 32 //! samples. //! //! The threshold used by digital filter is 1 more than \e threshold parameter //! value. So, the input provided should be 1 less than the expected threshold. //! //! The filter output resolves to the majority value of the sample window where //! majority is defined by the value passed into the \e threshold parameter. //! For proper operation, the value of \e threshold must be greater than //! sampleWindow / 2. //! //! To ensure proper operation of the filter, the following is the recommended //! function call sequence for initialization: //! //! -# Configure and enable the comparator using CMPSS_configLowComparator() //! and CMPSS_enableModule() //! -# Configure the digital filter using CMPSS_configFilterLow() //! -# Initialize the sample values using CMPSS_initFilterLow() //! -# Configure the module output signals CTRIP and CTRIPOUT using //! CMPSS_configOutputsLow() //! //! \return None. // //***************************************************************************** extern void CMPSS_configFilterLow(uint32_t base, uint16_t samplePrescale, uint16_t sampleWindow, uint16_t threshold); //***************************************************************************** // //! Configures whether or not the digital filter latches are reset by PWMSYNC //! //! \param base is the base address of the comparator module. //! \param highEnable indicates filter latch settings in the high comparator. //! \param lowEnable indicates filter latch settings in the low comparator. //! //! This function configures whether or not the digital filter latches in both //! the high and low comparators should be reset by PWMSYNC. If the //! \e highEnable parameter is \b true, the PWMSYNC will be allowed to reset //! the high comparator's digital filter latch. If it is false, the ability of //! the PWMSYNC to reset the latch will be disabled. The \e lowEnable parameter //! has the same effect on the low comparator's digital filter latch. //! //! \return None. // //***************************************************************************** extern void CMPSS_configLatchOnPWMSYNC(uint32_t base, _Bool highEnable, _Bool lowEnable); //***************************************************************************** // //! Configures the comparator subsystem's ramp generator. //! //! \param base is the base address of the comparator module. //! \param maxRampVal is the ramp maximum reference value. //! \param decrementVal value is the ramp decrement value. //! \param delayVal is the ramp delay value. //! \param pwmSyncSrc is the number of the PWMSYNC source. //! \param useRampValShdw indicates if the max ramp shadow should be used. //! //! This function configures many of the main settings of the comparator //! subsystem's ramp generator. The \e maxRampVal parameter should be passed //! the ramp maximum reference value that will be loaded into the ramp //! generator. The \e decrementVal parameter should be passed the decrement //! value that will be subtracted from the ramp generator on each system clock //! cycle. The \e delayVal parameter should be passed the 13-bit number of //! system clock cycles the ramp generator should delay before beginning to //! decrement the ramp generator after a PWMSYNC signal is received. //! //! These three values may be be set individually using the //! CMPSS_setMaxRampValue(), CMPSS_setRampDecValue(), and //! CMPSS_setRampDelayValue() APIs. //! //! The number of the PWMSYNC signal to be used to reset the ramp generator //! should be specified by passing it into the \e pwmSyncSrc parameter. For //! instance, passing a 2 into \e pwmSyncSrc will select PWMSYNC2. //! //! To indicate whether the ramp generator should reset with the value from the //! ramp max reference value shadow register or with the latched ramp max //! reference value, use the \e useRampValShdw parameter. Passing it \b true //! will result in the latched value being bypassed. The ramp generator will be //! loaded right from the shadow register. A value of \b false will load the //! ramp generator from the latched value. //! //! \return None. // //***************************************************************************** extern void CMPSS_configRamp(uint32_t base, uint16_t maxRampVal, uint16_t decrementVal, uint16_t delayVal, uint16_t pwmSyncSrc, _Bool useRampValShdw); //***************************************************************************** // // Close the Doxygen group. //! @} // //***************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //############################################################################# // // FILE: cputimer.h // // TITLE: C28x CPU timer Driver // //############################################################################# // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //############################################################################# //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup cputimer_api CPUTimer //! @{ // //***************************************************************************** //########################################################################### // // FILE: hw_cputimer.h // // TITLE: Definitions for the CPUTIMER registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the CPUTIMER register offsets // //***************************************************************************** // High //***************************************************************************** // // The following are defines for the bit fields in the TIM register // //***************************************************************************** // High //***************************************************************************** // // The following are defines for the bit fields in the PRD register // //***************************************************************************** // High //***************************************************************************** // // The following are defines for the bit fields in the TCR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the TPR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the TPRH register // //***************************************************************************** //***************************************************************************** // // Defines for the API. // //***************************************************************************** //***************************************************************************** // //! Values that can be passed to CPUTimer_setEmulationMode() as the //! \e mode parameter. // //**************************************************************************** typedef enum { //! Denotes that the timer will stop after the next decrement CPUTIMER_EMULATIONMODE_STOPAFTERNEXTDECREMENT = 0x0000, //! Denotes that the timer will stop when it reaches zero CPUTIMER_EMULATIONMODE_STOPATZERO = 0x0400, //! Denotes that the timer will run free CPUTIMER_EMULATIONMODE_RUNFREE = 0x0800 }CPUTimer_EmulationMode; //***************************************************************************** // //! The following are values that can be passed to //! CPUTimer_selectClockSource() as the \e source parameter. // //***************************************************************************** typedef enum { //! System Clock Source CPUTIMER_CLOCK_SOURCE_SYS = 0x0, //! Internal Oscillator 1 Clock Source CPUTIMER_CLOCK_SOURCE_INTOSC1 = 0x1, //! Internal Oscillator 2 Clock Source CPUTIMER_CLOCK_SOURCE_INTOSC2 = 0x2, //! External Clock Source CPUTIMER_CLOCK_SOURCE_XTAL = 0x3, //! Auxiliary PLL Clock Source CPUTIMER_CLOCK_SOURCE_AUX = 0x6 } CPUTimer_ClockSource; //***************************************************************************** // //! The following are values that can be passed to //! CPUTimer_selectClockSource() as the \e prescaler parameter. // //***************************************************************************** typedef enum { CPUTIMER_CLOCK_PRESCALER_1 = 0, //!< Prescaler value of / 1 CPUTIMER_CLOCK_PRESCALER_2 = 1, //!< Prescaler value of / 2 CPUTIMER_CLOCK_PRESCALER_4 = 2, //!< Prescaler value of / 4 CPUTIMER_CLOCK_PRESCALER_8 = 3, //!< Prescaler value of / 8 CPUTIMER_CLOCK_PRESCALER_16 = 4 //!< Prescaler value of / 16 } CPUTimer_Prescaler; //***************************************************************************** // //! \internal //! Checks CPU timer base address. //! //! \param base specifies the Timer module base address. //! //! This function determines if a CPU timer module base address is valid. //! //! \return Returns \b true if the base address is valid and \b false //! otherwise. // //***************************************************************************** static inline _Bool CPUTimer_isBaseValid(uint32_t base) { return((base == 0x00000C00U) || (base == 0x00000C08U) || (base == 0x00000C10U)); } //***************************************************************************** // //! Clears CPU timer overflow flag. //! //! \param base is the base address of the timer module. //! //! This function clears the CPU timer overflow flag. //! //! \return None. // //***************************************************************************** static inline void CPUTimer_clearOverflowFlag(uint32_t base) { do { if(!(CPUTimer_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cputimer.h", 164); } } while(0); // // Set TIF bit of TCR register // (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) |= 0x8000U; } //***************************************************************************** // //! Disables CPU timer interrupt. //! //! \param base is the base address of the timer module. //! //! This function disables the CPU timer interrupt. //! //! \return None. // //***************************************************************************** static inline void CPUTimer_disableInterrupt(uint32_t base) { do { if(!(CPUTimer_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cputimer.h", 185); } } while(0); // // Clear TIE bit of TCR register // (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) &= ~0x4000U; } //***************************************************************************** // //! Enables CPU timer interrupt. //! //! \param base is the base address of the timer module. //! //! This function enables the CPU timer interrupt. //! //! \return None. // //***************************************************************************** static inline void CPUTimer_enableInterrupt(uint32_t base) { do { if(!(CPUTimer_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cputimer.h", 206); } } while(0); // // Set TIE bit of TCR register // (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) |= 0x4000U; } //***************************************************************************** // //! Reloads CPU timer counter. //! //! \param base is the base address of the timer module. //! //! This function reloads the CPU timer counter with the values contained in //! the CPU timer period register. //! //! \return None. // //***************************************************************************** static inline void CPUTimer_reloadTimerCounter(uint32_t base) { do { if(!(CPUTimer_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cputimer.h", 228); } } while(0); // // Set TRB bit of register TCR // (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) |= 0x20U; } //***************************************************************************** // //! Stops CPU timer. //! //! \param base is the base address of the timer module. //! //! This function stops the CPU timer. //! //! \return None. // //***************************************************************************** static inline void CPUTimer_stopTimer(uint32_t base) { do { if(!(CPUTimer_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cputimer.h", 249); } } while(0); // // Set TSS bit of register TCR // (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) |= 0x10U; } //***************************************************************************** // //! Starts(restarts) CPU timer. //! //! \param base is the base address of the timer module. //! //! This function starts (restarts) the CPU timer. //! //! \b Note: This function doesn't reset the timer counter. //! //! \return None. // //***************************************************************************** static inline void CPUTimer_resumeTimer(uint32_t base) { do { if(!(CPUTimer_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cputimer.h", 272); } } while(0); // // Clear TSS bit of register TCR // (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) &= ~0x10U; } //***************************************************************************** // //! Starts(restarts) CPU timer. //! //! \param base is the base address of the timer module. //! //! This function starts (restarts) the CPU timer. //! //! \b Note: This function reloads the timer counter. //! //! \return None. // //***************************************************************************** static inline void CPUTimer_startTimer(uint32_t base) { do { if(!(CPUTimer_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cputimer.h", 295); } } while(0); // // Reload the timer counter // (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) |= 0x20U; // // Clear TSS bit of register TCR // (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) &= ~0x10U; } //***************************************************************************** // //! Sets CPU timer period. //! //! \param base is the base address of the timer module. //! \param periodCount is the CPU timer period count. //! //! This function sets the CPU timer period count. //! //! \return None. // //***************************************************************************** static inline void CPUTimer_setPeriod(uint32_t base, uint32_t periodCount) { do { if(!(CPUTimer_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cputimer.h", 322); } } while(0); // // Load the MSB period Count // (*((volatile uint32_t *)((uintptr_t)(base + 0x2U)))) = periodCount; } //***************************************************************************** // //! Returns the current CPU timer counter value. //! //! \param base is the base address of the timer module. //! //! This function returns the current CPU timer counter value. //! //! \return Returns the current CPU timer count value. // //***************************************************************************** static inline uint32_t CPUTimer_getTimerCount(uint32_t base) { do { if(!(CPUTimer_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cputimer.h", 343); } } while(0); // // Get the TIMH:TIM registers value // return((*((volatile uint32_t *)((uintptr_t)(base + 0x0U))))); } //***************************************************************************** // //! Set CPU timer pre-scaler value. //! //! \param base is the base address of the timer module. //! \param prescaler is the CPU timer pre-scaler value. //! //! This function sets the pre-scaler value for the CPU timer. For every value //! of (prescaler + 1), the CPU timer counter decrements by 1. //! //! \return None. // //***************************************************************************** static inline void CPUTimer_setPreScaler(uint32_t base, uint16_t prescaler) { do { if(!(CPUTimer_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cputimer.h", 366); } } while(0); // // Writes to TPR.TDDR and TPRH.TDDRH bits // (*((volatile uint16_t *)((uintptr_t)(base + 0x7U)))) = prescaler >> 8U; (*((volatile uint16_t *)((uintptr_t)(base + 0x6U)))) = (prescaler & 0xFFU) ; } //***************************************************************************** // //! Return the CPU timer overflow status. //! //! \param base is the base address of the timer module. //! //! This function returns the CPU timer overflow status. //! //! \return Returns true if the CPU timer has overflowed, false if not. // //***************************************************************************** static inline _Bool CPUTimer_getTimerOverflowStatus(uint32_t base) { do { if(!(CPUTimer_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cputimer.h", 388); } } while(0); // // Check if TIF bits of register TCR are set // return((((*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) & 0x8000U) == 0x8000U) ? 1 : 0); } //***************************************************************************** // //! Select CPU Timer 2 Clock Source and Prescaler //! //! \param base is the base address of the timer module. //! \param source is the clock source to use for CPU Timer 2 //! \param prescaler is the value that configures the selected clock source //! relative to the system clock //! //! This function selects the specified clock source and prescaler value //! for the CPU timer (CPU timer 2 only). //! //! The \e source parameter can be any one of the following: //! - \b CPUTIMER_CLOCK_SOURCE_SYS - System Clock //! - \b CPUTIMER_CLOCK_SOURCE_INTOSC1 - Internal Oscillator 1 Clock //! - \b CPUTIMER_CLOCK_SOURCE_INTOSC2 - Internal Oscillator 2 Clock //! - \b CPUTIMER_CLOCK_SOURCE_XTAL - External Clock //! - \b CPUTIMER_CLOCK_SOURCE_AUX - Auxiliary PLL Clock //! //! The \e prescaler parameter can be any one of the following: //! - \b CPUTIMER_CLOCK_PRESCALER_1 - Prescaler value of / 1 //! - \b CPUTIMER_CLOCK_PRESCALER_2 - Prescaler value of / 2 //! - \b CPUTIMER_CLOCK_PRESCALER_4 - Prescaler value of / 4 //! - \b CPUTIMER_CLOCK_PRESCALER_8 - Prescaler value of / 8 //! - \b CPUTIMER_CLOCK_PRESCALER_16 - Prescaler value of / 16 //! //! \return None. // //***************************************************************************** static inline void CPUTimer_selectClockSource(uint32_t base, CPUTimer_ClockSource source, CPUTimer_Prescaler prescaler) { do { if(!(base == 0x00000C10U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/cputimer.h", 430); } } while(0); // // Set source and prescaler for CPU Timer 2 // if(base == 0x00000C10U) { __eallow(); // // Set Clock Source // (*((volatile uint16_t *)((uintptr_t)(0x0005D300U + 0x7CU)))) &= ~0x7U; (*((volatile uint16_t *)((uintptr_t)(0x0005D300U + 0x7CU)))) |= (uint16_t)source; // // Set Clock Prescaler // (*((volatile uint16_t *)((uintptr_t)(0x0005D300U + 0x7CU)))) &= ~0x38U; (*((volatile uint16_t *)((uintptr_t)(0x0005D300U + 0x7CU)))) |= ((uint16_t)prescaler << 3U); __edis(); } } //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** //***************************************************************************** // //! Sets Emulation mode for CPU timer. //! //! \param base is the base address of the timer module. //! \param mode is the emulation mode of the timer. //! //! This function sets the behaviour of CPU timer during emulation. Valid //! values mode are: CPUTIMER_EMULATIONMODE_STOPAFTERNEXTDECREMENT, //! CPUTIMER_EMULATIONMODE_STOPATZERO and CPUTIMER_EMULATIONMODE_RUNFREE. //! //! \return None. // //***************************************************************************** extern void CPUTimer_setEmulationMode(uint32_t base, CPUTimer_EmulationMode mode); //***************************************************************************** // // Close the Doxygen group. //! @} // //***************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //########################################################################### // // FILE: dac.h // // TITLE: C28x DAC driver. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup dac_api DAC //! @{ // //***************************************************************************** //########################################################################### // // FILE: hw_dac.h // // TITLE: Definitions for the DAC registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the DAC register offsets // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the DACREV register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the DACCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the DACVALA register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the DACVALS register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the DACOUTEN register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the DACLOCK register // //***************************************************************************** // Lock //***************************************************************************** // // The following are defines for the bit fields in the DACTRIM register // //***************************************************************************** // // A 8-bit register mask // // // Lock Key // //***************************************************************************** // // The following are defines for the reg parameter of the // DAC_lockRegister() and DAC_isRegisterLocked() functions. // //***************************************************************************** //***************************************************************************** // //! Values that can be passed to DAC_setReferenceVoltage() as the \e source //! parameter. // //***************************************************************************** typedef enum { DAC_REF_VDAC = 0, //!< VDAC reference voltage DAC_REF_ADC_VREFHI = 1 //!< ADC VREFHI reference voltage }DAC_ReferenceVoltage; //***************************************************************************** // //! Values that can be passed to DAC_setLoadMode() as the \e mode parameter. // //***************************************************************************** typedef enum { DAC_LOAD_SYSCLK = 0, //!< Load on next SYSCLK DAC_LOAD_PWMSYNC = 4 //!< Load on next PWMSYNC specified by SYNCSEL }DAC_LoadMode; //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** //***************************************************************************** // //! \internal //! Checks DAC base address. //! //! \param base specifies the DAC module base address. //! //! This function determines if an DAC module base address is valid. //! //! \return Returns \b true if the base address is valid and \b false //! otherwise. // //***************************************************************************** static inline _Bool DAC_isBaseValid(uint32_t base) { return((base == 0x00005C00U) || (base == 0x00005C10U) || (base == 0x00005C20U)); } //***************************************************************************** // //! Get the DAC Revision value //! //! \param base is the DAC module base address //! //! This function gets the DAC revision value. //! //! \return Returns the DAC revision value. // //***************************************************************************** static inline uint16_t DAC_getRevision(uint32_t base) { // // Check the arguments. // do { if(!(DAC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dac.h", 163); } } while(0); // // Get the revision value. // return((*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) & 0xFFU); } //***************************************************************************** // //! Sets the DAC Reference Voltage //! //! \param base is the DAC module base address //! \param source is the selected reference voltage //! //! This function sets the DAC reference voltage. //! //! The \e source parameter can have one of two values: //! - \b DAC_REF_VDAC - The VDAC reference voltage //! - \b DAC_REF_ADC_VREFHI - The ADC VREFHI reference voltage //! //! \return None. // //***************************************************************************** static inline void DAC_setReferenceVoltage(uint32_t base, DAC_ReferenceVoltage source) { // // Check the arguments. // do { if(!(DAC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dac.h", 193); } } while(0); // // Set the reference voltage // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x1U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x1U)))) & ~0x1U) | (uint16_t)source; __edis(); } //***************************************************************************** // //! Sets the DAC Load Mode //! //! \param base is the DAC module base address //! \param mode is the selected load mode //! //! This function sets the DAC load mode. //! //! The \e mode parameter can have one of two values: //! - \b DAC_LOAD_SYSCLK - Load on next SYSCLK //! - \b DAC_LOAD_PWMSYNC - Load on next PWMSYNC specified by SYNCSEL //! //! \return None. // //***************************************************************************** static inline void DAC_setLoadMode(uint32_t base, DAC_LoadMode mode) { // // Check the arguments. // do { if(!(DAC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dac.h", 229); } } while(0); // // Set the load mode // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x1U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x1U)))) & ~0x4U) | (uint16_t)mode; __edis(); } //***************************************************************************** // //! Sets the DAC PWMSYNC Signal //! //! \param base is the DAC module base address //! \param signal is the selected PWM signal //! //! This function sets the DAC PWMSYNC signal. //! //! The \e signal parameter must be set to a number that represents the PWM //! signal that will be set. For instance, passing 2 into \e signal will //! select PWM sync signal 2. //! //! \return None. // //***************************************************************************** static inline void DAC_setPWMSyncSignal(uint32_t base, uint16_t signal) { // // Check the arguments. // do { if(!(DAC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dac.h", 264); } } while(0); do { if(!((signal > 0U) && (signal < 17U))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dac.h", 265); } } while(0); // // Set the PWM sync signal // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x1U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x1U)))) & ~0xF0U) | ((uint16_t)(signal - 1U) << 4U); __edis(); } //***************************************************************************** // //! Get the DAC Active Output Value //! //! \param base is the DAC module base address //! //! This function gets the DAC active output value. //! //! \return Returns the DAC active output value. // //***************************************************************************** static inline uint16_t DAC_getActiveValue(uint32_t base) { // // Check the arguments. // do { if(!(DAC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dac.h", 296); } } while(0); // // Get the active value // return((*((volatile uint16_t *)((uintptr_t)(base + 0x2U)))) & 0xFFFU); } //***************************************************************************** // //! Set the DAC Shadow Output Value //! //! \param base is the DAC module base address //! \param value is the 12-bit code to be loaded into the active value register //! //! This function sets the DAC shadow output value. //! //! \return None. // //***************************************************************************** static inline void DAC_setShadowValue(uint32_t base, uint16_t value) { // // Check the arguments. // do { if(!(DAC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dac.h", 322); } } while(0); do { if(!(value <= 0xFFFU)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dac.h", 323); } } while(0); // // Set the shadow value // (*((volatile uint16_t *)((uintptr_t)(base + 0x3U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x3U)))) & ~0xFFFU) | (uint16_t)(value & 0xFFFU); } //***************************************************************************** // //! Get the DAC Shadow Output Value //! //! \param base is the DAC module base address //! //! This function gets the DAC shadow output value. //! //! \return Returns the DAC shadow output value. // //***************************************************************************** static inline uint16_t DAC_getShadowValue(uint32_t base) { // // Check the arguments. // do { if(!(DAC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dac.h", 350); } } while(0); // // Get the shadow value // return((*((volatile uint16_t *)((uintptr_t)(base + 0x3U)))) & 0xFFFU); } //***************************************************************************** // //! Enable the DAC Output //! //! \param base is the DAC module base address //! //! This function enables the DAC output. //! //! \note A delay is required after enabling the DAC. Further details //! regarding the exact delay time length can be found in the device datasheet. //! //! \return None. // //***************************************************************************** static inline void DAC_enableOutput(uint32_t base) { // // Check the arguments. // do { if(!(DAC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dac.h", 378); } } while(0); // // Enable the output // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) |= 0x1U; __edis(); } //***************************************************************************** // //! Disable the DAC Output //! //! \param base is the DAC module base address //! //! This function disables the DAC output. //! //! \return None. // //***************************************************************************** static inline void DAC_disableOutput(uint32_t base) { // // Check the arguments. // do { if(!(DAC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dac.h", 407); } } while(0); // // Disable the output // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) &= ~0x1U; __edis(); } //***************************************************************************** // //! Set DAC Offset Trim //! //! \param base is the DAC module base address //! \param offset is the specified value for the offset trim //! //! This function sets the DAC offset trim. The \e offset value should be a //! signed number in the range of -128 to 127. //! //! \note The offset should not be modified unless specifically indicated by //! TI Errata or other documentation. Modifying the offset value could cause //! this module to operate outside of the datasheet specifications. //! //! \return None. // //***************************************************************************** static inline void DAC_setOffsetTrim(uint32_t base, int16_t offset) { // // Check the arguments. // do { if(!(DAC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dac.h", 442); } } while(0); do { if(!((offset > -129) && (offset < 128))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dac.h", 443); } } while(0); // // Set the offset trim value // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x6U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x6U)))) & ~0xFFU) | (int16_t)offset; __edis(); } //***************************************************************************** // //! Get DAC Offset Trim //! //! \param base is the DAC module base address //! //! This function gets the DAC offset trim value. //! //! \return None. // //***************************************************************************** static inline int16_t DAC_getOffsetTrim(uint32_t base) { uint16_t value; // // Check the arguments. // do { if(!(DAC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dac.h", 475); } } while(0); // // Get the sign-extended offset trim value // value = ((*((volatile uint16_t *)((uintptr_t)(base + 0x6U)))) & 0xFFU); value = ((value & (uint16_t)(0xFFU)) ^ (uint16_t)0x80) - (uint16_t)0x80; return((int16_t)value); } //***************************************************************************** // //! Lock write-access to DAC Register //! //! \param base is the DAC module base address //! \param reg is the selected DAC registers //! //! This function locks the write-access to the specified DAC register. Only a //! system reset can unlock the register once locked. //! //! The \e reg parameter can be an ORed combination of any of the following //! values: //! - \b DAC_LOCK_CONTROL - Lock the DAC control register //! - \b DAC_LOCK_SHADOW - Lock the DAC shadow value register //! - \b DAC_LOCK_OUTPUT - Lock the DAC output enable/disable register //! //! \return None. // //***************************************************************************** static inline void DAC_lockRegister(uint32_t base, uint16_t reg) { // // Check the arguments. // do { if(!(DAC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dac.h", 512); } } while(0); do { if(!((reg & ~((0x1U) | (0x2U) | (0x4U))) == 0U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dac.h", 514); } } while(0); // // Lock the specified registers // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x5U)))) |= ((0xA000U) | reg); __edis(); } //***************************************************************************** // //! Check if DAC Register is locked //! //! \param base is the DAC module base address //! \param reg is the selected DAC register locks to check //! //! This function checks if write-access has been locked on the specified DAC //! register. //! //! The \e reg parameter can be an ORed combination of any of the following //! values: //! - \b DAC_LOCK_CONTROL - Lock the DAC control register //! - \b DAC_LOCK_SHADOW - Lock the DAC shadow value register //! - \b DAC_LOCK_OUTPUT - Lock the DAC output enable/disable register //! //! \return Returns \b true if any of the registers specified are locked, and //! \b false if all specified registers aren't locked. // //***************************************************************************** static inline _Bool DAC_isRegisterLocked(uint32_t base, uint16_t reg) { // // Check the arguments. // do { if(!(DAC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dac.h", 552); } } while(0); do { if(!((reg & ~((0x1U) | (0x2U) | (0x4U))) == 0U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dac.h", 554); } } while(0); // // Return the lock status on the specified registers // return((_Bool)(((*((volatile uint16_t *)((uintptr_t)(base + 0x5U)))) & reg) != 0U)); } //***************************************************************************** // //! Tune DAC Offset Trim //! //! \param base is the DAC module base address //! \param referenceVoltage is the reference voltage the DAC //! module is operating at. //! //! This function adjusts/tunes the DAC offset trim. The \e referenceVoltage //! value should be a floating point number in the range specified in the //! device data manual. //! //! \note Use this function to adjust the DAC offset trim if operating //! at a reference voltage other than 2.5v. Since this function modifies //! the DAC offset trim register, it should only be called once after //! Device_cal. If it is called multiple times after Device_cal, the offset //! value scaled would be the wrong value. //! //! \return None. // //***************************************************************************** extern void DAC_tuneOffsetTrim(uint32_t base, float32_t referenceVoltage); //***************************************************************************** // // Close the Doxygen group. //! @} // //***************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //########################################################################### // // FILE: dcc.h // // TITLE: C28x DCC driver. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup dcc_api DCC //! @{ // //***************************************************************************** //########################################################################### // // FILE: hw_dcc.h // // TITLE: Definitions for the DCC registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the DCC register offsets // //***************************************************************************** // Clears the error signal. // attached to Clock Source 0. // counter attached to Clock Source // 0. // attached to Clock Source 1. // DCC Module. // to Clock Source 0. // attached to Clock Source 0. // to Clock Source 1. // Counter 1. // Counter 0. //***************************************************************************** // // The following are defines for the bit fields in the DCCGCTRL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the DCCCNTSEED0 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the DCCVALIDSEED0 register // //***************************************************************************** // Counter 0 //***************************************************************************** // // The following are defines for the bit fields in the DCCCNTSEED1 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the DCCSTATUS register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the DCCCNT0 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the DCCVALID0 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the DCCCNT1 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the DCCCLKSRC1 register // //***************************************************************************** // Counter 1 // Source Selection for COUNT1 //***************************************************************************** // // The following are defines for the bit fields in the DCCCLKSRC0 register // //***************************************************************************** // Counter 0 // Source Selection for COUNT0 // // The reset value required to start or enable specific DCC operations // // // The reset value required to stop or disable specific DCC operations // // // A 16-bit register mask // // // A 7-bit register mask // // // A mask for the DCC counter seed registers // // // A mask for the DCC counter seed value // //***************************************************************************** // //! The following are defines for the mode parameter of the //! DCC_enableSingleShotMode() function. // //***************************************************************************** typedef enum { //! Use to stop counting when counter0 and valid0 both reach zero DCC_MODE_COUNTER_ZERO = 0xA00U, //! Use to stop counting when counter1 reaches zero DCC_MODE_COUNTER_ONE = 0xB00U } DCC_SingleShotMode; //***************************************************************************** // //! The following are defines for the source parameter of the //! DCC_setCounter1ClkSource() function. // //***************************************************************************** typedef enum { DCC_COUNT1SRC_PLL = 0x0U, //!< PLL021SSP Clock Out Source DCC_COUNT1SRC_AUXPLL = 0x1U, //!< AUXPLL Clock Out Source DCC_COUNT1SRC_INTOSC1 = 0x2U, //!< Internal Oscillator1 Clock Source DCC_COUNT1SRC_INTOSC2 = 0x3U, //!< Internal Oscillator2 Clock Source DCC_COUNT1SRC_CMCLK = 0x5U, //!< CM Clock Source DCC_COUNT1SRC_CPU1SYSCLK = 0x6U, //!< CPU1 System Clock Source DCC_COUNT1SRC_ENETRXCLK = 0x7U, //!< etherNET RXCLK Clock Source DCC_COUNT1SRC_CPU2SYSCLK = 0x8U, //!< CPU2 System Clock Source DCC_COUNT1SRC_CROSSBAR = 0x9U, //!< Input Crossbar Clock Source DCC_COUNT1SRC_AUXCLKIN = 0xAU, //!< AUX Clock input Source DCC_COUNT1SRC_ETPWM = 0xBU, //!< ETPWM Clock Source DCC_COUNT1SRC_LSPCLK = 0xCU, //!< LSP Clock Source DCC_COUNT1SRC_ECATMII0RXCLK = 0xDU, //!< MII0 RXCLK(etherCAT)Clock Source DCC_COUNT1SRC_WDCLK = 0xEU, //!< Watch Dog Clock Source DCC_COUNT1SRC_CANX = 0xFU, //!< CANxBIT Clock Source DCC_COUNT1SRC_ECATMII1RXCLK = 0x17U, //!< MII1 RXCLK(etherCAT) Clk Src } DCC_Count1ClockSource; //***************************************************************************** // //! The following are defines for the source parameter of the //! DCC_setCounter0ClkSource() function. // //***************************************************************************** typedef enum { DCC_COUNT0SRC_XTAL = 0x0U, //!< Accurate Clock Source DCC_COUNT0SRC_INTOSC1 = 0x1U, //!< Internal Oscillator1 Clock Source DCC_COUNT0SRC_INTOSC2 = 0x2U, //!< Internal Oscillator2 Clock Source DCC_COUNT0SRC_CPU1SYSCLK = 0x5U, //!< CPU1 System Clock Source DCC_COUNT0SRC_CPU2SYSCLK = 0x6U, //!< CPU2 System Clock Source DCC_COUNT0SRC_XBAR = 0xCU, //!< Input XBAR Clock Source } DCC_Count0ClockSource; //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** //***************************************************************************** // //! \internal //! Checks DCC base address. //! //! \param base specifies the DCC module base address. //! //! This function determines if an DCC module base address is valid. //! //! \return Returns \b true if the base address is valid and \b false //! otherwise. // //***************************************************************************** static inline _Bool DCC_isBaseValid(uint32_t base) { return((base == 0x0005E700U) || (base == 0x0005E740U) || (base == 0x0005E780U)); } //***************************************************************************** // //! Enables the DCC module. //! //! \param base is the DCC module base address //! //! This function starts the DCC counter operation. //! //! \return None. // //***************************************************************************** static inline void DCC_enableModule(uint32_t base) { // // Check the arguments. // do { if(!(DCC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dcc.h", 205); } } while(0); // // Set DCC enable bit field. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) & ~(0xFU)) | (0xAU); __edis(); } //***************************************************************************** // //! Disable the DCC module. //! //! \param base is the DCC module base address //! //! This function stops the DCC counter operation. //! //! \return None. // //***************************************************************************** static inline void DCC_disableModule(uint32_t base) { // // Check the arguments. // do { if(!(DCC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dcc.h", 235); } } while(0); // // Reset DCC enable bit field. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) & ~(0xFU)) | (0x5U); __edis(); } //***************************************************************************** // //! Enable DCC Error Signal //! //! \param base is the DCC module base address //! //! This function enables the error signal interrupt. //! //! \return None. // //***************************************************************************** static inline void DCC_enableErrorSignal(uint32_t base) { // // Check the arguments. // do { if(!(DCC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dcc.h", 265); } } while(0); // // Enable the error signal // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) & ~(0xF0U)) | ((0xAU) << 4U); __edis(); } //***************************************************************************** // //! Enable DCC Done Signal //! //! \param base is the DCC module base address //! //! This function enables the done signal interrupt. //! //! \return None. // //***************************************************************************** static inline void DCC_enableDoneSignal(uint32_t base) { // // Check the arguments. // do { if(!(DCC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dcc.h", 296); } } while(0); // // Enable the done interrupt signal // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) & ~(0xF000U)) | ((0xAU) << 12U); __edis(); } //***************************************************************************** // //! Disable DCC Error Signal //! //! \param base is the DCC module base address //! //! This function disables the error signal interrupt. //! //! \return None. // //***************************************************************************** static inline void DCC_disableErrorSignal(uint32_t base) { // // Check the arguments. // do { if(!(DCC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dcc.h", 327); } } while(0); // // Disable the error signal // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) & ~(0xF0U)) | ((0x5U) << 4U); __edis(); } //***************************************************************************** // //! Disable DCC Done Signal //! //! \param base is the DCC module base address //! //! This function disables the done signal interrupt. //! //! \return None. // //***************************************************************************** static inline void DCC_disableDoneSignal(uint32_t base) { // // Check the arguments. // do { if(!(DCC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dcc.h", 358); } } while(0); // // Disable the done interrupt signal // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) & ~(0xF000U)) | ((0x5U) << 12U); __edis(); } //***************************************************************************** // //! Enable DCC Single-Shot Mode //! //! \param base is the DCC module base address //! \param mode is the selected Single-Shot operation mode //! //! This function enables the single-shot mode and sets the operation mode. //! //! The \e mode parameter can have one of two values: //! - \b DCC_MODE_COUNTER_ZERO - Stops counting when counter0 and valid0 both //! reach zero //! - \b DCC_MODE_COUNTER_ONE - Stops counting when counter1 reaches zero //! //! \return None. // //***************************************************************************** static inline void DCC_enableSingleShotMode(uint32_t base, DCC_SingleShotMode mode) { // // Check the arguments. // do { if(!(DCC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dcc.h", 395); } } while(0); // // Set Single-Shot mode value to the appropriate register // if(mode == DCC_MODE_COUNTER_ZERO) { __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) & ~(0xF00U)) | (uint16_t)DCC_MODE_COUNTER_ZERO; __edis(); } else { __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) & ~(0xF00U)) | (uint16_t)DCC_MODE_COUNTER_ONE; __edis(); } } //***************************************************************************** // //! Disable DCC Single-Shot Mode //! //! \param base is the DCC module base address //! //! This function disables the DCC Single-Shot operation mode //! //! \return None. // //***************************************************************************** static inline void DCC_disableSingleShotMode(uint32_t base) { // // Check the arguments. // do { if(!(DCC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dcc.h", 439); } } while(0); // // Reset Single-Shot enable bit field. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) & ~(0xF00U)) | ((0x5U) << 8U); __edis(); } //***************************************************************************** // //! Get Error Flag Status //! //! \param base is the DCC module base address //! //! This function gets the error flag status. //! //! \return Returns \b true if an error has occurred, \b false if no errors //! have occurred. // //***************************************************************************** static inline _Bool DCC_getErrorStatus(uint32_t base) { // // Check the arguments. // do { if(!(DCC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dcc.h", 471); } } while(0); // // Get the error flag // return((_Bool)(((*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) & 0x1U) == 0x1U)); } //***************************************************************************** // //! Get Single-Shot Done Flag Status //! //! \param base is the DCC module base address //! //! This function gets the single-shot done flag status. //! //! \return Returns \b true if single-shot mode has completed, \b false if //! single-shot mode has not completed. // //***************************************************************************** static inline _Bool DCC_getSingleShotStatus(uint32_t base) { // // Check the arguments. // do { if(!(DCC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dcc.h", 498); } } while(0); // // Read the done flag // return((_Bool)(((*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) & 0x2U) == 0x2U)); } //***************************************************************************** // //! Clear Error Status Flag //! //! \param base is the DCC module base address //! //! This function clears the DCC error status flag. //! //! \return None. // //***************************************************************************** static inline void DCC_clearErrorFlag(uint32_t base) { // // Check the arguments. // do { if(!(DCC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dcc.h", 524); } } while(0); // // Clear error status flag // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) |= 0x1U; __edis(); } //***************************************************************************** // //! Clear Single-Shot Done Status Flag //! //! \param base is the DCC module base address //! //! This function clears the DCC single-shot done status flag. //! //! \return None. // //***************************************************************************** static inline void DCC_clearDoneFlag(uint32_t base) { // // Check the arguments. // do { if(!(DCC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dcc.h", 553); } } while(0); // // Clear done status flag // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) |= 0x2U; __edis(); } //***************************************************************************** // //! Get Current Value of Counter 0 //! //! \param base is the DCC module base address //! //! This function gets current value of counter 0. //! //! \note Reads of the counter value may not be exact since the read operation //! is synchronized to the vbus clock. //! //! \return Returns the current value of counter 0. // //***************************************************************************** static inline uint32_t DCC_getCounter0Value(uint32_t base) { // // Check the arguments. // do { if(!(DCC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dcc.h", 585); } } while(0); // // Get the current counter 0 value // return((*((volatile uint32_t *)((uintptr_t)(base + 0x18U))))); } //***************************************************************************** // //! Get Current Value of the Valid Duration Counter for Counter 0 //! //! \param base is the DCC module base address //! //! This function gets current value of the valid duration counter for //! counter 0. //! //! \note Reads of the counter value may not be exact since the read operation //! is synchronized to the vbus clock. //! //! \return Returns the current value of the valid duration counter. // //***************************************************************************** static inline uint16_t DCC_getValidCounter0Value(uint32_t base) { // // Check the arguments. // do { if(!(DCC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dcc.h", 614); } } while(0); // // Get the current valid duration counter value // return((*((volatile uint16_t *)((uintptr_t)(base + 0x1CU))))); } //***************************************************************************** // //! Get Current Value of Counter 1 //! //! \param base is the DCC module base address //! //! This function gets current value of counter 1. //! //! \note Reads of the counter value may not be exact since the read operation //! is synchronized to the vbus clock. //! //! \return Returns the current value of counter 1. // //***************************************************************************** static inline uint32_t DCC_getCounter1Value(uint32_t base) { // // Check the arguments. // do { if(!(DCC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dcc.h", 642); } } while(0); // // Get the current counter 1 value // return((*((volatile uint32_t *)((uintptr_t)(base + 0x20U))))); } //***************************************************************************** // //! Set Counter 1 Clock Source //! //! \param base is the DCC module base address //! \param source is the selected clock source for counter 1 //! //! This function sets the counter 1 clock source. //! //! The \e source parameter can have one of following values: //! - \b DCC_COUNT1SRC_PLL - PLL021SSP Clock Out Source //! - \b DCC_COUNT1SRC_AUXPLL - AUXPLL Clock Out Source //! - \b DCC_COUNT1SRC_INTOSC1 - Internal Oscillator1 Clock Source //! - \b DCC_COUNT1SRC_INTOSC2 - Internal Oscillator2 Clock Source //! - \b DCC_COUNT1SRC_CMCLK - CM Clock Source //! - \b DCC_COUNT1SRC_CPU1SYSCLK - CPU1 System Clock Source //! - \b DCC_COUNT1SRC_ENETRXCLK - etherNET RXCLK Clock Source //! - \b DCC_COUNT1SRC_CPU2SYSCLK - CPU2 System Clock Source //! - \b DCC_COUNT1SRC_CROSSBAR - Input Crossbar Clock Source //! - \b DCC_COUNT1SRC_AUXCLKIN - AUX Clock input Source //! - \b DCC_COUNT1SRC_ETPWM - ETPWM Clock Source //! - \b DCC_COUNT1SRC_LSPCLK - LSP Clock Source //! - \b DCC_COUNT1SRC_ECATMII0RXCLK - MII0 RXCLK(etherCAT)Clock Source //! - \b DCC_COUNT1SRC_WDCLK - Watch Dog Clock Source //! - \b DCC_COUNT1SRC_CANX - CANxBIT Clock Source //! - \b DCC_COUNT1SRC_ECATMII1RXCLK - MII1 RXCLK(etherCAT) Clk Src //! //! \return None. // //***************************************************************************** static inline void DCC_setCounter1ClkSource(uint32_t base, DCC_Count1ClockSource source) { // // Check the arguments. // do { if(!(DCC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dcc.h", 686); } } while(0); // // Set the specified clock source // __eallow(); // // DCC Clk source is of 5bits DCCCLKSRC1[4:0] // (*((volatile uint16_t *)((uintptr_t)(base + 0x24U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x24U)))) & ((0x7FU) << 5U)) | (((0xAU) << 12U) | (uint16_t)source); __edis(); } //***************************************************************************** // //! Set Counter 0 Clock Source //! //! \param base is the DCC module base address //! \param source is the selected clock source for counter 0 //! //! This function sets the counter 0 clock source. //! //! The \e source parameter can have one of following values: //! - \b DCC_COUNT0SRC_XTAL - Accurate Clock Source //! - \b DCC_COUNT0SRC_INTOSC1 - Internal Oscillator1 Clock Source //! - \b DCC_COUNT0SRC_INTOSC2 - Internal Oscillator2 Clock Source //! - \b DCC_COUNT0SRC_CPU1SYSCLK - CPU1 System Clock Source //! - \b DCC_COUNT0SRC_CPU2SYSCLK - CPU2 System Clock Source //! - \b DCC_COUNT0SRC_XBAR - Input XBAR Clock Source //! //! \return None. // //***************************************************************************** static inline void DCC_setCounter0ClkSource(uint32_t base, DCC_Count0ClockSource source) { // // Check the arguments. // do { if(!(DCC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dcc.h", 730); } } while(0); // // Set the specified clock source // __eallow(); // // DCC Clk source is of 5bits DCCCLKSRC0[4:0] // (*((volatile uint16_t *)((uintptr_t)(base + 0x28U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x28U)))) & ((0x7FU) << 5U)) | (((0xAU) << 12U) | (uint16_t)source); __edis(); } //***************************************************************************** // //! Get Counter 1 Clock Source //! //! \param base is the DCC module base address //! //! This function gets the counter 1 clock source. //! //! \return Returns one of the following enumerated source values: //! - \b DCC_COUNT1SRC_PLL - PLL021SSP Clock Out Source //! - \b DCC_COUNT1SRC_AUXPLL - AUXPLL Clock Out Source //! - \b DCC_COUNT1SRC_INTOSC1 - Internal Oscillator1 Clock Source //! - \b DCC_COUNT1SRC_INTOSC2 - Internal Oscillator2 Clock Source //! - \b DCC_COUNT1SRC_CMCLK - CM Clock Source //! - \b DCC_COUNT1SRC_CPU1SYSCLK - CPU1 System Clock Source //! - \b DCC_COUNT1SRC_ENETRXCLK - etherNET RXCLK Clock Source //! - \b DCC_COUNT1SRC_CPU2SYSCLK - CPU2 System Clock Source //! - \b DCC_COUNT1SRC_CROSSBAR - Input Crossbar Clock Source //! - \b DCC_COUNT1SRC_AUXCLKIN - AUX Clock input Source //! - \b DCC_COUNT1SRC_ETPWM - ETPWM Clock Source //! - \b DCC_COUNT1SRC_LSPCLK - LSP Clock Source //! - \b DCC_COUNT1SRC_ECATMII0RXCLK - MII0 RXCLK(etherCAT)Clock Source //! - \b DCC_COUNT1SRC_WDCLK - Watch Dog Clock Source //! - \b DCC_COUNT1SRC_CANX - CANxBIT Clock Source //! - \b DCC_COUNT1SRC_ECATMII1RXCLK - MII1 RXCLK(etherCAT) Clk Src // //***************************************************************************** static inline uint16_t DCC_getCounter1ClkSource(uint32_t base) { // // Check the arguments. // do { if(!(DCC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dcc.h", 782); } } while(0); // // Get the specified clock source // return((*((volatile uint16_t *)((uintptr_t)(base + 0x24U)))) & 0x1FU); } //***************************************************************************** // //! Get Counter 0 Clock Source //! //! \param base is the DCC module base address //! //! This function gets the counter 0 clock source. //! //! \return Returns one of the following enumerated source values: //! - \b DCC_COUNT0SRC_XTAL - Accurate Clock Source //! - \b DCC_COUNT0SRC_INTOSC1 - Internal Oscillator1 Clock Source //! - \b DCC_COUNT0SRC_INTOSC2 - Internal Oscillator2 Clock Source //! - \b DCC_COUNT0SRC_CPU1SYSCLK - CPU1 System Clock Source //! - \b DCC_COUNT0SRC_CPU2SYSCLK - CPU2 System Clock Source //! - \b DCC_COUNT0SRC_XBAR - Input XBAR Clock Source // //***************************************************************************** static inline uint16_t DCC_getCounter0ClkSource(uint32_t base) { // // Check the arguments. // do { if(!(DCC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dcc.h", 813); } } while(0); // // Get the specified clock source // return((*((volatile uint16_t *)((uintptr_t)(base + 0x28U)))) & 0xFU); } //***************************************************************************** // //! Set the seed values //! //! \param base is the DCC module base address //! \param counter0 sets the seed value that gets loaded into Counter 0 //! \param validCounter0 sets the seed value that gets loaded into the valid //! duration counter for Counter 0 //! \param counter1 sets the seed value that gets loaded into Counter 1 //! //! This function sets the seed values for Counter 0, Valid Duration Counter 0, //! and Counter 1. //! //! \note //! -# Operating DCC with '0' set as the seed value for Counter 0, Valid //! Duration Counter 0, and/or Counter 1 will result in undefined operation. //! -# The Valid Duration Counter 0 is designed to be at least four cycles //! wide and shouldn't be programmed with a value less than '4'. //! //! \return None. // //***************************************************************************** static inline void DCC_setCounterSeeds(uint32_t base, uint32_t counter0, uint32_t validCounter0, uint32_t counter1) { // // Check the arguments. // do { if(!(DCC_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dcc.h", 850); } } while(0); do { if(!(validCounter0 >= 4U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dcc.h", 851); } } while(0); do { if(!(counter0 > 0U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dcc.h", 852); } } while(0); do { if(!(counter1 > 0U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dcc.h", 853); } } while(0); __eallow(); // // Set Counter 0 Seed // (*((volatile uint16_t *)((uintptr_t)(base + 0x8U)))) = counter0 & (0xFFFFU); (*((volatile uint16_t *)((uintptr_t)(base + 0x8U + 2U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x8U + 2U)))) & (0xFFF0U)) | ((uint32_t)(counter0 & (0xF0000U)) >> 16U); // // Set Valid Duration Counter 0 Seed // (*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) = validCounter0; // // Set Counter 1 Seed // (*((volatile uint16_t *)((uintptr_t)(base + 0x10U)))) = counter1 & (0xFFFFU); (*((volatile uint16_t *)((uintptr_t)(base + 0x10U + 2U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x10U + 2U)))) & (0xFFF0U)) | ((uint32_t)(counter1 & (0xF0000U)) >> 16U); __edis(); } //***************************************************************************** // // Close the Doxygen group. //! @} // //***************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //############################################################################# // // FILE: dcsm.h // // TITLE: C28x Driver for the DCSM security module. // //############################################################################# // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //############################################################################# //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup dcsm_api DCSM //! @{ // //***************************************************************************** //########################################################################### // // FILE: hw_dcsm.h // // TITLE: Definitions for the DCSM registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the DCSM register offsets // //***************************************************************************** // Register // Register 1 // Register 2 // Register 3 // Register 4 // 0 // 1 // Register 1 // Register 2 // Register 3 // Register 4 // Register // Register-1 // Register-2 // Register-3 // Register-4 // Register 1 // Register 2 // Register 3 // Register 1 // Register 2 // Register 3 // Status Register 1 // Status Register 2 // Status Register 1 // Register 0 // Register 1 // Register 2 // Register 3 // Register-1 // Register-2 // Register-3 // Register-4 // Register 1 // Register 2 // Register 3 // Register 1 // Register 2 // Register 3 // Status Register 1 // Status Register 2 // Status Register 1 // Register // 1 // 2 // 3 // Register //***************************************************************************** // // The following are defines for the bit fields in the Z1_LINKPOINTER register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the Z1_OTPSECLOCK register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the Z1_JLM_ENABLE register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the Z1_LINKPOINTERERR register // //***************************************************************************** // pointer from OTP loaded values //***************************************************************************** // // The following are defines for the bit fields in the Z1_CR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the Z1_GRABSECT1R register // //***************************************************************************** // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK //***************************************************************************** // // The following are defines for the bit fields in the Z1_GRABSECT2R register // //***************************************************************************** // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK //***************************************************************************** // // The following are defines for the bit fields in the Z1_GRABSECT3R register // //***************************************************************************** // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK //***************************************************************************** // // The following are defines for the bit fields in the Z1_GRABRAM1R register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the Z1_GRABRAM2R register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the Z1_GRABRAM3R register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the Z1_EXEONLYSECT1R register // //***************************************************************************** // in flash CPU1 BANK // in flash CPU1 BANK // in flash CPU1 BANK // in flash CPU1 BANK // in flash CPU1 BANK // in flash CPU1 BANK // in flash CPU1 BANK // in flash CPU1 BANK // in flash CPU1 BANK // in flash CPU1 BANK // in flash CPU1 BANK // in flash CPU1 BANK // in flash CPU1 BANK // in flash CPU1 BANK // in flash CM BANK // in flash CM BANK // in flash CM BANK // in flash CM BANK // in flash CM BANK // in flash CM BANK // in flash CM BANK // in flash CM BANK // in flash CM BANK // in flash CM BANK // in flash CM BANK // in flash CM BANK // in flash CM BANK // in flash CM BANK //***************************************************************************** // // The following are defines for the bit fields in the Z1_EXEONLYSECT2R register // //***************************************************************************** // in flash CPU2 BANK // in flash CPU2 BANK // in flash CPU2 BANK // in flash CPU2 BANK // in flash CPU2 BANK // in flash CPU2 BANK // in flash CPU2 BANK // in flash CPU2 BANK // in flash CPU2 BANK // in flash CPU2 BANK // in flash CPU2 BANK // in flash CPU2 BANK // in flash CPU2 BANK // in flash CPU2 BANK //***************************************************************************** // // The following are defines for the bit fields in the Z1_EXEONLYRAM1R register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the Z2_LINKPOINTER register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the Z2_OTPSECLOCK register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the Z2_LINKPOINTERERR register // //***************************************************************************** // pointer from OTP loaded values //***************************************************************************** // // The following are defines for the bit fields in the Z2_CR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the Z2_GRABSECT1R register // //***************************************************************************** // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK //***************************************************************************** // // The following are defines for the bit fields in the Z2_GRABSECT2R register // //***************************************************************************** // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK //***************************************************************************** // // The following are defines for the bit fields in the Z2_GRABSECT3R register // //***************************************************************************** // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK // BANK //***************************************************************************** // // The following are defines for the bit fields in the Z2_GRABRAM1R register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the Z2_GRABRAM2R register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the Z2_GRABRAM3R register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the Z2_EXEONLYSECT1R register // //***************************************************************************** // in flash CPU1 BANK // in flash CPU1 BANK // in flash CPU1 BANK // in flash CPU1 BANK // in flash CPU1 BANK // in flash CPU1 BANK // in flash CPU1 BANK // in flash CPU1 BANK // in flash CPU1 BANK // in flash CPU1 BANK // in flash CPU1 BANK // in flash CPU1 BANK // in flash CPU1 BANK // in flash CPU1 BANK // in flash CM BANK // in flash CM BANK // in flash CM BANK // in flash CM BANK // in flash CM BANK // in flash CM BANK // in flash CM BANK // in flash CM BANK // in flash CM BANK // in flash CM BANK // in flash CM BANK // in flash CM BANK // in flash CM BANK // in flash CM BANK //***************************************************************************** // // The following are defines for the bit fields in the Z2_EXEONLYSECT2R register // //***************************************************************************** // in flash CPU2 BANK // in flash CPU2 BANK // in flash CPU2 BANK // in flash CPU2 BANK // in flash CPU2 BANK // in flash CPU2 BANK // in flash CPU2 BANK // in flash CPU2 BANK // in flash CPU2 BANK // in flash CPU2 BANK // in flash CPU2 BANK // in flash CPU2 BANK // in flash CPU2 BANK // in flash CPU2 BANK //***************************************************************************** // // The following are defines for the bit fields in the Z2_EXEONLYRAM1R register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the FLSEM register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SECTSTAT1 register // //***************************************************************************** // Sector 0 // sector 1 // Sector 2 // Sector 3 // Sector 4 // Sector 5 // Sector 6 // Sector 7 // sector 8 // Sector 9 // Sector 10 // Sector 11 // Sector 12 // Sector 13 //***************************************************************************** // // The following are defines for the bit fields in the SECTSTAT2 register // //***************************************************************************** // Sector 0 // sector 1 // Sector 2 // Sector 3 // Sector 4 // Sector 5 // Sector 6 // Sector 7 // sector 8 // Sector 9 // Sector 10 // Sector 11 // Sector 12 // Sector 13 //***************************************************************************** // // The following are defines for the bit fields in the SECTSTAT3 register // //***************************************************************************** // Sector 0 // sector 1 // Sector 2 // Sector 3 // Sector 4 // Sector 5 // Sector 6 // Sector 7 // sector 8 // Sector 9 // Sector 10 // Sector 11 // Sector 12 // Sector 13 //***************************************************************************** // // The following are defines for the bit fields in the RAMSTAT1 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the RAMSTAT2 register // //***************************************************************************** // MSG RAM 1 // MSG RAM 2 // MSG RAM 1 // MSG RAM 2 // MSG RAM 1 // MSG RAM 2 // MSG RAM 1 // MSG RAM 2 // MSG RAM 1 // MSG RAM 2 // MSG RAM 1 // MSG RAM 2 //***************************************************************************** // // The following are defines for the bit fields in the RAMSTAT3 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SECERRSTAT register // //***************************************************************************** // Error Status //***************************************************************************** // // The following are defines for the bit fields in the SECERRCLR register // //***************************************************************************** // Load Error Status Bit //***************************************************************************** // // The following are defines for the bit fields in the SECERRFRC register // //***************************************************************************** // Load Error Status Bit //***************************************************************************** // // Defines for the unlockZone1CSM() and unlockZone2CSM(). // These are not parameters for any function. // These are not intended for application code. // //***************************************************************************** //***************************************************************************** // // Register key defines. // //***************************************************************************** //***************************************************************************** // //! Data structures to hold password keys. // //***************************************************************************** typedef struct { uint32_t csmKey0; uint32_t csmKey1; uint32_t csmKey2; uint32_t csmKey3; } DCSM_CSMPasswordKey; //***************************************************************************** // //! Values to distinguish the status of RAM or FLASH sectors. These values //! describe which zone the memory location belongs too. //! These values can be returned from DCSM_getRAMZone(), //! DCSM_getFlashSectorZone(). // //***************************************************************************** typedef enum { DCSM_MEMORY_INACCESSIBLE, //!< Inaccessible DCSM_MEMORY_ZONE1, //!< Zone 1 DCSM_MEMORY_ZONE2, //!< Zone 2 DCSM_MEMORY_FULL_ACCESS //!< Full access } DCSM_MemoryStatus; //***************************************************************************** // //! Values to pass to DCSM_claimZoneSemaphore(). These values are used //! to describe the zone that can write to Flash Wrapper registers. // //***************************************************************************** typedef enum { DCSM_FLSEM_ZONE1 = 0x01U, //!< Flash semaphore Zone 1 DCSM_FLSEM_ZONE2 = 0x02U //!< Flash semaphore Zone 2 } DCSM_SemaphoreZone; //***************************************************************************** // //! Values to distinguish the security status of the zones. //! These values can be returned from DCSM_getZone1CSMSecurityStatus(), //! DCSM_getZone2CSMSecurityStatus(). // //***************************************************************************** typedef enum { DCSM_STATUS_SECURE, //!< Secure DCSM_STATUS_UNSECURE, //!< Unsecure DCSM_STATUS_LOCKED, //!< Locked DCSM_STATUS_BLOCKED //!< Blocked } DCSM_SecurityStatus; //***************************************************************************** // // Values to distinguish the status of the Control Registers. These values // describe can be used with the return values of // DCSM_getZone1ControlStatus(), and DCSM_getZone2ControlStatus(). // //***************************************************************************** //***************************************************************************** // //! Values to decribe the EXEONLY Status. //! These values are returned from to DCSM_getZone1RAMEXEStatus(), //! DCSM_getZone2RAMEXEStatus(), DCSM_getZone1FlashEXEStatus(), //! DCSM_getZone2FlashEXEStatus(). // //***************************************************************************** typedef enum { DCSM_PROTECTED, //!< Protected DCSM_UNPROTECTED, //!< Unprotected DCSM_INCORRECT_ZONE //!< Incorrect Zone }DCSM_EXEOnlyStatus; //***************************************************************************** // //! Values to distinguish RAM Module. //! These values can be passed to DCSM_getZone1RAMEXEStatus() //! DCSM_getZone2RAMEXEStatus(), DCSM_getRAMZone(). // //***************************************************************************** typedef enum { // //C28x RAMs // DCSM_RAMLS0, //!< RAMLS0 DCSM_RAMLS1, //!< RAMLS1 DCSM_RAMLS2, //!< RAMLS2 DCSM_RAMLS3, //!< RAMLS3 DCSM_RAMLS4, //!< RAMLS4 DCSM_RAMLS5, //!< RAMLS5 DCSM_RAMLS6, //!< RAMLS6 DCSM_RAMLS7, //!< RAMLS7 DCSM_RAMD0, //!< RAMD0 DCSM_RAMD1, //!< RAMD1 DCSM_C28_RAM_END, // //CM RAMs // DCSM_RAM_CM_C0 , //!< RAM CM C0 DCSM_RAM_CM_C1 , //!< RAM CM C1 DCSM_RAM1_CPU1_CM , //!< CPU1 to CM Message RAM 1 DCSM_RAM2_CPU1_CM , //!< CPU1 to CM Message RAM 2 DCSM_RAM1_CM_CPU1 , //!< CM to CPU1 Message RAM 1 DCSM_RAM2_CM_CPU1 , //!< CM to CPU1 Message RAM 2 DCSM_RAM1_CPU2_CM , //!< CPU2 to CM Message RAM 1 DCSM_RAM2_CPU2_CM , //!< CPU2 to CM Message RAM 2 DCSM_RAM1_CM_CPU2 , //!< CM to CPU2 Message RAM 1 DCSM_RAM2_CM_CPU2 , //!< CM to CPU2 Message RAM 2 DCSM_RAM1_CPU1_CPU2, //!< CPU1 to CPU2 Message RAM 1 DCSM_RAM2_CPU1_CPU2, //!< CPU1 to CPU2 Message RAM 2 DCSM_RAM1_CPU2_CPU1, //!< CPU2 to CPU1 Message RAM 1 DCSM_RAM2_CPU2_CPU1, //!< CPU2 to CPU1 Message RAM 2 DCSM_CM_RAM_END, } DCSM_RAMModule; //***************************************************************************** // //! Values to distinguish Flash Sector. //! These values can be passed to DCSM_getZone1FlashEXEStatus() //! DCSM_getZone2FlashEXEStatus(), DCSM_getFlashSectorZone(). // //***************************************************************************** typedef enum { DCSM_SECTOR_0, //!< Sector 0 DCSM_SECTOR_1, //!< Sector 1 DCSM_SECTOR_2, //!< Sector 2 DCSM_SECTOR_3, //!< Sector 3 DCSM_SECTOR_4, //!< Sector 4 DCSM_SECTOR_5, //!< Sector 5 DCSM_SECTOR_6, //!< Sector 6 DCSM_SECTOR_7, //!< Sector 7 DCSM_SECTOR_8, //!< Sector 8 DCSM_SECTOR_9, //!< Sector 9 DCSM_SECTOR_10, //!< Sector 10 DCSM_SECTOR_11, //!< Sector 11 DCSM_SECTOR_12, //!< Sector 12 DCSM_SECTOR_13 //!< Sector 13 } DCSM_Sector; //***************************************************************************** // //! The following are values that can be passed to DCSM_getRAMZone(), //! DCSM_getZone2FlashEXEStatus() ,DCSM_getZone1FlashEXEStatus() & //! DCSM_getFlashSectorZone() as \e cpuInst parameter. // //***************************************************************************** typedef enum { //! To access CPU1 Memory DCSM_CPUSEL_CPU1 = 0x0U, //! To access CPU2 Memory DCSM_CPUSEL_CPU2 = 0x2U, //! To access CM Memory DCSM_CPUSEL_CM = 0x1U } DCSM_CPUSel; //***************************************************************************** // //! The following are values that can be passed to //! DCSM_getZone1OTPSecureLockStatus() & DCSM_getZone2OTPSecureLockStatus() //! as \e lockType parameter. // //***************************************************************************** typedef enum { //! JTAG Lock Status DCSM_OTPSECLOCK_JTAG = 0x0U, //! Zone Password Lock DCSM_OTPSECLOCK_PSWDLOCK = 0x1U, //! Zone CRC Lock DCSM_OTPSECLOCK_CRCLOCK = 0x2U, } DCSM_OTPLock; //***************************************************************************** // // Defines for the EXEONLYSECTxR register. // These values can be used in the DCSM_getZone1FlashEXEStatus() & // DCSM_getZone2FlashEXEStatus(). // //***************************************************************************** //***************************************************************************** // // Defines for the Z1_CR & Z2_CR register. // These values can be used in the DCSM_getZone1ControlStatus() & // DCSM_getZone2ControlStatus(). // //***************************************************************************** //***************************************************************************** // // Defines for the EXEONLYRAM1R register for Zone 1 and Zone 2. // These values can be used in the DCSM_getZone1RAMEXEStatus(), // DCSM_getZone1RAMEXEStatus(). // //***************************************************************************** //***************************************************************************** // // Defines for the OTPSECLOCK register. // These values can be used in the DCSM_getZone1OTPSecureLockStatus() // & DCSM_getZone2OTPSecureLockStatus() // //***************************************************************************** //***************************************************************************** // // DCSM functions // //***************************************************************************** //***************************************************************************** // //! Secures zone 1 by setting the FORCESEC bit of Z1_CR register //! //! This function resets the state of the zone. If the zone is unlocked, //! it will lock(secure) the zone and also reset all the bits in the //! Control Register. //! //! \return None. // //***************************************************************************** static inline void DCSM_secureZone1(void) { // // Write to the FORCESEC bit. // (*((volatile uint32_t *)((uintptr_t)(0x0005F000U + 0x18U))))|= 0x80000000U; } //***************************************************************************** // //! Secures zone 2 by setting the FORCESEC bit of Z2_CR register //! //! This function resets the state of the zone. If the zone is unlocked, //! it will lock(secure) the zone and also reset all the bits in the //! Control Register. //! //! \return None. // //***************************************************************************** static inline void DCSM_secureZone2(void) { // // Write to the FORCESEC bit. // (*((volatile uint32_t *)((uintptr_t)(0x0005F080U + 0x18U))))|= 0x80000000U; } //***************************************************************************** // //! Returns the CSM security status of zone 1 //! //! This function returns the security status of zone 1 CSM //! //! \return Returns security status as an enumerated type DCSM_SecurityStatus. // //***************************************************************************** static inline DCSM_SecurityStatus DCSM_getZone1CSMSecurityStatus(void) { uint32_t status; DCSM_SecurityStatus returnStatus; status = (*((volatile uint32_t *)((uintptr_t)(0x0005F000U + 0x18U)))); // // if ARMED bit is set and UNSECURED bit is set then CSM is unsecured. // Else it is secure. // if(((status & 0x400000U) != 0U) && ((status & 0x200000U) != 0U)) { returnStatus = DCSM_STATUS_UNSECURE; } else if((status & 0x100000U) == 0x100000U) { returnStatus = DCSM_STATUS_BLOCKED; } else if((status & 0x80000U) == 0x80000U) { returnStatus = DCSM_STATUS_LOCKED; } else { returnStatus = DCSM_STATUS_SECURE; } return(returnStatus); } //***************************************************************************** // //! Returns the CSM security status of zone 2 //! //! This function returns the security status of zone 2 CSM //! //! \return Returns security status as an enumerated type DCSM_SecurityStatus. // //***************************************************************************** static inline DCSM_SecurityStatus DCSM_getZone2CSMSecurityStatus(void) { uint32_t status; DCSM_SecurityStatus returnStatus; status = (*((volatile uint32_t *)((uintptr_t)(0x0005F080U + 0x18U)))); // // if ARMED bit is set and UNSECURED bit is set then CSM is unsecured. // Else it is secure. // if(((status & 0x400000U) != 0U) && ((status & 0x200000U) != 0U)) { returnStatus = DCSM_STATUS_UNSECURE; } else if((status & 0x100000U) == 0x100000U) { returnStatus = DCSM_STATUS_BLOCKED; } else if((status & 0x80000U) == 0x80000U) { returnStatus = DCSM_STATUS_LOCKED; } else { returnStatus = DCSM_STATUS_SECURE; } return(returnStatus); } //***************************************************************************** // //! Returns the Control Status of zone 1 //! //! This function returns the Control Status of zone 1 CSM //! //! \return Returns the contents of the Control Register which can be //! used with provided defines. // //***************************************************************************** static inline uint16_t DCSM_getZone1ControlStatus(void) { uint32_t stat; // // Return the contents of the CR register. // stat = (((*((volatile uint32_t *)((uintptr_t)(0x0005F000U + 0x18U))))) >> 16U); return((uint16_t)stat); } //***************************************************************************** // //! Returns the Control Status of zone 2 //! //! This function returns the Control Status of zone 2 CSM //! //! \return Returns the contents of the Control Register which can be //! used with the provided defines. // //***************************************************************************** static inline uint16_t DCSM_getZone2ControlStatus(void) { uint32_t stat; // // Return the contents of the CR register. // stat = (((*((volatile uint32_t *)((uintptr_t)(0x0005F080U + 0x18U))))) >> 16U); return((uint16_t)stat); } //***************************************************************************** // //! Returns the security zone a RAM section belongs to //! //! \param module is the RAM module value. Valid values are type DCSM_RAMModule //! C28x RAMs : //! - \b DCSM_RAMLS0 //! - \b DCSM_RAMLS1 //! - \b DCSM_RAMLS2 //! - \b DCSM_RAMLS3 //! - \b DCSM_RAMLS4 //! - \b DCSM_RAMLS5 //! - \b DCSM_RAMLS6 //! - \b DCSM_RAMLS7 //! - \b DCSM_RAMD0 //! - \b DCSM_RAMD1 //! CM RAMs : //! - \b DCSM_RAM_CM_C0 //! - \b DCSM_RAM_CM_C1 //! - \b DCSM_RAM1_CPU1_CM //! - \b DCSM_RAM2_CPU1_CM //! - \b DCSM_RAM1_CM_CPU1 //! - \b DCSM_RAM2_CM_CPU1 //! - \b DCSM_RAM1_CPU2_CM //! - \b DCSM_RAM2_CPU2_CM //! - \b DCSM_RAM1_CM_CPU2 //! - \b DCSM_RAM2_CM_CPU2 //! - \b DCSM_RAM1_CPU1_CPU2 //! - \b DCSM_RAM2_CPU1_CPU2 //! - \b DCSM_RAM1_CPU2_CPU1 //! - \b DCSM_RAM2_CPU2_CPU1 //! //! \param cpuInst is the CPU whose RAM Section needs to be accessed . //! //! The \e cpuInst parameter can have one of the following values of the //! DCSM_CPUSel type: //! - \b DCSM_CPUSEL_CPU1 - To access CPU1 RAM //! - \b DCSM_CPUSEL_CPU2 - To access CPU2 RAM //! - \b DCSM_CPUSEL_CM - To access CM RAM //! //! \note DCSM_CPUSEL_CPU1 & DCSM_CPUSEL_CPU2 can only be used with //! C28x RAMs (in DCSM_RAMModule) & DCSM_CPUSEL_CM can only be used with //! CM RAMs(in DCSM_RAMModule) //! //! This function returns the security zone a RAM section belongs to. //! //! \return Returns DCSM_MEMORY_INACCESSIBLE if the section is inaccessible, //! DCSM_MEMORY_ZONE1 if the section belongs to zone 1, DCSM_MEMORY_ZONE2 if //! the section belongs to zone 2 and DCSM_MEMORY_FULL_ACCESS if the section //! doesn't belong to any zone (or if the section is unsecure). // //***************************************************************************** static inline DCSM_MemoryStatus DCSM_getRAMZone(DCSM_RAMModule module, DCSM_CPUSel cpuInst) { uint16_t shift = (uint16_t)module * 2U; DCSM_RAMModule moduleCM; // // Check the arguments. // if((cpuInst == DCSM_CPUSEL_CPU1) || (cpuInst == DCSM_CPUSEL_CPU2)) do { if(!(module < DCSM_C28_RAM_END)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dcsm.h", 566); } } while(0); if(cpuInst == DCSM_CPUSEL_CM) { do { if(!((module > DCSM_C28_RAM_END) && (module < DCSM_CM_RAM_END))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dcsm.h", 571); } } while(0); moduleCM = (DCSM_RAMModule)(module - (DCSM_C28_RAM_END + 1U)); shift = (uint16_t)moduleCM * 2U; } // //Read the RAMSTAT register for the specific RAM Module. // return((DCSM_MemoryStatus)(((*((volatile uint32_t *)((uintptr_t)(0x0005F0C0U + 0x10U + (2U * (uint16_t)cpuInst))))) >> shift) & 0x03U)); } //***************************************************************************** // //! Returns the security zone a flash sector belongs to //! //! \param sector is the flash sector value. Use DCSM_Sector type. //! \param cpuInst is the CPU whose Flash Sector needs to be accessed . //! //! The \e cpuInst parameter can have one of the following values of the //! DCSM_CPUSel type: //! - \b DCSM_CPUSEL_CPU1 - To access CPU1 Flash sectors //! - \b DCSM_CPUSEL_CPU2 - To access CPU2 Flash sectors //! - \b DCSM_CPUSEL_CM - To access CM Flash sectors //! //! This function returns the security zone a flash sector belongs to. //! //! \return Returns DCSM_MEMORY_INACCESSIBLE if the section is inaccessible , //! DCSM_MEMORY_ZONE1 if the section belongs to zone 1, DCSM_MEMORY_ZONE2 if //! the section belongs to zone 2 and DCSM_MEMORY_FULL_ACCESS if the section //! doesn't belong to any zone (or if the section is unsecure).. // //***************************************************************************** static inline DCSM_MemoryStatus DCSM_getFlashSectorZone(DCSM_Sector sector, DCSM_CPUSel cpuInst) { uint32_t sectStat; uint16_t shift; // // Get the Sector status register for the specific bank // sectStat = (*((volatile uint32_t *)((uintptr_t)(0x0005F0C0U + 0x8U + (2U *(uint16_t)cpuInst))))); shift = (uint16_t)sector * 2U; // //Read the SECTSTAT register for the specific Flash Sector. // return((DCSM_MemoryStatus)((sectStat >> shift) & 0x3U)); } //***************************************************************************** // //! Read Zone 1 Link Pointer Error //! //! A non-zero value indicates an error on the bit position that is set to 1. //! //! \return Returns the value of the Zone 1 Link Pointer error. // //***************************************************************************** static inline uint32_t DCSM_getZone1LinkPointerError(void) { // // Return the LinkPointer Error for specific bank // return((*((volatile uint32_t *)((uintptr_t)(0x0005F000U + 0x6U))))); } //***************************************************************************** // //! Read Zone 2 Link Pointer Error //! //! A non-zero value indicates an error on the bit position that is set to 1. //! //! \return Returns the value of the Zone 2 Link Pointer error. // //***************************************************************************** static inline uint32_t DCSM_getZone2LinkPointerError(void) { // // Return the LinkPointer Error for specific bank // return((*((volatile uint32_t *)((uintptr_t)(0x0005F080U + 0x6U))))); } //***************************************************************************** // //! Get the status of the security configuration load from USER-OTP or sector //! error status //! //! \return Returns 0 if no error in loading security information from //! USER-OTP, 1 if an error has occurred in the load from USER-OTP. // //***************************************************************************** static inline _Bool DCSM_getFlashErrorStatus(void) { return((_Bool)((*((volatile uint32_t *)((uintptr_t)(0x0005F0C0U + 0x18U)))) & 0x1U)); } //***************************************************************************** // //! Clear the Flash Error Status bit //! //! Write a '1' to the clear bit to clear the sector error status bit. //! //! \return None. // //***************************************************************************** static inline void DCSM_clearFlashErrorStatus(void) { (*((volatile uint32_t *)((uintptr_t)(0x0005F0C0U + 0x1AU)))) |= 0x1U; } //***************************************************************************** // //! Set the force Flash Error Status bit //! //! Write a '1' to force bit to set the sector error status bit. //! //! \return None. // //***************************************************************************** static inline void DCSM_forceFlashErrorStatus(void) { (*((volatile uint32_t *)((uintptr_t)(0x0005F0C0U + 0x1CU)))) = 0x1U | ((uint32_t)0x5A5AU << 16U); } //***************************************************************************** // //! Returns the OTP secure Lock status of zone 1 //! //! \param lockType is the OTP secure Lock feature type . //! //! The \e lockType parameter can have one of the following values of the //! DCSM_CPUSel type: //! - \b DCSM_OTPSECLOCK_JTAG - JTAG Lock Status //! - \b DCSM_OTPSECLOCK_CRCLOCK - Zone CRC Lock //! - \b DCSM_OTPSECLOCK_PSWDLOCK - Zone Password Lock //! //! This function takes in a valid OTP secure Lock feature type and //! returns the status of zone 1 lock feature //! //! \return Returns security lock status can be: //! For JTAG lock : 0 - JTAG is not locked , 1 - JTAG is locked //! //! For Zone Password Lock : 1111 - CSM Pwd locations in the OTP are not //! protected and can be read from the debugger as well as code running //! from anywhere. //! Other Value : CSM Pwd locations in the OTP are protected and can't be read //! without unlocking CSM of that zone. //! //! For Zone CRC Lock : 1111 : VCU has ability to calculate CRC //! on secure memories. //! Other Value : VCU doesn't have the ability to calculate CRC on //! secure memories. // //***************************************************************************** static inline uint32_t DCSM_getZone1OTPSecureLockStatus(DCSM_OTPLock lockType) { uint32_t status, returnStatus; status = (*((volatile uint32_t *)((uintptr_t)(0x0005F000U + 0x2U)))); // // Reflects the state of the OTP Sec LOCK feature. // if(lockType == DCSM_OTPSECLOCK_JTAG) { returnStatus = (status & 0x1U) >> 0U; } else if(lockType == DCSM_OTPSECLOCK_CRCLOCK) { returnStatus = (status & 0xF00U) >> 8U; } else if(lockType == DCSM_OTPSECLOCK_PSWDLOCK) { returnStatus = (status & 0xF0U) >> 4U; } else returnStatus = (uint32_t)0xFFFFU; return(returnStatus); } //***************************************************************************** // //! Returns the OTP secure Lock status of zone 2 //! //! \param lockType is the OTP secure Lock feature type . //! //! The \e lockType parameter can have one of the following values of the //! DCSM_CPUSel type: //! - \b DCSM_OTPSECLOCK_CRCLOCK - Zone CRC Lock //! - \b DCSM_OTPSECLOCK_PSWDLOCK - Zone Password Lock //! //! This function takes in a valid OTP secure Lock feature type and //! returns the status of zone 2 lock feature //! //! \return Returns security lock status can be: //! //! For Zone Password Lock : 1111 - CSM Pwd locations in the OTP are not //! protected and can be read from the debugger as well as code running //! from anywhere. //! Other Value : CSM Pwd locations in the OTP are protected and can't be read //! without unlocking CSM of that zone. //! //! For Zone CRC Lock : 1111 : VCU has ability to calculate CRC //! on secure memories. //! Other Value : VCU doesn't have the ability to calculate CRC on //! secure memories. // //***************************************************************************** static inline uint32_t DCSM_getZone2OTPSecureLockStatus(DCSM_OTPLock lockType) { uint32_t status, returnStatus; status = (*((volatile uint32_t *)((uintptr_t)(0x0005F080U + 0x2U)))); // // Reflects the state of the OTP Sec LOCK feature. // if(lockType == DCSM_OTPSECLOCK_CRCLOCK) { returnStatus = (status & 0xF00U) >> 8U; } else if(lockType == DCSM_OTPSECLOCK_PSWDLOCK) { returnStatus = (status & 0xF0U) >> 4U; } else returnStatus = (uint32_t)0xFFFFU; return(returnStatus); } //***************************************************************************** // //! Unlocks Zone 1 CSM. //! //! \param psCMDKey is a pointer to the DCSM_CSMPasswordKey struct that has the //! CSM password for zone 1. //! //! This function unlocks the CSM password. It first reads the //! four password locations in the User OTP. If any of the password values is //! different from 0xFFFFFFFF, it unlocks the device by writing the provided //! passwords into CSM Key registers //! //! \return None. // //***************************************************************************** extern void DCSM_unlockZone1CSM(const DCSM_CSMPasswordKey * const psCMDKey); //***************************************************************************** // //! Unlocks Zone 2 CSM. //! //! \param psCMDKey is a pointer to the CSMPSWDKEY that has the CSM //! password for zone 2. //! //! This function unlocks the CSM password. It first reads //! the four password locations in the User OTP. If any of the password values //! is different from 0xFFFFFFFF, it unlocks the device by writing the //! provided passwords into CSM Key registers //! //! \return None. // //***************************************************************************** extern void DCSM_unlockZone2CSM(const DCSM_CSMPasswordKey * const psCMDKey); //***************************************************************************** // //! Write Zone 1 CSM. //! //! \param psCMDKey is a pointer to the CSMPSWDKEY that has the CSM //! password for zone 1. //! //! Password match flow is essentially a sequence of dummy reads //! from password locations (PWL) followed by writes to CSMKEY registers. //! This function helps writing the provided passwords into the CSM Key //! registers. The DCSM_readZone1CSMPwd() should be called //! by CPU1 before calling this API. //! //! \return None. // //***************************************************************************** extern void DCSM_writeZone1CSM(const DCSM_CSMPasswordKey * const psCMDKey); //***************************************************************************** // //! Write Zone 2 CSM. //! //! \param psCMDKey is a pointer to the CSMPSWDKEY that has the CSM //! password for zone 2. //! //! Password match flow is essentially a sequence of dummy reads //! from password locations (PWL) followed by writes to CSMKEY registers. //! This function helps writing the provided passwords into the CSM Key //! registers. The DCSM_readZone2CSMPwd() should be called //! by CPU1 before calling this API. //! //! \return None. // //***************************************************************************** extern void DCSM_writeZone2CSM(const DCSM_CSMPasswordKey * const psCMDKey); //***************************************************************************** // //! Returns the EXE-ONLY status of zone 1 for a flash sector //! //! \param sector is the flash sector value. Use DCSM_Sector type. //! \param cpuInst is the CPU whose Flash Sector needs to be accessed . //! //! The \e cpuInst parameter can have one of the following values of the //! DCSM_CPUSel type: //! - \b DCSM_CPUSEL_CPU1 - To access CPU1 Flash sectors //! - \b DCSM_CPUSEL_CPU2 - To access CPU2 Flash sectors //! - \b DCSM_CPUSEL_CM - To access CM Flash sectors //! //! This function takes in a valid sector value and returns the status of EXE //! ONLY security protection for the sector. //! //! \return Returns DCSM_PROTECTED if the sector is EXE-ONLY protected, //! DCSM_UNPROTECTED if the sector is not EXE-ONLY protected, //! DCSM_INCORRECT_ZONE if sector does not belong to this zone. // //***************************************************************************** extern DCSM_EXEOnlyStatus DCSM_getZone1FlashEXEStatus(DCSM_Sector sector, DCSM_CPUSel cpuInst); //***************************************************************************** // //! Returns the EXE-ONLY status of zone 1 for a RAM module //! //! \param module is the RAM module value. Valid values are type DCSM_RAMModule //! C28x RAMs : //! - \b DCSM_RAMLS0 //! - \b DCSM_RAMLS1 //! - \b DCSM_RAMLS2 //! - \b DCSM_RAMLS3 //! - \b DCSM_RAMLS4 //! - \b DCSM_RAMLS5 //! - \b DCSM_RAMLS6 //! - \b DCSM_RAMLS7 //! - \b DCSM_RAMD0 //! - \b DCSM_RAMD1 //! CM RAMs : //! - \b DCSM_RAM_CM_C0 //! - \b DCSM_RAM_CM_C1 //! - \b DCSM_RAM1_CPU1_CM //! - \b DCSM_RAM2_CPU1_CM //! - \b DCSM_RAM1_CM_CPU1 //! - \b DCSM_RAM2_CM_CPU1 //! - \b DCSM_RAM1_CPU2_CM //! - \b DCSM_RAM2_CPU2_CM //! - \b DCSM_RAM1_CM_CPU2 //! - \b DCSM_RAM2_CM_CPU2 //! - \b DCSM_RAM1_CPU1_CPU2 //! - \b DCSM_RAM2_CPU1_CPU2 //! - \b DCSM_RAM1_CPU2_CPU1 //! - \b DCSM_RAM2_CPU2_CPU1 //! //! This function takes in a valid module value and returns the status of EXE //! ONLY security protection for that module. //! //! \param cpuInst is the CPU whose RAM Section needs to be accessed . //! //! The \e cpuInst parameter can have one the following values: //! - \b DCSM_CPUSEL_CPU1 - To access CPU1 RAM //! - \b DCSM_CPUSEL_CPU2 - To access CPU2 RAM //! - \b DCSM_CPUSEL_CM - To access CM RAM //! //! \note DCSM_CPUSEL_CPU1 & DCSM_CPUSEL_CPU2 can only be used with //! C28x RAMs (in DCSM_RAMModule) & DCSM_CPUSEL_CM can only be used with //! CM RAMs(in DCSM_RAMModule) //! //! \return Returns DCSM_PROTECTED if the module is EXE-ONLY protected, //! DCSM_UNPROTECTED if the module is not EXE-ONLY protected, //! DCSM_INCORRECT_ZONE if module does not belong to this zone. // //***************************************************************************** extern DCSM_EXEOnlyStatus DCSM_getZone1RAMEXEStatus(DCSM_RAMModule module, DCSM_CPUSel cpuInst); //***************************************************************************** // //! Returns the EXE-ONLY status of zone 2 for a flash sector //! //! \param sector is the flash sector value. Use DCSM_Sector type. //! \param cpuInst is the CPU whose Flash Sector needs to be accessed . //! //! The \e cpuInst parameter can have one of the following values of the //! DCSM_CPUSel type: //! - \b DCSM_CPUSEL_CPU1 - To access CPU1 Flash sectors //! - \b DCSM_CPUSEL_CPU2 - To access CPU2 Flash sectors //! - \b DCSM_CPUSEL_CM - To access CM Flash sectors //! //! This function takes in a valid sector value and returns the status of EXE //! ONLY security protection for the sector. //! //! \return Returns DCSM_PROTECTED if the sector is EXE-ONLY protected, //! DCSM_UNPROTECTED if the sector is not EXE-ONLY protected, //! DCSM_INCORRECT_ZONE if sector does not belong to this zone. // //***************************************************************************** extern DCSM_EXEOnlyStatus DCSM_getZone2FlashEXEStatus(DCSM_Sector sector, DCSM_CPUSel cpuInst); //***************************************************************************** // //! Returns the EXE-ONLY status of zone 2 for a RAM module //! //! \param module is the RAM module value. Valid values are type DCSM_RAMModule //! C28x RAMs : //! - \b DCSM_RAMLS0 //! - \b DCSM_RAMLS1 //! - \b DCSM_RAMLS2 //! - \b DCSM_RAMLS3 //! - \b DCSM_RAMLS4 //! - \b DCSM_RAMLS5 //! - \b DCSM_RAMLS6 //! - \b DCSM_RAMLS7 //! - \b DCSM_RAMD0 //! - \b DCSM_RAMD1 //! CM RAMs : //! - \b DCSM_RAM_CM_C0 //! - \b DCSM_RAM_CM_C1 //! - \b DCSM_RAM1_CPU1_CM //! - \b DCSM_RAM2_CPU1_CM //! - \b DCSM_RAM1_CM_CPU1 //! - \b DCSM_RAM2_CM_CPU1 //! - \b DCSM_RAM1_CPU2_CM //! - \b DCSM_RAM2_CPU2_CM //! - \b DCSM_RAM1_CM_CPU2 //! - \b DCSM_RAM2_CM_CPU2 //! - \b DCSM_RAM1_CPU1_CPU2 //! - \b DCSM_RAM2_CPU1_CPU2 //! - \b DCSM_RAM1_CPU2_CPU1 //! - \b DCSM_RAM2_CPU2_CPU1 //! //! This function takes in a valid module value and returns the status of EXE //! ONLY security protection for that module. //! //! \param cpuInst is the CPU whose RAM Section needs to be accessed . //! //! The \e cpuInst parameter can have one the following values: //! - \b DCSM_CPUSEL_CPU1 - To access CPU1 RAM //! - \b DCSM_CPUSEL_CPU2 - To access CPU2 RAM //! - \b DCSM_CPUSEL_CM - To access CM RAM //! //! \note DCSM_CPUSEL_CPU1 & DCSM_CPUSEL_CPU2 can only be used with //! C28x RAMs (in DCSM_RAMModule) & DCSM_CPUSEL_CM can only be used with //! CM RAMs(in DCSM_RAMModule). //! //! \return Returns DCSM_PROTECTED if the module is EXE-ONLY protected, //! DCSM_UNPROTECTED if the module is not EXE-ONLY protected, //! DCSM_INCORRECT_ZONE if module does not belong to this zone. // //***************************************************************************** extern DCSM_EXEOnlyStatus DCSM_getZone2RAMEXEStatus(DCSM_RAMModule module, DCSM_CPUSel cpuInst); //***************************************************************************** // //! Claims the zone semaphore which allows access to the Flash Wrapper register //! for that zone. //! //! \param zone is the zone which is trying to claim the semaphore which allows //! access to the Flash Wrapper registers. //! //! \return Returns true for a successful semaphore capture, false if it was //! unable to capture the semaphore. // //***************************************************************************** extern _Bool DCSM_claimZoneSemaphore(DCSM_SemaphoreZone zone); //***************************************************************************** // //! Releases the zone semaphore. //! //! \return Returns true if it was successful in releasing the zone semaphore //! and false if it was unsuccessful in releasing the zone semaphore. //! //! \note If the calling function is not in the right zone to be able //! to access this register, it will return a false. // //***************************************************************************** extern _Bool DCSM_releaseZoneSemaphore(void); //***************************************************************************** // //! Perform dummy reads on the 128-bit Zone 1 CSM password. //! //! This function reads the four password locations in the User OTP //! needed to be done as part of the Password Match Flow before //! writes to the CSMKEY registers. //! This would need to be done before a DCSM_writeZone1CSM(). //! //! \return None. //! //! \note This API to be called from CPU1. // //***************************************************************************** extern void DCSM_readZone1CSMPwd(void); //***************************************************************************** // //! Perform dummy reads on the 128-bit Zone 2 CSM password. //! //! This function reads the four password locations in the User OTP //! needed to be done as part of the Password Match Flow before //! writes to the CSMKEY registers. //! This would need to be done before a DCSM_writeZone2CSM(). //! //! \return None. //! //! \note This API to be called from CPU1. // //***************************************************************************** extern void DCSM_readZone2CSMPwd(void); //***************************************************************************** // // Close the Doxygen group. //! @} // //***************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //########################################################################### // // FILE: dma.h // // TITLE: C28x DMA driver. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup dma_api DMA //! \brief This module is used for DMA configurations. //! @{ // //***************************************************************************** //########################################################################### // // FILE: hw_dma.h // // TITLE: Definitions for the DMA registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the DMA register offsets // //***************************************************************************** // Register // Register // Register // Register // Register // Register // Register // Register // Register // Shadow Register // Register // Active Register // Register //***************************************************************************** // // The following are defines for the bit fields in the DMACTRL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the DEBUGCTRL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PRIORITYCTRL1 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PRIORITYSTAT register // //***************************************************************************** // Bits //***************************************************************************** // // The following are defines for the bit fields in the MODE register // //***************************************************************************** // Select //***************************************************************************** // // The following are defines for the bit fields in the CONTROL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the BURST_SIZE register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the BURST_COUNT register // //***************************************************************************** //***************************************************************************** // // Values that can be passed to DMA_configMode() as the config parameter. // //***************************************************************************** //! Only one burst transfer performed per trigger. //! Burst transfers occur without additional event triggers after the first. //! DMA channel will be disabled at the end of a transfer. //! DMA reinitializes when the transfer count is zero and waits for a trigger. //! DMA transfers 16 bits at a time. //! DMA transfers 32 bits at a time. //***************************************************************************** // //! Values that can be passed to DMA_configMode() as the \e trigger parameter. // //***************************************************************************** typedef enum { DMA_TRIGGER_SOFTWARE = 0, DMA_TRIGGER_ADCA1 = 1, DMA_TRIGGER_ADCA2 = 2, DMA_TRIGGER_ADCA3 = 3, DMA_TRIGGER_ADCA4 = 4, DMA_TRIGGER_ADCAEVT = 5, DMA_TRIGGER_ADCB1 = 6, DMA_TRIGGER_ADCB2 = 7, DMA_TRIGGER_ADCB3 = 8, DMA_TRIGGER_ADCB4 = 9, DMA_TRIGGER_ADCBEVT = 10, DMA_TRIGGER_ADCC1 = 11, DMA_TRIGGER_ADCC2 = 12, DMA_TRIGGER_ADCC3 = 13, DMA_TRIGGER_ADCC4 = 14, DMA_TRIGGER_ADCCEVT = 15, DMA_TRIGGER_ADCD1 = 16, DMA_TRIGGER_ADCD2 = 17, DMA_TRIGGER_ADCD3 = 18, DMA_TRIGGER_ADCD4 = 19, DMA_TRIGGER_ADCDEVT = 20, DMA_TRIGGER_XINT1 = 29, DMA_TRIGGER_XINT2 = 30, DMA_TRIGGER_XINT3 = 31, DMA_TRIGGER_XINT4 = 32, DMA_TRIGGER_XINT5 = 33, DMA_TRIGGER_EPWM1SOCA = 36, DMA_TRIGGER_EPWM1SOCB = 37, DMA_TRIGGER_EPWM2SOCA = 38, DMA_TRIGGER_EPWM2SOCB = 39, DMA_TRIGGER_EPWM3SOCA = 40, DMA_TRIGGER_EPWM3SOCB = 41, DMA_TRIGGER_EPWM4SOCA = 42, DMA_TRIGGER_EPWM4SOCB = 43, DMA_TRIGGER_EPWM5SOCA = 44, DMA_TRIGGER_EPWM5SOCB = 45, DMA_TRIGGER_EPWM6SOCA = 46, DMA_TRIGGER_EPWM6SOCB = 47, DMA_TRIGGER_EPWM7SOCA = 48, DMA_TRIGGER_EPWM7SOCB = 49, DMA_TRIGGER_EPWM8SOCA = 50, DMA_TRIGGER_EPWM8SOCB = 51, DMA_TRIGGER_EPWM9SOCA = 52, DMA_TRIGGER_EPWM9SOCB = 53, DMA_TRIGGER_EPWM10SOCA = 54, DMA_TRIGGER_EPWM10SOCB = 55, DMA_TRIGGER_EPWM11SOCA = 56, DMA_TRIGGER_EPWM11SOCB = 57, DMA_TRIGGER_EPWM12SOCA = 58, DMA_TRIGGER_EPWM12SOCB = 59, DMA_TRIGGER_EPWM13SOCA = 60, DMA_TRIGGER_EPWM13SOCB = 61, DMA_TRIGGER_EPWM14SOCA = 62, DMA_TRIGGER_EPWM14SOCB = 63, DMA_TRIGGER_EPWM15SOCA = 64, DMA_TRIGGER_EPWM15SOCB = 65, DMA_TRIGGER_EPWM16SOCA = 66, DMA_TRIGGER_EPWM16SOCB = 67, DMA_TRIGGER_TINT0 = 68, DMA_TRIGGER_TINT1 = 69, DMA_TRIGGER_TINT2 = 70, DMA_TRIGGER_MCBSPAMXEVT = 71, DMA_TRIGGER_MCBSPAMREVT = 72, DMA_TRIGGER_MCBSPBMXEVT = 73, DMA_TRIGGER_MCBSPBMREVT = 74, DMA_TRIGGER_ECAP1 = 75, DMA_TRIGGER_ECAP2 = 76, DMA_TRIGGER_ECAP3 = 77, DMA_TRIGGER_ECAP4 = 78, DMA_TRIGGER_ECAP5 = 79, DMA_TRIGGER_ECAP6 = 80, DMA_TRIGGER_ECAP7 = 81, DMA_TRIGGER_SDFM1FLT1 = 95, DMA_TRIGGER_SDFM1FLT2 = 96, DMA_TRIGGER_SDFM1FLT3 = 97, DMA_TRIGGER_SDFM1FLT4 = 98, DMA_TRIGGER_SDFM2FLT1 = 99, DMA_TRIGGER_SDFM2FLT2 = 100, DMA_TRIGGER_SDFM2FLT3 = 101, DMA_TRIGGER_SDFM2FLT4 = 102, DMA_TRIGGER_SYNC = 103, DMA_TRIGGER_SPIATX = 109, DMA_TRIGGER_SPIARX = 110, DMA_TRIGGER_SPIBTX = 111, DMA_TRIGGER_SPIBRX = 112, DMA_TRIGGER_SPICTX = 113, DMA_TRIGGER_SPICRX = 114, DMA_TRIGGER_SPIDTX = 115, DMA_TRIGGER_SPIDRX = 116, DMA_TRIGGER_FSITXA = 123, DMA_TRIGGER_FSIRXA = 125, DMA_TRIGGER_CLB1INT = 127, DMA_TRIGGER_CLB2INT = 128, DMA_TRIGGER_CLB3INT = 129, DMA_TRIGGER_CLB4INT = 130, DMA_TRIGGER_USBA_RX1 = 131, DMA_TRIGGER_USBA_TX1 = 132, DMA_TRIGGER_USBA_RX2 = 133, DMA_TRIGGER_USBA_TX2 = 134, DMA_TRIGGER_USBA_RX3 = 135, DMA_TRIGGER_USBA_TX3 = 136, DMA_TRIGGER_FSIRXC = 143, DMA_TRIGGER_FSIRXD = 144, DMA_TRIGGER_FSIRXE = 145, DMA_TRIGGER_FSIRXF = 146, DMA_TRIGGER_FSIRXG = 147, DMA_TRIGGER_FSIRXH = 148, DMA_TRIGGER_FSITXB = 155, DMA_TRIGGER_FSIRXB = 157, DMA_TRIGGER_CANAIF1 = 167, DMA_TRIGGER_CANAIF2 = 168, DMA_TRIGGER_CANAIF3 = 169, DMA_TRIGGER_CANBIF1 = 170, DMA_TRIGGER_CANBIF2 = 171, DMA_TRIGGER_CANBIF3 = 172 } DMA_Trigger; //***************************************************************************** // //! Values that can be passed to DMA_setInterruptMode() as the \e mode //! parameter. // //***************************************************************************** typedef enum { //! DMA interrupt is generated at the beginning of a transfer DMA_INT_AT_BEGINNING, //! DMA interrupt is generated at the end of a transfer DMA_INT_AT_END } DMA_InterruptMode; //***************************************************************************** // //! Values that can be passed to DMA_setEmulationMode() as the \e mode //! parameter. // //***************************************************************************** typedef enum { //! Transmission stops after current read-write access is completed DMA_EMULATION_STOP, //! Continue DMA operation regardless of emulation suspend DMA_EMULATION_FREE_RUN } DMA_EmulationMode; //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** //***************************************************************************** // //! \internal //! Checks an DMA channel base address. //! //! \param base specifies the DMA channel base address. //! //! This function determines if a DMA channel base address is valid. //! //! \return Returns \b true if the base address is valid and \b false //! otherwise. // //***************************************************************************** static inline _Bool DMA_isBaseValid(uint32_t base) { return((base == 0x00001020U) || (base == 0x00001040U) || (base == 0x00001060U) || (base == 0x00001080U) || (base == 0x000010A0U) || (base == 0x000010C0U)); } //***************************************************************************** // //! Initializes the DMA controller to a known state. //! //! This function configures does a hard reset of the DMA controller in order //! to put it into a known state. The function also sets the DMA to run free //! during an emulation suspend (see the field DEBUGCTRL.FREE for more info). //! //! \return None. // //***************************************************************************** static inline void DMA_initController(void) { __eallow(); // // Set the hard reset bit. One NOP is required after HARDRESET. // (*((volatile uint16_t *)((uintptr_t)(0x00001000U + 0x0U)))) |= 0x1U; __asm(" NOP"); __edis(); } //***************************************************************************** // //! Sets DMA emulation mode. //! //! \param mode is the emulation mode to be selected. //! //! This function sets the behavior of the DMA operation when an emulation //! suspend occurs. The \e mode parameter can be one of the following: //! //! - \b DMA_EMULATION_STOP - DMA runs until the current read-write access is //! completed. //! - \b DMA_EMULATION_FREE_RUN - DMA operation continues regardless of a //! the suspend. //! //! \return None. // //***************************************************************************** static inline void DMA_setEmulationMode(DMA_EmulationMode mode) { __eallow(); // // Set emulation mode // if(mode == DMA_EMULATION_STOP) { (*((volatile uint16_t *)((uintptr_t)(0x00001000U + 0x1U)))) &= ~0x8000U; } else { (*((volatile uint16_t *)((uintptr_t)(0x00001000U + 0x1U)))) |= 0x8000U; } __edis(); } //***************************************************************************** // //! Enables peripherals to trigger a DMA transfer. //! //! \param base is the base address of the DMA channel control registers. //! //! This function enables the selected peripheral trigger to start a DMA //! transfer on the specified channel. //! //! \return None. // //***************************************************************************** static inline void DMA_enableTrigger(uint32_t base) { // // Check the arguments. // do { if(!(DMA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dma.h", 370); } } while(0); // // Set the peripheral interrupt trigger enable bit. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) |= 0x100U; __edis(); } //***************************************************************************** // //! Disables peripherals from triggering a DMA transfer. //! //! \param base is the base address of the DMA channel control registers. //! //! This function disables the selected peripheral trigger from starting a DMA //! transfer on the specified channel. This also disables the use of the //! software force using the DMA_forceTrigger() API. //! //! \return None. // //***************************************************************************** static inline void DMA_disableTrigger(uint32_t base) { // // Check the arguments. // do { if(!(DMA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dma.h", 399); } } while(0); // // Clear the peripheral interrupt trigger enable bit. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) &= ~0x100U; __edis(); } //***************************************************************************** // //! Force a peripheral trigger to a DMA channel. //! //! \param base is the base address of the DMA channel control registers. //! //! This function sets the peripheral trigger flag and if triggering a DMA //! burst is enabled (see DMA_enableTrigger()), a DMA burst transfer will be //! forced. //! //! \return None. // //***************************************************************************** static inline void DMA_forceTrigger(uint32_t base) { // // Check the arguments. // do { if(!(DMA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dma.h", 428); } } while(0); // // Set the peripheral interrupt trigger force bit. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x1U)))) |= 0x8U; __edis(); } //***************************************************************************** // //! Clears a DMA channel's peripheral trigger flag. //! //! \param base is the base address of the DMA channel control registers. //! //! This function clears the peripheral trigger flag. Normally, you would use //! this function when initializing the DMA for the first time. The flag is //! cleared automatically when the DMA starts the first burst of a transfer. //! //! \return None. // //***************************************************************************** static inline void DMA_clearTriggerFlag(uint32_t base) { // // Check the arguments. // do { if(!(DMA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dma.h", 457); } } while(0); // // Write a one to the clear bit to clear the peripheral trigger flag. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x1U)))) |= 0x10U; __edis(); } //***************************************************************************** // //! Gets the status of a DMA channel's peripheral trigger flag. //! //! \param base is the base address of the DMA channel control registers. //! //! This function returns \b true if a peripheral trigger event has occurred //! The flag is automatically cleared when the first burst transfer begins, but //! if needed, it can be cleared using DMA_clearTriggerFlag(). //! //! \return Returns \b true if a peripheral trigger event has occurred and its //! flag is set. Returns \b false otherwise. // //***************************************************************************** static inline _Bool DMA_getTriggerFlagStatus(uint32_t base) { // // Check the arguments. // do { if(!(DMA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dma.h", 487); } } while(0); // // Read the peripheral trigger flag and return appropriately. // return(((*((volatile uint16_t *)((uintptr_t)(base + 0x1U)))) & 0x100U) != 0U); } //***************************************************************************** // //! Starts a DMA channel. //! //! \param base is the base address of the DMA channel control registers. //! //! This function starts the DMA running, typically after you have configured //! it. It will wait for the first trigger event to start operation. To halt //! the channel use DMA_stopChannel(). //! //! \return None. // //***************************************************************************** static inline void DMA_startChannel(uint32_t base) { // // Check the arguments. // do { if(!(DMA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dma.h", 514); } } while(0); // // Set the run bit. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x1U)))) |= 0x1U; __edis(); } //***************************************************************************** // //! Halts a DMA channel. //! //! \param base is the base address of the DMA channel control registers. //! //! This function halts the DMA at its current state and any current read-write //! access is completed. To start the channel again use DMA_startChannel(). //! //! \return None. // //***************************************************************************** static inline void DMA_stopChannel(uint32_t base) { // // Check the arguments. // do { if(!(DMA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dma.h", 542); } } while(0); // // Set the halt bit. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x1U)))) |= 0x2U; __edis(); } //***************************************************************************** // //! Enables a DMA channel interrupt source. //! //! \param base is the base address of the DMA channel control registers. //! //! This function enables the indicated DMA channel interrupt source. //! //! \return None. // //***************************************************************************** static inline void DMA_enableInterrupt(uint32_t base) { // // Check the arguments. // do { if(!(DMA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dma.h", 569); } } while(0); // // Enable the specified DMA channel interrupt. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) |= 0x8000U; __edis(); } //***************************************************************************** // //! Disables a DMA channel interrupt source. //! //! \param base is the base address of the DMA channel control registers. //! //! This function disables the indicated DMA channel interrupt source. //! //! \return None. // //***************************************************************************** static inline void DMA_disableInterrupt(uint32_t base) { // // Check the arguments. // do { if(!(DMA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dma.h", 596); } } while(0); // // Disable the specified DMA channel interrupt. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) &= ~0x8000U; __edis(); } //***************************************************************************** // //! Enables the DMA channel overrun interrupt. //! //! \param base is the base address of the DMA channel control registers. //! //! This function enables the indicated DMA channel's ability to generate an //! interrupt upon the detection of an overrun. An overrun is when a peripheral //! event trigger is received by the DMA before a previous trigger on that //! channel had been serviced and its flag had been cleared. //! //! Note that this is the same interrupt signal as the interrupt that gets //! generated at the beginning/end of a transfer. That interrupt must first be //! enabled using DMA_enableInterrupt() in order for the overrun interrupt to //! be generated. //! //! \return None. // //***************************************************************************** static inline void DMA_enableOverrunInterrupt(uint32_t base) { // // Check the arguments. // do { if(!(DMA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dma.h", 631); } } while(0); // // Enable the specified DMA channel interrupt. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) |= 0x80U; __edis(); } //***************************************************************************** // //! Disables the DMA channel overrun interrupt. //! //! \param base is the base address of the DMA channel control registers. //! //! This function disables the indicated DMA channel's ability to generate an //! interrupt upon the detection of an overrun. //! //! \return None. // //***************************************************************************** static inline void DMA_disableOverrunInterrupt(uint32_t base) { // // Check the arguments. // do { if(!(DMA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dma.h", 659); } } while(0); // // Disable the specified DMA channel interrupt. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) &= ~0x80U; __edis(); } //***************************************************************************** // //! Clears the DMA channel error flags. //! //! \param base is the base address of the DMA channel control registers. //! //! This function clears both the DMA channel's sync error flag and its //! overrun error flag. //! //! \return None. // //***************************************************************************** static inline void DMA_clearErrorFlag(uint32_t base) { // // Check the arguments. // do { if(!(DMA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dma.h", 687); } } while(0); // // Write to the error clear bit. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x1U)))) |= 0x80U; __edis(); } //***************************************************************************** // //! Sets the interrupt generation mode of a DMA channel interrupt. //! //! \param base is the base address of the DMA channel control registers. //! \param mode is a flag to indicate the channel interrupt mode. //! //! This function sets the channel interrupt mode. When the \e mode parameter //! is \b DMA_INT_AT_END, the DMA channel interrupt will be generated at the //! end of the transfer. If \b DMA_INT_AT_BEGINNING, the interrupt will be //! generated at the beginning of a new transfer. Generating at the beginning //! of a new transfer is the default behavior. //! //! \return None. // //***************************************************************************** static inline void DMA_setInterruptMode(uint32_t base, DMA_InterruptMode mode) { // // Check the arguments. // do { if(!(DMA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dma.h", 719); } } while(0); __eallow(); // // Write the selected interrupt generation mode to the register. // if(mode == DMA_INT_AT_END) { (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) |= 0x200U; } else { (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) &= ~0x200U; } __edis(); } //***************************************************************************** // //! Sets the DMA channel priority mode. //! //! \param ch1IsHighPri is a flag to indicate the channel interrupt mode. //! //! This function sets the channel interrupt mode. When the \e ch1IsHighPri //! parameter is \b false, the DMA channels are serviced in round-robin mode. //! This is the default behavior. //! //! If \b true, channel 1 will be given higher priority than the other //! channels. This means that if a channel 1 trigger occurs, the current word //! transfer on any other channel is completed and channel 1 is serviced for //! the complete burst count. The lower-priority channel's interrupted transfer //! will then resume. //! //! \return None. // //***************************************************************************** static inline void DMA_setPriorityMode(_Bool ch1IsHighPri) { __eallow(); // // Write the selected priority mode to the register. // if(ch1IsHighPri) { (*((volatile uint16_t *)((uintptr_t)(0x00001000U + 0x4U)))) |= 0x1U; } else { (*((volatile uint16_t *)((uintptr_t)(0x00001000U + 0x4U)))) &= ~0x1U; } __edis(); } //***************************************************************************** // //! Configures the source address for the DMA channel //! //! \param base is the base address of the DMA channel control registers. //! \param *srcAddr is a source address. //! //! This function configures the source address of a DMA //! channel. //! //! \return None. // //***************************************************************************** static inline void DMA_configSourceAddress(uint32_t base, const void *srcAddr) { // // Check the arguments. // do { if(!(DMA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dma.h", 798); } } while(0); __eallow(); // // Set up SOURCE address. // (*((volatile uint32_t *)((uintptr_t)(base + 0x10U)))) = (uint32_t)srcAddr; (*((volatile uint32_t *)((uintptr_t)(base + 0x12U)))) = (uint32_t)srcAddr; __edis(); } //***************************************************************************** // //! Configures the destination address for the DMA channel //! //! \param base is the base address of the DMA channel control registers. //! \param *destAddr is the destination address. //! //! This function configures the destinaton address of a DMA //! channel. //! //! \return None. // //***************************************************************************** static inline void DMA_configDestAddress(uint32_t base, const void *destAddr) { // // Check the arguments. // do { if(!(DMA_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/dma.h", 830); } } while(0); __eallow(); // // Set up DESTINATION address. // (*((volatile uint32_t *)((uintptr_t)(base + 0x18U)))) = (uint32_t)destAddr; (*((volatile uint32_t *)((uintptr_t)(base + 0x1AU)))) = (uint32_t)destAddr; __edis(); } //***************************************************************************** // //! Configures the DMA channel //! //! \param base is the base address of the DMA channel control registers. //! \param *destAddr is the destination address. //! \param *srcAddr is a source address. //! //! This function configures the source and destination addresses of a DMA //! channel. The parameters are pointers to the data to be transferred. //! //! \return None. // //***************************************************************************** extern void DMA_configAddresses(uint32_t base, const void *destAddr, const void *srcAddr); //***************************************************************************** // //! Configures the DMA channel's burst settings. //! //! \param base is the base address of the DMA channel control registers. //! \param size is the number of words transferred per burst. //! \param srcStep is the amount to increment or decrement the source address //! after each word of a burst. //! \param destStep is the amount to increment or decrement the destination //! address after each word of a burst. //! //! This function configures the size of each burst and the address step size. //! //! The \e size parameter is the number of words that will be transferred //! during a single burst. Possible amounts range from 1 word to 32 words. //! //! The \e srcStep and \e destStep parameters specify the address step that //! should be added to the source and destination addresses after each //! transferred word of a burst. Only signed values from -4096 to 4095 are //! valid. //! //! \note Note that regardless of what data size (configured by //! DMA_configMode()) is used, parameters are in terms of 16-bits words. //! //! \return None. // //***************************************************************************** extern void DMA_configBurst(uint32_t base, uint16_t size, int16_t srcStep, int16_t destStep); //***************************************************************************** // //! Configures the DMA channel's transfer settings. //! //! \param base is the base address of the DMA channel control registers. //! \param transferSize is the number of bursts per transfer. //! \param srcStep is the amount to increment or decrement the source address //! after each burst of a transfer unless a wrap occurs. //! \param destStep is the amount to increment or decrement the destination //! address after each burst of a transfer unless a wrap occurs. //! //! This function configures the transfer size and the address step that is //! made after each burst. //! //! The \e transferSize parameter is the number of bursts per transfer. If DMA //! channel interrupts are enabled, they will occur after this number of bursts //! have completed. The maximum number of bursts is 65536. //! //! The \e srcStep and \e destStep parameters specify the address step that //! should be added to the source and destination addresses after each //! transferred burst of a transfer. Only signed values from -4096 to 4095 are //! valid. If a wrap occurs, these step values will be ignored. Wrapping is //! configured with DMA_configWrap(). //! //! \note Note that regardless of what data size (configured by //! DMA_configMode()) is used, parameters are in terms of 16-bits words. //! //! \return None. // //***************************************************************************** extern void DMA_configTransfer(uint32_t base, uint32_t transferSize, int16_t srcStep, int16_t destStep); //***************************************************************************** // //! Configures the DMA channel's wrap settings. //! //! \param base is the base address of the DMA channel control registers. //! \param srcWrapSize is the number of bursts to be transferred before a wrap //! of the source address occurs. //! \param srcStep is the amount to increment or decrement the source address //! after each burst of a transfer unless a wrap occurs. //! \param destWrapSize is the number of bursts to be transferred before a wrap //! of the destination address occurs. //! \param destStep is the amount to increment or decrement the destination //! address after each burst of a transfer unless a wrap occurs. //! //! This function configures the DMA channel's wrap settings. //! //! The \e srcWrapSize and \e destWrapSize parameters are the number of bursts //! that are to be transferred before their respective addresses are wrapped. //! The maximum wrap size is 65536 bursts. //! //! The \e srcStep and \e destStep parameters specify the address step that //! should be added to the source and destination addresses when the wrap //! occurs. Only signed values from -4096 to 4095 are valid. //! //! \note Note that regardless of what data size (configured by //! DMA_configMode()) is used, parameters are in terms of 16-bits words. //! //! \return None. // //***************************************************************************** extern void DMA_configWrap(uint32_t base, uint32_t srcWrapSize, int16_t srcStep, uint32_t destWrapSize, int16_t destStep); //***************************************************************************** // //! Configures the DMA channel trigger and mode. //! //! \param base is the base address of the DMA channel control registers. //! \param trigger is the interrupt source that triggers a DMA transfer. //! \param config is a bit field of several configuration selections. //! //! This function configures the DMA channel's trigger and mode. //! //! The \e trigger parameter is the interrupt source that will trigger the //! start of a DMA transfer. //! //! The \e config parameter is the logical OR of the following values: //! - \b DMA_CFG_ONESHOT_DISABLE or \b DMA_CFG_ONESHOT_ENABLE. If enabled, //! the subsequent burst transfers occur without additional event triggers //! after the first event trigger. If disabled, only one burst transfer is //! performed per event trigger. //! - \b DMA_CFG_CONTINUOUS_DISABLE or \b DMA_CFG_CONTINUOUS_ENABLE. If enabled //! the DMA reinitializes when the transfer count is zero and waits for the //! next interrupt event trigger. If disabled, the DMA stops and clears the //! run status bit. //! - \b DMA_CFG_SIZE_16BIT or \b DMA_CFG_SIZE_32BIT. This setting selects //! whether the databus width is 16 or 32 bits. //! //! \return None. // //***************************************************************************** extern void DMA_configMode(uint32_t base, DMA_Trigger trigger, uint32_t config); //***************************************************************************** // // Close the Doxygen group. //! @} // //***************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //########################################################################### // // FILE: ecap.h // // TITLE: C28x ECAP driver // //############################################################################# // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //############################################################################# //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup ecap_api eCAP //! @{ // //***************************************************************************** //***************************************************************************** // // Includes // //***************************************************************************** //########################################################################### // // FILE: hw_ecap.h // // TITLE: Definitions for the ECAP registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the ECAP register offsets // //***************************************************************************** // Register // Register // Register // Register // Register //***************************************************************************** // // The following are defines for the bit fields in the ECCTL0 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ECCTL1 register // //***************************************************************************** // select // Event 1 // select // Event 2 // select // Event 3 // select // Event 4 // a Cap Event //***************************************************************************** // // The following are defines for the bit fields in the ECCTL2 register // //***************************************************************************** // for continuous // select // counter, and interrupt flags. //***************************************************************************** // // The following are defines for the bit fields in the ECEINT register // //***************************************************************************** // Enable // Enable // Enable // Enable // Enable // Enable //***************************************************************************** // // The following are defines for the bit fields in the ECFLG register // //***************************************************************************** // Flag // Flag // Flag // Flag // Flag //***************************************************************************** // // The following are defines for the bit fields in the ECCLR register // //***************************************************************************** // Clear //***************************************************************************** // // The following are defines for the bit fields in the ECFRC register // //***************************************************************************** // Interrupt // Interrupt // Interrupt // Interrupt // Interrupt //***************************************************************************** // // The following are defines for the bit fields in the ECAPSYNCINSEL register // //***************************************************************************** //***************************************************************************** // // eCAP minimum and maximum values // //***************************************************************************** //***************************************************************************** // // Values that can be passed to ECAP_enableInterrupt(), // ECAP_disableInterrupt(), ECAP_clearInterrupt() and ECAP_forceInterrupt() as // the intFlags parameter and returned by ECAP_getInterruptSource(). // //***************************************************************************** //! Event 1 ISR source //! //! Event 2 ISR source //! //! Event 3 ISR source //! //! Event 4 ISR source //! //! Counter overflow ISR source //! //! Counter equals period ISR source //! //! Counter equals compare ISR source //! //***************************************************************************** // //! Values that can be passed to ECAP_setEmulationMode() as the //! \e mode parameter. // //***************************************************************************** typedef enum { //! TSCTR is stopped on emulation suspension ECAP_EMULATION_STOP = 0x0U, //! TSCTR runs until 0 before stopping on emulation suspension ECAP_EMULATION_RUN_TO_ZERO = 0x1U, //! TSCTR is not affected by emulation suspension ECAP_EMULATION_FREE_RUN = 0x2U }ECAP_EmulationMode; //***************************************************************************** // //! Values that can be passed to ECAP_setCaptureMode() as the //! \e mode parameter. // //***************************************************************************** typedef enum { //! eCAP operates in continuous capture mode ECAP_CONTINUOUS_CAPTURE_MODE = 0U, //! eCAP operates in one shot capture mode ECAP_ONE_SHOT_CAPTURE_MODE = 1U }ECAP_CaptureMode; //***************************************************************************** // //! Values that can be passed to ECAP_setEventPolarity(),ECAP_setCaptureMode(), //! ECAP_enableCounterResetOnEvent(),ECAP_disableCounterResetOnEvent(), //! ECAP_getEventTimeStamp(),ECAP_setDMASource() as the \e event parameter. // //***************************************************************************** typedef enum { ECAP_EVENT_1 = 0U, //!< eCAP event 1 ECAP_EVENT_2 = 1U, //!< eCAP event 2 ECAP_EVENT_3 = 2U, //!< eCAP event 3 ECAP_EVENT_4 = 3U //!< eCAP event 4 }ECAP_Events; //***************************************************************************** // //! Values that can be passed to ECAP_setSyncOutMode() as the \e mode //! parameter. // //***************************************************************************** typedef enum { //! sync out on the sync in signal and software force ECAP_SYNC_OUT_SYNCI = 0x00, //! sync out on counter equals period ECAP_SYNC_OUT_COUNTER_PRD = 0x40, //! Disable sync out signal ECAP_SYNC_OUT_DISABLED = 0x80 }ECAP_SyncOutMode; //***************************************************************************** // //! Values that can be passed to ECAP_setAPWMPolarity() as the \e polarity //! parameter. // //***************************************************************************** typedef enum { ECAP_APWM_ACTIVE_HIGH = 0x000, //!< APWM is active high ECAP_APWM_ACTIVE_LOW = 0x400 //!< APWM is active low }ECAP_APWMPolarity; //***************************************************************************** // //! Values that can be passed to ECAP_setEventPolarity() as the \e polarity //! parameter. // //***************************************************************************** typedef enum { ECAP_EVNT_RISING_EDGE = 0U, //!< Rising edge polarity ECAP_EVNT_FALLING_EDGE = 1U //!< Falling edge polarity }ECAP_EventPolarity; //***************************************************************************** // //! Values that can be passed to ECAP_selectECAPInput() as the \e input //! parameter. // //***************************************************************************** typedef enum { //! GPIO Input Crossbar output signal-1 ECAP_INPUT_INPUTXBAR1 = 0, //! GPIO Input Crossbar output signal-2 ECAP_INPUT_INPUTXBAR2 = 1, //! GPIO Input Crossbar output signal-3 ECAP_INPUT_INPUTXBAR3 = 2, //! GPIO Input Crossbar output signal-4 ECAP_INPUT_INPUTXBAR4 = 3, //! GPIO Input Crossbar output signal-5 ECAP_INPUT_INPUTXBAR5 = 4, //! GPIO Input Crossbar output signal-6 ECAP_INPUT_INPUTXBAR6 = 5, //! GPIO Input Crossbar output signal-7 ECAP_INPUT_INPUTXBAR7 = 6, //! GPIO Input Crossbar output signal-8 ECAP_INPUT_INPUTXBAR8 = 7, //! GPIO Input Crossbar output signal-9 ECAP_INPUT_INPUTXBAR9 = 8, //! GPIO Input Crossbar output signal-10 ECAP_INPUT_INPUTXBAR10 = 9, //! GPIO Input Crossbar output signal-11 ECAP_INPUT_INPUTXBAR11 = 10, //! GPIO Input Crossbar output signal-12 ECAP_INPUT_INPUTXBAR12 = 11, //! GPIO Input Crossbar output signal-13 ECAP_INPUT_INPUTXBAR13 = 12, //! GPIO Input Crossbar output signal-14 ECAP_INPUT_INPUTXBAR14 = 13, //! GPIO Input Crossbar output signal-15 ECAP_INPUT_INPUTXBAR15 = 14, //! GPIO Input Crossbar output signal-16 ECAP_INPUT_INPUTXBAR16 = 15, //! CLB1 CLBOUT14 input for ECAP1 instance ECAP_INPUT_ECAP1_CLB1_CLBOUT14 = 16, //! CLB1 CLBOUT14 input for ECAP2 instance ECAP_INPUT_ECAP2_CLB1_CLBOUT14 = 16, //! CLB2 CLBOUT14 input for ECAP3 instance ECAP_INPUT_ECAP3_CLB2_CLBOUT14 = 16, //! CLB2 CLBOUT14 input for ECAP4 instance ECAP_INPUT_ECAP4_CLB2_CLBOUT14 = 16, //! CLB2 CLBOUT14 input for ECAP5 instance ECAP_INPUT_ECAP5_CLB2_CLBOUT14 = 16, //! CLB3 CLBOUT14 input for ECAP6 instance ECAP_INPUT_ECAP6_CLB3_CLBOUT14 = 16, //! CLB3 CLBOUT14 input for ECAP7 instance ECAP_INPUT_ECAP7_CLB3_CLBOUT14 = 16, //! CLB1 CLBOUT15 input for ECAP1 instance ECAP_INPUT_ECAP1_CLB1_CLBOUT15 = 17, //! CLB1 CLBOUT15 input for ECAP2 instance ECAP_INPUT_ECAP2_CLB1_CLBOUT15 = 17, //! CLB2 CLBOUT15 input for ECAP3 instance ECAP_INPUT_ECAP3_CLB2_CLBOUT15 = 17, //! CLB2 CLBOUT15 input for ECAP4 instance ECAP_INPUT_ECAP4_CLB2_CLBOUT15 = 17, //! CLB2 CLBOUT15 input for ECAP5 instance ECAP_INPUT_ECAP5_CLB2_CLBOUT15 = 17, //! CLB3 CLBOUT15 input for ECAP6 instance ECAP_INPUT_ECAP6_CLB3_CLBOUT15 = 17, //! CLB3 CLBOUT15 input for ECAP7 instance ECAP_INPUT_ECAP7_CLB3_CLBOUT15 = 17, //! CLB4 CLBOUT14 input for ECAP6 instance ECAP_INPUT_ECAP6_CLB4_CLBOUT14 = 18, //! CLB4 CLBOUT14 input for ECAP7 instance ECAP_INPUT_ECAP7_CLB4_CLBOUT14 = 18, //! CLB4 CLBOUT15 input for ECAP6 instance ECAP_INPUT_ECAP6_CLB4_CLBOUT15 = 19, //! CLB4 CLBOUT15 input for ECAP7 instance ECAP_INPUT_ECAP7_CLB4_CLBOUT15 = 19, //! CANA INT0 Input ECAP_INPUT_CANA_INT0 = 20, //! CANB INT0 Input ECAP_INPUT_CANB_INT0 = 21, //! Delay clock for measurement ECAP_INPUT_ECAP_DELAY_CLOCK = 23, //! Output Xbar Output-1 ECAP_INPUT_OUTPUTXBAR1 = 24, //! Output Xbar Output-2 ECAP_INPUT_OUTPUTXBAR2 = 25, //! Output Xbar Output-3 ECAP_INPUT_OUTPUTXBAR3 = 26, //! Output Xbar Output-4 ECAP_INPUT_OUTPUTXBAR4 = 27, //! Output Xbar Output-5 ECAP_INPUT_OUTPUTXBAR5 = 28, //! Output Xbar Output-6 ECAP_INPUT_OUTPUTXBAR6 = 29, //! Output Xbar Output-7 ECAP_INPUT_OUTPUTXBAR7 = 30, //! Output Xbar Output-8 ECAP_INPUT_OUTPUTXBAR8 = 31, //! ADCD Event4 ECAP_INPUT_ADC_D_EVENT4 = 32, //! ADCD Event3 ECAP_INPUT_ADC_D_EVENT3 = 33, //! ADCD Event2 ECAP_INPUT_ADC_D_EVENT2 = 34, //! ADCD Event1 ECAP_INPUT_ADC_D_EVENT1 = 35, //! ADCC Event4 ECAP_INPUT_ADC_C_EVENT4 = 36, //! ADCC Event3 ECAP_INPUT_ADC_C_EVENT3 = 37, //! ADCC Event2 ECAP_INPUT_ADC_C_EVENT2 = 38, //! ADCC Event1 ECAP_INPUT_ADC_C_EVENT1 = 39, //! ADCB Event4 ECAP_INPUT_ADC_B_EVENT4 = 40, //! ADCB Event3 ECAP_INPUT_ADC_B_EVENT3 = 41, //! ADCB Event2 ECAP_INPUT_ADC_B_EVENT2 = 42, //! ADCB Event1 ECAP_INPUT_ADC_B_EVENT1 = 43, //! ADCA Event4 ECAP_INPUT_ADC_A_EVENT4 = 44, //! ADCA Event3 ECAP_INPUT_ADC_A_EVENT3 = 45, //! ADCA Event2 ECAP_INPUT_ADC_A_EVENT2 = 46, //! ADCA Event1 ECAP_INPUT_ADC_A_EVENT1 = 47, //! FSIA Rx MSR Line ECAP_INPUT_FSIA_RX_MSR_LINE = 48, //! FSIA Rx MSR Line Rise ECAP_INPUT_FSIA_RX_MSR_LINE_RISE = 49, //! FSIA Rx MSR Line Fall ECAP_INPUT_FSIA_RX_MSR_LINE_FALL = 50, //! FSIB Rx MSR Line ECAP_INPUT_FSIB_RX_MSR_LINE = 51, //! FSIB Rx MSR Line Rise ECAP_INPUT_FSIB_RX_MSR_LINE_RISE = 52, //! FSIB Rx MSR Line Fall ECAP_INPUT_FSIB_RX_MSR_LINE_FALL = 53, //! FSIC Rx MSR Line ECAP_INPUT_FSIC_RX_MSR_LINE = 54, //! FSIC Rx MSR Line Rise ECAP_INPUT_FSIC_RX_MSR_LINE_RISE = 55, //! FSIC Rx MSR Line Fall ECAP_INPUT_FSIC_RX_MSR_LINE_FALL = 56, //! FSID Rx MSR Line ECAP_INPUT_FSID_RX_MSR_LINE = 57, //! FSID Rx MSR Line Rise ECAP_INPUT_FSID_RX_MSR_LINE_RISE = 58, //! FSID Rx MSR Line Fall ECAP_INPUT_FSID_RX_MSR_LINE_FALL = 59, //! SDFM-2 Filter-1 Compare Low Trip ECAP_INPUT_SDFM2_FLT1_COMPARE_LOW = 60, //! SDFM-2 Filter-2 Compare Low Trip ECAP_INPUT_SDFM2_FLT2_COMPARE_LOW = 61, //! SDFM-2 Filter-3 Compare Low Trip ECAP_INPUT_SDFM2_FLT3_COMPARE_LOW = 62, //! SDFM-2 Filter-4 Compare Low Trip ECAP_INPUT_SDFM2_FLT4_COMPARE_LOW = 63, //! SDFM-1 Filter-1 Compare Low Trip ECAP_INPUT_SDFM1_FLT1_COMPARE_LOW = 64, //! SDFM-1 Filter-2 Compare Low Trip ECAP_INPUT_SDFM1_FLT2_COMPARE_LOW = 65, //! SDFM-1 Filter-3 Compare Low Trip ECAP_INPUT_SDFM1_FLT3_COMPARE_LOW = 66, //! SDFM-1 Filter-4 Compare Low Trip ECAP_INPUT_SDFM1_FLT4_COMPARE_LOW = 67, //! FSIE Rx MSR Line ECAP_INPUT_FSIE_RX_MSR_LINE = 68, //! FSIE Rx MSR Line Rise ECAP_INPUT_FSIE_RX_MSR_LINE_RISE = 69, //! FSIE Rx MSR Line Fall ECAP_INPUT_FSIE_RX_MSR_LINE_FALL = 70, //! FSIF Rx MSR Line ECAP_INPUT_FSIF_RX_MSR_LINE = 71, //! FSIF Rx MSR Line Rise ECAP_INPUT_FSIF_RX_MSR_LINE_RISE = 72, //! FSIF Rx MSR Line Fall ECAP_INPUT_FSIF_RX_MSR_LINE_FALL = 73, //! Ethercat Sync0 ECAP_INPUT_ECATSYNC0 = 74, //! Ethercat Sync1 ECAP_INPUT_ECATSYNC1 = 75, //! SDFM-2 Filter-1 Compare High Trip ECAP_INPUT_SDFM2_FLT1_COMPARE_HIGH = 76, //! SDFM-2 Filter-2 Compare High Trip ECAP_INPUT_SDFM2_FLT2_COMPARE_HIGH = 77, //! SDFM-2 Filter-3 Compare High Trip ECAP_INPUT_SDFM2_FLT3_COMPARE_HIGH = 78, //! SDFM-2 Filter-4 Compare High Trip ECAP_INPUT_SDFM2_FLT4_COMPARE_HIGH = 79, //! SDFM-1 Filter-1 Compare High Trip ECAP_INPUT_SDFM1_FLT1_COMPARE_HIGH = 80, //! SDFM-1 Filter-2 Compare High Trip ECAP_INPUT_SDFM1_FLT2_COMPARE_HIGH = 81, //! SDFM-1 Filter-3 Compare High Trip ECAP_INPUT_SDFM1_FLT3_COMPARE_HIGH = 82, //! SDFM-1 Filter-4 Compare High Trip ECAP_INPUT_SDFM1_FLT4_COMPARE_HIGH = 83, //! SDFM-2 Filter-1 Compare High Trip or Low Trip ECAP_INPUT_SDFM2_FLT1_COMPARE_HIGH_OR_LOW = 84, //! SDFM-2 Filter-2 Compare High Trip or Low Trip ECAP_INPUT_SDFM2_FLT2_COMPARE_HIGH_OR_LOW = 85, //! SDFM-2 Filter-3 Compare High Trip or Low Trip ECAP_INPUT_SDFM2_FLT3_COMPARE_HIGH_OR_LOW = 86, //! SDFM-2 Filter-4 Compare High Trip or Low Trip ECAP_INPUT_SDFM2_FLT4_COMPARE_HIGH_OR_LOW = 87, //! SDFM-1 Filter-1 Compare High Trip or Low Trip ECAP_INPUT_SDFM1_FLT1_COMPARE_HIGH_OR_LOW = 88, //! SDFM-1 Filter-2 Compare High Trip or Low Trip ECAP_INPUT_SDFM1_FLT2_COMPARE_HIGH_OR_LOW = 89, //! SDFM-1 Filter-3 Compare High Trip or Low Trip ECAP_INPUT_SDFM1_FLT3_COMPARE_HIGH_OR_LOW = 90, //! SDFM-1 Filter-4 Compare High Trip or Low Trip ECAP_INPUT_SDFM1_FLT4_COMPARE_HIGH_OR_LOW = 91, //! FSIG Rx MSR Line ECAP_INPUT_FSIG_RX_MSR_LINE = 92, //! FSIG Rx MSR Line Rise ECAP_INPUT_FSIG_RX_MSR_LINE_RISE = 93, //! FSIG Rx MSR Line Fall ECAP_INPUT_FSIG_RX_MSR_LINE_FALL = 94, //! Compare Subsystem-1 Low Trip ECAP_INPUT_CMPSS1_CTRIP_LOW = 96, //! Compare Subsystem-2 Low Trip ECAP_INPUT_CMPSS2_CTRIP_LOW = 97, //! Compare Subsystem-3 Low Trip ECAP_INPUT_CMPSS3_CTRIP_LOW = 98, //! Compare Subsystem-4 Low Trip ECAP_INPUT_CMPSS4_CTRIP_LOW = 99, //! Compare Subsystem-5 Low Trip ECAP_INPUT_CMPSS5_CTRIP_LOW = 100, //! Compare Subsystem-6 Low Trip ECAP_INPUT_CMPSS6_CTRIP_LOW = 101, //! Compare Subsystem-7 Low Trip ECAP_INPUT_CMPSS7_CTRIP_LOW = 102, //! FSIH Rx MSR Line ECAP_INPUT_FSIH_RX_MSR_LINE = 103, //! FSIH Rx MSR Line Rise ECAP_INPUT_FSIH_RX_MSR_LINE_RISE = 104, //! FSIH Rx MSR Line Fall ECAP_INPUT_FSIH_RX_MSR_LINE_FALL = 105, //! Compare Subsystem-1 High Trip ECAP_INPUT_CMPSS1_CTRIP_HIGH = 108, //! Compare Subsystem-2 High Trip ECAP_INPUT_CMPSS2_CTRIP_HIGH = 109, //! Compare Subsystem-3 High Trip ECAP_INPUT_CMPSS3_CTRIP_HIGH = 110, //! Compare Subsystem-4 High Trip ECAP_INPUT_CMPSS4_CTRIP_HIGH = 111, //! Compare Subsystem-5 High Trip ECAP_INPUT_CMPSS5_CTRIP_HIGH = 112, //! Compare Subsystem-6 High Trip ECAP_INPUT_CMPSS6_CTRIP_HIGH = 113, //! Compare Subsystem-7 High Trip ECAP_INPUT_CMPSS7_CTRIP_HIGH = 114, //! GPIO8 ECAP_INPUT_GPIO8 = 115, //! GPIO9 ECAP_INPUT_GPIO9 = 116, //! GPIO22 ECAP_INPUT_GPIO22 = 117, //! GPIO23 ECAP_INPUT_GPIO23 = 118, //! Compare Subsystem-1 High Trip or Low Trip ECAP_INPUT_CMPSS1_CTRIP_HIGH_OR_LOW = 120, //! Compare Subsystem-2 High Trip or Low Trip ECAP_INPUT_CMPSS2_CTRIP_HIGH_OR_LOW = 121, //! Compare Subsystem-3 High Trip or Low Trip ECAP_INPUT_CMPSS3_CTRIP_HIGH_OR_LOW = 122, //! Compare Subsystem-4 High Trip or Low Trip ECAP_INPUT_CMPSS4_CTRIP_HIGH_OR_LOW = 123, //! Compare Subsystem-5 High Trip or Low Trip ECAP_INPUT_CMPSS5_CTRIP_HIGH_OR_LOW = 124, //! Compare Subsystem-6 High Trip or Low Trip ECAP_INPUT_CMPSS6_CTRIP_HIGH_OR_LOW = 125, //! Compare Subsystem-7 High Trip or Low Trip ECAP_INPUT_CMPSS7_CTRIP_HIGH_OR_LOW = 126, //! GPTRIP7 input for instance ECAP1 ECAP_INPUT_ECAP1_GPTRIP7 = 127, //! GPTRIP8 input for instance ECAP2 ECAP_INPUT_ECAP2_GPTRIP8 = 127, //! GPTRIP9 input for instance ECAP3 ECAP_INPUT_ECAP3_GPTRIP9 = 127, //! GPTRIP10 input for instance ECAP4 ECAP_INPUT_ECAP4_GPTRIP10 = 127, //! GPTRIP11 input for instance ECAP5 ECAP_INPUT_ECAP5_GPTRIP11 = 127, //! GPTRIP12 input for instance ECAP6 ECAP_INPUT_ECAP6_GPTRIP12 = 127, //! GPTRIP13 input for instance ECAP7 ECAP_INPUT_ECAP7_GPTRIP13 = 127, }ECAP_InputCaptureSignals; //***************************************************************************** // //! Values that can be passed to ECAP_setSyncInPulseSource() as the \e mode //! parameter. // //***************************************************************************** typedef enum { //! Disable Sync-in ECAP_SYNC_IN_PULSE_SRC_DISABLE = 0x0, //! Sync-in source is EPWM1 sync-out signal ECAP_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM1 = 0x1, //! Sync-in source is EPWM2 sync-out signal ECAP_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM2 = 0x2, //! Sync-in source is EPWM3 sync-out signal ECAP_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM3 = 0x3, //! Sync-in source is EPWM4 sync-out signal ECAP_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM4 = 0x4, //! Sync-in source is EPWM5 sync-out signal ECAP_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM5 = 0x5, //! Sync-in source is EPWM6 sync-out signal ECAP_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM6 = 0x6, //! Sync-in source is EPWM7 sync-out signal ECAP_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM7 = 0x7, //! Sync-in source is EPWM8 sync-out signal ECAP_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM8 = 0x8, //! Sync-in source is EPWM9 sync-out signal ECAP_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM9 = 0x9, //! Sync-in source is EPWM10 sync-out signal ECAP_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM10 = 0xA, //! Sync-in source is EPWM11 sync-out signal ECAP_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM11 = 0xB, //! Sync-in source is EPWM12 sync-out signal ECAP_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM12 = 0xC, //! Sync-in source is EPWM13 sync-out signal ECAP_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM13 = 0xD, //! Sync-in source is EPWM14 sync-out signal ECAP_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM14 = 0xE, //! Sync-in source is EPWM15 sync-out signal ECAP_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM15 = 0xF, //! Sync-in source is EPWM16 sync-out signal ECAP_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM16 = 0x10, //! Sync-in source is ECAP1 sync-out signal ECAP_SYNC_IN_PULSE_SRC_SYNCOUT_ECAP1 = 0x11, //! Sync-in source is ECAP2 sync-out signal ECAP_SYNC_IN_PULSE_SRC_SYNCOUT_ECAP2 = 0x12, //! Sync-in source is ECAP3 sync-out signal ECAP_SYNC_IN_PULSE_SRC_SYNCOUT_ECAP3 = 0x13, //! Sync-in source is ECAP4 sync-out signal ECAP_SYNC_IN_PULSE_SRC_SYNCOUT_ECAP4 = 0x14, //! Sync-in source is ECAP5 sync-out signal ECAP_SYNC_IN_PULSE_SRC_SYNCOUT_ECAP5 = 0x15, //! Sync-in source is ECAP6 sync-out signal ECAP_SYNC_IN_PULSE_SRC_SYNCOUT_ECAP6 = 0x16, //! Sync-in source is ECAP7 sync-out signal ECAP_SYNC_IN_PULSE_SRC_SYNCOUT_ECAP7 = 0x17, //! Sync-in source is Input XBAR out5 signal ECAP_SYNC_IN_PULSE_SRC_INPUTXBAR_OUT5 = 0x18, //! Sync-in source is Input XBAR out6 signal ECAP_SYNC_IN_PULSE_SRC_INPUTXBAR_OUT6 = 0x19, //! Sync-in source is Ethercat sync0 signal ECAP_SYNC_IN_PULSE_SRC_ETHERCAT_SYNC0 = 0x1A, //! Sync-in source is Ethercat sync1 signal ECAP_SYNC_IN_PULSE_SRC_ETHERCAT_SYNC1 = 0x1B }ECAP_SyncInPulseSource; //***************************************************************************** // //! \internal //! Checks eCAP base address. //! //! \param base specifies the eCAP module base address. //! //! This function determines if an eCAP module base address is valid. //! //! \return Returns \b true if the base address is valid and \b false //! otherwise. // //***************************************************************************** static inline _Bool ECAP_isBaseValid(uint32_t base) { return((base == 0x00005200U) || (base == 0x00005240U) || (base == 0x00005280U) || (base == 0x000052C0U) || (base == 0x00005300U) || (base == 0x00005340U) || (base == 0x00005380U)); } //***************************************************************************** // //! Sets the input prescaler. //! //! \param base is the base address of the ECAP module. //! \param preScalerValue is the pre scaler value for ECAP input //! //! This function divides the ECAP input scaler. The pre scale value is //! doubled inside the module. For example a preScalerValue of 5 will divide //! the scaler by 10. Use a value of 1 to divide the pre scaler by 1. //! The value of preScalerValue should be less than //! \b ECAP_MAX_PRESCALER_VALUE. //! //! \return None. // //***************************************************************************** static inline void ECAP_setEventPrescaler(uint32_t base, uint16_t preScalerValue) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 603); } } while(0); do { if(!(preScalerValue < 32U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 605); } } while(0); __eallow(); // // Write to PRESCALE bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) & (~0x3E00U)) | (preScalerValue << 9U)); __edis(); } //***************************************************************************** // //! Sets the Capture event polarity. //! //! \param base is the base address of the ECAP module. //! \param event is the event number. //! \param polarity is the polarity of the event. //! //! This function sets the polarity of a given event. The value of event //! is between \b ECAP_EVENT_1 and \b ECAP_EVENT_4 inclusive corresponding to //! the four available events.For each event the polarity value determines the //! edge on which the capture is activated. For a rising edge use a polarity //! value of \b ECAP_EVNT_RISING_EDGE and for a falling edge use a polarity of //! \b ECAP_EVNT_FALLING_EDGE. //! //! \return None. // //***************************************************************************** static inline void ECAP_setEventPolarity(uint32_t base, ECAP_Events event, ECAP_EventPolarity polarity) { uint16_t shift; do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 643); } } while(0); shift = ((uint16_t)event) << 1U; __eallow(); // // Write to CAP1POL, CAP2POL, CAP3POL or CAP4POL // (*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) & ~(1U << shift)) | ((uint16_t)polarity << shift); __edis(); } //***************************************************************************** // //! Sets the capture mode. //! //! \param base is the base address of the ECAP module. //! \param mode is the capture mode. //! \param event is the event number at which the counter stops or wraps. //! //! This function sets the eCAP module to a continuous or one-shot mode. //! The value of mode should be either \b ECAP_CONTINUOUS_CAPTURE_MODE or //! \b ECAP_ONE_SHOT_CAPTURE_MODE corresponding to continuous or one-shot mode //! respectively. //! //! The value of event determines the event number at which the counter stops //! (in one-shot mode) or the counter wraps (in continuous mode). The value of //! event should be between \b ECAP_EVENT_1 and \b ECAP_EVENT_4 corresponding //! to the valid event numbers. //! //! \return None. // //***************************************************************************** static inline void ECAP_setCaptureMode(uint32_t base, ECAP_CaptureMode mode, ECAP_Events event) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 683); } } while(0); __eallow(); // // Write to CONT/ONESHT // (*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) & (~0x1U)) | (uint16_t)mode); // // Write to STOP_WRAP // (*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) & (~0x6U)) | (((uint16_t)event) << 1U )); __edis(); } //***************************************************************************** // //! Re-arms the eCAP module. //! //! \param base is the base address of the ECAP module. //! //! This function re-arms the eCAP module. //! //! \return None. // //***************************************************************************** static inline void ECAP_reArm(uint32_t base) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 716); } } while(0); __eallow(); // // Write to RE-ARM bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) |= 0x8U; __edis(); } //***************************************************************************** // //! Enables interrupt source. //! //! \param base is the base address of the ECAP module. //! \param intFlags is the interrupt source to be enabled. //! //! This function sets and enables eCAP interrupt source. The following are //! valid interrupt sources. //! - ECAP_ISR_SOURCE_CAPTURE_EVENT_1 - Event 1 generates interrupt //! - ECAP_ISR_SOURCE_CAPTURE_EVENT_2 - Event 2 generates interrupt //! - ECAP_ISR_SOURCE_CAPTURE_EVENT_3 - Event 3 generates interrupt //! - ECAP_ISR_SOURCE_CAPTURE_EVENT_4 - Event 4 generates interrupt //! - ECAP_ISR_SOURCE_COUNTER_OVERFLOW - Counter overflow generates interrupt //! - ECAP_ISR_SOURCE_COUNTER_PERIOD - Counter equal period generates //! interrupt //! - ECAP_ISR_SOURCE_COUNTER_COMPARE - Counter equal compare generates //! interrupt //! //! \return None. // //***************************************************************************** static inline void ECAP_enableInterrupt(uint32_t base, uint16_t intFlags) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 752); } } while(0); do { if(!((intFlags & ~(0x2U | 0x4U | 0x8U | 0x10U | 0x20U | 0x40U | 0x80U)) == 0U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 759); } } while(0); __eallow(); // // Set bits in ECEINT register // (*((volatile uint16_t *)((uintptr_t)(base + 0x16U)))) |= intFlags; __edis(); } //***************************************************************************** // //! Disables interrupt source. //! //! \param base is the base address of the ECAP module. //! \param intFlags is the interrupt source to be disabled. //! //! This function clears and disables eCAP interrupt source. The following are //! valid interrupt sources. //! - ECAP_ISR_SOURCE_CAPTURE_EVENT_1 - Event 1 generates interrupt //! - ECAP_ISR_SOURCE_CAPTURE_EVENT_2 - Event 2 generates interrupt //! - ECAP_ISR_SOURCE_CAPTURE_EVENT_3 - Event 3 generates interrupt //! - ECAP_ISR_SOURCE_CAPTURE_EVENT_4 - Event 4 generates interrupt //! - ECAP_ISR_SOURCE_COUNTER_OVERFLOW - Counter overflow generates interrupt //! - ECAP_ISR_SOURCE_COUNTER_PERIOD - Counter equal period generates //! interrupt //! - ECAP_ISR_SOURCE_COUNTER_COMPARE - Counter equal compare generates //! interrupt //! //! \return None. // //***************************************************************************** static inline void ECAP_disableInterrupt(uint32_t base, uint16_t intFlags) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 797); } } while(0); do { if(!((intFlags & ~(0x2U | 0x4U | 0x8U | 0x10U | 0x20U | 0x40U | 0x80U)) == 0U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 804); } } while(0); __eallow(); // // Clear bits in ECEINT register // (*((volatile uint16_t *)((uintptr_t)(base + 0x16U)))) &= ~intFlags; __edis(); } //***************************************************************************** // //! Returns the interrupt flag. //! //! \param base is the base address of the ECAP module. //! //! This function returns the eCAP interrupt flag. The following are valid //! interrupt sources corresponding to the eCAP interrupt flag. //! //! \return Returns the eCAP interrupt that has occurred. The following are //! valid return values. //! - ECAP_ISR_SOURCE_CAPTURE_EVENT_1 - Event 1 generates interrupt //! - ECAP_ISR_SOURCE_CAPTURE_EVENT_2 - Event 2 generates interrupt //! - ECAP_ISR_SOURCE_CAPTURE_EVENT_3 - Event 3 generates interrupt //! - ECAP_ISR_SOURCE_CAPTURE_EVENT_4 - Event 4 generates interrupt //! - ECAP_ISR_SOURCE_COUNTER_OVERFLOW - Counter overflow generates interrupt //! - ECAP_ISR_SOURCE_COUNTER_PERIOD - Counter equal period generates //! interrupt //! - ECAP_ISR_SOURCE_COUNTER_COMPARE - Counter equal compare generates //! interrupt //! //! \note - User can check if a combination of various interrupts have occurred //! by ORing the above return values. // //***************************************************************************** static inline uint16_t ECAP_getInterruptSource(uint32_t base) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 842); } } while(0); // // Return contents of ECFLG register // return((*((volatile uint16_t *)((uintptr_t)(base + 0x17U)))) & 0xFEU); } //***************************************************************************** // //! Returns the Global interrupt flag. //! //! \param base is the base address of the ECAP module. //! //! This function returns the eCAP Global interrupt flag. //! //! \return Returns true if there is a global eCAP interrupt, false otherwise. // //***************************************************************************** static inline _Bool ECAP_getGlobalInterruptStatus(uint32_t base) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 863); } } while(0); // // Return contents of Global interrupt bit // return(((*((volatile uint16_t *)((uintptr_t)(base + 0x17U)))) & 0x1U) == 0x1U); } //***************************************************************************** // //! Clears interrupt flag. //! //! \param base is the base address of the ECAP module. //! \param intFlags is the interrupt source. //! //! This function clears eCAP interrupt flags. The following are valid //! interrupt sources. //! - ECAP_ISR_SOURCE_CAPTURE_EVENT_1 - Event 1 generates interrupt //! - ECAP_ISR_SOURCE_CAPTURE_EVENT_2 - Event 2 generates interrupt //! - ECAP_ISR_SOURCE_CAPTURE_EVENT_3 - Event 3 generates interrupt //! - ECAP_ISR_SOURCE_CAPTURE_EVENT_4 - Event 4 generates interrupt //! - ECAP_ISR_SOURCE_COUNTER_OVERFLOW - Counter overflow generates interrupt //! - ECAP_ISR_SOURCE_COUNTER_PERIOD - Counter equal period generates //! interrupt //! - ECAP_ISR_SOURCE_COUNTER_COMPARE - Counter equal compare generates //! interrupt //! //! \return None. // //***************************************************************************** static inline void ECAP_clearInterrupt(uint32_t base, uint16_t intFlags) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 896); } } while(0); do { if(!((intFlags & ~(0x2U | 0x4U | 0x8U | 0x10U | 0x20U | 0x40U | 0x80U)) == 0U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 903); } } while(0); // // Write to ECCLR register // (*((volatile uint16_t *)((uintptr_t)(base + 0x18U)))) |= intFlags; } //***************************************************************************** // //! Clears global interrupt flag //! //! \param base is the base address of the ECAP module. //! //! This function clears the global interrupt bit. //! //! \return None. // //***************************************************************************** static inline void ECAP_clearGlobalInterrupt(uint32_t base) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 924); } } while(0); // // Write to INT bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x18U)))) |= 0x1U; } //***************************************************************************** // //! Forces interrupt source. //! //! \param base is the base address of the ECAP module. //! \param intFlags is the interrupt source. //! //! This function forces and enables eCAP interrupt source. The following are //! valid interrupt sources. //! - ECAP_ISR_SOURCE_CAPTURE_EVENT_1 - Event 1 generates interrupt //! - ECAP_ISR_SOURCE_CAPTURE_EVENT_2 - Event 2 generates interrupt //! - ECAP_ISR_SOURCE_CAPTURE_EVENT_3 - Event 3 generates interrupt //! - ECAP_ISR_SOURCE_CAPTURE_EVENT_4 - Event 4 generates interrupt //! - ECAP_ISR_SOURCE_COUNTER_OVERFLOW - Counter overflow generates interrupt //! - ECAP_ISR_SOURCE_COUNTER_PERIOD - Counter equal period generates //! interrupt //! - ECAP_ISR_SOURCE_COUNTER_COMPARE - Counter equal compare generates //! interrupt //! //! \return None. // //***************************************************************************** static inline void ECAP_forceInterrupt(uint32_t base, uint16_t intFlags) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 957); } } while(0); do { if(!((intFlags & ~(0x2U | 0x4U | 0x8U | 0x10U | 0x20U | 0x40U | 0x80U)) == 0U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 964); } } while(0); __eallow(); // // Write to ECFRC register // (*((volatile uint16_t *)((uintptr_t)(base + 0x19U)))) |= intFlags; __edis(); } //***************************************************************************** // //! Sets eCAP in Capture mode. //! //! \param base is the base address of the ECAP module. //! //! This function sets the eCAP module to operate in Capture mode. //! //! \return None. // //***************************************************************************** static inline void ECAP_enableCaptureMode(uint32_t base) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 988); } } while(0); __eallow(); // // Clear CAP/APWM bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) &= ~0x200U; __edis(); } //***************************************************************************** // //! Sets eCAP in APWM mode. //! //! \param base is the base address of the ECAP module. //! //! This function sets the eCAP module to operate in APWM mode. //! //! \return None. // //***************************************************************************** static inline void ECAP_enableAPWMMode(uint32_t base) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 1012); } } while(0); __eallow(); // // Set CAP/APWM bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) |= 0x200U; __edis(); } //***************************************************************************** // //! Enables counter reset on an event. //! //! \param base is the base address of the ECAP module. //! \param event is the event number the time base gets reset. //! //! This function enables the base timer, TSCTR, to be reset on capture //! event provided by the variable event. Valid inputs for event are //! \b ECAP_EVENT_1 to \b ECAP_EVENT_4. //! //! \return None. // //***************************************************************************** static inline void ECAP_enableCounterResetOnEvent(uint32_t base, ECAP_Events event) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 1040); } } while(0); __eallow(); // // Set CTRRST1,CTRRST2,CTRRST3 or CTRRST4 bits // (*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) |= 1U << ((2U * (uint16_t)event) + 1U); __edis(); } //***************************************************************************** // //! Disables counter reset on events. //! //! \param base is the base address of the ECAP module. //! \param event is the event number the time base gets reset. //! //! This function disables the base timer, TSCTR, from being reset on capture //! event provided by the variable event. Valid inputs for event are //! \b ECAP_EVENT_1 to \b ECAP_EVENT_4. //! //! \return None. // //***************************************************************************** static inline void ECAP_disableCounterResetOnEvent(uint32_t base, ECAP_Events event) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 1068); } } while(0); do { if(!((event >= 1U) || (event <= 4U))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 1069); } } while(0); __eallow(); // // Clear CTRRST1,CTRRST2,CTRRST3 or CTRRST4 bits // (*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) &= ~(1U << ((2U * (uint16_t)event) + 1U)); __edis(); } //***************************************************************************** // //! Enables time stamp capture. //! //! \param base is the base address of the ECAP module. //! //! This function enables time stamp count to be captured //! //! \return None. // //***************************************************************************** static inline void ECAP_enableTimeStampCapture(uint32_t base) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 1093); } } while(0); __eallow(); // // Set CAPLDEN bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) |= 0x100U; __edis(); } //***************************************************************************** // //! Disables time stamp capture. //! //! \param base is the base address of the ECAP module. //! //! This function disables time stamp count to be captured //! //! \return None. // //***************************************************************************** static inline void ECAP_disableTimeStampCapture(uint32_t base) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 1117); } } while(0); __eallow(); // // Clear CAPLDEN bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) &= ~0x100U; __edis(); } //***************************************************************************** // //! Sets a phase shift value count. //! //! \param base is the base address of the ECAP module. //! \param shiftCount is the phase shift value. //! //! This function writes a phase shift value to be loaded into the main time //! stamp counter. //! //! \return None. // //***************************************************************************** static inline void ECAP_setPhaseShiftCount(uint32_t base, uint32_t shiftCount) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 1143); } } while(0); // // Write to CTRPHS // (*((volatile uint32_t *)((uintptr_t)(base + 0x2U)))) = shiftCount; } //***************************************************************************** // //! Set up the source for sync-in pulse. //! //! \param base is the base address of the ECAP module. //! \param source is the sync-in pulse source. //! //! This function set the sync out pulse mode. //! Valid values for mode are: //! - ECAP_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM1-16 - sync-in pulse source can be //! any of the EPWM1-16 sync-out //! signal //! - ECAP_SYNC_IN_PULSE_SRC_SYNCOUT_ECAP1-7 - sync-in pulse source can be //! selected as any of the ECAP1-16 //! sync-out signal //! - ECAP_SYNC_IN_PULSE_SRC_INPUTXBAR_OUT5-6 - sync-in pulse source can be //! selected as any of the Input //! xbar out5-6 signal //! - ECAP_SYNC_IN_PULSE_SRC_ETHERCAT_SYNC0-1 - sync-in pulse source can be //! selected as any of the //! Ethercat sync0-1 signal //! - ECAP_SYNC_IN_PULSE_SRC_DISABLE - sync-in pulse is disabled for the //! ECAP module //! //! \return None. // //***************************************************************************** static inline void ECAP_setSyncInPulseSource(uint32_t base, ECAP_SyncInPulseSource source) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 1181); } } while(0); __eallow(); // // Set ECAP Sync-In Source Mode. // (*((volatile uint16_t *)((uintptr_t)(base + 0x1EU)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x1EU)))) & (~0x1FU)) | ((uint16_t)source & 0x1FU); __edis(); } //***************************************************************************** // //! Enable counter loading with phase shift value. //! //! \param base is the base address of the ECAP module. //! //! This function enables loading of the counter with the value present in the //! phase shift counter as defined by the ECAP_setPhaseShiftCount() function. //! //! \return None. // //***************************************************************************** static inline void ECAP_enableLoadCounter(uint32_t base) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 1210); } } while(0); __eallow(); // // Write to SYNCI_EN // (*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) |= 0x20U; __edis(); } //***************************************************************************** // //! Disable counter loading with phase shift value. //! //! \param base is the base address of the ECAP module. //! //! This function disables loading of the counter with the value present in the //! phase shift counter as defined by the ECAP_setPhaseShiftCount() function. //! //! \return None. // //***************************************************************************** static inline void ECAP_disableLoadCounter(uint32_t base) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 1236); } } while(0); __eallow(); // // Write to SYNCI_EN // (*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) &= ~0x20U; __edis(); } //***************************************************************************** // //! Load time stamp counter //! //! \param base is the base address of the ECAP module. //! //! This function forces the value in the phase shift counter register to be //! loaded into Time stamp counter register. //! Make sure to enable loading of Time stamp counter by calling //! ECAP_enableLoadCounter() function before calling this function. //! //! \return None. // //***************************************************************************** static inline void ECAP_loadCounter(uint32_t base) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 1263); } } while(0); __eallow(); // // Write to SWSYNC // (*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) |= 0x100U; __edis(); } //***************************************************************************** // //! Configures Sync out signal mode. //! //! \param base is the base address of the ECAP module. //! \param mode is the sync out mode. //! //! This function sets the sync out mode. Valid parameters for mode are: //! - ECAP_SYNC_OUT_SYNCI - Trigger sync out on sync-in event. //! - ECAP_SYNC_OUT_COUNTER_PRD - Trigger sync out when counter equals period. //! - ECAP_SYNC_OUT_DISABLED - Disable sync out. //! //! \return None. // //***************************************************************************** static inline void ECAP_setSyncOutMode(uint32_t base, ECAP_SyncOutMode mode) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 1292); } } while(0); __eallow(); // // Write to SYNCO_SEL // (*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) & (~0xC0U)) | (uint16_t)mode); __edis(); } //***************************************************************************** // //! Stops Time stamp counter. //! //! \param base is the base address of the ECAP module. //! //! This function stops the time stamp counter. //! //! \return None. // //***************************************************************************** static inline void ECAP_stopCounter(uint32_t base) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 1318); } } while(0); __eallow(); // // Clear TSCTR // (*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) &= ~0x10U; __edis(); } //***************************************************************************** // //! Starts Time stamp counter. //! //! \param base is the base address of the ECAP module. //! //! This function starts the time stamp counter. //! //! \return None. // //***************************************************************************** static inline void ECAP_startCounter(uint32_t base) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 1342); } } while(0); __eallow(); // // Set TSCTR // (*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) |= 0x10U; __edis(); } //***************************************************************************** // //! Set eCAP APWM polarity. //! //! \param base is the base address of the ECAP module. //! \param polarity is the polarity of APWM //! //! This function sets the polarity of the eCAP in APWM mode. Valid inputs for //! polarity are: //! - ECAP_APWM_ACTIVE_HIGH - For active high. //! - ECAP_APWM_ACTIVE_LOW - For active low. //! //! \return None. // //***************************************************************************** static inline void ECAP_setAPWMPolarity(uint32_t base, ECAP_APWMPolarity polarity) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 1371); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) & ~0x400U) | (uint16_t)polarity); __edis(); } //***************************************************************************** // //! Set eCAP APWM period. //! //! \param base is the base address of the ECAP module. //! \param periodCount is the period count for APWM. //! //! This function sets the period count of the APWM waveform. //! periodCount takes the actual count which is written to the register. The //! user is responsible for converting the desired frequency or time into //! the period count. //! //! \return None. // //***************************************************************************** static inline void ECAP_setAPWMPeriod(uint32_t base, uint32_t periodCount) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 1397); } } while(0); // // Write to CAP1 // (*((volatile uint32_t *)((uintptr_t)(base + 0x4U)))) = periodCount; } //***************************************************************************** // //! Set eCAP APWM on or off time count. //! //! \param base is the base address of the ECAP module. //! \param compareCount is the on or off count for APWM. //! //! This function sets the on or off time count of the APWM waveform depending //! on the polarity of the output. If the output , as set by //! ECAP_setAPWMPolarity(), is active high then compareCount determines the on //! time. If the output is active low then compareCount determines the off //! time. compareCount takes the actual count which is written to the register. //! The user is responsible for converting the desired frequency or time into //! the appropriate count value. //! //! \return None. // //***************************************************************************** static inline void ECAP_setAPWMCompare(uint32_t base, uint32_t compareCount) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 1425); } } while(0); // // Write to CAP2 // (*((volatile uint32_t *)((uintptr_t)(base + 0x6U)))) = compareCount; } //***************************************************************************** // //! Load eCAP APWM shadow period. //! //! \param base is the base address of the ECAP module. //! \param periodCount is the shadow period count for APWM. //! //! This function sets the shadow period count of the APWM waveform. //! periodCount takes the actual count which is written to the register. The //! user is responsible for converting the desired frequency or time into //! the period count. //! //! \return None. // //***************************************************************************** static inline void ECAP_setAPWMShadowPeriod(uint32_t base, uint32_t periodCount) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 1451); } } while(0); // // Write to CAP3 // (*((volatile uint32_t *)((uintptr_t)(base + 0x8U)))) = periodCount; } //***************************************************************************** // //! Set eCAP APWM shadow on or off time count. //! //! \param base is the base address of the ECAP module. //! \param compareCount is the on or off count for APWM. //! //! This function sets the shadow on or off time count of the APWM waveform //! depending on the polarity of the output. If the output , as set by //! ECAP_setAPWMPolarity() , is active high then compareCount determines the //! on time. If the output is active low then compareCount determines the off //! time. compareCount takes the actual count which is written to the register. //! The user is responsible for converting the desired frequency or time into //! the appropriate count value. //! //! \return None. // //***************************************************************************** static inline void ECAP_setAPWMShadowCompare(uint32_t base, uint32_t compareCount) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 1480); } } while(0); // // Write to CAP4 // (*((volatile uint32_t *)((uintptr_t)(base + 0xAU)))) = compareCount; } //***************************************************************************** // //! Returns the time base counter value. //! //! \param base is the base address of the ECAP module. //! //! This function returns the time base counter value. //! //! \return Returns the time base counter value. // //***************************************************************************** static inline uint32_t ECAP_getTimeBaseCounter(uint32_t base) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 1501); } } while(0); // // Read the Time base counter value // return((*((volatile uint32_t *)((uintptr_t)(base + 0x0U))))); } //***************************************************************************** // //! Returns event time stamp. //! //! \param base is the base address of the ECAP module. //! \param event is the event number. //! //! This function returns the current time stamp count of the given event. //! Valid values for event are \b ECAP_EVENT_1 to \b ECAP_EVENT_4. //! //! \return Event time stamp value or 0 if \e event is invalid. // //***************************************************************************** static inline uint32_t ECAP_getEventTimeStamp(uint32_t base, ECAP_Events event) { uint32_t count; do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 1526); } } while(0); switch(event) { case ECAP_EVENT_1: // // Read CAP1 register // count = (*((volatile uint32_t *)((uintptr_t)(base + 0x4U)))); break; case ECAP_EVENT_2: // // Read CAP2 register // count = (*((volatile uint32_t *)((uintptr_t)(base + 0x6U)))); break; case ECAP_EVENT_3: // // Read CAP3 register // count = (*((volatile uint32_t *)((uintptr_t)(base + 0x8U)))); break; case ECAP_EVENT_4: // // Read CAP4 register // count = (*((volatile uint32_t *)((uintptr_t)(base + 0xAU)))); break; default: // // Invalid event parameter // count = 0U; break; } return(count); } //***************************************************************************** // //! Select eCAP input. //! //! \param base is the base address of the ECAP module. //! \param input is the eCAP input signal. //! //! This function selects the eCAP input signal. //! //! Please refer to the ::ECAP_InputCaptureSignals Enum for the valid values //! to be passed to \e input parameter. //! //! \return None. // //***************************************************************************** static inline void ECAP_selectECAPInput(uint32_t base, ECAP_InputCaptureSignals input) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 1592); } } while(0); __eallow(); // // Write to ECCTL0 // (*((volatile uint16_t *)((uintptr_t)(base + 0x12U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x12U)))) & ~0x7FU) | (uint16_t)input); __edis(); } //***************************************************************************** // //! Resets eCAP counters and flags. //! //! \param base is the base address of the ECAP module. //! //! This function resets the main counter (TSCTR register), event filter, //! modulo counter, capture events and counter overflow flags //! //! \return None. // //***************************************************************************** static inline void ECAP_resetCounters(uint32_t base) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 1619); } } while(0); __eallow(); // // Write to ECCTL2 // (*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) |= 0x800U; __edis(); } //***************************************************************************** // //! Sets the eCAP DMA source. //! //! \param base is the base address of the ECAP module. //! \param event is the eCAP event for the DMA //! //! This function sets the eCAP event source for the DMA trigger. //! Valid values for \e event are \b ECAP_EVENT_1 to \b ECAP_EVENT_4. //! //! \return None. // //***************************************************************************** static inline void ECAP_setDMASource(uint32_t base, ECAP_Events event) { do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 1645); } } while(0); __eallow(); // // Write to ECCTL2 // (*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) & ~0x3000U) | ((uint16_t)event << 12U)); __edis(); } //***************************************************************************** // //! Return the Modulo counter status. //! //! \param base is the base address of the ECAP module. //! //! This function returns the modulo counter status, indicating which register //! gets loaded on the next capture event. //! //! \return Returns an \b ECAP_EVENT_n value indicating that CAPn is the //! register to be loaded on the next event. // //***************************************************************************** static inline ECAP_Events ECAP_getModuloCounterStatus(uint32_t base) { uint16_t counterStatusValue; do { if(!(ECAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/ecap.h", 1675); } } while(0); counterStatusValue = ((((*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) & 0xC000U) >> 14U)); // // Read MODCNTRSTS bit // return((ECAP_Events)(counterStatusValue)); } //***************************************************************************** // //! Configures emulation mode. //! //! \param base is the base address of the ECAP module. //! \param mode is the emulation mode. //! //! This function configures the eCAP counter, TSCTR, to the desired emulation //! mode when emulation suspension occurs. Valid inputs for mode are: //! - ECAP_EMULATION_STOP - Counter is stopped immediately. //! - ECAP_EMULATION_RUN_TO_ZERO - Counter runs till it reaches 0. //! - ECAP_EMULATION_FREE_RUN - Counter is not affected. //! //! \return None. // //***************************************************************************** extern void ECAP_setEmulationMode(uint32_t base, ECAP_EmulationMode mode); //***************************************************************************** // // Close the Doxygen group. //! @} // //***************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //########################################################################### // // FILE: emif.h // // TITLE: C28x EMIF driver. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup emif_api EMIF //! @{ // //***************************************************************************** //########################################################################### // // FILE: hw_emif.h // // TITLE: Definitions for the EMIF registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the EMIF register offsets // //***************************************************************************** // Register // Register // Register // Register // Register // Register // Register // Register //***************************************************************************** // // The following are defines for the bit fields in the RCSR register // //***************************************************************************** // or half rate. //***************************************************************************** // // The following are defines for the bit fields in the ASYNC_WCCR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SDRAM_CR register // //***************************************************************************** // devices. // only if this bit is set. // Power Down. //***************************************************************************** // // The following are defines for the bit fields in the SDRAM_RCR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ASYNC_CS2_CR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ASYNC_CS3_CR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ASYNC_CS4_CR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SDRAM_TR register // //***************************************************************************** // for different bank. // timing. // timing. // timing. // Refresh/Activate timing //***************************************************************************** // // The following are defines for the bit fields in the SDR_EXT_TMNG register // //***************************************************************************** // command timing. //***************************************************************************** // // The following are defines for the bit fields in the INT_RAW register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the INT_MSK register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the INT_MSK_SET register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the INT_MSK_CLR register // //***************************************************************************** //########################################################################### // // FILE: hw_memcfg.h // // TITLE: Definitions for the MEMCFG registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the MEMCFG register offsets // //***************************************************************************** // Register // Commit Register // Register // registers // Register // Commit Register // Register // control Register // Register 0 // Register 1 // Register // Register // Status Register // registers // Register // Commit Register // Register // Protection Register 0 // Protection Register 1 // Protection Register 2 // Protection Register 3 // Register // Register // Status Register // registers // Register // Commit Register // Register 0 // Register 1 // Register 2 // Register // TEST registers // Register // control Register // Register // Register // Flag Register // Flag Set Register // Flag Clear Register // Interrupt Enable Register // Violation Address // Violation Address // Violation Address // Violation Address // Violation Address // Violation Address // Violation Address // Violation Address // Register // Set Register // Clear Register // Interrupt Enable Register // Violation Address // Violation Address // Violation Address // Register // Register // Clear Register // Address // Address // Address // Read Error Address // Register // Register // Register // Address // Address // Register // Value Register // Flag Status Register // Flag Clear Register // Flag Set Register // Enable Register // Register // Register // Register // Register // register //***************************************************************************** // // The following are defines for the bit fields in the DXLOCK register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the DXCOMMIT register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the DXACCPROT0 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the DXTEST register // //***************************************************************************** // for M0 RAM // for M1 RAM // for D0 RAM // for D1 RAM //***************************************************************************** // // The following are defines for the bit fields in the DXINIT register // //***************************************************************************** // for M0 RAM. // for M1 RAM. // for D0 RAM. // for D1 RAM. //***************************************************************************** // // The following are defines for the bit fields in the DXINITDONE register // //***************************************************************************** // M0 RAM. // M1 RAM. // D0 RAM. // D1 RAM. //***************************************************************************** // // The following are defines for the bit fields in the DXRAMTEST_LOCK register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the LSXLOCK register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the LSXCOMMIT register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the LSXMSEL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the LSXCLAPGM register // //***************************************************************************** // data memory for CLA // data memory for CLA // data memory for CLA // data memory for CLA // data memory for CLA // data memory for CLA // data memory for CLA // data memory for CLA //***************************************************************************** // // The following are defines for the bit fields in the LSXACCPROT0 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the LSXACCPROT1 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the LSXTEST register // //***************************************************************************** // for LS0 RAM // for LS1 RAM // for LS2 RAM // for LS3 RAM // for LS4 RAM // for LS5 RAM // for LS6 RAM // for LS7 RAM //***************************************************************************** // // The following are defines for the bit fields in the LSXINIT register // //***************************************************************************** // for LS0 RAM. // for LS1 RAM. // for LS2 RAM. // for LS3 RAM. // for LS4 RAM. // for LS5 RAM. // for LS6 RAM. // for LS7 RAM. //***************************************************************************** // // The following are defines for the bit fields in the LSXINITDONE register // //***************************************************************************** // LS0 RAM. // LS1 RAM. // LS2 RAM. // LS3 RAM. // LS4 RAM. // LS5 RAM. // LS6 RAM. // LS7 RAM. //***************************************************************************** // // The following are defines for the bit fields in the LSXRAMTEST_LOCK register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GSXLOCK register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GSXCOMMIT register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GSXMSEL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GSXACCPROT0 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GSXACCPROT1 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GSXACCPROT2 register // //***************************************************************************** // RAM // RAM //***************************************************************************** // // The following are defines for the bit fields in the GSXACCPROT3 register // //***************************************************************************** // RAM // RAM // RAM // RAM // RAM //***************************************************************************** // // The following are defines for the bit fields in the GSXTEST register // //***************************************************************************** // for GS0 RAM // for GS1 RAM // for GS2 RAM // for GS3 RAM // for GS4 RAM // for GS5 RAM // for GS6 RAM // for GS7 RAM // for GS8 RAM // for GS9 RAM // for GS10 RAM // for GS11 RAM // for GS12 RAM // for GS13 RAM // for GS14 RAM // for GS15 RAM //***************************************************************************** // // The following are defines for the bit fields in the GSXINIT register // //***************************************************************************** // for GS0 RAM. // for GS1 RAM. // for GS2 RAM. // for GS3 RAM. // for GS4 RAM. // for GS5 RAM. // for GS6 RAM. // for GS7 RAM. // for GS8 RAM. // for GS9 RAM. // for GS10 RAM. // for GS11 RAM. // for GS12 RAM. // for GS13 RAM. // for GS14 RAM. // for GS15 RAM. //***************************************************************************** // // The following are defines for the bit fields in the GSXINITDONE register // //***************************************************************************** // GS0 RAM. // GS1 RAM. // GS2 RAM. // GS3 RAM. // GS4 RAM. // GS5 RAM. // GS6 RAM. // GS7 RAM. // GS8 RAM. // GS9 RAM. // GS10 RAM. // GS11 RAM. // GS12 RAM. // GS13 RAM. // GS14 RAM. // GS15 RAM. //***************************************************************************** // // The following are defines for the bit fields in the GSXRAMTEST_LOCK register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the MSGXLOCK register // //***************************************************************************** // lock bit // lock bit // RAM1 control fields // RAM0 control fields // RAM1 control fields // RAM control fields // RAM control fields //***************************************************************************** // // The following are defines for the bit fields in the MSGXCOMMIT register // //***************************************************************************** // COMMIT bit // COMMIT bit // COMMIT bit // COMMIT bit // COMMIT bit // RAM1 control fields // RAM0 control fields // RAM1 control fields // RAM control fields // RAM control fields //***************************************************************************** // // The following are defines for the bit fields in the MSGXACCPROT0 register // //***************************************************************************** // CPUTOCPU_MSGRAM0 RAM // CPUTOCPU_MSGRAM0 RAM //***************************************************************************** // // The following are defines for the bit fields in the MSGXACCPROT1 register // //***************************************************************************** // CPUTOCPU_MSGRAM1 RAM // CPUTOCPU_MSGRAM1RAM //***************************************************************************** // // The following are defines for the bit fields in the MSGXACCPROT2 register // //***************************************************************************** // CPUTOCM_MSGRAM0 RAM // CPUTOCM_MSGRAM0 RAM // CPUTOCM_MSGRAM1 RAM // CPUTOCM_MSGRAM1RAM //***************************************************************************** // // The following are defines for the bit fields in the MSGXTEST register // //***************************************************************************** // Select // Select // Select // Select //***************************************************************************** // // The following are defines for the bit fields in the MSGXINIT register // //***************************************************************************** // CPU to CPU MSG RAM0 // CPUTOCLA1 MSG RAM // CLA1TOCPU MSG RAM // CLA1 to DMA MSG RAM // DMA to CLA1 MSG RAM // CPU to CPU MSG RAM1 // CPU to CM MSG RAM0 // CPU to CM MSG RAM1 //***************************************************************************** // // The following are defines for the bit fields in the MSGXINITDONE register // //***************************************************************************** // to CPU MSG RAM // to CLA1 MSG RAM // CLA1 to CPU MSG RAM // CLA1 to DMA MSG RAM // to CLA1 MSG RAM // to CPU MSG RAM1 // to CM MSG RAM0 // to CM MSG RAM1 //***************************************************************************** // // The following are defines for the bit fields in the MSGXRAMTEST_LOCK register // //***************************************************************************** // MSGxTEST.TEST_CPUTOCPU_MSGRAM0 LOCK // MSGxTEST.TEST_CPUTOCPU_MSGRAM1 LOCK // LOCK // LOCK //***************************************************************************** // // The following are defines for the bit fields in the ROM_LOCK register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ROM_TEST register // //***************************************************************************** // for BOOTROM // for SECUREROM // for CLADATAROM //***************************************************************************** // // The following are defines for the bit fields in the ROM_FORCE_ERROR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PERI_MEM_TEST_LOCK register // //***************************************************************************** // bit //***************************************************************************** // // The following are defines for the bit fields in the PERI_MEM_TEST_CONTROL register // //***************************************************************************** // EtherCAT RAM //***************************************************************************** // // The following are defines for the bit fields in the EMIF1LOCK register // //***************************************************************************** // master select fields lock bit //***************************************************************************** // // The following are defines for the bit fields in the EMIF1COMMIT register // //***************************************************************************** // master select permanent lock //***************************************************************************** // // The following are defines for the bit fields in the EMIF1MSEL register // //***************************************************************************** // MSEL_EMIF1 bits //***************************************************************************** // // The following are defines for the bit fields in the EMIF1ACCPROT0 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the EMIF2LOCK register // //***************************************************************************** // master select permanent lock //***************************************************************************** // // The following are defines for the bit fields in the EMIF2COMMIT register // //***************************************************************************** // master select permanent lock //***************************************************************************** // // The following are defines for the bit fields in the EMIF2ACCPROT0 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the NMAVFLG register // //***************************************************************************** // Violation Flag // Violation Flag // Violation Flag // Violation Flag // Violation Flag // Violation Flag // Violation Flag // Violation Flag //***************************************************************************** // // The following are defines for the bit fields in the NMAVSET register // //***************************************************************************** // Violation Flag Set // Violation Flag Set // Violation Flag Set // Violation Flag Set // Violation Flag Set // Violation Flag Set // Violation Flag Set // Violation Flag Set //***************************************************************************** // // The following are defines for the bit fields in the NMAVCLR register // //***************************************************************************** // Violation Flag Clear // Violation Flag Clear // Violation Flag Clear // Violation Flag Clear // Violation Flag Clear // Violation Flag Clear // Violation Flag Clear // Violation Flag Clear //***************************************************************************** // // The following are defines for the bit fields in the NMAVINTEN register // //***************************************************************************** // Violation Interrupt Enable // Violation Interrupt Enable // Violation Interrupt Enable // Violation Interrupt Enable // Violation Interrupt Enable // Violation Interrupt Enable // Violation Interrupt Enable // Violation Interrupt Enable //***************************************************************************** // // The following are defines for the bit fields in the MAVFLG register // //***************************************************************************** // Violation Flag // Violation Flag // Violation Flag //***************************************************************************** // // The following are defines for the bit fields in the MAVSET register // //***************************************************************************** // Violation Flag Set // Violation Flag Set // Violation Flag Set //***************************************************************************** // // The following are defines for the bit fields in the MAVCLR register // //***************************************************************************** // Violation Flag Clear // Violation Flag Clear // Violation Flag Clear //***************************************************************************** // // The following are defines for the bit fields in the MAVINTEN register // //***************************************************************************** // Violation Interrupt Enable // Violation Interrupt Enable // Violation Interrupt Enable //***************************************************************************** // // The following are defines for the bit fields in the UCERRFLG register // //***************************************************************************** // Flag // Flag // Flag //***************************************************************************** // // The following are defines for the bit fields in the UCERRSET register // //***************************************************************************** // Flag Set // Flag Set // Flag Set //***************************************************************************** // // The following are defines for the bit fields in the UCERRCLR register // //***************************************************************************** // Flag Clear // Flag Clear // Flag Clear // Clear //***************************************************************************** // // The following are defines for the bit fields in the CERRFLG register // //***************************************************************************** // Flag // Flag // Flag //***************************************************************************** // // The following are defines for the bit fields in the CERRSET register // //***************************************************************************** // Flag Set // Flag Set // Flag Set //***************************************************************************** // // The following are defines for the bit fields in the CERRCLR register // //***************************************************************************** // Flag Clear // Flag Clear // Flag Clear //***************************************************************************** // // The following are defines for the bit fields in the CERRCNT register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CERRTHRES register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CEINTFLG register // //***************************************************************************** // exceeded threshold flag. //***************************************************************************** // // The following are defines for the bit fields in the CEINTCLR register // //***************************************************************************** // Exceeded Error Clear. //***************************************************************************** // // The following are defines for the bit fields in the CEINTSET register // //***************************************************************************** // exceeded flag set. //***************************************************************************** // // The following are defines for the bit fields in the CEINTEN register // //***************************************************************************** // Interrupt Enable. //***************************************************************************** // // The following are defines for the bit fields in the ROMWAITSTATE register // //***************************************************************************** // Control //***************************************************************************** // // The following are defines for the bit fields in the ROMPREFETCH register // //***************************************************************************** // Control //***************************************************************************** // // The following are defines for the bit fields in the CPU_RAM_TEST_ERROR_STS register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CPU_RAM_TEST_ERROR_STS_CLR register // //***************************************************************************** //***************************************************************************** // // Defines for the API. // //***************************************************************************** //***************************************************************************** // // Defines to specify access protection to EMIF_setAccessProtection(). // //***************************************************************************** //! This flag is used to specify whether CPU fetches are allowed/blocked //! for EMIF. //! This flag is used to specify whether CPU writes are allowed/blocked //! for EMIF. //! This flag is used to specify whether DMA writes are allowed/blocked //! for EMIF. It is valid only for EMIF1 instance. //***************************************************************************** // // Define to mask out the bits in the EMIF1ACCPROT0 register that aren't // associated with EMIF1 access protection. // //***************************************************************************** //***************************************************************************** // // Define to mask out the bits in the EMIF2ACCPROT0 register that aren't // associated with EMIF2 access protection. // //***************************************************************************** //***************************************************************************** // // Define to mask out the bits in the ASYNC_CSx_CR register that // aren't associated with async configuration. // //***************************************************************************** //***************************************************************************** // // Define to mask out the bits in the INT_MSK register that aren't associated // with interrupts. // //***************************************************************************** //***************************************************************************** // // Defines to specify interrupt sources to EMIF_enableAsyncInterrupt() and // EMIF_disableAsyncInterrupt().Three interrupts are available for asynchronous // memory interface: Masked Asyncronous Timeout(AT) to indicate EMxWAIT signal // remains active even after maximum wait cycles are reached. Masked Line Trap // (LT) to indicate illegal memory access or invalid cache line size. // Masked Wait Rise(WR) to indicate rising edge on EMxWAIT is detected. // //***************************************************************************** //! This flag is used to allow/block EMIF to generate Masked Asynchronous //! Timeout interrupt. //! This flag is used to allow/block EMIF to generate Masked Line Trap //! interrupt. //! This flag is used to allow/block EMIF to generate Masked Wait Rise //! interrupt. //***************************************************************************** // // Define for key for EMIF1MSEL register that enables the register write. // //***************************************************************************** //***************************************************************************** // // Define to mask out the bits in the SDRAM_CR register that aren't // associated with SDRAM configuration parameters. // //***************************************************************************** //***************************************************************************** // // Define to mask out the bits in the SDRAM_TR register that aren't // associated with SDRAM timings parameters. // //***************************************************************************** //***************************************************************************** // //! Values that can be passed to EMIF_setAsyncMode(), //! EMIF_setAsyncTimingParams(), EMIF_setAsyncDataBusWidth(), //! EMIF_enableAsyncExtendedWait() and EMIF_disableAsyncExtendedWait() //! as the \e offset parameter. Three chip selects are available in //! asynchronous memory interface so there are three configuration registers //! available for each EMIF instance. All the three chip select offsets are //! valid for EMIF1 while only EMIF_ASYNC_CS2_OFFSET is valid for EMIF2. // //***************************************************************************** typedef enum { EMIF_ASYNC_CS2_OFFSET = 0x8U, //! It is valid only for EMIF1 instance and not for EMIF2 instance. Valid //! value for configBase parameter is EMIF1CONFIG_BASE. Valid values for //! select parameter can be \e EMIF_MASTER_CPU1_NG, \e EMIF_MASTER_CPU1_G, //! \e EMIF_MASTER_CPU2_G or \e EMIF_MASTER_CPU1_NG2. //! //! \return None. // //***************************************************************************** static inline void EMIF_selectMaster(uint32_t configBase, EMIF_MasterSelect select) { // // Check the arguments. // do { if(!(EMIF_isEMIF1ConfigBaseValid(configBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 451); } } while(0); // // Sets the bits that enables EMIF1 master selection. // __eallow(); (*((volatile uint32_t *)((uintptr_t)(configBase + 0x4U)))) = (0x93A5CE70U | (uint32_t)select); __edis(); } //***************************************************************************** // //! Sets the access protection. //! //! \param configBase is the configuration address of the EMIF instance used. //! //! \param access is the required access protection configuration. //! //! This function sets the access protection for an EMIF instance from CPU //! and DMA. The \e access parameter can be any of \b EMIF_ACCPROT0_FETCHPROT, //! \b EMIF_ACCPROT0_CPUWRPROT \b EMIF_ACCPROT0_DMAWRPROT values or their //! combination. EMIF_ACCPROT0_DMAWRPROT value is valid as access parameter //! for EMIF1 instance only . //! //! \return None. // //***************************************************************************** static inline void EMIF_setAccessProtection(uint32_t configBase, uint16_t access) { uint16_t temp; // // Check the arguments. // do { if(!(EMIF_isEMIF1ConfigBaseValid(configBase) || EMIF_isEMIF2ConfigBaseValid(configBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 487); } } while(0); if(configBase == 0x0005F4C0U) { do { if(!(access <= ((uint16_t)0x1U | (uint16_t)0x2U | (uint16_t)0x4U))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 490); } } while(0); temp = ((uint16_t)0x1U | (uint16_t)0x2U | (uint16_t)0x4U); } else { do { if(!(access <= ((uint16_t)0x1U | (uint16_t)0x2U))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 495); } } while(0); temp = ((uint16_t)0x1U | (uint16_t)0x2U); } // // Sets the bits that enables access protection config. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(configBase + 0x8U)))) = ((*((volatile uint16_t *)((uintptr_t)(configBase + 0x8U)))) & ~(temp)) | access; __edis(); } //***************************************************************************** // //! Commits the lock configuration. //! //! \param configBase is the configuration address of the EMIF instance used. //! //! This function commits the access protection for an EMIF instance from //! CPU & DMA. //! //! \return None. // //***************************************************************************** static inline void EMIF_commitAccessConfig(uint32_t configBase) { // // Check the arguments. // do { if(!(EMIF_isEMIF1ConfigBaseValid(configBase) || EMIF_isEMIF2ConfigBaseValid(configBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 527); } } while(0); // // Sets the bits that commits access protection config. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(configBase + 0x2U)))) |= 0x1U; __edis(); } //***************************************************************************** // //! Locks the write to access configuration fields. //! //! \param configBase is the configuration address of the EMIF instance used. //! //! This function locks the write to access configuration fields i.e //! ACCPROT0 & Mselect fields, for an EMIF instance. //! //! \return None. // //***************************************************************************** static inline void EMIF_lockAccessConfig(uint32_t configBase) { // // Check the arguments. // do { if(!(EMIF_isEMIF1ConfigBaseValid(configBase) || EMIF_isEMIF2ConfigBaseValid(configBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 557); } } while(0); // // Sets the bits that locks access protection config. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(configBase + 0x0U)))) |= 0x1U; __edis(); } //***************************************************************************** // //! Unlocks the write to access configuration fields. //! //! \param configBase is the configuration address of the EMIF instance used. //! //! This function unlocks the write to access configuration fields such as //! ACCPROT0 & Mselect fields, for an EMIF instance. //! //! \return None. // //***************************************************************************** static inline void EMIF_unlockAccessConfig(uint32_t configBase) { // // Check the arguments. // do { if(!(EMIF_isEMIF1ConfigBaseValid(configBase) || EMIF_isEMIF2ConfigBaseValid(configBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 586); } } while(0); // // Sets the bits that unlocks access protection config. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(configBase + 0x0U)))) &= ~((uint16_t)0x1U); __edis(); } //***************************************************************************** // // Prototypes for Asynchronous Memory Interface // //***************************************************************************** //***************************************************************************** // //! Selects the asynchronous mode of operation. //! //! \param base is the base address of the EMIF instance used. //! //! \param offset is the offset of asynchronous chip select of EMIF instance. //! //! \param mode is the desired mode of operation for external memory. //! //! //! This function sets the mode of operation for asynchronous memory //! between Normal or Strobe mode. Valid values for param \e offset can be //! \e EMIF_ASYNC_CS2_OFFSET, \e EMIF_ASYNC_CS3_OFFSET & //! \e EMIF_ASYNC_C43_OFFSET for EMIF1 and \e EMIF_ASYNC_CS2_OFFSET for EMIF2. //! Valid values for param \e mode can be \e EMIF_ASYNC_STROBE_MODE or //! \e EMIF_ASYNC_NORMAL_MODE. //! //! \return None. // //***************************************************************************** static inline void EMIF_setAsyncMode(uint32_t base, EMIF_AsyncCSOffset offset, EMIF_AsyncMode mode) { // // Check the arguments. // do { if(!(EMIF_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 630); } } while(0); if(base == 0x00047800U) { do { if(!(offset == EMIF_ASYNC_CS2_OFFSET)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 633); } } while(0); } // // Sets the async mode of operation. // (*((volatile uint32_t *)((uintptr_t)(base + (uint32_t)offset)))) = ((*((volatile uint32_t *)((uintptr_t)(base + (uint32_t)offset)))) & ~((uint32_t)0x80000000U)) | (uint32_t)mode; } //***************************************************************************** // //! Enables the Extended Wait Mode. //! //! \param base is the base address of the EMIF instance used. //! //! \param offset is the offset of asynchronous chip select of the //! EMIF instance //! //! This function enables the extended wait mode for an asynchronous //! external memory.Valid values for param \e offset can be //! \e EMIF_ASYNC_CS2_OFFSET, \e EMIF_ASYNC_CS3_OFFSET & //! \e EMIF_ASYNC_C43_OFFSET for EMIF1 and \e EMIF_ASYNC_CS2_OFFSET for EMIF2. //! //! \return None. // //***************************************************************************** static inline void EMIF_enableAsyncExtendedWait(uint32_t base, EMIF_AsyncCSOffset offset) { // // Check the arguments. // do { if(!(EMIF_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 667); } } while(0); if(base == 0x00047800U) { do { if(!(offset == EMIF_ASYNC_CS2_OFFSET)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 670); } } while(0); } // // Sets the bit that enables extended wait mode. // (*((volatile uint32_t *)((uintptr_t)(base + (uint32_t)offset)))) = (*((volatile uint32_t *)((uintptr_t)(base + (uint32_t)offset)))) | 0x40000000U; } //***************************************************************************** // //! Disables the Extended Wait Mode. //! //! \param base is the base address of the EMIF instance used. //! //! \param offset is the offset of asynchronous chip select of EMIF instance. //! //! This function disables the extended wait mode for an asynchronous external //! memory.Valid values for param \e offset can be \e EMIF_ASYNC_CS2_OFFSET, //! \e EMIF_ASYNC_CS3_OFFSET & \e EMIF_ASYNC_C43_OFFSET for EMIF1 and //! \e EMIF_ASYNC_CS2_OFFSET for EMIF2. //! //! \return None. // //***************************************************************************** static inline void EMIF_disableAsyncExtendedWait(uint32_t base, EMIF_AsyncCSOffset offset) { // // Check the arguments. // do { if(!(EMIF_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 702); } } while(0); if(base == 0x00047800U) { do { if(!(offset == EMIF_ASYNC_CS2_OFFSET)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 705); } } while(0); } // // Sets the bit that disables extended wait mode. // (*((volatile uint32_t *)((uintptr_t)(base + (uint32_t)offset)))) = (*((volatile uint32_t *)((uintptr_t)(base + (uint32_t)offset)))) & ~((uint32_t)0x40000000U); } //***************************************************************************** // //! Sets the wait polarity. //! //! \param base is the base address of the EMIF instance used. //! //! \param polarity is desired wait polarity. //! //! This function sets the wait polarity for an asynchronous external memory. //! Valid values for param \e polarity can be \e EMIF_ASYNC_WAIT_POLARITY_LOW //! or \e EMIF_ASYNC_WAIT_POLARITY_HIGH. //! //! \return None. // //***************************************************************************** static inline void EMIF_setAsyncWaitPolarity(uint32_t base, EMIF_AsyncWaitPolarity polarity) { // // Check the arguments. // do { if(!(EMIF_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 736); } } while(0); // // Sets the polarity for async extended wait mode. // (*((volatile uint32_t *)((uintptr_t)(base + 0x2U)))) = ((*((volatile uint32_t *)((uintptr_t)(base + 0x2U)))) & ~((uint32_t)0x10000000U)) | (uint32_t)polarity; } //***************************************************************************** // //! Sets the Maximum Wait Cycles. //! //! \param base is the base address of the EMIF instance used. //! //! \param value is the desired maximum wait cycles. //! //! This function sets the maximum wait cycles for extended asynchronous cycle. //! Valid values for parameter \e value lies b/w 0x0U-0xFFU or 0-255. //! //! \return None. // //***************************************************************************** static inline void EMIF_setAsyncMaximumWaitCycles(uint32_t base, uint16_t value) { // // Check the arguments. // do { if(!(EMIF_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 766); } } while(0); do { if(!(value <= (0xFFU))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 767); } } while(0); // // Sets the bit that enables extended wait mode. // (*((volatile uint16_t *)((uintptr_t)(base + 0x2U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x2U)))) & ~((uint16_t)0xFFU)) | value; } //***************************************************************************** // //! Sets the Asynchronous Memory Timing Characteristics. //! //! \param base is the base address of the EMIF instance used. //! //! \param offset is the offset of asynchronous chip select of EMIF instance. //! //! \param tParam is the desired timing parameters. //! //! This function sets timing characteristics for an external asynchronous //! memory to be interfaced. Valid values for param \e offset can be //! \e EMIF_ASYNC_CS2_OFFSET, \e EMIF_ASYNC_CS3_OFFSET and //! \e EMIF_ASYNC_C43_OFFSET for EMIF1 & EMIF_ASYNC_CS2_OFFSET for EMIF2. //! //! \return None. // //***************************************************************************** static inline void EMIF_setAsyncTimingParams(uint32_t base, EMIF_AsyncCSOffset offset, const EMIF_AsyncTimingParams *tParam) { uint32_t temp; // // Check the arguments. // do { if(!(EMIF_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 803); } } while(0); if(base == 0x00047800U) { do { if(!(offset == EMIF_ASYNC_CS2_OFFSET)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 806); } } while(0); } // // Sets the async memory timing parameters. // temp = (tParam->turnArnd << 2U) | (tParam->rHold << 4U) | (tParam->rStrobe << 7U) | (tParam->rSetup << 13U) | (tParam->wHold << 17U) | (tParam->wStrobe << 20U) | (tParam->wSetup << 26U); (*((volatile uint32_t *)((uintptr_t)(base + (uint32_t)offset)))) = ((*((volatile uint32_t *)((uintptr_t)(base + (uint32_t)offset)))) & ~((uint32_t)0x70U | (uint32_t)0x1F80U | (uint32_t)0x1E000U | (uint32_t)0xE0000U | (uint32_t)0x3F00000U | (uint32_t)0x3C000000U | (uint32_t)0xCU)) | temp; } //***************************************************************************** // //! Sets the Asynchronous Data Bus Width. //! //! \param base is the base address of the EMIF instance used. //! //! \param offset is the offset of asynchronous chip select of EMIF instance. //! //! \param width is the data bus width of the memory. //! //! This function sets the data bus size for an external asynchronous memory //! to be interfaced. Valid values for param \e offset can be //! \e EMIF_ASYNC_CS2_OFFSET, \e EMIF_ASYNC_CS3_OFFSET & //! \e EMIF_ASYNC_C43_OFFSET for EMIF1 and \e EMIF_ASYNC_CS2_OFFSET for EMIF2. //! Valid values of param \e width can be \e EMIF_ASYNC_DATA_WIDTH_8, //! \e EMIF_ASYNC_DATA_WIDTH_16 or \e EMIF_ASYNC_DATA_WIDTH_32. //! //! \return None. // //***************************************************************************** static inline void EMIF_setAsyncDataBusWidth(uint32_t base, EMIF_AsyncCSOffset offset, EMIF_AsyncDataWidth width) { // // Check the arguments. // do { if(!(EMIF_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 851); } } while(0); if(base == 0x00047800U) { do { if(!(offset == EMIF_ASYNC_CS2_OFFSET)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 854); } } while(0); } // // Sets the async memory data bus width. // (*((volatile uint16_t *)((uintptr_t)(base + (uint32_t)offset)))) = ((*((volatile uint16_t *)((uintptr_t)(base + (uint32_t)offset)))) & ~((uint16_t)0x3U)) | (uint32_t)width; } //***************************************************************************** // // Prototypes for Interrupt Handling // //***************************************************************************** //***************************************************************************** // //! Enables the Asynchronous Memory Interrupts. //! //! \param base is the base address of the EMIF instance used. //! //! \param intFlags is the mask for desired interrupts. //! //! This function enables the desired interrupts for an external asynchronous //! memory interface. Valid values for param \e intFlags can be //! \b EMIF_ASYNC_INT_AT, \b EMIF_ASYNC_INT_LT, \b EMIF_ASYNC_INT_WR or their //! combination. //! //! \return None. // //***************************************************************************** static inline void EMIF_enableAsyncInterrupt(uint32_t base, uint16_t intFlags) { // // Check the arguments. // do { if(!(EMIF_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 892); } } while(0); do { if(!(intFlags <= ((uint16_t)0x1U | (uint16_t)0x2U | (uint16_t)0x3CU))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 893); } } while(0); // // Sets the bits that enables async memory interrupts. // (*((volatile uint16_t *)((uintptr_t)(base + 0x24U)))) = intFlags; } //***************************************************************************** // //! Disables the Asynchronous Memory Interrupts. //! //! \param base is the base address of the EMIF instance used. //! //! \param intFlags is the mask for interrupts to be disabled. //! //! This function disables the desired interrupts for an external asynchronous //! memory interface. Valid values for param \e intFlags can be //! \b EMIF_ASYNC_INT_AT, \b EMIF_ASYNC_INT_LT, \b EMIF_ASYNC_INT_WR or //! their combination. //! //! \return None. // //***************************************************************************** static inline void EMIF_disableAsyncInterrupt(uint32_t base, uint16_t intFlags) { // // Check the arguments. // do { if(!(EMIF_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 923); } } while(0); do { if(!(intFlags <= ((uint16_t)0x1U | (uint16_t)0x2U | (uint16_t)0x3CU))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 924); } } while(0); // // Sets the bits that disables async memory interrupts. // (*((volatile uint16_t *)((uintptr_t)(base + 0x26U)))) = intFlags; } //***************************************************************************** // //! Gets the interrupt status. //! //! \param base is the base address of the EMIF instance used. //! //! This function gets the interrupt status for an EMIF instance. //! //! \return Returns the current interrupt status. // //***************************************************************************** static inline uint16_t EMIF_getAsyncInterruptStatus(uint32_t base) { // // Check the arguments. // do { if(!(EMIF_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 950); } } while(0); // // Gets the async memory interrupt status. // return((*((volatile uint16_t *)((uintptr_t)(base + 0x22U)))) & ((uint16_t)0x1U | (uint16_t)0x2U | (uint16_t)0x3CU)); } //***************************************************************************** // //! Clears the interrupt status for an EMIF instance. //! //! \param base is the base address of the EMIF instance used. //! //! \param intFlags is the mask for the interrupt status to be cleared. //! //! This function clears the interrupt status for an EMIF instance. //! The \e intFlags parameter can be any of \b EMIF_INT_MSK_SET_AT_MASK_SET, //! \b EMIF_INT_MSK_SET_LT_MASK_SET, or \b EMIF_INT_MSK_SET_WR_MASK_SET_M //! values or their combination. //! //! \return None. // //***************************************************************************** static inline void EMIF_clearAsyncInterruptStatus(uint32_t base, uint16_t intFlags) { // // Check the arguments. // do { if(!(EMIF_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 980); } } while(0); do { if(!(intFlags <= ((uint16_t)0x1U | (uint16_t)0x2U | (uint16_t)0x3CU))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 981); } } while(0); // // Sets the bit that clears desired async memory interrupts. // (*((volatile uint16_t *)((uintptr_t)(base + 0x22U)))) = intFlags; } //***************************************************************************** // // Prototypes for Synchronous Memory Interface // //***************************************************************************** //***************************************************************************** // //! Sets the Synchronous Memory Timing Parameters. //! //! \param base is the base address of an EMIF instance. //! //! \param tParam is parameters from memory datasheet in \e ns. //! //! This function sets the timing characteristics for an external //! synchronous memory to be interfaced. //! //! \return None. // //***************************************************************************** static inline void EMIF_setSyncTimingParams(uint32_t base, const EMIF_SyncTimingParams *tParam) { uint32_t temp; // // Check the arguments. // do { if(!(EMIF_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 1015); } } while(0); // // Sets sync memory timing parameters. // temp = ((tParam->tRrd << 4U) & 0x70U) | ((tParam->tRc << 8U) & 0xF00U) | ((tParam->tRas << 12U) & 0xF000U) | ((tParam->tWr << 16U) & 0x70000U) | ((tParam->tRcd << 20U) & 0x700000U) | ((tParam->tRp << 24U) & 0x7000000U) | ((tParam->tRfc << 27U) & 0xF8000000U); (*((volatile uint32_t *)((uintptr_t)(base + 0x10U)))) = ((*((volatile uint32_t *)((uintptr_t)(base + 0x10U)))) & ~((uint32_t)0x70U | (uint32_t)0xF00U | (uint32_t)0xF000U | (uint32_t)0x70000U | (uint32_t)0x700000U | (uint32_t)0x7000000U | (uint32_t)0xF8000000U)) | temp; } //***************************************************************************** // //! Sets the SDRAM Self Refresh Exit Timing. //! //! \param base is the base address of an EMIF instance. //! //! \param tXs is the desired timing value. //! //! This function sets the self refresh exit timing for an external //! synchronous memory to be interfaced. tXs values must lie between //! 0x0U-0x1FU or 0-31. //! //! \return None. // //***************************************************************************** static inline void EMIF_setSyncSelfRefreshExitTmng(uint32_t base, uint16_t tXs) { // // Check the arguments. // do { if(!(EMIF_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 1060); } } while(0); do { if(!(tXs <= 0x1FU)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 1061); } } while(0); // // Sets the self refresh exit timing for sync memory. // (*((volatile uint16_t *)((uintptr_t)(base + 0x1EU)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x1EU)))) & ~((uint16_t)0x1FU)) | tXs; } //***************************************************************************** // //! Sets the SDR Refresh Rate. //! //! \param base is the base address of an EMIF instance. //! //! \param refRate is the refresh rate. //! //! This function sets the refresh rate for an external synchronous memory //! to be interfaced. Valid values for refRate lies b/w 0x0U-0x1FFFU or //! 0-8191. //! //! \return None. // //***************************************************************************** static inline void EMIF_setSyncRefreshRate(uint32_t base, uint16_t refRate) { // // Check the arguments. // do { if(!(EMIF_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 1092); } } while(0); do { if(!(refRate <= 0x1FFFU)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 1093); } } while(0); // // Sets the sync memory refresh rate. // (*((volatile uint16_t *)((uintptr_t)(base + 0x6U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x6U)))) & (~(uint16_t)0x1FFFU)) | refRate; } //***************************************************************************** // //! Sets the Synchronous Memory configuration parameters. //! //! \param base is the base address of the EMIF instance used. //! //! \param config is the desired configuration parameters. //! //! This function sets configuration parameters like CL, NM, IBANK //! and PAGESIZE for an external synchronous memory to be interfaced. //! //! \return None. // //***************************************************************************** static inline void EMIF_setSyncMemoryConfig(uint32_t base, const EMIF_SyncConfig *config) { uint32_t temp; // // Check the arguments. // do { if(!(EMIF_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 1124); } } while(0); // // Sets the sync memory configuration bits. // temp = ((uint32_t)config->casLatency | (uint32_t)config->iBank | (uint32_t)config->narrowMode | (uint32_t)config->pageSize); (*((volatile uint32_t *)((uintptr_t)(base + 0x4U)))) = ((*((volatile uint32_t *)((uintptr_t)(base + 0x4U)))) & ~((uint32_t)0x7U | (uint32_t)0x70U | (uint32_t)0x100U | (uint32_t)0xE00U | (uint32_t)0x4000U | (uint32_t)0x80000000U)) | temp; } //***************************************************************************** // // Prototypes for EMIF Low Power Modes // //***************************************************************************** //***************************************************************************** // //! Enables Self Refresh. //! //! \param base is the base address of the EMIF instance used. //! //! This function enables Self Refresh Mode for EMIF. //! //! \return None. // //***************************************************************************** static inline void EMIF_enableSyncSelfRefresh(uint32_t base) { // // Check the arguments. // do { if(!(EMIF_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 1158); } } while(0); // // Sets the bits that enables sync memory self refresh mode. // (*((volatile uint32_t *)((uintptr_t)(base + 0x4U)))) |= 0x80000000U; } //***************************************************************************** // //! Disables Self Refresh. //! //! \param base is the base address of the EMIF instance used. //! //! This function disables Self Refresh Mode for EMIF. //! //! \return None. // //***************************************************************************** static inline void EMIF_disableSyncSelfRefresh(uint32_t base) { // // Check the arguments. // do { if(!(EMIF_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 1183); } } while(0); // // Sets the bits that disables sync memory self refresh mode. // (*((volatile uint32_t *)((uintptr_t)(base + 0x4U)))) &= ~((uint32_t)0x80000000U); } //***************************************************************************** // //! Enables Power Down. //! //! \param base is the base address of the EMIF instance used. //! //! This function Enables Power Down Mode for synchronous memory //! to be interfaced. //! //! \return None. // //***************************************************************************** static inline void EMIF_enableSyncPowerDown(uint32_t base) { // // Check the arguments. // do { if(!(EMIF_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 1209); } } while(0); // // Sets the bits that enables sync memory power down mode. // (*((volatile uint32_t *)((uintptr_t)(base + 0x4U)))) |= 0x40000000U; } //***************************************************************************** // //! Disables Power Down. //! //! \param base is the base address of the EMIF instance used. //! //! This function disables Power Down Mode for synchronous memory //! to be interfaced. //! //! \return None. // //***************************************************************************** static inline void EMIF_disableSyncPowerDown(uint32_t base) { // // Check the arguments. // do { if(!(EMIF_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 1235); } } while(0); // // Sets the bits that disables sync memory power down mode. // (*((volatile uint32_t *)((uintptr_t)(base + 0x4U)))) &= ~((uint32_t)0x40000000U); } //***************************************************************************** // //! Enables Refresh in Power Down. //! //! \param base is the base address of the EMIF instance used. //! //! This function enables Refresh in Power Down Mode for synchronous memory //! to be interfaced. //! //! \return None. // //***************************************************************************** static inline void EMIF_enableSyncRefreshInPowerDown(uint32_t base) { // // Check the arguments. // do { if(!(EMIF_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 1261); } } while(0); // // Sets the bits that enables refresh in power down mode. // (*((volatile uint32_t *)((uintptr_t)(base + 0x4U)))) |= 0x20000000U; } //***************************************************************************** // //! Disables Refresh in Power Down. //! //! \param base is the base address of the EMIF instance used. //! //! This function disables Refresh in Power Down Mode for synchronous memory //! to be interfaced. //! //! \return None. // //***************************************************************************** static inline void EMIF_disableSyncRefreshInPowerDown(uint32_t base) { // // Check the arguments. // do { if(!(EMIF_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 1287); } } while(0); // // Sets the bits that disables refresh in power down mode. // (*((volatile uint32_t *)((uintptr_t)(base + 0x4U)))) &= ~((uint32_t)0x20000000U); } //***************************************************************************** // //! Gets total number of SDRAM accesses. //! //! \param base is the base address of the EMIF instance used. //! //! This function returns total number of SDRAM accesses //! from a master(CPUx/CPUx.DMA). //! //! \return \e Returns total number of accesses to SDRAM. // //***************************************************************************** static inline uint32_t EMIF_getSyncTotalAccesses(uint32_t base) { // // Check the arguments. // do { if(!(EMIF_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 1313); } } while(0); // // Gets total accesses to sync memory. // return((*((volatile uint32_t *)((uintptr_t)(base + 0x18U))))); } //***************************************************************************** // //! Gets total number of SDRAM accesses which require activate command. //! //! \param base is the base address of the EMIF instance used. //! //! This function returns total number of accesses to SDRAM which //! require activate command. //! //!\return \e Returns total number of accesses to SDRAM which require activate. // //***************************************************************************** static inline uint32_t EMIF_getSyncTotalActivateAccesses(uint32_t base) { // // Check the arguments. // do { if(!(EMIF_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/emif.h", 1339); } } while(0); // // Gets total accesses to sync memory which requires activate command. // return((*((volatile uint32_t *)((uintptr_t)(base + 0x1AU))))); } //***************************************************************************** // // Close the Doxygen group. //! @} // //***************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //############################################################################# // // FILE: epwm.h // // TITLE: C28x EPWM Driver // //############################################################################# // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //############################################################################# //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup epwm_api ePWM //! @{ // //***************************************************************************** //########################################################################### // // FILE: hw_epwm.h // // TITLE: Definitions for the EPWM registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the EPWM register offsets // //***************************************************************************** // Register // Register // Register // Register 2 // Register // Register 2 // Register // Event Source Select Register // Register // Register // Register // Control Register // Remainder Register // Register // Register // Register For Output A // Control Register For Output A // Register For Output B // Control Register For Output B // Force Register // S/W Force Register // Edge Delay High Resolution // Mirror Register // Edge Delay High Resolution // Mirror Register // Edge Delay High Resolution // Register // Edge Delay Count Register // Resolution Register // Register 2 // Register // Select Register // Register // Digital Compare A // Digital Compare B // Register // Register // Register // Pre-Scale Register // Register // Initialization Control Register // Initialization Register // Register // Register // Register // Control Register // Control Register // Register // Counter Register // Register // Counter Register // Capture Register // Select // Select // Select // Select // Register // Register //***************************************************************************** // // The following are defines for the bit fields in the TBCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the TBCTL2 register // //***************************************************************************** // SYNC Event //***************************************************************************** // // The following are defines for the bit fields in the EPWMSYNCINSEL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the TBSTS register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the EPWMSYNCOUTEN register // //***************************************************************************** // Enable // Enable // Enable // Enable // Enable // Event 1 Sync Enable // Event 1 Sync Enable //***************************************************************************** // // The following are defines for the bit fields in the TBCTL3 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CMPCTL register // //***************************************************************************** // Operating Mode // Operating Mode // Full Status // Full Status //***************************************************************************** // // The following are defines for the bit fields in the CMPCTL2 register // //***************************************************************************** // Mode // Mode //***************************************************************************** // // The following are defines for the bit fields in the DBCTL register // //***************************************************************************** // Control // Control //***************************************************************************** // // The following are defines for the bit fields in the DBCTL2 register // //***************************************************************************** // Select //***************************************************************************** // // The following are defines for the bit fields in the AQCTL register // //***************************************************************************** // Select // Select // Mode // Mode //***************************************************************************** // // The following are defines for the bit fields in the AQTSRCSEL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PCCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the VCAPCTL register // //***************************************************************************** // Enable // Select //***************************************************************************** // // The following are defines for the bit fields in the VCNTCFG register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the HRCNFG register // //***************************************************************************** // Bits // Bits // Bit // Bits // Bits //***************************************************************************** // // The following are defines for the bit fields in the HRPWR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the HRMSTEP register // //***************************************************************************** // Value //***************************************************************************** // // The following are defines for the bit fields in the HRCNFG2 register // //***************************************************************************** // Bits // Bits // Bits //***************************************************************************** // // The following are defines for the bit fields in the HRPCTL register // //***************************************************************************** // Select Bit: //***************************************************************************** // // The following are defines for the bit fields in the TRREM register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GLDCTL register // //***************************************************************************** // event control // Pulse Selection // bit // Select Register // Register //***************************************************************************** // // The following are defines for the bit fields in the GLDCFG register // //***************************************************************************** // configuration for TBPRD:TBPRDHR // configuration for CMPA:CMPAHR // configuration for CMPB:CMPBHR // configuration for CMPC // configuration for CMPD // configuration for DBRED:DBREDHR // configuration for DBFED:DBFEDHR // configuration for DBCTL // configuration for AQCTLA/A2 // configuration for AQCTLB/B2 // configuration for AQCSFRC //***************************************************************************** // // The following are defines for the bit fields in the EPWMXLINK register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the AQCTLA register // //***************************************************************************** // Down // Down //***************************************************************************** // // The following are defines for the bit fields in the AQCTLA2 register // //***************************************************************************** // T1 in UP-Count // T1 in DOWN-Count // T2 in UP-Count // T2 in DOWN-Count //***************************************************************************** // // The following are defines for the bit fields in the AQCTLB register // //***************************************************************************** // Down // Down //***************************************************************************** // // The following are defines for the bit fields in the AQCTLB2 register // //***************************************************************************** // T1 in UP-Count // T1 in DOWN-Count // T2 in UP-Count // T2 in DOWN-Count //***************************************************************************** // // The following are defines for the bit fields in the AQSFRC register // //***************************************************************************** // A Invoked // B Invoked //***************************************************************************** // // The following are defines for the bit fields in the AQCSFRC register // //***************************************************************************** // output A // output B //***************************************************************************** // // The following are defines for the bit fields in the DBREDHR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the DBRED register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the DBFEDHR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the DBFED register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the TBPHS register // //***************************************************************************** // Phase (8-bits) //***************************************************************************** // // The following are defines for the bit fields in the CMPA register // //***************************************************************************** // Register //***************************************************************************** // // The following are defines for the bit fields in the CMPB register // //***************************************************************************** // Bits //***************************************************************************** // // The following are defines for the bit fields in the GLDCTL2 register // //***************************************************************************** // shot mode // shot mode //***************************************************************************** // // The following are defines for the bit fields in the TZSEL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the TZDCSEL register // //***************************************************************************** // Event 1 // Event 2 // Event 1 // Event 2 //***************************************************************************** // // The following are defines for the bit fields in the TZCTL register // //***************************************************************************** // EPWMxA // EPWMxB //***************************************************************************** // // The following are defines for the bit fields in the TZCTL2 register // //***************************************************************************** // Count direction is UP // Count direction is DOWN // Count direction is UP // Count direction is DOWN //***************************************************************************** // // The following are defines for the bit fields in the TZCTLDCA register // //***************************************************************************** // while Count direction is UP // while Count direction is DOWN // while Count direction is UP // while Count direction is DOWN //***************************************************************************** // // The following are defines for the bit fields in the TZCTLDCB register // //***************************************************************************** // while Count direction is UP // while Count direction is DOWN // while Count direction is UP // while Count direction is DOWN //***************************************************************************** // // The following are defines for the bit fields in the TZEINT register // //***************************************************************************** // Enable // Enable // Enable // Enable // Enable // Enable //***************************************************************************** // // The following are defines for the bit fields in the TZFLG register // //***************************************************************************** // Flag // Flag // Flag // Flag // Flag //***************************************************************************** // // The following are defines for the bit fields in the TZCBCFLG register // //***************************************************************************** // Trip Latch // Trip Latch // Trip Latch // Trip Latch // Trip Latch // Trip Latch // Digital Compare Output A Event 2 // Digital Compare Output B Event 2 //***************************************************************************** // // The following are defines for the bit fields in the TZOSTFLG register // //***************************************************************************** // Trip Latch // Trip Latch // Trip Latch // Trip Latch // Trip Latch // Trip Latch // Digital Compare Output A Event 1 // Digital Compare Output B Event 1 //***************************************************************************** // // The following are defines for the bit fields in the TZCLR register // //***************************************************************************** // Latch //***************************************************************************** // // The following are defines for the bit fields in the TZCBCCLR register // //***************************************************************************** // (CBC1) Trip Latch // (CBC2) Trip Latch // (CBC3) Trip Latch // (CBC4) Trip Latch // (CBC5) Trip Latch // (CBC6) Trip Latch // selected for CBC // selected for CBC //***************************************************************************** // // The following are defines for the bit fields in the TZOSTCLR register // //***************************************************************************** // Trip Latch // Trip Latch // Trip Latch // Trip Latch // Trip Latch // Trip Latch // selected for OST // selected for OST //***************************************************************************** // // The following are defines for the bit fields in the TZFRC register // //***************************************************************************** // Cycle Event // Event // 1 // 2 // 1 // 2 //***************************************************************************** // // The following are defines for the bit fields in the ETSEL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ETPS register // //***************************************************************************** // Bits // Selection Bits //***************************************************************************** // // The following are defines for the bit fields in the ETFLG register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ETCLR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ETFRC register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ETINTPS register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ETSOCPS register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ETCNTINITCTL register // //***************************************************************************** // Initialization Force // Initialization Force // Initialization Force // Initialization Enable // Initialization Enable // Initialization Enable //***************************************************************************** // // The following are defines for the bit fields in the ETCNTINIT register // //***************************************************************************** // Initialization Bits // Initialization Bits // Initialization Bits //***************************************************************************** // // The following are defines for the bit fields in the DCTRIPSEL register // //***************************************************************************** // Input Select // Input Select // Input Select // Input Select //***************************************************************************** // // The following are defines for the bit fields in the DCACTL register // //***************************************************************************** // select // DCAEVT1LAT signal. // select // DCAEVT2LAT signal. //***************************************************************************** // // The following are defines for the bit fields in the DCBCTL register // //***************************************************************************** // select // DCBEVT1LAT signal. // select // DCBEVT2LAT signal. //***************************************************************************** // // The following are defines for the bit fields in the DCFCTL register // //***************************************************************************** // Select // Capture Alignment //***************************************************************************** // // The following are defines for the bit fields in the DCCAPCTL register // //***************************************************************************** // Capture Event // Clear Flag //***************************************************************************** // // The following are defines for the bit fields in the DCAHTRIPSEL register // //***************************************************************************** // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux //***************************************************************************** // // The following are defines for the bit fields in the DCALTRIPSEL register // //***************************************************************************** // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux //***************************************************************************** // // The following are defines for the bit fields in the DCBHTRIPSEL register // //***************************************************************************** // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux //***************************************************************************** // // The following are defines for the bit fields in the DCBLTRIPSEL register // //***************************************************************************** // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux //***************************************************************************** // // The following are defines for the bit fields in the EPWMLOCK register // //***************************************************************************** // Lock // Lock //***************************************************************************** // // Defines for the API. // //***************************************************************************** //***************************************************************************** // // Define to specify mask for source parameter for // EPWM_enableSyncOutPulseSource() & EPWM_disableSyncOutPulseSource() // //***************************************************************************** //***************************************************************************** // // Values that can be passed to EPWM_enableSyncOutPulseSource() & // EPWM_disableSyncOutPulseSource() as the \e mode parameter. // //***************************************************************************** //! Software force generated EPWM sync-out pulse //! Counter zero event generates EPWM sync-out pulse //! Counter equal to CMPB event generates EPWM sync-out pulse //! Counter equal to CMPC event generates EPWM sync-out pulse //! Counter equal to CMPD event generates EPWM sync-out pulse //! DCA Event 1 Sync signal generates EPWM sync-out pulse //! DCB Event 1 Sync signal generates EPWM sync-out pulse //! Enable all the above sources // // Time Base Module // //***************************************************************************** // //! Values that can be passed to EPWM_setEmulationMode() as the //! \e emulationMode parameter. // //***************************************************************************** typedef enum { //! Stop after next Time Base counter increment or decrement. EPWM_EMULATION_STOP_AFTER_NEXT_TB = 0, //! Stop when counter completes whole cycle EPWM_EMULATION_STOP_AFTER_FULL_CYCLE = 1, //! Free run EPWM_EMULATION_FREE_RUN = 2 } EPWM_EmulationMode; //***************************************************************************** // //! Values that can be passed to EPWM_setCountModeAfterSync() as the //! \e mode parameter. // //***************************************************************************** typedef enum { EPWM_COUNT_MODE_DOWN_AFTER_SYNC = 0, //!< Count down after sync event EPWM_COUNT_MODE_UP_AFTER_SYNC = 1 //!< Count up after sync event } EPWM_SyncCountMode; //***************************************************************************** // //! Values that can be passed to EPWM_setClockPrescaler() as the //! \e prescaler parameter. // //***************************************************************************** typedef enum { EPWM_CLOCK_DIVIDER_1 = 0, //!< Divide clock by 1 EPWM_CLOCK_DIVIDER_2 = 1, //!< Divide clock by 2 EPWM_CLOCK_DIVIDER_4 = 2, //!< Divide clock by 4 EPWM_CLOCK_DIVIDER_8 = 3, //!< Divide clock by 8 EPWM_CLOCK_DIVIDER_16 = 4, //!< Divide clock by 16 EPWM_CLOCK_DIVIDER_32 = 5, //!< Divide clock by 32 EPWM_CLOCK_DIVIDER_64 = 6, //!< Divide clock by 64 EPWM_CLOCK_DIVIDER_128 = 7 //!< Divide clock by 128 } EPWM_ClockDivider; //***************************************************************************** // //! Values that can be passed to EPWM_setClockPrescaler() as the //! \e highSpeedPrescaler parameter. // //***************************************************************************** typedef enum { EPWM_HSCLOCK_DIVIDER_1 = 0, //!< Divide clock by 1 EPWM_HSCLOCK_DIVIDER_2 = 1, //!< Divide clock by 2 EPWM_HSCLOCK_DIVIDER_4 = 2, //!< Divide clock by 4 EPWM_HSCLOCK_DIVIDER_6 = 3, //!< Divide clock by 6 EPWM_HSCLOCK_DIVIDER_8 = 4, //!< Divide clock by 8 EPWM_HSCLOCK_DIVIDER_10 = 5, //!< Divide clock by 10 EPWM_HSCLOCK_DIVIDER_12 = 6, //!< Divide clock by 12 EPWM_HSCLOCK_DIVIDER_14 = 7 //!< Divide clock by 14 } EPWM_HSClockDivider; //***************************************************************************** // //! Values that can be passed to EPWM_setSyncInPulseSource() as the \e mode //! parameter. // //***************************************************************************** typedef enum { //! Disable Sync-in EPWM_SYNC_IN_PULSE_SRC_DISABLE = 0x0, //! Sync-in source is EPWM1 sync-out signal EPWM_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM1 = 0x1, //! Sync-in source is EPWM2 sync-out signal EPWM_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM2 = 0x2, //! Sync-in source is EPWM3 sync-out signal EPWM_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM3 = 0x3, //! Sync-in source is EPWM4 sync-out signal EPWM_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM4 = 0x4, //! Sync-in source is EPWM5 sync-out signal EPWM_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM5 = 0x5, //! Sync-in source is EPWM6 sync-out signal EPWM_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM6 = 0x6, //! Sync-in source is EPWM7 sync-out signal EPWM_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM7 = 0x7, //! Sync-in source is EPWM8 sync-out signal EPWM_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM8 = 0x8, //! Sync-in source is EPWM9 sync-out signal EPWM_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM9 = 0x9, //! Sync-in source is EPWM10 sync-out signal EPWM_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM10 = 0xA, //! Sync-in source is EPWM11 sync-out signal EPWM_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM11 = 0xB, //! Sync-in source is EPWM12 sync-out signal EPWM_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM12 = 0xC, //! Sync-in source is EPWM13 sync-out signal EPWM_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM13 = 0xD, //! Sync-in source is EPWM14 sync-out signal EPWM_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM14 = 0xE, //! Sync-in source is EPWM15 sync-out signal EPWM_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM15 = 0xF, //! Sync-in source is EPWM16 sync-out signal EPWM_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM16 = 0x10, //! Sync-in source is ECAP1 sync-out signal EPWM_SYNC_IN_PULSE_SRC_SYNCOUT_ECAP1 = 0x11, //! Sync-in source is ECAP2 sync-out signal EPWM_SYNC_IN_PULSE_SRC_SYNCOUT_ECAP2 = 0x12, //! Sync-in source is ECAP3 sync-out signal EPWM_SYNC_IN_PULSE_SRC_SYNCOUT_ECAP3 = 0x13, //! Sync-in source is ECAP4 sync-out signal EPWM_SYNC_IN_PULSE_SRC_SYNCOUT_ECAP4 = 0x14, //! Sync-in source is ECAP5 sync-out signal EPWM_SYNC_IN_PULSE_SRC_SYNCOUT_ECAP5 = 0x15, //! Sync-in source is ECAP6 sync-out signal EPWM_SYNC_IN_PULSE_SRC_SYNCOUT_ECAP6 = 0x16, //! Sync-in source is ECAP7 sync-out signal EPWM_SYNC_IN_PULSE_SRC_SYNCOUT_ECAP7 = 0x17, //! Sync-in source is Input XBAR out5 signal EPWM_SYNC_IN_PULSE_SRC_INPUTXBAR_OUT5 = 0x18, //! Sync-in source is Input XBAR out6 signal EPWM_SYNC_IN_PULSE_SRC_INPUTXBAR_OUT6 = 0x19, //! Sync-in source is Ethercat sync0 signal EPWM_SYNC_IN_PULSE_SRC_ETHERCAT_SYNC0 = 0x1A, //! Sync-in source is Ethercat sync1 signal EPWM_SYNC_IN_PULSE_SRC_ETHERCAT_SYNC1 = 0x1B } EPWM_SyncInPulseSource; //***************************************************************************** // //! Values that can be passed to EPWM_setOneShotSyncOutTrigger() as the //! \e trigger parameter. // //***************************************************************************** typedef enum { EPWM_OSHT_SYNC_OUT_TRIG_SYNC = 0x0, //!< Trigger is OSHT sync EPWM_OSHT_SYNC_OUT_TRIG_RELOAD = 0x1 //!< Trigger is OSHT reload } EPWM_OneShotSyncOutTrigger; //***************************************************************************** // //! Values that can be passed to EPWM_setPeriodLoadMode() as the //! \e loadMode parameter. // //***************************************************************************** typedef enum { //! PWM Period register access is through shadow register EPWM_PERIOD_SHADOW_LOAD = 0, //! PWM Period register access is directly EPWM_PERIOD_DIRECT_LOAD = 1 } EPWM_PeriodLoadMode; //***************************************************************************** // //! Values that can be passed to EPWM_setTimeBaseCounterMode() as the //! \e counterMode parameter. // //***************************************************************************** typedef enum { EPWM_COUNTER_MODE_UP = 0, //!< Up - count mode. EPWM_COUNTER_MODE_DOWN = 1, //!< Down - count mode. EPWM_COUNTER_MODE_UP_DOWN = 2, //!< Up - down - count mode. EPWM_COUNTER_MODE_STOP_FREEZE = 3 //!< Stop - Freeze counter. } EPWM_TimeBaseCountMode; //***************************************************************************** // //! Values that can be passed to EPWM_selectPeriodLoadEvent() as the //! \e shadowLoadMode parameter. // //***************************************************************************** typedef enum { //! shadow to active load occurs when time base counter reaches 0. EPWM_SHADOW_LOAD_MODE_COUNTER_ZERO = 0, //! shadow to active load occurs when time base counter reaches 0 and a //! SYNC occurs EPWM_SHADOW_LOAD_MODE_COUNTER_SYNC = 1, //! shadow to active load occurs only when a SYNC occurs EPWM_SHADOW_LOAD_MODE_SYNC = 2 } EPWM_PeriodShadowLoadMode; //***************************************************************************** // // Values that can be returned by the EPWM_getTimeBaseCounterDirection() // //***************************************************************************** //! Time base counter is counting up //! //! Time base counter is counting down //! //***************************************************************************** // //! Values that can be passed to EPWM_setupEPWMLinks() as the \e epwmLink //! parameter. // //***************************************************************************** typedef enum { EPWM_LINK_WITH_EPWM_1 = 0, //!< link current ePWM with ePWM1 EPWM_LINK_WITH_EPWM_2 = 1, //!< link current ePWM with ePWM2 EPWM_LINK_WITH_EPWM_3 = 2, //!< link current ePWM with ePWM3 EPWM_LINK_WITH_EPWM_4 = 3, //!< link current ePWM with ePWM4 EPWM_LINK_WITH_EPWM_5 = 4, //!< link current ePWM with ePWM5 EPWM_LINK_WITH_EPWM_6 = 5, //!< link current ePWM with ePWM6 EPWM_LINK_WITH_EPWM_7 = 6, //!< link current ePWM with ePWM7 EPWM_LINK_WITH_EPWM_8 = 7, //!< link current ePWM with ePWM8 EPWM_LINK_WITH_EPWM_9 = 8, //!< link current ePWM with ePWM9 EPWM_LINK_WITH_EPWM_10 = 9, //!< link current ePWM with ePWM10 EPWM_LINK_WITH_EPWM_11 = 10, //!< link current ePWM with ePWM11 EPWM_LINK_WITH_EPWM_12 = 11, //!< link current ePWM with ePWM12 EPWM_LINK_WITH_EPWM_13 = 12, //!< link current ePWM with ePWM13 EPWM_LINK_WITH_EPWM_14 = 13, //!< link current ePWM with ePWM14 EPWM_LINK_WITH_EPWM_15 = 14, //!< link current ePWM with ePWM15 EPWM_LINK_WITH_EPWM_16 = 15 //!< link current ePWM with ePWM16 } EPWM_CurrentLink; //***************************************************************************** // //! Values that can be passed to EPWM_setupEPWMLinks() as the \e linkComp //! parameter. // //***************************************************************************** typedef enum { EPWM_LINK_TBPRD = 0, //!< link TBPRD:TBPRDHR registers EPWM_LINK_COMP_A = 4, //!< link COMPA registers EPWM_LINK_COMP_B = 8, //!< link COMPB registers EPWM_LINK_COMP_C = 12, //!< link COMPC registers EPWM_LINK_COMP_D = 16, //!< link COMPD registers EPWM_LINK_GLDCTL2 = 28 //!< link GLDCTL2 registers } EPWM_LinkComponent; // // Counter Compare Module // //***************************************************************************** // //! Values that can be passed to the EPWM_getCounterCompareShadowStatus(), //! EPWM_setCounterCompareValue(), EPWM_setCounterCompareShadowLoadMode(), //! EPWM_disableCounterCompareShadowLoadMode() //! as the \e compModule parameter. // //***************************************************************************** typedef enum { EPWM_COUNTER_COMPARE_A = 0, //!< counter compare A EPWM_COUNTER_COMPARE_B = 2, //!< counter compare B EPWM_COUNTER_COMPARE_C = 5, //!< counter compare C EPWM_COUNTER_COMPARE_D = 7 //!< counter compare D } EPWM_CounterCompareModule; //***************************************************************************** // //! Values that can be passed to EPWM_setCounterCompareShadowLoadMode() as the //! \e loadMode parameter. // //***************************************************************************** typedef enum { //! load when counter equals zero EPWM_COMP_LOAD_ON_CNTR_ZERO = 0, //! load when counter equals period EPWM_COMP_LOAD_ON_CNTR_PERIOD = 1, //! load when counter equals zero or period EPWM_COMP_LOAD_ON_CNTR_ZERO_PERIOD = 2, //! Freeze shadow to active load EPWM_COMP_LOAD_FREEZE = 3, //! load when counter equals zero EPWM_COMP_LOAD_ON_SYNC_CNTR_ZERO = 4, //! load when counter equals period EPWM_COMP_LOAD_ON_SYNC_CNTR_PERIOD = 5, //! load when counter equals zero or period EPWM_COMP_LOAD_ON_SYNC_CNTR_ZERO_PERIOD = 6, //! load on sync only EPWM_COMP_LOAD_ON_SYNC_ONLY = 8 } EPWM_CounterCompareLoadMode; // // Action Qualifier Module // //***************************************************************************** // //! Values that can be passed to EPWM_setActionQualifierShadowLoadMode() and //! EPWM_disableActionQualifierShadowLoadMode() as the \e aqModule parameter. // //***************************************************************************** typedef enum { EPWM_ACTION_QUALIFIER_A = 0, //!< Action Qualifier A EPWM_ACTION_QUALIFIER_B = 2 //!< Action Qualifier B } EPWM_ActionQualifierModule; //***************************************************************************** // //! Values that can be passed to EPWM_setActionQualifierShadowLoadMode() as the //! \e loadMode parameter. // //***************************************************************************** typedef enum { //! load when counter equals zero EPWM_AQ_LOAD_ON_CNTR_ZERO = 0, //! load when counter equals period EPWM_AQ_LOAD_ON_CNTR_PERIOD = 1, //! load when counter equals zero or period EPWM_AQ_LOAD_ON_CNTR_ZERO_PERIOD = 2, //! Freeze shadow to active load EPWM_AQ_LOAD_FREEZE = 3, //! load on sync or when counter equals zero EPWM_AQ_LOAD_ON_SYNC_CNTR_ZERO = 4, //! load on sync or when counter equals period EPWM_AQ_LOAD_ON_SYNC_CNTR_PERIOD = 5, //! load on sync or when counter equals zero or period EPWM_AQ_LOAD_ON_SYNC_CNTR_ZERO_PERIOD = 6, //! load on sync only EPWM_AQ_LOAD_ON_SYNC_ONLY = 8 } EPWM_ActionQualifierLoadMode; //***************************************************************************** // //! Values that can be passed to EPWM_setActionQualifierT1TriggerSource() and //! EPWM_setActionQualifierT2TriggerSource() as the \e trigger parameter. // //***************************************************************************** typedef enum { EPWM_AQ_TRIGGER_EVENT_TRIG_DCA_1 = 0, //!< Digital compare event A 1 EPWM_AQ_TRIGGER_EVENT_TRIG_DCA_2 = 1, //!< Digital compare event A 2 EPWM_AQ_TRIGGER_EVENT_TRIG_DCB_1 = 2, //!< Digital compare event B 1 EPWM_AQ_TRIGGER_EVENT_TRIG_DCB_2 = 3, //!< Digital compare event B 2 EPWM_AQ_TRIGGER_EVENT_TRIG_TZ_1 = 4, //!< Trip zone 1 EPWM_AQ_TRIGGER_EVENT_TRIG_TZ_2 = 5, //!< Trip zone 2 EPWM_AQ_TRIGGER_EVENT_TRIG_TZ_3 = 6, //!< Trip zone 3 EPWM_AQ_TRIGGER_EVENT_TRIG_EPWM_SYNCIN = 7,//!< ePWM sync EPWM_AQ_TRIGGER_EVENT_TRIG_DC_EVTFILT = 8 //!< Digital compare filter event } EPWM_ActionQualifierTriggerSource; //***************************************************************************** // //! Values that can be passed to EPWM_setActionQualifierAction() as the \e //! event parameter. // //***************************************************************************** typedef enum { //! Time base counter equals zero EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO = 0, //! Time base counter equals period EPWM_AQ_OUTPUT_ON_TIMEBASE_PERIOD = 2, //! Time base counter up equals COMPA EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA = 4, //! Time base counter down equals COMPA EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA = 6, //! Time base counter up equals COMPB EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPB = 8, //! Time base counter down equals COMPB EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPB = 10, //! T1 event on count up EPWM_AQ_OUTPUT_ON_T1_COUNT_UP = 1, //! T1 event on count down EPWM_AQ_OUTPUT_ON_T1_COUNT_DOWN = 3, //! T2 event on count up EPWM_AQ_OUTPUT_ON_T2_COUNT_UP = 5, //! T2 event on count down EPWM_AQ_OUTPUT_ON_T2_COUNT_DOWN = 7 } EPWM_ActionQualifierOutputEvent; //***************************************************************************** // //! Values that can be passed to EPWM_setActionQualifierSWAction(), //! EPWM_setActionQualifierAction() as the \e outPut parameter. // //***************************************************************************** typedef enum { EPWM_AQ_OUTPUT_NO_CHANGE = 0, //!< No change in the output pins EPWM_AQ_OUTPUT_LOW = 1, //!< Set output pins to low EPWM_AQ_OUTPUT_HIGH = 2, //!< Set output pins to High EPWM_AQ_OUTPUT_TOGGLE = 3 //!< Toggle the output pins } EPWM_ActionQualifierOutput; //***************************************************************************** // //! Values that can be passed to EPWM_setActionQualifierContSWForceAction() //! as the \e outPut parameter. // //***************************************************************************** typedef enum { EPWM_AQ_SW_DISABLED = 0, //!< Software forcing disabled EPWM_AQ_SW_OUTPUT_LOW = 1, //!< Set output pins to low EPWM_AQ_SW_OUTPUT_HIGH = 2 //!< Set output pins to High } EPWM_ActionQualifierSWOutput; //***************************************************************************** // //! Values that can be passed to EPWM_setActionQualifierActionComplete() //! as the \e action parameter. // //***************************************************************************** typedef enum { //! Time base counter equals zero and no change in the output pins EPWM_AQ_OUTPUT_NO_CHANGE_ZERO = 0x0, //! Time base counter equals zero and set output pins to low EPWM_AQ_OUTPUT_LOW_ZERO = 0x1, //! Time base counter equals zero and set output pins to high EPWM_AQ_OUTPUT_HIGH_ZERO = 0x2, //! Time base counter equals zero and toggle the output pins EPWM_AQ_OUTPUT_TOGGLE_ZERO = 0x3, //! Time base counter equals period and no change in the output pins EPWM_AQ_OUTPUT_NO_CHANGE_PERIOD = 0x0, //! Time base counter equals period and set output pins to low EPWM_AQ_OUTPUT_LOW_PERIOD = 0x4, //! Time base counter equals period and set output pins to high EPWM_AQ_OUTPUT_HIGH_PERIOD = 0x8, //! Time base counter equals period and toggle the output pins EPWM_AQ_OUTPUT_TOGGLE_PERIOD = 0xC, //! Time base counter up equals COMPA and no change in the output pins EPWM_AQ_OUTPUT_NO_CHANGE_UP_CMPA = 0x00, //! Time base counter up equals COMPA and set output pins to low EPWM_AQ_OUTPUT_LOW_UP_CMPA = 0x10, //! Time base counter up equals COMPA and set output pins to high EPWM_AQ_OUTPUT_HIGH_UP_CMPA = 0x20, //! Time base counter up equals COMPA and toggle the output pins EPWM_AQ_OUTPUT_TOGGLE_UP_CMPA = 0x30, //! Time base counter down equals COMPA and no change in the output pins EPWM_AQ_OUTPUT_NO_CHANGE_DOWN_CMPA = 0x00, //! Time base counter down equals COMPA and set output pins to low EPWM_AQ_OUTPUT_LOW_DOWN_CMPA = 0x40, //! Time base counter down equals COMPA and set output pins to high EPWM_AQ_OUTPUT_HIGH_DOWN_CMPA = 0x80, //! Time base counter down equals COMPA and toggle the output pins EPWM_AQ_OUTPUT_TOGGLE_DOWN_CMPA = 0xC0, //! Time base counter up equals COMPB and no change in the output pins EPWM_AQ_OUTPUT_NO_CHANGE_UP_CMPB = 0x000, //! Time base counter up equals COMPB and set output pins to low EPWM_AQ_OUTPUT_LOW_UP_CMPB = 0x100, //! Time base counter up equals COMPB and set output pins to high EPWM_AQ_OUTPUT_HIGH_UP_CMPB = 0x200, //! Time base counter up equals COMPB and toggle the output pins EPWM_AQ_OUTPUT_TOGGLE_UP_CMPB = 0x300, //! Time base counter down equals COMPB and no change in the output pins EPWM_AQ_OUTPUT_NO_CHANGE_DOWN_CMPB = 0x000, //! Time base counter down equals COMPB and set output pins to low EPWM_AQ_OUTPUT_LOW_DOWN_CMPB = 0x400, //! Time base counter down equals COMPB and set output pins to high EPWM_AQ_OUTPUT_HIGH_DOWN_CMPB = 0x800, //! Time base counter down equals COMPB and toggle the output pins EPWM_AQ_OUTPUT_TOGGLE_DOWN_CMPB = 0xC00 } EPWM_ActionQualifierEventAction; //***************************************************************************** // //! Values that can be passed to //! EPWM_setAdditionalActionQualifierActionComplete() as the \e action //! parameter. // //***************************************************************************** typedef enum { //! T1 event on count up and no change in the output pins EPWM_AQ_OUTPUT_NO_CHANGE_UP_T1 = 0x0, //! T1 event on count up and set output pins to low EPWM_AQ_OUTPUT_LOW_UP_T1 = 0x1, //! T1 event on count up and set output pins to high EPWM_AQ_OUTPUT_HIGH_UP_T1 = 0x2, //! T1 event on count up and toggle the output pins EPWM_AQ_OUTPUT_TOGGLE_UP_T1 = 0x3, //! T1 event on count down and no change in the output pins EPWM_AQ_OUTPUT_NO_CHANGE_DOWN_T1 = 0x0, //! T1 event on count down and set output pins to low EPWM_AQ_OUTPUT_LOW_DOWN_T1 = 0x4, //! T1 event on count down and set output pins to high EPWM_AQ_OUTPUT_HIGH_DOWN_T1 = 0x8, //! T1 event on count down and toggle the output pins EPWM_AQ_OUTPUT_TOGGLE_DOWN_T1 = 0xC, //! T2 event on count up and no change in the output pins EPWM_AQ_OUTPUT_NO_CHANGE_UP_T2 = 0x00, //! T2 event on count up and set output pins to low EPWM_AQ_OUTPUT_LOW_UP_T2 = 0x10, //! T2 event on count up and set output pins to high EPWM_AQ_OUTPUT_HIGH_UP_T2 = 0x20, //! T2 event on count up and toggle the output pins EPWM_AQ_OUTPUT_TOGGLE_UP_T2 = 0x30, //! T2 event on count down and no change in the output pins EPWM_AQ_OUTPUT_NO_CHANGE_DOWN_T2 = 0x00, //! T2 event on count down and set output pins to low EPWM_AQ_OUTPUT_LOW_DOWN_T2 = 0x40, //! T2 event on count down and set output pins to high EPWM_AQ_OUTPUT_HIGH_DOWN_T2 = 0x80, //! T2 event on count down and toggle the output pins EPWM_AQ_OUTPUT_TOGGLE_DOWN_T2 = 0xC0 } EPWM_AdditionalActionQualifierEventAction; //***************************************************************************** // //! Values that can be passed to EPWM_forceActionQualifierSWAction(), //! EPWM_setActionQualifierSWAction(), EPWM_setActionQualifierAction() //! EPWM_setActionQualifierContSWForceAction() as the \e epwmOutput parameter. // //***************************************************************************** typedef enum { EPWM_AQ_OUTPUT_A = 0, //!< ePWMxA output EPWM_AQ_OUTPUT_B = 2 //!< ePWMxB output } EPWM_ActionQualifierOutputModule; //***************************************************************************** // //! Values that can be passed to EPWM_setActionQualifierContSWForceShadowMode() //! as the \e mode parameter. // //***************************************************************************** typedef enum { //! shadow mode load when counter equals zero EPWM_AQ_SW_SH_LOAD_ON_CNTR_ZERO = 0, //! shadow mode load when counter equals period EPWM_AQ_SW_SH_LOAD_ON_CNTR_PERIOD = 1, //! shadow mode load when counter equals zero or period EPWM_AQ_SW_SH_LOAD_ON_CNTR_ZERO_PERIOD = 2, //! No shadow load mode. Immediate mode only. EPWM_AQ_SW_IMMEDIATE_LOAD = 3 } EPWM_ActionQualifierContForce; //***************************************************************************** // //! Values that can be passed to EPWM_setDeadBandOutputSwapMode() //! as the \e output parameter. // //***************************************************************************** typedef enum { EPWM_DB_OUTPUT_A = 0, //!< DB output is ePWMA EPWM_DB_OUTPUT_B = 1 //!< DB output is ePWMB } EPWM_DeadBandOutput; //***************************************************************************** // //! Values that can be passed to EPWM_setDeadBandDelayPolarity(), //! EPWM_setDeadBandDelayMode() as the \e delayMode parameter. // //***************************************************************************** typedef enum { EPWM_DB_RED = 1, //!< DB RED (Rising Edge Delay) mode EPWM_DB_FED = 0 //!< DB FED (Falling Edge Delay) mode } EPWM_DeadBandDelayMode; //***************************************************************************** // //! Values that can be passed to EPWM_setDeadBandDelayPolarity as the //! \e polarity parameter. // //***************************************************************************** typedef enum { EPWM_DB_POLARITY_ACTIVE_HIGH = 0, //!< DB polarity is not inverted EPWM_DB_POLARITY_ACTIVE_LOW = 1 //!< DB polarity is inverted } EPWM_DeadBandPolarity; //***************************************************************************** // // Values that can be passed to EPWM_setRisingEdgeDeadBandDelayInput(), // EPWM_setFallingEdgeDeadBandDelayInput() as the input parameter. // //***************************************************************************** //! Input signal is ePWMA //! //! Input signal is ePWMB //! //! Input signal is the output of Rising Edge delay //! //***************************************************************************** // //! Values that can be passed to EPWM_setDeadBandControlShadowLoadMode() as //! the \e loadMode parameter. // //***************************************************************************** typedef enum { //! load when counter equals zero EPWM_DB_LOAD_ON_CNTR_ZERO = 0, //! load when counter equals period EPWM_DB_LOAD_ON_CNTR_PERIOD = 1, //! load when counter equals zero or period EPWM_DB_LOAD_ON_CNTR_ZERO_PERIOD = 2, //! Freeze shadow to active load EPWM_DB_LOAD_FREEZE = 3 } EPWM_DeadBandControlLoadMode; //***************************************************************************** // //! Values that can be passed to EPWM_setRisingEdgeDelayCountShadowLoadMode() //! as the \e loadMode parameter. // //***************************************************************************** typedef enum { //! load when counter equals zero EPWM_RED_LOAD_ON_CNTR_ZERO = 0, //! load when counter equals period EPWM_RED_LOAD_ON_CNTR_PERIOD = 1, //! load when counter equals zero or period EPWM_RED_LOAD_ON_CNTR_ZERO_PERIOD = 2, //! Freeze shadow to active load EPWM_RED_LOAD_FREEZE = 3 } EPWM_RisingEdgeDelayLoadMode; //***************************************************************************** // //! Values that can be passed to EPWM_setFallingEdgeDelayCountShadowLoadMode() //! as the \e loadMode parameter. // //***************************************************************************** typedef enum { //! load when counter equals zero EPWM_FED_LOAD_ON_CNTR_ZERO = 0, //! load when counter equals period EPWM_FED_LOAD_ON_CNTR_PERIOD = 1, //! load when counter equals zero or period EPWM_FED_LOAD_ON_CNTR_ZERO_PERIOD = 2, //! Freeze shadow to active load EPWM_FED_LOAD_FREEZE = 3 } EPWM_FallingEdgeDelayLoadMode; //***************************************************************************** // //! Values that can be passed to EPWM_setDeadBandCounterClock() as the //! \e clockMode parameter. // //***************************************************************************** typedef enum { //! Dead band counter runs at TBCLK rate EPWM_DB_COUNTER_CLOCK_FULL_CYCLE = 0, //! Dead band counter runs at 2*TBCLK rate EPWM_DB_COUNTER_CLOCK_HALF_CYCLE = 1 } EPWM_DeadBandClockMode; // // Trip Zone // //***************************************************************************** // // Values that can be passed to EPWM_enableTripZoneSignals() and // EPWM_disableTripZoneSignals() as the tzSignal parameter. // //***************************************************************************** //! TZ1 Cycle By Cycle //! //! TZ2 Cycle By Cycle //! //! TZ3 Cycle By Cycle //! //! TZ4 Cycle By Cycle //! //! TZ5 Cycle By Cycle //! //! TZ6 Cycle By Cycle //! //! DCAEVT2 Cycle By Cycle //! //! DCBEVT2 Cycle By Cycle //! //! One-shot TZ1 //! //! One-shot TZ2 //! //! One-shot TZ3 //! //! One-shot TZ4 //! //! One-shot TZ5 //! //! One-shot TZ6 //! //! One-shot DCAEVT1 //! //! One-shot DCBEVT1 //! //***************************************************************************** // //! Values that can be passed to EPWM_setTripZoneDigitalCompareEventCondition() //! as the \e dcType parameter. // //***************************************************************************** typedef enum { EPWM_TZ_DC_OUTPUT_A1 = 0, //!< Digital Compare output 1 A EPWM_TZ_DC_OUTPUT_A2 = 3, //!< Digital Compare output 2 A EPWM_TZ_DC_OUTPUT_B1 = 6, //!< Digital Compare output 1 B EPWM_TZ_DC_OUTPUT_B2 = 9 //!< Digital Compare output 2 B } EPWM_TripZoneDigitalCompareOutput; //***************************************************************************** // //! Values that can be passed to EPWM_setTripZoneDigitalCompareEventCondition() //! as the \e dcEvent parameter. // //***************************************************************************** typedef enum { EPWM_TZ_EVENT_DC_DISABLED = 0, //!< Event is disabled EPWM_TZ_EVENT_DCXH_LOW = 1, //!< Event when DCxH low EPWM_TZ_EVENT_DCXH_HIGH = 2, //!< Event when DCxH high EPWM_TZ_EVENT_DCXL_LOW = 3, //!< Event when DCxL low EPWM_TZ_EVENT_DCXL_HIGH = 4, //!< Event when DCxL high EPWM_TZ_EVENT_DCXL_HIGH_DCXH_LOW = 5 //!< Event when DCxL high DCxH low } EPWM_TripZoneDigitalCompareOutputEvent; //***************************************************************************** // //! Values that can be passed to EPWM_setTripZoneAction() as the \e tzEvent //! parameter. // //***************************************************************************** typedef enum { EPWM_TZ_ACTION_EVENT_TZA = 0, //!< TZ1 - TZ6, DCAEVT2, DCAEVT1 EPWM_TZ_ACTION_EVENT_TZB = 2, //!< TZ1 - TZ6, DCBEVT2, DCBEVT1 EPWM_TZ_ACTION_EVENT_DCAEVT1 = 4, //!< DCAEVT1 (Digital Compare A event 1) EPWM_TZ_ACTION_EVENT_DCAEVT2 = 6, //!< DCAEVT2 (Digital Compare A event 2) EPWM_TZ_ACTION_EVENT_DCBEVT1 = 8, //!< DCBEVT1 (Digital Compare B event 1) EPWM_TZ_ACTION_EVENT_DCBEVT2 = 10 //!< DCBEVT2 (Digital Compare B event 2) } EPWM_TripZoneEvent; //***************************************************************************** // //! Values that can be passed to EPWM_setTripZoneAction() as the //! \e tzAction parameter. // //***************************************************************************** typedef enum { EPWM_TZ_ACTION_HIGH_Z = 0, //!< high impedance output EPWM_TZ_ACTION_HIGH = 1, //!< high voltage state EPWM_TZ_ACTION_LOW = 2, //!< low voltage state EPWM_TZ_ACTION_DISABLE = 3 //!< disable action } EPWM_TripZoneAction; //***************************************************************************** // //! Values that can be passed to EPWM_setTripZoneAdvAction() as the //! \e tzAdvEvent parameter. // //***************************************************************************** typedef enum { //! TZ1 - TZ6, DCBEVT2, DCBEVT1 while counting down EPWM_TZ_ADV_ACTION_EVENT_TZB_D = 9, //! TZ1 - TZ6, DCBEVT2, DCBEVT1 while counting up EPWM_TZ_ADV_ACTION_EVENT_TZB_U = 6, //! TZ1 - TZ6, DCAEVT2, DCAEVT1 while counting down EPWM_TZ_ADV_ACTION_EVENT_TZA_D = 3, //! TZ1 - TZ6, DCAEVT2, DCAEVT1 while counting up EPWM_TZ_ADV_ACTION_EVENT_TZA_U = 0 } EPWM_TripZoneAdvancedEvent; //***************************************************************************** // //! Values that can be passed to EPWM_setTripZoneAdvDigitalCompareActionA(), //! EPWM_setTripZoneAdvDigitalCompareActionB(),EPWM_setTripZoneAdvAction() //! as the \e tzAdvDCAction parameter. // //***************************************************************************** typedef enum { EPWM_TZ_ADV_ACTION_HIGH_Z = 0, //!< high impedance output EPWM_TZ_ADV_ACTION_HIGH = 1, //!< high voltage state EPWM_TZ_ADV_ACTION_LOW = 2, //!< low voltage state EPWM_TZ_ADV_ACTION_TOGGLE = 3, //!< toggle the output EPWM_TZ_ADV_ACTION_DISABLE = 7 //!< disable action } EPWM_TripZoneAdvancedAction; //***************************************************************************** // //! Values that can be passed to EPWM_setTripZoneAdvDigitalCompareActionA() and //! EPWM_setTripZoneAdvDigitalCompareActionB() as the \e tzAdvDCEvent //! parameter. // //***************************************************************************** typedef enum { //! Digital Compare event A/B 1 while counting up EPWM_TZ_ADV_ACTION_EVENT_DCxEVT1_U = 0, //! Digital Compare event A/B 1 while counting down EPWM_TZ_ADV_ACTION_EVENT_DCxEVT1_D = 3, //! Digital Compare event A/B 2 while counting up EPWM_TZ_ADV_ACTION_EVENT_DCxEVT2_U = 6, //! Digital Compare event A/B 2 while counting down EPWM_TZ_ADV_ACTION_EVENT_DCxEVT2_D = 9 } EPWM_TripZoneAdvDigitalCompareEvent; //***************************************************************************** // // Values that can be passed to EPWM_enableTripZoneInterrupt()and // EPWM_disableTripZoneInterrupt() as the tzInterrupt parameter . // //***************************************************************************** //! Trip Zones Cycle By Cycle interrupt //! //! Trip Zones One Shot interrupt //! //! Digital Compare A Event 1 interrupt //! //! Digital Compare A Event 2 interrupt //! //! Digital Compare B Event 1 interrupt //! //! Digital Compare B Event 2 interrupt //! //***************************************************************************** // // Values that can be returned by EPWM_getTripZoneFlagStatus() . // //***************************************************************************** //! Trip Zones Cycle By Cycle flag //! //! Trip Zones One Shot flag //! //! Digital Compare A Event 1 flag //! //! Digital Compare A Event 2 flag //! //! Digital Compare B Event 1 flag //! //! Digital Compare B Event 2 flag //! //***************************************************************************** // // Value can be passed to EPWM_clearTripZoneFlag() as the // tzInterrupt parameter and returned by EPWM_getTripZoneFlagStatus(). // //***************************************************************************** //! Trip Zone interrupt //! //***************************************************************************** // // Values that can be passed to EPWM_clearCycleByCycleTripZoneFlag() // as the tzCbcFlag parameter and returned by // EPWM_getCycleByCycleTripZoneFlagStatus(). // //***************************************************************************** //! CBC flag 1 //! //! CBC flag 2 //! //! CBC flag 3 //! //! CBC flag 4 //! //! CBC flag 5 //! //! CBC flag 6 //! //! CBC flag Digital compare event A2 //! //! CBC flag Digital compare event B2 //! //***************************************************************************** // // Values that can be passed to EPWM_clearOneShotTripZoneFlag() as // the tzCbcFlag parameter and returned by the // EPWM_getOneShotTripZoneFlagStatus() . // //***************************************************************************** //! OST flag OST1 //! //! OST flag OST2 //! //! OST flag OST3 //! //! OST flag OST4 //! //! OST flag OST5 //! //! OST flag OST6 //! //! OST flag Digital compare event A1 //! //! OST flag Digital compare event B1 //! //***************************************************************************** // //! Values that can be passed to EPWM_selectCycleByCycleTripZoneClearEvent() as //! the \e clearMode parameter. // //***************************************************************************** typedef enum { //! Clear CBC pulse when counter equals zero EPWM_TZ_CBC_PULSE_CLR_CNTR_ZERO = 0, //! Clear CBC pulse when counter equals period EPWM_TZ_CBC_PULSE_CLR_CNTR_PERIOD = 1, //! Clear CBC pulse when counter equals zero or period EPWM_TZ_CBC_PULSE_CLR_CNTR_ZERO_PERIOD = 2 } EPWM_CycleByCycleTripZoneClearMode; //***************************************************************************** // // Values that can be passed to EPWM_forceTripZoneEvent() as the // tzForceEvent parameter. // //***************************************************************************** //! Force Cycle By Cycle trip event //! //! Force a One-Shot Trip Event //! //! ForceDigital Compare Output A Event 1 //! //! ForceDigital Compare Output A Event 2 //! //! ForceDigital Compare Output B Event 1 //! //! ForceDigital Compare Output B Event 2 //! //***************************************************************************** // // Values that can be passed to EPWM_setInterruptSource() as the // interruptSource parameter. // //***************************************************************************** //! Time-base counter equal to zero //! //! Time-base counter equal to period //! //! Time-base counter equal to zero or period //! //! time-base counter equal to CMPA when the timer is incrementing //! //! time-base counter equal to CMPC when the timer is incrementing //! //! time-base counter equal to CMPA when the timer is decrementing //! //! time-base counter equal to CMPC when the timer is decrementing //! //! time-base counter equal to CMPB when the timer is incrementing //! //! time-base counter equal to CMPD when the timer is incrementing //! //! time-base counter equal to CMPB when the timer is decrementing //! //! time-base counter equal to CMPD when the timer is decrementing //! //***************************************************************************** // //! Values that can be passed to EPWM_enableADCTrigger(), //! EPWM_disableADCTrigger(),EPWM_setADCTriggerSource(), //! EPWM_setADCTriggerEventPrescale(),EPWM_getADCTriggerFlagStatus(), //! EPWM_clearADCTriggerFlag(),EPWM_enableADCTriggerEventCountInit(), //! EPWM_disableADCTriggerEventCountInit(),EPWM_forceADCTriggerEventCountInit(), //! EPWM_setADCTriggerEventCountInitValue(),EPWM_getADCTriggerEventCount(), //! EPWM_forceADCTrigger() as the \e adcSOCType parameter // //***************************************************************************** typedef enum { EPWM_SOC_A = 0, //!< SOC A EPWM_SOC_B = 1 //!< SOC B } EPWM_ADCStartOfConversionType; //***************************************************************************** // //! Values that can be passed to EPWM_setADCTriggerSource() as the //! \e socSource parameter. // //***************************************************************************** typedef enum { //! Event is based on DCxEVT1 EPWM_SOC_DCxEVT1 = 0, //! Time-base counter equal to zero EPWM_SOC_TBCTR_ZERO = 1, //! Time-base counter equal to period EPWM_SOC_TBCTR_PERIOD = 2, //! Time-base counter equal to zero or period EPWM_SOC_TBCTR_ZERO_OR_PERIOD = 3, //! time-base counter equal to CMPA when the timer is incrementing EPWM_SOC_TBCTR_U_CMPA = 4, //! time-base counter equal to CMPC when the timer is incrementing EPWM_SOC_TBCTR_U_CMPC = 8, //! time-base counter equal to CMPA when the timer is decrementing EPWM_SOC_TBCTR_D_CMPA = 5, //! time-base counter equal to CMPC when the timer is decrementing EPWM_SOC_TBCTR_D_CMPC = 10, //! time-base counter equal to CMPB when the timer is incrementing EPWM_SOC_TBCTR_U_CMPB = 6, //! time-base counter equal to CMPD when the timer is incrementing EPWM_SOC_TBCTR_U_CMPD = 12, //! time-base counter equal to CMPB when the timer is decrementing EPWM_SOC_TBCTR_D_CMPB = 7, //! time-base counter equal to CMPD when the timer is decrementing EPWM_SOC_TBCTR_D_CMPD = 14 } EPWM_ADCStartOfConversionSource; // // Digital Compare Module // //***************************************************************************** // //! Values that can be passed to EPWM_selectDigitalCompareTripInput(), //! EPWM_enableDigitalCompareTripCombinationInput(), //! EPWM_disableDigitalCompareTripCombinationInput() as the \e dcType //! parameter. // //***************************************************************************** typedef enum { EPWM_DC_TYPE_DCAH = 0, //!< Digital Compare A High EPWM_DC_TYPE_DCAL = 1, //!< Digital Compare A Low EPWM_DC_TYPE_DCBH = 2, //!< Digital Compare B High EPWM_DC_TYPE_DCBL = 3 //!< Digital Compare B Low } EPWM_DigitalCompareType; //***************************************************************************** // //! Values that can be passed to EPWM_selectDigitalCompareTripInput() as the //! \e tripSource parameter. // //***************************************************************************** typedef enum { EPWM_DC_TRIP_TRIPIN1 = 0, //!< Trip 1 EPWM_DC_TRIP_TRIPIN2 = 1, //!< Trip 2 EPWM_DC_TRIP_TRIPIN3 = 2, //!< Trip 3 EPWM_DC_TRIP_TRIPIN4 = 3, //!< Trip 4 EPWM_DC_TRIP_TRIPIN5 = 4, //!< Trip 5 EPWM_DC_TRIP_TRIPIN6 = 5, //!< Trip 6 EPWM_DC_TRIP_TRIPIN7 = 6, //!< Trip 7 EPWM_DC_TRIP_TRIPIN8 = 7, //!< Trip 8 EPWM_DC_TRIP_TRIPIN9 = 8, //!< Trip 9 EPWM_DC_TRIP_TRIPIN10 = 9, //!< Trip 10 EPWM_DC_TRIP_TRIPIN11 = 10, //!< Trip 11 EPWM_DC_TRIP_TRIPIN12 = 11, //!< Trip 12 EPWM_DC_TRIP_TRIPIN14 = 13, //!< Trip 14 EPWM_DC_TRIP_TRIPIN15 = 14, //!< Trip 15 EPWM_DC_TRIP_COMBINATION = 15 //!< All Trips (Trip1 - Trip 15) are selected } EPWM_DigitalCompareTripInput; //***************************************************************************** // // Values that can be passed to EPWM_enableDigitalCompareTripCombinationInput(), // EPWM_disableDigitalCompareTripCombinationInput() as the tripInput // parameter. // //***************************************************************************** //! Combinational Trip 1 input //! //! Combinational Trip 2 input //! //! Combinational Trip 3 input //! //! Combinational Trip 4 input //! //! Combinational Trip 5 input //! //! Combinational Trip 6 input //! //! Combinational Trip 7 input //! //! Combinational Trip 8 input //! //! Combinational Trip 9 input //! //! Combinational Trip 10 input //! //! Combinational Trip 11 input //! //! Combinational Trip 12 input //! //! Combinational Trip 14 input //! //! Combinational Trip 15 input //! //***************************************************************************** // //! Values that can be passed to EPWM_setDigitalCompareBlankingEvent() as the //! the \e blankingPulse parameter. // //***************************************************************************** typedef enum { //! Time base counter equals period EPWM_DC_WINDOW_START_TBCTR_PERIOD = 0, //! Time base counter equals zero EPWM_DC_WINDOW_START_TBCTR_ZERO = 1, //! Time base counter equals zero EPWM_DC_WINDOW_START_TBCTR_ZERO_PERIOD = 2 } EPWM_DigitalCompareBlankingPulse; //***************************************************************************** // //! Values that can be passed to EPWM_setDigitalCompareFilterInput() //! as the \e filterInput parameter. // //***************************************************************************** typedef enum { EPWM_DC_WINDOW_SOURCE_DCAEVT1 = 0, //!< DC filter signal source is DCAEVT1 EPWM_DC_WINDOW_SOURCE_DCAEVT2 = 1, //!< DC filter signal source is DCAEVT2 EPWM_DC_WINDOW_SOURCE_DCBEVT1 = 2, //!< DC filter signal source is DCBEVT1 EPWM_DC_WINDOW_SOURCE_DCBEVT2 = 3 //!< DC filter signal source is DCBEVT2 } EPWM_DigitalCompareFilterInput; //***************************************************************************** // //! Values that can be assigned to EPWM_setDigitalCompareEventSource(), //! EPWM_setDigitalCompareEventSyncMode(),EPWM_enableDigitalCompareSyncEvent() //! EPWM_enableDigitalCompareADCTrigger(),EPWM_disableDigitalCompareSyncEvent() //! EPWM_disableDigitalCompareADCTrigger() as the \e dcModule parameter. // //***************************************************************************** typedef enum { EPWM_DC_MODULE_A = 0, //!< Digital Compare Module A EPWM_DC_MODULE_B = 1 //!< Digital Compare Module B } EPWM_DigitalCompareModule; //***************************************************************************** // //! Values that can be passed to EPWM_setDigitalCompareEventSource(), //! EPWM_setDigitalCompareEventSyncMode as the \e dcEvent parameter. // //***************************************************************************** typedef enum { EPWM_DC_EVENT_1 = 0, //!< Digital Compare Event number 1 EPWM_DC_EVENT_2 = 1 //!< Digital Compare Event number 2 } EPWM_DigitalCompareEvent; //***************************************************************************** // //! Values that can be passed to EPWM_setDigitalCompareEventSource() as the //! \e dcEventSource parameter. // //***************************************************************************** typedef enum { //! signal source is unfiltered (DCAEVT1/2) EPWM_DC_EVENT_SOURCE_ORIG_SIGNAL = 0, //! signal source is filtered (DCEVTFILT) EPWM_DC_EVENT_SOURCE_FILT_SIGNAL = 1 } EPWM_DigitalCompareEventSource; //***************************************************************************** // //! Values that can be passed to EPWM_setDigitalCompareEventSyncMode() as the //! \e syncMode parameter. // //***************************************************************************** typedef enum { //! DC input signal is synced with TBCLK EPWM_DC_EVENT_INPUT_SYNCED = 0, //! DC input signal is not synced with TBCLK EPWM_DC_EVENT_INPUT_NOT_SYNCED = 1 } EPWM_DigitalCompareSyncMode; //***************************************************************************** // //! Values that can be passed to EPWM_setDigitalCompareCBCLatchMode() as the //! \e latchMode parameter. // //***************************************************************************** typedef enum { //! DC cycle-by-cycle(CBC) latch is disabled EPWM_DC_CBC_LATCH_DISABLED = 0x0, //! DC cycle-by-cycle(CBC) latch is enabled EPWM_DC_CBC_LATCH_ENABLED = 0x1 } EPWM_DigitalCompareCBCLatchMode; //***************************************************************************** // //! Values that can be passed to EPWM_selectDigitalCompareCBCLatchClearEvent() //! as the \e latchMode parameter. // //***************************************************************************** typedef enum { //! Clear CBC latch when counter equals zero EPWM_DC_CBC_LATCH_CLR_CNTR_ZERO = 0x0, //! Clear CBC latch when counter equals period EPWM_DC_CBC_LATCH_CLR_ON_CNTR_PERIOD = 0x1, //! Clear CBC latch when counter equals zero or period EPWM_DC_CBC_LATCH_CLR_ON_CNTR_ZERO_PERIOD = 0x2 } EPWM_DigitalCompareCBCLatchClearEvent; //***************************************************************************** // //! Values that can be passed to EPWM_setGlobalLoadTrigger() as the //! \e loadTrigger parameter. // //***************************************************************************** typedef enum { //! load when counter is equal to zero EPWM_GL_LOAD_PULSE_CNTR_ZERO = 0x0, //! load when counter is equal to period EPWM_GL_LOAD_PULSE_CNTR_PERIOD = 0x1, //! load when counter is equal to zero or period EPWM_GL_LOAD_PULSE_CNTR_ZERO_PERIOD = 0x2, //! load on sync event EPWM_GL_LOAD_PULSE_SYNC = 0x3, //! load on sync event or when counter is equal to zero EPWM_GL_LOAD_PULSE_SYNC_OR_CNTR_ZERO = 0x4, //! load on sync event or when counter is equal to period EPWM_GL_LOAD_PULSE_SYNC_OR_CNTR_PERIOD = 0x5, //! load on sync event or when counter is equal to period or zero EPWM_GL_LOAD_PULSE_SYNC_CNTR_ZERO_PERIOD = 0x6, //! load on global force EPWM_GL_LOAD_PULSE_GLOBAL_FORCE = 0xF } EPWM_GlobalLoadTrigger; //***************************************************************************** // // Values that can be passed to EPWM_enableGlobalLoadRegisters(), // EPWM_disableGlobalLoadRegisters() as theloadRegister parameter. // //***************************************************************************** //! Global load TBPRD:TBPRDHR //! //! Global load CMPA:CMPAHR //! //! Global load CMPB:CMPBHR //! //! Global load CMPC //! //! Global load CMPD //! //! Global load DBRED:DBREDHR //! //! Global load DBFED:DBFEDHR //! //! Global load DBCTL //! //! Global load AQCTLA/A2 //! //! Global load AQCTLB/B2 //! //! Global load AQCSFRC //! //***************************************************************************** // //! Values that can be passed to EPWM_setValleyTriggerSource() as the \e //! trigger parameter. // //***************************************************************************** typedef enum { //! Valley capture trigged by software. EPWM_VALLEY_TRIGGER_EVENT_SOFTWARE = 0U, //! Valley capture trigged by when counter is equal to zero. EPWM_VALLEY_TRIGGER_EVENT_CNTR_ZERO = 1U, //! Valley capture trigged by when counter is equal period. EPWM_VALLEY_TRIGGER_EVENT_CNTR_PERIOD = 2U, //! Valley capture trigged when counter is equal to zero or period. EPWM_VALLEY_TRIGGER_EVENT_CNTR_ZERO_PERIOD = 3U, //! Valley capture trigged by DCAEVT1 (Digital Compare A event 1) EPWM_VALLEY_TRIGGER_EVENT_DCAEVT1 = 4U, //! Valley capture trigged by DCAEVT2 (Digital Compare A event 2) EPWM_VALLEY_TRIGGER_EVENT_DCAEVT2 = 5U, //! Valley capture trigged by DCBEVT1 (Digital Compare B event 1) EPWM_VALLEY_TRIGGER_EVENT_DCBEVT1 = 6U, //! Valley capture trigged by DCBEVT2 (Digital Compare B event 2) EPWM_VALLEY_TRIGGER_EVENT_DCBEVT2 = 7U } EPWM_ValleyTriggerSource; //***************************************************************************** // //! Values that can be passed to EPWM_getValleyCountEdgeStatus() as the \e edge //! parameter. // //***************************************************************************** typedef enum { EPWM_VALLEY_COUNT_START_EDGE = 0, //!< Valley count start edge EPWM_VALLEY_COUNT_STOP_EDGE = 1 //!< Valley count stop edge } EPWM_ValleyCounterEdge; //***************************************************************************** // //! Values that can be passed to EPWM_setValleyDelayValue() as the \e delayMode //! parameter. // //***************************************************************************** typedef enum { //! Delay value equals the offset value defines by software EPWM_VALLEY_DELAY_MODE_SW_DELAY = 0U, //! Delay value equals the sum of the Hardware counter value and the offset //! value defines by software EPWM_VALLEY_DELAY_MODE_VCNT_DELAY_SW_DELAY = 1U, //! Delay value equals the the Hardware counter shifted by //! (1 + the offset value defines by software) EPWM_VALLEY_DELAY_MODE_VCNT_DELAY_SHIFT_1_SW_DELAY = 2U, //! Delay value equals the the Hardware counter shifted by //! (2 + the offset value defines by software) EPWM_VALLEY_DELAY_MODE_VCNT_DELAY_SHIFT_2_SW_DELAY = 3U, //! Delay value equals the the Hardware counter shifted by //! (4 + the offset value defines by software) EPWM_VALLEY_DELAY_MODE_VCNT_DELAY_SHIFT_4_SW_DELAY = 4U } EPWM_ValleyDelayMode; // // DC Edge Filter // //***************************************************************************** // //! Values that can be passed to EPWM_setDigitalCompareEdgeFilterMode() //! as the \e edgeMode parameter. // //***************************************************************************** typedef enum { EPWM_DC_EDGEFILT_MODE_RISING = 0, //!< Digital Compare Edge filter low //!< to high edge mode EPWM_DC_EDGEFILT_MODE_FALLING = 1, //!< Digital Compare Edge filter high //!< to low edge mode EPWM_DC_EDGEFILT_MODE_BOTH = 2 //!< Digital Compare Edge filter both //!< edges mode } EPWM_DigitalCompareEdgeFilterMode; //***************************************************************************** // //! Values that can be passed to EPWM_setDigitalCompareEdgeFilterEdgeCount() //! as the \e edgeCount parameter. // //***************************************************************************** typedef enum { EPWM_DC_EDGEFILT_EDGECNT_0 = 0, //!< Digital Compare Edge filter edge //!< count = 0 EPWM_DC_EDGEFILT_EDGECNT_1 = 1, //!< Digital Compare Edge filter edge //!< count = 1 EPWM_DC_EDGEFILT_EDGECNT_2 = 2, //!< Digital Compare Edge filter edge //!< count = 2 EPWM_DC_EDGEFILT_EDGECNT_3 = 3, //!< Digital Compare Edge filter edge //!< count = 3 EPWM_DC_EDGEFILT_EDGECNT_4 = 4, //!< Digital Compare Edge filter edge //!< count = 4 EPWM_DC_EDGEFILT_EDGECNT_5 = 5, //!< Digital Compare Edge filter edge //!< count = 5 EPWM_DC_EDGEFILT_EDGECNT_6 = 6, //!< Digital Compare Edge filter edge //!< count = 6 EPWM_DC_EDGEFILT_EDGECNT_7 = 7 //!< Digital Compare Edge filter edge //!< count = 7 } EPWM_DigitalCompareEdgeFilterEdgeCount; //***************************************************************************** // //! Values that can be passed to EPWM_lockRegisters() as the \e registerGroup //! parameter. // //***************************************************************************** typedef enum { EPWM_REGISTER_GROUP_GLOBAL_LOAD = 0x2, //!< Global load register group EPWM_REGISTER_GROUP_TRIP_ZONE = 0x4, //!< Trip zone register group EPWM_REGISTER_GROUP_TRIP_ZONE_CLEAR = 0x8, //!< Trip zone clear group EPWM_REGISTER_GROUP_DIGITAL_COMPARE = 0x10 //!< Digital compare group } EPWM_LockRegisterGroup; //***************************************************************************** // //! Values that can be passed to EPWM_configureSignal() as the //! \e signalParams parameter. // //***************************************************************************** typedef struct { float32_t freqInHz; //!< Desired Signal Frequency(in Hz) float32_t dutyValA; //!< Desired ePWMxA Signal Duty float32_t dutyValB; //!< Desired ePWMxB Signal Duty _Bool invertSignalB; //!< Invert ePWMxB Signal if true float32_t sysClkInHz; //!< SYSCLK Frequency(in Hz) SysCtl_EPWMCLKDivider epwmClkDiv; //!< EPWM Clock Divider EPWM_TimeBaseCountMode tbCtrMode; //!< Time Base Counter Mode EPWM_ClockDivider tbClkDiv; //!< Time Base Counter Clock Divider EPWM_HSClockDivider tbHSClkDiv; //!< Time Base Counter HS Clock Divider } EPWM_SignalParams; //***************************************************************************** // // Prototypes for the API. // //***************************************************************************** //***************************************************************************** // //! \internal //! Checks ePWM base address. //! //! \param base specifies the ePWM module base address. //! //! This function determines if an ePWM module base address is valid. //! //! \return Returns \b true if the base address is valid and \b false //! otherwise. // //***************************************************************************** static inline _Bool EPWM_isBaseValid(uint32_t base) { return((base == 0x00004000U) || (base == 0x00004100U) || (base == 0x00004200U) || (base == 0x00004300U) || (base == 0x00004400U) || (base == 0x00004500U) || (base == 0x00004600U) || (base == 0x00004700U) || (base == 0x00004800U) || (base == 0x00004900U) || (base == 0x00004A00U) || (base == 0x00004B00U) || (base == 0x00004C00U) || (base == 0x00004D00U) || (base == 0x00004E00U) || (base == 0x00004F00U)); } // // Time Base Sub Module related APIs // //***************************************************************************** // //! Set the time base count //! //! \param base is the base address of the EPWM module. //! \param count is the time base count value. //! //! This function sets the 16 bit counter value of the time base counter. //! //! \return None. // //***************************************************************************** static inline void EPWM_setTimeBaseCounter(uint32_t base, uint16_t count) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 1669); } } while(0); // // Write to TBCTR register // (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) = count; } //***************************************************************************** // //! Set count mode after phase shift sync //! //! \param base is the base address of the EPWM module. //! \param mode is the count mode. //! //! This function sets the time base count to count up or down after a new //! phase value set by the EPWM_setPhaseShift(). The count direction is //! determined by the variable mode. Valid inputs for mode are: //! - EPWM_COUNT_MODE_UP_AFTER_SYNC - Count up after sync //! - EPWM_COUNT_MODE_DOWN_AFTER_SYNC - Count down after sync //! //! \return None. // //***************************************************************************** static inline void EPWM_setCountModeAfterSync(uint32_t base, EPWM_SyncCountMode mode) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 1699); } } while(0); if(mode == EPWM_COUNT_MODE_UP_AFTER_SYNC) { // // Set PHSDIR bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) |= 0x2000U; } else { // // Clear PHSDIR bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) &= ~0x2000U; } } //***************************************************************************** // //! Set the time base clock and the high speed time base clock count pre-scaler //! //! \param base is the base address of the EPWM module. //! \param prescaler is the time base count pre scale value. //! \param highSpeedPrescaler is the high speed time base count pre scale //! value. //! //! This function sets the pre scaler(divider)value for the time base clock //! counter and the high speed time base clock counter. //! Valid values for pre-scaler and highSpeedPrescaler are EPWM_CLOCK_DIVIDER_X, //! where X is 1,2,4,8,16, 32,64 or 128. //! The actual numerical values for these macros represent values 0,1...7. //! The equation for the output clock is: //! TBCLK = EPWMCLK/(highSpeedPrescaler * pre-scaler) //! //! \b Note: EPWMCLK is a scaled version of SYSCLK. At reset EPWMCLK is half //! SYSCLK. //! //! \return None. // //***************************************************************************** static inline void EPWM_setClockPrescaler(uint32_t base, EPWM_ClockDivider prescaler, EPWM_HSClockDivider highSpeedPrescaler) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 1747); } } while(0); // // Write to CLKDIV and HSPCLKDIV bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) & ~(0x1C00U | 0x380U)) | (((uint16_t)prescaler << 10U) | ((uint16_t)highSpeedPrescaler << 7U))); } //***************************************************************************** // //! Force a software sync pulse //! //! \param base is the base address of the EPWM module. //! //! This function causes a single software initiated sync pulse. Make sure the //! appropriate mode is selected using EPWM_setupSyncOutputMode() before using //! this function. //! //! \return None. // //***************************************************************************** static inline void EPWM_forceSyncPulse(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 1778); } } while(0); // // Set SWFSYNC bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) |= 0x40U; } //***************************************************************************** // //! Set up the source for sync-in pulse. //! //! \param base is the base address of the EPWM module. //! \param source is the sync-in pulse source. //! //! This function set the sync out pulse mode. //! Valid values for mode are: //! - EPWM_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM1-16 - sync-in pulse source can be //! any of the EPWM1-16 sync-out //! signal //! - EPWM_SYNC_IN_PULSE_SRC_SYNCOUT_ECAP1-7 - sync-in pulse source can be //! selected as any of the ECAP1-16 //! sync-out signal //! - EPWM_SYNC_IN_PULSE_SRC_INPUTXBAR_OUT5-6 - sync-in pulse source can be //! selected as any of the Input //! xbar out5-6 signal //! - EPWM_SYNC_IN_PULSE_SRC_ETHERCAT_SYNC0-1 - sync-in pulse source can be //! selected as any of the Ethercat //! sync0-1 signal //! - EPWM_SYNC_IN_PULSE_SRC_DISABLE - sync-in pulse is disabled for the //! EPWM module //! //! \return None. // //***************************************************************************** static inline void EPWM_setSyncInPulseSource(uint32_t base, EPWM_SyncInPulseSource source) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 1819); } } while(0); // // Set EPWM Sync-In Source Mode. // (*((volatile uint16_t *)((uintptr_t)(base + 0x3U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x3U)))) & (~0x1FU)) | ((uint16_t)source & 0x1FU); } //***************************************************************************** // //! Enables sync-out pulse source. //! //! \param base is the base address of the EPWM module. //! \param source is the sync-out pulse source. //! //! This function enables the sync-out pulse source. //! Below valid values for param \b source can be OR'd together to enable //! multiple sync-out sources: //! - EPWM_SYNC_OUT_PULSE_ON_SOFTWARE - sync-out pulse is generated by //! software when EPWM_forceSyncPulse() //! function is called or by EPWMxSYNCI //! signal. //! - EPWM_SYNC_OUT_PULSE_ON_CNTR_ZERO - sync-out pulse is generated when //! time base counter equals zero. //! - EPWM_SYNC_OUT_PULSE_ON_CNTR_COMPARE_B - sync-out pulse is generated when //! time base counter equals compare //! B value. //! - EPWM_SYNC_OUT_PULSE_ON_CNTR_COMPARE_C - sync-out pulse is generated when //! time base counter equals compare //! C value. //! - EPWM_SYNC_OUT_PULSE_ON_CNTR_COMPARE_D - sync-out pulse is generated when //! time base counter equals compare //! D value. //! - EPWM_SYNC_OUT_PULSE_ON_DCA_EVT1_SYNC - sync-out pulse is generated by DCA //! event1 sync signal //! - EPWM_SYNC_OUT_PULSE_ON_DCB_EVT1_SYNC - sync-out pulse is generated by DCB //! event1 sync signal //! - EPWM_SYNC_OUT_PULSE_ON_ALL - sync-out pulse is generated by all //! the above sources //! //! \return None. // //***************************************************************************** static inline void EPWM_enableSyncOutPulseSource(uint32_t base, uint16_t source) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 1870); } } while(0); do { if(!(source <= ((uint16_t)0x1U | (uint16_t)0x2U | (uint16_t)0x4U | (uint16_t)0x8U | (uint16_t)0x10U | (uint16_t)0x20U | (uint16_t)0x40U))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 1871); } } while(0); // // Enable selected EPWM Sync-Out Sources. // (*((volatile uint16_t *)((uintptr_t)(base + 0x6U)))) = (*((volatile uint16_t *)((uintptr_t)(base + 0x6U)))) | (uint16_t)source; } //***************************************************************************** // //! Disables sync-out pulse source. //! //! \param base is the base address of the EPWM module. //! \param source is the sync-out pulse source. //! //! This function disables the sync-out pulse source. //! Below valid values for param \b source can be OR'd together to disable //! multiple sync-out sources: //! - EPWM_SYNC_OUT_PULSE_ON_SOFTWARE - disables software as sync-out source //! //! - EPWM_SYNC_OUT_PULSE_ON_CNTR_ZERO - disables counter equal to zero event //! as sync-out source //! - EPWM_SYNC_OUT_PULSE_ON_CNTR_COMPARE_B - disables counter equal to cmpb //! event as sync-out source //! - EPWM_SYNC_OUT_PULSE_ON_CNTR_COMPARE_C - disables counter equal to cmpc //! event as sync-out source //! - EPWM_SYNC_OUT_PULSE_ON_CNTR_COMPARE_D - disables counter equal to cmpd //! event as sync-out source //! - EPWM_SYNC_OUT_PULSE_ON_DCA_EVT1_SYNC - disables DCA event1 sync signal as //! sync-out source //! - EPWM_SYNC_OUT_PULSE_ON_DCB_EVT1_SYNC - disables DCB event1 sync signal as //! sync-out source //! - EPWM_SYNC_OUT_PULSE_ON_ALL - disables all the above sync-out sources //! //! \return None. // //***************************************************************************** static inline void EPWM_disableSyncOutPulseSource(uint32_t base, uint16_t source) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 1915); } } while(0); do { if(!(source <= ((uint16_t)0x1U | (uint16_t)0x2U | (uint16_t)0x4U | (uint16_t)0x8U | (uint16_t)0x10U | (uint16_t)0x20U | (uint16_t)0x40U))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 1916); } } while(0); // // Disable EPWM Sync-Out Sources. // (*((volatile uint16_t *)((uintptr_t)(base + 0x6U)))) = (*((volatile uint16_t *)((uintptr_t)(base + 0x6U)))) & ~((uint16_t)source); } //***************************************************************************** // //! Set up the one-shot sync-out trigger source. //! //! \param base is the base address of the EPWM module. //! \param trigger is the one-shot sync-out signal trigger source. //! //! This function sets the one-shot sync-out trigger source. //! Valid values for param \b trigger are: //! - EPWM_OSHT_SYNC_OUT_TRIG_SYNC - Trigger for one-shot sync-out signal is //! one-shot sync event. //! - EPWM_OSHT_SYNC_OUT_TRIG_RELOAD - Trigger for one-shot sync-out signal is //! one-shot reload event. //! //! \return None. // //***************************************************************************** static inline void EPWM_setOneShotSyncOutTrigger(uint32_t base, EPWM_OneShotSyncOutTrigger trigger) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 1949); } } while(0); // // Set source for One-Shot Sync-Out Pulse. // (*((volatile uint16_t *)((uintptr_t)(base + 0x7U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x7U)))) & ~(0x1U)) | (uint16_t)trigger; } //***************************************************************************** // //! Set PWM period load mode. //! //! \param base is the base address of the EPWM module. //! \param loadMode is the PWM period load mode. //! //! This function sets the load mode for the PWM period. If loadMode is set to //! EPWM_PERIOD_SHADOW_LOAD, a write or read to the TBPRD (PWM Period count //! register) accesses the shadow register. If loadMode is set to //! EPWM_PERIOD_DIRECT_LOAD, a write or read to the TBPRD register accesses the //! register directly. //! //! \return None. // //***************************************************************************** static inline void EPWM_setPeriodLoadMode(uint32_t base, EPWM_PeriodLoadMode loadMode) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 1981); } } while(0); if(loadMode == EPWM_PERIOD_SHADOW_LOAD) { // // Clear PRDLD // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) &= ~0x8U; } else { // // Set PRDLD // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) |= 0x8U; } } //***************************************************************************** // //! Enable phase shift load //! //! \param base is the base address of the EPWM module. //! //! This function enables loading of phase shift when the appropriate sync //! event occurs. //! //! \return None. // //***************************************************************************** static inline void EPWM_enablePhaseShiftLoad(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 2017); } } while(0); // // Set PHSEN bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) |= 0x4U; } //***************************************************************************** // //! Disable phase shift load //! //! \param base is the base address of the EPWM module. //! //! This function disables loading of phase shift. //! //! \return None. // //***************************************************************************** static inline void EPWM_disablePhaseShiftLoad(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 2042); } } while(0); // // Clear PHSEN bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) &= ~0x4U; } //***************************************************************************** // //! Set time base counter mode //! //! \param base is the base address of the EPWM module. //! \param counterMode is the time base counter mode. //! //! This function sets up the time base counter mode. //! Valid values for counterMode are: //! - EPWM_COUNTER_MODE_UP - Up - count mode. //! - EPWM_COUNTER_MODE_DOWN - Down - count mode. //! - EPWM_COUNTER_MODE_UP_DOWN - Up - down - count mode. //! - EPWM_COUNTER_MODE_STOP_FREEZE - Stop - Freeze counter. //! //! \return None. // //***************************************************************************** static inline void EPWM_setTimeBaseCounterMode(uint32_t base, EPWM_TimeBaseCountMode counterMode) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 2073); } } while(0); // // Write to CTRMODE bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) & ~(0x3U)) | ((uint16_t)counterMode)); } //***************************************************************************** // //! Set shadow to active period load on sync mode //! //! \param base is the base address of the EPWM module. //! \param shadowLoadMode is the shadow to active load mode. //! //! This function sets up the shadow to active Period register load mode with //! respect to a sync event. Valid values for shadowLoadMode are: //! - EPWM_SHADOW_LOAD_MODE_COUNTER_ZERO - shadow to active load occurs when //! time base counter reaches 0. //! - EPWM_SHADOW_LOAD_MODE_COUNTER_SYNC - shadow to active load occurs when //! time base counter reaches 0 and a //! SYNC occurs. //! - EPWM_SHADOW_LOAD_MODE_SYNC - shadow to active load occurs only //! when a SYNC occurs. //! //! \return None. // //***************************************************************************** static inline void EPWM_selectPeriodLoadEvent(uint32_t base, EPWM_PeriodShadowLoadMode shadowLoadMode) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 2110); } } while(0); // // Write to PRDLDSYNC bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x1U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x1U)))) & ~(0xC000U)) | ((uint16_t)shadowLoadMode << 14U)); } //***************************************************************************** // //! Enable one shot sync mode //! //! \param base is the base address of the EPWM module. //! //! This function enables one shot sync mode. //! //! \return None. // //***************************************************************************** static inline void EPWM_enableOneShotSync(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 2136); } } while(0); // // Set OSHTSYNCMODE bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x1U)))) |= 0x40U; } //***************************************************************************** // //! Disable one shot sync mode //! //! \param base is the base address of the EPWM module. //! //! This function disables one shot sync mode. //! //! \return None. // //***************************************************************************** static inline void EPWM_disableOneShotSync(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 2161); } } while(0); // // Clear OSHTSYNCMODE bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x1U)))) &= ~0x40U; } //***************************************************************************** // //! Start one shot sync mode //! //! \param base is the base address of the EPWM module. //! //! This function propagates a one shot sync pulse. //! //! \return None. // //***************************************************************************** static inline void EPWM_startOneShotSync(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 2186); } } while(0); // // Set OSHTSYNC bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x1U)))) |= 0x80U; } //***************************************************************************** // //! Returns time base counter value. //! //! \param base is the base address of the EPWM module. //! //! This function returns the current value of the time base counter. //! //! \return returns time base counter value // //***************************************************************************** static inline uint16_t EPWM_getTimeBaseCounterValue(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 2211); } } while(0); // // Returns TBCTR value // return((*((volatile uint16_t *)((uintptr_t)(base + 0x4U))))); } //***************************************************************************** // //! Return time base counter maximum status. //! //! \param base is the base address of the EPWM module. //! //! This function returns the status of the time base max counter. //! //! \return Returns true if the counter has reached 0xFFFF. //! Returns false if the counter hasn't reached 0xFFFF. // //***************************************************************************** static inline _Bool EPWM_getTimeBaseCounterOverflowStatus(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 2237); } } while(0); // // Return true if CTRMAX bit is set, false otherwise // return((((*((volatile uint16_t *)((uintptr_t)(base + 0x5U)))) & 0x4U) == 0x4U) ? 1 : 0); } //***************************************************************************** // //! Clear max time base counter event. //! //! \param base is the base address of the EPWM module. //! //! This function clears the max time base counter latch event. The latch event //! occurs when the time base counter reaches its maximum value of 0xFFFF. //! //! \return None. // //***************************************************************************** static inline void EPWM_clearTimeBaseCounterOverflowEvent(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 2264); } } while(0); // // Set CTRMAX bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x5U)))) |= 0x4U; } //***************************************************************************** // //! Return external sync signal status. //! //! \param base is the base address of the EPWM module. //! //! This function returns the external sync signal status. //! //! \return Returns true if if an external sync signal event //! Returns false if there is no event. // //***************************************************************************** static inline _Bool EPWM_getSyncStatus(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 2290); } } while(0); // // Return true if SYNCI bit is set, false otherwise // return((((*((volatile uint16_t *)((uintptr_t)(base + 0x5U)))) & 0x2U) == 0x2U) ? 1 : 0); } //***************************************************************************** // //! Clear external sync signal event. //! //! \param base is the base address of the EPWM module. //! //! This function clears the external sync signal latch event. //! //! \return None. // //***************************************************************************** static inline void EPWM_clearSyncEvent(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 2316); } } while(0); // // Set SYNCI bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x5U)))) |= 0x2U; } //***************************************************************************** // //! Return time base counter direction. //! //! \param base is the base address of the EPWM module. //! //! This function returns the direction of the time base counter. //! //! \return returns EPWM_TIME_BASE_STATUS_COUNT_UP if the counter is counting //! up or EPWM_TIME_BASE_STATUS_COUNT_DOWN if the counter is //! counting down. // //***************************************************************************** static inline uint16_t EPWM_getTimeBaseCounterDirection(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 2343); } } while(0); // // Return CTRDIR bit // return((*((volatile uint16_t *)((uintptr_t)(base + 0x5U)))) & 0x1U); } //***************************************************************************** // //! Sets the phase shift offset counter value. //! //! \param base is the base address of the EPWM module. //! \param phaseCount is the phase shift count value. //! //! This function sets the 16 bit time-base counter phase of the ePWM relative //! to the time-base that is supplying the synchronization input signal. Call //! the EPWM_enablePhaseShiftLoad() function to enable loading of the //! phaseCount phase shift value when a sync event occurs. //! //! \return None. // //***************************************************************************** static inline void EPWM_setPhaseShift(uint32_t base, uint16_t phaseCount) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 2372); } } while(0); // // Write to TBPHS bit // (*((volatile uint32_t *)((uintptr_t)(base + 0x60U)))) = (((*((volatile uint32_t *)((uintptr_t)(base + 0x60U)))) & ~((uint32_t)0xFFFF0000U)) | ((uint32_t)phaseCount << 16U)); } //***************************************************************************** // //! Sets the PWM period count. //! //! \param base is the base address of the EPWM module. //! \param periodCount is period count value. //! //! This function sets the period of the PWM count. The value of periodCount is //! the value written to the register. User should map the desired period or //! frequency of the waveform into the correct periodCount. //! Invoke the function EPWM_selectPeriodLoadEvent() with the appropriate //! parameter to set the load mode of the Period count. periodCount has a //! maximum valid value of 0xFFFF //! //! \return None. // //***************************************************************************** static inline void EPWM_setTimeBasePeriod(uint32_t base, uint16_t periodCount) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 2406); } } while(0); // // Write to TBPRD bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x63U)))) = periodCount; } //***************************************************************************** // //! Gets the PWM period count. //! //! \param base is the base address of the EPWM module. //! //! This function gets the period of the PWM count. //! //! \return The period count value. // //***************************************************************************** static inline uint16_t EPWM_getTimeBasePeriod(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 2431); } } while(0); // // Read from TBPRD bit // return((*((volatile uint16_t *)((uintptr_t)(base + 0x63U))))); } //***************************************************************************** // //! Sets the EPWM links. //! //! \param base is the base address of the EPWM module. //! \param epwmLink is the ePWM instance to link with. //! \param linkComp is the ePWM component to link. //! //! This function links the component defined in linkComp in the current ePWM //! instance with the linkComp component of the ePWM instance defined by //! epwmLink. A change (a write) in the value of linkComp component of epwmLink //! instance, causes a change in the current ePWM linkComp component. //! For example if the current ePWM is ePWM3 and the values of epwmLink and //! linkComp are EPWM_LINK_WITH_EPWM_1 and EPWM_LINK_COMP_C respectively, //! then a write to COMPC register in ePWM1, will result in a simultaneous //! write to COMPC register in ePWM3. //! Valid values for epwmLink are: //! - EPWM_LINK_WITH_EPWM_1 - link current ePWM with ePWM1 //! - EPWM_LINK_WITH_EPWM_2 - link current ePWM with ePWM2 //! - EPWM_LINK_WITH_EPWM_3 - link current ePWM with ePWM3 //! - EPWM_LINK_WITH_EPWM_4 - link current ePWM with ePWM4 //! - EPWM_LINK_WITH_EPWM_5 - link current ePWM with ePWM5 //! - EPWM_LINK_WITH_EPWM_6 - link current ePWM with ePWM6 //! - EPWM_LINK_WITH_EPWM_7 - link current ePWM with ePWM7 //! - EPWM_LINK_WITH_EPWM_8 - link current ePWM with ePWM8 //! //! Valid values for linkComp are: //! - EPWM_LINK_TBPRD - link TBPRD:TBPRDHR registers //! - EPWM_LINK_COMP_A - link COMPA registers //! - EPWM_LINK_COMP_B - link COMPB registers //! - EPWM_LINK_COMP_C - link COMPC registers //! - EPWM_LINK_COMP_D - link COMPD registers //! - EPWM_LINK_GLDCTL2 - link GLDCTL2 registers //! //! \return None. // //***************************************************************************** static inline void EPWM_setupEPWMLinks(uint32_t base, EPWM_CurrentLink epwmLink, EPWM_LinkComponent linkComp) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 2483); } } while(0); // // Configure EPWM links // (*((volatile uint32_t *)((uintptr_t)(base + 0x38U)))) = (((*((volatile uint32_t *)((uintptr_t)(base + 0x38U)))) & ~((uint32_t)0xFU << linkComp)) | ((uint32_t)epwmLink << linkComp)); } //***************************************************************************** // //! Sets up the Counter Compare shadow load mode //! //! \param base is the base address of the EPWM module. //! \param compModule is the counter compare module. //! \param loadMode is the shadow to active load mode. //! //! This function enables and sets up the counter compare shadow load mode. //! Valid values for the variables are: //! - compModule //! - EPWM_COUNTER_COMPARE_A - counter compare A. //! - EPWM_COUNTER_COMPARE_B - counter compare B. //! - EPWM_COUNTER_COMPARE_C - counter compare C. //! - EPWM_COUNTER_COMPARE_D - counter compare D. //! - loadMode //! - EPWM_COMP_LOAD_ON_CNTR_ZERO - load when counter equals zero //! - EPWM_COMP_LOAD_ON_CNTR_PERIOD - load when counter equals period //! - EPWM_COMP_LOAD_ON_CNTR_ZERO_PERIOD - load when counter equals //! zero or period //! - EPWM_COMP_LOAD_FREEZE - Freeze shadow to active load //! - EPWM_COMP_LOAD_ON_SYNC_CNTR_ZERO - load when counter equals zero //! - EPWM_COMP_LOAD_ON_SYNC_CNTR_PERIOD -load when counter equals period //! - EPWM_COMP_LOAD_ON_SYNC_CNTR_ZERO_PERIOD - load when counter equals //! zero or period //! - EPWM_COMP_LOAD_ON_SYNC_ONLY - load on sync only //! //! \return None. // //***************************************************************************** static inline void EPWM_setCounterCompareShadowLoadMode(uint32_t base, EPWM_CounterCompareModule compModule, EPWM_CounterCompareLoadMode loadMode) { uint16_t syncModeOffset; uint16_t loadModeOffset; uint16_t shadowModeOffset; uint32_t registerOffset; // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 2536); } } while(0); if((compModule == EPWM_COUNTER_COMPARE_A) || (compModule == EPWM_COUNTER_COMPARE_C)) { syncModeOffset = 10U; loadModeOffset = 0U; shadowModeOffset = 4U; } else { syncModeOffset = 12U; loadModeOffset = 2U; shadowModeOffset = 6U; } // // Get the register offset. EPWM_O_CMPCTL for A&B or // EPWM_O_CMPCTL2 for C&D // registerOffset = base + 0x8U + ((uint32_t)compModule & 0x1U); // // Set the appropriate sync and load mode bits and also enable shadow // load mode. Shadow to active load can also be frozen. // (*((volatile uint16_t *)((uintptr_t)(registerOffset)))) = (((*((volatile uint16_t *)((uintptr_t)(registerOffset)))) & ~((0x3U << syncModeOffset) | // Clear sync mode (0x3U << loadModeOffset) | // Clear load mode (0x1U << shadowModeOffset))) | // shadow mode ((((uint16_t)loadMode >> 2U) << syncModeOffset) | (((uint16_t)loadMode & 0x3U) << loadModeOffset))); } //***************************************************************************** // //! Disable Counter Compare shadow load mode //! //! \param base is the base address of the EPWM module. //! \param compModule is the counter compare module. //! //! This function disables counter compare shadow load mode. //! Valid values for the variables are: //! - compModule //! - EPWM_COUNTER_COMPARE_A - counter compare A. //! - EPWM_COUNTER_COMPARE_B - counter compare B. //! - EPWM_COUNTER_COMPARE_C - counter compare C. //! - EPWM_COUNTER_COMPARE_D - counter compare D. //! //! \return None. // //***************************************************************************** static inline void EPWM_disableCounterCompareShadowLoadMode(uint32_t base, EPWM_CounterCompareModule compModule) { uint16_t shadowModeOffset; uint32_t registerOffset; // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 2598); } } while(0); if((compModule == EPWM_COUNTER_COMPARE_A) || (compModule == EPWM_COUNTER_COMPARE_C)) { shadowModeOffset = 4U; } else { shadowModeOffset = 6U; } // // Get the register offset. EPWM_O_CMPCTL for A&B or // EPWM_O_CMPCTL2 for C&D // registerOffset = base + 0x8U + ((uint32_t)compModule & 0x1U); // // Disable shadow load mode. // (*((volatile uint16_t *)((uintptr_t)(registerOffset)))) = ((*((volatile uint16_t *)((uintptr_t)(registerOffset)))) | (0x1U << shadowModeOffset)); } //***************************************************************************** // //! Set counter compare values. //! //! \param base is the base address of the EPWM module. //! \param compModule is the Counter Compare value module. //! \param compCount is the counter compare count value. //! //! This function sets the counter compare value for counter compare registers. //! The maximum value for compCount is 0xFFFF. //! Valid values for compModule are: //! - EPWM_COUNTER_COMPARE_A - counter compare A. //! - EPWM_COUNTER_COMPARE_B - counter compare B. //! - EPWM_COUNTER_COMPARE_C - counter compare C. //! - EPWM_COUNTER_COMPARE_D - counter compare D. //! //! \return None. // //***************************************************************************** static inline void EPWM_setCounterCompareValue(uint32_t base, EPWM_CounterCompareModule compModule, uint16_t compCount) { uint32_t registerOffset; // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 2651); } } while(0); // // Get the register offset for the Counter compare // registerOffset = 0x6AU + (uint16_t)compModule; // // Write to the counter compare registers. // if((compModule == EPWM_COUNTER_COMPARE_A) || (compModule == EPWM_COUNTER_COMPARE_B)) { // // Write to COMPA or COMPB bits // (*((volatile uint16_t *)((uintptr_t)(base + registerOffset + 0x1U)))) = compCount; } else { // // Write to COMPC or COMPD bits // (*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) = compCount; } } //***************************************************************************** // //! Get counter compare values. //! //! \param base is the base address of the EPWM module. //! \param compModule is the Counter Compare value module. //! //! This function gets the counter compare value for counter compare registers. //! Valid values for compModule are: //! - EPWM_COUNTER_COMPARE_A - counter compare A. //! - EPWM_COUNTER_COMPARE_B - counter compare B. //! - EPWM_COUNTER_COMPARE_C - counter compare C. //! - EPWM_COUNTER_COMPARE_D - counter compare D. //! //! \return The counter compare count value. // //***************************************************************************** static inline uint16_t EPWM_getCounterCompareValue(uint32_t base, EPWM_CounterCompareModule compModule) { uint32_t registerOffset; uint16_t compCount; // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 2704); } } while(0); // // Get the register offset for the Counter compare // registerOffset = 0x6AU + (uint16_t)compModule; // // Read from the counter compare registers. // if((compModule == EPWM_COUNTER_COMPARE_A) || (compModule == EPWM_COUNTER_COMPARE_B)) { // // Read COMPA or COMPB bits // compCount = (uint16_t)(((*((volatile uint32_t *)((uintptr_t)(base + registerOffset)))) & (uint32_t)0xFFFF0000U) >> 16U); } else { // // Read COMPC or COMPD bits // compCount = (*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))); } return(compCount); } //***************************************************************************** // //! Return the counter compare shadow register full status. //! //! \param base is the base address of the EPWM module. //! \param compModule is the Counter Compare value module. //! //! This function returns the counter Compare shadow register full status flag. //! Valid values for compModule are: //! - EPWM_COUNTER_COMPARE_A - counter compare A. //! - EPWM_COUNTER_COMPARE_B - counter compare B. //! //! \return Returns true if the shadow register is full. //! Returns false if the shadow register is not full. // //***************************************************************************** static inline _Bool EPWM_getCounterCompareShadowStatus(uint32_t base, EPWM_CounterCompareModule compModule) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 2756); } } while(0); // // Read the value of SHDWAFULL or SHDWBFULL bit // return(((((*((volatile uint32_t *)((uintptr_t)(base + 0x8U)))) >> ((((uint16_t)compModule >> 1U) & 0x1U) + 8U)) & 0x1U) == 0x1U) ? 1:0); } // // Action Qualifier module related APIs // //***************************************************************************** // //! Sets the Action Qualifier shadow load mode //! //! \param base is the base address of the EPWM module. //! \param aqModule is the Action Qualifier module value. //! \param loadMode is the shadow to active load mode. //! //! This function enables and sets the Action Qualifier shadow load mode. //! Valid values for the variables are: //! - aqModule //! - EPWM_ACTION_QUALIFIER_A - Action Qualifier A. //! - EPWM_ACTION_QUALIFIER_B - Action Qualifier B. //! - loadMode //! - EPWM_AQ_LOAD_ON_CNTR_ZERO - load when counter equals zero //! - EPWM_AQ_LOAD_ON_CNTR_PERIOD - load when counter equals period //! - EPWM_AQ_LOAD_ON_CNTR_ZERO_PERIOD - load when counter equals //! zero or period //! - EPWM_AQ_LOAD_FREEZE - Freeze shadow to active load //! - EPWM_AQ_LOAD_ON_SYNC_CNTR_ZERO - load on sync or when counter //! equals zero //! - EPWM_AQ_LOAD_ON_SYNC_CNTR_PERIOD - load on sync or when counter //! equals period //! - EPWM_AQ_LOAD_ON_SYNC_CNTR_ZERO_PERIOD - load on sync or when //! counter equals zero or period //! - EPWM_AQ_LOAD_ON_SYNC_ONLY - load on sync only //! //! \return None. // //***************************************************************************** static inline void EPWM_setActionQualifierShadowLoadMode(uint32_t base, EPWM_ActionQualifierModule aqModule, EPWM_ActionQualifierLoadMode loadMode) { uint16_t syncModeOffset; uint16_t shadowModeOffset; // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 2810); } } while(0); syncModeOffset = 8U + (uint16_t)aqModule; shadowModeOffset = 4U + (uint16_t)aqModule; // // Set the appropriate sync and load mode bits and also enable shadow // load mode. Shadow to active load can also be frozen. // (*((volatile uint16_t *)((uintptr_t)(base + 0x10U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x10U)))) & (~((0x3U << (uint16_t)aqModule) | (0x3U << (uint16_t)syncModeOffset))) | (0x1U << shadowModeOffset)) | ((((uint16_t)loadMode >> 2U) << syncModeOffset) | (((uint16_t)loadMode & 0x3U) << (uint16_t)aqModule))); } //***************************************************************************** // //! Disable Action Qualifier shadow load mode //! //! \param base is the base address of the EPWM module. //! \param aqModule is the Action Qualifier module value. //! //! This function disables the Action Qualifier shadow load mode. //! Valid values for the variables are: //! - aqModule //! - EPWM_ACTION_QUALIFIER_A - Action Qualifier A. //! - EPWM_ACTION_QUALIFIER_B - Action Qualifier B. //! //! \return None. // //***************************************************************************** static inline void EPWM_disableActionQualifierShadowLoadMode(uint32_t base, EPWM_ActionQualifierModule aqModule) { uint16_t shadowModeOffset; // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 2853); } } while(0); shadowModeOffset = 4U + (uint16_t)aqModule; // // Disable shadow load mode. Action qualifier is loaded on // immediate mode only. // (*((volatile uint16_t *)((uintptr_t)(base + 0x10U)))) &= ~(1U << shadowModeOffset); } //***************************************************************************** // //! Set up Action qualifier trigger source for event T1 //! //! \param base is the base address of the EPWM module. //! \param trigger sources for Action Qualifier triggers. //! //! This function sets up the sources for Action Qualifier event T1. //! Valid values for trigger are: //! - EPWM_AQ_TRIGGER_EVENT_TRIG_DCA_1 - Digital compare event A 1 //! - EPWM_AQ_TRIGGER_EVENT_TRIG_DCA_2 - Digital compare event A 2 //! - EPWM_AQ_TRIGGER_EVENT_TRIG_DCB_1 - Digital compare event B 1 //! - EPWM_AQ_TRIGGER_EVENT_TRIG_DCB_2 - Digital compare event B 2 //! - EPWM_AQ_TRIGGER_EVENT_TRIG_TZ_1 - Trip zone 1 //! - EPWM_AQ_TRIGGER_EVENT_TRIG_TZ_2 - Trip zone 2 //! - EPWM_AQ_TRIGGER_EVENT_TRIG_TZ_3 - Trip zone 3 //! - EPWM_AQ_TRIGGER_EVENT_TRIG_EPWM_SYNCIN - ePWM sync //! - EPWM_AQ_TRIGGER_EVENT_TRIG_DC_EVTFILT - Digital compare filter event //! //! \return None. // //***************************************************************************** static inline void EPWM_setActionQualifierT1TriggerSource(uint32_t base, EPWM_ActionQualifierTriggerSource trigger) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 2893); } } while(0); // // Set T1 trigger source // (*((volatile uint16_t *)((uintptr_t)(base + 0x11U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x11U)))) & (~0xFU)) | ((uint16_t)trigger)); } //***************************************************************************** // //! Set up Action qualifier trigger source for event T2 //! //! \param base is the base address of the EPWM module. //! \param trigger sources for Action Qualifier triggers. //! //! This function sets up the sources for Action Qualifier event T2. //! Valid values for trigger are: //! - EPWM_AQ_TRIGGER_EVENT_TRIG_DCA_1 - Digital compare event A 1 //! - EPWM_AQ_TRIGGER_EVENT_TRIG_DCA_2 - Digital compare event A 2 //! - EPWM_AQ_TRIGGER_EVENT_TRIG_DCB_1 - Digital compare event B 1 //! - EPWM_AQ_TRIGGER_EVENT_TRIG_DCB_2 - Digital compare event B 2 //! - EPWM_AQ_TRIGGER_EVENT_TRIG_TZ_1 - Trip zone 1 //! - EPWM_AQ_TRIGGER_EVENT_TRIG_TZ_2 - Trip zone 2 //! - EPWM_AQ_TRIGGER_EVENT_TRIG_TZ_3 - Trip zone 3 //! - EPWM_AQ_TRIGGER_EVENT_TRIG_EPWM_SYNCIN - ePWM sync //! - EPWM_AQ_TRIGGER_EVENT_TRIG_DC_EVTFILT - Digital compare filter event //! //! \return None. // //***************************************************************************** static inline void EPWM_setActionQualifierT2TriggerSource(uint32_t base, EPWM_ActionQualifierTriggerSource trigger) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 2932); } } while(0); // // Set T2 trigger source // (*((volatile uint16_t *)((uintptr_t)(base + 0x11U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x11U)))) & (~0xF0U)) | ((uint16_t)trigger << 4U)); } //***************************************************************************** // //! Set up Action qualifier outputs //! //! \param base is the base address of the EPWM module. //! \param epwmOutput is the ePWM pin type. //! \param output is the Action Qualifier output. //! \param event is the event that causes a change in output. //! //! This function sets up the Action Qualifier output on ePWM A or ePWMB, //! depending on the value of epwmOutput, to a value specified by outPut based //! on the input events - specified by event. //! The following are valid values for the parameters. //! - epwmOutput //! - EPWM_AQ_OUTPUT_A - ePWMxA output //! - EPWM_AQ_OUTPUT_B - ePWMxB output //! - output //! - EPWM_AQ_OUTPUT_NO_CHANGE - No change in the output pins //! - EPWM_AQ_OUTPUT_LOW - Set output pins to low //! - EPWM_AQ_OUTPUT_HIGH - Set output pins to High //! - EPWM_AQ_OUTPUT_TOGGLE - Toggle the output pins //! - event //! - EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO - Time base counter equals //! zero //! - EPWM_AQ_OUTPUT_ON_TIMEBASE_PERIOD - Time base counter equals //! period //! - EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA - Time base counter up equals //! COMPA //! - EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA - Time base counter down //! equals COMPA //! - EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPB - Time base counter up equals //! COMPB //! - EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPB - Time base counter down //! equals COMPB //! - EPWM_AQ_OUTPUT_ON_T1_COUNT_UP - T1 event on count up //! - EPWM_AQ_OUTPUT_ON_T1_COUNT_DOWN - T1 event on count down //! - EPWM_AQ_OUTPUT_ON_T2_COUNT_UP - T2 event on count up //! - EPWM_AQ_OUTPUT_ON_T2_COUNT_DOWN - T2 event on count down //! //! \return None. // //***************************************************************************** static inline void EPWM_setActionQualifierAction(uint32_t base, EPWM_ActionQualifierOutputModule epwmOutput, EPWM_ActionQualifierOutput output, EPWM_ActionQualifierOutputEvent event) { uint32_t registerOffset; uint32_t registerTOffset; // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 2996); } } while(0); // // Get the register offset // registerOffset = 0x40U + (uint16_t)epwmOutput; registerTOffset = 0x41U + (uint16_t)epwmOutput; // // If the event occurs on T1 or T2 events // if(((uint16_t)event & 0x1U) == 1U) { // // Write to T1U,T1D,T2U or T2D of AQCTLA2 register // (*((volatile uint16_t *)((uintptr_t)(base + registerTOffset)))) = (((*((volatile uint16_t *)((uintptr_t)(base + registerTOffset)))) & ~(3U << ((uint16_t)event - 1U))) | ((uint16_t)output << ((uint16_t)event - 1U))); } else { // // Write to ZRO,PRD,CAU,CAD,CBU or CBD bits of AQCTLA register // (*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) = (((*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) & ~(3U << (uint16_t)event)) | ((uint16_t)output << (uint16_t)event)); } } //***************************************************************************** // //! Set up Action qualifier event outputs //! //! \param base is the base address of the EPWM module. //! \param epwmOutput is the ePWM pin type. //! \param action is the desired action when the specified event occurs //! //! This function sets up the Action Qualifier output on ePWMA or ePWMB, //! depending on the value of epwmOutput, to a value specified by action. //! Valid action param values from different time base counter scenarios //! should be OR'd together to configure complete action for a pwm output. //! The following are valid values for the parameters. //! - epwmOutput //! - EPWM_AQ_OUTPUT_A - ePWMxA output //! - EPWM_AQ_OUTPUT_B - ePWMxB output //! //! - action //! - When time base counter equals zero //! - EPWM_AQ_OUTPUT_NO_CHANGE_ZERO - Time base counter equals zero //! and no change in output pins //! - EPWM_AQ_OUTPUT_LOW_ZERO - Time base counter equals zero //! and set output pins to low //! - EPWM_AQ_OUTPUT_HIGH_ZERO - Time base counter equals zero //! and set output pins to high //! - EPWM_AQ_OUTPUT_TOGGLE_ZERO - Time base counter equals zero //! and toggle the output pins //! - When time base counter equals period //! - EPWM_AQ_OUTPUT_NO_CHANGE_PERIOD - Time base counter equals period //! and no change in output pins //! - EPWM_AQ_OUTPUT_LOW_PERIOD - Time base counter equals period //! and set output pins to low //! - EPWM_AQ_OUTPUT_HIGH_PERIOD - Time base counter equals period //! and set output pins to high //! - EPWM_AQ_OUTPUT_TOGGLE_PERIOD - Time base counter equals period //! and toggle the output pins //! - When time base counter equals CMPA during up-count //! - EPWM_AQ_OUTPUT_NO_CHANGE_UP_CMPA - Time base counter up equals //! COMPA and no change in the //! output pins //! - EPWM_AQ_OUTPUT_LOW_UP_CMPA - Time base counter up equals //! COMPA and set output pins low //! - EPWM_AQ_OUTPUT_HIGH_UP_CMPA - Time base counter up equals //! COMPA and set output pins high //! - EPWM_AQ_OUTPUT_TOGGLE_UP_CMPA - Time base counter up equals //! COMPA and toggle output pins //! - When time base counter equals CMPA during down-count //! - EPWM_AQ_OUTPUT_NO_CHANGE_DOWN_CMPA - Time base counter down equals //! COMPA and no change in the //! output pins //! - EPWM_AQ_OUTPUT_LOW_DOWN_CMPA - Time base counter down equals //! COMPA and set output pins low //! - EPWM_AQ_OUTPUT_HIGH_DOWN_CMPA - Time base counter down equals //! COMPA and set output pins high //! - EPWM_AQ_OUTPUT_TOGGLE_DOWN_CMPA - Time base counter down equals //! COMPA and toggle output pins //! - When time base counter equals CMPB during up-count //! - EPWM_AQ_OUTPUT_NO_CHANGE_UP_CMPB - Time base counter up equals //! COMPB and no change in the //! output pins //! - EPWM_AQ_OUTPUT_LOW_UP_CMPB - Time base counter up equals //! COMPB and set output pins low //! - EPWM_AQ_OUTPUT_HIGH_UP_CMPB - Time base counter up equals //! COMPB and set output pins high //! - EPWM_AQ_OUTPUT_TOGGLE_UP_CMPB - Time base counter up equals //! COMPB and toggle output pins //! - When time base counter equals CMPB during down-count //! - EPWM_AQ_OUTPUT_NO_CHANGE_DOWN_CMPB- Time base counter down equals //! COMPB and no change in the //! output pins //! - EPWM_AQ_OUTPUT_LOW_DOWN_CMPB - Time base counter down equals //! COMPB and set output pins low //! - EPWM_AQ_OUTPUT_HIGH_DOWN_CMPB - Time base counter down equals //! COMPB and set output pins high //! - EPWM_AQ_OUTPUT_TOGGLE_DOWN_CMPB - Time base counter down equals //! COMPB and toggle output pins //! //! \b note: A logical OR of the valid values should be passed as the action //! parameter. Single action should be configured for each time base //! counter scenario. //! //! \return None. // //***************************************************************************** static inline void EPWM_setActionQualifierActionComplete(uint32_t base, EPWM_ActionQualifierOutputModule epwmOutput, uint16_t action) { uint32_t registerOffset; // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 3121); } } while(0); // // Get the register offset // registerOffset = 0x40U + (uint16_t)epwmOutput; // // Write to ZRO, PRD, CAU, CAD, CBU or CBD bits of AQCTLA register // (*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) = (uint16_t)action; } //***************************************************************************** // //! Set up Additional action qualifier event outputs //! //! \param base is the base address of the EPWM module. //! \param epwmOutput is the ePWM pin type. //! \param action is the desired action when the specified event occurs //! //! This function sets up the Additional Action Qualifier output on ePWMA or //! ePWMB depending on the value of epwmOutput, to a value specified by action. //! Valid action param values from different event scenarios should be OR'd //! together to configure complete action for a pwm output. //! The following are valid values for the parameters. //! - epwmOutput //! - EPWM_AQ_OUTPUT_A - ePWMxA output //! - EPWM_AQ_OUTPUT_B - ePWMxB output //! - action //! - When T1 event occurs during up-count //! - EPWM_AQ_OUTPUT_NO_CHANGE_UP_T1 - T1 event on count up //! and no change in output pins //! - EPWM_AQ_OUTPUT_LOW_UP_T1 - T1 event on count up //! and set output pins to low //! - EPWM_AQ_OUTPUT_HIGH_UP_T1 - T1 event on count up //! and set output pins to high //! - EPWM_AQ_OUTPUT_TOGGLE_UP_T1 - T1 event on count up //! and toggle the output pins //! - When T1 event occurs during down-count //! - EPWM_AQ_OUTPUT_NO_CHANGE_DOWN_T1- T1 event on count down //! and no change in output pins //! - EPWM_AQ_OUTPUT_LOW_DOWN_T1 - T1 event on count down //! and set output pins to low //! - EPWM_AQ_OUTPUT_HIGH_DOWN_T1 - T1 event on count down //! and set output pins to high //! - EPWM_AQ_OUTPUT_TOGGLE_DOWN_T1 - T1 event on count down //! and toggle the output pins //! - When T2 event occurs during up-count //! - EPWM_AQ_OUTPUT_NO_CHANGE_UP_T2 - T2 event on count up //! and no change in output pins //! - EPWM_AQ_OUTPUT_LOW_UP_T2 - T2 event on count up //! and set output pins to low //! - EPWM_AQ_OUTPUT_HIGH_UP_T2 - T2 event on count up //! and set output pins to high //! - EPWM_AQ_OUTPUT_TOGGLE_UP_T2 - T2 event on count up //! and toggle the output pins //! - When T2 event occurs during down-count //! - EPWM_AQ_OUTPUT_NO_CHANGE_DOWN_T2 - T2 event on count down //! and no change in output pins //! - EPWM_AQ_OUTPUT_LOW_DOWN_T2 - T2 event on count down //! and set output pins to low //! - EPWM_AQ_OUTPUT_HIGH_DOWN_T2 - T2 event on count down //! and set output pins to high //! - EPWM_AQ_OUTPUT_TOGGLE_DOWN_T2 - T2 event on count down //! and toggle the output pins //! //! \b note: A logical OR of the valid values should be passed as the action //! parameter. Single action should be configured for each event //! scenario. //! //! \return None. // //***************************************************************************** static inline void EPWM_setAdditionalActionQualifierActionComplete(uint32_t base, EPWM_ActionQualifierOutputModule epwmOutput, uint16_t action) { uint32_t registerTOffset; // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 3205); } } while(0); // // Get the register offset // registerTOffset = 0x41U + (uint16_t)epwmOutput; // // Write to T1U, T1D, T2U or T2D of AQCTLA2 register // (*((volatile uint16_t *)((uintptr_t)(base + registerTOffset)))) = (uint16_t)action; } //***************************************************************************** // //! Sets up Action qualifier continuous software load mode. //! //! \param base is the base address of the EPWM module. //! \param mode is the mode for shadow to active load mode. //! //! This function sets up the AQCFRSC register load mode for continuous //! software force reload mode. The software force actions are determined by //! the EPWM_setActionQualifierContSWForceAction() function. //! Valid values for mode are: //! - EPWM_AQ_SW_SH_LOAD_ON_CNTR_ZERO - shadow mode load when counter //! equals zero //! - EPWM_AQ_SW_SH_LOAD_ON_CNTR_PERIOD - shadow mode load when counter //! equals period //! - EPWM_AQ_SW_SH_LOAD_ON_CNTR_ZERO_PERIOD - shadow mode load when counter //! equals zero or period //! - EPWM_AQ_SW_IMMEDIATE_LOAD - immediate mode load only //! //! \return None. // //***************************************************************************** static inline void EPWM_setActionQualifierContSWForceShadowMode(uint32_t base, EPWM_ActionQualifierContForce mode) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 3247); } } while(0); // // Set the Action qualifier software action reload mode. // Write to RLDCSF bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x47U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x47U)))) & ~0xC0U) | ((uint16_t)mode << 6U)); } //***************************************************************************** // //! Triggers a continuous software forced event. //! //! \param base is the base address of the EPWM module. //! \param epwmOutput is the ePWM pin type. //! \param output is the Action Qualifier output. //! //! This function triggers a continuous software forced Action Qualifier output //! on ePWM A or B based on the value of epwmOutput. //! Valid values for the parameters are: //! - epwmOutput //! - EPWM_AQ_OUTPUT_A - ePWMxA output //! - EPWM_AQ_OUTPUT_B - ePWMxB output //! - output //! - EPWM_AQ_SW_DISABLED - Software forcing disabled. //! - EPWM_AQ_OUTPUT_LOW - Set output pins to low //! - EPWM_AQ_OUTPUT_HIGH - Set output pins to High //! //! \return None. // //***************************************************************************** static inline void EPWM_setActionQualifierContSWForceAction(uint32_t base, EPWM_ActionQualifierOutputModule epwmOutput, EPWM_ActionQualifierSWOutput output) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 3288); } } while(0); // // Initiate a continuous software forced output // if(epwmOutput == EPWM_AQ_OUTPUT_A) { (*((volatile uint16_t *)((uintptr_t)(base + 0x49U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x49U)))) & ~0x3U) | ((uint16_t)output)); } else { (*((volatile uint16_t *)((uintptr_t)(base + 0x49U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x49U)))) & ~0xCU) | ((uint16_t)output << 2U)) ; } } //***************************************************************************** // //! Set up one time software forced Action qualifier outputs //! //! \param base is the base address of the EPWM module. //! \param epwmOutput is the ePWM pin type. //! \param output is the Action Qualifier output. //! //! This function sets up the one time software forced Action Qualifier output //! on ePWM A or ePWMB, depending on the value of epwmOutput to a value //! specified by outPut. //! The following are valid values for the parameters. //! - epwmOutput //! - EPWM_AQ_OUTPUT_A - ePWMxA output //! - EPWM_AQ_OUTPUT_B - ePWMxB output //! - output //! - EPWM_AQ_OUTPUT_NO_CHANGE - No change in the output pins //! - EPWM_AQ_OUTPUT_LOW - Set output pins to low //! - EPWM_AQ_OUTPUT_HIGH - Set output pins to High //! - EPWM_AQ_OUTPUT_TOGGLE - Toggle the output pins //! //! \return None. // //***************************************************************************** static inline void EPWM_setActionQualifierSWAction(uint32_t base, EPWM_ActionQualifierOutputModule epwmOutput, EPWM_ActionQualifierOutput output) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 3339); } } while(0); // // Set the one time software forced action // if(epwmOutput == EPWM_AQ_OUTPUT_A) { (*((volatile uint16_t *)((uintptr_t)(base + 0x47U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x47U)))) & ~0x3U) | ((uint16_t)output)); } else { (*((volatile uint16_t *)((uintptr_t)(base + 0x47U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x47U)))) & ~0x18U) | ((uint16_t)output << 3U)); } } //***************************************************************************** // //! Triggers a one time software forced event on Action qualifier //! //! \param base is the base address of the EPWM module. //! \param epwmOutput is the ePWM pin type. //! //! This function triggers a one time software forced Action Qualifier event //! on ePWM A or B based on the value of epwmOutput. //! Valid values for epwmOutput are: //! - EPWM_AQ_OUTPUT_A - ePWMxA output //! - EPWM_AQ_OUTPUT_B - ePWMxB output //! //! \return None. // //***************************************************************************** static inline void EPWM_forceActionQualifierSWAction(uint32_t base, EPWM_ActionQualifierOutputModule epwmOutput) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 3381); } } while(0); // // Initiate a software forced event // if(epwmOutput == EPWM_AQ_OUTPUT_A) { (*((volatile uint16_t *)((uintptr_t)(base + 0x47U)))) |= 0x4U; } else { (*((volatile uint16_t *)((uintptr_t)(base + 0x47U)))) |= 0x20U; } } // // Dead Band Module related APIs // //***************************************************************************** // //! Sets Dead Band signal output swap mode. //! //! \param base is the base address of the EPWM module. //! \param output is the ePWM Dead Band output. //! \param enableSwapMode is the output swap mode. //! //! This function sets up the output signal swap mode. For example if the //! output variable is set to EPWM_DB_OUTPUT_A and enableSwapMode is true, then //! the ePWM A output gets its signal from the ePWM B signal path. Valid values //! for the input variables are: //! - output //! - EPWM_DB_OUTPUT_A - ePWM output A //! - EPWM_DB_OUTPUT_B - ePWM output B //! - enableSwapMode //! - true - the output is swapped //! - false - the output and the signal path are the same. //! //! \return None. // //***************************************************************************** static inline void EPWM_setDeadBandOutputSwapMode(uint32_t base, EPWM_DeadBandOutput output, _Bool enableSwapMode) { uint16_t mask; // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 3430); } } while(0); mask = (uint16_t)1U << ((uint16_t)output + 12U); if(enableSwapMode) { // // Set the appropriate outswap bit to swap output // (*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) | mask); } else { // // Clear the appropriate outswap bit to disable output swap // (*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) & ~mask); } } //***************************************************************************** // //! Sets Dead Band signal output mode. //! //! \param base is the base address of the EPWM module. //! \param delayMode is the Dead Band delay type. //! \param enableDelayMode is the dead band delay mode. //! //! This function sets up the dead band delay mode. The delayMode variable //! determines if the applied delay is Rising Edge or Falling Edge. The //! enableDelayMode determines if a dead band delay should be applied. //! Valid values for the variables are: //! - delayMode //! - EPWM_DB_RED - Rising Edge delay //! - EPWM_DB_FED - Falling Edge delay //! - enableDelayMode //! - true - Falling edge or Rising edge delay is applied. //! - false - Dead Band delay is bypassed. //! //! \return None. // //***************************************************************************** static inline void EPWM_setDeadBandDelayMode(uint32_t base, EPWM_DeadBandDelayMode delayMode, _Bool enableDelayMode) { uint16_t mask; // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 3481); } } while(0); mask = 1U << ((uint16_t)(delayMode + 0U)); if(enableDelayMode) { // // Set the appropriate outmode bit to enable Dead Band delay // (*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) | mask); } else { // // Clear the appropriate outswap bit to disable output swap // (*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) & ~ mask); } } //***************************************************************************** // //! Sets Dead Band delay polarity. //! //! \param base is the base address of the EPWM module. //! \param delayMode is the Dead Band delay type. //! \param polarity is the polarity of the delayed signal. //! //! This function sets up the polarity as determined by the variable polarity //! of the Falling Edge or Rising Edge delay depending on the value of //! delayMode. Valid values for the variables are: //! - delayMode //! - EPWM_DB_RED - Rising Edge delay //! - EPWM_DB_FED - Falling Edge delay //! - polarity //! - EPWM_DB_POLARITY_ACTIVE_HIGH - polarity is not inverted. //! - EPWM_DB_POLARITY_ACTIVE_LOW - polarity is inverted. //! //! \return None. // //***************************************************************************** static inline void EPWM_setDeadBandDelayPolarity(uint32_t base, EPWM_DeadBandDelayMode delayMode, EPWM_DeadBandPolarity polarity) { uint16_t shift; // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 3532); } } while(0); shift = (((uint16_t)delayMode ^ 0x1U) + 2U); // // Set the appropriate polsel bits for dead band polarity // (*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) & ~ (1U << shift)) | ((uint16_t)polarity << shift)); } //***************************************************************************** // //! Sets Rising Edge Dead Band delay input. //! //! \param base is the base address of the EPWM module. //! \param input is the input signal to the dead band. //! //! This function sets up the rising Edge delay input signal. //! Valid values for input are: //! - EPWM_DB_INPUT_EPWMA - Input signal is ePWMA( Valid for both Falling //! Edge and Rising Edge) //! - EPWM_DB_INPUT_EPWMB - Input signal is ePWMB( Valid for both Falling //! Edge and Rising Edge) //! //! \return None. // //***************************************************************************** static inline void EPWM_setRisingEdgeDeadBandDelayInput(uint32_t base, uint16_t input) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 3567); } } while(0); do { if(!((input == 0U) || (input == 1U))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 3569); } } while(0); // // Set the Rising Edge Delay input // (*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) & ~(1U << (4U))) | (input << 4U)); } //***************************************************************************** // //! Sets Dead Band delay input. //! //! \param base is the base address of the EPWM module. //! \param input is the input signal to the dead band. //! //! This function sets up the rising Edge delay input signal. //! Valid values for input are: //! - EPWM_DB_INPUT_EPWMA - Input signal is ePWMA(Valid for both Falling //! Edge and Rising Edge) //! - EPWM_DB_INPUT_EPWMB - Input signal is ePWMB(Valid for both Falling //! Edge and Rising Edge) //! - EPWM_DB_INPUT_DB_RED - Input signal is the output of Rising //! Edge delay. //! (Valid only for Falling Edge delay) //! //! \return None. // //***************************************************************************** static inline void EPWM_setFallingEdgeDeadBandDelayInput(uint32_t base, uint16_t input) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 3605); } } while(0); do { if(!((input == 0U) || (input == 1U) || (input == 2U))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 3608); } } while(0); if(input == 2U) { // // Set the Falling Edge Delay input // (*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) |= 0x4000U; } else { // // Set the Falling Edge Delay input // (*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) &= ~0x4000U; // // Set the Rising Edge Delay input // (*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) & ~(1U << (4U + 1U))) | (input << (4U + 1U))); } } //***************************************************************************** // //! Set the Dead Band control shadow load mode. //! //! \param base is the base address of the EPWM module. //! \param loadMode is the shadow to active load mode. //! //! This function enables and sets the Dead Band control register shadow //! load mode. //! Valid values for the \e loadMode parameter are: //! - EPWM_DB_LOAD_ON_CNTR_ZERO - load when counter equals zero. //! - EPWM_DB_LOAD_ON_CNTR_PERIOD - load when counter equals period. //! - EPWM_DB_LOAD_ON_CNTR_ZERO_PERIOD - load when counter equals zero or //! period. //! - EPWM_DB_LOAD_FREEZE - Freeze shadow to active load. //! //! \return None. // //***************************************************************************** static inline void EPWM_setDeadBandControlShadowLoadMode(uint32_t base, EPWM_DeadBandControlLoadMode loadMode) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 3659); } } while(0); // // Enable the shadow mode and setup the load event // (*((volatile uint16_t *)((uintptr_t)(base + 0xDU)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0xDU)))) & ~0x3U) | (0x4U | (uint16_t)loadMode)); } //***************************************************************************** // //! Disable Dead Band control shadow load mode. //! //! \param base is the base address of the EPWM module. //! //! This function disables the Dead Band control register shadow //! load mode. //! //! \return None. // //***************************************************************************** static inline void EPWM_disableDeadBandControlShadowLoadMode(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 3687); } } while(0); // // Disable the shadow load mode. Only immediate load mode only. // (*((volatile uint16_t *)((uintptr_t)(base + 0xDU)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0xDU)))) & ~0x4U); } //***************************************************************************** // //! Set the RED (Rising Edge Delay) shadow load mode. //! //! \param base is the base address of the EPWM module. //! \param loadMode is the shadow to active load event. //! //! This function sets the Rising Edge Delay register shadow load mode. //! Valid values for the \e loadMode parameter are: //! - EPWM_RED_LOAD_ON_CNTR_ZERO - load when counter equals zero. //! - EPWM_RED_LOAD_ON_CNTR_PERIOD - load when counter equals period. //! - EPWM_RED_LOAD_ON_CNTR_ZERO_PERIOD - load when counter equals zero or //! period. //! - EPWM_RED_LOAD_FREEZE - Freeze shadow to active load. //! //! \return None. // //***************************************************************************** static inline void EPWM_setRisingEdgeDelayCountShadowLoadMode(uint32_t base, EPWM_RisingEdgeDelayLoadMode loadMode) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 3721); } } while(0); // // Enable the shadow mode. Set-up the load mode // (*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) & ~0xC0U) | ((uint16_t)0x400U | ((uint16_t)loadMode << 6U))); } //***************************************************************************** // //! Disable the RED (Rising Edge Delay) shadow load mode. //! //! \param base is the base address of the EPWM module. //! //! This function disables the Rising Edge Delay register shadow load mode. //! //! \return None. // //***************************************************************************** static inline void EPWM_disableRisingEdgeDelayCountShadowLoadMode(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 3750); } } while(0); // // Disable the shadow mode. // (*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) & ~0x400U); } //***************************************************************************** // //! Set the FED (Falling Edge Delay) shadow load mode. //! //! \param base is the base address of the EPWM module. //! \param loadMode is the shadow to active load event. //! //! This function enables and sets the Falling Edge Delay register shadow load //! mode. Valid values for the \e loadMode parameters are: //! - EPWM_FED_LOAD_ON_CNTR_ZERO - load when counter equals zero. //! - EPWM_FED_LOAD_ON_CNTR_PERIOD - load when counter equals period. //! - EPWM_FED_LOAD_ON_CNTR_ZERO_PERIOD - load when counter equals zero or //! period. //! - EPWM_FED_LOAD_FREEZE - Freeze shadow to active load. //! //! \return None. // //***************************************************************************** static inline void EPWM_setFallingEdgeDelayCountShadowLoadMode(uint32_t base, EPWM_FallingEdgeDelayLoadMode loadMode) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 3785); } } while(0); // // Enable the shadow mode. Setup the load mode. // (*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) & ~0x300U) | (0x800U | ((uint16_t)loadMode << 8U))); } //***************************************************************************** // //! Disables the FED (Falling Edge Delay) shadow load mode. //! //! \param base is the base address of the EPWM module. //! //! This function disables the Falling Edge Delay register shadow load mode. //! Valid values for the parameters are: //! //! \return None. // //***************************************************************************** static inline void EPWM_disableFallingEdgeDelayCountShadowLoadMode(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 3815); } } while(0); // // Disable the shadow mode. // (*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) & ~0x800U); } //***************************************************************************** // //! Sets Dead Band Counter clock rate. //! //! \param base is the base address of the EPWM module. //! \param clockMode is the Dead Band counter clock mode. //! //! This function sets up the Dead Band counter clock rate with respect to //! TBCLK (ePWM time base counter). //! Valid values for clockMode are: //! - EPWM_DB_COUNTER_CLOCK_FULL_CYCLE -Dead band counter runs at TBCLK //! (ePWM Time Base Counter) rate. //! - EPWM_DB_COUNTER_CLOCK_HALF_CYCLE -Dead band counter runs at 2*TBCLK //! (twice ePWM Time Base Counter)rate. //! //! \return None. // //***************************************************************************** static inline void EPWM_setDeadBandCounterClock(uint32_t base, EPWM_DeadBandClockMode clockMode) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 3849); } } while(0); // // Set the DB clock mode // (*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) & ~0x8000U) | ((uint16_t)clockMode << 15U)); } //***************************************************************************** // //! Set ePWM RED count //! //! \param base is the base address of the EPWM module. //! \param redCount is the RED(Rising Edge Delay) count. //! //! This function sets the RED (Rising Edge Delay) count value. //! The value of redCount should be less than 0x4000U. //! //! \return None. // //***************************************************************************** static inline void EPWM_setRisingEdgeDelayCount(uint32_t base, uint16_t redCount) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 3878); } } while(0); do { if(!(redCount < 0x4000U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 3879); } } while(0); // // Set the RED (Rising Edge Delay) count // (*((volatile uint16_t *)((uintptr_t)(base + 0x51U)))) = redCount; } //***************************************************************************** // //! Set ePWM FED count //! //! \param base is the base address of the EPWM module. //! \param fedCount is the FED(Falling Edge Delay) count. //! //! This function sets the FED (Falling Edge Delay) count value. //! The value of fedCount should be less than 0x4000U. //! //! \return None. // //***************************************************************************** static inline void EPWM_setFallingEdgeDelayCount(uint32_t base, uint16_t fedCount) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 3906); } } while(0); do { if(!(fedCount < 0x4000U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 3907); } } while(0); // // Set the RED (Rising Edge Delay) count // (*((volatile uint16_t *)((uintptr_t)(base + 0x53U)))) = fedCount; } // // Chopper module related APIs // //***************************************************************************** // //! Enable chopper mode //! //! \param base is the base address of the EPWM module. //! //! This function enables ePWM chopper module. //! //! \return None. // //***************************************************************************** static inline void EPWM_enableChopper(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 3935); } } while(0); // // Set CHPEN bit. Enable Chopper // (*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) |= 0x1U; } //***************************************************************************** // //! Disable chopper mode //! //! \param base is the base address of the EPWM module. //! //! This function disables ePWM chopper module. //! //! \return None. // //***************************************************************************** static inline void EPWM_disableChopper(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 3960); } } while(0); // // Clear CHPEN bit. Disable Chopper // (*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) &= ~0x1U; } //***************************************************************************** // //! Set chopper duty cycle. //! //! \param base is the base address of the EPWM module. //! \param dutyCycleCount is the chopping clock duty cycle count. //! //! This function sets the chopping clock duty cycle. The value of //! dutyCycleCount should be less than 7. The dutyCycleCount value is converted //! to the actual chopper duty cycle value base on the following equation: //! chopper duty cycle = (dutyCycleCount + 1) / 8 //! //! \return None. // //***************************************************************************** static inline void EPWM_setChopperDutyCycle(uint32_t base, uint16_t dutyCycleCount) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 3989); } } while(0); do { if(!(dutyCycleCount < 7U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 3990); } } while(0); // // Set the chopper duty cycle // (*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) & ~0x700U) | (dutyCycleCount << 8U)); } //***************************************************************************** // //! Set chopper clock frequency scaler. //! //! \param base is the base address of the EPWM module. //! \param freqDiv is the chopping clock frequency divider. //! //! This function sets the scaler for the chopping clock frequency. The value //! of freqDiv should be less than 8. The chopping clock frequency is altered //! based on the following equation. //! chopper clock frequency = SYSCLKOUT / ( 1 + freqDiv) //! //! \return None. // //***************************************************************************** static inline void EPWM_setChopperFreq(uint32_t base, uint16_t freqDiv) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4021); } } while(0); do { if(!(freqDiv < 8U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4022); } } while(0); // // Set the chopper clock // (*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) & ~(uint16_t)0xE0U) | (freqDiv << 5U)); } //***************************************************************************** // //! Set chopper clock frequency scaler. //! //! \param base is the base address of the EPWM module. //! \param firstPulseWidth is the width of the first pulse. //! //! This function sets the first pulse width of chopper output waveform. The //! value of firstPulseWidth should be less than 0x10. The value of the first //! pulse width in seconds is given using the following equation: //! first pulse width = 1 / (((firstPulseWidth + 1) * SYSCLKOUT)/8) //! //! \return None. // //***************************************************************************** static inline void EPWM_setChopperFirstPulseWidth(uint32_t base, uint16_t firstPulseWidth) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4054); } } while(0); do { if(!(firstPulseWidth < 16U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4055); } } while(0); // // Set the chopper clock // (*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) & ~(uint16_t)0x1EU) | (firstPulseWidth << 1U)); } // // Trip Zone module related APIs // //***************************************************************************** // //! Enables Trip Zone signal. //! //! \param base is the base address of the EPWM module. //! \param tzSignal is the Trip Zone signal. //! //! This function enables the Trip Zone signals specified by tzSignal as a //! source for the Trip Zone module. //! Valid values for tzSignal are: //! - EPWM_TZ_SIGNAL_CBC1 - TZ1 Cycle By Cycle //! - EPWM_TZ_SIGNAL_CBC2 - TZ2 Cycle By Cycle //! - EPWM_TZ_SIGNAL_CBC3 - TZ3 Cycle By Cycle //! - EPWM_TZ_SIGNAL_CBC4 - TZ4 Cycle By Cycle //! - EPWM_TZ_SIGNAL_CBC5 - TZ5 Cycle By Cycle //! - EPWM_TZ_SIGNAL_CBC6 - TZ6 Cycle By Cycle //! - EPWM_TZ_SIGNAL_DCAEVT2 - DCAEVT2 Cycle By Cycle //! - EPWM_TZ_SIGNAL_DCBEVT2 - DCBEVT2 Cycle By Cycle //! - EPWM_TZ_SIGNAL_OSHT1 - One-shot TZ1 //! - EPWM_TZ_SIGNAL_OSHT2 - One-shot TZ2 //! - EPWM_TZ_SIGNAL_OSHT3 - One-shot TZ3 //! - EPWM_TZ_SIGNAL_OSHT4 - One-shot TZ4 //! - EPWM_TZ_SIGNAL_OSHT5 - One-shot TZ5 //! - EPWM_TZ_SIGNAL_OSHT6 - One-shot TZ6 //! - EPWM_TZ_SIGNAL_DCAEVT1 - One-shot DCAEVT1 //! - EPWM_TZ_SIGNAL_DCBEVT1 - One-shot DCBEVT1 //! //! \b note: A logical OR of the valid values can be passed as the tzSignal //! parameter. //! //! \return None. // //***************************************************************************** static inline void EPWM_enableTripZoneSignals(uint32_t base, uint16_t tzSignal) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4108); } } while(0); // // Set the trip zone bits // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x80U)))) |= tzSignal; __edis(); } //***************************************************************************** // //! Disables Trip Zone signal. //! //! \param base is the base address of the EPWM module. //! \param tzSignal is the Trip Zone signal. //! //! This function disables the Trip Zone signal specified by tzSignal as a //! source for the Trip Zone module. //! Valid values for tzSignal are: //! - EPWM_TZ_SIGNAL_CBC1 - TZ1 Cycle By Cycle //! - EPWM_TZ_SIGNAL_CBC2 - TZ2 Cycle By Cycle //! - EPWM_TZ_SIGNAL_CBC3 - TZ3 Cycle By Cycle //! - EPWM_TZ_SIGNAL_CBC4 - TZ4 Cycle By Cycle //! - EPWM_TZ_SIGNAL_CBC5 - TZ5 Cycle By Cycle //! - EPWM_TZ_SIGNAL_CBC6 - TZ6 Cycle By Cycle //! - EPWM_TZ_SIGNAL_DCAEVT2 - DCAEVT2 Cycle By Cycle //! - EPWM_TZ_SIGNAL_DCBEVT2 - DCBEVT2 Cycle By Cycle //! - EPWM_TZ_SIGNAL_OSHT1 - One-shot TZ1 //! - EPWM_TZ_SIGNAL_OSHT2 - One-shot TZ2 //! - EPWM_TZ_SIGNAL_OSHT3 - One-shot TZ3 //! - EPWM_TZ_SIGNAL_OSHT4 - One-shot TZ4 //! - EPWM_TZ_SIGNAL_OSHT5 - One-shot TZ5 //! - EPWM_TZ_SIGNAL_OSHT6 - One-shot TZ6 //! - EPWM_TZ_SIGNAL_DCAEVT1 - One-shot DCAEVT1 //! - EPWM_TZ_SIGNAL_DCBEVT1 - One-shot DCBEVT1 //! //! \b note: A logical OR of the valid values can be passed as the tzSignal //! parameter. //! //! \return None. // //***************************************************************************** static inline void EPWM_disableTripZoneSignals(uint32_t base, uint16_t tzSignal) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4157); } } while(0); // // Clear the trip zone bits // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x80U)))) &= ~tzSignal; __edis(); } //***************************************************************************** // //! Set Digital compare conditions that cause Trip Zone event. //! //! \param base is the base address of the EPWM module. //! \param dcType is the Digital compare output type. //! \param dcEvent is the Digital Compare output event. //! //! This function sets up the Digital Compare output Trip Zone event sources. //! The dcType variable specifies the event source to be whether Digital //! Compare output A or Digital Compare output B. The dcEvent parameter //! specifies the event that causes Trip Zone. //! Valid values for the parameters are: //! - dcType //! - EPWM_TZ_DC_OUTPUT_A1 - Digital Compare output 1 A //! - EPWM_TZ_DC_OUTPUT_A2 - Digital Compare output 2 A //! - EPWM_TZ_DC_OUTPUT_B1 - Digital Compare output 1 B //! - EPWM_TZ_DC_OUTPUT_B2 - Digital Compare output 2 B //! - dcEvent //! - EPWM_TZ_EVENT_DC_DISABLED - Event Trigger is disabled //! - EPWM_TZ_EVENT_DCXH_LOW - Trigger event when DCxH low //! - EPWM_TZ_EVENT_DCXH_HIGH - Trigger event when DCxH high //! - EPWM_TZ_EVENT_DCXL_LOW - Trigger event when DCxL low //! - EPWM_TZ_EVENT_DCXL_HIGH - Trigger event when DCxL high //! - EPWM_TZ_EVENT_DCXL_HIGH_DCXH_LOW - Trigger event when DCxL high //! DCxH low //! //! \note x in DCxH/DCxL represents DCAH/DCAL or DCBH/DCBL //! //! \return None. // //***************************************************************************** static inline void EPWM_setTripZoneDigitalCompareEventCondition(uint32_t base, EPWM_TripZoneDigitalCompareOutput dcType, EPWM_TripZoneDigitalCompareOutputEvent dcEvent) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4207); } } while(0); // // Set Digital Compare Events conditions that cause a Digital Compare trip // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x82U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x82U)))) & ~(0x7U << (uint16_t)dcType)) | ((uint16_t)dcEvent << (uint16_t)dcType)); __edis(); } //***************************************************************************** // //! Enable advanced Trip Zone event Action. //! //! \param base is the base address of the EPWM module. //! //! This function enables the advanced actions of the Trip Zone events. The //! advanced features combine the trip zone events with the direction of the //! counter. //! //! \return None. // //***************************************************************************** static inline void EPWM_enableTripZoneAdvAction(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4238); } } while(0); // // Enable Advanced feature. Set ETZE bit // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x85U)))) |= 0x8000U; __edis(); } //***************************************************************************** // //! Disable advanced Trip Zone event Action. //! //! \param base is the base address of the EPWM module. //! //! This function disables the advanced actions of the Trip Zone events. //! //! \return None. // //***************************************************************************** static inline void EPWM_disableTripZoneAdvAction(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4265); } } while(0); // // Disable Advanced feature. clear ETZE bit // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x85U)))) &= ~0x8000U; __edis(); } //***************************************************************************** // //! Set Trip Zone Action. //! //! \param base is the base address of the EPWM module. //! \param tzEvent is the Trip Zone event type. //! \param tzAction is the Trip zone Action. //! //! This function sets the Trip Zone Action to be taken when a Trip Zone event //! occurs. //! Valid values for the parameters are: //! - tzEvent //! - EPWM_TZ_ACTION_EVENT_DCBEVT2 - DCBEVT2 (Digital Compare B event 2) //! - EPWM_TZ_ACTION_EVENT_DCBEVT1 - DCBEVT1 (Digital Compare B event 1) //! - EPWM_TZ_ACTION_EVENT_DCAEVT2 - DCAEVT2 (Digital Compare A event 2) //! - EPWM_TZ_ACTION_EVENT_DCAEVT1 - DCAEVT1 (Digital Compare A event 1) //! - EPWM_TZ_ACTION_EVENT_TZB - TZ1 - TZ6, DCBEVT2, DCBEVT1 //! - EPWM_TZ_ACTION_EVENT_TZA - TZ1 - TZ6, DCAEVT2, DCAEVT1 //! - tzAction //! - EPWM_TZ_ACTION_HIGH_Z - high impedance output //! - EPWM_TZ_ACTION_HIGH - high output //! - EPWM_TZ_ACTION_LOW - low low //! - EPWM_TZ_ACTION_DISABLE - disable action //! //! \note Disable the advanced Trip Zone event using //! EPWM_disableTripZoneAdvAction() before calling this function. //! \note This function operates on both ePWMA and ePWMB depending on the //! tzEvent parameter. //! //! \return None. // //***************************************************************************** static inline void EPWM_setTripZoneAction(uint32_t base, EPWM_TripZoneEvent tzEvent, EPWM_TripZoneAction tzAction) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4314); } } while(0); // // Set the Action for Trip Zone events // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x84U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x84U)))) & ~(0x3U << (uint16_t)tzEvent)) | ((uint16_t)tzAction << (uint16_t)tzEvent)) ; __edis(); } //***************************************************************************** // //! Set Advanced Trip Zone Action. //! //! \param base is the base address of the EPWM module. //! \param tzAdvEvent is the Trip Zone event type. //! \param tzAdvAction is the Trip zone Action. //! //! This function sets the Advanced Trip Zone Action to be taken when an //! advanced Trip Zone event occurs. //! //! Valid values for the parameters are: //! - tzAdvEvent //! - EPWM_TZ_ADV_ACTION_EVENT_TZB_D - TZ1 - TZ6, DCBEVT2, DCBEVT1 while //! counting down //! - EPWM_TZ_ADV_ACTION_EVENT_TZB_U - TZ1 - TZ6, DCBEVT2, DCBEVT1 while //! counting up //! - EPWM_TZ_ADV_ACTION_EVENT_TZA_D - TZ1 - TZ6, DCAEVT2, DCAEVT1 while //! counting down //! - EPWM_TZ_ADV_ACTION_EVENT_TZA_U - TZ1 - TZ6, DCAEVT2, DCAEVT1 while //! counting up //! - tzAdvAction //! - EPWM_TZ_ADV_ACTION_HIGH_Z - high impedance output //! - EPWM_TZ_ADV_ACTION_HIGH - high voltage state //! - EPWM_TZ_ADV_ACTION_LOW - low voltage state //! - EPWM_TZ_ADV_ACTION_TOGGLE - Toggle output //! - EPWM_TZ_ADV_ACTION_DISABLE - disable action //! //! \note This function enables the advanced Trip Zone event. //! //! \note This function operates on both ePWMA and ePWMB depending on the //! tzAdvEvent parameter. //! \note Advanced Trip Zone events take into consideration the direction of //! the counter in addition to Trip Zone events. //! //! \return None. // //***************************************************************************** static inline void EPWM_setTripZoneAdvAction(uint32_t base, EPWM_TripZoneAdvancedEvent tzAdvEvent, EPWM_TripZoneAdvancedAction tzAdvAction) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4371); } } while(0); // // Set the Advanced Action for Trip Zone events // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x85U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x85U)))) & ~(0x7U << (uint16_t)tzAdvEvent)) | ((uint16_t)tzAdvAction << (uint16_t)tzAdvEvent)); (*((volatile uint16_t *)((uintptr_t)(base + 0x85U)))) |= 0x8000U; __edis(); } //***************************************************************************** // //! Set Advanced Digital Compare Trip Zone Action on ePWMA. //! //! \param base is the base address of the EPWM module. //! \param tzAdvDCEvent is the Digital Compare Trip Zone event type. //! \param tzAdvDCAction is the Digital Compare Trip zone Action. //! //! This function sets the Digital Compare (DC) Advanced Trip Zone Action to be //! taken on ePWMA when an advanced Digital Compare Trip Zone A event occurs. //! Valid values for the parameters are: //! - tzAdvDCEvent //! - EPWM_TZ_ADV_ACTION_EVENT_DCxEVT2_D - Digital Compare event A2 while //! counting down //! - EPWM_TZ_ADV_ACTION_EVENT_DCxEVT2_U - Digital Compare event A2 while //! counting up //! - EPWM_TZ_ADV_ACTION_EVENT_DCxEVT1_D - Digital Compare event A1 while //! counting down //! - EPWM_TZ_ADV_ACTION_EVENT_DCxEVT1_U - Digital Compare event A1 while //! counting up //! - tzAdvDCAction //! - EPWM_TZ_ADV_ACTION_HIGH_Z - high impedance output //! - EPWM_TZ_ADV_ACTION_HIGH - high voltage state //! - EPWM_TZ_ADV_ACTION_LOW - low voltage state //! - EPWM_TZ_ADV_ACTION_TOGGLE - Toggle output //! - EPWM_TZ_ADV_ACTION_DISABLE - disable action //! //! \note This function enables the advanced Trip Zone event. //! //! \note Advanced Trip Zone events take into consideration the direction of //! the counter in addition to Digital Compare Trip Zone events. //! //! \return None. // //***************************************************************************** static inline void EPWM_setTripZoneAdvDigitalCompareActionA(uint32_t base, EPWM_TripZoneAdvDigitalCompareEvent tzAdvDCEvent, EPWM_TripZoneAdvancedAction tzAdvDCAction) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4428); } } while(0); // // Set the Advanced Action for Trip Zone events // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x86U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x86U)))) & ~(0x7U << (uint16_t)tzAdvDCEvent)) | ((uint16_t)tzAdvDCAction << (uint16_t)tzAdvDCEvent)); (*((volatile uint16_t *)((uintptr_t)(base + 0x85U)))) |= 0x8000U; __edis(); } //***************************************************************************** // //! Set Advanced Digital Compare Trip Zone Action on ePWMB. //! //! \param base is the base address of the EPWM module. //! \param tzAdvDCEvent is the Digital Compare Trip Zone event type. //! \param tzAdvDCAction is the Digital Compare Trip zone Action. //! //! This function sets the Digital Compare (DC) Advanced Trip Zone Action to be //! taken on ePWMB when an advanced Digital Compare Trip Zone B event occurs. //! Valid values for the parameters are: //! - tzAdvDCEvent //! - EPWM_TZ_ADV_ACTION_EVENT_DCxEVT2_D - Digital Compare event B2 while //! counting down //! - EPWM_TZ_ADV_ACTION_EVENT_DCxEVT2_U - Digital Compare event B2 while //! counting up //! - EPWM_TZ_ADV_ACTION_EVENT_DCxEVT1_D - Digital Compare event B1 while //! counting down //! - EPWM_TZ_ADV_ACTION_EVENT_DCxEVT1_U - Digital Compare event B1 while //! counting up //! - tzAdvDCAction //! - EPWM_TZ_ADV_ACTION_HIGH_Z - high impedance output //! - EPWM_TZ_ADV_ACTION_HIGH - high voltage state //! - EPWM_TZ_ADV_ACTION_LOW - low voltage state //! - EPWM_TZ_ADV_ACTION_TOGGLE - Toggle output //! - EPWM_TZ_ADV_ACTION_DISABLE - disable action //! //! \note This function enables the advanced Trip Zone event. //! //! \note Advanced Trip Zone events take into consideration the direction of //! the counter in addition to Digital Compare Trip Zone events. //! //! \return None. // //***************************************************************************** static inline void EPWM_setTripZoneAdvDigitalCompareActionB(uint32_t base, EPWM_TripZoneAdvDigitalCompareEvent tzAdvDCEvent, EPWM_TripZoneAdvancedAction tzAdvDCAction) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4484); } } while(0); // // Set the Advanced Action for Trip Zone events // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x87U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x87U)))) & ~(0x7U << (uint16_t)tzAdvDCEvent)) | ((uint16_t)tzAdvDCAction << (uint16_t)tzAdvDCEvent)); (*((volatile uint16_t *)((uintptr_t)(base + 0x85U)))) |= 0x8000U; __edis(); } //***************************************************************************** // //! Enable Trip Zone interrupts. //! //! \param base is the base address of the EPWM module. //! \param tzInterrupt is the Trip Zone interrupt. //! //! This function enables the Trip Zone interrupts. //! Valid values for tzInterrupt are: //! - EPWM_TZ_INTERRUPT_CBC - Trip Zones Cycle By Cycle interrupt //! - EPWM_TZ_INTERRUPT_OST - Trip Zones One Shot interrupt //! - EPWM_TZ_INTERRUPT_DCAEVT1 - Digital Compare A Event 1 interrupt //! - EPWM_TZ_INTERRUPT_DCAEVT2 - Digital Compare A Event 2 interrupt //! - EPWM_TZ_INTERRUPT_DCBEVT1 - Digital Compare B Event 1 interrupt //! - EPWM_TZ_INTERRUPT_DCBEVT2 - Digital Compare B Event 2 interrupt //! //! \b note: A logical OR of the valid values can be passed as the tzInterrupt //! parameter. //! //! \return None. // //***************************************************************************** static inline void EPWM_enableTripZoneInterrupt(uint32_t base, uint16_t tzInterrupt) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4526); } } while(0); do { if(!((tzInterrupt > 0U) && (tzInterrupt < 0x80U))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4527); } } while(0); // // Enable Trip zone interrupts // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x8DU)))) |= tzInterrupt; __edis(); } //***************************************************************************** // //! Disable Trip Zone interrupts. //! //! \param base is the base address of the EPWM module. //! \param tzInterrupt is the Trip Zone interrupt. //! //! This function disables the Trip Zone interrupts. //! Valid values for tzInterrupt are: //! - EPWM_TZ_INTERRUPT_CBC - Trip Zones Cycle By Cycle interrupt //! - EPWM_TZ_INTERRUPT_OST - Trip Zones One Shot interrupt //! - EPWM_TZ_INTERRUPT_DCAEVT1 - Digital Compare A Event 1 interrupt //! - EPWM_TZ_INTERRUPT_DCAEVT2 - Digital Compare A Event 2 interrupt //! - EPWM_TZ_INTERRUPT_DCBEVT1 - Digital Compare B Event 1 interrupt //! - EPWM_TZ_INTERRUPT_DCBEVT2 - Digital Compare B Event 2 interrupt //! //! \b note: A logical OR of the valid values can be passed as the tzInterrupt //! parameter. //! //! \return None. // //*************************************************************************** static inline void EPWM_disableTripZoneInterrupt(uint32_t base, uint16_t tzInterrupt) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4565); } } while(0); do { if(!((tzInterrupt > 0U) && (tzInterrupt < 0x80U))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4566); } } while(0); // // Disable Trip zone interrupts // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x8DU)))) &= ~tzInterrupt; __edis(); } //***************************************************************************** // //! Gets the Trip Zone status flag //! //! \param base is the base address of the EPWM module. //! //! This function returns the Trip Zone status flag. //! //! \return The function returns the following or the bitwise OR value //! of the following values. //! - EPWM_TZ_INTERRUPT - Trip Zone interrupt was generated //! due to the following TZ events. //! - EPWM_TZ_FLAG_CBC - Trip Zones Cycle By Cycle event status flag //! - EPWM_TZ_FLAG_OST - Trip Zones One Shot event status flag //! - EPWM_TZ_FLAG_DCAEVT1 - Digital Compare A Event 1 status flag //! - EPWM_TZ_FLAG_DCAEVT2 - Digital Compare A Event 2 status flag //! - EPWM_TZ_FLAG_DCBEVT1 - Digital Compare B Event 1 status flag //! - EPWM_TZ_FLAG_DCBEVT2 - Digital Compare B Event 2 status flag // //*************************************************************************** static inline uint16_t EPWM_getTripZoneFlagStatus(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4602); } } while(0); // // Return the Trip zone flag status // return((*((volatile uint16_t *)((uintptr_t)(base + 0x93U)))) & 0x7FU); } //***************************************************************************** // //! Gets the Trip Zone Cycle by Cycle flag status //! //! \param base is the base address of the EPWM module. //! //! This function returns the specific Cycle by Cycle Trip Zone flag //! status. //! //! \return The function returns the following values. //! - EPWM_TZ_CBC_FLAG_1 - CBC 1 status flag //! - EPWM_TZ_CBC_FLAG_2 - CBC 2 status flag //! - EPWM_TZ_CBC_FLAG_3 - CBC 3 status flag //! - EPWM_TZ_CBC_FLAG_4 - CBC 4 status flag //! - EPWM_TZ_CBC_FLAG_5 - CBC 5 status flag //! - EPWM_TZ_CBC_FLAG_6 - CBC 6 status flag //! - EPWM_TZ_CBC_FLAG_DCAEVT2 - CBC status flag for Digital compare //! event A2 //! - EPWM_TZ_CBC_FLAG_DCBEVT2 - CBC status flag for Digital compare //! event B2 // //*************************************************************************** static inline uint16_t EPWM_getCycleByCycleTripZoneFlagStatus(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4638); } } while(0); // // Return the Cycle By Cycle Trip zone flag status // return((*((volatile uint16_t *)((uintptr_t)(base + 0x94U)))) & 0xFFU); } //***************************************************************************** // //! Gets the Trip Zone One Shot flag status //! //! \param base is the base address of the EPWM module. //! //! This function returns the specific One Shot Trip Zone flag status. //! //! \return The function returns the bitwise OR of the following flags. //! - EPWM_TZ_OST_FLAG_OST1 - OST status flag for OST1 //! - EPWM_TZ_OST_FLAG_OST2 - OST status flag for OST2 //! - EPWM_TZ_OST_FLAG_OST3 - OST status flag for OST3 //! - EPWM_TZ_OST_FLAG_OST4 - OST status flag for OST4 //! - EPWM_TZ_OST_FLAG_OST5 - OST status flag for OST5 //! - EPWM_TZ_OST_FLAG_OST6 - OST status flag for OST6 //! - EPWM_TZ_OST_FLAG_DCAEVT1 - OST status flag for Digital //! compare event A1 //! - EPWM_TZ_OST_FLAG_DCBEVT1 - OST status flag for Digital //! compare event B1 // //*************************************************************************** static inline uint16_t EPWM_getOneShotTripZoneFlagStatus(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4673); } } while(0); // // Return the One Shot Trip zone flag status // return((*((volatile uint16_t *)((uintptr_t)(base + 0x95U)))) & 0xFFU); } //***************************************************************************** // //! Set the Trip Zone CBC pulse clear event. //! //! \param base is the base address of the EPWM module. //! \param clearEvent is the CBC trip zone clear event. //! //! This function set the event which automatically clears the //! CBC (Cycle by Cycle) latch. //! Valid values for clearEvent are: //! - EPWM_TZ_CBC_PULSE_CLR_CNTR_ZERO - Clear CBC pulse when counter //! equals zero //! - EPWM_TZ_CBC_PULSE_CLR_CNTR_PERIOD - Clear CBC pulse when counter //! equals period //! - EPWM_TZ_CBC_PULSE_CLR_CNTR_ZERO_PERIOD - Clear CBC pulse when counter //! equals zero or period //! //! \return None. // //************************************************************************** static inline void EPWM_selectCycleByCycleTripZoneClearEvent(uint32_t base, EPWM_CycleByCycleTripZoneClearMode clearEvent) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4708); } } while(0); // // Set the Cycle by Cycle Trip Latch mode // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x97U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x97U)))) & ~0xC000U) | ((uint16_t)clearEvent << 14U)); __edis(); } //***************************************************************************** // //! Clear Trip Zone flag //! //! \param base is the base address of the EPWM module. //! \param tzFlags is the Trip Zone flags. //! //! This function clears the Trip Zone flags //! Valid values for tzFlags are: //! - EPWM_TZ_INTERRUPT - Global Trip Zone interrupt flag //! - EPWM_TZ_FLAG_CBC - Trip Zones Cycle By Cycle flag //! - EPWM_TZ_FLAG_OST - Trip Zones One Shot flag //! - EPWM_TZ_FLAG_DCAEVT1 - Digital Compare A Event 1 flag //! - EPWM_TZ_FLAG_DCAEVT2 - Digital Compare A Event 2 flag //! - EPWM_TZ_FLAG_DCBEVT1 - Digital Compare B Event 1 flag //! - EPWM_TZ_FLAG_DCBEVT2 - Digital Compare B Event 2 flag //! //! \b note: A bitwise OR of the valid values can be passed as the tzFlags //! parameter. //! //! \return None. // //*************************************************************************** static inline void EPWM_clearTripZoneFlag(uint32_t base, uint16_t tzFlags) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4749); } } while(0); do { if(!((tzFlags < 0x80U) && (tzFlags > 0x1U))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4750); } } while(0); // // Clear Trip zone event flag // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x97U)))) |= tzFlags; __edis(); } //***************************************************************************** // //! Clear the Trip Zone Cycle by Cycle flag. //! //! \param base is the base address of the EPWM module. //! \param tzCBCFlags is the CBC flag to be cleared. //! //! This function clears the specific Cycle by Cycle Trip Zone flag. //! The following are valid values for tzCBCFlags. //! - EPWM_TZ_CBC_FLAG_1 - CBC 1 flag //! - EPWM_TZ_CBC_FLAG_2 - CBC 2 flag //! - EPWM_TZ_CBC_FLAG_3 - CBC 3 flag //! - EPWM_TZ_CBC_FLAG_4 - CBC 4 flag //! - EPWM_TZ_CBC_FLAG_5 - CBC 5 flag //! - EPWM_TZ_CBC_FLAG_6 - CBC 6 flag //! - EPWM_TZ_CBC_FLAG_DCAEVT2 - CBC flag Digital compare //! event A2 //! - EPWM_TZ_CBC_FLAG_DCBEVT2 - CBC flag Digital compare //! event B2 //! //! \return None. // //*************************************************************************** static inline void EPWM_clearCycleByCycleTripZoneFlag(uint32_t base, uint16_t tzCBCFlags) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4789); } } while(0); do { if(!(tzCBCFlags < 0x800U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4790); } } while(0); // // Clear the Cycle By Cycle Trip zone flag // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x98U)))) |= tzCBCFlags; __edis(); } //***************************************************************************** // //! Clear the Trip Zone One Shot flag. //! //! \param base is the base address of the EPWM module. //! \param tzOSTFlags is the OST flags to be cleared. //! //! This function clears the specific One Shot (OST) Trip Zone flag. //! The following are valid values for tzOSTFlags. //! - EPWM_TZ_OST_FLAG_OST1 - OST flag for OST1 //! - EPWM_TZ_OST_FLAG_OST2 - OST flag for OST2 //! - EPWM_TZ_OST_FLAG_OST3 - OST flag for OST3 //! - EPWM_TZ_OST_FLAG_OST4 - OST flag for OST4 //! - EPWM_TZ_OST_FLAG_OST5 - OST flag for OST5 //! - EPWM_TZ_OST_FLAG_OST6 - OST flag for OST6 //! - EPWM_TZ_OST_FLAG_DCAEVT1 - OST flag for Digital compare event A1 //! - EPWM_TZ_OST_FLAG_DCBEVT1 - OST flag for Digital compare event B1 //! //! \return None. // //*************************************************************************** static inline void EPWM_clearOneShotTripZoneFlag(uint32_t base, uint16_t tzOSTFlags) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4827); } } while(0); do { if(!(tzOSTFlags < 0x800U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4828); } } while(0); // // Clear the Cycle By Cycle Trip zone flag // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x99U)))) |= tzOSTFlags; __edis(); } //***************************************************************************** // //! Force Trip Zone events. //! //! \param base is the base address of the EPWM module. //! \param tzForceEvent is the forced Trip Zone event. //! //! This function forces a Trip Zone event. //! Valid values for tzForceEvent are: //! - EPWM_TZ_FORCE_EVENT_CBC - Force Trip Zones Cycle By Cycle event //! - EPWM_TZ_FORCE_EVENT_OST - Force Trip Zones One Shot Event //! - EPWM_TZ_FORCE_EVENT_DCAEVT1 - Force Digital Compare A Event 1 //! - EPWM_TZ_FORCE_EVENT_DCAEVT2 - Force Digital Compare A Event 2 //! - EPWM_TZ_FORCE_EVENT_DCBEVT1 - Force Digital Compare B Event 1 //! - EPWM_TZ_FORCE_EVENT_DCBEVT2 - Force Digital Compare B Event 2 //! //! \return None. // //*************************************************************************** static inline void EPWM_forceTripZoneEvent(uint32_t base, uint16_t tzForceEvent) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4863); } } while(0); do { if(!((tzForceEvent & 0xFF81U)== 0U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4864); } } while(0); // // Force a Trip Zone event // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x9BU)))) |= tzForceEvent; __edis(); } // // Event Trigger related APIs // //***************************************************************************** // //! Enable ePWM interrupt. //! //! \param base is the base address of the EPWM module. //! //! This function enables the ePWM interrupt. //! //! \return None. // //***************************************************************************** static inline void EPWM_enableInterrupt(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4894); } } while(0); // // Enable ePWM interrupt // (*((volatile uint16_t *)((uintptr_t)(base + 0xA4U)))) |= 0x8U; } //***************************************************************************** // //! disable ePWM interrupt. //! //! \param base is the base address of the EPWM module. //! //! This function disables the ePWM interrupt. //! //! \return None. // //***************************************************************************** static inline void EPWM_disableInterrupt(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4919); } } while(0); // // Disable ePWM interrupt // (*((volatile uint16_t *)((uintptr_t)(base + 0xA4U)))) &= ~0x8U; } //***************************************************************************** // //! Sets the ePWM interrupt source. //! //! \param base is the base address of the EPWM module. //! \param interruptSource is the ePWM interrupt source. //! //! This function sets the ePWM interrupt source. //! Valid values for interruptSource are: //! - EPWM_INT_TBCTR_ZERO - Time-base counter equal to zero //! - EPWM_INT_TBCTR_PERIOD - Time-base counter equal to period //! - EPWM_INT_TBCTR_ZERO_OR_PERIOD - Time-base counter equal to zero or //! period //! - EPWM_INT_TBCTR_U_CMPx - Where x is A,B,C or D //! Time-base counter equal to CMPA, CMPB, //! CMPC or CMPD (depending the value of x) //! when the timer is incrementing //! - EPWM_INT_TBCTR_D_CMPx - Where x is A,B,C or D //! Time-base counter equal to CMPA, CMPB, //! CMPC or CMPD (depending the value of x) //! when the timer is decrementing //! //! \return None. // //***************************************************************************** static inline void EPWM_setInterruptSource(uint32_t base, uint16_t interruptSource) { uint16_t intSource; // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4960); } } while(0); do { if(!(((interruptSource > 0U) && (interruptSource < 9U)) || (interruptSource == 10U) || (interruptSource == 12U) || (interruptSource == 14U))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 4963); } } while(0); if((interruptSource == 8U) || (interruptSource == 12U) || (interruptSource == 10U) || (interruptSource == 14U)) { // // Shift the interrupt source by 1 // intSource = interruptSource >> 1U; // // Enable events based on comp C or comp D // (*((volatile uint16_t *)((uintptr_t)(base + 0xA4U)))) |= 0x40U; } else if((interruptSource == 4U) || (interruptSource == 6U) || (interruptSource == 5U) || (interruptSource == 7U)) { intSource = interruptSource; // // Enable events based on comp A or comp B // (*((volatile uint16_t *)((uintptr_t)(base + 0xA4U)))) &= ~0x40U; } else { intSource = interruptSource; } // // Set the interrupt source // (*((volatile uint16_t *)((uintptr_t)(base + 0xA4U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0xA4U)))) & ~0x7U) | intSource); } //***************************************************************************** // //! Sets the ePWM interrupt event counts. //! //! \param base is the base address of the EPWM module. //! \param eventCount is the event count for interrupt scale //! //! This function sets the interrupt event count that determines the number of //! events that have to occur before an interrupt is issued. //! Maximum value for eventCount is 15. //! //! \return None. // //***************************************************************************** static inline void EPWM_setInterruptEventCount(uint32_t base, uint16_t eventCount) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 5024); } } while(0); do { if(!(eventCount < 16U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 5025); } } while(0); // // Enable advanced feature of interrupt every up to 15 events // (*((volatile uint16_t *)((uintptr_t)(base + 0xA6U)))) |= 0x10U; (*((volatile uint16_t *)((uintptr_t)(base + 0xAEU)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0xAEU)))) & ~0xFU) | eventCount); } //***************************************************************************** // //! Return the interrupt status. //! //! \param base is the base address of the EPWM module. //! //! This function returns the ePWM interrupt status. //! \b Note This function doesn't return the Trip Zone status. //! //! \return Returns true if ePWM interrupt was generated. //! Returns false if no interrupt was generated // //***************************************************************************** static inline _Bool EPWM_getEventTriggerInterruptStatus(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 5055); } } while(0); // // Return INT bit of ETFLG register // return((((*((volatile uint16_t *)((uintptr_t)(base + 0xA8U)))) & 0x1U) == 0x1U) ? 1 : 0); } //***************************************************************************** // //! Clear interrupt flag. //! //! \param base is the base address of the EPWM module. //! //! This function clears the ePWM interrupt flag. //! //! \return None // //***************************************************************************** static inline void EPWM_clearEventTriggerInterruptFlag(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 5080); } } while(0); // // Clear INT bit of ETCLR register // (*((volatile uint16_t *)((uintptr_t)(base + 0xAAU)))) |= 0x1U; } //***************************************************************************** // //! Enable Pre-interrupt count load. //! //! \param base is the base address of the EPWM module. //! //! This function enables the ePWM interrupt counter to be pre-interrupt loaded //! with a count value. //! //! \note This is valid only for advanced/expanded interrupt mode //! //! \return None. // //***************************************************************************** static inline void EPWM_enableInterruptEventCountInit(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 5108); } } while(0); // // Enable interrupt event count initializing/loading // (*((volatile uint16_t *)((uintptr_t)(base + 0xB2U)))) |= 0x2000U; } //***************************************************************************** // //! Disable interrupt count load. //! //! \param base is the base address of the EPWM module. //! //! This function disables the ePWM interrupt counter from being loaded with //! pre-interrupt count value. //! //! \return None. // //***************************************************************************** static inline void EPWM_disableInterruptEventCountInit(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 5134); } } while(0); // // Disable interrupt event count initializing/loading // (*((volatile uint16_t *)((uintptr_t)(base + 0xB2U)))) &= ~0x2000U; } //***************************************************************************** // //! Force a software pre interrupt event counter load. //! //! \param base is the base address of the EPWM module. //! //! This function forces the ePWM interrupt counter to be loaded with the //! contents set by EPWM_setPreInterruptEventCount(). //! //! \note make sure the EPWM_enablePreInterruptEventCountLoad() function is //! is called before invoking this function. //! //! \return None. // //***************************************************************************** static inline void EPWM_forceInterruptEventCountInit(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 5163); } } while(0); // // Load the Interrupt Event counter value // (*((volatile uint16_t *)((uintptr_t)(base + 0xB2U)))) |= 0x400U; } //***************************************************************************** // //! Set interrupt count. //! //! \param base is the base address of the EPWM module. //! \param eventCount is the ePWM interrupt count value. //! //! This function sets the ePWM interrupt count. eventCount is the value of the //! pre-interrupt value that is to be loaded. The maximum value of eventCount //! is 15. //! //! \return None. // //***************************************************************************** static inline void EPWM_setInterruptEventCountInitValue(uint32_t base, uint16_t eventCount) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 5191); } } while(0); do { if(!(eventCount < 16U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 5192); } } while(0); // // Set the Pre-interrupt event count // (*((volatile uint16_t *)((uintptr_t)(base + 0xB4U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0xB4U)))) & ~0xFU) | (uint16_t)(eventCount & 0xFU)); } //***************************************************************************** // //! Get the interrupt count. //! //! \param base is the base address of the EPWM module. //! //! This function returns the ePWM interrupt event count. //! //! \return The interrupt event counts that have occurred. // //***************************************************************************** static inline uint16_t EPWM_getInterruptEventCount(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 5219); } } while(0); // // Return the interrupt event count // return((((*((volatile uint16_t *)((uintptr_t)(base + 0xAEU)))) & 0xF0U) >> 4U)); } //***************************************************************************** // //! Force ePWM interrupt. //! //! \param base is the base address of the EPWM module. //! //! This function forces an ePWM interrupt. //! //! \return None // //***************************************************************************** static inline void EPWM_forceEventTriggerInterrupt(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 5245); } } while(0); // // Set INT bit of ETFRC register // (*((volatile uint16_t *)((uintptr_t)(base + 0xACU)))) |= 0x1U; } // // ADC SOC configuration related APIs // //***************************************************************************** // //! Enable ADC SOC event. //! //! \param base is the base address of the EPWM module. //! \param adcSOCType is the ADC SOC type. //! //! This function enables the ePWM module to trigger an ADC SOC event. //! Valid values for adcSOCType are: //! - EPWM_SOC_A - SOC A //! - EPWM_SOC_B - SOC B //! //! \return None. // //***************************************************************************** static inline void EPWM_enableADCTrigger(uint32_t base, EPWM_ADCStartOfConversionType adcSOCType) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 5277); } } while(0); // // Enable an SOC // if(adcSOCType == EPWM_SOC_A) { (*((volatile uint16_t *)((uintptr_t)(base + 0xA4U)))) |= 0x800U; } else { (*((volatile uint16_t *)((uintptr_t)(base + 0xA4U)))) |= 0x8000U; } } //***************************************************************************** // //! Disable ADC SOC event. //! //! \param base is the base address of the EPWM module. //! \param adcSOCType is the ADC SOC type. //! //! This function disables the ePWM module from triggering an ADC SOC event. //! Valid values for adcSOCType are: //! - EPWM_SOC_A - SOC A //! - EPWM_SOC_B - SOC B //! //! \return None. // //***************************************************************************** static inline void EPWM_disableADCTrigger(uint32_t base, EPWM_ADCStartOfConversionType adcSOCType) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 5313); } } while(0); // // Disable an SOC // if(adcSOCType == EPWM_SOC_A) { (*((volatile uint16_t *)((uintptr_t)(base + 0xA4U)))) &= ~0x800U; } else { (*((volatile uint16_t *)((uintptr_t)(base + 0xA4U)))) &= ~0x8000U; } } //***************************************************************************** // //! Sets the ePWM SOC source. //! //! \param base is the base address of the EPWM module. //! \param adcSOCType is the ADC SOC type. //! \param socSource is the SOC source. //! //! This function sets the ePWM ADC SOC source. //! Valid values for socSource are: //! - adcSOCType //! - EPWM_SOC_A - SOC A //! - EPWM_SOC_B - SOC B //! - socSource //! - EPWM_SOC_DCxEVT1 - Event is based on DCxEVT1 //! - EPWM_SOC_TBCTR_ZERO - Time-base counter equal to zero //! - EPWM_SOC_TBCTR_PERIOD - Time-base counter equal to period //! - EPWM_SOC_TBCTR_ZERO_OR_PERIOD - Time-base counter equal to zero or //! period //! - EPWM_SOC_TBCTR_U_CMPx - Where x is A,B,C or D //! Time-base counter equal to CMPA, CMPB, //! CMPC or CMPD(depending the value of x) //! when the timer is incrementing //! - EPWM_SOC_TBCTR_D_CMPx - Where x is A,B,C or D //! Time-base counter equal to CMPA, CMPB, //! CMPC or CMPD(depending the value of x) //! when the timer is decrementing //! //! \return None. // //***************************************************************************** static inline void EPWM_setADCTriggerSource(uint32_t base, EPWM_ADCStartOfConversionType adcSOCType, EPWM_ADCStartOfConversionSource socSource) { uint16_t source; // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 5369); } } while(0); if((socSource == EPWM_SOC_TBCTR_U_CMPC) || (socSource == EPWM_SOC_TBCTR_U_CMPD) || (socSource == EPWM_SOC_TBCTR_D_CMPC) || (socSource == EPWM_SOC_TBCTR_D_CMPD)) { source = (uint16_t)socSource >> 1U; } else { source = (uint16_t)socSource; } if(adcSOCType == EPWM_SOC_A) { // // Set the SOC source // (*((volatile uint16_t *)((uintptr_t)(base + 0xA4U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0xA4U)))) & ~0x700U) | (source << 8U)); // // Enable the comparator selection // if((socSource == EPWM_SOC_TBCTR_U_CMPA) || (socSource == EPWM_SOC_TBCTR_U_CMPB) || (socSource == EPWM_SOC_TBCTR_D_CMPA) || (socSource == EPWM_SOC_TBCTR_D_CMPB)) { // // Enable events based on comp A or comp B // (*((volatile uint16_t *)((uintptr_t)(base + 0xA4U)))) &= ~0x10U; } else if((socSource == EPWM_SOC_TBCTR_U_CMPC) || (socSource == EPWM_SOC_TBCTR_U_CMPD) || (socSource == EPWM_SOC_TBCTR_D_CMPC) || (socSource == EPWM_SOC_TBCTR_D_CMPD)) { // // Enable events based on comp C or comp D // (*((volatile uint16_t *)((uintptr_t)(base + 0xA4U)))) |= 0x10U; } else { // // No action required for the other socSource options // } } else { // // Enable the comparator selection // (*((volatile uint16_t *)((uintptr_t)(base + 0xA4U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0xA4U)))) & ~0x7000U) | (source << 12U)); // // Enable the comparator selection // if((socSource == EPWM_SOC_TBCTR_U_CMPA) || (socSource == EPWM_SOC_TBCTR_U_CMPB) || (socSource == EPWM_SOC_TBCTR_D_CMPA) || (socSource == EPWM_SOC_TBCTR_D_CMPB)) { // // Enable events based on comp A or comp B // (*((volatile uint16_t *)((uintptr_t)(base + 0xA4U)))) &= ~0x20U; } else if((socSource == EPWM_SOC_TBCTR_U_CMPC) || (socSource == EPWM_SOC_TBCTR_U_CMPD) || (socSource == EPWM_SOC_TBCTR_D_CMPC) || (socSource == EPWM_SOC_TBCTR_D_CMPD)) { // // Enable events based on comp C or comp D // (*((volatile uint16_t *)((uintptr_t)(base + 0xA4U)))) |= 0x20U; } else { // // No action required for the other socSource options // } } } //***************************************************************************** // //! Sets the ePWM SOC event counts. //! //! \param base is the base address of the EPWM module. //! \param adcSOCType is the ADC SOC type. //! \param preScaleCount is the event count number. //! //! This function sets the SOC event count that determines the number of //! events that have to occur before an SOC is issued. //! Valid values for the parameters are: //! - adcSOCType //! - EPWM_SOC_A - SOC A //! - EPWM_SOC_B - SOC B //! - preScaleCount //! - [1 - 15] - Generate SOC pulse every preScaleCount //! up to 15 events. //! //! \note A preScaleCount value of 0 disables the prescale. //! //! \return None. // //***************************************************************************** static inline void EPWM_setADCTriggerEventPrescale(uint32_t base, EPWM_ADCStartOfConversionType adcSOCType, uint16_t preScaleCount) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 5494); } } while(0); do { if(!(preScaleCount < 16U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 5495); } } while(0); // // Enable advanced feature of SOC every up to 15 events // (*((volatile uint16_t *)((uintptr_t)(base + 0xA6U)))) |= 0x20U; if(adcSOCType == EPWM_SOC_A) { // // Set the count for SOC A // (*((volatile uint16_t *)((uintptr_t)(base + 0xB0U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0xB0U)))) & ~0xFU) | preScaleCount); } else { // // Set the count for SOC B // (*((volatile uint16_t *)((uintptr_t)(base + 0xB0U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0xB0U)))) & ~0xF00U) | (preScaleCount << 8U)); } } //***************************************************************************** // //! Return the SOC event status. //! //! \param base is the base address of the EPWM module. //! \param adcSOCType is the ADC SOC type. //! //! This function returns the ePWM SOC status. //! Valid values for adcSOCType are: //! - EPWM_SOC_A - SOC A //! - EPWM_SOC_B - SOC B //! //! \return Returns true if the selected adcSOCType SOC was generated. //! Returns false if the selected adcSOCType SOC was not generated. // //***************************************************************************** static inline _Bool EPWM_getADCTriggerFlagStatus(uint32_t base, EPWM_ADCStartOfConversionType adcSOCType) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 5544); } } while(0); // // Return the SOC A/ B status // return(((((*((volatile uint16_t *)((uintptr_t)(base + 0xA8U)))) >> ((uint16_t)adcSOCType + 2U)) & 0x1U) == 0x1U) ? 1 : 0); } //***************************************************************************** // //! Clear SOC flag. //! //! \param base is the base address of the EPWM module. //! \param adcSOCType is the ADC SOC type. //! //! This function clears the ePWM SOC flag. //! Valid values for adcSOCType are: //! - EPWM_SOC_A - SOC A //! - EPWM_SOC_B - SOC B //! //! \return None // //***************************************************************************** static inline void EPWM_clearADCTriggerFlag(uint32_t base, EPWM_ADCStartOfConversionType adcSOCType) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 5575); } } while(0); // // Clear SOC A/B bit of ETCLR register // (*((volatile uint16_t *)((uintptr_t)(base + 0xAAU)))) |= 1U << ((uint16_t)adcSOCType + 2U); } //***************************************************************************** // //! Enable Pre-SOC event count load. //! //! \param base is the base address of the EPWM module. //! \param adcSOCType is the ADC SOC type. //! //! This function enables the ePWM SOC event counter which is set by the //! EPWM_setADCTriggerEventCountInitValue() function to be loaded before //! an SOC event. //! Valid values for adcSOCType are: //! - EPWM_SOC_A - SOC A //! - EPWM_SOC_B - SOC B //! //! \note This is valid only for advanced/expanded SOC mode //! //! \return None. // //***************************************************************************** static inline void EPWM_enableADCTriggerEventCountInit(uint32_t base, EPWM_ADCStartOfConversionType adcSOCType) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 5609); } } while(0); // // Enable SOC event count initializing/loading // (*((volatile uint16_t *)((uintptr_t)(base + 0xB2U)))) |= 1U << ((uint16_t)adcSOCType + 14U); } //***************************************************************************** // //! Disable Pre-SOC event count load. //! //! \param base is the base address of the EPWM module. //! \param adcSOCType is the ADC SOC type. //! //! This function disables the ePWM SOC event counter from being loaded before //! an SOC event (only an SOC event causes an increment of the counter value). //! Valid values for adcSOCType are: //! - EPWM_SOC_A - SOC A //! - EPWM_SOC_B - SOC B //! //! \note This is valid only for advanced/expanded SOC mode //! //! \return None. // //***************************************************************************** static inline void EPWM_disableADCTriggerEventCountInit(uint32_t base, EPWM_ADCStartOfConversionType adcSOCType) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 5642); } } while(0); // // Disable SOC event count initializing/loading // (*((volatile uint16_t *)((uintptr_t)(base + 0xB2U)))) &= ~(1U << ((uint16_t)adcSOCType + 14U)); } //***************************************************************************** // //! Force a software pre SOC event counter load. //! //! \param base is the base address of the EPWM module. //! \param adcSOCType is the ADC SOC type //! //! This function forces the ePWM SOC counter to be loaded with the //! contents set by EPWM_setPreADCStartOfConversionEventCount(). //! //! \note make sure the EPWM_enableADCTriggerEventCountInit() //! function is called before invoking this function. //! //! \return None. // //***************************************************************************** static inline void EPWM_forceADCTriggerEventCountInit(uint32_t base, EPWM_ADCStartOfConversionType adcSOCType) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 5674); } } while(0); // // Load the Interrupt Event counter value // (*((volatile uint16_t *)((uintptr_t)(base + 0xB2U)))) |= 1U << ((uint16_t)adcSOCType + 11U); } //***************************************************************************** // //! Set ADC Trigger count values. //! //! \param base is the base address of the EPWM module. //! \param adcSOCType is the ADC SOC type. //! \param eventCount is the ePWM interrupt count value. //! //! This function sets the ePWM ADC Trigger count values. //! Valid values for adcSOCType are: //! - EPWM_SOC_A - SOC A //! - EPWM_SOC_B - SOC B //! The eventCount has a maximum value of 15. //! //! \return None. // //***************************************************************************** static inline void EPWM_setADCTriggerEventCountInitValue(uint32_t base, EPWM_ADCStartOfConversionType adcSOCType, uint16_t eventCount) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 5707); } } while(0); do { if(!(eventCount < 16)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 5708); } } while(0); // // Set the ADC Trigger event count // if(adcSOCType == EPWM_SOC_A) { (*((volatile uint16_t *)((uintptr_t)(base + 0xB4U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0xB4U)))) & ~0xF0U) | (uint16_t)(eventCount << 4U)); } else { (*((volatile uint16_t *)((uintptr_t)(base + 0xB4U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0xB4U)))) & ~0xF00U) | (eventCount << 8U)); } } //***************************************************************************** // //! Get the SOC event count. //! //! \param base is the base address of the EPWM module. //! \param adcSOCType is the ADC SOC type. //! //! This function returns the ePWM SOC event count. //! Valid values for adcSOCType are: //! - EPWM_SOC_A - SOC A //! - EPWM_SOC_B - SOC B //! //! \return The SOC event counts that have occurred. // //***************************************************************************** static inline uint16_t EPWM_getADCTriggerEventCount(uint32_t base, EPWM_ADCStartOfConversionType adcSOCType) { uint16_t eventCount; // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 5751); } } while(0); // // Return the SOC event count // if(adcSOCType == EPWM_SOC_A) { eventCount = ((*((volatile uint16_t *)((uintptr_t)(base + 0xB0U)))) >> 4U) & 0xFU; } else { eventCount = ((*((volatile uint16_t *)((uintptr_t)(base + 0xB0U)))) >> 12U) & 0xFU; } return(eventCount); } //***************************************************************************** // //! Force SOC event. //! //! \param base is the base address of the EPWM module. //! \param adcSOCType is the ADC SOC type. //! //! This function forces an ePWM SOC event. //! Valid values for adcSOCType are: //! - EPWM_SOC_A - SOC A //! - EPWM_SOC_B - SOC B //! //! \return None // //***************************************************************************** static inline void EPWM_forceADCTrigger(uint32_t base, EPWM_ADCStartOfConversionType adcSOCType) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 5790); } } while(0); // // Set SOC A/B bit of ETFRC register // (*((volatile uint16_t *)((uintptr_t)(base + 0xACU)))) |= 1U << ((uint16_t)adcSOCType + 2U); } // // Digital Compare module related APIs // //***************************************************************************** // //! Set the DC trip input. //! //! \param base is the base address of the EPWM module. //! \param tripSource is the tripSource. //! \param dcType is the Digital Compare type. //! //! This function sets the trip input to the Digital Compare (DC). For a given //! dcType the function sets the tripSource to be the input to the DC. //! Valid values for the parameter are: //! - tripSource //! - EPWM_DC_TRIP_TRIPINx - Trip x,where x ranges from 1 to 15 excluding 13 //! - EPWM_DC_TRIP_COMBINATION - selects all the Trip signals whose input //! is enabled by the following function //! EPWM_enableDigitalCompareTripCombinationInput() //! - dcType //! - EPWM_DC_TYPE_DCAH - Digital Compare A High //! - EPWM_DC_TYPE_DCAL - Digital Compare A Low //! - EPWM_DC_TYPE_DCBH - Digital Compare B High //! - EPWM_DC_TYPE_DCBL - Digital Compare B Low //! //! \return None // //***************************************************************************** static inline void EPWM_selectDigitalCompareTripInput(uint32_t base, EPWM_DigitalCompareTripInput tripSource, EPWM_DigitalCompareType dcType) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 5834); } } while(0); // // Set the DC trip input // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0xC0U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0xC0U)))) & ~(0xFU << ((uint16_t)dcType << 2U))) | ((uint16_t)tripSource << ((uint16_t)dcType << 2U))); __edis(); } // // DCFILT // //***************************************************************************** // //! Enable DC filter blanking window. //! //! \param base is the base address of the EPWM module. //! //! This function enables the DC filter blanking window. //! //! \return None // //***************************************************************************** static inline void EPWM_enableDigitalCompareBlankingWindow(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 5866); } } while(0); // // Enable DC filter blanking window // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0xC7U)))) |= 0x4U; __edis(); } //***************************************************************************** // //! Disable DC filter blanking window. //! //! \param base is the base address of the EPWM module. //! //! This function disables the DC filter blanking window. //! //! \return None // //***************************************************************************** static inline void EPWM_disableDigitalCompareBlankingWindow(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 5893); } } while(0); // // Disable DC filter blanking window // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0xC7U)))) &= ~0x4U; __edis(); } //***************************************************************************** // //! Enable Digital Compare Window inverse mode. //! //! \param base is the base address of the EPWM module. //! //! This function enables the Digital Compare Window inverse mode. This will //! invert the blanking window. //! //! \return None // //***************************************************************************** static inline void EPWM_enableDigitalCompareWindowInverseMode(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 5921); } } while(0); // // Enable DC window inverse mode. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0xC7U)))) |= 0x8U; __edis(); } //***************************************************************************** // //! Disable Digital Compare Window inverse mode. //! //! \param base is the base address of the EPWM module. //! //! This function disables the Digital Compare Window inverse mode. //! //! \return None // //***************************************************************************** static inline void EPWM_disableDigitalCompareWindowInverseMode(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 5948); } } while(0); // // Disable DC window inverse mode. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0xC7U)))) &= ~0x8U; __edis(); } //***************************************************************************** // //! Set the Digital Compare filter blanking pulse. //! //! \param base is the base address of the EPWM module. //! \param blankingPulse is Pulse that starts blanking window. //! //! This function sets the input pulse that starts the Digital Compare blanking //! window. //! Valid values for blankingPulse are: //! - EPWM_DC_WINDOW_START_TBCTR_PERIOD - Time base counter equals period //! - EPWM_DC_WINDOW_START_TBCTR_ZERO - Time base counter equals zero //! - EPWM_DC_WINDOW_START_TBCTR_ZERO_PERIOD - Time base counter equals zero //! or period. //! //! \return None // //***************************************************************************** static inline void EPWM_setDigitalCompareBlankingEvent(uint32_t base, EPWM_DigitalCompareBlankingPulse blankingPulse) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 5983); } } while(0); // // Set DC blanking event // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0xC7U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0xC7U)))) & ~0x30U) | ((uint16_t)((uint32_t)blankingPulse << 4U))); __edis(); } //***************************************************************************** // //! Set up the Digital Compare filter input. //! //! \param base is the base address of the EPWM module. //! \param filterInput is Digital Compare signal source. //! //! This function sets the signal input source that will be filtered by the //! Digital Compare module. //! Valid values for filterInput are: //! - EPWM_DC_WINDOW_SOURCE_DCAEVT1 - DC filter signal source is DCAEVT1 //! - EPWM_DC_WINDOW_SOURCE_DCAEVT2 - DC filter signal source is DCAEVT2 //! - EPWM_DC_WINDOW_SOURCE_DCBEVT1 - DC filter signal source is DCBEVT1 //! - EPWM_DC_WINDOW_SOURCE_DCBEVT2 - DC filter signal source is DCBEVT2 //! //! \return None // //***************************************************************************** static inline void EPWM_setDigitalCompareFilterInput(uint32_t base, EPWM_DigitalCompareFilterInput filterInput) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 6020); } } while(0); // // Set the signal source that will be filtered // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0xC7U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0xC7U)))) & ~0x3U) | ((uint16_t)filterInput)); __edis(); } // // DC Edge Filter // //***************************************************************************** // //! Enable Digital Compare Edge Filter. //! //! \param base is the base address of the EPWM module. //! //! This function enables the Digital Compare Edge filter to generate event //! after configured number of edges. //! //! \return None // //***************************************************************************** static inline void EPWM_enableDigitalCompareEdgeFilter(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 6053); } } while(0); // // Enable DC Edge Filter // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0xC7U)))) |= 0x40U; __edis(); } //***************************************************************************** // //! Disable Digital Compare Edge Filter. //! //! \param base is the base address of the EPWM module. //! //! This function disables the Digital Compare Edge filter. //! //! \return None // //***************************************************************************** static inline void EPWM_disableDigitalCompareEdgeFilter(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 6080); } } while(0); // // Disable DC Edge Filter // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0xC7U)))) &= ~0x40U; __edis(); } //***************************************************************************** // //! Set the Digital Compare Edge Filter Mode. //! //! \param base is the base address of the EPWM module. //! \param edgeMode is Digital Compare Edge filter mode. //! //! This function sets the Digital Compare Event filter mode. Valid values //! for edgeMode are: //! - EPWM_DC_EDGEFILT_MODE_RISING - DC edge filter mode is rising edge //! - EPWM_DC_EDGEFILT_MODE_FALLING - DC edge filter mode is falling edge //! - EPWM_DC_EDGEFILT_MODE_BOTH - DC edge filter mode is both edges //! //! \return None // //***************************************************************************** static inline void EPWM_setDigitalCompareEdgeFilterMode(uint32_t base, EPWM_DigitalCompareEdgeFilterMode edgeMode) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 6113); } } while(0); // // Set DC Edge filter mode // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0xC7U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0xC7U)))) & ~0x300U) | (edgeMode << 8U); __edis(); } //***************************************************************************** // //! Set the Digital Compare Edge Filter Edge Count. //! //! \param base is the base address of the EPWM module. //! \param edgeCount is Digital Compare event filter count //! //! This function sets the Digital Compare Event filter Edge Count to generate //! events. Valid values for edgeCount can be: //! - EPWM_DC_EDGEFILT_EDGECNT_0 - No edge is required to generate event //! - EPWM_DC_EDGEFILT_EDGECNT_1 - 1 edge is required for event generation //! - EPWM_DC_EDGEFILT_EDGECNT_2 - 2 edges are required for event generation //! - EPWM_DC_EDGEFILT_EDGECNT_3 - 3 edges are required for event generation //! - EPWM_DC_EDGEFILT_EDGECNT_4 - 4 edges are required for event generation //! - EPWM_DC_EDGEFILT_EDGECNT_5 - 5 edges are required for event generation //! - EPWM_DC_EDGEFILT_EDGECNT_6 - 6 edges are required for event generation //! - EPWM_DC_EDGEFILT_EDGECNT_7 - 7 edges are required for event generation //! //! \return None // //***************************************************************************** static inline void EPWM_setDigitalCompareEdgeFilterEdgeCount(uint32_t base, uint16_t edgeCount) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 6152); } } while(0); // // Set DC Edge filter edge count // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0xC7U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0xC7U)))) & ~0x1C00U) | (edgeCount << 10U); __edis(); } //***************************************************************************** // //! Returns the Digital Compare Edge Filter Edge Count. //! //! \param base is the base address of the EPWM module. //! //! This function returns the configured Digital Compare Edge filter edge //! count required to generate events. It can return values from 0-7. //! //! \return Returns the configured DigitalCompare Edge filter edge count. // //***************************************************************************** static inline uint16_t EPWM_getDigitalCompareEdgeFilterEdgeCount(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 6182); } } while(0); // // Return configured DC edge filter edge count // return(((*((volatile uint16_t *)((uintptr_t)(base + 0xC7U)))) & 0x1C00U) >> 10U); } //***************************************************************************** // //! Returns the Digital Compare Edge filter captured edge count status. //! //! \param base is the base address of the EPWM module. //! //! This function returns the count of edges captured by Digital Compare Edge //! filter. It can return values from 0-7. //! //! \return Returns the count of captured edges // //***************************************************************************** static inline uint16_t EPWM_getDigitalCompareEdgeFilterEdgeStatus(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 6209); } } while(0); // // Return captured edge count by DC Edge filter // return(((*((volatile uint16_t *)((uintptr_t)(base + 0xC7U)))) & 0xE000U) >> 13U); } //***************************************************************************** // //! Set up the Digital Compare filter window offset //! //! \param base is the base address of the EPWM module. //! \param windowOffsetCount is blanking window offset length. //! //! This function sets the offset between window start pulse and blanking //! window in TBCLK count. //! The function take a 16bit count value for the offset value. //! //! \return None // //***************************************************************************** static inline void EPWM_setDigitalCompareWindowOffset(uint32_t base, uint16_t windowOffsetCount) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 6238); } } while(0); // // Set the blanking window offset in TBCLK counts // (*((volatile uint16_t *)((uintptr_t)(base + 0xC9U)))) = windowOffsetCount; } //***************************************************************************** // //! Set up the Digital Compare filter window length //! //! \param base is the base address of the EPWM module. //! \param windowLengthCount is blanking window length. //! //! This function sets up the Digital Compare filter blanking window length in //! TBCLK count.The function takes a 16bit count value for the window length. //! //! \return None // //***************************************************************************** static inline void EPWM_setDigitalCompareWindowLength(uint32_t base, uint16_t windowLengthCount) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 6265); } } while(0); // // Set the blanking window length in TBCLK counts // (*((volatile uint16_t *)((uintptr_t)(base + 0xCBU)))) = windowLengthCount; } //***************************************************************************** // //! Return DC filter blanking window offset count. //! //! \param base is the base address of the EPWM module. //! //! This function returns DC filter blanking window offset count. //! //! \return None // //***************************************************************************** static inline uint16_t EPWM_getDigitalCompareBlankingWindowOffsetCount(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 6290); } } while(0); // // Return the Blanking Window Offset count // return((*((volatile uint16_t *)((uintptr_t)(base + 0xCAU))))); } //***************************************************************************** // //! Return DC filter blanking window length count. //! //! \param base is the base address of the EPWM module. //! //! This function returns DC filter blanking window length count. //! //! \return None // //***************************************************************************** static inline uint16_t EPWM_getDigitalCompareBlankingWindowLengthCount(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 6315); } } while(0); // // Return the Blanking Window Length count // return((*((volatile uint16_t *)((uintptr_t)(base + 0xCCU))))); } //***************************************************************************** // //! Set up the Digital Compare Event source. //! //! \param base is the base address of the EPWM module. //! \param dcModule is the Digital Compare module. //! \param dcEvent is the Digital Compare Event number. //! \param dcEventSource is the - Digital Compare Event source. //! //! This function sets up the Digital Compare module Event sources. //! The following are valid values for the parameters. //! - dcModule //! - EPWM_DC_MODULE_A - Digital Compare Module A //! - EPWM_DC_MODULE_B - Digital Compare Module B //! - dcEvent //! - EPWM_DC_EVENT_1 - Digital Compare Event number 1 //! - EPWM_DC_EVENT_2 - Digital Compare Event number 2 //! - dcEventSource //! - EPWM_DC_EVENT_SOURCE_FILT_SIGNAL - signal source is filtered //! \note The signal source for this option is DCxEVTy, where the //! value of x is dependent on dcModule and the value of y is //! dependent on dcEvent. Possible signal sources are DCAEVT1, //! DCBEVT1, DCAEVT2 or DCBEVT2 depending on the value of both //! dcModule and dcEvent. //! - EPWM_DC_EVENT_SOURCE_ORIG_SIGNAL - signal source is unfiltered //! The signal source for this option is DCEVTFILT. //! \return None // //***************************************************************************** static inline void EPWM_setDigitalCompareEventSource(uint32_t base, EPWM_DigitalCompareModule dcModule, EPWM_DigitalCompareEvent dcEvent, EPWM_DigitalCompareEventSource dcEventSource) { uint32_t registerOffset; // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 6363); } } while(0); registerOffset = 0xC3U + (uint16_t)dcModule; // // Set the DC event 1 source source // __eallow(); if(dcEvent == EPWM_DC_EVENT_1) { (*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) = (((*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) & ~0x1U) | (uint16_t)dcEventSource); } else { (*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) = (((*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) & ~0x100U) | ((uint16_t)dcEventSource << 8U)); } __edis(); } //***************************************************************************** // //! Set up the Digital Compare input sync mode. //! //! \param base is the base address of the EPWM module. //! \param dcModule is the Digital Compare module. //! \param dcEvent is the Digital Compare Event number. //! \param syncMode is the Digital Compare Event sync mode. //! //! This function sets up the Digital Compare module Event sources. //! The following are valid values for the parameters. //! - dcModule //! - EPWM_DC_MODULE_A - Digital Compare Module A //! - EPWM_DC_MODULE_B - Digital Compare Module B //! - dcEvent //! - EPWM_DC_EVENT_1 - Digital Compare Event number 1 //! - EPWM_DC_EVENT_2 - Digital Compare Event number 2 //! - syncMode //! - EPWM_DC_EVENT_INPUT_SYNCED - DC input signal is synced with //! TBCLK //! - EPWM_DC_EVENT_INPUT_NOT SYNCED - DC input signal is not synced with //! TBCLK //! //! \return None // //***************************************************************************** static inline void EPWM_setDigitalCompareEventSyncMode(uint32_t base, EPWM_DigitalCompareModule dcModule, EPWM_DigitalCompareEvent dcEvent, EPWM_DigitalCompareSyncMode syncMode) { uint32_t registerOffset; // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 6423); } } while(0); registerOffset = 0xC3U + (uint16_t)dcModule; // // Set the DC event sync mode // __eallow(); if(dcEvent == EPWM_DC_EVENT_1) { (*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) = (((*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) & ~0x2U) | ((uint16_t)syncMode << 1U)); } else { (*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) = (((*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) & ~0x200U) | ((uint16_t)syncMode << 9U)); } __edis(); } //***************************************************************************** // //! Enable Digital Compare to generate Start of Conversion. //! //! \param base is the base address of the EPWM module. //! \param dcModule is the Digital Compare module. //! //! This function enables the Digital Compare Event 1 to generate Start of //! Conversion. //! The following are valid values for the \e dcModule parameter. //! - EPWM_DC_MODULE_A - Digital Compare Module A //! - EPWM_DC_MODULE_B - Digital Compare Module B //! //! \return None // //***************************************************************************** static inline void EPWM_enableDigitalCompareADCTrigger(uint32_t base, EPWM_DigitalCompareModule dcModule) { uint32_t registerOffset; // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 6471); } } while(0); registerOffset = 0xC3U + (uint16_t)dcModule; // // Enable Digital Compare start of conversion generation // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) = ((*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) | 0x4U); __edis(); } //***************************************************************************** // //! Disable Digital Compare from generating Start of Conversion. //! //! \param base is the base address of the EPWM module. //! \param dcModule is the Digital Compare module. //! //! This function disables the Digital Compare Event 1 from generating Start of //! Conversion. //! The following are valid values for the \e dcModule parameter. //! - EPWM_DC_MODULE_A - Digital Compare Module A //! - EPWM_DC_MODULE_B - Digital Compare Module B //! //! \return None // //***************************************************************************** static inline void EPWM_disableDigitalCompareADCTrigger(uint32_t base, EPWM_DigitalCompareModule dcModule) { uint32_t registerOffset; // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 6509); } } while(0); registerOffset = 0xC3U + (uint16_t)dcModule; // // Disable Digital Compare start of conversion generation // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) = ((*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) & ~0x4U); __edis(); } //***************************************************************************** // //! Enable Digital Compare to generate sync out pulse. //! //! \param base is the base address of the EPWM module. //! \param dcModule is the Digital Compare module. //! //! This function enables the Digital Compare Event 1 to generate sync out //! pulse //! The following are valid values for the \e dcModule parameter. //! - EPWM_DC_MODULE_A - Digital Compare Module A //! - EPWM_DC_MODULE_B - Digital Compare Module B //! //! \return None // //***************************************************************************** static inline void EPWM_enableDigitalCompareSyncEvent(uint32_t base, EPWM_DigitalCompareModule dcModule) { uint32_t registerOffset; // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 6547); } } while(0); registerOffset = 0xC3U + (uint16_t)dcModule; // // Enable Digital Compare sync out pulse generation // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) = ((*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) | 0x8U); __edis(); } //***************************************************************************** // //! Disable Digital Compare from generating Start of Conversion. //! //! \param base is the base address of the EPWM module. //! \param dcModule is the Digital Compare module. //! //! This function disables the Digital Compare Event 1 from generating synch //! out pulse. //! The following are valid values for the \e dcModule parameters. //! - EPWM_DC_MODULE_A - Digital Compare Module A //! - EPWM_DC_MODULE_B - Digital Compare Module B //! //! \return None // //***************************************************************************** static inline void EPWM_disableDigitalCompareSyncEvent(uint32_t base, EPWM_DigitalCompareModule dcModule) { uint32_t registerOffset; // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 6585); } } while(0); registerOffset = 0xC3U + (uint16_t)dcModule; // // Disable Digital Compare sync out pulse generation // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) = ((*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) & ~0x8U); __edis(); } //***************************************************************************** // //! Set up the Digital Compare CBC latch mode. //! //! \param base is the base address of the EPWM module. //! \param dcModule is the Digital Compare module. //! \param dcEvent is the Digital Compare Event number. //! \param latchMode is the Digital Compare CBC latch mode. //! //! This function sets up the Digital Compare CBC latch mode. //! The following are valid values for the parameters. //! - dcModule //! - EPWM_DC_MODULE_A - Digital Compare Module A //! - EPWM_DC_MODULE_B - Digital Compare Module B //! - dcEvent //! - EPWM_DC_EVENT_1 - Digital Compare Event number 1 //! - EPWM_DC_EVENT_2 - Digital Compare Event number 2 //! - latchMode //! - EPWM_DC_CBC_LATCH_DISABLED - DC cycle-by-cycle(CBC) latch is disabled //! - EPWM_DC_CBC_LATCH_ENABLED - DC cycle-by-cycle(CBC) latch is enabled //! //! \return None // //***************************************************************************** static inline void EPWM_setDigitalCompareCBCLatchMode(uint32_t base, EPWM_DigitalCompareModule dcModule, EPWM_DigitalCompareEvent dcEvent, EPWM_DigitalCompareCBCLatchMode latchMode) { uint32_t registerOffset; // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 6633); } } while(0); registerOffset = 0xC3U + (uint16_t)dcModule; // // Set the DC CBC Latch Mode // __eallow(); if(dcEvent == EPWM_DC_EVENT_1) { (*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) = (((*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) & ~0x10U) | ((uint16_t)latchMode << 4U)); } else { (*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) = (((*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) & ~0x1000U) | ((uint16_t)latchMode << 12U)); } __edis(); } //***************************************************************************** // //! Sets the Digital Compare CBC latch clear event. //! //! \param base is the base address of the EPWM module. //! \param dcModule is the Digital Compare module. //! \param dcEvent is the Digital Compare Event number. //! \param clearEvent is the Digital Compare CBC latch clear event. //! //! This function sets the Digital Compare CBC latch clear event. //! The following are valid values for the parameters. //! - dcModule //! - EPWM_DC_MODULE_A - Digital Compare Module A //! - EPWM_DC_MODULE_B - Digital Compare Module B //! - dcEvent //! - EPWM_DC_EVENT_1 - Digital Compare Event number 1 //! - EPWM_DC_EVENT_2 - Digital Compare Event number 2 //! - clearEvent //! - EPWM_DC_CBC_LATCH_CLR_CNTR_ZERO - DC CBC latch is cleared when //! counter is zero //! - EPWM_DC_CBC_LATCH_CLR_ON_CNTR_PERIOD - DC CBC latch is cleared when //! counter is equal to period //! - EPWM_DC_CBC_LATCH_CLR_ON_CNTR_ZERO_PERIOD - DC CBC latch is cleared //! when either counter is //! zero or equal to period //! //! \return None // //***************************************************************************** static inline void EPWM_selectDigitalCompareCBCLatchClearEvent(uint32_t base, EPWM_DigitalCompareModule dcModule, EPWM_DigitalCompareEvent dcEvent, EPWM_DigitalCompareCBCLatchClearEvent clearEvent) { uint32_t registerOffset; // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 6696); } } while(0); registerOffset = 0xC3U + (uint16_t)dcModule; // // Set the DC CBC Latch Clear Event // __eallow(); if(dcEvent == EPWM_DC_EVENT_1) { (*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) = (((*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) & ~0x60U) | ((uint16_t)clearEvent << 5U)); } else { (*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) = (((*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) & ~0x6000U) | ((uint16_t)clearEvent << 13U)); } __edis(); } //***************************************************************************** // //! Gets the Digital Compare CBC latch status //! //! \param base is the base address of the EPWM module. //! \param dcModule is the Digital Compare module. //! \param dcEvent is the Digital Compare Event number. //! //! This function returns the Digital Compare module cycle-by-cycle(CBC) latch //! status. //! The following are valid values for the parameters. //! - dcModule //! - EPWM_DC_MODULE_A - Digital Compare Module A //! - EPWM_DC_MODULE_B - Digital Compare Module B //! - dcEvent //! - EPWM_DC_EVENT_1 - Digital Compare Event number 1 //! - EPWM_DC_EVENT_2 - Digital Compare Event number 2 //! //! \return Returns Digital Compare CBC latch status. //! -\b true - CBC latch is enabled //! -\b false - CBC latch is disabled // //***************************************************************************** static inline _Bool EPWM_getDigitalCompareCBCLatchStatus(uint32_t base, EPWM_DigitalCompareModule dcModule, EPWM_DigitalCompareEvent dcEvent) { uint32_t registerOffset; uint16_t status; // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 6753); } } while(0); registerOffset = 0xC3U + (uint16_t)dcModule; // // Get DC CBC Latch Clear Event // if(dcEvent == EPWM_DC_EVENT_1) { status = (*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) & 0x80U; } else { status = (*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) & 0x8000U; } return(status != 0U); } // // DC capture mode // //***************************************************************************** // //! Enables the Time Base Counter Capture controller. //! //! \param base is the base address of the EPWM module. //! //! This function enables the time Base Counter Capture. //! //! \return None. // //***************************************************************************** static inline void EPWM_enableDigitalCompareCounterCapture(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 6791); } } while(0); // // Enable Time base counter capture // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0xC8U)))) |= 0x1U; __edis(); } //***************************************************************************** // //! Disables the Time Base Counter Capture controller. //! //! \param base is the base address of the EPWM module. //! //! This function disable the time Base Counter Capture. //! //! \return None. // //***************************************************************************** static inline void EPWM_disableDigitalCompareCounterCapture(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 6818); } } while(0); // // Disable Time base counter capture // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0xC8U)))) &= ~0x1U; __edis(); } //***************************************************************************** // //! Set the Time Base Counter Capture mode. //! //! \param base is the base address of the EPWM module. //! \param enableShadowMode is the shadow read mode flag. //! //! This function sets the mode the Time Base Counter value is read from. If //! enableShadowMode is true, CPU reads of the DCCAP register will return the //! shadow register contents.If enableShadowMode is false, CPU reads of the //! DCCAP register will return the active register contents. //! //! \return None. // //***************************************************************************** static inline void EPWM_setDigitalCompareCounterShadowMode(uint32_t base, _Bool enableShadowMode) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 6849); } } while(0); __eallow(); if(enableShadowMode) { // // Enable DC counter shadow mode // (*((volatile uint16_t *)((uintptr_t)(base + 0xC8U)))) &= ~0x2U; } else { // // Disable DC counter shadow mode // (*((volatile uint16_t *)((uintptr_t)(base + 0xC8U)))) |= 0x2U; } __edis(); } //***************************************************************************** // //! Return the DC Capture event status. //! //! \param base is the base address of the EPWM module. //! //! This function returns the DC capture event status. //! //! \return Returns true if a DC capture event has occurs. //! Returns false if no DC Capture event has occurred. //! //! \return None. // //***************************************************************************** static inline _Bool EPWM_getDigitalCompareCaptureStatus(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 6889); } } while(0); // // Return the DC compare status // return(((*((volatile uint16_t *)((uintptr_t)(base + 0xC8U)))) & 0x2000U) == 0x2000U); } //***************************************************************************** // //! Return the DC Time Base Counter capture value. //! //! \param base is the base address of the EPWM module. //! //! This function returns the DC Time Base Counter capture value. The value //! read is determined by the mode as set in the //! EPWM_setTimeBaseCounterReadMode() function. //! //! \return Returns the DC Time Base Counter Capture count value. // //***************************************************************************** static inline uint16_t EPWM_getDigitalCompareCaptureCount(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 6917); } } while(0); // // Return the DC Time Base Counter Capture count value // return((*((volatile uint16_t *)((uintptr_t)(base + 0xCFU))))); } //***************************************************************************** // //! Enable DC TRIP combinational input. //! //! \param base is the base address of the EPWM module. //! \param tripInput is the Trip number. //! \param dcType is the Digital Compare module. //! //! This function enables the specified Trip input. //! Valid values for the parameters are: //! - tripInput //! - EPWM_DC_COMBINATIONAL_TRIPINx, where x is 1,2,...12,14,15 //! - dcType //! - EPWM_DC_TYPE_DCAH - Digital Compare A High //! - EPWM_DC_TYPE_DCAL - Digital Compare A Low //! - EPWM_DC_TYPE_DCBH - Digital Compare B High //! - EPWM_DC_TYPE_DCBL - Digital Compare B Low //! //! \return None. // //***************************************************************************** static inline void EPWM_enableDigitalCompareTripCombinationInput(uint32_t base, uint16_t tripInput, EPWM_DigitalCompareType dcType) { uint32_t registerOffset; // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 6956); } } while(0); // // Get the DCAHTRIPSEL, DCALTRIPSEL, DCBHTRIPSEL, DCBLTRIPSEL register // offset with respect to DCAHTRIPSEL // registerOffset = 0xD2U + (uint16_t)dcType; // // Set the DC trip input // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) = ((*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) | tripInput); // // Enable the combination input // (*((volatile uint16_t *)((uintptr_t)(base + 0xC0U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0xC0U)))) | (0xFU << ((uint16_t)dcType << 2U))); __edis(); } //***************************************************************************** // //! Disable DC TRIP combinational input. //! //! \param base is the base address of the EPWM module. //! \param tripInput is the Trip number. //! \param dcType is the Digital Compare module. //! //! This function disables the specified Trip input. //! Valid values for the parameters are: //! - tripInput //! - EPWM_DC_COMBINATIONAL_TRIPINx, where x is 1,2,...12,14,15 //! - dcType //! - EPWM_DC_TYPE_DCAH - Digital Compare A High //! - EPWM_DC_TYPE_DCAL - Digital Compare A Low //! - EPWM_DC_TYPE_DCBH - Digital Compare B High //! - EPWM_DC_TYPE_DCBL - Digital Compare B Low //! //! \return None. // //***************************************************************************** static inline void EPWM_disableDigitalCompareTripCombinationInput(uint32_t base, uint16_t tripInput, EPWM_DigitalCompareType dcType) { uint32_t registerOffset; // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 7010); } } while(0); // // Get the DCAHTRIPSEL, DCALTRIPSEL, DCBHTRIPSEL, DCBLTRIPSEL register // offset with respect to DCAHTRIPSEL // registerOffset = 0xD2U + (uint16_t)dcType; // // Set the DC trip input // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) = ((*((volatile uint16_t *)((uintptr_t)(base + registerOffset)))) & ~tripInput); __edis(); } // // Valley switching // //***************************************************************************** // //! Enable valley capture mode. //! //! \param base is the base address of the EPWM module. //! //! This function enables Valley Capture mode. //! //! \return None. // //***************************************************************************** static inline void EPWM_enableValleyCapture(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 7047); } } while(0); // // Set VCAPE bit // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x18U)))) |= 0x1U; __edis(); } //***************************************************************************** // //! Disable valley capture mode. //! //! \param base is the base address of the EPWM module. //! //! This function disables Valley Capture mode. //! //! \return None. // //***************************************************************************** static inline void EPWM_disableValleyCapture(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 7074); } } while(0); // // Clear VCAPE bit // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x18U)))) &= ~0x1U; __edis(); } //***************************************************************************** // //! Start valley capture mode. //! //! \param base is the base address of the EPWM module. //! //! This function starts Valley Capture sequence. //! //! \b Make sure you invoke EPWM_setValleyTriggerSource with the trigger //! variable set to EPWM_VALLEY_TRIGGER_EVENT_SOFTWARE before calling this //! function. //! //! \return None. // //***************************************************************************** static inline void EPWM_startValleyCapture(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 7105); } } while(0); // // Set VCAPSTART bit // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x18U)))) |= 0x2U; __edis(); } //***************************************************************************** // //! Set valley capture trigger. //! //! \param base is the base address of the EPWM module. //! \param trigger is the Valley counter trigger. //! //! This function sets the trigger value that initiates Valley Capture sequence //! //! \b Set the number of Trigger source events for starting and stopping the //! valley capture using EPWM_setValleyTriggerEdgeCounts(). //! //! \return None. // //***************************************************************************** static inline void EPWM_setValleyTriggerSource(uint32_t base, EPWM_ValleyTriggerSource trigger) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 7136); } } while(0); // // Write to TRIGSEL bits // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x18U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x18U)))) & ~0x1CU) | ((uint16_t)trigger << 2U)); __edis(); } //***************************************************************************** // //! Set valley capture trigger source count. //! //! \param base is the base address of the EPWM module. //! \param startCount //! \param stopCount //! //! This function sets the number of trigger events required to start and stop //! the valley capture count. //! Maximum values for both startCount and stopCount is 15 corresponding to the //! 15th edge of the trigger event. //! //! \b Note: //! A startCount value of 0 prevents starting the valley counter. //! A stopCount value of 0 prevents the valley counter from stopping. //! //! \return None. // //***************************************************************************** static inline void EPWM_setValleyTriggerEdgeCounts(uint32_t base, uint16_t startCount, uint16_t stopCount) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 7175); } } while(0); do { if(!((startCount < 16U) && (stopCount < 16U))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 7176); } } while(0); // // Write to STARTEDGE and STOPEDGE bits // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x19U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x19U)))) & ~(0xFU | 0xF00U)) | (startCount | (stopCount << 8U))); __edis(); } //***************************************************************************** // //! Enable valley switching delay. //! //! \param base is the base address of the EPWM module. //! //! This function enables Valley switching delay. //! //! \return None. // //***************************************************************************** static inline void EPWM_enableValleyHWDelay(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 7206); } } while(0); // // Set EDGEFILTDLYSEL bit // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x18U)))) |= 0x400U; __edis(); } //***************************************************************************** // //! Disable valley switching delay. //! //! \param base is the base address of the EPWM module. //! //! This function disables Valley switching delay. //! //! \return None. // //***************************************************************************** static inline void EPWM_disableValleyHWDelay(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 7233); } } while(0); // // Clear EDGEFILTDLYSEL bit // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x18U)))) &= ~0x400U; __edis(); } //***************************************************************************** // //! Set Valley delay values. //! //! \param base is the base address of the EPWM module. //! \param delayOffsetValue is the software defined delay offset value. //! //! This function sets the Valley delay value. //! //! \return None. // //***************************************************************************** static inline void EPWM_setValleySWDelayValue(uint32_t base, uint16_t delayOffsetValue) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 7261); } } while(0); // // Write to SWVDELVAL bits // (*((volatile uint16_t *)((uintptr_t)(base + 0x77U)))) = delayOffsetValue; } //***************************************************************************** // //! Set Valley delay mode. //! //! \param base is the base address of the EPWM module. //! \param delayMode is the Valley delay mode. //! //! This function sets the Valley delay mode values. //! //! \return None. // //***************************************************************************** static inline void EPWM_setValleyDelayDivider(uint32_t base, EPWM_ValleyDelayMode delayMode) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 7287); } } while(0); // // Write to VDELAYDIV bits // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x18U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x18U)))) & ~0x380U) | ((uint16_t)delayMode << 7U)); __edis(); } //***************************************************************************** // //! Get the valley edge status bit. //! //! \param base is the base address of the EPWM module. //! \param edge is the start or stop edge. //! //! This function returns the status of the start or stop valley status //! depending on the value of edge. //! If a start or stop edge has occurred, the function returns true, if not it //! returns false. //! //! \return Returns true if the specified edge has occurred, //! Returns false if the specified edge has not occurred. // //***************************************************************************** static inline _Bool EPWM_getValleyEdgeStatus(uint32_t base, EPWM_ValleyCounterEdge edge) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 7321); } } while(0); if(edge == EPWM_VALLEY_COUNT_START_EDGE) { // // Returns STARTEDGESTS status // return((((*((volatile uint16_t *)((uintptr_t)(base + 0x19U)))) & 0x80U) == 0x80U ) ? 1 : 0); } else { // // Returns STOPEDGESTS status // return((((*((volatile uint16_t *)((uintptr_t)(base + 0x19U)))) & 0x8000U) == 0x8000U) ? 1 : 0); } } //***************************************************************************** // //! Get the Valley Counter value. //! //! \param base is the base address of the EPWM module. //! //! This function returns the valley time base count value which is captured //! upon occurrence of the stop edge condition selected by //! EPWM_setValleyTriggerSource() and by the stopCount variable of the //! EPWM_setValleyTriggerEdgeCounts() function. //! //! \return Returns the valley base time count. // //***************************************************************************** static inline uint16_t EPWM_getValleyCount(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 7361); } } while(0); // // Read VCNTVAL register // return((*((volatile uint16_t *)((uintptr_t)(base + 0xFEU))))); } //***************************************************************************** // //! Get the Valley delay value. //! //! \param base is the base address of the EPWM module. //! //! This function returns the hardware valley delay count. //! //! \return Returns the valley delay count. // //***************************************************************************** static inline uint16_t EPWM_getValleyHWDelay(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 7386); } } while(0); // // Read HWVDELVAL register // return((*((volatile uint16_t *)((uintptr_t)(base + 0xFDU))))); } //***************************************************************************** // //! Enable Global shadow load mode. //! //! \param base is the base address of the EPWM module. //! //! This function enables Global shadow to active load mode of registers. //! The trigger source for loading shadow to active is determined by //! EPWM_setGlobalLoadTrigger() function. //! //! \return None. // //***************************************************************************** static inline void EPWM_enableGlobalLoad(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 7413); } } while(0); // // Shadow to active load is controlled globally // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x34U)))) |= 0x1U; __edis(); } //***************************************************************************** // //! Disable Global shadow load mode. //! //! \param base is the base address of the EPWM module. //! //! This function disables Global shadow to active load mode of registers. //! Loading shadow to active is determined individually. //! //! \return None. // //***************************************************************************** static inline void EPWM_disableGlobalLoad(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 7441); } } while(0); // // Shadow to active load is controlled individually // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x34U)))) &= ~0x1U; __edis(); } //***************************************************************************** // //! Set the Global shadow load pulse. //! //! \param base is the base address of the EPWM module. //! \param loadTrigger is the pulse that causes global shadow load. //! //! This function sets the pulse that causes Global shadow to active load. //! Valid values for the loadTrigger parameter are: //! //! - EPWM_GL_LOAD_PULSE_CNTR_ZERO - load when counter is equal //! to zero //! - EPWM_GL_LOAD_PULSE_CNTR_PERIOD - load when counter is equal //! to period //! - EPWM_GL_LOAD_PULSE_CNTR_ZERO_PERIOD - load when counter is equal //! to zero or period //! - EPWM_GL_LOAD_PULSE_SYNC - load on sync event //! - EPWM_GL_LOAD_PULSE_SYNC_OR_CNTR_ZERO - load on sync event or when //! counter is equal to zero //! - EPWM_GL_LOAD_PULSE_SYNC_OR_CNTR_PERIOD - load on sync event or when //! counter is equal to period //! - EPWM_GL_LOAD_PULSE_SYNC_CNTR_ZERO_PERIOD - load on sync event or when //! counter is equal to period //! or zero //! - EPWM_GL_LOAD_PULSE_GLOBAL_FORCE - load on global force //! //! \return None. // //***************************************************************************** static inline void EPWM_setGlobalLoadTrigger(uint32_t base, EPWM_GlobalLoadTrigger loadTrigger) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 7486); } } while(0); // // Set the Global shadow to active load pulse // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x34U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x34U)))) & ~0x1EU) | ((uint16_t)loadTrigger << 1U)); __edis(); } //***************************************************************************** // //! Set the number of Global load pulse event counts //! //! \param base is the base address of the EPWM module. //! \param prescalePulseCount is the pulse event counts. //! //! This function sets the number of Global Load pulse events that have to //! occurred before a global load pulse is issued. Valid values for //! prescaleCount range from 0 to 7. 0 being no event (disables counter), and 7 //! representing 7 events. //! //! \return None. // //***************************************************************************** static inline void EPWM_setGlobalLoadEventPrescale(uint32_t base, uint16_t prescalePulseCount) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 7519); } } while(0); do { if(!(prescalePulseCount < 8U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 7520); } } while(0); // // Set the number of counts that have to occur before // a load strobe is issued // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x34U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x34U)))) & ~0x380U) | (prescalePulseCount << 7U)); __edis(); } //***************************************************************************** // //! Return the number of Global load pulse event counts //! //! \param base is the base address of the EPWM module. //! //! This function returns the number of Global Load pulse events that have //! occurred. These pulse events are set by the EPWM_setGlobalLoadTrigger() //! function. //! //! \return None. // //***************************************************************************** static inline uint16_t EPWM_getGlobalLoadEventCount(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 7552); } } while(0); // // Return the number of events that have occurred // return(((*((volatile uint16_t *)((uintptr_t)(base + 0x34U)))) >> 10U) & 0x7U); } //***************************************************************************** // //! Enable continuous global shadow to active load. //! //! \param base is the base address of the EPWM module. //! //! This function enables global continuous shadow to active load. Register //! load happens every time the event set by the //! EPWM_setGlobalLoadTrigger() occurs. //! //! \return None. // //***************************************************************************** static inline void EPWM_disableGlobalLoadOneShotMode(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 7579); } } while(0); // // Enable global continuous shadow to active load // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x34U)))) &= ~0x20U; __edis(); } //***************************************************************************** // //! Enable One shot global shadow to active load. //! //! \param base is the base address of the EPWM module. //! //! This function enables a one time global shadow to active load. Register //! load happens every time the event set by the //! EPWM_setGlobalLoadTrigger() occurs. //! //! \return None. // //***************************************************************************** static inline void EPWM_enableGlobalLoadOneShotMode(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 7608); } } while(0); // // Enable global continuous shadow to active load // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x34U)))) |= 0x20U; __edis(); } //***************************************************************************** // //! Set One shot global shadow to active load pulse. //! //! \param base is the base address of the EPWM module. //! //! This function sets a one time global shadow to active load pulse. The pulse //! propagates to generate a load signal if any of the events set by //! EPWM_setGlobalLoadTrigger() occur. //! //! \return None. // //***************************************************************************** static inline void EPWM_setGlobalLoadOneShotLatch(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 7637); } } while(0); // // Set a one shot Global shadow load pulse. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x74U)))) |= 0x1U; __edis(); } //***************************************************************************** // //! Force a software One shot global shadow to active load pulse. //! //! \param base is the base address of the EPWM module. //! //! This function forces a software a one time global shadow to active load //! pulse. //! //! \return None. // //***************************************************************************** static inline void EPWM_forceGlobalLoadOneShotEvent(uint32_t base) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 7665); } } while(0); // // Force a Software Global shadow load pulse // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x74U)))) |= 0x2U; __edis(); } //***************************************************************************** // //! Enable a register to be loaded Globally. //! //! \param base is the base address of the EPWM module. //! \param loadRegister is the register. //! //! This function enables the register specified by loadRegister to be globally //! loaded. //! Valid values for loadRegister are: //! - EPWM_GL_REGISTER_TBPRD_TBPRDHR - Register TBPRD:TBPRDHR //! - EPWM_GL_REGISTER_CMPA_CMPAHR - Register CMPA:CMPAHR //! - EPWM_GL_REGISTER_CMPB_CMPBHR - Register CMPB:CMPBHR //! - EPWM_GL_REGISTER_CMPC - Register CMPC //! - EPWM_GL_REGISTER_CMPD - Register CMPD //! - EPWM_GL_REGISTER_DBRED_DBREDHR - Register DBRED:DBREDHR //! - EPWM_GL_REGISTER_DBFED_DBFEDHR - Register DBFED:DBFEDHR //! - EPWM_GL_REGISTER_DBCTL - Register DBCTL //! - EPWM_GL_REGISTER_AQCTLA_AQCTLA2 - Register AQCTLA/A2 //! - EPWM_GL_REGISTER_AQCTLB_AQCTLB2 - Register AQCTLB/B2 //! - EPWM_GL_REGISTER_AQCSFRC - Register AQCSFRC //! //! \return None. // //***************************************************************************** static inline void EPWM_enableGlobalLoadRegisters(uint32_t base, uint16_t loadRegister) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 7706); } } while(0); do { if(!((loadRegister > 0x0000U) && (loadRegister < 0x0800U))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 7707); } } while(0); // // The register specified by loadRegister is loaded globally // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x35U)))) |= loadRegister; __edis(); } //***************************************************************************** // //! Disable a register to be loaded Globally. //! //! \param base is the base address of the EPWM module. //! \param loadRegister is the register. //! //! This function disables the register specified by loadRegister from being //! loaded globally. The shadow to active load happens as specified by the //! register control //! Valid values for loadRegister are: //! - EPWM_GL_REGISTER_TBPRD_TBPRDHR - Register TBPRD:TBPRDHR //! - EPWM_GL_REGISTER_CMPA_CMPAHR - Register CMPA:CMPAHR //! - EPWM_GL_REGISTER_CMPB_CMPBHR - Register CMPB:CMPBHR //! - EPWM_GL_REGISTER_CMPC - Register CMPC //! - EPWM_GL_REGISTER_CMPD - Register CMPD //! - EPWM_GL_REGISTER_DBRED_DBREDHR - Register DBRED:DBREDHR //! - EPWM_GL_REGISTER_DBFED_DBFEDHR - Register DBFED:DBFEDHR //! - EPWM_GL_REGISTER_DBCTL - Register DBCTL //! - EPWM_GL_REGISTER_AQCTLA_AQCTLA2 - Register AQCTLA/A2 //! - EPWM_GL_REGISTER_AQCTLB_AQCTLB2 - Register AQCTLB/B2 //! - EPWM_GL_REGISTER_AQCSFRC - Register AQCSFRC //! //! \return None. // //***************************************************************************** static inline void EPWM_disableGlobalLoadRegisters(uint32_t base, uint16_t loadRegister) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 7749); } } while(0); do { if(!((loadRegister > 0x0000U) && (loadRegister < 0x0800U))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 7750); } } while(0); // // The register specified by loadRegister is loaded by individual // register configuration setting // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x35U)))) &= ~loadRegister; __edis(); } //***************************************************************************** // //! Lock EALLOW protected register groups //! //! \param base is the base address of the EPWM module. //! \param registerGroup is the EALLOW register groups. //! //! This functions locks the EALLOW protected register groups specified by //! the registerGroup variable. //! //! \return None. // //***************************************************************************** static inline void EPWM_lockRegisters(uint32_t base, EPWM_LockRegisterGroup registerGroup) { // // Check the arguments // do { if(!(EPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/epwm.h", 7780); } } while(0); // // Write the Key to EPWMLOCK register // (*((volatile uint32_t *)((uintptr_t)(base + 0xFAU)))) = ((uint32_t)0xA5A50000U | ((uint32_t)registerGroup)); } //***************************************************************************** // //! Set emulation mode //! //! \param base is the base address of the EPWM module. //! \param emulationMode is the emulation mode. //! //! This function sets the emulation behaviours of the time base counter. Valid //! values for emulationMode are: //! - EPWM_EMULATION_STOP_AFTER_NEXT_TB - Stop after next Time Base counter //! increment or decrement. //! - EPWM_EMULATION_STOP_AFTER_FULL_CYCLE - Stop when counter completes whole //! cycle. //! - EPWM_EMULATION_FREE_RUN - Free run. //! //! \return None. // //***************************************************************************** extern void EPWM_setEmulationMode(uint32_t base, EPWM_EmulationMode emulationMode); //***************************************************************************** // //! Configures ePWM signal with desired frequency & duty //! //! \param base is the base address of the EPWM module. //! \param signalParams is the desired signal parameters. //! //! This function configures the ePWM module to generate a signal with //! desired frequency & duty. //! //! \return None. // //***************************************************************************** extern void EPWM_configureSignal(uint32_t base, const EPWM_SignalParams *signalParams); //***************************************************************************** // // Close the Doxygen group. //! @} // //***************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //########################################################################### // // FILE: eqep.h // // TITLE: C28x eQEP driver. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup eqep_api eQEP //! @{ // //***************************************************************************** //########################################################################### // // FILE: hw_eqep.h // // TITLE: Definitions for the EQEP registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the EQEP register offsets // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the QDECCTL register // //***************************************************************************** // Enhancement enable // Position Counter // selection //***************************************************************************** // // The following are defines for the bit fields in the QEPCTL register // //***************************************************************************** // enable // counter // count //***************************************************************************** // // The following are defines for the bit fields in the QCAPCTL register // //***************************************************************************** // prescaler //***************************************************************************** // // The following are defines for the bit fields in the QPOSCTL register // //***************************************************************************** // width // enable/disable // load // enable //***************************************************************************** // // The following are defines for the bit fields in the QEINT register // //***************************************************************************** // interrupt enable // interrupt enable // interrupt enable // enable // interrupt enable // interrupt enable // interrupt enable // interrupt enable // enable // enable // enable //***************************************************************************** // // The following are defines for the bit fields in the QFLG register // //***************************************************************************** // interrupt flag // interrupt flag // interrupt flag // flag // interrupt flag // interrupt flag // interrupt flag // interrupt flag // flag // flag //***************************************************************************** // // The following are defines for the bit fields in the QCLR register // //***************************************************************************** // interrupt flag // interrupt flag // change interrupt flag // interrupt flag // underflow interrupt flag // overflow interrupt flag // interrupt flag // event interrupt flag // interrupt flag // interrupt flag // flag // flag //***************************************************************************** // // The following are defines for the bit fields in the QFRC register // //***************************************************************************** // interrupt // interrupt // change interrupt // interrupt // underflow interrupt // overflow interrupt // interrupt // interrupt // interrupt // interrupt //***************************************************************************** // // The following are defines for the bit fields in the QEPSTS register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the REV register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the QEPSTROBESEL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the QMACTRL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the QEPSRCSEL register // //***************************************************************************** //***************************************************************************** // // Values that can be passed to EQEP_setDecoderConfig() as the config // parameter. // //***************************************************************************** // // Operation Mode // // // Resolution // // // Swap QEPA and QEPB // //***************************************************************************** // // Values that can be passed to EQEP_setCompareConfig() as the config // parameter. // //***************************************************************************** // // Sync pulse pin // // // Shadow register use // //***************************************************************************** // // Values that can be passed to EQEP_enableInterrupt(), // EQEP_disableInterrupt(), and EQEP_clearInterruptStatus() as the // intFlags parameter and returned by EQEP_clearInterruptStatus(). // //***************************************************************************** //***************************************************************************** // // Values that can be returned by EQEP_getStatus(). // //***************************************************************************** //! Unit position event detected //! Direction was clockwise on first index event //! Direction is CW (forward) //! Direction was CW on index //! Capture timer overflow //! Direction changed between position capture events //! First index pulse occurred //! Position counter error //***************************************************************************** // // Values that can be passed to EQEP_setLatchMode() as the latchMode parameter. // //***************************************************************************** // // Position counter latch event // // // Strobe position counter latch event // //! On rising edge of strobe //! On rising edge when clockwise, on falling when counter clockwise // // Index position counter latch event // //***************************************************************************** // // Values that can be passed to EQEP_setPositionInitMode() as the initMode // parameter. // //***************************************************************************** // // Strobe events // //! On rising edge of strobe //! On rising edge when clockwise, on falling when counter clockwise // // Index events // //***************************************************************************** // //! Values that can be passed to EQEP_setPositionCounterConfig() as the \e mode //! parameter. // //***************************************************************************** typedef enum { //! Reset position on index pulse EQEP_POSITION_RESET_IDX = 0x0000, //! Reset position on maximum position EQEP_POSITION_RESET_MAX_POS = 0x1000, //! Reset position on the first index pulse EQEP_POSITION_RESET_1ST_IDX = 0x2000, //! Reset position on a unit time event EQEP_POSITION_RESET_UNIT_TIME_OUT = 0x3000 } EQEP_PositionResetMode; //***************************************************************************** // //! Values that can be passed to EQEP_setCaptureConfig() as the \e capPrescale //! parameter. CAPCLK is the capture timer clock frequency. // //***************************************************************************** typedef enum { EQEP_CAPTURE_CLK_DIV_1 = 0x00, //!< CAPCLK = SYSCLKOUT/1 EQEP_CAPTURE_CLK_DIV_2 = 0x10, //!< CAPCLK = SYSCLKOUT/2 EQEP_CAPTURE_CLK_DIV_4 = 0x20, //!< CAPCLK = SYSCLKOUT/4 EQEP_CAPTURE_CLK_DIV_8 = 0x30, //!< CAPCLK = SYSCLKOUT/8 EQEP_CAPTURE_CLK_DIV_16 = 0x40, //!< CAPCLK = SYSCLKOUT/16 EQEP_CAPTURE_CLK_DIV_32 = 0x50, //!< CAPCLK = SYSCLKOUT/32 EQEP_CAPTURE_CLK_DIV_64 = 0x60, //!< CAPCLK = SYSCLKOUT/64 EQEP_CAPTURE_CLK_DIV_128 = 0x70 //!< CAPCLK = SYSCLKOUT/128 } EQEP_CAPCLKPrescale; //***************************************************************************** // //! Values that can be passed to EQEP_setCaptureConfig() as the \e evntPrescale //! parameter. UPEVNT is the unit position event frequency. // //***************************************************************************** typedef enum { EQEP_UNIT_POS_EVNT_DIV_1, //!< UPEVNT = QCLK/1 EQEP_UNIT_POS_EVNT_DIV_2, //!< UPEVNT = QCLK/2 EQEP_UNIT_POS_EVNT_DIV_4, //!< UPEVNT = QCLK/4 EQEP_UNIT_POS_EVNT_DIV_8, //!< UPEVNT = QCLK/8 EQEP_UNIT_POS_EVNT_DIV_16, //!< UPEVNT = QCLK/16 EQEP_UNIT_POS_EVNT_DIV_32, //!< UPEVNT = QCLK/32 EQEP_UNIT_POS_EVNT_DIV_64, //!< UPEVNT = QCLK/64 EQEP_UNIT_POS_EVNT_DIV_128, //!< UPEVNT = QCLK/128 EQEP_UNIT_POS_EVNT_DIV_256, //!< UPEVNT = QCLK/256 EQEP_UNIT_POS_EVNT_DIV_512, //!< UPEVNT = QCLK/512 EQEP_UNIT_POS_EVNT_DIV_1024, //!< UPEVNT = QCLK/1024 EQEP_UNIT_POS_EVNT_DIV_2048 //!< UPEVNT = QCLK/2048 } EQEP_UPEVNTPrescale; //***************************************************************************** // //! Values that can be passed to EQEP_setStrobeSource() as the \e strobeSrc //! parameter. // //***************************************************************************** typedef enum { EQEP_STROBE_FROM_GPIO = 0, //!< Strobe signal comes from GPIO EQEP_STROBE_OR_ADCSOCA = 2, //!< Strobe signal is OR'd with ADCSOCA EQEP_STROBE_OR_ADCSOCB = 3 //!< Strobe signal is OR'd with ADCSOCB } EQEP_StrobeSource; //***************************************************************************** // //! Values that can be passed to EQEP_setQMAModuleMode() as the \e qmaMode //! parameter. // //***************************************************************************** typedef enum { EQEP_QMA_MODE_BYPASS, //!< QMA module is bypassed EQEP_QMA_MODE_1, //!< QMA mode-1 operation is selected EQEP_QMA_MODE_2 //!< QMA mode-2 operation is selected } EQEP_QMAMode; //***************************************************************************** // //! Possible values of sources for QEPA,QEPB and Index signal which are passed //! as a structure to EQEP_selectSource() as \e sourceConfig // //***************************************************************************** typedef enum { EQEP_SOURCE_DEVICE_PIN = 0x0000U, //!< signal comes from Device Pin EQEP_SOURCE_CMPSS1 = 0x0001U, //!< signal comes from CMPSS1 EQEP_SOURCE_CMPSS2 = 0x0002U, //!< signal comes from CMPSS2 EQEP_SOURCE_CMPSS3 = 0x0003U, //!< signal comes from CMPSS3 EQEP_SOURCE_CMPSS4 = 0x0004U, //!< signal comes from CMPSS4 EQEP_SOURCE_CMPSS5 = 0x0005U, //!< signal comes from CMPSS5 EQEP_SOURCE_CMPSS6 = 0x0006U, //!< signal comes from CMPSS6 EQEP_SOURCE_CMPSS7 = 0x0007U, //!< signal comes from CMPSS7 EQEP_SOURCE_CMPSS8 = 0x0008U, //!< signal comes from CMPSS8 EQEP_SOURCE_PWMXBAR1 = 0x0009U, //!< signal comes from PWMXBAR1 EQEP_SOURCE_PWMXBAR2 = 0x000AU, //!< signal comes from PWMXBAR2 EQEP_SOURCE_PWMXBAR3 = 0x000BU, //!< signal comes from PWMXBAR3 EQEP_SOURCE_PWMXBAR4 = 0x000CU, //!< signal comes from PWMXBAR4 EQEP_SOURCE_PWMXBAR5 = 0x000DU, //!< signal comes from PWMXBAR5 EQEP_SOURCE_PWMXBAR6 = 0x000EU, //!< signal comes from PWMXBAR6 EQEP_SOURCE_PWMXBAR7 = 0x000FU, //!< signal comes from PWMXBAR7 } EQEP_Source; //***************************************************************************** // //! Structure to be passed to EQEP_selectSource() as \e sourceConfig // //***************************************************************************** typedef struct { EQEP_Source sourceA; EQEP_Source sourceB; EQEP_Source sourceIndex; }EQEP_SourceSelect; //***************************************************************************** // //! Values that can be passed to EQEP_setEmulationMode() as the \e emuMode //! parameter. // //***************************************************************************** typedef enum { EQEP_EMULATIONMODE_STOPIMMEDIATELY, //!< Counters stop immediately EQEP_EMULATIONMODE_STOPATROLLOVER, //!< Counters stop at period rollover EQEP_EMULATIONMODE_RUNFREE //!< Counter unaffected by suspend }EQEP_EmulationMode; //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** //***************************************************************************** // //! \internal //! Checks an eQEP base address. //! //! \param base specifies the eQEP module base address. //! //! This function determines if a eQEP module base address is valid. //! //! \return Returns \b true if the base address is valid and \b false //! otherwise. // //***************************************************************************** static inline _Bool EQEP_isBaseValid(uint32_t base) { return((base == 0x00005100U) || (base == 0x00005140U) || (base == 0x00005180U)); } //***************************************************************************** // //! Enables the eQEP module. //! //! \param base is the base address of the eQEP module. //! //! This function enables operation of the enhanced quadrature encoder pulse //! (eQEP) module. The module must be configured before it is enabled. //! //! \sa EQEP_setConfig() //! //! \return None. // //***************************************************************************** static inline void EQEP_enableModule(uint32_t base) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 398); } } while(0); // // Enable the eQEP module. // (*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) |= 0x8U; } //***************************************************************************** // //! Disables the eQEP module. //! //! \param base is the base address of the enhanced quadrature encoder pulse //! (eQEP) module //! //! This function disables operation of the eQEP module. //! //! \return None. // //***************************************************************************** static inline void EQEP_disableModule(uint32_t base) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 424); } } while(0); // // Disable the eQEP module. // (*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) &= ~(0x8U); } //***************************************************************************** // //! Configures eQEP module's quadrature decoder unit. //! //! \param base is the base address of the eQEP module. //! \param config is the configuration for the eQEP module decoder unit. //! //! This function configures the operation of the eQEP module's quadrature //! decoder unit. The \e config parameter provides the configuration //! of the decoder and is the logical OR of several values: //! //! - \b EQEP_CONFIG_2X_RESOLUTION or \b EQEP_CONFIG_1X_RESOLUTION specify //! if both rising and falling edges should be counted or just rising edges. //! - \b EQEP_CONFIG_QUADRATURE, \b EQEP_CONFIG_CLOCK_DIR, //! \b EQEP_CONFIG_UP_COUNT, or \b EQEP_CONFIG_DOWN_COUNT specify if //! quadrature signals are being provided on QEPA and QEPB, if a direction //! signal and a clock are being provided, or if the direction should be //! hard-wired for a single direction with QEPA used for input. //! - \b EQEP_CONFIG_NO_SWAP or \b EQEP_CONFIG_SWAP to specify if the //! signals provided on QEPA and QEPB should be swapped before being //! processed. //! //! \return None. // //***************************************************************************** static inline void EQEP_setDecoderConfig(uint32_t base, uint16_t config) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 463); } } while(0); // // Write the new decoder configuration to the hardware. // (*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) & ~(0x400U | 0x800U | 0xC000U)) | config; } //***************************************************************************** // //! Configures eQEP module position counter unit. //! //! \param base is the base address of the eQEP module. //! \param mode is the configuration for the eQEP module position counter. //! \param maxPosition specifies the maximum position value. //! //! This function configures the operation of the eQEP module position //! counter. The \e mode parameter determines the event on which the position //! counter gets reset. It should be passed one of the following values: //! \b EQEP_POSITION_RESET_IDX, \b EQEP_POSITION_RESET_MAX_POS, //! \b EQEP_POSITION_RESET_1ST_IDX, or \b EQEP_POSITION_RESET_UNIT_TIME_OUT. //! //! \e maxPosition is the maximum value of the position counter and is //! the value used to reset the position capture when moving in the reverse //! (negative) direction. //! //! \return None. // //***************************************************************************** static inline void EQEP_setPositionCounterConfig(uint32_t base, EQEP_PositionResetMode mode, uint32_t maxPosition) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 502); } } while(0); // // Write the position counter reset configuration to the hardware. // (*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) & ~0x3000U) | (uint16_t)mode; // // Set the maximum position. // (*((volatile uint32_t *)((uintptr_t)(base + 0x4U)))) = maxPosition; } //***************************************************************************** // //! Gets the current encoder position. //! //! \param base is the base address of the eQEP module. //! //! This function returns the current position of the encoder. Depending upon //! the configuration of the encoder, and the incident of an index pulse, this //! value may or may not contain the expected data (that is, if in reset on //! index mode, if an index pulse has not been encountered, the position //! counter is not yet aligned with the index pulse). //! //! \return The current position of the encoder. // //***************************************************************************** static inline uint32_t EQEP_getPosition(uint32_t base) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 537); } } while(0); // // Return the current position counter. // return((*((volatile uint32_t *)((uintptr_t)(base + 0x0U))))); } //***************************************************************************** // //! Sets the current encoder position. //! //! \param base is the base address of the eQEP module. //! \param position is the new position for the encoder. //! //! This function sets the current position of the encoder; the encoder //! position is then measured relative to this value. //! //! \return None. // //***************************************************************************** static inline void EQEP_setPosition(uint32_t base, uint32_t position) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 564); } } while(0); // // Set the position counter. // (*((volatile uint32_t *)((uintptr_t)(base + 0x0U)))) = position; } //***************************************************************************** // //! Gets the current direction of rotation. //! //! \param base is the base address of the eQEP module. //! //! This function returns the current direction of rotation. In this case, //! current means the most recently detected direction of the encoder; it may //! not be presently moving but this is the direction it last moved before it //! stopped. //! //! \return Returns 1 if moving in the forward direction or -1 if moving in the //! reverse direction. // //***************************************************************************** static inline int16_t EQEP_getDirection(uint32_t base) { int16_t direction; // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 595); } } while(0); // // Return the direction of rotation. // if(((*((volatile uint16_t *)((uintptr_t)(base + 0x1CU)))) & 0x20U) != 0U) { direction = 1; } else { direction = -1; } return(direction); } //***************************************************************************** // //! Enables individual eQEP module interrupt sources. //! //! \param base is the base address of the eQEP module. //! \param intFlags is a bit mask of the interrupt sources to be enabled. //! //! This function enables eQEP module interrupt sources. The \e intFlags //! parameter can be any of the following values OR'd together: //! - \b EQEP_INT_POS_CNT_ERROR - Position counter error //! - \b EQEP_INT_PHASE_ERROR - Quadrature phase error //! - \b EQEP_INT_DIR_CHANGE - Quadrature direction change //! - \b EQEP_INT_WATCHDOG - Watchdog time-out //! - \b EQEP_INT_UNDERFLOW - Position counter underflow //! - \b EQEP_INT_OVERFLOW - Position counter overflow //! - \b EQEP_INT_POS_COMP_READY - Position-compare ready //! - \b EQEP_INT_POS_COMP_MATCH - Position-compare match //! - \b EQEP_INT_STROBE_EVNT_LATCH - Strobe event latch //! - \b EQEP_INT_INDEX_EVNT_LATCH - Index event latch //! - \b EQEP_INT_UNIT_TIME_OUT - Unit time-out //! //! \return None. // //***************************************************************************** static inline void EQEP_enableInterrupt(uint32_t base, uint16_t intFlags) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 642); } } while(0); // // Enable the specified interrupts. // (*((volatile uint16_t *)((uintptr_t)(base + 0x18U)))) |= intFlags; } //***************************************************************************** // //! Disables individual eQEP module interrupt sources. //! //! \param base is the base address of the eQEP module. //! \param intFlags is a bit mask of the interrupt sources to be disabled. //! //! This function disables eQEP module interrupt sources. The \e intFlags //! parameter can be any of the following values OR'd together: //! - \b EQEP_INT_POS_CNT_ERROR - Position counter error //! - \b EQEP_INT_PHASE_ERROR - Quadrature phase error //! - \b EQEP_INT_DIR_CHANGE - Quadrature direction change //! - \b EQEP_INT_WATCHDOG - Watchdog time-out //! - \b EQEP_INT_UNDERFLOW - Position counter underflow //! - \b EQEP_INT_OVERFLOW - Position counter overflow //! - \b EQEP_INT_POS_COMP_READY - Position-compare ready //! - \b EQEP_INT_POS_COMP_MATCH - Position-compare match //! - \b EQEP_INT_STROBE_EVNT_LATCH - Strobe event latch //! - \b EQEP_INT_INDEX_EVNT_LATCH - Index event latch //! - \b EQEP_INT_UNIT_TIME_OUT - Unit time-out //! //! \return None. // //***************************************************************************** static inline void EQEP_disableInterrupt(uint32_t base, uint16_t intFlags) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 680); } } while(0); // // Disable the specified interrupts. // (*((volatile uint16_t *)((uintptr_t)(base + 0x18U)))) &= ~(intFlags); } //***************************************************************************** // //! Gets the current interrupt status. //! //! \param base is the base address of the eQEP module. //! //! This function returns the interrupt status for the eQEP module //! module. //! //! \return Returns the current interrupt status, enumerated as a bit field of //! the following values: //! - \b EQEP_INT_GLOBAL - Global interrupt flag //! - \b EQEP_INT_POS_CNT_ERROR - Position counter error //! - \b EQEP_INT_PHASE_ERROR - Quadrature phase error //! - \b EQEP_INT_DIR_CHANGE - Quadrature direction change //! - \b EQEP_INT_WATCHDOG - Watchdog time-out //! - \b EQEP_INT_UNDERFLOW - Position counter underflow //! - \b EQEP_INT_OVERFLOW - Position counter overflow //! - \b EQEP_INT_POS_COMP_READY - Position-compare ready //! - \b EQEP_INT_POS_COMP_MATCH - Position-compare match //! - \b EQEP_INT_STROBE_EVNT_LATCH - Strobe event latch //! - \b EQEP_INT_INDEX_EVNT_LATCH - Index event latch //! - \b EQEP_INT_UNIT_TIME_OUT - Unit time-out // //***************************************************************************** static inline uint16_t EQEP_getInterruptStatus(uint32_t base) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 719); } } while(0); return((*((volatile uint16_t *)((uintptr_t)(base + 0x19U))))); } //***************************************************************************** // //! Clears eQEP module interrupt sources. //! //! \param base is the base address of the eQEP module. //! \param intFlags is a bit mask of the interrupt sources to be cleared. //! //! This function clears eQEP module interrupt flags. The \e intFlags //! parameter can be any of the following values OR'd together: //! - \b EQEP_INT_GLOBAL - Global interrupt flag //! - \b EQEP_INT_POS_CNT_ERROR - Position counter error //! - \b EQEP_INT_PHASE_ERROR - Quadrature phase error //! - \b EQEP_INT_DIR_CHANGE - Quadrature direction change //! - \b EQEP_INT_WATCHDOG - Watchdog time-out //! - \b EQEP_INT_UNDERFLOW - Position counter underflow //! - \b EQEP_INT_OVERFLOW - Position counter overflow //! - \b EQEP_INT_POS_COMP_READY - Position-compare ready //! - \b EQEP_INT_POS_COMP_MATCH - Position-compare match //! - \b EQEP_INT_STROBE_EVNT_LATCH - Strobe event latch //! - \b EQEP_INT_INDEX_EVNT_LATCH - Index event latch //! - \b EQEP_INT_UNIT_TIME_OUT - Unit time-out //! //! Note that the \b EQEP_INT_GLOBAL value is the global interrupt flag. In //! order to get any further eQEP interrupts, this flag must be cleared. //! //! \return None. // //***************************************************************************** static inline void EQEP_clearInterruptStatus(uint32_t base, uint16_t intFlags) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 758); } } while(0); // // Clear the requested interrupt sources. // (*((volatile uint16_t *)((uintptr_t)(base + 0x1AU)))) = intFlags; } //***************************************************************************** // //! Forces individual eQEP module interrupts. //! //! \param base is the base address of the eQEP module. //! \param intFlags is a bit mask of the interrupt sources to be forced. //! //! This function forces eQEP module interrupt flags. The \e intFlags //! parameter can be any of the following values OR'd together: //! - \b EQEP_INT_POS_CNT_ERROR //! - \b EQEP_INT_PHASE_ERROR //! - \b EQEP_INT_DIR_CHANGE //! - \b EQEP_INT_WATCHDOG //! - \b EQEP_INT_UNDERFLOW //! - \b EQEP_INT_OVERFLOW //! - \b EQEP_INT_POS_COMP_READY //! - \b EQEP_INT_POS_COMP_MATCH //! - \b EQEP_INT_STROBE_EVNT_LATCH //! - \b EQEP_INT_INDEX_EVNT_LATCH //! - \b EQEP_INT_UNIT_TIME_OUT //! //! \return None. // //***************************************************************************** static inline void EQEP_forceInterrupt(uint32_t base, uint16_t intFlags) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 796); } } while(0); // // Force the specified interrupts. // (*((volatile uint16_t *)((uintptr_t)(base + 0x1BU)))) |= intFlags; } //***************************************************************************** // //! Gets the encoder error indicator. //! //! \param base is the base address of the eQEP module. //! //! This function returns the error indicator for the eQEP module. It is an //! error for both of the signals of the quadrature input to change at the same //! time. //! //! \return Returns \b true if an error has occurred and \b false otherwise. // //***************************************************************************** static inline _Bool EQEP_getError(uint32_t base) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 823); } } while(0); // // Return the error indicator. // return(((*((volatile uint16_t *)((uintptr_t)(base + 0x19U)))) & 0x4U) != 0U); } //***************************************************************************** // //! Returns content of the eQEP module status register //! //! \param base is the base address of the eQEP module. //! //! This function returns the contents of the status register. The value it //! returns is an OR of the following values: //! //! - \b EQEP_STS_UNIT_POS_EVNT - Unit position event detected //! - \b EQEP_STS_DIR_ON_1ST_IDX - If set, clockwise rotation (forward //! movement) occurred on the first index event //! - \b EQEP_STS_DIR_FLAG - If set, movement is clockwise rotation //! - \b EQEP_STS_DIR_LATCH - If set, clockwise rotation occurred on last //! index event marker //! - \b EQEP_STS_CAP_OVRFLW_ERROR - Overflow occurred in eQEP capture timer //! - \b EQEP_STS_CAP_DIR_ERROR - Direction change occurred between position //! capture events //! - \b EQEP_STS_1ST_IDX_FLAG - Set by the occurrence of the first index //! pulse //! - \b EQEP_STS_POS_CNT_ERROR - Position counter error occurred //! //! \return Returns the value of the QEP status register. // //***************************************************************************** static inline uint16_t EQEP_getStatus(uint32_t base) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 862); } } while(0); // // Return the status register. // return((*((volatile uint16_t *)((uintptr_t)(base + 0x1CU)))) & 0x00FFU); } //***************************************************************************** // //! Clears selected fields of the eQEP module status register //! //! \param base is the base address of the eQEP module. //! \param statusFlags is the bit mask of the status flags to be cleared. //! //! This function clears the status register fields indicated by //! \e statusFlags. The \e statusFlags parameter is the logical OR of any of //! the following: //! //! - \b EQEP_STS_UNIT_POS_EVNT - Unit position event detected //! - \b EQEP_STS_CAP_OVRFLW_ERROR - Overflow occurred in eQEP capture timer //! - \b EQEP_STS_CAP_DIR_ERROR - Direction change occurred between position //! capture events //! - \b EQEP_STS_1ST_IDX_FLAG - Set by the occurrence of the first index //! pulse //! //! \note Only the above status fields can be cleared. All others are //! read-only, non-sticky fields. //! //! \return None. // //***************************************************************************** static inline void EQEP_clearStatus(uint32_t base, uint16_t statusFlags) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 900); } } while(0); // // Clear the requested interrupt sources. // (*((volatile uint16_t *)((uintptr_t)(base + 0x1CU)))) = statusFlags; } //***************************************************************************** // //! Configures eQEP module edge-capture unit. //! //! \param base is the base address of the eQEP module. //! \param capPrescale is the prescaler setting of the eQEP capture timer clk. //! \param evntPrescale is the prescaler setting of the unit position event //! frequency. //! //! This function configures the operation of the eQEP module edge-capture //! unit. The \e capPrescale parameter provides the configuration of the eQEP //! capture timer clock rate. It determines by which power of 2 between 1 and //! 128 inclusive SYSCLKOUT is divided. The macros for this parameter are in //! the format of EQEP_CAPTURE_CLK_DIV_X, where X is the divide value. For //! example, \b EQEP_CAPTURE_CLK_DIV_32 will give a capture timer clock //! frequency that is SYSCLKOUT/32. //! //! The \e evntPrescale parameter determines how frequently a unit position //! event occurs. The macro that can be passed this parameter is in the format //! EQEP_UNIT_POS_EVNT_DIV_X, where X is the number of quadrature clock //! periods between unit position events. For example, //! \b EQEP_UNIT_POS_EVNT_DIV_16 will result in a unit position event //! frequency of QCLK/16. //! //! \return None. // //***************************************************************************** static inline void EQEP_setCaptureConfig(uint32_t base, EQEP_CAPCLKPrescale capPrescale, EQEP_UPEVNTPrescale evntPrescale) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 942); } } while(0); // // Write new prescaler configurations to the appropriate registers. // (*((volatile uint16_t *)((uintptr_t)(base + 0x16U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x16U)))) & ~(0xFU | 0x70U)) | ((uint16_t)evntPrescale | (uint16_t)capPrescale); } //***************************************************************************** // //! Enables the eQEP module edge-capture unit. //! //! \param base is the base address of the eQEP module. //! //! This function enables operation of the eQEP module's edge-capture unit. //! //! \return None. // //***************************************************************************** static inline void EQEP_enableCapture(uint32_t base) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 970); } } while(0); // // Enable edge capture. // (*((volatile uint16_t *)((uintptr_t)(base + 0x16U)))) |= 0x8000U; } //***************************************************************************** // //! Disables the eQEP module edge-capture unit. //! //! \param base is the base address of the eQEP module. //! //! This function disables operation of the eQEP module's edge-capture unit. //! //! \return None. // //***************************************************************************** static inline void EQEP_disableCapture(uint32_t base) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 995); } } while(0); // // Disable edge capture. // (*((volatile uint16_t *)((uintptr_t)(base + 0x16U)))) &= ~(0x8000U); } //***************************************************************************** // //! Gets the encoder capture period. //! //! \param base is the base address of the eQEP module. //! //! This function returns the period count value between the last successive //! eQEP position events. //! //! \return The period count value between the last successive position events. // //***************************************************************************** static inline uint16_t EQEP_getCapturePeriod(uint32_t base) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 1021); } } while(0); // // Return the capture period. // return((*((volatile uint16_t *)((uintptr_t)(base + 0x1EU))))); } //***************************************************************************** // //! Gets the encoder capture timer value. //! //! \param base is the base address of the eQEP module. //! //! This function returns the time base for the edge capture unit. //! //! \return The capture timer value. // //***************************************************************************** static inline uint16_t EQEP_getCaptureTimer(uint32_t base) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 1046); } } while(0); // // Return the capture timer value. // return((*((volatile uint16_t *)((uintptr_t)(base + 0x1DU))))); } //***************************************************************************** // //! Enables the eQEP module position-compare unit. //! //! \param base is the base address of the eQEP module. //! //! This function enables operation of the eQEP module's position-compare unit. //! //! \return None. // //***************************************************************************** static inline void EQEP_enableCompare(uint32_t base) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 1071); } } while(0); // // Enable position compare. // (*((volatile uint16_t *)((uintptr_t)(base + 0x17U)))) |= 0x1000U; } //***************************************************************************** // //! Disables the eQEP module position-compare unit. //! //! \param base is the base address of the eQEP module. //! //! This function disables operation of the eQEP module's position-compare //! unit. //! //! \return None. // //***************************************************************************** static inline void EQEP_disableCompare(uint32_t base) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 1097); } } while(0); // // Disable position compare. // (*((volatile uint16_t *)((uintptr_t)(base + 0x17U)))) &= ~(0x1000U); } //***************************************************************************** // //! Configures the position-compare unit's sync output pulse width. //! //! \param base is the base address of the eQEP module. //! \param cycles is the width of the pulse that can be generated on a //! position-compare event. It is in units of 4 SYSCLKOUT cycles. //! //! This function configures the width of the sync output pulse. The width of //! the pulse will be \e cycles * 4 * the width of a SYSCLKOUT cycle. The //! maximum width is 4096 * 4 * SYSCLKOUT cycles. //! //! \return None. // //***************************************************************************** static inline void EQEP_setComparePulseWidth(uint32_t base, uint16_t cycles) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 1126); } } while(0); do { if(!(cycles <= (0xFFFU + 1U))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 1127); } } while(0); // // Set the pulse width. // (*((volatile uint16_t *)((uintptr_t)(base + 0x17U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x17U)))) & ~(uint16_t)0xFFFU) | (cycles - 1U); } //***************************************************************************** // //! Loads the eQEP module unit timer period as number of SYSCLK cycles. //! //! \param base is the base address of the eQEP module. //! \param period is period value at which a unit time-out interrupt is set. //! //! This function sets the unit time-out interrupt when it matches the value //! specified by \e period //! The unit timer is clocked by SYSCLKOUT //! //! \return None. // //***************************************************************************** static inline void EQEP_loadUnitTimer(uint32_t base, uint32_t period) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 1157); } } while(0); // // Set the period of the unit timer. // (*((volatile uint32_t *)((uintptr_t)(base + 0x10U)))) = period; } //***************************************************************************** // //! Enables the eQEP module unit timer. //! //! \param base is the base address of the eQEP module. //! \param period is period value at which a unit time-out interrupt is set. //! //! This function enables operation of the eQEP module's peripheral unit timer. //! The unit timer is clocked by SYSCLKOUT and will set the unit time-out //! interrupt when it matches the value specified by \e period. //! //! \return None. // //***************************************************************************** static inline void EQEP_enableUnitTimer(uint32_t base, uint32_t period) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 1185); } } while(0); // // Set the period of the unit timer. // (*((volatile uint32_t *)((uintptr_t)(base + 0x10U)))) = period; // // Enable peripheral unit timer. // (*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) |= 0x2U; } //***************************************************************************** // //! Disables the eQEP module unit timer. //! //! \param base is the base address of the eQEP module. //! //! This function disables operation of the eQEP module's peripheral //! unit timer. //! //! \return None. // //***************************************************************************** static inline void EQEP_disableUnitTimer(uint32_t base) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 1216); } } while(0); // // Disable peripheral unit timer. // (*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) &= ~(0x2U); } //***************************************************************************** // //! Enables the eQEP module watchdog timer. //! //! \param base is the base address of the eQEP module. //! \param period is watchdog period value at which a time-out will occur if //! no quadrature-clock event is detected. //! //! This function enables operation of the eQEP module's peripheral watchdog //! timer. //! //! \note When selecting \e period, note that the watchdog timer is clocked //! from SYSCLKOUT/64. //! //! \return None. // //***************************************************************************** static inline void EQEP_enableWatchdog(uint32_t base, uint16_t period) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 1247); } } while(0); // // Set the timeout count for the eQEP peripheral watchdog timer. // (*((volatile uint16_t *)((uintptr_t)(base + 0x13U)))) = period; // // Enable peripheral watchdog. // (*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) |= 0x1U; } //***************************************************************************** // //! Disables the eQEP module watchdog timer. //! //! \param base is the base address of the eQEP module. //! //! This function disables operation of the eQEP module's peripheral watchdog //! timer. //! //! \return None. // //***************************************************************************** static inline void EQEP_disableWatchdog(uint32_t base) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 1278); } } while(0); // // Disable peripheral watchdog. // (*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) &= ~(0x1U); } //***************************************************************************** // //! Sets the eQEP module watchdog timer value. //! //! \param base is the base address of the eQEP module. //! \param value is the value to be written to the watchdog timer. //! //! This function sets the eQEP module's watchdog timer value. //! //! \return None. // //***************************************************************************** static inline void EQEP_setWatchdogTimerValue(uint32_t base, uint16_t value) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 1304); } } while(0); // // Write the value to the watchdog timer register. // (*((volatile uint16_t *)((uintptr_t)(base + 0x12U)))) = value; } //***************************************************************************** // //! Gets the eQEP module watchdog timer value. //! //! \param base is the base address of the eQEP module. //! //! \return Returns the current watchdog timer value. // //***************************************************************************** static inline uint16_t EQEP_getWatchdogTimerValue(uint32_t base) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 1327); } } while(0); // // Read the value from the watchdog timer register. // return((*((volatile uint16_t *)((uintptr_t)(base + 0x12U))))); } //***************************************************************************** // //! Configures the mode in which the position counter is initialized. //! //! \param base is the base address of the eQEP module. //! \param initMode is the configuration for initializing the position count. //! See below for a description of this parameter. //! //! This function configures the events on which the position count can be //! initialized. The \e initMode parameter provides the mode as either //! \b EQEP_INIT_DO_NOTHING (no action configured) or one of the following //! strobe events, index events, or a logical OR of both a strobe event and an //! index event. //! //! - \b EQEP_INIT_RISING_STROBE or \b EQEP_INIT_EDGE_DIR_STROBE specify //! which strobe event will initialize the position counter. //! - \b EQEP_INIT_RISING_INDEX or \b EQEP_INIT_FALLING_INDEX specify //! which index event will initialize the position counter. //! //! Use EQEP_setSWPositionInit() to cause a software initialization and //! EQEP_setInitialPosition() to set the value that gets loaded into the //! position counter upon initialization. //! //! \return None. // //***************************************************************************** static inline void EQEP_setPositionInitMode(uint32_t base, uint16_t initMode) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 1367); } } while(0); // // Set the init mode in the QEP Control register. // (*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) & ~(0x300U | 0xC00U)) | initMode; } //***************************************************************************** // //! Sets the software initialization of the encoder position counter. //! //! \param base is the base address of the eQEP module. //! \param initialize is a flag to specify if software initialization of the //! position counter is enabled. //! //! This function does a software initialization of the position counter when //! the \e initialize parameter is \b true. When \b false, the QEPCTL[SWI] bit //! is cleared and no action is taken. //! //! The init value to be loaded into the position counter can be set with //! EQEP_setInitialPosition(). Additional initialization causes can be //! configured with EQEP_setPositionInitMode(). //! //! \return None. // //***************************************************************************** static inline void EQEP_setSWPositionInit(uint32_t base, _Bool initialize) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 1402); } } while(0); // // Set or clear the software initialization bit. // if(initialize) { (*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) |= 0x80U; } else { (*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) &= ~0x80U; } } //***************************************************************************** // //! Sets the init value for the encoder position counter. //! //! \param base is the base address of the eQEP module. //! \param position is the value to be written to the position counter upon. //! initialization. //! //! This function sets the init value for position of the encoder. See //! EQEP_setPositionInitMode() to set the initialization cause or //! EQEP_setSWPositionInit() to cause a software initialization. //! //! \return None. // //***************************************************************************** static inline void EQEP_setInitialPosition(uint32_t base, uint32_t position) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 1438); } } while(0); // // Write position to position counter init register // (*((volatile uint32_t *)((uintptr_t)(base + 0x2U)))) = position; } //***************************************************************************** // //! Configures the quadrature modes in which the position count can be latched. //! //! \param base is the base address of the eQEP module. //! \param latchMode is the configuration for latching of the position count //! and several other registers. See below for a description of this //! parameter. //! //! This function configures the events on which the position count and several //! other registers can be latched. The \e latchMode parameter provides the //! mode as the logical OR of several values. //! //! - \b EQEP_LATCH_CNT_READ_BY_CPU or \b EQEP_LATCH_UNIT_TIME_OUT specify //! the event that latches the position counter. This latch register can be //! read using EQEP_getPositionLatch(). The capture timer and capture //! period are also latched based on this setting, and can be read using //! EQEP_getCaptureTimerLatch() and EQEP_getCapturePeriodLatch(). //! - \b EQEP_LATCH_RISING_STROBE or \b EQEP_LATCH_EDGE_DIR_STROBE //! specify which strobe event will latch the position counter into the //! strobe position latch register. This register can be read with //! EQEP_getStrobePositionLatch(). //! - \b EQEP_LATCH_RISING_INDEX, \b EQEP_LATCH_FALLING_INDEX, or //! \b EQEP_LATCH_SW_INDEX_MARKER specify which index event will latch the //! position counter into the index position latch register. This register //! can be read with EQEP_getIndexPositionLatch(). //! //! \return None. // //***************************************************************************** static inline void EQEP_setLatchMode(uint32_t base, uint32_t latchMode) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 1482); } } while(0); // // Set the latch mode in the QEP Control register. // (*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) & ~(0x4U | 0x30U | 0x40U)) | latchMode; } //***************************************************************************** // //! Gets the encoder position that was latched on an index event. //! //! \param base is the base address of the eQEP module. //! //! This function returns the value in the index position latch register. The //! position counter is latched into this register on either a rising index //! edge, a falling index edge, or a software index marker. This is configured //! using EQEP_setLatchMode(). //! //! \return The position count latched on an index event. // //***************************************************************************** static inline uint32_t EQEP_getIndexPositionLatch(uint32_t base) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 1512); } } while(0); // // Return the current position counter. // return((*((volatile uint32_t *)((uintptr_t)(base + 0x8U))))); } //***************************************************************************** // //! Gets the encoder position that was latched on a strobe event. //! //! \param base is the base address of the eQEP module. //! //! This function returns the value in the strobe position latch register. The //! position counter can be configured to be latched into this register on //! rising strobe edges only or on rising strobe edges while moving clockwise //! and falling strobe edges while moving counter-clockwise. This is configured //! using EQEP_setLatchMode(). //! //! \return The position count latched on a strobe event. // //***************************************************************************** static inline uint32_t EQEP_getStrobePositionLatch(uint32_t base) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 1541); } } while(0); // // Return the current position counter. // return((*((volatile uint32_t *)((uintptr_t)(base + 0xAU))))); } //***************************************************************************** // //! Gets the encoder position that was latched on a unit time-out event. //! //! \param base is the base address of the eQEP module. //! //! This function returns the value in the position latch register. The //! position counter is latched into this register either on a unit time-out //! event. //! //! \return The position count latch register value. // //***************************************************************************** static inline uint32_t EQEP_getPositionLatch(uint32_t base) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 1568); } } while(0); // // Return the current position counter. // return((*((volatile uint32_t *)((uintptr_t)(base + 0xCU))))); } //***************************************************************************** // //! Gets the encoder capture timer latch. //! //! \param base is the base address of the eQEP module. //! //! This function returns the value in the capture timer latch register. The //! capture timer value is latched into this register either on a unit time-out //! event or upon the CPU reading the eQEP position counter. This is configured //! using EQEP_setLatchMode(). //! //! \return The edge-capture timer latch value. // //***************************************************************************** static inline uint16_t EQEP_getCaptureTimerLatch(uint32_t base) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 1596); } } while(0); // // Return the current position counter. // return((*((volatile uint16_t *)((uintptr_t)(base + 0x1FU))))); } //***************************************************************************** // //! Gets the encoder capture period latch. //! //! \param base is the base address of the eQEP module. //! //! This function returns the value in the capture period latch register. The //! capture period value is latched into this register either on a unit //! time-out event or upon the CPU reading the eQEP position counter. This is //! configured using EQEP_setLatchMode(). //! //! \return The edge-capture period latch value. // //***************************************************************************** static inline uint16_t EQEP_getCapturePeriodLatch(uint32_t base) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 1624); } } while(0); // // Return the current position counter. // return((*((volatile uint16_t *)((uintptr_t)(base + 0x20U))))); } //***************************************************************************** // //! Set the quadrature mode adapter (QMA) module mode //! //! \param base is the base address of the eQEP module. //! \param qmaMode is the mode in which the QMA module will operate. //! //! This function sets the quadrature mode adapter module mode. The possible //! modes are passed to the function through the \e qmaMode parameter which //! can take the values EQEP_QMA_MODE_BYPASS, EQEP_QMA_MODE_1, or //! EQEP_QMA_MODE_2. //! //! To use the QMA module, you must first put the eQEP module into //! direction-count mode (\b EQEP_CONFIG_CLOCK_DIR) using EQEP_setConfig(). //! //! \return None. // //***************************************************************************** static inline void EQEP_setQMAModuleMode(uint32_t base, EQEP_QMAMode qmaMode) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 1656); } } while(0); // // Write the QMA module mode into the appropriate register. // (*((volatile uint16_t *)((uintptr_t)(base + 0x34U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x34U)))) & ~0x7U) | (uint16_t)qmaMode; } //***************************************************************************** // //! Set the strobe input source of the eQEP module. //! //! \param base is the base address of the eQEP module. //! \param strobeSrc is the source of the strobe signal. //! //! This function sets the source of the eQEP module's strobe signal. The //! possible values of the \e strobeSrc parameter are //! - \b EQEP_STROBE_FROM_GPIO - The strobe is used as-is after passing through //! the polarity select logic. //! - \b EQEP_STROBE_OR_ADCSOCA - The strobe is OR'd with the ADCSOCA signal //! after passing through the polarity select logic. //! - \b EQEP_STROBE_OR_ADCSOCB - The strobe is OR'd with the ADCSOCB signal //! after passing through the polarity select logic. //! //! \return None. // //***************************************************************************** static inline void EQEP_setStrobeSource(uint32_t base, EQEP_StrobeSource strobeSrc) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 1691); } } while(0); // // Write the strobe source selection into the appropriate register. // (*((volatile uint16_t *)((uintptr_t)(base + 0x32U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x32U)))) & ~0x3U) | (uint16_t)strobeSrc; } //***************************************************************************** // //! Enables the index direction enhancement mode of the eQEP module //! //! \param base is the base address of the eQEP module. //! //! This function enables the enhancement mode for direction change //! during Index event //! //! \return None. // //***************************************************************************** static inline void EQEP_enableDirectionChangeDuringIndex(uint32_t base) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 1719); } } while(0); // //Sets the index direction enhancement bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) |= 0x1U; } //***************************************************************************** // //! Disables the index direction enhancement mode of the eQEP module //! //! \param base is the base address of the eQEP module. //! //! This function disables the enhancement mode for direction change //! during Index event //! //! \return None. // //***************************************************************************** static inline void EQEP_disableDirectionChangeDuringIndex(uint32_t base) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 1745); } } while(0); // //Clears the index direction enhancement bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) &= ~(0x1U); } //***************************************************************************** // //! Selects the source for eQEPA/B/I signals //! //! \param base is the base address of the enhanced quadrature encoder pulse //! (eQEP) module //! \param sourceConfig is the structure that contains source configuration //! //! This function configures the sources for QEPA,QEPB and Index of eQEP module //! //! \return None. // //***************************************************************************** static inline void EQEP_selectSource(uint32_t base, EQEP_SourceSelect sourceConfig ) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 1772); } } while(0); // // Selecting sources for eQEP signals // (*((volatile uint32_t *)((uintptr_t)(base + 0x36U)))) = ((*((volatile uint32_t *)((uintptr_t)(base + 0x36U)))) & ~(0xFU | 0xF0U | 0xF00U)) | ((uint32_t)((uint32_t)(sourceConfig.sourceA) << 0U) | (uint32_t)((uint32_t)(sourceConfig.sourceB) << 4U) | (uint32_t)((uint32_t)(sourceConfig.sourceIndex) << 8U)); } //***************************************************************************** // //! Set the emulation mode of the eQEP module. //! //! \param base is the base address of the eQEP module. //! \param emuMode is the mode operation upon an emulation suspend. //! //! This function sets the eQEP module's emulation mode. This mode determines //! how the timers are affected by an emulation suspend. Valid values for the //! \e emuMode parameter are the following: //! //! - \b EQEP_EMULATIONMODE_STOPIMMEDIATELY - The position counter, watchdog //! counter, unit timer, and capture timer all stop immediately. //! - \b EQEP_EMULATIONMODE_STOPATROLLOVER - The position counter, watchdog //! counter, unit timer all count until period rollover. The capture timer //! counts until the next unit period event. //! - \b EQEP_EMULATIONMODE_RUNFREE - The position counter, watchdog counter, //! unit timer, and capture timer are all unaffected by an emulation suspend. //! //! \return None. // //***************************************************************************** static inline void EQEP_setEmulationMode(uint32_t base, EQEP_EmulationMode emuMode) { // // Check the arguments. // do { if(!(EQEP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/eqep.h", 1816); } } while(0); // // Write the emulation mode to the FREE_SOFT bits. // (*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x15U)))) & ~0xC000U) | ((uint16_t)emuMode << 14U); } //***************************************************************************** // //! Configures eQEP module position-compare unit. //! //! \param base is the base address of the eQEP module. //! \param config is the configuration for the eQEP module //! position-compare unit. See below for a description of this parameter. //! \param compareValue is the value to which the position count value is //! compared for a position-compare event. //! \param cycles is the width of the pulse that can be generated on a //! position-compare event. It is in units of 4 SYSCLKOUT cycles. //! //! This function configures the operation of the eQEP module position-compare //! unit. The \e config parameter provides the configuration of the //! position-compare unit and is the logical OR of several values: //! //! - \b EQEP_COMPARE_NO_SYNC_OUT, \b EQEP_COMPARE_IDX_SYNC_OUT, or //! \b EQEP_COMPARE_STROBE_SYNC_OUT specify if there is a sync output pulse //! and which pin should be used. //! - \b EQEP_COMPARE_NO_SHADOW, \b EQEP_COMPARE_LOAD_ON_ZERO, or //! \b EQEP_COMPARE_LOAD_ON_MATCH specify if a shadow is enabled and when //! should the load should occur--QPOSCNT = 0 or QPOSCNT = QPOSCOMP. //! //! The \e cycles is used to select the width of the sync output pulse. The //! width of the resulting pulse will be \e cycles * 4 * the width of a //! SYSCLKOUT cycle. The maximum width is 4096 * 4 * SYSCLKOUT cycles. //! //! \note You can set the sync pulse width independently using the //! EQEP_setComparePulseWidth() function. //! //! \return None. // //***************************************************************************** extern void EQEP_setCompareConfig(uint32_t base, uint16_t config, uint32_t compareValue, uint16_t cycles); //***************************************************************************** // //! Sets the polarity of the eQEP module's input signals. //! //! \param base is the base address of the eQEP module. //! \param invertQEPA is the flag to negate the QEPA input. //! \param invertQEPB is the flag to negate the QEPA input. //! \param invertIndex is the flag to negate the index input. //! \param invertStrobe is the flag to negate the strobe input. //! //! This function configures the polarity of the inputs to the eQEP module. To //! negate the polarity of any of the input signals, pass \b true into its //! corresponding parameter in this function. Pass \b false to leave it as-is. //! //! \return None. // //***************************************************************************** extern void EQEP_setInputPolarity(uint32_t base, _Bool invertQEPA, _Bool invertQEPB, _Bool invertIndex, _Bool invertStrobe); //***************************************************************************** // // Close the Doxygen group. //! @} // //***************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //########################################################################### // // FILE: escss.h // // TITLE: C28x EtherCAT SS Driver. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup escss_api ESCSS //! @{ // //***************************************************************************** //########################################################################### // // FILE: hw_esc_ss.h // // TITLE: Definitions for the ESCSS registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the ESCSS register offsets // //***************************************************************************** // Status // Status // emulate // and LATCHIN input // config. // override // trigger // & override // trigger // destination config // various triggers // various triggers // connections select // configurations // tieoff // to IO pad //***************************************************************************** // // The following are defines for the bit fields in the ESCSS_IPREVNUM register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ESCSS_INTR_RIS register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ESCSS_INTR_MASK register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ESCSS_INTR_MIS register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ESCSS_INTR_CLR register // //***************************************************************************** // Clear //***************************************************************************** // // The following are defines for the bit fields in the ESCSS_INTR_SET register // //***************************************************************************** // Emulate //***************************************************************************** // // The following are defines for the bit fields in the ESCSS_LATCH_SEL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ESCSS_ACCESS_CTRL register // //***************************************************************************** // Bridge // count while enabled. //***************************************************************************** // // The following are defines for the bit fields in the ESCSS_GPIN_GRP_CAP_SEL register // //***************************************************************************** // select // select // select //***************************************************************************** // // The following are defines for the bit fields in the ESCSS_GPOUT_GRP_CAP_SEL register // //***************************************************************************** // select // select // select //***************************************************************************** // // The following are defines for the bit fields in the ESCSS_MEM_TEST register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ESCSS_RESET_DEST_CONFIG register // //***************************************************************************** // ResetOut // the device reset //***************************************************************************** // // The following are defines for the bit fields in the ESCSS_SYNC0_CONFIG register // //***************************************************************************** // PIE Interrupt // Interrupt // DMA Trigger // NVIC Interrupt // Trigger //***************************************************************************** // // The following are defines for the bit fields in the ESCSS_SYNC1_CONFIG register // //***************************************************************************** // PIE Interrupt // Interrupt // DMA Trigger // NVIC Interrupt // Trigger //***************************************************************************** // // The following are defines for the bit fields in the ESCSS_CONFIG_LOCK register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ESCSS_MISC_IO_CONFIG register // //***************************************************************************** // connection //***************************************************************************** // // The following are defines for the bit fields in the ESCSS_PHY_IO_CONFIG register // //***************************************************************************** // Interface // compensation //***************************************************************************** // // The following are defines for the bit fields in the ESCSS_SYNC_IO_CONFIG register // //***************************************************************************** // enabled // enabled //***************************************************************************** // // The following are defines for the bit fields in the ESCSS_LATCH_IO_CONFIG register // //***************************************************************************** // enabled // enabled //***************************************************************************** // // The following are defines for the bit fields in the ESCSS_LED_CONFIG register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ESCSS_MISC_CONFIG register // //***************************************************************************** // Port0 // Port1 // // Define for Mask Value to get the IP Revision Number. // // // Define for Mask Value to get the Raw Interrupt Mask. // // // Defines for the Group Capture Select Mask. // // // Defines for Valid and Bad Key Return from Various API's. // // // Define for the Valid Key Value. // // // Defines for GPIN0 to GPIN31. // // // Defines for GPOUT0 to GPOUT31. // //***************************************************************************** // //! This data type is used to define the signal hookup to 32 possible LATCH0/1 //! trigger sources. // //***************************************************************************** typedef enum { ESCSS_TRIGGER_LATCH0 = 0U, //!< Latch0 Trigger. ESCSS_TRIGGER_LATCH1 = 1U, //!< Latch1 Trigger ESCSS_TRIGGER_CPUNMI = 2U, //!< CPUNMI Trigger. ESCSS_TRIGGER_CMNMI = 3U, //!< CMNMI Trigger. ESCSS_TRIGGER_ERRORSTS = 4U, //!< ERRORSTS Trigger. ESCSS_TRIGGER_GPTRIPOUT0 = 5U, //!< GPTRIPOUT0 Trigger. ESCSS_TRIGGER_GPTRIPOUT1 = 6U, //!< GPTRIPOUT1 Trigger. ESCSS_TRIGGER_GPTRIPOUT2 = 7U, //!< GPTRIPOUT2 Trigger. ESCSS_TRIGGER_GPTRIPOUT3 = 8U, //!< GPTRIPOUT3 Trigger. ESCSS_TRIGGER_GPTRIPOUT4 = 9U, //!< GPTRIPOUT4 Trigger. ESCSS_TRIGGER_GPTRIPOUT5 = 10U, //!< GPTRIPOUT5 Trigger. ESCSS_TRIGGER_GPTRIPOUT6 = 11U, //!< GPTRIPOUT6 Trigger. ESCSS_TRIGGER_GPTRIPOUT7 = 12U, //!< GPTRIPOUT7 Trigger. ESCSS_TRIGGER_GPTRIPOUT8 = 13U, //!< GPTRIPOUT8 Trigger. ESCSS_TRIGGER_GPTRIPOUT9 = 14U, //!< GPTRIPOUT9 Trigger. ESCSS_TRIGGER_GPTRIPOUT10 = 15U, //!< GPTRIPOUT10 Trigger. ESCSS_TRIGGER_GPTRIPOUT11 = 16U, //!< GPTRIPOUT11 Trigger. ESCSS_TRIGGER_GPTRIPOUT12 = 17U, //!< GPTRIPOUT12 Trigger. ESCSS_TRIGGER_GPTRIPOUT13 = 18U, //!< GPTRIPOUT13 Trigger. ESCSS_TRIGGER_GPTRIPOUT14 = 19U, //!< GPTRIPOUT14 Trigger. ESCSS_TRIGGER_GPTRIPOUT15 = 20U, //!< GPTRIPOUT15 Trigger. ESCSS_TRIGGER_PWMXBAROUT0 = 21U, //!< PWMXBAROUT0 Trigger. ESCSS_TRIGGER_PWMXBAROUT1 = 22U, //!< PWMXBAROUT1 Trigger. ESCSS_TRIGGER_PWMXBAROUT2 = 23U, //!< PWMXBAROUT2 Trigger. ESCSS_TRIGGER_PWMXBAROUT3 = 24U, //!< PWMXBAROUT3 Trigger. ESCSS_TRIGGER_PWMXBAROUT4 = 25U, //!< PWMXBAROUT4 Trigger. ESCSS_TRIGGER_PWMXBAROUT5 = 26U, //!< PWMXBAROUT5 Trigger. ESCSS_TRIGGER_PWMXBAROUT6 = 27U, //!< PWMXBAROUT6 Trigger. ESCSS_TRIGGER_PWMXBAROUT7 = 28U //!< PWMXBAROUT7 Trigger. } ESCSS_LatchTrigger; //***************************************************************************** // //! The definitions are used to select the capture trigger. // //***************************************************************************** typedef enum { ESCSS_SOF_CAPTURE_TRIGGER = 0U, //!< Start of Frame as Capture Trigger //!< Select. ESCSS_SYNC0_CAPTURE_TRIGGER = 4U, //!< SYNC0 as Capture Trigger Select. ESCSS_SYNC1_CAPTURE_TRIGGER = 5U, //!< SYNC1 as Capture Trigger Select. ESCSS_LATCH0_CAPTURE_TRIGGER = 6U, //!< LATCH0 as Capture Trigger Select. ESCSS_LATCH1_CAPTURE_TRIGGER = 7U //!< LATCH1 as Capture Trigger Select. } ESCSS_CaptureTrigger; //***************************************************************************** // //! The definition are there to select number of Ports. // //***************************************************************************** typedef enum { ESCSS_ONE_PORT_SELECTION = 0U, //!< One port operation(Port0). ESCSS_TWO_PORT_SELECTION = 1U //!< Two port operation(Port0,Port1). } ESCSS_PortSelection; //***************************************************************************** // //! The definition values are there to select the size to pass as a parameter //! to ESCSS_configureEEPROMSize(). // //***************************************************************************** typedef enum { ESCSS_LESS_THAN_16K, //!< EEPROMs of size 16K bits or less. ESCSS_GREATER_THAN_16K //!< EEPROMs of size greater than 16K bits. } ESCSS_SizeSelect; //***************************************************************************** // //! The definition values is there to select the Group Capture Trigger for the //! ESCSS_setGPINGroupCaptureTriggerSelect and //! ESCSS_setGPOUTGroupCaptureTriggerSelect APIs. // //***************************************************************************** typedef enum { ESCSS_GROUP_CAPTURE_SELECT0 = 0U, ESCSS_GROUP_CAPTURE_SELECT1 = 4U, ESCSS_GROUP_CAPTURE_SELECT2 = 8U, ESCSS_GROUP_CAPTURE_SELECT3 = 12U } ESCSS_GroupCaptureSelect; //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** //***************************************************************************** // //! \internal //! //! Checks the EtherCAT Sub-System base address. //! //! \param base is the base address of EtherCAT Sub-System. //! //! This function determines if EtherCAT Sub-System base address passed is //! valid. //! //! \return Returns \b true if the base address is valid and \b false //! otherwise. // //***************************************************************************** static inline _Bool ESCSS_isBaseValid(uint32_t base) { return((0x00057E00U == base)); } //***************************************************************************** // //! \internal //! //! Checks the EtherCAT Sub-System Configuration base address. //! //! \param base is the base address of EtherCAT Sub-System Configuration //! Registers Base. //! //! This function determines if EtherCAT Sub-System Configuration Registers //! base address passed is valid. //! //! \return Returns \b true if the base address is valid and \b false //! otherwise. // //***************************************************************************** static inline _Bool ESCSS_isConfigBaseValid(uint32_t base) { return((0x00057F00U == base)); } //***************************************************************************** // //! Reads the Minor IP Revision Number for EtherCAT. //! //! \param base is the base address of EtherCAT Sub-System. //! //! This function returns the Minor IP Revision Number. Reset value for this //! are Hard Coded and increments with minor changes to the IP. //! //! \return Returns the EtherCAT Minor IP Revision Number. // //***************************************************************************** static inline uint16_t ESCSS_readIPMinorRevNumber(uint32_t base) { // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 341); } } while(0); // // Returns the Minor IP Revision Number. // return((((*((volatile uint32_t *)((uintptr_t)(base + 0x0U))))) & 0xFU) >> 0U); } //***************************************************************************** // //! Reads the Major IP Revision Number for EtherCAT. //! //! \param base is the base address of EtherCAT Sub-System. //! //! This function returns the Major IP Revision Number. Reset value for this //! are Hard Coded and increments with minor changes to the IP. //! //! \return Returns the EtherCAT Major IP Revision Number. // //***************************************************************************** static inline uint16_t ESCSS_readIPMajorRevNumber(uint32_t base) { // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 369); } } while(0); // // Returns the Major IP Revision Number. // return((((*((volatile uint32_t *)((uintptr_t)(base + 0x0U))))) & 0xF0U) >> 4U); } //***************************************************************************** // //! Reads the Major and Minor IP Revision Number for EtherCAT. //! //! \param base is the base address of EtherCAT Sub-System. //! //! This function returns the IP Revision Number. Reset value for this //! are Hard Coded and increments with minor changes to the IP. //! //! \return Returns the EtherCAT IP Revision Number. // //***************************************************************************** static inline uint32_t ESCSS_readIPRevNumber(uint32_t base) { // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 397); } } while(0); // // Return the IP Revision Number. // return(((*((volatile uint32_t *)((uintptr_t)(base + 0x0U))))) & (0U | 0xFU)); } //***************************************************************************** // //! Gets the Raw Interrupt Status for selected interrupts. //! //! \param base is the base address of EtherCAT Sub-System. //! \param interruptMask is the mask value to select the different type of //! interrupt. //! //! This function returns the Raw Interrupt Status of all the different //! interrupt triggers. //! //! \return Returns the Raw Interrupt Status Value. // //***************************************************************************** static inline uint16_t ESCSS_getRawInterruptStatus(uint32_t base, uint16_t interruptMask) { // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 425); } } while(0); do { if(!((interruptMask & ~(0x1U | 0x2U | 0x4U | 0x8U | 0x10U | 0x20U)) == 0U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 431); } } while(0); // // Return the specific Raw Interrupt Status Value. // return(((*((volatile uint32_t *)((uintptr_t)(base + 0x2U))))) & interruptMask); } //***************************************************************************** // //! Reads the Raw Interrupt Status for different interrupt triggers. //! //! \param base is the base address of EtherCAT Sub-System. //! //! This function returns the Raw Interrupt Status of individual interrupt //! triggers. //! //! The Raw interrupt Status can have the following valid options for //! \e interruptMask can be OR'ed together: //! \b ESCSS_INTR_RIS_SYNC0_RIS, \b ESCSS_INTR_RIS_SYNC1_RIS, //! \b ESCSS_INTR_RIS_IRQ_RIS, \b ESCSS_INTR_RIS_DMA_DONE_RIS, //! \b ESCSS_INTR_RIS_TIMEOUT_ERR_RIS, \b ESCSS_INTR_RIS_MASTER_RESET_RIS. //! //! \return Returns the Raw Interrupt Status Value. // //***************************************************************************** static inline uint32_t ESCSS_readRawInterruptStatus(uint32_t base) { // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 463); } } while(0); // // Return the Raw Interrupt Status Value. // return((*((volatile uint32_t *)((uintptr_t)(base + 0x2U)))) & (0x1U | 0x2U | 0x4U | 0x8U | 0x10U | 0x20U)); } //***************************************************************************** // //! Allows to mask individual interrupt cause impacting the interrupt. //! //! \param base is the base address of EtherCAT Sub-System. //! \param interruptMask is the mask value to select the different type of //! interrupt. //! //! This function sets the Masked Interrupt Status of the different //! interrupt triggers as per the input mask value. //! //! The Masked interrupt Status can have the following valid options for //! \e interruptMask can be OR'ed together: //! - \b ESCSS_INTR_MASK_SYNC0_MASK - Masks SYNC0 to have effect on interrupts //! or other CPU/DMA Trigger, //! - \b ESCSS_INTR_MASK_SYNC1_MASK - Masks SYNC1 to have effect on interrupts //! or other CPU/DMA Trigger, //! - \b ESCSS_INTR_MASK_IRQ_MASK - Masks EtherCATSS IRQ to have effect on //! interrupts or other CPU/DMA Trigger, //! - \b ESCSS_INTR_MASK_DMA_DONE_MASK - Masks DMA Done to have effect on //! interrupts or other CPU/DMA Trigger, //! - \b ESCSS_INTR_MASK_TIMEOUT_ERR_MASK - Masks PDI access timeout Error to //! have effect on interrupts or other CPU/DMA Trigger, //! - \b ESCSS_INTR_MASK_MASTER_RESET_MASK - Masks EtherCAT Master reset event //! against any effect on interrupts or other CPU Interrupts. //! //! \return None. // //***************************************************************************** static inline void ESCSS_setMaskedInterruptStatus(uint32_t base, uint16_t interruptMask) { // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 506); } } while(0); do { if(!((interruptMask & ~(0x1U | 0x2U | 0x4U | 0x8U | 0x10U | 0x20U)) == 0U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 512); } } while(0); // // Set the Masked Interrupt Status Value. // (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) |= interruptMask; } //***************************************************************************** // //! Allows to reset the mask individual interrupt cause impacting the //! interrupt. //! //! \param base is the base address of EtherCAT Sub-System. //! \param interruptMask is the mask value to select the different type of //! interrupt. //! //! This function resets the Masked Interrupt Status of the different //! interrupt triggers as per the input mask value passed as parameter. //! //! The Masked interrupt Status can have the following valid options for //! \e interruptMask can be OR'ed together: //! - \b ESCSS_INTR_MASK_SYNC0_MASK - Masks SYNC0 to have effect on interrupts //! or other CPU/DMA Trigger, //! - \b ESCSS_INTR_MASK_SYNC1_MASK - Masks SYNC1 to have effect on interrupts //! or other CPU/DMA Trigger, //! - \b ESCSS_INTR_MASK_IRQ_MASK - Masks EtherCATSS IRQ to have effect on //! interrupts or other CPU/DMA Trigger, //! - \b ESCSS_INTR_MASK_DMA_DONE_MASK - Masks DMA Done to have effect on //! interrupts or other CPU/DMA Trigger, //! - \b ESCSS_INTR_MASK_TIMEOUT_ERR_MASK - Masks PDI access timeout Error to //! have effect on interrupts or other CPU/DMA Trigger, //! - \b ESCSS_INTR_MASK_MASTER_RESET_MASK - Masks EtherCAT Master reset event //! against any effect on interrupts or other CPU Interrupts. //! //! \return None. // //***************************************************************************** static inline void ESCSS_resetMaskedInterruptStatus(uint32_t base, uint16_t interruptMask) { // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 555); } } while(0); do { if(!((interruptMask & ~(0x1U | 0x2U | 0x4U | 0x8U | 0x10U | 0x20U)) == 0U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 561); } } while(0); // // Reset the Masked Interrupt Status Value. // (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) &= ~interruptMask; } //***************************************************************************** // //! Gets the Masked Interrupt Status all interrupt triggers. //! //! \param base is the base address of EtherCAT Sub-System. //! \param interruptMask is the mask value to select the different type of //! interrupt. //! //! This function returns the Masked Interrupt Status of the different //! interrupt triggers as per the input mask value. //! //! The Masked interrupt Status can have the following valid options for //! \e interruptMask can be OR'ed together: //! \b ESCSS_INTR_MIS_SYNC0_MIS, \b ESCSS_INTR_MIS_SYNC1_MIS, //! \b ESCSS_INTR_MIS_IRQ_MIS, \b ESCSS_INTR_MIS_DMA_DONE_MIS, //! \b ESCSS_INTR_MIS_TIMEOUT_ERR_MIS, \b ESCSS_INTR_MIS_MASTER_RESET_MIS. //! //! \return Returns the Masked Interrupt Status Value. // //***************************************************************************** static inline uint16_t ESCSS_getMaskedInterruptStatus(uint32_t base, uint16_t interruptMask) { // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 594); } } while(0); do { if(!((interruptMask & ~(0x1U | 0x2U | 0x4U | 0x8U | 0x10U | 0x20U)) == 0U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 600); } } while(0); // // Return the Masked Interrupt Status Value. // return(((*((volatile uint16_t *)((uintptr_t)(base + 0x6U))))) & interruptMask); } //***************************************************************************** // //! Clears the individual interrupt cause. //! //! \param base is the base address of EtherCAT Sub-System. //! \param interruptMask is the mask value to select the different type of //! interrupt. //! //! This function clears the individual interrupt cause based on the mask value //! passed. Writing a 1 clears the Raw Status. //! //! The interrupt Status Mask parameter can have the following valid options //! for \e interruptMask can be OR'ed together: //! \b ESCSS_INTR_CLR_SYNC0_CLR, \b ESCSS_INTR_CLR_SYNC1_CLR, //! \b ESCSS_INTR_CLR_IRQ_CLR, \b ESCSS_INTR_CLR_DMA_DONE_CLR, //! \b ESCSS_INTR_CLR_TIMEOUT_ERR_CLR, \b ESCSS_INTR_CLR_MASTER_RESET_CLR. //! //! \return None. // //***************************************************************************** static inline void ESCSS_clearRawInterruptStatus(uint32_t base, uint16_t interruptMask) { // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 634); } } while(0); do { if(!((interruptMask & ~(0x1U | 0x2U | 0x4U | 0x8U | 0x10U | 0x20U)) == 0U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 640); } } while(0); // // Clear the Interrupt Status using the Mask Value passed. // (*((volatile uint16_t *)((uintptr_t)(base + 0x8U)))) = interruptMask; } //***************************************************************************** // //! Selects the LATCH0 Inputs Mux Select. //! //! \param base is the base address of EtherCAT Sub-System. //! \param muxSelectValue is the mux select value for Latch0. //! //! This function sets the Mux Select value for LATCH0 input to ESC SS. //! //! The \e muxSelectValue parameter can be one of the possible values from //! the ESCSS_LatchTrigger enum. //! //! \return None. // //***************************************************************************** static inline void ESCSS_selectLatch0Mux(uint32_t base, ESCSS_LatchTrigger muxSelectValue) { // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 668); } } while(0); // // Set the Mux Select Value for Latch0. // (*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) |= (((uint32_t)muxSelectValue << 0U) & 0x1FU); } //***************************************************************************** // //! Select the LATCH1 Inputs Mux Select. //! //! \param base is the base address of EtherCAT Sub-System. //! \param muxSelectValue is the mux select value for Latch1. //! //! This function sets the Mux Select value for LATCH1 input to ESC SS. //! //! The \e muxSelectValue parameter can be one of the possible values from //! the ESCSS_LatchTrigger enum. //! //! \return None. // //***************************************************************************** static inline void ESCSS_selectLatch1Mux(uint32_t base, ESCSS_LatchTrigger muxSelectValue) { // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 699); } } while(0); // // Set the Mux Select Value for Latch1. // (*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) |= (((uint32_t)muxSelectValue << 8U) & 0x1F00U); } //***************************************************************************** // //! Configures the Wait State on the 16 bit Asynchronous Interface. //! //! \param base is the base address of EtherCAT Sub-System. //! \param waitState is the minimum wait state value. //! //! This function configures the predefined minimum number of wait-states which //! the VBUS bridge will put out accesses on the 16-bit Asynchronous interface. //! //! \return None. // //***************************************************************************** static inline void ESCSS_configure16BitAsyncAccessWaitState(uint32_t base, uint16_t waitState) { // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 728); } } while(0); // // Configure the Wait State Value. // (*((volatile uint16_t *)((uintptr_t)(base + 0xEU)))) |= ((waitState << 0U) & 0x7FU); } //***************************************************************************** // //! Enables the PDI Timeout Feature. //! //! \param base is the base address of EtherCAT Sub-System. //! //! Enables the Timeout features which counts programmed number of Sys clocks //! before the Local host aborts the transaction. //! The timeout counter starts counting upon BUSY is asserted by EtherCAT IP. //! //! \return None. // //***************************************************************************** static inline void ESCSS_enablePDIAccessTimeOut(uint32_t base) { // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 757); } } while(0); // // Enable timeout. // (*((volatile uint16_t *)((uintptr_t)(base + 0xEU)))) |= 0x80U; } //***************************************************************************** // //! Disables the PDI Timeout Feature. //! //! \param base is the base address of EtherCAT Sub-System. //! //! Disables the Timeout features which counts programmed number of Sys clocks //! before the Local host aborts the transaction on PDI interface. //! //! \return None. // //***************************************************************************** static inline void ESCSS_disablePDIAccessTimeOut(uint32_t base) { // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 783); } } while(0); // // Disable Timeout. // (*((volatile uint16_t *)((uintptr_t)(base + 0xEU)))) &= (~0x80U); } //***************************************************************************** // //! Enables the Debug Access through the PDI Controller. //! //! \param base is the base address of EtherCAT Sub-System. //! //! This function configures the debug accesses to be allowed to go //! through. //! //! \return None. // //***************************************************************************** static inline void ESCSS_enableDebugAccess(uint32_t base) { // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 809); } } while(0); // // Set the Bit for Debug Access. // (*((volatile uint16_t *)((uintptr_t)(base + 0xEU)))) |= 0x200U; } //***************************************************************************** // //! Disables the Debug Access through the PDI Controller. //! //! \param base is the base address of EtherCAT Sub-System. //! //! This function configures the debug accesses to be not allowed to go //! through. //! //! \return None. // //***************************************************************************** static inline void ESCSS_disableDebugAccess(uint32_t base) { // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 836); } } while(0); // // Reset the Bit for Debug Access. // (*((volatile uint16_t *)((uintptr_t)(base + 0xEU)))) &= ~0x200U; } //***************************************************************************** // //! Reads the GPIN Data. //! //! \param base is the base address of EtherCAT Sub-System. //! //! This function returns the GPIN Data. Local GPIN data register connects to //! GPIN pipelined register for debug & override purposes. //! //! \return Returns the GPIN Data Value. // //***************************************************************************** static inline uint32_t ESCSS_readGPINData(uint32_t base) { // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 864); } } while(0); // // Return the GPIN Data Read from the register. // return((*((volatile uint32_t *)((uintptr_t)(base + 0x10U))))); } //***************************************************************************** // //! Sets the GPIN Data Register Value. //! //! \param base is the base address of EtherCAT Sub-System. //! \param pinValue is the value to be written in the GPIN Register. //! //! This function writes the GPIN Data. Local GPIN data register connects to //! GPIN pipelined register for debug & override purposes. //! //! The \e pinValue can have the respective GPIN Defines OR'ed to select //! which PIN to write to. The defines are ESCSS_GPIN_x where x is from 0 to //! 31. //! //! \return None. // //***************************************************************************** static inline void ESCSS_setGPINData(uint32_t base, uint32_t pinValue) { // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 895); } } while(0); // // Set the GPIN data register value. // (*((volatile uint32_t *)((uintptr_t)(base + 0x10U)))) |= pinValue; } //***************************************************************************** // //! Resets the GPIN Data Register Value. //! //! \param base is the base address of EtherCAT Sub-System. //! \param pinValue is the value to be written in the GPIN Register. //! //! This function writes the GPIN Data. Local GPIN data register connects to //! GPIN pipelined register for debug & override purposes. //! //! The \e pinValue can have the respective GPIN Defines OR'ed to select //! which PIN to write to. The defines are ESCSS_GPIN_x where x is from 0 to //! 31. //! //! \return None. // //***************************************************************************** static inline void ESCSS_resetGPINData(uint32_t base, uint32_t pinValue) { // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 926); } } while(0); // // Reset the GPIN data register value. // (*((volatile uint32_t *)((uintptr_t)(base + 0x10U)))) &= ~pinValue; } //***************************************************************************** // //! Enables the connection of GPIN to EtherCATSS through pipelined register as //! against the direct from IO. //! //! \param base is the base address of EtherCAT Sub-System. //! \param pipelineMask is the mask to enable connection is through pipelined //! register. //! //! This function enables that the connection is through the pipelined //! register which is captured on programmed event. //! //! The \e pipelineMask can have the respective GPIN Defines OR'ed to select //! which PIN to write to. The defines are ESCSS_GPIN_x where x is from 0 to //! 31. //! //! \return None. // //***************************************************************************** static inline void ESCSS_enableGPIPipelinedRegCaptureOnEvent(uint32_t base, uint32_t pipelineMask) { // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 959); } } while(0); // // Set the value for the GPIN Pipeline Select. // (*((volatile uint32_t *)((uintptr_t)(base + 0x12U)))) |= pipelineMask; } //***************************************************************************** // //! Disables the connection of GPIN to EtherCATSS through pipelined register //! and is direct from the IO Pad. //! //! \param base is the base address of EtherCAT Sub-System. //! \param pipelineMask is the mask to enable connection is through pipelined //! register. //! //! This function disables the connection through the pipelined register //! and connection is directly from the IO pad. //! //! The \e pipelineMask can have the respective GPIN Defines OR'ed to select //! which PIN to write to. The defines are ESCSS_GPIN_x where x is from 0 to //! 31. //! //! \return None. // //***************************************************************************** static inline void ESCSS_disableGPIPipelinedRegCaptureOnEvent(uint32_t base, uint32_t pipelineMask) { // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 993); } } while(0); // // Reset the value for the GPIN Pipeline Select. // (*((volatile uint32_t *)((uintptr_t)(base + 0x12U)))) &= ~pipelineMask; } //***************************************************************************** // //! Reads the GPOUT Data. //! //! \param base is the base address of EtherCAT Sub-System. //! //! This function returns the GPOUT Data. Local GPOUT data register which is //! synchronized version on SysClk, each bit is represents GPOUT IORead is //! allowed for CPU to process (IO extender or so if required). //! //! \return Returns the GPOUT Data Value. // //***************************************************************************** static inline uint32_t ESCSS_readGPOUTData(uint32_t base) { // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 1020); } } while(0); // // Return the GPOUT Data Read from the register. // return((*((volatile uint32_t *)((uintptr_t)(base + 0x16U))))); } //***************************************************************************** // //! Enables the connection of EtherCATSS GPOUT output to the IO pad through //! pipelined register as against the direct connection. //! //! \param base is the base address of EtherCAT Sub-System. //! \param pipelineMask is the mask to enable connection is through pipelined //! register. //! //! This function enables the connection to be through the pipelined register //! which captures EtherCATSS o/p on programmed event. //! //! The \e pipelineMask can have the respective GPOUT Defines OR'ed to select //! which PIN to write to. The defines are ESCSS_GPOUT_x where x is from 0 to //! 31. //! //! \return None. // //***************************************************************************** static inline void ESCSS_enableGPOUTPipelinedRegCaptureOnEvent(uint32_t base, uint32_t pipelineMask) { // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 1054); } } while(0); // // Set the GPOUT pipelined register value. // (*((volatile uint32_t *)((uintptr_t)(base + 0x18U)))) |= pipelineMask; } //***************************************************************************** // //! Disables the connection of GPOUT to EtherCATSS through pipelined register //! and is direct from the IO Pad. //! //! \param base is the base address of EtherCAT Sub-System. //! \param pipelineMask is the mask to enable connection is through pipelined //! register. //! //! This function disables the connection through the pipelined register //! and connection is directly from the IO pad. //! //! The \e pipelineMask can have the respective GPOUT Defines OR'ed to select //! which PIN to write to. The defines are ESCSS_GPOUT_x where x is from 0 to //! 31. //! //! \return None. // //***************************************************************************** static inline void ESCSS_disableGPOUTPipelinedRegCaptureOnEvent(uint32_t base, uint32_t pipelineMask) { // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 1088); } } while(0); // // Reset the GPOUT pipelined register value. // (*((volatile uint32_t *)((uintptr_t)(base + 0x18U)))) &= ~pipelineMask; } //***************************************************************************** // //! Initializes the Memory Init. //! //! \param base is the base address of EtherCAT Sub-System. //! //! This function starts the initialization when set. //! //! \return None. // //***************************************************************************** static inline void ESCSS_initMemory(uint32_t base) { // // Check the arguments. // do { if(!(ESCSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 1113); } } while(0); // // Trigger the memory initialization. // (*((volatile uint16_t *)((uintptr_t)(base + 0x1CU)))) |= 0x1U; } //***************************************************************************** // //! Returns the memory init status. //! //! \param base is the base address of EtherCAT Sub-System. //! //! This function returns the status of the memory initialization. //! //! \return Returns \b true indicating memory initialization completion, and //! \b false if not ye completed. //! // //***************************************************************************** static inline _Bool ESCSS_getMemoryInitDoneStatusNonBlocking(uint32_t base) { // // Check the arguments. // do { if(!(ESCSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 1140); } } while(0); _Bool memoryInitStatus; // // Get the memory init Status. // if(((*((volatile uint32_t *)((uintptr_t)(base + 0x1CU)))) & 0x2U) == 0x2U) memoryInitStatus = (_Bool)1; else memoryInitStatus = (_Bool)0; return(memoryInitStatus); } //***************************************************************************** // //! Waits for the memory init status to be set till the loop count. //! //! \param base is the base address of EtherCAT Sub-System. //! \param loopCount is the count till which the loop will run till the Memory //! init is done. //! //! This function returns the status of the memory initialization after waiting //! till a loop count. //! //! \return Returns \b true indicating memory initialization completion, and //! \b false if not ye completed. //! // //***************************************************************************** static inline uint32_t ESCSS_getMemoryInitDoneStatusBlocking(uint32_t base, uint32_t loopCount) { uint32_t count = 0U; // // Check the arguments. // do { if(!(ESCSS_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 1180); } } while(0); uint32_t apiStatus = 0x00U; while(count < loopCount) { // // Get the memory init Status. // if(((*((volatile uint32_t *)((uintptr_t)(base + 0x1CU)))) & 0x2U) == 0x2U) { // // Memory Init Successful. // apiStatus = 0x01U; break; } else { apiStatus = 0x00U; } count++; } return(apiStatus); } //***************************************************************************** // //! Checks if lock configuration is done. //! //! \param base is the base address of EtherCAT Sub-System. //! //! This function checks if the lock configuration is done and returns the //! status. //! //! \return None. // //***************************************************************************** static inline _Bool ESCSS_isConfigurationLockEnabled(uint32_t base) { _Bool configStatus; // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isConfigBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 1229); } } while(0); // // Check if lock configuration is enabled. // if(((*((volatile uint32_t *)((uintptr_t)(base + 0x0U)))) & 0x1U) == 0x1U) { configStatus = (_Bool)1; } else { configStatus = (_Bool)0; } return(configStatus); } //***************************************************************************** // //! Enables the selection of LED o/p connect to IO Pad. //! //! \param base is the base address of EtherCAT configuration Registers. //! \param ledSelectConfig is the Mux Selection Value. //! //! This function enables the selection of LED o/p connect to IO Pad. This //! selection assumes both buffer input and buffer enable connection as //! required. //! //! The LED Configuration Mask parameter can have the following valid options //! for \e ledSelectConfig can be OR'ed together: //! - \b ESCSS_LED_CONFIG_LINKACT0 - GPIO enable for LINKACT0 LED, //! - \b ESCSS_LED_CONFIG_LINKACT1 - GPIO enable for LINKACT1 LED, //! - \b ESCSS_LED_CONFIG_STATE - GPIO enable for STATE LED, //! - \b ESCSS_LED_CONFIG_ERR - GPIO enable for ERR LED, //! - \b ESCSS_LED_CONFIG_RUN - GPIO enable for RUN LED. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** static inline uint16_t ESCSS_enableLEDOptions(uint32_t base, uint16_t ledSelectConfig) { uint16_t apiStatus; // // Check the arguments. // do { if(!(ESCSS_isConfigBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 1278); } } while(0); do { if(!((ledSelectConfig & ~(0x1U | 0x2U | 0x4U | 0x8U | 0x10U)) == 0U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 1283); } } while(0); if((_Bool)1 != ESCSS_isConfigurationLockEnabled(0x00057F00U)) { // // Set the LED Options. // (*((volatile uint16_t *)((uintptr_t)(base + 0x12U)))) |= ledSelectConfig; apiStatus = 0x01U; } else { // // Return API Fail if Configuration Lock is Enabled. // apiStatus = 0x00U; } return(apiStatus); } //***************************************************************************** // //! Disables the selection of LED o/p connect to IO Pad. //! //! \param base is the base address of EtherCAT configuration Registers. //! \param ledSelectConfig is the Mux Selection Value. //! //! This function disables the selection of LED o/p connect to IO Pad. The //! non-EtherCAT function is selected on the IO. //! //! The LED Configuration Mask parameter can have the following valid options //! for \e ledSelectConfig can be OR'ed together: //! - \b ESCSS_LED_CONFIG_LINKACT0, //! - \b ESCSS_LED_CONFIG_LINKACT1, //! - \b ESCSS_LED_CONFIG_STATE, //! - \b ESCSS_LED_CONFIG_ERR, //! - \b ESCSS_LED_CONFIG_RUN. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** static inline uint16_t ESCSS_disableLEDOptions(uint32_t base, uint16_t ledSelectConfig) { uint16_t apiStatus; // // Check the arguments. // do { if(!(ESCSS_isConfigBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 1334); } } while(0); do { if(!((ledSelectConfig & ~(0x1U | 0x2U | 0x4U | 0x8U | 0x10U)) == 0U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 1339); } } while(0); if((_Bool)1 != ESCSS_isConfigurationLockEnabled(0x00057F00U)) { // // Disable the LED Options. // (*((volatile uint16_t *)((uintptr_t)(base + 0x12U)))) &= ~ledSelectConfig; apiStatus = 0x01U; } else { // // Return API Fail if Configuration Lock is Enabled. // apiStatus = 0x00U; } return(apiStatus); } //***************************************************************************** // //! Enable for GPIN Connection to IO pad. //! //! \param base is the base address of EtherCAT configuration Registers. //! \param selectValue is the mask for the mux select. //! //! This function allows bit-wise selection of the GPIN be connected from //! GPIO PAD. Once those are not driven by GPIO, will be driven from register //! writable from local Host. //! //! The \e selectValue can have the respective GPIN Defines OR'ed to select //! which PIN to enable. The defines are ESCSS_GPIN_x where x is from 0 to //! 31. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** static inline uint16_t ESCSS_enableGPIN(uint32_t base, uint32_t selectValue) { uint16_t apiStatus; // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isConfigBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 1387); } } while(0); if((_Bool)1 != ESCSS_isConfigurationLockEnabled(0x00057F00U)) { // // Mux Select the GPIN from the dedicated IO PAD. // (*((volatile uint32_t *)((uintptr_t)(base + 0xAU)))) |= selectValue; apiStatus = 0x01U; } else { // // Return API Fail if Configuration Lock is Enabled. // apiStatus = 0x00U; } return(apiStatus); } //***************************************************************************** // //! Disable for GPIN Connection to IO pad. //! //! \param base is the base address of EtherCAT configuration Registers. //! \param selectValue is the mask for the mux select. //! //! This function disables connection to GPIO PAD, but connects to //! ESCSS_GPIN_DAT. //! //! The \e selectValue can have the respective GPIN Defines OR'ed to select //! which GPIN to disable. The defines are ESCSS_GPIN_x where x is from 0 to //! 31. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** static inline uint16_t ESCSS_disableGPIN(uint32_t base, uint32_t selectValue) { uint16_t apiStatus; // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isConfigBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 1434); } } while(0); if((_Bool)1 != ESCSS_isConfigurationLockEnabled(0x00057F00U)) { // // Disables connection to GPIO PADMux. // (*((volatile uint32_t *)((uintptr_t)(base + 0xAU)))) &= ~selectValue; apiStatus = 0x01U; } else { // // Return API Fail if Configuration Lock is Enabled. // apiStatus = 0x00U; } return(apiStatus); } //***************************************************************************** // //! Enable GPOUT selection between register or GPIO pad. //! //! \param base is the base address of EtherCAT configuration Registers. //! \param selectValue is the mask for the mux select. //! //! This function is to allow the EtherCAT GPOUT output be driven to either of //! the two IO-pads allocated. //! //! The \e selectValue can have the respective GPOUT Defines OR'ed to select //! which GPOUT to enable. The defines are ESCSS_GPOUT_x where x is from 0 to //! 31. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** static inline uint16_t ESCSS_enableGPOUT(uint32_t base, uint32_t selectValue) { uint16_t apiStatus; // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isConfigBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 1481); } } while(0); if((_Bool)1 != ESCSS_isConfigurationLockEnabled(0x00057F00U)) { // // Mux Select the GPOUT. // (*((volatile uint32_t *)((uintptr_t)(base + 0xEU)))) |= selectValue; apiStatus = 0x01U; } else { // // Return API Fail if Configuration Lock is Enabled. // apiStatus = 0x00U; } return(apiStatus); } //***************************************************************************** // //! Disable GPOUT selection between register or GPIO pad. //! //! \param base is the base address of EtherCAT configuration Registers. //! \param selectValue is the mask for the mux select. //! //! This function is to disable the EtherCAT GPOUT output be driven to either //! of the two IO-pads allocated. //! //! The \e selectValue can have the respective GPOUT Defines OR'ed to select //! which GPOUT to disable. The defines are ESCSS_GPOUT_x where x is from 0 to //! 31. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** static inline uint16_t ESCSS_disableGPOUT(uint32_t base, uint32_t selectValue) { uint16_t apiStatus; // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isConfigBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 1528); } } while(0); if((_Bool)1 != ESCSS_isConfigurationLockEnabled(0x00057F00U)) { // // Mux Select the GPOUT to disable. // (*((volatile uint32_t *)((uintptr_t)(base + 0xEU)))) &= ~selectValue; apiStatus = 0x01U; } else { // // Return API Fail if Configuration Lock is Enabled. // apiStatus = 0x00U; } return(apiStatus); } //***************************************************************************** // //! Configure the TX for shift for Port 0. //! //! \param base is the base address of EtherCAT configuration Registers. //! \param shiftValue is the shift in 10ns terms. //! //! This function is to configure the TX for shift for Port 0. Two bit TX_SHIFT //! configuration in terms of 10ns counts for port0. This is the shift added //! to TX_ENA & TX_DATA to match delay of PHY TX_CLK w.r.t. device internal //! clock. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** static inline uint16_t ESCSS_configureTX0ShiftForTxEnaAndTxData(uint32_t base, uint32_t shiftValue) { uint16_t apiStatus; // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isConfigBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 1573); } } while(0); if((_Bool)1 != ESCSS_isConfigurationLockEnabled(0x00057F00U)) { // // Set the shift Value. // (*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) |= ((uint16_t)((uint32_t)shiftValue << 0U) & 0x3U); apiStatus = 0x01U; } else { // // Return API Fail if Configuration Lock is Enabled. // apiStatus = 0x00U; } return(apiStatus); } //***************************************************************************** // //! Configure the TX for shift for Port 1. //! //! \param base is the base address of EtherCAT configuration Registers. //! \param shiftValue is the shift in 10ns terms. //! //! This function is to configure the TX for shift for Port 1. Two bit TX_SHIFT //! configuration in terms of 10ns counts for port1. This is the shift added //! to TX_ENA & TX_DATA to match delay of PHY TX_CLK w.r.t. device internal //! clock. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** static inline uint16_t ESCSS_configureTX1ShiftForTxEnaAndTxData(uint32_t base, uint32_t shiftValue) { uint16_t apiStatus; // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isConfigBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 1622); } } while(0); if((_Bool)1 != ESCSS_isConfigurationLockEnabled(0x00057F00U)) { // // Set the shift Value. // (*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) |= ((shiftValue << 2U) & 0xCU); apiStatus = 0x01U; } else { // // Return API Fail if Configuration Lock is Enabled. // apiStatus = 0x00U; } return(apiStatus); } //***************************************************************************** // //! Enable the PDI Emulation. //! //! \param base is the base address of EtherCAT configuration Registers. //! //! This function will be hooked up to the PDI_EMULATION input of the //! EtherCAT IP. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** static inline uint16_t ESCSS_enablePDIEmulation(uint32_t base) { uint16_t apiStatus; // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isConfigBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 1667); } } while(0); if((_Bool)1 != ESCSS_isConfigurationLockEnabled(0x00057F00U)) { // // Set the PDI Emulation. // (*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) |= 0x20U; apiStatus = 0x01U; } else { // // Return API Fail if Configuration Lock is Enabled. // apiStatus = 0x00U; } return(apiStatus); } //***************************************************************************** // //! Disable the PDI Emulation. //! //! \param base is the base address of EtherCAT configuration Registers. //! //! This function will not allow hooking up to the PDI_EMULATION input of the //! EtherCAT IP. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** static inline uint16_t ESCSS_disablePDIEmulation(uint32_t base) { uint16_t apiStatus; // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isConfigBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 1709); } } while(0); if((_Bool)1 != ESCSS_isConfigurationLockEnabled(0x00057F00U)) { // // Set the PDI Emulation. // (*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) &= ~0x20U; apiStatus = 0x01U; } else { // // Return API Fail if Configuration Lock is Enabled. // apiStatus = 0x00U; } return(apiStatus); } //***************************************************************************** // //! Configure the Physical Address Offset. //! //! \param base is the base address of EtherCAT configuration Registers. //! \param registerOffset is the register offset value. //! //! This function will set the PHY_OFFSET[4:0] input of the EtherCAT IP. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** static inline uint16_t ESCSS_configurePhyAddressOffset(uint32_t base, uint16_t registerOffset) { uint16_t apiStatus; // // Check if the passed parameter base is valid. // do { if(!(ESCSS_isConfigBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/escss.h", 1751); } } while(0); if((_Bool)1 != ESCSS_isConfigurationLockEnabled(0x00057F00U)) { // // Set the Physical Address Offset. // (*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) |= ((uint16_t)((uint32_t)registerOffset << 6U) & 0x7C0U); apiStatus = 0x01U; } else { // // Return API Fail if Configuration Lock is Enabled. // apiStatus = 0x00U; } return(apiStatus); } //***************************************************************************** // //! Sets the Raw Interrupt Cause Status. //! //! \param base is the base address of EtherCAT Sub-System. //! \param interruptMask is the mask value to select the different type of //! interrupt. //! \param writeKey is the key Value which decides if the writes to this //! register are to take affect. //! //! This function sets the individual interrupt cause based on the mask value //! passed to emulate the interrupt cause. //! //! The interrupt Status Mask parameter can have the following valid options //! for \e interruptMask can be OR'ed together: //! \b ESCSS_INTR_SET_SYNC0_SET, \b ESCSS_INTR_SET_SYNC1_SET, //! \b ESCSS_INTR_SET_IRQ_SET, \b ESCSS_INTR_SET_DMA_DONE_SET, //! \b ESCSS_INTR_SET_TIMEOUT_ERR_SET, \b ESCSS_INTR_SET_MASTER_RESET_SET. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** extern uint16_t ESCSS_setRawInterruptStatus(uint32_t base, uint16_t interruptMask, uint16_t writeKey); //***************************************************************************** // //! Sets the GPIN pipe group capture trigger. //! //! \param base is the base address of EtherCAT Sub-System. //! \param selectGPIN is to select the trigger to capture the IO input in //! pipeline register for selective GPIN. //! \param triggerCapSelect is the GPIN Data to be written. //! //! This function selects the trigger to capture the IO input in pipeline //! register for GPIN. //! The \e selectGPIN parameter takes the following parameters: //! \b ESCSS_GROUP_CAPTURE_SELECT0, \b ESCSS_GROUP_CAPTURE_SELECT1, //! \b ESCSS_GROUP_CAPTURE_SELECT2 and \b ESCSS_GROUP_CAPTURE_SELECT3. //! The \e ESCSS_CaptureTrigger parameter takes the values: //! \b ESCSS_SOF_CAPTURE_TRIGGER, \b ESCSS_SYNC0_CAPTURE_TRIGGER, \b //! ESCSS_SYNC1_CAPTURE_TRIGGER, \b ESCSS_LATCH0_CAPTURE_TRIGGER, \b //! ESCSS_LATCH1_CAPTURE_TRIGGER. //! //! \return None. // //***************************************************************************** extern void ESCSS_setGPINGroupCaptureTriggerSelect(uint32_t base, ESCSS_GroupCaptureSelect selectGPIN, ESCSS_CaptureTrigger triggerCapSelect); //***************************************************************************** // //! GPOUT pipe group capture trigger. //! //! \param base is the base address of EtherCAT Sub-System. //! \param selectGPOUT is to select the trigger to capture the IO input in //! pipeline register for selective GPIN. //! \param triggerCapSelect is the GPIN Data to be written. //! //! This function selects the trigger to capture the IO input in pipeline //! register for GPOUT. //! The \e selectGPOUT parameter takes the following parameters: //! \b ESCSS_GROUP_CAPTURE_SELECT0, \b ESCSS_GROUP_CAPTURE_SELECT1, //! \b ESCSS_GROUP_CAPTURE_SELECT2 and \b ESCSS_GROUP_CAPTURE_SELECT3. //! The \e ESCSS_CaptureTrigger parameter takes the values: //! \b ESCSS_SOF_CAPTURE_TRIGGER, \b ESCSS_SYNC0_CAPTURE_TRIGGER, \b //! ESCSS_SYNC1_CAPTURE_TRIGGER, \b ESCSS_LATCH0_CAPTURE_TRIGGER, \b //! ESCSS_LATCH1_CAPTURE_TRIGGER. //! //! \return None. // //***************************************************************************** extern void ESCSS_setGPOUTGroupCaptureTriggerSelect(uint32_t base, ESCSS_GroupCaptureSelect selectGPOUT, ESCSS_CaptureTrigger triggerCapSelect); //***************************************************************************** // //! Enables EtherCAT Reset drives to EtherCAT IP and PHY Reset. //! //! \param base is the base address of EtherCAT Sub-System. //! \param writeKey is the key Value which decides if the writes to this //! register are to take affect. //! //! This function enables the EtherCAT Reset to drive the IP & PHY reset. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** extern uint16_t ESCSS_enableCPUReset(uint32_t base, uint16_t writeKey); //***************************************************************************** // //! EtherCAT Reset does not drive to EtherCAT IP and PHY Reset. //! //! \param base is the base address of EtherCAT Sub-System. //! \param writeKey is the key Value which decides if the writes to this //! register are to take affect. //! //! This function configures the EtherCAT Reset not to drive to EtherCAT IP //! and PHY Reset. The application shall configure NMI/Interrupt to eventually //! complete the reset through system control soft reset. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** extern uint16_t ESCSS_disableCPUReset(uint32_t base, uint16_t writeKey); //***************************************************************************** // //! Enables for reset out to drive the CPU NMI. //! //! \param base is the base address of EtherCAT Sub-System. //! \param writeKey is the key Value which decides if the writes to this //! register are to take affect. //! //! This function configures the EtherCAT Reset to drive the CPU NMI. IP Reset //! out drives CPU NMI to which it belongs. NMI handler is expected to complete //! the required tasks or context save if any and then reset the EtherCAT //! through the system control soft reset. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** extern uint16_t ESCSS_enableResetToNMI(uint32_t base, uint16_t writeKey); //***************************************************************************** // //! Disables for reset out to drive the CPU NMI //! //! \param base is the base address of EtherCAT Sub-System. //! \param writeKey is the key Value which decides if the writes to this //! register are to take affect. //! //! This function configures the EtherCAT Reset not to drive the CPU NMI. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** extern uint16_t ESCSS_disableResetToNMI(uint32_t base, uint16_t writeKey); //***************************************************************************** // //! Enables for reset out to drive the interrupt to CPU which it belongs to. //! //! \param base is the base address of EtherCAT Sub-System. //! \param writeKey is the key Value which decides if the writes to this //! register are to take affect. //! //! This function enables the EtherCAT Reset to drive the interrupt to CPU //! which it belongs to. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** extern uint16_t ESCSS_enableResetToInterrupt(uint32_t base, uint16_t writeKey); //***************************************************************************** // //! Disables for reset out to drive the interrupt to CPU which it belongs to. //! //! \param base is the base address of EtherCAT Sub-System. //! \param writeKey is the key Value which decides if the writes to this //! register are to take affect. //! //! This function configures the EtherCAT Reset not to drive the interrupt to //! CPU which it belongs to. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** extern uint16_t ESCSS_disableResetToInterrupt(uint32_t base, uint16_t writeKey); //***************************************************************************** // //! Configures the EtherCAT connection from SYNC0 to a particular interrupt. //! //! \param base is the base address of EtherCAT Sub-System. //! \param connectionInterrupt is the interrupt to which SYNC0 output is //! connected to. //! \param writeKey is the key Value which decides if the writes to this //! register are to take affect. //! //! This function configures the connection from SYNC0 to the interrupt to the //! respective selection made. The following valid options for //! \e connectionInterrupt are: //! - \b ESCSS_SYNC0_CONFIG_C28X_PIE_EN - Connects the SYNC0 to C28x //! PIE Interrupt //! - \b ESCSS_SYNC0_CONFIG_CLA_INT_EN - Connects the SYNC0 to CLA //! Interrupt //! - \b ESCSS_SYNC0_CONFIG_C28X_DMA_EN - Connects the SYNC0 to C28x //! DMA Trigger //! - \b ESCSS_SYNC0_CONFIG_CM4_NVIC_EN - Connects the SYNC0 to CM4 //! NVIC Interrupt //! - \b ESCSS_SYNC0_CONFIG_UDMA_TRIG_EN - Connects the SYNC0 to uDMA //! Trigger //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** extern uint16_t ESCSS_configureSync0Connections(uint32_t base, uint16_t connectionInterrupt, uint16_t writeKey); //***************************************************************************** // //! Configures the EtherCAT connection from SYNC1 to a particular interrupt. //! //! \param base is the base address of EtherCAT Sub-System. //! \param connectionInterrupt is the interrupt to which SYNC1 output is //! connected to. //! \param writeKey is the key Value which decides if the writes to this //! register are to take affect. //! //! This function configures the connection from SYNC1 to the interrupt to the //! respective selection made. The following valid options for //! \e connectionInterrupt are: //! - \b ESCSS_SYNC1_CONFIG_C28X_PIE_EN - Connects the SYNC1 to C28x //! PIE Interrupt //! - \b ESCSS_SYNC1_CONFIG_CLA_INT_EN - Connects the SYNC1 to CLA //! Interrupt //! - \b ESCSS_SYNC1_CONFIG_C28X_DMA_EN - Connects the SYNC1 to C28x //! DMA Trigger //! - \b ESCSS_SYNC1_CONFIG_CM4_NVIC_EN - Connects the SYNC1 to CM4 //! NVIC Interrupt //! - \b ESCSS_SYNC1_CONFIG_UDMA_TRIG_EN - Connects the SYNC1 to uDMA //! Trigger //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** extern uint16_t ESCSS_configureSync1Connections(uint32_t base, uint16_t connectionInterrupt, uint16_t writeKey); //***************************************************************************** // //! Enables the configuration lock. //! //! \param base is the base address of EtherCAT Sub-System. //! \param writeKey is the key Value to enable the writing lock. //! //! This bit enables locking the contents of all the EtherCAT configuration //! registers. This bit can be set only once after ecatXRSN and gets reset //! after the next ecatXRSN. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** extern uint16_t ESCSS_enableConfigurationLock(uint32_t base, uint16_t writeKey); //***************************************************************************** // //! Locking the IO Configuration. //! //! \param base is the base address of EtherCAT configuration Registers. //! \param writeKey is the key Value to enable the writing lock. //! //! This function leads to locking of the IO Configurations. Changing IO //! selections or IO configurations after this bit is set can have //! unpredictable IO behavior on the device IOs. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** extern uint16_t ESCSS_enableIOConnectionLock(uint32_t base, uint16_t writeKey); //***************************************************************************** // //! Disable Lock on the IO Configuration. //! //! \param base is the base address of EtherCAT configuration Registers. //! \param writeKey is the key Value to enable the writing lock. //! //! This function leads to disabling of the locking of the IO Configurations. //! EtherCAT ports are not connected to the IO pad. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** extern uint16_t ESCSS_disableIOConnectionLock(uint32_t base, uint16_t writeKey); //***************************************************************************** // //! Enabled ResetIN from GPIO. //! //! \param base is the base address of EtherCAT configuration Registers. //! \param writeKey is the key Value to enable the writing lock. //! //! This function enables the RESET_IN GPIO pad input to be connected in reset //! input cone. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** extern uint16_t ESCSS_enableResetInputFromGpioPad(uint32_t base, uint16_t writeKey); //***************************************************************************** // //! Disable ResetIN from GPIO. //! //! \param base is the base address of EtherCAT configuration Registers. //! \param writeKey is the key Value to enable the writing lock. //! //! This function leads to RESET_IN GPIO pad to not be enabled, only SW & PMM //! resets affect EtherCAT reset. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** extern uint16_t ESCSS_disableResetInputFromGpioPad(uint32_t base, uint16_t writeKey); //***************************************************************************** // //! Enables the EEPROM I2C IOPAD connection. //! //! \param base is the base address of EtherCAT configuration Registers. //! \param writeKey is the key Value to enable the writing lock. //! //! This function leads to EEPROM I2C connections driving the IOPAD //! connections. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** extern uint16_t ESCSS_enableESCEEPROMI2CIoPadConnection(uint32_t base, uint16_t writeKey); //***************************************************************************** // //! Disable the EEPROM I2C IOPAD connection. //! //! \param base is the base address of EtherCAT configuration Registers. //! \param writeKey is the key Value to enable the writing lock. //! //! This function leads to EEPROM I2C Connections not connected to IOPAD. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** extern uint16_t ESCSS_disableESCEEPROMI2CIoPadConnection(uint32_t base, uint16_t writeKey); //***************************************************************************** // //! Number of PHY port counts. //! //! \param base is the base address of EtherCAT configuration Registers. //! \param portConfig indicating the number of PHY Ports to be selected. //! \param writeKey is the key Value to enable the writing lock. //! //! Indicates the number of PHY ports selected for operation in addition to //! Port0 which is default. The various values for the selection of //! \e portConfig are: //! \b ESCSS_ONE_PORT_SELECTION, \b ESCSS_TWO_PORT_SELECTION. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** extern uint16_t ESCSS_configurePortCount(uint32_t base, ESCSS_PortSelection portConfig, uint16_t writeKey); //***************************************************************************** // //! Auto Compensation based on sampling of TX_CLK. //! //! \param base is the base address of EtherCAT configuration Registers. //! \param writeKey is the key Value to enable the writing lock. //! //! This setting is used to allocate the IO pad for TX_CLK for doing the Auto //! compensation for the sampling of TXEN & TXDATA. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** extern uint16_t ESCSS_enableAutoCompensationTxClkIOPad(uint32_t base, uint16_t writeKey); //***************************************************************************** // //! Manual Compensation is there using CLK_IN. //! //! \param base is the base address of EtherCAT configuration Registers. //! \param writeKey is the key Value to enable the writing lock. //! //! This function sets the manual compensation using CLK_IN no TX_CLK Pad, //! IP input is tied to '0'. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** extern uint16_t ESCSS_disableAutoCompensationTxClkIOPad(uint32_t base, uint16_t writeKey); //***************************************************************************** // //! SYNC0 connection to OUT pad enabled. //! //! \param base is the base address of EtherCAT configuration Registers. //! \param writeKey is the key Value to enable the writing lock. //! //! This function enables the direct mux between Sync0 output of EtherCAT and //! other GPIO functions. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** extern uint16_t ESCSS_enableSync0GpioMuxConnection(uint32_t base, uint16_t writeKey); //***************************************************************************** // //! SYNC0 connection to OUT pad disabled. //! //! \param base is the base address of EtherCAT configuration Registers. //! \param writeKey is the key Value to enable the writing lock. //! //! This function does not enables the direct mux between Sync0 output of //! EtherCAT and other GPIO functions. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** extern uint16_t ESCSS_disableSync0GpioMuxConnection(uint32_t base, uint16_t writeKey); //***************************************************************************** // //! SYNC1 connection to OUT pad enabled. //! //! \param base is the base address of EtherCAT configuration Registers. //! \param writeKey is the key Value to enable the writing lock. //! //! This function enables the direct mux between Sync1 output of EtherCAT and //! other GPIO functions. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** extern uint16_t ESCSS_enableSync1GpioMuxConnection(uint32_t base, uint16_t writeKey); //***************************************************************************** // //! SYNC1 connection to OUT pad disabled. //! //! \param base is the base address of EtherCAT configuration Registers. //! \param writeKey is the key Value to enable the writing lock. //! //! This function does not enables the direct mux between Sync1 output of //! EtherCAT and other GPIO functions. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** extern uint16_t ESCSS_disableSync1GpioMuxConnection(uint32_t base, uint16_t writeKey); //***************************************************************************** // //! LATCH0 connection to IN pad enabled. //! //! \param base is the base address of EtherCAT configuration Registers. //! \param writeKey is the key Value to enable the writing lock. //! //! This function enables the direct mux between LATCH0 input from IOPAD and //! other GPIO functions to the EtherCATSS input. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** extern uint16_t ESCSS_enableLatch0GpioMuxConnection(uint32_t base, uint16_t writeKey); //***************************************************************************** // //! LATCH0 connection to IN pad disabled. //! //! \param base is the base address of EtherCAT configuration Registers. //! \param writeKey is the key Value to enable the writing lock. //! //! This function does not enable the direct mux between LATCH0 input from //! IOPAD and other GPIO functions to the EtherCATSS input. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** extern uint16_t ESCSS_disableLatch0GpioMuxConnection(uint32_t base, uint16_t writeKey); //***************************************************************************** // //! LATCH1 connection to IN pad enabled. //! //! \param base is the base address of EtherCAT configuration Registers. //! \param writeKey is the key Value to enable the writing lock. //! //! This function enables the direct mux between LATCH1 input from IOPAD and //! other GPIO functions to the EtherCATSS input. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** extern uint16_t ESCSS_enableLatch1GpioMuxConnection(uint32_t base, uint16_t writeKey); //***************************************************************************** // //! LATCH1 connection to IN pad disabled. //! //! \param base is the base address of EtherCAT configuration Registers. //! \param writeKey is the key Value to enable the writing lock. //! //! This function does not enable the direct mux between LATCH1 input from //! IOPAD and other GPIO functions to the EtherCATSS input. //! //! \return Returns \b ESCSS_API_SUCCESS if the Register Access is successful, //! \b ESCSS_API_FAIL if access to the Register Fails. // //***************************************************************************** extern uint16_t ESCSS_disableLatch1GpioMuxConnection(uint32_t base, uint16_t writeKey); //***************************************************************************** // //! Configure EEPROM Size bound as per the select. //! //! \param base is the base address of EtherCAT configuration Registers. //! \param eepromSize is the shift in 10ns terms. //! //! This function set the bit which will be hooked up to the EEPROM_SIZE input //! of the EtherCAT IP . This is set to 0 for EEPROMs of size 16K bits or lower //! and set to 1 for EEPROMs of size above 16K bits. //! //! \return None. // //***************************************************************************** extern void ESCSS_configureEEPROMSize(uint32_t base, ESCSS_SizeSelect eepromSize); //***************************************************************************** // // Close the Doxygen group. //! @} // //***************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //########################################################################### // // FILE: flash.h // // TITLE: C28x Flash driver. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup flash_api Flash //! @{ // //***************************************************************************** //########################################################################### // // FILE: hw_flash.h // // TITLE: Definitions for the FLASH registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the FLASH register offsets // //***************************************************************************** // Register // Register // Register // Register 1 // Register // Low // High //***************************************************************************** // // The following are defines for the bit fields in the FRDCNTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the FBAC register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the FBFALLBACK register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the FBPRDY register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the FPAC1 register // //***************************************************************************** // Mode //***************************************************************************** // // The following are defines for the bit fields in the FMSTAT register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the FRD_INTF_CTRL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ECC_ENABLE register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ERR_STATUS register // //***************************************************************************** // Corrected Value 0 // Corrected Value 1 // error occurred // Corrected Value 0 // Corrected Value 1 // error occurred //***************************************************************************** // // The following are defines for the bit fields in the ERR_POS register // //***************************************************************************** // Error in lower 64 bits // Error in upper 64 bits //***************************************************************************** // // The following are defines for the bit fields in the ERR_STATUS_CLR register // //***************************************************************************** // Corrected Value 0 Clear // Corrected Value 1 Clear // error occurred Clear // Corrected Value 0 Clear // Corrected Value 1 Clear // error occurred Clear //***************************************************************************** // // The following are defines for the bit fields in the ERR_CNT register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ERR_THRESHOLD register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ERR_INTFLG register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ERR_INTCLR register // //***************************************************************************** // Clear // Clear //***************************************************************************** // // The following are defines for the bit fields in the FADDR_TEST register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the FECC_TEST register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the FECC_CTRL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the FECC_STATUS register // //***************************************************************************** // Error // Error // Bits of Error //########################################################################### // // FILE: ipc.h // // TITLE: C28x IPC driver. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup ipc_api IPC //! \brief This module is used for inter-processor communications. //! @{ // //***************************************************************************** //########################################################################### // // FILE: hw_ipc.h // // TITLE: Definitions for the IPC registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the IPC register offsets // //***************************************************************************** // Register // Register // Register // Register // Register // Register // Register // Register // Register //***************************************************************************** // // The following are defines for the bit fields in the CPU1TOCMIPCACK register // //***************************************************************************** // CMTOCPU1IPCFLG.IPC0 bit // CMTOCPU1IPCFLG.IPC1 bit // CMTOCPU1IPCFLG.IPC2 bit // CMTOCPU1IPCFLG.IPC3 bit // CMTOCPU1IPCFLG.IPC4 bit // CMTOCPU1IPCFLG.IPC5 bit // CMTOCPU1IPCFLG.IPC6 bit // CMTOCPU1IPCFLG.IPC7 bit // CMTOCPU1IPCFLG.IPC8 bit // CMTOCPU1IPCFLG.IPC9 bit // CMTOCPU1IPCFLG.IPC10 bit // CMTOCPU1IPCFLG.IPC11 bit // CMTOCPU1IPCFLG.IPC12 bit // CMTOCPU1IPCFLG.IPC13 bit // CMTOCPU1IPCFLG.IPC14 bit // CMTOCPU1IPCFLG.IPC15 bit // CMTOCPU1IPCFLG.IPC16 bit // CMTOCPU1IPCFLG.IPC17 bit // CMTOCPU1IPCFLG.IPC18 bit // CMTOCPU1IPCFLG.IPC19 bit // CMTOCPU1IPCFLG.IPC20 bit // CMTOCPU1IPCFLG.IPC21 bit // CMTOCPU1IPCFLG.IPC22 bit // CMTOCPU1IPCFLG.IPC23 bit // CMTOCPU1IPCFLG.IPC24 bit // CMTOCPU1IPCFLG.IPC25 bit // CMTOCPU1IPCFLG.IPC26 bit // CMTOCPU1IPCFLG.IPC27 bit // CMTOCPU1IPCFLG.IPC28 bit // CMTOCPU1IPCFLG.IPC29 bit // CMTOCPU1IPCFLG.IPC30 bit // CMTOCPU1IPCFLG.IPC31 bit //***************************************************************************** // // The following are defines for the bit fields in the CMTOCPU1IPCSTS register // //***************************************************************************** // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 //***************************************************************************** // // The following are defines for the bit fields in the CPU1TOCMIPCSET register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CPU1TOCMIPCCLR register // //***************************************************************************** // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag //***************************************************************************** // // The following are defines for the bit fields in the CPU1TOCMIPCFLG register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CMTOCPU1IPCACK register // //***************************************************************************** // CPU1TOCMIPCFLG.IPC0 bit // CPU1TOCMIPCFLG.IPC1 bit // CPU1TOCMIPCFLG.IPC2 bit // CPU1TOCMIPCFLG.IPC3 bit // CPU1TOCMIPCFLG.IPC4 bit // CPU1TOCMIPCFLG.IPC5 bit // CPU1TOCMIPCFLG.IPC6 bit // CPU1TOCMIPCFLG.IPC7 bit // CPU1TOCMIPCFLG.IPC8 bit // CPU1TOCMIPCFLG.IPC9 bit // CPU1TOCMIPCFLG.IPC10 bit // CPU1TOCMIPCFLG.IPC11 bit // CPU1TOCMIPCFLG.IPC12 bit // CPU1TOCMIPCFLG.IPC13 bit // CPU1TOCMIPCFLG.IPC14 bit // CPU1TOCMIPCFLG.IPC15 bit // CPU1TOCMIPCFLG.IPC16 bit // CPU1TOCMIPCFLG.IPC17 bit // CPU1TOCMIPCFLG.IPC18 bit // CPU1TOCMIPCFLG.IPC19 bit // CPU1TOCMIPCFLG.IPC20 bit // CPU1TOCMIPCFLG.IPC21 bit // CPU1TOCMIPCFLG.IPC22 bit // CPU1TOCMIPCFLG.IPC23 bit // CPU1TOCMIPCFLG.IPC24 bit // CPU1TOCMIPCFLG.IPC25 bit // CPU1TOCMIPCFLG.IPC26 bit // CPU1TOCMIPCFLG.IPC27 bit // CPU1TOCMIPCFLG.IPC28 bit // CPU1TOCMIPCFLG.IPC29 bit // CPU1TOCMIPCFLG.IPC30 bit // CPU1TOCMIPCFLG.IPC31 bit //***************************************************************************** // // The following are defines for the bit fields in the CPU1TOCMIPCSTS register // //***************************************************************************** // CM // CM // CM // CM // CM // CM // CM // CM // CM // CM // CM // CM // CM // CM // CM // CM // CM // CM // CM // CM // CM // CM //***************************************************************************** // // The following are defines for the bit fields in the CMTOCPU1IPCSET register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CMTOCPU1IPCCLR register // //***************************************************************************** // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag //***************************************************************************** // // The following are defines for the bit fields in the CMTOCPU1IPCFLG register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PUMPREQUEST register // //***************************************************************************** // between CPU1, CPU2 and CM // this register //***************************************************************************** // // The following are defines for the bit fields in the CPU2TOCMIPCACK register // //***************************************************************************** // CMTOCPU2IPCFLG.IPC0 bit // CMTOCPU2IPCFLG.IPC1 bit // CMTOCPU2IPCFLG.IPC2 bit // CMTOCPU2IPCFLG.IPC3 bit // CMTOCPU2IPCFLG.IPC4 bit // CMTOCPU2IPCFLG.IPC5 bit // CMTOCPU2IPCFLG.IPC6 bit // CMTOCPU2IPCFLG.IPC7 bit // CMTOCPU2IPCFLG.IPC8 bit // CMTOCPU2IPCFLG.IPC9 bit // CMTOCPU2IPCFLG.IPC10 bit // CMTOCPU2IPCFLG.IPC11 bit // CMTOCPU2IPCFLG.IPC12 bit // CMTOCPU2IPCFLG.IPC13 bit // CMTOCPU2IPCFLG.IPC14 bit // CMTOCPU2IPCFLG.IPC15 bit // CMTOCPU2IPCFLG.IPC16 bit // CMTOCPU2IPCFLG.IPC17 bit // CMTOCPU2IPCFLG.IPC18 bit // CMTOCPU2IPCFLG.IPC19 bit // CMTOCPU2IPCFLG.IPC20 bit // CMTOCPU2IPCFLG.IPC21 bit // CMTOCPU2IPCFLG.IPC22 bit // CMTOCPU2IPCFLG.IPC23 bit // CMTOCPU2IPCFLG.IPC24 bit // CMTOCPU2IPCFLG.IPC25 bit // CMTOCPU2IPCFLG.IPC26 bit // CMTOCPU2IPCFLG.IPC27 bit // CMTOCPU2IPCFLG.IPC28 bit // CMTOCPU2IPCFLG.IPC29 bit // CMTOCPU2IPCFLG.IPC30 bit // CMTOCPU2IPCFLG.IPC31 bit //***************************************************************************** // // The following are defines for the bit fields in the CMTOCPU2IPCSTS register // //***************************************************************************** // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 //***************************************************************************** // // The following are defines for the bit fields in the CPU2TOCMIPCSET register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CPU2TOCMIPCCLR register // //***************************************************************************** // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag //***************************************************************************** // // The following are defines for the bit fields in the CPU2TOCMIPCFLG register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CMTOCPU2IPCACK register // //***************************************************************************** // CPU2TOCMIPCFLG.IPC0 bit // CPU2TOCMIPCFLG.IPC1 bit // CPU2TOCMIPCFLG.IPC2 bit // CPU2TOCMIPCFLG.IPC3 bit // CPU2TOCMIPCFLG.IPC4 bit // CPU2TOCMIPCFLG.IPC5 bit // CPU2TOCMIPCFLG.IPC6 bit // CPU2TOCMIPCFLG.IPC7 bit // CPU2TOCMIPCFLG.IPC8 bit // CPU2TOCMIPCFLG.IPC9 bit // CPU2TOCMIPCFLG.IPC10 bit // CPU2TOCMIPCFLG.IPC11 bit // CPU2TOCMIPCFLG.IPC12 bit // CPU2TOCMIPCFLG.IPC13 bit // CPU2TOCMIPCFLG.IPC14 bit // CPU2TOCMIPCFLG.IPC15 bit // CPU2TOCMIPCFLG.IPC16 bit // CPU2TOCMIPCFLG.IPC17 bit // CPU2TOCMIPCFLG.IPC18 bit // CPU2TOCMIPCFLG.IPC19 bit // CPU2TOCMIPCFLG.IPC20 bit // CPU2TOCMIPCFLG.IPC21 bit // CPU2TOCMIPCFLG.IPC22 bit // CPU2TOCMIPCFLG.IPC23 bit // CPU2TOCMIPCFLG.IPC24 bit // CPU2TOCMIPCFLG.IPC25 bit // CPU2TOCMIPCFLG.IPC26 bit // CPU2TOCMIPCFLG.IPC27 bit // CPU2TOCMIPCFLG.IPC28 bit // CPU2TOCMIPCFLG.IPC29 bit // CPU2TOCMIPCFLG.IPC30 bit // CPU2TOCMIPCFLG.IPC31 bit //***************************************************************************** // // The following are defines for the bit fields in the CPU2TOCMIPCSTS register // //***************************************************************************** // CM // CM // CM // CM // CM // CM // CM // CM // CM // CM // CM // CM // CM // CM // CM // CM // CM // CM // CM // CM // CM // CM //***************************************************************************** // // The following are defines for the bit fields in the CMTOCPU2IPCSET register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CMTOCPU2IPCCLR register // //***************************************************************************** // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag //***************************************************************************** // // The following are defines for the bit fields in the CMTOCPU2IPCFLG register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CPU1TOCPU2IPCACK register // //***************************************************************************** // CPU2TOCPU1IPCFLG.IPC0 bit // CPU2TOCPU1IPCFLG.IPC1 bit // CPU2TOCPU1IPCFLG.IPC2 bit // CPU2TOCPU1IPCFLG.IPC3 bit // CPU2TOCPU1IPCFLG.IPC4 bit // CPU2TOCPU1IPCFLG.IPC5 bit // CPU2TOCPU1IPCFLG.IPC6 bit // CPU2TOCPU1IPCFLG.IPC7 bit // CPU2TOCPU1IPCFLG.IPC8 bit // CPU2TOCPU1IPCFLG.IPC9 bit // CPU2TOCPU1IPCFLG.IPC10 bit // CPU2TOCPU1IPCFLG.IPC11 bit // CPU2TOCPU1IPCFLG.IPC12 bit // CPU2TOCPU1IPCFLG.IPC13 bit // CPU2TOCPU1IPCFLG.IPC14 bit // CPU2TOCPU1IPCFLG.IPC15 bit // CPU2TOCPU1IPCFLG.IPC16 bit // CPU2TOCPU1IPCFLG.IPC17 bit // CPU2TOCPU1IPCFLG.IPC18 bit // CPU2TOCPU1IPCFLG.IPC19 bit // CPU2TOCPU1IPCFLG.IPC20 bit // CPU2TOCPU1IPCFLG.IPC21 bit // CPU2TOCPU1IPCFLG.IPC22 bit // CPU2TOCPU1IPCFLG.IPC23 bit // CPU2TOCPU1IPCFLG.IPC24 bit // CPU2TOCPU1IPCFLG.IPC25 bit // CPU2TOCPU1IPCFLG.IPC26 bit // CPU2TOCPU1IPCFLG.IPC27 bit // CPU2TOCPU1IPCFLG.IPC28 bit // CPU2TOCPU1IPCFLG.IPC29 bit // CPU2TOCPU1IPCFLG.IPC30 bit // CPU2TOCPU1IPCFLG.IPC31 bit //***************************************************************************** // // The following are defines for the bit fields in the CPU2TOCPU1IPCSTS register // //***************************************************************************** // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 // CPU1 //***************************************************************************** // // The following are defines for the bit fields in the CPU1TOCPU2IPCSET register // //***************************************************************************** // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag //***************************************************************************** // // The following are defines for the bit fields in the CPU1TOCPU2IPCCLR register // //***************************************************************************** // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag //***************************************************************************** // // The following are defines for the bit fields in the CPU1TOCPU2IPCFLG register // //***************************************************************************** // Status // Status // Status // Status // Status // Status // Status // Status // Status // Status // Status // Status // Status // Status // Status // Status // Status // Status // Status // Status // Status // Status //***************************************************************************** // // The following are defines for the bit fields in the CPU2TOCPU1IPCACK register // //***************************************************************************** // CPU1TOCPU2IPCFLG.IPC0 bit // CPU1TOCPU2IPCFLG.IPC1 bit // CPU1TOCPU2IPCFLG.IPC2 bit // CPU1TOCPU2IPCFLG.IPC3 bit // CPU1TOCPU2IPCFLG.IPC4 bit // CPU1TOCPU2IPCFLG.IPC5 bit // CPU1TOCPU2IPCFLG.IPC6 bit // CPU1TOCPU2IPCFLG.IPC7 bit // CPU1TOCPU2IPCFLG.IPC8 bit // CPU1TOCPU2IPCFLG.IPC9 bit // CPU1TOCPU2IPCFLG.IPC10 bit // CPU1TOCPU2IPCFLG.IPC11 bit // CPU1TOCPU2IPCFLG.IPC12 bit // CPU1TOCPU2IPCFLG.IPC13 bit // CPU1TOCPU2IPCFLG.IPC14 bit // CPU1TOCPU2IPCFLG.IPC15 bit // CPU1TOCPU2IPCFLG.IPC16 bit // CPU1TOCPU2IPCFLG.IPC17 bit // CPU1TOCPU2IPCFLG.IPC18 bit // CPU1TOCPU2IPCFLG.IPC19 bit // CPU1TOCPU2IPCFLG.IPC20 bit // CPU1TOCPU2IPCFLG.IPC21 bit // CPU1TOCPU2IPCFLG.IPC22 bit // CPU1TOCPU2IPCFLG.IPC23 bit // CPU1TOCPU2IPCFLG.IPC24 bit // CPU1TOCPU2IPCFLG.IPC25 bit // CPU1TOCPU2IPCFLG.IPC26 bit // CPU1TOCPU2IPCFLG.IPC27 bit // CPU1TOCPU2IPCFLG.IPC28 bit // CPU1TOCPU2IPCFLG.IPC29 bit // CPU1TOCPU2IPCFLG.IPC30 bit // CPU1TOCPU2IPCFLG.IPC31 bit //***************************************************************************** // // The following are defines for the bit fields in the CPU1TOCPU2IPCSTS register // //***************************************************************************** // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 // CPU2 //***************************************************************************** // // The following are defines for the bit fields in the CPU2TOCPU1IPCSET register // //***************************************************************************** // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag //***************************************************************************** // // The following are defines for the bit fields in the CPU2TOCPU1IPCCLR register // //***************************************************************************** // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag // Flag //***************************************************************************** // // The following are defines for the bit fields in the CPU2TOCPU1IPCFLG register // //***************************************************************************** // Status // Status // Status // Status // Status // Status // Status // Status // Status // Status // Status // Status // Status // Status // Status // Status // Status // Status // Status // Status // Status // Status //***************************************************************************** // // Defines for the APIs // //***************************************************************************** //***************************************************************************** // // Driver configuration macros // //***************************************************************************** // // Number of IPC messages in circular buffer (must be interval of 2) // // // Number of IPC interrupts using circular buffer (must be same number on both // CPUs) // //***************************************************************************** // // Values that can be passed as parameter flags in all the IPC API functions. // //***************************************************************************** //***************************************************************************** // // Values that can be passed as parameter ipcInt in // IPC_registerInterrupt and IPC_unregisterInterrupt functions. // Please refer to the datasheet for the actual number of interrupts available // for each IPC instance // //***************************************************************************** //***************************************************************************** // // Values that can be passed as parameter addrCorrEnable in // IPC_sendCommand, IPC_readCommand, IPC_sendMessageToQueue and // IPC_readMessageFromQueue functions. // //***************************************************************************** //***************************************************************************** // // Values that can be passed as parameter block in // IPC_sendMessageToQueue and IPC_readMessageFromQueue functions. // //***************************************************************************** //***************************************************************************** // // Macros used to get and release the flash pump sempahore // //***************************************************************************** //***************************************************************************** // // Internal macros used for message queue implementation // //***************************************************************************** //***************************************************************************** // // Enums for the APIs // //***************************************************************************** //***************************************************************************** // //! Values that can be passed as parameter \e ipcType in all the driver //! functions // //***************************************************************************** typedef enum { IPC_CPU1_L_CPU2_R, //!< CPU1 - Local core, CPU2 - Remote core IPC_CPU1_L_CM_R, //!< CPU1 - Local core, CM - Remote core IPC_CPU2_L_CPU1_R, //!< CPU2 - Local core, CPU1 - Remote core IPC_CPU2_L_CM_R, //!< CPU2 - Local core, CM - Remote core IPC_TOTAL_NUM }IPC_Type_t; //***************************************************************************** // // Internal structs for register and messaage queue accesses // //***************************************************************************** typedef struct { uint32_t IPC_ACK; uint32_t IPC_STS; uint32_t IPC_SET; uint32_t IPC_CLR; uint32_t IPC_FLG; uint32_t IPC_RSVDREG; uint32_t IPC_COUNTERL; uint32_t IPC_COUNTERH; }IPC_Flag_Ctr_Reg_t; typedef struct { uint32_t IPC_SENDCOM; uint32_t IPC_SENDADDR; uint32_t IPC_SENDDATA; uint32_t IPC_REMOTEREPLY; }IPC_SendCmd_Reg_t; typedef struct { uint32_t IPC_RECVCOM; uint32_t IPC_RECVADDR; uint32_t IPC_RECVDATA; uint32_t IPC_LOCALREPLY; }IPC_RecvCmd_Reg_t; typedef struct { uint32_t IPC_BOOTSTS; uint32_t IPC_BOOTMODE; uint32_t IPC_PUMPREQUEST; }IPC_Boot_Pump_Reg_t; typedef struct { uint32_t command; uint32_t address; uint32_t dataw1; uint32_t dataw2; }IPC_Message_t; typedef struct { IPC_Message_t Buffer[4U][4U]; uint16_t PutWriteIndex[4U]; uint16_t GetReadIndex[4U]; }IPC_PutBuffer_t; typedef struct { IPC_Message_t Buffer[4U][4U]; uint16_t GetWriteIndex[4U]; uint16_t PutReadIndex[4U]; }IPC_GetBuffer_t; //***************************************************************************** // // Internal struct used to store the required information regarding an IPC // instance // //***************************************************************************** typedef struct { volatile IPC_Flag_Ctr_Reg_t *IPC_Flag_Ctr_Reg; volatile IPC_SendCmd_Reg_t *IPC_SendCmd_Reg; volatile IPC_RecvCmd_Reg_t *IPC_RecvCmd_Reg; volatile IPC_Boot_Pump_Reg_t *IPC_Boot_Pump_Reg; uint32_t IPC_IntNum[8U]; uint32_t IPC_MsgRam_LtoR; uint32_t IPC_MsgRam_RtoL; uint32_t IPC_Offset_Corr; IPC_PutBuffer_t *IPC_PutBuffer; IPC_GetBuffer_t *IPC_GetBuffer; }IPC_Instance_t; extern const IPC_Instance_t IPC_Instance[IPC_TOTAL_NUM]; //***************************************************************************** // // A structure that defines an IPC message queue. These // fields are used by the IPC drivers, and normally it is not necessary for // user software to directly read or write fields in the table. // //***************************************************************************** typedef struct { IPC_Message_t * PutBuffer; uint32_t PutFlag; uint16_t * PutWriteIndex; uint16_t * PutReadIndex; IPC_Message_t * GetBuffer; uint16_t * GetWriteIndex; uint16_t * GetReadIndex; } IPC_MessageQueue_t; //***************************************************************************** // // API Function prototypes // //***************************************************************************** //***************************************************************************** // //! Local core sets Local to Remote IPC Flag //! //! \param ipcType is the enum corresponding to the IPC instance used //! \param flags is the IPC flag mask for the flags being set //! //! This function will allow the Local core system to set the designated IPC //! flags to send to the Remote core system. The \e flags parameter can be any //! of the IPC flag values: \b IPC_FLAG0 - \b IPC_FLAG31. //! //! \return None. // //***************************************************************************** static inline void IPC_setFlagLtoR(IPC_Type_t ipcType, uint32_t flags) { IPC_Instance[ipcType].IPC_Flag_Ctr_Reg->IPC_SET = flags; } //***************************************************************************** // //! Local core clears Local to Remote IPC Flag //! //! \param ipcType is the enum corresponding to the IPC instance used //! \param flags is the IPC flag mask for the flags being cleared //! //! This function will allow the Local core system to clear the designated IPC //! flags sent to the Remote core system. The \e flags parameter can be any //! of the IPC flag values: \b IPC_FLAG0 - \b IPC_FLAG31. //! //! \return None. // //***************************************************************************** static inline void IPC_clearFlagLtoR(IPC_Type_t ipcType, uint32_t flags) { IPC_Instance[ipcType].IPC_Flag_Ctr_Reg->IPC_CLR = flags; } //***************************************************************************** // //! Local core acknowledges Remote to Local IPC Flag. //! //! \param ipcType is the enum corresponding to the IPC instance used //! \param flags is the IPC flag mask for the flags being acknowledged. //! //! This function will allow the Local core system to acknowledge/clear the IPC //! flag set by the Remote core system. The \e flags parameter can be any of //! the IPC flag values: \b IPC_FLAG0 - \b IPC_FLAG31. //! //! \return None. // //***************************************************************************** static inline void IPC_ackFlagRtoL(IPC_Type_t ipcType, uint32_t flags) { IPC_Instance[ipcType].IPC_Flag_Ctr_Reg->IPC_ACK = flags; } //***************************************************************************** // //! Determines whether the given IPC flags are busy or not. //! //! \param ipcType is the enum corresponding to the IPC instance used //! \param flags is the Local to Remote IPC flag masks to check the status of //! //! Allows the caller to determine whether the designated Local to Remote //! IPC flags are pending. The \e flags parameter can be any of the IPC flag //! values: \b IPC_FLAG0 - \b IPC_FLAG31. //! //! \return Returns \b true if the any of the designated IPC flags are busy //! or \b false if all the designated IPC flags are free. // //***************************************************************************** static inline _Bool IPC_isFlagBusyLtoR(IPC_Type_t ipcType, uint32_t flags) { return((IPC_Instance[ipcType].IPC_Flag_Ctr_Reg->IPC_FLG & flags) != 0U); } //***************************************************************************** // //! Determines whether the given Remote to Local IPC flags are busy or not. //! //! \param ipcType is the enum corresponding to the IPC instance used //! \param flags is the Remote to Local IPC Flag masks to check the status of //! //! Allows the caller to determine whether the designated Remote to Local //! IPC flags are pending. The \e flags parameter can be any of the IPC flag //! values: \b IPC_FLAG0 - \b IPC_FLAG31. //! //! \return Returns \b true if the any of the designated IPC flags are busy //! or \b false if all the designated IPC flags are free. // //***************************************************************************** static inline _Bool IPC_isFlagBusyRtoL(IPC_Type_t ipcType, uint32_t flags) { return((IPC_Instance[ipcType].IPC_Flag_Ctr_Reg->IPC_STS & flags) != 0U); } //***************************************************************************** // //! Wait for the remote core to send a flag //! //! \param ipcType is the enum corresponding to the IPC instance used //! \param flag is the Remote to Local IPC flag mask to wait for //! //! Allows the caller to wait for the Remote to Local flag to be send by //! the remote core. The \e flags parameter can be any of the IPC flag //! values: \b IPC_FLAG0 - \b IPC_FLAG31. //! //! \return None // //***************************************************************************** static inline void IPC_waitForFlag(IPC_Type_t ipcType, uint32_t flag) { while((IPC_Instance[ipcType].IPC_Flag_Ctr_Reg->IPC_STS & flag) == 0U) { } } //***************************************************************************** // //! Wait for the IPC flag to be acknowledged //! //! \param ipcType is the enum corresponding to the IPC instance used //! \param flag is the IPC flag mask for which ack is pending //! //! Allows the caller to wait for the IPC flag to be acknowledged by the //! remote core. The \e flagsparameter can be any of the IPC flag values: //! \b IPC_FLAG0 - \b IPC_FLAG31. //! //! \return None // //***************************************************************************** static inline void IPC_waitForAck(IPC_Type_t ipcType, uint32_t flag) { while((IPC_Instance[ipcType].IPC_Flag_Ctr_Reg->IPC_FLG & flag) != 0U) { } } //***************************************************************************** // //! Synchronises the two cores //! //! \param ipcType is the enum corresponding to the IPC instance used //! \param flag is the IPC flag mask with which synchronisation is done //! //! Allows the local and remote cores to synchronise. Neither core will return //! from this function call before the other core enters it. //! //! \note Must be called with same flag mask on both the cores //! //! \return None // //***************************************************************************** static inline void IPC_sync(IPC_Type_t ipcType, uint32_t flag) { IPC_setFlagLtoR(ipcType, flag); IPC_waitForFlag(ipcType, flag); IPC_ackFlagRtoL(ipcType, flag); IPC_waitForAck(ipcType, flag); } //***************************************************************************** // //! Sends a command to the Remote core //! //! \param ipcType is the enum corresponding to the IPC instance used //! \param flags is the IPC flag mask for the flags to be set //! \param addrCorrEnable is the flag used to determine whether or not to //! convert the addr parameter to remote core's address space //! \param command is the 32-bit command value //! \param addr is the 32-bit address to be sent as part of command //! \param data is the 32-bit data to be sent as part of command //! //! Allows the caller to send a command to the remote core. A command consists //! of a unique command value, a 32-bit address and a 32-bit data. The function //! also sends the designated flags to the remote core. //! There may be differences in the address spaces of Local and Remote core. //! For example in case of F2838X device, the address spaces of C28x core and //! CM core are different. In case the \e addr refers to an address in the IPC //! MSG RAM, \e addrCorrEnable param may be used to correct the address mismatch //! //! The \e flags parameter can be any of the IPC flag values: \b IPC_FLAG0 - //! \b IPC_FLAG31. //! The \e addrCorrEnable parameter can take values IPC_ADDR_CORRECTION_ENABLE //! (converts the address to remote core's address space) or //! IPC_ADDR_CORRECTION_DISABLE(does not modify the addr parmeter) //! //! The application shall use the function IPC_getResponse to read the response //! sent by the remote core. //! //! \note The application is expected to wait until the the response is //! received before sending another command. //! //! \note \e addrCorrEnable parameter must be kept same on the sending and //! receiving cores //! //! \return Returns \b true if the command is sent properly and \b false if //! the designated flags were busy and hence command was not sent. // //***************************************************************************** extern _Bool IPC_sendCommand(IPC_Type_t ipcType, uint32_t flags, _Bool addrCorrEnable, uint32_t command, uint32_t addr, uint32_t data); //***************************************************************************** // //! Reads a command sent by the Remote core //! //! \param ipcType is the enum corresponding to the IPC instance used //! \param flags is the IPC flag mask for the flags sent by the remote core //! \param addrCorrEnable is the flag used to determine whether or not to //! convert the addr parameter to remote core's address space //! \param command is the 32-bit pointer at which the command value is read to //! \param addr is the 32-bit pointer at which address value is read to //! \param data is the 32-bit pointer at which the data is read to //! //! Allows the caller to read a command sent by the remote core. A command //! consists of a unique command value, a 32-bit address and a 32-bit data. //! There may be differences in the address spaces of Local and Remote core. //! For example in case of F2838X device, the address spaces of C28x core and //! CM core are different. In case the \e addr refers to an address in the IPC //! MSG RAM, \e addrCorrEnable param may be used to correct the address mismatch //! //! The \e flags parameter can be any of the IPC flag values: \b IPC_FLAG0 - //! \b IPC_FLAG31. //! The \e addrCorrEnable parameter can take values IPC_ADDR_CORRECTION_ENABLE //! (converts the address to remote core's address space) or //! IPC_ADDR_CORRECTION_DISABLE(does not modify the addr parmeter) //! //! \note The application is expected to acknowledge the flag and send a //! response (if needed) after reading the command //! //! \note \e addrCorrEnable parameter must be kept same on the sending and //! receiving cores //! //! \return Returns \b true if the command is read properly and \b false if //! the designated flags were empty and hence command was not read. // //***************************************************************************** extern _Bool IPC_readCommand(IPC_Type_t ipcType, uint32_t flags, _Bool addrCorrEnable, uint32_t *command, uint32_t *addr, uint32_t *data); //***************************************************************************** // //! Sends the response to the command sent by remote core. //! //! \param ipcType is the enum corresponding to the IPC instance used //! \param data is the 32-bit value of the response to be sent //! //! Allows the caller to send a response to the command previously sent by the //! remote core //! //! \return None. // //***************************************************************************** static inline void IPC_sendResponse(IPC_Type_t ipcType, uint32_t data) { IPC_Instance[ipcType].IPC_RecvCmd_Reg->IPC_LOCALREPLY = data; } //***************************************************************************** // //! Reads the response from the remote core. //! //! \param ipcType is the enum corresponding to the IPC instance used //! //! Allows the caller to read the response sent by the remote core to the //! command previously sent by the local core //! //! \return the 32-bit value of the response. // //***************************************************************************** static inline uint32_t IPC_getResponse(IPC_Type_t ipcType) { return(IPC_Instance[ipcType].IPC_SendCmd_Reg->IPC_REMOTEREPLY); } //***************************************************************************** // //! Sets the BOOTMODE register. //! //! \param ipcType is the enum corresponding to the IPC instance used //! \param mode is the 32-bit value to be set //! //! Allows the caller to set the BOOTMODE register. //! //! \note This function shall be called by CPU1 only. Boot registers are not //! available in CPU2<->CM IPC instance //! //! \return None // //***************************************************************************** static inline void IPC_setBootMode(IPC_Type_t ipcType, uint32_t mode) { do { if(!((ipcType == IPC_CPU1_L_CPU2_R) || (ipcType == IPC_CPU1_L_CM_R))) { __error__("C:\\ti\\c2000\\C2000Ware_2_01_00_00\\driverlib\\f2838x\\driverlib\\ipc.h", 640); } } while(0); IPC_Instance[ipcType].IPC_Boot_Pump_Reg->IPC_BOOTMODE = mode; } //***************************************************************************** // //! Reads the BOOTMODE register. //! //! \param ipcType is the enum corresponding to the IPC instance used //! //! Allows the caller to read the BOOTMODE register. //! //! \note Boot registers are not available in CPU2<->CM IPC instance //! //! \return 32-bit value of the BOOOTMODE register // //***************************************************************************** static inline uint32_t IPC_getBootMode(IPC_Type_t ipcType) { return(IPC_Instance[ipcType].IPC_Boot_Pump_Reg->IPC_BOOTMODE); } //***************************************************************************** // //! Sets the BOOTSTS register. //! //! \param ipcType is the enum corresponding to the IPC instance used //! \param status is the 32-bit value to be set //! //! Allows the caller to set the BOOTSTS register. //! //! \note This function shall be called by CPU2 and CM only //! //! \note This function shall be called by CPU2 and CM only. Boot registers //! are not available in CPU2<->CM IPC instance //! //! \return None. // //***************************************************************************** static inline void IPC_setBootStatus(IPC_Type_t ipcType, uint32_t status) { do { if(!(ipcType == IPC_CPU2_L_CPU1_R)) { __error__("C:\\ti\\c2000\\C2000Ware_2_01_00_00\\driverlib\\f2838x\\driverlib\\ipc.h", 684); } } while(0); IPC_Instance[ipcType].IPC_Boot_Pump_Reg->IPC_BOOTSTS = status; } //***************************************************************************** // //! Reads the BOOTSTS register. //! //! \param ipcType is the enum corresponding to the IPC instance used //! //! Allows the caller to set the BOOTMODE register. //! //! \note Boot registers are not available in CPU2<->CM IPC instance //! //! \return 32-bit value of the BOOOTSTS register // //***************************************************************************** static inline uint32_t IPC_getBootStatus(IPC_Type_t ipcType) { return(IPC_Instance[ipcType].IPC_Boot_Pump_Reg->IPC_BOOTSTS); } //***************************************************************************** // //! Reads the timestamp counter value. //! //! \param ipcType is the enum corresponding to the IPC instance used //! //! Allows the caller to read the IPC timestamp counter value. //! //! \return 64-bit counter value. // //***************************************************************************** static inline uint64_t IPC_getCounter(IPC_Type_t ipcType) { // // Get the Counter High and Low values. Read to the Counter low register // saves the value of Counter High register. // uint32_t ctrL = IPC_Instance[ipcType].IPC_Flag_Ctr_Reg->IPC_COUNTERL; uint32_t ctrH = IPC_Instance[ipcType].IPC_Flag_Ctr_Reg->IPC_COUNTERH; // // Return the 64-bit value of the counter // return(((uint64_t)ctrH << 32) | ((uint64_t)ctrL)); } //***************************************************************************** // //! Registers an interrupt handler for IPC //! //! \param ipcType is the enum corresponding to the IPC instance used //! \param ipcInt is the Flag number for which interrupt is being registered //! \param pfnHandler is the pointer to ISR function //! //! This function registers the handler to be called when an IPC interrupt //! occurs. This function enables the global interrupt in the interrupt //! controller. //! The \e ipcInt parameter can be any of the IPC flag values:\b IPC_INT0 - //! \b IPC_INT7. IPC_INT0 corresponds to IPC Flag 0 interrupt and so on. // //***************************************************************************** extern void IPC_registerInterrupt(IPC_Type_t ipcType, uint32_t ipcInt, void (*pfnHandler)(void)); //***************************************************************************** // //! Unregisters an interrupt handler for IPC //! //! \param ipcType is the enum corresponding to the IPC instance used //! \param ipcInt is the Flag number for which interrupt is being unregistered //! //! This function clears the handler to be called when an IPC interrupt //! occurs. This function also masks off the interrupt in the interrupt //! controller so that the interrupt handler no longer is called. //! The \e ipcInt parameter can be any of the IPC flag values:\b IPC_INT0 - //! \b IPC_INT7. IPC_INT0 corresponds to IPC Flag 0 interrupt and so on. // //***************************************************************************** extern void IPC_unregisterInterrupt(IPC_Type_t ipcType, uint32_t ipcInt); //***************************************************************************** // //! Initializes the IPC message queue //! //! \param ipcType is the enum corresponding to the IPC instance used //! \param msgQueue specifies the address of a \e IPC_MessageQueue_t instance //! \param ipcInt_L specifies the interrupt number on the local core used by //! the message queue . //! \param ipcInt_R specifies the interrupt number on the remote core used by //! the message queue. //! //! This function initializes the IPC message queue with circular buffer //! and index addresses for an IPC interrupt pair. The //! \e ipcInt_L and \e ipcInt_R parameters can be one of the following values: //! \b IPC_INT0, \b IPC_INT1, \b IPC_INT2, \b IPC_INT3. //! //! \note If an interrupt is currently in use by an \e IPC_MessageQueue_t //! instance, that particular interrupt should not be tied to a second //! \e IPC_MessageQueue_t instance. //! //! \note For a particular ipcInt_L - ipcInt_R pair, there must be an instance //! of IPC_MessageQueue_t defined and initialized on both the locakl and remote //! systems. //! //! \return None. // //***************************************************************************** extern void IPC_initMessageQueue(IPC_Type_t ipcType, volatile IPC_MessageQueue_t *msgQueue, uint32_t ipcInt_L, uint32_t ipcInt_R); //***************************************************************************** // //! Sends a message into the messageQueue. //! //! \param ipcType is the enum corresponding to the IPC instance used //! \param msgQueue specifies the address of a \e IPC_MessageQueue_t instance //! \param addrCorrEnable is the flag used to determine whether or not to //! convert the addr parameter to remote core's address space //! \param msg specifies the address of the \e IPC_Message_t instance to be //! sent to message queue. //! \param block specifies whether to allow function to block until the buffer //! has a free slot //! //! This function checks if there is a free slot in the message queue. If so, it //! puts the message pointed to by \e msg into the free and sets the //! appropriate IPC interrupt flag //! //! The \e addrCorrEnable parameter can take values IPC_ADDR_CORRECTION_ENABLE //! (converts the address to remote core's address space) or //! IPC_ADDR_CORRECTION_DISABLE(does not modify the addr parmeter) //! The \e block parameter can be one of the following values: //! \b IPC_BLOCKING_CALL or \b IPC_NONBLOCKING_CALL. //! //! \return \b false if the queue is full. \b true if the message is //! successfully sent. // //***************************************************************************** extern _Bool IPC_sendMessageToQueue(IPC_Type_t ipcType, volatile IPC_MessageQueue_t *msgQueue, _Bool addrCorrEnable, IPC_Message_t *msg, _Bool block); //***************************************************************************** // //! Reads a message from the messageQueue. //! //! \param ipcType is the enum corresponding to the IPC instance used //! \param msgQueue specifies the address of a \e IPC_MessageQueue_t instance //! \param addrCorrEnable is the flag used to determine whether or not to //! convert the addr parameter to remote core's address space //! \param msg specifies the address of the \e IPC_Message_t instance to which //! the message needs to be read //! \param block specifies whether to allow function to block until a message //! is available in the message queue //! //! This function checks if there is a message in the message queue. If so, it //! reads the message and writes to the address pointed to by \e msg into. //! //! The \e addrCorrEnable parameter can take values IPC_ADDR_CORRECTION_ENABLE //! (converts the address to remote core's address space) or //! IPC_ADDR_CORRECTION_DISABLE(does not modify the addr parmeter) //! The \e block parameter can be one of the following values: //! \b IPC_BLOCKING_CALL or \b IPC_NONBLOCKING_CALL. //! //! \return \b false if the queue is empty. \b true if the message successfully //! read. // //***************************************************************************** extern _Bool IPC_readMessageFromQueue(IPC_Type_t ipcType, volatile IPC_MessageQueue_t *msgQueue, _Bool addrCorrEnable, IPC_Message_t *msg, _Bool block); //***************************************************************************** // // Close the Doxygen group. //! @} // //***************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** #pragma CODE_SECTION(Flash_setBankPowerMode, ".TI.ramfunc"); #pragma CODE_SECTION(Flash_setPumpPowerMode, ".TI.ramfunc"); #pragma CODE_SECTION(Flash_disableCache, ".TI.ramfunc"); #pragma CODE_SECTION(Flash_disablePrefetch, ".TI.ramfunc"); #pragma CODE_SECTION(Flash_setWaitstates, ".TI.ramfunc"); #pragma CODE_SECTION(Flash_enableCache, ".TI.ramfunc"); #pragma CODE_SECTION(Flash_enablePrefetch, ".TI.ramfunc"); #pragma CODE_SECTION(Flash_enableECC, ".TI.ramfunc"); //***************************************************************************** // //! Values that can be passed to Flash_setBankPowerMode() as the bank parameter // //***************************************************************************** typedef enum { FLASH_BANK = 0x0 //!< Bank } Flash_BankNumber; //***************************************************************************** // //! Values that can be passed to Flash_claimPumpSemaphore() in order to claim //! the pump semaphore. // //***************************************************************************** typedef enum { FLASH_CPU1_WRAPPER = 0x2, //!< CPU1 Wrapper FLASH_CPU2_WRAPPER = 0x1 //!< CPU2 Wrapper }Flash_PumpOwnership; //***************************************************************************** // //! Values that can be passed to Flash_setBankPowerMode() as the powerMode //! parameter. // //***************************************************************************** typedef enum { FLASH_BANK_PWR_SLEEP = 0x0, //!< Sleep fallback mode FLASH_BANK_PWR_STANDBY = 0x1, //!< Standby fallback mode FLASH_BANK_PWR_ACTIVE = 0x3 //!< Active fallback mode } Flash_BankPowerMode; //***************************************************************************** // //! Values that can be passed to Flash_setPumpPowerMode() as the powerMode //! parameter. // //***************************************************************************** typedef enum { FLASH_PUMP_PWR_SLEEP = 0x0, //!< Sleep fallback mode FLASH_PUMP_PWR_ACTIVE = 0x1 //!< Active fallback mode } Flash_PumpPowerMode; //***************************************************************************** // //! Type that correspond to values returned from Flash_getLowErrorStatus() and //! Flash_getHighErrorStatus() determining the error status code. // //***************************************************************************** typedef enum { FLASH_NO_ERR = 0x0, //!< No error FLASH_FAIL_0 = 0x1, //!< Fail on 0 FLASH_FAIL_1 = 0x2, //!< Fail on 1 FLASH_UNC_ERR = 0x4 //!< Uncorrectable error } Flash_ErrorStatus; //***************************************************************************** // //! Values that can be returned from Flash_getLowErrorType() and //! Flash_getHighErrorType() determining the error type. // //***************************************************************************** typedef enum { FLASH_DATA_ERR = 0x0, //!< Data error FLASH_ECC_ERR = 0x1 //!< ECC error } Flash_ErrorType; //***************************************************************************** // //! Values that can be returned from Flash_getECCTestSingleBitErrorType(). // //***************************************************************************** typedef enum { FLASH_DATA_BITS = 0x0, //!< Data bits FLASH_CHECK_BITS = 0x1 //!< ECC bits } Flash_SingleBitErrorIndicator; //***************************************************************************** // // Values that can be passed to Flash_clearLowErrorStatus and // Flash_clearHighErrorStatus. // //***************************************************************************** //***************************************************************************** // // Values that can be returned from Flash_getInterruptFlag and // Flash_getECCTestStatus. // //***************************************************************************** //***************************************************************************** // // Delay instruction that allows for register configuration to complete. // //***************************************************************************** //***************************************************************************** // // Key value for claiming the pump semaphore. // //***************************************************************************** //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** //***************************************************************************** // //! \internal //! Checks a flash wrapper base address for the control registers. //! //! \param ctrlBase is the base address of the flash wrapper control registers. //! //! This function determines if a flash wrapper control base address is valid. //! //! \return Returns \b true if the base address is valid and \b false //! otherwise. // //***************************************************************************** static inline _Bool Flash_isCtrlBaseValid(uint32_t ctrlBase) { return((ctrlBase == 0x0005F800U)); } //***************************************************************************** // //! \internal //! Checks a flash wrapper base address for the ECC registers. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! //! This function determines if a flash wrapper ECC base address is valid. //! //! \return Returns \b true if the base address is valid and \b false //! otherwise. // //***************************************************************************** static inline _Bool Flash_isECCBaseValid(uint32_t eccBase) { return((eccBase == 0x0005FB00U)); } //***************************************************************************** // //! Sets the random read wait state amount. //! //! \param ctrlBase is the base address of the flash wrapper control registers. //! \param waitstates is the wait-state value. //! //! This function sets the number of wait states for a flash read access. The //! \e waitstates parameter is a number between 0 and 15. It is \b important //! to look at your device's datasheet for information about what the required //! minimum flash wait-state is for your selected SYSCLK frequency. //! //! By default the wait state amount is configured to the maximum 15. //! //! \return None. // //***************************************************************************** static inline void Flash_setWaitstates(uint32_t ctrlBase, uint16_t waitstates) { // // Check the arguments. // do { if(!(Flash_isCtrlBaseValid(ctrlBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 275); } } while(0); // // waitstates is 4 bits wide. // do { if(!(waitstates <= 0xFU)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 280); } } while(0); __eallow(); // // Write flash read wait-state amount to appropriate register. // (*((volatile uint32_t *)((uintptr_t)(ctrlBase + 0x0U)))) = ((*((volatile uint32_t *)((uintptr_t)(ctrlBase + 0x0U)))) & ~(uint32_t)0xF00U) | ((uint32_t)waitstates << 8U); __edis(); } //***************************************************************************** // //! Sets the fallback power mode of a flash bank. //! //! \param ctrlBase is the base address of the flash wrapper registers. //! \param bank is the flash bank that is being configured. //! \param powerMode is the power mode to be entered. //! //! This function sets the fallback power mode of the flash bank specified by //! them \e bank parameter. The power mode is specified by the \e powerMode //! parameter with one of the following values: //! //! - \b FLASH_BANK_PWR_SLEEP - Sense amplifiers and sense reference disabled. //! - \b FLASH_BANK_PWR_STANDBY - Sense amplifiers disabled but sense reference //! enabled. //! - \b FLASH_BANK_PWR_ACTIVE - Sense amplifiers and sense reference enabled. //! //! //! Note: There is only one Flash_BankNumber value on this device (FLASH_BANK). //! //! \return None. // //***************************************************************************** static inline void Flash_setBankPowerMode(uint32_t ctrlBase, Flash_BankNumber bank, Flash_BankPowerMode powerMode) { // // Check the arguments. // do { if(!(Flash_isCtrlBaseValid(ctrlBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 326); } } while(0); __eallow(); // // Write the power mode to the appropriate register. // (*((volatile uint32_t *)((uintptr_t)(ctrlBase + 0x20U)))) = ((*((volatile uint32_t *)((uintptr_t)(ctrlBase + 0x20U)))) & ~((0x3U) << ((uint32_t)bank * 2U))) | ((uint32_t)powerMode << ((uint32_t)bank * 2U)); __edis(); } //***************************************************************************** // //! Sets the fallback power mode of the charge pump. //! //! \param ctrlBase is the base address of the flash wrapper control registers. //! \param powerMode is the power mode to be entered. //! //! This function sets the fallback power mode flash charge pump. //! //! - \b FLASH_PUMP_PWR_SLEEP - All circuits disabled. //! - \b FLASH_PUMP_PWR_ACTIVE - All pump circuits active. //! //! \return None. // //***************************************************************************** static inline void Flash_setPumpPowerMode(uint32_t ctrlBase, Flash_PumpPowerMode powerMode) { // // Check the arguments. // do { if(!(Flash_isCtrlBaseValid(ctrlBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 364); } } while(0); __eallow(); // // Write the power mode to the appropriate register. // (*((volatile uint32_t *)((uintptr_t)(ctrlBase + 0x24U)))) = ((*((volatile uint32_t *)((uintptr_t)(ctrlBase + 0x24U)))) & ~(uint32_t)0x1U) | (uint32_t)powerMode; __edis(); } //***************************************************************************** // //! Enables prefetch mechanism. //! //! \param ctrlBase is the base address of the flash wrapper control registers. //! //! \return None. // //***************************************************************************** static inline void Flash_enablePrefetch(uint32_t ctrlBase) { // // Check the arguments. // do { if(!(Flash_isCtrlBaseValid(ctrlBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 395); } } while(0); __eallow(); // // Set the prefetch enable bit. // (*((volatile uint32_t *)((uintptr_t)(ctrlBase + 0x180U)))) |= 0x1U; __edis(); } //***************************************************************************** // //! Disables prefetch mechanism. //! //! \param ctrlBase is the base address of the flash wrapper control registers. //! //! \return None. // //***************************************************************************** static inline void Flash_disablePrefetch(uint32_t ctrlBase) { // // Check the arguments. // do { if(!(Flash_isCtrlBaseValid(ctrlBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 425); } } while(0); __eallow(); // // Clear the prefetch enable bit. // (*((volatile uint32_t *)((uintptr_t)(ctrlBase + 0x180U)))) &= ~(uint32_t)0x1U; __edis(); } //***************************************************************************** // //! Enables data cache. //! //! \param ctrlBase is the base address of the flash wrapper control registers. //! //! \return None. // //***************************************************************************** static inline void Flash_enableCache(uint32_t ctrlBase) { // // Check the arguments. // do { if(!(Flash_isCtrlBaseValid(ctrlBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 455); } } while(0); __eallow(); // // Set the data cache enable bit. // (*((volatile uint32_t *)((uintptr_t)(ctrlBase + 0x180U)))) |= 0x2U; __edis(); } //***************************************************************************** // //! Disables data cache. //! //! \param ctrlBase is the base address of the flash wrapper control registers. //! //! \return None. // //***************************************************************************** static inline void Flash_disableCache(uint32_t ctrlBase) { // // Check the arguments. // do { if(!(Flash_isCtrlBaseValid(ctrlBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 485); } } while(0); __eallow(); // // Clear the data cache enable bit. // (*((volatile uint32_t *)((uintptr_t)(ctrlBase + 0x180U)))) &= ~(uint32_t)0x2U; __edis(); } //***************************************************************************** // //! Enables flash error correction code (ECC) protection. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! //! \return None. // //***************************************************************************** static inline void Flash_enableECC(uint32_t eccBase) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 515); } } while(0); __eallow(); // // Write the key value 0xA to ECC_ENABLE register. // (*((volatile uint32_t *)((uintptr_t)(eccBase + 0x0U)))) = ((*((volatile uint32_t *)((uintptr_t)(eccBase + 0x0U)))) & ~(uint32_t)0xFU) | 0xAU; __edis(); } //***************************************************************************** // //! Disables flash error correction code (ECC) protection. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! //! \return None. // //***************************************************************************** static inline void Flash_disableECC(uint32_t eccBase) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 543); } } while(0); __eallow(); // // Clear ECC enable field with the one's complement of the key. // (*((volatile uint32_t *)((uintptr_t)(eccBase + 0x0U)))) = ((*((volatile uint32_t *)((uintptr_t)(eccBase + 0x0U)))) & ~(uint32_t)0xFU) | 0x5U; __edis(); } //***************************************************************************** // //! Sets the bank active grace period. //! //! \param ctrlBase is the base address of the flash wrapper control registers. //! \param period is the starting count value for the BAGP down counter. //! //! This function sets the bank active grace period specified by the //! \e period parameter. The \e period is a value between 0 and 255. This //! value must be greater than 1 when the fallback mode is not Active. //! //! \return None. // //***************************************************************************** static inline void Flash_setBankActiveGracePeriod(uint32_t ctrlBase, uint32_t period) { // // Check the arguments. // do { if(!(Flash_isCtrlBaseValid(ctrlBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 578); } } while(0); do { if(!(period <= 255U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 579); } } while(0); __eallow(); // // Write period to the BAGP of the FBAC register. // (*((volatile uint32_t *)((uintptr_t)(ctrlBase + 0x1EU)))) = ((*((volatile uint32_t *)((uintptr_t)(ctrlBase + 0x1EU)))) & ~(uint32_t)0xFF00U) | (period << 8U); __edis(); } //***************************************************************************** // //! Sets the pump wake up time. //! //! \param ctrlBase is the base address of the flash wrapper control registers. //! \param sysclkCycles is the number of SYSCLK cycles it takes for the pump //! to wakeup. //! //! This function sets the wakeup time with \e sysclkCycles parameter. //! The \e sysclkCycles is a value between 0 and 8190. When the charge pump //! exits sleep power mode, it will take sysclkCycles to wakeup. //! //! \return None. // //***************************************************************************** static inline void Flash_setPumpWakeupTime(uint32_t ctrlBase, uint16_t sysclkCycles) { // // Check the arguments. // do { if(!(Flash_isCtrlBaseValid(ctrlBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 613); } } while(0); // // PSLEEP = sysclkCycles/2. PSLEEP maximum value is 4095(12 bits wide) // do { if(!(sysclkCycles <= 8190U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 618); } } while(0); __eallow(); // // Write sysclkCycles/2 to PSLEEP of the FPAC1 register. // (*((volatile uint32_t *)((uintptr_t)(ctrlBase + 0x24U)))) = ((*((volatile uint32_t *)((uintptr_t)(ctrlBase + 0x24U)))) & ~(uint32_t)0xFFF0000U) | (((uint32_t)sysclkCycles / (uint32_t)2) << (uint32_t)16U); __edis(); } //***************************************************************************** // //! Reads the bank active power state. //! //! \param ctrlBase is the base address of the flash wrapper control registers. //! \param bank is the flash bank that is being used. //! //! \return Returns \b true if the Bank is in Active power state and \b false //! otherwise. // //***************************************************************************** static inline _Bool Flash_isBankReady(uint32_t ctrlBase, Flash_BankNumber bank) { // // Check the arguments. // do { if(!(Flash_isCtrlBaseValid(ctrlBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 650); } } while(0); _Bool ready; uint32_t bitMask = (uint32_t)0x1U << (uint32_t)bank; // // Return the BANKXRDY bit in FBPRDY. // if(((*((volatile uint32_t *)((uintptr_t)(ctrlBase + 0x22U)))) & bitMask) == bitMask) { ready = 1; } else { ready = 0; } return(ready); } //***************************************************************************** // //! Reads the pump active power state. //! //! \param ctrlBase is the base address of the flash wrapper control registers. //! //! \return Returns \b true if the Pump is in Active power state and \b false //! otherwise. // //***************************************************************************** static inline _Bool Flash_isPumpReady(uint32_t ctrlBase) { // // Check the arguments. // do { if(!(Flash_isCtrlBaseValid(ctrlBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 684); } } while(0); _Bool ready; // // Return the PUMPRDY bit in FBPRDY. // if(((*((volatile uint32_t *)((uintptr_t)(ctrlBase + 0x22U)))) & (uint32_t)0x8000U) == 0x8000U) { ready = 1; } else { ready = 0; } return(ready); } //***************************************************************************** // //! Gets the single error address low. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! //! This function returns the 32-bit address of the single bit error that //! occurred in the lower 64-bits of a 128-bit memory-aligned data. The //! returned address is to that 64-bit aligned data. //! //! \return Returns the 32 bits of a 64-bit aligned address where a single bit //! error occurred. // //***************************************************************************** static inline uint32_t Flash_getSingleBitErrorAddressLow(uint32_t eccBase) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 724); } } while(0); return((*((volatile uint32_t *)((uintptr_t)(eccBase + 0x2U))))); } //***************************************************************************** // //! Gets the single error address high. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! //! This function returns the 32-bit address of the single bit error that //! occurred in the upper 64-bits of a 128-bit memory-aligned data. The //! returned address is to that 64-bit aligned data. //! //! \return Returns the 32 bits of a 64-bit aligned address where a single bit //! error occurred. // //***************************************************************************** static inline uint32_t Flash_getSingleBitErrorAddressHigh(uint32_t eccBase) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 749); } } while(0); return((*((volatile uint32_t *)((uintptr_t)(eccBase + 0x4U))))); } //***************************************************************************** // //! Gets the uncorrectable error address low. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! //! This function returns the 32-bit address of the uncorrectable error that //! occurred in the lower 64-bits of a 128-bit memory-aligned data. The //! returned address is to that 64-bit aligned data. //! //! \return Returns the 32 bits of a 64-bit aligned address where an //! uncorrectable error occurred. // //***************************************************************************** static inline uint32_t Flash_getUncorrectableErrorAddressLow(uint32_t eccBase) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 774); } } while(0); return((*((volatile uint32_t *)((uintptr_t)(eccBase + 0x6U))))); } //***************************************************************************** // //! Gets the uncorrectable error address high. //! //! \param eccBase is the base address of the flash wrapper ECC base. //! //! This function returns the 32-bit address of the uncorrectable error that //! occurred in the upper 64-bits of a 128-bit memory-aligned data. The //! returned address is to that 64-bit aligned data. //! //! \return Returns the 32 bits of a 64-bit aligned address where an //! uncorrectable error occurred. // //***************************************************************************** static inline uint32_t Flash_getUncorrectableErrorAddressHigh(uint32_t eccBase) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 799); } } while(0); return((*((volatile uint32_t *)((uintptr_t)(eccBase + 0x8U))))); } //***************************************************************************** // //! Gets the error status of the Lower 64-bits. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! //! This function returns the error status of the lower 64-bits of a 128-bit //! aligned address. //! //! \return Returns value of the low error status bits which can be used with //! Flash_ErrorStatus type. // //***************************************************************************** static inline Flash_ErrorStatus Flash_getLowErrorStatus(uint32_t eccBase) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 823); } } while(0); // // Get the Low Error Status bits // return((Flash_ErrorStatus)((*((volatile uint32_t *)((uintptr_t)(eccBase + 0xAU)))) & (uint32_t)0x7U)); } //***************************************************************************** // //! Gets the error status of the Upper 64-bits. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! //! This function returns the error status of the upper 64-bits of a 128-bit //! aligned address. //! //! \return Returns value of the high error status bits which can be used with //! Flash_ErrorStatus type. // //***************************************************************************** static inline Flash_ErrorStatus Flash_getHighErrorStatus(uint32_t eccBase) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 851); } } while(0); // // Get the High Error Status bits // return((Flash_ErrorStatus)(((*((volatile uint32_t *)((uintptr_t)(eccBase + 0xAU)))) >> 16U) & (uint32_t)0x7U)); } //***************************************************************************** // //! Gets the error position of the lower 64-bits for a single bit error. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! //! This function returns the error position of the lower 64-bits. If the //! error type is FLASH_ECC_ERR, the position ranges from 0-7 else it ranges //! from 0-63 for FLASH_DATA_ERR. //! //! \return Returns the position of the lower error bit. // //***************************************************************************** static inline uint32_t Flash_getLowErrorPosition(uint32_t eccBase) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 879); } } while(0); return(((*((volatile uint32_t *)((uintptr_t)(eccBase + 0xCU)))) & (uint32_t)0x3FU) >> 0U); } //***************************************************************************** // //! Gets the error position of the upper 64-bits for a single bit error. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! //! This function returns the error position of the upper 64-bits. If the //! error type is FLASH_ECC_ERR, the position ranges from 0-7 else it ranges //! from 0-63 for FLASH_DATA_ERR. //! //! \return Returns the position of the upper error bit. // //***************************************************************************** static inline uint32_t Flash_getHighErrorPosition(uint32_t eccBase) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 905); } } while(0); return(((*((volatile uint32_t *)((uintptr_t)(eccBase + 0xCU)))) & (uint32_t)0x3F0000U) >> 16U); } //***************************************************************************** // //! Clears the error position bit of the lower 64-bits for a single bit error. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! //! This function clears the error position bit of the lower 64-bits. //! //! \return None // //***************************************************************************** static inline void Flash_clearLowErrorPosition(uint32_t eccBase) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 929); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(eccBase + 0xCU)))) &= ~(uint32_t)0x3FU; __edis(); } //***************************************************************************** // //! Clears the error position of the upper 64-bits for a single bit error. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! //! This function clears the error position bit of the upper 64-bits. //! //! \return None. // //***************************************************************************** static inline void Flash_clearHighErrorPosition(uint32_t eccBase) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 953); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(eccBase + 0xCU)))) &= ~(uint32_t)0x3F0000U; __edis(); } //***************************************************************************** // //! Gets the error type of the lower 64-bits. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! //! This function returns the error type of the lower 64-bits. The error type //! can be FLASH_ECC_ERR or FLASH_DATA_ERR. //! //! \return Returns the type of the lower 64-bit error. // //***************************************************************************** static inline Flash_ErrorType Flash_getLowErrorType(uint32_t eccBase) { Flash_ErrorType errorType; // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 979); } } while(0); // // Check which error type. // If bit is 1 then ECC error, else it is a Data error. // if(((*((volatile uint32_t *)((uintptr_t)(eccBase + 0xCU)))) & 0x100U) == 0x100U) errorType = FLASH_ECC_ERR; else errorType = FLASH_DATA_ERR; return(errorType); } //***************************************************************************** // //! Gets the error type of the upper 64-bits. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! //! This function returns the error type of the upper 64-bits. The error type //! can be FLASH_ECC_ERR or FLASH_DATA_ERR. //! //! \return Returns the type of the upper 64-bit error. // //***************************************************************************** static inline Flash_ErrorType Flash_getHighErrorType(uint32_t eccBase) { Flash_ErrorType errorType; // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 1013); } } while(0); // // Check which error type. // If bit is 1 then ECC error, else it is a Data error. // if(((*((volatile uint32_t *)((uintptr_t)(eccBase + 0xCU)))) & 0x1000000U) == 0x1000000U) errorType = FLASH_ECC_ERR; else errorType = FLASH_DATA_ERR; return(errorType); } //***************************************************************************** // //! Clears the errors status of the lower 64-bits. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! \param errorStatus is the error status to clear. errorStatus is a uint16_t. //! errorStatus is a bitwise OR of the following value: //! //! - \b FLASH_FAIL_0_CLR //! - \b FLASH_FAIL_1_CLR //! - \b FLASH_UNC_ERR_CLR //! //! \return None. // //***************************************************************************** static inline void Flash_clearLowErrorStatus(uint32_t eccBase, uint16_t errorStatus) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 1049); } } while(0); do { if(!(errorStatus <= 7U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 1050); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(eccBase + 0xEU)))) |= ((uint32_t)errorStatus); __edis(); } //***************************************************************************** // //! Clears the errors status of the upper 64-bits. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! \param errorStatus is the error status to clear. errorStatus is a uint16_t. //! errorStatus is a bitwise OR of the following value: //! //! - \b FLASH_FAIL_0_CLR //! - \b FLASH_FAIL_1_CLR //! - \b FLASH_UNC_ERR_CLR //! //! \return None. // //***************************************************************************** static inline void Flash_clearHighErrorStatus(uint32_t eccBase, uint16_t errorStatus) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 1078); } } while(0); do { if(!(errorStatus <= 7U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 1079); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(eccBase + 0xEU)))) |= ((uint32_t)errorStatus << 16U); __edis(); } //***************************************************************************** // //! Gets the single bit error count. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! //! \return Returns the single bit error count. // //***************************************************************************** static inline uint32_t Flash_getErrorCount(uint32_t eccBase) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 1101); } } while(0); return((*((volatile uint32_t *)((uintptr_t)(eccBase + 0x10U)))) & (uint32_t)0xFFFFU); } //***************************************************************************** // //! Sets the single bit error threshold. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! \param threshold is the single bit error threshold. Valid ranges are from //! 0-65535. //! //! \return None. // //***************************************************************************** static inline void Flash_setErrorThreshold(uint32_t eccBase, uint16_t threshold) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 1124); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(eccBase + 0x12U)))) = ((uint32_t)threshold & (uint32_t)0xFFFFU); __edis(); } //***************************************************************************** // //! Gets the error interrupt. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! //! This function returns the type of error interrupt that occurred. The //! values can be used with //! - \b FLASH_NO_ERROR //! - \b FLASH_SINGLE_ERROR //! - \b FLASH_UNC_ERROR //! //! \return Returns the interrupt flag. // //***************************************************************************** static inline uint32_t Flash_getInterruptFlag(uint32_t eccBase) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 1153); } } while(0); // // Read which type of error occurred. // return(((*((volatile uint32_t *)((uintptr_t)(eccBase + 0x14U)))) & (uint32_t)0x3U)); } //***************************************************************************** // //! Clears the single error interrupt flag. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! //! \return None. // //***************************************************************************** static inline void Flash_clearSingleErrorInterruptFlag(uint32_t eccBase) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 1176); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(eccBase + 0x16U)))) |= 0x1U; __edis(); } //***************************************************************************** // //! Clears the uncorrectable error interrupt flag. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! //! \return None. // //***************************************************************************** static inline void Flash_clearUncorrectableInterruptFlag(uint32_t eccBase) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 1199); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(eccBase + 0x16U)))) |= 0x2U; __edis(); } //***************************************************************************** // //! Sets the Data Low Test register for ECC testing. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! \param data is a 32-bit value that is the low double word of selected //! 64-bit data //! //! \return None. // //***************************************************************************** static inline void Flash_setDataLowECCTest(uint32_t eccBase, uint32_t data) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 1224); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(eccBase + 0x1AU)))) = data; __edis(); } //***************************************************************************** // //! Sets the Data High Test register for ECC testing. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! \param data is a 32-bit value that is the high double word of selected //! 64-bit data //! //! \return None. // //***************************************************************************** static inline void Flash_setDataHighECCTest(uint32_t eccBase, uint32_t data) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 1248); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(eccBase + 0x18U)))) = data; __edis(); } //***************************************************************************** // //! Sets the test address register for ECC testing. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! \param address is a 32-bit value containing an address. Bits 21-3 will be //! used as the flash word (128-bit) address. //! //! This function left shifts the address 1 bit to convert it to a byte address //! //! \return None. // //***************************************************************************** static inline void Flash_setECCTestAddress(uint32_t eccBase, uint32_t address) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 1274); } } while(0); // // Left shift the address 1 bit to make it byte-addressable // uint32_t byteAddress = address << 1; __eallow(); // // Write bits 21-3 to the register. // (*((volatile uint32_t *)((uintptr_t)(eccBase + 0x1CU)))) = byteAddress; __edis(); } //***************************************************************************** // //! Sets the ECC test bits for ECC testing. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! \param ecc is a 32-bit value. The least significant 8 bits are used as //! the ECC Control Bits in the ECC Test. //! //! \return None. // //***************************************************************************** static inline void Flash_setECCTestECCBits(uint32_t eccBase, uint16_t ecc) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 1309); } } while(0); do { if(!(ecc <= 255U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 1311); } } while(0); __eallow(); // // Write the 8 ECC Control Bits. // (*((volatile uint32_t *)((uintptr_t)(eccBase + 0x1EU)))) = ((uint32_t)ecc & (uint32_t)0xFFU); __edis(); } //***************************************************************************** // //! Enables ECC Test mode. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! //! \return None. // //***************************************************************************** static inline void Flash_enableECCTestMode(uint32_t eccBase) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 1337); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(eccBase + 0x20U)))) |= 0x1U; __edis(); } //***************************************************************************** // //! Disables ECC Test mode. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! //! \return None. // //***************************************************************************** static inline void Flash_disableECCTestMode(uint32_t eccBase) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 1359); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(eccBase + 0x20U)))) &= ~(uint32_t)0x1U; __edis(); } //***************************************************************************** // //! Selects the ECC block on bits [63:0] of bank data. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! //! \return None. // //***************************************************************************** static inline void Flash_selectLowECCBlock(uint32_t eccBase) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 1382); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(eccBase + 0x20U)))) &= ~(uint32_t)0x2U; __edis(); } //***************************************************************************** // //! Selects the ECC block on bits [127:64] of bank data. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! //! \return None. // //***************************************************************************** static inline void Flash_selectHighECCBlock(uint32_t eccBase) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 1405); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(eccBase + 0x20U)))) |= 0x2U; __edis(); } //***************************************************************************** // //! Performs the ECC calculation on the test block. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! //! \return None. // //***************************************************************************** static inline void Flash_performECCCalculation(uint32_t eccBase) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 1427); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(eccBase + 0x20U)))) |= 0x4U; __edis(); } //***************************************************************************** // //! Gets the ECC Test data out high 63:32 bits. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! //! \return Returns the ECC TEst data out High. // //***************************************************************************** static inline uint32_t Flash_getTestDataOutHigh(uint32_t eccBase) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 1449); } } while(0); return((*((volatile uint32_t *)((uintptr_t)(eccBase + 0x22U))))); } //***************************************************************************** // //! Gets the ECC Test data out low 31:0 bits. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! //! \return Returns the ECC Test data out Low. // //***************************************************************************** static inline uint32_t Flash_getTestDataOutLow(uint32_t eccBase) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 1469); } } while(0); return((*((volatile uint32_t *)((uintptr_t)(eccBase + 0x24U))))); } //***************************************************************************** // //! Gets the ECC Test status. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! //! This function returns the ECC test status. The values can be used with //! - \b FLASH_NO_ERROR //! - \b FLASH_SINGLE_ERROR //! - \b FLASH_UNC_ERROR //! //! \return Returns the ECC test status. // //***************************************************************************** static inline uint32_t Flash_getECCTestStatus(uint32_t eccBase) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 1494); } } while(0); // // Read which type of error occurred. // return(((*((volatile uint32_t *)((uintptr_t)(eccBase + 0x26U))))) & (uint32_t)0x3U); } //***************************************************************************** // //! Gets the ECC Test single bit error position. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! //! \return Returns the ECC Test single bit error position. If the error type //! is check bits than the position can range from 0 to 7. If the error type //! is data bits than the position can range from 0 to 63. // //***************************************************************************** static inline uint32_t Flash_getECCTestErrorPosition(uint32_t eccBase) { // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 1519); } } while(0); // // Read the position bits and shift it to the right. // return(((*((volatile uint32_t *)((uintptr_t)(eccBase + 0x26U)))) & (uint32_t)0xFCU) >> 2U); } //***************************************************************************** // //! Gets the single bit error type. //! //! \param eccBase is the base address of the flash wrapper ECC registers. //! //! \return Returns the single bit error type as a //! Flash_SingleBitErrorIndicator. FLASH_DATA_BITS and FLASH_CHECK_BITS //! indicate where the single bit error occurred. // //***************************************************************************** static inline Flash_SingleBitErrorIndicator Flash_getECCTestSingleBitErrorType(uint32_t eccBase) { uint32_t errorType; // // Check the arguments. // do { if(!(Flash_isECCBaseValid(eccBase))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/flash.h", 1547); } } while(0); // // Read the ERR_TYPE bit to see where the single bit error was. // errorType = (((*((volatile uint32_t *)((uintptr_t)(eccBase + 0x26U)))) & (uint32_t)0x100U) >> 8U); return((Flash_SingleBitErrorIndicator)errorType); } //***************************************************************************** // //! Claim the flash pump semaphore. //! //! \param wrapper is the Flash_PumpOwnership wrapper claiming the pump //! semaphore. //! //! \return None. // //***************************************************************************** static inline void Flash_claimPumpSemaphore(Flash_PumpOwnership wrapper) { // // Block until the pump semaphore is claimed. // __eallow(); while(IPC_Instance[IPC_CPU1_L_CPU2_R]. IPC_Boot_Pump_Reg->IPC_PUMPREQUEST != (uint32_t)wrapper) { IPC_Instance[IPC_CPU1_L_CPU2_R]. IPC_Boot_Pump_Reg->IPC_PUMPREQUEST = 0x5A5A0000UL | (uint32_t)wrapper; } __edis(); } //***************************************************************************** // //! Release the flash pump semaphore. //! //! \return None. // //***************************************************************************** static inline void Flash_releasePumpSemaphore(void) { // // Relinquish the pump semaphore. // __eallow(); IPC_Instance[IPC_CPU1_L_CPU2_R]. IPC_Boot_Pump_Reg->IPC_PUMPREQUEST = 0x5A5A0000UL; __edis(); } //***************************************************************************** // //! Initializes the flash control registers. //! //! \param ctrlBase is the base address of the flash wrapper control registers. //! \param eccBase is the base address of the flash wrapper ECC registers. //! \param waitstates is the wait-state value. //! //! This function initializes the flash control registers. At reset bank and //! pump are in sleep. A flash access will power up the bank and pump //! automatically. After a flash access, bank and pump go to low power mode //! (configurable in FBFALLBACK/FPAC1 registers) if there is no further access //! to flash. This function will power up Flash bank and pump and set the //! fallback mode of flash and pump as active. //! //! This function also sets the number of wait-states for a flash access //! (see Flash_setWaitstates() for more details), and enables cache, the //! prefetch mechanism, and ECC. //! //! \return None. // //***************************************************************************** extern void Flash_initModule(uint32_t ctrlBase, uint32_t eccBase, uint16_t waitstates); //***************************************************************************** // //! Powers down the flash. //! //! \param ctrlBase is the base address of the flash wrapper control registers. //! //! This function powers down the flash bank(s) and the flash pump. //! //! Note: For this device, you must claim the flash pump semaphore before //! calling this function and powering down the pump. Afterwards, you may want //! to relinquish the flash pump. //! //! \return None. // //***************************************************************************** extern void Flash_powerDown(uint32_t ctrlBase); //***************************************************************************** // // Close the Doxygen group. //! @} // //***************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //########################################################################### // // FILE: fsi.h // // TITLE: C28x FSI Driver API header file // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup fsi_api FSI //! @{ // //***************************************************************************** //########################################################################### // // FILE: hw_fsi.h // // TITLE: Definitions for the FSI registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the FSI register offsets // //***************************************************************************** // register // register // register low // register high // register // data register // control load register // control status register // register // reference // count // control register // register // register // status flag register // clear register // force register // register // register // register // register // data register // register // status flag register // and computed CRC // register // force register // register // register // control register // counter reference // current count // register // reference // count // register for RX_INT1 // register for RX_INT2 // register // register // register // register // register // register 1 //***************************************************************************** // // The following are defines for the bit fields in the TX_MASTER_CTRL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the TX_CLK_CTRL register // //***************************************************************************** // Divider //***************************************************************************** // // The following are defines for the bit fields in the TX_OPER_CTRL_LO register // //***************************************************************************** // Select // Select //***************************************************************************** // // The following are defines for the bit fields in the TX_OPER_CTRL_HI register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the TX_FRAME_CTRL register // //***************************************************************************** // Transmitted //***************************************************************************** // // The following are defines for the bit fields in the TX_FRAME_TAG_UDATA register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the TX_BUF_PTR_LOAD register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the TX_BUF_PTR_STS register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the TX_PING_CTRL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the TX_PING_TAG register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the TX_INT_CTRL register // //***************************************************************************** // to INT1 // Interrupt to INT1 // Interrupt to INT1 // to INT1 // to INT2 // Interrupt to INT2 // Interrupt to INT2 // to INT2 //***************************************************************************** // // The following are defines for the bit fields in the TX_DMA_CTRL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the TX_LOCK_CTRL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the TX_EVT_STS register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the TX_EVT_CLR register // //***************************************************************************** // Clear //***************************************************************************** // // The following are defines for the bit fields in the TX_EVT_FRC register // //***************************************************************************** // Force //***************************************************************************** // // The following are defines for the bit fields in the TX_USER_CRC register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the TX_ECC_DATA register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the TX_ECC_VAL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the RX_MASTER_CTRL register // //***************************************************************************** // Behaviour //***************************************************************************** // // The following are defines for the bit fields in the RX_OPER_CTRL register // //***************************************************************************** // Received // Select //***************************************************************************** // // The following are defines for the bit fields in the RX_FRAME_INFO register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the RX_FRAME_TAG_UDATA register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the RX_DMA_CTRL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the RX_EVT_STS register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the RX_CRC_INFO register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the RX_EVT_CLR register // //***************************************************************************** // Clear // Clear // Clear // Clear // Clear // Clear // Clear //***************************************************************************** // // The following are defines for the bit fields in the RX_EVT_FRC register // //***************************************************************************** // Force // Force // Force // Force // Force // Force // Force //***************************************************************************** // // The following are defines for the bit fields in the RX_BUF_PTR_LOAD register // //***************************************************************************** // pointer //***************************************************************************** // // The following are defines for the bit fields in the RX_BUF_PTR_STS register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the RX_FRAME_WD_CTRL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the RX_PING_WD_CTRL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the RX_PING_TAG register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the RX_INT1_CTRL register // //***************************************************************************** // Interrupt to INT1 // Interrupt to INT1 // INT1 // Interrupt to INT1 // Interrupt to INT1 // Interrupt to INT1 // to INT1 // Interrupt to INT1 // Interrupt to INT1 // Interrupt to INT1 // Interrupt to INT1 // Interrupt to INT1 // Interrupt to INT1 // Interrupt to INT1 // Matched Interrupt to INT1 //***************************************************************************** // // The following are defines for the bit fields in the RX_INT2_CTRL register // //***************************************************************************** // Interrupt to INT2 // Interrupt to INT2 // to INT2 // Interrupt to INT2 // Interrupt to INT2 // Interrupt to INT2 // to INT2 // Interrupt to INT2 // Interrupt to INT2 // Interrupt to INT2 // Interrupt to INT2 // Interrupt to INT2 // Interrupt to INT2 // Interrupt to INT2 // Matched Interrupt to INT2 //***************************************************************************** // // The following are defines for the bit fields in the RX_LOCK_CTRL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the RX_ECC_DATA register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the RX_ECC_VAL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the RX_ECC_LOG register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the RX_FRAME_TAG_CMP register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the RX_PING_TAG_CMP register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the RX_DLYLINE_CTRL register // //***************************************************************************** // RXCLK // RXD0 // RXD1 //***************************************************************************** // // The following are defines for the bit fields in the RX_VIS_1 register // //***************************************************************************** //***************************************************************************** // // FSI Tx defines // //***************************************************************************** //! \brief FSI Tx events defines //! //! \details Values that can be passed to APIs to enable/disable interrupts and //! also to set/get/clear event status on FSI Tx operation. //! //! There are 4 supported interrupts related to Tx events- //! All are available as event status as well excecpt 4th one. //! 1) frame transmission done //! 2) transmit buffer is underrun //! 3) transmit buffer is overrun //! 4) ping counter timeout //! //! Ping frame transmission upon hardware trigger(ping watchdog or //! external trigger) is shown as event status. //! //! \brief Mask of all Tx Events, ORing all event defines //! //! \brief Maximum number of external input for triggering frame-transmission //! //! \brief Shifts needed to control FSI Tx interrupt generation on INT2 //! //***************************************************************************** // // FSI Rx Defines // //***************************************************************************** //! \brief FSI Rx event defines //! //! \details Values that can be passed to APIs to enable/disable interrupts and //! also to set/get/clear event status on FSI Rx operation. //! //! There are 15 supported interrupts related to Rx events- //! All are available as event status as well. //! 1) ping watchdog times out //! 2) frame watchdog times out //! 3) mismatch between hardware computed CRC and received CRC.This //! status should be ignored if user chooses SW CRC computation //! 4) invalid Frame type detected //! 5) invalid EndofFrame bit-pattern //! 6) buffer Overrun in Rx buffer //! 7) received frame without errors //! 8) software reads empty Rx buffer //! 9) received error frame //! 10) received ping frame //! 11) software didn't clear FRAME_DONE flag after receiving new //! frame //! 12) received data frame //! 13) recieved ping frame with matched tag //! 14) recieved data frame with matched tag //! 15) recieved error frame with tag match //! //! \brief Mask of all Rx Events, ORing all event defines //! //! \brief Maximum value in Rx delay line tap control //! //***************************************************************************** // // Common defines for both FSI Tx and Rx // //***************************************************************************** //! \brief Maximum data length(16 words) for user/software defined data frame //! //! \brief Maximum value for user data field(8 bits) //! //! \brief Maximum value of Buffer pointer offset(4 bits) //! //! \brief Key value for writing some FSI Tx/Rx registers //! //***************************************************************************** // // typedefs // //***************************************************************************** //! \brief Data lines used for transmit/receive operation //! //! \details Supported number of data lines is only 2 - 1 lane or 2 lanes //! typedef enum { FSI_DATA_WIDTH_1_LANE = 0x0000U, FSI_DATA_WIDTH_2_LANE = 0x0001U } FSI_DataWidth; //! \brief List of TX submodules that can be reset, can be used with reset APIs //! //! \details Three kind of resets can be made- //! 1) reset entire Tx Module //! 2) reset only TX clock //! 3) reset ping timeout counter //! typedef enum { FSI_TX_MASTER_CORE_RESET = 0x0000U, FSI_TX_CLOCK_RESET = 0x0001U, FSI_TX_PING_TIMEOUT_CNT_RESET = 0x0002U } FSI_TxSubmoduleInReset; //! \brief Start Mode for Tx frame transmission //! //! \details Three start modes(that is, how transmission will start) are //! supported- //! 1. SW write of START bit in \b TX_PKT_CTRL register //! 2. Rising edge on external trigger //! 3. Either SW write of START bit or Frame completion //! typedef enum { FSI_TX_START_FRAME_CTRL = 0x0000U, FSI_TX_START_EXT_TRIG = 0x0001U, FSI_TX_START_FRAME_CTRL_OR_UDATA_TAG = 0x0002U } FSI_TxStartMode; //! \brief Various FSI frame types //! //! \details Three frame types exist- //! - \b Ping: Used for checking line integrity, can be sent by //! software or automatically by hardware. //! - \b Error: Used typically during error conditions or when one //! side wants to signal the other side for attention. //! - \b Data: Two subtypes exist based on data-length- //! a) \b Fixed (1/2/4/6 words) //! b) \b Nwords Software programs number of data words //! //! \note 4 bit code for frame types- 0x1, 0x2 and 0x8 to 0xE are reserved //! typedef enum { FSI_FRAME_TYPE_PING = 0x0000U, FSI_FRAME_TYPE_ERROR = 0x000FU, FSI_FRAME_TYPE_1WORD_DATA = 0x0004U, FSI_FRAME_TYPE_2WORD_DATA = 0x0005U, FSI_FRAME_TYPE_4WORD_DATA = 0x0006U, FSI_FRAME_TYPE_6WORD_DATA = 0x0007U, FSI_FRAME_TYPE_NWORD_DATA = 0x0003U } FSI_FrameType; //! \brief Possible values of a FSI frame //! //! \details 4 bit field inside FSI frame is available to set tag value(0-15) //! typedef enum { FSI_FRAME_TAG0 = 0x0000U, FSI_FRAME_TAG1 = 0x0001U, FSI_FRAME_TAG2 = 0x0002U, FSI_FRAME_TAG3 = 0x0003U, FSI_FRAME_TAG4 = 0x0004U, FSI_FRAME_TAG5 = 0x0005U, FSI_FRAME_TAG6 = 0x0006U, FSI_FRAME_TAG7 = 0x0007U, FSI_FRAME_TAG8 = 0x0008U, FSI_FRAME_TAG9 = 0x0009U, FSI_FRAME_TAG10 = 0x000AU, FSI_FRAME_TAG11 = 0x000BU, FSI_FRAME_TAG12 = 0x000CU, FSI_FRAME_TAG13 = 0x000DU, FSI_FRAME_TAG14 = 0x000EU, FSI_FRAME_TAG15 = 0x000FU } FSI_FrameTag; //! \brief Ping timeout mode //! //! \details Ping timeout can reset and restart only on hardware initiated PING //! frames (PING Watchdog timeout) //! OR //! on any software initiated frame being sent out also based on //! which mode is selected //! typedef enum { FSI_PINGTIMEOUT_ON_HWINIT_PING_FRAME = 0x0000U, FSI_PINGTIMEOUT_ON_HWSWINIT_PING_FRAME = 0x0001U } FSI_PingTimeoutMode; //! \brief ECC Computation width- 16 bit or 32 bit //! typedef enum { FSI_32BIT_ECC_COMPUTE = 0x0000U, FSI_16BIT_ECC_COMPUTE = 0x0001U } FSI_ECCComputeWidth; //! \brief Interrupt lines supported in FSI //! //! \details Any event on FSI Tx or Rx can be enabled to trigger interrupt on 2 //! interrupt lines to CPU/CLA- \b INT1 and \b INT2 //! typedef enum { FSI_INT1 = 0x0000U, FSI_INT2 = 0x0001U } FSI_InterruptNum; //! \brief List of RX modules that can be reset, can be used with reset APIs //! //! \details Three submodules can be reset- //! 1) RX master core //! 2) frame watchdog counter //! 3) ping watchdog counter //! typedef enum { FSI_RX_MASTER_CORE_RESET = 0x0000U, FSI_RX_FRAME_WD_CNT_RESET = 0x0001U, FSI_RX_PING_WD_CNT_RESET = 0x0002U } FSI_RxSubmoduleInReset; //! \brief Available Rx lines for delay tap selection //! //! \details Delay tapping can be done on 3 lines- 1)RXCLK 2)RXD0 and 3)RXD1 //! typedef enum { FSI_RX_DELAY_CLK = 0x0000U, FSI_RX_DELAY_D0 = 0x0001U, FSI_RX_DELAY_D1 = 0x0002U } FSI_RxDelayTapType; //! \brief Indexes of available EPWM SOC triggers //! //! typedef enum { FSI_EXT_TRIGSRC_EPWM1_SOCA = 8U, FSI_EXT_TRIGSRC_EPWM1_SOCB = 9U, FSI_EXT_TRIGSRC_EPWM2_SOCA = 10U, FSI_EXT_TRIGSRC_EPWM2_SOCB = 11U, FSI_EXT_TRIGSRC_EPWM3_SOCA = 12U, FSI_EXT_TRIGSRC_EPWM3_SOCB = 13U, FSI_EXT_TRIGSRC_EPWM4_SOCA = 14U, FSI_EXT_TRIGSRC_EPWM4_SOCB = 15U, FSI_EXT_TRIGSRC_EPWM5_SOCA = 16U, FSI_EXT_TRIGSRC_EPWM5_SOCB = 17U, FSI_EXT_TRIGSRC_EPWM6_SOCA = 18U, FSI_EXT_TRIGSRC_EPWM6_SOCB = 19U, FSI_EXT_TRIGSRC_EPWM7_SOCA = 20U, FSI_EXT_TRIGSRC_EPWM7_SOCB = 21U, FSI_EXT_TRIGSRC_EPWM8_SOCA = 22U, FSI_EXT_TRIGSRC_EPWM8_SOCB = 23U, FSI_EXT_TRIGSRC_EPWM9_SOCA = 24U, FSI_EXT_TRIGSRC_EPWM9_SOCB = 25U, FSI_EXT_TRIGSRC_EPWM10_SOCA = 26U, FSI_EXT_TRIGSRC_EPWM10_SOCB = 27U, FSI_EXT_TRIGSRC_EPWM11_SOCA = 28U, FSI_EXT_TRIGSRC_EPWM11_SOCB = 29U, FSI_EXT_TRIGSRC_EPWM12_SOCA = 30U, FSI_EXT_TRIGSRC_EPWM12_SOCB = 31U, FSI_EXT_TRIGSRC_EPWM13_SOCA = 32U, FSI_EXT_TRIGSRC_EPWM13_SOCB = 33U, FSI_EXT_TRIGSRC_EPWM14_SOCA = 34U, FSI_EXT_TRIGSRC_EPWM14_SOCB = 35U, FSI_EXT_TRIGSRC_EPWM15_SOCA = 36U, FSI_EXT_TRIGSRC_EPWM15_SOCB = 37U, FSI_EXT_TRIGSRC_EPWM16_SOCA = 38U, FSI_EXT_TRIGSRC_EPWM16_SOCB = 39U, FSI_EXT_TRIGSRC_ADC_SOCA = 52U, FSI_EXT_TRIGSRC_ADC_SOCB = 53U, FSI_EXT_TRIGSRC_CPU1_TIMER0INT = 54U, FSI_EXT_TRIGSRC_CPU1_TIMER1INT = 55U, FSI_EXT_TRIGSRC_CPU1_TIMER2INT = 56U, FSI_EXT_TRIGSRC_CPU2_TIMER0INT = 57U, FSI_EXT_TRIGSRC_CPU2_TIMER1INT = 58U, FSI_EXT_TRIGSRC_CPU2_TIMER2INT = 59U, FSI_EXT_TRIGSRC_CPU1_CLATASKRUN1 = 60U, FSI_EXT_TRIGSRC_CPU1_CLATASKRUN2 = 61U, FSI_EXT_TRIGSRC_CPU2_CLATASKRUN1 = 62U, FSI_EXT_TRIGSRC_CPU2_CLATASKRUN2 = 63U } FSI_ExtFrameTriggerSrc; //***************************************************************************** // // FSI Tx function prototypes/defintion // //***************************************************************************** //***************************************************************************** // //! \brief Validates if FSI-Tx base address is correct //! //! \param[in] base is the base address of the FSI-Tx module //! //! \return returns \b true if the base address is valid and \b false otherwise // //***************************************************************************** static inline _Bool FSI_isTxBaseValid(uint32_t base) { return((base == 0x00006600U) || (base == 0x00006700U)); } //***************************************************************************** // //! \brief Sends FLUSH pattern //! //! \details FLUSH pattern (toggle data lines followed by toggle on clocks) //! should be sent only when FSI Tx is not under \b SOFT_RESET and the //! clock to the transmit core has been turned ON. //! //! \param[in] base is the FSI Tx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_sendTxFlush(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 430); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) |= ((uint16_t)0x2U | ((0x00A5U) << 8U)); __edis(); } //***************************************************************************** // //! \brief Stops FLUSH pattern transmission //! //! \details Transmission of FLUSH pattern should be stopped before starting //! sending frames. Generally during initilization a pair of send/stop //! APIs for FLUSH pattern is called to clear data/clock lines. //! //! \param[in] base is the FSI Tx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_stopTxFlush(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 458); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) = (((~0x2U) & (*((volatile uint16_t *)((uintptr_t)(base + 0x0U))))) | ((0x00A5U) << 8U)); __edis(); } //***************************************************************************** // //! \brief Selects PLL clock as source for clock dividers //! //! \param[in] base is the FSI Tx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_selectTxPLLClock(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 483); } } while(0); __eallow(); // // Set PLLCLK as source for clock divider // (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) |= 0x100U; __edis(); } //***************************************************************************** // //! \brief sets clock division prescalar and enables the transmit clock //! //! \param[in] base is the FSI Tx module base address //! \param[in] preScaleValue used to generate transmit clock, it defines the //! division value of /2,/3,/4,etc. of \b PLLcLK //! //! \return None. // //***************************************************************************** static inline void FSI_enableTxClock(uint32_t base, uint16_t preScaleValue) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 511); } } while(0); do { if(!(preScaleValue <= 0xFFU)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 512); } } while(0); __eallow(); // // Set prescalar value // (*((volatile uint16_t *)((uintptr_t)(base + 0x2U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x2U)))) & (~0x3FCU)) | (preScaleValue << 2U); // // Enable Tx clock // (*((volatile uint16_t *)((uintptr_t)(base + 0x2U)))) |= 0x2U; __edis(); } //***************************************************************************** // //! \brief Disables transmit clock //! //! \param[in] base is the FSI Tx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_disableTxClock(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 545); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x2U)))) &= ~0x2U; __edis(); } //***************************************************************************** // //! \brief Sets Data width for transmission //! //! \param[in] base is the FSI Tx module base address //! \param[in] dataWidth selection between 1 or 2 lane transmission //! //! \return None. // //***************************************************************************** static inline void FSI_setTxDataWidth(uint32_t base, FSI_DataWidth dataWidth) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 568); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) & (~0x3U)) | (uint16_t)dataWidth; __edis(); } //***************************************************************************** // //! \brief Enables SPI compatible mode //! //! \details FSI supports a \b compatibility mode in order to communicate with //! \b legacy peripherals like \b SPI. Only the 16-bit mode of SPI will //! be supported. All the frame structures, CRC checks and will be //! identical to the normal FSI frames. //! //! \param[in] base is the FSI Tx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_enableTxSPIMode(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 598); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) |= 0x4U; __edis(); } //***************************************************************************** // //! \brief Disables SPI compatible mode //! //! \param[in] base is the FSI Tx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_disableTxSPIMode(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 620); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) &= ~0x4U; __edis(); } //***************************************************************************** // //! \brief Sets start mode for any frame transmission //! //! \param[in] base is the FSI Tx module base address //! \param[in] txStartMode is one of supported 3 start modes in transmission //! //! \return None. // //***************************************************************************** static inline void FSI_setTxStartMode(uint32_t base, FSI_TxStartMode txStartMode) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 643); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) & (~0x38U)) | ((uint16_t)txStartMode << 3U); __edis(); } //***************************************************************************** // //! \brief Setting for when Ping timeout can reset and restart //! //! \param[in] base is the FSI Tx module base address //! \param[in] pingTimeoutMode can be HW or both HW/SW initiated //! //! \return None. // //***************************************************************************** static inline void FSI_setTxPingTimeoutMode(uint32_t base, FSI_PingTimeoutMode pingTimeoutMode) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 669); } } while(0); __eallow(); if(pingTimeoutMode == FSI_PINGTIMEOUT_ON_HWSWINIT_PING_FRAME) { (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) |= 0x80U; } else { (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) &= ~0x80U; } __edis(); } //***************************************************************************** // //! \brief Enables the Tx TDM mode for multi-slave configuration //! //! \param[in] base is the FSI Tx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_enableTxTDMMode(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 702); } } while(0); __eallow(); // // Enable Tx TDM Mode // (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) |= 0x200U; __edis(); } //***************************************************************************** // //! \brief Disables the Tx TDM mode. //! //! \param[in] base is the FSI Tx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_disableTxTDMMode(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 728); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) &= ~0x200U; __edis(); } //***************************************************************************** // //! \brief Sets a particular external input to trigger transmission //! //! \param[in] base is the FSI Tx module base address //! \param[in] extInputNum can be one of ports from 0 to 63. See also //! FSI_ExtFrameTriggerSrc enum members for valid external triggers. //! //! \return None. // //***************************************************************************** static inline void FSI_setTxExtFrameTrigger(uint32_t base, uint16_t extInputNum) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 751); } } while(0); do { if(!(extInputNum < (0x0040U))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 752); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x5U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x5U)))) & (~0x1F80U)) | (extInputNum << 7U); __edis(); } //***************************************************************************** // //! \brief Enables CRC value of a data frame to be forced to zero //! //! \details CRC value of the data frame will be forced to 0 whenever there is //! a transmission and buffer over-run or under-run condition happens. //! The idea is to force a corruption of the CRC since the data is not //! guaranteed to be reliable //! //! \param[in] base is the FSI Tx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_enableTxCRCForceError(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 782); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x5U)))) |= 0x20U; __edis(); } //***************************************************************************** // //! \brief Disables forcing of CRC value of a data frame to zero //! //! \param[in] base is the FSI Tx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_disableTxCRCForceError(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 804); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x5U)))) &= ~0x20U; __edis(); } //***************************************************************************** // //! \brief Select between 16-bit and 32-bit ECC computation //! //! \param[in] base is the FSI Tx module base address //! \param[in] eccComputeWidth is ECC Computation width //! //! \return None. // //***************************************************************************** static inline void FSI_setTxECCComputeWidth(uint32_t base, FSI_ECCComputeWidth eccComputeWidth) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 827); } } while(0); __eallow(); if(eccComputeWidth == FSI_16BIT_ECC_COMPUTE) { (*((volatile uint16_t *)((uintptr_t)(base + 0x5U)))) |= 0x40U; } else { (*((volatile uint16_t *)((uintptr_t)(base + 0x5U)))) &= ~0x40U; } __edis(); } //***************************************************************************** // //! \brief Sets frame type for transmission //! //! \param[in] base is the FSI Tx module base address //! \param[in] frameType value of frame type //! //! \return None. // //***************************************************************************** static inline void FSI_setTxFrameType(uint32_t base, FSI_FrameType frameType) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 859); } } while(0); (*((volatile uint16_t *)((uintptr_t)(base + 0x6U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x6U)))) & (~0xFU)) | (uint16_t)frameType; } //***************************************************************************** // //! \brief Sets the frame size if frame type is user/software defined frame //! //! \param[in] base is the FSI Tx module base address //! \param[in] nWords is number of data words in a software defined frame //! //! \return None. // //***************************************************************************** static inline void FSI_setTxSoftwareFrameSize(uint32_t base, uint16_t nWords) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 882); } } while(0); do { if(!((nWords != 0) && ((nWords - 1) <= (0x000FU)))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 883); } } while(0); (*((volatile uint16_t *)((uintptr_t)(base + 0x6U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x6U)))) & (~0xF0U)) | ((nWords - 1) << 4U); } //***************************************************************************** // //! \brief Starts transmitting frames //! //! \param[in] base is the FSI Tx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_startTxTransmit(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 906); } } while(0); (*((volatile uint16_t *)((uintptr_t)(base + 0x6U)))) |= 0x8000U; } //***************************************************************************** // //! \brief Sets frame tag for transmission //! //! \param[in] base is the FSI Tx module base address //! \param[in] frameTag value of frame tag, 4 bit value (0 to 15) //! //! \return None. // //***************************************************************************** static inline void FSI_setTxFrameTag(uint32_t base, FSI_FrameTag frameTag) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 927); } } while(0); (*((volatile uint16_t *)((uintptr_t)(base + 0x7U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x7U)))) & (~0xFU)) | (uint16_t)frameTag; } //***************************************************************************** // //! \brief Sets user defined data for transmission //! It is an extra data field(8 bit) apart from regular data //! //! \param[in] base is the FSI Tx module base address //! \param[in] userDefData 8 bit user defined data value //! //! \return None. // //***************************************************************************** static inline void FSI_setTxUserDefinedData(uint32_t base, uint16_t userDefData) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 952); } } while(0); do { if(!(userDefData <= (0x00FFU))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 953); } } while(0); (*((volatile uint16_t *)((uintptr_t)(base + 0x7U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x7U)))) & (~0xFF00U)) | (userDefData << 8U); } //***************************************************************************** // //! \brief Sets the value for transmit buffer pointer at desired location //! //! \param[in] base is the FSI Tx module base address //! \param[in] bufPtrOff 4 bit offset pointer in Tx buffer where transmitter //! will pick the data //! //! \return None. // //***************************************************************************** static inline void FSI_setTxBufferPtr(uint32_t base, uint16_t bufPtrOff) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 978); } } while(0); do { if(!(bufPtrOff <= (0x000FU))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 979); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x8U)))) = bufPtrOff; __edis(); } //***************************************************************************** // //! \brief Returns current buffer pointer location //! //! \param[in] base is the FSI Tx module base address //! //! \return current buffer pointer location //! //! \note there could be lag due to synchronization hence value is accurate //! only when no current transmission is happening // //***************************************************************************** static inline uint16_t FSI_getTxBufferPtr(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1004); } } while(0); return((*((volatile uint16_t *)((uintptr_t)(base + 0x9U)))) & 0xFU); } //***************************************************************************** // //! \brief Returns valid number of data words present in buffer which have not //! been transmitted yet //! //! \param[in] base is the FSI Tx module base address //! //! \return number of data words present in buffer which have not been //! transmitted yet //! \note there could be lag due to synchronization hence value is accurate //! only when no current transmission is happening // //***************************************************************************** static inline uint16_t FSI_getTxWordCount(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1029); } } while(0); return(((*((volatile uint16_t *)((uintptr_t)(base + 0x9U)))) & 0x1F00U) >> 8U); } //***************************************************************************** // //! \brief Enables ping timer logic and once set time elapses it sends signal //! to transmitter to send ping frame //! //! \param[in] base is the FSI Tx module base address //! \param[in] refValue 32 bit reference value for ping time-out counter //! \param[in] pingFrameTag 4 bit tag value for ping time-out counter //! //! \return None. // //***************************************************************************** static inline void FSI_enableTxPingTimer(uint32_t base, uint32_t refValue, FSI_FrameTag pingFrameTag) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1055); } } while(0); (*((volatile uint16_t *)((uintptr_t)(base + 0xBU)))) = (uint16_t)pingFrameTag; __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0xCU)))) = refValue; (*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) |= 0x2U; __edis(); } //***************************************************************************** // //! \brief Sets the ping tag value, used by either timeout counter initiated //! PING frame transfer or by external ping trigger input. //! //! \param[in] base is the FSI Tx module base address //! \param[in] frameTag 4 bit tag value for ping time-out counter //! //! \return None. // //***************************************************************************** static inline void FSI_setTxPingTag(uint32_t base, FSI_FrameTag frameTag) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1084); } } while(0); (*((volatile uint16_t *)((uintptr_t)(base + 0xBU)))) = (uint16_t)frameTag; } //***************************************************************************** // //! \brief Disables ping timer logic //! //! \param[in] base is the FSI Tx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_disableTxPingTimer(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1104); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) &= ~0x2U; __edis(); } //***************************************************************************** // //! \brief Enables external trigger to transmit a ping frame //! //! \param[in] base is the FSI Tx module base address //! \param[in] extTrigSel can be one of the external inputs from 0 to 63. //! //! \return None. // //***************************************************************************** static inline void FSI_enableTxExtPingTrigger(uint32_t base, uint16_t extTrigSel) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1127); } } while(0); do { if(!(extTrigSel < (0x0040U))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1128); } } while(0); __eallow(); // // Select external input trigger // (*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) & (~0x1F8U)) | (extTrigSel << 3U); // // Enable ping frame transmission through external trigger // (*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) |= 0x4U; __edis(); } //***************************************************************************** // //! \brief Disables external trigger logic //! //! \param[in] base is the FSI Tx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_disableTxExtPingTrigger(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1160); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) &= ~0x4U; __edis(); } //***************************************************************************** // //! \brief Gives Current value of Ping Timeout Logic Counter //! //! \param[in] base is the FSI Tx module base address //! //! \return Current value of counter is returned // //***************************************************************************** static inline uint32_t FSI_getTxCurrentPingTimeoutCounter(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1182); } } while(0); return((*((volatile uint32_t *)((uintptr_t)(base + 0xEU))))); } //***************************************************************************** // //! \brief Enables to generate DMA event on completion of a frame transfer //! //! \param[in] base is the FSI Tx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_enableTxDMAEvent(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1202); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x11U)))) |= 0x1U; __edis(); } //***************************************************************************** // //! \brief Disable to generate DMA event on completion of a frame transfer //! //! \param[in] base is the FSI Tx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_disableTxDMAEvent(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1224); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x11U)))) &= ~0x1U; __edis(); } //***************************************************************************** // //! \brief Locks the control of all transmit control registers,once locked //! further writes will not take effect until system reset occurs //! //! \param[in] base is the FSI Tx module base address //! //! \note System reset only can unlock registers once locked. //! //! \return None. // //***************************************************************************** static inline void FSI_lockTxCtrl(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1249); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x12U)))) = ((uint16_t)0x1U | ((0x00A5U) << 8U)); __edis(); } //***************************************************************************** // //! \brief Returns current status of all the error flags //! //! \param[in] base is the FSI Tx module base address //! //! \return the status of error flags,each bit of integer is associated with //! one error flag. //! //! Example Usage - function will set the bits corresponding to respective //! error flag in return value //! evtStatus = FSI_getTxEventStatus(FSI_base) //! if bit value of evtStatus is 12(01100) means //! FSI_TX_EVT_OVERRUN and FSI_TX_EVT_PING_HW_TRIG flags are set // //***************************************************************************** static inline uint16_t FSI_getTxEventStatus(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1280); } } while(0); return((*((volatile uint16_t *)((uintptr_t)(base + 0x14U)))) & (0x000FU)); } //***************************************************************************** // //! \brief Enables user to set TX error flags //! //! \param[in] base is the FSI Tx module base address //! \param[in] evtFlags contains list of event and error flags that are //! supposed to be set. //! //! \details Writing a 1 to this bit position will cause the corresponding bit //! in \b TX_EVT_ERR_STATUS register to get set. The purpose of this //! register is to allow software to simulate the effect of the event //! and test the associated software/ISR. //! //! Example Usage //! evtFlags = FSI_TX_EVT_FRAME_DONE & FSI_TX_EVT_OVERRUN //! FSI_forceTxEvents(FSI_base,evtFlags) //! Above call sets error flag to frameDone and overRun events //! //! \return None. // //***************************************************************************** static inline void FSI_forceTxEvents(uint32_t base, uint16_t evtFlags) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1312); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x17U)))) = (evtFlags & (0x000FU)); __edis(); } //***************************************************************************** // //! \brief Enables user to clear TX error flags //! //! \param[in] base is the FSI Tx module base address //! \param[in] evtFlags contains list of event and error flags that are //! supposed to be cleared. //! //! \details Writing a 1 to this bit position will cause the corresponding bit //! in the TX_EVT_ERR_STATUS register to get cleared to 0 //! //! \return None. // //***************************************************************************** static inline void FSI_clearTxEvents(uint32_t base, uint16_t evtFlags) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1339); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x16U)))) = (evtFlags & (0x000FU)); __edis(); } //***************************************************************************** // //! \brief Sets the CRC value to be picked transmission if transmission is //! configured to use user defined SW CRC //! //! \param[in] base is the FSI Tx module base address //! \param[in] userCRCValue is user defined CRC //! //! \return None. // //***************************************************************************** static inline void FSI_enableTxUserCRC(uint32_t base, uint16_t userCRCValue) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1363); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) |= 0x40U; __edis(); (*((volatile uint16_t *)((uintptr_t)(base + 0x18U)))) = userCRCValue; } //***************************************************************************** // //! \brief Sets the CRC value to be picked transmission if transmission is //! configured to use user defined SW CRC //! //! \param[in] base is the FSI Tx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_disableTxUserCRC(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1388); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) &= ~0x40U; __edis(); } //***************************************************************************** // //! \brief Sets data for ECC logic computaion //! //! \param[in] base is the FSI Tx module base address //! \param[in] data data value for which ECC needs to be computed //! //! \return None. // //***************************************************************************** static inline void FSI_setTxECCdata(uint32_t base, uint32_t data) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1411); } } while(0); (*((volatile uint32_t *)((uintptr_t)(base + 0x20U)))) = data; } //***************************************************************************** // //! \brief Returns ECC value evaluated for 16/32 bit data //! //! \param[in] base is the FSI Tx module base address //! //! \return ECC value for input data // //***************************************************************************** static inline uint16_t FSI_getTxECCValue(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1431); } } while(0); return((*((volatile uint16_t *)((uintptr_t)(base + 0x22U)))) & 0x7FU); } //***************************************************************************** // //! \brief Enables user to generate interrupt on occurrence of FSI_TxEventList //! events //! //! \param[in] base is the FSI Tx module base address //! \param[in] intNum is the type of interrupt to be generated //! interrupt1 or interrupt2 //! \param[in] intFlags contains list of events on which interrupt //! should be generated. //! //! Example Usage //! intFlags = FSI_TX_EVT_FRAME_DONE && FSI_TX_EVT_BUF_OVERRUN //! && FSI_TX_EVT_PING_TIMEOUT //! FSI_enableTxInterrupt(FSI_base, FSI_INT1, intFlags) //! above configuration will generate signal on interrupt line 1 upon //! frameDone, BufOverRun and PingTimeOut event //! //! \return None. // //***************************************************************************** static inline void FSI_enableTxInterrupt(uint32_t base, FSI_InterruptNum intNum, uint16_t intFlags) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1464); } } while(0); __eallow(); if(intNum == FSI_INT1) { (*((volatile uint16_t *)((uintptr_t)(base + 0x10U)))) |= (intFlags & (0x000FU)); } else { (*((volatile uint16_t *)((uintptr_t)(base + 0x10U)))) |= ((intFlags & (0x000FU)) << (0x8U)); } __edis(); } //***************************************************************************** // //! \brief Enables user to disable generation interrupt on occurrence of //! FSI_TxEventList events //! //! \param[in] base is the FSI Tx module base address //! \param[in] intNum is the type of interrupt to be generated //! interrupt1 or interrupt2 //! \param[in] intFlags contains list of events on which interrupt //! generation has to be disabled. //! //! \return None. // //***************************************************************************** static inline void FSI_disableTxInterrupt(uint32_t base, FSI_InterruptNum intNum, uint16_t intFlags) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1502); } } while(0); __eallow(); if(intNum == FSI_INT1) { (*((volatile uint16_t *)((uintptr_t)(base + 0x10U)))) &= ~(intFlags & (0x000FU)); } else { (*((volatile uint16_t *)((uintptr_t)(base + 0x10U)))) &= ((~(intFlags & (0x000FU)) << (0x8U)) | 0xFFU); } __edis(); } //***************************************************************************** // //! \brief Returns address of Tx data buffer //! //! \details Data buffer is consisting of 16 words from offset- 0x40 to 0x4e //! //! \param[in] base is the FSI Tx module base address //! //! \return Tx data buffer address // //***************************************************************************** static inline uint32_t FSI_getTxBufferAddress(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isTxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1536); } } while(0); return(base + (0x40U + (0))); } //***************************************************************************** // //! \brief Resets clock or ping timeout counter or entire TX module //! //! \param[in] base is the FSI Tx module base address //! \param[in] submodule the name of submodule which is supposed to be reset //! //! \return None. // //***************************************************************************** extern void FSI_resetTxModule(uint32_t base, FSI_TxSubmoduleInReset submodule); //***************************************************************************** // //! \brief Clears reset on clock or ping timeout counter or entire TX module //! //! \param[in] base is the FSI Tx module base address //! \param[in] submodule the name of submodule, to be brought out of reset //! //! \return None. // //***************************************************************************** extern void FSI_clearTxModuleReset(uint32_t base, FSI_TxSubmoduleInReset submodule); //***************************************************************************** // //! \brief Writes data in FSI Tx buffer //! //! \param[in] base is the FSI Tx module base address //! \param[in] array is the address of the array of words to be transmitted. //! \param[in] length is the number of words in the array to be transmitted. //! \param[in] bufOffset is the offset in Tx buffer where data will be written //! //! \note Data Overwrite protection is implemented in this function by ensuring //! not more than 16 words are written and also wrap around case is taken //! care when more words need to be written if last write happens at //! maximum offset in Tx buffer //! //! \return None. // //***************************************************************************** extern void FSI_writeTxBuffer(uint32_t base, const uint16_t array[], uint16_t length, uint16_t bufOffset); //***************************************************************************** //***************************************************************************** // // FSI Rx function prototypes/definitions // //***************************************************************************** //***************************************************************************** // //! \brief Checks the FSI-Rx base address //! //! \param base is the base address of the FSI-Rx module //! //! \return returns \b true if the base address is valid and \b false otherwise // //***************************************************************************** static inline _Bool FSI_isRxBaseValid(uint32_t base) { return((base == 0x00006680U) || (base == 0x00006780U) || (base == 0x00006880U) || (base == 0x00006980U) || (base == 0x00006A80U) || (base == 0x00006B80U) || (base == 0x00006C80U) || (base == 0x00006D80U)); } //***************************************************************************** // //! \brief Enables internal loopback where mux will select //! internal pins coming from TX module instead of what comes from pins //! //! \param[in] base is the FSI Rx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_enableRxInternalLoopback(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1632); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) |= ((uint16_t)0x2U | ((0x00A5U) << 8U)); __edis(); } //***************************************************************************** // //! \brief Disables internal loopback where mux will not use internal pins //! coming from TX module //! //! \param[in] base is the FSI Rx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_disableRxInternalLoopback(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1657); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) & (~0x2U)) | ((0x00A5U) << 8U); __edis(); } //***************************************************************************** // //! \brief Receive clock is selected from the internal port coming //! from TX module //! //! \param[in] base is the FSI Rx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_enableRxSPIPairing(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1683); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) |= ((uint16_t)0x4U | ((0x00A5U) << 8U)); __edis(); } //***************************************************************************** // //! \brief Selects regular receive clock coming from the pins //! //! \param[in] base is the FSI Rx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_disableRxSPIPairing(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1707); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) & (~0x4U)) | ((0x00A5U) << 8U); __edis(); } //***************************************************************************** // //! \brief Selects number of data lines used for receiving //! //! \param[in] base is the FSI Rx module base address //! \param[in] dataWidth selection between 1 or 2 lane receive operation //! //! \return None. // //***************************************************************************** static inline void FSI_setRxDataWidth(uint32_t base, FSI_DataWidth dataWidth) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1733); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) & (~0x3U)) | (uint16_t)dataWidth; __edis(); } //***************************************************************************** // //! \brief Enables SPI compatible mode in FSI Rx //! //! \param[in] base is the FSI Rx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_enableRxSPIMode(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1757); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) |= 0x4U; __edis(); } //***************************************************************************** // //! \brief Disables SPI compatible mode in FSI Rx //! //! \param[in] base is the FSI Rx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_disableRxSPIMode(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1779); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) &= ~0x4U; __edis(); } //***************************************************************************** // //! \brief Sets the frame size if frame type is user/software defined frame //! //! \param[in] base is the FSI Rx module base address //! \param[in] nWords is number of data words in a software defined frame //! //! \return None. // //***************************************************************************** static inline void FSI_setRxSoftwareFrameSize(uint32_t base, uint16_t nWords) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1802); } } while(0); do { if(!((nWords != 0) && ((nWords - 1) <= (0x000FU)))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1803); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) & (~0x78U)) | ((nWords - 1) << 3U); __edis(); } //***************************************************************************** // //! \brief Select between 16-bit and 32-bit ECC computation //! //! \param[in] base is the FSI Rx module base address //! \param[in] eccComputeWidth is ECC Computation width //! //! \return None. // //***************************************************************************** static inline void FSI_setRxECCComputeWidth(uint32_t base, FSI_ECCComputeWidth eccComputeWidth) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1829); } } while(0); __eallow(); if(eccComputeWidth == FSI_16BIT_ECC_COMPUTE) { (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) |= 0x80U; } else { (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) &= ~0x80U; } __edis(); } //***************************************************************************** // //! \brief Setting for when Ping timeout can reset and restart //! //! \param[in] base is the FSI Rx module base address //! \param[in] pingTimeoutMode can be HW or both HW/SW initiated //! //! \return None. // //***************************************************************************** static inline void FSI_setRxPingTimeoutMode(uint32_t base, FSI_PingTimeoutMode pingTimeoutMode) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1861); } } while(0); __eallow(); if(pingTimeoutMode == FSI_PINGTIMEOUT_ON_HWSWINIT_PING_FRAME) { (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) |= 0x100U; } else { (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) &= ~0x100U; } __edis(); } //***************************************************************************** // //! \brief Gets frame type received in the last successful frame //! //! \param[in] base is the FSI Rx module base address //! //! \return value of Frame type received on last successful frame // //***************************************************************************** static inline FSI_FrameType FSI_getRxFrameType(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1892); } } while(0); return((FSI_FrameType)((*((volatile uint16_t *)((uintptr_t)(base + 0x6U)))) & 0xFU)); } //***************************************************************************** // //! \brief Enables to generate DMA event on completion of a successful //! frame reception //! //! \param[in] base is the FSI Rx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_enableRxDMAEvent(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1914); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x8U)))) |= 0x1U; __edis(); } //***************************************************************************** // //! \brief Disables the DMA event generation on completion of a successful //! frame reception //! //! \param[in] base is the FSI Rx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_disableRxDMAEvent(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1937); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x8U)))) &= ~0x1U; __edis(); } //***************************************************************************** // //! \brief Returns Frame tag received for the last successful frame //! //! \param[in] base is the FSI Rx module base address //! //! \return frame tag value. // //***************************************************************************** static inline uint16_t FSI_getRxFrameTag(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1959); } } while(0); return(((*((volatile uint16_t *)((uintptr_t)(base + 0x7U)))) & 0x1EU) >> 1U); } //***************************************************************************** // //! \brief Returns User-Data(8-bit) field for received data frame. //! //! \param[in] base is the FSI Rx module base address //! //! \return user data field value. // //***************************************************************************** static inline uint16_t FSI_getRxUserDefinedData(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 1981); } } while(0); return(((*((volatile uint16_t *)((uintptr_t)(base + 0x7U)))) & 0xFF00U) >> 8U); } //***************************************************************************** // //! \brief Returns current status of all the evetn/error flags //! //! \param[in] base is the FSI Rx module base address //! //! \return the status of error flags,each bit of integer is associated //! with one error flag. //! //! Example Usage - function will set the bits corresponding to respective //! error flag in return value //! evtFlags = FSI_getRxEventStatus(FSI_base) //! if value of evtFlags is 1036(0100000001100) means //! FSI_RX_EVT_FRAME_OVERRUN,FSI_RX_EVT_TYPE_ERR and //! FSI_RX_EVT_CRC_ERR flags are set // //***************************************************************************** static inline uint16_t FSI_getRxEventStatus(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2011); } } while(0); return((*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) & (0x7FFFU)); } //***************************************************************************** // //! \brief Enables user to set RX event/error flags //! //! \param[in] base is the FSI Rx module base address //! \param[in] evtFlags contains list of error flags to be set //! //! \return None. //! //! Example Usage //! evtFlags = FSI_RX_EVT_EOF_ERR && FSI_RX_EVT_TYPE_ERR //! FSI_forceRxEvents(FSI_base,evtFlags) //! Above call sets error flag to FSI_RX_ERR_EOF_ERR and //! FSI_RX_ERR_TYPE_ERR events // //***************************************************************************** static inline void FSI_forceRxEvents(uint32_t base, uint16_t evtFlags) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2039); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0xDU)))) = (evtFlags & (0x7FFFU)); __edis(); } //***************************************************************************** // //! \brief Enables user to clear RX event/error flags //! //! \param[in] base is the FSI Rx module base address //! \param[in] evtFlags contains list of error flags to be cleared //! //! \return None. // //***************************************************************************** static inline void FSI_clearRxEvents(uint32_t base, uint16_t evtFlags) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2062); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) = (evtFlags & (0x7FFFU)); __edis(); } //***************************************************************************** // //! \brief Returns CRC value received in data frame/frame //! //! \param[in] base is the FSI Rx module base address //! //! \return CRC value received in data frame // //***************************************************************************** static inline uint16_t FSI_getRxReceivedCRC(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2084); } } while(0); return((*((volatile uint16_t *)((uintptr_t)(base + 0xBU)))) & 0xFFU); } //***************************************************************************** // //! \brief Computes and returns CRC value for data received //! //! \param[in] base is the FSI Rx module base address //! //! \return CRC value computed on received data // //***************************************************************************** static inline uint16_t FSI_getRxComputedCRC(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2104); } } while(0); return(((*((volatile uint16_t *)((uintptr_t)(base + 0xBU)))) & 0xFF00U) >> 8U); } //***************************************************************************** // //! \brief Sets the value for receive buffer pointer at desired location //! //! \param[in] base is the FSI Rx module base address //! \param[in] bufPtrOff 4 bit offset pointer in Rx buffer from where received //! data will be read //! //! \return None. // //***************************************************************************** static inline void FSI_setRxBufferPtr(uint32_t base, uint16_t bufPtrOff) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2127); } } while(0); do { if(!(bufPtrOff <= (0x000FU))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2128); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0xEU)))) = bufPtrOff; __edis(); } //***************************************************************************** // //! \brief Returns current buffer pointer location //! //! \param[in] base is the FSI Rx module base address //! //! \return current buffer pointer location //! //! \note there could be lag due to synchronization, hence value is accurate //! only when no current reception is happening // //***************************************************************************** static inline uint16_t FSI_getRxBufferPtr(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2153); } } while(0); return((*((volatile uint16_t *)((uintptr_t)(base + 0xFU)))) & 0xFU); } //***************************************************************************** // //! \brief Returns valid number of data words present in buffer which have //! not been read out yet //! //! \param[in] base is the FSI Rx module base address //! //! \return number of data words present in buffer which have not been read //! out yet //! //! \note there could be lag due to synchronization, hence value is accurate //! only when no current reception is happening // //***************************************************************************** static inline uint16_t FSI_getRxWordCount(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2179); } } while(0); return(((*((volatile uint16_t *)((uintptr_t)(base + 0xFU)))) & 0x1F00U) >> 8U); } //***************************************************************************** // //! \brief Enables the frame watchdog counter logic to count every time it //! start to receive a frame //! //! \param[in] base is the FSI Rx module base address //! \param[in] wdRef reference value for ping watchdog time-out counter //! //! \return None. // //***************************************************************************** static inline void FSI_enableRxFrameWatchdog(uint32_t base, uint32_t wdRef) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2203); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0x12U)))) = wdRef; (*((volatile uint16_t *)((uintptr_t)(base + 0x10U)))) |= 0x2U; __edis(); } //***************************************************************************** // //! \brief Disables the frame watchdog counter logic //! //! \param[in] base is the FSI Rx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_disableRxFrameWatchdog(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2226); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x10U)))) &= ~0x2U; __edis(); } //***************************************************************************** // //! \brief Returns current value of frame watchdog counter //! //! \param[in] base is the FSI Rx module base address //! //! \return current value of frame watchdog counter // //***************************************************************************** static inline uint32_t FSI_getRxFrameWatchdogCounter(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2248); } } while(0); return((*((volatile uint32_t *)((uintptr_t)(base + 0x14U))))); } //***************************************************************************** // //! \brief Enables the ping watchdog counter logic and once the set time //! elapses it will indicate ping watchdog time-out has occurred //! //! \param[in] base is the FSI Rx module base address //! \param[in] wdRef reference value for ping watchdog time-out counter //! //! \return None. // //***************************************************************************** static inline void FSI_enableRxPingWatchdog(uint32_t base, uint32_t wdRef) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2270); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0x18U)))) = wdRef; (*((volatile uint16_t *)((uintptr_t)(base + 0x16U)))) |= 0x2U; __edis(); } //***************************************************************************** // //! \brief Disables the ping watchdog counter logic //! //! \param[in] base is the FSI Rx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_disableRxPingWatchdog(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2293); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x16U)))) &= ~0x2U; __edis(); } //***************************************************************************** // //! \brief Returns current value of ping watchdog counter //! //! \param[in] base is the FSI Rx module base address //! //! \return current value(32 bit) of ping watchdog counter // //***************************************************************************** static inline uint32_t FSI_getRxPingWatchdogCounter(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2315); } } while(0); return((*((volatile uint32_t *)((uintptr_t)(base + 0x1AU))))); } //***************************************************************************** // //! \brief Returns the value of tag received for last ping frame //! //! \param[in] base is the FSI Rx module base address //! //! \return the tagValue received for last ping frame // //***************************************************************************** static inline uint16_t FSI_getRxPingTag(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2335); } } while(0); return(((*((volatile uint16_t *)((uintptr_t)(base + 0x17U)))) & 0x1EU) >> 1U); } //***************************************************************************** // //! \brief Locks the control of all receive control registers, //! once locked further writes will not take effect until system //! reset occurs //! //! \param[in] base is the FSI Rx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_lockRxCtrl(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2358); } } while(0); __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x1EU)))) = ((uint16_t)0x1U | ((0x00A5U) << 8U)); __edis(); } //***************************************************************************** // //! \brief Sets Rx ECC data on which ECC (SEC-DED) computaion logic runs //! //! \param[in] base is the FSI Rx module base address //! \param[in] rxECCdata Data for ECC logic //! //! \return None. // //***************************************************************************** static inline void FSI_setRxECCData(uint32_t base, uint32_t rxECCdata) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2383); } } while(0); (*((volatile uint32_t *)((uintptr_t)(base + 0x20U)))) = rxECCdata; } //***************************************************************************** // //! \brief Sets received ECC value on which ECC (SEC-DED) computaion logic runs //! //! \param[in] base is the FSI Rx module base address //! \param[in] rxECCvalue Received ECC value in a data frame //! //! \return None. // //***************************************************************************** static inline void FSI_setRxReceivedECCValue(uint32_t base, uint16_t rxECCvalue) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2404); } } while(0); // // ECC value can be passed as 8 bit value in USERDATA field in a frame // do { if(!(rxECCvalue <= (0x00FFU))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2409); } } while(0); (*((volatile uint16_t *)((uintptr_t)(base + 0x22U)))) = rxECCvalue; } //***************************************************************************** // //! \brief Returns ECC Corrected data //! //! \param[in] base is the FSI Rx module base address //! //! \return 32 bit ECC corrected data // //***************************************************************************** static inline uint32_t FSI_getRxECCCorrectedData(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2429); } } while(0); return((*((volatile uint32_t *)((uintptr_t)(base + 0x24U))))); } //***************************************************************************** // //! \brief Returns ECC Log details //! //! \param[in] base is the FSI Rx module base address //! //! \return ECC Log value(8 bit) // //***************************************************************************** static inline uint16_t FSI_getRxECCLog(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2449); } } while(0); return((*((volatile uint16_t *)((uintptr_t)(base + 0x26U)))) & (0x1U | 0x2U)); } //***************************************************************************** // //! \brief Let user generate interrupt on occurrence of Rx events //! //! \param[in] base is the FSI Rx module base address //! \param[in] intNum the type of interrupt to be generated interrupt1 //! or interrupt2 //! \param[in] intFlags contains list of events on which interrupt //! should be generated. Each bit will represent one event,bits for //! the events on which user want to generate interrupt will be set //! others remain clear //! //! \return None. //! //! Example Usage //! evtFlags = FSI_RX_EVT_PING_WD_TIMEOUT & FSI_RX_INT_TYPE_ERR //! FSI_enableRxInterrupt(FSI_base,FSI_INT1,evtFlags) //! Above call will generate interrupt1 on events //! FSI_RX_INT_PING_WD_TIMEOUT and FSI_RX_INT_TYPE_ERR // //***************************************************************************** static inline void FSI_enableRxInterrupt(uint32_t base, FSI_InterruptNum intNum, uint16_t intFlags) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2483); } } while(0); __eallow(); if(intNum == FSI_INT1) { (*((volatile uint16_t *)((uintptr_t)(base + 0x1CU)))) |= (intFlags & (0x7FFFU)); } else { (*((volatile uint16_t *)((uintptr_t)(base + 0x1DU)))) |= (intFlags & (0x7FFFU)); } __edis(); } //***************************************************************************** // //! \brief Let user disable interrupt generation on Rx events //! //! \param[in] base is the FSI Rx module base address //! \param[in] intNum the type of interrupt to be generated interrupt1 //! or interrupt2 //! \param[in] intFlags contains list of events on which interrupt //! generation has to be disabled. //! //! \return None. // //***************************************************************************** static inline void FSI_disableRxInterrupt(uint32_t base, FSI_InterruptNum intNum, uint16_t intFlags) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2521); } } while(0); __eallow(); if(intNum == FSI_INT1) { (*((volatile uint16_t *)((uintptr_t)(base + 0x1CU)))) &= ~(intFlags & (0x7FFFU)); } else { (*((volatile uint16_t *)((uintptr_t)(base + 0x1DU)))) &= ~(intFlags & (0x7FFFU)); } __edis(); } //***************************************************************************** // //! \brief Returns address of Rx data buffer //! //! \details Data buffer is consisting of 16 words from offset- 0x40 to 0x4e //! //! \param[in] base is the FSI Rx module base address //! //! \return Rx data buffer address // //***************************************************************************** static inline uint32_t FSI_getRxBufferAddress(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2556); } } while(0); return(base + (0x40U + (0))); } //***************************************************************************** // //! \brief Sets the Rx Frame Reference Tag Value //! //! \details The reference tag is used to check against when comparing the //! TAG_MASK and the incoming frame tag. //! //! \param[in] base is the FSI Rx module base address //! \param[in] refVal is the Rx frame reference tag value to be set //! //! \return Rx data buffer address // //***************************************************************************** static inline void FSI_setRxFrameTagRef(uint32_t base, uint16_t refVal) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2580); } } while(0); __eallow(); // // Sets the Rx frame tag reference. // (*((volatile uint16_t *)((uintptr_t)(base + 0x28U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x28U)))) & ~((uint16_t)0xFU)) | (refVal << 0U)); __edis(); } //***************************************************************************** // //! \brief Returns the Rx Frame Reference Tag Value //! //! \details The reference tag is used to check against when comparing the //! TAG_MASK and the incoming frame tag. //! //! \param[in] base is the FSI Rx module base address //! //! \return Rx frame reference tag // //***************************************************************************** static inline uint16_t FSI_getRxFrameTagRef(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2612); } } while(0); // // Returns the Rx frame tag reference. // return(((*((volatile uint16_t *)((uintptr_t)(base + 0x28U)))) & 0xFU) >> 0U); } //***************************************************************************** // //! \brief Sets the Rx Frame Tag Mask Value //! //! \details Any bit position set to 0 will be used in the comparison of //! incoming tag & the reference tag. A bit position set to 1 will be ignored //! in the tag comparison. //! //! \param[in] base is the FSI Rx module base address //! \param[in] maskVal is the Rx frame tag mask value to be set //! //! \return Rx frame tag mask // //***************************************************************************** static inline void FSI_setRxFrameTagMask(uint32_t base, uint16_t maskVal) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2641); } } while(0); __eallow(); // // Sets the Rx frame tag mask. // (*((volatile uint16_t *)((uintptr_t)(base + 0x28U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x28U)))) & ~((uint16_t)0xF0U)) | (maskVal << 4U)); __edis(); } //***************************************************************************** // //! \brief Returns the Rx Frame Tag Mask Value //! //! \details Any bit position set to 0 will be used in the comparison of //! incoming tag & the reference tag. A bit position set to 1 will be ignored //! in the tag comparison. //! //! \param[in] base is the FSI Rx module base address //! //! \return Rx frame reference tag // //***************************************************************************** static inline uint16_t FSI_getRxFrameTagMask(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2674); } } while(0); // // Returns the frame tag mask. // return(((*((volatile uint16_t *)((uintptr_t)(base + 0x28U)))) & 0xF0U) >> 4U); } //***************************************************************************** // //! \brief Enables the Rx Frame Compare Mode //! //! \param[in] base is the FSI Rx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_enableRxFrameTagCompare(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2698); } } while(0); __eallow(); // // Enables the frame tag compare mode. // (*((volatile uint16_t *)((uintptr_t)(base + 0x28U)))) |= 0x100U; __edis(); } //***************************************************************************** // //! \brief Disables the Rx Frame Compare Mode //! //! \param[in] base is the FSI Rx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_disableRxFrameTagCompare(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2724); } } while(0); __eallow(); // // Disables the Rx frame tag compare mode. // (*((volatile uint16_t *)((uintptr_t)(base + 0x28U)))) &= ~(uint16_t)0x100U; __edis(); } //***************************************************************************** // //! \brief Enables the Rx Frame Broadcast Mode //! //! \param[in] base is the FSI Rx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_enableRxFrameBroadcast(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2751); } } while(0); __eallow(); // // Enables Rx frame broadcast mode. // (*((volatile uint16_t *)((uintptr_t)(base + 0x28U)))) |= 0x200U; __edis(); } //***************************************************************************** // //! \brief Disables the Rx Frame Broadcast Mode //! //! \param[in] base is the FSI Rx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_disableRxFrameBroadcast(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2777); } } while(0); __eallow(); // // Disables Rx frame broadcast mode. // (*((volatile uint16_t *)((uintptr_t)(base + 0x28U)))) &= ~(uint16_t)0x200U; __edis(); } // // ping frame related APIs // //***************************************************************************** // //! \brief Sets the Rx Ping Tag Reference Value //! //! \details The reference tag is used to check against when comparing the //! TAG_MASK and the incoming ping tag. //! //! \param[in] base is the FSI Rx module base address //! \param[in] refVal is the Rx frame reference tag value to be set //! //! \return Rx data buffer address // //***************************************************************************** static inline void FSI_setRxPingTagRef(uint32_t base, uint16_t refVal) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2811); } } while(0); __eallow(); // // Set Rx ping tag reference value. // (*((volatile uint16_t *)((uintptr_t)(base + 0x29U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x29U)))) & ~((uint16_t)0xFU)) | (refVal << 0U)); __edis(); } //***************************************************************************** // //! \brief Returns the Rx Ping Reference Tag Value //! //! \details The reference tag is used to check against when comparing the //! TAG_MASK and the incoming ping tag. //! //! \param[in] base is the FSI Rx module base address //! //! \return Rx frame reference tag // //***************************************************************************** static inline uint16_t FSI_getRxPingTagRef(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2843); } } while(0); // // Returns Rx ping tag reference. // return(((*((volatile uint16_t *)((uintptr_t)(base + 0x29U)))) & 0xFU) >> 0U); } //***************************************************************************** // //! \brief Sets the Rx Ping Tag Mask Value //! //! \details Any bit position set to 0 will be used in the comparison of //! incoming tag & the reference tag. A bit position set to 1 will be ignored //! in the tag comparison. //! //! \param[in] base is the FSI Rx module base address //! \param[in] maskVal is the Rx frame tag mask value to be set //! //! \return Rx ping tag mask // //***************************************************************************** static inline void FSI_setRxPingTagMask(uint32_t base, uint16_t maskVal) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2872); } } while(0); __eallow(); // // Set Rx ping tag mask. // (*((volatile uint16_t *)((uintptr_t)(base + 0x29U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x29U)))) & ~((uint16_t)0xF0U)) | (maskVal << 4U)); __edis(); } //***************************************************************************** // //! \brief Returns the Rx Ping Tag Mask Value //! //! \details Any bit position set to 0 will be used in the comparison of //! incoming tag & the reference tag. A bit position set to 1 will be ignored //! in the tag comparison. //! //! \param[in] base is the FSI Rx module base address //! //! \return Rx ping reference tag // //***************************************************************************** static inline uint16_t FSI_getRxPingTagMask(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2905); } } while(0); // // Returns ping tag mask. // return(((*((volatile uint16_t *)((uintptr_t)(base + 0x29U)))) & 0xF0U) >> 4U); } //***************************************************************************** // //! \brief Enables the Rx Ping Compare Mode //! //! \param[in] base is the FSI Rx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_enableRxPingTagCompare(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2929); } } while(0); __eallow(); // // Enables the Rx ping tag compare mode. // (*((volatile uint16_t *)((uintptr_t)(base + 0x29U)))) |= 0x100U; __edis(); } //***************************************************************************** // //! \brief Disables the Rx Ping Compare Mode //! //! \param[in] base is the FSI Rx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_disableRxPingTagCompare(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2955); } } while(0); __eallow(); // // Disables Rx ping tag compare mode. // (*((volatile uint16_t *)((uintptr_t)(base + 0x29U)))) &= ~(uint16_t)0x100U; __edis(); } //***************************************************************************** // //! \brief Enables the Rx Ping Broadcast Mode //! //! \param[in] base is the FSI Rx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_enableRxPingBroadcast(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 2982); } } while(0); __eallow(); // // Enables the Rx ping broadcast mode. // (*((volatile uint16_t *)((uintptr_t)(base + 0x29U)))) |= 0x200U; __edis(); } //***************************************************************************** // //! \brief Disables the Rx Ping Broadcast Mode //! //! \param[in] base is the FSI Rx module base address //! //! \return None. // //***************************************************************************** static inline void FSI_disableRxPingBroadcast(uint32_t base) { // // Check the arguments. // do { if(!(FSI_isRxBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/fsi.h", 3008); } } while(0); __eallow(); // // Disables the Rx ping broadcast. // (*((volatile uint16_t *)((uintptr_t)(base + 0x29U)))) &= ~(uint16_t)0x200U; __edis(); } //***************************************************************************** // //! \brief Resets frame watchdog,ping watchdog or entire RX module //! //! \param[in] base is the FSI Rx module base address //! \param[in] submodule the name of module which is supposed to be reset //! //! \return None. // //***************************************************************************** extern void FSI_resetRxModule(uint32_t base, FSI_RxSubmoduleInReset submodule); //***************************************************************************** // //! \brief Clears resets on frame watchdog,ping watchdog or entire RX module //! //! \param[in] base is the FSI Rx module base address //! \param[in] submodule module which is to be brought out of reset //! //! \return None. // //***************************************************************************** extern void FSI_clearRxModuleReset(uint32_t base, FSI_RxSubmoduleInReset submodule); //***************************************************************************** // //! \brief Reads data from FSI Rx buffer //! //! \param[in] base is the FSI Rx module base address //! \param[out] array is the address of the array of words to receive the data //! \param[in] length is the number of words in the array to be received //! \param[in] bufOffset is the offset in Rx buffer from where data will //! be read //! //! \note This function ensures that not more than 16 words are read and //! wrap around case is also taken care when more words need to be read //! wherein last read happens at maximum offset in Rx buffer //! //! \return None. // //***************************************************************************** extern void FSI_readRxBuffer(uint32_t base, uint16_t array[], uint16_t length, uint16_t bufOffset); //***************************************************************************** // //! \brief Adds delay for selected tap line //! //! \param[in] base is the FSI Rx module base address //! \param[in] delayTapType the line for which delay needs to be added //! it can be either RXCLK,RXD0 or RXD1 //! \param[in] tapValue 5 bit value of the amount of delay to be added //! //! \return None. // //***************************************************************************** extern void FSI_configRxDelayLine(uint32_t base, FSI_RxDelayTapType delayTapType, uint16_t tapValue); //***************************************************************************** // //! \brief Initializes FSI Tx module //! //! \details Software based initialization of the FSI transmitter IP. This is //! typically needed only once during initialization or if the module //! needs to be reset due to an underrun condition that occurred during //! operation. //! //! \param[in] base is the FSI Tx module base address //! \param[in] prescalar is the user configurable clock divider for PLL input //! clock //! //! \return None. // //***************************************************************************** extern void FSI_performTxInitialization(uint32_t base, uint16_t prescalar); //***************************************************************************** // //! \brief Initializes FSI Rx module //! //! \details Software based initialization of the FSI receiver module.This is //! typically needed only once during initialization. However, if there //! are framing errors in the received frames, then the receive module //! needs to be reset so that subsequent frames/packets can be handled //! fresh. //! //! \param[in] base is the FSI Rx module base address //! //! \return None. // //***************************************************************************** extern void FSI_performRxInitialization(uint32_t base); //***************************************************************************** // //! \brief Sends Flush pattern sequence //! //! \details Flush pattern sequence sent by a FSI transmit module will bring the //! FSI receive module out of reset so that it will then be ready to //! receive subsequent frames. //! //! \param[in] base is the FSI Tx module base address //! \param[in] prescalar is the user configurable clock divider for PLL input //! clock //! //! \return None. // //***************************************************************************** extern void FSI_executeTxFlushSequence(uint32_t base, uint16_t prescalar); //***************************************************************************** // // Close the Doxygen group. //! @} // //***************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //########################################################################### // // FILE: gpio.h // // TITLE: C28x GPIO driver. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup gpio_api GPIO //! @{ // //***************************************************************************** //########################################################################### // // FILE: hw_gpio.h // // TITLE: Definitions for the GPIO registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the GPIO register offsets // //***************************************************************************** // Period Control (GPIO0 to 31) // Register (GPIO0 to 15) // Register (GPIO16 to 31) // to 15) // to 31) // (GPIO0 to 31) // Register (GPIO0 to 31) // Registers (GPIO0 to 31) // Register (GPIO0 to GPIO31) // (GPIO0 to 15) // (GPIO16 to 31) // (GPIO0 to 7) // (GPIO8 to 15) // (GPIO16 to 23) // (GPIO24 to 31) // Register (GPIO0 to 31) // (GPIO0 to 31) // Period Control (GPIO32 to 63) // Register (GPIO32 to 47) // Register (GPIO48 to 63) // to 47) // to 63) // (GPIO32 to 63) // Register (GPIO32 to 63) // Registers (GPIO32 to 63) // Register (GPIO32 to GPIO63) // register (GPIO32 to GPIO63) // (GPIO32 to 47) // (GPIO48 to 63) // (GPIO32 to 39) // (GPIO40 to 47) // (GPIO48 to 55) // (GPIO56 to 63) // Register (GPIO32 to 63) // (GPIO32 to 63) // Period Control (GPIO64 to 95) // Register (GPIO64 to 79) // Register (GPIO80 to 95) // to 79) // to 95) // (GPIO64 to 95) // Register (GPIO64 to 95) // Registers (GPIO64 to 95) // Register (GPIO64 to GPIO95) // (GPIO64 to 79) // (GPIO80 to 95) // (GPIO64 to 71) // (GPIO72 to 79) // (GPIO80 to 87) // (GPIO88 to 95) // Register (GPIO64 to 95) // (GPIO64 to 95) // Period Control (GPIO96 to // 127) // Register (GPIO96 to 111) // Register (GPIO112 to 127) // to 111) // (GPIO112 to 127) // (GPIO96 to 127) // Register (GPIO96 to 127) // Registers (GPIO96 to 127) // Register (GPIO96 to GPIO127) // (GPIO96 to 111) // (GPIO112 to 127) // (GPIO96 to 103) // (GPIO104 to 111) // (GPIO112 to 119) // (GPIO120 to 127) // Register (GPIO96 to 127) // (GPIO96 to 127) // Period Control (GPIO128 to // 159) // Register (GPIO128 to 143) // Register (GPIO144 to 159) // (GPIO128 to 143) // (GPIO144 to 159) // (GPIO128 to 159) // Register (GPIO128 to 159) // Registers (GPIO128 to 159) // Register (GPIO128 to GPIO159) // (GPIO128 to 143) // (GPIO144 to 159) // (GPIO128 to 135) // (GPIO136 to 143) // (GPIO144 to 151) // (GPIO152 to 159) // Register (GPIO128 to 159) // (GPIO128 to 159) // Period Control (GPIO160 to // 168) // Register (GPIO160 to 168) // (GPIO160 to 168) // (GPIO160 to 168) // Register (GPIO160 to 168) // Registers (GPIO160 to 168) // Register (GPIO160 to GPIO168) // (GPIO160 to 168) // (GPIO160 to 167) // (GPIO168) // Register (GPIO160 to 168) // (GPIO160 to 168) // to 31) // (GPIO0 to 31) // (GPIO0 to 31) // (GPIO0 to 31) // to 63) // (GPIO32 to 63) // (GPIO32 to 63) // (GPIO32 to 63) // to 95) // (GPIO64 to 95) // (GPIO64 to 95) // (GPIO64 to 95) // to 127) // (GPIO96 to 127) // (GPIO96 to 127) // (GPIO96 to 127) // to 159) // (GPIO128 to 159) // (GPIO128 to 159) // (GPIO128 to 159) // to 168) // (GPIO160 to 168) // (GPIO160 to 168) // (GPIO160 to 168) //***************************************************************************** // // The following are defines for the bit fields in the GPACTRL register // //***************************************************************************** // for GPIO0 to GPIO7 // for GPIO8 to GPIO15 // for GPIO16 to GPIO23 // for GPIO24 to GPIO31 //***************************************************************************** // // The following are defines for the bit fields in the GPAQSEL1 register // //***************************************************************************** // type for GPIO0 // type for GPIO1 // type for GPIO2 // type for GPIO3 // type for GPIO4 // type for GPIO5 // type for GPIO6 // type for GPIO7 // type for GPIO8 // type for GPIO9 // type for GPIO10 // type for GPIO11 // type for GPIO12 // type for GPIO13 // type for GPIO14 // type for GPIO15 //***************************************************************************** // // The following are defines for the bit fields in the GPAQSEL2 register // //***************************************************************************** // type for GPIO16 // type for GPIO17 // type for GPIO18 // type for GPIO19 // type for GPIO20 // type for GPIO21 // type for GPIO22 // type for GPIO23 // type for GPIO24 // type for GPIO25 // type for GPIO26 // type for GPIO27 // type for GPIO28 // type for GPIO29 // type for GPIO30 // type for GPIO31 //***************************************************************************** // // The following are defines for the bit fields in the GPAMUX1 register // //***************************************************************************** // for GPIO0 // for GPIO1 // for GPIO2 // for GPIO3 // for GPIO4 // for GPIO5 // for GPIO6 // for GPIO7 // for GPIO8 // for GPIO9 // for GPIO10 // for GPIO11 // for GPIO12 // for GPIO13 // for GPIO14 // for GPIO15 //***************************************************************************** // // The following are defines for the bit fields in the GPAMUX2 register // //***************************************************************************** // for GPIO16 // for GPIO17 // for GPIO18 // for GPIO19 // for GPIO20 // for GPIO21 // for GPIO22 // for GPIO23 // for GPIO24 // for GPIO25 // for GPIO26 // for GPIO27 // for GPIO28 // for GPIO29 // for GPIO30 // for GPIO31 //***************************************************************************** // // The following are defines for the bit fields in the GPADIR register // //***************************************************************************** // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode //***************************************************************************** // // The following are defines for the bit fields in the GPAPUD register // //***************************************************************************** // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin //***************************************************************************** // // The following are defines for the bit fields in the GPAINV register // //***************************************************************************** // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin //***************************************************************************** // // The following are defines for the bit fields in the GPAODR register // //***************************************************************************** // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin //***************************************************************************** // // The following are defines for the bit fields in the GPAGMUX1 register // //***************************************************************************** // for GPIO0 // for GPIO1 // for GPIO2 // for GPIO3 // for GPIO4 // for GPIO5 // for GPIO6 // for GPIO7 // for GPIO8 // for GPIO9 // for GPIO10 // for GPIO11 // for GPIO12 // for GPIO13 // for GPIO14 // for GPIO15 //***************************************************************************** // // The following are defines for the bit fields in the GPAGMUX2 register // //***************************************************************************** // for GPIO16 // for GPIO17 // for GPIO18 // for GPIO19 // for GPIO20 // for GPIO21 // for GPIO22 // for GPIO23 // for GPIO24 // for GPIO25 // for GPIO26 // for GPIO27 // for GPIO28 // for GPIO29 // for GPIO30 // for GPIO31 //***************************************************************************** // // The following are defines for the bit fields in the GPACSEL1 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPACSEL2 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPACSEL3 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPACSEL4 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPALOCK register // //***************************************************************************** // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin //***************************************************************************** // // The following are defines for the bit fields in the GPACR register // //***************************************************************************** // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin //***************************************************************************** // // The following are defines for the bit fields in the GPBCTRL register // //***************************************************************************** // for GPIO32 to GPIO39 // for GPIO40 to GPIO47 // for GPIO48 to GPIO55 // for GPIO56 to GPIO63 //***************************************************************************** // // The following are defines for the bit fields in the GPBQSEL1 register // //***************************************************************************** // type for GPIO32 // type for GPIO33 // type for GPIO34 // type for GPIO35 // type for GPIO36 // type for GPIO37 // type for GPIO38 // type for GPIO39 // type for GPIO40 // type for GPIO41 // type for GPIO42 // type for GPIO43 // type for GPIO44 // type for GPIO45 // type for GPIO46 // type for GPIO47 //***************************************************************************** // // The following are defines for the bit fields in the GPBQSEL2 register // //***************************************************************************** // type for GPIO48 // type for GPIO49 // type for GPIO50 // type for GPIO51 // type for GPIO52 // type for GPIO53 // type for GPIO54 // type for GPIO55 // type for GPIO56 // type for GPIO57 // type for GPIO58 // type for GPIO59 // type for GPIO60 // type for GPIO61 // type for GPIO62 // type for GPIO63 //***************************************************************************** // // The following are defines for the bit fields in the GPBMUX1 register // //***************************************************************************** // for GPIO32 // for GPIO33 // for GPIO34 // for GPIO35 // for GPIO36 // for GPIO37 // for GPIO38 // for GPIO39 // for GPIO40 // for GPIO41 // for GPIO42 // for GPIO43 // for GPIO44 // for GPIO45 // for GPIO46 // for GPIO47 //***************************************************************************** // // The following are defines for the bit fields in the GPBMUX2 register // //***************************************************************************** // for GPIO48 // for GPIO49 // for GPIO50 // for GPIO51 // for GPIO52 // for GPIO53 // for GPIO54 // for GPIO55 // for GPIO56 // for GPIO57 // for GPIO58 // for GPIO59 // for GPIO60 // for GPIO61 // for GPIO62 // for GPIO63 //***************************************************************************** // // The following are defines for the bit fields in the GPBDIR register // //***************************************************************************** // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode //***************************************************************************** // // The following are defines for the bit fields in the GPBPUD register // //***************************************************************************** // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin //***************************************************************************** // // The following are defines for the bit fields in the GPBINV register // //***************************************************************************** // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin //***************************************************************************** // // The following are defines for the bit fields in the GPBODR register // //***************************************************************************** // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin //***************************************************************************** // // The following are defines for the bit fields in the GPBAMSEL register // //***************************************************************************** // pin // pin //***************************************************************************** // // The following are defines for the bit fields in the GPBGMUX1 register // //***************************************************************************** // for GPIO32 // for GPIO33 // for GPIO34 // for GPIO35 // for GPIO36 // for GPIO37 // for GPIO38 // for GPIO39 // for GPIO40 // for GPIO41 // for GPIO42 // for GPIO43 // for GPIO44 // for GPIO45 // for GPIO46 // for GPIO47 //***************************************************************************** // // The following are defines for the bit fields in the GPBGMUX2 register // //***************************************************************************** // for GPIO48 // for GPIO49 // for GPIO50 // for GPIO51 // for GPIO52 // for GPIO53 // for GPIO54 // for GPIO55 // for GPIO56 // for GPIO57 // for GPIO58 // for GPIO59 // for GPIO60 // for GPIO61 // for GPIO62 // for GPIO63 //***************************************************************************** // // The following are defines for the bit fields in the GPBCSEL1 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPBCSEL2 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPBCSEL3 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPBCSEL4 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPBLOCK register // //***************************************************************************** // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin //***************************************************************************** // // The following are defines for the bit fields in the GPBCR register // //***************************************************************************** // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin //***************************************************************************** // // The following are defines for the bit fields in the GPCCTRL register // //***************************************************************************** // for GPIO64 to GPIO71 // for GPIO72 to GPIO79 // for GPIO80 to GPIO87 // for GPIO88 to GPIO95 //***************************************************************************** // // The following are defines for the bit fields in the GPCQSEL1 register // //***************************************************************************** // type for GPIO64 // type for GPIO65 // type for GPIO66 // type for GPIO67 // type for GPIO68 // type for GPIO69 // type for GPIO70 // type for GPIO71 // type for GPIO72 // type for GPIO73 // type for GPIO74 // type for GPIO75 // type for GPIO76 // type for GPIO77 // type for GPIO78 // type for GPIO79 //***************************************************************************** // // The following are defines for the bit fields in the GPCQSEL2 register // //***************************************************************************** // type for GPIO80 // type for GPIO81 // type for GPIO82 // type for GPIO83 // type for GPIO84 // type for GPIO85 // type for GPIO86 // type for GPIO87 // type for GPIO88 // type for GPIO89 // type for GPIO90 // type for GPIO91 // type for GPIO92 // type for GPIO93 // type for GPIO94 // type for GPIO95 //***************************************************************************** // // The following are defines for the bit fields in the GPCMUX1 register // //***************************************************************************** // for GPIO64 // for GPIO65 // for GPIO66 // for GPIO67 // for GPIO68 // for GPIO69 // for GPIO70 // for GPIO71 // for GPIO72 // for GPIO73 // for GPIO74 // for GPIO75 // for GPIO76 // for GPIO77 // for GPIO78 // for GPIO79 //***************************************************************************** // // The following are defines for the bit fields in the GPCMUX2 register // //***************************************************************************** // for GPIO80 // for GPIO81 // for GPIO82 // for GPIO83 // for GPIO84 // for GPIO85 // for GPIO86 // for GPIO87 // for GPIO88 // for GPIO89 // for GPIO90 // for GPIO91 // for GPIO92 // for GPIO93 // for GPIO94 // for GPIO95 //***************************************************************************** // // The following are defines for the bit fields in the GPCDIR register // //***************************************************************************** // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode //***************************************************************************** // // The following are defines for the bit fields in the GPCPUD register // //***************************************************************************** // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin //***************************************************************************** // // The following are defines for the bit fields in the GPCINV register // //***************************************************************************** // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin //***************************************************************************** // // The following are defines for the bit fields in the GPCODR register // //***************************************************************************** // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin //***************************************************************************** // // The following are defines for the bit fields in the GPCGMUX1 register // //***************************************************************************** // for GPIO64 // for GPIO65 // for GPIO66 // for GPIO67 // for GPIO68 // for GPIO69 // for GPIO70 // for GPIO71 // for GPIO72 // for GPIO73 // for GPIO74 // for GPIO75 // for GPIO76 // for GPIO77 // for GPIO78 // for GPIO79 //***************************************************************************** // // The following are defines for the bit fields in the GPCGMUX2 register // //***************************************************************************** // for GPIO80 // for GPIO81 // for GPIO82 // for GPIO83 // for GPIO84 // for GPIO85 // for GPIO86 // for GPIO87 // for GPIO88 // for GPIO89 // for GPIO90 // for GPIO91 // for GPIO92 // for GPIO93 // for GPIO94 // for GPIO95 //***************************************************************************** // // The following are defines for the bit fields in the GPCCSEL1 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPCCSEL2 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPCCSEL3 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPCCSEL4 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPCLOCK register // //***************************************************************************** // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin //***************************************************************************** // // The following are defines for the bit fields in the GPCCR register // //***************************************************************************** // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin //***************************************************************************** // // The following are defines for the bit fields in the GPDCTRL register // //***************************************************************************** // for GPIO96 to GPIO103 // for GPIO104 to GPIO111 // for GPIO112 to GPIO119 // for GPIO120 to GPIO127 //***************************************************************************** // // The following are defines for the bit fields in the GPDQSEL1 register // //***************************************************************************** // type for GPIO96 // type for GPIO97 // type for GPIO98 // type for GPIO99 // type for GPIO100 // type for GPIO101 // type for GPIO102 // type for GPIO103 // type for GPIO104 // type for GPIO105 // type for GPIO106 // type for GPIO107 // type for GPIO108 // type for GPIO109 // type for GPIO110 // type for GPIO111 //***************************************************************************** // // The following are defines for the bit fields in the GPDQSEL2 register // //***************************************************************************** // type for GPIO112 // type for GPIO113 // type for GPIO114 // type for GPIO115 // type for GPIO116 // type for GPIO117 // type for GPIO118 // type for GPIO119 // type for GPIO120 // type for GPIO121 // type for GPIO122 // type for GPIO123 // type for GPIO124 // type for GPIO125 // type for GPIO126 // type for GPIO127 //***************************************************************************** // // The following are defines for the bit fields in the GPDMUX1 register // //***************************************************************************** // for GPIO96 // for GPIO97 // for GPIO98 // for GPIO99 // for GPIO100 // for GPIO101 // for GPIO102 // for GPIO103 // for GPIO104 // for GPIO105 // for GPIO106 // for GPIO107 // for GPIO108 // for GPIO109 // for GPIO110 // for GPIO111 //***************************************************************************** // // The following are defines for the bit fields in the GPDMUX2 register // //***************************************************************************** // for GPIO112 // for GPIO113 // for GPIO114 // for GPIO115 // for GPIO116 // for GPIO117 // for GPIO118 // for GPIO119 // for GPIO120 // for GPIO121 // for GPIO122 // for GPIO123 // for GPIO124 // for GPIO125 // for GPIO126 // for GPIO127 //***************************************************************************** // // The following are defines for the bit fields in the GPDDIR register // //***************************************************************************** // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode //***************************************************************************** // // The following are defines for the bit fields in the GPDPUD register // //***************************************************************************** // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin //***************************************************************************** // // The following are defines for the bit fields in the GPDINV register // //***************************************************************************** // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin //***************************************************************************** // // The following are defines for the bit fields in the GPDODR register // //***************************************************************************** // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin //***************************************************************************** // // The following are defines for the bit fields in the GPDGMUX1 register // //***************************************************************************** // for GPIO96 // for GPIO97 // for GPIO98 // for GPIO99 // for GPIO100 // for GPIO101 // for GPIO102 // for GPIO103 // for GPIO104 // for GPIO105 // for GPIO106 // for GPIO107 // for GPIO108 // for GPIO109 // for GPIO110 // for GPIO111 //***************************************************************************** // // The following are defines for the bit fields in the GPDGMUX2 register // //***************************************************************************** // for GPIO112 // for GPIO113 // for GPIO114 // for GPIO115 // for GPIO116 // for GPIO117 // for GPIO118 // for GPIO119 // for GPIO120 // for GPIO121 // for GPIO122 // for GPIO123 // for GPIO124 // for GPIO125 // for GPIO126 // for GPIO127 //***************************************************************************** // // The following are defines for the bit fields in the GPDCSEL1 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPDCSEL2 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPDCSEL3 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPDCSEL4 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPDLOCK register // //***************************************************************************** // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin //***************************************************************************** // // The following are defines for the bit fields in the GPDCR register // //***************************************************************************** // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin //***************************************************************************** // // The following are defines for the bit fields in the GPECTRL register // //***************************************************************************** // for GPIO128 to GPIO135 // for GPIO136 to GPIO143 // for GPIO144 to GPIO151 // for GPIO152 to GPIO159 //***************************************************************************** // // The following are defines for the bit fields in the GPEQSEL1 register // //***************************************************************************** // type for GPIO128 // type for GPIO129 // type for GPIO130 // type for GPIO131 // type for GPIO132 // type for GPIO133 // type for GPIO134 // type for GPIO135 // type for GPIO136 // type for GPIO137 // type for GPIO138 // type for GPIO139 // type for GPIO140 // type for GPIO141 // type for GPIO142 // type for GPIO143 //***************************************************************************** // // The following are defines for the bit fields in the GPEQSEL2 register // //***************************************************************************** // type for GPIO144 // type for GPIO145 // type for GPIO146 // type for GPIO147 // type for GPIO148 // type for GPIO149 // type for GPIO150 // type for GPIO151 // type for GPIO152 // type for GPIO153 // type for GPIO154 // type for GPIO155 // type for GPIO156 // type for GPIO157 // type for GPIO158 // type for GPIO159 //***************************************************************************** // // The following are defines for the bit fields in the GPEMUX1 register // //***************************************************************************** // for GPIO128 // for GPIO129 // for GPIO130 // for GPIO131 // for GPIO132 // for GPIO133 // for GPIO134 // for GPIO135 // for GPIO136 // for GPIO137 // for GPIO138 // for GPIO139 // for GPIO140 // for GPIO141 // for GPIO142 // for GPIO143 //***************************************************************************** // // The following are defines for the bit fields in the GPEMUX2 register // //***************************************************************************** // for GPIO144 // for GPIO145 // for GPIO146 // for GPIO147 // for GPIO148 // for GPIO149 // for GPIO150 // for GPIO151 // for GPIO152 // for GPIO153 // for GPIO154 // for GPIO155 // for GPIO156 // for GPIO157 // for GPIO158 // for GPIO159 //***************************************************************************** // // The following are defines for the bit fields in the GPEDIR register // //***************************************************************************** // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode //***************************************************************************** // // The following are defines for the bit fields in the GPEPUD register // //***************************************************************************** // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin //***************************************************************************** // // The following are defines for the bit fields in the GPEINV register // //***************************************************************************** // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin //***************************************************************************** // // The following are defines for the bit fields in the GPEODR register // //***************************************************************************** // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin //***************************************************************************** // // The following are defines for the bit fields in the GPEGMUX1 register // //***************************************************************************** // for GPIO128 // for GPIO129 // for GPIO130 // for GPIO131 // for GPIO132 // for GPIO133 // for GPIO134 // for GPIO135 // for GPIO136 // for GPIO137 // for GPIO138 // for GPIO139 // for GPIO140 // for GPIO141 // for GPIO142 // for GPIO143 //***************************************************************************** // // The following are defines for the bit fields in the GPEGMUX2 register // //***************************************************************************** // for GPIO144 // for GPIO145 // for GPIO146 // for GPIO147 // for GPIO148 // for GPIO149 // for GPIO150 // for GPIO151 // for GPIO152 // for GPIO153 // for GPIO154 // for GPIO155 // for GPIO156 // for GPIO157 // for GPIO158 // for GPIO159 //***************************************************************************** // // The following are defines for the bit fields in the GPECSEL1 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPECSEL2 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPECSEL3 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPECSEL4 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPELOCK register // //***************************************************************************** // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin //***************************************************************************** // // The following are defines for the bit fields in the GPECR register // //***************************************************************************** // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin //***************************************************************************** // // The following are defines for the bit fields in the GPFCTRL register // //***************************************************************************** // for GPIO160 to GPIO167 // for GPIO168 //***************************************************************************** // // The following are defines for the bit fields in the GPFQSEL1 register // //***************************************************************************** // type for GPIO160 // type for GPIO161 // type for GPIO162 // type for GPIO163 // type for GPIO164 // type for GPIO165 // type for GPIO166 // type for GPIO167 // type for GPIO168 //***************************************************************************** // // The following are defines for the bit fields in the GPFMUX1 register // //***************************************************************************** // for GPIO160 // for GPIO161 // for GPIO162 // for GPIO163 // for GPIO164 // for GPIO165 // for GPIO166 // for GPIO167 // for GPIO168 //***************************************************************************** // // The following are defines for the bit fields in the GPFDIR register // //***************************************************************************** // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode // pin in GPIO mode //***************************************************************************** // // The following are defines for the bit fields in the GPFPUD register // //***************************************************************************** // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin //***************************************************************************** // // The following are defines for the bit fields in the GPFINV register // //***************************************************************************** // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin //***************************************************************************** // // The following are defines for the bit fields in the GPFODR register // //***************************************************************************** // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin //***************************************************************************** // // The following are defines for the bit fields in the GPFGMUX1 register // //***************************************************************************** // for GPIO160 // for GPIO161 // for GPIO162 // for GPIO163 // for GPIO164 // for GPIO165 // for GPIO166 // for GPIO167 // for GPIO168 //***************************************************************************** // // The following are defines for the bit fields in the GPFCSEL1 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPFCSEL2 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPFLOCK register // //***************************************************************************** // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin // this pin //***************************************************************************** // // The following are defines for the bit fields in the GPFCR register // //***************************************************************************** // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin // for this pin //***************************************************************************** // // The following are defines for the bit fields in the GPADAT register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPASET register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPACLEAR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPATOGGLE register // //***************************************************************************** // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin //***************************************************************************** // // The following are defines for the bit fields in the GPBDAT register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPBSET register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPBCLEAR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPBTOGGLE register // //***************************************************************************** // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin //***************************************************************************** // // The following are defines for the bit fields in the GPCDAT register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPCSET register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPCCLEAR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPCTOGGLE register // //***************************************************************************** // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin //***************************************************************************** // // The following are defines for the bit fields in the GPDDAT register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPDSET register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPDCLEAR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPDTOGGLE register // //***************************************************************************** // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin //***************************************************************************** // // The following are defines for the bit fields in the GPEDAT register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPESET register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPECLEAR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPETOGGLE register // //***************************************************************************** // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin // pin //***************************************************************************** // // The following are defines for the bit fields in the GPFDAT register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPFSET register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPFCLEAR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GPFTOGGLE register // //***************************************************************************** // pin // pin // pin // pin // pin // pin // pin // pin // pin //########################################################################### // // FILE: hw_xint.h // // TITLE: Definitions for the XINT registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the XINT register offsets // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the XINT1CR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the XINT2CR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the XINT3CR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the XINT4CR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the XINT5CR register // //***************************************************************************** //########################################################################### // // FILE: xbar.h // // TITLE: C28x X-BAR driver. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup xbar_api XBAR //! @{ // //***************************************************************************** //########################################################################### // // FILE: hw_clbxbar.h // // TITLE: Definitions for the XBAR registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the XBAR register offsets // //***************************************************************************** // for Output-0 // for Output-0 // for Output-1 // for Output-1 // for Output-2 // for Output-2 // for Output-3 // for Output-3 // for Output-4 // for Output-4 // for Output-5 // for Output-5 // for Output-6 // for Output-6 // for Output-7 // for Output-7 // for Output-0 // for Output-1 // for Output-2 // for Output-3 // for Output-4 // for Output-5 // for Output-6 // for Output-7 // Register // register //***************************************************************************** // // The following are defines for the bit fields in the AUXSIG0MUX0TO15CFG register // //***************************************************************************** // AUXSIG0 of CLB-XBAR // AUXSIG0 of CLB-XBAR // AUXSIG0 of CLB-XBAR // AUXSIG0 of CLB-XBAR // AUXSIG0 of CLB-XBAR // AUXSIG0 of CLB-XBAR // AUXSIG0 of CLB-XBAR // AUXSIG0 of CLB-XBAR // AUXSIG0 of CLB-XBAR // AUXSIG0 of CLB-XBAR // AUXSIG0 of CLB-XBAR // AUXSIG0 of CLB-XBAR // AUXSIG0 of CLB-XBAR // AUXSIG0 of CLB-XBAR // AUXSIG0 of CLB-XBAR // AUXSIG0 of CLB-XBAR //***************************************************************************** // // The following are defines for the bit fields in the AUXSIG0MUX16TO31CFG register // //***************************************************************************** // AUXSIG0 of CLB-XBAR // AUXSIG0 of CLB-XBAR // AUXSIG0 of CLB-XBAR // AUXSIG0 of CLB-XBAR // AUXSIG0 of CLB-XBAR // AUXSIG0 of CLB-XBAR // AUXSIG0 of CLB-XBAR // AUXSIG0 of CLB-XBAR // AUXSIG0 of CLB-XBAR // AUXSIG0 of CLB-XBAR // AUXSIG0 of CLB-XBAR // AUXSIG0 of CLB-XBAR // AUXSIG0 of CLB-XBAR // AUXSIG0 of CLB-XBAR // AUXSIG0 of CLB-XBAR // AUXSIG0 of CLB-XBAR //***************************************************************************** // // The following are defines for the bit fields in the AUXSIG1MUX0TO15CFG register // //***************************************************************************** // AUXSIG1 of CLB-XBAR // AUXSIG1 of CLB-XBAR // AUXSIG1 of CLB-XBAR // AUXSIG1 of CLB-XBAR // AUXSIG1 of CLB-XBAR // AUXSIG1 of CLB-XBAR // AUXSIG1 of CLB-XBAR // AUXSIG1 of CLB-XBAR // AUXSIG1 of CLB-XBAR // AUXSIG1 of CLB-XBAR // AUXSIG1 of CLB-XBAR // AUXSIG1 of CLB-XBAR // AUXSIG1 of CLB-XBAR // AUXSIG1 of CLB-XBAR // AUXSIG1 of CLB-XBAR // AUXSIG1 of CLB-XBAR //***************************************************************************** // // The following are defines for the bit fields in the AUXSIG1MUX16TO31CFG register // //***************************************************************************** // AUXSIG1 of CLB-XBAR // AUXSIG1 of CLB-XBAR // AUXSIG1 of CLB-XBAR // AUXSIG1 of CLB-XBAR // AUXSIG1 of CLB-XBAR // AUXSIG1 of CLB-XBAR // AUXSIG1 of CLB-XBAR // AUXSIG1 of CLB-XBAR // AUXSIG1 of CLB-XBAR // AUXSIG1 of CLB-XBAR // AUXSIG1 of CLB-XBAR // AUXSIG1 of CLB-XBAR // AUXSIG1 of CLB-XBAR // AUXSIG1 of CLB-XBAR // AUXSIG1 of CLB-XBAR // AUXSIG1 of CLB-XBAR //***************************************************************************** // // The following are defines for the bit fields in the AUXSIG2MUX0TO15CFG register // //***************************************************************************** // AUXSIG2 of CLB-XBAR // AUXSIG2 of CLB-XBAR // AUXSIG2 of CLB-XBAR // AUXSIG2 of CLB-XBAR // AUXSIG2 of CLB-XBAR // AUXSIG2 of CLB-XBAR // AUXSIG2 of CLB-XBAR // AUXSIG2 of CLB-XBAR // AUXSIG2 of CLB-XBAR // AUXSIG2 of CLB-XBAR // AUXSIG2 of CLB-XBAR // AUXSIG2 of CLB-XBAR // AUXSIG2 of CLB-XBAR // AUXSIG2 of CLB-XBAR // AUXSIG2 of CLB-XBAR // AUXSIG2 of CLB-XBAR //***************************************************************************** // // The following are defines for the bit fields in the AUXSIG2MUX16TO31CFG register // //***************************************************************************** // AUXSIG2 of CLB-XBAR // AUXSIG2 of CLB-XBAR // AUXSIG2 of CLB-XBAR // AUXSIG2 of CLB-XBAR // AUXSIG2 of CLB-XBAR // AUXSIG2 of CLB-XBAR // AUXSIG2 of CLB-XBAR // AUXSIG2 of CLB-XBAR // AUXSIG2 of CLB-XBAR // AUXSIG2 of CLB-XBAR // AUXSIG2 of CLB-XBAR // AUXSIG2 of CLB-XBAR // AUXSIG2 of CLB-XBAR // AUXSIG2 of CLB-XBAR // AUXSIG2 of CLB-XBAR // AUXSIG2 of CLB-XBAR //***************************************************************************** // // The following are defines for the bit fields in the AUXSIG3MUX0TO15CFG register // //***************************************************************************** // AUXSIG3 of CLB-XBAR // AUXSIG3 of CLB-XBAR // AUXSIG3 of CLB-XBAR // AUXSIG3 of CLB-XBAR // AUXSIG3 of CLB-XBAR // AUXSIG3 of CLB-XBAR // AUXSIG3 of CLB-XBAR // AUXSIG3 of CLB-XBAR // AUXSIG3 of CLB-XBAR // AUXSIG3 of CLB-XBAR // AUXSIG3 of CLB-XBAR // AUXSIG3 of CLB-XBAR // AUXSIG3 of CLB-XBAR // AUXSIG3 of CLB-XBAR // AUXSIG3 of CLB-XBAR // AUXSIG3 of CLB-XBAR //***************************************************************************** // // The following are defines for the bit fields in the AUXSIG3MUX16TO31CFG register // //***************************************************************************** // AUXSIG3 of CLB-XBAR // AUXSIG3 of CLB-XBAR // AUXSIG3 of CLB-XBAR // AUXSIG3 of CLB-XBAR // AUXSIG3 of CLB-XBAR // AUXSIG3 of CLB-XBAR // AUXSIG3 of CLB-XBAR // AUXSIG3 of CLB-XBAR // AUXSIG3 of CLB-XBAR // AUXSIG3 of CLB-XBAR // AUXSIG3 of CLB-XBAR // AUXSIG3 of CLB-XBAR // AUXSIG3 of CLB-XBAR // AUXSIG3 of CLB-XBAR // AUXSIG3 of CLB-XBAR // AUXSIG3 of CLB-XBAR //***************************************************************************** // // The following are defines for the bit fields in the AUXSIG4MUX0TO15CFG register // //***************************************************************************** // AUXSIG4 of CLB-XBAR // AUXSIG4 of CLB-XBAR // AUXSIG4 of CLB-XBAR // AUXSIG4 of CLB-XBAR // AUXSIG4 of CLB-XBAR // AUXSIG4 of CLB-XBAR // AUXSIG4 of CLB-XBAR // AUXSIG4 of CLB-XBAR // AUXSIG4 of CLB-XBAR // AUXSIG4 of CLB-XBAR // AUXSIG4 of CLB-XBAR // AUXSIG4 of CLB-XBAR // AUXSIG4 of CLB-XBAR // AUXSIG4 of CLB-XBAR // AUXSIG4 of CLB-XBAR // AUXSIG4 of CLB-XBAR //***************************************************************************** // // The following are defines for the bit fields in the AUXSIG4MUX16TO31CFG register // //***************************************************************************** // AUXSIG4 of CLB-XBAR // AUXSIG4 of CLB-XBAR // AUXSIG4 of CLB-XBAR // AUXSIG4 of CLB-XBAR // AUXSIG4 of CLB-XBAR // AUXSIG4 of CLB-XBAR // AUXSIG4 of CLB-XBAR // AUXSIG4 of CLB-XBAR // AUXSIG4 of CLB-XBAR // AUXSIG4 of CLB-XBAR // AUXSIG4 of CLB-XBAR // AUXSIG4 of CLB-XBAR // AUXSIG4 of CLB-XBAR // AUXSIG4 of CLB-XBAR // AUXSIG4 of CLB-XBAR // AUXSIG4 of CLB-XBAR //***************************************************************************** // // The following are defines for the bit fields in the AUXSIG5MUX0TO15CFG register // //***************************************************************************** // AUXSIG5 of CLB-XBAR // AUXSIG5 of CLB-XBAR // AUXSIG5 of CLB-XBAR // AUXSIG5 of CLB-XBAR // AUXSIG5 of CLB-XBAR // AUXSIG5 of CLB-XBAR // AUXSIG5 of CLB-XBAR // AUXSIG5 of CLB-XBAR // AUXSIG5 of CLB-XBAR // AUXSIG5 of CLB-XBAR // AUXSIG5 of CLB-XBAR // AUXSIG5 of CLB-XBAR // AUXSIG5 of CLB-XBAR // AUXSIG5 of CLB-XBAR // AUXSIG5 of CLB-XBAR // AUXSIG5 of CLB-XBAR //***************************************************************************** // // The following are defines for the bit fields in the AUXSIG5MUX16TO31CFG register // //***************************************************************************** // AUXSIG5 of CLB-XBAR // AUXSIG5 of CLB-XBAR // AUXSIG5 of CLB-XBAR // AUXSIG5 of CLB-XBAR // AUXSIG5 of CLB-XBAR // AUXSIG5 of CLB-XBAR // AUXSIG5 of CLB-XBAR // AUXSIG5 of CLB-XBAR // AUXSIG5 of CLB-XBAR // AUXSIG5 of CLB-XBAR // AUXSIG5 of CLB-XBAR // AUXSIG5 of CLB-XBAR // AUXSIG5 of CLB-XBAR // AUXSIG5 of CLB-XBAR // AUXSIG5 of CLB-XBAR // AUXSIG5 of CLB-XBAR //***************************************************************************** // // The following are defines for the bit fields in the AUXSIG6MUX0TO15CFG register // //***************************************************************************** // AUXSIG6 of CLB-XBAR // AUXSIG6 of CLB-XBAR // AUXSIG6 of CLB-XBAR // AUXSIG6 of CLB-XBAR // AUXSIG6 of CLB-XBAR // AUXSIG6 of CLB-XBAR // AUXSIG6 of CLB-XBAR // AUXSIG6 of CLB-XBAR // AUXSIG6 of CLB-XBAR // AUXSIG6 of CLB-XBAR // AUXSIG6 of CLB-XBAR // AUXSIG6 of CLB-XBAR // AUXSIG6 of CLB-XBAR // AUXSIG6 of CLB-XBAR // AUXSIG6 of CLB-XBAR // AUXSIG6 of CLB-XBAR //***************************************************************************** // // The following are defines for the bit fields in the AUXSIG6MUX16TO31CFG register // //***************************************************************************** // AUXSIG6 of CLB-XBAR // AUXSIG6 of CLB-XBAR // AUXSIG6 of CLB-XBAR // AUXSIG6 of CLB-XBAR // AUXSIG6 of CLB-XBAR // AUXSIG6 of CLB-XBAR // AUXSIG6 of CLB-XBAR // AUXSIG6 of CLB-XBAR // AUXSIG6 of CLB-XBAR // AUXSIG6 of CLB-XBAR // AUXSIG6 of CLB-XBAR // AUXSIG6 of CLB-XBAR // AUXSIG6 of CLB-XBAR // AUXSIG6 of CLB-XBAR // AUXSIG6 of CLB-XBAR // AUXSIG6 of CLB-XBAR //***************************************************************************** // // The following are defines for the bit fields in the AUXSIG7MUX0TO15CFG register // //***************************************************************************** // AUXSIG7 of CLB-XBAR // AUXSIG7 of CLB-XBAR // AUXSIG7 of CLB-XBAR // AUXSIG7 of CLB-XBAR // AUXSIG7 of CLB-XBAR // AUXSIG7 of CLB-XBAR // AUXSIG7 of CLB-XBAR // AUXSIG7 of CLB-XBAR // AUXSIG7 of CLB-XBAR // AUXSIG7 of CLB-XBAR // AUXSIG7 of CLB-XBAR // AUXSIG7 of CLB-XBAR // AUXSIG7 of CLB-XBAR // AUXSIG7 of CLB-XBAR // AUXSIG7 of CLB-XBAR // AUXSIG7 of CLB-XBAR //***************************************************************************** // // The following are defines for the bit fields in the AUXSIG7MUX16TO31CFG register // //***************************************************************************** // AUXSIG7 of CLB-XBAR // AUXSIG7 of CLB-XBAR // AUXSIG7 of CLB-XBAR // AUXSIG7 of CLB-XBAR // AUXSIG7 of CLB-XBAR // AUXSIG7 of CLB-XBAR // AUXSIG7 of CLB-XBAR // AUXSIG7 of CLB-XBAR // AUXSIG7 of CLB-XBAR // AUXSIG7 of CLB-XBAR // AUXSIG7 of CLB-XBAR // AUXSIG7 of CLB-XBAR // AUXSIG7 of CLB-XBAR // AUXSIG7 of CLB-XBAR // AUXSIG7 of CLB-XBAR // AUXSIG7 of CLB-XBAR //***************************************************************************** // // The following are defines for the bit fields in the AUXSIG0MUXENABLE register // //***************************************************************************** // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR //***************************************************************************** // // The following are defines for the bit fields in the AUXSIG1MUXENABLE register // //***************************************************************************** // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR //***************************************************************************** // // The following are defines for the bit fields in the AUXSIG2MUXENABLE register // //***************************************************************************** // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR //***************************************************************************** // // The following are defines for the bit fields in the AUXSIG3MUXENABLE register // //***************************************************************************** // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR //***************************************************************************** // // The following are defines for the bit fields in the AUXSIG4MUXENABLE register // //***************************************************************************** // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR //***************************************************************************** // // The following are defines for the bit fields in the AUXSIG5MUXENABLE register // //***************************************************************************** // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR //***************************************************************************** // // The following are defines for the bit fields in the AUXSIG6MUXENABLE register // //***************************************************************************** // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR //***************************************************************************** // // The following are defines for the bit fields in the AUXSIG7MUXENABLE register // //***************************************************************************** // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR // CLB-XBAR //***************************************************************************** // // The following are defines for the bit fields in the AUXSIGOUTINV register // //***************************************************************************** // of CLB-XBAR // of CLB-XBAR // of CLB-XBAR // of CLB-XBAR // of CLB-XBAR // of CLB-XBAR // of CLB-XBAR // of CLB-XBAR //***************************************************************************** // // The following are defines for the bit fields in the AUXSIGLOCK register // //***************************************************************************** // CLB-XBAR //########################################################################### // // FILE: hw_epwmxbar.h // // TITLE: Definitions for the XBAR registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the XBAR register offsets // //***************************************************************************** // for TRIP4 // for TRIP4 // for TRIP5 // for TRIP5 // for TRIP7 // for TRIP7 // for TRIP8 // for TRIP8 // for TRIP9 // for TRIP9 // for TRIP10 // for TRIP10 // for TRIP11 // for TRIP11 // for TRIP12 // for TRIP12 // TRIP4 // TRIP5 // TRIP7 // TRIP8 // TRIP9 // TRIP10 // TRIP11 // TRIP12 // Register // register //***************************************************************************** // // The following are defines for the bit fields in the TRIP4MUX0TO15CFG register // //***************************************************************************** // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR //***************************************************************************** // // The following are defines for the bit fields in the TRIP4MUX16TO31CFG register // //***************************************************************************** // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR //***************************************************************************** // // The following are defines for the bit fields in the TRIP5MUX0TO15CFG register // //***************************************************************************** // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR //***************************************************************************** // // The following are defines for the bit fields in the TRIP5MUX16TO31CFG register // //***************************************************************************** // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR //***************************************************************************** // // The following are defines for the bit fields in the TRIP7MUX0TO15CFG register // //***************************************************************************** // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR //***************************************************************************** // // The following are defines for the bit fields in the TRIP7MUX16TO31CFG register // //***************************************************************************** // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR //***************************************************************************** // // The following are defines for the bit fields in the TRIP8MUX0TO15CFG register // //***************************************************************************** // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR //***************************************************************************** // // The following are defines for the bit fields in the TRIP8MUX16TO31CFG register // //***************************************************************************** // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR //***************************************************************************** // // The following are defines for the bit fields in the TRIP9MUX0TO15CFG register // //***************************************************************************** // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR //***************************************************************************** // // The following are defines for the bit fields in the TRIP9MUX16TO31CFG register // //***************************************************************************** // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR //***************************************************************************** // // The following are defines for the bit fields in the TRIP10MUX0TO15CFG register // //***************************************************************************** // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // TRIP10 of EPWM-XBAR // TRIP10 of EPWM-XBAR // TRIP10 of EPWM-XBAR // TRIP10 of EPWM-XBAR // TRIP10 of EPWM-XBAR // TRIP10 of EPWM-XBAR //***************************************************************************** // // The following are defines for the bit fields in the TRIP10MUX16TO31CFG register // //***************************************************************************** // TRIP10 of EPWM-XBAR // TRIP10 of EPWM-XBAR // TRIP10 of EPWM-XBAR // TRIP10 of EPWM-XBAR // TRIP10 of EPWM-XBAR // TRIP10 of EPWM-XBAR // TRIP10 of EPWM-XBAR // TRIP10 of EPWM-XBAR // TRIP10 of EPWM-XBAR // TRIP10 of EPWM-XBAR // TRIP10 of EPWM-XBAR // TRIP10 of EPWM-XBAR // TRIP10 of EPWM-XBAR // TRIP10 of EPWM-XBAR // TRIP10 of EPWM-XBAR // TRIP10 of EPWM-XBAR //***************************************************************************** // // The following are defines for the bit fields in the TRIP11MUX0TO15CFG register // //***************************************************************************** // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // TRIP11 of EPWM-XBAR // TRIP11 of EPWM-XBAR // TRIP11 of EPWM-XBAR // TRIP11 of EPWM-XBAR // TRIP11 of EPWM-XBAR // TRIP11 of EPWM-XBAR //***************************************************************************** // // The following are defines for the bit fields in the TRIP11MUX16TO31CFG register // //***************************************************************************** // TRIP11 of EPWM-XBAR // TRIP11 of EPWM-XBAR // TRIP11 of EPWM-XBAR // TRIP11 of EPWM-XBAR // TRIP11 of EPWM-XBAR // TRIP11 of EPWM-XBAR // TRIP11 of EPWM-XBAR // TRIP11 of EPWM-XBAR // TRIP11 of EPWM-XBAR // TRIP11 of EPWM-XBAR // TRIP11 of EPWM-XBAR // TRIP11 of EPWM-XBAR // TRIP11 of EPWM-XBAR // TRIP11 of EPWM-XBAR // TRIP11 of EPWM-XBAR // TRIP11 of EPWM-XBAR //***************************************************************************** // // The following are defines for the bit fields in the TRIP12MUX0TO15CFG register // //***************************************************************************** // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // TRIP12 of EPWM-XBAR // TRIP12 of EPWM-XBAR // TRIP12 of EPWM-XBAR // TRIP12 of EPWM-XBAR // TRIP12 of EPWM-XBAR // TRIP12 of EPWM-XBAR //***************************************************************************** // // The following are defines for the bit fields in the TRIP12MUX16TO31CFG register // //***************************************************************************** // TRIP12 of EPWM-XBAR // TRIP12 of EPWM-XBAR // TRIP12 of EPWM-XBAR // TRIP12 of EPWM-XBAR // TRIP12 of EPWM-XBAR // TRIP12 of EPWM-XBAR // TRIP12 of EPWM-XBAR // TRIP12 of EPWM-XBAR // TRIP12 of EPWM-XBAR // TRIP12 of EPWM-XBAR // TRIP12 of EPWM-XBAR // TRIP12 of EPWM-XBAR // TRIP12 of EPWM-XBAR // TRIP12 of EPWM-XBAR // TRIP12 of EPWM-XBAR // TRIP12 of EPWM-XBAR //***************************************************************************** // // The following are defines for the bit fields in the TRIP4MUXENABLE register // //***************************************************************************** // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR //***************************************************************************** // // The following are defines for the bit fields in the TRIP5MUXENABLE register // //***************************************************************************** // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR //***************************************************************************** // // The following are defines for the bit fields in the TRIP7MUXENABLE register // //***************************************************************************** // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR //***************************************************************************** // // The following are defines for the bit fields in the TRIP8MUXENABLE register // //***************************************************************************** // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR //***************************************************************************** // // The following are defines for the bit fields in the TRIP9MUXENABLE register // //***************************************************************************** // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR //***************************************************************************** // // The following are defines for the bit fields in the TRIP10MUXENABLE register // //***************************************************************************** // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR //***************************************************************************** // // The following are defines for the bit fields in the TRIP11MUXENABLE register // //***************************************************************************** // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR //***************************************************************************** // // The following are defines for the bit fields in the TRIP12MUXENABLE register // //***************************************************************************** // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR //***************************************************************************** // // The following are defines for the bit fields in the TRIPOUTINV register // //***************************************************************************** // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR // of EPWM-XBAR //***************************************************************************** // // The following are defines for the bit fields in the TRIPLOCK register // //***************************************************************************** // EPWM-XBAR //########################################################################### // // FILE: hw_inputxbar.h // // TITLE: Definitions for the XBAR registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the XBAR register offsets // //***************************************************************************** // (GPIO0 to x) // (GPIO0 to x) // (GPIO0 to x) // (GPIO0 to x) // (GPIO0 to x) // (GPIO0 to x) // (GPIO0 to x) // (GPIO0 to x) // (GPIO0 to x) // (GPIO0 to x) // (GPIO0 to x) // (GPIO0 to x) // (GPIO0 to x) // (GPIO0 to x) // (GPIO0 to x) // (GPIO0 to x) //***************************************************************************** // // The following are defines for the bit fields in the INPUTSELECTLOCK register // //***************************************************************************** // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register // Register //########################################################################### // // FILE: hw_outputxbar.h // // TITLE: Definitions for the XBAR registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the XBAR register offsets // //***************************************************************************** // Configuration for Output 1 // Configuration for Output 1 // Configuration for Output 2 // Configuration for Output 2 // Configuration for Output 3 // Configuration for Output 3 // Configuration for Output 4 // Configuration for Output 4 // Configuration for Output 5 // Configuration for Output 5 // Configuration for Output 6 // Configuration for Output 6 // Configuration for Output 7 // Configuration for Output 7 // Configuration for Output 8 // Configuration for Output 8 // Output 1 // Output 2 // Output 3 // Output 4 // Output 5 // Output 6 // Output 7 // Output 8 // Clear // Clear // Enable // Lock register //***************************************************************************** // // The following are defines for the bit fields in the OUTPUT1MUX0TO15CFG register // //***************************************************************************** // OUTPUT1 of OUTPUT-XBAR // OUTPUT1 of OUTPUT-XBAR // OUTPUT1 of OUTPUT-XBAR // OUTPUT1 of OUTPUT-XBAR // OUTPUT1 of OUTPUT-XBAR // OUTPUT1 of OUTPUT-XBAR // OUTPUT1 of OUTPUT-XBAR // OUTPUT1 of OUTPUT-XBAR // OUTPUT1 of OUTPUT-XBAR // OUTPUT1 of OUTPUT-XBAR // OUTPUT1 of OUTPUT-XBAR // OUTPUT1 of OUTPUT-XBAR // OUTPUT1 of OUTPUT-XBAR // OUTPUT1 of OUTPUT-XBAR // OUTPUT1 of OUTPUT-XBAR // OUTPUT1 of OUTPUT-XBAR //***************************************************************************** // // The following are defines for the bit fields in the OUTPUT1MUX16TO31CFG register // //***************************************************************************** // OUTPUT1 of OUTPUT-XBAR // OUTPUT1 of OUTPUT-XBAR // OUTPUT1 of OUTPUT-XBAR // OUTPUT1 of OUTPUT-XBAR // OUTPUT1 of OUTPUT-XBAR // OUTPUT1 of OUTPUT-XBAR // OUTPUT1 of OUTPUT-XBAR // OUTPUT1 of OUTPUT-XBAR // OUTPUT1 of OUTPUT-XBAR // OUTPUT1 of OUTPUT-XBAR // OUTPUT1 of OUTPUT-XBAR // OUTPUT1 of OUTPUT-XBAR // OUTPUT1 of OUTPUT-XBAR // OUTPUT1 of OUTPUT-XBAR // OUTPUT1 of OUTPUT-XBAR // OUTPUT1 of OUTPUT-XBAR //***************************************************************************** // // The following are defines for the bit fields in the OUTPUT2MUX0TO15CFG register // //***************************************************************************** // OUTPUT2 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR //***************************************************************************** // // The following are defines for the bit fields in the OUTPUT2MUX16TO31CFG register // //***************************************************************************** // OUTPUT2 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR //***************************************************************************** // // The following are defines for the bit fields in the OUTPUT3MUX0TO15CFG register // //***************************************************************************** // OUTPUT3 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR //***************************************************************************** // // The following are defines for the bit fields in the OUTPUT3MUX16TO31CFG register // //***************************************************************************** // OUTPUT3 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR //***************************************************************************** // // The following are defines for the bit fields in the OUTPUT4MUX0TO15CFG register // //***************************************************************************** // OUTPUT4 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR //***************************************************************************** // // The following are defines for the bit fields in the OUTPUT4MUX16TO31CFG register // //***************************************************************************** // OUTPUT4 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR //***************************************************************************** // // The following are defines for the bit fields in the OUTPUT5MUX0TO15CFG register // //***************************************************************************** // OUTPUT5 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR //***************************************************************************** // // The following are defines for the bit fields in the OUTPUT5MUX16TO31CFG register // //***************************************************************************** // OUTPUT5 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR //***************************************************************************** // // The following are defines for the bit fields in the OUTPUT6MUX0TO15CFG register // //***************************************************************************** // OUTPUT6 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR //***************************************************************************** // // The following are defines for the bit fields in the OUTPUT6MUX16TO31CFG register // //***************************************************************************** // OUTPUT6 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR //***************************************************************************** // // The following are defines for the bit fields in the OUTPUT7MUX0TO15CFG register // //***************************************************************************** // OUTPUT7 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR //***************************************************************************** // // The following are defines for the bit fields in the OUTPUT7MUX16TO31CFG register // //***************************************************************************** // OUTPUT7 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR //***************************************************************************** // // The following are defines for the bit fields in the OUTPUT8MUX0TO15CFG register // //***************************************************************************** // OUTPUT8 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR //***************************************************************************** // // The following are defines for the bit fields in the OUTPUT8MUX16TO31CFG register // //***************************************************************************** // OUTPUT8 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR //***************************************************************************** // // The following are defines for the bit fields in the OUTPUT1MUXENABLE register // //***************************************************************************** // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR //***************************************************************************** // // The following are defines for the bit fields in the OUTPUT2MUXENABLE register // //***************************************************************************** // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR //***************************************************************************** // // The following are defines for the bit fields in the OUTPUT3MUXENABLE register // //***************************************************************************** // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR //***************************************************************************** // // The following are defines for the bit fields in the OUTPUT4MUXENABLE register // //***************************************************************************** // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR //***************************************************************************** // // The following are defines for the bit fields in the OUTPUT5MUXENABLE register // //***************************************************************************** // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR //***************************************************************************** // // The following are defines for the bit fields in the OUTPUT6MUXENABLE register // //***************************************************************************** // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR //***************************************************************************** // // The following are defines for the bit fields in the OUTPUT7MUXENABLE register // //***************************************************************************** // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR //***************************************************************************** // // The following are defines for the bit fields in the OUTPUT8MUXENABLE register // //***************************************************************************** // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR //***************************************************************************** // // The following are defines for the bit fields in the OUTPUTLATCH register // //***************************************************************************** // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR // OUTPUT-XBAR //***************************************************************************** // // The following are defines for the bit fields in the OUTPUTLATCHCLR register // //***************************************************************************** // OUTPUT1 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR //***************************************************************************** // // The following are defines for the bit fields in the OUTPUTLATCHFRC register // //***************************************************************************** // OUTPUT1 of OUTPUT-XBAR // OUTPUT2 of OUTPUT-XBAR // OUTPUT3 of OUTPUT-XBAR // OUTPUT4 of OUTPUT-XBAR // OUTPUT5 of OUTPUT-XBAR // OUTPUT6 of OUTPUT-XBAR // OUTPUT7 of OUTPUT-XBAR // OUTPUT8 of OUTPUT-XBAR //***************************************************************************** // // The following are defines for the bit fields in the OUTPUTLATCHENABLE register // //***************************************************************************** // drive OUTPUT1 for OUTPUT-XBAR // drive OUTPUT2 for OUTPUT-XBAR // drive OUTPUT3 for OUTPUT-XBAR // drive OUTPUT4 for OUTPUT-XBAR // drive OUTPUT5 for OUTPUT-XBAR // drive OUTPUT6 for OUTPUT-XBAR // drive OUTPUT7 for OUTPUT-XBAR // drive OUTPUT8 for OUTPUT-XBAR //***************************************************************************** // // The following are defines for the bit fields in the OUTPUTINV register // //***************************************************************************** // of OUTPUT-XBAR // of OUTPUT-XBAR // of OUTPUT-XBAR // of OUTPUT-XBAR // of OUTPUT-XBAR // of OUTPUT-XBAR // of OUTPUT-XBAR // of OUTPUT-XBAR //***************************************************************************** // // The following are defines for the bit fields in the OUTPUTLOCK register // //***************************************************************************** // OUTPUT-XBAR //########################################################################### // // FILE: hw_xbar.h // // TITLE: Definitions for the XBAR registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the XBAR register offsets // //***************************************************************************** // Register 1 // Register 2 // Register 3 // Register 4 //***************************************************************************** // // The following are defines for the bit fields in the XBARFLG1 register // //***************************************************************************** // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // CMPSS1.CTRIPOUTL Signal // CMPSS1.CTRIPOUTH Signal // CMPSS2.CTRIPOUTL Signal // CMPSS2.CTRIPOUTH Signal // CMPSS3.CTRIPOUTL Signal // CMPSS3.CTRIPOUTH Signal // CMPSS4.CTRIPOUTL Signal // CMPSS4.CTRIPOUTH Signal // CMPSS5.CTRIPOUTL Signal // CMPSS5.CTRIPOUTH Signal // CMPSS6.CTRIPOUTL Signal // CMPSS6.CTRIPOUTH Signal // CMPSS7.CTRIPOUTL Signal // CMPSS7.CTRIPOUTH Signal // CMPSS8.CTRIPOUTL Signal // CMPSS8.CTRIPOUTH Signal //***************************************************************************** // // The following are defines for the bit fields in the XBARFLG2 register // //***************************************************************************** // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal //***************************************************************************** // // The following are defines for the bit fields in the XBARFLG3 register // //***************************************************************************** // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal //***************************************************************************** // // The following are defines for the bit fields in the XBARFLG4 register // //***************************************************************************** // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // ERRORSTS_ERROR Signal // Signal // Signal // Signal //***************************************************************************** // // The following are defines for the bit fields in the XBARCLR1 register // //***************************************************************************** // CMPSS1.CTRIPL Signal // CMPSS1.CTRIPH Signal // CMPSS2.CTRIPL Signal // CMPSS2.CTRIPH Signal // CMPSS3.CTRIPL Signal // CMPSS3.CTRIPH Signal // CMPSS4.CTRIPL Signal // CMPSS4.CTRIPH Signal // CMPSS5.CTRIPL Signal // CMPSS5.CTRIPH Signal // CMPSS6.CTRIPL Signal // CMPSS6.CTRIPH Signal // CMPSS7.CTRIPL Signal // CMPSS7.CTRIPH Signal // CMPSS8.CTRIPL Signal // CMPSS8.CTRIPH Signal // CMPSS1.CTRIPOUTL Signal // CMPSS1.CTRIPOUTH Signal // CMPSS2.CTRIPOUTL Signal // CMPSS2.CTRIPOUTH Signal // CMPSS3.CTRIPOUTL Signal // CMPSS3.CTRIPOUTH Signal // CMPSS4.CTRIPOUTL Signal // CMPSS4.CTRIPOUTH Signal // CMPSS5.CTRIPOUTL Signal // CMPSS5.CTRIPOUTH Signal // CMPSS6.CTRIPOUTL Signal // CMPSS6.CTRIPOUTH Signal // CMPSS7.CTRIPOUTL Signal // CMPSS7.CTRIPOUTH Signal // CMPSS8.CTRIPOUTL Signal // CMPSS8.CTRIPOUTH Signal //***************************************************************************** // // The following are defines for the bit fields in the XBARCLR2 register // //***************************************************************************** // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // ECAP1.OUT Signal // ECAP2.OUT Signal // ECAP3.OUT Signal // ECAP4.OUT Signal // ECAP5.OUT Signal // ECAP6.OUT Signal // EXTSYNCOUT Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal //***************************************************************************** // // The following are defines for the bit fields in the XBARCLR3 register // //***************************************************************************** // Signal // Signal // Signal // Signal // Signal // Signal // Signal // SD1FLT1.COMPL Signal // SD1FLT1.COMPH Signal // SD1FLT2.COMPL Signal // SD1FLT2.COMPH Signal // SD1FLT3.COMPL Signal // SD1FLT3.COMPH Signal // SD1FLT4.COMPL Signal // SD1FLT4.COMPH Signal // SD2FLT1.COMPL Signal // SD2FLT1.COMPH Signal // SD2FLT2.COMPL Signal // SD2FLT2.COMPH Signal // SD2FLT3.COMPL Signal // SD2FLT3.COMPH Signal // SD2FLT4.COMPL Signal // SD2FLT4.COMPH Signal // ECAP7.OUT Signal // SD1FLT1.COMPZ Signal // SD1FLT1.DRINT Signal // SD1FLT2.COMPZ Signal // SD1FLT2.DRINT Signal // SD1FLT3.COMPZ Signal // SD1FLT3.DRINT Signal // SD1FLT4.COMPZ Signal // SD1FLT4.DRINT Signal //***************************************************************************** // // The following are defines for the bit fields in the XBARCLR4 register // //***************************************************************************** // SD2FLT1.COMPZ Signal // SD2FLT1.DRINT Signal // SD2FLT2.COMPZ Signal // SD2FLT2.DRINT Signal // SD2FLT3.COMPZ Signal // SD2FLT3.DRINT Signal // SD2FLT4.COMPZ Signal // SD2FLT4.DRINT Signal // EMAC_PPS0 Signal // MCANA_FEVT0 Signal // MCANA_FEVT1 Signal // MCANA_FEVT2 Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // Signal // ERRORSTS_ERROR Signal // ECATSYNC0 Signal // ECATSYNC1 Signal // Signal //***************************************************************************** // // Useful defines used within the driver functions. // Not intended for use by application code. // //***************************************************************************** //***************************************************************************** // // The following values define the muxes parameter for XBAR_enableEPWMMux(), // XBAR_enableOutputMux(), XBAR_disableEPWMMux(), and // XBAR_disableOutputMux(). // //***************************************************************************** //***************************************************************************** // //! The following values define the \e output parameter for //! XBAR_setOutputMuxConfig(), XBAR_enableOutputMux(), and //! XBAR_disableOutputMux(). // //***************************************************************************** typedef enum { XBAR_OUTPUT1 = 0, //!< OUTPUT1 of the Output X-BAR XBAR_OUTPUT2 = 2, //!< OUTPUT2 of the Output X-BAR XBAR_OUTPUT3 = 4, //!< OUTPUT3 of the Output X-BAR XBAR_OUTPUT4 = 6, //!< OUTPUT4 of the Output X-BAR XBAR_OUTPUT5 = 8, //!< OUTPUT5 of the Output X-BAR XBAR_OUTPUT6 = 10, //!< OUTPUT6 of the Output X-BAR XBAR_OUTPUT7 = 12, //!< OUTPUT7 of the Output X-BAR XBAR_OUTPUT8 = 14 //!< OUTPUT8 of the Output X-BAR } XBAR_OutputNum; //***************************************************************************** // //! The following values define the \e trip parameter for //! XBAR_setEPWMMuxConfig(), XBAR_enableEPWMMux(), and XBAR_disableEPWMMux(). // //***************************************************************************** typedef enum { XBAR_TRIP4 = 0, //!< TRIP4 of the ePWM X-BAR XBAR_TRIP5 = 2, //!< TRIP5 of the ePWM X-BAR XBAR_TRIP7 = 4, //!< TRIP7 of the ePWM X-BAR XBAR_TRIP8 = 6, //!< TRIP8 of the ePWM X-BAR XBAR_TRIP9 = 8, //!< TRIP9 of the ePWM X-BAR XBAR_TRIP10 = 10, //!< TRIP10 of the ePWM X-BAR XBAR_TRIP11 = 12, //!< TRIP11 of the ePWM X-BAR XBAR_TRIP12 = 14 //!< TRIP12 of the ePWM X-BAR } XBAR_TripNum; //***************************************************************************** // // The following values define the trip parameter for XBAR_setCLBMuxConfig(), // XBAR_enableCLBMux(), and XBAR_disableCLBMux(). // //***************************************************************************** typedef enum { XBAR_AUXSIG0 = 0, XBAR_AUXSIG1 = 2, XBAR_AUXSIG2 = 4, XBAR_AUXSIG3 = 6, XBAR_AUXSIG4 = 8, XBAR_AUXSIG5 = 10, XBAR_AUXSIG6 = 12, XBAR_AUXSIG7 = 14 } XBAR_AuxSigNum; //***************************************************************************** // //! The following values define the \e input parameter for XBAR_setInputPin(). // //***************************************************************************** typedef enum { XBAR_INPUT1, //!< ePWM[TZ1], ePWM[TRIP1], X-BARs, eCAPs XBAR_INPUT2, //!< ePWM[TZ2], ePWM[TRIP2], X-BARs, eCAPs XBAR_INPUT3, //!< ePWM[TZ3], ePWM[TRIP3], X-BARs, eCAPs XBAR_INPUT4, //!< ADC wrappers, X-BARs, XINT1, eCAPs XBAR_INPUT5, //!< EXTSYNCIN1, X-BARs, XINT2, eCAPs XBAR_INPUT6, //!< EXTSYNCIN2, ePWM[TRIP6], X-BARs, XINT3, eCAPs XBAR_INPUT7, //!< X-BARs, eCAPs XBAR_INPUT8, //!< X-BARs, eCAPs XBAR_INPUT9, //!< X-BARs, eCAPs XBAR_INPUT10, //!< X-BARs, eCAPs XBAR_INPUT11, //!< X-BARs, eCAPs XBAR_INPUT12, //!< X-BARs, eCAPs XBAR_INPUT13, //!< XINT4, X-BARs, eCAPs XBAR_INPUT14, //!< XINT5, X-BARs, eCAPs XBAR_INPUT15, //!< eCAPs XBAR_INPUT16 //!< eCAPs } XBAR_InputNum; //***************************************************************************** // //! The following values define the \e muxConfig parameter for //! XBAR_setOutputMuxConfig(). // //***************************************************************************** typedef enum { // //OUTPUTXBAR // XBAR_OUT_MUX00_CMPSS1_CTRIPOUTH = 0x0000, XBAR_OUT_MUX00_CMPSS1_CTRIPOUTH_OR_L = 0x0001, XBAR_OUT_MUX00_ADCAEVT1 = 0x0002, XBAR_OUT_MUX00_ECAP1_OUT = 0x0003, XBAR_OUT_MUX01_CMPSS1_CTRIPOUTL = 0x0200, XBAR_OUT_MUX01_INPUTXBAR1 = 0x0201, XBAR_OUT_MUX01_CLB1_OUT4 = 0x0202, XBAR_OUT_MUX01_ADCCEVT1 = 0x0203, XBAR_OUT_MUX02_CMPSS2_CTRIPOUTH = 0x0400, XBAR_OUT_MUX02_CMPSS2_CTRIPOUTH_OR_L = 0x0401, XBAR_OUT_MUX02_ADCAEVT2 = 0x0402, XBAR_OUT_MUX02_ECAP2_OUT = 0x0403, XBAR_OUT_MUX03_CMPSS2_CTRIPOUTL = 0x0600, XBAR_OUT_MUX03_INPUTXBAR2 = 0x0601, XBAR_OUT_MUX03_CLB1_OUT5 = 0x0602, XBAR_OUT_MUX03_ADCCEVT2 = 0x0603, XBAR_OUT_MUX04_CMPSS3_CTRIPOUTH = 0x0800, XBAR_OUT_MUX04_CMPSS3_CTRIPOUTH_OR_L = 0x0801, XBAR_OUT_MUX04_ADCAEVT3 = 0x0802, XBAR_OUT_MUX04_ECAP3_OUT = 0x0803, XBAR_OUT_MUX05_CMPSS3_CTRIPOUTL = 0x0A00, XBAR_OUT_MUX05_INPUTXBAR3 = 0x0A01, XBAR_OUT_MUX05_CLB2_OUT4 = 0x0A02, XBAR_OUT_MUX05_ADCCEVT3 = 0x0A03, XBAR_OUT_MUX06_CMPSS4_CTRIPOUTH = 0x0C00, XBAR_OUT_MUX06_CMPSS4_CTRIPOUTH_OR_L = 0x0C01, XBAR_OUT_MUX06_ADCAEVT4 = 0x0C02, XBAR_OUT_MUX06_ECAP4_OUT = 0x0C03, XBAR_OUT_MUX07_CMPSS4_CTRIPOUTL = 0x0E00, XBAR_OUT_MUX07_INPUTXBAR4 = 0x0E01, XBAR_OUT_MUX07_CLB2_OUT5 = 0x0E02, XBAR_OUT_MUX07_ADCCEVT4 = 0x0E03, XBAR_OUT_MUX08_CMPSS5_CTRIPOUTH = 0x1000, XBAR_OUT_MUX08_CMPSS5_CTRIPOUTH_OR_L = 0x1001, XBAR_OUT_MUX08_ADCBEVT1 = 0x1002, XBAR_OUT_MUX08_ECAP5_OUT = 0x1003, XBAR_OUT_MUX09_CMPSS5_CTRIPOUTL = 0x1200, XBAR_OUT_MUX09_INPUTXBAR5 = 0x1201, XBAR_OUT_MUX09_CLB3_OUT4 = 0x1202, XBAR_OUT_MUX10_CMPSS6_CTRIPOUTH = 0x1400, XBAR_OUT_MUX10_CMPSS6_CTRIPOUTH_OR_L = 0x1401, XBAR_OUT_MUX10_ADCBEVT2 = 0x1402, XBAR_OUT_MUX10_ECAP6_OUT = 0x1403, XBAR_OUT_MUX11_CMPSS6_CTRIPOUTL = 0x1600, XBAR_OUT_MUX11_INPUTXBAR6 = 0x1601, XBAR_OUT_MUX11_CLB3_OUT5 = 0x1602, XBAR_OUT_MUX12_CMPSS7_CTRIPOUTH = 0x1800, XBAR_OUT_MUX12_CMPSS7_CTRIPOUTH_OR_L = 0x1801, XBAR_OUT_MUX12_ADCBEVT3 = 0x1802, XBAR_OUT_MUX12_ECAP7_OUT = 0x1803, XBAR_OUT_MUX13_CMPSS7_CTRIPOUTL = 0x1A00, XBAR_OUT_MUX13_ADCSOCA = 0x1A01, XBAR_OUT_MUX13_CLB4_OUT4 = 0x1A02, XBAR_OUT_MUX14_ADCBEVT4 = 0x1C02, XBAR_OUT_MUX14_EXTSYNCOUT = 0x1C03, XBAR_OUT_MUX15_ADCSOCB = 0x1E01, XBAR_OUT_MUX15_CLB4_OUT5 = 0x1E02, XBAR_OUT_MUX16_SD1FLT1_COMPH = 0x2000, XBAR_OUT_MUX16_SD1FLT1_COMPH_OR_COMPL = 0x2001, XBAR_OUT_MUX17_SD1FLT1_COMPL = 0x2200, XBAR_OUT_MUX17_CLAHALT = 0x2203, XBAR_OUT_MUX18_SD1FLT2_COMPH = 0x2400, XBAR_OUT_MUX18_SD1FLT2_COMPH_OR_COMPL = 0x2401, XBAR_OUT_MUX19_SD1FLT2_COMPL = 0x2600, XBAR_OUT_MUX20_SD1FLT3_COMPH = 0x2800, XBAR_OUT_MUX20_SD1FLT3_COMPH_OR_COMPL = 0x2801, XBAR_OUT_MUX21_SD1FLT3_COMPL = 0x2A00, XBAR_OUT_MUX22_SD1FLT4_COMPH = 0x2C00, XBAR_OUT_MUX22_SD1FLT4_COMPH_OR_COMPL = 0x2C01, XBAR_OUT_MUX23_SD1FLT4_COMPL = 0x2E00, XBAR_OUT_MUX24_SD2FLT1_COMPH = 0x3000, XBAR_OUT_MUX24_SD2FLT1_COMPH_OR_COMPL = 0x3001, XBAR_OUT_MUX25_SD2FLT1_COMPL = 0x3200, XBAR_OUT_MUX26_SD2FLT2_COMPH = 0x3400, XBAR_OUT_MUX26_SD2FLT2_COMPH_OR_COMPL = 0x3401, XBAR_OUT_MUX27_SD2FLT2_COMPL = 0x3600, XBAR_OUT_MUX27_ERRORSTS = 0x3602, XBAR_OUT_MUX28_SD2FLT3_COMPH = 0x3800, XBAR_OUT_MUX28_SD2FLT3_COMPH_OR_COMPL = 0x3801, XBAR_OUT_MUX28_XCLKOUT = 0x3802, XBAR_OUT_MUX29_SD2FLT3_COMPL = 0x3A00, XBAR_OUT_MUX30_SD2FLT4_COMPH = 0x3C00, XBAR_OUT_MUX30_SD2FLT4_COMPH_OR_COMPL = 0x3C01, XBAR_OUT_MUX31_SD2FLT4_COMPL = 0x3E00, } XBAR_OutputMuxConfig; //***************************************************************************** // //! The following values define the \e muxConfig parameter for //! XBAR_setEPWMMuxConfig(). // //***************************************************************************** typedef enum { XBAR_EPWM_MUX00_CMPSS1_CTRIPH = 0x0000, XBAR_EPWM_MUX00_CMPSS1_CTRIPH_OR_L = 0x0001, XBAR_EPWM_MUX00_ADCAEVT1 = 0x0002, XBAR_EPWM_MUX00_ECAP1_OUT = 0x0003, XBAR_EPWM_MUX01_CMPSS1_CTRIPL = 0x0200, XBAR_EPWM_MUX01_INPUTXBAR1 = 0x0201, XBAR_EPWM_MUX01_CLB1_OUT4 = 0x0202, XBAR_EPWM_MUX01_ADCCEVT1 = 0x0203, XBAR_EPWM_MUX02_CMPSS2_CTRIPH = 0x0400, XBAR_EPWM_MUX02_CMPSS2_CTRIPH_OR_L = 0x0401, XBAR_EPWM_MUX02_ADCAEVT2 = 0x0402, XBAR_EPWM_MUX02_ECAP2_OUT = 0x0403, XBAR_EPWM_MUX03_CMPSS2_CTRIPL = 0x0600, XBAR_EPWM_MUX03_INPUTXBAR2 = 0x0601, XBAR_EPWM_MUX03_CLB1_OUT5 = 0x0602, XBAR_EPWM_MUX03_ADCCEVT2 = 0x0603, XBAR_EPWM_MUX04_CMPSS3_CTRIPH = 0x0800, XBAR_EPWM_MUX04_CMPSS3_CTRIPH_OR_L = 0x0801, XBAR_EPWM_MUX04_ADCAEVT3 = 0x0802, XBAR_EPWM_MUX04_ECAP3_OUT = 0x0803, XBAR_EPWM_MUX05_CMPSS3_CTRIPL = 0x0A00, XBAR_EPWM_MUX05_INPUTXBAR3 = 0x0A01, XBAR_EPWM_MUX05_CLB2_OUT4 = 0x0A02, XBAR_EPWM_MUX05_ADCCEVT3 = 0x0A03, XBAR_EPWM_MUX06_CMPSS4_CTRIPH = 0x0C00, XBAR_EPWM_MUX06_CMPSS4_CTRIPH_OR_L = 0x0C01, XBAR_EPWM_MUX06_ADCAEVT4 = 0x0C02, XBAR_EPWM_MUX06_ECAP4_OUT = 0x0C03, XBAR_EPWM_MUX07_CMPSS4_CTRIPL = 0x0E00, XBAR_EPWM_MUX07_INPUTXBAR4 = 0x0E01, XBAR_EPWM_MUX07_CLB2_OUT5 = 0x0E02, XBAR_EPWM_MUX07_ADCCEVT4 = 0x0E03, XBAR_EPWM_MUX08_CMPSS5_CTRIPH = 0x1000, XBAR_EPWM_MUX08_CMPSS5_CTRIPH_OR_L = 0x1001, XBAR_EPWM_MUX08_ADCBEVT1 = 0x1002, XBAR_EPWM_MUX08_ECAP5_OUT = 0x1003, XBAR_EPWM_MUX09_CMPSS5_CTRIPL = 0x1200, XBAR_EPWM_MUX09_INPUTXBAR5 = 0x1201, XBAR_EPWM_MUX09_CLB3_OUT4 = 0x1202, XBAR_EPWM_MUX10_CMPSS6_CTRIPH = 0x1400, XBAR_EPWM_MUX10_CMPSS6_CTRIPH_OR_L = 0x1401, XBAR_EPWM_MUX10_ADCBEVT2 = 0x1402, XBAR_EPWM_MUX10_ECAP6_OUT = 0x1403, XBAR_EPWM_MUX11_CMPSS6_CTRIPL = 0x1600, XBAR_EPWM_MUX11_INPUTXBAR6 = 0x1601, XBAR_EPWM_MUX11_CLB3_OUT5 = 0x1602, XBAR_EPWM_MUX12_CMPSS7_CTRIPH = 0x1800, XBAR_EPWM_MUX12_CMPSS7_CTRIPH_OR_L = 0x1801, XBAR_EPWM_MUX12_ADCBEVT3 = 0x1802, XBAR_EPWM_MUX12_ECAP7_OUT = 0x1803, XBAR_EPWM_MUX13_CMPSS7_CTRIPL = 0x1A00, XBAR_EPWM_MUX13_ADCSOCA = 0x1A01, XBAR_EPWM_MUX13_CLB4_OUT4 = 0x1A02, XBAR_EPWM_MUX14_ADCBEVT4 = 0x1C02, XBAR_EPWM_MUX14_EXTSYNCOUT = 0x1C03, XBAR_EPWM_MUX15_ADCSOCB = 0x1E01, XBAR_EPWM_MUX15_CLB4_OUT5 = 0x1E02, XBAR_EPWM_MUX16_SD1FLT1_COMPH = 0x2000, XBAR_EPWM_MUX16_SD1FLT1_COMPH_OR_COMPL = 0x2001, XBAR_EPWM_MUX16_ERRORSTS = 0x2003, XBAR_EPWM_MUX17_SD1FLT1_COMPL = 0x2200, XBAR_EPWM_MUX17_INPUTXBAR7 = 0x2201, XBAR_EPWM_MUX17_CLAHALT = 0x2203, XBAR_EPWM_MUX18_SD1FLT2_COMPH = 0x2400, XBAR_EPWM_MUX18_SD1FLT2_COMPH_OR_COMPL = 0x2401, XBAR_EPWM_MUX18_ECATSYNC0 = 0x2403, XBAR_EPWM_MUX19_SD1FLT2_COMPL = 0x2600, XBAR_EPWM_MUX19_INPUTXBAR8 = 0x2601, XBAR_EPWM_MUX19_ECATSYNC1 = 0x2603, XBAR_EPWM_MUX20_SD1FLT3_COMPH = 0x2800, XBAR_EPWM_MUX20_SD1FLT3_COMPH_OR_COMPL = 0x2801, XBAR_EPWM_MUX21_SD1FLT3_COMPL = 0x2A00, XBAR_EPWM_MUX21_INPUTXBAR9 = 0x2A01, XBAR_EPWM_MUX22_SD1FLT4_COMPH = 0x2C00, XBAR_EPWM_MUX22_SD1FLT4_COMPH_OR_COMPL = 0x2C01, XBAR_EPWM_MUX23_SD1FLT4_COMPL = 0x2E00, XBAR_EPWM_MUX23_INPUTXBAR10 = 0x2E01, XBAR_EPWM_MUX24_SD2FLT1_COMPH = 0x3000, XBAR_EPWM_MUX24_SD2FLT1_COMPH_OR_COMPL = 0x3001, XBAR_EPWM_MUX25_SD2FLT1_COMPL = 0x3200, XBAR_EPWM_MUX25_MCANA_FEVT0 = 0x3202, XBAR_EPWM_MUX26_SD2FLT2_COMPH = 0x3400, XBAR_EPWM_MUX26_SD2FLT2_COMPH_OR_COMPL = 0x3401, XBAR_EPWM_MUX27_SD2FLT2_COMPL = 0x3600, XBAR_EPWM_MUX27_MCANA_FEVT1 = 0x3602, XBAR_EPWM_MUX28_SD2FLT3_COMPH = 0x3800, XBAR_EPWM_MUX28_SD2FLT3_COMPH_OR_COMPL = 0x3801, XBAR_EPWM_MUX29_SD2FLT3_COMPL = 0x3A00, XBAR_EPWM_MUX29_MCANA_FEVT2 = 0x3A02, XBAR_EPWM_MUX30_SD2FLT4_COMPH = 0x3C00, XBAR_EPWM_MUX30_SD2FLT4_COMPH_OR_COMPL = 0x3C01, XBAR_EPWM_MUX31_SD2FLT4_COMPL = 0x3E00 } XBAR_EPWMMuxConfig; //***************************************************************************** // // The following values define the muxConfig parameter for // XBAR_setCLBMuxConfig(). // //***************************************************************************** typedef enum { XBAR_CLB_MUX00_CMPSS1_CTRIPH = 0x0000, XBAR_CLB_MUX00_CMPSS1_CTRIPH_OR_L = 0x0001, XBAR_CLB_MUX00_ADCAEVT1 = 0x0002, XBAR_CLB_MUX00_ECAP1_OUT = 0x0003, XBAR_CLB_MUX01_CMPSS1_CTRIPL = 0x0200, XBAR_CLB_MUX01_INPUTXBAR1 = 0x0201, XBAR_CLB_MUX01_CLB1_OUT4 = 0x0202, XBAR_CLB_MUX01_ADCCEVT1 = 0x0203, XBAR_CLB_MUX02_CMPSS2_CTRIPH = 0x0400, XBAR_CLB_MUX02_CMPSS2_CTRIPH_OR_L = 0x0401, XBAR_CLB_MUX02_ADCAEVT2 = 0x0402, XBAR_CLB_MUX02_ECAP2_OUT = 0x0403, XBAR_CLB_MUX03_CMPSS2_CTRIPL = 0x0600, XBAR_CLB_MUX03_INPUTXBAR2 = 0x0601, XBAR_CLB_MUX03_CLB1_OUT5 = 0x0602, XBAR_CLB_MUX03_ADCCEVT2 = 0x0603, XBAR_CLB_MUX04_CMPSS3_CTRIPH = 0x0800, XBAR_CLB_MUX04_CMPSS3_CTRIPH_OR_L = 0x0801, XBAR_CLB_MUX04_ADCAEVT3 = 0x0802, XBAR_CLB_MUX04_ECAP3_OUT = 0x0803, XBAR_CLB_MUX05_CMPSS3_CTRIPL = 0x0A00, XBAR_CLB_MUX05_INPUTXBAR3 = 0x0A01, XBAR_CLB_MUX05_CLB2_OUT4 = 0x0A02, XBAR_CLB_MUX05_ADCCEVT3 = 0x0A03, XBAR_CLB_MUX06_CMPSS4_CTRIPH = 0x0C00, XBAR_CLB_MUX06_CMPSS4_CTRIPH_OR_L = 0x0C01, XBAR_CLB_MUX06_ADCAEVT4 = 0x0C02, XBAR_CLB_MUX06_ECAP4_OUT = 0x0C03, XBAR_CLB_MUX07_CMPSS4_CTRIPL = 0x0E00, XBAR_CLB_MUX07_INPUTXBAR4 = 0x0E01, XBAR_CLB_MUX07_CLB2_OUT5 = 0x0E02, XBAR_CLB_MUX07_ADCCEVT4 = 0x0E03, XBAR_CLB_MUX08_CMPSS5_CTRIPH = 0x1000, XBAR_CLB_MUX08_CMPSS5_CTRIPH_OR_L = 0x1001, XBAR_CLB_MUX08_ADCBEVT1 = 0x1002, XBAR_CLB_MUX08_ECAP5_OUT = 0x1003, XBAR_CLB_MUX09_CMPSS5_CTRIPL = 0x1200, XBAR_CLB_MUX09_INPUTXBAR5 = 0x1201, XBAR_CLB_MUX09_CLB3_OUT4 = 0x1202, XBAR_CLB_MUX10_CMPSS6_CTRIPH = 0x1400, XBAR_CLB_MUX10_CMPSS6_CTRIPH_OR_L = 0x1401, XBAR_CLB_MUX10_ADCBEVT2 = 0x1402, XBAR_CLB_MUX10_ECAP6_OUT = 0x1403, XBAR_CLB_MUX11_CMPSS6_CTRIPL = 0x1600, XBAR_CLB_MUX11_INPUTXBAR6 = 0x1601, XBAR_CLB_MUX11_CLB3_OUT5 = 0x1602, XBAR_CLB_MUX12_CMPSS7_CTRIPH = 0x1800, XBAR_CLB_MUX12_CMPSS7_CTRIPH_OR_L = 0x1801, XBAR_CLB_MUX12_ADCBEVT3 = 0x1802, XBAR_CLB_MUX12_ECAP7_OUT = 0x1803, XBAR_CLB_MUX13_CMPSS7_CTRIPL = 0x1A00, XBAR_CLB_MUX13_ADCSOCA = 0x1A01, XBAR_CLB_MUX13_CLB4_OUT4 = 0x1A02, XBAR_CLB_MUX14_ADCBEVT4 = 0x1C02, XBAR_CLB_MUX14_EXTSYNCOUT = 0x1C03, XBAR_CLB_MUX15_ADCSOCB = 0x1E01, XBAR_CLB_MUX15_CLB4_OUT5 = 0x1E02, XBAR_CLB_MUX16_SD1FLT1_COMPH = 0x2000, XBAR_CLB_MUX16_SD1FLT1_COMPH_OR_COMPL = 0x2001, XBAR_CLB_MUX16_SD1FLT1_COMPZ = 0x2002, XBAR_CLB_MUX16_SD1FLT1_DRINT = 0x2003, XBAR_CLB_MUX17_SD1FLT1_COMPL = 0x2200, XBAR_CLB_MUX17_INPUTXBAR7 = 0x2201, XBAR_CLB_MUX17_CLAHALT = 0x2203, XBAR_CLB_MUX18_SD1FLT2_COMPH = 0x2400, XBAR_CLB_MUX18_SD1FLT2_COMPH_OR_COMPL = 0x2401, XBAR_CLB_MUX18_SD1FLT2_COMPZ = 0x2402, XBAR_CLB_MUX18_SD1FLT2_DRINT = 0x2403, XBAR_CLB_MUX19_SD1FLT2_COMPL = 0x2600, XBAR_CLB_MUX19_INPUTXBAR8 = 0x2601, XBAR_CLB_MUX20_SD1FLT3_COMPH = 0x2800, XBAR_CLB_MUX20_SD1FLT3_COMPH_OR_COMPL = 0x2801, XBAR_CLB_MUX20_SD1FLT3_COMPZ = 0x2802, XBAR_CLB_MUX20_SD1FLT3_DRINT = 0x2803, XBAR_CLB_MUX21_SD1FLT3_COMPL = 0x2A00, XBAR_CLB_MUX21_INPUTXBAR9 = 0x2A01, XBAR_CLB_MUX22_SD1FLT4_COMPH = 0x2C00, XBAR_CLB_MUX22_SD1FLT4_COMPH_OR_COMPL = 0x2C01, XBAR_CLB_MUX22_SD1FLT4_COMPZ = 0x2C02, XBAR_CLB_MUX22_SD1FLT4_DRINT = 0x2C03, XBAR_CLB_MUX23_SD1FLT4_COMPL = 0x2E00, XBAR_CLB_MUX23_INPUTXBAR10 = 0x2E01, XBAR_CLB_MUX23_CLB_EMAC_PPS1 = 0x2E03, XBAR_CLB_MUX24_SD2FLT1_COMPH = 0x3000, XBAR_CLB_MUX24_SD2FLT1_COMPH_OR_COMPL = 0x3001, XBAR_CLB_MUX24_SD2FLT1_COMPZ = 0x3002, XBAR_CLB_MUX24_SD2FLT1_DRINT = 0x3003, XBAR_CLB_MUX25_SD2FLT1_COMPL = 0x3200, XBAR_CLB_MUX25_INPUTXBAR11 = 0x3201, XBAR_CLB_MUX25_MCANA_FEVT0 = 0x3202, XBAR_CLB_MUX26_SD2FLT2_COMPH = 0x3400, XBAR_CLB_MUX26_SD2FLT2_COMPH_OR_COMPL = 0x3401, XBAR_CLB_MUX26_SD2FLT2_COMPZ = 0x3402, XBAR_CLB_MUX26_SD2FLT2_DRINT = 0x3403, XBAR_CLB_MUX27_SD2FLT2_COMPL = 0x3600, XBAR_CLB_MUX27_INPUTXBAR12 = 0x3601, XBAR_CLB_MUX27_MCANA_FEVT1 = 0x3602, XBAR_CLB_MUX28_SD2FLT3_COMPH = 0x3800, XBAR_CLB_MUX28_SD2FLT3_COMPH_OR_COMPL = 0x3801, XBAR_CLB_MUX28_SD2FLT3_COMPZ = 0x3802, XBAR_CLB_MUX28_SD2FLT3_DRINT = 0x3803, XBAR_CLB_MUX29_SD2FLT3_COMPL = 0x3A00, XBAR_CLB_MUX29_INPUTXBAR13 = 0x3A01, XBAR_CLB_MUX29_MCANA_FEVT2 = 0x3A02, XBAR_CLB_MUX30_SD2FLT4_COMPH = 0x3C00, XBAR_CLB_MUX30_SD2FLT4_COMPH_OR_COMPL = 0x3C01, XBAR_CLB_MUX30_SD2FLT4_COMPZ = 0x3C02, XBAR_CLB_MUX30_SD2FLT4_DRINT = 0x3C03, XBAR_CLB_MUX31_SD2FLT4_COMPL = 0x3E00, XBAR_CLB_MUX31_CLB_EMAC_PPS0 = 0x3E02, XBAR_CLB_MUX31_INPUTXBAR14 = 0x3E01 } XBAR_CLBMuxConfig; //***************************************************************************** // //! The following values define the \e inputFlag parameter for //! XBAR_getInputFlagStatus() and XBAR_clearInputFlag(). // //***************************************************************************** typedef enum { // // XBARFLG1 // XBAR_INPUT_FLG_CMPSS1_CTRIPL = 0x0000, XBAR_INPUT_FLG_CMPSS1_CTRIPH = 0x0001, XBAR_INPUT_FLG_CMPSS2_CTRIPL = 0x0002, XBAR_INPUT_FLG_CMPSS2_CTRIPH = 0x0003, XBAR_INPUT_FLG_CMPSS3_CTRIPL = 0x0004, XBAR_INPUT_FLG_CMPSS3_CTRIPH = 0x0005, XBAR_INPUT_FLG_CMPSS4_CTRIPL = 0x0006, XBAR_INPUT_FLG_CMPSS4_CTRIPH = 0x0007, XBAR_INPUT_FLG_CMPSS5_CTRIPL = 0x0008, XBAR_INPUT_FLG_CMPSS5_CTRIPH = 0x0009, XBAR_INPUT_FLG_CMPSS6_CTRIPL = 0x000A, XBAR_INPUT_FLG_CMPSS6_CTRIPH = 0x000B, XBAR_INPUT_FLG_CMPSS7_CTRIPL = 0x000C, XBAR_INPUT_FLG_CMPSS7_CTRIPH = 0x000D, XBAR_INPUT_FLG_CMPSS8_CTRIPL = 0x000E, XBAR_INPUT_FLG_CMPSS8_CTRIPH = 0x000F, XBAR_INPUT_FLG_CMPSS1_CTRIPOUTL = 0x0010, XBAR_INPUT_FLG_CMPSS1_CTRIPOUTH = 0x0011, XBAR_INPUT_FLG_CMPSS2_CTRIPOUTL = 0x0012, XBAR_INPUT_FLG_CMPSS2_CTRIPOUTH = 0x0013, XBAR_INPUT_FLG_CMPSS3_CTRIPOUTL = 0x0014, XBAR_INPUT_FLG_CMPSS3_CTRIPOUTH = 0x0015, XBAR_INPUT_FLG_CMPSS4_CTRIPOUTL = 0x0016, XBAR_INPUT_FLG_CMPSS4_CTRIPOUTH = 0x0017, XBAR_INPUT_FLG_CMPSS5_CTRIPOUTL = 0x0018, XBAR_INPUT_FLG_CMPSS5_CTRIPOUTH = 0x0019, XBAR_INPUT_FLG_CMPSS6_CTRIPOUTL = 0x001A, XBAR_INPUT_FLG_CMPSS6_CTRIPOUTH = 0x001B, XBAR_INPUT_FLG_CMPSS7_CTRIPOUTL = 0x001C, XBAR_INPUT_FLG_CMPSS7_CTRIPOUTH = 0x001D, XBAR_INPUT_FLG_CMPSS8_CTRIPOUTL = 0x001E, XBAR_INPUT_FLG_CMPSS8_CTRIPOUTH = 0x001F, // // XBARFLG2 // XBAR_INPUT_FLG_INPUT1 = 0x0100, XBAR_INPUT_FLG_INPUT2 = 0x0101, XBAR_INPUT_FLG_INPUT3 = 0x0102, XBAR_INPUT_FLG_INPUT4 = 0x0103, XBAR_INPUT_FLG_INPUT5 = 0x0104, XBAR_INPUT_FLG_INPUT6 = 0x0105, XBAR_INPUT_FLG_ADCSOCA = 0x0106, XBAR_INPUT_FLG_ADCSOCB = 0x0107, XBAR_INPUT_FLG_INPUT7 = 0x0108, XBAR_INPUT_FLG_INPUT8 = 0x0109, XBAR_INPUT_FLG_INPUT9 = 0x010A, XBAR_INPUT_FLG_INPUT10 = 0x010B, XBAR_INPUT_FLG_INPUT11 = 0x010C, XBAR_INPUT_FLG_INPUT12 = 0x010D, XBAR_INPUT_FLG_INPUT13 = 0x010E, XBAR_INPUT_FLG_INPUT14 = 0x010F, XBAR_INPUT_FLG_ECAP1_OUT = 0x0110, XBAR_INPUT_FLG_ECAP2_OUT = 0x0111, XBAR_INPUT_FLG_ECAP3_OUT = 0x0112, XBAR_INPUT_FLG_ECAP4_OUT = 0x0113, XBAR_INPUT_FLG_ECAP5_OUT = 0x0114, XBAR_INPUT_FLG_ECAP6_OUT = 0x0115, XBAR_INPUT_FLG_EXTSYNCOUT = 0x0116, XBAR_INPUT_FLG_ADCAEVT1 = 0x0117, XBAR_INPUT_FLG_ADCAEVT2 = 0x0118, XBAR_INPUT_FLG_ADCAEVT3 = 0x0119, XBAR_INPUT_FLG_ADCAEVT4 = 0x011A, XBAR_INPUT_FLG_ADCBEVT1 = 0x011B, XBAR_INPUT_FLG_ADCBEVT2 = 0x011C, XBAR_INPUT_FLG_ADCBEVT3 = 0x011D, XBAR_INPUT_FLG_ADCBEVT4 = 0x011E, XBAR_INPUT_FLG_ADCCEVT1 = 0x011F, // // XBARFLG3 // XBAR_INPUT_FLG_ADCCEVT2 = 0x0200, XBAR_INPUT_FLG_ADCCEVT3 = 0x0201, XBAR_INPUT_FLG_ADCCEVT4 = 0x0202, XBAR_INPUT_FLG_ADCDEVT1 = 0x0203, XBAR_INPUT_FLG_ADCDEVT2 = 0x0204, XBAR_INPUT_FLG_ADCDEVT3 = 0x0205, XBAR_INPUT_FLG_ADCDEVT4 = 0x0206, XBAR_INPUT_FLG_SD1FLT1_COMPL = 0x0207, XBAR_INPUT_FLG_SD1FLT1_COMPH = 0x0208, XBAR_INPUT_FLG_SD1FLT2_COMPL = 0x0209, XBAR_INPUT_FLG_SD1FLT2_COMPH = 0x020A, XBAR_INPUT_FLG_SD1FLT3_COMPL = 0x020B, XBAR_INPUT_FLG_SD1FLT3_COMPH = 0x020C, XBAR_INPUT_FLG_SD1FLT4_COMPL = 0x020D, XBAR_INPUT_FLG_SD1FLT4_COMPH = 0x020E, XBAR_INPUT_FLG_SD2FLT1_COMPL = 0x020F, XBAR_INPUT_FLG_SD2FLT1_COMPH = 0x0210, XBAR_INPUT_FLG_SD2FLT2_COMPL = 0x0211, XBAR_INPUT_FLG_SD2FLT2_COMPH = 0x0212, XBAR_INPUT_FLG_SD2FLT3_COMPL = 0x0213, XBAR_INPUT_FLG_SD2FLT3_COMPH = 0x0214, XBAR_INPUT_FLG_SD2FLT4_COMPL = 0x0215, XBAR_INPUT_FLG_SD2FLT4_COMPH = 0x0216, XBAR_INPUT_FLG_ECAP7_OUT = 0x0217, XBAR_INPUT_FLG_SD1FLT1_COMPZ = 0x0218, XBAR_INPUT_FLG_SD1FLT1_DRINT = 0x0219, XBAR_INPUT_FLG_SD1FLT2_COMPZ = 0x021A, XBAR_INPUT_FLG_SD1FLT2_DRINT = 0x021B, XBAR_INPUT_FLG_SD1FLT3_COMPZ = 0x021C, XBAR_INPUT_FLG_SD1FLT3_DRINT = 0x021D, XBAR_INPUT_FLG_SD1FLT4_COMPZ = 0x021E, XBAR_INPUT_FLG_SD1FLT4_DRINT = 0x021F, // // XBARFLG4 // XBAR_INPUT_FLG_SD2FLT1_COMPZ = 0x0300, XBAR_INPUT_FLG_SD2FLT1_DRINT = 0x0301, XBAR_INPUT_FLG_SD2FLT2_COMPZ = 0x0302, XBAR_INPUT_FLG_SD2FLT2_DRINT = 0x0303, XBAR_INPUT_FLG_SD2FLT3_COMPZ = 0x0304, XBAR_INPUT_FLG_SD2FLT3_DRINT = 0x0305, XBAR_INPUT_FLG_SD2FLT4_COMPZ = 0x0306, XBAR_INPUT_FLG_SD2FLT4_DRINT = 0x0307, XBAR_INPUT_FLG_EMAC_PPS0 = 0x0308, XBAR_INPUT_FLG_MCANA_FEVT0 = 0x0309, XBAR_INPUT_FLG_MCANA_FEVT1 = 0x030A, XBAR_INPUT_FLG_MCANA_FEVT2 = 0x030B, XBAR_INPUT_FLG_CLB1_OUT4 = 0x0310, XBAR_INPUT_FLG_CLB1_OUT5 = 0x0311, XBAR_INPUT_FLG_CLB2_OUT4 = 0x0312, XBAR_INPUT_FLG_CLB2_OUT5 = 0x0313, XBAR_INPUT_FLG_CLB3_OUT4 = 0x0314, XBAR_INPUT_FLG_CLB3_OUT5 = 0x0315, XBAR_INPUT_FLG_CLB4_OUT4 = 0x0316, XBAR_INPUT_FLG_CLB4_OUT5 = 0x0317, XBAR_INPUT_FLG_ERRORSTS_ERROR = 0x031C, XBAR_INPUT_FLG_ECATSYNC0 = 0x031D, XBAR_INPUT_FLG_ECATSYNC1 = 0x031E, XBAR_INPUT_FLG_CLAHALT = 0x031F } XBAR_InputFlag; //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** //***************************************************************************** // //! \internal //! Checks a X-BAR base address. //! //! \param base is the base address of the X-BAR. //! //! This function determines if a X-BAR base address is valid. //! //! \return Returns \b true if the base address is valid and \b false //! otherwise. // //***************************************************************************** static inline _Bool XBAR_isBaseValid(uint32_t base) { return((base == 0x00007A80U) || (base == 0x00007900U)); } //***************************************************************************** // //! Enables the Output X-BAR mux values to be passed to the output signal. //! //! \param base specifies the X-BAR Enable register base address. //! \param output is the X-BAR output being configured. //! \param muxes is a bit field of the muxes to be enabled. //! //! This function enables the mux values to be passed to the X-BAR output //! signal. The \e output parameter is a value \b XBAR_OUTPUTy where y is //! the output number between 1 and 8 inclusive. //! //! The \e base parameter can take base addresses //! OUTPUTXBAR_BASE //! //! The \e muxes parameter is a bit field of the muxes being enabled where bit //! 0 represents mux 0, bit 1 represents mux 1 and so on. Defines are provided //! in the form of \b XBAR_MUXnn that can be OR'd together to enable several //! muxes on an output at the same time. For example, passing this function //! ( \b XBAR_MUX04 | \b XBAR_MUX10 ) would enable muxes 4 and 10. //! //! \return None. // //***************************************************************************** static inline void XBAR_enableOutputMux(uint32_t base, XBAR_OutputNum output, uint32_t muxes) { uint16_t outputNum = (uint16_t)output; // // Check the arguments. // do { if(!(XBAR_isBaseValid(base))) { __error__("C:\\ti\\c2000\\C2000Ware_2_01_00_00\\driverlib\\f2838x\\driverlib\\xbar.h", 742); } } while(0); // // Set the enable bit. // __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0x20U + outputNum)))) |= muxes; __edis(); } //***************************************************************************** // //! Disables the Output X-BAR mux values from being passed to the output. //! //! \param base specifies the X-BAR Enable Register base address. //! \param output is the X-BAR output being configured. //! \param muxes is a bit field of the muxes to be disabled. //! //! This function disables the mux values from being passed to the X-BAR output //! signal. The \e output parameter is a value \b XBAR_OUTPUTy where y is //! the output number between 1 and 8 inclusive. //! //! The \e base parameter can take base addresses //! OUTPUTXBAR_BASE //! //! The \e muxes parameter is a bit field of the muxes being disabled where bit //! 0 represents mux 0, bit 1 represents mux 1 and so on. Defines are provided //! in the form of \b XBAR_MUXnn that can be OR'd together to disable several //! muxes on an output at the same time. For example, passing this function //! ( \b XBAR_MUX04 | \b XBAR_MUX10 ) would disable muxes 4 and 10. //! //! \return None. // //***************************************************************************** static inline void XBAR_disableOutputMux(uint32_t base, XBAR_OutputNum output, uint32_t muxes) { uint16_t outputNum = (uint16_t)output; // // Check the arguments. // do { if(!(XBAR_isBaseValid(base))) { __error__("C:\\ti\\c2000\\C2000Ware_2_01_00_00\\driverlib\\f2838x\\driverlib\\xbar.h", 786); } } while(0); // // Clear the enable bit. // __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0x20U + outputNum)))) &= ~(muxes); __edis(); } //***************************************************************************** // //! Enables or disables the output latch to drive the selected output. //! //! \param base specifies the X-BAR base address. //! \param output is the X-BAR output being configured. //! \param enable is a flag that determines whether or not the latch is //! selected to drive the X-BAR output. //! //! The \e base parameter can take base addresses //! OUTPUTXBAR_BASE //! //! This function sets the Output X-BAR output signal latch mode. If the //! \e enable parameter is \b true, the output specified by \e output will be //! driven by the output latch. //! //! \return None. // //***************************************************************************** static inline void XBAR_setOutputLatchMode(uint32_t base, XBAR_OutputNum output, _Bool enable) { // // Check the arguments. // do { if(!(XBAR_isBaseValid(base))) { __error__("C:\\ti\\c2000\\C2000Ware_2_01_00_00\\driverlib\\f2838x\\driverlib\\xbar.h", 823); } } while(0); __eallow(); // // Set or clear the latch setting bit based on the enable parameter. // if(enable) { (*((volatile uint16_t *)((uintptr_t)(base + 0x36U)))) |= 0x1U << ((uint16_t)output / 2U); } else { (*((volatile uint16_t *)((uintptr_t)(base + 0x36U)))) &= ~(0x1U << ((uint16_t)output / 2U)); } __edis(); } //***************************************************************************** // //! Returns the status of the output latch //! //! \param base specifies the X-BAR base address. //! \param output is the X-BAR output being checked. //! //! The \e base parameter can take base addresses //! OUTPUTXBAR_BASE //! //! \return Returns \b true if the output corresponding to \e output was //! triggered. If not, it will return \b false. // //***************************************************************************** static inline _Bool XBAR_getOutputLatchStatus(uint32_t base, XBAR_OutputNum output) { // // Check the arguments. // do { if(!(XBAR_isBaseValid(base))) { __error__("C:\\ti\\c2000\\C2000Ware_2_01_00_00\\driverlib\\f2838x\\driverlib\\xbar.h", 864); } } while(0); // // Get the status of the Output X-BAR output latch. // return(((*((volatile uint16_t *)((uintptr_t)(base + 0x30U)))) & (0x1U << ((uint16_t)output / 2U))) != 0U); } //***************************************************************************** // //! Clears the output latch for the specified output. //! //! \param base specifies the X-BAR base address. //! \param output is the X-BAR output being configured. //! //! The \e base parameter can take base addresses //! OUTPUTXBAR_BASE //! //! This function clears the Output X-BAR output latch. The output to be //! configured is specified by the \e output parameter. //! //! \return None. // //***************************************************************************** static inline void XBAR_clearOutputLatch(uint32_t base, XBAR_OutputNum output) { // // Check the arguments. // do { if(!(XBAR_isBaseValid(base))) { __error__("C:\\ti\\c2000\\C2000Ware_2_01_00_00\\driverlib\\f2838x\\driverlib\\xbar.h", 895); } } while(0); // // Set the bit that clears the corresponding OUTPUTLATCH bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0x32U)))) |= 0x1U << ((uint16_t)output / 2U); } //***************************************************************************** // //! Forces the output latch for the specified output. //! //! \param base specifies the X-BAR base address. //! \param output is the X-BAR output being configured. //! //! The \e base parameter can take base addresses //! OUTPUTXBAR_BASE //! //! This function forces the Output X-BAR output latch. The output to be //! configured is specified by the \e output parameter. //! //! \return None. // //***************************************************************************** static inline void XBAR_forceOutputLatch(uint32_t base, XBAR_OutputNum output) { // // Check the arguments. // do { if(!(XBAR_isBaseValid(base))) { __error__("C:\\ti\\c2000\\C2000Ware_2_01_00_00\\driverlib\\f2838x\\driverlib\\xbar.h", 926); } } while(0); // // Set the bit that forces the corresponding OUTPUTLATCH bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0x34U)))) = 0x1U << ((uint16_t)output / 2U); } //***************************************************************************** // //! Configures the polarity of an Output X-BAR output. //! //! \param base specifies the X-BAR base address. //! \param output is the X-BAR output being configured. //! \param invert is a flag that determines whether the output is active-high //! or active-low. //! //! The \e base parameter can take base addresses //! OUTPUTXBAR_BASE //! //! This function inverts the Output X-BAR signal if the \e invert parameter is //! \b true. If \e invert is \b false, the signal will be passed as is. The //! \e output parameter is a value \b XBAR_OUTPUTy where y is the output //! number between 1 and 8 inclusive. //! //! \return None. // //***************************************************************************** static inline void XBAR_invertOutputSignal(uint32_t base, XBAR_OutputNum output, _Bool invert) { // // Check the arguments. // do { if(!(XBAR_isBaseValid(base))) { __error__("C:\\ti\\c2000\\C2000Ware_2_01_00_00\\driverlib\\f2838x\\driverlib\\xbar.h", 961); } } while(0); // // Set or clear the polarity setting bit based on the invert parameter. // __eallow(); if(invert) { (*((volatile uint16_t *)((uintptr_t)(base + 0x38U)))) |= 0x1U << ((uint16_t)output / 2U); } else { (*((volatile uint16_t *)((uintptr_t)(base + 0x38U)))) &= ~(0x1U << ((uint16_t)output / 2U)); } __edis(); } //***************************************************************************** // //! Enables the ePWM X-BAR mux values to be passed to an ePWM module. //! //! \param trip is the X-BAR output being configured. //! \param muxes is a bit field of the muxes to be enabled. //! //! This function enables the mux values to be passed to the X-BAR trip //! signal. The \e trip parameter is a value \b XBAR_TRIPy where y is //! the number of the trip signal on the ePWM. //! //! The \e muxes parameter is a bit field of the muxes being enabled where bit //! 0 represents mux 0, bit 1 represents mux 1 and so on. Defines are provided //! in the form of \b XBAR_MUXnn that can be logically OR'd together to //! enable several muxes on an output at the same time. //! //! \return None. // //***************************************************************************** static inline void XBAR_enableEPWMMux(XBAR_TripNum trip, uint32_t muxes) { // // Set the enable bit. // __eallow(); (*((volatile uint32_t *)((uintptr_t)((0x00007A00U + 0x20U) + (uint16_t)trip)))) |= muxes; __edis(); } //***************************************************************************** // //! Disables the ePWM X-BAR mux values to be passed to an ePWM module. //! //! \param trip is the X-BAR output being configured. //! \param muxes is a bit field of the muxes to be disabled. //! //! This function disables the mux values to be passed to the X-BAR trip //! signal. The \e trip parameter is a value \b XBAR_TRIPy where y is //! the number of the trip signal on the ePWM. //! //! The \e muxes parameter is a bit field of the muxes being disabled where bit //! 0 represents mux 0, bit 1 represents mux 1 and so on. Defines are provided //! in the form of \b XBAR_MUXnn that can be logically OR'd together to //! disable several muxes on an output at the same time. //! //! \return None. // //***************************************************************************** static inline void XBAR_disableEPWMMux(XBAR_TripNum trip, uint32_t muxes) { // // Clear the enable bit. // __eallow(); (*((volatile uint32_t *)((uintptr_t)((0x00007A00U + 0x20U) + (uint16_t)trip)))) &= ~(muxes); __edis(); } //***************************************************************************** // //! Configures the polarity of an ePWM X-BAR output. //! //! \param trip is the X-BAR output being configured. //! \param invert is a flag that determines whether the output is active-high //! or active-low. //! //! This function inverts the ePWM X-BAR trip signal if the \e invert //! parameter is \b true. If \e invert is \b false, the signal will be passed //! as is. The \e trip parameter is a value \b XBAR_TRIPy where y is //! the number of the trip signal on the ePWM X-BAR that is being configured. //! //! \return None. // //***************************************************************************** static inline void XBAR_invertEPWMSignal(XBAR_TripNum trip, _Bool invert) { // // Set or clear the polarity setting bit based on the invert parameter. // __eallow(); if(invert) { (*((volatile uint16_t *)((uintptr_t)(0x00007A00U + 0x38U)))) |= 0x1U << ((uint16_t)trip / 2U); } else { (*((volatile uint16_t *)((uintptr_t)(0x00007A00U + 0x38U)))) &= ~(0x1U << ((uint16_t)trip / 2U)); } __edis(); } //***************************************************************************** // //! Sets the GPIO / non-GPIO pin for an Input X-BAR input. //! //! \param base specifies the X-BAR base address. //! \param input is the X-BAR input being configured. //! \param pin is the identifying number of the pin. //! //! The \e base parameter can take base addresses //! INPUTXBAR_BASE //! //! This function configures which GPIO is assigned to an Input X-BAR input. //! The \e input parameter is a value in the form of a define \b XBAR_INPUTy //! where y is a the input number for the Input X-BAR. //! //! The pin is specified by its numerical value. For example, GPIO34 is //! specified by passing 34 as \e pin. //! //! For the other non - GPIO values: //! 0xFFFD: '1' will be driven to the destination //! 0xFFFE: '1' will be driven to the destination //! 0xFFFF: '0' will be driven to the destination //! NOTE: Pin value greater than the available number of GPIO pins on a //! device (except 0xFFFF) will cause the destination to be driven '1'. //! //! \return None. // //***************************************************************************** static inline void XBAR_setInputPin(uint32_t base, XBAR_InputNum input, uint16_t pin) { // // Check the argument. // do { if(!((pin <= 168U) || ((pin >= 0xFFFDU) && (pin <= 0xFFFFU)))) { __error__("C:\\ti\\c2000\\C2000Ware_2_01_00_00\\driverlib\\f2838x\\driverlib\\xbar.h", 1119); } } while(0); do { if(!(XBAR_isBaseValid(base))) { __error__("C:\\ti\\c2000\\C2000Ware_2_01_00_00\\driverlib\\f2838x\\driverlib\\xbar.h", 1120); } } while(0); // // Write the requested pin to the appropriate input select register. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U + (uint16_t)input)))) = pin; __edis(); } //***************************************************************************** // //! Locks an input to the Input X-BAR. //! //! \param base specifies the X-BAR base address. //! \param input is an input to the Input X-BAR. //! //! This function locks the specific input on the Input X-BAR. //! //! The \e base parameter can take base addresses //! INPUTXBAR_BASE //! //! \return None. // //***************************************************************************** static inline void XBAR_lockInput(uint32_t base, XBAR_InputNum input) { // // Check the arguments. // do { if(!(XBAR_isBaseValid(base))) { __error__("C:\\ti\\c2000\\C2000Ware_2_01_00_00\\driverlib\\f2838x\\driverlib\\xbar.h", 1153); } } while(0); // // lock the input in the INPUTSELECTLOCK register. // __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0x1EU)))) = (uint32_t)1U << (uint16_t)input; __edis(); } //***************************************************************************** // //! Locks the Output X-BAR. //! //! \param base specifies the X-BAR base address. //! This function locks the Output X-BAR. //! //! The \e base parameter can take base addresses //! OUTPUTXBAR_BASE //! //! \return None. // //***************************************************************************** static inline void XBAR_lockOutput(uint32_t base) { // // Check the arguments. // do { if(!(XBAR_isBaseValid(base))) { __error__("C:\\ti\\c2000\\C2000Ware_2_01_00_00\\driverlib\\f2838x\\driverlib\\xbar.h", 1183); } } while(0); // // Lock the Output X-BAR with the OUTPUTLOCK register. // Write key 0x5A5A to the KEY bits and 1 to LOCK bit. // __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0x3EU)))) = ((uint32_t)0x5A5A << 16U) | (uint32_t)0x1U; __edis(); } //***************************************************************************** // //! Locks the ePWM X-BAR. //! //! This function locks the ePWM X-BAR. //! //! \return None. // //***************************************************************************** static inline void XBAR_lockEPWM(void) { // // Lock the ePWM X-BAR with the TRIPLOCK register. // Write key 0x5A5A to the KEY bits and 1 to LOCK bit. // __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x00007A00U + 0x3EU)))) = ((uint32_t)0x5A5A << 16U) | (uint32_t)0x1U; __edis(); } //***************************************************************************** // //! Enables the CLB X-BAR mux values to be passed to an CLB module. //! //! \param auxSignal is the X-BAR output being configured. //! \param muxes is a bit field of the muxes to be enabled. //! //! This function enables the mux values to be passed to the X-BAR auxSignal //! signal. The \e auxSignal parameter is a value \b XBAR_AUXSIGy where y is //! the number of the signal on the CLB. //! //! The \e muxes parameter is a bit field of the muxes being enabled where bit //! 0 represents mux 0, bit 1 represents mux 1 and so on. Defines are provided //! in the form of \b XBAR_MUXnn that can be logically OR'd together to //! enable several muxes on an output at the same time. //! //! \return None. // //***************************************************************************** static inline void XBAR_enableCLBMux(XBAR_AuxSigNum auxSignal, uint32_t muxes) { // // Set the enable bit. // __eallow(); (*((volatile uint32_t *)((uintptr_t)((0x00007A40U + 0x20U) + (uint16_t)auxSignal)))) |= muxes; __edis(); } //***************************************************************************** // //! Disables the CLB X-BAR mux values to be passed to an CLB module. //! //! \param auxSignal is the X-BAR output being configured. //! \param muxes is a bit field of the muxes to be disabled. //! //! This function disables the mux values to be passed to the X-BAR auxSignal //! signal. The \e auxSignal parameter is a value \b XBAR_AUXSIGy where y is //! the number of the signal on the CLB. //! //! The \e muxes parameter is a bit field of the muxes being disabled where bit //! 0 represents mux 0, bit 1 represents mux 1 and so on. Defines are provided //! in the form of \b XBAR_MUXnn that can be logically OR'd together to //! disable several muxes on an output at the same time. //! //! \return None. // //***************************************************************************** static inline void XBAR_disableCLBMux(XBAR_AuxSigNum auxSignal, uint32_t muxes) { // // Clear the enable bit. // __eallow(); (*((volatile uint32_t *)((uintptr_t)((0x00007A40U + 0x20U) + (uint16_t)auxSignal)))) &= ~(muxes); __edis(); } //***************************************************************************** // //! Configures the polarity of an CLB X-BAR output. //! //! \param auxSignal is the X-BAR output being configured. //! \param invert is a flag that determines whether the output is active-high //! or active-low. //! //! This function inverts the CLB X-BAR auxSignal signal if the \e invert //! parameter is \b true. If \e invert is \b false, the signal will be passed //! as is. The \e auxSignal parameter is a value \b XBAR_AUXSIGy where y is //! the number of the signal on the CLB X-BAR that is being configured. //! //! \return None. // //***************************************************************************** static inline void XBAR_invertCLBSignal(XBAR_AuxSigNum auxSignal, _Bool invert) { // // Set or clear the polarity setting bit based on the invert parameter. // __eallow(); if(invert) { (*((volatile uint16_t *)((uintptr_t)(0x00007A40U + 0x38U)))) |= 0x1U << ((uint16_t)auxSignal / 2U); } else { (*((volatile uint16_t *)((uintptr_t)(0x00007A40U + 0x38U)))) &= ~(0x1U << ((uint16_t)auxSignal / 2U)); } __edis(); } //***************************************************************************** // //! Configures the Output X-BAR mux that determines the signals passed to an //! output. //! //! \param base specifies the X-BAR Config Register base address. //! \param output is the X-BAR output being configured. //! \param muxConfig is mux configuration that specifies the signal. //! //! This function configures an Output X-BAR mux. This determines which //! signal(s) should be passed through the X-BAR to a GPIO. The \e output //! parameter is a value \b XBAR_OUTPUTy where y is a the output number //! between 1 and 8 inclusive. //! //! The \e base parameter can take base addresses //! OUTPUTXBAR_BASE //! //! The \e muxConfig parameter is the mux configuration value that specifies //! which signal will be passed from the mux. The values have the format of //! \b XBAR_OUT_MUXnn_xx where the 'xx' is the signal and nn is the mux //! number (00 through 11). The possible values are found in xbar.h //! //! This function may be called for each mux of an output and their values will //! be logically OR'd before being passed to the output signal. This means that //! this function may be called, for example, with the argument //! \b XBAR_OUT_MUX00_ECAP1_OUT and then with the argument //! \b XBAR_OUT_MUX01_INPUTXBAR1, resulting in the values of MUX00 and MUX01 //! being logically OR'd if both are enabled. Calling the function twice for //! the same mux on the output will result in the configuration in the second //! call overwriting the first. //! //! \return None. // //***************************************************************************** extern void XBAR_setOutputMuxConfig(uint32_t base, XBAR_OutputNum output, XBAR_OutputMuxConfig muxConfig); //***************************************************************************** // //! Configures the ePWM X-BAR mux that determines the signals passed to an //! ePWM module. //! //! \param trip is the X-BAR output being configured. //! \param muxConfig is mux configuration that specifies the signal. //! //! This function configures an ePWM X-BAR mux. This determines which signal(s) //! should be passed through the X-BAR to an ePWM module. The \e trip //! parameter is a value \b XBAR_TRIPy where y is a the number of the trip //! signal on the ePWM. //! //! The \e muxConfig parameter is the mux configuration value that specifies //! which signal will be passed from the mux. The values have the format of //! \b XBAR_EPWM_MUXnn_xx where the 'xx' is the signal and nn is the mux //! number (0 through 31). The possible values are found in xbar.h //! //! This function may be called for each mux of an output and their values will //! be logically OR'd before being passed to the trip signal. This means that //! this function may be called, for example, with the argument //! \b XBAR_EPWM_MUX00_ECAP1_OUT and then with the argument //! \b XBAR_EPWM_MUX01_INPUTXBAR1, resulting in the values of MUX00 and MUX03 //! being logically OR'd if both are enabled. Calling the function twice for //! the same mux on the output will result in the configuration in the second //! call overwriting the first. //! //! \return None. // //***************************************************************************** extern void XBAR_setEPWMMuxConfig(XBAR_TripNum trip, XBAR_EPWMMuxConfig muxConfig); //***************************************************************************** // //! Returns the status of the input latch. //! //! \param inputFlag is the X-BAR input latch being checked. Values are in the //! format of /b XBAR_INPUT_FLG_XXXX where "XXXX" is name of the signal. //! //! \return Returns \b true if the X-BAR input corresponding to the //! \e inputFlag has been triggered. If not, it will return \b false. // //***************************************************************************** extern _Bool XBAR_getInputFlagStatus(XBAR_InputFlag inputFlag); //***************************************************************************** // //! Clears the input latch for the specified input latch. //! //! \param inputFlag is the X-BAR input latch being cleared. //! //! This function clears the Input X-BAR input latch. The input latch to be //! cleared is specified by the \e inputFlag parameter. //! //! \return None. // //***************************************************************************** extern void XBAR_clearInputFlag(XBAR_InputFlag inputFlag); //***************************************************************************** // //! Configures the CLB X-BAR mux that determines the signals passed to a //! CLB module. //! //! \param auxSignal is the X-BAR output being configured. //! \param muxConfig is mux configuration that specifies the signal. //! //! This function configures an CLB X-BAR mux. This determines which signal(s) //! should be passed through the X-BAR to an CLB module. The \e auxSignal //! parameter is a value \b XBAR_AUXSIGy where y is a the number of the //! signal on the CLB. //! //! The \e muxConfig parameter is the mux configuration value that specifies //! which signal will be passed from the mux. The values have the format of //! \b XBAR_CLB_MUXnn_xx where the 'xx' is the signal and nn is the mux //! number (0 through 31). The possible values are found in xbar.h //! //! This function may be called for each mux of an output and their values will //! be logically OR'd before being passed to the signal. This means that //! this function may be called, for example, with the argument //! \b XBAR_CLB_MUX00_ECAP1_OUT and then with the argument //! \b XBAR_CLB_MUX03_INPUTXBAR2, resulting in the values of MUX00 and MUX03 //! being logically OR'd if both are enabled. Calling the function twice for //! the same mux on the output will result in the configuration in the second //! call overwriting the first. //! //! \return None. // //***************************************************************************** extern void XBAR_setCLBMuxConfig(XBAR_AuxSigNum auxSignal, XBAR_CLBMuxConfig muxConfig); //***************************************************************************** // // Close the Doxygen group. //! @} // //***************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //***************************************************************************** // // Useful defines used within the driver functions to access gpio registers. // Not intended for use by application code. // // Divide by 2 is for C28x which has word access // //***************************************************************************** //***************************************************************************** // // Values that can be passed to GPIO_setPadConfig() as the pinType parameter // and returned by GPIO_getPadConfig(). // //***************************************************************************** //***************************************************************************** // //! Values that can be passed to GPIO_setDirectionMode() as the \e pinIO //! parameter and returned from GPIO_getDirectionMode(). // //***************************************************************************** typedef enum { GPIO_DIR_MODE_IN, //!< Pin is a GPIO input GPIO_DIR_MODE_OUT //!< Pin is a GPIO output } GPIO_Direction; //***************************************************************************** // //! Values that can be passed to GPIO_setInterruptType() as the \e intType //! parameter and returned from GPIO_getInterruptType(). // //***************************************************************************** typedef enum { GPIO_INT_TYPE_FALLING_EDGE = 0x00, //!< Interrupt on falling edge GPIO_INT_TYPE_RISING_EDGE = 0x04, //!< Interrupt on rising edge GPIO_INT_TYPE_BOTH_EDGES = 0x0C //!< Interrupt on both edges } GPIO_IntType; //***************************************************************************** // //! Values that can be passed to GPIO_setQualificationMode() as the //! \e qualification parameter and returned by GPIO_getQualificationMode(). // //***************************************************************************** typedef enum { GPIO_QUAL_SYNC, //!< Synchronization to SYSCLKOUT GPIO_QUAL_3SAMPLE, //!< Qualified with 3 samples GPIO_QUAL_6SAMPLE, //!< Qualified with 6 samples GPIO_QUAL_ASYNC //!< No synchronization } GPIO_QualificationMode; //***************************************************************************** // //! Values that can be passed to GPIO_setAnalogMode() as the \e mode parameter. // //***************************************************************************** typedef enum { GPIO_ANALOG_DISABLED, //!< Pin is in digital mode GPIO_ANALOG_ENABLED //!< Pin is in analog mode } GPIO_AnalogMode; //***************************************************************************** // //! Values that can be passed to GPIO_setMasterCore() as the \e core parameter. // //***************************************************************************** typedef enum { GPIO_CORE_CPU1, //!< CPU1 selected as master core GPIO_CORE_CPU1_CLA1, //!< CPU1's CLA1 selected as master core GPIO_CORE_CPU2, //!< CPU2 selected as master core GPIO_CORE_CPU2_CLA1, //!< CPU2's CLA1 selected as master core GPIO_CORE_CM //!< CM selected as master core } GPIO_CoreSelect; //***************************************************************************** // //! Values that can be passed to GPIO_readPortData(), GPIO_setPortPins(), //! GPIO_clearPortPins(), and GPIO_togglePortPins() as the \e port parameter. // //***************************************************************************** typedef enum { GPIO_PORT_A = 0, //!< GPIO port A GPIO_PORT_B = 1, //!< GPIO port B GPIO_PORT_C = 2, //!< GPIO port C GPIO_PORT_D = 3, //!< GPIO port D GPIO_PORT_E = 4, //!< GPIO port E GPIO_PORT_F = 5 //!< GPIO port F } GPIO_Port; //***************************************************************************** // //! Values that can be passed to GPIO_setInterruptPin(), //! GPIO_setInterruptType(), GPIO_getInterruptType(), GPIO_enableInterrupt(), //! GPIO_disableInterrupt(), as the \e extIntNum parameter. // //***************************************************************************** typedef enum { GPIO_INT_XINT1, //!< External Interrupt 1 GPIO_INT_XINT2, //!< External Interrupt 2 GPIO_INT_XINT3, //!< External Interrupt 3 GPIO_INT_XINT4, //!< External Interrupt 4 GPIO_INT_XINT5 //!< External Interrupt 5 } GPIO_ExternalIntNum; //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** //***************************************************************************** // //! \internal //! Checks that a pin number is valid for a device. //! //! Note that this function reflects the highest possible GPIO number of a //! device on its biggest package. Check the datasheet to see what the actual //! range of valid pin numbers is for a specific package. //! //! \return None. // //***************************************************************************** static inline _Bool GPIO_isPinValid(uint32_t pin) { return(pin <= 168U); } //***************************************************************************** // //! Sets the interrupt type for the specified pin. //! //! \param extIntNum specifies the external interrupt. //! \param intType specifies the type of interrupt trigger mechanism. //! //! This function sets up the various interrupt trigger mechanisms for the //! specified pin on the selected GPIO port. //! //! The following defines can be used to specify the external interrupt for the //! \e extIntNum parameter: //! //! - \b GPIO_INT_XINT1 //! - \b GPIO_INT_XINT2 //! - \b GPIO_INT_XINT3 //! - \b GPIO_INT_XINT4 //! - \b GPIO_INT_XINT5 //! //! One of the following flags can be used to define the \e intType //! parameter: //! //! - \b GPIO_INT_TYPE_FALLING_EDGE sets detection to edge and trigger to //! falling //! - \b GPIO_INT_TYPE_RISING_EDGE sets detection to edge and trigger to rising //! - \b GPIO_INT_TYPE_BOTH_EDGES sets detection to both edges //! //! \return None. // //***************************************************************************** static inline void GPIO_setInterruptType(GPIO_ExternalIntNum extIntNum, GPIO_IntType intType) { // // Write the selected polarity to the appropriate register. // (*((volatile uint16_t *)((uintptr_t)(0x00007070U + (uint16_t)extIntNum)))) = ((*((volatile uint16_t *)((uintptr_t)(0x00007070U + (uint16_t)extIntNum)))) & ~0xCU) | (uint16_t)intType; } //***************************************************************************** // //! Gets the interrupt type for a pin. //! //! \param extIntNum specifies the external interrupt. //! //! This function gets the interrupt type for a interrupt. The interrupt can be //! configured as a falling-edge, rising-edge, or both-edges detected //! interrupt. //! //! The following defines can be used to specify the external interrupt for the //! \e extIntNum parameter: //! //! - \b GPIO_INT_XINT1 //! - \b GPIO_INT_XINT2 //! - \b GPIO_INT_XINT3 //! - \b GPIO_INT_XINT4 //! - \b GPIO_INT_XINT5 //! //! \return Returns one of the flags described for GPIO_setInterruptType(). // //***************************************************************************** static inline GPIO_IntType GPIO_getInterruptType(GPIO_ExternalIntNum extIntNum) { // // Read the selected polarity from the appropriate register. // return((GPIO_IntType)((*((volatile uint16_t *)((uintptr_t)(0x00007070U + (uint16_t)extIntNum)))) & 0xCU)); } //***************************************************************************** // //! Enables the specified external interrupt. //! //! \param extIntNum specifies the external interrupt. //! //! This function enables the indicated external interrupt sources. Only the //! sources that are enabled can be reflected to the processor interrupt. //! Disabled sources have no effect on the processor. //! //! The following defines can be used to specify the external interrupt for the //! \e extIntNum parameter: //! //! - \b GPIO_INT_XINT1 //! - \b GPIO_INT_XINT2 //! - \b GPIO_INT_XINT3 //! - \b GPIO_INT_XINT4 //! - \b GPIO_INT_XINT5 //! //! \return None. // //***************************************************************************** static inline void GPIO_enableInterrupt(GPIO_ExternalIntNum extIntNum) { // // Set the enable bit for the specified interrupt. // (*((volatile uint16_t *)((uintptr_t)(0x00007070U + (uint16_t)extIntNum)))) |= 0x1U; } //***************************************************************************** // //! Disables the specified external interrupt. //! //! \param extIntNum specifies the external interrupt. //! //! This function disables the indicated external interrupt sources. Only the //! sources that are enabled can be reflected to the processor interrupt. //! Disabled sources have no effect on the processor. //! //! The following defines can be used to specify the external interrupt for the //! \e extIntNum parameter: //! //! - \b GPIO_INT_XINT1 //! - \b GPIO_INT_XINT2 //! - \b GPIO_INT_XINT3 //! - \b GPIO_INT_XINT4 //! - \b GPIO_INT_XINT5 //! //! \return None. // //***************************************************************************** static inline void GPIO_disableInterrupt(GPIO_ExternalIntNum extIntNum) { // // Clear the enable bit for the specified interrupt // (*((volatile uint16_t *)((uintptr_t)(0x00007070U + (uint16_t)extIntNum)))) &= ~0x1U; } //***************************************************************************** // //! Gets the value of the external interrupt counter. //! //! \param extIntNum specifies the external interrupt. //! //! The following defines can be used to specify the external interrupt for the //! \e extIntNum parameter: //! //! - \b GPIO_INT_XINT1 //! - \b GPIO_INT_XINT2 //! - \b GPIO_INT_XINT3 //! //! \b Note: The counter is clocked at the SYSCLKOUT rate. //! //! \return Returns external interrupt counter value. // //***************************************************************************** static inline uint16_t GPIO_getInterruptCounter(GPIO_ExternalIntNum extIntNum) { do { if(!(extIntNum <= GPIO_INT_XINT3)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/gpio.h", 398); } } while(0); // // Read the counter value from the appropriate register. // return(((*((volatile uint16_t *)((uintptr_t)(0x00007070U + 0x8U + (uint16_t)extIntNum)))))); } //***************************************************************************** // //! Reads the value present on the specified pin. //! //! \param pin is the identifying GPIO number of the pin. //! //! The value at the specified pin are read, as specified by \e pin. The value //! is returned for both input and output pins. //! //! The pin is specified by its numerical value. For example, GPIO34 is //! specified by passing 34 as \e pin. //! //! \return Returns the value in the data register for the specified pin. // //***************************************************************************** static inline uint32_t GPIO_readPin(uint32_t pin) { volatile uint32_t *gpioDataReg; // // Check the arguments. // do { if(!(GPIO_isPinValid(pin))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/gpio.h", 429); } } while(0); gpioDataReg = (uint32_t *)((uintptr_t)0x00007F00U) + ((pin / 32U) * ((0x8U - 0x0U) / 2U)); return((gpioDataReg[(0x0U / 2U)] >> (pin % 32U)) & (uint32_t)0x1U); } //***************************************************************************** // //! Reads the data register value for specified pin. //! //! \param pin is the identifying GPIO number of the pin. //! //! The value available at the data register for the specified pin is read, as //! specified by \e pin. The value is returned for both input and output pins. //! //! The pin is specified by its numerical value. For example, GPIO34 is //! specified by passing 34 as \e pin. //! //! \sa GPIO_readPin() //! //! \return Returns the value in the data register for the specified pin. // //***************************************************************************** static inline uint32_t GPIO_readPinDataRegister(uint32_t pin) { volatile uint32_t *gpioDataReg; // // Check the arguments. // do { if(!(GPIO_isPinValid(pin))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/gpio.h", 462); } } while(0); gpioDataReg = (uint32_t *)((uintptr_t)0x00007F80U) + ((pin / 32U) * ((0x2U - 0x0U) / 2U)); return((gpioDataReg[(0x0U / 2U)] >> (pin % 32U)) & (uint32_t)0x1U); } //***************************************************************************** // //! Writes a value to the specified pin. //! //! \param pin is the identifying GPIO number of the pin. //! \param outVal is the value to write to the pin. //! //! Writes the corresponding bit values to the output pin specified by //! \e pin. Writing to a pin configured as an input pin has no effect. //! //! The pin is specified by its numerical value. For example, GPIO34 is //! specified by passing 34 as \e pin. //! //! \return None. // //***************************************************************************** static inline void GPIO_writePin(uint32_t pin, uint32_t outVal) { volatile uint32_t *gpioDataReg; uint32_t pinMask; // // Check the arguments. // do { if(!(GPIO_isPinValid(pin))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/gpio.h", 495); } } while(0); gpioDataReg = (uint32_t *)((uintptr_t)0x00007F00U) + ((pin / 32U) * ((0x8U - 0x0U) / 2U)); pinMask = (uint32_t)1U << (pin % 32U); if(outVal == 0U) { gpioDataReg[(0x4U / 2U)] = pinMask; } else { gpioDataReg[(0x2U / 2U)] = pinMask; } } //***************************************************************************** // //! Toggles the specified pin. //! //! \param pin is the identifying GPIO number of the pin. //! //! Writes the corresponding bit values to the output pin specified by //! \e pin. Writing to a pin configured as an input pin has no effect. //! //! The pin is specified by its numerical value. For example, GPIO34 is //! specified by passing 34 as \e pin. //! //! \return None. // //***************************************************************************** static inline void GPIO_togglePin(uint32_t pin) { volatile uint32_t *gpioDataReg; // // Check the arguments. // do { if(!(GPIO_isPinValid(pin))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/gpio.h", 535); } } while(0); gpioDataReg = (uint32_t *)((uintptr_t)0x00007F00U) + ((pin / 32U) * ((0x8U - 0x0U) / 2U)); gpioDataReg[(0x6U / 2U)] = (uint32_t)1U << (pin % 32U); } //***************************************************************************** // //! Reads the data on the specified port. //! //! \param port is the GPIO port being accessed in the form of \b GPIO_PORT_X //! where X is the port letter. //! //! \return Returns the value available on pin for the specified port. Each //! bit of the the return value represents a pin on the port, where bit 0 //! represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. // //***************************************************************************** static inline uint32_t GPIO_readPortData(GPIO_Port port) { volatile uint32_t *gpioDataReg; // // Get the starting address of the port's registers and return DATA. // gpioDataReg = (uint32_t *)((uintptr_t)0x00007F00U) + ((uint32_t)port * ((0x8U - 0x0U) / 2U)); return(gpioDataReg[(0x0U / 2U)]); } //***************************************************************************** // //! Reads the data written in GPIO Data Register. //! //! \param port is the GPIO port being accessed in the form of \b GPIO_PORT_X //! where X is the port letter. //! //! Reads the data written in GPIO Data Register for the specified port. In //! previous devices, read of GPIO data registers resulted in read of //! corespoinding pins. The function \b GPIO_readPortData() returns the value //! on pin. //! //! \sa GPIO_readPortData() //! //! \return Returns the value in the data register for the specified port. Each //! bit of the the return value represents a pin on the port, where bit 0 //! represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. // //***************************************************************************** static inline uint32_t GPIO_readPortDataRegister(GPIO_Port port) { volatile uint32_t *gpioDataReg; // // Get the starting address of the port's registers and return DATA. // gpioDataReg = (uint32_t *)((uintptr_t)0x00007F80U) + ((uint32_t)port * ((0x2U - 0x0U) / 2U)); return(gpioDataReg[(0x0U / 2U)]); } //***************************************************************************** // //! Writes a value to the specified port. //! //! \param port is the GPIO port being accessed. //! \param outVal is the value to write to the port. //! //! This function writes the value \e outVal to the port specified by the //! \e port parameter which takes a value in the form of \b GPIO_PORT_X where X //! is the port letter. For example, use \b GPIO_PORT_A to affect port A //! (GPIOs 0-31). //! //! The \e outVal is a bit-packed value, where each bit represents a bit on a //! GPIO port. Bit 0 represents GPIO port pin 0, bit 1 represents GPIO port //! pin 1, and so on. //! //! \return None. // //***************************************************************************** static inline void GPIO_writePortData(GPIO_Port port, uint32_t outVal) { volatile uint32_t *gpioDataReg; // // Get the starting address of the port's registers and write to DATA. // gpioDataReg = (uint32_t *)((uintptr_t)0x00007F00U) + ((uint32_t)port * ((0x8U - 0x0U) / 2U)); gpioDataReg[(0x0U / 2U)] = outVal; } //***************************************************************************** // //! Sets all of the specified pins on the specified port. //! //! \param port is the GPIO port being accessed. //! \param pinMask is a mask of which of the 32 pins on the port are affected. //! //! This function sets all of the pins specified by the \e pinMask parameter on //! the port specified by the \e port parameter which takes a value in the //! form of \b GPIO_PORT_X where X is the port letter. For example, use //! \b GPIO_PORT_A to affect port A (GPIOs 0-31). //! //! The \e pinMask is a bit-packed value, where each bit that is set identifies //! the pin to be set. Bit 0 represents GPIO port pin 0, bit 1 represents GPIO //! port pin 1, and so on. //! //! \return None. // //***************************************************************************** static inline void GPIO_setPortPins(GPIO_Port port, uint32_t pinMask) { volatile uint32_t *gpioDataReg; // // Get the starting address of the port's registers and write to SET. // gpioDataReg = (uint32_t *)((uintptr_t)0x00007F00U) + ((uint32_t)port * ((0x8U - 0x0U) / 2U)); gpioDataReg[(0x2U / 2U)] = pinMask; } //***************************************************************************** // //! Clears all of the specified pins on the specified port. //! //! \param port is the GPIO port being accessed. //! \param pinMask is a mask of which of the 32 pins on the port are affected. //! //! This function clears all of the pins specified by the \e pinMask parameter //! on the port specified by the \e port parameter which takes a value in the //! form of \b GPIO_PORT_X where X is the port letter. For example, use //! \b GPIO_PORT_A to affect port A (GPIOs 0-31). //! //! The \e pinMask is a bit-packed value, where each bit that is \b set //! identifies the pin to be cleared. Bit 0 represents GPIO port pin 0, bit 1 //! represents GPIO port pin 1, and so on. //! //! \return None. // //***************************************************************************** static inline void GPIO_clearPortPins(GPIO_Port port, uint32_t pinMask) { volatile uint32_t *gpioDataReg; // // Get the starting address of the port's registers and write to CLEAR. // gpioDataReg = (uint32_t *)((uintptr_t)0x00007F00U) + ((uint32_t)port * ((0x8U - 0x0U) / 2U)); gpioDataReg[(0x4U / 2U)] = pinMask; } //***************************************************************************** // //! Toggles all of the specified pins on the specified port. //! //! \param port is the GPIO port being accessed. //! \param pinMask is a mask of which of the 32 pins on the port are affected. //! //! This function toggles all of the pins specified by the \e pinMask parameter //! on the port specified by the \e port parameter which takes a value in the //! form of \b GPIO_PORT_X where X is the port letter. For example, use //! \b GPIO_PORT_A to affect port A (GPIOs 0-31). //! //! The \e pinMask is a bit-packed value, where each bit that is set identifies //! the pin to be toggled. Bit 0 represents GPIO port pin 0, bit 1 represents //! GPIO port pin 1, and so on. //! //! \return None. // //***************************************************************************** static inline void GPIO_togglePortPins(GPIO_Port port, uint32_t pinMask) { volatile uint32_t *gpioDataReg; // // Get the starting address of the port's registers and write to TOGGLE. // gpioDataReg = (uint32_t *)((uintptr_t)0x00007F00U) + ((uint32_t)port * ((0x8U - 0x0U) / 2U)); gpioDataReg[(0x6U / 2U)] = pinMask; } //***************************************************************************** // //! Locks the configuration of the specified pins on the specified port. //! //! \param port is the GPIO port being accessed. //! \param pinMask is a mask of which of the 32 pins on the port are affected. //! //! This function locks the configuration registers of the pins specified by //! the \e pinMask parameter on the port specified by the \e port parameter //! which takes a value in the form of \b GPIO_PORT_X where X is the port //! letter. For example, use \b GPIO_PORT_A to affect port A (GPIOs 0-31). //! //! The \e pinMask is a bit-packed value, where each bit that is set identifies //! the pin to be locked. Bit 0 represents GPIO port pin 0, bit 1 represents //! GPIO port pin 1, 0xFFFFFFFF represents all pins on that port, and so on. //! //! Note that this function is for locking the configuration of a pin such as //! the pin muxing, direction, open drain mode, and other settings. It does not //! affect the ability to change the value of the pin. //! //! \return None. // //***************************************************************************** static inline void GPIO_lockPortConfig(GPIO_Port port, uint32_t pinMask) { volatile uint32_t *gpioDataReg; // // Get the starting address of the port's registers and write to the lock. // gpioDataReg = (uint32_t *)((uintptr_t)0x00007C00U) + ((uint32_t)port * ((0x40U - 0x0U) / 2U)); __eallow(); gpioDataReg[(0x3CU / 2U)] |= pinMask; __edis(); } //***************************************************************************** // //! Unlocks the configuration of the specified pins on the specified port. //! //! \param port is the GPIO port being accessed. //! \param pinMask is a mask of which of the 32 pins on the port are affected. //! //! This function unlocks the configuration registers of the pins specified by //! the \e pinMask parameter on the port specified by the \e port parameter //! which takes a value in the form of \b GPIO_PORT_X where X is the port //! letter. For example, use \b GPIO_PORT_A to affect port A (GPIOs 0-31). //! //! The \e pinMask is a bit-packed value, where each bit that is set identifies //! the pin to be unlocked. Bit 0 represents GPIO port pin 0, bit 1 represents //! GPIO port pin 1, 0xFFFFFFFF represents all pins on that port, and so on. //! //! \return None. // //***************************************************************************** static inline void GPIO_unlockPortConfig(GPIO_Port port, uint32_t pinMask) { volatile uint32_t *gpioDataReg; // // Get the starting address of the port's registers and write to the lock. // gpioDataReg = (uint32_t *)((uintptr_t)0x00007C00U) + ((uint32_t)port * ((0x40U - 0x0U) / 2U)); __eallow(); gpioDataReg[(0x3CU / 2U)] &= ~pinMask; __edis(); } //***************************************************************************** // //! Commits the lock configuration of the specified pins on the specified port. //! //! \param port is the GPIO port being accessed. //! \param pinMask is a mask of which of the 32 pins on the port are affected. //! //! This function commits the lock configuration registers of the pins //! specified by the \e pinMask parameter on the port specified by the \e port //! parameter which takes a value in the form of \b GPIO_PORT_X where X is the //! port letter. For example, use \b GPIO_PORT_A to affect port A (GPIOs 0-31). //! //! The \e pinMask is a bit-packed value, where each bit that is set identifies //! the pin to be locked. Bit 0 represents GPIO port pin 0, bit 1 represents //! GPIO port pin 1, 0xFFFFFFFF represents all pins on that port, and so on. //! //! Note that once this function is called, GPIO_lockPortConfig() and //! GPIO_unlockPortConfig() will no longer have any effect on the specified //! pins. //! //! \return None. // //***************************************************************************** static inline void GPIO_commitPortConfig(GPIO_Port port, uint32_t pinMask) { volatile uint32_t *gpioDataReg; // // Get the starting address of the port's registers and write to the lock. // gpioDataReg = (uint32_t *)((uintptr_t)0x00007C00U) + ((uint32_t)port * ((0x40U - 0x0U) / 2U)); __eallow(); gpioDataReg[(0x3EU / 2U)] |= pinMask; __edis(); } //***************************************************************************** // //! Sets the direction and mode of the specified pin. //! //! \param pin is the identifying GPIO number of the pin. //! \param pinIO is the pin direction mode. //! //! This function configures the specified pin on the selected GPIO port as //! either input or output. //! //! The parameter \e pinIO is an enumerated data type that can be one of the //! following values: //! //! - \b GPIO_DIR_MODE_IN //! - \b GPIO_DIR_MODE_OUT //! //! where \b GPIO_DIR_MODE_IN specifies that the pin is programmed as an input //! and \b GPIO_DIR_MODE_OUT specifies that the pin is programmed as an output. //! //! The pin is specified by its numerical value. For example, GPIO34 is //! specified by passing 34 as \e pin. //! //! \return None. // //***************************************************************************** extern void GPIO_setDirectionMode(uint32_t pin, GPIO_Direction pinIO); //***************************************************************************** // //! Gets the direction mode of a pin. //! //! \param pin is the identifying GPIO number of the pin. //! //! This function gets the direction mode for a specified pin. The pin can be //! configured as either an input or output The type of direction is returned //! as an enumerated data type. //! //! \return Returns one of the enumerated data types described for //! GPIO_setDirectionMode(). // //***************************************************************************** extern GPIO_Direction GPIO_getDirectionMode(uint32_t pin); //***************************************************************************** // //! Sets the pin for the specified external interrupt. //! //! \param pin is the identifying GPIO number of the pin. //! \param extIntNum specifies the external interrupt. //! //! This function sets which pin triggers the selected external interrupt. //! //! The following defines can be used to specify the external interrupt for the //! \e extIntNum parameter: //! //! - \b GPIO_INT_XINT1 //! - \b GPIO_INT_XINT2 //! - \b GPIO_INT_XINT3 //! - \b GPIO_INT_XINT4 //! - \b GPIO_INT_XINT5 //! //! The pin is specified by its numerical value. For example, GPIO34 is //! specified by passing 34 as \e pin. //! //! \sa XBAR_setInputPin() //! //! \return None. // //***************************************************************************** extern void GPIO_setInterruptPin(uint32_t pin, GPIO_ExternalIntNum extIntNum); //***************************************************************************** // //! Sets the pad configuration for the specified pin. //! //! \param pin is the identifying GPIO number of the pin. //! \param pinType specifies the pin type. //! //! This function sets the pin type for the specified pin. The parameter //! \e pinType can be the following values: //! //! - \b GPIO_PIN_TYPE_STD specifies a push-pull output or a floating input //! - \b GPIO_PIN_TYPE_PULLUP specifies the pull-up is enabled for an input //! - \b GPIO_PIN_TYPE_OD specifies an open-drain output pin //! - \b GPIO_PIN_TYPE_INVERT specifies inverted polarity on an input //! //! \b GPIO_PIN_TYPE_INVERT may be OR-ed with \b GPIO_PIN_TYPE_STD or //! \b GPIO_PIN_TYPE_PULLUP. //! //! The pin is specified by its numerical value. For example, GPIO34 is //! specified by passing 34 as \e pin. //! //! \return None. // //***************************************************************************** extern void GPIO_setPadConfig(uint32_t pin, uint32_t pinType); //***************************************************************************** // //! Gets the pad configuration for a pin. //! //! \param pin is the identifying GPIO number of the pin. //! //! This function returns the pin type for the specified pin. The value //! returned corresponds to the values used in GPIO_setPadConfig(). //! //! \return Returns a bit field of the values \b GPIO_PIN_TYPE_STD, //! \b GPIO_PIN_TYPE_PULLUP, \b GPIO_PIN_TYPE_OD, and \b GPIO_PIN_TYPE_INVERT. // //***************************************************************************** extern uint32_t GPIO_getPadConfig(uint32_t pin); //***************************************************************************** // //! Sets the qualification mode for the specified pin. //! //! \param pin is the identifying GPIO number of the pin. //! \param qualification specifies the qualification mode of the pin. //! //! This function sets the qualification mode for the specified pin. The //! parameter \e qualification can be one of the following values: //! - \b GPIO_QUAL_SYNC //! - \b GPIO_QUAL_3SAMPLE //! - \b GPIO_QUAL_6SAMPLE //! - \b GPIO_QUAL_ASYNC //! //! To set the qualification sampling period, use //! GPIO_setQualificationPeriod(). //! //! \return None. // //***************************************************************************** extern void GPIO_setQualificationMode(uint32_t pin, GPIO_QualificationMode qualification); //***************************************************************************** // //! Gets the qualification type for the specified pin. //! //! \param pin is the identifying GPIO number of the pin. //! //! \return Returns the qualification mode in the form of one of the values //! \b GPIO_QUAL_SYNC, \b GPIO_QUAL_3SAMPLE, \b GPIO_QUAL_6SAMPLE, or //! \b GPIO_QUAL_ASYNC. // //***************************************************************************** extern GPIO_QualificationMode GPIO_getQualificationMode(uint32_t pin); //***************************************************************************** // //! Sets the qualification period for a set of pins //! //! \param pin is the identifying GPIO number of the pin. //! \param divider specifies the output drive strength. //! //! This function sets the qualification period for a set of \b 8 \b pins, //! specified by the \e pin parameter. For instance, passing in 3 as the value //! of \e pin will set the qualification period for GPIO0 through GPIO7, and a //! value of 98 will set the qualification period for GPIO96 through GPIO103. //! This is because the register field that configures the divider is shared. //! //! To think of this in terms of an equation, configuring \e pin as \b n will //! configure GPIO (n & ~(7)) through GPIO ((n & ~(7)) + 7). //! //! \e divider is the value by which the frequency of SYSCLKOUT is divided. It //! can be 1 or an even value between 2 and 510 inclusive. //! //! \return None. // //***************************************************************************** extern void GPIO_setQualificationPeriod(uint32_t pin, uint32_t divider); //***************************************************************************** // //! Selects the master core of a specified pin. //! //! \param pin is the identifying GPIO number of the pin. //! \param core is the core that is master of the specified pin. //! //! This function configures which core owns the specified pin's data registers //! (DATA, SET, CLEAR, and TOGGLE). The \e core parameter is an enumerated data //! type that specifies the core, such as \b GPIO_CORE_CPU1_CLA1 to make CPU1's //! CLA1 master of the pin. //! //! The pin is specified by its numerical value. For example, GPIO34 is //! specified by passing 34 as \e pin. //! //! \return None. // //***************************************************************************** extern void GPIO_setMasterCore(uint32_t pin, GPIO_CoreSelect core); //***************************************************************************** // //! Sets the analog mode of the specified pin. //! //! \param pin is the identifying GPIO number of the pin. //! \param mode is the selected analog mode. //! //! This function configures the specified pin for either analog or digital //! mode. Not all GPIO pins have the ability to be switched to analog mode, //! so refer to the technical reference manual for details. This setting should //! be thought of as another level of muxing. //! //! The parameter \e mode is an enumerated data type that can be one of the //! following values: //! //! - \b GPIO_ANALOG_DISABLED - Pin is in digital mode //! - \b GPIO_ANALOG_ENABLED - Pin is in analog mode //! //! The pin is specified by its numerical value. For example, GPIO34 is //! specified by passing 34 as \e pin. //! //! \return None. // //***************************************************************************** extern void GPIO_setAnalogMode(uint32_t pin, GPIO_AnalogMode mode); //***************************************************************************** // //! Configures the alternate function of a GPIO pin. //! //! \param pinConfig is the pin configuration value, specified as only one //! of the \b GPIO_#_???? values. //! //! This function configures the pin mux that selects the peripheral function //! associated with a particular GPIO pin. Only one peripheral function at a //! time can be associated with a GPIO pin, and each peripheral function should //! only be associated with a single GPIO pin at a time (despite the fact that //! many of them can be associated with more than one GPIO pin). //! //! The available mappings are supplied in pin_map.h. //! //! \return None. // //***************************************************************************** extern void GPIO_setPinConfig(uint32_t pinConfig); //***************************************************************************** // // Close the Doxygen group. //! @} // //***************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //########################################################################### // // FILE: hrcap.h // // TITLE: C28x HRCAP Driver. // //############################################################################# // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //############################################################################# //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup hrcap_api HRCAP //! @{ // //***************************************************************************** //########################################################################### // // FILE: hw_hrcap.h // // TITLE: Definitions for the HRCAP registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the HRCAP register offsets // //***************************************************************************** // Register // Register // Register // Register // Register // Interrupt Enable Register // Interrupt Flag Register // Interrupt Clear Register // Interrupt Force Register // Register // Counter Register // Capture Register // Counter Register // Capture Register //***************************************************************************** // // The following are defines for the bit fields in the ECCTL0 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ECCTL1 register // //***************************************************************************** // select // Event 1 // select // Event 2 // select // Event 3 // select // Event 4 // a Cap Event //***************************************************************************** // // The following are defines for the bit fields in the ECCTL2 register // //***************************************************************************** // for continuous // select // counter, and interrupt flags. //***************************************************************************** // // The following are defines for the bit fields in the ECEINT register // //***************************************************************************** // Enable // Enable // Enable // Enable // Enable // Enable //***************************************************************************** // // The following are defines for the bit fields in the ECFLG register // //***************************************************************************** // Flag // Flag // Flag // Flag // Flag //***************************************************************************** // // The following are defines for the bit fields in the ECCLR register // //***************************************************************************** // Clear //***************************************************************************** // // The following are defines for the bit fields in the ECFRC register // //***************************************************************************** // Interrupt // Interrupt // Interrupt // Interrupt // Interrupt //***************************************************************************** // // The following are defines for the bit fields in the ECAPSYNCINSEL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the HRCTL register // //***************************************************************************** // Select //***************************************************************************** // // The following are defines for the bit fields in the HRINTEN register // //***************************************************************************** // enable // status enable //***************************************************************************** // // The following are defines for the bit fields in the HRFLG register // //***************************************************************************** // Status Flag // Flag Bit // status Flag Bi //***************************************************************************** // // The following are defines for the bit fields in the HRCLR register // //***************************************************************************** // Interrupt Flag // Interrupt Flag Bit // check status Flag Bit //***************************************************************************** // // The following are defines for the bit fields in the HRFRC register // //***************************************************************************** // Interrupt Flag Bit // check status Flag Bit //***************************************************************************** // // Values that can be passed to HRCAP_enableCalibrationInterrupt(), // HRCAP_disableCalibrationInterrupt() as the intFlags parameter and // HRCAP_clearCalibrationFlags() and HRCAP_forceCalibrationFlags() as the flags // parameter and returned by HRCAP_getCalibrationFlags(). // //***************************************************************************** //! Global calibration interrupt flag //! //! Calibration done flag //! //! Calibration period overflow flag //! //***************************************************************************** // //! Values that can be passed to HRCAP_getCalibrationClockPeriod() as the //! \e clockSource parameter. // //***************************************************************************** typedef enum { HRCAP_CALIBRATION_CLOCK_SYSCLK = 0x0, //!< Use SYSCLK for period match. HRCAP_CALIBRATION_CLOCK_HRCLK = 0x4 //!< Use HRCLK for period match. }HRCAP_CalibrationClockSource; //***************************************************************************** // //! Values that can be passed to HRCAP_setCalibrationMode(), //! as the \e continuousMode parameter. // //***************************************************************************** typedef enum { //! Continuous calibration disabled. HRCAP_CONTINUOUS_CALIBRATION_DISABLED = 0x00, //! Continuous calibration enabled. HRCAP_CONTINUOUS_CALIBRATION_ENABLED = 0x20 }HRCAP_ContinuousCalibrationMode; //***************************************************************************** // //! \internal //! Checks HRCAP base address. //! //! \param base specifies the HRCAP module base address. //! //! This function determines if an HRCAP module base address is valid. //! //! \return Returns \b true if the base address is valid and \b false //! otherwise. // //***************************************************************************** static inline _Bool HRCAP_isBaseValid(uint32_t base) { return((base == 0x00005360U) || (base == 0x000053A0U)); } //***************************************************************************** // //! enables HRCAP. //! //! \param base is the base address of the HRCAP instance used. //! //! This function enables High Resolution Capture module. //! //! \note High resolution clock must be enabled before High Resolution Module //! is enabled. //! //! \return None. // //***************************************************************************** static inline void HRCAP_enableHighResolution(uint32_t base) { do { if(!(HRCAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrcap.h", 154); } } while(0); __eallow(); // // Set HRE bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) |= 0x1U; __edis(); } //***************************************************************************** // //! Disables HRCAP. //! //! \param base is the base address of the HRCAP instance used. //! //! This function disable High Resolution Capture module. //! //! //! \return None. // //***************************************************************************** static inline void HRCAP_disableHighResolution(uint32_t base) { do { if(!(HRCAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrcap.h", 180); } } while(0); __eallow(); // // Set HRE bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) &= ~0x1U; __edis(); } //***************************************************************************** // //! Enables high resolution clock. //! //! \param base is the base address of the HRCAP instance used. //! //! This function enables High Resolution clock. //! //! \return None. // //***************************************************************************** static inline void HRCAP_enableHighResolutionClock(uint32_t base) { do { if(!(HRCAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrcap.h", 205); } } while(0); __eallow(); // // Set HRCLKE bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) |= 0x2U; __edis(); } //***************************************************************************** // //! Disables High resolution clock. //! //! \param base is the base address of the HRCAP instance used. //! //! This function disables High Resolution clock. //! //! \return None. // //***************************************************************************** static inline void HRCAP_disbleHighResolutionClock(uint32_t base) { do { if(!(HRCAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrcap.h", 229); } } while(0); __eallow(); // // Clear HRCLKE bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) &= ~0x2U; __edis(); } //***************************************************************************** // //! Starts calibration. //! //! \param base is the base address of the HRCAP instance used. //! //! This function starts calibration. //! //! \return None. // //***************************************************************************** static inline void HRCAP_startCalibration(uint32_t base) { do { if(!(HRCAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrcap.h", 254); } } while(0); __eallow(); // // Set CALIBSTART bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) |= 0x8U; __edis(); } //***************************************************************************** // //! Sets the calibration mode. //! //! \param base is the base address of the HRCAP instance used. //! //! This function sets the the calibration mode by turning on continuous //! calibration. //! //! \return None. // //***************************************************************************** static inline void HRCAP_setCalibrationMode(uint32_t base) { do { if(!(HRCAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrcap.h", 280); } } while(0); __eallow(); // // Write to CALIBSTS and CALIBCONT bits. // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) |= 0x20U; __edis(); } //***************************************************************************** // //! Enables calibration interrupt. //! //! \param base is the base address of the HRCAP module. //! \param intFlags is the calibration interrupt flags to be enabled. //! //! This function enables HRCAP calibration interrupt flags. //! Valid values for intFlags are: //! - HRCAP_CALIBRATION_DONE - Calibration done interrupt. //! - HRCAP_CALIBRATION_PERIOD_OVERFLOW - Calibration period overflow //! check interrupt. //! \return None. // //***************************************************************************** static inline void HRCAP_enableCalibrationInterrupt(uint32_t base, uint16_t intFlags) { do { if(!(HRCAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrcap.h", 309); } } while(0); do { if(!(intFlags & (0x2U | 0x4U))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrcap.h", 311); } } while(0); __eallow(); // // Set CALIBDONE or CALPRDCHKSTS. // (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) |= intFlags; __edis(); } //***************************************************************************** // //! Disables calibration interrupt source. //! //! \param base is the base address of the HRCAP module. //! \param intFlags is the calibration interrupt flags to be disabled. //! //! This function disables HRCAP calibration interrupt flags. //! Valid values for intFlags are: //! - HRCAP_CALIBRATION_DONE - Calibration done interrupt. //! - HRCAP_CALIBRATION_PERIOD_OVERFLOW - Calibration period check //! interrupt. //! \return None. // //***************************************************************************** static inline void HRCAP_disableCalibrationInterrupt(uint32_t base, uint16_t intFlags) { do { if(!(HRCAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrcap.h", 340); } } while(0); do { if(!(intFlags & (0x2U | 0x4U))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrcap.h", 342); } } while(0); __eallow(); // // Clear CALIBDONE or CALPRDCHKSTS. // (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) &= ~intFlags; __edis(); } //***************************************************************************** // //! Returns the calibration interrupt source. //! //! \param base is the base address of the HRCAP module. //! //! This function returns the HRCAP calibration interrupt source. //! //! \return Returns the HRCAP interrupt that has occurred. The following are //! valid return values. //! - HRCAP_GLOBAL_CALIBRATION_INTERRUPT - Global calibration //! interrupt. //! - HRCAP_CALIBRATION_DONE - Calibration done interrupt. //! - HRCAP_CALIBRATION_PERIOD_OVERFLOW - Calibration period overflow //! interrupt. //! //! \note - User can check if a combination of the interrupts have occurred //! by ORing the above return values. // //***************************************************************************** static inline uint16_t HRCAP_getCalibrationFlags(uint32_t base) { do { if(!(HRCAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrcap.h", 376); } } while(0); // // Return contents of HRFLG register. // return((uint16_t)((*((volatile uint16_t *)((uintptr_t)(base + 0x6U)))) & 0x7U)); } //***************************************************************************** // //! Clears calibration flags. //! //! \param base is the base address of the HRCAP module. //! \param flags is the calibration flags to be cleared. //! //! This function clears HRCAP calibration flags. //! The following are valid values for flags. //! - HRCAP_GLOBAL_CALIBRATION_INTERRUPT - Global calibration interrupt. //! - HRCAP_CALIBRATION_DONE - Calibration done flag. //! - HRCAP_CALIBRATION_PERIOD_OVERFLOW - Calibration period overflow flag. //! //! \return None. // //***************************************************************************** static inline void HRCAP_clearCalibrationFlags(uint32_t base, uint16_t flags) { do { if(!(HRCAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrcap.h", 403); } } while(0); do { if(!((flags == (0x2U | 0x1U)) || (flags == (0x4U | 0x1U)) || (flags == (0x2U | 0x1U | 0x4U)))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrcap.h", 410); } } while(0); // // Write to HRCLR register. // (*((volatile uint16_t *)((uintptr_t)(base + 0x8U)))) |= flags; } //***************************************************************************** // //! Return the Calibration status //! //! \param base is the base address of the HRCAP instance used. //! //! This function returns the calibration status. //! //! \return This functions returns true if the calibration is in process,false //! if there is no active calibration. // //***************************************************************************** static inline _Bool HRCAP_isCalibrationBusy(uint32_t base) { do { if(!(HRCAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrcap.h", 433); } } while(0); // // Read CALIBSTS bit. // return(((*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) & 0x10U) == 0x10U); } //***************************************************************************** // //! Force a software based calibration //! //! \param base is the base address of the HRCAP instance used. //! \param flag is the calibration flag source. //! //! This function forces a software based calibration done flag. //! The following are valid values for flag. //! - HRCAP_CALIBRATION_DONE - Calibration done flag. //! - HRCAP_CALIBRATION_PERIOD_OVERFLOW - Calibration period overflow flag. //! //! \return None. // //***************************************************************************** static inline void HRCAP_forceCalibrationFlags(uint32_t base, uint16_t flag) { do { if(!(HRCAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrcap.h", 460); } } while(0); do { if(!((flag & (0x2U | 0x4U)))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrcap.h", 462); } } while(0); __eallow(); // // Write to CALIBDONE or CALPRDCHKSTS bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) |= flag; __edis(); } //***************************************************************************** // //! Sets the calibration period count //! //! \param base is the base address of the HRCAP instance used. //! \param sysclkHz is the rate of the SYSCLK in Hz. //! //! This function sets the calibration period count value to achieve a period //! of 1.6 milliseconds given the SYSCLK frequency in Hz (the \e sysclkHz //! parameter). //! //! \return None. // //***************************************************************************** static inline void HRCAP_setCalibrationPeriod(uint32_t base, uint32_t sysclkHz) { do { if(!(HRCAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrcap.h", 490); } } while(0); __eallow(); (*((volatile uint32_t *)((uintptr_t)(base + 0xCU)))) = (sysclkHz * 16U) / 10000U; __edis(); } //***************************************************************************** // //! Returns the calibration clock period //! //! \param base is the base address of the HRCAP instance used. //! \param clockSource is the calibration clock source //! (\b HRCAP_CALIBRATION_CLOCK_SYSCLK or \b HRCAP_CALIBRATION_CLOCK_HRCLK). //! //! This function returns the period match value of the calibration clock. The //! return value has a valid count when a period match occurs. //! //! \return This function returns the captured value of the clock counter //! specified by clockSource. // //***************************************************************************** static inline uint32_t HRCAP_getCalibrationClockPeriod(uint32_t base, HRCAP_CalibrationClockSource clockSource) { do { if(!(HRCAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrcap.h", 516); } } while(0); // // Return HRCAP_O_HRSYSCLKCAP or HRCAP_O_HRCLKCAP. // return((*((volatile uint32_t *)((uintptr_t)(base + 0x10U + (uint32_t)clockSource))))); } //***************************************************************************** // //! Calculates the scale factor //! //! \param base is the base address of the HRCAP instance used. //! //! This function reads the SYSCLK and HRCLK calibration periods and then //! uses them to calculate the scale factor. //! //! \return This function returns the calculated scale factor. // //***************************************************************************** static inline float32_t HRCAP_getScaleFactor(uint32_t base) { do { if(!(HRCAP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrcap.h", 539); } } while(0); // // Calculate and return the scale factor. // return((float32_t)HRCAP_getCalibrationClockPeriod(base, HRCAP_CALIBRATION_CLOCK_SYSCLK) / (float32_t)HRCAP_getCalibrationClockPeriod(base, HRCAP_CALIBRATION_CLOCK_HRCLK)); } //***************************************************************************** // //! Returns event time stamp in nanoseconds //! //! \param timeStamp is a raw time stamp count returned by //! ECAP_getEventTimeStamp(). //! \param scaleFactor is the calculated scale factor returned by //! HRCAP_getScaleFactor(). //! //! This function converts a raw CAP time stamp (the \e timeStamp parameter) to //! nanoseconds using the provided scale factor (the \e scaleFactor parameter). //! //! \return Returns the converted time stamp in nanoseconds. // //***************************************************************************** static inline float32_t HRCAP_convertEventTimeStampNanoseconds(uint32_t timeStamp, float32_t scaleFactor) { // // Convert the raw count value to nanoseconds using the given scale factor. // return((float32_t)timeStamp * scaleFactor * ((float32_t)5.0 / (float32_t)128.0)); } //***************************************************************************** // // Close the Doxygen group. //! @} // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //############################################################################# // // FILE: hrpwm.h // // TITLE: C28x HRPWM Driver // //############################################################################# // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //############################################################################# //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup hrpwm_api HRPWM //! @{ // //***************************************************************************** //########################################################################### // // FILE: hw_hrpwm.h // // TITLE: Definitions for the HRPWM registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the HRPWM register offsets // //***************************************************************************** // Register // Register // Register // Register 2 // Register // Register 2 // Register // Event Source Select Register // Register // Register // Register // Control Register // Remainder Register // Register // Register // Register For Output A // Control Register For Output A // Register For Output B // Control Register For Output B // Force Register // S/W Force Register // Edge Delay High Resolution // Mirror Register // Edge Delay High Resolution // Mirror Register // Edge Delay High Resolution // Register // Edge Delay Count Register // Resolution Register // Register 2 // Register // Select Register // Register // Digital Compare A // Digital Compare B // Register // Register // Register // Pre-Scale Register // Register // Initialization Control Register // Initialization Register // Register // Register // Register // Control Register // Control Register // Register // Counter Register // Register // Counter Register // Capture Register // Select // Select // Select // Select // Register // Register //***************************************************************************** // // The following are defines for the bit fields in the TBCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the TBCTL2 register // //***************************************************************************** // SYNC Event //***************************************************************************** // // The following are defines for the bit fields in the EPWMSYNCINSEL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the TBSTS register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the EPWMSYNCOUTEN register // //***************************************************************************** // Enable // Enable // Enable // Enable // Enable // Event 1 Sync Enable // Event 1 Sync Enable //***************************************************************************** // // The following are defines for the bit fields in the TBCTL3 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the CMPCTL register // //***************************************************************************** // Operating Mode // Operating Mode // Full Status // Full Status //***************************************************************************** // // The following are defines for the bit fields in the CMPCTL2 register // //***************************************************************************** // Mode // Mode //***************************************************************************** // // The following are defines for the bit fields in the DBCTL register // //***************************************************************************** // Control // Control //***************************************************************************** // // The following are defines for the bit fields in the DBCTL2 register // //***************************************************************************** // Select //***************************************************************************** // // The following are defines for the bit fields in the AQCTL register // //***************************************************************************** // Select // Select // Mode // Mode //***************************************************************************** // // The following are defines for the bit fields in the AQTSRCSEL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the PCCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the VCAPCTL register // //***************************************************************************** // Enable // Select //***************************************************************************** // // The following are defines for the bit fields in the VCNTCFG register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the HRCNFG register // //***************************************************************************** // Bits // Bits // Bit // Bits // Bits //***************************************************************************** // // The following are defines for the bit fields in the HRPWR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the HRMSTEP register // //***************************************************************************** // Value //***************************************************************************** // // The following are defines for the bit fields in the HRCNFG2 register // //***************************************************************************** // Bits // Bits // Bits //***************************************************************************** // // The following are defines for the bit fields in the HRPCTL register // //***************************************************************************** // Select Bit: //***************************************************************************** // // The following are defines for the bit fields in the TRREM register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the GLDCTL register // //***************************************************************************** // event control // Pulse Selection // bit // Select Register // Register //***************************************************************************** // // The following are defines for the bit fields in the GLDCFG register // //***************************************************************************** // configuration for TBPRD:TBPRDHR // configuration for CMPA:CMPAHR // configuration for CMPB:CMPBHR // configuration for CMPC // configuration for CMPD // configuration for DBRED:DBREDHR // configuration for DBFED:DBFEDHR // configuration for DBCTL // configuration for AQCTLA/A2 // configuration for AQCTLB/B2 // configuration for AQCSFRC //***************************************************************************** // // The following are defines for the bit fields in the EPWMXLINK register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the AQCTLA register // //***************************************************************************** // Down // Down //***************************************************************************** // // The following are defines for the bit fields in the AQCTLA2 register // //***************************************************************************** // T1 in UP-Count // T1 in DOWN-Count // T2 in UP-Count // T2 in DOWN-Count //***************************************************************************** // // The following are defines for the bit fields in the AQCTLB register // //***************************************************************************** // Down // Down //***************************************************************************** // // The following are defines for the bit fields in the AQCTLB2 register // //***************************************************************************** // T1 in UP-Count // T1 in DOWN-Count // T2 in UP-Count // T2 in DOWN-Count //***************************************************************************** // // The following are defines for the bit fields in the AQSFRC register // //***************************************************************************** // A Invoked // B Invoked //***************************************************************************** // // The following are defines for the bit fields in the AQCSFRC register // //***************************************************************************** // output A // output B //***************************************************************************** // // The following are defines for the bit fields in the DBREDHR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the DBRED register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the DBFEDHR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the DBFED register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the TBPHS register // //***************************************************************************** // Phase (8-bits) //***************************************************************************** // // The following are defines for the bit fields in the CMPA register // //***************************************************************************** // Register //***************************************************************************** // // The following are defines for the bit fields in the CMPB register // //***************************************************************************** // Bits //***************************************************************************** // // The following are defines for the bit fields in the GLDCTL2 register // //***************************************************************************** // shot mode // shot mode //***************************************************************************** // // The following are defines for the bit fields in the TZSEL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the TZDCSEL register // //***************************************************************************** // Event 1 // Event 2 // Event 1 // Event 2 //***************************************************************************** // // The following are defines for the bit fields in the TZCTL register // //***************************************************************************** // EPWMxA // EPWMxB //***************************************************************************** // // The following are defines for the bit fields in the TZCTL2 register // //***************************************************************************** // Count direction is UP // Count direction is DOWN // Count direction is UP // Count direction is DOWN //***************************************************************************** // // The following are defines for the bit fields in the TZCTLDCA register // //***************************************************************************** // while Count direction is UP // while Count direction is DOWN // while Count direction is UP // while Count direction is DOWN //***************************************************************************** // // The following are defines for the bit fields in the TZCTLDCB register // //***************************************************************************** // while Count direction is UP // while Count direction is DOWN // while Count direction is UP // while Count direction is DOWN //***************************************************************************** // // The following are defines for the bit fields in the TZEINT register // //***************************************************************************** // Enable // Enable // Enable // Enable // Enable // Enable //***************************************************************************** // // The following are defines for the bit fields in the TZFLG register // //***************************************************************************** // Flag // Flag // Flag // Flag // Flag //***************************************************************************** // // The following are defines for the bit fields in the TZCBCFLG register // //***************************************************************************** // Trip Latch // Trip Latch // Trip Latch // Trip Latch // Trip Latch // Trip Latch // Digital Compare Output A Event 2 // Digital Compare Output B Event 2 //***************************************************************************** // // The following are defines for the bit fields in the TZOSTFLG register // //***************************************************************************** // Trip Latch // Trip Latch // Trip Latch // Trip Latch // Trip Latch // Trip Latch // Digital Compare Output A Event 1 // Digital Compare Output B Event 1 //***************************************************************************** // // The following are defines for the bit fields in the TZCLR register // //***************************************************************************** // Latch //***************************************************************************** // // The following are defines for the bit fields in the TZCBCCLR register // //***************************************************************************** // (CBC1) Trip Latch // (CBC2) Trip Latch // (CBC3) Trip Latch // (CBC4) Trip Latch // (CBC5) Trip Latch // (CBC6) Trip Latch // selected for CBC // selected for CBC //***************************************************************************** // // The following are defines for the bit fields in the TZOSTCLR register // //***************************************************************************** // Trip Latch // Trip Latch // Trip Latch // Trip Latch // Trip Latch // Trip Latch // selected for OST // selected for OST //***************************************************************************** // // The following are defines for the bit fields in the TZFRC register // //***************************************************************************** // Cycle Event // Event // 1 // 2 // 1 // 2 //***************************************************************************** // // The following are defines for the bit fields in the ETSEL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ETPS register // //***************************************************************************** // Bits // Selection Bits //***************************************************************************** // // The following are defines for the bit fields in the ETFLG register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ETCLR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ETFRC register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ETINTPS register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ETSOCPS register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the ETCNTINITCTL register // //***************************************************************************** // Initialization Force // Initialization Force // Initialization Force // Initialization Enable // Initialization Enable // Initialization Enable //***************************************************************************** // // The following are defines for the bit fields in the ETCNTINIT register // //***************************************************************************** // Initialization Bits // Initialization Bits // Initialization Bits //***************************************************************************** // // The following are defines for the bit fields in the DCTRIPSEL register // //***************************************************************************** // Input Select // Input Select // Input Select // Input Select //***************************************************************************** // // The following are defines for the bit fields in the DCACTL register // //***************************************************************************** // select // DCAEVT1LAT signal. // select // DCAEVT2LAT signal. //***************************************************************************** // // The following are defines for the bit fields in the DCBCTL register // //***************************************************************************** // select // DCBEVT1LAT signal. // select // DCBEVT2LAT signal. //***************************************************************************** // // The following are defines for the bit fields in the DCFCTL register // //***************************************************************************** // Select // Capture Alignment //***************************************************************************** // // The following are defines for the bit fields in the DCCAPCTL register // //***************************************************************************** // Capture Event // Clear Flag //***************************************************************************** // // The following are defines for the bit fields in the DCAHTRIPSEL register // //***************************************************************************** // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux //***************************************************************************** // // The following are defines for the bit fields in the DCALTRIPSEL register // //***************************************************************************** // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux //***************************************************************************** // // The following are defines for the bit fields in the DCBHTRIPSEL register // //***************************************************************************** // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux //***************************************************************************** // // The following are defines for the bit fields in the DCBLTRIPSEL register // //***************************************************************************** // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux // Mux //***************************************************************************** // // The following are defines for the bit fields in the EPWMLOCK register // //***************************************************************************** // Lock // Lock //############################################################################# // // FILE: hrpwm.h // // TITLE: C28x HRPWM Driver // //############################################################################# // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //############################################################################# //***************************************************************************** // //! Values that can be passed to HRPWM_setMEPEdgeSelect(), //! HRPWM_setMEPControlMode(), HRPWM_setCounterCompareShadowLoadEvent() //! as the \e channel parameter. // //***************************************************************************** typedef enum { HRPWM_CHANNEL_A = 0, //!< HRPWM A HRPWM_CHANNEL_B = 8 //!< HRPWM B } HRPWM_Channel; //***************************************************************************** // //! Values that can be passed to HRPWM_setMEPEdgeSelect() as the \e mepEdgeMode //! parameter. // //***************************************************************************** typedef enum { //! HRPWM is disabled HRPWM_MEP_CTRL_DISABLE = 0, //! MEP controls rising edge HRPWM_MEP_CTRL_RISING_EDGE = 1, //! MEP controls falling edge HRPWM_MEP_CTRL_FALLING_EDGE = 2, //! MEP controls both rising and falling edge HRPWM_MEP_CTRL_RISING_AND_FALLING_EDGE = 3 } HRPWM_MEPEdgeMode; //***************************************************************************** // //! Values that can be passed to HRPWM_setHRMEPCtrlMode() as the \e //! parameter. // //***************************************************************************** typedef enum { //! CMPAHR/CMPBHR or TBPRDHR controls MEP edge HRPWM_MEP_DUTY_PERIOD_CTRL = 0, //! TBPHSHR controls MEP edge HRPWM_MEP_PHASE_CTRL = 1 } HRPWM_MEPCtrlMode; //***************************************************************************** // //! Values that can be passed to HRPWM_setCounterCompareShadowLoadEvent(), //! HRPWM_setRisingEdgeDelayLoadMode() and HRPWM_setFallingEdgeDelayLoadMode //! as the \e loadEvent parameter. // //***************************************************************************** typedef enum { //! load when counter equals zero HRPWM_LOAD_ON_CNTR_ZERO = 0, //! load when counter equals period HRPWM_LOAD_ON_CNTR_PERIOD = 1, //! load when counter equals zero or period HRPWM_LOAD_ON_CNTR_ZERO_PERIOD = 2 } HRPWM_LoadMode; //***************************************************************************** // //! Values that can be passed to HRPWM_setChannelBOutputPath() as the \e //! outputOnB parameter. // //***************************************************************************** typedef enum { HRPWM_OUTPUT_ON_B_NORMAL = 0, //!< ePWMxB output is normal. HRPWM_OUTPUT_ON_B_INV_A = 1 //!< ePWMxB output is inverted //!< version of ePWMxA signal } HRPWM_ChannelBOutput; //***************************************************************************** // //! Values that can be passed to HRPWM_setSyncPulseSource() as the \e //! syncPulseSource parameter. // //***************************************************************************** typedef enum { //! Counter equals Period HRPWM_PWMSYNC_SOURCE_PERIOD = 0, //! Counter equals zero HRPWM_PWMSYNC_SOURCE_ZERO = 1, //! Counter equals COMPC when counting up HRPWM_PWMSYNC_SOURCE_COMPC_UP = 4, //! Counter equals COMPC when counting down HRPWM_PWMSYNC_SOURCE_COMPC_DOWN = 5, //! Counter equals COMPD when counting up HRPWM_PWMSYNC_SOURCE_COMPD_UP = 6, //! Counter equals COMPD when counting down HRPWM_PWMSYNC_SOURCE_COMPD_DOWN = 7 } HRPWM_SyncPulseSource; //***************************************************************************** // //! Values that can be passed to HRPWM_setCounterCompareValue() as the \e //! compModule parameter. // //***************************************************************************** typedef enum { HRPWM_COUNTER_COMPARE_A = 0, //!< counter compare A HRPWM_COUNTER_COMPARE_B = 4 //!< counter compare B } HRPWM_CounterCompareModule; //***************************************************************************** // //! Values that can be passed to HRPWM_setDeadbandMEPEdgeSelect() as the \e //! mepDBEdge. // //***************************************************************************** typedef enum { //! HRPWM is disabled HRPWM_DB_MEP_CTRL_DISABLE = 0, //! MEP controls Rising Edge Delay HRPWM_DB_MEP_CTRL_RED = 1, //! MEP controls Falling Edge Delay HRPWM_DB_MEP_CTRL_FED = 2, //! MEP controls both Falling and Rising edge delay HRPWM_DB_MEP_CTRL_RED_FED = 3 } HRPWM_MEPDeadBandEdgeMode; //***************************************************************************** // //! Values that can be passed to HRPWM_lockRegisters() as the \e registerGroup //! parameter. // //***************************************************************************** typedef enum { HRPWM_REGISTER_GROUP_HRPWM = 0x1, //!< HRPWM register group HRPWM_REGISTER_GROUP_GLOBAL_LOAD = 0x2, //!< Global load register group HRPWM_REGISTER_GROUP_TRIP_ZONE = 0x4, //!< Trip zone register group HRPWM_REGISTER_GROUP_TRIP_ZONE_CLEAR = 0x8, //!< Trip zone clear group HRPWM_REGISTER_GROUP_DIGITAL_COMPARE = 0x10 //!< Digital compare group } HRPWM_LockRegisterGroup; //***************************************************************************** // // Functions APIs shared with ePWM module // //***************************************************************************** // // Time Base Sub Module related APIs // // // Action Qualifier module related APIs // // // Dead Band Module related APIs // // // Chopper module related APIs // // // Trip Zone module related APIs // // // HRPWM_getTripZoneInterruptStatus API define is obsolete please use // HRPWM_getTripZoneFlagStatus going forward. // // // HRPWM_getCycleByCycleTripZoneInterruptStatus API define is obsolete // please use HRPWM_getCycleByCycleTripZoneFlagStatus going forward. // // // HRPWM_getOneShotTripZoneInterruptStatus is obsolete please use // HRPWM_getOneShotTripZoneFlagStatus going forward. // // // HRPWM_clearTripZoneInterruptFlag is obsolete please use // HRPWM_clearTripZoneFlag going forward. // // // HRPWM_clearCycleByCycleTripZoneInterruptFlag is obsolete please use // HRPWM_clearCycleByCycleTripZoneFlag going forward. // // // HRPWM_clearOneShotTripZoneInterruptFlag is obsolete please use // HRPWM_clearOneShotTripZoneFlag going forward. // // // Event Trigger related APIs // // // ADC SOC configuration related APIs // // // Digital Compare Module related APIs // // // Valley switching related APIs // // // Global Load feature related APIs // //***************************************************************************** // // Prototypes for the API. // //***************************************************************************** //***************************************************************************** // //! \internal //! Checks HRPWM base address. //! //! \param base specifies the HRPWM module base address. //! //! This function determines if an HRPWM module base address is valid. //! //! \return Returns \b true if the base address is valid and \b false //! otherwise. // //***************************************************************************** static inline _Bool HRPWM_isBaseValid(uint32_t base) { return((base == 0x00004000U) || (base == 0x00004100U) || (base == 0x00004200U) || (base == 0x00004300U) || (base == 0x00004400U) || (base == 0x00004500U) || (base == 0x00004600U) || (base == 0x00004700U)); } //***************************************************************************** // //! Sets the consolidated phase shift value in high resolution mode. //! //! \param base is the base address of the EPWM module. //! \param phaseCount is the consolidated phase shift count value. //! //! This function sets the consolidated phase shift value, that is, both TBPHS //! and TBPHSHR values are configured together. //! //! Call EPWM_enablePhaseShiftLoad & HRPWM_enableHRPhaseShiftLoad() functions //! to enable loading of the phaseCount in high resolution mode. //! //! \b Note: phaseCount is a 24-bit value. //! \b Note: For configuring TBPHS = 0x3C, TBPHSHR = 0x2; //! phaseCount = 0x3C02 //! //! \return None. // //***************************************************************************** static inline void HRPWM_setPhaseShift(uint32_t base, uint32_t phaseCount) { // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 556); } } while(0); do { if(!(phaseCount < 0x1000000U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 557); } } while(0); // // Write to TBPHS:TBPHSHR bits // (*((volatile uint32_t *)((uintptr_t)(base + 0x60U)))) = phaseCount << 8U; } //***************************************************************************** // //! Sets only the high resolution phase shift value. //! //! \param base is the base address of the EPWM module. //! \param hrPhaseCount is the high resolution phase shift count value. //! //! This function sets only the high resolution phase shift(TBPHSHR) value. //! Call the HRPWM_enableHRPhaseShiftLoad() function to enable loading of //! the hrPhaseCount. //! //! \b Note: hrPhaseCount is an 8-bit value. //! //! \return None. // //***************************************************************************** static inline void HRPWM_setHiResPhaseShiftOnly(uint32_t base, uint16_t hrPhaseCount) { // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 587); } } while(0); do { if(!(hrPhaseCount < 256U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 588); } } while(0); // // Write to TBPHSHR bits // (*((volatile uint16_t *)((uintptr_t)(base + 0x60U)))) = hrPhaseCount << 8U; } //***************************************************************************** // //! Sets the consolidated period of time base counter used in HR mode. //! //! \param base is the base address of the EPWM module. //! \param periodCount is the consolidated period count value. //! //! This function sets the consolidated period of time base counter value //! (TBPRD:TBPRDHR) required in high resolution mode. //! //! User should map the desired period or frequency of the waveform into //! the correct periodCount. //! //! \b Note: periodCount is a 24 bit value. //! \b Note: For configuring TBPRD = 0x3C, TBPRDHR = 0xA; //! periodCount = 0x3C0A //! //! \return None. // //***************************************************************************** static inline void HRPWM_setTimeBasePeriod(uint32_t base, uint32_t periodCount) { // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 622); } } while(0); do { if(!(periodCount < 0x1000000U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 623); } } while(0); // // Write to TBPRD:TBPRDHR bits // (*((volatile uint32_t *)((uintptr_t)(base + 0x62U)))) = periodCount << 8U; } //***************************************************************************** // //! Sets only the high resolution time base counter. //! //! \param base is the base address of the EPWM module. //! \param hrPeriodCount is the high resolution period count value. //! //! This function sets only the high resolution time base counter(TBPRDHR) //! value. //! //! User should map the desired period or frequency of the waveform into //! the correct hrPeriodCount. //! //! \b Note: hrPeriodCount is an 8-bit value. //! //! \return None. // //***************************************************************************** static inline void HRPWM_setHiResTimeBasePeriodOnly(uint32_t base, uint16_t hrPeriodCount) { // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 655); } } while(0); do { if(!(hrPeriodCount < 256U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 656); } } while(0); // // Write to TBPRDHR bits // (*((volatile uint16_t *)((uintptr_t)(base + 0x62U)))) = hrPeriodCount << 8U; } //***************************************************************************** // //! Gets the consolidated time base period count used in HR mode //! //! \param base is the base address of the EPWM module. //! //! This function gets the consolidated time base period(TBPRD:TBPRDHR) value //! used in high resolution mode. //! //! \return The consolidated time base period count value. // //***************************************************************************** static inline uint32_t HRPWM_getTimeBasePeriod(uint32_t base) { // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 682); } } while(0); // // Read from TBPRD:TBPRDHR bit // return((*((volatile uint32_t *)((uintptr_t)(base + 0x62U)))) >> 8U); } //***************************************************************************** // //! Gets the only the high resolution time base period count. //! //! \param base is the base address of the EPWM module. //! //! This function gets only the high resolution time base period(TBPRDHR) value. //! //! \return The high resolution time base period count value. // //***************************************************************************** static inline uint16_t HRPWM_getHiResTimeBasePeriodOnly(uint32_t base) { // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 707); } } while(0); // // Read from TBPRDHR bit // return((*((volatile uint16_t *)((uintptr_t)(base + 0x62U)))) >> 8U); } //***************************************************************************** // //! Sets the high resolution edge controlled by MEP (Micro Edge Positioner). //! //! \param base is the base address of the EPWM module. //! \param channel is high resolution period module. //! \param mepEdgeMode edge of the PWM that is controlled by MEP (Micro Edge //! Positioner). //! //! This function sets the edge of the PWM that is controlled by MEP (Micro //! Edge Positioner). Valid values for the parameters are: //! - channel //! - HRPWM_CHANNEL_A - HRPWM A //! - HRPWM_CHANNEL_B - HRPWM B //! - mepEdgeMode //! - HRPWM_MEP_CTRL_DISABLE - HRPWM is disabled //! - HRPWM_MEP_CTRL_RISING_EDGE - MEP (Micro Edge Positioner) //! controls rising edge. //! - HRPWM_MEP_CTRL_FALLING_EDGE - MEP (Micro Edge Positioner) //! controls falling edge. //! - HRPWM_MEP_CTRL_RISING_AND_FALLING_EDGE - MEP (Micro Edge Positioner) //! controls both edges. //! //! \return None. // //***************************************************************************** static inline void HRPWM_setMEPEdgeSelect(uint32_t base, HRPWM_Channel channel, HRPWM_MEPEdgeMode mepEdgeMode) { // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 748); } } while(0); // // Set the edge mode // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x20U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x20U)))) & ~(0x3U << (uint16_t)channel )) | ((uint16_t)mepEdgeMode << (uint16_t)channel)); __edis(); } //***************************************************************************** // //! Sets the MEP (Micro Edge Positioner) control mode. //! //! \param base is the base address of the EPWM module. //! \param channel is high resolution period module. //! \param mepCtrlMode is the MEP (Micro Edge Positioner) control mode. //! //! This function sets the mode (register type) the MEP (Micro Edge Positioner) //! will control. Valid values for the parameters are: //! - channel //! - HRPWM_CHANNEL_A - HRPWM A //! - HRPWM_CHANNEL_B - HRPWM B //! - mepCtrlMode //! - HRPWM_MEP_DUTY_PERIOD_CTRL - MEP (Micro Edge Positioner) is //! controlled by value of CMPAHR/ //! CMPBHR(depending on the value of //! channel) or TBPRDHR. //! - HRPWM_MEP_PHASE_CTRL - MEP (Micro Edge Positioner) is //! controlled by TBPHSHR. //! //! \return None. // //***************************************************************************** static inline void HRPWM_setMEPControlMode(uint32_t base, HRPWM_Channel channel, HRPWM_MEPCtrlMode mepCtrlMode) { // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 791); } } while(0); // // Set the MEP control // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x20U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x20U)))) & ~(0x1U << ((uint16_t)channel + 2U))) | ((uint16_t)mepCtrlMode << ((uint16_t)channel + 2U))); __edis(); } //***************************************************************************** // //! Sets the high resolution comparator load mode. //! //! \param base is the base address of the EPWM module. //! \param channel is high resolution period module. //! \param loadEvent is the MEP (Micro Edge Positioner) control mode. //! //! This function sets the shadow load mode of the high resolution comparator. //! The function sets the COMPA or COMPB register depending on the channel //! variable. //! Valid values for the parameters are: //! - channel //! - HRPWM_CHANNEL_A - HRPWM A //! - HRPWM_CHANNEL_B - HRPWM B //! - loadEvent //! - HRPWM_LOAD_ON_CNTR_ZERO - load when counter equals zero //! - HRPWM_LOAD_ON_CNTR_PERIOD - load when counter equals period //! - HRPWM_LOAD_ON_CNTR_ZERO_PERIOD - load when counter equals zero or //! period //! //! \return None. // //***************************************************************************** static inline void HRPWM_setCounterCompareShadowLoadEvent(uint32_t base, HRPWM_Channel channel, HRPWM_LoadMode loadEvent) { // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 834); } } while(0); // // Set the CMPAHR or CMPBHR load mode // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x20U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x20U)))) & ~(0x3U << ((uint16_t)channel + 3U))) | ((uint16_t)loadEvent << ((uint16_t)channel + 3U))); __edis(); } //***************************************************************************** // //! Sets the high resolution output swap mode. //! //! \param base is the base address of the EPWM module. //! \param enableOutputSwap is the output swap flag. //! //! This function sets the HRPWM output swap mode. If enableOutputSwap is true, //! ePWMxA signal appears on ePWMxB output and ePWMxB signal appears on ePWMxA //! output. If it is false ePWMxA and ePWMxB outputs are unchanged. //! //! \return None. // //***************************************************************************** static inline void HRPWM_setOutputSwapMode(uint32_t base, _Bool enableOutputSwap) { // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 866); } } while(0); // // Set output swap mode // __eallow(); if(enableOutputSwap) { (*((volatile uint16_t *)((uintptr_t)(base + 0x20U)))) |= 0x80U; } else { (*((volatile uint16_t *)((uintptr_t)(base + 0x20U)))) &= ~0x80U; } __edis(); } //***************************************************************************** // //! Sets the high resolution output on ePWMxB //! //! \param base is the base address of the EPWM module. //! \param outputOnB is the output signal on ePWMxB. //! //! This function sets the HRPWM output signal on ePWMxB. If outputOnB is //! HRPWM_OUTPUT_ON_B_INV_A, ePWMxB output is an inverted version of //! ePWMxA. If outputOnB is HRPWM_OUTPUT_ON_B_NORMAL, ePWMxB output is //! ePWMxB. //! //! \return None. // //***************************************************************************** static inline void HRPWM_setChannelBOutputPath(uint32_t base, HRPWM_ChannelBOutput outputOnB) { // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 904); } } while(0); // // Set the output on ePWM B // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x20U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x20U)))) & ~(0x20U)) | ((uint16_t)outputOnB << 5U)); __edis(); } //***************************************************************************** // //! Enables MEP (Micro Edge Positioner) automatic scale mode. //! //! \param base is the base address of the EPWM module. //! //! This function enables the MEP (Micro Edge Positioner) to automatically //! scale HRMSTEP. //! //! \return None. // //***************************************************************************** static inline void HRPWM_enableAutoConversion(uint32_t base) { // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 934); } } while(0); // // Enable MEP automatic scale // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x20U)))) |= 0x40U; __edis(); } //***************************************************************************** // //! Disables MEP automatic scale mode. //! //! \param base is the base address of the EPWM module. //! //! This function disables the MEP (Micro Edge Positioner) from automatically //! scaling HRMSTEP. //! //! \return None. // //***************************************************************************** static inline void HRPWM_disableAutoConversion(uint32_t base) { // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 962); } } while(0); // // Disable MEP automatic scale // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x20U)))) &= ~0x40U; __edis(); } //***************************************************************************** // //! Enable high resolution period feature. //! //! \param base is the base address of the EPWM module. //! //! This function enables the high resolution period feature. //! //! \return None. // //***************************************************************************** static inline void HRPWM_enablePeriodControl(uint32_t base) { // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 989); } } while(0); // // Set HRPE bit // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x2DU)))) |= 0x1U; __edis(); } //***************************************************************************** // //! Disable high resolution period feature. //! //! \param base is the base address of the EPWM module. //! //! This function disables the high resolution period feature. //! //! \return None. // //***************************************************************************** static inline void HRPWM_disablePeriodControl(uint32_t base) { // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 1016); } } while(0); // // Clear HRPE bit // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x2DU)))) &= ~0x1U; __edis(); } //***************************************************************************** // //! Enable high resolution phase load //! //! \param base is the base address of the EPWM module. //! //! This function enables loading of high resolution phase shift value which is //! set by the function HRPWM_setPhaseShift(). //! //! \return None. // //***************************************************************************** static inline void HRPWM_enablePhaseShiftLoad(uint32_t base) { // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 1044); } } while(0); // // Set TBPHSHRLOADE bit // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x2DU)))) |= 0x4U; __edis(); } //***************************************************************************** // //! Disable high resolution phase load //! //! \param base is the base address of the EPWM module. //! //! This function disables loading of high resolution phase shift value. //! //! \return // //***************************************************************************** static inline void HRPWM_disablePhaseShiftLoad(uint32_t base) { // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 1071); } } while(0); // // Clear TBPHSHRLOADE bit // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x2DU)))) &= ~0x4U; __edis(); } //***************************************************************************** // //! Set high resolution PWMSYNC source. //! //! \param base is the base address of the EPWM module. //! \param syncPulseSource is the PWMSYNC source. //! //! This function sets the high resolution PWMSYNC pulse source. //! Valid values for syncPulseSource are: //! - HRPWM_PWMSYNC_SOURCE_PERIOD - Counter equals Period. //! - HRPWM_PWMSYNC_SOURCE_ZERO - Counter equals zero. //! - HRPWM_PWMSYNC_SOURCE_COMPC_UP - Counter equals COMPC when //! counting up. //! - HRPWM_PWMSYNC_SOURCE_COMPC_DOWN - Counter equals COMPC when //! counting down. //! - HRPWM_PWMSYNC_SOURCE_COMPD_UP - Counter equals COMPD when //! counting up. //! - HRPWM_PWMSYNC_SOURCE_COMPD_DOWN - Counter equals COMPD when //! counting down. //! //! \return None. // //***************************************************************************** static inline void HRPWM_setSyncPulseSource(uint32_t base, HRPWM_SyncPulseSource syncPulseSource) { // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 1110); } } while(0); // // Set the PWMSYNC source // __eallow(); // // Configuration for sync pulse source equal to HRPWM_PWMSYNC_SOURCE_PERIOD // or HRPWM_PWMSYNC_SOURCE_ZERO // if(syncPulseSource < HRPWM_PWMSYNC_SOURCE_COMPC_UP) { (*((volatile uint16_t *)((uintptr_t)(base + 0x2DU)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x2DU)))) & ~(0x70U | 0x2U)) | ((uint16_t)syncPulseSource << 1U)); } else { (*((volatile uint16_t *)((uintptr_t)(base + 0x2DU)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x2DU)))) & ~0x70U) | ((uint16_t)syncPulseSource << 4U)); } __edis(); } //***************************************************************************** // //! Sets the Translator Remainder value. //! //! \param base is the base address of the EPWM module. //! \param trremVal is the translator remainder value. //! //! This function sets the Translator Remainder value. //! //! \return None. // //***************************************************************************** static inline void HRPWM_setTranslatorRemainder(uint32_t base, uint16_t trremVal) { // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 1155); } } while(0); do { if(!(trremVal < 2048U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 1156); } } while(0); // // Set Translator Remainder value // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x2EU)))) = (trremVal & 0x7FFU); __edis(); } //***************************************************************************** // //! Sets the consolidated counter compare values in HR mode. //! //! \param base is the base address of the EPWM module. //! \param compModule is the Counter Compare module. //! \param compCount is the consolidated counter compare count value. //! //! This function sets the consolidated counter compare(CMPx:CMPxHR) value //! required in high resolution mode for counter compare registers. //! Valid values for compModule are: //! - HRPWM_COUNTER_COMPARE_A - counter compare A. //! - HRPWM_COUNTER_COMPARE_B - counter compare B. //! //! \b Note: compCount is a 24 bit value. //! \b Note: For configuring CMPA = 0xB4, CMPAHR = 0x64; value of //! compCount = 0xB464 //! //! \return None. // //***************************************************************************** static inline void HRPWM_setCounterCompareValue(uint32_t base, HRPWM_CounterCompareModule compModule, uint32_t compCount) { // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 1195); } } while(0); do { if(!(compCount < 0x1000000U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 1196); } } while(0); // // Write to counter compare registers // if(compModule == HRPWM_COUNTER_COMPARE_A) { // // Write to CMPA:CMPAHR // (*((volatile uint32_t *)((uintptr_t)(base + 0x6AU)))) = compCount << 8U; } else { // // Write to CMPB:CMPBHR // (*((volatile uint32_t *)((uintptr_t)(base + 0x6CU)))) = compCount << 8U; } } //***************************************************************************** // //! Sets only the high resolution counter compare value. //! //! \param base is the base address of the EPWM module. //! \param compModule is the Counter Compare module. //! \param hrCompCount is the high resolution counter compare count value. //! //! This function sets the high resolution counter compare value(CMPxHR) for //! counter compare registers. //! Valid values for compModule are: //! - HRPWM_COUNTER_COMPARE_A - counter compare A. //! - HRPWM_COUNTER_COMPARE_B - counter compare B. //! //! \b Note: hrCompCount is an 8-bit value. //! //! \return None. // //***************************************************************************** static inline void HRPWM_setHiResCounterCompareValueOnly(uint32_t base, HRPWM_CounterCompareModule compModule, uint16_t hrCompCount) { // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 1244); } } while(0); do { if(!(hrCompCount < 256U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 1245); } } while(0); // // Write to the high resolution counter compare registers // if(compModule == HRPWM_COUNTER_COMPARE_A) { // // Write to CMPAHR // (*((volatile uint16_t *)((uintptr_t)(base + 0x6AU)))) = hrCompCount << 8U; } else { // // Write to CMPBHR // (*((volatile uint16_t *)((uintptr_t)(base + 0x6CU)))) = hrCompCount << 8U; } } //***************************************************************************** // //! Gets the consolidated counter compare values. //! //! \param base is the base address of the EPWM module. //! \param compModule is the Counter Compare module value. //! //! This function gets the consolidated counter compare(CMPx:CMPxHR) value //! used in high resolution for the counter compare module specified. //! Valid values for compModule are: //! - HRPWM_COUNTER_COMPARE_A - counter compare A. //! - HRPWM_COUNTER_COMPARE_B - counter compare B. //! //! //! \return None. // //***************************************************************************** static inline uint32_t HRPWM_getCounterCompareValue(uint32_t base, HRPWM_CounterCompareModule compModule) { uint32_t compCount; // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 1292); } } while(0); // // Get counter compare value for selected module // if(compModule == HRPWM_COUNTER_COMPARE_A) { // // Read from CMPAHR // compCount = (*((volatile uint32_t *)((uintptr_t)(base + 0x6AU)))) >> 8U; } else { // // Read from CMPBHR // compCount = (*((volatile uint32_t *)((uintptr_t)(base + 0x6CU)))) >> 8U; } return(compCount); } //***************************************************************************** // //! Gets only the high resolution counter compare values. //! //! \param base is the base address of the EPWM module. //! \param compModule is the Counter Compare module value. //! //! This function gets only the high resolution counter compare(CMPxHR) value //! for the counter compare module specified. //! Valid values for compModule are: //! - HRPWM_COUNTER_COMPARE_A - counter compare A. //! - HRPWM_COUNTER_COMPARE_B - counter compare B. //! //! \return None. // //***************************************************************************** static inline uint16_t HRPWM_getHiResCounterCompareValueOnly(uint32_t base, HRPWM_CounterCompareModule compModule) { uint16_t hrCompCount; // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 1339); } } while(0); // // Get counter compare value for selected module // if(compModule == HRPWM_COUNTER_COMPARE_A) { // // Read from CMPAHR // hrCompCount = (*((volatile uint16_t *)((uintptr_t)(base + 0x6AU)))) >> 8U; } else { // // Read from CMPBHR // hrCompCount = (*((volatile uint16_t *)((uintptr_t)(base + 0x6CU)))) >> 8U; } return(hrCompCount); } //***************************************************************************** // //! Sets the consolidated RED count in high resolution mode. //! //! \param base is the base address of the EPWM module. //! \param redCount is the high resolution RED count. //! //! This function sets the consolidated RED (Rising Edge Delay) count //! (DBRED:DBREDHR) value used in high resolution mode. The value of //! redCount should be less than 0x200000. //! //! \b Note: redCount is a 21 bit value. //! \b Note: For configuring DBRED = 0x4, DBREDHR = 0x1; value of //! redCount = ((0x4 << 7) | 0x1) = 0x201 //! //! \return None. // //***************************************************************************** static inline void HRPWM_setRisingEdgeDelay(uint32_t base, uint32_t redCount) { // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 1385); } } while(0); do { if(!(redCount < 0x200000)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 1386); } } while(0); // // Set the consolidated RED (Rising Edge Delay) count // (*((volatile uint32_t *)((uintptr_t)(base + 0x50U)))) = redCount << 9U; } //***************************************************************************** // //! Sets the high resolution RED count only. //! //! \param base is the base address of the EPWM module. //! \param hrRedCount is the high resolution RED count. //! //! This function sets only the high resolution RED (Rising Edge Delay) //! count(DBREDHR) value. //! The value of hrRedCount should be less than 128. //! //! \b Note: hrRedCount is a 7-bit value. //! //! \return None. // //***************************************************************************** static inline void HRPWM_setHiResRisingEdgeDelayOnly(uint32_t base, uint16_t hrRedCount) { // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 1416); } } while(0); do { if(!(hrRedCount < 128U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 1417); } } while(0); // // Set the High Resolution RED (Rising Edge Delay) count only // (*((volatile uint16_t *)((uintptr_t)(base + 0x50U)))) = hrRedCount << 9U; } //***************************************************************************** // //! Sets the consolidated FED value in high resolution mode. //! //! \param base is the base address of the EPWM module. //! \param fedCount is the high resolution FED count. //! //! This function sets the consolidated FED (Falling Edge Delay) count //! (DBFED: DBFEDHR) value used in high resolution mode. The value of fedCount //! should be less than 0x200000. //! //! \b Note: fedCount is a 21 bit value. //! \b Note: For configuring DBFED = 0x4, DBFEDHR = 0x1; value of //! fedCount = ((0x4 << 7) | 0x1) = 0x201 //! //! \return None. // //***************************************************************************** static inline void HRPWM_setFallingEdgeDelay(uint32_t base, uint32_t fedCount) { // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 1449); } } while(0); do { if(!(fedCount < 0x200000)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 1450); } } while(0); // // Set the High Resolution FED (Falling Edge Delay) count // (*((volatile uint32_t *)((uintptr_t)(base + 0x52U)))) = fedCount << 9U; } //***************************************************************************** // //! Sets high resolution FED count only. //! //! \param base is the base address of the EPWM module. //! \param hrFedCount is the high resolution FED count. //! //! This function sets only the high resolution FED (Falling Edge Delay) count //! (DBFEDHR)value. The value of hrFedCount should be less than 128. //! //! \b Note: hrFedCount is a 7-bit value. //! //! \return None. // //***************************************************************************** static inline void HRPWM_setHiResFallingEdgeDelayOnly(uint32_t base, uint16_t hrFedCount) { // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 1479); } } while(0); do { if(!(hrFedCount < 128U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 1480); } } while(0); // // Set the high resolution FED (Falling Edge Delay) count // (*((volatile uint16_t *)((uintptr_t)(base + 0x52U)))) = hrFedCount << 9U; } //***************************************************************************** // //! Set high resolution MEP (Micro Edge Positioner) step. //! //! \param base is the base address of the EPWM module. //! \param mepCount is the high resolution MEP (Micro Edge Positioner) step //! count. //! //! This function sets the high resolution MEP (Micro Edge Positioner) step //! count. The maximum value for the MEP count step is 255. //! //! \return None. // //***************************************************************************** static inline void HRPWM_setMEPStep(uint32_t base, uint16_t mepCount) { // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 1508); } } while(0); do { if(!(mepCount < 256U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 1509); } } while(0); // // Set HRPWM MEP count // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x26U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x26U)))) & ~0xFFU) | mepCount); __edis(); } //***************************************************************************** // //! Set high resolution Dead Band MEP (Micro Edge Positioner) control. //! //! \param base is the base address of the EPWM module. //! \param mepDBEdge is the high resolution MEP (Micro Edge Positioner) control //! edge. //! //! This function sets the high resolution Dead Band edge that the MEP (Micro //! Edge Positioner) controls Valid values for mepDBEdge are: //! - HRPWM_DB_MEP_CTRL_DISABLE - HRPWM is disabled //! - HRPWM_DB_MEP_CTRL_RED - MEP (Micro Edge Positioner) controls //! Rising Edge Delay //! - HRPWM_DB_MEP_CTRL_FED - MEP (Micro Edge Positioner) controls //! Falling Edge Delay //! - HRPWM_DB_MEP_CTRL_RED_FED - MEP (Micro Edge Positioner) controls both //! Falling and Rising edge delays //! //! \return None. // //***************************************************************************** static inline void HRPWM_setDeadbandMEPEdgeSelect(uint32_t base, HRPWM_MEPDeadBandEdgeMode mepDBEdge) { // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 1549); } } while(0); // // Set the HRPWM DB edge mode // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x27U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x27U)))) & ~0x3U) | ((uint16_t)mepDBEdge)); __edis(); } //***************************************************************************** // //! Set the high resolution Dead Band RED load mode. //! //! \param base is the base address of the EPWM module. //! \param loadEvent is the shadow to active load event. //! //! This function sets the high resolution Rising Edge Delay(RED)Dead Band //! count load mode. //! Valid values for loadEvent are: //! - HRPWM_LOAD_ON_CNTR_ZERO - load when counter equals zero. //! - HRPWM_LOAD_ON_CNTR_PERIOD - load when counter equals period //! - HRPWM_LOAD_ON_CNTR_ZERO_PERIOD - load when counter equals zero //! or period. //! //! \return None. // //***************************************************************************** static inline void HRPWM_setRisingEdgeDelayLoadMode(uint32_t base, HRPWM_LoadMode loadEvent) { // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 1586); } } while(0); // // Set the HRPWM RED load mode // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x27U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x27U)))) & ~0xCU) | ((uint16_t)loadEvent << 2U)); __edis(); } //***************************************************************************** // //! Set the high resolution Dead Band FED load mode. //! //! \param base is the base address of the EPWM module. //! \param loadEvent is the shadow to active load event. //! //! This function sets the high resolution Falling Edge Delay(FED) Dead Band //! count load mode. //! Valid values for loadEvent are: //! - HRPWM_LOAD_ON_CNTR_ZERO - load when counter equals zero. //! - HRPWM_LOAD_ON_CNTR_PERIOD - load when counter equals period //! - HRPWM_LOAD_ON_CNTR_ZERO_PERIOD - load when counter equals zero //! or period. //! //! \return None. // //***************************************************************************** static inline void HRPWM_setFallingEdgeDelayLoadMode(uint32_t base, HRPWM_LoadMode loadEvent) { // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 1622); } } while(0); // // Set the HRPWM FED load mode // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x27U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x27U)))) & ~0x30U) | ((uint16_t)loadEvent << 4U)); __edis(); } //***************************************************************************** // //! Lock EALLOW protected register groups //! //! \param base is the base address of the EPWM module. //! \param registerGroup is the EALLOW register groups. //! //! This functions locks the EALLOW protected register groups specified by //! the registerGroup variable. //! //! \return None. // //***************************************************************************** static inline void HRPWM_lockRegisters(uint32_t base, HRPWM_LockRegisterGroup registerGroup) { // // Check the arguments // do { if(!(HRPWM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/hrpwm.h", 1653); } } while(0); // // Write the Key to EPWMLOCK register // (*((volatile uint32_t *)((uintptr_t)(base + 0xFAU)))) = ((uint32_t)0xA5A50000U | ((uint32_t)registerGroup)); } //***************************************************************************** // // Close the Doxygen group. //! @} // //***************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //########################################################################### // // FILE: i2c.h // // TITLE: C28x I2C driver. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup i2c_api I2C //! @{ // //***************************************************************************** //########################################################################### // // FILE: hw_i2c.h // // TITLE: Definitions for the I2C registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the I2C register offsets // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the I2COAR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the I2CIER register // //***************************************************************************** // enable // enable // interrupt enable // enable // enable // interrupt enable // enable //***************************************************************************** // // The following are defines for the bit fields in the I2CSTR register // //***************************************************************************** // flag bit // flag bit. // interrupt flag bit // flag bit. // flag bit. // bit. // bit. //***************************************************************************** // // The following are defines for the bit fields in the I2CDRR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the I2CSAR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the I2CDXR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the I2CMDR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the I2CISRC register // //***************************************************************************** // field //***************************************************************************** // // The following are defines for the bit fields in the I2CEMDR register // //***************************************************************************** // behav in Type1 //***************************************************************************** // // The following are defines for the bit fields in the I2CPSC register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the I2CFFTX register // //***************************************************************************** // Enable // Clear //***************************************************************************** // // The following are defines for the bit fields in the I2CFFRX register // //***************************************************************************** // Clear //***************************************************************************** // // Defines for the API. // //***************************************************************************** //***************************************************************************** // // I2C Master commands. // //***************************************************************************** //***************************************************************************** // // I2C interrupts for use with the intFlags parameter of I2C_enableInterrupt(), // I2C_disableInterrupt(), and I2C_clearInterruptStatus() and to be returned by // I2C_getInterruptStatus(). // //***************************************************************************** // // Helpful define to mask out the bits in the I2CSTR register that aren't // associated with interrupts. // //***************************************************************************** // // Flags for use as the stsFlags parameter of I2C_clearStatus() and to be // returned by I2C_getStatus(). // //***************************************************************************** //***************************************************************************** // //! I2C interrupts to be returned by I2C_getInterruptSource(). // //***************************************************************************** typedef enum { I2C_INTSRC_NONE, //!< No interrupt pending I2C_INTSRC_ARB_LOST, //!< Arbitration-lost interrupt I2C_INTSRC_NO_ACK, //!< NACK interrupt I2C_INTSRC_REG_ACCESS_RDY, //!< Register-access-ready interrupt I2C_INTSRC_RX_DATA_RDY, //!< Receive-data-ready interrupt I2C_INTSRC_TX_DATA_RDY, //!< Transmit-data-ready interrupt I2C_INTSRC_STOP_CONDITION, //!< Stop condition detected I2C_INTSRC_ADDR_SLAVE //!< Addressed as slave interrupt } I2C_InterruptSource; //***************************************************************************** // //! Values that can be passed to I2C_setFIFOInterruptLevel() as the \e txLevel //! parameter, returned by I2C_getFIFOInterruptLevel() in the \e txLevel //! parameter, and returned by I2C_getTxFIFOStatus(). // //***************************************************************************** typedef enum { I2C_FIFO_TXEMPTY = 0x0000U, //!< Transmit FIFO empty I2C_FIFO_TX0 = 0x0000U, //!< Transmit FIFO empty I2C_FIFO_TX1 = 0x0001U, //!< Transmit FIFO 1/16 full I2C_FIFO_TX2 = 0x0002U, //!< Transmit FIFO 2/16 full I2C_FIFO_TX3 = 0x0003U, //!< Transmit FIFO 3/16 full I2C_FIFO_TX4 = 0x0004U, //!< Transmit FIFO 4/16 full I2C_FIFO_TX5 = 0x0005U, //!< Transmit FIFO 5/16 full I2C_FIFO_TX6 = 0x0006U, //!< Transmit FIFO 6/16 full I2C_FIFO_TX7 = 0x0007U, //!< Transmit FIFO 7/16 full I2C_FIFO_TX8 = 0x0008U, //!< Transmit FIFO 8/16 full I2C_FIFO_TX9 = 0x0009U, //!< Transmit FIFO 9/16 full I2C_FIFO_TX10 = 0x000AU, //!< Transmit FIFO 10/16 full I2C_FIFO_TX11 = 0x000BU, //!< Transmit FIFO 11/16 full I2C_FIFO_TX12 = 0x000CU, //!< Transmit FIFO 12/16 full I2C_FIFO_TX13 = 0x000DU, //!< Transmit FIFO 13/16 full I2C_FIFO_TX14 = 0x000EU, //!< Transmit FIFO 14/16 full I2C_FIFO_TX15 = 0x000FU, //!< Transmit FIFO 15/16 full I2C_FIFO_TX16 = 0x0010U, //!< Transmit FIFO full I2C_FIFO_TXFULL = 0x0010U //!< Transmit FIFO full } I2C_TxFIFOLevel; //***************************************************************************** // //! Values that can be passed to I2C_setFIFOInterruptLevel() as the \e rxLevel //! parameter, returned by I2C_getFIFOInterruptLevel() in the \e rxLevel //! parameter, and returned by I2C_getRxFIFOStatus(). // //***************************************************************************** typedef enum { I2C_FIFO_RXEMPTY = 0x0000U, //!< Receive FIFO empty I2C_FIFO_RX0 = 0x0000U, //!< Receive FIFO empty I2C_FIFO_RX1 = 0x0001U, //!< Receive FIFO 1/16 full I2C_FIFO_RX2 = 0x0002U, //!< Receive FIFO 2/16 full I2C_FIFO_RX3 = 0x0003U, //!< Receive FIFO 3/16 full I2C_FIFO_RX4 = 0x0004U, //!< Receive FIFO 4/16 full I2C_FIFO_RX5 = 0x0005U, //!< Receive FIFO 5/16 full I2C_FIFO_RX6 = 0x0006U, //!< Receive FIFO 6/16 full I2C_FIFO_RX7 = 0x0007U, //!< Receive FIFO 7/16 full I2C_FIFO_RX8 = 0x0008U, //!< Receive FIFO 8/16 full I2C_FIFO_RX9 = 0x0009U, //!< Receive FIFO 9/16 full I2C_FIFO_RX10 = 0x000AU, //!< Receive FIFO 10/16 full I2C_FIFO_RX11 = 0x000BU, //!< Receive FIFO 11/16 full I2C_FIFO_RX12 = 0x000CU, //!< Receive FIFO 12/16 full I2C_FIFO_RX13 = 0x000DU, //!< Receive FIFO 13/16 full I2C_FIFO_RX14 = 0x000EU, //!< Receive FIFO 14/16 full I2C_FIFO_RX15 = 0x000FU, //!< Receive FIFO 15/16 full I2C_FIFO_RX16 = 0x0010U, //!< Receive FIFO full I2C_FIFO_RXFULL = 0x0010U //!< Receive FIFO full } I2C_RxFIFOLevel; //***************************************************************************** // //! Values that can be passed to I2C_setBitCount() as the \e size parameter. // //***************************************************************************** typedef enum { I2C_BITCOUNT_1 = 1U, //!< 1 bit per data byte I2C_BITCOUNT_2 = 2U, //!< 2 bits per data byte I2C_BITCOUNT_3 = 3U, //!< 3 bits per data byte I2C_BITCOUNT_4 = 4U, //!< 4 bits per data byte I2C_BITCOUNT_5 = 5U, //!< 5 bits per data byte I2C_BITCOUNT_6 = 6U, //!< 6 bits per data byte I2C_BITCOUNT_7 = 7U, //!< 7 bits per data byte I2C_BITCOUNT_8 = 0U //!< 8 bits per data byte } I2C_BitCount; //***************************************************************************** // //! Values that can be passed to I2C_setAddressMode() as the \e mode parameter. // //***************************************************************************** typedef enum { I2C_ADDR_MODE_7BITS = 0x0000U, //!< 7-bit address I2C_ADDR_MODE_10BITS = 0x0100U //!< 10-bit address } I2C_AddressMode; //***************************************************************************** // //! Values that can be passed to I2C_setExtendedMode() as the \e mode parameter. // //***************************************************************************** typedef enum { I2C_EADDR_MODE_BC = 1U, //!< Backward compatibility I2C_EADDR_MODE_FWD = 2U //!< Forward compatibility } I2C_ExtendedMode; //***************************************************************************** // //! Values that can be passed to I2C_setEmulationMode() as the \e mode //! parameter. // //***************************************************************************** typedef enum { //! If SCL is low, keep it low. If high, stop when it goes low again. I2C_EMULATION_STOP_SCL_LOW = 0x0000U, //! Continue I2C operation regardless I2C_EMULATION_FREE_RUN = 0x4000U } I2C_EmulationMode; //***************************************************************************** // //! Values that can be passed to I2C_initMaster() as the \e dutyCycle //! parameter. // //***************************************************************************** typedef enum { I2C_DUTYCYCLE_33, //!< Clock duty cycle is 33% I2C_DUTYCYCLE_50 //!< Clock duty cycle is 55% } I2C_DutyCycle; //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** //***************************************************************************** // //! \internal //! Checks an I2C base address. //! //! \param base is the base address of the I2C instance used. //! //! This function determines if a I2C module base address is valid. //! //! \return Returns \b true if the base address is valid and \b false //! otherwise. // //***************************************************************************** static inline _Bool I2C_isBaseValid(uint32_t base) { return((base == 0x00007300U) || (base == 0x00007340U)); } //***************************************************************************** // //! Enables the I2C module. //! //! \param base is the base address of the I2C instance used. //! //! This function enables operation of the I2C module. //! //! \return None. // //***************************************************************************** static inline void I2C_enableModule(uint32_t base) { // // Check the arguments. // do { if(!(I2C_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/i2c.h", 328); } } while(0); (*((volatile uint16_t *)((uintptr_t)(base + 0x9U)))) |= 0x20U; } //***************************************************************************** // //! Disables the I2C module. //! //! \param base is the base address of the I2C instance used. //! //! This function disables operation of the I2C module. //! //! \return None. // //***************************************************************************** static inline void I2C_disableModule(uint32_t base) { // // Check the arguments. // do { if(!(I2C_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/i2c.h", 350); } } while(0); (*((volatile uint16_t *)((uintptr_t)(base + 0x9U)))) &= ~(0x20U); } //***************************************************************************** // //! Enables the transmit and receive FIFOs. //! //! \param base is the base address of the I2C instance used. //! //! This functions enables the transmit and receive FIFOs in the I2C. //! //! \return None. // //***************************************************************************** static inline void I2C_enableFIFO(uint32_t base) { // // Check the arguments. // do { if(!(I2C_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/i2c.h", 372); } } while(0); // // Enable the FIFO. // (*((volatile uint16_t *)((uintptr_t)(base + 0x20U)))) |= 0x4000U | 0x2000U; (*((volatile uint16_t *)((uintptr_t)(base + 0x21U)))) |= 0x2000U; } //***************************************************************************** // //! Disables the transmit and receive FIFOs. //! //! \param base is the base address of the I2C instance used. //! //! This functions disables the transmit and receive FIFOs in the I2C. //! //! \return None. // //***************************************************************************** static inline void I2C_disableFIFO(uint32_t base) { // // Check the arguments. // do { if(!(I2C_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/i2c.h", 398); } } while(0); // // Disable the FIFO. // (*((volatile uint16_t *)((uintptr_t)(base + 0x20U)))) &= ~(0x4000U | 0x2000U); (*((volatile uint16_t *)((uintptr_t)(base + 0x21U)))) &= ~0x2000U; } //***************************************************************************** // //! Sets the FIFO level at which interrupts are generated. //! //! \param base is the base address of the I2C instance used. //! \param txLevel is the transmit FIFO interrupt level, specified as //! \b I2C_FIFO_TX0, \b I2C_FIFO_TX1, \b I2C_FIFO_TX2, . . . or //! \b I2C_FIFO_TX16. //! \param rxLevel is the receive FIFO interrupt level, specified as //! \b I2C_FIFO_RX0, \b I2C_FIFO_RX1, \b I2C_FIFO_RX2, . . . or //! \b I2C_FIFO_RX16. //! //! This function sets the FIFO level at which transmit and receive interrupts //! are generated. The transmit FIFO interrupt flag will be set when the FIFO //! reaches a value less than or equal to \e txLevel. The receive FIFO //! flag will be set when the FIFO reaches a value greater than or equal to //! \e rxLevel. //! //! \return None. // //***************************************************************************** static inline void I2C_setFIFOInterruptLevel(uint32_t base, I2C_TxFIFOLevel txLevel, I2C_RxFIFOLevel rxLevel) { // // Check the arguments. // do { if(!(I2C_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/i2c.h", 435); } } while(0); // // Set the FIFO interrupt levels. // (*((volatile uint16_t *)((uintptr_t)(base + 0x20U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x20U)))) & (~0x1FU)) | (uint16_t)txLevel; (*((volatile uint16_t *)((uintptr_t)(base + 0x21U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x21U)))) & (~0x1FU)) | (uint16_t)rxLevel; } //***************************************************************************** // //! Gets the FIFO level at which interrupts are generated. //! //! \param base is the base address of the I2C instance used. //! \param txLevel is a pointer to storage for the transmit FIFO level, //! returned as one of \b I2C_FIFO_TX0, \b I2C_FIFO_TX1, //! \b I2C_FIFO_TX2, . . . or \b I2C_FIFO_TX16. //! \param rxLevel is a pointer to storage for the receive FIFO level, //! returned as one of \b I2C_FIFO_RX0, \b I2C_FIFO_RX1, //! \b I2C_FIFO_RX2, . . . or \b I2C_FIFO_RX16. //! //! This function gets the FIFO level at which transmit and receive interrupts //! are generated. The transmit FIFO interrupt flag will be set when the FIFO //! reaches a value less than or equal to \e txLevel. The receive FIFO //! flag will be set when the FIFO reaches a value greater than or equal to //! \e rxLevel. //! //! \return None. // //***************************************************************************** static inline void I2C_getFIFOInterruptLevel(uint32_t base, I2C_TxFIFOLevel *txLevel, I2C_RxFIFOLevel *rxLevel) { // // Check the arguments. // do { if(!(I2C_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/i2c.h", 474); } } while(0); // // Extract the transmit and receive FIFO levels. // *txLevel = (I2C_TxFIFOLevel)((*((volatile uint16_t *)((uintptr_t)(base + 0x20U)))) & 0x1FU); *rxLevel = (I2C_RxFIFOLevel)((*((volatile uint16_t *)((uintptr_t)(base + 0x21U)))) & 0x1FU); } //***************************************************************************** // //! Get the transmit FIFO status //! //! \param base is the base address of the I2C instance used. //! //! This function gets the current number of words in the transmit FIFO. //! //! \return Returns the current number of words in the transmit FIFO specified //! as one of the following: //! \b I2C_FIFO_TX0, \b I2C_FIFO_TX1, \b I2C_FIFO_TX2, \b I2C_FIFO_TX3, //! ..., or \b I2C_FIFO_TX16 // //***************************************************************************** static inline I2C_TxFIFOLevel I2C_getTxFIFOStatus(uint32_t base) { uint16_t level; // // Check the arguments. // do { if(!(I2C_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/i2c.h", 507); } } while(0); // // Get the current FIFO status // level = (((*((volatile uint16_t *)((uintptr_t)(base + 0x20U)))) & 0x1F00U) >> 8U); return((I2C_TxFIFOLevel)level); } //***************************************************************************** // //! Get the receive FIFO status //! //! \param base is the base address of the I2C instance used. //! //! This function gets the current number of words in the receive FIFO. //! //! \return Returns the current number of words in the receive FIFO specified //! as one of the following: //! \b I2C_FIFO_RX0, \b I2C_FIFO_RX1, \b I2C_FIFO_RX2, \b I2C_FIFO_RX3, //! ..., or \b I2C_FIFO_RX16 // //***************************************************************************** static inline I2C_RxFIFOLevel I2C_getRxFIFOStatus(uint32_t base) { uint16_t level; // // Check the arguments. // do { if(!(I2C_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/i2c.h", 540); } } while(0); // // Get the current FIFO status // level = (((*((volatile uint16_t *)((uintptr_t)(base + 0x21U)))) & 0x1F00U) >> 8U); return((I2C_RxFIFOLevel)level); } //***************************************************************************** // //! Sets the address that the I2C Master places on the bus. //! //! \param base is the base address of the I2C instance used. //! \param slaveAddr 7-bit or 10-bit slave address //! //! This function configures the address that the I2C Master places on the bus //! when initiating a transaction. //! //! \return None. // //***************************************************************************** static inline void I2C_setSlaveAddress(uint32_t base, uint16_t slaveAddr) { // // Check the arguments. // do { if(!(I2C_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/i2c.h", 570); } } while(0); do { if(!(slaveAddr <= 0x3FFU)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/i2c.h", 571); } } while(0); (*((volatile uint16_t *)((uintptr_t)(base + 0x7U)))) = slaveAddr; } //***************************************************************************** // //! Sets the slave address for this I2C module. //! //! \param base is the base address of the I2C Slave module. //! \param slaveAddr is the 7-bit or 10-bit slave address //! //! This function writes the specified slave address. //! //! The parameter \e slaveAddr is the value that is compared against the //! slave address sent by an I2C master. //! //! \return None. // //***************************************************************************** static inline void I2C_setOwnSlaveAddress(uint32_t base, uint16_t slaveAddr) { // // Check the arguments. // do { if(!(I2C_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/i2c.h", 597); } } while(0); do { if(!(slaveAddr <= 0x3FFU)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/i2c.h", 598); } } while(0); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) = slaveAddr; } //***************************************************************************** // //! Indicates whether or not the I2C bus is busy. //! //! \param base is the base address of the I2C instance used. //! //! This function returns an indication of whether or not the I2C bus is busy. //! This function can be used in a multi-master environment to determine if the //! bus is free for another data transfer. //! //! \return Returns \b true if the I2C bus is busy; otherwise, returns //! \b false. // //***************************************************************************** static inline _Bool I2C_isBusBusy(uint32_t base) { // // Check the arguments. // do { if(!(I2C_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/i2c.h", 623); } } while(0); return(((*((volatile uint16_t *)((uintptr_t)(base + 0x2U)))) & 0x1000U) == 0x1000U); } //***************************************************************************** // //! Gets the current I2C module status. //! //! \param base is the base address of the I2C instance used. //! //! This function returns the status for the I2C module. //! //! \return The current module status, enumerated as a bit field of //! - \b I2C_STS_ARB_LOST - Arbitration-lost //! - \b I2C_STS_NO_ACK - No-acknowledgment (NACK) //! - \b I2C_STS_REG_ACCESS_RDY - Register-access-ready (ARDY) //! - \b I2C_STS_RX_DATA_RDY - Receive-data-ready //! - \b I2C_STS_TX_DATA_RDY - Transmit-data-ready //! - \b I2C_STS_STOP_CONDITION - Stop condition detected //! - \b I2C_STS_BYTE_SENT - Byte transmit complete //! - \b I2C_STS_ADDR_ZERO - Address of all zeros detected //! - \b I2C_STS_ADDR_SLAVE - Addressed as slave //! - \b I2C_STS_TX_EMPTY - Transmit shift register empty //! - \b I2C_STS_RX_FULL - Receive shift register full //! - \b I2C_STS_BUS_BUSY - Bus busy, wait for STOP or reset //! - \b I2C_STS_NACK_SENT - NACK was sent //! - \b I2C_STS_SLAVE_DIR- Addressed as slave transmitter // //***************************************************************************** static inline uint16_t I2C_getStatus(uint32_t base) { // // Check the arguments. // do { if(!(I2C_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/i2c.h", 659); } } while(0); // // Return contents of the status register // return((*((volatile uint16_t *)((uintptr_t)(base + 0x2U))))); } //***************************************************************************** // //! Clears I2C status flags. //! //! \param base is the base address of the I2C instance used. //! \param stsFlags is a bit mask of the status flags to be cleared. //! //! This function clears the specified I2C status flags. The \e stsFlags //! parameter is the logical OR of the following values: //! - \b I2C_STS_ARB_LOST //! - \b I2C_STS_NO_ACK, //! - \b I2C_STS_REG_ACCESS_RDY //! - \b I2C_STS_RX_DATA_RDY //! - \b I2C_STS_STOP_CONDITION //! - \b I2C_STS_BYTE_SENT //! - \b I2C_STS_NACK_SENT //! - \b I2C_STS_SLAVE_DIR //! //! \note Note that some of the status flags returned by I2C_getStatus() cannot //! be cleared by this function. Some may only be cleared by hardware or a //! reset of the I2C module. //! //! \return None. // //***************************************************************************** static inline void I2C_clearStatus(uint32_t base, uint16_t stsFlags) { // // Check the arguments. // do { if(!(I2C_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/i2c.h", 698); } } while(0); // // Write to the status registers to clear them. // (*((volatile uint16_t *)((uintptr_t)(base + 0x2U)))) = stsFlags; } //***************************************************************************** // //! Controls the state of the I2C module. //! //! \param base is the base address of the I2C instance used. //! \param config is the command to be issued to the I2C module. //! //! This function is used to control the state of the master and slave send and //! receive operations. The \e config is a logical OR of the following options. //! //! One of the following four options: //! - \b I2C_MASTER_SEND_MODE - Master-transmitter mode //! - \b I2C_MASTER_RECEIVE_MODE - Master-receiver mode //! - \b I2C_SLAVE_SEND_MODE - Slave-transmitter mode //! - \b I2C_SLAVE_RECEIVE_MODE - Slave-receiver mode //! //! Any of the following: //! - \b I2C_REPEAT_MODE - Sends data until stop bit is set, ignores data count //! - \b I2C_START_BYTE_MODE - Use start byte mode //! - \b I2C_FREE_DATA_FORMAT - Use free data format, transfers have no address //! //! \return None. // //***************************************************************************** static inline void I2C_setConfig(uint32_t base, uint16_t config) { // // Check the arguments. // do { if(!(I2C_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/i2c.h", 736); } } while(0); // // Write the selected options to the mode register. // (*((volatile uint16_t *)((uintptr_t)(base + 0x9U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x9U)))) & ~(0x400U | 0x200U | 0x80U | 0x10U | 0x8U)) | config; } //***************************************************************************** // //! Sets the data byte bit count the I2C module. //! //! \param base is the base address of the I2C instance used. //! \param size is the number of bits per data byte. //! //! The \e size parameter is a value I2C_BITCOUNT_x where x is the number of //! bits per data byte. The default and maximum size is 8 bits. //! //! \return None. // //***************************************************************************** static inline void I2C_setBitCount(uint32_t base, I2C_BitCount size) { // // Check the arguments. // do { if(!(I2C_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/i2c.h", 765); } } while(0); // // Write the selected options to the mode register. // (*((volatile uint16_t *)((uintptr_t)(base + 0x9U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x9U)))) & ~0x7U) | (uint16_t)size; } //***************************************************************************** // //! Issues an I2C START condition. //! //! \param base is the base address of the I2C instance used. //! //! This function causes the I2C module to generate a start condition. This //! function is only valid when the I2C module specified by the \b base //! parameter is a master. //! //! \return None. // //***************************************************************************** static inline void I2C_sendStartCondition(uint32_t base) { // // Check the arguments. // do { if(!(I2C_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/i2c.h", 793); } } while(0); // // Set the START condition bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0x9U)))) |= 0x2000U; } //***************************************************************************** // //! Issues an I2C STOP condition. //! //! \param base is the base address of the I2C instance used. //! //! This function causes the I2C module to generate a stop condition. This //! function is only valid when the I2C module specified by the \b base //! parameter is a master. //! //! To check on the status of the STOP condition, I2C_getStopConditionStatus() //! can be used. //! //! \return None. // //***************************************************************************** static inline void I2C_sendStopCondition(uint32_t base) { // // Check the arguments. // do { if(!(I2C_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/i2c.h", 823); } } while(0); // // Set the STOP condition bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0x9U)))) |= 0x800U; } //***************************************************************************** // //! Issues a no-acknowledge (NACK) bit. //! //! \param base is the base address of the I2C instance used. //! //! This function causes the I2C module to generate a NACK bit. This is only //! applicable when the I2C module is acting as a receiver. //! //! \return None. // //***************************************************************************** static inline void I2C_sendNACK(uint32_t base) { // // Check the arguments. // do { if(!(I2C_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/i2c.h", 849); } } while(0); // // Set the NACK mode bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0x9U)))) |= 0x8000U; } //***************************************************************************** // //! Receives a byte that has been sent to the I2C. //! //! \param base is the base address of the I2C instance used. //! //! This function reads a byte of data from the I2C Data Receive Register. //! //! \return Returns the byte received from by the I2C cast as an uint16_t. // //***************************************************************************** static inline uint16_t I2C_getData(uint32_t base) { // // Check the arguments. // do { if(!(I2C_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/i2c.h", 874); } } while(0); // // Return the contents of the receive register. // return((*((volatile uint16_t *)((uintptr_t)(base + 0x6U))))); } //***************************************************************************** // //! Transmits a byte from the I2C. //! //! \param base is the base address of the I2C instance used. //! \param data is the data to be transmitted from the I2C Master. //! //! This function places the supplied data into I2C Data Transmit Register. //! //! \return None. // //***************************************************************************** static inline void I2C_putData(uint32_t base, uint16_t data) { // // Check the arguments. // do { if(!(I2C_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/i2c.h", 900); } } while(0); // // Place the data into the transmit register. // (*((volatile uint16_t *)((uintptr_t)(base + 0x8U)))) = data; } //***************************************************************************** // //! Get stop condition status. //! //! \param base is the base address of the I2C instance used. //! //! This function reads and returns the stop condition bit status. //! //! \return Returns \b true if the STP bit has been set by the device to //! generate a stop condition when the internal data counter of the I2C module //! has reached 0. Returns \b false when the STP bit is zero. This bit is //! automatically cleared after the stop condition has been generated. // //***************************************************************************** static inline _Bool I2C_getStopConditionStatus(uint32_t base) { // // Check the arguments. // do { if(!(I2C_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/i2c.h", 928); } } while(0); // // Check the stop condition bit and return appropriately. // return(((*((volatile uint16_t *)((uintptr_t)(base + 0x9U)))) & 0x800U) != 0U); } //***************************************************************************** // //! Set number of bytes to be to transfer or receive when repeat mode is off. //! //! \param base is the base address of the I2C instance used. //! \param count is the value to be put in the I2C data count register. //! //! This function sets the number of bytes to transfer or receive when repeat //! mode is off. //! //! \return None. // //***************************************************************************** static inline void I2C_setDataCount(uint32_t base, uint16_t count) { // // Check the arguments. // do { if(!(I2C_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/i2c.h", 955); } } while(0); // // Write the count value to the appropriate register. // (*((volatile uint16_t *)((uintptr_t)(base + 0x5U)))) = count; } //***************************************************************************** // //! Sets the addressing mode to either 7-bit or 10-bit. //! //! \param base is the base address of the I2C instance used. //! \param mode is the address mode, 7-bit or 10-bit. //! //! This function configures the I2C module for either a 7-bit address //! (default) or a 10-bit address. The \e mode parameter configures the address //! length to 10 bits when its value is \b I2C_ADDR_MODE_10BITS and 7 bits when //! \b I2C_ADDR_MODE_7BITS. //! //! \return None. // //***************************************************************************** static inline void I2C_setAddressMode(uint32_t base, I2C_AddressMode mode) { // // Check the arguments. // do { if(!(I2C_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/i2c.h", 984); } } while(0); // // Write the appropriate value to the address expansion bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0x9U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x9U)))) & ~0x100U) | (uint16_t)mode; } //***************************************************************************** // //! Sets I2C emulation mode. //! //! \param base is the base address of the I2C instance used. //! \param mode is the emulation mode. //! //! This function sets the behavior of the I2C operation when an emulation //! suspend occurs. The \e mode parameter can be one of the following: //! //! - \b I2C_EMULATION_STOP_SCL_LOW - If SCL is low when the breakpoint occurs, //! the I2C module stops immediately. If SCL is high, the I2C module waits //! until SCL becomes low and then stops. //! - \b I2C_EMULATION_FREE_RUN - I2C operation continues regardless of a //! the suspend. //! //! \return None. // //***************************************************************************** static inline void I2C_setEmulationMode(uint32_t base, I2C_EmulationMode mode) { // // Check the arguments. // do { if(!(I2C_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/i2c.h", 1018); } } while(0); // // Write the desired emulation mode to the register. // (*((volatile uint16_t *)((uintptr_t)(base + 0x9U)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0x9U)))) & ~0x4000U) | (uint16_t)mode; } //***************************************************************************** // //! Enables I2C loopback mode. //! //! \param base is the base address of the I2C instance used. //! //! This function enables loopback mode. This mode is only valid during master //! mode and is helpful during device testing as it causes data transmitted out //! of the data transmit register to be received in data receive register. //! //! \return None. // //***************************************************************************** static inline void I2C_enableLoopback(uint32_t base) { // // Check the arguments. // do { if(!(I2C_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/i2c.h", 1046); } } while(0); // // Set the bit that enables loopback mode. // (*((volatile uint16_t *)((uintptr_t)(base + 0x9U)))) |= 0x40U; } //***************************************************************************** // //! Disables I2C loopback mode. //! //! \param base is the base address of the I2C instance used. //! //! This function disables loopback mode. Loopback mode is disabled by default //! after reset. //! //! \return None. // //***************************************************************************** static inline void I2C_disableLoopback(uint32_t base) { // // Check the arguments. // do { if(!(I2C_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/i2c.h", 1072); } } while(0); // // Clear the bit that enables loopback mode. // (*((volatile uint16_t *)((uintptr_t)(base + 0x9U)))) &= ~0x40U; } //***************************************************************************** // //! Returns the current I2C interrupt source. //! //! \param base is the base address of the I2C instance used. //! //! This function returns the event that generated an I2C basic (non-FIFO) //! interrupt. The possible sources are the following: //! - \b I2C_INTSRC_NONE //! - \b I2C_INTSRC_ARB_LOST //! - \b I2C_INTSRC_NO_ACK //! - \b I2C_INTSRC_REG_ACCESS_RDY //! - \b I2C_INTSRC_RX_DATA_RDY //! - \b I2C_INTSRC_TX_DATA_RDY //! - \b I2C_INTSRC_STOP_CONDITION //! - \b I2C_INTSRC_ADDR_SLAVE //! //! Calling this function will result in hardware automatically clearing the //! current interrupt code and if ready, loading the next pending enabled //! interrupt. It will also clear the corresponding interrupt flag if the //! source is \b I2C_INTSRC_ARB_LOST, \b I2C_INTSRC_NO_ACK, or //! \b I2C_INTSRC_STOP_CONDITION. //! //! \note Note that this function differs from I2C_getInterruptStatus() in that //! it returns a single interrupt source. I2C_getInterruptSource() will return //! the status of all interrupt flags possible, including the flags that aren't //! necessarily enabled to generate interrupts. //! //! \return None. // //***************************************************************************** static inline I2C_InterruptSource I2C_getInterruptSource(uint32_t base) { // // Check the arguments. // do { if(!(I2C_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/i2c.h", 1117); } } while(0); // // Return the interrupt source value // return((I2C_InterruptSource)((*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) & 0x7U)); } //***************************************************************************** // //! Sets the compatibility mode to support I2C Extended Mode. //! //! \param base is the base address of the I2C instance used. //! \param mode is the compatibility modes. //! //! This function configures the I2C module for either a Forward or Backward //! compatibilty. The \e mode parameter configures the compatibility //! to Forward when its value is \b I2C_EADDR_MODE_FWD and Backward when //! \b I2C_EADDR_MODE_BC. //! //! \return None. // //***************************************************************************** static inline void I2C_setExtendedMode(uint32_t base, I2C_ExtendedMode mode) { // // Check the arguments. // do { if(!(I2C_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/i2c.h", 1147); } } while(0); // // Write the appropriate value to the compatibility mode register. // (*((volatile uint16_t *)((uintptr_t)(base + 0xBU)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0xBU)))) & ~(0x1U | 0x2U)) | (uint16_t)mode; } //***************************************************************************** // //! Initializes the I2C Master. //! //! \param base is the base address of the I2C instance used. //! \param sysclkHz is the rate of the clock supplied to the I2C module //! (SYSCLK) in Hz. //! \param bitRate is the rate of the master clock signal, SCL. //! \param dutyCycle is duty cycle of the SCL signal. //! //! This function initializes operation of the I2C Master by configuring the //! bus speed for the master. Note that the I2C module \b must be put into //! reset before calling this function. You can do this with the function //! I2C_disableModule(). //! //! A programmable prescaler in the I2C module divides down the input clock //! (rate specified by \e sysclkHz) to produce the module clock (calculated to //! be around 10 MHz in this function). That clock is then divided down further //! to configure the SCL signal to run at the rate specified by \e bitRate. The //! \e dutyCycle parameter determines the percentage of time high and time low //! on the clock signal. The valid values are \b I2C_DUTYCYCLE_33 for 33% and //! \b I2C_DUTYCYCLE_50 for 50%. //! //! The peripheral clock is the system clock. This value is returned by //! SysCtl_getClock(), or it can be explicitly hard coded if it is //! constant and known (to save the code/execution overhead of a call to //! SysCtl_getClock()). //! //! \return None. // //***************************************************************************** extern void I2C_initMaster(uint32_t base, uint32_t sysclkHz, uint32_t bitRate, I2C_DutyCycle dutyCycle); //***************************************************************************** // //! Enables I2C interrupt sources. //! //! \param base is the base address of the I2C instance used. //! \param intFlags is the bit mask of the interrupt sources to be enabled. //! //! This function enables the indicated I2C Master interrupt sources. Only the //! sources that are enabled can be reflected to the processor interrupt. //! Disabled sources have no effect on the processor. //! //! The \e intFlags parameter is the logical OR of any of the following: //! //! - \b I2C_INT_ARB_LOST - Arbitration-lost interrupt //! - \b I2C_INT_NO_ACK - No-acknowledgment (NACK) interrupt //! - \b I2C_INT_REG_ACCESS_RDY - Register-access-ready interrupt //! - \b I2C_INT_RX_DATA_RDY - Receive-data-ready interrupt //! - \b I2C_INT_TX_DATA_RDY - Transmit-data-ready interrupt //! - \b I2C_INT_STOP_CONDITION - Stop condition detected //! - \b I2C_INT_ADDR_SLAVE - Addressed as slave interrupt //! - \b I2C_INT_RXFF - RX FIFO level interrupt //! - \b I2C_INT_TXFF - TX FIFO level interrupt //! //! \note \b I2C_INT_RXFF and \b I2C_INT_TXFF are associated with the I2C FIFO //! interrupt vector. All others are associated with the I2C basic interrupt. //! //! \return None. // //***************************************************************************** extern void I2C_enableInterrupt(uint32_t base, uint32_t intFlags); //***************************************************************************** // //! Disables I2C interrupt sources. //! //! \param base is the base address of the I2C instance used. //! \param intFlags is the bit mask of the interrupt sources to be disabled. //! //! This function disables the indicated I2C Slave interrupt sources. Only //! the sources that are enabled can be reflected to the processor interrupt. //! Disabled sources have no effect on the processor. //! //! The \e intFlags parameter has the same definition as the \e intFlags //! parameter to I2C_enableInterrupt(). //! //! \return None. // //***************************************************************************** extern void I2C_disableInterrupt(uint32_t base, uint32_t intFlags); //***************************************************************************** // //! Gets the current I2C interrupt status. //! //! \param base is the base address of the I2C instance used. //! //! This function returns the interrupt status for the I2C module. //! //! \return The current interrupt status, enumerated as a bit field of //! - \b I2C_INT_ARB_LOST //! - \b I2C_INT_NO_ACK //! - \b I2C_INT_REG_ACCESS_RDY //! - \b I2C_INT_RX_DATA_RDY //! - \b I2C_INT_TX_DATA_RDY //! - \b I2C_INT_STOP_CONDITION //! - \b I2C_INT_ADDR_SLAVE //! - \b I2C_INT_RXFF //! - \b I2C_INT_TXFF //! //! \note This function will only return the status flags associated with //! interrupts. However, a flag may be set even if its corresponding interrupt //! is disabled. // //***************************************************************************** extern uint32_t I2C_getInterruptStatus(uint32_t base); //***************************************************************************** // //! Clears I2C interrupt sources. //! //! \param base is the base address of the I2C instance used. //! \param intFlags is a bit mask of the interrupt sources to be cleared. //! //! The specified I2C interrupt sources are cleared, so that they no longer //! assert. This function must be called in the interrupt handler to keep the //! interrupt from being triggered again immediately upon exit. //! //! The \e intFlags parameter has the same definition as the \e intFlags //! parameter to I2C_enableInterrupt(). //! //! \note \b I2C_INT_RXFF and \b I2C_INT_TXFF are associated with the I2C FIFO //! interrupt vector. All others are associated with the I2C basic interrupt. //! //! \note Also note that some of the status flags returned by //! I2C_getInterruptStatus() cannot be cleared by this function. Some may only //! be cleared by hardware or a reset of the I2C module. //! //! \return None. // //***************************************************************************** extern void I2C_clearInterruptStatus(uint32_t base, uint32_t intFlags); //***************************************************************************** // // Close the Doxygen group. //! @} // //***************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //########################################################################### // // FILE: mcbsp.h // // TITLE: C28x McBSP driver. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup mcbsp_api McBSP //! @{ // //***************************************************************************** //########################################################################### // // FILE: hw_mcbsp.h // // TITLE: Definitions for the MCBSP registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the MCBSP register offsets // //***************************************************************************** // 31-16 // 15-0 // 31-16 // 15-0 // 2 // 1 // register 2 // register 1 // register 2 // register 1 // partition A // partition B // partition A // partition B // partition C // partition D // partition C // partition D // partition E // partition F // partition E // partition F // partition G // partition H // partition G // partition H //***************************************************************************** // // The following are defines for the bit fields in the DRR2 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the DRR1 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the DXR2 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the DXR1 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SPCR2 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SPCR1 register // //***************************************************************************** // justification mode //***************************************************************************** // // The following are defines for the bit fields in the RCR2 register // //***************************************************************************** // selects //***************************************************************************** // // The following are defines for the bit fields in the RCR1 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the XCR2 register // //***************************************************************************** // selects //***************************************************************************** // // The following are defines for the bit fields in the XCR1 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SRGR2 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SRGR1 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the MCR2 register // //***************************************************************************** // selects //***************************************************************************** // // The following are defines for the bit fields in the MCR1 register // //***************************************************************************** // mode //***************************************************************************** // // The following are defines for the bit fields in the PCR register // //***************************************************************************** // polarity // synchronization polarity // Mode // Synchronization Mode //***************************************************************************** // // The following are defines for the bit fields in the MFFINT register // //***************************************************************************** //***************************************************************************** // // Defines for the API. // //***************************************************************************** //***************************************************************************** // // Define to specify mask for setting the word and frame length in // McBSP_setTxDataSize() anf McBSP_setRxDataSize(). // //***************************************************************************** //***************************************************************************** // // Defines the values that can be returned by McBSP_getRxErrorStatus() when // there is an error in Rx. // //***************************************************************************** //***************************************************************************** // // Defines the values that can be returned by McBSP_getTxErrorStatus() when // there is an error in Tx. // //***************************************************************************** //***************************************************************************** // // Values that can be returned by McBSP_configureTxMultichannel() and // McBSP_configureRxMultichannel(). // //***************************************************************************** //***************************************************************************** // //! Values that can be passed to McBSP_setRxSignExtension() as the \e //! mode parameters. // //***************************************************************************** typedef enum { MCBSP_RIGHT_JUSTIFY_FILL_ZERO = 0x0000U, //!< Right justify and //!< zero fill MSB. MCBSP_RIGHT_JUSTIFY_FILL_SIGN = 0x2000U, //!< Right justified sign //!< extended into MSBs. MCBSP_LEFT_JUSTIFY_FILL_ZER0 = 0x4000U //!< Left justifies LBS //!< filled with zero. }McBSP_RxSignExtensionMode; //***************************************************************************** // //! Values that can be passed to McBSP_setClockStopMode() as the \e mode //! parameter. // //***************************************************************************** typedef enum { MCBSP_CLOCK_MCBSP_MODE = 0x0000U, //!< Disables clock stop mode. MCBSP_CLOCK_SPI_MODE_NO_DELAY = 0x1000U, //!< Enables clock stop mode. MCBSP_CLOCK_SPI_MODE_DELAY = 0x1800U //!< Enables clock stop mode //!< with half cycle delay. }McBSP_ClockStopMode; //***************************************************************************** // //! Values that can be passed to McBSP_setRxInterruptSource() as the //! \e interruptSource parameter. // //***************************************************************************** typedef enum { MCBSP_RX_ISR_SOURCE_SERIAL_WORD = 0x0000U, //!> 1U) << 7U)); } //***************************************************************************** // //! Configures transmitter input clock source for sample generator. //! //! \param base is the base address of the McBSP module. //! \param srgClockSource is clock source for the sample generator. //! //! This functions sets the clock source for the sample rate generator. //! Valid values for \e clockSource are //! - \b MCBSP_SRG_TX_CLOCK_SOURCE_LSPCLK for LSPCLK. //! - \b MCBSP_SRG_TX_CLOCK_SOURCE_MCLKR_PIN for external clock at MCLKR pin. //! MCLKX pin will be an output driven by sample rate generator. //! //! \return None. // //***************************************************************************** static inline void McBSP_setTxSRGClockSource(uint32_t base, const McBSP_SRGTxClockSource srgClockSource) { // // Check the arguments. // do { if(!(McBSP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/mcbsp.h", 1839); } } while(0); // // Set or clear CLKSM bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) & ~0x2000U) | ((uint16_t)((uint16_t)srgClockSource & 0x1U) << 13U)); // // Set or clear SCLKME bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0x12U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x12U)))) & ~0x80U) | (uint16_t)(((uint16_t)srgClockSource >> 1U) << 7U)); } //***************************************************************************** // //! Sets the mode for transmitter internal frame sync signal. //! //! \param base is the base address of the McBSP module. //! \param syncMode is the frame sync mode. //! //! This function sets the frame sync signal generation mode. The signal can be //! generated based on clock divider as set in McBSP_setFrameSyncPulsePeriod() //! function or when data is transferred from DXR registers to XSR registers. //! Valid input for syncMode are: //! //! - \b MCBSP_TX_INTERNAL_FRAME_SYNC_DATA - frame sync signal is //! generated when data is transferred from //! DXR registers to XSR registers. //! - \b MCBSP_TX_INTERNAL_FRAME_SYNC_SRG - frame sync signal is //! generated based on the clock counter //! value as defined in //! McBSP_setFrameSyncPulsePeriod() //! function. //! //! \return None. // //***************************************************************************** static inline void McBSP_setTxInternalFrameSyncSource(uint32_t base, const McBSP_TxInternalFrameSyncSource syncMode) { // // Check the arguments. // do { if(!(McBSP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/mcbsp.h", 1886); } } while(0); // // Set or clear FSGM bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) & ~0x1000U) | (uint16_t)syncMode); } //***************************************************************************** // //! Set Multichannel receiver partitions. //! //! \param base is the base address of the McBSP module. //! \param partition is the number of partitions. //! //! This function sets the partitions for Multichannel receiver. Valid values //! for partition are \b MCBSP_MULTICHANNEL_TWO_PARTITION or \b //! MCBSP_MULTICHANNEL_EIGHT_PARTITION for 2 and 8 partitions respectively. //! //! \return None. // //***************************************************************************** static inline void McBSP_setRxMultichannelPartition(uint32_t base, const McBSP_MultichannelPartition partition) { // // Check the arguments. // do { if(!(McBSP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/mcbsp.h", 1916); } } while(0); // // Set or Clear RMCME bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0xDU)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0xDU)))) & ~0x200U) | (uint16_t)partition); } //***************************************************************************** // //! Sets block to receiver in two partition configuration. //! //! \param base is the base address of the McBSP module. //! \param block is the block to assign to the partition. //! //! This function assigns the block the user provides to the appropriate //! receiver partition. //! If user sets the value of block to 0,2,4 or 6 the API will assign the //! blocks to partition A. If values 1,3,5,or 7 are set to block, then //! the API assigns the block to partition B. //! //! \note This function should be used with the two partition configuration //! only and not with eight partition configuration. //! //! \return None. // //***************************************************************************** static inline void McBSP_setRxTwoPartitionBlock(uint32_t base, const McBSP_PartitionBlock block) { // // Check the arguments. // do { if(!(McBSP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/mcbsp.h", 1950); } } while(0); // //Check the block value if it is 0,2,4,6 or 1,3,5,7. // if(((uint16_t)block == 0U) || ((uint16_t)block == 2U) || ((uint16_t)block == 4U) || ((uint16_t)block == 6U)) { // // write to RPABLK bits. // (*((volatile uint16_t *)((uintptr_t)(base + 0xDU)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0xDU)))) & ~0x60U) | (uint16_t)(((uint16_t)block >> 1U)<< 5U)); } else { // // write to RPBBLK bits. // (*((volatile uint16_t *)((uintptr_t)(base + 0xDU)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0xDU)))) & ~0x180U) | (uint16_t)(((uint16_t)block >> 1U)<< 7U)); } } //***************************************************************************** // //! Returns the current active receiver block number. //! //! \param base is the base address of the McBSP module. //! //! This function returns the current active receiver block involved in McBSP //! reception. //! //! \return Active block in McBSP reception. Returned values range from 0 to 7 //! representing the respective active block number . // //***************************************************************************** static inline uint16_t McBSP_getRxActiveBlock(uint32_t base) { // // Check the arguments. // do { if(!(McBSP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/mcbsp.h", 1997); } } while(0); // // return RCBLK bits. // return(((*((volatile uint16_t *)((uintptr_t)(base + 0xDU)))) & 0x1CU) >> 2U); } //***************************************************************************** // //! Configure channel selection mode for receiver. //! //! \param base is the base address of the McBSP module. //! \param channelMode is the channel selection mode. //! //! This function configures the channel selection mode. The following are //! valid values for channelMode: //! //! - \b MCBSP_ALL_RX_CHANNELS_ENABLED - enables all channels. //! - \b MCBSP_RX_CHANNEL_SELECTION_ENABLED - lets the user enable desired //! channels by using McBSP_enableRxChannel(). //! //! \return None. // //***************************************************************************** static inline void McBSP_setRxChannelMode(uint32_t base, const McBSP_RxChannelMode channelMode) { // // Check the arguments. // do { if(!(McBSP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/mcbsp.h", 2029); } } while(0); // // Set or clear RMCM bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0xDU)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0xDU)))) & ~0x1U) | (uint16_t)channelMode); } //***************************************************************************** // //! Set Multichannel transmitter partitions. //! //! \param base is the base address of the McBSP module. //! \param partition is the number of partitions. //! //! This function sets the partitions for Multichannel transmitter. Valid //! values for partition are \b MCBSP_MULTICHANNEL_TWO_PARTITION or \b //! MCBSP_MULTICHANNEL_EIGHT_PARTITION for 2 and 8 partitions respectively. //! //! \return None. // //***************************************************************************** static inline void McBSP_setTxMultichannelPartition(uint32_t base, const McBSP_MultichannelPartition partition) { // // Check the arguments. // do { if(!(McBSP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/mcbsp.h", 2059); } } while(0); // // Set or clear XMCME bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) & ~0x200U) | (uint16_t)partition); } //***************************************************************************** // //! Sets block to transmitter in two partition configuration. //! //! \param base is the base address of the McBSP module. //! \param block is the block to assign to the partition. //! //! This function assigns the block the user provides to the appropriate //! transmitter partition. //! If user sets the value of block to 0,2,4 or 6 the API will assign the //! blocks to partition A. If values 1,3,5,or 7 are set to block, then //! the API assigns the block to partition B. //! //! \note This function should be used with the two partition configuration //! only and not with eight partition configuration. //! //! \return None. // //***************************************************************************** static inline void McBSP_setTxTwoPartitionBlock(uint32_t base, const McBSP_PartitionBlock block) { // // Check the arguments. // do { if(!(McBSP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/mcbsp.h", 2093); } } while(0); if(((uint16_t)block == 0U) || ((uint16_t)block == 2U) || ((uint16_t)block == 4U) || ((uint16_t)block == 6U)) { // // write to XPABLK bits. // (*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) & ~0x60U) | ((uint16_t)((uint16_t)block >> 1U)<< 5U)); } else { // // write to XPBBLK bits. // (*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) & ~0x180U) | ((uint16_t)((uint16_t)block >> 1U)<< 7U)); } } //***************************************************************************** // //! Returns the current active transmitter block number. //! //! \param base is the base address of the McBSP module. //! //! This function returns the current active transmitter block involved in //! McBSP transmission. //! //! \return Active block in McBSP transmission. Returned values range from //! 0 to 7 representing the respective active block number. // //***************************************************************************** static inline uint16_t McBSP_getTxActiveBlock(uint32_t base) { // // Check the arguments. // do { if(!(McBSP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/mcbsp.h", 2137); } } while(0); // // return XCBLK bits. // return(((*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) & 0x1CU) >> 2U); } //***************************************************************************** // //! Configure channel selection mode for transmitter. //! //! \param base is the base address of the McBSP module. //! \param channelMode is the channel selection mode. //! //! This function configures the channel selection mode. The following are //! valid values for channelMode: //! //! - \b MCBSP_ALL_TX_CHANNELS_ENABLED - enables and unmasks all channels //! - \b MCBSP_TX_CHANNEL_SELECTION_ENABLED - lets the user enable and unmask //! desired channels by using McBSP_enableTxChannel() //! - \b MCBSP_ENABLE_MASKED_TX_CHANNEL_SELECTION - All channels enables but //! until enabled by McBSP_enableTxChannel() //! - \b MCBSP_SYMMERTIC_RX_TX_SELECTION - Symmetric transmission and //! reception. //! //! \return None. // //***************************************************************************** static inline void McBSP_setTxChannelMode(uint32_t base, const McBSP_TxChannelMode channelMode) { // // Check the arguments. // do { if(!(McBSP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/mcbsp.h", 2174); } } while(0); // // Set values to the XMCM bits. // (*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) & ~0x3U) | (uint16_t)channelMode); } //***************************************************************************** // //! Select the transmitter frame sync signal source. //! //! \param base is the base address of the McBSP module. //! \param syncSource is the transmitter frame sync source. //! //! This function sets external or internal sync signal source based on the //! syncSource selection. Valid input for syncSource are: //! //! - \b MCBSP_TX_EXTERNAL_FRAME_SYNC_SOURCE - frame sync signal is supplied //! externally by pin FSX. //! - \b MCBSP_TX_INTERNAL_FRAME_SYNC_SOURCE - frame sync signal is supplied //! internally. //! //! \return None. // //***************************************************************************** static inline void McBSP_setTxFrameSyncSource(uint32_t base, const McBSP_TxFrameSyncSource syncSource) { // // Check the arguments. // do { if(!(McBSP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/mcbsp.h", 2209); } } while(0); // //Set or Clear the FSXM bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0x12U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x12U)))) & ~0x800U) | (uint16_t)syncSource); } //***************************************************************************** // //! Select receiver frame sync signal source. //! //! \param base is the base address of the McBSP module. //! \param syncSource is the receiver frame sync source. //! //! This function sets external or internal sync signal source based on the //! syncSource selection. Valid input for syncSource are: //! //! - \b MCBSP_RX_EXTERNAL_FRAME_SYNC_SOURCE - frame sync signal is supplied //! externally by pin FSR. //! - \b MCBSP_RX_INTERNAL_FRAME_SYNC_SOURCE - frame sync signal is supplied //! by SRG. //! //! \return None. // //***************************************************************************** static inline void McBSP_setRxFrameSyncSource(uint32_t base, const McBSP_RxFrameSyncSource syncSource) { // // Check the arguments. // do { if(!(McBSP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/mcbsp.h", 2243); } } while(0); // // Set or clear FSRM bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0x12U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x12U)))) & ~0x400U) | (uint16_t)syncSource); } //***************************************************************************** // //! Configures the Transmit clock source. //! //! \param base is the base address of the McBSP module. //! \param clockSource is clock source for the transmission pin. //! //! This function configures the clock source for the transmitter. Valid input //! for rxClockSource are: //! - \b MCBSP_INTERNAL_TX_CLOCK_SOURCE - internal clock source. SRG is the //! source. //! - \b MCBSP_EXTERNAL_TX_CLOCK_SOURCE - external clock source. //! //! \return None. // //***************************************************************************** static inline void McBSP_setTxClockSource(uint32_t base, const McBSP_TxClockSource clockSource) { // // Check the arguments. // do { if(!(McBSP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/mcbsp.h", 2274); } } while(0); // // Set or clear CLKXM bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0x12U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x12U)))) & ~0x200U ) | (uint16_t)clockSource); } //***************************************************************************** // //! Configures the Receive clock source. //! //! \param base is the base address of the McBSP module. //! \param clockSource is clock source for the reception pin. //! //! This function configures the clock source for the receiver. Valid input //! for base are: //! - \b MCBSP_INTERNAL_RX_CLOCK_SOURCE - internal clock source. Sample Rate //! Generator will be used. //! - \b MCBSP_EXTERNAL_RX_CLOCK_SOURCE - external clock will drive the data. //! //! \return None. // //***************************************************************************** static inline void McBSP_setRxClockSource(uint32_t base, const McBSP_RxClockSource clockSource) { // // Check the arguments. // do { if(!(McBSP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/mcbsp.h", 2305); } } while(0); // // Set or clear CLKRM bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0x12U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x12U)))) & ~0x100U) | (uint16_t)clockSource); } //***************************************************************************** // //! Sets transmitter frame sync polarity. //! //! \param base is the base address of the McBSP module. //! \param syncPolarity is the polarity of frame sync pulse. //! //! This function sets the polarity (rising or falling edge)of the frame sync //! on FSX pin. Use \b MCBSP_TX_FRAME_SYNC_POLARITY_LOW for active low //! frame sync pulse and \b MCBSP_TX_FRAME_SYNC_POLARITY_HIGH for active //! high sync pulse. //! //! \return None. // //***************************************************************************** static inline void McBSP_setTxFrameSyncPolarity(uint32_t base, const McBSP_TxFrameSyncPolarity syncPolarity) { // // Check the arguments. // do { if(!(McBSP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/mcbsp.h", 2336); } } while(0); // // Set or clear FSXP bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0x12U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x12U)))) & ~0x8U) | (uint16_t)syncPolarity); } //***************************************************************************** //! Sets receiver frame sync polarity. //! //! \param base is the base address of the McBSP module. //! \param syncPolarity is the polarity of frame sync pulse. //! //! This function sets the polarity (rising or falling edge)of the frame sync //! on FSR pin. Use \b MCBSP_RX_FRAME_SYNC_POLARITY_LOW for active low //! frame sync pulse and \b MCBSP_RX_FRAME_SYNC_POLARITY_HIGH for active //! high sync pulse. //! //! \return None. // //***************************************************************************** static inline void McBSP_setRxFrameSyncPolarity(uint32_t base, const McBSP_RxFrameSyncPolarity syncPolarity) { // // Check the arguments. // do { if(!(McBSP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/mcbsp.h", 2366); } } while(0); // // Set or clear FSRP bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0x12U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x12U)))) & ~0x4U) | (uint16_t)syncPolarity); } //***************************************************************************** //! Sets transmitter clock polarity when using external clock source. //! //! \param base is the base address of the McBSP module. //! \param clockPolarity is the polarity of external clock. //! //! This function sets the polarity (rising or falling edge) of the transmitter //! clock on MCLKX pin. //! Valid values for clockPolarity are: //! - \b MCBSP_TX_POLARITY_RISING_EDGE for rising edge. //! - \b MCBSP_TX_POLARITY_FALLING_EDGE for falling edge. //! //! \return None. // //***************************************************************************** static inline void McBSP_setTxClockPolarity(uint32_t base, const McBSP_TxClockPolarity clockPolarity) { // // Check the arguments. // do { if(!(McBSP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/mcbsp.h", 2397); } } while(0); // // Clear CLKXP bit first , then set or clear CLKXP bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0x12U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x12U)))) & ~0x2U) | (uint16_t)clockPolarity); } //***************************************************************************** //! Sets receiver clock polarity when using external clock source. //! //! \param base is the base address of the McBSP module. //! \param clockPolarity is the polarity of external clock. //! //! This function sets the polarity (rising or falling edge) of the receiver //! clock on MCLKR pin. If external clock is used, the polarity will affect //! CLKG signal. //! Valid values for clockPolarity are: //! - \b MCBSP_RX_POLARITY_RISING_EDGE for rising edge. //! - \b MCBSP_RX_POLARITY_FALLING_EDGE for falling edge. //! //! \return None. // //***************************************************************************** static inline void McBSP_setRxClockPolarity(uint32_t base, const McBSP_RxClockPolarity clockPolarity) { // // Check the arguments. // do { if(!(McBSP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/mcbsp.h", 2430); } } while(0); // // Clear CLKRP bit first , then set or clear CLKRP bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0x12U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x12U)))) & ~0x1U) | (uint16_t)clockPolarity); } //***************************************************************************** // //! Read 8,12 or 16 bit data word from McBSP data receive registers. //! //! \param base is the base address of the McBSP port. //! //! This function returns the data value in data receive register. //! //! \return received data. // //***************************************************************************** static inline uint16_t McBSP_read16bitData(uint32_t base) { // // Check the arguments. // do { if(!(McBSP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/mcbsp.h", 2457); } } while(0); // // Read DRR1 register. // return((*((volatile uint16_t *)((uintptr_t)(base + 0x1U))))); } //***************************************************************************** // //! Read 20, 24 or 32 bit data word from McBSP data receive registers. //! //! \param base is the base address of the McBSP port. //! //! This function returns the data values in data receive registers. //! //! \return received data. // //***************************************************************************** static inline uint32_t McBSP_read32bitData(uint32_t base) { // // Check the arguments. // do { if(!(McBSP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/mcbsp.h", 2482); } } while(0); // // Read DDR1 register and return DDR2:DDR1. // return((((uint32_t)(*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) << 16U) | (*((volatile uint16_t *)((uintptr_t)(base + 0x1U)))))); } //***************************************************************************** // //! Write 8,12 or 16 bit data word to McBSP data transmit registers. //! //! \param base is the base address of the McBSP port. //! \param data is the data to be written. //! //! This function writes 8,12 or 16 bit data to data transmit register. //! //! \return None. // //***************************************************************************** static inline void McBSP_write16bitData(uint32_t base, uint16_t data) { // // Check the arguments. // do { if(!(McBSP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/mcbsp.h", 2509); } } while(0); // // Write to DXR1 register. // (*((volatile uint16_t *)((uintptr_t)(base + 0x3U)))) = data; } //***************************************************************************** // //! Write 20, 24 or 32 bit data word to McBSP data transmit registers. //! //! \param base is the base address of the McBSP port. //! \param data is the data to be written. //! //! This function writes 20, 24 or 32 bit data to data transmit registers. //! //! \return None. // //***************************************************************************** static inline void McBSP_write32bitData(uint32_t base, uint32_t data) { // // Check the arguments. // do { if(!(McBSP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/mcbsp.h", 2535); } } while(0); // // Write to DXR2 register first. // (*((volatile uint16_t *)((uintptr_t)(base + 0x2U)))) = data >> 16U; // // Write to DXR1 register. // (*((volatile uint16_t *)((uintptr_t)(base + 0x3U)))) = data & 0xFFFFU; } //***************************************************************************** // //! Return left justified for data for U Law or A Law companding. //! //! \param data is the 14 bit word. //! \param compandingType specifies the type comapnding desired. //! //! This functions returns U law or A law adjusted word. //! //! \return U law or A law left justified word. // //***************************************************************************** static inline uint16_t McBSP_getLeftJustifyData(uint16_t data, const McBSP_CompandingType compandingType) { return(data << (uint16_t)compandingType); } //***************************************************************************** // //! Enable Recieve Interrupt. //! //! \param base is the base address of the McBSP module. //! //! This function enables Recieve Interrupt on RRDY. //! //! \return None. // //***************************************************************************** static inline void McBSP_enableRxInterrupt(uint32_t base) { // // Check the arguments. // do { if(!(McBSP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/mcbsp.h", 2585); } } while(0); // // Set RINT ENA bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0x23U)))) |= 0x4U; } //***************************************************************************** // //! Disable Recieve Interrupt. //! //! \param base is the base address of the McBSP module. //! //! This function disables Recieve Interrupt on RRDY. //! //! \return None. // //***************************************************************************** static inline void McBSP_disableRxInterrupt(uint32_t base) { // // Check the arguments. // do { if(!(McBSP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/mcbsp.h", 2610); } } while(0); // // Clear RINT ENA bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0x23U)))) |= ~(0x4U); } //***************************************************************************** // //! Enable Transmit Interrupt. //! //! \param base is the base address of the McBSP module. //! //! This function enables Transmit Interrupt on XRDY. //! //! \return None. // //***************************************************************************** static inline void McBSP_enableTxInterrupt(uint32_t base) { // // Check the arguments. // do { if(!(McBSP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/mcbsp.h", 2635); } } while(0); // // Set XINT ENA bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0x23U)))) |= 0x1U; } //***************************************************************************** // //! Disable Transmit Interrupt. //! //! \param base is the base address of the McBSP module. //! //! This function disables Transmit Interrupt on XRDY. //! //! \return None. // //***************************************************************************** static inline void McBSP_disableTxInterrupt(uint32_t base) { // // Check the arguments. // do { if(!(McBSP_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/mcbsp.h", 2660); } } while(0); // // Clear XINT ENA bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0x23U)))) |= ~(0x1U); } //***************************************************************************** // //! Write 8,12 or 16 bit data word to McBSP data transmit registers //! //! \param base is the base address of the McBSP port. //! \param data is the data to be written. //! //! This function sends 16 bit or less data to the transmitter buffer. //! //! \return None. //! //! \return None. // //***************************************************************************** extern void McBSP_transmit16BitDataNonBlocking(uint32_t base, uint16_t data); //***************************************************************************** // //! Write 8,12 or 16 bit data word to McBSP data transmit registers //! //! \param base is the base address of the McBSP port. //! \param data is the data to be written. //! //! This function sends 16 bit or less data to the transmitter buffer. If //! transmit buffer is not ready the function will wait until transmit buffer //! is empty. If the transmitter buffer is empty the data will be written to //! the data registers. //! //! \return None. // //***************************************************************************** extern void McBSP_transmit16BitDataBlocking(uint32_t base, uint16_t data); //***************************************************************************** // //! Write 20 , 24 or 32 bit data word to McBSP data transmit registers //! //! \param base is the base address of the McBSP port. //! \param data is the data to be written. //! //! This function sends 20 , 24 or 32 bit data to the transmitter buffer. If //! the transmitter buffer is empty the data will be written to the data //! registers. //! //! \return None. // //***************************************************************************** extern void McBSP_transmit32BitDataNonBlocking(uint32_t base, uint32_t data); //***************************************************************************** // //! Write 20 , 24 or 32 bit data word to McBSP data transmit registers //! //! \param base is the base address of the McBSP port. //! \param data is the data to be written. //! //! This function sends 20 , 24 or 32 bit data to the transmitter buffer. If //! transmit buffer is not ready the function will wait until transmit buffer //! is empty. If the transmitter buffer is empty the data will be written //! to the data registers. //! //! \return None. // //***************************************************************************** extern void McBSP_transmit32BitDataBlocking(uint32_t base, uint32_t data); //***************************************************************************** // //! Read 8,12 or 16 bit data word from McBSP data receive registers //! //! \param base is the base address of the McBSP port. //! \param receiveData is the pointer to the receive data. //! //! This function reads 8,12 or 16 bit data from the receiver buffer. //! If the receiver buffer has new data, the data will be read. //! //! \return None. // //***************************************************************************** extern void McBSP_receive16BitDataNonBlocking(uint32_t base, uint16_t *receiveData); //***************************************************************************** // //! Read 8,12 or 16 bit data word from McBSP data receive registers //! //! \param base is the base address of the McBSP port. //! \param receiveData is the pointer to the receive data. //! //! This function reads 8,12 or 16 bit data from the receiver buffer. If //! receiver buffer is not ready the function will wait until receiver buffer //! has new data. //! If the receiver buffer has new data, the data will be read. //! //! \return None. // //***************************************************************************** extern void McBSP_receive16BitDataBlocking(uint32_t base, uint16_t *receiveData); //***************************************************************************** // //! Read 20, 24 or 32 bit data word from McBSP data receive registers //! //! \param base is the base address of the McBSP port. //! \param receiveData is the pointer to the receive data. //! //! This function reads 20, 24 or 32 bit data from the receiver buffer. //! If the receiver buffer has new data, the data will be read. //! //! \return None. // //***************************************************************************** extern void McBSP_receive32BitDataNonBlocking(uint32_t base, uint32_t *receiveData); //***************************************************************************** // //! Read 20, 24 or 32 bit data word from McBSP data receive registers //! //! \param base is the base address of the McBSP port. //! \param receiveData is the pointer to the receive data. //! //! This function reads 20, 24 or 32 bit data from the receiver buffer. If //! receiver buffer is not ready the function will wait until receiver buffer //! has new data. //! If the receiver buffer has new data, the data will be read. //! //! \return None. // //***************************************************************************** extern void McBSP_receive32BitDataBlocking(uint32_t base, uint32_t *receiveData); //***************************************************************************** // //! Sets number of words per frame and bits per word for data Reception. //! //! \param base is the base address of the McBSP module. //! \param dataFrame is the data frame phase. //! \param bitsPerWord is the number of bits per word. //! \param wordsPerFrame is the number of words per frame per phase. //! //! This function sets the number of bits per word and the number of words per //! frame for the given phase. //! Valid inputs for phase are \b MCBSP_PHASE_ONE_FRAME or \b //! MCBSP_PHASE_TWO_FRAME representing the first or second frame phase //! respectively. Valid value for bitsPerWord are: //! - \b MCBSP_BITS_PER_WORD_8 8 bit word. //! - \b MCBSP_BITS_PER_WORD_12 12 bit word. //! - \b MCBSP_BITS_PER_WORD_16 16 bit word. //! - \b MCBSP_BITS_PER_WORD_20 20 bit word. //! - \b MCBSP_BITS_PER_WORD_24 24 bit word. //! - \b MCBSP_BITS_PER_WORD_32 32 bit word. //! The maximum value for wordsPerFrame is 127 (128 - 1)representing 128 words. //! //! \return None. // //***************************************************************************** extern void McBSP_setRxDataSize(uint32_t base, const McBSP_DataPhaseFrame dataFrame, const McBSP_DataBitsPerWord bitsPerWord, uint16_t wordsPerFrame); //***************************************************************************** // //! Sets number of words per frame and bits per word for data Transmission. //! //! \param base is the base address of the McBSP module. //! \param dataFrame is the data frame phase. //! \param bitsPerWord is the number of bits per word. //! \param wordsPerFrame is the number of words per frame per phase. //! //! This function sets the number of bits per word and the number of words per //! frame for the given phase. //! Valid inputs for phase are \b MCBSP_PHASE_ONE_FRAME or \b //! MCBSP_PHASE_TWO_FRAME representing single or dual phase respectively. //! Valid values for bitsPerWord are: //! - \b MCBSP_BITS_PER_WORD_8 8 bit word. //! - \b MCBSP_BITS_PER_WORD_12 12 bit word. //! - \b MCBSP_BITS_PER_WORD_16 16 bit word. //! - \b MCBSP_BITS_PER_WORD_20 20 bit word. //! - \b MCBSP_BITS_PER_WORD_24 24 bit word. //! - \b MCBSP_BITS_PER_WORD_32 32 bit word. //! The maximum value for wordsPerFrame is 127 (128 - 1)representing 128 words. //! //! \return None. // //***************************************************************************** extern void McBSP_setTxDataSize(uint32_t base, const McBSP_DataPhaseFrame dataFrame, const McBSP_DataBitsPerWord bitsPerWord, uint16_t wordsPerFrame); //***************************************************************************** // //! Disables a channel in an eight partition receiver //! //! \param base is the base address of the McBSP module. //! \param partition is the partition of the channel. //! \param channel is the receiver channel number to be enabled. //! //! This function disables the given receiver channel number for the partition //! provided. //! Valid values for partition are \b MCBSP_MULTICHANNEL_TWO_PARTITION or //! \b MCBSP_MULTICHANNEL_EIGHT_PARTITION for 2 or 8 partitions respectively. //! Valid values for channel range from 0 to 127. //! //! \return None. // //***************************************************************************** extern void McBSP_disableRxChannel(uint32_t base, const McBSP_MultichannelPartition partition, uint16_t channel); //***************************************************************************** // //! Enables a channel for eight partition receiver //! //! \param base is the base address of the McBSP module. //! \param partition is the partition of the channel. //! \param channel is the receiver channel number to be enabled. //! //! This function enables the given receiver channel number for the partition //! provided. //! Valid values for partition are \b MCBSP_MULTICHANNEL_TWO_PARTITION or //! \b MCBSP_MULTICHANNEL_EIGHT_PARTITION for 2 or 8 partitions respectively. //! Valid values for channel range from 0 to 127. //! //! \return None. // //***************************************************************************** extern void McBSP_enableRxChannel(uint32_t base, const McBSP_MultichannelPartition partition, uint16_t channel); //***************************************************************************** // //! Disables a channel in an eight partition transmitter //! //! \param base is the base address of the McBSP module. //! \param partition is the partition of the channel. //! \param channel is the transmitter channel number to be enabled. //! //! This function disables the given transmitter channel number for the //! partition provided. //! Valid values for partition are \b MCBSP_MULTICHANNEL_TWO_PARTITION or //! \b MCBSP_MULTICHANNEL_EIGHT_PARTITION for 2 or 8 partitions respectively. //! Valid values for channel range from 0 to 127. //! //! \return None. // //***************************************************************************** extern void McBSP_disableTxChannel(uint32_t base, const McBSP_MultichannelPartition partition, uint16_t channel); //***************************************************************************** // //! Enables a channel for eight partition transmitter //! //! \param base is the base address of the McBSP module. //! \param partition is the partition of the channel. //! \param channel is the transmitter channel number to be enabled. //! //! This function enables the given transmitter channel number for the //! partition provided. //! Valid values for partition are \b MCBSP_MULTICHANNEL_TWO_PARTITION or //! \b MCBSP_MULTICHANNEL_EIGHT_PARTITION for 2 or 8 partitions respectively. //! Valid values for channel range from 0 to 127. //! //! \return None. // //***************************************************************************** extern void McBSP_enableTxChannel(uint32_t base, const McBSP_MultichannelPartition partition, uint16_t channel); //***************************************************************************** // //! Configures transmitter clock //! //! \param base is the base address of the McBSP module. //! \param ptrClockParams is a pointer to a structure containing \e clock //! parameters McBSP_ClockParams. //! This function sets up the transmitter clock. The following are valid //! values and ranges for the parameters of the McBSP_TxFsyncParams. //! - \b clockSRGSyncFSR - true to sync with signal on FSR pin, //! false to ignore signal on FSR pin. //! the pulse on FSR pin. //! - \b clockSRGDivider - Maximum valid value is 255. //! - \b clockSource - MCBSP_EXTERNAL_TX_CLOCK_SOURCE or //! MCBSP_INTERNAL_TX_CLOCK_SOURCE //! - \b clockTxSRGSource - MCBSP_SRG_TX_CLOCK_SOURCE_LSPCLK or //! MCBSP_SRG_TX_CLOCK_SOURCE_MCLKR_PIN //! - \b clockMCLKXPolarity - Output polarity on MCLKX pin. //! - MCBSP_TX_POLARITY_RISING_EDGE //! - MCBSP_TX_POLARITY_FALLING_EDGE //! - \b clockMCLKRPolarity - Input polarity on MCLKR pin (if SRG is //! sourced from MCLKR pin). //! - MCBSP_RX_POLARITY_FALLING_EDGE //! - MCBSP_RX_POLARITY_RISING_EDGE //! //! \note Make sure the clock divider is such that, the McBSP clock is not //! running faster than 1/2 the speed of the source clock. //! //! \return None. // //***************************************************************************** extern void McBSP_configureTxClock(uint32_t base, const McBSP_ClockParams * ptrClockParams); //***************************************************************************** // //! Configures receiver clock //! //! \param base is the base address of the McBSP module. //! \param ptrClockParams is a pointer to a structure containing \e clock //! parameters McBSP_ClockParams. //! This function sets up the receiver clock. The following are valid //! values and ranges for the parameters of the McBSP_TxFsyncParams. //! - \b clockSRGSyncFlag - true to sync with signal on FSR pin, false to //! ignore the pulse on FSR pin. //! - \b clockSRGDivider - Maximum valid value is 255. //! - \b clockSource - MCBSP_EXTERNAL_RX_CLOCK_SOURCE or //! MCBSP_INTERNAL_RX_CLOCK_SOURCE //! - \b clockRxSRGSource - MCBSP_SRG_RX_CLOCK_SOURCE_LSPCLK or //! MCBSP_SRG_RX_CLOCK_SOURCE_MCLKX_PIN //! - \b clockMCLKRPolarity- output polarity on MCLKR pin. //! - MCBSP_RX_POLARITY_FALLING_EDGE or //! - MCBSP_RX_POLARITY_RISING_EDGE //! - \b clockMCLKXPolarity- Input polarity on MCLKX pin (if SRG is sourced //! from MCLKX pin). //! - MCBSP_TX_POLARITY_RISING_EDGE or //! - MCBSP_TX_POLARITY_FALLING_EDGE //! //! \note Make sure the clock divider is such that, the McBSP clock is not //! running faster than 1/2 the speed of the source clock. //! //! \return None. // //***************************************************************************** extern void McBSP_configureRxClock(uint32_t base, const McBSP_ClockParams * ptrClockParams); //***************************************************************************** // //! Configures transmitter frame sync. //! //! \param base is the base address of the McBSP module. //! \param ptrFsyncParams is a pointer to a structure containing \e frame sync //! parameters McBSPTxFsyncParams. //! This function sets up the transmitter frame sync. The following are valid //! values and ranges for the parameters of the McBSPTxFsyncParams. //! - \b syncSRGSyncFSRFlag - true to sync with signal on FSR pin, false to //! ignore the pulse on FSR pin.This value has to //! be similar to the value of //! McBSP_ClockParams.clockSRGSyncFlag. //! - \b syncErrorDetect - true to enable frame sync error detect. false //! to disable. //! - \b syncClockDivider - Maximum valid value is 4095. //! - \b syncPulseDivider - Maximum valid value is 255. //! - \b syncSourceTx - MCBSP_TX_INTERNAL_FRAME_SYNC_SOURCE or //! MCBSP_TX_EXTERNAL_FRAME_SYNC_SOURCE //! - \b syncIntSource - MCBSP_TX_INTERNAL_FRAME_SYNC_DATA or //! MCBSP_TX_INTERNAL_FRAME_SYNC_SRG //! - \b syncFSXPolarity - MCBSP_TX_FRAME_SYNC_POLARITY_LOW or //! MCBSP_TX_FRAME_SYNC_POLARITY_HIGH. //! //! \return None. // //***************************************************************************** extern void McBSP_configureTxFrameSync(uint32_t base, const McBSP_TxFsyncParams * ptrFsyncParams); //***************************************************************************** // //! Configures receiver frame sync. //! //! \param base is the base address of the McBSP module. //! \param ptrFsyncParams is a pointer to a structure containing \e frame sync //! parameters McBSP_RxFsyncParams. //! This function sets up the receiver frame sync. The following are valid //! values and ranges for the parameters of the McBSPTxFsyncParams. //! - \b syncSRGSyncFSRFlag - true to sync with signal on FSR pin, //! false to ignore the pulse on FSR pin. //! This value has to be similar to the value of //! McBSP_ClockParams.clockSRGSyncFlag. //! - \b syncErrorDetect - true to enable frame sync error detect. //! false to disable. //! - \b syncClockDivider - Maximum valid value is 4095. //! - \b syncPulseDivider - Maximum valid value is 255. //! - \b syncSourceRx - MCBSP_RX_INTERNAL_FRAME_SYNC_SOURCE or //! MCBSP_RX_EXTERNAL_FRAME_SYNC_SOURCE //! - \b syncFSRPolarity - MCBSP_RX_FRAME_SYNC_POLARITY_LOW or //! MCBSP_RX_FRAME_SYNC_POLARITY_HIGH //! //! \return None. // //***************************************************************************** extern void McBSP_configureRxFrameSync(uint32_t base, const McBSP_RxFsyncParams * ptrFsyncParams); //***************************************************************************** // //! Configures transmitter data format. //! //! \param base is the base address of the McBSP module. //! \param ptrDataParams is a pointer to a structure containing \e data format //! parameters McBSPTxDataParams. //! This function sets up the transmitter data format and properties. The //! following are valid values and ranges for the parameters of the //! McBSPTxDataParams. //! - \b loopbackModeFlag - true for digital loop-back mode. //! false for no loop-back mode. //! - \b twoPhaseModeFlag - true for two phase mode. //! false for single phase mode. //! - \b pinDelayEnableFlag - true to enable DX pin delay. //! false to disable DX pin delay. //! - \b phase1FrameLength - maximum value of 127. //! - \b phase2FrameLength - maximum value of 127. //! - \b clockStopMode - MCBSP_CLOCK_SPI_MODE_NO_DELAY or //! MCBSP_CLOCK_SPI_MODE_DELAY //! - \b phase1WordLength - MCBSP_BITS_PER_WORD_x , x = 8,12,16,20,24,32 //! - \b phase2WordLength - MCBSP_BITS_PER_WORD_x , x = 8,12,16,20,24,32 //! - \b compandingMode - MCBSP_COMPANDING_NONE, //! MCBSP_COMPANDING_NONE_LSB_FIRST //! MCBSP_COMPANDING_U_LAW_SET or //! MCBSP_COMPANDING_A_LAW_SET. //! - \b dataDelayBits - MCBSP_DATA_DELAY_BIT_0, //! MCBSP_DATA_DELAY_BIT_1 or //! MCBSP_DATA_DELAY_BIT_2 //! - \b interruptMode - MCBSP_TX_ISR_SOURCE_TX_READY, //! MCBSP_TX_ISR_SOURCE_END_OF_BLOCK, //! MCBSP_TX_ISR_SOURCE_FRAME_SYNC or //! MCBSP_TX_ISR_SOURCE_SYNC_ERROR //! //! \b Note - When using companding,phase1WordLength and phase2WordLength //! must be 8 bits wide. //! //! \return None. // //***************************************************************************** extern void McBSP_configureTxDataFormat(uint32_t base, const McBSP_TxDataParams * ptrDataParams); //***************************************************************************** // //! Configures receiver data format. //! //! \param base is the base address of the McBSP module. //! \param ptrDataParams is a pointer to a structure containing data format //! parameters McBSP_RxDataParams. //! This function sets up the transmitter data format and properties. The //! following are valid values and ranges for the parameters of the //! McBSP_RxDataParams. //! - \b loopbackModeFlag - true for digital loop-back mode. //! false for non loop-back mode. //! - \b twoPhaseModeFlag - true for two phase mode. //! false for single phase mode. //! - \b phase1FrameLength - maximum value of 127. //! - \b phase2FrameLength - maximum value of 127. //! - \b phase1WordLength - MCBSP_BITS_PER_WORD_x , x = 8,12,16,20,24,32 //! - \b phase2WordLength - MCBSP_BITS_PER_WORD_x , x = 8,12,16,20,24,32 //! - \b compandingMode - MCBSP_COMPANDING_NONE, //! MCBSP_COMPANDING_NONE_LSB_FIRST //! MCBSP_COMPANDING_U_LAW_SET or //! MCBSP_COMPANDING_A_LAW_SET. //! - \b dataDelayBits - MCBSP_DATA_DELAY_BIT_0, //! MCBSP_DATA_DELAY_BIT_1 or //! MCBSP_DATA_DELAY_BIT_2 //! - \b signExtMode - MCBSP_RIGHT_JUSTIFY_FILL_ZERO, //! MCBSP_RIGHT_JUSTIFY_FILL_SIGN or //! MCBSP_LEFT_JUSTIFY_FILL_ZER0 //! - \b interruptMode - MCBSP_RX_ISR_SOURCE_SERIAL_WORD, //! MCBSP_RX_ISR_SOURCE_END_OF_BLOCK, //! MCBSP_RX_ISR_SOURCE_FRAME_SYNC or //! MCBSP_RX_ISR_SOURCE_SYNC_ERROR //! //! \b Note - When using companding,phase1WordLength and phase2WordLength //! must be 8 bits wide. //! //! \return None. // //***************************************************************************** extern void McBSP_configureRxDataFormat(uint32_t base, const McBSP_RxDataParams * ptrDataParams); //***************************************************************************** // //! Configures transmitter multichannel. //! //! \param base is the base address of the McBSP module. //! \param ptrMchnParams is a pointer to a structure containing multichannel //! parameters McBSP_TxMultichannelParams. //! //! This function sets up the transmitter multichannel mode. The following are //! valid values and ranges for the parameters of the //! McBSP_TxMultichannelParams. //! - \b channelCount - Maximum value of 128 for partition 8 //! Maximum value of 32 for partition 2 //! - \b ptrChannelsList - Pointer to an array of size channelCount that //! has unique channels. //! - \b multichannelMode - MCBSP_ALL_TX_CHANNELS_ENABLED, //! MCBSP_TX_CHANNEL_SELECTION_ENABLED, //! MCBSP_ENABLE_MASKED_TX_CHANNEL_SELECTION or //! MCBSP_SYMMERTIC_RX_TX_SELECTION //! - \b partition - MCBSP_MULTICHANNEL_TWO_PARTITION or //! MCBSP_MULTICHANNEL_EIGHT_PARTITION //! \note - In 2 partition mode only channels that belong to a single even or //! odd block number should be listed. It is valid to have an even and //! odd channels. For example you can have channels [48 -63] and //! channels [96 - 111] enables as one belongs to an even block and //! the other to an odd block or two partitions. But not channels //! [48 - 63] and channels [112 - 127] since they both are even blocks //! or similar partitions. //! //! \return returns the following error codes. //! - \b MCBSP_ERROR_EXCEEDED_CHANNELS - number of channels exceeds 128 //! - \b MCBSP_ERROR_2_PARTITION_A - invalid channel combination for //! partition A //! - \b MCBSP_ERROR_2_PARTITION_B - invalid channel combination for //! partition B //! - \b MCBSP_ERROR_INVALID_MODE - invalid transmitter channel mode. //! //! \return Returns the following error codes. //! - \b MCBSP_ERROR_EXCEEDED_CHANNELS - Exceeded number of channels. //! - \b MCBSP_ERROR_2_PARTITION_A - Error in 2 partition A setup. //! - \b MCBSP_ERROR_2_PARTITION_B - Error in 2 partition B setup. //! - \b MCBSP_ERROR_INVALID_MODE - Invalid mode. // //***************************************************************************** extern uint16_t McBSP_configureTxMultichannel(uint32_t base, const McBSP_TxMultichannelParams * ptrMchnParams); //***************************************************************************** // //! Configures receiver multichannel. //! //! \param base is the base address of the McBSP module. //! \param ptrMchnParams is a pointer to a structure containing multichannel //! parameters McBSP_RxMultiChannelParams. //! //! This function sets up the receiver multichannel mode. The following are //! valid values and ranges for the parameters of the McBSPMultichannelParams. //! - \b channelCount - Maximum value of 128 for partition 8 //! Maximum value of 32 for partition 2 //! - \b ptrChannelsList - Pointer to an array of size channelCount that //! has unique channels. //! - \b multichannelMode - MCBSP_ALL_RX_CHANNELS_ENABLED, //! MCBSP_RX_CHANNEL_SELECTION_ENABLED, //! - \b partition - MCBSP_MULTICHANNEL_TWO_PARTITION or //! MCBSP_MULTICHANNEL_EIGHT_PARTITION //! \note - In 2 partition mode only channels that belong to a single even or //! odd block number should be listed. It is valid to have an even //! and odd channels. For example you can have channels [48 - 63] and //! channels [96 - 111] enables as one belongs to an even block and //! the other to an odd block or two partitions. But not channels //! [48 - 63]and channels [112 - 127] since they both are even blocks //! or similar partitions. //! //! \return returns the following error codes. //! - \b MCBSP_ERROR_EXCEEDED_CHANNELS - number of channels exceeds 128 //! - \b MCBSP_ERROR_2_PARTITION_A - invalid channel combination for //! partition A //! - \b MCBSP_ERROR_2_PARTITION_B - invalid channel combination for //! partition B //! - \b MCBSP_ERROR_INVALID_MODE - invalid transmitter channel mode. //! //! \return Returns the following error codes. //! - \b MCBSP_ERROR_EXCEEDED_CHANNELS - Exceeded number of channels. //! - \b MCBSP_ERROR_2_PARTITION_A - Error in 2 partition A setup. //! - \b MCBSP_ERROR_2_PARTITION_B - Error in 2 partition B setup. //! - \b MCBSP_ERROR_INVALID_MODE - Invalid mode. // //***************************************************************************** extern uint16_t McBSP_configureRxMultichannel(uint32_t base, const McBSP_RxMultichannelParams * ptrMchnParams); //***************************************************************************** // //! Configures McBSP in SPI master mode //! //! \param base is the base address of the McBSP module. //! \param ptrSPIMasterMode is a pointer to a structure containing SPI //! parameters McBSP_SPIMasterModeParams. //! This function sets up the McBSP module in SPI master mode.The following are //! valid values and ranges for the parameters of the //! McBSP_SPIMasterModeParams. //! - \b loopbackModeFlag - true for digital loop-back //! false for no loop-back //! - \b clockStopMode - MCBSP_CLOCK_SPI_MODE_NO_DELAY or //! MCBSP_CLOCK_SPI_MODE_DELAY //! - \b wordLength - MCBSP_BITS_PER_WORD_x , x = 8,12,16,20,24,32 //! - \b spiMode It represents the clock polarity can take values: //! - MCBSP_TX_POLARITY_RISING_EDGE or //! MCBSP_TX_POLARITY_FALLING_EDGE //! - \b clockSRGDivider - Maximum valid value is 255. //! //! \note Make sure the clock divider is such that, the McBSP clock is not //! running faster than 1/2 the speed of the source clock. //! //! \return None. // //***************************************************************************** extern void McBSP_configureSPIMasterMode(uint32_t base, const McBSP_SPIMasterModeParams * ptrSPIMasterMode); //***************************************************************************** // //! Configures McBSP in SPI slave mode //! //! \param base is the base address of the McBSP module. //! \param ptrSPISlaveMode is a pointer to a structure containing SPI //! parameters McBSP_SPISlaveModeParams. //! This function sets up the McBSP module in SPI slave mode.The following are //! valid values and ranges for the parameters of the McBSP_SPISlaveModeParams. //! - \b loopbackModeFlag - true for digital loop-back //! false for no loop-back //! - \b clockStopMode - MCBSP_CLOCK_SPI_MODE_NO_DELAY or //! MCBSP_CLOCK_SPI_MODE_DELAY //! - \b wordLength - MCBSP_BITS_PER_WORD_x , x = 8,12,16,20,24,32 //! - \b spiMode It represents the clock polarity and can take //! values: //! - MCBSP_RX_POLARITY_FALLING_EDGE or //! MCBSP_RX_POLARITY_RISING_EDGE //! //! \return None. // //***************************************************************************** extern void McBSP_configureSPISlaveMode(uint32_t base, const McBSP_SPISlaveModeParams * ptrSPISlaveMode); //***************************************************************************** // // Close the Doxygen group. //! @} // //***************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //########################################################################### // // FILE: memcfg.h // // TITLE: C28x RAM config driver. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup memcfg_api MemCfg //! @{ // //***************************************************************************** //***************************************************************************** // // Useful defines used within the driver functions. Not intended for use by // application code. // //***************************************************************************** // // Masks to decode memory section defines. // // // Used for access violation functions. // // // Key for writing to memory test config lock registers // //***************************************************************************** // // Values that can be passed to MemCfg_lockConfig(), MemCfg_unlockConfig(), // MemCfg_commitConfig(), MemCfg_setProtection(), MemCfg_initSections(), // MemCfg_setCLAMemType(), MemCfg_setLSRAMMasterSel(), MemCfg_getInitStatus() // as the memSection(s) or ramSection(s) parameter. // //***************************************************************************** // // DxRAM - Dedicated RAM config // // // LSxRAM - Local shared RAM config // // // GSxRAM - Global shared RAM config // // // MSGxRAM - Message RAM config // // // ROM memory sections // // // Peripheral memory sections // // // All sections // //***************************************************************************** // // Values that can be passed to MemCfg_setProtection() as the protectMode // parameter. // //***************************************************************************** //***************************************************************************** // // Values that can be passed to MemCfg_enableViolationInterrupt() // MemCfg_disableViolationInterrupt(), MemCfg_forceViolationInterrupt(), // MemCfg_clearViolationInterruptStatus(), and MemCfg_getViolationAddress() as // the intFlags parameter. They also make up the return value of // MemCfg_getViolationInterruptStatus(). // //***************************************************************************** //***************************************************************************** // // Values that can be passed to MemCfg_forceCorrErrorStatus(), // MemCfg_clearCorrErrorStatus(), and MemCfg_getCorrErrorAddress() as the // stsFlag(s) parameter and returned by MemCfg_getCorrErrorStatus(). // //***************************************************************************** //***************************************************************************** // // Values that can be passed to MemCfg_forceUncorrErrorStatus(), // MemCfg_clearUncorrErrorStatus(), and MemCfg_getUncorrErrorAddress() as the // stsFlag(s) parameter and returned by MemCfg_getUncorrErrorStatus(). // //***************************************************************************** //***************************************************************************** // // Values that can be passed to MemCfg_clearDiagErrorStatus() as stsFlags // parameter and returned by MemCfg_getDiagErrorStatus(). // //***************************************************************************** //***************************************************************************** // //! Values that can be passed to MemCfg_setCLAMemType() as the \e claMemType //! parameter. // //***************************************************************************** typedef enum { MEMCFG_CLA_MEM_DATA, //!< Section is CLA data memory MEMCFG_CLA_MEM_PROGRAM //!< Section is CLA program memory } MemCfg_CLAMemoryType; //***************************************************************************** // //! Values that can be passed to MemCfg_setLSRAMMasterSel() as the \e masterSel //! parameter. // //***************************************************************************** typedef enum { MEMCFG_LSRAMMASTER_CPU_ONLY, //!< CPU is the master of the section MEMCFG_LSRAMMASTER_CPU_CLA1 //!< CPU and CLA1 share this section } MemCfg_LSRAMMasterSel; //***************************************************************************** // //! Values that can be passed to MemCfg_setGSRAMMasterSel() as the \e masterSel //! parameter. // //***************************************************************************** typedef enum { MEMCFG_GSRAMMASTER_CPU1, //!< CPU1 is master of the section MEMCFG_GSRAMMASTER_CPU2 //!< CPU2 is master of the section } MemCfg_GSRAMMasterSel; //***************************************************************************** // //! Values that can be passed to MemCfg_setTestMode() as the \e testMode //! parameter. // //***************************************************************************** typedef enum { //! Functional mode MEMCFG_TEST_FUNCTIONAL = 0, //! Writes allowed to data only MEMCFG_TEST_WRITE_DATA = 1, //! Writes allowed to ECC only (for DxRAM & LSxRAM) MEMCFG_TEST_WRITE_ECC = 2, //! Writes allowed to Parity only (for GSxRAM, MSGxRAM & ROM) MEMCFG_TEST_WRITE_PARITY = 2, //! Diagnostic mode, similar to functional mode but NMI is not generated. MEMCFG_TEST_FUNC_DIAG = 3 } MemCfg_TestMode; //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** //***************************************************************************** // //! Sets the CLA memory type of the specified RAM section. //! //! \param ramSections is the logical OR of the sections to be configured. //! \param claMemType indicates data memory or program memory. //! //! This function sets the CLA memory type configuration of the RAM section. If //! the \e claMemType parameter is \b MEMCFG_CLA_MEM_DATA, the RAM section will //! be configured as CLA data memory. If \b MEMCFG_CLA_MEM_PROGRAM, the RAM //! section will be configured as CLA program memory. //! //! The \e ramSections parameter is an OR of the following indicators: //! \b MEMCFG_SECT_LS0 through \b MEMCFG_SECT_LSx. //! //! \note This API only applies to LSx RAM and has no effect if the CLA isn't //! master of the memory section. //! //! \sa MemCfg_setLSRAMMasterSel() //! //! \return None. // //***************************************************************************** static inline void MemCfg_setCLAMemType(uint32_t ramSections, MemCfg_CLAMemoryType claMemType) { // // Check the arguments. // do { if(!((ramSections & 0xFF000000U) == 0x01000000U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/memcfg.h", 352); } } while(0); // // Write the CLA memory configuration to the appropriate register. Either // set or clear the bit that determines the function of the RAM section as // it relates to the CLA. // __eallow(); if(claMemType == MEMCFG_CLA_MEM_PROGRAM) { // // Program memory // (*((volatile uint32_t *)((uintptr_t)(0x0005F400U + 0x26U)))) |= ramSections; } else { // // Data memory // (*((volatile uint32_t *)((uintptr_t)(0x0005F400U + 0x26U)))) &= ~ramSections; } __edis(); } //***************************************************************************** // //! Enables individual RAM access violation interrupt sources. //! //! \param intFlags is a bit mask of the interrupt sources to be enabled. //! Can be a logical OR any of the following values: //! - \b MEMCFG_NMVIOL_CPUREAD - Non-master CPU read access //! - \b MEMCFG_NMVIOL_CPUWRITE - Non-master CPU write access //! - \b MEMCFG_NMVIOL_CPUFETCH - Non-master CPU fetch access //! - \b MEMCFG_NMVIOL_DMAWRITE - Non-master DMA write access //! - \b MEMCFG_NMVIOL_CLA1READ - Non-master CLA1 read access //! - \b MEMCFG_NMVIOL_CLA1WRITE - Non-master CLA1 write access //! - \b MEMCFG_NMVIOL_CLA1FETCH - Non-master CLA1 fetch access //! - \b MEMCFG_NMVIOL_DMAREAD - Non Master DMA read access //! - \b MEMCFG_MVIOL_CPUFETCH - Master CPU fetch access //! - \b MEMCFG_MVIOL_CPUWRITE - Master CPU write access //! - \b MEMCFG_MVIOL_DMAWRITE - Master DMA write access //! This function enables the indicated RAM access violation interrupt sources. //! Only the sources that are enabled can be reflected to the processor //! interrupt; disabled sources have no effect on the processor. //! //! \return None. // //***************************************************************************** static inline void MemCfg_enableViolationInterrupt(uint32_t intFlags) { // // Enable the specified interrupts. // __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x0005F500U + 0x6U)))) |= intFlags & 0x0000FFFFU; (*((volatile uint32_t *)((uintptr_t)(0x0005F500U + 0x26U)))) |= (intFlags & 0x000F0000U) >> 16U; __edis(); } //***************************************************************************** // //! Disables individual RAM access violation interrupt sources. //! //! \param intFlags is a bit mask of the interrupt sources to be disabled. //! Can be a logical OR any of the following values: //! - \b MEMCFG_NMVIOL_CPUREAD //! - \b MEMCFG_NMVIOL_CPUWRITE //! - \b MEMCFG_NMVIOL_CPUFETCH //! - \b MEMCFG_NMVIOL_DMAWRITE //! - \b MEMCFG_NMVIOL_CLA1READ //! - \b MEMCFG_NMVIOL_CLA1WRITE //! - \b MEMCFG_NMVIOL_CLA1FETCH //! - \b MEMCFG_NMVIOL_DMAREAD //! - \b MEMCFG_MVIOL_CPUFETCH //! - \b MEMCFG_MVIOL_CPUWRITE //! - \b MEMCFG_MVIOL_DMAWRITE //! //! This function disables the indicated RAM access violation interrupt //! sources. Only the sources that are enabled can be reflected to the //! processor interrupt; disabled sources have no effect on the processor. //! //! \note Note that only non-master violations may generate interrupts. //! //! \return None. // //***************************************************************************** static inline void MemCfg_disableViolationInterrupt(uint32_t intFlags) { // // Disable the specified interrupts. // __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x0005F500U + 0x6U)))) &= ~(intFlags & 0x0000FFFFU); (*((volatile uint32_t *)((uintptr_t)(0x0005F500U + 0x26U)))) &= ~((intFlags & 0x000F0000U) >> 16U); __edis(); } //***************************************************************************** // //! Gets the current RAM access violation status. //! //! This function returns the RAM access violation status. This function will //! return flags for both master and non-master access violations although only //! the non-master flags have the ability to cause the generation of an //! interrupt. //! //! \return Returns the current violation status, enumerated as a bit field of //! the values: //! - \b MEMCFG_NMVIOL_CPUREAD - Non-master CPU read access //! - \b MEMCFG_NMVIOL_CPUWRITE - Non-master CPU write access //! - \b MEMCFG_NMVIOL_CPUFETCH - Non-master CPU fetch access //! - \b MEMCFG_NMVIOL_DMAWRITE - Non-master DMA write access //! - \b MEMCFG_NMVIOL_CLA1READ - Non-master CLA1 read access //! - \b MEMCFG_NMVIOL_CLA1WRITE - Non-master CLA1 write access //! - \b MEMCFG_NMVIOL_CLA1FETCH - Non-master CLA1 fetch access //! - \b MEMCFG_NMVIOL_DMAREAD - Non Master DMA read access //! - \b MEMCFG_MVIOL_CPUFETCH - Master CPU fetch access //! - \b MEMCFG_MVIOL_CPUWRITE - Master CPU write access //! - \b MEMCFG_MVIOL_DMAWRITE - Master DMA write access //***************************************************************************** static inline uint32_t MemCfg_getViolationInterruptStatus(void) { uint32_t status; // // Read and return RAM access status flags. // status = ((*((volatile uint32_t *)((uintptr_t)(0x0005F500U + 0x0U))))) | ((*((volatile uint32_t *)((uintptr_t)(0x0005F500U + 0x20U)))) << 16U); return(status); } //***************************************************************************** // //! Sets the RAM access violation status. //! //! \param intFlags is a bit mask of the access violation flags to be set. //! Can be a logical OR any of the following values: //! - \b MEMCFG_NMVIOL_CPUREAD //! - \b MEMCFG_NMVIOL_CPUWRITE //! - \b MEMCFG_NMVIOL_CPUFETCH //! - \b MEMCFG_NMVIOL_DMAWRITE //! - \b MEMCFG_NMVIOL_CLA1READ //! - \b MEMCFG_NMVIOL_CLA1WRITE //! - \b MEMCFG_NMVIOL_CLA1FETCH //! - \b MEMCFG_NMVIOL_DMAREAD //! - \b MEMCFG_MVIOL_CPUFETCH //! - \b MEMCFG_MVIOL_CPUWRITE //! - \b MEMCFG_MVIOL_DMAWRITE //! //! This function sets the RAM access violation status. This function will //! set flags for both master and non-master access violations, and an //! interrupt will be generated if it is enabled. //! //! \return None. // //***************************************************************************** static inline void MemCfg_forceViolationInterrupt(uint32_t intFlags) { // // Shift and mask the flags appropriately and write them to the // corresponding SET register. // __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x0005F500U + 0x2U)))) = intFlags & 0x0000FFFFU; (*((volatile uint32_t *)((uintptr_t)(0x0005F500U + 0x22U)))) = (intFlags & 0x000F0000U) >> 16U; __edis(); } //***************************************************************************** // //! Clears RAM access violation flags. //! //! \param intFlags is a bit mask of the access violation flags to be cleared. //! Can be a logical OR any of the following values: //! - \b MEMCFG_NMVIOL_CPUREAD //! - \b MEMCFG_NMVIOL_CPUWRITE //! - \b MEMCFG_NMVIOL_CPUFETCH //! - \b MEMCFG_NMVIOL_DMAWRITE //! - \b MEMCFG_NMVIOL_CLA1READ //! - \b MEMCFG_NMVIOL_CLA1WRITE //! - \b MEMCFG_NMVIOL_CLA1FETCH //! - \b MEMCFG_NMVIOL_DMAREAD //! - \b MEMCFG_MVIOL_CPUFETCH //! - \b MEMCFG_MVIOL_CPUWRITE //! - \b MEMCFG_MVIOL_DMAWRITE //! //! \return None. // //***************************************************************************** static inline void MemCfg_clearViolationInterruptStatus(uint32_t intFlags) { // // Clear the requested access violation flags. // __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x0005F500U + 0x4U)))) |= intFlags & 0x0000FFFFU; (*((volatile uint32_t *)((uintptr_t)(0x0005F500U + 0x24U)))) |= (intFlags & 0x000F0000U) >> 16U; __edis(); } //***************************************************************************** // //! Sets the correctable error threshold value. //! //! \param threshold is the correctable error threshold. //! //! This value sets the error-count threshold at which a correctable error //! interrupt is generated. That is when the error count register reaches the //! value specified by the \e threshold parameter, an interrupt is //! generated if it is enabled. //! //! \return None. // //***************************************************************************** static inline void MemCfg_setCorrErrorThreshold(uint32_t threshold) { // // Write the threshold value to the appropriate register. // __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x0005F540U + 0x30U)))) = threshold; __edis(); } //***************************************************************************** // //! Gets the correctable error count. //! //! \return Returns the number of correctable error have occurred. // //***************************************************************************** static inline uint32_t MemCfg_getCorrErrorCount(void) { // // Read and return the number of errors that have occurred. // return((*((volatile uint32_t *)((uintptr_t)(0x0005F540U + 0x2EU))))); } //***************************************************************************** // //! Enables individual RAM correctable error interrupt sources. //! //! \param intFlags is a bit mask of the interrupt sources to be enabled. Can //! take the value \b MEMCFG_CERR_CPUREAD only. Other values are reserved. //! //! This function enables the indicated RAM correctable error interrupt //! sources. Only the sources that are enabled can be reflected to the //! processor interrupt; disabled sources have no effect on the processor. //! //! \note Note that only correctable errors may generate interrupts. //! //! \return None. // //***************************************************************************** static inline void MemCfg_enableCorrErrorInterrupt(uint32_t intFlags) { // // Enable the specified interrupts. // __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x0005F540U + 0x38U)))) |= intFlags; __edis(); } //***************************************************************************** // //! Disables individual RAM correctable error interrupt sources. //! //! \param intFlags is a bit mask of the interrupt sources to be disabled. Can //! take the value \b MEMCFG_CERR_CPUREAD only. Other values are reserved. //! //! This function disables the indicated RAM correctable error interrupt //! sources. Only the sources that are enabled can be reflected to the //! processor interrupt; disabled sources have no effect on the processor. //! //! \note Note that only correctable errors may generate interrupts. //! //! \return None. // //***************************************************************************** static inline void MemCfg_disableCorrErrorInterrupt(uint32_t intFlags) { // // Disable the specified interrupts. // __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x0005F540U + 0x38U)))) &= ~(intFlags); __edis(); } //***************************************************************************** // //! Gets the current RAM correctable error interrupt status. //! //! \return Returns the current error interrupt status. Will return a value of //! \b MEMCFG_CERR_CPUREAD if an interrupt has been generated. If not, the //! function will return 0. // //***************************************************************************** static inline uint32_t MemCfg_getCorrErrorInterruptStatus(void) { // // Read and return correctable error interrupt flags. // return((*((volatile uint32_t *)((uintptr_t)(0x0005F540U + 0x32U))))); } //***************************************************************************** // //! Sets the RAM correctable error interrupt status. //! //! \param intFlags is a bit mask of the interrupt sources to be set. Can take //! the value \b MEMCFG_CERR_CPUREAD only. Other values are reserved. //! //! This function sets the correctable error interrupt flag. //! //! \note Note that only correctable errors may generate interrupts. //! //! \return None. // //***************************************************************************** static inline void MemCfg_forceCorrErrorInterrupt(uint32_t intFlags) { // // Write the flags to the appropriate SET register. // __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x0005F540U + 0x36U)))) = intFlags; __edis(); } //***************************************************************************** // //! Clears the RAM correctable error interrupt status. //! //! \param intFlags is a bit mask of the interrupt sources to be cleared. Can //! take the value \b MEMCFG_CERR_CPUREAD only. Other values are reserved. //! //! This function clears the correctable error interrupt flag. //! //! \note Note that only correctable errors may generate interrupts. //! //! \return None. // //***************************************************************************** static inline void MemCfg_clearCorrErrorInterruptStatus(uint32_t intFlags) { // // Clear the requested flags. // __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x0005F540U + 0x34U)))) |= intFlags; __edis(); } //***************************************************************************** // //! Gets the current correctable RAM error status. //! //! \return Returns the current error status, enumerated as a bit field of //! \b MEMCFG_CERR_CPUREAD, \b MEMCFG_CERR_DMAREAD, or \b MEMCFG_CERR_CLA1READ // //***************************************************************************** static inline uint32_t MemCfg_getCorrErrorStatus(void) { // // Read and return RAM error status flags. // return((*((volatile uint32_t *)((uintptr_t)(0x0005F540U + 0x20U))))); } //***************************************************************************** // //! Gets the current uncorrectable RAM error status. //! //! \return Returns the current error status, enumerated as a bit field of //! \b MEMCFG_UCERR_CPUREAD, \b MEMCFG_UCERR_DMAREAD, \b MEMCFG_UCERR_CLA1READ, //! or \b MEMCFG_UCERR_ECATMEMREAD. // //***************************************************************************** static inline uint32_t MemCfg_getUncorrErrorStatus(void) { // // Read and return RAM error status flags. // return((*((volatile uint32_t *)((uintptr_t)(0x0005F540U + 0x0U))))); } //***************************************************************************** // //! Sets the specified correctable RAM error status flag. //! //! \param stsFlags is a bit mask of the error sources. This parameter can be //! any of the following values: \b MEMCFG_CERR_CPUREAD, //! \b MEMCFG_CERR_DMAREAD, or \b MEMCFG_CERR_CLA1READ. //! //! This function sets the specified correctable RAM error status flag. //! //! \return None. // //***************************************************************************** static inline void MemCfg_forceCorrErrorStatus(uint32_t stsFlags) { // // Write the flags to the appropriate SET register. // __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x0005F540U + 0x22U)))) = stsFlags; __edis(); } //***************************************************************************** // //! Sets the specified uncorrectable RAM error status flag. //! //! \param stsFlags is a bit mask of the error sources. This parameter can be //! any of the following values: \b MEMCFG_UCERR_CPUREAD, //! \b MEMCFG_UCERR_DMAREAD, \b MEMCFG_UCERR_CLA1READ, or //! \b MEMCFG_UCERR_ECATMEMREAD. //! //! This function sets the specified uncorrectable RAM error status flag. //! //! \return None. // //***************************************************************************** static inline void MemCfg_forceUncorrErrorStatus(uint32_t stsFlags) { // // Write the flags to the appropriate SET register. // __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x0005F540U + 0x2U)))) = stsFlags; __edis(); } //***************************************************************************** // //! Clears correctable RAM error flags. //! //! \param stsFlags is a bit mask of the status flags to be cleared. //! This parameter can be any of the \b MEMCFG_CERR_CPUREAD, //! \b MEMCFG_CERR_DMAREAD, or \b MEMCFG_CERR_CLA1READ values. //! //! This function clears the specified correctable RAM error flags. //! //! \return None. // //***************************************************************************** static inline void MemCfg_clearCorrErrorStatus(uint32_t stsFlags) { // // Clear the requested flags. // __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x0005F540U + 0x24U)))) |= stsFlags; __edis(); } //***************************************************************************** // //! Clears uncorrectable RAM error flags. //! //! \param stsFlags is a bit mask of the status flags to be cleared. //! This parameter can be any of the \b MEMCFG_UCERR_CPUREAD, //! \b MEMCFG_UCERR_DMAREAD, \b MEMCFG_UCERR_CLA1READ, or //! \b MEMCFG_UCERR_ECATMEMREAD values. //! //! This function clears the specified uncorrectable RAM error flags. //! //! \return None. // //***************************************************************************** static inline void MemCfg_clearUncorrErrorStatus(uint32_t stsFlags) { // // Clear the requested flags. // __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x0005F540U + 0x4U)))) |= stsFlags; __edis(); } //***************************************************************************** // //! Gets the diagnostics corr/uncorr memory error status in test mode. //! //! \return Returns the diagnostics error status in test mode. It can return //! following values: \b MEMCFG_DIAGERR_UNCORR, and/or \b MEMCFG_DIAGERR_CORR. // //***************************************************************************** static inline uint32_t MemCfg_getDiagErrorStatus(void) { // // Returns diag error status. // return((*((volatile uint32_t *)((uintptr_t)(0x0005F590U + 0x0U))))); } //***************************************************************************** // //! Clears the diagnostics corr/uncorr memory error status. //! //! \param stsFlags is a bit mask of the status flags to be cleared. //! //! This function clears the specified diagnostics corr/uncorr RAM/ROM memory //! error flags in test mode. The param \e stsFlags can be any of the following //! values: \b MEMCFG_DIAGERR_UNCORR, and/or \b MEMCFG_DIAGERR_CORR. //! //! \return None. // //***************************************************************************** static inline void MemCfg_clearDiagErrorStatus(uint32_t stsFlags) { // // Clear diag error status. // (*((volatile uint32_t *)((uintptr_t)(0x0005F590U + 0x2U)))) |= stsFlags; } //***************************************************************************** // //! Gets address location of diagnostics corr/uncorr memory read/write error. //! //! \return Return address location of diagnostics corr/uncorr memory error //! error in test mode. // //***************************************************************************** static inline uint32_t MemCfg_getDiagErrorAddress(void) { // // Return diag error address. // return((*((volatile uint32_t *)((uintptr_t)(0x0005F590U + 0x4U))))); } //***************************************************************************** // //! Enables ROM wait state. //! //! This function enables the ROM wait state. This mean CPU accesses to ROM are //! 1-wait. //! //! \return None. // //***************************************************************************** static inline void MemCfg_enableROMWaitState(void) { // // Clear the disable bit. // __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x0005F580U + 0x0U)))) &= ~((uint32_t)0x1U); __edis(); } //***************************************************************************** // //! Disables ROM wait state. //! //! This function enables the ROM wait state. This mean CPU accesses to ROM are //! 0-wait. //! //! \return None. // //***************************************************************************** static inline void MemCfg_disableROMWaitState(void) { // // Set the disable bit. // __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x0005F580U + 0x0U)))) |= 0x1U; __edis(); } //***************************************************************************** // //! Enables ROM prefetch. //! //! This function enables the ROM prefetch for both secure ROM and boot ROM. //! //! \return None. // //***************************************************************************** static inline void MemCfg_enableROMPrefetch(void) { // // Set the enable bit. // __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x0005F588U + 0x0U)))) |= 0x1U; __edis(); } //***************************************************************************** // //! Disables ROM prefetch. //! //! This function enables the ROM prefetch for both secure ROM and boot ROM. //! //! \return None. // //***************************************************************************** static inline void MemCfg_disableROMPrefetch(void) { // // Clear the enable bit. // __eallow(); (*((volatile uint32_t *)((uintptr_t)(0x0005F588U + 0x0U)))) &= ~((uint32_t)0x1U); __edis(); } //***************************************************************************** // //! Locks the writes to the configuration of specified memory sections. //! //! \param memSections is the logical OR of the sections to be configured. //! //! This function locks writes to the access protection and master select //! configuration of a memory section.That means calling MemCfg_setProtection() //! or MemCfg_setLSRAMMasterSel() for a locked memory section will have no //! effect until MemCfg_unlockConfig() is called. //! //! The \e memSections parameter is an OR of one of the following sets of //! indicators: //! - \b MEMCFG_SECT_D0 and \b MEMCFG_SECT_D1 or \b MEMCFG_SECT_DX_ALL //! - \b MEMCFG_SECT_LS0 through \b MEMCFG_SECT_LSx or \b MEMCFG_SECT_LSX_ALL //! - \b MEMCFG_SECT_GS0 through \b MEMCFG_SECT_GSx or \b MEMCFG_SECT_GSX_ALL //! - \b MEMCFG_SECT_MSGCPUTOCPU0, \b MEMCFG_SECT_MSGCPUTOCLA1, //! \b MEMCFG_SECT_MSGCLA1TOCPU, \b MEMCFG_SECT_MSGCLA1TODMA, //! \b MEMCFG_SECT_MSGDMATOCLA1, \b MEMCFG_SECT_MSGCPUTOCPU1, //! \b MEMCFG_SECT_MSGCPUTOCM0, \b MEMCFG_SECT_MSGCPUTOCM1, or use //! \b MEMCFG_SECT_MSGX_ALL to configure all possible message RAM sections. //! - \b OR use \b MEMCFG_SECT_ALL to configure all possible sections. //! //! \return None. // //***************************************************************************** extern void MemCfg_lockConfig(uint32_t memSections); //***************************************************************************** // //! Unlocks the writes to the configuration of a memory section. //! //! \param memSections is the logical OR of the sections to be configured. //! //! This function unlocks writes to the access protection and master select //! configuration of a memory section that has been locked using //! MemCfg_lockConfig(). //! //! The \e memSections parameter is an OR of one of the following sets of //! indicators: //! - \b MEMCFG_SECT_D0 and \b MEMCFG_SECT_D1 or \b MEMCFG_SECT_DX_ALL //! - \b MEMCFG_SECT_LS0 through \b MEMCFG_SECT_LSx or \b MEMCFG_SECT_LSX_ALL //! - \b MEMCFG_SECT_GS0 through \b MEMCFG_SECT_GSx or \b MEMCFG_SECT_GSX_ALL //! - \b MEMCFG_SECT_MSGCPUTOCPU0, \b MEMCFG_SECT_MSGCPUTOCLA1, //! \b MEMCFG_SECT_MSGCLA1TOCPU, \b MEMCFG_SECT_MSGCLA1TODMA, //! \b MEMCFG_SECT_MSGDMATOCLA1, \b MEMCFG_SECT_MSGCPUTOCPU1, //! \b MEMCFG_SECT_MSGCPUTOCM0, \b MEMCFG_SECT_MSGCPUTOCM1, or use //! \b MEMCFG_SECT_MSGX_ALL to configure all possible message RAM sections. //! - \b OR use \b MEMCFG_SECT_ALL to configure all possible sections. //! //! \return None. // //***************************************************************************** extern void MemCfg_unlockConfig(uint32_t memSections); //***************************************************************************** // //! Permanently locks writes to the configuration of a memory section. //! //! \param memSections is the logical OR of the sections to be configured. //! //! This function permanently locks writes to the access protection and master //! select configuration of a memory section. That means calling //! MemCfg_setProtection() or MemCfg_setLSRAMMasterSel() for a locked memory //! section will have no effect. To lock the configuration in a nonpermanent //! way, use MemCfg_lockConfig(). //! //! The \e memSections parameter is an OR of one of the following sets of //! indicators: //! - \b MEMCFG_SECT_D0 and \b MEMCFG_SECT_D1 or \b MEMCFG_SECT_DX_ALL //! - \b MEMCFG_SECT_LS0 through \b MEMCFG_SECT_LSx or \b MEMCFG_SECT_LSX_ALL //! - \b MEMCFG_SECT_GS0 through \b MEMCFG_SECT_GSx or \b MEMCFG_SECT_GSX_ALL //! - \b MEMCFG_SECT_MSGCPUTOCPU0, \b MEMCFG_SECT_MSGCPUTOCPU1, //! \b MEMCFG_SECT_MSGCPUTOCLA1, \b MEMCFG_SECT_MSGCLA1TOCPU, //! \b MEMCFG_SECT_MSGCLA1TODMA, \b MEMCFG_SECT_MSGDMATOCLA1, //! \b MEMCFG_SECT_MSGCPUTOCM0, \b MEMCFG_SECT_MSGCPUTOCM1, or use //! \b MEMCFG_SECT_MSGX_ALL to configure all possible message RAM sections. //! - \b OR use \b MEMCFG_SECT_ALL to configure all possible sections. //! //! \return None. // //***************************************************************************** extern void MemCfg_commitConfig(uint32_t memSections); //***************************************************************************** // //! Sets the access protection mode of a single memory section. //! //! \param memSection is the memory section to be configured. //! \param protectMode is the logical OR of the settings to be applied. //! //! This function sets the access protection mode of a specified memory section. //! The mode is passed into the \e protectMode parameter as the logical OR of //! the following values: //! - \b MEMCFG_PROT_ALLOWCPUWRITE or \b MEMCFG_PROT_BLOCKCPUWRITE - CPU write //! - \b MEMCFG_PROT_ALLOWDMAWRITE or \b MEMCFG_PROT_BLOCKDMAWRITE - DMA write //! //! The \e memSection parameter is one of the following indicators: //! - \b MEMCFG_SECT_M0 or \b MEMCFG_SECT_M1 //! - \b MEMCFG_SECT_D0 or \b MEMCFG_SECT_D1 //! - \b MEMCFG_SECT_LS0 through \b MEMCFG_SECT_LSx //! - \b MEMCFG_SECT_GS0 through \b MEMCFG_SECT_GSx //! - \b MEMCFG_SECT_MSGCPUTOCPU0 or \b MEMCFG_SECT_MSGCPUTOCPU1 or //! \b MEMCFG_SECT_MSGCPUTOCM0 or \b MEMCFG_SECT_MSGCPUTOCM1 //! //! This function will have no effect if the associated registers have been //! locked by MemCfg_lockConfig() or MemCfg_commitConfig() or if the memory //! is configured as CLA program memory. //! //! \return None. // //***************************************************************************** extern void MemCfg_setProtection(uint32_t memSection, uint32_t protectMode); //***************************************************************************** // //! Sets the master of the specified LSxRAM section. //! //! \param ramSection is the LSxRAM section to be configured. //! \param masterSel is the sharing selection. //! //! This function sets the master select configuration of the LSxRAM section.If //! the \e masterSel parameter is \b MEMCFG_LSRAMMASTER_CPU_ONLY, the LSxRAM //! section passed into the \e ramSection parameter will be dedicated to the //! CPU. If \b MEMCFG_LSRAMMASTER_CPU_CLA1, the memory section will be shared //! between the CPU and the CLA. //! //! The \e ramSection parameter should be a value from \b MEMCFG_SECT_LS0 //! through \b MEMCFG_SECT_LSx. //! //! This function will have no effect if the associated registers have been //! locked by MemCfg_lockConfig() or MemCfg_commitConfig(). //! //! \note This API only applies to LSxRAM. //! //! \return None. // //***************************************************************************** extern void MemCfg_setLSRAMMasterSel(uint32_t ramSection, MemCfg_LSRAMMasterSel masterSel); //***************************************************************************** // //! Sets the master of the specified GSxRAM section. //! //! \param ramSections is the logical OR of the sections to be configured. //! \param masterSel is the sharing selection. //! //! This function sets the master select configuration of the GSxRAM section.If //! the \e masterSel parameter is \b MEMCFG_GSRAMMASTER_CPU1, the GSRAM //! sections passed into the \e ramSections parameter will be dedicated to //! CPU1. If \b MEMCFG_GSRAMMASTER_CPU2, the memory section will be dedicated //! to CPU2. //! //! The \e ramSections parameter should be a logical OR of values from //! \b MEMCFG_SECT_GS0 through \b MEMCFG_SECT_GSx. //! //! This function will have no effect if the associated registers have been //! locked by MemCfg_lockConfig() or MemCfg_commitConfig(). //! //! \note This API only applies to GSxRAM. //! //! \return None. // //***************************************************************************** extern void MemCfg_setGSRAMMasterSel(uint32_t ramSections, MemCfg_GSRAMMasterSel masterSel); //***************************************************************************** // //! Locks the writes to the test mode configuration of specified memory //! sections. //! //! \param memSections is the logical OR of the sections to be configured. //! //! This function locks writes to the test mode configuration of a RAM section. //! That means calling MemCfg_setTestMode() for a locked RAM section will have //! no effect until MemCfg_unlockTestConfig() is called. //! //! The \e memSections parameter is an OR of one of the following sets of //! indicators: //! - \b MEMCFG_SECT_M0, \b MEMCFG_SECT_M1, \b MEMCFG_SECT_D0, //! \b MEMCFG_SECT_D1 or \b MEMCFG_SECT_DX_ALL //! - \b MEMCFG_SECT_LS0 through \b MEMCFG_SECT_LSx or use //! \b MEMCFG_SECT_LSX_ALL to configure all possible LSRAM sections. //! - \b MEMCFG_SECT_GS0 through \b MEMCFG_SECT_GSx or use //! \b MEMCFG_SECT_GSX_ALL to configure all possible GSRAM sections. //! - \b MEMCFG_SECT_MSGCPUTOCPU0, \b MEMCFG_SECT_MSGCPUTOCPU1, //! \b MEMCFG_SECT_MSGCPUTOCLA1, \b MEMCFG_SECT_MSGCLA1TOCPU, //! \b MEMCFG_SECT_MSGCLA1TODMA, \b MEMCFG_SECT_MSGDMATOCLA1, //! \b MEMCFG_SECT_MSGCPUTOCM0, \b MEMCFG_SECT_MSGCPUTOCM1, or use //! \b MEMCFG_SECT_MSGX_ALL to configure all possible message RAM sections. //! - \b MEMCFG_SECT_ROMBOOT, \b MEMCFG_SECT_ROMSECURE, //! \b MEMCFG_SECT_ROMCLADATA or \b MEMCFG_SECT_ROM_ALL to configure all //! possible ROM sections. //! - \b MEMCFG_SECT_PERIMEM_ETHERCAT or MEMCFG_SECT_PERIMEM_ALL to configure //! all possible peripheral memories. //! - \b OR use \b MEMCFG_SECT_ALL to configure all possible sections. //! //! \return None. // //***************************************************************************** extern void MemCfg_lockTestConfig(uint32_t memSections); //***************************************************************************** // //! Unlocks the writes to the test mode configuration of specified memory //! sections. //! //! \param memSections is the logical OR of the sections to be configured. //! //! This function unlocks writes to the test mode configuration of a RAM //! section that has been locked using MemCfg_lockTestConfig(). //! //! The \e memSections parameter is an OR of one of the following sets of //! indicators: //! - \b MEMCFG_SECT_M0, \b MEMCFG_SECT_M1, \b MEMCFG_SECT_D0, //! \b MEMCFG_SECT_D1 or \b MEMCFG_SECT_DX_ALL //! - \b MEMCFG_SECT_LS0 through \b MEMCFG_SECT_LSx or use //! \b MEMCFG_SECT_LSX_ALL to configure all possible LSRAM sections. //! - \b MEMCFG_SECT_GS0 through \b MEMCFG_SECT_GSx or use //! \b MEMCFG_SECT_GSX_ALL to configure all possible GSRAM sections. //! - \b MEMCFG_SECT_MSGCPUTOCPU0, \b MEMCFG_SECT_MSGCPUTOCPU1, //! \b MEMCFG_SECT_MSGCPUTOCLA1, \b MEMCFG_SECT_MSGCLA1TOCPU, //! \b MEMCFG_SECT_MSGCLA1TODMA, \b MEMCFG_SECT_MSGDMATOCLA1, //! \b MEMCFG_SECT_MSGCPUTOCM0, \b MEMCFG_SECT_MSGCPUTOCM1, or use //! \b MEMCFG_SECT_MSGX_ALL to configure all possible message RAM sections. //! - \b MEMCFG_SECT_ROMBOOT, \b MEMCFG_SECT_ROMSECURE, //! \b MEMCFG_SECT_ROMCLADATA or \b MEMCFG_SECT_ROM_ALL to configure all //! possible ROM sections. //! \b MEMCFG_SECT_PERIMEM_ETHERCAT or MEMCFG_SECT_PERIMEM_ALL to configure //! all possible peripheral memories. //! - \b OR use \b MEMCFG_SECT_ALL to configure all possible sections. //! //! \return None. // //***************************************************************************** extern void MemCfg_unlockTestConfig(uint32_t memSections); //***************************************************************************** // //! Sets the test mode of the specified memory section. //! //! \param memSection is the memory section to be configured. //! \param testMode is the test mode selected. //! //! This function sets the test mode configuration of the RAM section. The //! \e testMode parameter can take one of the following values: //! - \b MEMCFG_TEST_FUNCTIONAL //! - \b MEMCFG_TEST_WRITE_DATA //! - \b MEMCFG_TEST_WRITE_ECC (DxRAM) or MEMCFG_TEST_WRITE_PARITY (LSx, GSx, //! or MSGxRAM) //! - \b MEMCFG_TEST_FUNC_DIAG //! //! The \e memSection parameter is one of the following indicators: //! - \b MEMCFG_SECT_M0 or \b MEMCFG_SECT_M1 //! - \b MEMCFG_SECT_D0 or \b MEMCFG_SECT_D1 //! - \b MEMCFG_SECT_LS0 through \b MEMCFG_SECT_LSx //! - \b MEMCFG_SECT_GS0 through \b MEMCFG_SECT_GSx //! - \b MEMCFG_SECT_MSGCPUTOCPU0, \b MEMCFG_SECT_MSGCPUTOCPU1, //! \b MEMCFG_SECT_MSGCPUTOCLA1, \b MEMCFG_SECT_MSGCLA1TOCPU, //! \b MEMCFG_SECT_MSGCLA1TODMA, \b MEMCFG_SECT_MSGDMATOCLA1, //! \b MEMCFG_SECT_MSGCPUTOCM0, \b MEMCFG_SECT_MSGCPUTOCM1, //! - \b MEMCFG_SECT_ROMBOOT, \b MEMCFG_SECT_ROMSECURE, or //! \b MEMCFG_SECT_ROMCLADATA //! //! \return None. // //***************************************************************************** extern void MemCfg_setTestMode(uint32_t memSection, MemCfg_TestMode testMode); //***************************************************************************** // //! Starts the initialization the specified RAM sections. //! //! \param ramSections is the logical OR of the sections to be initialized. //! //! This function starts the initialization of the specified RAM sections. Use //! MemCfg_getInitStatus() to check if the initialization is done. //! //! The \e ramSections parameter is an OR of one of the following sets of //! indicators: //! - \b MEMCFG_SECT_D0 and \b MEMCFG_SECT_D1 or \b MEMCFG_SECT_DX_ALL //! - \b MEMCFG_SECT_LS0 through \b MEMCFG_SECT_LSx or \b MEMCFG_SECT_LSX_ALL //! - \b MEMCFG_SECT_GS0 through \b MEMCFG_SECT_GSx or \b MEMCFG_SECT_GSX_ALL //! - \b MEMCFG_SECT_MSGCPUTOCPU0, \b MEMCFG_SECT_MSGCPUTOCPU1, //! \b MEMCFG_SECT_MSGCPUTOCLA1, \b MEMCFG_SECT_MSGCLA1TOCPU, //! \b MEMCFG_SECT_MSGCLA1TODMA, \b MEMCFG_SECT_MSGDMATOCLA1, //! \b MEMCFG_SECT_MSGCPUTOCM0, or \b MEMCFG_SECT_MSGCPUTOCM1, //! - \b OR use \b MEMCFG_SECT_ALL to configure all possible sections. //! //! \return None. // //***************************************************************************** extern void MemCfg_initSections(uint32_t ramSections); //***************************************************************************** // //! Get the status of initialized RAM sections. //! //! \param ramSections is the logical OR of the sections to be checked. //! //! This function gets the initialization status of the RAM sections specified //! by the \e ramSections parameter. //! //! The \e ramSections parameter is an OR of one of the following sets of //! indicators: //! - \b MEMCFG_SECT_M0, \b MEMCFG_SECT_M1, \b MEMCFG_SECT_D0, and //! \b MEMCFG_SECT_D1 or \b MEMCFG_SECT_DX_ALL //! - \b MEMCFG_SECT_LS0 through \b MEMCFG_SECT_LSx or \b MEMCFG_SECT_LSX_ALL //! - \b MEMCFG_SECT_GS0 through \b MEMCFG_SECT_GSx or \b MEMCFG_SECT_GSX_ALL //! - \b MEMCFG_SECT_MSGCPUTOCPU0, \b MEMCFG_SECT_MSGCPUTOCPU1, //! \b MEMCFG_SECT_MSGCPUTOCLA1, \b MEMCFG_SECT_MSGCLA1TOCPU, //! \b MEMCFG_SECT_MSGCLA1TODMA, \b MEMCFG_SECT_MSGDMATOCLA1, //! \b MEMCFG_SECT_MSGCPUTOCM0, or \b MEMCFG_SECT_MSGCPUTOCM1, //! - \b OR use \b MEMCFG_SECT_ALL to get status of all possible sections. //! //! \note Use MemCfg_initSections() to start the initialization. //! //! \return Returns \b true if all the sections specified by \e ramSections //! have been initialized and \b false if not. // //***************************************************************************** extern _Bool MemCfg_getInitStatus(uint32_t ramSections); //***************************************************************************** // //! Get the violation address associated with a intFlag. //! //! \param intFlag is the type of access violation as indicated by ONE of //! these values: //! - \b MEMCFG_NMVIOL_CPUREAD //! - \b MEMCFG_NMVIOL_CPUWRITE //! - \b MEMCFG_NMVIOL_CPUFETCH //! - \b MEMCFG_NMVIOL_DMAWRITE //! - \b MEMCFG_NMVIOL_CLA1READ //! - \b MEMCFG_NMVIOL_CLA1WRITE //! - \b MEMCFG_NMVIOL_CLA1FETCH //! - \b MEMCFG_NMVIOL_DMAREAD //! - \b MEMCFG_MVIOL_CPUFETCH //! - \b MEMCFG_MVIOL_CPUWRITE //! - \b MEMCFG_MVIOL_DMAWRITE //! //! \return Returns the violation address associated with the \e intFlag. // //***************************************************************************** extern uint32_t MemCfg_getViolationAddress(uint32_t intFlag); //***************************************************************************** // //! Get the correctable error address associated with a stsFlag. //! //! \param stsFlag is the type of error to which the returned address will //! correspond. It can take following values: \b MEMCFG_CERR_CPUREAD, or //! \b MEMCFG_CERR_CLA1READ. //! //! \return Returns the error address associated with the stsFlag. // //***************************************************************************** extern uint32_t MemCfg_getCorrErrorAddress(uint32_t stsFlag); //***************************************************************************** // //! Get the uncorrectable error address associated with a stsFlag. //! //! \param stsFlag is the type of error to which the returned address will //! correspond. It may be passed one of these values: \b MEMCFG_UCERR_CPUREAD, //! \b MEMCFG_UCERR_DMAREAD, \b MEMCFG_UCERR_CLA1READ, or //! \b MEMCFG_UCERR_ECATMEMREAD values. //! //! \return Returns the error address associated with the stsFlag. // //***************************************************************************** extern uint32_t MemCfg_getUncorrErrorAddress(uint32_t stsFlag); //***************************************************************************** // //! Forces parity error in the selected memory. //! //! \param memSections is the logical OR of the sections to be tested. //! //! This function forces the parity error in the memories specified //! by the \e memSections parameter. //! //! The \e memSections parameter is an OR of one of the following sets of //! indicators: //! - \b MEMCFG_SECT_ROMBOOT, \b MEMCFG_SECT_ROMSECURE , //! \b MEMCFG_SECT_ROMCLADATA, or \b MEMCFG_SECT_ROM_ALL. //! - \b MEMCFG_SECT_PERIMEM_ETHERCAT, or \b MEMCFG_SECT_PERIMEM_ALL //! - \b OR use \b MEMCFG_SECT_ALL to force parity error in all possible //! memory sections. //! //! \return None. // //***************************************************************************** extern void MemCfg_forceMemError(uint32_t memSections); //***************************************************************************** // //! Enables test mode for selected peripheral memories. //! //! \param memSections is the logical OR of the type of peripheral memories //! to be tested. //! //! This function enables test mode for selected peripheral memories specified //! by the \e memTypes parameter. //! //! The \e memTypes parameter is an OR of one of the following sets of //! indicators: //! - \b MEMCFG_SECT_PERIMEM_ETHERCAT, or \b MEMCFG_SECT_PERIMEM_ALL //! //! \return None. // //***************************************************************************** extern void MemCfg_enablePeriMemTestMode(uint32_t memSections); //***************************************************************************** // //! Disables the test mode for selected peripheral memories. //! //! \param memSections is the logical OR of the type of peripheral memories //! to be tested. //! //! This function disables test mode for selected peripheral memories specified //! by the \e memSections parameter. //! //! The \e memTypes parameter is an OR of one of the following sets of //! indicators: //! - \b MEMCFG_SECT_PERIMEM_ETHERCAT, or \b MEMCFG_SECT_PERIMEM_ALL //! //! \return None. // //***************************************************************************** extern void MemCfg_disablePeriMemTestMode(uint32_t memSections); //***************************************************************************** // // Close the Doxygen group. //! @} // //***************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //########################################################################### // // FILE: pin_map.h // // TITLE: Definitions of pin mux info for gpio.c. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // 0x00000003 = MUX register value // 0x0000000C = GMUX register value // 0x0000FF00 = Shift amount within mux registers // 0xFFFF0000 = Offset of MUX register //***************************************************************************** //########################################################################### // // FILE: sci.h // // TITLE: C28x SCI driver. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup sci_api SCI //! @{ // //***************************************************************************** //########################################################################### // // FILE: hw_sci.h // // TITLE: Definitions for the SCI registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the SCI register offsets // //***************************************************************************** // register // register //***************************************************************************** // // The following are defines for the bit fields in the SCICCR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SCICTL1 register // //***************************************************************************** // enable //***************************************************************************** // // The following are defines for the bit fields in the SCIHBAUD register // //***************************************************************************** // Registers SCIHBAUD //***************************************************************************** // // The following are defines for the bit fields in the SCILBAUD register // //***************************************************************************** // Registers SCILBAUD //***************************************************************************** // // The following are defines for the bit fields in the SCICTL2 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SCIRXST register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SCIRXEMU register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SCIRXBUF register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SCITXBUF register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SCIFFTX register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SCIFFRX register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SCIFFCT register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SCIPRI register // //***************************************************************************** //***************************************************************************** // // Values that can be passed to SCI_enableInterrupt, SCI_disableInterrupt, and // SCI_clearInterruptStatus as the intFlags parameter, and returned from // SCI_getInterruptStatus. // //***************************************************************************** //***************************************************************************** // // Values that can be passed to SCI_setConfig as the config parameter // and returned by SCI_getConfig in the config parameter. // Additionally, the SCI_CONFIG_PAR_* enum subset can be passed to // SCI_setParityMode as the parity parameter, and are returned by // SCI_getParityMode. // //***************************************************************************** //***************************************************************************** // //! Values that can be used with SCI_setParityMode() and SCI_getParityMode() to //! describe the parity of the SCI communication. // //***************************************************************************** typedef enum { SCI_CONFIG_PAR_NONE = 0x0000U, //!< No parity SCI_CONFIG_PAR_EVEN = 0x0060U, //!< Even parity SCI_CONFIG_PAR_ODD = 0x0020U //!< Odd parity } SCI_ParityType; //***************************************************************************** // //! Values that can be passed to SCI_setFIFOInterruptLevel() as the txLevel //! parameter and returned by SCI_getFIFOInteruptLevel() and //! SCI_getTxFIFOStatus(). // //***************************************************************************** typedef enum { SCI_FIFO_TX0 = 0x0000U, //!< Transmit interrupt empty SCI_FIFO_TX1 = 0x0001U, //!< Transmit interrupt 1/16 full SCI_FIFO_TX2 = 0x0002U, //!< Transmit interrupt 2/16 full SCI_FIFO_TX3 = 0x0003U, //!< Transmit interrupt 3/16 full SCI_FIFO_TX4 = 0x0004U, //!< Transmit interrupt 4/16 full SCI_FIFO_TX5 = 0x0005U, //!< Transmit interrupt 5/16 full SCI_FIFO_TX6 = 0x0006U, //!< Transmit interrupt 6/16 full SCI_FIFO_TX7 = 0x0007U, //!< Transmit interrupt 7/16 full SCI_FIFO_TX8 = 0x0008U, //!< Transmit interrupt 8/16 full SCI_FIFO_TX9 = 0x0009U, //!< Transmit interrupt 9/16 full SCI_FIFO_TX10 = 0x000AU, //!< Transmit interrupt 10/16 full SCI_FIFO_TX11 = 0x000BU, //!< Transmit interrupt 11/16 full SCI_FIFO_TX12 = 0x000CU, //!< Transmit interrupt 12/16 full SCI_FIFO_TX13 = 0x000DU, //!< Transmit interrupt 13/16 full SCI_FIFO_TX14 = 0x000EU, //!< Transmit interrupt 14/16 full SCI_FIFO_TX15 = 0x000FU, //!< Transmit interrupt 15/16 full SCI_FIFO_TX16 = 0x0010U //!< Transmit interrupt full } SCI_TxFIFOLevel; //***************************************************************************** // //! Values that can be passed to SCI_setFIFOInterruptLevel() as the rxLevel //! parameter and returned by SCI_getFIFOInterruptLevel() and //! SCI_getRxFIFOStatus(). // //***************************************************************************** typedef enum { SCI_FIFO_RX0 = 0x0000U, //!< Receive interrupt empty SCI_FIFO_RX1 = 0x0001U, //!< Receive interrupt 1/16 full SCI_FIFO_RX2 = 0x0002U, //!< Receive interrupt 2/16 full SCI_FIFO_RX3 = 0x0003U, //!< Receive interrupt 3/16 full SCI_FIFO_RX4 = 0x0004U, //!< Receive interrupt 4/16 full SCI_FIFO_RX5 = 0x0005U, //!< Receive interrupt 5/16 full SCI_FIFO_RX6 = 0x0006U, //!< Receive interrupt 6/16 full SCI_FIFO_RX7 = 0x0007U, //!< Receive interrupt 7/16 full SCI_FIFO_RX8 = 0x0008U, //!< Receive interrupt 8/16 full SCI_FIFO_RX9 = 0x0009U, //!< Receive interrupt 9/16 full SCI_FIFO_RX10 = 0x000AU, //!< Receive interrupt 10/16 full SCI_FIFO_RX11 = 0x000BU, //!< Receive interrupt 11/16 full SCI_FIFO_RX12 = 0x000CU, //!< Receive interrupt 12/16 full SCI_FIFO_RX13 = 0x000DU, //!< Receive interrupt 13/16 full SCI_FIFO_RX14 = 0x000EU, //!< Receive interrupt 14/16 full SCI_FIFO_RX15 = 0x000FU, //!< Receive interrupt 15/16 full SCI_FIFO_RX16 = 0x0010U //!< Receive interrupt full } SCI_RxFIFOLevel; //***************************************************************************** // // Values returned from SCI_getRxStatus(). These correspond to the different // bits and flags of the SCIRXST register. // //***************************************************************************** //***************************************************************************** // // API Function prototypes // //***************************************************************************** //***************************************************************************** // //! \internal //! Checks a SCI base address. //! //! \param base is the base address of the SCI port. //! //! This function determines if a SCI port base address is valid. //! //! \return Returns \b true if the base address is valid and \b false //! otherwise. // //***************************************************************************** static inline _Bool SCI_isBaseValid(uint32_t base) { return((base == 0x00007200U) || (base == 0x00007210U) || (base == 0x00007220U) || (base == 0x00007230U)); } //***************************************************************************** // //! Sets the type of parity. //! //! \param base is the base address of the SCI port. //! \param parity specifies the type of parity to use. //! //! Sets the type of parity to use for transmitting and expect when receiving. //! The \e parity parameter must be one of the following: //! \b SCI_CONFIG_PAR_NONE, \b SCI_CONFIG_PAR_EVEN, \b SCI_CONFIG_PAR_ODD. //! //! \return None. // //***************************************************************************** static inline void SCI_setParityMode(uint32_t base, SCI_ParityType parity) { // // Check the arguments. // do { if(!(SCI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sci.h", 240); } } while(0); // // Set the parity mode. // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) = (((*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) & ~(0x0060U)) | (uint16_t)parity); } //***************************************************************************** // //! Gets the type of parity currently being used. //! //! \param base is the base address of the SCI port. //! //! This function gets the type of parity used for transmitting data and //! expected when receiving data. //! //! \return Returns the current parity settings, specified as one of the //! following: //! \b SCI_CONFIG_PAR_NONE, \b SCI_CONFIG_PAR_EVEN, \b SCI_CONFIG_PAR_ODD. // //***************************************************************************** static inline SCI_ParityType SCI_getParityMode(uint32_t base) { uint16_t parity; // // Check the arguments. // do { if(!(SCI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sci.h", 271); } } while(0); // // Return the current parity setting. // parity = ((*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) & (0x0060U)); return((SCI_ParityType)parity); } //***************************************************************************** // //! Locks Autobaud. //! //! \param base is the base address of the SCI port. //! //! This function performs an autobaud lock for the SCI. //! //! \return None. // //***************************************************************************** static inline void SCI_lockAutobaud(uint32_t base) { // // Check the arguments. // do { if(!(SCI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sci.h", 298); } } while(0); // // Prime the baud register // (*((volatile uint16_t *)((uintptr_t)(base + 0x2U)))) = 0x0U; (*((volatile uint16_t *)((uintptr_t)(base + 0x3U)))) = 0x1U; // // Prepare for autobaud detection. // Set the CDC bit to enable autobaud detection and clear the ABD bit. // (*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) |= 0x2000U; (*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) |= 0x4000U; // // Wait until we correctly read an 'A' or 'a' and lock // while(((*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) & 0x8000U) != 0x8000U) { } // // After autobaud lock, clear the ABD and CDC bits // (*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) |= 0x4000U; (*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) &= ~0x2000U; } //***************************************************************************** // //! Sets the FIFO interrupt level at which interrupts are generated. //! //! \param base is the base address of the SCI port. //! \param txLevel is the transmit FIFO interrupt level, specified as one of //! the following: //! \b SCI_FIFO_TX0, \b SCI_FIFO_TX1, \b SCI_FIFO_TX2, . . . or //! \b SCI_FIFO_TX15. //! \param rxLevel is the receive FIFO interrupt level, specified as one of //! the following //! \b SCI_FIFO_RX0, \b SCI_FIFO_RX1, \b SCI_FIFO_RX2, ... or \b SCI_FIFO_RX15. //! //! This function sets the FIFO level at which transmit and receive interrupts //! are generated. //! //! \return None. // //***************************************************************************** static inline void SCI_setFIFOInterruptLevel(uint32_t base, SCI_TxFIFOLevel txLevel, SCI_RxFIFOLevel rxLevel) { // // Check the arguments. // do { if(!(SCI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sci.h", 353); } } while(0); // // Set the FIFO interrupt levels. // (*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) & (~0x1FU)) | (uint16_t)txLevel; (*((volatile uint16_t *)((uintptr_t)(base + 0xBU)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0xBU)))) & (~0x1FU)) | (uint16_t)rxLevel; } //***************************************************************************** // //! Gets the FIFO interrupt level at which interrupts are generated. //! //! \param base is the base address of the SCI port. //! \param txLevel is a pointer to storage for the transmit FIFO interrupt //! level, returned as one of the following: //! \b SCI_FIFO_TX0, \b SCI_FIFO_TX1, \b SCI_FIFO_TX2, ... or \b SCI_FIFO_TX15. //! \param rxLevel is a pointer to storage for the receive FIFO interrupt //! level, returned as one of the following: //! \b SCI_FIFO_RX0, \b SCI_FIFO_RX1, \b SCI_FIFO_RX2, ... or \b SCI_FIFO_RX15. //! //! This function gets the FIFO level at which transmit and receive interrupts //! are generated. //! //! \return None. // //***************************************************************************** static inline void SCI_getFIFOInterruptLevel(uint32_t base, SCI_TxFIFOLevel *txLevel, SCI_RxFIFOLevel *rxLevel) { // // Check the arguments. // do { if(!(SCI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sci.h", 390); } } while(0); // // Extract the transmit and receive FIFO levels. // *txLevel = (SCI_TxFIFOLevel)((*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) & 0x1FU); *rxLevel = (SCI_RxFIFOLevel)((*((volatile uint16_t *)((uintptr_t)(base + 0xBU)))) & 0x1FU); } //***************************************************************************** // //! Gets the current configuration of a SCI. //! //! \param base is the base address of the SCI port. //! \param lspclkHz is the rate of the clock supplied to the SCI module. This //! is the LSPCLK. //! \param baud is a pointer to storage for the baud rate. //! \param config is a pointer to storage for the data format. //! //! The baud rate and data format for the SCI is determined, given an //! explicitly provided peripheral clock (hence the ExpClk suffix). The //! returned baud rate is the actual baud rate; it may not be the exact baud //! rate requested or an ``official'' baud rate. The data format returned in //! \e config is enumerated the same as the \e config parameter of //! SCI_setConfig(). //! //! The peripheral clock is the low speed peripheral clock. This will be //! the value returned by SysCtl_getLowSeedClock(), or it can be explicitly //! hard coded if it is constant and known (to save the code/execution overhead //! of a call to SysCtl_getLowSpeedClock()). //! //! \return None. // //***************************************************************************** static inline void SCI_getConfig(uint32_t base, uint32_t lspclkHz, uint32_t *baud, uint32_t *config) { // // Check the arguments. // do { if(!(SCI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sci.h", 433); } } while(0); // // Compute the baud rate. // *baud = lspclkHz / ((1U + (uint32_t)((uint32_t)((*((volatile uint16_t *)((uintptr_t)(base + 0x2U)))) << 8U) | (*((volatile uint16_t *)((uintptr_t)(base + 0x3U)))))) * 8U); // // Get the parity, data length, and number of stop bits. // *config = (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) & (0x0060U | 0x0080U | 0x0007U); } //***************************************************************************** // //! Enables transmitting and receiving. //! //! \param base is the base address of the SCI port. //! //! Enables SCI by taking SCI out of the software reset. Sets the TXENA, and //! RXENA bits which enables transmit and receive. //! //! \return None. // //***************************************************************************** static inline void SCI_enableModule(uint32_t base) { // // Check the arguments. // do { if(!(SCI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sci.h", 468); } } while(0); // // Enable RX, TX, and the SCI. // (*((volatile uint16_t *)((uintptr_t)(base + 0x1U)))) |= (0x2U | 0x1U | 0x20U); } //***************************************************************************** // //! Disables transmitting and receiving. //! //! \param base is the base address of the SCI port. //! //! Clears the SCIEN, TXE, and RXE bits. The user should ensure that all the //! data has been sent before disable the module during transmission. //! //! \return None. // //***************************************************************************** static inline void SCI_disableModule(uint32_t base) { // // Check the arguments. // do { if(!(SCI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sci.h", 495); } } while(0); // // Disable the FIFO. // (*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) &= ~(0x4000U); // // Disable the SCI. // (*((volatile uint16_t *)((uintptr_t)(base + 0x1U)))) &= ~(0x2U | 0x1U); } //***************************************************************************** // //! Enables the transmit and receive FIFOs. //! //! \param base is the base address of the SCI port. //! //! This functions enables the transmit and receive FIFOs in the SCI. //! //! \return None. // //***************************************************************************** static inline void SCI_enableFIFO(uint32_t base) { // // Check the arguments. // do { if(!(SCI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sci.h", 525); } } while(0); // // Enable the FIFO. // (*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) |= 0x8000U; (*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) |= 0x4000U | 0x2000U; (*((volatile uint16_t *)((uintptr_t)(base + 0xBU)))) |= 0x2000U; } //***************************************************************************** // //! Disables the transmit and receive FIFOs. //! //! \param base is the base address of the SCI port. //! //! This functions disables the transmit and receive FIFOs in the SCI. //! //! \return None. // //***************************************************************************** static inline void SCI_disableFIFO(uint32_t base) { // // Check the arguments. // do { if(!(SCI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sci.h", 552); } } while(0); // // Disable the FIFO. // (*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) &= ~0x4000U; } //***************************************************************************** // //! Determines if the FIFO enhancement is enabled. //! //! \param base is the base address of the SCI port. //! //! This function returns a flag indicating whether or not the FIFO enhancement //! is enabled. //! //! \return Returns \b true if the FIFO enhancement is enabled or \b false //! if the FIFO enhancement is disabled. // //***************************************************************************** static inline _Bool SCI_isFIFOEnabled(uint32_t base) { // // Check the arguments. // do { if(!(SCI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sci.h", 579); } } while(0); // // Return true if the FIFO is enabled and false if it is disabled. // return((((*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) & 0x4000U) == 0x4000U) ? 1 : 0); } //***************************************************************************** // //! Resets the receive FIFO. //! //! \param base is the base address of the SCI port. //! //! This functions resets the receive FIFO of the SCI. //! //! \return None. // //***************************************************************************** static inline void SCI_resetRxFIFO(uint32_t base) { // // Check the arguments. // do { if(!(SCI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sci.h", 605); } } while(0); // // Reset the specified FIFO. // (*((volatile uint16_t *)((uintptr_t)(base + 0xBU)))) &= ~0x2000U; (*((volatile uint16_t *)((uintptr_t)(base + 0xBU)))) |= 0x2000U; } //***************************************************************************** // //! Resets the transmit FIFO. //! //! \param base is the base address of the SCI port. //! //! This functions resets the transmit FIFO of the SCI. //! //! \return None. // //***************************************************************************** static inline void SCI_resetTxFIFO(uint32_t base) { // // Check the arguments. // do { if(!(SCI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sci.h", 631); } } while(0); // // Reset the specified FIFO. // (*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) &= ~0x2000U; (*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) |= 0x2000U; } //***************************************************************************** // //! Resets the SCI Transmit and Receive Channels //! //! \param base is the base address of the SCI port. //! //! This functions resets transmit and receive channels in the SCI. //! //! \return None. // //***************************************************************************** static inline void SCI_resetChannels(uint32_t base) { // // Check the arguments. // do { if(!(SCI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sci.h", 657); } } while(0); // // Reset the Tx and Rx Channels // (*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) |= 0x8000U; } //***************************************************************************** // //! Determines if there are any characters in the receive buffer when the //! FIFO enhancement is not enabled. //! //! \param base is the base address of the SCI port. //! //! This function returns a flag indicating whether or not there is data //! available in the receive buffer. //! //! \return Returns \b true if there is data in the receive buffer or \b false //! if there is no data in the receive buffer. // //***************************************************************************** static inline _Bool SCI_isDataAvailableNonFIFO(uint32_t base) { // // Check the arguments. // do { if(!(SCI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sci.h", 685); } } while(0); // // Return the availability of characters with FIFO disabled. // return((((*((volatile uint16_t *)((uintptr_t)(base + 0x5U)))) & 0x40U) == 0x40U) ? 1 : 0); } //***************************************************************************** // //! Determines if there is any space in the transmit buffer when the FIFO //! enhancement is not enabled. //! //! \param base is the base address of the SCI port. //! //! This function returns a flag indicating whether or not there is space //! available in the transmit buffer when not using the FIFO enhancement. //! //! \return Returns \b true if there is space available in the transmit buffer //! or \b false if there is no space available in the transmit buffer. // //***************************************************************************** static inline _Bool SCI_isSpaceAvailableNonFIFO(uint32_t base) { // // Check the arguments. // do { if(!(SCI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sci.h", 714); } } while(0); // // Return the availability of space. // return((((*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) & 0x80U) == 0x80U) ? 1 : 0); } //***************************************************************************** // //! Get the transmit FIFO status //! //! \param base is the base address of the SCI port. //! //! This functions gets the current number of words in the transmit FIFO. //! //! \return Returns the current number of words in the transmit FIFO specified //! as one of the following: //! \b SCI_FIFO_TX0, \b SCI_FIFO_TX1, \b SCI_FIFO_TX2, \b SCI_FIFO_TX3 //! \b SCI_FIFO_TX4, ..., or \b SCI_FIFO_TX16 // //***************************************************************************** static inline SCI_TxFIFOLevel SCI_getTxFIFOStatus(uint32_t base) { // // Check the arguments. // do { if(!(SCI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sci.h", 743); } } while(0); // // Get the current FIFO status // return((SCI_TxFIFOLevel)(((*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) & 0x1F00U) >> 8U)); } //***************************************************************************** // //! Get the receive FIFO status //! //! \param base is the base address of the SCI port. //! //! This functions gets the current number of words in the receive FIFO. //! //! \return Returns the current number of words in the receive FIFO specified //! as one of the following: //! \b SCI_FIFO_RX0, \b SCI_FIFO_RX1, \b SCI_FIFO_RX2, \b SCI_FIFO_RX3 //! \b SCI_FIFO_RX4, ..., or \b SCI_FIFO_RX16 // //***************************************************************************** static inline SCI_RxFIFOLevel SCI_getRxFIFOStatus(uint32_t base) { // // Check the arguments. // do { if(!(SCI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sci.h", 772); } } while(0); // // Get the current FIFO status // return((SCI_RxFIFOLevel)(((*((volatile uint16_t *)((uintptr_t)(base + 0xBU)))) & 0x1F00U) >> 8U)); } //***************************************************************************** // //! Determines whether the SCI transmitter is busy or not. //! //! \param base is the base address of the SCI port. //! //! Allows the caller to determine whether all transmitted bytes have cleared //! the transmitter hardware when the FIFO is not enabled. When the FIFO is //! enabled, this function allows the caller to determine whether there is any //! data in the FIFO. //! //! Without the FIFO enabled, if \b false is returned, the transmit buffer and //! shift registers are empty and the transmitter is not busy. With the FIFO //! enabled, if \b false is returned, the FIFO is empty. This does not //! necessarily mean that the transmitter is not busy. The empty FIFO does not //! reflect the status of the transmitter shift register. The FIFO may be empty //! while the transmitter is still transmitting data. //! //! \return Returns \b true if the SCI is transmitting or \b false if //! transmissions are complete. // //***************************************************************************** static inline _Bool SCI_isTransmitterBusy(uint32_t base) { // // Check the argument. // do { if(!(SCI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sci.h", 809); } } while(0); // // Check if FIFO enhancement is enabled. // if(SCI_isFIFOEnabled(base)) { // // With FIFO enhancement, determine if the SCI is busy. // return((((*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) & 0x1F00U) == 0x1F00U) ? 1 : 0); } else { // // Without FIFO enhancement, determine if the SCI is busy. // Check if the transmit buffer and shift register empty. // return((((*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) & 0x40U) == 0x40U) ? 0 : 1); } } //***************************************************************************** // //! Waits to send a character from the specified port when the FIFO enhancement //! is enabled. //! //! \param base is the base address of the SCI port. //! \param data is the character to be transmitted. //! //! Sends the character \e data to the transmit buffer for the specified port. //! If there is no space available in the transmit FIFO, this function waits //! until there is space available before returning. \e data is a uint16_t but //! only 8 bits are written to the SCI port. SCI only transmits 8 bit //! characters. //! //! \return None. // //***************************************************************************** static inline void SCI_writeCharBlockingFIFO(uint32_t base, uint16_t data) { // // Check the arguments. // do { if(!(SCI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sci.h", 856); } } while(0); // // Wait until space is available in the transmit FIFO. // while(SCI_getTxFIFOStatus(base) == SCI_FIFO_TX15) { } // // Send a char. // (*((volatile uint16_t *)((uintptr_t)(base + 0x9U)))) = data; } //***************************************************************************** // //! Waits to send a character from the specified port. //! //! \param base is the base address of the SCI port. //! \param data is the character to be transmitted. //! //! Sends the character \e data to the transmit buffer for the specified port. //! If there is no space available in the transmit buffer, or the transmit //! FIFO if it is enabled, this function waits until there is space available //! before returning. \e data is a uint16_t but only 8 bits are written to the //! SCI port. SCI only transmits 8 bit characters. //! //! \return None. // //***************************************************************************** static inline void SCI_writeCharBlockingNonFIFO(uint32_t base, uint16_t data) { // // Check the arguments. // do { if(!(SCI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sci.h", 893); } } while(0); // // Wait until space is available in the transmit buffer. // while(!SCI_isSpaceAvailableNonFIFO(base)) { } // // Send a char. // (*((volatile uint16_t *)((uintptr_t)(base + 0x9U)))) = data; } //***************************************************************************** // //! Sends a character to the specified port. //! //! \param base is the base address of the SCI port. //! \param data is the character to be transmitted. //! //! Writes the character \e data to the transmit buffer for the specified port. //! This function does not block and only writes to the transmit buffer. //! The user should use SCI_isSpaceAvailableNonFIFO() or SCI_getTxFIFOStatus() //! to determine if the transmit buffer or FIFO have space available. //! \e data is a uint16_t but only 8 bits are written to the SCI port. SCI //! only transmits 8 bit characters. //! //! This function replaces the original SCICharNonBlockingPut() API and //! performs the same actions. A macro is provided in sci.h to map //! the original API to this API. //! //! \return None. // //***************************************************************************** static inline void SCI_writeCharNonBlocking(uint32_t base, uint16_t data) { // // Check the arguments. // do { if(!(SCI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sci.h", 935); } } while(0); // // Send a char. // (*((volatile uint16_t *)((uintptr_t)(base + 0x9U)))) = data; } //***************************************************************************** // //! Waits for a character from the specified port when the FIFO enhancement //! is enabled. //! //! \param base is the base address of the SCI port. //! //! Gets a character from the receive FIFO for the specified port. If there //! are no characters available, this function waits until a character is //! received before returning. //! //! \return Returns the character read from the specified port as \e uint16_t. // //***************************************************************************** static inline uint16_t SCI_readCharBlockingFIFO(uint32_t base) { // // Check the arguments. // do { if(!(SCI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sci.h", 963); } } while(0); // // Wait until a character is available in the receive FIFO. // while(SCI_getRxFIFOStatus(base) == SCI_FIFO_RX0) { } // // Return the character from the receive buffer. // return(uint16_t)((*((volatile uint16_t *)((uintptr_t)(base + 0x7U)))) & 0xFFU); } //***************************************************************************** // //! Waits for a character from the specified port when the FIFO enhancement //! is not enabled. //! //! \param base is the base address of the SCI port. //! //! Gets a character from the receive buffer for the specified port. If there //! is no characters available, this function waits until a character is //! received before returning. //! //! \return Returns the character read from the specified port as \e uint16_t. // //***************************************************************************** static inline uint16_t SCI_readCharBlockingNonFIFO(uint32_t base) { // // Check the arguments. // do { if(!(SCI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sci.h", 998); } } while(0); // // Wait until a character is available in the receive FIFO. // while(!SCI_isDataAvailableNonFIFO(base)) { } // // Return the character from the receive buffer. // return(uint16_t)((*((volatile uint16_t *)((uintptr_t)(base + 0x7U)))) & 0xFFU); } //***************************************************************************** // //! Receives a character from the specified port. //! //! \param base is the base address of the SCI port. //! //! Gets a character from the receive buffer for the specified port. This //! function does not block and only reads the receive buffer. The user should //! use SCI_isDataAvailableNonFIFO() or SCI_getRxFIFOStatus() to determine if //! the receive buffer or FIFO have data available. //! //! This function replaces the original SCICharNonBlockingGet() API and //! performs the same actions. A macro is provided in sci.h to map //! the original API to this API. //! //! \return Returns \e uin16_t which is read from the receive buffer. // //***************************************************************************** static inline uint16_t SCI_readCharNonBlocking(uint32_t base) { // // Check the arguments. // do { if(!(SCI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sci.h", 1037); } } while(0); // // Return the character from the receive buffer. // return(uint16_t)((*((volatile uint16_t *)((uintptr_t)(base + 0x7U)))) & 0xFFU); } //***************************************************************************** // //! Gets current receiver status flags. //! //! \param base is the base address of the SCI port. //! //! This function returns the current receiver status flags. The returned //! error flags are equivalent to the error bits returned via the previous //! reading or receiving of a character with the exception that the overrun //! error is set immediately the overrun occurs rather than when a character //! is next read. //! //! \return Returns a bitwise OR combination of the receiver status flags, //! \b SCI_RXSTATUS_WAKE, \b SCI_RXSTATUS_PARITY, \b SCI_RXSTATUS_OVERRUN, //! \b SCI_RXSTATUS_FRAMING, \b SCI_RXSTATUS_BREAK, \b SCI_RXSTATUS_READY, //! and \b SCI_RXSTATUS_ERROR. // //***************************************************************************** static inline uint16_t SCI_getRxStatus(uint32_t base) { // // Check the arguments. // do { if(!(SCI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sci.h", 1069); } } while(0); // // Return the current value of the receive status register. // return((*((volatile uint16_t *)((uintptr_t)(base + 0x5U))))); } //***************************************************************************** // //! Performs a software reset of the SCI and Clears all reported receiver //! status flags. //! //! \param base is the base address of the SCI port. //! //! This function performs a software reset of the SCI port. It affects the //! operating flags of the SCI, but it neither affects the configuration bits //! nor restores the reset values. //! //! \return None. // //***************************************************************************** static inline void SCI_performSoftwareReset(uint32_t base) { // // Check the arguments. // do { if(!(SCI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sci.h", 1097); } } while(0); // // To clear all errors a sw reset of the module is required // (*((volatile uint16_t *)((uintptr_t)(base + 0x1U)))) &= ~0x20U; (*((volatile uint16_t *)((uintptr_t)(base + 0x1U)))) |= 0x20U; } //***************************************************************************** // //! Enables Loop Back Test Mode //! //! \param base is the base address of the SCI port. //! //! Enables the loop back test mode where the Tx pin is internally connected //! to the Rx pin. //! //! \return None. // //***************************************************************************** static inline void SCI_enableLoopback(uint32_t base) { // // Check the arguments. // do { if(!(SCI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sci.h", 1124); } } while(0); // // Set the loop back mode. // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) |= 0x10U; } //***************************************************************************** // //! Disables Loop Back Test Mode //! //! \param base is the base address of the SCI port. //! //! Disables the loop back test mode where the Tx pin is no longer internally //! connected to the Rx pin. //! //! \return None. // //***************************************************************************** static inline void SCI_disableLoopback(uint32_t base) { // // Check the arguments. // do { if(!(SCI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sci.h", 1150); } } while(0); // // Clear the loop back mode. // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) &= ~0x10U; } //***************************************************************************** // //! Get the receive FIFO Overflow flag status //! //! \param base is the base address of the SCI port. //! //! This functions gets the receive FIFO overflow flag status. //! //! \return Returns \b true if overflow has occurred, else returned \b false if //! an overflow hasn't occurred. // //***************************************************************************** static inline _Bool SCI_getOverflowStatus(uint32_t base) { // // Check the arguments. // do { if(!(SCI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sci.h", 1176); } } while(0); // // Return the current FIFO overflow status // return(((*((volatile uint16_t *)((uintptr_t)(base + 0xBU)))) & 0x8000U) == 0x8000U); } //***************************************************************************** // //! Clear the receive FIFO Overflow flag status //! //! \param base is the base address of the SCI port. //! //! This functions clears the receive FIFO overflow flag status. //! //! \return None. // //***************************************************************************** static inline void SCI_clearOverflowStatus(uint32_t base) { // // Check the arguments. // do { if(!(SCI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sci.h", 1201); } } while(0); // // Clear the current FIFO overflow status // (*((volatile uint16_t *)((uintptr_t)(base + 0xBU)))) |= 0x4000U; } //***************************************************************************** // //! Sets the configuration of a SCI. //! //! \param base is the base address of the SCI port. //! \param lspclkHz is the rate of the clock supplied to the SCI module. This //! is the LSPCLK. //! \param baud is the desired baud rate. //! \param config is the data format for the port (number of data bits, //! number of stop bits, and parity). //! //! This function configures the SCI for operation in the specified data //! format. The baud rate is provided in the \e baud parameter and the data //! format in the \e config parameter. //! //! The \e config parameter is the bitwise OR of three values: the number of //! data bits, the number of stop bits, and the parity. \b SCI_CONFIG_WLEN_8, //! \b SCI_CONFIG_WLEN_7, \b SCI_CONFIG_WLEN_6, \b SCI_CONFIG_WLEN_5, //! \b SCI_CONFIG_WLEN_4, \b SCI_CONFIG_WLEN_3, \b SCI_CONFIG_WLEN_2, and //! \b SCI_CONFIG_WLEN_1. Select from eight to one data bits per byte //! (respectively). //! \b SCI_CONFIG_STOP_ONE and \b SCI_CONFIG_STOP_TWO select one or two stop //! bits (respectively). \b SCI_CONFIG_PAR_NONE, \b SCI_CONFIG_PAR_EVEN, //! \b SCI_CONFIG_PAR_ODD, select the parity mode (no parity bit, even parity //! bit, odd parity bit respectively). //! //! The peripheral clock is the low speed peripheral clock. This will be //! the value returned by SysCtl_getLowSpeedClock(), or it can be explicitly //! hard coded if it is constant and known (to save the code/execution overhead //! of a call to SysCtl_getLowSpeedClock()). //! //! \return None. // //***************************************************************************** extern void SCI_setConfig(uint32_t base, uint32_t lspclkHz, uint32_t baud, uint32_t config); //***************************************************************************** // //! Waits to send an array of characters from the specified port. //! //! \param base is the base address of the SCI port. //! \param array is the address of the array of characters to be transmitted. //! It is pointer to the array of characters to be transmitted. //! \param length is the length of the array, or number of characters in the //! array to be transmitted. //! //! Sends the number of characters specified by \e length, starting at the //! address \e array, out of the transmit buffer for the specified port. //! If there is no space available in the transmit buffer, or the transmit //! FIFO if it is enabled, this function waits until there is space available //! and \e length number of characters are transmitted before returning. //! \e array is a pointer to uint16_ts but only the least significant 8 bits //! are written to the SCI port. SCI only transmits 8 bit characters. //! //! \return None. // //***************************************************************************** extern void SCI_writeCharArray(uint32_t base, const uint16_t * const array, uint16_t length); //***************************************************************************** // //! Waits to receive an array of characters from the specified port. //! //! \param base is the base address of the SCI port. //! \param array is the address of the array of characters to be received. //! It is a pointer to the array of characters to be received. //! \param length is the length of the array, or number of characters in the //! array to be received. //! //! Receives an array of characters from the receive buffer for the specified //! port, and stores them as an array of characters starting at address //! \e array. This function waits until the \e length number of characters are //! received before returning. //! //! \return None. // //***************************************************************************** extern void SCI_readCharArray(uint32_t base, uint16_t * const array, uint16_t length); //***************************************************************************** // //! Enables individual SCI interrupt sources. //! //! \param base is the base address of the SCI port. //! \param intFlags is the bit mask of the interrupt sources to be enabled. //! //! Enables the indicated SCI interrupt sources. Only the sources that are //! enabled can be reflected to the processor interrupt; disabled sources have //! no effect on the processor. //! //! The \e intFlags parameter is the bitwise OR of any of the following: //! //! - \b SCI_INT_RXERR - RXERR Interrupt //! - \b SCI_INT_RXRDY_BRKDT - RXRDY/BRKDT Interrupt //! - \b SCI_INT_TXRDY - TXRDY Interrupt //! - \b SCI_INT_TXFF - TX FIFO Level Interrupt //! - \b SCI_INT_RXFF - RX FIFO Level Interrupt //! - \b SCI_INT_FE - Frame Error //! - \b SCI_INT_OE - Overrun Error //! - \b SCI_INT_PE - Parity Error //! //! \return None. // //***************************************************************************** extern void SCI_enableInterrupt(uint32_t base, uint32_t intFlags); //***************************************************************************** // //! Disables individual SCI interrupt sources. //! //! \param base is the base address of the SCI port. //! \param intFlags is the bit mask of the interrupt sources to be disabled. //! //! Disables the indicated SCI interrupt sources. Only the sources that are //! enabled can be reflected to the processor interrupt; disabled sources have //! no effect on the processor. //! //! The \e intFlags parameter has the same definition as the \e intFlags //! parameter to SCI_enableInterrupt(). //! //! \return None. // //***************************************************************************** extern void SCI_disableInterrupt(uint32_t base, uint32_t intFlags); //***************************************************************************** // //! Gets the current interrupt status. //! //! \param base is the base address of the SCI port. //! //! \return Returns the current interrupt status, enumerated as a bit field of //! values described in SCI_enableInterrupt(). // //***************************************************************************** extern uint32_t SCI_getInterruptStatus(uint32_t base); //***************************************************************************** // //! Clears SCI interrupt sources. //! //! \param base is the base address of the SCI port. //! \param intFlags is a bit mask of the interrupt sources to be cleared. //! //! The specified SCI interrupt sources are cleared, so that they no longer //! assert. This function must be called in the interrupt handler to keep the //! interrupt from being recognized again immediately upon exit. //! //! The \e intFlags parameter has the same definition as the \e intFlags //! parameter to SCI_enableInterrupt(). //! //! \return None. // //***************************************************************************** extern void SCI_clearInterruptStatus(uint32_t base, uint32_t intFlags); //***************************************************************************** // // Close the Doxygen group. //! @} // //***************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //########################################################################### // // FILE: sdfm.h // // TITLE: C28x SDFM Driver // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup sdfm_api SDFM //! @{ // //***************************************************************************** //########################################################################### // // FILE: hw_sdfm.h // // TITLE: Definitions for the SDFM registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the SDFM register offsets // //***************************************************************************** // Register // for Ch1 // Register for Ch1 // Ch1 // for Ch1 // for Ch1 // Register for Ch1 // or 32bit) for Ch1 // for Ch1 // Register (16b) for Ch1 // for CH1 // Register for Ch1 // Ch1 // for CH1 // for Ch2 // Register for Ch2 // Ch2 // for Ch2 // for Ch2 // Register for Ch2 // or 32bit) for Ch2 // for Ch2 // Register (16b) for Ch2 // for CH2 // Register for Ch2 // Ch2 // for CH2 // for Ch3 // Register for Ch3 // Ch3 // for Ch3 // for Ch3 // Register for Ch3 // or 32bit) for Ch3 // for Ch3 // Register (16b) for Ch3 // for CH3 // Register for Ch3 // Ch3 // for CH3 // for Ch4 // Register for Ch4 // Ch4 // for Ch4 // for Ch4 // Register for Ch4 // or 32bit) for Ch4 // for Ch4 // Register (16b) for Ch4 // for CH4 // Register for Ch4 // Ch4 // for CH4 // Control Register // Control Register // Clock Control Register // Control Register // Clock Control Register // Lock Register // Control Register // Control Register // Clock Control Register // Control Register // Clock Control Register // Lock Register // Control Register // Control Register // Clock Control Register // Control Register // Clock Control Register // Lock Register // Control Register // Control Register // Clock Control Register // Control Register // Clock Control Register // Lock Register //***************************************************************************** // // The following are defines for the bit fields in the SDIFLG register // //***************************************************************************** // Ch1 // Ch1 // Ch2 // Ch2 // Ch3 // Ch3 // Ch4 // Ch4 // 1 // 2 // 3 // 4 //***************************************************************************** // // The following are defines for the bit fields in the SDIFLGCLR register // //***************************************************************************** // Ch1 // Ch1 // Ch2 // Ch2 // Ch3 // Ch3 // Ch4 // Ch4 // 1 // 2 // 3 // 4 // bit for Ch1 // bit for Ch2 // bit for Ch3 // bit for Ch4 //***************************************************************************** // // The following are defines for the bit fields in the SDCTL register // //***************************************************************************** // (Z) flag Ch1 // (Z) flag Ch2 // (Z) flag Ch3 // (Z) flag Ch4 // enable //***************************************************************************** // // The following are defines for the bit fields in the SDMFILEN register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SDSTATUS register // //***************************************************************************** // (Z) flag Ch1 // (Z) flag Ch2 // (Z) flag Ch3 // (Z) flag Ch4 // phase complete for filter module // 1. // phase complete for filter module // 2. // phase complete for filter module // 3. // phase complete for filter module // 4. // filter module 1. // filter module 2. // filter module 3. // filter module 4. //***************************************************************************** // // The following are defines for the bit fields in the SDCTLPARM1 register // //***************************************************************************** // clock // data //***************************************************************************** // // The following are defines for the bit fields in the SDDFPARM1 register // //***************************************************************************** // DOSR+1 // (SincFast/1/2/3) //***************************************************************************** // // The following are defines for the bit fields in the SDDPARM1 register // //***************************************************************************** // 16/32b 2's complement) // shift in 16b mode) //***************************************************************************** // // The following are defines for the bit fields in the SDFLT1CMPH1 register // //***************************************************************************** // comparator filter output //***************************************************************************** // // The following are defines for the bit fields in the SDFLT1CMPL1 register // //***************************************************************************** // comparator filter output //***************************************************************************** // // The following are defines for the bit fields in the SDCPARM1 register // //***************************************************************************** // Actual rate COSR+1 // (SincFast/1/2/3) // enable // crossing output enable //***************************************************************************** // // The following are defines for the bit fields in the SDDATA1 register // //***************************************************************************** // 16-bit Data in 16b mode //***************************************************************************** // // The following are defines for the bit fields in the SDDATFIFO1 register // //***************************************************************************** // 16-bit Data in 16b mode //***************************************************************************** // // The following are defines for the bit fields in the SDFLT1CMPH2 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SDFLT1CMPHZ register // //***************************************************************************** // the comparator filter output //***************************************************************************** // // The following are defines for the bit fields in the SDFIFOCTL1 register // //***************************************************************************** // Enable // Select // enable //***************************************************************************** // // The following are defines for the bit fields in the SDSYNC1 register // //***************************************************************************** // Enable //***************************************************************************** // // The following are defines for the bit fields in the SDFLT1CMPL2 register // //***************************************************************************** // for the comparator filter // output. //***************************************************************************** // // The following are defines for the bit fields in the SDCTLPARM2 register // //***************************************************************************** // clock // data //***************************************************************************** // // The following are defines for the bit fields in the SDDFPARM2 register // //***************************************************************************** // DOSR+1 // (SincFast/1/2/3) //***************************************************************************** // // The following are defines for the bit fields in the SDDPARM2 register // //***************************************************************************** // 16/32b 2's complement) // shift in 16b mode) //***************************************************************************** // // The following are defines for the bit fields in the SDFLT2CMPH1 register // //***************************************************************************** // comparator filter output //***************************************************************************** // // The following are defines for the bit fields in the SDFLT2CMPL1 register // //***************************************************************************** // comparator filter output //***************************************************************************** // // The following are defines for the bit fields in the SDCPARM2 register // //***************************************************************************** // Actual rate COSR+1 // (SincFast/1/2/3) // enable // crossing output enable //***************************************************************************** // // The following are defines for the bit fields in the SDDATA2 register // //***************************************************************************** // 16-bit Data in 16b mode //***************************************************************************** // // The following are defines for the bit fields in the SDDATFIFO2 register // //***************************************************************************** // 16-bit Data in 16b mode //***************************************************************************** // // The following are defines for the bit fields in the SDFLT2CMPH2 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SDFLT2CMPHZ register // //***************************************************************************** // the comparator filter output //***************************************************************************** // // The following are defines for the bit fields in the SDFIFOCTL2 register // //***************************************************************************** // Enable // Select // enable //***************************************************************************** // // The following are defines for the bit fields in the SDSYNC2 register // //***************************************************************************** // Enable //***************************************************************************** // // The following are defines for the bit fields in the SDFLT2CMPL2 register // //***************************************************************************** // for the comparator filter // output. //***************************************************************************** // // The following are defines for the bit fields in the SDCTLPARM3 register // //***************************************************************************** // clock // data //***************************************************************************** // // The following are defines for the bit fields in the SDDFPARM3 register // //***************************************************************************** // DOSR+1 // (SincFast/1/2/3) //***************************************************************************** // // The following are defines for the bit fields in the SDDPARM3 register // //***************************************************************************** // 16/32b 2's complement) // shift in 16b mode) //***************************************************************************** // // The following are defines for the bit fields in the SDFLT3CMPH1 register // //***************************************************************************** // comparator filter output //***************************************************************************** // // The following are defines for the bit fields in the SDFLT3CMPL1 register // //***************************************************************************** // comparator filter output //***************************************************************************** // // The following are defines for the bit fields in the SDCPARM3 register // //***************************************************************************** // Actual rate COSR+1 // (SincFast/1/2/3) // enable // crossing output enable //***************************************************************************** // // The following are defines for the bit fields in the SDDATA3 register // //***************************************************************************** // 16-bit Data in 16b mode //***************************************************************************** // // The following are defines for the bit fields in the SDDATFIFO3 register // //***************************************************************************** // 16-bit Data in 16b mode //***************************************************************************** // // The following are defines for the bit fields in the SDFLT3CMPH2 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SDFLT3CMPHZ register // //***************************************************************************** // the comparator filter output //***************************************************************************** // // The following are defines for the bit fields in the SDFIFOCTL3 register // //***************************************************************************** // Enable // Select // enable //***************************************************************************** // // The following are defines for the bit fields in the SDSYNC3 register // //***************************************************************************** // Enable //***************************************************************************** // // The following are defines for the bit fields in the SDFLT3CMPL2 register // //***************************************************************************** // for the comparator filter // output. //***************************************************************************** // // The following are defines for the bit fields in the SDCTLPARM4 register // //***************************************************************************** // clock // data //***************************************************************************** // // The following are defines for the bit fields in the SDDFPARM4 register // //***************************************************************************** // DOSR+1 // (SincFast/1/2/3) //***************************************************************************** // // The following are defines for the bit fields in the SDDPARM4 register // //***************************************************************************** // 16/32b 2's complement) // shift in 16b mode) //***************************************************************************** // // The following are defines for the bit fields in the SDFLT4CMPH1 register // //***************************************************************************** // comparator filter output //***************************************************************************** // // The following are defines for the bit fields in the SDFLT4CMPL1 register // //***************************************************************************** // comparator filter output //***************************************************************************** // // The following are defines for the bit fields in the SDCPARM4 register // //***************************************************************************** // Actual rate COSR+1 // (SincFast/1/2/3) // enable // crossing output enable //***************************************************************************** // // The following are defines for the bit fields in the SDDATA4 register // //***************************************************************************** // 16-bit Data in 16b mode //***************************************************************************** // // The following are defines for the bit fields in the SDDATFIFO4 register // //***************************************************************************** // 16-bit Data in 16b mode //***************************************************************************** // // The following are defines for the bit fields in the SDFLT4CMPH2 register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SDFLT4CMPHZ register // //***************************************************************************** // the comparator filter output //***************************************************************************** // // The following are defines for the bit fields in the SDFIFOCTL4 register // //***************************************************************************** // Enable // Select // enable //***************************************************************************** // // The following are defines for the bit fields in the SDSYNC4 register // //***************************************************************************** // Enable //***************************************************************************** // // The following are defines for the bit fields in the SDFLT4CMPL2 register // //***************************************************************************** // for the comparator filter // output. //***************************************************************************** // // The following are defines for the bit fields in the SDCOMP1CTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SDCOMP1EVT2FLTCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SDCOMP1EVT2FLTCLKCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SDCOMP1EVT1FLTCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SDCOMP1EVT1FLTCLKCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SDCOMP1LOCK register // //***************************************************************************** // Lock //***************************************************************************** // // The following are defines for the bit fields in the SDCOMP2CTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SDCOMP2EVT2FLTCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SDCOMP2EVT2FLTCLKCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SDCOMP2EVT1FLTCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SDCOMP2EVT1FLTCLKCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SDCOMP2LOCK register // //***************************************************************************** // Lock //***************************************************************************** // // The following are defines for the bit fields in the SDCOMP3CTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SDCOMP3EVT2FLTCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SDCOMP3EVT2FLTCLKCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SDCOMP3EVT1FLTCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SDCOMP3EVT1FLTCLKCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SDCOMP3LOCK register // //***************************************************************************** // Lock //***************************************************************************** // // The following are defines for the bit fields in the SDCOMP4CTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SDCOMP4EVT2FLTCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SDCOMP4EVT2FLTCLKCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SDCOMP4EVT1FLTCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SDCOMP4EVT1FLTCLKCTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SDCOMP4LOCK register // //***************************************************************************** // Lock //***************************************************************************** // // Defines for the API. // //***************************************************************************** //! Macro to get the low threshold //! //! Macro to get the high threshold //! //! Macro to get the high threshold 1 & 2 to be passed as lowThreshold //! parameter to SDFM_setCompFilterLowThreshold(). //! //! Macro to get the high threshold 1 & 2 to be passed as highThreshold //! parameter to SDFM_setCompFilterHighThreshold(). //! //! Macro to convert comparator over sampling ratio to acceptable bit location //! //! Macro to convert the data shift bit values to acceptable bit location //! //! Macro to combine high threshold and low threshold values //! //! Macro to set the FIFO level to acceptable bit location //! //! Macro to set and enable the zero cross threshold value. //! //! Macros to enable or disable filter. //! //***************************************************************************** // // Defines for SDFM register offsets. Added for internal use. Not to be used by // application. // //***************************************************************************** //!< SD filter offset //!< Event Digital filter offset //!< Offset between high threshold 1 & 2 registers //!< Offset between low threshold 1 & 2 registers //***************************************************************************** // // Define to mask out the bits in the SDCOMPHFILCTL register that aren't // associated with comparator event filter configurations. Added for internal // use, not to be used in application code. // //***************************************************************************** //***************************************************************************** // // Define to mask out the bits in the SDCOMPLOCK register that aren't // associated with lock configuration. Added for internal use, not to be used // in application code. // //***************************************************************************** //***************************************************************************** // // Values that can be passed to SDFM_enableSynchronizer() or // SDFM_disableSynchronizer() as syncConfig parameter. // //***************************************************************************** //! Define for Clock synchronizer Configuration //! Define for Data Synchronizer Configuration //***************************************************************************** // //! Values that can be returned from SDFM_getManchesterDecoderFailedStatus() // //***************************************************************************** typedef enum { SDFM_MANCHESTER_DECODER_SUCCESS = 0, //!< Manchester Decoder is working SDFM_MANCHESTER_DECODER_FAIL = 1 //!< Manchester Decoder has failed } SDFM_ManchesterDecoderStatus; //***************************************************************************** // //! Values that can be returned from SDFM_getThresholdStatus() // //***************************************************************************** typedef enum { SDFM_OUTPUT_WITHIN_THRESHOLD = 0, //!< SDFM output is within threshold SDFM_OUTPUT_ABOVE_THRESHOLD = 1, //!< SDFM output is above threshold SDFM_OUTPUT_BELOW_THRESHOLD = 2 //!< SDFM output is below threshold } SDFM_OutputThresholdStatus; //***************************************************************************** // //! Values that can be passed to all functions as the \e filterNumber //! parameter. // //***************************************************************************** typedef enum { SDFM_FILTER_1 = 0, //!< Digital filter 1 SDFM_FILTER_2 = 1, //!< Digital filter 2 SDFM_FILTER_3 = 2, //!< Digital filter 3 SDFM_FILTER_4 = 3 //!< Digital filter 4 } SDFM_FilterNumber; //***************************************************************************** // //! Values that can be passed to SDFM_setFilterType(), //! SDFM_setComparatorFilterType() as the \e filterType parameter. // //***************************************************************************** typedef enum { //! Digital filter with SincFast structure. SDFM_FILTER_SINC_FAST = 0x00, //! Digital filter with Sinc1 structure SDFM_FILTER_SINC_1 = 0x10, //! Digital filter with Sinc3 structure. SDFM_FILTER_SINC_2 = 0x20, //! Digital filter with Sinc4 structure. SDFM_FILTER_SINC_3 = 0x30 } SDFM_FilterType; //***************************************************************************** // //! Values that can be passed to SDFM_setupModulatorClock(),as the //! \e clockMode parameter. // //***************************************************************************** typedef enum { //! Modulator clock is identical to the data rate SDFM_MODULATOR_CLK_EQUAL_DATA_RATE = 0, //! Modulator clock is half the data rate SDFM_MODULATOR_CLK_HALF_DATA_RATE = 1, //! Modulator clock is off. Data is Manchester coded. SDFM_MODULATOR_CLK_OFF = 2, //! Modulator clock is double the data rate. SDFM_MODULATOR_CLK_DOUBLE_DATA_RATE = 3 } SDFM_ModulatorClockMode; //***************************************************************************** // //! Values that can be passed to SDFM_setOutputDataFormat(),as the //! \e dataFormat parameter. // //***************************************************************************** typedef enum { //! Filter output is in 16 bits 2's complement format. SDFM_DATA_FORMAT_16_BIT = 0, //! Filter output is in 32 bits 2's complement format. SDFM_DATA_FORMAT_32_BIT = 1 } SDFM_OutputDataFormat; //***************************************************************************** // //! Values that can be passed to SDFM_setDataReadyInterruptSource(),as the //! \e dataReadySource parameter. // //***************************************************************************** typedef enum { //! Data ready interrupt source is direct (non -FIFO). SDFM_DATA_READY_SOURCE_DIRECT = 0, //! Data ready interrupt source is FIFO. SDFM_DATA_READY_SOURCE_FIFO = 1 } SDFM_DataReadyInterruptSource; //***************************************************************************** // //! Values that can be passed to SDFM_setPWMSyncSource(),as the //! \e syncSource parameter. // //***************************************************************************** typedef enum { SDFM_SYNC_PWM1_SOCA = 0, //!< SDFM sync source is PWM1 SOCA SDFM_SYNC_PWM1_SOCB = 1, //!< SDFM sync source is PWM1 SOCB SDFM_SYNC_PWM2_SOCA = 4, //!< SDFM sync source is PWM2 SOCA SDFM_SYNC_PWM2_SOCB = 5, //!< SDFM sync source is PWM2 SOCB SDFM_SYNC_PWM3_SOCA = 8, //!< SDFM sync source is PWM3 SOCA SDFM_SYNC_PWM3_SOCB = 9, //!< SDFM sync source is PWM3 SOCB SDFM_SYNC_PWM4_SOCA = 12, //!< SDFM sync source is PWM4 SOCA SDFM_SYNC_PWM4_SOCB = 13, //!< SDFM sync source is PWM4 SOCB SDFM_SYNC_PWM5_SOCA = 16, //!< SDFM sync source is PWM5 SOCA SDFM_SYNC_PWM5_SOCB = 17, //!< SDFM sync source is PWM5 SOCB SDFM_SYNC_PWM6_SOCA = 20, //!< SDFM sync source is PWM6 SOCA SDFM_SYNC_PWM6_SOCB = 21, //!< SDFM sync source is PWM6 SOCB SDFM_SYNC_PWM7_SOCA = 24, //!< SDFM sync source is PWM7 SOCA SDFM_SYNC_PWM7_SOCB = 25, //!< SDFM sync source is PWM7 SOCB SDFM_SYNC_PWM8_SOCA = 28, //!< SDFM sync source is PWM8 SOCA SDFM_SYNC_PWM8_SOCB = 29, //!< SDFM sync source is PWM8 SOCB SDFM_SYNC_PWM9_SOCA = 32, //!< SDFM sync source is PWM9 SOCA SDFM_SYNC_PWM9_SOCB = 33, //!< SDFM sync source is PWM9 SOCB SDFM_SYNC_PWM10_SOCA = 36, //!< SDFM sync source is PWM10 SOCA SDFM_SYNC_PWM10_SOCB = 37, //!< SDFM sync source is PWM10 SOCB SDFM_SYNC_PWM11_SOCA = 40, //!< SDFM sync source is PWM11 SOCA SDFM_SYNC_PWM11_SOCB = 41, //!< SDFM sync source is PWM11 SOCB SDFM_SYNC_PWM12_SOCA = 44, //!< SDFM sync source is PWM12 SOCA SDFM_SYNC_PWM12_SOCB = 45, //!< SDFM sync source is PWM12 SOCB SDFM_SYNC_PWM13_SOCA = 48, //!< SDFM sync source is PWM13 SOCA SDFM_SYNC_PWM13_SOCB = 49, //!< SDFM sync source is PWM13 SOCB SDFM_SYNC_PWM14_SOCA = 52, //!< SDFM sync source is PWM14 SOCA SDFM_SYNC_PWM14_SOCB = 53, //!< SDFM sync source is PWM14 SOCB SDFM_SYNC_PWM15_SOCA = 56, //!< SDFM sync source is PWM15 SOCA SDFM_SYNC_PWM15_SOCB = 57, //!< SDFM sync source is PWM15 SOCB SDFM_SYNC_PWM16_SOCA = 60, //!< SDFM sync source is PWM16 SOCA SDFM_SYNC_PWM16_SOCB = 61 //!< SDFM sync source is PWM16 SOCB } SDFM_PWMSyncSource; //***************************************************************************** // //! Values that can be passed to SDFM_setFIFOClearOnSyncMode(),as the //! \e fifoClearSyncMode parameter. // //***************************************************************************** typedef enum { //! SDFM FIFO buffer is not cleared on Sync signal SDFM_FIFO_NOT_CLEARED_ON_SYNC = 0, //! SDFM FIFO buffer is cleared on Sync signal SDFM_FIFO_CLEARED_ON_SYNC = 1 } SDFM_FIFOClearSyncMode; //***************************************************************************** // //! Values that can be passed to SDFM_setWaitForSyncClearMode(),as the //! \e syncClearMode parameter. // //***************************************************************************** typedef enum { //! Wait for sync cleared using software. SDFM_MANUAL_CLEAR_WAIT_FOR_SYNC = 0, //! Wait for sync cleared automatically SDFM_AUTO_CLEAR_WAIT_FOR_SYNC = 1 } SDFM_WaitForSyncClearMode; //***************************************************************************** // //! Values that can be passed to SDFM_selectCompEventSource() as the //! \e compEventNum parameter. // //***************************************************************************** typedef enum { SDFM_COMP_EVENT_1 = 11U, //!< Selects CEVT1 SDFM_COMP_EVENT_2 = 14U //!< Selects CEVT2 } SDFM_CompEventNumber; //***************************************************************************** // //! Values that can be passed to SDFM_selectCompEventSource() as the //! \e compEventSource parameter. // //***************************************************************************** typedef enum { SDFM_COMP_EVENT_SRC_COMPH1 = 0, //!< COMPH1 event is the source SDFM_COMP_EVENT_SRC_COMPH1_L1 = 1, //!< Either of COMPH1 or COMPL1 event //!< can be the source SDFM_COMP_EVENT_SRC_COMPH2 = 2, //!< COMPH2 event is the source SDFM_COMP_EVENT_SRC_COMPH2_L2 = 3, //!< Either of COMPH2 or COMPL2 event //!< can be the source SDFM_COMP_EVENT_SRC_COMPL1 = 0, //!< COMPL1 event is the source SDFM_COMP_EVENT_SRC_COMPL2 = 2 //!< COMPL2 event is the source } SDFM_CompEventSource; //***************************************************************************** // //! Values that can be passed to SDFM_selectManchesterClockSource() as the //! \e clkSource parameter. // //***************************************************************************** typedef enum { SDFM_MANCHESTER_CLOCK_SYSCLK = 0x0, SDFM_MANCHESTER_CLOCK_PLLCLK = 0x4U } SDFM_ManchesterClockSource; //***************************************************************************** // //! Values that can be passed to SDFM_selectClockSource() as the \e clkSource //! parameter. // //***************************************************************************** typedef enum { //! Source is respective channel clock SDFM_CLK_SOURCE_CHANNEL_CLK = 0x0, //! Source is SD1 channel clock is the source SDFM_CLK_SOURCE_SD1_CLK = 0x8U } SDFM_ClockSource; //***************************************************************************** // //! Values that can be passed to SDFM_selectCompEventHighSource() as the //! \e source parameter. // //***************************************************************************** typedef enum { //! Comparator event high source is unfiltered event SDFM_COMPHOUT_SOURCE_COMPHIN = 0x0, //! Comparator event high source is filtered event SDFM_COMPHOUT_SOURCE_FILTER = 0x8 } SDFM_CompEventHighSource; //***************************************************************************** // //! Values that can be passed to SDFM_selectCompEventLowSource() as the //! \e source parameter. // //***************************************************************************** typedef enum { //! Comparator event low source is unfiltered event SDFM_COMPLOUT_SOURCE_COMPLIN = 0x000, //! Comparator event low source is filtered event SDFM_COMPLOUT_SOURCE_FILTER = 0x800 } SDFM_CompEventLowSource; //***************************************************************************** // //! Values that can be passed to SDFM_configCompEventLowFilter() & //! SDFM_configCompEventHighFilter() as the \e filterNumber. // //***************************************************************************** typedef struct { uint16_t sampleWindow; //!< Sample window size uint16_t threshold; //!< Majority voting threshold uint16_t clkPrescale; //!< Sample clock pre-scale } SDFM_CompEventFilterConfig; //***************************************************************************** // // Values that can be passed to SDFM_enableInterrupt and SDFM_disableInterrupt // as intFlags parameter // //***************************************************************************** //! Interrupt is generated if Modulator fails. //! //! Interrupt on Comparator low-level threshold. //! //! Interrupt on Comparator high-level threshold. //! //! Interrupt on Acknowledge flag //! //! Interrupt on FIFO level //! //! Interrupt on FIFO overflow //! //***************************************************************************** // // Values that can be passed to SDFM_clearInterruptFlag flags parameter // //***************************************************************************** //! Master interrupt flag //! //! Filter 1 high -level threshold flag //! //! Filter 1 low -level threshold flag //! //! Filter 2 high -level threshold flag //! //! Filter 2 low -level threshold flag //! //! Filter 3 high -level threshold flag //! //! Filter 3 low -level threshold flag //! //! Filter 4 high -level threshold flag //! //! Filter 4 low -level threshold flag //! //! Filter 1 modulator failed flag //! //! Filter 2 modulator failed flag //! //! Filter 3 modulator failed flag //! //! Filter 4 modulator failed flag //! //! Filter 1 new data flag //! //! Filter 2 new data flag //! //! Filter 3 new data flag //! //! Filter 4 new data flag //! //! Filter 1 FIFO overflow flag //! //! Filter 2 FIFO overflow flag //! //! Filter 3 FIFO overflow flag //! //! Filter 4 FIFO overflow flag //! //! Filter 1 FIFO overflow flag //! //! Filter 2 FIFO overflow flag //! //! Filter 3 FIFO overflow flag //! //! Filter 4 FIFO overflow flag //! //***************************************************************************** // //! \internal //! Checks SDFM base address. //! //! \param base specifies the SDFM module base address. //! //! This function determines if SDFM module base address is valid. //! //! \return Returns \b true if the base address is valid and \b false //! otherwise. // //***************************************************************************** static inline _Bool SDFM_isBaseValid(uint32_t base) { return((base == 0x00005E00U) || (base == 0x00005E80U)); } //***************************************************************************** // //! Enable external reset //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! //! This function enables data filter to be reset by an external source (PWM //! compare output). //! //! \return None. // //***************************************************************************** static inline void SDFM_enableExternalReset(uint32_t base, SDFM_FilterNumber filterNumber) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 582); } } while(0); // // Set the SDSYNCEN bit // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x11U + ((uint32_t)filterNumber * 16U))))) |= 0x1000U; __edis(); } //***************************************************************************** // //! Disable external reset //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! //! This function disables data filter from being reset by an external source //! (PWM compare output). //! //! \return None. //***************************************************************************** static inline void SDFM_disableExternalReset(uint32_t base, SDFM_FilterNumber filterNumber) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 608); } } while(0); // // Clear the SDSYNCEN bit // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x11U + ((uint32_t)filterNumber * 16U))))) &= ~0x1000U; __edis(); } //***************************************************************************** // //! Enable filter //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! //! This function enables the filter specified by the \e filterNumber variable. //! //! \return None. // //***************************************************************************** static inline void SDFM_enableFilter(uint32_t base, SDFM_FilterNumber filterNumber) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 634); } } while(0); // // Set the FEN bit // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x11U + ((uint32_t)filterNumber * 16U))))) |= 0x100U; __edis(); } //***************************************************************************** // //! Disable filter //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! //! This function disables the filter specified by the \e filterNumber //! variable. //! //! \return None. //***************************************************************************** static inline void SDFM_disableFilter(uint32_t base, SDFM_FilterNumber filterNumber) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 660); } } while(0); // // Clear the FEN bit // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x11U + ((uint32_t)filterNumber * 16U))))) &= ~0x100U; __edis(); } //***************************************************************************** // //! Enable FIFO buffer //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! //! This function enables the filter FIFO buffer specified by the //! \e filterNumber variable. //! //! \return None. // //***************************************************************************** static inline void SDFM_enableFIFOBuffer(uint32_t base, SDFM_FilterNumber filterNumber) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 687); } } while(0); // // Set the FFEN bit // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x1DU + ((uint32_t)filterNumber * 16U))))) |= 0x2000U; __edis(); } //***************************************************************************** // //! Disable FIFO buffer //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! //! This function disables the filter FIFO buffer specified by the //! \e filterNumber variable. //! //! \return None. // //***************************************************************************** static inline void SDFM_disableFIFOBuffer(uint32_t base, SDFM_FilterNumber filterNumber) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 714); } } while(0); // // Clear the FFEN bit // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x1DU + ((uint32_t)filterNumber * 16U))))) &= ~0x2000U; __edis(); } //***************************************************************************** // //! Return the Manchester lock status //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! //! This function returns the Manchester code lock status. //! //! \return Returns \b true if the Manchester decoder module is locked //! (success). //! Returns \b false if the Manchester decoder module isn't locked //! (failure). // //***************************************************************************** static inline _Bool SDFM_getManchesterDecoderLockedStatus(uint32_t base, SDFM_FilterNumber filterNumber) { uint16_t shift; do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 745); } } while(0); shift = (uint16_t)filterNumber + 12U; // // Read bits MAL1, MAL2, MAL3 and MAL4 bits // return((((*((volatile uint16_t *)((uintptr_t)(base + 0x7U)))) >> shift) & 1U) != 0x1U); } //***************************************************************************** // //! Return the Manchester fail status //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! //! This function returns the Manchester failed lock status for the filter //! specified by \e filterNumber variable. //! //! \return Returns \b SDFM_MANCHESTER_DECODER_SUCCESS if the Manchester //! decoder is working properly. //! Returns \b SDFM_MANCHESTER_DECODER_FAIL if the Manchester decoder //! has encountered issues. // //***************************************************************************** static inline SDFM_ManchesterDecoderStatus SDFM_getManchesterDecoderFailedStatus(uint32_t base, SDFM_FilterNumber filterNumber) { uint16_t shift; do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 777); } } while(0); shift = (uint16_t)filterNumber + 8U; // // Read bits MAF1, MAF2, MAF3 and MAF4 bits // return((SDFM_ManchesterDecoderStatus)(((*((volatile uint16_t *)((uintptr_t)(base + 0x7U)))) >> shift) & 1U)); } //***************************************************************************** // //! Return the Zero Cross Trip status //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! //! This function returns the Zero Cross Trip status for the filter //! specified by filterNumber variable. //! //! \return \b true if Comparator filter output >= High-level threshold (Z) //! \b false if Comparator filter output < High-level threshold (Z) // //***************************************************************************** static inline _Bool SDFM_getZeroCrossTripStatus(uint32_t base, SDFM_FilterNumber filterNumber) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 805); } } while(0); return((((*((volatile uint16_t *)((uintptr_t)(base + 0x7U)))) >> (uint16_t)filterNumber) & 0x1U) == 1U); } //***************************************************************************** // //! Clear the Zero Cross Trip status //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! //! This function clears the Zero Cross Trip status for the filter //! specified by filterNumber variable. //! //! \return None. // //***************************************************************************** static inline void SDFM_clearZeroCrossTripStatus(uint32_t base, SDFM_FilterNumber filterNumber) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 827); } } while(0); // // Set SDCTL MIE bit // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) |= (1U << filterNumber); __edis(); } //***************************************************************************** // //! Enable Comparator. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! //! This function enables the Comparator for the selected filter. //! //! \return None. // //***************************************************************************** static inline void SDFM_enableComparator(uint32_t base, SDFM_FilterNumber filterNumber) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 852); } } while(0); // // Set CEN bit // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x15U + ((uint32_t)filterNumber * 16U))))) |= 0x2000U; __edis(); } //***************************************************************************** // //! Disable Comparator. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! //! This function disables the Comparator for the selected filter. //! //! \return None. // //***************************************************************************** static inline void SDFM_disableComparator(uint32_t base, SDFM_FilterNumber filterNumber) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 878); } } while(0); // // Clear CEN bit // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x15U + ((uint32_t)filterNumber * 16U))))) &= ~0x2000U; __edis(); } //***************************************************************************** // //! Selects Comparator Event Source. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number //! \param compEventNum is the event number //! \param compEventSource is the event source //! //! This function selects the comparator event source. Valid values for //! \e compEventNum are: //! - SDFM_COMP_EVENT_1 - Selects comparator event 1 //! - SDFM_COMP_EVENT_2 - Selects comparator event 2 //! Valid values for \e SDFM_COMP_EVENT_1 are: //! - SDFM_COMP_EVENT_SRC_COMPH1 - COMPH1 event is the source for selected event //! - SDFM_COMP_EVENT_SRC_COMPH1_L1 - Either of COMPH1 or COMPL1 event can be //! the source for selected event //! - SDFM_COMP_EVENT_SRC_COMPH2 - COMPH2 event is the source for selected event //! - SDFM_COMP_EVENT_SRC_COMPH2_L2 - Either of COMPH2 or COMPL2 event can be //! the source for selected event //! //! Valid values for \e SDFM_COMP_EVENT_2 are: //! - SDFM_COMP_EVENT_SRC_COMPL1 - COMPL1 event is the source for selected event //! - SDFM_COMP_EVENT_SRC_COMPH1_L1 - Either of COMPH1 or COMPL1 event can be //! the source for selected event //! - SDFM_COMP_EVENT_SRC_COMPL2 - COMPL2 event is the source for selected event //! - SDFM_COMP_EVENT_SRC_COMPH2_L2 - Either of COMPH2 or COMPL2 event can be //! the source for selected event //! //! \return None. // //***************************************************************************** static inline void SDFM_selectCompEventSource(uint32_t base, SDFM_FilterNumber filterNumber, SDFM_CompEventNumber compEventNum, SDFM_CompEventSource compEventSource) { uint32_t address; do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 927); } } while(0); address = base + 0x15U + ((uint32_t)filterNumber * (0x20U - 0x10U)); // // Select source for selected comparator event // __eallow(); (*((volatile uint16_t *)((uintptr_t)(address)))) = ((*((volatile uint16_t *)((uintptr_t)(address)))) & ~((uint16_t)0x2U << compEventNum)) | ((uint16_t)compEventSource << compEventNum) ; __edis(); } //***************************************************************************** // //! Set filter type. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! \param filterType is the filter type or structure. //! //! This function sets the filter type or structure to be used as specified by //! filterType for the selected filter number as specified by filterNumber. //! //! \return None. //***************************************************************************** static inline void SDFM_setFilterType(uint32_t base, SDFM_FilterNumber filterNumber, SDFM_FilterType filterType) { uint32_t address; do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 959); } } while(0); address = base + 0x11U + ((uint32_t)filterNumber * 16U); // // Write to SST bits // __eallow(); (*((volatile uint16_t *)((uintptr_t)(address)))) = ((*((volatile uint16_t *)((uintptr_t)(address)))) & (~0xC00U)) | ((uint16_t)filterType << 6U); __edis(); } //***************************************************************************** // //! Set data filter over sampling ratio. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! \param overSamplingRatio is the data filter over sampling ratio. //! //! This function sets the filter oversampling ratio for the filter specified //! by the filterNumber variable.Valid values for the variable //! overSamplingRatio are 0 to 255 inclusive. The actual oversampling ratio //! will be this value plus one. //! //! \return None. //***************************************************************************** static inline void SDFM_setFilterOverSamplingRatio(uint32_t base, SDFM_FilterNumber filterNumber, uint16_t overSamplingRatio) { uint32_t address; do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 993); } } while(0); do { if(!(overSamplingRatio < 256U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 994); } } while(0); address = base + 0x11U + ((uint32_t)filterNumber * 16U); // // Write to DOSR bits // __eallow(); (*((volatile uint16_t *)((uintptr_t)(address)))) = ((*((volatile uint16_t *)((uintptr_t)(address)))) & (~0xFFU)) | overSamplingRatio; __edis(); } //***************************************************************************** // //! Set modulator clock mode. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! \param clockMode is the modulator clock mode. //! //! This function sets the modulator clock mode specified by clockMode //! for the filter specified by filterNumber. //! //! \return None. //***************************************************************************** static inline void SDFM_setupModulatorClock(uint32_t base, SDFM_FilterNumber filterNumber, SDFM_ModulatorClockMode clockMode) { uint32_t address; do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1026); } } while(0); address = base + 0x10U + ((uint32_t)filterNumber * 16U); // // Write to MOD bits // __eallow(); (*((volatile uint16_t *)((uintptr_t)(address)))) = ((*((volatile uint16_t *)((uintptr_t)(address)))) & (~0x3U)) | (uint16_t)clockMode; __edis(); } //***************************************************************************** // //! Set the output data format //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! \param dataFormat is the output data format. //! //! This function sets the output data format for the filter specified by //! filterNumber. //! //! \return None. // //***************************************************************************** static inline void SDFM_setOutputDataFormat(uint32_t base, SDFM_FilterNumber filterNumber, SDFM_OutputDataFormat dataFormat) { uint32_t address; do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1059); } } while(0); address = base + 0x12U + ((uint32_t)filterNumber * 16U); // // Write to DR bit // __eallow(); (*((volatile uint16_t *)((uintptr_t)(address)))) = ((*((volatile uint16_t *)((uintptr_t)(address)))) & (~0x400U)) | ((uint16_t)dataFormat << 10U); __edis(); } //***************************************************************************** // //! Set data shift value. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! \param shiftValue is the data shift value. //! //! This function sets the shift value for the 16 bit 2's complement data //! format. The valid maximum value for shiftValue is 31. //! //! \b Note: Use this function with 16 bit 2's complement data format only. //! //! \return None. // //***************************************************************************** static inline void SDFM_setDataShiftValue(uint32_t base, SDFM_FilterNumber filterNumber, uint16_t shiftValue) { uint32_t address; do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1094); } } while(0); do { if(!(shiftValue < 32U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1095); } } while(0); address = base + 0x12U + ((uint32_t)filterNumber * 16U); // // Write to SH bit // __eallow(); (*((volatile uint16_t *)((uintptr_t)(address)))) = ((*((volatile uint16_t *)((uintptr_t)(address)))) & (~0xF800U)) | (shiftValue << 11U); __edis(); } //***************************************************************************** // //! Set Filter output high-level threshold. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! \param highThreshold is the high-level threshold 1 & 2. //! //! This function sets the unsigned high-level threshold value for the //! Comparator filter output. If the output value of the filter exceeds //! highThreshold and interrupt generation is enabled, an interrupt will be //! issued. The param \b highThreshold takes both high threshold 1 & 2 values. //! The upper 16-bits represent the high threshold 2 value while lower 16-bits //! represent the threshold 1 values. //! //! \return None. // //***************************************************************************** static inline void SDFM_setCompFilterHighThreshold(uint32_t base, SDFM_FilterNumber filterNumber, uint32_t highThreshold) { uint32_t address; do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1133); } } while(0); do { if(!((uint16_t)highThreshold <= 0x7FFFU)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1134); } } while(0); do { if(!((uint16_t)(highThreshold >> 16U) <= 0x7FFFU)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1135); } } while(0); address = base + 0x13U + ((uint32_t)filterNumber * (0x20U - 0x10U)); // // Write to HLT bit // __eallow(); (*((volatile uint16_t *)((uintptr_t)(address)))) = ((*((volatile uint16_t *)((uintptr_t)(address)))) & ~0x7FFFU) | (uint16_t)highThreshold; (*((volatile uint16_t *)((uintptr_t)(address + (0x1BU - 0x13U))))) = ((*((volatile uint16_t *)((uintptr_t)(address + (0x1BU - 0x13U))))) & ~0x7FFFU) | (uint16_t)(highThreshold >> 16U); __edis(); } //***************************************************************************** // //! Set Filter output low-level threshold. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number //! \param lowThreshold is the low-level threshold //! //! This function sets the unsigned low-level threshold value 1 or 2 for the //! Comparator filter output. If the output value of the filter gets below //! lowThreshold and interrupt generation is enabled, an interrupt will be //! issued. The param \b lowThreshold takes both low threshold 1 & 2 values. //! The upper 16-bits represent the low threshold 2 value while lower 16-bits //! represent the threshold 1 values. //! //! \return None. // //***************************************************************************** static inline void SDFM_setCompFilterLowThreshold(uint32_t base, SDFM_FilterNumber filterNumber, uint32_t lowThreshold) { uint32_t address; do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1177); } } while(0); do { if(!((uint16_t)lowThreshold <= 0x7FFFU)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1178); } } while(0); do { if(!((uint16_t)(lowThreshold >> 16U) <= 0x7FFFU)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1179); } } while(0); address = base + 0x14U + ((uint32_t)filterNumber * (0x20U - 0x10U)); // // Write to LLT bit. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(address)))) = ((*((volatile uint16_t *)((uintptr_t)(address)))) & ~0x7FFFU) | (uint16_t)lowThreshold; (*((volatile uint16_t *)((uintptr_t)(address + (0x1FU - 0x14U))))) = ((*((volatile uint16_t *)((uintptr_t)(address + (0x1FU - 0x14U))))) & ~0x7FFFU) | (uint16_t)(lowThreshold >> 16U); __edis(); } //***************************************************************************** // //! Set Filter output zero-cross threshold. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! \param zeroCrossThreshold is the zero-cross threshold. //! //! This function sets the unsigned zero-cross threshold value for the //! Comparator filter output. //! //! \return None. // //***************************************************************************** static inline void SDFM_setCompFilterZeroCrossThreshold(uint32_t base, SDFM_FilterNumber filterNumber, uint16_t zeroCrossThreshold) { uint32_t address; do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1216); } } while(0); do { if(!(zeroCrossThreshold < 0x7FFFU)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1217); } } while(0); address = base + 0x1CU + ((uint32_t)filterNumber * 16U); // // Write to ZCT bit // __eallow(); (*((volatile uint16_t *)((uintptr_t)(address)))) = ((*((volatile uint16_t *)((uintptr_t)(address)))) & ~0x7FFFU) | zeroCrossThreshold; __edis(); } //***************************************************************************** // //! Enable zero-cross Edge detect mode. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! //! This function enables Zero Cross Edge detection. //! //! \return None. // //***************************************************************************** static inline void SDFM_enableZeroCrossEdgeDetect(uint32_t base, SDFM_FilterNumber filterNumber) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1247); } } while(0); // // Set ZCEN bit // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x15U + ((uint32_t)filterNumber * 16U))))) |= 0x400U; __edis(); } //***************************************************************************** // //! Disable zero-cross Edge detect mode. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! //! This function disables Zero Cross Edge detection. //! //! \return None. // //***************************************************************************** static inline void SDFM_disableZeroCrossEdgeDetect(uint32_t base, SDFM_FilterNumber filterNumber) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1273); } } while(0); // // Clear ZCEN bit // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x15U + ((uint32_t)filterNumber * 16U))))) &= ~0x400U; __edis(); } //***************************************************************************** // //! Enable SDFM interrupts. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! \param intFlags is the interrupt source. //! //! This function enables the low threshold , high threshold or modulator //! failure interrupt as determined by intFlags for the filter specified //! by filterNumber. //! Valid values for intFlags are: //! SDFM_MODULATOR_FAILURE_INTERRUPT , SDFM_LOW_LEVEL_THRESHOLD_INTERRUPT, //! SDFM_HIGH_LEVEL_THRESHOLD_INTERRUPT, SDFM_FIFO_INTERRUPT, //! SDFM_FIFO_OVERFLOW_INTERRUPT,SDFM_DATA_FILTER_ACKNOWLEDGE_INTERRUPT //! //! \return None. // //***************************************************************************** static inline void SDFM_enableInterrupt(uint32_t base, SDFM_FilterNumber filterNumber, uint16_t intFlags) { uint16_t offset; do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1309); } } while(0); offset = (uint16_t)filterNumber * 16U; __eallow(); // // Low, high threshold, Modulator failure // if((intFlags & (0x200U | 0x40U | 0x20U)) != 0U) { // // Set IEL or IEH or MFIE bit of SDFM_O_SDCPARMx // (*((volatile uint16_t *)((uintptr_t)(base + 0x15U + offset)))) |= (intFlags & (0x200U | 0x40U | 0x20U)); } // // Data filter acknowledge interrupt // if((intFlags & 0x1U) != 0U) { (*((volatile uint16_t *)((uintptr_t)(base + 0x11U + offset)))) |= 0x200U; } // // FIFO , FIFO overflow interrupt // if((intFlags & (0x1000U | 0x8000U)) != 0U) { // // Set OVFIEN or FFIEN bits of SDFM_O_SDFIFOCTLx // (*((volatile uint16_t *)((uintptr_t)(base + 0x1DU + offset)))) |= (intFlags & (0x1000U | 0x8000U)); } __edis(); } //***************************************************************************** // //! Disable SDFM interrupts. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! \param intFlags is the interrupt source. //! //! This function disables the low threshold , high threshold or modulator //! failure interrupt as determined by intFlags for the filter //! specified by filterNumber. //! Valid values for intFlags are: //! SDFM_MODULATOR_FAILURE_INTERRUPT , SDFM_LOW_LEVEL_THRESHOLD_INTERRUPT, //! SDFM_HIGH_LEVEL_THRESHOLD_INTERRUPT, SDFM_FIFO_INTERRUPT, //! SDFM_FIFO_OVERFLOW_INTERRUPT,SDFM_DATA_FILTER_ACKNOWLEDGE_INTERRUPT //! //! \return None. // //***************************************************************************** static inline void SDFM_disableInterrupt(uint32_t base, SDFM_FilterNumber filterNumber, uint16_t intFlags) { uint16_t offset; do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1379); } } while(0); offset = (uint16_t)filterNumber * 16U; __eallow(); // // Low, high threshold, modulator failure interrupts // if((intFlags & (0x200U | 0x40U | 0x20U)) != 0U) { // // Set IEL or IEH or MFIE bit of SDFM_O_SDCPARMx // (*((volatile uint16_t *)((uintptr_t)(base + 0x15U + offset)))) &= ~(intFlags & (0x200U | 0x40U | 0x20U)); } // // Data filter acknowledge interrupt // if((intFlags & 0x1U) != 0U) { (*((volatile uint16_t *)((uintptr_t)(base + 0x11U + offset)))) &= ~0x200U; } // // FIFO , FIFO overflow interrupt // if((intFlags & (0x1000U | 0x8000U)) != 0U) { // // Set OVFIEN or FFIEN bits of SDFM_O_SDFIFOCTLx // (*((volatile uint16_t *)((uintptr_t)(base + 0x1DU + offset)))) &= ~(intFlags & (0x1000U | 0x8000U)); } __edis(); } //***************************************************************************** // //! Set the comparator filter type. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! \param filterType is the comparator filter type or structure. //! //! This function sets the Comparator filter type or structure to be used as //! specified by filterType for the selected filter number as specified by //! filterNumber. //! //! \return None. //***************************************************************************** static inline void SDFM_setComparatorFilterType(uint32_t base, SDFM_FilterNumber filterNumber, SDFM_FilterType filterType) { uint32_t address; do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1443); } } while(0); address = base + 0x15U + ((uint32_t)filterNumber * 16U); // // Write to CS1_CS0 bits // __eallow(); (*((volatile uint16_t *)((uintptr_t)(address)))) = ((*((volatile uint16_t *)((uintptr_t)(address)))) & (~0x180U)) | ((uint16_t)filterType << 3U); __edis(); } //***************************************************************************** // //! Set Comparator filter over sampling ratio. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! \param overSamplingRatio is the comparator filter over sampling ration. //! //! This function sets the comparator filter oversampling ratio for the filter //! specified by the filterNumber.Valid values for the variable //! overSamplingRatio are 0 to 31 inclusive. //! The actual oversampling ratio will be this value plus one. //! //! \return None. //***************************************************************************** static inline void SDFM_setCompFilterOverSamplingRatio(uint32_t base, SDFM_FilterNumber filterNumber, uint16_t overSamplingRatio) { uint32_t address; do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1477); } } while(0); do { if(!(overSamplingRatio < 32U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1478); } } while(0); address = base + 0x15U + ((uint32_t)filterNumber * 16U); // // Write to COSR bits // __eallow(); (*((volatile uint16_t *)((uintptr_t)(address)))) = ((*((volatile uint16_t *)((uintptr_t)(address)))) & (~0x1FU)) | overSamplingRatio; __edis(); } //***************************************************************************** // //! Get the filter data output. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! //! This function returns the latest data filter output. Depending on the //! filter data output format selected, the valid value will be the lower 16 //! bits or the whole 32 bits of the returned value. //! //! \return Returns the latest data filter output. //***************************************************************************** static inline uint32_t SDFM_getFilterData(uint32_t base, SDFM_FilterNumber filterNumber) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1507); } } while(0); // // Read SDDATA bits // return((*((volatile uint32_t *)((uintptr_t)(base + 0x16U + ((uint32_t)filterNumber * 16U)))))); } //***************************************************************************** // //! Get the Comparator threshold status. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! //! This function returns the Comparator output threshold status for the given //! filterNumber. //! //! \return Returns the following status flags. //! - \b SDFM_OUTPUT_WITHIN_THRESHOLD if the output is within the //! specified threshold. //! - \b SDFM_OUTPUT_ABOVE_THRESHOLD if the output is above the high //! threshold //! - \b SDFM_OUTPUT_BELOW_THRESHOLD if the output is below the low //! threshold. //! //***************************************************************************** static inline SDFM_OutputThresholdStatus SDFM_getThresholdStatus(uint32_t base, SDFM_FilterNumber filterNumber) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1537); } } while(0); // // Read SDIFLG high/low threshold bits // return((SDFM_OutputThresholdStatus)(((*((volatile uint32_t *)((uintptr_t)(base + 0x0U)))) >> (2U * (uint16_t)filterNumber)) & 0x3U)); } //***************************************************************************** // //! Get the Modulator status. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! //! This function returns the Modulator status. //! //! \return Returns true if the Modulator is operating normally //! Returns false if the Modulator has failed //! //***************************************************************************** static inline _Bool SDFM_getModulatorStatus(uint32_t base, SDFM_FilterNumber filterNumber) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1562); } } while(0); // // Read SDIFLG MF1, MF2, MF3 OR MF4 bits // return((((*((volatile uint32_t *)((uintptr_t)(base + 0x0U)))) >> ((uint16_t)filterNumber + 8U)) & 0x1U) != 0x1U); } //***************************************************************************** // //! Check if new Filter data is available. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! //! This function returns new filter data status. //! //! \return Returns \b true if new filter data is available //! Returns \b false if no new filter data is available //! //***************************************************************************** static inline _Bool SDFM_getNewFilterDataStatus(uint32_t base, SDFM_FilterNumber filterNumber) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1587); } } while(0); // // Read SDIFLG AF1, AF2, AF3 OR AF4 bits // return((((*((volatile uint32_t *)((uintptr_t)(base + 0x0U)))) >> ((uint16_t)filterNumber + 12U)) & 0x1U) == 0x1U); } //***************************************************************************** // //! Check if FIFO buffer is overflowed. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! //! This function returns the status of the FIFO buffer overflow for the given //! filter value. //! //! \return Returns \b true if FIFO buffer is overflowed //! Returns \b false if FIFO buffer is not overflowed //! //***************************************************************************** static inline _Bool SDFM_getFIFOOverflowStatus(uint32_t base, SDFM_FilterNumber filterNumber) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1613); } } while(0); // // Read SDIFLG SDFFOVF1, SDFFOVF2, SDFFOVF3 OR SDFFOVF4 bits // return((((*((volatile uint32_t *)((uintptr_t)(base + 0x0U)))) >> ((uint16_t)filterNumber + 16U)) & 0x1U) == 0x1U); } //***************************************************************************** // //! Check FIFO buffer interrupt status. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! //! This function returns the status of the FIFO buffer interrupt for the given //! filter. //! //! \return Returns \b true if FIFO buffer interrupt has occurred. //! Returns \b false if FIFO buffer interrupt has not occurred. //! //***************************************************************************** static inline _Bool SDFM_getFIFOISRStatus(uint32_t base, SDFM_FilterNumber filterNumber) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1639); } } while(0); // // Read SDIFLG SDFFINT1, SDFFINT2, SDFFINT3 OR SDFFINT4 bits // return((((*((volatile uint32_t *)((uintptr_t)(base + 0x0U)))) >> ((uint16_t)filterNumber + 20U)) & 0x1U) == 0x1U); } //***************************************************************************** // //! Get pending interrupt. //! //! \param base is the base address of the SDFM module //! //! This function returns any pending interrupt status. //! //! \return Returns \b true if there is a pending interrupt. //! Returns \b false if no interrupt is pending. //! //***************************************************************************** static inline _Bool SDFM_getIsrStatus(uint32_t base) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1662); } } while(0); // // Read SDIFLG MIF // return(((*((volatile uint32_t *)((uintptr_t)(base + 0x0U)))) >> 31U) == 0x1U); } //***************************************************************************** // //! Clear pending flags. //! //! \param base is the base address of the SDFM module //! \param flag is the SDFM status //! //! This function clears the specified pending interrupt flag. //! Valid values are //! SDFM_MASTER_INTERRUPT_FLAG,SDFM_FILTER_1_NEW_DATA_FLAG, //! SDFM_FILTER_2_NEW_DATA_FLAG,SDFM_FILTER_3_NEW_DATA_FLAG, //! SDFM_FILTER_4_NEW_DATA_FLAG,SDFM_FILTER_1_MOD_FAILED_FLAG, //! SDFM_FILTER_2_MOD_FAILED_FLAG,SDFM_FILTER_3_MOD_FAILED_FLAG, //! SDFM_FILTER_4_MOD_FAILED_FLAG,SDFM_FILTER_1_HIGH_THRESHOLD_FLAG, //! SDFM_FILTER_1_LOW_THRESHOLD_FLAG,SDFM_FILTER_2_HIGH_THRESHOLD_FLAG, //! SDFM_FILTER_2_LOW_THRESHOLD_FLAG,SDFM_FILTER_3_HIGH_THRESHOLD_FLAG, //! SDFM_FILTER_3_LOW_THRESHOLD_FLAG,SDFM_FILTER_4_HIGH_THRESHOLD_FLAG, //! SDFM_FILTER_4_LOW_THRESHOLD_FLAG,SDFM_FILTER_1_FIFO_OVERFLOW_FLAG, //! SDFM_FILTER_2_FIFO_OVERFLOW_FLAG,SDFM_FILTER_3_FIFO_OVERFLOW_FLAG //! SDFM_FILTER_4_FIFO_OVERFLOW_FLAG,SDFM_FILTER_1_FIFO_INTERRUPT_FLAG, //! SDFM_FILTER_2_FIFO_INTERRUPT_FLAG,SDFM_FILTER_3_FIFO_INTERRUPT_FLAG //! SDFM_FILTER_4_FIFO_INTERRUPT_FLAG or any combination of the above flags. //! //! \return None //! //***************************************************************************** static inline void SDFM_clearInterruptFlag(uint32_t base, uint32_t flag) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1698); } } while(0); do { if(!((flag & 0x80FFFFFFU) == flag)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1699); } } while(0); // // Write to SDIFLGCLR register // (*((volatile uint32_t *)((uintptr_t)(base + 0x2U)))) |= flag; } //***************************************************************************** // //! Enable master interrupt. //! //! \param base is the base address of the SDFM module //! //! This function enables the master SDFM interrupt. //! //! \return None //! //***************************************************************************** static inline void SDFM_enableMasterInterrupt(uint32_t base) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1720); } } while(0); // // Set SDCTL MIE bit // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) |= 0x2000U; __edis(); } //***************************************************************************** // //! Disable master interrupt. //! //! \param base is the base address of the SDFM module //! //! This function disables the master SDFM interrupt. //! //! \return None //! //***************************************************************************** static inline void SDFM_disableMasterInterrupt(uint32_t base) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1743); } } while(0); // // Clear SDCTL MIE bit // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x4U)))) &= ~0x2000U; __edis(); } //***************************************************************************** // //! Enable master filter. //! //! \param base is the base address of the SDFM module //! //! This function enables master filter. //! //! \return None //! //***************************************************************************** static inline void SDFM_enableMasterFilter(uint32_t base) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1766); } } while(0); // // Set SDMFILEN MFE bit // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x6U)))) |= 0x800U; __edis(); } //***************************************************************************** // //! Disable master filter. //! //! \param base is the base address of the SDFM module //! //! This function disables master filter. //! //! \return None //! //***************************************************************************** static inline void SDFM_disableMasterFilter(uint32_t base) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1789); } } while(0); // // Clear SDMFILEN MFE bit // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x6U)))) &= ~0x800U; __edis(); } //***************************************************************************** // //! Return the FIFO data count //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! //! This function returns the FIFO data count. //! //! \return Returns the number of data words available in FIFO buffer. // //***************************************************************************** static inline uint16_t SDFM_getFIFODataCount(uint32_t base, SDFM_FilterNumber filterNumber) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1814); } } while(0); // // Read SDFFST // return(((*((volatile uint16_t *)((uintptr_t)(base + 0x1DU + ((uint32_t)filterNumber * 16U))))) & 0x7C0U) >> 6U); } //***************************************************************************** // //! Return the Comparator sinc filter data //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! //! This function returns the Comparator sinc filter data output. //! //! \return Returns the Comparator sinc filter data output. //! // //***************************************************************************** static inline uint16_t SDFM_getComparatorSincData(uint32_t base, SDFM_FilterNumber filterNumber) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1840); } } while(0); // // Read SDCDATA // return((*((volatile uint16_t *)((uintptr_t)(base + 0x1AU + ((uint32_t)filterNumber * 16U)))))); } //***************************************************************************** // //! Return the FIFO data //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! //! This function returns the latest FIFO data. //! //! \return Returns the latest FIFO data. //! //! \note Discard the upper 16 bits if the output data format is 16bits. // //***************************************************************************** static inline uint32_t SDFM_getFIFOData(uint32_t base, SDFM_FilterNumber filterNumber) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1865); } } while(0); // // Read SDDATFIFO // return((*((volatile uint32_t *)((uintptr_t)(base + 0x18U + ((uint32_t)filterNumber * 16U)))))); } //***************************************************************************** // //! Set the FIFO interrupt level. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! \param fifoLevel is the FIFO interrupt level. //! //! This function sets the FIFO interrupt level. Interrupt is generated when //! the FIFO buffer word count gets to or exceeds the value of \e fifoLevel. //! Maximum value for \e fifoLevel is 16. //! //! \return None. // //***************************************************************************** static inline void SDFM_setFIFOInterruptLevel(uint32_t base, SDFM_FilterNumber filterNumber, uint16_t fifoLevel) { uint32_t address; do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1894); } } while(0); do { if(!(fifoLevel <= 16U)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1895); } } while(0); address = base + 0x1DU + ((uint32_t)filterNumber * 16U); // // Write to SDFFIL bit // __eallow(); (*((volatile uint16_t *)((uintptr_t)(address)))) = (((*((volatile uint16_t *)((uintptr_t)(address)))) & (~0x1FU)) | fifoLevel); __edis(); } //***************************************************************************** // //! Set data ready interrupt source. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! \param dataReadySource is the data ready interrupt source. //! //! This function sets the data ready interrupt source. //! Valid values for \e dataReadySource: //! - SDFM_DATA_READY_SOURCE_DIRECT - Direct data ready //! - SDFM_DATA_READY_SOURCE_FIFO - FIFO data ready. //! //! \return None. // //***************************************************************************** static inline void SDFM_setDataReadyInterruptSource(uint32_t base, SDFM_FilterNumber filterNumber, SDFM_DataReadyInterruptSource dataReadySource) { uint32_t address; do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1930); } } while(0); address = base + 0x1DU + ((uint32_t)filterNumber * 16U); // // Write to DRINTSEL // __eallow(); (*((volatile uint16_t *)((uintptr_t)(address)))) = ((*((volatile uint16_t *)((uintptr_t)(address)))) & ~0x4000U) | ((uint16_t)dataReadySource << 14U); __edis(); } //***************************************************************************** // //! Get the wait-for-sync event status. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! //! This function returns the Wait-for-Sync event status. //! //! \return Returns true if sync event has occurred. //! Returns false if sync event has not occurred. // //***************************************************************************** static inline _Bool SDFM_getWaitForSyncStatus(uint32_t base, SDFM_FilterNumber filterNumber) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1959); } } while(0); // // Read WTSYNFLG bit // return((((*((volatile uint16_t *)((uintptr_t)(base + 0x1EU + ((uint32_t)filterNumber * 16U))))) & 0x80U) >> 7U) == 0x1U); } //***************************************************************************** // //! Clear the Wait-for-sync event status. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! //! This function clears the Wait-for-sync event status. //! //! \return None. // //***************************************************************************** static inline void SDFM_clearWaitForSyncFlag(uint32_t base, SDFM_FilterNumber filterNumber) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 1983); } } while(0); __eallow(); // // Clear WTSYNCLR bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x1EU + ((uint32_t)filterNumber * 16U))))) |= 0x100U; __edis(); } //***************************************************************************** // //! Enable wait for sync mode. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! //! This function enables the wait for sync mode. Data to FIFO will be written //! only after PWM sync event. //! //! \return None. // //***************************************************************************** static inline void SDFM_enableWaitForSync(uint32_t base, SDFM_FilterNumber filterNumber) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 2011); } } while(0); __eallow(); // // Set WTSYNCEN bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x1EU + ((uint32_t)filterNumber * 16U))))) |= 0x40U; __edis(); } //***************************************************************************** // //! Disable wait for sync mode. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! //! This function disables the wait for sync mode. Data to FIFO will be written //! every Data ready event. //! //! \return None. // //***************************************************************************** static inline void SDFM_disableWaitForSync(uint32_t base, SDFM_FilterNumber filterNumber) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 2039); } } while(0); __eallow(); // // Clear WTSYNCEN bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x1EU + ((uint32_t)filterNumber * 16U))))) &= ~0x40U; __edis(); } //***************************************************************************** // //! Set the PWM sync mode. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! \param syncSource is the PWM sync source. //! //! This function sets the PWM sync source for the specific SDFM filter. Valid //! values for syncSource are SDFM_SYNC_PWMx_CMPy. Where x ranges from 1 to 8 //! Representing PWM1 to PWM8 respectively and y ranges from A to D //! representing PWM comparators A to D. //! //! \return None. // //***************************************************************************** static inline void SDFM_setPWMSyncSource(uint32_t base, SDFM_FilterNumber filterNumber, SDFM_PWMSyncSource syncSource) { uint32_t address; do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 2073); } } while(0); address = base + 0x1EU + ((uint32_t)filterNumber * 16U); __eallow(); // // Write to SYNCSEL bits // (*((volatile uint16_t *)((uintptr_t)(address)))) = ((*((volatile uint16_t *)((uintptr_t)(address)))) & ~0x3FU) | (uint16_t)syncSource; __edis(); } //***************************************************************************** // //! Set FIFO clear on sync mode. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! \param fifoClearSyncMode is the FIFO clear on sync mode. //! //! This function sets the FIFO clear mode for the specified filter when a sync //! happens depending on the value of fifoClearSyncMode. //! Valid values for fifoClearSyncMode are: //! - SDFM_FIFO_NOT_CLEARED_ON_SYNC - FIFO is not cleared on sync. //! - SDFM_FIFO_CLEARED_ON_SYNC - FIFO is cleared on sync. //! //! \return None. // //***************************************************************************** static inline void SDFM_setFIFOClearOnSyncMode(uint32_t base, SDFM_FilterNumber filterNumber, SDFM_FIFOClearSyncMode fifoClearSyncMode) { uint32_t address; do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 2110); } } while(0); address = base + 0x1EU + ((uint32_t)filterNumber * 16U); __eallow(); // // Write to FFSYNCCLREN bit // (*((volatile uint16_t *)((uintptr_t)(address)))) = ((*((volatile uint16_t *)((uintptr_t)(address)))) & ~0x200U) | ((uint16_t)fifoClearSyncMode << 9U); __edis(); } //***************************************************************************** // //! Set Wait-for-sync clear mode. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! \param syncClearMode is the wait-for-sync clear mode. //! //! This function sets the Wait-For-sync clear mode depending on the value of //! syncClearMode. //! Valid values for syncClearMode are: //! - SDFM_MANUAL_CLEAR_WAIT_FOR_SYNC - Wait-for-sync flag is cleared by //! invoking SDFM_clearWaitForSyncFlag(). //! - SDFM_AUTO_CLEAR_WAIT_FOR_SYNC - Wait-for-sync flag is cleared //! automatically on FIFO interrupt. //! //! \return None. // //***************************************************************************** static inline void SDFM_setWaitForSyncClearMode(uint32_t base, SDFM_FilterNumber filterNumber, SDFM_WaitForSyncClearMode syncClearMode) { uint32_t address; do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 2149); } } while(0); address = base + 0x1EU + ((uint32_t)filterNumber * 16U); __eallow(); // // Write to WTSCLREN bit // (*((volatile uint16_t *)((uintptr_t)(address)))) = ((*((volatile uint16_t *)((uintptr_t)(address)))) & ~0x400U) | ((uint16_t)syncClearMode << 10U); __edis(); } //***************************************************************************** // //! Selects clock source for Manchester decoding. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! \param clkSource is the clock source //! //! This function selects the clock for Manchester decoding between sysclk or //! pll clock. //! Valid values for clkSource are: //! - SDFM_MANCHESTER_CLOCK_SYSCLK - sysclk is the source //! - SDFM_MANCHESTER_CLOCK_PLLCLK - pll clock is the source //! //! \return None. // //***************************************************************************** static inline void SDFM_selectManchesterClockSource(uint32_t base, SDFM_FilterNumber filterNumber, SDFM_ManchesterClockSource clkSource) { uint32_t address; do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 2186); } } while(0); address = base + 0x10U + ((uint32_t)filterNumber * (0x20U - 0x10U)); // // Select clock source for manchester decoding. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(address)))) = ((*((volatile uint16_t *)((uintptr_t)(address)))) & ~(0x4U)) | (uint16_t)clkSource; __edis(); } //***************************************************************************** // //! Returns the clock period used for Manchester decoding. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! //! This function Returns the clock period used for Manchester decoding. //! //! \return Returns the clock period used for Manchester decoding. // //***************************************************************************** static inline uint16_t SDFM_getManchesterClockPeriod(uint32_t base, SDFM_FilterNumber filterNumber) { uint32_t address; do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 2217); } } while(0); address = base + 0x10U + ((uint32_t)filterNumber * (0x20U - 0x10U)); // // Return Manchester clock period. // return((((*((volatile uint16_t *)((uintptr_t)(address)))) & 0xFF00U) >> 8U)); } //***************************************************************************** // //! Selects clock source for SDFM channels. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! \param clkSource is the clock source //! //! This function selests the clock for SDFM module filter channels. //! Valid values for clkSource are: //! - SDFM_CLK_SOURCE_CHANNEL_CLK - Respective channel's clk is the source //! - SDFM_CLK_SOURCE_SD1_CLK - Filter 1 clock is the source //! //! \return None. // //***************************************************************************** static inline void SDFM_selectClockSource(uint32_t base, SDFM_FilterNumber filterNumber, SDFM_ClockSource clkSource) { uint32_t address; do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 2250); } } while(0); address = base + 0x10U + ((uint32_t)filterNumber * (0x20U - 0x10U)); // // Select SDFM clock source. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(address)))) = ((*((volatile uint16_t *)((uintptr_t)(address)))) & ~(0x8U)) | (uint16_t)clkSource; __edis(); } //***************************************************************************** // //! Enables Input Synchronizer. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! \param syncConfig defines which synchronizer to be enabled //! //! This function enables either data or clock or both synchronizer. //! Valid values for syncConfig can be the logical OR of any of the values: //! - SDFM_CLOCK_SYNCHRONIZER - Enable SDFM input clock synchronizer //! - SDFM_DATA_SYNCHRONIZER - Enable SDFM input data synchronizer //! //! \return None. // //***************************************************************************** static inline void SDFM_enableSynchronizer(uint32_t base, SDFM_FilterNumber filterNumber, uint16_t syncConfig) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 2283); } } while(0); // // Select SDFM clock source. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x10U + ((uint32_t)filterNumber * (0x20U - 0x10U)))))) |= syncConfig; __edis(); } //***************************************************************************** // //! Disables Input Synchronizer. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! \param syncConfig defines which synchronizer to be disabled //! //! This function disables either data or clock or both synchronizer. //! Valid values for syncConfig can be the logical OR of any of the values: //! - SDFM_CLOCK_SYNCHRONIZER - Disable SDFM input clock synchronizer //! - SDFM_DATA_SYNCHRONIZER - Disable SDFM input data synchronizer //! //! \return None. // //***************************************************************************** static inline void SDFM_disableSynchronizer(uint32_t base, SDFM_FilterNumber filterNumber, uint16_t syncConfig) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 2314); } } while(0); // // Select SDFM clock source. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x10U + ((uint32_t)filterNumber * (0x20U - 0x10U)))))) &= ~syncConfig; __edis(); } //***************************************************************************** // //! Selects comparator event high source. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! \param source is the comparator event high source //! //! This function selects the source for comparator event high. //! Valid values for source are: //! - SDFM_COMPHOUT_SOURCE_COMPHIN - Original COMPHIN/CEVT1 signal is source //! - SDFM_COMPHOUT_SOURCE_FILTER - Filtered COMPHIN/CEVT1 signal is source //! //! \return None. // //***************************************************************************** static inline void SDFM_selectCompEventHighSource(uint32_t base, SDFM_FilterNumber filterNumber, SDFM_CompEventHighSource source) { uint32_t address; do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 2346); } } while(0); address = base + 0x60U + ((uint32_t)filterNumber * (0x68U - 0x60U)); // // Set COMPHOUT source. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(address)))) = ((*((volatile uint16_t *)((uintptr_t)(address)))) & ~0xCU) | (uint16_t)source; __edis(); } //***************************************************************************** // //! Selects comparator event low source. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! \param source is the comparator event low source //! //! This function selects the source for comparator event low. //! Valid values for source are: //! - SDFM_COMPLOUT_SOURCE_COMPLIN - Original COMPLIN/CEVT2 signal is source //! - SDFM_COMPHOUT_SOURCE_FILTER - Filtered COMPLIN/CEVT2 signal is source //! //! \return None. // //***************************************************************************** static inline void SDFM_selectCompEventLowSource(uint32_t base, SDFM_FilterNumber filterNumber, SDFM_CompEventLowSource source) { uint32_t address; do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 2380); } } while(0); address = base + 0x60U + ((uint32_t)filterNumber * (0x68U - 0x60U)); // // Set COMPLOUT source. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(address)))) = ((*((volatile uint16_t *)((uintptr_t)(address)))) & ~0xC00U) | (uint16_t)source; __edis(); } //***************************************************************************** // //! Initializes Comparator Event Low Filter. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! //! This function initializes Comparator Event Low Filter. //! //! \return None. // //***************************************************************************** static inline void SDFM_initCompEventLowFilter(uint32_t base, SDFM_FilterNumber filterNumber) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 2408); } } while(0); // // Initialize comparator event low filter. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x61U + ((uint32_t)filterNumber * (0x68U - 0x60U)))))) |= (uint16_t)0x8000U; __edis(); } //***************************************************************************** // //! Initializes Comparator Event High Filter. //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! //! This function initializes Comparator Event High Filter. //! //! \return None. // //***************************************************************************** static inline void SDFM_initCompEventHighFilter(uint32_t base, SDFM_FilterNumber filterNumber) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 2435); } } while(0); // // Initialize comparator event high filter. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x63U + ((uint32_t)filterNumber * (0x68U - 0x60U)))))) |= (uint16_t)0x8000U; __edis(); } //***************************************************************************** // //! Lock Comparator Event Filter Configurations //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! \param lockConfig defines the configurations to be locked //! //! This function locks the comparator event filter configurations. Valid //! values of the lockConfig can be logical OR of any of the following values: //! - SDFM_SDCOMPLOCK_SDCOMPCTL - Locks write access to SDCOMPCTL register //! - SDFM_SDCOMPLOCK_COMP - Locks write access to SDCOMPxFILCTL & //! SDCOMPxFILCLKCTL register //! //! \return None. // //***************************************************************************** static inline void SDFM_lockCompEventFilterConfig(uint32_t base, SDFM_FilterNumber filterNumber, uint16_t lockConfig) { do { if(!(SDFM_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/sdfm.h", 2468); } } while(0); // // Lock comparator event filter related configurations. // __eallow(); (*((volatile uint16_t *)((uintptr_t)(base + 0x67U + ((uint32_t)filterNumber * (0x68U - 0x60U)))))) |= lockConfig; __edis(); } //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** //***************************************************************************** // //! Configures SDFM comparator for filter config & threshold values //! //! \param base is the base address of the SDFM module //! \param config1 is the filter number, filter type and over sampling ratio. //! \param config2 is high-level and low-level threshold 1 values. //! \param config3 is the zero-cross threshold value. //! //! This function configures the comparator filter for filter config and //! threshold values based on provided inputs. //! //! The config1 parameter is the logical OR of the filter number, filter type //! and oversampling ratio. //! The bit definitions for config1 are as follow: //! - config1.[3:0] filter number //! - config1.[7:4] filter type //! - config1.[15:8] Over sampling Ratio //! Valid values for filter number and filter type are defined in //! SDFM_FilterNumber and SDFM_FilterType enumerations respectively. //! SDFM_SET_OSR(X) macro can be used to set the value of the oversampling //! ratio ,which ranges [1,32] inclusive, in the appropriate bit location. //! For example the value //! (SDFM_FILTER_1 | SDFM_FILTER_SINC_2 | SDFM_SET_OSR(16)) //! will select Filter 1, SINC 2 type with an oversampling ratio of 16. //! //! The config2 parameter is the logical OR of the filter high and low //! threshold 1 values. //! The bit definitions for config2 are as follow: //! - config2.[15:0] low threshold 1 //! - config2.[31:16] high threshold 1 //! The upper 16 bits define the high threshold 1 and the lower 16 bits define //! the low threshold 1. SDFM_THRESHOLD(H,L) can be used to combine the high //! and low thresholds. //! The config3 parameter is the logical OR of the zero cross threshold //! enable flag and the zero-cross threshold value. //! The bit definitions for config3 are as follow: //! - config3.[15] - Enable or disable zero cross threshold. Valid values //! are 1 or 0 to enable or disable the zero cross threshold //! respectively. //! -config3.[14:0] - Zero Cross Threshold value. //! The SDFM_SET_ZERO_CROSS_THRESH_VALUE(X) macro can be used to specify the //! zero-cross threshold value and OR the 1 to enable it. //! //! \return None. //! //***************************************************************************** extern void SDFM_configComparator(uint32_t base, uint16_t config1, uint32_t config2, uint16_t config3); //***************************************************************************** // //! Configure SDFM enhanced comparator for filter config & threshold values //! //! \param base is the base address of the SDFM module //! \param filterConfig is the filter number, filter type & over sampling ratio. //! \param highLowThreshold1 is high-level and low-level threshold 1 values. //! \param highLowThreshold2 is high-level and low-level threshold 2 values. //! \param zeroCrossThreshold is the zero-cross threshold value. //! //! This function configures the comparator filter for filter config and //! threshold values based on input parameters. //! //! The filterConfig parameter is the logical OR of the filter number, filter //! type and oversampling ratio. //! The bit definitions for filterConfig are as follow: //! - filterConfig.[3:0] filter number //! - filterConfig.[7:4] filter type //! - filterConfig.[15:8] Over sampling Ratio //! Valid values for filter number and filter type are defined in //! SDFM_FilterNumber and SDFM_FilterType enumerations respectively. //! SDFM_SET_OSR(X) macro can be used to set the value of the oversampling //! ratio ,which ranges [1,32] inclusive, in the appropriate bit location. //! For example the value //! (SDFM_FILTER_1 | SDFM_FILTER_SINC_2 | SDFM_SET_OSR(16)) //! will select Filter 1, SINC 2 type with an oversampling ratio of 16. //! //! The highLowThreshold1 parameter is the logical OR of the filter high & low //! threshold 1 values. //! The bit definitions for highLowThreshold1 are as follow: //! - highLowThreshold1.[15:0] low threshold 1 //! - highLowThreshold1.[31:16] high threshold 1 //! The upper 16 bits define the high threshold and the lower 16 bits define //! the low threshold. SDFM_THRESHOLD(H,L) can be used to combine the high and //! low thresholds. //! //! The highLowThreshold2 parameter is the logical OR of the filter high & low //! threshold 2 values. //! The bit definitions for highLowThreshold2 are as follow: //! - highLowThreshold2.[15:0] low threshold 2 //! - highLowThreshold2.[31:16] high threshold 2 //! The upper 16 bits define the high threshold and the lower 16 bits define //! the low threshold. SDFM_THRESHOLD(H,L) can be used to combine the high & //! low thresholds. //! //! The zeroCrossThreshold parameter is the logical OR of the zero cross //! threshold enable flag and the zero-cross threshold value. The bit //! definitions for zeroCrossThreshold are as follows: //! - zeroCrossThreshold.[15] - Enable or disable zero cross threshold. Valid //! values are 1 or 0 to enable or disable the zero cross threshold //! respectively. //! - zeroCrossThreshold.[14:0] - Zero Cross Threshold value. //! The SDFM_SET_ZERO_CROSS_THRESH_VALUE(X) macro can be used as parameter //! zeroCrossThreshold to enable & specify the zero-cross threshold value. //! //! \return None. //! //***************************************************************************** extern void SDFM_configEnhancedComparator(uint32_t base, uint16_t filterConfig, uint32_t highLowThreshold1, uint32_t highLowThreshold2, uint16_t zeroCrossThreshold); //***************************************************************************** // //! Configure SDFM data filter //! //! \param base is the base address of the SDFM module //! \param config1 is the filter number, filter type and over sampling ratio //! configuration. //! \param config2 is filter switch, data representation and data shift values //! configuration. //! //! This function configures the data filter based on configurations //! config1 and config2. //! //! The config1 parameter is the logical OR of the filter number, filter type //! and oversampling ratio. //! The bit definitions for config1 are as follow: //! - config1.[3:0] Filter number //! - config1.[7:4] Filter type //! - config1.[15:8] Over sampling Ratio //! Valid values for filter number and filter type are defined in //! SDFM_FilterNumber and SDFM_FilterType enumerations respectively. //! SDFM_SET_OSR(X) macro can be used to set the value of the oversampling //! ratio , which ranges [1,256] inclusive , in the appropriate bit location //! for config1. For example the value //! (SDFM_FILTER_2 | SDFM_FILTER_SINC_3 | SDFM_SET_OSR(64)) //! will select Filter 2 , SINC 3 type with an oversampling ratio of 64. //! //! The config2 parameter is the logical OR of data representation, filter //! switch, and data shift values //! The bit definitions for config2 are as follow: //! - config2.[0] Data representation //! - config2.[1] Filter switch //! - config2.[15:2] Shift values //! Valid values for data representation are given in SDFM_OutputDataFormat //! enumeration. SDFM_FILTER_DISABLE or SDFM_FILTER_ENABLE will define the //! filter switch values.SDFM_SHIFT_VALUE(X) macro can be used to set the value //! of the data shift value,which ranges [0,31] inclusive, in the appropriate //! bit location for config2. //! The shift value is valid only in SDFM_DATA_FORMAT_16_BIT data //! representation format. //! //! \return None. //! //***************************************************************************** extern void SDFM_configDataFilter(uint32_t base, uint16_t config1, uint16_t config2); //***************************************************************************** // //! Configure SDFM comparator Zero Cross threshold //! //! \param base is the base address of the SDFM module //! \param config1 is the filter number, filter type and over sampling ratio. //! \param config2 is the zero cross threshold value. //! //! This function configures the comparator filter zero cross threshold values //! based on configurations config1 and config2. //! //! The config1 parameter is the logical OR of the filter number, filter type //! and oversampling ratio. //! The bit definitions for config1 are as follow: //! - config1.[3:0] filter number //! - config1.[7:4] filter type //! - config1.[15:8] Over sampling Ratio //! Valid values for filter number and filter type are defined in //! SDFM_FilterNumber and SDFM_FilterType enumerations respectively. //! SDFM_SET_OSR(X) macro can be used to set the value of the oversampling //! ratio ,which ranges [1,32] inclusive, in the appropriate bit location. //! For example the value //! (SDFM_FILTER_1 | SDFM_FILTER_SINC_2 | SDFM_SET_OSR(16)) //! will select Filter 1 , SINC 2 type with an oversampling ratio of 16. //! //! The config2 parameter is the value of the zero cross threshold. The maximum //! acceptable value is 32767. //! //! \return None. //! //***************************************************************************** extern void SDFM_configZeroCrossComparator(uint32_t base, uint16_t config1, uint16_t config2); //***************************************************************************** // //! Configure SDFM data filter FIFO //! //! \param base is the base address of the SDFM module //! \param config1 is the filter number, filter type and over sampling ratio //! configuration. //! \param config2 is filter switch, data representation and data shift values //! and FIFO level configuration. //! //! This function enables and configures the data filter FIFO based on //! configurations config1 and config2. //! //! The config1 parameter is the logical OR of the filter number, filter type //! and oversampling ratio. //! The bit definitions for config1 are as follow: //! - config1.[3:0] filter number //! - config1.[7:4] filter type //! - config1.[15:8] Over sampling Ratio //! Valid values for filter number and filter type are defined in //! SDFM_FilterNumber and SDFM_FilterType enumerations respectively. //! SDFM_SET_OSR(X) macro can be used to set the value of the oversampling //! ratio , which ranges [1,256] inclusive , in the appropriate bit location //! for config1. For example the value //! (SDFM_FILTER_2 | SDFM_FILTER_SINC_3 | SDFM_SET_OSR(64)) //! will select Filter 2 , SINC 3 type with an oversampling ratio of 64. //! //! The config2 parameter is the logical OR of data representation, filter //! switch, data shift value, and FIFO level //! The bit definitions for config2 are as follow: //! - config2.[0] Data representation //! - config2.[1] filter switch. //! - config2.[6:2] shift values. //! - config2.[15:7] FIFO level //! Valid values for data representation are given in SDFM_OutputDataFormat //! enumeration. SDFM_FILTER_DISABLE or SDFM_FILTER_ENABLE will define the //! filter switch values.SDFM_SHIFT_VALUE(X) macro can be used to set the value //! of the data shift value,which ranges [0,31] inclusive, in the appropriate //! bit location for config2. //! The value of FIFO level ranges [1,16] inclusive. The macro //! SDFM_SET_FIFO_LEVEL(X) can be used to set the value of the FIFO level. //! //! \return None. //! //***************************************************************************** extern void SDFM_configDataFilterFIFO(uint32_t base, uint16_t config1, uint16_t config2); //***************************************************************************** // //! Configure Comparator Event Low Filter //! //! \param base is the base address of the SDFM module //! \param filterNumber is the filter number. //! \param config is the comparator event low source //! //! This function configures the sample window, threshold and clock prescale //! configurations for the comparator event low filter. //! //! \return None. // //***************************************************************************** extern void SDFM_configCompEventLowFilter(uint32_t base, SDFM_FilterNumber filterNumber, const SDFM_CompEventFilterConfig *config); //***************************************************************************** // //! Configure Comparator Event High Filter //! //! \param base is the base address of the SDFM module. //! \param filterNumber is the filter number. //! \param config is the comparator event high source //! //! This function configures the sample window, threshold and clock prescale //! configurations for the comparator event high filter. //! //! \return None. // //***************************************************************************** extern void SDFM_configCompEventHighFilter(uint32_t base, SDFM_FilterNumber filterNumber, const SDFM_CompEventFilterConfig *config); //***************************************************************************** // // Close the Doxygen group. //! @} // //***************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //########################################################################### // // FILE: spi.h // // TITLE: C28x SPI driver. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup spi_api SPI //! \brief This module is used for SPI configurations. //! @{ // //***************************************************************************** //########################################################################### // // FILE: hw_spi.h // // TITLE: Definitions for the SPI registers. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // The following are defines for the SPI register offsets // //***************************************************************************** // Register // Register // Register // Register //***************************************************************************** // // The following are defines for the bit fields in the SPICCR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SPICTL register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SPISTS register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SPIBRR register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SPIFFTX register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SPIFFRX register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SPIFFCT register // //***************************************************************************** //***************************************************************************** // // The following are defines for the bit fields in the SPIPRI register // //***************************************************************************** //***************************************************************************** // // Values that can be passed to SPI_enableInterrupt(), SPI_disableInterrupt(), // and SPI_clearInterruptStatus() as the intFlags parameter, and returned by // SPI_getInterruptStatus(). // //***************************************************************************** //***************************************************************************** // //! Values that can be passed to SPI_setConfig() as the \e protocol parameter. // //***************************************************************************** typedef enum { //! Mode 0. Polarity 0, phase 0. Rising edge without delay. SPI_PROT_POL0PHA0 = 0x0000U, //! Mode 1. Polarity 0, phase 1. Rising edge with delay. SPI_PROT_POL0PHA1 = 0x0002U, //! Mode 2. Polarity 1, phase 0. Falling edge without delay. SPI_PROT_POL1PHA0 = 0x0001U, //! Mode 3. Polarity 1, phase 1. Falling edge with delay. SPI_PROT_POL1PHA1 = 0x0003U } SPI_TransferProtocol; //***************************************************************************** // //! Values that can be passed to SPI_setConfig() as the \e mode parameter. // //***************************************************************************** typedef enum { SPI_MODE_SLAVE = 0x0002U, //!< SPI slave SPI_MODE_MASTER = 0x0006U, //!< SPI master SPI_MODE_SLAVE_OD = 0x0000U, //!< SPI slave w/ output (TALK) disabled SPI_MODE_MASTER_OD = 0x0004U //!< SPI master w/ output (TALK) disabled } SPI_Mode; //***************************************************************************** // //! Values that can be passed to SPI_setFIFOInterruptLevel() as the \e txLevel //! parameter, returned by SPI_getFIFOInterruptLevel() in the \e txLevel //! parameter, and returned by SPI_getTxFIFOStatus(). // //***************************************************************************** typedef enum { SPI_FIFO_TXEMPTY = 0x0000U, //!< Transmit FIFO empty SPI_FIFO_TX0 = 0x0000U, //!< Transmit FIFO empty SPI_FIFO_TX1 = 0x0001U, //!< Transmit FIFO 1/16 full SPI_FIFO_TX2 = 0x0002U, //!< Transmit FIFO 2/16 full SPI_FIFO_TX3 = 0x0003U, //!< Transmit FIFO 3/16 full SPI_FIFO_TX4 = 0x0004U, //!< Transmit FIFO 4/16 full SPI_FIFO_TX5 = 0x0005U, //!< Transmit FIFO 5/16 full SPI_FIFO_TX6 = 0x0006U, //!< Transmit FIFO 6/16 full SPI_FIFO_TX7 = 0x0007U, //!< Transmit FIFO 7/16 full SPI_FIFO_TX8 = 0x0008U, //!< Transmit FIFO 8/16 full SPI_FIFO_TX9 = 0x0009U, //!< Transmit FIFO 9/16 full SPI_FIFO_TX10 = 0x000AU, //!< Transmit FIFO 10/16 full SPI_FIFO_TX11 = 0x000BU, //!< Transmit FIFO 11/16 full SPI_FIFO_TX12 = 0x000CU, //!< Transmit FIFO 12/16 full SPI_FIFO_TX13 = 0x000DU, //!< Transmit FIFO 13/16 full SPI_FIFO_TX14 = 0x000EU, //!< Transmit FIFO 14/16 full SPI_FIFO_TX15 = 0x000FU, //!< Transmit FIFO 15/16 full SPI_FIFO_TX16 = 0x0010U, //!< Transmit FIFO full SPI_FIFO_TXFULL = 0x0010U //!< Transmit FIFO full } SPI_TxFIFOLevel; //***************************************************************************** // //! Values that can be passed to SPI_setFIFOInterruptLevel() as the \e rxLevel //! parameter, returned by SPI_getFIFOInterruptLevel() in the \e rxLevel //! parameter, and returned by SPI_getRxFIFOStatus(). // //***************************************************************************** typedef enum { SPI_FIFO_RXEMPTY = 0x0000U, //!< Receive FIFO empty SPI_FIFO_RX0 = 0x0000U, //!< Receive FIFO empty SPI_FIFO_RX1 = 0x0001U, //!< Receive FIFO 1/16 full SPI_FIFO_RX2 = 0x0002U, //!< Receive FIFO 2/16 full SPI_FIFO_RX3 = 0x0003U, //!< Receive FIFO 3/16 full SPI_FIFO_RX4 = 0x0004U, //!< Receive FIFO 4/16 full SPI_FIFO_RX5 = 0x0005U, //!< Receive FIFO 5/16 full SPI_FIFO_RX6 = 0x0006U, //!< Receive FIFO 6/16 full SPI_FIFO_RX7 = 0x0007U, //!< Receive FIFO 7/16 full SPI_FIFO_RX8 = 0x0008U, //!< Receive FIFO 8/16 full SPI_FIFO_RX9 = 0x0009U, //!< Receive FIFO 9/16 full SPI_FIFO_RX10 = 0x000AU, //!< Receive FIFO 10/16 full SPI_FIFO_RX11 = 0x000BU, //!< Receive FIFO 11/16 full SPI_FIFO_RX12 = 0x000CU, //!< Receive FIFO 12/16 full SPI_FIFO_RX13 = 0x000DU, //!< Receive FIFO 13/16 full SPI_FIFO_RX14 = 0x000EU, //!< Receive FIFO 14/16 full SPI_FIFO_RX15 = 0x000FU, //!< Receive FIFO 15/16 full SPI_FIFO_RX16 = 0x0010U, //!< Receive FIFO full SPI_FIFO_RXFULL = 0x0010U, //!< Receive FIFO full SPI_FIFO_RXDEFAULT = 0x001FU //!< To prevent interrupt at reset } SPI_RxFIFOLevel; //***************************************************************************** // //! Values that can be passed to SPI_setEmulationMode() as the \e mode //! parameter. // //***************************************************************************** typedef enum { //! Transmission stops after midway in the bit stream SPI_EMULATION_STOP_MIDWAY = 0x0000U, //! Continue SPI operation regardless SPI_EMULATION_FREE_RUN = 0x0010U, //! Transmission will stop after a started transmission completes SPI_EMULATION_STOP_AFTER_TRANSMIT = 0x0020U } SPI_EmulationMode; //***************************************************************************** // //! Values that can be passed to SPI_setSTESignalPolarity() as the \e polarity //! parameter. // //***************************************************************************** typedef enum { SPI_STE_ACTIVE_LOW = 0x0000U, //!< SPISTE is active low (normal) SPI_STE_ACTIVE_HIGH = 0x2U //!< SPISTE is active high (inverted) } SPI_STEPolarity; //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** //***************************************************************************** // //! \internal //! Checks an SPI base address. //! //! \param base specifies the SPI module base address. //! //! This function determines if a SPI module base address is valid. //! //! \return Returns \b true if the base address is valid and \b false //! otherwise. // //***************************************************************************** static inline _Bool SPI_isBaseValid(uint32_t base) { return((base == 0x00006100U) || (base == 0x00006110U) || (base == 0x00006120U) || (base == 0x00006130U)); } //***************************************************************************** // //! Enables the serial peripheral interface. //! //! \param base specifies the SPI module base address. //! //! This function enables operation of the serial peripheral interface. The //! serial peripheral interface must be configured before it is enabled. //! //! \return None. // //***************************************************************************** static inline void SPI_enableModule(uint32_t base) { // // Check the arguments. // do { if(!(SPI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/spi.h", 251); } } while(0); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) |= 0x80U; } //***************************************************************************** // //! Disables the serial peripheral interface. //! //! \param base specifies the SPI module base address. //! //! This function disables operation of the serial peripheral interface. Call //! this function before doing any configuration. //! //! \return None. // //***************************************************************************** static inline void SPI_disableModule(uint32_t base) { // // Check the arguments. // do { if(!(SPI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/spi.h", 274); } } while(0); (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) &= ~(0x80U); } //***************************************************************************** // //! Enables the transmit and receive FIFOs. //! //! \param base is the base address of the SPI port. //! //! This functions enables the transmit and receive FIFOs in the SPI. //! //! \return None. // //***************************************************************************** static inline void SPI_enableFIFO(uint32_t base) { // // Check the arguments. // do { if(!(SPI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/spi.h", 296); } } while(0); // // Enable the FIFO. // (*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) |= 0x4000U | 0x2000U; (*((volatile uint16_t *)((uintptr_t)(base + 0xBU)))) |= 0x2000U; } //***************************************************************************** // //! Disables the transmit and receive FIFOs. //! //! \param base is the base address of the SPI port. //! //! This functions disables the transmit and receive FIFOs in the SPI. //! //! \return None. // //***************************************************************************** static inline void SPI_disableFIFO(uint32_t base) { // // Check the arguments. // do { if(!(SPI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/spi.h", 322); } } while(0); // // Disable the FIFO. // (*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) &= ~(0x4000U | 0x2000U); (*((volatile uint16_t *)((uintptr_t)(base + 0xBU)))) &= ~0x2000U; } //***************************************************************************** // //! Resets the transmit FIFO. //! //! \param base is the base address of the SPI port. //! //! This function resets the transmit FIFO, setting the FIFO pointer back to //! zero. //! //! \return None. // //***************************************************************************** static inline void SPI_resetTxFIFO(uint32_t base) { // // Check the arguments. // do { if(!(SPI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/spi.h", 349); } } while(0); // // Reset the TX FIFO. // (*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) &= ~0x2000U; (*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) |= 0x2000U; } //***************************************************************************** // //! Resets the receive FIFO. //! //! \param base is the base address of the SPI port. //! //! This function resets the receive FIFO, setting the FIFO pointer back to //! zero. //! //! \return None. // //***************************************************************************** static inline void SPI_resetRxFIFO(uint32_t base) { // // Check the arguments. // do { if(!(SPI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/spi.h", 376); } } while(0); // // Reset the RX FIFO. // (*((volatile uint16_t *)((uintptr_t)(base + 0xBU)))) &= ~0x2000U; (*((volatile uint16_t *)((uintptr_t)(base + 0xBU)))) |= 0x2000U; } //***************************************************************************** // //! Sets the FIFO level at which interrupts are generated. //! //! \param base is the base address of the SPI port. //! \param txLevel is the transmit FIFO interrupt level, specified as //! \b SPI_FIFO_TX0, \b SPI_FIFO_TX1, \b SPI_FIFO_TX2, . . . or //! \b SPI_FIFO_TX16. //! \param rxLevel is the receive FIFO interrupt level, specified as //! \b SPI_FIFO_RX0, \b SPI_FIFO_RX1, \b SPI_FIFO_RX2, . . . or //! \b SPI_FIFO_RX16. //! //! This function sets the FIFO level at which transmit and receive interrupts //! are generated. //! //! \return None. // //***************************************************************************** static inline void SPI_setFIFOInterruptLevel(uint32_t base, SPI_TxFIFOLevel txLevel, SPI_RxFIFOLevel rxLevel) { // // Check the arguments. // do { if(!(SPI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/spi.h", 410); } } while(0); // // Set the FIFO interrupt levels. // (*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) & (~0x1FU)) | (uint16_t)txLevel; (*((volatile uint16_t *)((uintptr_t)(base + 0xBU)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0xBU)))) & (~0x1FU)) | (uint16_t)rxLevel; } //***************************************************************************** // //! Gets the FIFO level at which interrupts are generated. //! //! \param base is the base address of the SPI port. //! \param txLevel is a pointer to storage for the transmit FIFO level, //! returned as one of \b SPI_FIFO_TX0, \b SPI_FIFO_TX1, //! \b SPI_FIFO_TX2, . . . or \b SPI_FIFO_TX16. //! \param rxLevel is a pointer to storage for the receive FIFO level, //! returned as one of \b SPI_FIFO_RX0, \b SPI_FIFO_RX1, //! \b SPI_FIFO_RX2, . . . or \b SPI_FIFO_RX16. //! //! This function gets the FIFO level at which transmit and receive interrupts //! are generated. //! //! \return None. // //***************************************************************************** static inline void SPI_getFIFOInterruptLevel(uint32_t base, SPI_TxFIFOLevel *txLevel, SPI_RxFIFOLevel *rxLevel) { // // Check the arguments. // do { if(!(SPI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/spi.h", 446); } } while(0); // // Extract the transmit and receive FIFO levels. // *txLevel = (SPI_TxFIFOLevel)((*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) & 0x1FU); *rxLevel = (SPI_RxFIFOLevel)((*((volatile uint16_t *)((uintptr_t)(base + 0xBU)))) & 0x1FU); } //***************************************************************************** // //! Get the transmit FIFO status //! //! \param base is the base address of the SPI port. //! //! This function gets the current number of words in the transmit FIFO. //! //! \return Returns the current number of words in the transmit FIFO specified //! as one of the following: //! \b SPI_FIFO_TX0, \b SPI_FIFO_TX1, \b SPI_FIFO_TX2, \b SPI_FIFO_TX3, //! ..., or \b SPI_FIFO_TX16 // //***************************************************************************** static inline SPI_TxFIFOLevel SPI_getTxFIFOStatus(uint32_t base) { // // Check the arguments. // do { if(!(SPI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/spi.h", 477); } } while(0); // // Get the current FIFO status // return((SPI_TxFIFOLevel)(((*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) & 0x1F00U) >> 8U)); } //***************************************************************************** // //! Get the receive FIFO status //! //! \param base is the base address of the SPI port. //! //! This function gets the current number of words in the receive FIFO. //! //! \return Returns the current number of words in the receive FIFO specified //! as one of the following: //! \b SPI_FIFO_RX0, \b SPI_FIFO_RX1, \b SPI_FIFO_RX2, \b SPI_FIFO_RX3, //! ..., or \b SPI_FIFO_RX16 // //***************************************************************************** static inline SPI_RxFIFOLevel SPI_getRxFIFOStatus(uint32_t base) { // // Check the arguments. // do { if(!(SPI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/spi.h", 506); } } while(0); // // Get the current FIFO status // return((SPI_RxFIFOLevel)(((*((volatile uint16_t *)((uintptr_t)(base + 0xBU)))) & 0x1F00U) >> 8U)); } //***************************************************************************** // //! Determines whether the SPI transmitter is busy or not. //! //! \param base is the base address of the SPI port. //! //! This function allows the caller to determine whether all transmitted bytes //! have cleared the transmitter hardware. If \b false is returned, then the //! transmit FIFO is empty and all bits of the last transmitted word have left //! the hardware shift register. This function is only valid when operating in //! FIFO mode. //! //! \return Returns \b true if the SPI is transmitting or \b false if all //! transmissions are complete. // //***************************************************************************** static inline _Bool SPI_isBusy(uint32_t base) { // // Check the arguments. // do { if(!(SPI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/spi.h", 537); } } while(0); // // Determine if the SPI is busy. // return(((*((volatile uint16_t *)((uintptr_t)(base + 0xAU)))) & 0x1F00U) != 0U); } //***************************************************************************** // //! Puts a data element into the SPI transmit buffer. //! //! \param base specifies the SPI module base address. //! \param data is the left-justified data to be transmitted over SPI. //! //! This function places the supplied data into the transmit buffer of the //! specified SPI module. //! //! \note The data being sent must be left-justified in \e data. The lower //! 16 - N bits will be discarded where N is the data width selected in //! SPI_setConfig(). For example, if configured for a 6-bit data width, the //! lower 10 bits of data will be discarded. //! //! \return None. // //***************************************************************************** static inline void SPI_writeDataNonBlocking(uint32_t base, uint16_t data) { // // Check the arguments. // do { if(!(SPI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/spi.h", 569); } } while(0); // // Write data to the transmit buffer. // (*((volatile uint16_t *)((uintptr_t)(base + 0x8U)))) = data; } //***************************************************************************** // //! Gets a data element from the SPI receive buffer. //! //! \param base specifies the SPI module base address. //! //! This function gets received data from the receive buffer of the specified //! SPI module and returns it. //! //! \note Only the lower N bits of the value written to \e data contain valid //! data, where N is the data width as configured by SPI_setConfig(). For //! example, if the interface is configured for 8-bit data width, only the //! lower 8 bits of the value written to \e data contain valid data. //! //! \return Returns the word of data read from the SPI receive buffer. // //***************************************************************************** static inline uint16_t SPI_readDataNonBlocking(uint32_t base) { // // Check the arguments. // do { if(!(SPI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/spi.h", 600); } } while(0); // // Check for data to read. // return((*((volatile uint16_t *)((uintptr_t)(base + 0x7U))))); } //***************************************************************************** // //! Waits for space in the FIFO and then puts data into the transmit buffer. //! //! \param base specifies the SPI module base address. //! \param data is the left-justified data to be transmitted over SPI. //! //! This function places the supplied data into the transmit buffer of the //! specified SPI module once space is available in the transmit FIFO. This //! function should only be used when the FIFO is enabled. //! //! \note The data being sent must be left-justified in \e data. The lower //! 16 - N bits will be discarded where N is the data width selected in //! SPI_setConfig(). For example, if configured for a 6-bit data width, the //! lower 10 bits of data will be discarded. //! //! \return None. // //***************************************************************************** static inline void SPI_writeDataBlockingFIFO(uint32_t base, uint16_t data) { // // Check the arguments. // do { if(!(SPI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/spi.h", 633); } } while(0); // // Wait until space is available in the receive FIFO. // while(SPI_getTxFIFOStatus(base) == SPI_FIFO_TXFULL) { } // // Write data to the transmit buffer. // (*((volatile uint16_t *)((uintptr_t)(base + 0x8U)))) = data; } //***************************************************************************** // //! Waits for data in the FIFO and then reads it from the receive buffer. //! //! \param base specifies the SPI module base address. //! //! This function waits until there is data in the receive FIFO and then reads //! received data from the receive buffer. This function should only be used //! when FIFO mode is enabled. //! //! \note Only the lower N bits of the value written to \e data contain valid //! data, where N is the data width as configured by SPI_setConfig(). For //! example, if the interface is configured for 8-bit data width, only the //! lower 8 bits of the value written to \e data contain valid data. //! //! \return Returns the word of data read from the SPI receive buffer. // //***************************************************************************** static inline uint16_t SPI_readDataBlockingFIFO(uint32_t base) { // // Check the arguments. // do { if(!(SPI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/spi.h", 672); } } while(0); // // Wait until data is available in the receive FIFO. // while(SPI_getRxFIFOStatus(base) == SPI_FIFO_RXEMPTY) { } // // Check for data to read. // return((*((volatile uint16_t *)((uintptr_t)(base + 0x7U))))); } //***************************************************************************** // //! Waits for the transmit buffer to empty and then writes data to it. //! //! \param base specifies the SPI module base address. //! \param data is the left-justified data to be transmitted over SPI. //! //! This function places the supplied data into the transmit buffer of the //! specified SPI module once it is empty. This function should not be used //! when FIFO mode is enabled. //! //! \note The data being sent must be left-justified in \e data. The lower //! 16 - N bits will be discarded where N is the data width selected in //! SPI_setConfig(). For example, if configured for a 6-bit data width, the //! lower 10 bits of data will be discarded. //! //! \return None. // //***************************************************************************** static inline void SPI_writeDataBlockingNonFIFO(uint32_t base, uint16_t data) { // // Check the arguments. // do { if(!(SPI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/spi.h", 712); } } while(0); // // Wait until the transmit buffer is not full. // while(((*((volatile uint16_t *)((uintptr_t)(base + 0x2U)))) & 0x20U) != 0U) { } // // Write data to the transmit buffer. // (*((volatile uint16_t *)((uintptr_t)(base + 0x8U)))) = data; } //***************************************************************************** // //! Waits for data to be received and then reads it from the buffer. //! //! \param base specifies the SPI module base address. //! //! This function waits for data to be received and then reads it from the //! receive buffer of the specified SPI module. This function should not be //! used when FIFO mode is enabled. //! //! \note Only the lower N bits of the value written to \e data contain valid //! data, where N is the data width as configured by SPI_setConfig(). For //! example, if the interface is configured for 8-bit data width, only the //! lower 8 bits of the value written to \e data contain valid data. //! //! \return Returns the word of data read from the SPI receive buffer. // //***************************************************************************** static inline uint16_t SPI_readDataBlockingNonFIFO(uint32_t base) { // // Check the arguments. // do { if(!(SPI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/spi.h", 751); } } while(0); // // Wait until data has been received. // while(((*((volatile uint16_t *)((uintptr_t)(base + 0x2U)))) & 0x40U) == 0U) { } // // Check for data to read. // return((*((volatile uint16_t *)((uintptr_t)(base + 0x7U))))); } //***************************************************************************** // //! Enables SPI 3-wire mode. //! //! \param base is the base address of the SPI port. //! //! This function enables 3-wire mode. When in master mode, this allows SPISIMO //! to become SPIMOMI and SPISOMI to become free for non-SPI use. When in slave //! mode, SPISOMI because the SPISISO pin and SPISIMO is free for non-SPI use. //! //! \return None. // //***************************************************************************** static inline void SPI_enableTriWire(uint32_t base) { // // Check the arguments. // do { if(!(SPI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/spi.h", 785); } } while(0); // // Set the tri-wire bit to enable 3-wire mode. // (*((volatile uint16_t *)((uintptr_t)(base + 0xFU)))) |= 0x1U; } //***************************************************************************** // //! Disables SPI 3-wire mode. //! //! \param base is the base address of the SPI port. //! //! This function disables 3-wire mode. SPI will operate in normal 4-wire mode. //! //! \return None. // //***************************************************************************** static inline void SPI_disableTriWire(uint32_t base) { // // Check the arguments. // do { if(!(SPI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/spi.h", 810); } } while(0); // // Clear the tri-wire bit to disable 3-wire mode. // (*((volatile uint16_t *)((uintptr_t)(base + 0xFU)))) &= ~0x1U; } //***************************************************************************** // //! Enables SPI loopback mode. //! //! \param base is the base address of the SPI port. //! //! This function enables loopback mode. This mode is only valid during master //! mode and is helpful during device testing as it internally connects SIMO //! and SOMI. //! //! \return None. // //***************************************************************************** static inline void SPI_enableLoopback(uint32_t base) { // // Check the arguments. // do { if(!(SPI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/spi.h", 837); } } while(0); // // Set the bit that enables loopback mode. // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) |= 0x10U; } //***************************************************************************** // //! Disables SPI loopback mode. //! //! \param base is the base address of the SPI port. //! //! This function disables loopback mode. Loopback mode is disabled by default //! after reset. //! //! \return None. // //***************************************************************************** static inline void SPI_disableLoopback(uint32_t base) { // // Check the arguments. // do { if(!(SPI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/spi.h", 863); } } while(0); // // Clear the bit that enables loopback mode. // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) &= ~0x10U; } //***************************************************************************** // //! Set the slave select (SPISTE) signal polarity. //! //! \param base is the base address of the SPI port. //! \param polarity is the SPISTE signal polarity. //! //! This function sets the polarity of the slave select (SPISTE) signal. The //! two modes to choose from for the \e polarity parameter are //! \b SPI_STE_ACTIVE_LOW for active-low polarity (typical) and //! \b SPI_STE_ACTIVE_HIGH for active-high polarity (considered inverted). //! //! \note This has no effect on the STE signal when in master mode. It is only //! applicable to slave mode. //! //! \return None. // //***************************************************************************** static inline void SPI_setSTESignalPolarity(uint32_t base, SPI_STEPolarity polarity) { // // Check the arguments. // do { if(!(SPI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/spi.h", 895); } } while(0); // // Write the polarity of the SPISTE signal to the register. // (*((volatile uint16_t *)((uintptr_t)(base + 0xFU)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0xFU)))) & ~0x2U) | (uint16_t)polarity; } //***************************************************************************** // //! Enables SPI high speed mode. //! //! \param base is the base address of the SPI port. //! //! This function enables high speed mode. //! //! \return None. // //***************************************************************************** static inline void SPI_enableHighSpeedMode(uint32_t base) { // // Check the arguments. // do { if(!(SPI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/spi.h", 921); } } while(0); // // Set the bit that enables high speed mode. // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) |= 0x20U; } //***************************************************************************** // //! Disables SPI high speed mode. //! //! \param base is the base address of the SPI port. //! //! This function disables high speed mode. High speed mode is disabled by //! default after reset. //! //! \return None. // //***************************************************************************** static inline void SPI_disableHighSpeedMode(uint32_t base) { // // Check the arguments. // do { if(!(SPI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/spi.h", 947); } } while(0); // // Clear the bit that enables high speed mode. // (*((volatile uint16_t *)((uintptr_t)(base + 0x0U)))) &= ~0x20U; } //***************************************************************************** // //! Sets SPI emulation mode. //! //! \param base is the base address of the SPI port. //! \param mode is the emulation mode. //! //! This function sets the behavior of the SPI operation when an emulation //! suspend occurs. The \e mode parameter can be one of the following: //! //! - \b SPI_EMULATION_STOP_MIDWAY - Transmission stops midway through the bit //! stream. The rest of the bits will be transmitting after the suspend is //! deasserted. //! - \b SPI_EMULATION_STOP_AFTER_TRANSMIT - If the suspend occurs before the //! first SPICLK pulse, the transmission will not start. If it occurs later, //! the transmission will be completed. //! - \b SPI_EMULATION_FREE_RUN - SPI operation continues regardless of a //! the suspend. //! //! \return None. // //***************************************************************************** static inline void SPI_setEmulationMode(uint32_t base, SPI_EmulationMode mode) { // // Check the arguments. // do { if(!(SPI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/spi.h", 983); } } while(0); // // Write the desired emulation mode to the register. // (*((volatile uint16_t *)((uintptr_t)(base + 0xFU)))) = ((*((volatile uint16_t *)((uintptr_t)(base + 0xFU)))) & ~(0x10U | 0x20U)) | (uint16_t)mode; } //***************************************************************************** // //! Configures the FIFO Transmit Delay //! //! \param base is the base address of the SPI port. //! \param delay Tx FIFO delay to be configured in cycles (0..0xFF) //! //! This function sets the delay between every transfer from FIFO //! transmit buffer to transmit shift register. The delay is defined in //! number SPI serial clock cycles. //! //! \return None // //***************************************************************************** static inline void SPI_setTxFifoTransmitDelay(uint32_t base, uint16_t delay) { // // Check the arguments. // do { if(!(SPI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/spi.h", 1013); } } while(0); do { if(!(delay <= 0xFFU)) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/spi.h", 1014); } } while(0); // // Configure the FIFO Transmit Delay Bits // (*((volatile uint16_t *)((uintptr_t)(base + 0xCU)))) = delay; } //***************************************************************************** // //! Returns the Emulation Buffer Received Data //! //! \param base is the base address of the SPI port. //! //! This function returns the Emulation Buffer Received Data //! //! \return Rx emulation buffer data // //***************************************************************************** static inline uint16_t SPI_readRxEmulationBuffer(uint32_t base) { // // Check the arguments. // do { if(!(SPI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/spi.h", 1039); } } while(0); // // Return Emulation Buffer Received Data // return((*((volatile uint16_t *)((uintptr_t)(base + 0x6U))))); } //***************************************************************************** // //! Enable Trasnmit //! //! \param base is the base address of the SPI port. //! //! This function sets the TALK bit enabling the data trasnmission. //! This bit is enabled by SPI_setConfig if the parameter \r mode is selected as //! SPI_MODE_SLAVE or SPI_MODE_MASTER. //! //! \return None // //***************************************************************************** static inline void SPI_enableTalk(uint32_t base) { // // Check the arguments. // do { if(!(SPI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/spi.h", 1066); } } while(0); // // Set the TALK bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x1U)))) |= 0x2U; } //***************************************************************************** // //! Disable Trasnmit //! //! \param base is the base address of the SPI port. //! //! This function clears the TALK bit disabling the data trasnmission. The //! output pin will be put in high-impedance state. //! This bit is enabled by SPI_setConfig if the parameter \r mode is selected as //! SPI_MODE_SLAVE or SPI_MODE_MASTER. //! //! \return None // //***************************************************************************** static inline void SPI_disableTalk(uint32_t base) { // // Check the arguments. // do { if(!(SPI_isBaseValid(base))) { __error__("C:/ti/c2000/C2000Ware_2_01_00_00/driverlib/f2838x/driverlib/spi.h", 1094); } } while(0); // // Set the TALK bit // (*((volatile uint16_t *)((uintptr_t)(base + 0x1U)))) &= ~0x2U; } //***************************************************************************** // //! Configures the serial peripheral interface. //! //! \param base specifies the SPI module base address. //! \param lspclkHz is the rate of the clock supplied to the SPI module //! (LSPCLK) in Hz. //! \param protocol specifies the data transfer protocol. //! \param mode specifies the mode of operation. //! \param bitRate specifies the clock rate in Hz. //! \param dataWidth specifies number of bits transferred per frame. //! //! This function configures the serial peripheral interface. It sets the SPI //! protocol, mode of operation, bit rate, and data width. //! //! The \e protocol parameter defines the data frame format. The \e protocol //! parameter can be one of the following values: \b SPI_PROT_POL0PHA0, //! \b SPI_PROT_POL0PHA1, \b SPI_PROT_POL1PHA0, or //! \b SPI_PROT_POL1PHA1. These frame formats encode the following polarity //! and phase configurations: //! //!
//! Polarity Phase       Mode
//!   0       0   SPI_PROT_POL0PHA0
//!   0       1   SPI_PROT_POL0PHA1
//!   1       0   SPI_PROT_POL1PHA0
//!   1       1   SPI_PROT_POL1PHA1
//! 
//! //! The \e mode parameter defines the operating mode of the SPI module. The //! SPI module can operate as a master or slave; the SPI can also be be //! configured to disable output on its serial output line. The \e mode //! parameter can be one of the following values: \b SPI_MODE_MASTER, //! \b SPI_MODE_SLAVE, \b SPI_MODE_MASTER_OD or \b SPI_MODE_SLAVE_OD ("OD" //! indicates "output disabled"). //! //! The \e bitRate parameter defines the bit rate for the SPI. This bit rate //! must satisfy the following clock ratio criteria: //! //! - \e bitRate can be no greater than lspclkHz divided by 4. //! - \e lspclkHz / \e bitRate cannot be greater than 128. //! //! The \e dataWidth parameter defines the width of the data transfers and //! can be a value between 1 and 16, inclusive. //! //! The peripheral clock is the low speed peripheral clock. This value is //! returned by SysCtl_getLowSpeedClock(), or it can be explicitly hard coded //! if it is constant and known (to save the code/execution overhead of a call //! to SysCtl_getLowSpeedClock()). //! //! \note SPI operation should be disabled via SPI_disableModule() before any //! changes to its configuration. //! //! \return None. // //***************************************************************************** extern void SPI_setConfig(uint32_t base, uint32_t lspclkHz, SPI_TransferProtocol protocol, SPI_Mode mode, uint32_t bitRate, uint16_t dataWidth); //***************************************************************************** // //! Configures the baud rate of the serial peripheral interface. //! //! \param base specifies the SPI module base address. //! \param lspclkHz is the rate of the clock supplied to the SPI module //! (LSPCLK) in Hz. //! \param bitRate specifies the clock rate in Hz. //! //! This function configures the SPI baud rate. The \e bitRate parameter //! defines the bit rate for the SPI. This bit rate must satisfy the following //! clock ratio criteria: //! //! - \e bitRate can be no greater than \e lspclkHz divided by 4. //! - \e lspclkHz / \e bitRate cannot be greater than 128. //! //! The peripheral clock is the low speed peripheral clock. This value is //! returned by SysCtl_getLowSpeedClock(), or it can be explicitly hard coded //! if it is constant and known (to save the code/execution overhead of a call //! to SysCtl_getLowSpeedClock()). //! //! \note SPI_setConfig() also sets the baud rate. Use SPI_setBaudRate() //! if you wish to configure it separately from protocol and mode. //! //! \return None. // //***************************************************************************** extern void SPI_setBaudRate(uint32_t base, uint32_t lspclkHz, uint32_t bitRate); //***************************************************************************** // //! Enables individual SPI interrupt sources. //! //! \param base specifies the SPI module base address. //! \param intFlags is a bit mask of the interrupt sources to be enabled. //! //! This function enables the indicated SPI interrupt sources. Only the sources //! that are enabled can be reflected to the processor interrupt; disabled //! sources have no effect on the processor. The \e intFlags parameter can be //! any of the following values: //! - \b SPI_INT_RX_OVERRUN - Receive overrun interrupt //! - \b SPI_INT_RX_DATA_TX_EMPTY - Data received, transmit empty //! - \b SPI_INT_RXFF (also enables \b SPI_INT_RXFF_OVERFLOW) - RX FIFO level //! interrupt (and RX FIFO overflow) //! - \b SPI_INT_TXFF - TX FIFO level interrupt //! //! \note \b SPI_INT_RX_OVERRUN, \b SPI_INT_RX_DATA_TX_EMPTY, //! \b SPI_INT_RXFF_OVERFLOW, and \b SPI_INT_RXFF are associated with //! \b SPIRXINT; \b SPI_INT_TXFF is associated with \b SPITXINT. //! //! \return None. // //***************************************************************************** extern void SPI_enableInterrupt(uint32_t base, uint32_t intFlags); //***************************************************************************** // //! Disables individual SPI interrupt sources. //! //! \param base specifies the SPI module base address. //! \param intFlags is a bit mask of the interrupt sources to be disabled. //! //! This function disables the indicated SPI interrupt sources. The //! \e intFlags parameter can be any of the following values: //! - \b SPI_INT_RX_OVERRUN //! - \b SPI_INT_RX_DATA_TX_EMPTY //! - \b SPI_INT_RXFF (also disables \b SPI_INT_RXFF_OVERFLOW) //! - \b SPI_INT_TXFF //! //! \note \b SPI_INT_RX_OVERRUN, \b SPI_INT_RX_DATA_TX_EMPTY, //! \b SPI_INT_RXFF_OVERFLOW, and \b SPI_INT_RXFF are associated with //! \b SPIRXINT; \b SPI_INT_TXFF is associated with \b SPITXINT. //! //! \return None. // //***************************************************************************** extern void SPI_disableInterrupt(uint32_t base, uint32_t intFlags); //***************************************************************************** // //! Gets the current interrupt status. //! //! \param base specifies the SPI module base address. //! //! This function returns the interrupt status for the SPI module. //! //! \return The current interrupt status, enumerated as a bit field of the //! following values: //! - \b SPI_INT_RX_OVERRUN - Receive overrun interrupt //! - \b SPI_INT_RX_DATA_TX_EMPTY - Data received, transmit empty //! - \b SPI_INT_RXFF - RX FIFO level interrupt //! - \b SPI_INT_RXFF_OVERFLOW - RX FIFO overflow //! - \b SPI_INT_TXFF - TX FIFO level interrupt // //***************************************************************************** extern uint32_t SPI_getInterruptStatus(uint32_t base); //***************************************************************************** // //! Clears SPI interrupt sources. //! //! \param base specifies the SPI module base address. //! \param intFlags is a bit mask of the interrupt sources to be cleared. //! //! This function clears the specified SPI interrupt sources so that they no //! longer assert. This function must be called in the interrupt handler to //! keep the interrupts from being triggered again immediately upon exit. The //! \e intFlags parameter can consist of a bit field of the following values: //! - \b SPI_INT_RX_OVERRUN //! - \b SPI_INT_RX_DATA_TX_EMPTY //! - \b SPI_INT_RXFF //! - \b SPI_INT_RXFF_OVERFLOW //! - \b SPI_INT_TXFF //! //! \note \b SPI_INT_RX_DATA_TX_EMPTY is cleared by a read of the receive //! receive buffer, so it usually doesn't need to be cleared using this //! function. //! //! \note Also note that \b SPI_INT_RX_OVERRUN, \b SPI_INT_RX_DATA_TX_EMPTY, //! \b SPI_INT_RXFF_OVERFLOW, and \b SPI_INT_RXFF are associated with //! \b SPIRXINT; \b SPI_INT_TXFF is associated with \b SPITXINT. //! //! \return None. // //***************************************************************************** extern void SPI_clearInterruptStatus(uint32_t base, uint32_t intFlags); //***************************************************************************** // // Close the Doxygen group. //! @} // //***************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //########################################################################### // // FILE: usb.h // // TITLE: Prototypes for the USB Interface Driver. // //########################################################################### // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //########################################################################### //***************************************************************************** // // If building with a C++ compiler, make all of the definitions in this header // have a C binding. // //***************************************************************************** //***************************************************************************** // //! \addtogroup usb_api USB //! @{ // //***************************************************************************** //***************************************************************************** // // The following are defines for the g_usUSBFlags variable // //***************************************************************************** //***************************************************************************** // // The following are values that can be passed to USBIntEnableControl() and // USBIntDisableControl() as the ui32Flags parameter, and are returned from // USBIntStatusControl(). // //***************************************************************************** //***************************************************************************** // // The following are values that can be passed to USBIntEnableEndpoint() and // USBIntDisableEndpoint() as the ui32Flags parameter, and are returned from // USBIntStatusEndpoint(). // //***************************************************************************** //***************************************************************************** // // The following are values that are returned from USBSpeedGet(). // //***************************************************************************** //***************************************************************************** // // The following are values that are returned from USBEndpointStatus(). The // USB_HOST_* values are used when the USB controller is in host mode and the // USB_DEV_* values are used when the USB controller is in device mode. // //***************************************************************************** // (ISOC Mode) // specified timeout period // device // specified timeout period // (ISOC mode) // device // specified timeout period // device // transfer // a full FIFO // to come // Data End seen //***************************************************************************** // // The following are values that can be passed to USBHostEndpointConfig() and // USBDevEndpointConfigSet() as the ui32Flags parameter. // //***************************************************************************** //***************************************************************************** // // The following are values that can be passed to USBHostPwrConfig() as the // ui32Flags parameter. // //***************************************************************************** //***************************************************************************** // // This value specifies the maximum size of transfers on endpoint 0 as 64 // bytes. This value is fixed in hardware as the FIFO size for endpoint 0. // //***************************************************************************** //***************************************************************************** // // These values are used to indicate which endpoint to access. // //***************************************************************************** //***************************************************************************** // // These macros allow conversion between 0-based endpoint indices and the // USB_EP_x values required when calling various USB APIs. // //***************************************************************************** //***************************************************************************** // // The following are values that can be passed to USBFIFOConfigSet() as the // ui32FIFOSize parameter. // //***************************************************************************** // (occupying 16 bytes) // (occupying 32 bytes) // (occupying 64 bytes) // (occupying 128 bytes) // (occupying 256 bytes) // (occupying 512 bytes) // (occupying 1024 bytes) // (occupying 2048 bytes) // (occupying 4096 bytes) //***************************************************************************** // // This macro allow conversion from a FIFO size label as defined above to // a number of bytes // //***************************************************************************** //***************************************************************************** // // The following are values that can be passed to USBEndpointDataSend() as the // ui32TransType parameter. // //***************************************************************************** // endpoint 0 in device mode) // 0) // 0) //***************************************************************************** // // The following are values are returned by the USBModeGet function. // //***************************************************************************** // mode. // Device mode. // set. // the cable. // the cable. // the cable Session Valid. // the cable A valid. // the cable. // the cable. // the cable. // the cable. //***************************************************************************** // // Prototypes for the APIs. // //***************************************************************************** extern uint32_t USBDevAddrGet(uint32_t ui32Base); extern void USBDevAddrSet(uint32_t ui32Base, uint32_t ui32Address); extern void USBDevConnect(uint32_t ui32Base); extern void USBDevDisconnect(uint32_t ui32Base); extern void USBDevEndpointConfigSet(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32MaxPacketSize, uint32_t ui32Flags); extern void USBDevEndpointConfigGet(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t *pui32MaxPacketSize, uint32_t *pui32Flags); extern void USBDevEndpointDataAck(uint32_t ui32Base, uint32_t ui32Endpoint, _Bool bIsLastPacket); extern void USBDevEndpointStall(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32Flags); extern void USBDevEndpointStallClear(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32Flags); extern void USBDevEndpointStatusClear(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32Flags); extern uint32_t USBEndpointDataAvail(uint32_t ui32Base, uint32_t ui32Endpoint); extern void USBEndpointDMAEnable(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32Flags); extern void USBEndpointDMADisable(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32Flags); extern void USBEndpointDMAConfigSet(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32Config); extern int32_t USBEndpointDataGet(uint32_t ui32Base, uint32_t ui32Endpoint, uint8_t *pui8Data, uint32_t *pui32Size); extern int32_t USBEndpointDataPut(uint32_t ui32Base, uint32_t ui32Endpoint, uint8_t *pui8Data, uint32_t ui32Size); extern int32_t USBEndpointDataSend(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32TransType); extern void USBEndpointDataToggleClear(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32Flags); extern void USBEndpointPacketCountSet(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32Count); extern uint32_t USBEndpointStatus(uint32_t ui32Base, uint32_t ui32Endpoint); extern uint32_t USBFIFOAddrGet(uint32_t ui32Base, uint32_t ui32Endpoint); extern void USBFIFOConfigGet(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t *pui32FIFOAddress, uint32_t *pui32FIFOSize, uint32_t ui32Flags); extern void USBFIFOConfigSet(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32FIFOAddress, uint32_t ui32FIFOSize, uint32_t ui32Flags); extern void USBFIFOFlush(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32Flags); extern uint32_t USBFrameNumberGet(uint32_t ui32Base); extern uint32_t USBHostAddrGet(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32Flags); extern void USBHostAddrSet(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32Addr, uint32_t ui32Flags); extern void USBHostEndpointConfig(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32MaxPacketSize, uint32_t ui32NAKPollInterval, uint32_t ui32TargetEndpoint, uint32_t ui32Flags); extern void USBHostEndpointDataAck(uint32_t ui32Base, uint32_t ui32Endpoint); extern void USBHostEndpointDataToggle(uint32_t ui32Base, uint32_t ui32Endpoint, _Bool bDataToggle, uint32_t ui32Flags); extern void USBHostEndpointStatusClear(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32Flags); extern uint32_t USBHostHubAddrGet(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32Flags); extern void USBHostHubAddrSet(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32Addr, uint32_t ui32Flags); extern void USBHostPwrDisable(uint32_t ui32Base); extern void USBHostPwrEnable(uint32_t ui32Base); extern void USBHostPwrConfig(uint32_t ui32Base, uint32_t ui32Flags); extern void USBHostPwrFaultDisable(uint32_t ui32Base); extern void USBHostPwrFaultEnable(uint32_t ui32Base); extern void USBHostRequestIN(uint32_t ui32Base, uint32_t ui32Endpoint); extern void USBHostRequestINClear(uint32_t ui32Base, uint32_t ui32Endpoint); extern void USBHostRequestStatus(uint32_t ui32Base); extern void USBHostReset(uint32_t ui32Base, _Bool bStart); extern void USBHostResume(uint32_t ui32Base, _Bool bStart); extern uint32_t USBHostSpeedGet(uint32_t ui32Base); extern void USBHostSuspend(uint32_t ui32Base); extern void USBIntDisableControl(uint32_t ui32Base, uint32_t ui32IntFlags); extern void USBIntEnableControl(uint32_t ui32Base, uint32_t ui32IntFlags); extern uint32_t USBIntStatus(uint32_t ui32Base, uint32_t *ui32IntStatusEP); extern uint32_t USBIntStatusControl(uint32_t ui32Base); extern void USBIntDisableEndpoint(uint32_t ui32Base, uint32_t ui32IntFlags); extern void USBIntEnableEndpoint(uint32_t ui32Base, uint32_t ui32IntFlags); extern uint32_t USBIntStatusEndpoint(uint32_t ui32Base); extern void USBOTGSessionRequest(uint32_t ui32Base, _Bool bStart); extern uint32_t USBModeGet(uint32_t ui32Base); extern void USBEndpointDMAChannel(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32Channel); extern void USBHostMode(uint32_t ui32Base); extern void USBDevMode(uint32_t ui32Base); extern void USBOTGMode(uint32_t ui32Base); extern void USBPHYPowerOff(uint32_t ui32Base); extern void USBPHYPowerOn(uint32_t ui32Base); extern uint32_t USBNumEndpointsGet(uint32_t ui32Base); extern void USBEnableGlobalInterrupt(uint32_t ui32Base); extern void USBDisableGlobalInterrupt(uint32_t ui32Base); extern uint16_t USBGlobalInterruptFlagStatus(uint32_t ui32Base); extern void USBClearGlobalInterruptFlag(uint32_t ui32Base); //***************************************************************************** // // The following are values that can be passed to USBIntEnable() and // USBIntDisable() as the ulIntFlags parameter, and are returned from // USBIntStatus(). // //***************************************************************************** //***************************************************************************** // // Mark the end of the C bindings section for C++ compilers. // //***************************************************************************** //############################################################################# // // FILE: device.h // // TITLE: Device setup for examples. // //############################################################################# // $TI Release: F2838x Support Library v2.01.00.00 $ // $Release Date: Mon Dec 23 17:43:44 IST 2019 $ // $Copyright: // Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the // distribution. // // Neither the name of Texas Instruments Incorporated nor the names of // its contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // $ //############################################################################# // // Included Files // //***************************************************************************** // // Defines for pin numbers and other GPIO configuration // //***************************************************************************** // // LEDs // // // SCI for USB-to-UART adapter on FTDI chip // // // CANA // // // CAN External Loopback // // // MCAN // // // FSI // //***************************************************************************** // // Defines related to clock configuration // //***************************************************************************** // // 20MHz XTAL on controlCARD. For use with SysCtl_getClock() and // SysCtl_getAuxClock(). // // // Define to pass to SysCtl_setClock(). Will configure the clock as follows: // PLLSYSCLK = 20MHz (XTAL_OSC) * 40 (IMULT) / (2 (REFDIV) * 2 (ODIV) * 1(SYSDIV)) // // // 200MHz SYSCLK frequency based on the above DEVICE_SETCLOCK_CFG. Update the // code below if a different clock configuration is used! // // // 50MHz LSPCLK frequency based on the above DEVICE_SYSCLK_FREQ and a default // low speed peripheral clock divider of 4. Update the code below if a // different LSPCLK divider is used! // // // Define to pass to SysCtl_setAuxClock(). Will configure the clock as follows: // AUXPLLCLK = 20MHz (XTAL_OSC) * 125 (IMULT) / (5 (REFDIV) * 4 (ODIV) * 1(AUXPLLDIV) ) // // // 125MHz AUXCLK frequency based on the above DEVICE_AUXSETCLOCK_CFG. Update // the code below if a different clock configuration is used! // //***************************************************************************** // // Macro to call SysCtl_delay() to achieve a delay in microseconds. The macro // will convert the desired delay in microseconds to the count value expected // by the function. \b x is the number of microseconds to delay. // //***************************************************************************** // // Defines for setting FSI clock speeds // //***************************************************************************** // // Macros related to booting CPU2 and CM. These can be used while invoking the // functions Device_bootCPU2() and Device_bootCM(). // // Note that the macros CM_BOOT_FREQ_125MHZ and CPU2_BOOT_FREQ_200MHZ are used // in the functions Device_bootCM() and Device_bootCPU2() respectively. Please // update the function and the macros if you are using a different clock // frequency. // //***************************************************************************** //***************************************************************************** // // Defines, Globals, and Header Includes related to Flash Support // //***************************************************************************** //***************************************************************************** // // Function Prototypes // //***************************************************************************** extern void Device_init(void); extern void Device_bootCPU2(uint32_t bootmode); extern void Device_bootCM(uint32_t bootmode); extern void Device_enableAllPeripherals(void); extern void Device_initGPIO(void); extern void Device_enableUnbondedGPIOPullupsFor176Pin(void); extern void Device_enableUnbondedGPIOPullups(void); extern void __error__(char *filename, uint32_t line); /*****************************************************************************/ /* string.h */ /* */ /* Copyright (c) 1993 Texas Instruments Incorporated */ /* http://www.ti.com/ */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions */ /* are met: */ /* */ /* Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* */ /* Redistributions in binary form must reproduce the above copyright */ /* notice, this list of conditions and the following disclaimer in */ /* the documentation and/or other materials provided with the */ /* distribution. */ /* */ /* Neither the name of Texas Instruments Incorporated nor the names */ /* of its contributors may be used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */ /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */ /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */ /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */ /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */ /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /*****************************************************************************/ #pragma diag_push #pragma CHECK_MISRA("-6.3") /* standard types required for standard headers */ #pragma CHECK_MISRA("-19.1") /* #includes required for implementation */ #pragma CHECK_MISRA("-20.1") /* standard headers must define standard names */ #pragma CHECK_MISRA("-20.2") /* standard headers must define standard names */ typedef unsigned long size_t; /*****************************************************************************/ /* _ti_config.h */ /* */ /* Copyright (c) 2017 Texas Instruments Incorporated */ /* http://www.ti.com/ */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions */ /* are met: */ /* */ /* Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* */ /* Redistributions in binary form must reproduce the above copyright */ /* notice, this list of conditions and the following disclaimer in */ /* the documentation and/or other materials provided with the */ /* distribution. */ /* */ /* Neither the name of Texas Instruments Incorporated nor the names */ /* of its contributors may be used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */ /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */ /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */ /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */ /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */ /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /*****************************************************************************/ #pragma diag_push #pragma CHECK_MISRA("-19.4") #pragma CHECK_MISRA("-19.1") /* Common definitions */ /* C */ /* C89/C99 */ /* _TI_NOEXCEPT_CPP14 is defined to noexcept only when compiling for C++14. It is intended to be used for functions like abort and atexit that are supposed to be declared noexcept only in C++14 mode. */ /* Target-specific definitions */ /*****************************************************************************/ /* linkage.h */ /* */ /* Copyright (c) 1998 Texas Instruments Incorporated */ /* http://www.ti.com/ */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions */ /* are met: */ /* */ /* Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* */ /* Redistributions in binary form must reproduce the above copyright */ /* notice, this list of conditions and the following disclaimer in */ /* the documentation and/or other materials provided with the */ /* distribution. */ /* */ /* Neither the name of Texas Instruments Incorporated nor the names */ /* of its contributors may be used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */ /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */ /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */ /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */ /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */ /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /*****************************************************************************/ #pragma diag_push #pragma CHECK_MISRA("-19.4") /* macros required for implementation */ /* No modifiers needed to access code */ /*--------------------------------------------------------------------------*/ /* Define _DATA_ACCESS ==> how to access RTS global or static data */ /*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/ /* Define _OPTIMIZE_FOR_SPACE ==> Always optimize for space. */ /*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/ /* Define _IDECL ==> how inline functions are declared */ /*--------------------------------------------------------------------------*/ #pragma diag_pop #pragma diag_pop #pragma diag_push #pragma CHECK_MISRA("-19.4") /* macros required for implementation */ #pragma diag_pop size_t strlen(const char *string); char *strcpy(char * __restrict dest, const char * __restrict src); char *strncpy(char * __restrict dest, const char * __restrict src, size_t n); char *strcat(char * __restrict string1, const char * __restrict string2); char *strncat(char * __restrict dest, const char * __restrict src, size_t n); char *strchr(const char *string, int c); char *strrchr(const char *string, int c); int strcmp(const char *string1, const char *string2); int strncmp(const char *string1, const char *string2, size_t n); int strcoll(const char *string1, const char *_string2); size_t strxfrm(char * __restrict to, const char * __restrict from, size_t n); char *strpbrk(const char *string, const char *chs); size_t strspn(const char *string, const char *chs); size_t strcspn(const char *string, const char *chs); char *strstr(const char *string1, const char *string2); char *strtok(char * __restrict str1, const char * __restrict str2); char *strerror(int _errno); char *strdup(const char *string); void *memmove(void *s1, const void *s2, size_t n); #pragma diag_push #pragma CHECK_MISRA("-16.4") /* false positives due to builtin declarations */ void *memcpy(void * __restrict s1, const void * __restrict s2, size_t n); #pragma diag_pop int memcmp(const void *cs, const void *ct, size_t n); void *memchr(const void *cs, int c, size_t n); void *memset(void *mem, int ch, size_t length); /*----------------------------------------------------------------------------*/ /* If sys/cdefs.h is available, go ahead and include it. xlocale.h assumes */ /* this file will have already included sys/cdefs.h. */ /*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /* Include xlocale/_string.h> if POSIX is enabled. This will expose the */ /* xlocale string interface. */ /*----------------------------------------------------------------------------*/ #pragma diag_pop /*****************************************************************************/ /* STDIO.H */ /* */ /* Copyright (c) 1993 Texas Instruments Incorporated */ /* http://www.ti.com/ */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions */ /* are met: */ /* */ /* Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* */ /* Redistributions in binary form must reproduce the above copyright */ /* notice, this list of conditions and the following disclaimer in */ /* the documentation and/or other materials provided with the */ /* distribution. */ /* */ /* Neither the name of Texas Instruments Incorporated nor the names */ /* of its contributors may be used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */ /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */ /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */ /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */ /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */ /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /*****************************************************************************/ /*****************************************************************************/ /* stdarg.h */ /* */ /* Copyright (c) 1996 Texas Instruments Incorporated */ /* http://www.ti.com/ */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions */ /* are met: */ /* */ /* Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* */ /* Redistributions in binary form must reproduce the above copyright */ /* notice, this list of conditions and the following disclaimer in */ /* the documentation and/or other materials provided with the */ /* distribution. */ /* */ /* Neither the name of Texas Instruments Incorporated nor the names */ /* of its contributors may be used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */ /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */ /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */ /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */ /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */ /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /*****************************************************************************/ #pragma diag_push #pragma CHECK_MISRA("-20.1") /* standard headers must define standard names */ #pragma CHECK_MISRA("-20.2") /* standard headers must define standard names */ #pragma CHECK_MISRA("-19.7") /* macros required for implementation */ #pragma CHECK_MISRA("-19.10") /* need types as macro arguments */ typedef __va_list va_list; /****************************************************************************/ /* RETURN THE NEXT VALUE ON THE STACK ... */ /* */ /* (, ) BECOMES ... */ /* */ /* ap -= 1 (stack grows toward high addresses) */ /* ap -= 1 more if type is long or float */ /* ap -= 1 more if type is long or float and to account for alignment */ /* if necessary */ /* */ /* if () return **ap; */ /* else if () return *ap; */ /* */ /* LONG/FLOATS ARE ALWAYS ALIGNED ON AN EVEN WORD BOUNDARY, EVEN WHEN */ /* PASSED AS PARAMETERS, THUS ap MUST BE ALIGNED FOR THOSE ACCESSES. */ /****************************************************************************/ #pragma diag_pop #pragma diag_push #pragma CHECK_MISRA("-20.2") /* reuse of standard macros/objects/funcs */ #pragma CHECK_MISRA("-20.1") /* redefining reserved identifiers */ #pragma CHECK_MISRA("-19.7") /* use function instead of function-like macro */ #pragma CHECK_MISRA("-19.4") /* macros should have only simple expansions */ #pragma CHECK_MISRA("-19.1") /* include should follow directive or comment */ #pragma CHECK_MISRA("-16.3") /* parameters without names */ #pragma CHECK_MISRA("-6.3") /* use size/sign-specific typedefs */ /*---------------------------------------------------------------------------*/ /* Attributes are only available in relaxed ANSI mode. */ /*---------------------------------------------------------------------------*/ /****************************************************************************/ /* TYPES THAT ANSI REQUIRES TO BE DEFINED */ /****************************************************************************/ struct __sFILE { int fd; /* File descriptor */ unsigned char* buf; /* Pointer to start of buffer */ unsigned char* pos; /* Position in buffer */ unsigned char* bufend; /* Pointer to end of buffer */ unsigned char* buff_stop; /* Pointer to last read char in buffer */ unsigned int flags; /* File status flags (see below) */ }; typedef struct __sFILE FILE; typedef long fpos_t; /****************************************************************************/ /* DEVICE AND STREAM RELATED MACROS */ /****************************************************************************/ /****************************************************************************/ /* MACROS THAT DEFINE AND USE FILE STATUS FLAGS */ /****************************************************************************/ /****************************************************************************/ /* MACROS THAT ANSI REQUIRES TO BE DEFINED */ /****************************************************************************/ /******** END OF ANSI MACROS ************************************************/ /****************************************************************************/ /* DEVICE AND STREAM RELATED DATA STRUCTURES AND MACROS */ /****************************************************************************/ extern FILE _ftable[10]; extern char __TI_tmpnams[10][16]; /****************************************************************************/ /* FUNCTION DEFINITIONS - ANSI */ /****************************************************************************/ /****************************************************************************/ /* OPERATIONS ON FILES */ /****************************************************************************/ extern int remove(const char *_file); extern int rename(const char *_old, const char *_new); extern FILE *tmpfile(void); extern char *tmpnam(char *_s); /****************************************************************************/ /* FILE ACCESS FUNCTIONS */ /****************************************************************************/ extern int fclose(FILE * __restrict _fp); extern FILE *fopen(const char * __restrict _fname, const char * __restrict _mode); extern FILE *freopen(const char * __restrict _fname, const char * __restrict _mode, FILE * __restrict _fp); extern void setbuf(FILE * __restrict _fp, char * __restrict _buf); extern int setvbuf(FILE * __restrict _fp, char * __restrict _buf, int _type, size_t _size); extern int fflush(FILE *_fp); /****************************************************************************/ /* FORMATTED INPUT/OUTPUT FUNCTIONS */ /****************************************************************************/ extern int fprintf(FILE * __restrict _fp, const char * __restrict _format, ...) __attribute__((__format__ (__printf__, 2, 3))); extern int fscanf(FILE * __restrict _fp, const char * __restrict _fmt, ...) __attribute__((__format__ (__scanf__, 2, 3))); extern int printf(const char * __restrict _format, ...) __attribute__((__format__ (__printf__, 1, 2))); extern int scanf(const char * __restrict _fmt, ...) __attribute__((__format__ (__scanf__, 1, 2))); extern int sprintf(char * __restrict _string, const char * __restrict _format, ...) __attribute__((__format__ (__printf__, 2, 3))); extern int snprintf(char * __restrict _string, size_t _n, const char * __restrict _format, ...) __attribute__((__format__ (__printf__, 3, 4))); extern int sscanf(const char * __restrict _str, const char * __restrict _fmt, ...) __attribute__((__format__ (__scanf__, 2, 3))); extern int vfprintf(FILE * __restrict _fp, const char * __restrict _format, va_list _ap) __attribute__((__format__ (__printf__, 2, 0))); extern int vfscanf(FILE * __restrict _fp, const char * __restrict _fmt, va_list _ap) __attribute__((__format__ (__scanf__, 2, 0))); extern int vprintf(const char * __restrict _format, va_list _ap) __attribute__((__format__ (__printf__, 1, 0))); extern int vscanf(const char * __restrict _format, va_list _ap) __attribute__((__format__ (__scanf__, 1, 0))); extern int vsprintf(char * __restrict _string, const char * __restrict _format, va_list _ap) __attribute__((__format__ (__printf__, 2, 0))); extern int vsnprintf(char * __restrict _string, size_t _n, const char * __restrict _format, va_list _ap) __attribute__((__format__ (__printf__, 3, 0))); extern int vsscanf(const char * __restrict _str, const char * __restrict _fmt, va_list _ap) __attribute__((__format__ (__scanf__, 2, 0))); extern int asprintf(char **, const char *, ...) __attribute__((__format__ (__printf__, 2, 3))); extern int vasprintf(char **, const char *, va_list) __attribute__((__format__ (__printf__, 2, 0))); /****************************************************************************/ /* CHARACTER INPUT/OUTPUT FUNCTIONS */ /****************************************************************************/ extern int fgetc(FILE *_fp); extern char *fgets(char * __restrict _ptr, int _size, FILE * __restrict _fp); extern int fputc(int _c, FILE *_fp); extern int fputs(const char * __restrict _ptr, FILE * __restrict _fp); extern int getc(FILE *_p); extern int getchar(void); extern char *gets(char *_ptr); extern int putc(int _x, FILE *_fp); extern int putchar(int _x); extern int puts(const char *_ptr); extern int ungetc(int _c, FILE *_fp); /****************************************************************************/ /* DIRECT INPUT/OUTPUT FUNCTIONS */ /****************************************************************************/ extern size_t fread(void * __restrict _ptr, size_t _size, size_t _count, FILE * __restrict _fp); extern size_t fwrite(const void * __restrict _ptr, size_t _size, size_t _count, FILE * __restrict _fp); /****************************************************************************/ /* FILE POSITIONING FUNCTIONS */ /****************************************************************************/ extern int fgetpos(FILE * __restrict _fp, fpos_t * __restrict _pos); extern int fseek(FILE *_fp, long _offset, int _ptrname); extern int fsetpos(FILE * __restrict _fp, const fpos_t * __restrict _pos); extern long ftell(FILE *_fp); extern void rewind(FILE *_fp); /****************************************************************************/ /* ERROR-HANDLING FUNCTIONS */ /****************************************************************************/ extern void clearerr(FILE *_fp); extern int feof(FILE *_fp); extern int ferror(FILE *_fp); extern void perror(const char *_s); #pragma diag_pop /*----------------------------------------------------------------------------*/ /* If sys/cdefs.h is available, go ahead and include it. xlocale.h assumes */ /* this file will have already included sys/cdefs.h. */ /*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /* Include xlocale/_stdio.h if xlocale.h has already been included. This is */ /* to conform with FreeBSD's xlocale implementation. */ /*----------------------------------------------------------------------------*/ /*****************************************************************************/ /* stdlib.h */ /* */ /* Copyright (c) 1993 Texas Instruments Incorporated */ /* http://www.ti.com/ */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions */ /* are met: */ /* */ /* Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* */ /* Redistributions in binary form must reproduce the above copyright */ /* notice, this list of conditions and the following disclaimer in */ /* the documentation and/or other materials provided with the */ /* distribution. */ /* */ /* Neither the name of Texas Instruments Incorporated nor the names */ /* of its contributors may be used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */ /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */ /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */ /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */ /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */ /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /*****************************************************************************/ #pragma diag_push #pragma CHECK_MISRA("-6.3") /* standard types required for standard headers */ #pragma CHECK_MISRA("-8.5") /* need to define inline function */ #pragma CHECK_MISRA("-19.1") /* #includes required for implementation */ #pragma CHECK_MISRA("-19.7") /* need function-like macros */ #pragma CHECK_MISRA("-20.1") /* standard headers must define standard names */ #pragma CHECK_MISRA("-20.2") /* standard headers must define standard names */ /*---------------------------------------------------------------------------*/ /* Attributes are only available in relaxed ANSI mode. */ /*---------------------------------------------------------------------------*/ #pragma diag_push #pragma CHECK_MISRA("-5.7") /* keep names intact */ typedef struct { int quot, rem; } div_t; typedef struct { long quot, rem; } ldiv_t; typedef struct { long long quot, rem; } lldiv_t; #pragma diag_pop typedef unsigned long wchar_t; /*---------------------------------------------------------------*/ /* NOTE - Normally, abs, labs, and fabs are expanded inline, so */ /* no formal definition is really required. However, ANSI */ /* requires that they exist as separate functions, so */ /* they are supplied in the library. The prototype is */ /* here mainly for documentation. */ /*---------------------------------------------------------------*/ #pragma diag_push #pragma CHECK_MISRA("-16.4") /* false positives due to builtin declarations */ int abs(int _val); long labs(long _val); long long llabs(long long _val); #pragma diag_pop int atoi(const char *_st); long atol(const char *_st); long long atoll(const char *_st); int ltoa(long val, char *buffer); extern double atof(const char *_st); long strtol(const char * __restrict _st, char ** __restrict _endptr, int _base); unsigned long strtoul(const char * __restrict _st, char ** __restrict _endptr, int _base); long long strtoll(const char * __restrict _st, char ** __restrict _endptr, int _base); unsigned long long strtoull(const char * __restrict _st, char ** __restrict _endptr, int _base); float strtof(const char * __restrict _st, char ** __restrict _endptr); double strtod(const char * __restrict _st, char ** __restrict _endptr); long double strtold(const char * __restrict _st, char ** __restrict _endptr); int rand(void); void srand(unsigned _seed); void *calloc(size_t _num, size_t _size) __attribute__((malloc)); void *malloc(size_t _size) __attribute__((malloc)); void *realloc(void *_ptr, size_t _size); void free(void *_ptr); void *memalign(size_t _aln, size_t _size) __attribute__((malloc)); void *aligned_alloc(size_t _aln, size_t _size) __attribute__((malloc)); void __TI_heap_stats(void); void *__TI_heap_check(void); size_t __TI_heap_total_available(void); size_t __TI_heap_largest_available(void); __attribute__((noreturn)) void abort(void) ; typedef void (*__TI_atexit_fn)(void); int atexit(__TI_atexit_fn _func) ; typedef int (*__TI_compar_fn)(const void *_a,const void *_b); void *bsearch(const void *_key, const void *_base, size_t _nmemb, size_t _size, __TI_compar_fn compar); void qsort(void *_base, size_t _nmemb, size_t _size, __TI_compar_fn compar); __attribute__((noreturn)) void exit(int _status); __attribute__((noreturn)) void _Exit(int _status); __attribute__((noreturn)) void quick_exit(int _status); int at_quick_exit(__TI_atexit_fn _func) ; div_t div(int _numer, int _denom); ldiv_t ldiv(long _numer, long _denom); lldiv_t lldiv(long long _numer, long long _denom); char *getenv(const char *_string); int system(const char *_name); int mblen(const char *_s, size_t _n); size_t mbstowcs(wchar_t * __restrict _dest, const char * __restrict _src, size_t _n); int mbtowc(wchar_t * __restrict _dest, const char * __restrict _src, size_t _n); size_t wcstombs(char * __restrict _dest, const wchar_t * __restrict _src, size_t _n); int wctomb(char *_s, wchar_t _wc); /* C2000-specific additions to header implemented with #include */ /*****************************************************************************/ /* stdlibf.h */ /* far versions of stdlib.h functions */ /* */ /* Copyright (c) 1996 Texas Instruments Incorporated */ /* http://www.ti.com/ */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions */ /* are met: */ /* */ /* Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* */ /* Redistributions in binary form must reproduce the above copyright */ /* notice, this list of conditions and the following disclaimer in */ /* the documentation and/or other materials provided with the */ /* distribution. */ /* */ /* Neither the name of Texas Instruments Incorporated nor the names */ /* of its contributors may be used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */ /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */ /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */ /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */ /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */ /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /*****************************************************************************/ #pragma diag_push #pragma CHECK_MISRA("-6.3") #pragma diag_pop #pragma diag_push #pragma CHECK_MISRA("-19.4") /* Macros needed to retarget builtins */ ldiv_t __attribute__((builtin)) __euclidean_div_i32byu32(long numerator, unsigned long denominator); /*****************************************************************************/ /* These two structures are unsigned analogues of ldiv_t and lldiv_t. */ /* They are used only by the fast integer division intrinsics */ /*****************************************************************************/ #pragma diag_push #pragma CHECK_MISRA("-5.7") /* Must have equivalent field names to ldiv_t and lldiv_t for usability */ typedef struct { unsigned long quot; unsigned long rem; } __uldiv_t; typedef struct { unsigned long long quot; unsigned long long rem; } __ulldiv_t; #pragma diag_pop /*****************************************************************************/ /* NOTE: The result of division between two unsigned values does not vary */ /* between traditional, euclidean, and modulo versions. Thus, only */ /* traditional versions are provided for unsigned inputs */ /*****************************************************************************/ /* 16-bit by 16-bit */ ldiv_t __attribute__((builtin)) __traditional_div_i16byi16(int numerator, int denominator); ldiv_t __attribute__((builtin)) __euclidean_div_i16byi16(int numerator, int denominator); ldiv_t __attribute__((builtin)) __modulo_div_i16byi16(int numerator, int denominator); __uldiv_t __attribute__((builtin)) __traditional_div_u16byu16(unsigned int numerator, unsigned int denominator); /* 32-bit by 32-bit */ ldiv_t __attribute__((builtin)) __traditional_div_i32byi32(long numerator, long denominator); ldiv_t __attribute__((builtin)) __euclidean_div_i32byi32(long numerator, long denominator); ldiv_t __attribute__((builtin)) __modulo_div_i32byi32(long numerator, long denominator); ldiv_t __attribute__((builtin)) __traditional_div_i32byu32(long numerator, unsigned long denominator); /* Declared above for all C200 targets */ /* ldiv_t __attribute__((builtin)) __euclidean_div_i32byu32(long numerator, unsigned long denominator); */ ldiv_t __attribute__((builtin)) __modulo_div_i32byu32(long numerator, unsigned long denominator); __uldiv_t __attribute__((builtin)) __traditional_div_u32byu32(unsigned long numerator, unsigned long denominator); /* 32-bit by 16-bit */ ldiv_t __attribute__((builtin)) __traditional_div_i32byi16(long numerator, int denominator); ldiv_t __attribute__((builtin)) __euclidean_div_i32byi16(long numerator, int denominator); ldiv_t __attribute__((builtin)) __modulo_div_i32byi16(long numerator, int denominator); __uldiv_t __attribute__((builtin)) __traditional_div_u32byu16(unsigned long numerator, unsigned int denominator); /* 64-bit by 64-bit */ lldiv_t __attribute__((builtin)) __traditional_div_i64byi64(long long numerator, long long denominator); lldiv_t __attribute__((builtin)) __euclidean_div_i64byi64(long long numerator, long long denominator); lldiv_t __attribute__((builtin)) __modulo_div_i64byi64(long long numerator, long long denominator); lldiv_t __attribute__((builtin)) __traditional_div_i64byu64(long long numerator, unsigned long long denominator); lldiv_t __attribute__((builtin)) __euclidean_div_i64byu64(long long numerator, unsigned long long denominator); lldiv_t __attribute__((builtin)) __modulo_div_i64byu64(long long numerator, unsigned long long denominator); __ulldiv_t __attribute__((builtin)) __traditional_div_u64byu64(unsigned long long numerator, unsigned long long denominator); /* 64-bit by 32-bit */ /* lldiv_t __attribute__((builtin)) __traditional_div_i64byi32(unsigned long long numerator, long denominator); lldiv_t __attribute__((builtin)) __euclidean_div_i64byi32(unsigned long long numerator, long denominator); lldiv_t __attribute__((builtin)) __modulo_div_i64byi32(unsigned long long numerator, long denominator); lldiv_t __attribute__((builtin)) __traditional_div_i64byu32(unsigned long long numerator, unsigned long denominator); lldiv_t __attribute__((builtin)) __euclidean_div_i64byu32(unsigned long long numerator, unsigned long denominator); lldiv_t __attribute__((builtin)) __modulo_div_i64byu32(unsigned long long numerator, unsigned long denominator); __ulldiv_t __attribute__((builtin)) __traditional_div_u64byu32(unsigned long long numerator, unsigned long denominator); */ /* ldiv and lldiv implementations using intrinsics. They are implemented using * inline functions so the address of the functions can be taken */ #pragma diag_push #pragma CHECK_MISRA("-5.6") /* We use a preprocessor macro to optimize ldiv and lldiv standard functions */ __inline ldiv_t __fast_ldiv(long _numer, long _denom); __inline ldiv_t __fast_ldiv(long _numer, long _denom) { return __traditional_div_i32byi32(_numer, _denom); } __inline lldiv_t __fast_lldiv(long long _numer, long long _denom); __inline lldiv_t __fast_lldiv(long long _numer, long long _denom) { return __traditional_div_i64byi64(_numer, _denom); } #pragma diag_pop #pragma diag_pop #pragma diag_pop #pragma diag_push #pragma CHECK_MISRA("-19.15") /* FreeBSD library requires code outside of the include guard */ /*----------------------------------------------------------------------------*/ /* If sys/cdefs.h is available, go ahead and include it. xlocale.h assumes */ /* this file will have already included sys/cdefs.h. */ /*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/ /* Include xlocale/_stdlib.h if xlocale.h has already been included. This */ /* comes from FreeBSD's stdlib.h. */ /*----------------------------------------------------------------------------*/ #pragma diag_pop /* * main.h * * Created on: Mar 31, 2020 * Author: Andy Fung */ /* * source.h * * Created on: Mar 30, 2020 * Author: Andy Fung */ enum DSPCommands { GetRevision = 1, StartChannel = 2, StopChannel = 3, Reset = 4, SetMCV = 5, SetExceedBehavior = 6, SetRampDetect = 7, SetCurrentSetPoint = 8, SetMode = 9, GetReadings = 10, GetErrors = 11, GetBoardStatus = 12, ClearErrors = 13, SetRampTime = 14, SetRampVoltage = 15, SetOCLevel = 16, InduceOC = 17, InduceBulkOC = 18, SetILsCoarse = 19, SetILsFine = 20, SetICoarseSense = 21, SetClampScale = 22, SetTempScale = 23, SetIHiScale = 24, SetVBulkScale = 25, SetCurrentRange = 26, SetCurrentRangeAuto = 27, InduceOV = 28, SetPTon = 29, SetPToff = 30, GetPTon = 31, GetPToff = 32, GetPM = 33, SetCompF = 34, SetCompR = 35, GetCompF = 36, GetCompR = 37, SetIFineSense = 38, SetVCoarse = 39, SetVFine = 40, SetIMaxCoarse = 41, SetIMaxFine = 42, SetVMaxCoarse = 43, SetVMaxFine = 44, SetSlaveMode = 45, SetBuckMode = 46, GetBuckMode = 47, SetLowVoltageMode = 48, GetLowVoltageMode = 49, SetILeakLimitForRamp = 50, SetILeakLimit = 51, SetIMin = 52, SetVMin = 53, SetPulseStagger = 54, GetPulseStagger = 55, SetPulseWidthAdjust = 56, GetPulseWidthAdjust = 57, SetNewPulseValues = 58, SetILimitHsForRamp = 59, SetVirtualChannelNum = 60, SetTriggerSlope = 61, SetloSetLowCurrRangeIB = 62, SetloSetLowCurrRangeIM = 63, SetloSetVeryLowCurrRangeIM = 64, SetloSetVeryLowCurrRangeIB = 65, SetloSetHighCurrRangeIB = 66, SetloSetHighCurrRangeIM = 67, SendPulseTrigger = 68, GetPulseReady = 69, SetTriggerSource = 70, SetBiasCurrent = 71, GetMaxClampReady = 72, SetStartSurgeClamp = 73, SetPulseCount = 74, GetStartPulseFlag = 75, SetZeroOutThresh = 76, SetAdjustLowScale = 77, SetAdjustHighScale = 78, SetSeqNew = 79, SetSeqStep = 80, // Note: not used yet. For future 1 packat sending of steps SetSeqEnd = 81, SetSeqStepP1 = 82, SetSeqStepP2 = 83, SetSeqStepP3 = 84, GetVoltRampComplete = 85, SetNumChans = 86, SetRemoteDisPol = 87, GetRemoteDisPol = 88, SetRemoteDisable = 89, GetRemoteDisable = 90, SetPulseTrigger = 91, // FB14454 Add trigger output on/off command SetPulseTrigDelay = 92, SetIHsOffset = 93, SetCurrRampRate = 94, SetVoltRampRate = 95, GetPulseWidthAdjDone = 96, SetPulseSync = 97, SetLongPulseOnTime = 98, SetLongPulseOffTime = 99, GetLongPulseOnTime = 100, GetLongPulseOffTime = 101, SetPulsedSweepStartCurrent = 102, SetPulsedSweepEndCurrent = 103, SetPulsedSweepNumSteps = 104, GetPulseEnd = 105, GetPulsedSweepCounter = 106, SendPulseSweepTrigger = 107, SetPulseWidthAdjOffset = 108, SetExtTrigDelay = 109, SetTriggerPolarity = 110, I2cStressTestCommand = 111, GetPulsedSweepPulses = 112, GetSwitchAllow = 113, GetCompChanged = 114 }; // This CommandTag has to be identical to the Commandtag in CM enum CommandTag { SystErrCmdTag = 0, MemTabReadCmdTag = 1 }; typedef struct{ uint16_t commandTag; void (*CmdFunction)(); }CommandElement; typedef struct{ uint16_t numCommand; CommandElement commandArray[200]; }Command; typedef struct{ Command sourceCommand; }Source; typedef struct { uint16_t bulkVoltage[2]; uint16_t heatSinkA[2]; uint16_t heatSinkB[2]; }BoardStatusBytes; typedef struct OutputReads { uint16_t vRead[2]; uint16_t iRead[2]; } OutputReads; void ExecSendReadings(void); void ExecEventQueueCheck(void); uint16_t CommandsAdd(Source *source, enum CommandTag cmdTag, void (*CmdExec)()); void InitCommandArray(Source *source); /* * i2cModule.h * * Created on: Mar 30, 2020 * Author: Andy Fung */ // // Error messages for read and write functions // void initI2C(void); uint16_t I2CWrite(uint16_t *msgBuf, uint16_t sendlen, uint16_t receiveLen, char *receiveBuf); __interrupt void i2cAISR(void); #pragma DATA_SECTION(msgBuf, "MSGRAM_CPU_TO_CM") uint16_t msgBuf[100]; uint16_t revBuf[100]; //#pragma DATA_SECTION(tempBuf, "RAMLS5_VAR") //uint16_t tempBuf[50]; char* const chanStrings[] = {"(CH1", "(CH2", "(CH3", "(CH4", "(CH5", "(CH6", "(CH7", "(CH8"}; char* const tempStrings[] = {"(T1", "(T2", "(T3", "(T4"}; extern IPC_MessageQueue_t rxMessageQueue, txMessageQueue; extern IPC_Message_t TxMsg, RxMsg; void ExecSendReadings(void) { uint16_t cmdBuf[8]; BoardStatusBytes boardStatusBytes; OutputReads outputReads; uint16_t iRead, vRead; uint16_t bulkV; uint16_t temperature1, temperature2; uint16_t tempBuf[50]; sprintf((char *)tempBuf, "(BULK %.1f) ", 0.123); memset(cmdBuf, 0, sizeof(cmdBuf)); memset(revBuf, 0, sizeof(revBuf)); cmdBuf[0] = GetMaxClampReady; I2CWrite(cmdBuf, 8, 2, (char *)revBuf); memset(cmdBuf, 0, sizeof(cmdBuf)); memset(revBuf, 0, sizeof(revBuf)); cmdBuf[0] = GetVoltRampComplete; I2CWrite(cmdBuf, 8, 2, (char *)revBuf); memset(cmdBuf, 0, sizeof(cmdBuf)); memset(revBuf, 0, sizeof(revBuf)); cmdBuf[0] = GetReadings; I2CWrite(cmdBuf, 8, 4, (char *)&outputReads); memset(cmdBuf, 0, sizeof(cmdBuf)); memset(revBuf, 0, sizeof(revBuf)); cmdBuf[0] = GetBoardStatus; I2CWrite(cmdBuf, 8, 6, (char *)&boardStatusBytes); iRead = outputReads.iRead[0] | outputReads.iRead[1] << 8; vRead = outputReads.vRead[0] | outputReads.vRead[1] << 8; bulkV = boardStatusBytes.bulkVoltage[0] | boardStatusBytes.bulkVoltage[1] << 8; temperature1 = boardStatusBytes.heatSinkA[0] | boardStatusBytes.heatSinkA[1] << 8; temperature2 = boardStatusBytes.heatSinkB[0] | boardStatusBytes.heatSinkB[1] << 8; // bulkVoltage = (float)(bulkV) * 297/65535; // heatSinkA = (float)(temperature1) * 300/65535; // heatSinkB = (float)(temperature2) * 300/65535; memset(msgBuf, 0, sizeof(msgBuf)); msgBuf[0] = iRead; msgBuf[1] = vRead; msgBuf[2] = bulkV; msgBuf[3] = temperature1; msgBuf[4] = temperature2; // Clear any IPC flags if set already IPC_clearFlagLtoR(IPC_CPU1_L_CM_R, 0xFFFFFFFFU); // Initialize message queue IPC_initMessageQueue(IPC_CPU1_L_CM_R, &txMessageQueue, 0x1U, 0x1U); TxMsg.command = MemTabReadCmdTag; TxMsg.address = (uint32_t)msgBuf; TxMsg.dataw1 = 5; // Using dataw1 as data length TxMsg.dataw2 = 5; // Message identifier IPC_sendMessageToQueue(IPC_CPU1_L_CM_R, &txMessageQueue, 1, &TxMsg, 1); } void ExecEventQueueCheck(void) { } uint16_t CommandsAdd(Source *source, enum CommandTag cmdTag, void (*CmdExec)()) { uint16_t cmdIndex; cmdIndex = source->sourceCommand.numCommand; if(0xFFFF != source->sourceCommand.commandArray[cmdTag].commandTag || cmdIndex > 200) { return 0; } source->sourceCommand.commandArray[cmdTag].commandTag = cmdTag; source->sourceCommand.commandArray[cmdTag].CmdFunction = CmdExec; source->sourceCommand.numCommand++; return 1; } void InitCommandArray(Source *source) { uint16_t i; source->sourceCommand.numCommand = 0; for(i=0; i<200; i++) { source->sourceCommand.commandArray[i].commandTag = 0xFFFF; source->sourceCommand.commandArray[i].CmdFunction = 0; } }