Симуляция генерации синусоидального шим и управление по модбас
note: - модбас не моделируется, в s-function просто передаются константы режимов. - лишние файлы убраны в outdate. - два канала одной фазы переключаются немного криво: на один такт симуляции проскакивает высокий уровень предыдущего канала и только потом включается текущий канал
This commit is contained in:
292
MCU_STM32F4xx_Matlab/Drivers/CMSIS/arm_defines.h
Normal file
292
MCU_STM32F4xx_Matlab/Drivers/CMSIS/arm_defines.h
Normal file
@@ -0,0 +1,292 @@
|
||||
#define __disable_irq()
|
||||
|
||||
#ifndef __ASM
|
||||
#define __ASM __asm
|
||||
#endif
|
||||
|
||||
#ifndef __IO
|
||||
#define __IO volatile
|
||||
#endif
|
||||
|
||||
#ifndef __inline
|
||||
#define __inline inline
|
||||
#endif
|
||||
#ifndef __INLINE
|
||||
#define __INLINE __inline
|
||||
#endif
|
||||
|
||||
#ifndef __STATIC_INLINE
|
||||
#define __STATIC_INLINE static __inline
|
||||
#endif
|
||||
|
||||
#ifndef __STATIC_FORCEINLINE
|
||||
#define __STATIC_FORCEINLINE static __forceinline
|
||||
#endif
|
||||
|
||||
#ifndef __NO_RETURN
|
||||
#define __NO_RETURN __declspec(noreturn)
|
||||
#endif
|
||||
|
||||
#ifndef __USED
|
||||
#define __USED __attribute__((used))
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef __WEAK
|
||||
#define __WEAK __declspec(selectany)
|
||||
// #define __weak __WEAK
|
||||
#endif
|
||||
|
||||
#ifndef __PACKED
|
||||
#define __PACKED __attribute__((packed))
|
||||
#endif
|
||||
|
||||
#ifndef __PACKED_STRUCT
|
||||
#define __PACKED_STRUCT __packed struct
|
||||
#endif
|
||||
|
||||
#ifndef __PACKED_UNION
|
||||
#define __PACKED_UNION __packed union
|
||||
#endif
|
||||
|
||||
#ifndef __UNALIGNED_UINT32 /* deprecated */
|
||||
#define __UNALIGNED_UINT32(x) (*((__packed uint32_t *)(x)))
|
||||
#endif
|
||||
|
||||
#ifndef __UNALIGNED_UINT16_WRITE
|
||||
#define __UNALIGNED_UINT16_WRITE(addr, val) ((*((__packed uint16_t *)(addr))) = (val))
|
||||
#endif
|
||||
|
||||
#ifndef __UNALIGNED_UINT16_READ
|
||||
#define __UNALIGNED_UINT16_READ(addr) (*((const __packed uint16_t *)(addr)))
|
||||
#endif
|
||||
|
||||
#ifndef __UNALIGNED_UINT32_WRITE
|
||||
#define __UNALIGNED_UINT32_WRITE(addr, val) ((*((__packed uint32_t *)(addr))) = (val))
|
||||
#endif
|
||||
|
||||
#ifndef __UNALIGNED_UINT32_READ
|
||||
#define __UNALIGNED_UINT32_READ(addr) (*((const __packed uint32_t *)(addr)))
|
||||
#endif
|
||||
|
||||
#ifndef __ALIGNED
|
||||
#define __ALIGNED(x) __attribute__((aligned(x)))
|
||||
#endif
|
||||
|
||||
#ifndef __RESTRICT
|
||||
#define __RESTRICT __restrict
|
||||
#endif
|
||||
|
||||
#ifndef __weak
|
||||
#define __weak
|
||||
#endif
|
||||
//#define __ASM()
|
||||
//#define __DSB()
|
||||
//#define __ISB()
|
||||
//#define __NOP()
|
||||
//#define __WFI()
|
||||
//#define __SEV()
|
||||
//#define __WFE()
|
||||
//#define __DMB()
|
||||
|
||||
|
||||
|
||||
/**
|
||||
\brief No Operation
|
||||
\details No Operation does nothing. This instruction can be used for code alignment purposes.
|
||||
*/
|
||||
#define __NOP()
|
||||
/**
|
||||
\brief Wait For Interrupt
|
||||
\details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs.
|
||||
*/
|
||||
#define __WFI()
|
||||
|
||||
/**
|
||||
\brief Wait For Event
|
||||
\details Wait For Event is a hint instruction that permits the processor to enter
|
||||
a low-power state until one of a number of events occurs.
|
||||
*/
|
||||
#define __WFE()
|
||||
|
||||
/**
|
||||
\brief Send Event
|
||||
\details Send Event is a hint instruction. It causes an event to be signaled to the CPU.
|
||||
*/
|
||||
#define __SEV()
|
||||
|
||||
/**
|
||||
\brief Instruction Synchronization Barrier
|
||||
\details Instruction Synchronization Barrier flushes the pipeline in the processor,
|
||||
so that all instructions following the ISB are fetched from cache or memory,
|
||||
after the instruction has been completed.
|
||||
*/
|
||||
#define __ISB()
|
||||
|
||||
/**
|
||||
\brief Data Synchronization Barrier
|
||||
\details Acts as a special kind of Data Memory Barrier.
|
||||
It completes when all explicit memory accesses before this instruction complete.
|
||||
*/
|
||||
#define __DSB()
|
||||
|
||||
|
||||
/**
|
||||
\brief Data Memory Barrier
|
||||
\details Ensures the apparent order of the explicit memory operations before
|
||||
and after the instruction, without ensuring their completion.
|
||||
*/
|
||||
#define __DMB()
|
||||
|
||||
|
||||
/**
|
||||
\brief Reverse byte order (32 bit)
|
||||
\details Reverses the byte order in unsigned integer value. For example, 0x12345678 becomes 0x78563412.
|
||||
\param [in] value Value to reverse
|
||||
\return Reversed value
|
||||
*/
|
||||
#define __REV(value) value
|
||||
|
||||
|
||||
/**
|
||||
\brief Reverse byte order (16 bit)
|
||||
\details Reverses the byte order within each halfword of a word. For example, 0x12345678 becomes 0x34127856.
|
||||
\param [in] value Value to reverse
|
||||
\return Reversed value
|
||||
*/
|
||||
#define __REV16(value) value
|
||||
|
||||
|
||||
/**
|
||||
\brief Reverse byte order (16 bit)
|
||||
\details Reverses the byte order in a 16-bit value and returns the signed 16-bit result. For example, 0x0080 becomes 0x8000.
|
||||
\param [in] value Value to reverse
|
||||
\return Reversed value
|
||||
*/
|
||||
#define __REVSH(value) value
|
||||
|
||||
|
||||
/**
|
||||
\brief Rotate Right in unsigned value (32 bit)
|
||||
\details Rotate Right (immediate) provides the value of the contents of a register rotated by a variable number of bits.
|
||||
\param [in] op1 Value to rotate
|
||||
\param [in] op2 Number of Bits to rotate
|
||||
\return Rotated value
|
||||
*/
|
||||
#define __ROR()
|
||||
|
||||
|
||||
/**
|
||||
\brief Breakpoint
|
||||
\details Causes the processor to enter Debug state.
|
||||
Debug tools can use this to investigate system state when the instruction at a particular address is reached.
|
||||
\param [in] value is ignored by the processor.
|
||||
If required, a debugger can use it to store additional information about the breakpoint.
|
||||
*/
|
||||
#define __BKPT(value) value
|
||||
|
||||
|
||||
/**
|
||||
\brief Reverse bit order of value
|
||||
\details Reverses the bit order of the given value.
|
||||
\param [in] value Value to reverse
|
||||
\return Reversed value
|
||||
*/
|
||||
#define __RBIT() _byteswap_ulong(_rotr(value, 16))
|
||||
|
||||
/**
|
||||
\brief Count leading zeros
|
||||
\details Counts the number of leading zeros of a data value.
|
||||
\param [in] value Value to count the leading zeros
|
||||
\return number of leading zeros in value
|
||||
*/
|
||||
#define __CLZ() __lzcnt(value)
|
||||
|
||||
|
||||
/**
|
||||
\brief LDR Exclusive (8 bit)
|
||||
\details Executes a exclusive LDR instruction for 8 bit value.
|
||||
\param [in] ptr Pointer to data
|
||||
\return value of type uint8_t at (*ptr)
|
||||
*/
|
||||
#define __LDREXB(ptr) (*(volatile uint8_t *)(ptr))
|
||||
|
||||
|
||||
/**
|
||||
\brief LDR Exclusive (16 bit)
|
||||
\details Executes a exclusive LDR instruction for 16 bit values.
|
||||
\param [in] ptr Pointer to data
|
||||
\return value of type uint16_t at (*ptr)
|
||||
*/
|
||||
#define __LDREXH(ptr) (*(volatile uint16_t *)(ptr))
|
||||
|
||||
|
||||
/**
|
||||
\brief LDR Exclusive (32 bit)
|
||||
\details Executes a exclusive LDR instruction for 32 bit values.
|
||||
\param [in] ptr Pointer to data
|
||||
\return value of type uint32_t at (*ptr)
|
||||
*/
|
||||
#define __LDREXW(ptr) (*(volatile uint32_t *)(ptr))
|
||||
|
||||
|
||||
/**
|
||||
\brief STR Exclusive (8 bit)
|
||||
\details Executes a exclusive STR instruction for 8 bit values.
|
||||
\param [in] value Value to store
|
||||
\param [in] ptr Pointer to location
|
||||
\return 0 Function succeeded
|
||||
\return 1 Function failed
|
||||
*/
|
||||
#define __STREXB(value, ptr) (*(volatile uint8_t *)(ptr) = (value), 0)
|
||||
|
||||
|
||||
/**
|
||||
\brief STR Exclusive (16 bit)
|
||||
\details Executes a exclusive STR instruction for 16 bit values.
|
||||
\param [in] value Value to store
|
||||
\param [in] ptr Pointer to location
|
||||
\return 0 Function succeeded
|
||||
\return 1 Function failed
|
||||
*/
|
||||
#define __STREXH(value, ptr) (*(volatile uint16_t *)(ptr) = (value), 0)
|
||||
|
||||
|
||||
/**
|
||||
\brief STR Exclusive (32 bit)
|
||||
\details Executes a exclusive STR instruction for 32 bit values.
|
||||
\param [in] value Value to store
|
||||
\param [in] ptr Pointer to location
|
||||
\return 0 Function succeeded
|
||||
\return 1 Function failed
|
||||
*/
|
||||
#define __STREXW(value, ptr) (*(volatile uint32_t *)(ptr) = (value), 0)
|
||||
|
||||
|
||||
/**
|
||||
\brief Remove the exclusive lock
|
||||
\details Removes the exclusive lock which is created by LDREX.
|
||||
*/
|
||||
#define __CLREX
|
||||
|
||||
|
||||
|
||||
/**
|
||||
\brief Signed Saturate
|
||||
\details Saturates a signed value.
|
||||
\param [in] value Value to be saturated
|
||||
\param [in] sat Bit position to saturate to (1..32)
|
||||
\return Saturated value
|
||||
*/
|
||||
#define __SSAT
|
||||
|
||||
|
||||
/**
|
||||
\brief Unsigned Saturate
|
||||
\details Saturates an unsigned value.
|
||||
\param [in] value Value to be saturated
|
||||
\param [in] sat Bit position to saturate to (0..31)
|
||||
\return Saturated value
|
||||
*/
|
||||
#define __USAT
|
||||
|
||||
1942
MCU_STM32F4xx_Matlab/Drivers/CMSIS/core_cm4_matlab.h
Normal file
1942
MCU_STM32F4xx_Matlab/Drivers/CMSIS/core_cm4_matlab.h
Normal file
File diff suppressed because it is too large
Load Diff
311
MCU_STM32F4xx_Matlab/Drivers/CMSIS/stdint.h
Normal file
311
MCU_STM32F4xx_Matlab/Drivers/CMSIS/stdint.h
Normal file
@@ -0,0 +1,311 @@
|
||||
/* Copyright (C) ARM Ltd., 1999,2014 */
|
||||
/* All rights reserved */
|
||||
|
||||
/*
|
||||
* RCS $Revision$
|
||||
* Checkin $Date$
|
||||
* Revising $Author: agrant $
|
||||
*/
|
||||
|
||||
#ifndef __stdint_h
|
||||
#define __stdint_h
|
||||
#define __ARMCLIB_VERSION 6190004
|
||||
|
||||
#ifdef __INT64_TYPE__
|
||||
/* armclang predefines '__INT64_TYPE__' and '__INT64_C_SUFFIX__' */
|
||||
#define __INT64 __INT64_TYPE__
|
||||
#else
|
||||
/* armcc has builtin '__int64' which can be used in --strict mode */
|
||||
#define __INT64 __int64
|
||||
#define __INT64_C_SUFFIX__ ll
|
||||
#endif
|
||||
#define __PASTE2(x, y) x ## y
|
||||
#define __PASTE(x, y) __PASTE2(x, y)
|
||||
#define __INT64_C(x) __ESCAPE__(__PASTE(x, __INT64_C_SUFFIX__))
|
||||
#define __UINT64_C(x) __ESCAPE__(__PASTE(x ## u, __INT64_C_SUFFIX__))
|
||||
#if defined(__clang__) || (defined(__ARMCC_VERSION) && !defined(__STRICT_ANSI__))
|
||||
/* armclang and non-strict armcc allow 'long long' in system headers */
|
||||
#define __LONGLONG long long
|
||||
#else
|
||||
/* strict armcc has '__int64' */
|
||||
#define __LONGLONG __int64
|
||||
#endif
|
||||
|
||||
#ifndef __STDINT_DECLS
|
||||
#define __STDINT_DECLS
|
||||
|
||||
#undef __CLIBNS
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace std {
|
||||
#define __CLIBNS std::
|
||||
extern "C" {
|
||||
#else
|
||||
#define __CLIBNS
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/*
|
||||
* 'signed' is redundant below, except for 'signed char' and if
|
||||
* the typedef is used to declare a bitfield.
|
||||
*/
|
||||
|
||||
/* 7.18.1.1 */
|
||||
|
||||
/* exact-width signed integer types */
|
||||
typedef signed char int8_t;
|
||||
typedef signed short int int16_t;
|
||||
typedef signed int int32_t;
|
||||
typedef signed __INT64 int64_t;
|
||||
|
||||
/* exact-width unsigned integer types */
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short int uint16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef unsigned __INT64 uint64_t;
|
||||
|
||||
/* 7.18.1.2 */
|
||||
|
||||
/* smallest type of at least n bits */
|
||||
/* minimum-width signed integer types */
|
||||
typedef signed char int_least8_t;
|
||||
typedef signed short int int_least16_t;
|
||||
typedef signed int int_least32_t;
|
||||
typedef signed __INT64 int_least64_t;
|
||||
|
||||
/* minimum-width unsigned integer types */
|
||||
typedef unsigned char uint_least8_t;
|
||||
typedef unsigned short int uint_least16_t;
|
||||
typedef unsigned int uint_least32_t;
|
||||
typedef unsigned __INT64 uint_least64_t;
|
||||
|
||||
/* 7.18.1.3 */
|
||||
|
||||
/* fastest minimum-width signed integer types */
|
||||
typedef signed int int_fast8_t;
|
||||
typedef signed int int_fast16_t;
|
||||
typedef signed int int_fast32_t;
|
||||
typedef signed __INT64 int_fast64_t;
|
||||
|
||||
/* fastest minimum-width unsigned integer types */
|
||||
typedef unsigned int uint_fast8_t;
|
||||
typedef unsigned int uint_fast16_t;
|
||||
typedef unsigned int uint_fast32_t;
|
||||
typedef unsigned __INT64 uint_fast64_t;
|
||||
|
||||
/* 7.18.1.4 integer types capable of holding object pointers */
|
||||
#if __sizeof_ptr == 8
|
||||
typedef signed __INT64 intptr_t;
|
||||
typedef unsigned __INT64 uintptr_t;
|
||||
#else
|
||||
typedef signed int intptr_t;
|
||||
typedef unsigned int uintptr_t;
|
||||
#endif
|
||||
|
||||
/* 7.18.1.5 greatest-width integer types */
|
||||
typedef signed __LONGLONG intmax_t;
|
||||
typedef unsigned __LONGLONG uintmax_t;
|
||||
|
||||
|
||||
#if !defined(__cplusplus) || defined(__USE_C99_ALL) || 201103L <= __cplusplus || defined(__STDC_LIMIT_MACROS)
|
||||
|
||||
/* 7.18.2.1 */
|
||||
|
||||
/* minimum values of exact-width signed integer types */
|
||||
#define INT8_MIN -128
|
||||
#define INT16_MIN -32768
|
||||
#define INT32_MIN (~0x7fffffff) /* -2147483648 is unsigned */
|
||||
#define INT64_MIN __INT64_C(~0x7fffffffffffffff) /* -9223372036854775808 is unsigned */
|
||||
|
||||
/* maximum values of exact-width signed integer types */
|
||||
#define INT8_MAX 127
|
||||
#define INT16_MAX 32767
|
||||
#define INT32_MAX 2147483647
|
||||
#define INT64_MAX __INT64_C(9223372036854775807)
|
||||
|
||||
/* maximum values of exact-width unsigned integer types */
|
||||
#define UINT8_MAX 255
|
||||
#define UINT16_MAX 65535
|
||||
#define UINT32_MAX 4294967295u
|
||||
#define UINT64_MAX __UINT64_C(18446744073709551615)
|
||||
|
||||
/* 7.18.2.2 */
|
||||
|
||||
/* minimum values of minimum-width signed integer types */
|
||||
#define INT_LEAST8_MIN -128
|
||||
#define INT_LEAST16_MIN -32768
|
||||
#define INT_LEAST32_MIN (~0x7fffffff)
|
||||
#define INT_LEAST64_MIN __INT64_C(~0x7fffffffffffffff)
|
||||
|
||||
/* maximum values of minimum-width signed integer types */
|
||||
#define INT_LEAST8_MAX 127
|
||||
#define INT_LEAST16_MAX 32767
|
||||
#define INT_LEAST32_MAX 2147483647
|
||||
#define INT_LEAST64_MAX __INT64_C(9223372036854775807)
|
||||
|
||||
/* maximum values of minimum-width unsigned integer types */
|
||||
#define UINT_LEAST8_MAX 255
|
||||
#define UINT_LEAST16_MAX 65535
|
||||
#define UINT_LEAST32_MAX 4294967295u
|
||||
#define UINT_LEAST64_MAX __UINT64_C(18446744073709551615)
|
||||
|
||||
/* 7.18.2.3 */
|
||||
|
||||
/* minimum values of fastest minimum-width signed integer types */
|
||||
#define INT_FAST8_MIN (~0x7fffffff)
|
||||
#define INT_FAST16_MIN (~0x7fffffff)
|
||||
#define INT_FAST32_MIN (~0x7fffffff)
|
||||
#define INT_FAST64_MIN __INT64_C(~0x7fffffffffffffff)
|
||||
|
||||
/* maximum values of fastest minimum-width signed integer types */
|
||||
#define INT_FAST8_MAX 2147483647
|
||||
#define INT_FAST16_MAX 2147483647
|
||||
#define INT_FAST32_MAX 2147483647
|
||||
#define INT_FAST64_MAX __INT64_C(9223372036854775807)
|
||||
|
||||
/* maximum values of fastest minimum-width unsigned integer types */
|
||||
#define UINT_FAST8_MAX 4294967295u
|
||||
#define UINT_FAST16_MAX 4294967295u
|
||||
#define UINT_FAST32_MAX 4294967295u
|
||||
#define UINT_FAST64_MAX __UINT64_C(18446744073709551615)
|
||||
|
||||
/* 7.18.2.4 */
|
||||
|
||||
/* minimum value of pointer-holding signed integer type */
|
||||
#if __sizeof_ptr == 8
|
||||
#define INTPTR_MIN INT64_MIN
|
||||
#else
|
||||
#define INTPTR_MIN INT32_MIN
|
||||
#endif
|
||||
|
||||
/* maximum value of pointer-holding signed integer type */
|
||||
#if __sizeof_ptr == 8
|
||||
#define INTPTR_MAX INT64_MAX
|
||||
#else
|
||||
#define INTPTR_MAX INT32_MAX
|
||||
#endif
|
||||
|
||||
/* maximum value of pointer-holding unsigned integer type */
|
||||
#if __sizeof_ptr == 8
|
||||
#define UINTPTR_MAX UINT64_MAX
|
||||
#else
|
||||
#define UINTPTR_MAX UINT32_MAX
|
||||
#endif
|
||||
|
||||
/* 7.18.2.5 */
|
||||
|
||||
/* minimum value of greatest-width signed integer type */
|
||||
#define INTMAX_MIN __ESCAPE__(~0x7fffffffffffffffll)
|
||||
|
||||
/* maximum value of greatest-width signed integer type */
|
||||
#define INTMAX_MAX __ESCAPE__(9223372036854775807ll)
|
||||
|
||||
/* maximum value of greatest-width unsigned integer type */
|
||||
#define UINTMAX_MAX __ESCAPE__(18446744073709551615ull)
|
||||
|
||||
/* 7.18.3 */
|
||||
|
||||
/* limits of ptrdiff_t */
|
||||
#if __sizeof_ptr == 8
|
||||
#define PTRDIFF_MIN INT64_MIN
|
||||
#define PTRDIFF_MAX INT64_MAX
|
||||
#else
|
||||
#define PTRDIFF_MIN INT32_MIN
|
||||
#define PTRDIFF_MAX INT32_MAX
|
||||
#endif
|
||||
|
||||
/* limits of sig_atomic_t */
|
||||
#define SIG_ATOMIC_MIN (~0x7fffffff)
|
||||
#define SIG_ATOMIC_MAX 2147483647
|
||||
|
||||
/* limit of size_t */
|
||||
#if __sizeof_ptr == 8
|
||||
#define SIZE_MAX UINT64_MAX
|
||||
#else
|
||||
#define SIZE_MAX UINT32_MAX
|
||||
#endif
|
||||
|
||||
/* limits of wchar_t */
|
||||
/* NB we have to undef and redef because they're defined in both
|
||||
* stdint.h and wchar.h */
|
||||
#undef WCHAR_MIN
|
||||
#undef WCHAR_MAX
|
||||
|
||||
#if defined(__WCHAR32) || (defined(__ARM_SIZEOF_WCHAR_T) && __ARM_SIZEOF_WCHAR_T == 4)
|
||||
#define WCHAR_MIN 0
|
||||
#define WCHAR_MAX 0xffffffffU
|
||||
#else
|
||||
#define WCHAR_MIN 0
|
||||
#define WCHAR_MAX 65535
|
||||
#endif
|
||||
|
||||
/* limits of wint_t */
|
||||
#define WINT_MIN (~0x7fffffff)
|
||||
#define WINT_MAX 2147483647
|
||||
|
||||
#endif /* __STDC_LIMIT_MACROS */
|
||||
|
||||
#if !defined(__cplusplus) || defined(__USE_C99_ALL) || 201103L <= __cplusplus || defined(__STDC_CONSTANT_MACROS)
|
||||
|
||||
/* 7.18.4.1 macros for minimum-width integer constants */
|
||||
#define INT8_C(x) (x)
|
||||
#define INT16_C(x) (x)
|
||||
#define INT32_C(x) (x)
|
||||
#define INT64_C(x) __INT64_C(x)
|
||||
|
||||
#define UINT8_C(x) (x ## u)
|
||||
#define UINT16_C(x) (x ## u)
|
||||
#define UINT32_C(x) (x ## u)
|
||||
#define UINT64_C(x) __UINT64_C(x)
|
||||
|
||||
/* 7.18.4.2 macros for greatest-width integer constants */
|
||||
#define INTMAX_C(x) __ESCAPE__(x ## ll)
|
||||
#define UINTMAX_C(x) __ESCAPE__(x ## ull)
|
||||
|
||||
#endif /* __STDC_CONSTANT_MACROS */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
} /* namespace std */
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __STDINT_DECLS */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifndef __STDINT_NO_EXPORTS
|
||||
using ::std::int8_t;
|
||||
using ::std::int16_t;
|
||||
using ::std::int32_t;
|
||||
using ::std::int64_t;
|
||||
using ::std::uint8_t;
|
||||
using ::std::uint16_t;
|
||||
using ::std::uint32_t;
|
||||
using ::std::uint64_t;
|
||||
using ::std::int_least8_t;
|
||||
using ::std::int_least16_t;
|
||||
using ::std::int_least32_t;
|
||||
using ::std::int_least64_t;
|
||||
using ::std::uint_least8_t;
|
||||
using ::std::uint_least16_t;
|
||||
using ::std::uint_least32_t;
|
||||
using ::std::uint_least64_t;
|
||||
using ::std::int_fast8_t;
|
||||
using ::std::int_fast16_t;
|
||||
using ::std::int_fast32_t;
|
||||
using ::std::int_fast64_t;
|
||||
using ::std::uint_fast8_t;
|
||||
using ::std::uint_fast16_t;
|
||||
using ::std::uint_fast32_t;
|
||||
using ::std::uint_fast64_t;
|
||||
using ::std::intptr_t;
|
||||
using ::std::uintptr_t;
|
||||
using ::std::intmax_t;
|
||||
using ::std::uintmax_t;
|
||||
#endif
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#undef __INT64
|
||||
#undef __LONGLONG
|
||||
|
||||
#endif /* __stdint_h */
|
||||
|
||||
/* end of stdint.h */
|
||||
15679
MCU_STM32F4xx_Matlab/Drivers/CMSIS/stm32f407xx_matlab.h
Normal file
15679
MCU_STM32F4xx_Matlab/Drivers/CMSIS/stm32f407xx_matlab.h
Normal file
File diff suppressed because it is too large
Load Diff
301
MCU_STM32F4xx_Matlab/Drivers/CMSIS/stm32f4xx.h
Normal file
301
MCU_STM32F4xx_Matlab/Drivers/CMSIS/stm32f4xx.h
Normal file
@@ -0,0 +1,301 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f4xx_matlab.h
|
||||
* @author MCD Application Team
|
||||
* @brief CMSIS STM32F4xx Device Peripheral Access Layer Header File.
|
||||
*
|
||||
* The file is the unique include file that the application programmer
|
||||
* is using in the C source code, usually in main.c. This file contains:
|
||||
* - Configuration section that allows to select:
|
||||
* - The STM32F4xx device used in the target application
|
||||
* - To use or not the peripheral's drivers in application code(i.e.
|
||||
* code will be based on direct access to peripheral's registers
|
||||
* rather than drivers API), this option is controlled by
|
||||
* "#define USE_HAL_DRIVER"
|
||||
*
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2017 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/** @addtogroup CMSIS
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup stm32f4xx
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef __STM32F4xx_H
|
||||
#define __STM32F4xx_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/** @addtogroup Library_configuration_section
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief STM32 Family
|
||||
*/
|
||||
#if !defined (STM32F4)
|
||||
#define STM32F4
|
||||
#endif /* STM32F4 */
|
||||
|
||||
/* Uncomment the line below according to the target STM32 device used in your
|
||||
application
|
||||
*/
|
||||
#if !defined (STM32F405xx) && !defined (STM32F415xx) && !defined (STM32F407xx) && !defined (STM32F417xx) && \
|
||||
!defined (STM32F427xx) && !defined (STM32F437xx) && !defined (STM32F429xx) && !defined (STM32F439xx) && \
|
||||
!defined (STM32F401xC) && !defined (STM32F401xE) && !defined (STM32F410Tx) && !defined (STM32F410Cx) && \
|
||||
!defined (STM32F410Rx) && !defined (STM32F411xE) && !defined (STM32F446xx) && !defined (STM32F469xx) && \
|
||||
!defined (STM32F479xx) && !defined (STM32F412Cx) && !defined (STM32F412Rx) && !defined (STM32F412Vx) && \
|
||||
!defined (STM32F412Zx) && !defined (STM32F413xx) && !defined (STM32F423xx)
|
||||
/* #define STM32F405xx */ /*!< STM32F405RG, STM32F405VG and STM32F405ZG Devices */
|
||||
/* #define STM32F415xx */ /*!< STM32F415RG, STM32F415VG and STM32F415ZG Devices */
|
||||
/* #define STM32F407xx */ /*!< STM32F407VG, STM32F407VE, STM32F407ZG, STM32F407ZE, STM32F407IG and STM32F407IE Devices */
|
||||
/* #define STM32F417xx */ /*!< STM32F417VG, STM32F417VE, STM32F417ZG, STM32F417ZE, STM32F417IG and STM32F417IE Devices */
|
||||
/* #define STM32F427xx */ /*!< STM32F427VG, STM32F427VI, STM32F427ZG, STM32F427ZI, STM32F427IG and STM32F427II Devices */
|
||||
/* #define STM32F437xx */ /*!< STM32F437VG, STM32F437VI, STM32F437ZG, STM32F437ZI, STM32F437IG and STM32F437II Devices */
|
||||
/* #define STM32F429xx */ /*!< STM32F429VG, STM32F429VI, STM32F429ZG, STM32F429ZI, STM32F429BG, STM32F429BI, STM32F429NG,
|
||||
STM32F439NI, STM32F429IG and STM32F429II Devices */
|
||||
/* #define STM32F439xx */ /*!< STM32F439VG, STM32F439VI, STM32F439ZG, STM32F439ZI, STM32F439BG, STM32F439BI, STM32F439NG,
|
||||
STM32F439NI, STM32F439IG and STM32F439II Devices */
|
||||
/* #define STM32F401xC */ /*!< STM32F401CB, STM32F401CC, STM32F401RB, STM32F401RC, STM32F401VB and STM32F401VC Devices */
|
||||
/* #define STM32F401xE */ /*!< STM32F401CD, STM32F401RD, STM32F401VD, STM32F401CE, STM32F401RE and STM32F401VE Devices */
|
||||
/* #define STM32F410Tx */ /*!< STM32F410T8 and STM32F410TB Devices */
|
||||
/* #define STM32F410Cx */ /*!< STM32F410C8 and STM32F410CB Devices */
|
||||
/* #define STM32F410Rx */ /*!< STM32F410R8 and STM32F410RB Devices */
|
||||
/* #define STM32F411xE */ /*!< STM32F411CC, STM32F411RC, STM32F411VC, STM32F411CE, STM32F411RE and STM32F411VE Devices */
|
||||
/* #define STM32F446xx */ /*!< STM32F446MC, STM32F446ME, STM32F446RC, STM32F446RE, STM32F446VC, STM32F446VE, STM32F446ZC,
|
||||
and STM32F446ZE Devices */
|
||||
/* #define STM32F469xx */ /*!< STM32F469AI, STM32F469II, STM32F469BI, STM32F469NI, STM32F469AG, STM32F469IG, STM32F469BG,
|
||||
STM32F469NG, STM32F469AE, STM32F469IE, STM32F469BE and STM32F469NE Devices */
|
||||
/* #define STM32F479xx */ /*!< STM32F479AI, STM32F479II, STM32F479BI, STM32F479NI, STM32F479AG, STM32F479IG, STM32F479BG
|
||||
and STM32F479NG Devices */
|
||||
/* #define STM32F412Cx */ /*!< STM32F412CEU and STM32F412CGU Devices */
|
||||
/* #define STM32F412Zx */ /*!< STM32F412ZET, STM32F412ZGT, STM32F412ZEJ and STM32F412ZGJ Devices */
|
||||
/* #define STM32F412Vx */ /*!< STM32F412VET, STM32F412VGT, STM32F412VEH and STM32F412VGH Devices */
|
||||
/* #define STM32F412Rx */ /*!< STM32F412RET, STM32F412RGT, STM32F412REY and STM32F412RGY Devices */
|
||||
/* #define STM32F413xx */ /*!< STM32F413CH, STM32F413MH, STM32F413RH, STM32F413VH, STM32F413ZH, STM32F413CG, STM32F413MG,
|
||||
STM32F413RG, STM32F413VG and STM32F413ZG Devices */
|
||||
/* #define STM32F423xx */ /*!< STM32F423CH, STM32F423RH, STM32F423VH and STM32F423ZH Devices */
|
||||
#endif
|
||||
|
||||
/* Tip: To avoid modifying this file each time you need to switch between these
|
||||
devices, you can define the device in your toolchain compiler preprocessor.
|
||||
*/
|
||||
#if !defined (USE_HAL_DRIVER)
|
||||
/**
|
||||
* @brief Comment the line below if you will not use the peripherals drivers.
|
||||
In this case, these drivers will not be included and the application code will
|
||||
be based on direct access to peripherals registers
|
||||
*/
|
||||
/*#define USE_HAL_DRIVER */
|
||||
#endif /* USE_HAL_DRIVER */
|
||||
|
||||
/**
|
||||
* @brief CMSIS version number V2.6.8
|
||||
*/
|
||||
#define __STM32F4xx_CMSIS_VERSION_MAIN (0x02U) /*!< [31:24] main version */
|
||||
#define __STM32F4xx_CMSIS_VERSION_SUB1 (0x06U) /*!< [23:16] sub1 version */
|
||||
#define __STM32F4xx_CMSIS_VERSION_SUB2 (0x08U) /*!< [15:8] sub2 version */
|
||||
#define __STM32F4xx_CMSIS_VERSION_RC (0x00U) /*!< [7:0] release candidate */
|
||||
#define __STM32F4xx_CMSIS_VERSION ((__STM32F4xx_CMSIS_VERSION_MAIN << 24)\
|
||||
|(__STM32F4xx_CMSIS_VERSION_SUB1 << 16)\
|
||||
|(__STM32F4xx_CMSIS_VERSION_SUB2 << 8 )\
|
||||
|(__STM32F4xx_CMSIS_VERSION_RC))
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup Device_Included
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if defined(STM32F405xx)
|
||||
#include "stm32f405xx_matlab.h"
|
||||
#elif defined(STM32F415xx)
|
||||
#include "stm32f415xx_matlab.h"
|
||||
#elif defined(STM32F407xx)
|
||||
#include "stm32f407xx_matlab.h"
|
||||
#elif defined(STM32F417xx)
|
||||
#include "stm32f417xx_matlab.h"
|
||||
#elif defined(STM32F427xx)
|
||||
#include "stm32f427xx_matlab.h"
|
||||
#elif defined(STM32F437xx)
|
||||
#include "stm32f437xx_matlab.h"
|
||||
#elif defined(STM32F429xx)
|
||||
#include "stm32f429xx_matlab.h"
|
||||
#elif defined(STM32F439xx)
|
||||
#include "stm32f439xx_matlab.h"
|
||||
#elif defined(STM32F401xC)
|
||||
#include "stm32f401xc_matlab.h"
|
||||
#elif defined(STM32F401xE)
|
||||
#include "stm32f401xe_matlab.h"
|
||||
#elif defined(STM32F410Tx)
|
||||
#include "stm32f410tx_matlab.h"
|
||||
#elif defined(STM32F410Cx)
|
||||
#include "stm32f410cx_matlab.h"
|
||||
#elif defined(STM32F410Rx)
|
||||
#include "stm32f410rx_matlab.h"
|
||||
#elif defined(STM32F411xE)
|
||||
#include "stm32f411xe_matlab.h"
|
||||
#elif defined(STM32F446xx)
|
||||
#include "stm32f446xx_matlab.h"
|
||||
#elif defined(STM32F469xx)
|
||||
#include "stm32f469xx_matlab.h"
|
||||
#elif defined(STM32F479xx)
|
||||
#include "stm32f479xx_matlab.h"
|
||||
#elif defined(STM32F412Cx)
|
||||
#include "stm32f412cx_matlab.h"
|
||||
#elif defined(STM32F412Zx)
|
||||
#include "stm32f412zx_matlab.h"
|
||||
#elif defined(STM32F412Rx)
|
||||
#include "stm32f412rx_matlab.h"
|
||||
#elif defined(STM32F412Vx)
|
||||
#include "stm32f412vx_matlab.h"
|
||||
#elif defined(STM32F413xx)
|
||||
#include "stm32f413xx_matlab.h"
|
||||
#elif defined(STM32F423xx)
|
||||
#include "stm32f423xx_matlab.h"
|
||||
#else
|
||||
#error "Please select first the target STM32F4xx device used in your application (in stm32f4xx_matlab.h file)"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup Exported_types
|
||||
* @{
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
RESET = 0U,
|
||||
SET = !RESET
|
||||
} FlagStatus, ITStatus;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DISABLE = 0U,
|
||||
ENABLE = !DISABLE
|
||||
} FunctionalState;
|
||||
#define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SUCCESS = 0U,
|
||||
ERROR = !SUCCESS
|
||||
} ErrorStatus;
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup Exported_macro
|
||||
* @{
|
||||
*/
|
||||
#define SET_BIT(REG, BIT) ((REG) |= (BIT))
|
||||
|
||||
#define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
|
||||
|
||||
#define READ_BIT(REG, BIT) ((REG) & (BIT))
|
||||
|
||||
#define CLEAR_REG(REG) ((REG) = (0x0))
|
||||
|
||||
#define WRITE_REG(REG, VAL) ((REG) = (VAL))
|
||||
|
||||
#define READ_REG(REG) ((REG))
|
||||
|
||||
#define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
|
||||
|
||||
#define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
|
||||
|
||||
/* Use of CMSIS compiler intrinsics for register exclusive access */
|
||||
/* Atomic 32-bit register access macro to set one or several bits */
|
||||
#define ATOMIC_SET_BIT(REG, BIT) \
|
||||
do { \
|
||||
uint32_t val; \
|
||||
do { \
|
||||
val = __LDREXW((__IO uint32_t *)&(REG)) | (BIT); \
|
||||
} while ((__STREXW(val,(__IO uint32_t *)&(REG))) != 0U); \
|
||||
} while(0)
|
||||
|
||||
/* Atomic 32-bit register access macro to clear one or several bits */
|
||||
#define ATOMIC_CLEAR_BIT(REG, BIT) \
|
||||
do { \
|
||||
uint32_t val; \
|
||||
do { \
|
||||
val = __LDREXW((__IO uint32_t *)&(REG)) & ~(BIT); \
|
||||
} while ((__STREXW(val,(__IO uint32_t *)&(REG))) != 0U); \
|
||||
} while(0)
|
||||
|
||||
/* Atomic 32-bit register access macro to clear and set one or several bits */
|
||||
#define ATOMIC_MODIFY_REG(REG, CLEARMSK, SETMASK) \
|
||||
do { \
|
||||
uint32_t val; \
|
||||
do { \
|
||||
val = (__LDREXW((__IO uint32_t *)&(REG)) & ~(CLEARMSK)) | (SETMASK); \
|
||||
} while ((__STREXW(val,(__IO uint32_t *)&(REG))) != 0U); \
|
||||
} while(0)
|
||||
|
||||
/* Atomic 16-bit register access macro to set one or several bits */
|
||||
#define ATOMIC_SETH_BIT(REG, BIT) \
|
||||
do { \
|
||||
uint16_t val; \
|
||||
do { \
|
||||
val = __LDREXH((__IO uint16_t *)&(REG)) | (BIT); \
|
||||
} while ((__STREXH(val,(__IO uint16_t *)&(REG))) != 0U); \
|
||||
} while(0)
|
||||
|
||||
/* Atomic 16-bit register access macro to clear one or several bits */
|
||||
#define ATOMIC_CLEARH_BIT(REG, BIT) \
|
||||
do { \
|
||||
uint16_t val; \
|
||||
do { \
|
||||
val = __LDREXH((__IO uint16_t *)&(REG)) & ~(BIT); \
|
||||
} while ((__STREXH(val,(__IO uint16_t *)&(REG))) != 0U); \
|
||||
} while(0)
|
||||
|
||||
/* Atomic 16-bit register access macro to clear and set one or several bits */
|
||||
#define ATOMIC_MODIFYH_REG(REG, CLEARMSK, SETMASK) \
|
||||
do { \
|
||||
uint16_t val; \
|
||||
do { \
|
||||
val = (__LDREXH((__IO uint16_t *)&(REG)) & ~(CLEARMSK)) | (SETMASK); \
|
||||
} while ((__STREXH(val,(__IO uint16_t *)&(REG))) != 0U); \
|
||||
} while(0)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#if defined (USE_HAL_DRIVER)
|
||||
#include "stm32f4xx_hal.h"
|
||||
#endif /* USE_HAL_DRIVER */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __STM32F4xx_H */
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
104
MCU_STM32F4xx_Matlab/Drivers/CMSIS/system_stm32f4xx.h
Normal file
104
MCU_STM32F4xx_Matlab/Drivers/CMSIS/system_stm32f4xx.h
Normal file
@@ -0,0 +1,104 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file system_stm32f4xx.h
|
||||
* @author MCD Application Team
|
||||
* @brief CMSIS Cortex-M4 Device System Source File for STM32F4xx devices.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2017 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
/** @addtogroup CMSIS
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** @addtogroup stm32f4xx_system
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Define to prevent recursive inclusion
|
||||
*/
|
||||
#ifndef __SYSTEM_STM32F4XX_H
|
||||
#define __SYSTEM_STM32F4XX_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @addtogroup STM32F4xx_System_Includes
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
|
||||
/** @addtogroup STM32F4xx_System_Exported_types
|
||||
* @{
|
||||
*/
|
||||
/* This variable is updated in three ways:
|
||||
1) by calling CMSIS function SystemCoreClockUpdate()
|
||||
2) by calling HAL API function HAL_RCC_GetSysClockFreq()
|
||||
3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
|
||||
Note: If you use this function to configure the system clock; then there
|
||||
is no need to call the 2 first functions listed above, since SystemCoreClock
|
||||
variable is updated automatically.
|
||||
*/
|
||||
extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
|
||||
|
||||
extern const uint8_t AHBPrescTable[16]; /*!< AHB prescalers table values */
|
||||
extern const uint8_t APBPrescTable[8]; /*!< APB prescalers table values */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32F4xx_System_Exported_Constants
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32F4xx_System_Exported_Macros
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/** @addtogroup STM32F4xx_System_Exported_Functions
|
||||
* @{
|
||||
*/
|
||||
|
||||
extern void SystemInit(void);
|
||||
extern void SystemCoreClockUpdate(void);
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*__SYSTEM_STM32F4XX_H */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
Reference in New Issue
Block a user