aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/include/libmaple/stm32.h
blob: 5efb67080b0ec9d264aea7e1bdfc449d582d5a1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/******************************************************************************
 * The MIT License
 *
 * Copyright (c) 2010 LeafLabs, LLC.
 *
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use, copy,
 * modify, merge, publish, distribute, sublicense, and/or sell copies
 * of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 *****************************************************************************/

/**
 * @file stm32.h
 * @brief STM32 chip-specific definitions
 */

#ifndef _LIBMAPLE_STM32_H_
#define _LIBMAPLE_STM32_H_

#ifdef __cplusplus
extern "C" {
#endif

/* Everything enclosed in the following __DOXYGEN_PREDEFINED_HACK
 * conditional block must be defined in the family header. */
#include <family/stm32.h>

#ifdef __DOXYGEN_PREDEFINED_HACK

/*
 * Clock configuration.
 *
 * These defines depend upon how the MCU is configured.  Because of
 * the potential for a mismatch between them and the actual clock
 * configuration, keep their number to a minimum.
 */

/**
 * @brief APB1 clock speed, in Hz.
 */
#define STM32_PCLK1

/**
 *  @brief APB2 clock speed, in Hz.
 */
#define STM32_PCLK2

/** @brief Deprecated. Use STM32_PCLK1 instead. */
#define PCLK1
/** @brief Deprecated. Use STM32_PCLK2 instead. */
#define PCLK2

/*
 * Family- and MCU-specific values.
 */

/**
 * @brief Number of interrupts in the vector table.
 *
 * This does not include Cortex-M interrupts (NMI, HardFault, etc.).
 */
#define STM32_NR_INTERRUPTS

/**
 * Number of GPIO ports.
 */
#define STM32_NR_GPIO_PORTS

/**
 * @brief Multiplier to convert microseconds into loop iterations
 *        in delay_us().
 *
 * @see delay_us()
 */
#define STM32_DELAY_US_MULT

/**
 * @brief Pointer to end of built-in SRAM.
 *
 * Points to the address which is 1 byte past the last valid
 * SRAM address.
 */
#define STM32_SRAM_END

#endif  /* __DOXYGEN_PREDEFINED_HACK */

/*
 * The following are for backwards compatibility only.
 */

/* PCLK1 and PCLK2 are for backwards compatibility only; don't use in
 * new code. */
#ifndef PCLK1
#define PCLK1 STM32_PCLK1
#endif
#if PCLK1 != STM32_PCLK1
#error "PCLK1 (which is deprecated) differs from STM32_PCLK1."
#endif
#ifndef PCLK2
#define PCLK2 STM32_PCLK2
#endif
#if PCLK2 != STM32_PCLK2
#error "PCLK2 (which is deprecated) differs from STM32_PCLK2."
#endif

/** @brief Deprecated. Use STM32_NR_INTERRUPTS instead. */
#define NR_INTERRUPTS                   STM32_NR_INTERRUPTS
/** @brief Deprecated. Use STM32_NR_GPIO_PORTS instead. */
#define NR_GPIO_PORTS                   STM32_NR_GPIO_PORTS
/** @brief Deprecated. Use STM32_DELAY_US_MULT instead. */
#define DELAY_US_MULT                   STM32_DELAY_US_MULT

#ifdef __cplusplus
}
#endif

#endif