Skip to content

Commit 4bfd68b

Browse files
author
modm update bot
committed
Update to v2.1.1
1 parent 9aad9de commit 4bfd68b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+13390
-10023
lines changed

include/RP2040.h

Lines changed: 2631 additions & 67 deletions
Large diffs are not rendered by default.

include/hardware/platform_defs.h

Lines changed: 66 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
2+
* Copyright (c) 2024 Raspberry Pi Ltd.
33
*
44
* SPDX-License-Identifier: BSD-3-Clause
55
*/
@@ -20,52 +20,103 @@
2020
#define NUM_CORES _u(2)
2121
#define NUM_DMA_CHANNELS _u(12)
2222
#define NUM_DMA_TIMERS _u(4)
23+
#define NUM_DMA_IRQS _u(2)
2324
#define NUM_IRQS _u(32)
2425
#define NUM_USER_IRQS _u(6)
2526
#define NUM_PIOS _u(2)
2627
#define NUM_PIO_STATE_MACHINES _u(4)
28+
#define NUM_PIO_IRQS _u(2)
2729
#define NUM_PWM_SLICES _u(8)
30+
#define NUM_PWM_IRQS _u(1)
2831
#define NUM_SPIN_LOCKS _u(32)
2932
#define NUM_UARTS _u(2)
3033
#define NUM_I2CS _u(2)
3134
#define NUM_SPIS _u(2)
32-
#define NUM_TIMERS _u(4)
35+
#define NUM_GENERIC_TIMERS _u(1)
36+
#define NUM_ALARMS _u(4)
37+
#define ADC_BASE_PIN _u(26)
3338
#define NUM_ADC_CHANNELS _u(5)
34-
39+
#define NUM_RESETS _u(24)
3540
#define NUM_BANK0_GPIOS _u(30)
3641
#define NUM_QSPI_GPIOS _u(6)
3742

3843
#define PIO_INSTRUCTION_COUNT _u(32)
3944

40-
// PICO_CONFIG: XOSC_KHZ, The crystal oscillator frequency in kHz, type=int, default=12000, advanced=true, group=hardware_base
45+
#define USBCTRL_DPRAM_SIZE _u(4096)
46+
47+
#define HAS_SIO_DIVIDER 1
48+
#define HAS_RP2040_RTC 1
49+
// PICO_CONFIG: XOSC_HZ, Crystal oscillator frequency in Hz, type=int, default=12000000, advanced=true, group=hardware_base
4150
// NOTE: The system and USB clocks are generated from the frequency using two PLLs.
42-
// If you override this define, or SYS_CLK_KHZ/USB_CLK_KHZ below, you will *also* need to add your own adjusted PLL set-up defines to
51+
// If you override this define, or SYS_CLK_HZ/USB_CLK_HZ below, you will *also* need to add your own adjusted PLL set-up defines to
4352
// override the defaults which live in src/rp2_common/hardware_clocks/include/hardware/clocks.h
4453
// Please see the comments there about calculating the new PLL setting values.
45-
#ifndef XOSC_KHZ
46-
#define XOSC_KHZ _u(12000)
54+
#ifndef XOSC_HZ
55+
#ifdef XOSC_KHZ
56+
#define XOSC_HZ ((XOSC_KHZ) * _u(1000))
57+
#elif defined(XOSC_MHZ)
58+
#define XOSC_HZ ((XOSC_MHZ) * _u(1000000))
59+
#else
60+
#define XOSC_HZ _u(12000000)
61+
#endif
62+
#endif
63+
64+
// PICO_CONFIG: PICO_USE_FASTEST_SUPPORTED_CLOCK, Use the fastest officially supported clock by default, type=bool, default=0, group=hardware_base
65+
#ifndef PICO_USE_FASTEST_SUPPORTED_CLOCK
66+
#define PICO_USE_FASTEST_SUPPORTED_CLOCK 0
67+
#endif
68+
69+
// PICO_CONFIG: SYS_CLK_HZ, System operating frequency in Hz, type=int, default=125000000, advanced=true, group=hardware_base
70+
#ifndef SYS_CLK_HZ
71+
#ifdef SYS_CLK_KHZ
72+
#define SYS_CLK_HZ ((SYS_CLK_KHZ) * _u(1000))
73+
#elif defined(SYS_CLK_MHZ)
74+
#define SYS_CLK_HZ ((SYS_CLK_MHZ) * _u(1000000))
75+
#else
76+
#if PICO_USE_FASTEST_SUPPORTED_CLOCK
77+
#define SYS_CLK_HZ _u(200000000)
78+
#else
79+
#define SYS_CLK_HZ _u(125000000)
80+
#endif
81+
#endif
4782
#endif
4883

