Skip to content

Commit 27c1a89

Browse files
kilograhamWren6991
authored andcommitted
review fixes
1 parent 895bad7 commit 27c1a89

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

src/rp2_common/hardware_sync/include/hardware/sync.h

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ extern "C" {
1818
/** \file hardware/sync.h
1919
* \defgroup hardware_sync hardware_sync
2020
*
21-
* Low level hardware spim locks, barrier and processor event APIs
21+
* Low level hardware spin locks, barrier and processor event APIs
2222
*
2323
* Spin Locks
2424
* ----------
@@ -39,10 +39,10 @@ extern "C" {
3939
*
4040
* Number (ID) | Description
4141
* :---------: | -----------
42-
* 0-13 | Currently reserved for exclusive use by the SDK and other libraries. If you use these spin locks, you risk breaking SDK or other library functionality. Each reserved spin lock use individually has its own PICO_SPINLOCK_ID so you can search for those).
42+
* 0-13 | Currently reserved for exclusive use by the SDK and other libraries. If you use these spin locks, you risk breaking SDK or other library functionality. Each reserved spin lock used individually has its own PICO_SPINLOCK_ID so you can search for those.
4343
* 14,15 | (\ref PICO_SPINLOCK_ID_OS1 and \ref PICO_SPINLOCK_ID_OS2). Currently reserved for exclusive use by an operating system (or other system level software) co-existing with the SDK.
44-
* 16-23 | (\ref PICO_SPINLOCK_ID_STRIPED_FIRST - \ref PICO_SPINLOCK_ID_STRIPED_LAST). Spin locks from this range are assigned in a round-robin fashion via next_striped_spin_lock_num(). These spin locks are share, but assigning numbers from a range reduces the probability that two higher level locking primitives using _striped_ spin locks will actually be using the same spin lock.
45-
* 24-31 | (\ref PICO_SPINLOCK_ID_CLAIM_FREE_FIRST - \ref PICO_SPINLOCK_ID_CLAIM_FREE_LAST). These are reserved for exclusive used and are allocated on a first come first serve basis at runtime via \ref spin_lock_claim_unused()
44+
* 16-23 | (\ref PICO_SPINLOCK_ID_STRIPED_FIRST - \ref PICO_SPINLOCK_ID_STRIPED_LAST). Spin locks from this range are assigned in a round-robin fashion via \ref next_striped_spin_lock_num(). These spin locks are shared, but assigning numbers from a range reduces the probability that two higher level locking primitives using _striped_ spin locks will actually be using the same spin lock.
45+
* 24-31 | (\ref PICO_SPINLOCK_ID_CLAIM_FREE_FIRST - \ref PICO_SPINLOCK_ID_CLAIM_FREE_LAST). These are reserved for exclusive use and are allocated on a first come first served basis at runtime via \ref spin_lock_claim_unused()
4646
*/
4747

4848
// PICO_CONFIG: PARAM_ASSERTIONS_ENABLED_SYNC, Enable/disable assertions in the HW sync module, type=bool, default=0, group=hardware_sync
@@ -70,12 +70,12 @@ typedef volatile uint32_t spin_lock_t;
7070
#define PICO_SPINLOCK_ID_HARDWARE_CLAIM 11
7171
#endif
7272

73-
// PICO_CONFIG: PICO_SPINLOCK_ID_OS1, Spinlock ID reserved for use by low level OS style software, min=0, max=31, default=12, group=hardware_sync
73+
// PICO_CONFIG: PICO_SPINLOCK_ID_OS1, Spinlock ID reserved for use by low level OS style software, min=0, max=31, default=14, group=hardware_sync
7474
#ifndef PICO_SPINLOCK_ID_OS1
7575
#define PICO_SPINLOCK_ID_OS1 14
7676
#endif
7777

78-
// PICO_CONFIG: PICO_SPINLOCK_ID_OS2, Spinlock ID reserved for use by low level OS style software, min=0, max=31, default=13, group=hardware_sync
78+
// PICO_CONFIG: PICO_SPINLOCK_ID_OS2, Spinlock ID reserved for use by low level OS style software, min=0, max=31, default=15, group=hardware_sync
7979
#ifndef PICO_SPINLOCK_ID_OS2
8080
#define PICO_SPINLOCK_ID_OS2 15
8181
#endif
@@ -95,11 +95,14 @@ typedef volatile uint32_t spin_lock_t;
9595
#define PICO_SPINLOCK_ID_CLAIM_FREE_FIRST 24
9696
#endif
9797

98-
// PICO_CONFIG: PICO_SPINLOCK_ID_CLAIM_FREE_END, Highest Spinlock ID in the 'claim free' range, min=0, max=31, default=31, group=hardware_sync
99-
#ifndef PICO_SPINLOCK_ID_CLAIM_FREE_END
100-
#define PICO_SPINLOCK_ID_CLAIM_FREE_END 31
98+
#ifdef PICO_SPINLOCK_ID_CLAIM_FREE_END
99+
#warning PICO_SPINLOCK_ID_CLAIM_FREE_END has been renamed to PICO_SPINLOCK_ID_CLAIM_FREE_LAST
101100
#endif
102101

102+
// PICO_CONFIG: PICO_SPINLOCK_ID_CLAIM_FREE_END, Highest Spinlock ID in the 'claim free' range, min=0, max=31, default=31, group=hardware_sync
103+
#ifndef PICO_SPINLOCK_ID_CLAIM_FREE_LAST
104+
#define PICO_SPINLOCK_ID_CLAIM_FREE_LAST 31
105+
#endif
103106

104107
/*! \brief Insert a SEV instruction in to the code path.
105108
* \ingroup hardware_sync

src/rp2_common/hardware_sync/sync.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,6 @@ void spin_lock_unclaim(uint lock_num) {
5454
}
5555

5656
int spin_lock_claim_unused(bool required) {
57-
return hw_claim_unused_from_range((uint8_t*)&claimed, required, PICO_SPINLOCK_ID_CLAIM_FREE_FIRST, PICO_SPINLOCK_ID_CLAIM_FREE_END, "No spinlocks are available");
57+
return hw_claim_unused_from_range((uint8_t*)&claimed, required, PICO_SPINLOCK_ID_CLAIM_FREE_FIRST, PICO_SPINLOCK_ID_CLAIM_FREE_LAST, "No spinlocks are available");
5858
}
5959

0 commit comments

Comments
 (0)