RTEMS  5.1
bdbuf.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 
19 /*
20  * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
21  *
22  * Redistribution and use in source and binary forms, with or without
23  * modification, are permitted provided that the following conditions
24  * are met:
25  * 1. Redistributions of source code must retain the above copyright
26  * notice, this list of conditions and the following disclaimer.
27  * 2. Redistributions in binary form must reproduce the above copyright
28  * notice, this list of conditions and the following disclaimer in the
29  * documentation and/or other materials provided with the distribution.
30  *
31  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
32  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
33  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
34  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
35  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
36  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
37  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
38  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
39  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
40  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
41  * POSSIBILITY OF SUCH DAMAGE.
42  */
43 
44 #ifndef _RTEMS_CONFDEFS_BDBUF_H
45 #define _RTEMS_CONFDEFS_BDBUF_H
46 
47 #ifndef __CONFIGURATION_TEMPLATE_h
48 #error "Do not include this file directly, use <rtems/confdefs.h> instead"
49 #endif
50 
51 #ifdef CONFIGURE_INIT
52 
53 #ifdef CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
54 
55 #include <rtems/confdefs/percpu.h>
56 #include <rtems/bdbuf.h>
57 
58 #ifndef CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS
59  #define CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS \
60  RTEMS_BDBUF_MAX_READ_AHEAD_BLOCKS_DEFAULT
61 #endif
62 
63 #ifndef CONFIGURE_BDBUF_MAX_WRITE_BLOCKS
64  #define CONFIGURE_BDBUF_MAX_WRITE_BLOCKS \
65  RTEMS_BDBUF_MAX_WRITE_BLOCKS_DEFAULT
66 #endif
67 
68 #ifndef CONFIGURE_SWAPOUT_TASK_PRIORITY
69  #define CONFIGURE_SWAPOUT_TASK_PRIORITY \
70  RTEMS_BDBUF_SWAPOUT_TASK_PRIORITY_DEFAULT
71 #endif
72 
73 #ifndef CONFIGURE_SWAPOUT_SWAP_PERIOD
74  #define CONFIGURE_SWAPOUT_SWAP_PERIOD \
75  RTEMS_BDBUF_SWAPOUT_TASK_SWAP_PERIOD_DEFAULT
76 #endif
77 
78 #ifndef CONFIGURE_SWAPOUT_BLOCK_HOLD
79  #define CONFIGURE_SWAPOUT_BLOCK_HOLD \
80  RTEMS_BDBUF_SWAPOUT_TASK_BLOCK_HOLD_DEFAULT
81 #endif
82 
83 #ifndef CONFIGURE_SWAPOUT_WORKER_TASKS
84  #define CONFIGURE_SWAPOUT_WORKER_TASKS \
85  RTEMS_BDBUF_SWAPOUT_WORKER_TASKS_DEFAULT
86 #endif
87 
88 #ifndef CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY
89  #define CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY \
90  RTEMS_BDBUF_SWAPOUT_WORKER_TASK_PRIORITY_DEFAULT
91 #endif
92 
93 #ifndef CONFIGURE_BDBUF_TASK_STACK_SIZE
94  #define CONFIGURE_BDBUF_TASK_STACK_SIZE \
95  RTEMS_BDBUF_TASK_STACK_SIZE_DEFAULT
96 #endif
97 
98 #ifndef CONFIGURE_BDBUF_CACHE_MEMORY_SIZE
99  #define CONFIGURE_BDBUF_CACHE_MEMORY_SIZE \
100  RTEMS_BDBUF_CACHE_MEMORY_SIZE_DEFAULT
101 #endif
102 
103 #ifndef CONFIGURE_BDBUF_BUFFER_MIN_SIZE
104  #define CONFIGURE_BDBUF_BUFFER_MIN_SIZE \
105  RTEMS_BDBUF_BUFFER_MIN_SIZE_DEFAULT
106 #endif
107 
108 #ifndef CONFIGURE_BDBUF_BUFFER_MAX_SIZE
109  #define CONFIGURE_BDBUF_BUFFER_MAX_SIZE \
110  RTEMS_BDBUF_BUFFER_MAX_SIZE_DEFAULT
111 #endif
112 
113 #ifndef CONFIGURE_BDBUF_READ_AHEAD_TASK_PRIORITY
114  #define CONFIGURE_BDBUF_READ_AHEAD_TASK_PRIORITY \
115  RTEMS_BDBUF_READ_AHEAD_TASK_PRIORITY_DEFAULT
116 #endif
117 
118 #define _CONFIGURE_LIBBLOCK_TASKS \
119  ( 1 + CONFIGURE_SWAPOUT_WORKER_TASKS \
120  + ( CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS != 0 ) )
121 
122 #define _CONFIGURE_LIBBLOCK_TASKS_STACK_EXTRA \
123  ( _CONFIGURE_LIBBLOCK_TASKS \
124  * ( CONFIGURE_BDBUF_TASK_STACK_SIZE <= CONFIGURE_MINIMUM_TASK_STACK_SIZE ? \
125  0 : \
126  CONFIGURE_BDBUF_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE ) )
127 
128 #ifdef __cplusplus
129 extern "C" {
130 #endif
131 
133  CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS,
134  CONFIGURE_BDBUF_MAX_WRITE_BLOCKS,
135  CONFIGURE_SWAPOUT_TASK_PRIORITY,
136  CONFIGURE_SWAPOUT_SWAP_PERIOD,
137  CONFIGURE_SWAPOUT_BLOCK_HOLD,
138  CONFIGURE_SWAPOUT_WORKER_TASKS,
139  CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY,
140  CONFIGURE_BDBUF_TASK_STACK_SIZE,
141  CONFIGURE_BDBUF_CACHE_MEMORY_SIZE,
142  CONFIGURE_BDBUF_BUFFER_MIN_SIZE,
143  CONFIGURE_BDBUF_BUFFER_MAX_SIZE,
144  CONFIGURE_BDBUF_READ_AHEAD_TASK_PRIORITY
145 };
146 
147 #ifdef __cplusplus
148 }
149 #endif
150 
151 #else /* !CONFIGURE_APPLICATION_NEEDS_LIBBLOCK */
152 
153 #define _CONFIGURE_LIBBLOCK_TASKS 0
154 
155 #define _CONFIGURE_LIBBLOCK_TASKS_STACK_EXTRA 0
156 
157 #endif /* CONFIGURE_APPLICATION_NEEDS_LIBBLOCK */
158 
159 #endif /* CONFIGURE_INIT */
160 
161 #endif /* _RTEMS_CONFDEFS_BDBUF_H */
Evaluate Per-CPU Configuration Options.
Definition: bdbuf.h:361
const rtems_bdbuf_config rtems_bdbuf_configuration
Block Device Buffer Management.