009-08-05 Chris Johns <chrisj@rtems.org>

* libmisc/dummy/dummy-networking.c: New.
        * libmisc/dummy/dummy.c, libmisc/Makefile.am: Move
        trhe networking configuration into a separate file so
        configuration varations do not cause conflicts.
        * score/inline/rtems/score/object.inl,
        score/include/rtems/score/object.h: Remove warnings.
        * score/inline/rtems/score/object.inl: Add _Chain_First,
        _Chain_Last, _Chain_Mext, and _Chain_Previous.
        * sapi/inline/rtems/chain.inl: Add rtems_chain_first,
        rtems_chain_last, rtems_chain_mext, and rtems_chain_previous.
        * libblock/include/rtems/diskdevs.h: Remove the bdbuf pool id and
        block_size_log2. Add media_block_size.
        * libblock/src/diskdevs.c: Remove size restrictions on block
        size. Add media block size initialisation. Remove comment to clean
        up the bdbuf cache.
        * libblock/src/blkdev.c: Remove references to
        block_size_log2. Allow any block size.
        * libblock/include/rtems/bdbuf.h, libblock/src/bdbuf.c: Remove all
        references to pools and make the cache handle demand driver
        variable buffer size allocation. Added worker threads support the
        swapout task.
        * sapi/include/confdefs.h: Updated the bdbuf configutation.
