source: rtems/cpukit/include/rtems/score/percpudata.h @ 5803f37

5
Last change on this file since 5803f37 was f49618d, checked in by Andreas Dachsberger <andreas.dachsberger@…>, on 04/18/19 at 08:19:23

doxygen: score: adjust doc in percpudata.h to doxygen guidelines

Update #3706.

  • Property mode set to 100644
File size: 3.1 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup PerCPUData
5 *
6 * @brief Definition of custom per-CPU items.
7 */
8
9/*
10 * Copyright (c) 2018 embedded brains GmbH.  All rights reserved.
11 *
12 *  embedded brains GmbH
13 *  Dornierstr. 4
14 *  82178 Puchheim
15 *  Germany
16 *  <rtems@embedded-brains.de>
17 *
18 * The license and distribution terms for this file may be
19 * found in the file LICENSE in this distribution or at
20 * http://www.rtems.org/license/LICENSE.
21 */
22
23#ifndef _RTEMS_SCORE_PERCPUDATA_H
24#define _RTEMS_SCORE_PERCPUDATA_H
25
26#include <rtems/score/percpu.h>
27#include <rtems/linkersets.h>
28
29#ifdef __cplusplus
30extern "C" {
31#endif /* __cplusplus */
32
33/**
34 * @defgroup PerCPUData Flexible Per-CPU Data
35 *
36 * @ingroup PerCPU
37 *
38 * @brief Flexible Per-CPU Data
39 *
40 * Provides the definition of custom per-CPU items.  The items are collected in
41 * a special linker set.  During system initialization the content of the
42 * linker set is duplicated for all secondary processors using memory allocated
43 * from the workspace.  The begin and end of the per-CPU data area is cache
44 * line aligned (CPU_CACHE_LINE_BYTES).
45 *
46 * @{
47 */
48
49RTEMS_LINKER_RWSET_DECLARE( _Per_CPU_Data, char );
50
51/**
52 * @brief Declares a per-CPU item of the specified type.
53 *
54 * Items declared with this macro have external linkage.
55 *
56 * @param type The type of the item.
57 * @param item The designator of the item.
58 */
59#define PER_CPU_DATA_ITEM_DECLARE( type, item ) \
60  RTEMS_LINKER_RWSET_ITEM_DECLARE( _Per_CPU_Data, type, item ) \
61  RTEMS_SECTION( ".rtemsrwset._Per_CPU_Data.content.1" )
62
63/**
64 * @brief Defines a per-CPU item of the specified type.
65 *
66 * @param type The type of the item.
67 * @param item The designator of the item.
68 */
69#define PER_CPU_DATA_ITEM( type, item ) \
70  RTEMS_LINKER_RWSET_ITEM( _Per_CPU_Data, type, item )
71
72/**
73 * @brief Returns the offset of the per-CPU item to the begin of the per-CPU
74 * data area.
75 *
76 * @param item The designator of the item.
77 */
78#define PER_CPU_DATA_OFFSET( item ) \
79  ( (uintptr_t) &_Linker_set__Per_CPU_Data_##item \
80    - (uintptr_t) RTEMS_LINKER_SET_BEGIN( _Per_CPU_Data ) )
81
82/**
83 * @brief Returns a pointer of the specified type to the per-CPU item at the
84 * specified offset for the specified processor.
85 *
86 * @param cpu The processor of the item.
87 * @param type The type of the item.
88 * @param offset The offset of the item.
89 */
90#ifdef RTEMS_SMP
91#define PER_CPU_DATA_GET_BY_OFFSET( cpu, type, offset ) \
92  (type *) ( cpu->data + offset )
93#else
94#define PER_CPU_DATA_GET_BY_OFFSET( cpu, type, offset ) \
95  (type *) ( (uintptr_t) RTEMS_LINKER_SET_BEGIN( _Per_CPU_Data ) + offset ), \
96    (void) cpu
97#endif
98
99/**
100 * @brief Returns a pointer of the specified type to the specified per-CPU item
101 * for the specified processor.
102 *
103 * @param cpu The processor of the item.
104 * @param type The type of the item.
105 * @param item The designator of the item.
106 */
107#ifdef RTEMS_SMP
108#define PER_CPU_DATA_GET( cpu, type, item ) \
109  PER_CPU_DATA_GET_BY_OFFSET( cpu, type, PER_CPU_DATA_OFFSET( item ) )
110#else
111#define PER_CPU_DATA_GET( cpu, type, item ) \
112  &_Linker_set__Per_CPU_Data_##item, (void) cpu
113#endif
114
115/** @} */
116
117#ifdef __cplusplus
118}
119#endif /* __cplusplus */
120
121#endif /* _RTEMS_SCORE_PERCPUDATA_H */
Note: See TracBrowser for help on using the repository browser.