source: rtems-libbsd/rtemsbsd/include/rtems/bsd/bsd.h @ 130fa35

55-freebsd-126-freebsd-12freebsd-9.3
Last change on this file since 130fa35 was 130fa35, checked in by Chris Johns <chrisj@…>, on 06/27/16 at 03:09:04

Make the domain allocation size global to allow it to set in tests.

Some BSPs with multiple NIC locked in the tests due to not enough
memory. This provides a simple per BSP way to increase the memory
size.

  • Property mode set to 100644
File size: 6.5 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup rtems_bsd
5 *
6 * @brief TODO.
7 */
8
9/*
10 * Copyright (c) 2009, 2016 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 * Redistribution and use in source and binary forms, with or without
19 * modification, are permitted provided that the following conditions
20 * are met:
21 * 1. Redistributions of source code must retain the above copyright
22 *    notice, this list of conditions and the following disclaimer.
23 * 2. Redistributions in binary form must reproduce the above copyright
24 *    notice, this list of conditions and the following disclaimer in the
25 *    documentation and/or other materials provided with the distribution.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
28 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
31 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * SUCH DAMAGE.
38 */
39
40#ifndef _RTEMS_BSD_BSD_H_
41#define _RTEMS_BSD_BSD_H_
42
43#include <sys/cdefs.h>
44#include <sys/queue.h>
45#include <sys/kernel.h>
46
47#include <stdarg.h>
48
49#include <rtems.h>
50
51#ifdef __cplusplus
52extern "C" {
53#endif /* __cplusplus */
54
55typedef enum {
56        RTEMS_BSD_RES_IRQ = 1,
57        RTEMS_BSD_RES_MEMORY = 3
58} rtems_bsd_device_resource_type;
59
60typedef struct {
61        rtems_bsd_device_resource_type type;
62        unsigned long start_request;
63        unsigned long start_actual;
64} rtems_bsd_device_resource;
65
66typedef struct {
67        const char *name;
68        int unit;
69        size_t resource_count;
70        const rtems_bsd_device_resource *resources;
71        const struct sysinit *driver_reference;
72} rtems_bsd_device;
73
74#define RTEMS_BSD_DEFINE_NEXUS_DEVICE(name, unit, resource_count, resources) \
75    extern struct sysinit SYSINIT_ENTRY_NAME(name##_nexusmodule); \
76    RTEMS_BSD_DEFINE_SET_ITEM(nexus, name##unit, rtems_bsd_device) = \
77        { #name, unit, (resource_count), (resources), \
78            &SYSINIT_ENTRY_NAME(name##_nexusmodule) }
79
80rtems_status_code rtems_bsd_initialize(void);
81
82/**
83 * @brief Returns the initial priority for a task specified by its name.
84 *
85 * Applications may provide their own implementation of this function.  For
86 * example they can define their implementation in the same module which calls
87 * rtems_bsd_initialize().
88 *
89 * @param[in] name The task name.
90 *
91 * @return The desired initial task priority.
92 */
93rtems_task_priority rtems_bsd_get_task_priority(const char *name);
94
95/**
96 * @brief Returns the stack size for a task specified by its name.
97 *
98 * Applications may provide their own implementation of this function.  For
99 * example they can define their implementation in the same module which calls
100 * rtems_bsd_initialize().
101 *
102 * @param[in] name The task name.
103 *
104 * @return The desired task stack size.
105 */
106size_t rtems_bsd_get_task_stack_size(const char *name);
107
108typedef enum {
109        RTEMS_BSD_ALLOCATOR_DOMAIN_PAGE,
110        RTEMS_BSD_ALLOCATOR_DOMAIN_MBUF,
111        RTEMS_BSD_ALLOCATOR_DOMAIN_MALLOC
112} rtems_bsd_allocator_domain;
113
114/**
115 * @brief The size for the page/mbufs default allocator domain.
116 *
117 * Applications may set this value to change the value returned by the default.
118 */
119extern uintptr_t rtems_bsd_allocator_domain_page_mbuf_size;
120
121/**
122 * @brief Returns the size for a specific allocator domain.
123 *
124 * Applications may provide their own implementation of this function.  For
125 * example they can define their implementation in the same module which calls
126 * rtems_bsd_initialize().
127 *
128 * @param[in] domain The allocator domain.
129 *
130 * @return The desired size for the specified allocator domain.
131 */
132uintptr_t rtems_bsd_get_allocator_domain_size(
133    rtems_bsd_allocator_domain domain);
134
135/**
136 * @brief Returns the Ethernet MAC address for a specified device.
137 *
138 * Applications may provide their own implementation of this function.  For
139 * example they can define their implementation in the same module which calls
140 * rtems_bsd_initialize().
141 *
142 * The default implementation returns
143 * { 0x0e, 0xb0, 0xba, 0x5e, 0xba, 0x11 + unit }.
144 *
145 * This is a workaround.  A better approach would be to use a device tree and a
146 * bus device similar to the FreeBSD SIMPLEBUS(4).
147 *
148 * @param[in] name The device name.
149 * @param[in] unit The device unit.
150 * @param[out] mac_addr The Ethernet MAC address.
151 */
152void rtems_bsd_get_mac_address(const char *name, int unit,
153    uint8_t mac_addr[6]);
154
155/**
156 * @defgroup BSDBusRoot Bus Root Functions
157 *
158 * @brief Functions to perform bus root operations.
159 *
160 * Suspend and resume can be used to go into or exit a power saving state.
161 * Detach may be used to shutdown the system and do a warm reset.
162 *
163 * All functions must be called from task context.  They perform complex
164 * operations affecting all devices of the bus tree and work only if all
165 * drivers are written properly and no resources used by the drivers are
166 * blocked.
167 *
168 * @{
169 */
170
171/**
172 * @brief Attach the root bus.
173 *
174 * @retval 0 Successful operation.
175 * @retval errno Otherwise.
176 */
177int rtems_bsd_bus_root_attach(void);
178
179/**
180 * @brief Suspend the root bus.
181 *
182 * @retval 0 Successful operation.
183 * @retval errno Otherwise.
184 */
185int rtems_bsd_bus_root_suspend(void);
186
187/**
188 * @brief Resume the root bus.
189 *
190 * @retval 0 Successful operation.
191 * @retval errno Otherwise.
192 */
193int rtems_bsd_bus_root_resume(void);
194
195/**
196 * @brief Detach the root bus.
197 *
198 * @retval 0 Successful operation.
199 * @retval errno Otherwise.
200 */
201int rtems_bsd_bus_root_detach(void);
202
203/**
204 * @brief Sets the output back-end for logging functions.
205 *
206 * @param new_vprintf_handler The new output back-end for logging functions.
207 *
208 * @see rtems_bsd_vprintf().
209 */
210void rtems_bsd_set_vprintf_handler(int (*new_vprintf_handler)
211    (int, const char *, va_list));
212
213/**
214 * @brief Output back-end for logging functions.
215 *
216 * Used by kernel space printf(), vprintf(), log() and vlog().  Used by user
217 * space syslog() and vsyslog().
218 *
219 * The default uses putchar() and uses a mutex to serialize the output.  It may
220 * be customized via rtems_bsd_set_vprintf_handler().
221 */
222int rtems_bsd_vprintf(int level, const char *fmt, va_list ap);
223
224/** @} */
225
226#ifdef __cplusplus
227}
228#endif /* __cplusplus */
229
230#endif /* _RTEMS_BSD_BSD_H_ */
Note: See TracBrowser for help on using the repository browser.