This commit is contained in:
Chris Johns
2009-08-05 00:00:54 +00:00
parent f14a21df69
commit 0d15414ed6
14 changed files with 1526 additions and 1014 deletions
+25
View File
@@ -1,3 +1,28 @@
2009-08-05 Chris Johns <chrisj@rtems.org>
* libmisc/dummy/dummy-networking.c: New.
* libmisc/dummy/dummy.c, libmisc/Makefile.am: Move
trhe networking configuration into a separate file so
configuration varations do not cause conflicts.
* score/inline/rtems/score/object.inl,
score/include/rtems/score/object.h: Remove warnings.
* score/inline/rtems/score/object.inl: Add _Chain_First,
_Chain_Last, _Chain_Mext, and _Chain_Previous.
* sapi/inline/rtems/chain.inl: Add rtems_chain_first,
rtems_chain_last, rtems_chain_mext, and rtems_chain_previous.
* libblock/include/rtems/diskdevs.h: Remove the bdbuf pool id and
block_size_log2. Add media_block_size.
* libblock/src/diskdevs.c: Remove size restrictions on block
size. Add media block size initialisation. Remove comment to clean
up the bdbuf cache.
* libblock/src/blkdev.c: Remove references to
block_size_log2. Allow any block size.
* libblock/include/rtems/bdbuf.h, libblock/src/bdbuf.c: Remove all
references to pools and make the cache handle demand driver
variable buffer size allocation. Added worker threads support the
swapout task.
* sapi/include/confdefs.h: Updated the bdbuf configutation.
2009-08-04 Joel Sherrill <joel.sherrill@OARcorp.com>
* sapi/include/confdefs.h: Account for allocation of user extension
+125 -136
View File
@@ -10,9 +10,10 @@
* Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia
* Author: Victor V. Vengerov <vvv@oktet.ru>
*
* Copyright (C) 2008 Chris Johns <chrisj@rtems.org>
* Copyright (C) 2008,2009 Chris Johns <chrisj@rtems.org>
* Rewritten to remove score mutex access. Fixes many performance
* issues.
Change to support demand driven variable buffer sizes.
*
* @(#) bdbuf.h,v 1.9 2005/02/02 00:06:18 joel Exp
*/
@@ -44,8 +45,33 @@ extern "C" {
* devices and file systems. The code provides read ahead and write queuing to
* the drivers and fast cache look up using an AVL tree.
*
* The buffers are held in pools based on size. Each pool has buffers and the
* buffers follow this state machine:
* The block size used by a file system can be set at runtime and must be a
* multiple of the disk device block size. The disk device's physical block
* size is called the media block size. The file system can set the block size
* it uses to a larger multiple of the media block size. The driver must be
* able to handle buffers sizes larger than one media block.
*
* The user configures the amount of memory to be used as buffers in the cache,
* and the minimum and maximum buffer size. The cache will allocate additional
* memory for the buffer descriptors and groups. There are enough buffer
* descriptors allocated so all the buffer memory can be used as minimum sized
* buffers.
*
* The cache is a single pool of buffers. The buffer memory is divided into
* groups where the size of buffer memory allocated to a group is the maximum
* buffer size. A group's memory can be divided down into small buffer sizes
* that are a multiple of 2 of the minimum buffer size. A group is the minumum
* allocation unit for buffers of a specific size. If a buffer of maximum size
* is request the group will have a single buffer. If a buffer of minium size
* is requested the group is divided into minimum sized buffers and the
* remaining buffers are held ready for use. A group keeps track of which
* buffers are with a file system or driver and groups who have buffer in use
* cannot be realloced. Groups with no buffers in use can be taken and
* realloced to a new size. This is how buffers of different sizes move around
* the cache.
* The buffers are held in various lists in the cache. All buffers follow this
* state machine:
*
* @dot
* digraph g {
@@ -82,14 +108,14 @@ extern "C" {
* to another requester until released back to the cache. The same goes to a
* buffer in the transfer state. The transfer state means being read or
* written. If the file system has modifed the block and releases it as
* modified it placed on the pool's modified list and a hold timer
* modified it placed on the cache's modified list and a hold timer
* initialised. The buffer is held for the hold time before being written to
* disk. Buffers are held for a configurable period of time on the modified
* list as a write sets the state to transfer and this locks the buffer out
* from the file system until the write complete. Buffers are often repeatable
* accessed and modified in a series of small updates so if sent to the disk
* when released as modified the user would have to block waiting until it had
* been written. This would be a performance problem.
* from the file system until the write completes. Buffers are often accessed
* and modified in a series of small updates so if sent to the disk when
* released as modified the user would have to block waiting until it had been
* written. This would be a performance problem.
*
* The code performs mulitple block reads and writes. Multiple block reads or
* read ahead increases performance with hardware that supports it. It also
@@ -103,12 +129,22 @@ extern "C" {
* than the LRU list. This means these buffers are used before buffers used by
* the file system.
*
* The pool has the following lists of buffers:
* The cache has the following lists of buffers:
* - @c ready: Empty buffers created when the pool is initialised.
* - @c modified: Buffers waiting to be written to disk.
* - @c sync: Buffers to be synced to disk.
* - @c lru: Accessed buffers released in least recently used order.
*
* The cache scans the ready list then the LRU list for a suitable buffer in
* this order. A suitable buffer is one that matches the same allocation size
* as the device the buffer is for. The a buffer's group has no buffers in use
* with the file system or driver the group is reallocated. This means the
* buffers in the group are invalidated, resized and placed on the ready queue.
* There is a performance issue with this design. The reallocation of a group
* may forced recently accessed buffers out of the cache when they should
* not. The design should be change to have groups on a LRU list if they have
* no buffers in use.
*
* @{
*/
@@ -127,15 +163,21 @@ typedef enum
RTEMS_BDBUF_STATE_TRANSFER = 7 /**< Being transferred to or from disk */
} rtems_bdbuf_buf_state;
/**
* Forward reference to the block.
*/
struct rtems_bdbuf_group;
typedef struct rtems_bdbuf_group rtems_bdbuf_group;
/**
* To manage buffers we using buffer descriptors (BD). A BD holds a buffer plus
* a range of other information related to managing the buffer in the cache. To
* speed-up buffer lookup descriptors are organized in AVL-Tree. The fields
* speed-up buffer lookup descriptors are organized in AVL-Tree. The fields
* 'dev' and 'block' are search keys.
*/
typedef struct rtems_bdbuf_buffer
{
rtems_chain_node link; /* Link in the BD onto a number of lists. */
rtems_chain_node link; /**< Link the BD onto a number of lists. */
struct rtems_bdbuf_avl_node
{
@@ -154,94 +196,57 @@ typedef struct rtems_bdbuf_buffer
volatile rtems_bdbuf_buf_state state; /**< State of the buffer. */
volatile uint32_t waiters; /**< The number of threads waiting on this
* buffer. */
rtems_bdpool_id pool; /**< Identifier of buffer pool to which this buffer
belongs */
volatile uint32_t hold_timer; /**< Timer to indicate how long a buffer
* has been held in the cache modified. */
volatile uint32_t waiters; /**< The number of threads waiting on this
* buffer. */
rtems_bdbuf_group* group; /**< Pointer to the group of BDs this BD is
* part of. */
volatile uint32_t hold_timer; /**< Timer to indicate how long a buffer
* has been held in the cache modified. */
} rtems_bdbuf_buffer;
/**
* The groups of the blocks with the same size are collected in a pool. Note
* that a several of the buffer's groups with the same size can exists.
* A group is a continuous block of buffer descriptors. A group covers the
* maximum configured buffer size and is the allocation size for the buffers to
* a specific buffer size. If you allocate a buffer to be a specific size, all
* buffers in the group, if there are more than 1 will also be that size. The
* number of buffers in a group is a multiple of 2, ie 1, 2, 4, 8, etc.
*/
typedef struct rtems_bdbuf_pool
struct rtems_bdbuf_group
{
uint32_t blksize; /**< The size of the blocks (in bytes) */
uint32_t nblks; /**< Number of blocks in this pool */
uint32_t flags; /**< Configuration flags */
rtems_id lock; /**< The pool lock. Lock this data and
* all BDs. */
rtems_id sync_lock; /**< Sync calls lock writes. */
bool sync_active; /**< True if a sync is active. */
rtems_id sync_requester; /**< The sync requester. */
dev_t sync_device; /**< The device to sync */
rtems_bdbuf_buffer* tree; /**< Buffer descriptor lookup AVL tree
* root */
rtems_chain_control ready; /**< Free buffers list (or read-ahead) */
rtems_chain_control lru; /**< Last recently used list */
rtems_chain_control modified; /**< Modified buffers list */
rtems_chain_control sync; /**< Buffers to sync list */
rtems_id access; /**< Obtain if waiting for a buffer in the
* ACCESS state. */
volatile uint32_t access_waiters; /**< Count of access blockers. */
rtems_id transfer; /**< Obtain if waiting for a buffer in the
* TRANSFER state. */
volatile uint32_t transfer_waiters; /**< Count of transfer blockers. */
rtems_id waiting; /**< Obtain if waiting for a buffer and the
* none are available. */
volatile uint32_t wait_waiters; /**< Count of waiting blockers. */
rtems_bdbuf_buffer* bds; /**< Pointer to table of buffer descriptors
* allocated for this buffer pool. */
void* buffers; /**< The buffer's memory. */
} rtems_bdbuf_pool;
/**
* Configuration structure describes block configuration (size, amount, memory
* location) for buffering layer pool.
*/
typedef struct rtems_bdbuf_pool_config {
int size; /**< Size of block */
int num; /**< Number of blocks of appropriate size */
unsigned char* mem_area; /**< Pointer to the blocks location or NULL, in this
* case memory for blocks will be allocated by
* Buffering Layer with the help of RTEMS partition
* manager */
} rtems_bdbuf_pool_config;
/**
* External reference to the pool configuration table describing each pool in
* the system.
*
* The configuration table is provided by the application.
*/
extern rtems_bdbuf_pool_config rtems_bdbuf_pool_configuration[];
/**
* External reference the size of the pool configuration table
* @ref rtems_bdbuf_pool_configuration.
*
* The configuration table size is provided by the application.
*/
extern size_t rtems_bdbuf_pool_configuration_size;
rtems_chain_node link; /**< Link the groups on a LRU list if they
* have no buffers in use. */
size_t bds_per_group; /**< The number of BD allocated to this
* group. This value must be a multiple of
* 2. */
uint32_t users; /**< How many users the block has. */
rtems_bdbuf_buffer* bdbuf; /**< First BD this block covers. */
};
/**
* Buffering configuration definition. See confdefs.h for support on using this
* structure.
*/
typedef struct rtems_bdbuf_config {
uint32_t max_read_ahead_blocks; /**< Number of blocks to read ahead. */
uint32_t max_write_blocks; /**< Number of blocks to write at once. */
rtems_task_priority swapout_priority; /**< Priority of the swap out task. */
uint32_t swapout_period; /**< Period swapout checks buf timers. */
uint32_t swap_block_hold; /**< Period a buffer is held. */
uint32_t max_read_ahead_blocks; /**< Number of blocks to read
* ahead. */
uint32_t max_write_blocks; /**< Number of blocks to write
* at once. */
rtems_task_priority swapout_priority; /**< Priority of the swap out
* task. */
uint32_t swapout_period; /**< Period swapout checks buf
* timers. */
uint32_t swap_block_hold; /**< Period a buffer is held. */
uint32_t swapout_workers; /**< The number of worker
* threads for the swapout
* task. */
rtems_task_priority swapout_worker_priority; /**< Priority of the swap out
* task. */
size_t size; /**< Size of memory in the
* cache */
uint32_t buffer_min; /**< Minimum buffer size. */
uint32_t buffer_max; /**< Maximum buffer size
* supported. It is also the
* allocation size. */
} rtems_bdbuf_config;
/**
@@ -249,7 +254,7 @@ typedef struct rtems_bdbuf_config {
*
* The configuration is provided by the application.
*/
extern rtems_bdbuf_config rtems_bdbuf_configuration;
extern const rtems_bdbuf_config rtems_bdbuf_configuration;
/**
* The max_read_ahead_blocks value is altered if there are fewer buffers
@@ -277,12 +282,36 @@ extern rtems_bdbuf_config rtems_bdbuf_configuration;
*/
#define RTEMS_BDBUF_SWAPOUT_TASK_BLOCK_HOLD_DEFAULT 1000
/**
* Default swap-out worker tasks. Currently disabled.
*/
#define RTEMS_BDBUF_SWAPOUT_WORKER_TASKS_DEFAULT 0
/**
* Default swap-out worker task priority. The same as the swapout task.
*/
#define RTEMS_BDBUF_SWAPOUT_WORKER_TASK_PRIORITY_DEFAULT \
RTEMS_BDBUF_SWAPOUT_TASK_PRIORITY_DEFAULT
/**
* Default size of memory allocated to the cache.
*/
#define RTEMS_BDBUF_CACHE_MEMORY_SIZE_DEFAULT (64 * 512)
/**
* Default minimum size of buffers.
*/
#define RTEMS_BDBUF_BUFFER_MIN_SIZE_DEFAULT (512)
/**
* Default maximum size of buffers.
*/
#define RTEMS_BDBUF_BUFFER_MAX_SIZE_DEFAULT (4096)
/**
* Prepare buffering layer to work - initialize buffer descritors and (if it is
* neccessary) buffers. Buffers will be allocated accoriding to the
* configuration table, each entry describes the size of block and the size of
* the pool. After initialization all blocks is placed into the ready state.
* lists.
* neccessary) buffers. After initialization all blocks is placed into the
* ready state.
*
* @return RTEMS status code (RTEMS_SUCCESSFUL if operation completed
* successfully or error code if error is occured)
@@ -395,13 +424,12 @@ rtems_bdbuf_sync (rtems_bdbuf_buffer* bd);
/**
* Synchronize all modified buffers for this device with the disk and wait
* until the transfers have completed. The sync mutex for the pool is locked
* until the transfers have completed. The sync mutex for the cache is locked
* stopping the addition of any further modifed buffers. It is only the
* currently modified buffers that are written.
*
* @note Nesting calls to sync multiple devices attached to a single pool will
* be handled sequentially. A nested call will be blocked until the first sync
* request has complete. This is only true for device using the same pool.
* @note Nesting calls to sync multiple devices will be handled sequentially. A
* nested call will be blocked until the first sync request has complete.
*
* @param dev Block device number
*
@@ -411,45 +439,6 @@ rtems_bdbuf_sync (rtems_bdbuf_buffer* bd);
rtems_status_code
rtems_bdbuf_syncdev (dev_t dev);
/**
* Find first appropriate buffer pool. This primitive returns the index of
* first buffer pool which block size is greater than or equal to specified
* size.
*
* @param block_size Requested block size
* @param pool The pool to use for the requested pool size.
*
* @return RTEMS status code (RTEMS_SUCCESSFUL if operation completed
* successfully or error code if error is occured)
* @retval RTEMS_INVALID_SIZE The specified block size is invalid (not a power
* of 2)
* @retval RTEMS_NOT_DEFINED The buffer pool for this or greater block size
* is not configured.
*/
rtems_status_code
rtems_bdbuf_find_pool (uint32_t block_size, rtems_bdpool_id *pool);
/**
* Obtain characteristics of buffer pool with specified number.
*
* @param pool Buffer pool number
* @param block_size Block size for which buffer pool is configured returned
* there
* @param blocks Number of buffers in buffer pool.
*
* RETURNS:
* @return RTEMS status code (RTEMS_SUCCESSFUL if operation completed
* successfully or error code if error is occured)
* @retval RTEMS_INVALID_SIZE The appropriate buffer pool is not configured.
*
* @note Buffer pools enumerated continuously starting from 0.
*/
rtems_status_code rtems_bdbuf_get_pool_info(
rtems_bdpool_id pool,
uint32_t *block_size,
uint32_t *blocks
);
/** @} */
#ifdef __cplusplus
+5 -15
View File
@@ -20,13 +20,6 @@
#include <rtems/libio.h>
#include <stdlib.h>
/**
* @ingroup rtems_bdbuf
*
* Buffer pool identifier.
*/
typedef int rtems_bdpool_id;
#include <rtems/blkdev.h>
#ifdef __cplusplus
@@ -107,19 +100,16 @@ typedef struct rtems_disk_device {
/**
* Device block size in bytes.
*
* This is the minimum transfer unit and must be power of two.
* This is the minimum transfer unit. It can be any size.
*/
uint32_t block_size;
/**
* Binary logarithm of the block size.
* Device media block size in bytes.
*
* This is the media transfer unit the hardware defaults to.
*/
uint32_t block_size_log2;
/**
* Buffer pool assigned to this disk.
*/
rtems_bdpool_id pool;
uint32_t media_block_size;
/**
* IO control handler for this disk.
+1132 -745
View File
File diff suppressed because it is too large Load Diff
+4 -8
View File
@@ -37,7 +37,6 @@ rtems_blkdev_generic_read(
void * arg)
{
rtems_libio_rw_args_t *args = arg;
int block_size_log2;
int block_size;
char *buf;
unsigned int count;
@@ -51,15 +50,14 @@ rtems_blkdev_generic_read(
if (dd == NULL)
return RTEMS_INVALID_NUMBER;
block_size_log2 = dd->block_size_log2;
block_size = dd->block_size;
buf = args->buffer;
count = args->count;
args->bytes_moved = 0;
block = args->offset >> block_size_log2;
blkofs = args->offset & (block_size - 1);
block = args->offset / block_size;
blkofs = args->offset % block_size;
while (count > 0)
{
@@ -97,7 +95,6 @@ rtems_blkdev_generic_write(
void * arg)
{
rtems_libio_rw_args_t *args = arg;
int block_size_log2;
uint32_t block_size;
char *buf;
uint32_t count;
@@ -112,15 +109,14 @@ rtems_blkdev_generic_write(
if (dd == NULL)
return RTEMS_INVALID_NUMBER;
block_size_log2 = dd->block_size_log2;
block_size = dd->block_size;
buf = args->buffer;
count = args->count;
args->bytes_moved = 0;
block = args->offset >> block_size_log2;
blkofs = args->offset & (block_size - 1);
block = args->offset / block_size;
blkofs = args->offset % block_size;
while (count > 0)
{
+1 -21
View File
@@ -226,34 +226,18 @@ rtems_status_code rtems_disk_create_phys(
const char *name
)
{
int bs_log2;
int i;
rtems_disk_device *dd;
rtems_status_code rc;
rtems_bdpool_id pool;
rtems_device_major_number major;
rtems_device_minor_number minor;
rtems_filesystem_split_dev_t (dev, major, minor);
for (bs_log2 = 0, i = block_size; (i & 1) == 0; i >>= 1, bs_log2++);
if ((bs_log2 < 9) || (i != 1)) /* block size < 512 or not power of 2 */
return RTEMS_INVALID_NUMBER;
rc = rtems_semaphore_obtain(diskdevs_mutex, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
if (rc != RTEMS_SUCCESSFUL)
return rc;
diskdevs_protected = true;
rc = rtems_bdbuf_find_pool(block_size, &pool);
if (rc != RTEMS_SUCCESSFUL)
{
diskdevs_protected = false;
rtems_semaphore_release(diskdevs_mutex);
return rc;
}
rc = create_disk(dev, name, &dd);
if (rc != RTEMS_SUCCESSFUL)
{
@@ -266,10 +250,8 @@ rtems_status_code rtems_disk_create_phys(
dd->uses = 0;
dd->start = 0;
dd->size = disk_size;
dd->block_size = block_size;
dd->block_size_log2 = bs_log2;
dd->block_size = dd->media_block_size = block_size;
dd->ioctl = handler;
dd->pool = pool;
rc = rtems_io_register_name(name, major, minor);
@@ -333,7 +315,6 @@ rtems_status_code rtems_disk_create_log(
dd->start = start;
dd->size = size;
dd->block_size = pdd->block_size;
dd->block_size_log2 = pdd->block_size_log2;
dd->ioctl = pdd->ioctl;
rc = rtems_io_register_name(name, major, minor);
@@ -555,7 +536,6 @@ rtems_disk_io_done(void)
rc = rtems_semaphore_delete(diskdevs_mutex);
/* XXX bdbuf should be released too! */
disk_io_initialized = 0;
return rc;
}
+1 -1
View File
@@ -31,7 +31,7 @@ libdevnull_a_SOURCES = devnull/devnull.c devnull/devnull.h
EXTRA_DIST += dummy/README
noinst_LIBRARIES += libdummy.a
libdummy_a_SOURCES = dummy/dummy.c
libdummy_a_SOURCES = dummy/dummy.c dummy/dummy-networking.c
## dumpbuf
noinst_LIBRARIES += libdumpbuf.a
+58
View File
@@ -0,0 +1,58 @@
/*
* Dummy configuration file
*
* COPYRIGHT (c) 1989-2008.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems.h>
/* Loopback Network Configuration */
#if defined(RTEMS_NETWORKING)
#include <rtems/rtems_bsdnet.h>
#include <sys/socket.h>
#include <netinet/in.h>
extern int rtems_bsdnet_loopattach(struct rtems_bsdnet_ifconfig *, int);
static struct rtems_bsdnet_ifconfig loopback_config = {
"lo0", /* name */
rtems_bsdnet_loopattach, /* attach function */
NULL, /* link to next interface */
"127.0.0.1", /* IP address */
"255.0.0.0", /* IP net mask */
0, /* hardware_address */
0, 0, 0, 0,
0, 0, 0,
0
};
struct rtems_bsdnet_config rtems_bsdnet_config = {
&loopback_config, /* Network interface */
NULL, /* Use fixed network configuration */
0, /* Default network task priority */
0, /* Default mbuf capacity */
0, /* Default mbuf cluster capacity */
"testSystem", /* Host name */
"nowhere.com", /* Domain name */
"127.0.0.1", /* Gateway */
"127.0.0.1", /* Log host */
{"127.0.0.1" }, /* Name server(s) */
{"127.0.0.1" }, /* NTP server(s) */
1, /* sb_efficiency */
0, /* udp_tx_buf_size */
0, /* udp_rx_buf_size */
0, /* tcp_tx_buf_size */
0 /* tcp_rx_buf_size */
};
#endif
-40
View File
@@ -36,43 +36,3 @@ int main( int, char **, char **);
#include <rtems/confdefs.h>
/* Loopback Network Configuration */
#if defined(RTEMS_NETWORKING)
#include <rtems/rtems_bsdnet.h>
#include <sys/socket.h>
#include <netinet/in.h>
extern int rtems_bsdnet_loopattach(struct rtems_bsdnet_ifconfig *, int);
static struct rtems_bsdnet_ifconfig loopback_config = {
"lo0", /* name */
rtems_bsdnet_loopattach, /* attach function */
NULL, /* link to next interface */
"127.0.0.1", /* IP address */
"255.0.0.0", /* IP net mask */
0, /* hardware_address */
0, 0, 0, 0,
0, 0, 0,
0
};
struct rtems_bsdnet_config rtems_bsdnet_config = {
&loopback_config, /* Network interface */
NULL, /* Use fixed network configuration */
0, /* Default network task priority */
0, /* Default mbuf capacity */
0, /* Default mbuf cluster capacity */
"testSystem", /* Host name */
"nowhere.com", /* Domain name */
"127.0.0.1", /* Gateway */
"127.0.0.1", /* Log host */
{"127.0.0.1" }, /* Name server(s) */
{"127.0.0.1" }, /* NTP server(s) */
1, /* sb_efficiency */
0, /* udp_tx_buf_size */
0, /* udp_rx_buf_size */
0, /* tcp_tx_buf_size */
0 /* tcp_rx_buf_size */
};
#endif
+32 -19
View File
@@ -727,32 +727,45 @@ rtems_fs_init_functions_t rtems_fs_init_helper =
#define CONFIGURE_SWAPOUT_BLOCK_HOLD \
RTEMS_BDBUF_SWAPOUT_TASK_BLOCK_HOLD_DEFAULT
#endif
#ifndef CONFIGURE_SWAPOUT_WORKER_TASKS
#define CONFIGURE_SWAPOUT_WORKER_TASKS \
RTEMS_BDBUF_SWAPOUT_WORKER_TASKS_DEFAULT
#endif
#ifndef CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY
#define CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY \
RTEMS_BDBUF_SWAPOUT_WORKER_TASK_PRIORITY_DEFAULT
#endif
#ifndef CONFIGURE_BDBUF_CACHE_MEMORY_SIZE
#define CONFIGURE_BDBUF_CACHE_MEMORY_SIZE \
RTEMS_BDBUF_CACHE_MEMORY_SIZE_DEFAULT
#endif
#ifndef CONFIGURE_BDBUF_BUFFER_MIN_SIZE
#define CONFIGURE_BDBUF_BUFFER_MIN_SIZE \
RTEMS_BDBUF_BUFFER_MIN_SIZE_DEFAULT
#endif
#ifndef CONFIGURE_BDBUF_BUFFER_MAX_SIZE
#define CONFIGURE_BDBUF_BUFFER_MAX_SIZE \
RTEMS_BDBUF_BUFFER_MAX_SIZE_DEFAULT
#endif
#ifdef CONFIGURE_INIT
rtems_bdbuf_config rtems_bdbuf_configuration = {
const rtems_bdbuf_config rtems_bdbuf_configuration = {
CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS,
CONFIGURE_BDBUF_MAX_WRITE_BLOCKS,
CONFIGURE_SWAPOUT_TASK_PRIORITY,
CONFIGURE_SWAPOUT_SWAP_PERIOD,
CONFIGURE_SWAPOUT_BLOCK_HOLD
CONFIGURE_SWAPOUT_BLOCK_HOLD,
CONFIGURE_SWAPOUT_WORKER_TASKS,
CONFIGURE_SWAPOUT_WORKER_TASK_PRIORITY,
CONFIGURE_BDBUF_CACHE_MEMORY_SIZE,
CONFIGURE_BDBUF_BUFFER_MIN_SIZE,
CONFIGURE_BDBUF_BUFFER_MAX_SIZE
};
#endif
#ifndef CONFIGURE_HAS_OWN_BDBUF_TABLE
#ifndef CONFIGURE_BDBUF_BUFFER_COUNT
#define CONFIGURE_BDBUF_BUFFER_COUNT 64
#endif
#ifndef CONFIGURE_BDBUF_BUFFER_SIZE
#define CONFIGURE_BDBUF_BUFFER_SIZE 512
#endif
#ifdef CONFIGURE_INIT
rtems_bdbuf_pool_config rtems_bdbuf_pool_configuration[] = {
{CONFIGURE_BDBUF_BUFFER_SIZE, CONFIGURE_BDBUF_BUFFER_COUNT, NULL}
};
size_t rtems_bdbuf_pool_configuration_size =
(sizeof(rtems_bdbuf_pool_configuration) /
sizeof(rtems_bdbuf_pool_configuration[0]));
#endif /* CONFIGURE_INIT */
#endif /* CONFIGURE_HAS_OWN_BDBUF_TABLE */
#if defined(CONFIGURE_HAS_OWN_BDBUF_TABLE) || \
defined(CONFIGURE_BDBUF_BUFFER_SIZE) || \
defined(CONFIGURE_BDBUF_BUFFER_COUNT)
#error BDBUF Cache does not use a buffer configuration table. Please remove.
#endif
#endif /* CONFIGURE_APPLICATION_NEEDS_LIBBLOCK */
#if defined(RTEMS_MULTIPROCESSING)
+51 -1
View File
@@ -96,7 +96,7 @@ RTEMS_INLINE_ROUTINE bool rtems_chain_is_null_node(
*
* @param[in] the_chain is the chain to be operated upon.
*
* @return This method returns the permanent head node of the chain.
* @return This method returns the permanent node of the chain.
*/
RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_head(
rtems_chain_control *the_chain
@@ -121,6 +121,56 @@ RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_tail(
return _Chain_Tail( the_chain );
}
/**
* @brief Return pointer to Chain's First node after the permanent head.
*
* This function returns a pointer to the first node on the chain after the
* head.
*
* @param[in] the_chain is the chain to be operated upon.
*
* @return This method returns the first node of the chain.
*/
RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_first(
rtems_chain_control *the_chain
)
{
return _Chain_First( the_chain );
}
/**
* @brief Return pointer to Chain's Last node before the permanent tail.
*
* This function returns a pointer to the last node on the chain just before
* the tail.
*
* @param[in] the_chain is the chain to be operated upon.
*
* @return This method returns the last node of the chain.
*/
RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_last(
rtems_chain_control *the_chain
)
{
return _Chain_Last( the_chain );
}
/**
* @brief Return pointer the next node from this node
*
* This function returns a pointer to the next node after this node.
*
* @param[in] the_node is the node to be operated upon.
*
* @return This method returns the next node on the chain.
*/
RTEMS_INLINE_ROUTINE rtems_chain_node *rtems_chain_next(
rtems_chain_node *the_node
)
{
return _Chain_Next( the_node );
}
/**
* @brief Are Two Nodes Equal
*
+25 -25
View File
@@ -73,20 +73,20 @@ typedef uint16_t Objects_Id;
*/
typedef uint8_t Objects_Maximum;
#define OBJECTS_INDEX_START_BIT 0
#define OBJECTS_API_START_BIT 8
#define OBJECTS_CLASS_START_BIT 11
#define OBJECTS_INDEX_START_BIT 0U
#define OBJECTS_API_START_BIT 8U
#define OBJECTS_CLASS_START_BIT 11U
#define OBJECTS_INDEX_MASK (Objects_Id)0x00ff
#define OBJECTS_API_MASK (Objects_Id)0x0700
#define OBJECTS_CLASS_MASK (Objects_Id)0xF800
#define OBJECTS_INDEX_MASK (Objects_Id)0x00ffU
#define OBJECTS_API_MASK (Objects_Id)0x0700U
#define OBJECTS_CLASS_MASK (Objects_Id)0xF800U
#define OBJECTS_INDEX_VALID_BITS (Objects_Id)0x00ff
#define OBJECTS_API_VALID_BITS (Objects_Id)0x0007
#define OBJECTS_INDEX_VALID_BITS (Objects_Id)0x00ffU
#define OBJECTS_API_VALID_BITS (Objects_Id)0x0007U
/* OBJECTS_NODE_VALID_BITS should not be used with 16 bit Ids */
#define OBJECTS_CLASS_VALID_BITS (Objects_Id)0x001f
#define OBJECTS_CLASS_VALID_BITS (Objects_Id)0x001fU
#define OBJECTS_UNLIMITED_OBJECTS 0x8000
#define OBJECTS_UNLIMITED_OBJECTS 0x8000U
#define OBJECTS_ID_INITIAL_INDEX (0)
#define OBJECTS_ID_FINAL_INDEX (0xff)
@@ -113,76 +113,76 @@ typedef uint16_t Objects_Maximum;
* This is the bit position of the starting bit of the index portion of
* the object Id.
*/
#define OBJECTS_INDEX_START_BIT 0
#define OBJECTS_INDEX_START_BIT 0U
/**
* This is the bit position of the starting bit of the node portion of
* the object Id.
*/
#define OBJECTS_NODE_START_BIT 16
#define OBJECTS_NODE_START_BIT 16U
/**
* This is the bit position of the starting bit of the API portion of
* the object Id.
*/
#define OBJECTS_API_START_BIT 24
#define OBJECTS_API_START_BIT 24U
/**
* This is the bit position of the starting bit of the class portion of
* the object Id.
*/
#define OBJECTS_CLASS_START_BIT 27
#define OBJECTS_CLASS_START_BIT 27U
/**
* This mask is used to extract the index portion of an object Id.
*/
#define OBJECTS_INDEX_MASK (Objects_Id)0x0000ffff
#define OBJECTS_INDEX_MASK (Objects_Id)0x0000ffffU
/**
* This mask is used to extract the node portion of an object Id.
*/
#define OBJECTS_NODE_MASK (Objects_Id)0x00ff0000
#define OBJECTS_NODE_MASK (Objects_Id)0x00ff0000U
/**
* This mask is used to extract the API portion of an object Id.
*/
#define OBJECTS_API_MASK (Objects_Id)0x07000000
#define OBJECTS_API_MASK (Objects_Id)0x07000000U
/**
* This mask is used to extract the class portion of an object Id.
*/
#define OBJECTS_CLASS_MASK (Objects_Id)0xf8000000
#define OBJECTS_CLASS_MASK (Objects_Id)0xf8000000U
/**
* This mask represents the bits that is used to ensure no extra bits
* are set after shifting to extract the index portion of an object Id.
*/
#define OBJECTS_INDEX_VALID_BITS (Objects_Id)0x0000ffff
#define OBJECTS_INDEX_VALID_BITS (Objects_Id)0x0000ffffU
/**
* This mask represents the bits that is used to ensure no extra bits
* are set after shifting to extract the node portion of an object Id.
*/
#define OBJECTS_NODE_VALID_BITS (Objects_Id)0x000000ff
#define OBJECTS_NODE_VALID_BITS (Objects_Id)0x000000ffU
/**
* This mask represents the bits that is used to ensure no extra bits
* are set after shifting to extract the API portion of an object Id.
*/
#define OBJECTS_API_VALID_BITS (Objects_Id)0x00000007
#define OBJECTS_API_VALID_BITS (Objects_Id)0x00000007U
/**
* This mask represents the bits that is used to ensure no extra bits
* are set after shifting to extract the class portion of an object Id.
*/
#define OBJECTS_CLASS_VALID_BITS (Objects_Id)0x0000001f
#define OBJECTS_CLASS_VALID_BITS (Objects_Id)0x0000001fU
/**
* Mask to enable unlimited objects. This is used in the configuration
* table when specifying the number of configured objects.
*/
#define OBJECTS_UNLIMITED_OBJECTS 0x80000000
#define OBJECTS_UNLIMITED_OBJECTS 0x80000000U
/**
* This is the lowest value for the index portion of an object Id.
@@ -192,7 +192,7 @@ typedef uint16_t Objects_Maximum;
/**
* This is the highest value for the index portion of an object Id.
*/
#define OBJECTS_ID_FINAL_INDEX (0xffff)
#define OBJECTS_ID_FINAL_INDEX (0xffffU)
#endif
/**
@@ -336,7 +336,7 @@ typedef struct {
/** This is the true if unlimited objects in this class. */
bool auto_extend;
/** This is the number of objects in a block. */
uint32_t allocation_size;
Objects_Maximum allocation_size;
/** This is the size in bytes of each object instance. */
size_t size;
/** This points to the table of local objects. */
+63 -1
View File
@@ -83,7 +83,7 @@ RTEMS_INLINE_ROUTINE bool _Chain_Is_null_node(
/** @brief Return pointer to Chain Head
*
* This function returns a pointer to the first node on the chain.
* This function returns a pointer to the head node on the chain.
*
* @param[in] the_chain is the chain to be operated upon.
*
@@ -111,6 +111,68 @@ RTEMS_INLINE_ROUTINE Chain_Node *_Chain_Tail(
return (Chain_Node *) &the_chain->permanent_null;
}
/** @brief Return pointer to Chain's First node
*
* This function returns a pointer to the first node on the chain after the
* head.
*
* @param[in] the_chain is the chain to be operated upon.
*
* @return This method returns the first node of the chain.
*/
RTEMS_INLINE_ROUTINE Chain_Node *_Chain_First(
Chain_Control *the_chain
)
{
return the_chain->first;
}
/** @brief Return pointer to Chain's Last node
*
* This function returns a pointer to the last node on the chain just before
* the tail.
*
* @param[in] the_chain is the chain to be operated upon.
*
* @return This method returns the last node of the chain.
*/
RTEMS_INLINE_ROUTINE Chain_Node *_Chain_Last(
Chain_Control *the_chain
)
{
return the_chain->last;
}
/** @brief Return pointer the next node from this node
*
* This function returns a pointer to the next node after this node.
*
* @param[in] the_node is the node to be operated upon.
*
* @return This method returns the next node on the chain.
*/
RTEMS_INLINE_ROUTINE Chain_Node *_Chain_Next(
Chain_Node *the_node
)
{
return the_node->next;
}
/** @brief Return pointer the previous node from this node
*
* This function returns a pointer to the previous node on this chain.
*
* @param[in] the_node is the node to be operated upon.
*
* @return This method returns the previous node on the chain.
*/
RTEMS_INLINE_ROUTINE Chain_Node *_Chain_Previous(
Chain_Node *the_node
)
{
return the_node->previous;
}
/** @brief Is the Chain Empty
*
* This function returns true if there a no nodes on @a the_chain and
+4 -2
View File
@@ -111,7 +111,9 @@ RTEMS_INLINE_ROUTINE Objects_Maximum _Objects_Get_index(
Objects_Id id
)
{
return (id >> OBJECTS_INDEX_START_BIT) & OBJECTS_INDEX_VALID_BITS;
return
(Objects_Maximum)((id >> OBJECTS_INDEX_START_BIT) &
OBJECTS_INDEX_VALID_BITS);
}
/**
@@ -224,7 +226,7 @@ RTEMS_INLINE_ROUTINE Objects_Control *_Objects_Get_local_object(
RTEMS_INLINE_ROUTINE void _Objects_Set_local_object(
Objects_Information *information,
uint16_t index,
uint32_t index,
Objects_Control *the_object
)
{