Skip to content

Commit ff5b4a1

Browse files
committed
mpsl: split mpsl_hwres
Since `mpsh_hwres.h` should not use defines from nrfx, the header has to be split. Signed-off-by: Marcin Szymczyk <[email protected]>
1 parent 2c5dc50 commit ff5b4a1

File tree

4 files changed

+115
-51
lines changed

4 files changed

+115
-51
lines changed

mpsl/include/mpsl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ extern "C" {
2626
#include "nrf_errno.h"
2727
#include "mpsl_clock.h"
2828
#include "mpsl_hwres.h"
29+
#include "mpsl_dppi.h"
2930

3031
/** @brief High IRQ priority
3132
*

mpsl/include/mpsl_dppi.h

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
* Copyright (c) Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
/**
8+
* @file mpsl_dppi.h
9+
*
10+
* @defgroup mpsl_dppi MPSL DPPI API
11+
* @ingroup mpsl
12+
*
13+
* This file defines an API to dynamically allocate some of hardware
14+
* resources. The allocation functions are expected to be implemented
15+
* outside of the MPSL.
16+
* @{
17+
*/
18+
19+
#ifndef MPSL_DPPI_H__
20+
#define MPSL_DPPI_H__
21+
22+
#include <nrfx.h>
23+
24+
#ifdef __cplusplus
25+
extern "C" {
26+
#endif
27+
28+
#if defined(DPPI_PRESENT) || defined(DOXYGEN)
29+
30+
/** @brief Allocate a DPPI channel of a DPPIC controller instance.
31+
*
32+
* @param[in] p_dppic Pointer to a DPPIC controller instance.
33+
* @param[out] p_dppi_ch Allocated DPPI channel number on the given DPPIC instance.
34+
* Value written at this pointer is valid only on successful
35+
* allocation.
36+
*
37+
* @retval true Allocation successful.
38+
* @retval false Allocation failed.
39+
*/
40+
bool mpsl_hwres_dppi_channel_alloc(NRF_DPPIC_Type * p_dppic, uint8_t * p_dppi_ch);
41+
42+
#endif /* DPPI_PRESENT */
43+
44+
#if defined(PPIB_PRESENT) || defined(DOXYGEN)
45+
46+
/** @brief Allocate a PPIB channel of a PPIB-to-PPIB interconnection.
47+
*
48+
* @param[in] p_ppib Pointer to a PPIB instance.
49+
* @param[out] p_ppib_ch Allocated PPIB channel number the for PPIB-to-PPIB
50+
* interconnection identified by the @p p_ppib being one
51+
* of the sides of the interconnection.
52+
* Value written at this pointer valid only on successful
53+
* allocation.
54+
*
55+
* @retval true Allocation successful.
56+
* @retval false Allocation failed.
57+
*/
58+
bool mpsl_hwres_ppib_channel_alloc(NRF_PPIB_Type * p_ppib, uint8_t * p_ppib_ch);
59+
60+
#endif /* PPIB_PRESENT */
61+
62+
#ifdef __cplusplus
63+
}
64+
#endif
65+
66+
#endif // MPSL_DPPI_H__
67+
68+
/**@} */

mpsl/include/mpsl_hwres.h

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
* @ingroup mpsl
1212
*
1313
* This file defines fixed hardware resources used by the MPSL.
14-
* It also defines an API to dynamically allocate some of hardware
15-
* resources. The allocation functions are expected to be implemented
16-
* outside of the MPSL.
1714
* @{
1815
*/
1916

@@ -27,20 +24,8 @@
2724
extern "C" {
2825
#endif
2926

30-
/* Reserved (D)PPI, PPIB and IPCT resources for the supported platforms. */
31-
/* This corresponds to the PPI channels 19, 30, and 31. */
32-
#define MPSL_NRF52_PPI_CHANNELS_USED_MASK (0xc0080000)
33-
/* This corresponds to the DPPI channels 0, 1, and 2. */
34-
#define MPSL_NRF53_DPPIC_CHANNELS_USED_MASK (0x00000007)
35-
#define MPSL_NRF54L_DPPIC10_CHANNELS_USED_MASK (0x00000001)
36-
#define MPSL_NRF54L_DPPIC20_CHANNELS_USED_MASK (0x00000001)
37-
#define MPSL_NRF54L_PPIB11_CHANNELS_USED_MASK (0x00000001)
38-
#define MPSL_NRF54L_PPIB21_CHANNELS_USED_MASK (0x00000001)
39-
#define MPSL_NRF54H_DPPIC020_CHANNELS_USED_MASK (0x00000001)
40-
#define MPSL_NRF54H_IPCT130_CHANNELS_USED_MASK (0x00000001)
41-
42-
#if !defined(__ZEPHYR__)
4327
#include "nrfx.h"
28+
#include "mpsl_hwres_zephyr.h"
4429

4530
#if defined(NRF52_SERIES)
4631
#define MPSL_RESERVED_PPI_CHANNELS ((1UL << 19) | (1UL << 30) | (1UL << 31))
@@ -72,41 +57,6 @@ extern "C" {
7257
#else
7358
#define MPSL_TIMER0 NRF_TIMER020
7459
#endif
75-
#endif
76-
77-
#if defined(DPPI_PRESENT) || defined(DOXYGEN)
78-
79-
/** @brief Allocate a DPPI channel of a DPPIC controller instance.
80-
*
81-
* @param[in] p_dppic Pointer to a DPPIC controller instance.
82-
* @param[out] p_dppi_ch Allocated DPPI channel number on the given DPPIC instance.
83-
* Value written at this pointer is valid only on successful
84-
* allocation.
85-
*
86-
* @retval true Allocation successful.
87-
* @retval false Allocation failed.
88-
*/
89-
bool mpsl_hwres_dppi_channel_alloc(NRF_DPPIC_Type * p_dppic, uint8_t * p_dppi_ch);
90-
91-
#endif /* DPPI_PRESENT */
92-
93-
#if defined(PPIB_PRESENT) || defined(DOXYGEN)
94-
95-
/** @brief Allocate a PPIB channel of a PPIB-to-PPIB interconnection.
96-
*
97-
* @param[in] p_ppib Pointer to a PPIB instance.
98-
* @param[out] p_ppib_ch Allocated PPIB channel number the for PPIB-to-PPIB
99-
* interconnection identified by the @p p_ppib being one
100-
* of the sides of the interconnection.
101-
* Value written at this pointer valid only on successful
102-
* allocation.
103-
*
104-
* @retval true Allocation successful.
105-
* @retval false Allocation failed.
106-
*/
107-
bool mpsl_hwres_ppib_channel_alloc(NRF_PPIB_Type * p_ppib, uint8_t * p_ppib_ch);
108-
109-
#endif /* PPIB_PRESENT */
11060

11161
#ifdef __cplusplus
11262
}

mpsl/include/mpsl_hwres_zephyr.h

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright (c) Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
*/
6+
7+
/**
8+
* @file mpsl_hwres_zephyr.h
9+
*
10+
* @defgroup mpsl_hwres MPSL hardware resources API for Zephyr
11+
* @ingroup mpsl
12+
*
13+
* This file defines fixed hardware resources used by the MPSL in Zephyr.
14+
* @{
15+
*/
16+
17+
#ifndef MPSL_HWRES_ZEPHYR_H__
18+
#define MPSL_HWRES_ZEPHYR_H__
19+
20+
#include <stdbool.h>
21+
#include <stdint.h>
22+
23+
#ifdef __cplusplus
24+
extern "C" {
25+
#endif
26+
27+
/* Reserved (D)PPI, PPIB and IPCT resources for the supported platforms. */
28+
/* This corresponds to the PPI channels 19, 30, and 31. */
29+
#define MPSL_NRF52_PPI_CHANNELS_USED_MASK (0xc0080000)
30+
/* This corresponds to the DPPI channels 0, 1, and 2. */
31+
#define MPSL_NRF53_DPPIC_CHANNELS_USED_MASK (0x00000007)
32+
#define MPSL_NRF54L_DPPIC10_CHANNELS_USED_MASK (0x00000001)
33+
#define MPSL_NRF54L_DPPIC20_CHANNELS_USED_MASK (0x00000001)
34+
#define MPSL_NRF54L_PPIB11_CHANNELS_USED_MASK (0x00000001)
35+
#define MPSL_NRF54L_PPIB21_CHANNELS_USED_MASK (0x00000001)
36+
#define MPSL_NRF54H_DPPIC020_CHANNELS_USED_MASK (0x00000001)
37+
#define MPSL_NRF54H_IPCT130_CHANNELS_USED_MASK (0x00000001)
38+
39+
#ifdef __cplusplus
40+
}
41+
#endif
42+
43+
#endif // MPSL_HWRES_ZEPHYR_H__
44+
45+
/**@} */

0 commit comments

Comments
 (0)