source: rtems-libbsd/rtemsbsd/include/rtems/bsd/bsd.h @ 5383ed4

4.115-freebsd-12freebsd-9.3
Last change on this file since 5383ed4 was 5383ed4, checked in by Sebastian Huber <sebastian.huber@…>, on Feb 13, 2015 at 9:31:27 AM

Add and use rtems_bsd_get_allocator_domain_size()

  • Property mode set to 100644
File size: 4.6 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup rtems_bsd
5 *
6 * @brief TODO.
7 */
8
9/*
10 * Copyright (c) 2009-2015 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 <rtems.h>
48
49#ifdef __cplusplus
50extern "C" {
51#endif /* __cplusplus */
52
53typedef enum {
54        RTEMS_BSD_RES_IRQ = 1,
55        RTEMS_BSD_RES_MEMORY = 3
56} rtems_bsd_device_resource_type;
57
58typedef struct {
59        rtems_bsd_device_resource_type type;
60        unsigned long start_request;
61        unsigned long start_actual;
62} rtems_bsd_device_resource;
63
64typedef struct {
65        const char *name;
66        int unit;
67        size_t resource_count;
68        const rtems_bsd_device_resource *resources;
69        const struct sysinit *driver_reference;
70} rtems_bsd_device;
71
72#define RTEMS_BSD_DEFINE_NEXUS_DEVICE(name, unit, resource_count, resources) \
73    extern struct sysinit SYSINIT_ENTRY_NAME(name##_nexusmodule); \
74    RTEMS_BSD_DEFINE_SET_ITEM(nexus, name##unit, rtems_bsd_device) = \
75        { #name, unit, (resource_count), (resources), \
76            &SYSINIT_ENTRY_NAME(name##_nexusmodule) }
77
78rtems_status_code rtems_bsd_initialize(void);
79
80/**
81 * @brief Returns the initial priority for a task specified by its name.
82 *
83 * Applications may provide their own implementation of this function.  For
84 * example they can define their implementation in the same module which calls
85 * rtems_bsd_initialize().
86 *
87 * @param[in] name The task name.
88 *
89 * @return The desired initial task priority.
90 */
91rtems_task_priority rtems_bsd_get_task_priority(const char *name);
92
93/**
94 * @brief Returns the stack size for a task specified by its name.
95 *
96 * Applications may provide their own implementation of this function.  For
97 * example they can define their implementation in the same module which calls
98 * rtems_bsd_initialize().
99 *
100 * @param[in] name The task name.
101 *
102 * @return The desired task stack size.
103 */
104size_t rtems_bsd_get_task_stack_size(const char *name);
105
106typedef enum {
107        RTEMS_BSD_ALLOCATOR_DOMAIN_PAGE,
108        RTEMS_BSD_ALLOCATOR_DOMAIN_MBUF,
109        RTEMS_BSD_ALLOCATOR_DOMAIN_MALLOC
110} rtems_bsd_allocator_domain;
111
112/**
113 * @brief Returns the size for a specific allocator domain.
114 *
115 * Applications may provide their own implementation of this function.  For
116 * example they can define their implementation in the same module which calls
117 * rtems_bsd_initialize().
118 *
119 * @param[in] domain The allocator domain.
120 *
121 * @return The desired size for the specified allocator domain.
122 */
123uintptr_t rtems_bsd_get_allocator_domain_size(
124    rtems_bsd_allocator_domain domain);
125
126/**
127 * @brief Returns the Ethernet MAC address for a specified device.
128 *
129 * Applications may provide their own implementation of this function.  For
130 * example they can define their implementation in the same module which calls
131 * rtems_bsd_initialize().
132 *
133 * The default implementation returns
134 * { 0x0e, 0xb0, 0xba, 0x5e, 0xba, 0x11 + unit }.
135 *
136 * This is a workaround.  A better approach would be to use a device tree and a
137 * bus device similar to the FreeBSD SIMPLEBUS(4).
138 *
139 * @param[in] name The device name.
140 * @param[in] unit The device unit.
141 * @param[out] mac_addr The Ethernet MAC address.
142 */
143void rtems_bsd_get_mac_address(const char *name, int unit,
144    uint8_t mac_addr[6]);
145
146#ifdef __cplusplus
147}
148#endif /* __cplusplus */
149
150#endif /* _RTEMS_BSD_BSD_H_ */
Note: See TracBrowser for help on using the repository browser.