claim.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef _HARDWARE_CLAIM_H
8 #define _HARDWARE_CLAIM_H
9 
10 #include "pico.h"
11 #include "hardware/sync.h"
12 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
48 void hw_claim_or_assert(uint8_t *bits, uint bit_index, const char *message);
49 
60 int hw_claim_unused_from_range(uint8_t *bits, bool required, uint bit_lsb, uint bit_msb, const char *message);
61 
71 bool hw_is_claimed(const uint8_t *bits, uint bit_index);
72 
81 void hw_claim_clear(uint8_t *bits, uint bit_index);
82 
94 uint32_t hw_claim_lock(void);
95 
103 void hw_claim_unlock(uint32_t token);
104 
105 #ifdef __cplusplus
106 }
107 #endif
108 
109 #endif
bool hw_is_claimed(const uint8_t *bits, uint bit_index)
Determine if a resource is claimed at the time of the callThe resource ownership is indicated by the ...
Definition: claim.c:17
void hw_claim_or_assert(uint8_t *bits, uint bit_index, const char *message)
Atomically claim a resource, panicking if it is already in useThe resource ownership is indicated by ...
Definition: claim.c:21
int hw_claim_unused_from_range(uint8_t *bits, bool required, uint bit_lsb, uint bit_msb, const char *message)
Atomically claim one resource out of a range of resources, optionally asserting if none are free...
Definition: claim.c:31
void hw_claim_clear(uint8_t *bits, uint bit_index)
Atomically unclaim a resourceThe resource ownership is indicated by the bit_index bit in an array of ...
Definition: claim.c:49
void hw_claim_unlock(uint32_t token)
Release the runtime mutual exclusion lock provided by the hardware_claim library. ...
Definition: claim.c:13
uint32_t hw_claim_lock(void)
Acquire the runtime mutual exclusion lock provided by the hardware_claim libraryThis method is called...
Definition: claim.c:9