Mistake on this page?
Report an issue in GitHub or email us
sch_int_rm.h
Go to the documentation of this file.
1 /*************************************************************************************************/
2 /*!
3  * \file
4  *
5  * \brief Internal scheduler resource manager interface file.
6  *
7  * Copyright (c) 2013-2019 Arm Ltd. All Rights Reserved.
8  *
9  * Copyright (c) 2019-2020 Packetcraft, Inc.
10  *
11  * Licensed under the Apache License, Version 2.0 (the "License");
12  * you may not use this file except in compliance with the License.
13  * You may obtain a copy of the License at
14  *
15  * http://www.apache.org/licenses/LICENSE-2.0
16  *
17  * Unless required by applicable law or agreed to in writing, software
18  * distributed under the License is distributed on an "AS IS" BASIS,
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20  * See the License for the specific language governing permissions and
21  * limitations under the License.
22  */
23 /*************************************************************************************************/
24 
25 #ifndef SCH_INT_RM_H
26 #define SCH_INT_RM_H
27 
28 #include "sch_api.h"
29 #include "sch_api_ble.h"
30 #include "ll_math.h"
31 #include "cfg_mac_ble.h"
32 #include "pal_bb.h"
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 /**************************************************************************************************
39  Macros
40 **************************************************************************************************/
41 
42 /*! \brief Maximum number of reservations per unit of preferred periodicity. */
43 #define SCH_RM_MAX_RSVN_PREF_PER 2 /* TODO allow run-time configuration */
44 
45 /*! \brief Binary divide by preferred periodicity (10,000us) (n[max]=2^32). */
46 #define SCH_RM_DIV_PREF_PER(n) ((uint32_t)(((uint64_t)(n) * UINT64_C(1717987)) >> 34))
47 
48 /*! \brief Minimum offset unit of reservation manager in microseconds. (Half of minimum isochronous interval) */
49 #define SCH_RM_MIN_OFFSET_UNIT_US 2500
50 
51 /*! \brief Default distance in microseconds between common reservation and uncommon reservation. */
52 #define SCH_RM_OFFSET_UNCOMMON_US 3750
53 
54 /*! \brief Margin in microseconds from the duration of the common reservation to uncommon reservation. */
55 #define SCH_RM_MARGIN_UNCOMMON_US 50
56 
57 /*! \brief Maximum depth to be searched between intervals. (4 means 16 times(2^4) */
58 #define SCH_RM_MAX_SEARCH_DEPTH 4
59 
60 /**************************************************************************************************
61  Data Types
62 **************************************************************************************************/
63 
64 /*! \brief Reservation descriptor. */
65 typedef struct
66 {
67  uint8_t handle; /*!< Reservation handle. */
68  bool_t commIntUsed; /*!< Reservation is controlled by common interval. */
69  uint8_t offsetBit; /*!< Offset bit location. */
70  uint32_t interUsec; /*!< Interval in microseconds. */
71  uint32_t durUsec; /*!< Duration in microseconds. */
72  GetRefTimeCb_t refTimeCb; /*!< Callback function to get reference time of the handle. */
73 } schRmRsvn_t;
74 
75 /*! \brief Scheduler resource manager control block. */
76 typedef struct
77 {
78  uint8_t numRsvn; /*!< Number of reservations. */
79  uint8_t refHandle; /*!< Handle to be used to get reference time. */
80  uint8_t offsetDepth; /*!< Offset depth from common interval. */
81  uint8_t indexUncommon; /*!< Index of uncommon reservations. */
82  uint32_t rmStatus; /*!< Reservation status. */
83  uint32_t commonInt; /*!< Common interval. */
84  uint32_t rsvnInterUsec[SCH_RM_MAX_RSVN]; /*!< Reserved intervals indexed by handle. */
85  schRmRsvn_t rsvn[SCH_RM_MAX_RSVN]; /*!< Reservation info for each handle. */
86 } SchRmCb_t;
87 
88 /**************************************************************************************************
89  Global Variables
90 **************************************************************************************************/
91 
92 extern SchRmCb_t schRmCb;
93 
94 /**************************************************************************************************
95  Function Declarations
96 **************************************************************************************************/
97 
98 void schRmSortListDescending(uint32_t item[], uint8_t numItems);
99 uint8_t schRmIntCalculateDepth(uint32_t intLarge, uint32_t intSmall);
100 
101 #ifdef __cplusplus
102 };
103 #endif
104 
105 #endif /* SCH_INT_RM_H */
uint32_t commonInt
Definition: sch_int_rm.h:83
uint8_t handle
Definition: sch_int_rm.h:67
uint8_t numRsvn
Definition: sch_int_rm.h:78
Scheduler resource manager control block.
Definition: sch_int_rm.h:76
uint32_t(* GetRefTimeCb_t)(uint8_t handle, uint32_t *pDurUsec)
Get reference time callback signature.
Definition: sch_api_ble.h:67
Reservation descriptor.
Definition: sch_int_rm.h:65
#define SCH_RM_MAX_RSVN
Definition: cfg_mac_ble.h:101
uint32_t rmStatus
Definition: sch_int_rm.h:82
BLE MAC system configuration.
bool_t commIntUsed
Definition: sch_int_rm.h:68
GetRefTimeCb_t refTimeCb
Definition: sch_int_rm.h:72
uint32_t durUsec
Definition: sch_int_rm.h:71
uint8_t offsetDepth
Definition: sch_int_rm.h:80
uint8_t indexUncommon
Definition: sch_int_rm.h:81
Multi-protocol scheduler interface file.
uint32_t interUsec
Definition: sch_int_rm.h:70
uint8_t offsetBit
Definition: sch_int_rm.h:69
Baseband interface file.
Link layer scheduler interface file.
uint8_t refHandle
Definition: sch_int_rm.h:79
Link Layer math utilities.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.