49-
// PICO_CONFIG: SYS_CLK_KHZ, The system operating frequency in kHz, type=int, default=125000, advanced=true, group=hardware_base
50-
#ifndef SYS_CLK_KHZ
51-
#define SYS_CLK_KHZ _u(125000)
84+
// PICO_CONFIG: USB_CLK_HZ, USB clock frequency. Must be 48MHz for the USB interface to operate correctly, type=int, default=48000000, advanced=true, group=hardware_base
85+
#ifndef USB_CLK_HZ
86+
#ifdef USB_CLK_KHZ
87+
#define USB_CLK_HZ ((USB_CLK_KHZ) * _u(1000))
88+
#elif defined(USB_CLK_MHZ)
89+
#define USB_CLK_HZ ((USB_CLK_MHZ) * _u(1000000))
90+
#else
91+
#define USB_CLK_HZ _u(48000000)
92+
#endif
5293
#endif
5394

54-
// PICO_CONFIG: USB_CLK_KHZ, USB clock frequency. Must be 48MHz for the USB interface to operate correctly, type=int, default=48000, advanced=true, group=hardware_base
55-
#ifndef USB_CLK_KHZ
56-
#define USB_CLK_KHZ _u(48000)
95+
// For backwards compatibility define XOSC_KHZ if the frequency is indeed an integer number of Khz.
96+
#if defined(XOSC_HZ) && !defined(XOSC_KHZ) && (XOSC_HZ % 1000 == 0)
97+
#define XOSC_KHZ (XOSC_HZ / 1000)
5798
#endif
5899

59100
// For backwards compatibility define XOSC_MHZ if the frequency is indeed an integer number of Mhz.
60101
#if defined(XOSC_KHZ) && !defined(XOSC_MHZ) && (XOSC_KHZ % 1000 == 0)
61102
#define XOSC_MHZ (XOSC_KHZ / 1000)
62103
#endif
63104

105+
// For backwards compatibility define SYS_CLK_KHZ if the frequency is indeed an integer number of Khz.
106+
#if defined(SYS_CLK_HZ) && !defined(SYS_CLK_KHZ) && (SYS_CLK_HZ % 1000 == 0)
107+
#define SYS_CLK_KHZ (SYS_CLK_HZ / 1000)
108+
#endif
109+
64110
// For backwards compatibility define SYS_CLK_MHZ if the frequency is indeed an integer number of Mhz.
65111
#if defined(SYS_CLK_KHZ) && !defined(SYS_CLK_MHZ) && (SYS_CLK_KHZ % 1000 == 0)
66112
#define SYS_CLK_MHZ (SYS_CLK_KHZ / 1000)
67113
#endif
68114

115+
// For backwards compatibility define USB_CLK_KHZ if the frequency is indeed an integer number of Khz.
116+
#if defined(USB_CLK_HZ) && !defined(USB_CLK_KHZ) && (USB_CLK_HZ % 1000 == 0)
117+
#define USB_CLK_KHZ (USB_CLK_HZ / 1000)
118+
#endif
119+
69120
// For backwards compatibility define USB_CLK_MHZ if the frequency is indeed an integer number of Mhz.
70121
#if defined(USB_CLK_KHZ) && !defined(USB_CLK_MHZ) && (USB_CLK_KHZ % 1000 == 0)
71122
#define USB_CLK_MHZ (USB_CLK_KHZ / 1000)
@@ -74,5 +125,6 @@
74125
#define FIRST_USER_IRQ (NUM_IRQS - NUM_USER_IRQS)
75126
#define VTABLE_FIRST_IRQ 16
76127

77-
#endif
128+
#define REG_FIELD_WIDTH(f) (f ## _MSB + 1 - f ## _LSB)
78129

130+
#endif

