1 | /* SPDX-License-Identifier: BSD-2-Clause */ |
---|
2 | |
---|
3 | /** |
---|
4 | * @file |
---|
5 | * |
---|
6 | * @ingroup RTEMSBSPsARMAtsam |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * Copyright (c) 2016 embedded brains GmbH. All rights reserved. |
---|
11 | * |
---|
12 | * Redistribution and use in source and binary forms, with or without |
---|
13 | * modification, are permitted provided that the following conditions |
---|
14 | * are met: |
---|
15 | * 1. Redistributions of source code must retain the above copyright |
---|
16 | * notice, this list of conditions and the following disclaimer. |
---|
17 | * 2. Redistributions in binary form must reproduce the above copyright |
---|
18 | * notice, this list of conditions and the following disclaimer in the |
---|
19 | * documentation and/or other materials provided with the distribution. |
---|
20 | * |
---|
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
---|
25 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
31 | * POSSIBILITY OF SUCH DAMAGE. |
---|
32 | */ |
---|
33 | |
---|
34 | #ifndef LIBBSP_ARM_ATSAM_BSP_H |
---|
35 | #define LIBBSP_ARM_ATSAM_BSP_H |
---|
36 | |
---|
37 | /** |
---|
38 | * @defgroup RTEMSBSPsARMAtsam Atmel/Microchip SAM E70, S70, V70 and V71 |
---|
39 | * |
---|
40 | * @ingroup RTEMSBSPsARM |
---|
41 | * |
---|
42 | * @brief Atmel/Microchip SAM E70, S70, V70 and V71 Board Support Package. |
---|
43 | * |
---|
44 | * @{ |
---|
45 | */ |
---|
46 | |
---|
47 | #include <bspopts.h> |
---|
48 | #include <bsp/default-initial-extension.h> |
---|
49 | #include <sys/ioccom.h> |
---|
50 | |
---|
51 | #include <rtems.h> |
---|
52 | |
---|
53 | #ifdef __cplusplus |
---|
54 | extern "C" { |
---|
55 | #endif /* __cplusplus */ |
---|
56 | |
---|
57 | #define BSP_FEATURE_IRQ_EXTENSION |
---|
58 | |
---|
59 | #define BSP_ARMV7M_IRQ_PRIORITY_DEFAULT (13 << 4) |
---|
60 | |
---|
61 | #define BSP_ARMV7M_SYSTICK_PRIORITY (14 << 4) |
---|
62 | |
---|
63 | uint32_t atsam_systick_frequency(void); |
---|
64 | |
---|
65 | #define BSP_ARMV7M_SYSTICK_FREQUENCY atsam_systick_frequency() |
---|
66 | |
---|
67 | struct rtems_bsdnet_ifconfig; |
---|
68 | |
---|
69 | int if_atsam_attach(struct rtems_bsdnet_ifconfig *config, int attaching); |
---|
70 | |
---|
71 | #define RTEMS_BSP_NETWORK_DRIVER_NAME "atsam0" |
---|
72 | |
---|
73 | #define RTEMS_BSP_NETWORK_DRIVER_ATTACH if_atsam_attach |
---|
74 | |
---|
75 | /** |
---|
76 | * @brief Interface driver configuration. |
---|
77 | */ |
---|
78 | typedef struct { |
---|
79 | /** |
---|
80 | * @brief Maximum retries for MDIO communication. |
---|
81 | */ |
---|
82 | uint32_t mdio_retries; |
---|
83 | |
---|
84 | /** |
---|
85 | * @brief Address of PHY. |
---|
86 | * |
---|
87 | * Use 0xff to search for a PHY. |
---|
88 | */ |
---|
89 | uint8_t phy_addr; |
---|
90 | } if_atsam_config; |
---|
91 | |
---|
92 | extern char atsam_memory_dtcm_begin[]; |
---|
93 | extern char atsam_memory_dtcm_end[]; |
---|
94 | extern char atsam_memory_dtcm_size[]; |
---|
95 | |
---|
96 | extern char atsam_memory_intflash_begin[]; |
---|
97 | extern char atsam_memory_intflash_end[]; |
---|
98 | extern char atsam_memory_intflash_size[]; |
---|
99 | |
---|
100 | extern char atsam_memory_intsram_begin[]; |
---|
101 | extern char atsam_memory_intsram_end[]; |
---|
102 | extern char atsam_memory_intsram_size[]; |
---|
103 | |
---|
104 | extern char atsam_memory_itcm_begin[]; |
---|
105 | extern char atsam_memory_itcm_end[]; |
---|
106 | extern char atsam_memory_itcm_size[]; |
---|
107 | |
---|
108 | extern char atsam_memory_nocache_begin[]; |
---|
109 | extern char atsam_memory_nocache_end[]; |
---|
110 | extern char atsam_memory_nocache_size[]; |
---|
111 | |
---|
112 | extern char atsam_memory_qspiflash_begin[]; |
---|
113 | extern char atsam_memory_qspiflash_end[]; |
---|
114 | extern char atsam_memory_qspiflash_size[]; |
---|
115 | |
---|
116 | extern char atsam_memory_sdram_begin[]; |
---|
117 | extern char atsam_memory_sdram_end[]; |
---|
118 | extern char atsam_memory_sdram_size[]; |
---|
119 | |
---|
120 | void atsam_rtc_get_time(rtems_time_of_day *tod); |
---|
121 | |
---|
122 | |
---|
123 | |
---|
124 | void bsp_restart( const void *const addr ); |
---|
125 | |
---|
126 | /* |
---|
127 | * This ioctl enables the receive DMA for an UART. The DMA can be usefull if you |
---|
128 | * loose characters in high interrupt load situations. |
---|
129 | * |
---|
130 | * Disabling the DMA again is only possible by closing all file descriptors of |
---|
131 | * that UART. |
---|
132 | * |
---|
133 | * Note that every UART needs one DMA channel and the system has only a limited |
---|
134 | * amount of DMAs. So only use it if you need it. |
---|
135 | */ |
---|
136 | #define ATSAM_UART_ENABLE_RX_DMA _IO('d', 0) |
---|
137 | |
---|
138 | #ifdef __cplusplus |
---|
139 | } |
---|
140 | #endif /* __cplusplus */ |
---|
141 | |
---|
142 | /** @} */ |
---|
143 | |
---|
144 | #endif /* LIBBSP_ARM_ATSAM_BSP_H */ |
---|