include/hardware/regs/adc.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
// THIS HEADER FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT
2+
13
/**
2-
* Copyright (c) 2021 Raspberry Pi (Trading) Ltd.
4+
* Copyright (c) 2024 Raspberry Pi Ltd.
35
*
46
* SPDX-License-Identifier: BSD-3-Clause
57
*/
@@ -9,8 +11,8 @@
911
// Bus type : apb
1012
// Description : Control and data interface to SAR ADC
1113
// =============================================================================
12-
#ifndef HARDWARE_REGS_ADC_DEFINED
13-
#define HARDWARE_REGS_ADC_DEFINED
14+
#ifndef _HARDWARE_REGS_ADC_H
15+
#define _HARDWARE_REGS_ADC_H
1416
// =============================================================================
1517
// Register : ADC_CS
1618
// Description : ADC Control and Status
@@ -25,8 +27,8 @@
2527
// round-robin fashion.
2628
// The first channel to be sampled will be the one currently
2729
// indicated by AINSEL.
28-
// AINSEL will be updated after each conversion with the
29-
// newly-selected channel.
30+
// AINSEL will be updated after each conversion with the newly-
31+
// selected channel.
3032
#define ADC_CS_RROBIN_RESET _u(0x00)
3133
#define ADC_CS_RROBIN_BITS _u(0x001f0000)
3234
#define ADC_CS_RROBIN_MSB _u(20)
@@ -153,15 +155,13 @@
153155
#define ADC_FCS_UNDER_ACCESS "WC"
154156
// -----------------------------------------------------------------------------
155157
// Field : ADC_FCS_FULL
156-
// Description : None
157158
#define ADC_FCS_FULL_RESET _u(0x0)
158159
#define ADC_FCS_FULL_BITS _u(0x00000200)
159160
#define ADC_FCS_FULL_MSB _u(9)
160161
#define ADC_FCS_FULL_LSB _u(9)
161162
#define ADC_FCS_FULL_ACCESS "RO"
162163
// -----------------------------------------------------------------------------
163164
// Field : ADC_FCS_EMPTY
164-
// Description : None
165165
#define ADC_FCS_EMPTY_RESET _u(0x0)
166166
#define ADC_FCS_EMPTY_BITS _u(0x00000100)
167167
#define ADC_FCS_EMPTY_MSB _u(8)
@@ -218,7 +218,6 @@
218218
#define ADC_FIFO_ERR_ACCESS "RF"
219219
// -----------------------------------------------------------------------------
220220
// Field : ADC_FIFO_VAL
221-
// Description : None
222221
#define ADC_FIFO_VAL_RESET "-"
223222
#define ADC_FIFO_VAL_BITS _u(0x00000fff)
224223
#define ADC_FIFO_VAL_MSB _u(11)
@@ -311,4 +310,5 @@
311310
#define ADC_INTS_FIFO_LSB _u(0)
312311
#define ADC_INTS_FIFO_ACCESS "RO"
313312
// =============================================================================
314-
#endif // HARDWARE_REGS_ADC_DEFINED
313+
#endif // _HARDWARE_REGS_ADC_H
314+

include/hardware/regs/addressmap.h

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
1+
// THIS HEADER FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT
2+
13
/**
2-
* Copyright (c) 2021 Raspberry Pi (Trading) Ltd.
4+
* Copyright (c) 2024 Raspberry Pi Ltd.
35
*
46
* SPDX-License-Identifier: BSD-3-Clause
57
*/
6-
#ifndef _ADDRESSMAP_H_
7-
#define _ADDRESSMAP_H_
8+
#ifndef _ADDRESSMAP_H
9+
#define _ADDRESSMAP_H
10+
11+
/**
12+
* \file rp2040/addressmap.h
13+
*/
814

915
#include "hardware/platform_defs.h"
1016

1117
// Register address offsets for atomic RMW aliases
12-
#define REG_ALIAS_RW_BITS (0x0u << 12u)
13-
#define REG_ALIAS_XOR_BITS (0x1u << 12u)
14-
#define REG_ALIAS_SET_BITS (0x2u << 12u)
15-
#define REG_ALIAS_CLR_BITS (0x3u << 12u)
18+
#define REG_ALIAS_RW_BITS (_u(0x0) << _u(12))
19+
#define REG_ALIAS_XOR_BITS (_u(0x1) << _u(12))
20+
#define REG_ALIAS_SET_BITS (_u(0x2) << _u(12))
21+
#define REG_ALIAS_CLR_BITS (_u(0x3) << _u(12))
1622

1723
#define ROM_BASE _u(0x00000000)
1824
#define XIP_BASE _u(0x10000000)
@@ -71,4 +77,5 @@
7177
#define SIO_BASE _u(0xd0000000)
7278
#define PPB_BASE _u(0xe0000000)
7379

74-
#endif // _ADDRESSMAP_H_
80+
#endif // _ADDRESSMAP_H
81+

0 commit comments

Comments
 (0)