forked from Imagelibrary/rtems
Merge branch 'master' of ssh://git.rtems.org/data/git/rtems
This commit is contained in:
@@ -361,7 +361,12 @@
|
||||
* derived values for all boards
|
||||
*/
|
||||
/* value of input clock divider (derived from pll mode reg) */
|
||||
#define BSP_SYSPLL_CKID (((mpc83xx.clk.spmr>>(31-8))&0x01)+1)
|
||||
#if MPC83XX_CHIP_TYPE != 8309
|
||||
#define BSP_SYSPLL_CKID (((mpc83xx.clk.spmr>>(31-8))&0x01)+1)
|
||||
#else
|
||||
/* On the MPC8309 this bit is reserved */
|
||||
#define BSP_SYSPLL_CKID 1
|
||||
#endif
|
||||
/* value of system pll (derived from pll mode reg) */
|
||||
#define BSP_SYSPLL_MF ((mpc83xx.clk.spmr>>(31-7))&0x0f)
|
||||
/* value of system pll (derived from pll mode reg) */
|
||||
|
||||
@@ -61,7 +61,9 @@ typedef struct m83xxSysConRegisters_ {
|
||||
uint8_t reserved0_011C[0x00128-0x0011C];/* 0x0_011C--0x0_0128 Reserved */
|
||||
volatile uint32_t ddrcdr; /* 0x0_0128 control driver register (DDRCDR) R/W 0x7304_0001 5.3.2.8/5-28 */
|
||||
volatile uint32_t ddrdsr; /* 0x0_012C debug status register (DDRDSR) R 0x3300_0000 5.3.2.9/5-30 */
|
||||
uint8_t reserved0_0130[0x00200-0x00130];/* 0x0_0130--0x0_01FC Reserved */
|
||||
uint8_t reserved0_0130[0x00150-0x00130];/* 0x0_0130--0x0_015C Reserved */
|
||||
volatile uint32_t gpr_1; /* 0x0_0150 General Purpose Register 1 (GPR_1) */
|
||||
uint8_t reserved0_0154[0x00200-0x00154];/* 0x0_0154--0x0_01FC Reserved */
|
||||
} m83xxSysConRegisters_t;
|
||||
#define M83xx_SYSCON_SPCR_TBEN (1 << (31-9))
|
||||
|
||||
@@ -921,8 +923,9 @@ extern m83xxRegisters_t mpc83xx;
|
||||
#define RCWLR_COREPLL(n) (((n)&0xff)<<(31-15))
|
||||
|
||||
/* for MPC8309: */
|
||||
#define RCWLR_CEVCOD_1_4 (0<<(31-25)) /* QUICC internal PLL divider 1:4 */
|
||||
#define RCWLR_CEVCOD_1_2 (2<<(31-25)) /* QUICC internal PLL divider 1:2 */
|
||||
#define RCWLR_CEVCOD_1_8 (2<<(31-25)) /* QUICC internal PLL divider 1:8 */
|
||||
#define RCWLR_CEVCOD_1_4 (1<<(31-25)) /* QUICC internal PLL divider 1:4 */
|
||||
#define RCWLR_CEVCOD_1_2 (0<<(31-25)) /* QUICC internal PLL divider 1:2 */
|
||||
/* QUICC Engine PLL mult. factor */
|
||||
#define RCWLR_CEPDF_2 (1<<(31-26)) /* QUICC Engine divide PLL out by 2*/
|
||||
/* QUICC Engine PLL mult. factor */
|
||||
|
||||
@@ -37,7 +37,7 @@ extern "C" {
|
||||
*
|
||||
* @ingroup rtems_libblock
|
||||
*
|
||||
* This module provides functions to manage partitions of a disk device.
|
||||
* @brief This module provides functions to manage partitions of a disk device.
|
||||
*
|
||||
* A @ref rtems_disk "disk" is a set of blocks which are identified by a
|
||||
* consecutive set of non-negative integers starting at zero. There are also
|
||||
@@ -205,8 +205,8 @@ typedef union {
|
||||
} rtems_bdpart_format;
|
||||
|
||||
/**
|
||||
* Reads the partition information from the physical disk device with name
|
||||
* @a disk_name.
|
||||
* @brief Reads the partition information from the physical disk device with
|
||||
* name @a disk_name.
|
||||
*
|
||||
* The partition information will be stored in the partition table
|
||||
* @a partitions with a maximum of @a count partitions. The number of actual
|
||||
@@ -222,13 +222,13 @@ rtems_status_code rtems_bdpart_read(
|
||||
);
|
||||
|
||||
/**
|
||||
* Sorts the partition table @a partitions with @a count partitions to have
|
||||
* ascending begin blocks
|
||||
* @brief Sorts the partition table @a partitions with @a count partitions to
|
||||
* have ascending begin blocks
|
||||
*/
|
||||
void rtems_bdpart_sort( rtems_bdpart_partition *partitions, size_t count);
|
||||
|
||||
/**
|
||||
* Writes the partition table to the physical disk device with name
|
||||
* @brief Writes the partition table to the physical disk device with name
|
||||
* @a disk_name.
|
||||
*
|
||||
* The partition table @a partitions with @a count partitions will be written
|
||||
@@ -248,8 +248,8 @@ rtems_status_code rtems_bdpart_write(
|
||||
);
|
||||
|
||||
/**
|
||||
* Creates a partition table in @a partitions with @a count partitions for the
|
||||
* physical disk device with name @a disk_name.
|
||||
* @brief Creates a partition table in @a partitions with @a count partitions
|
||||
* for the physical disk device with name @a disk_name.
|
||||
*
|
||||
* The array of positive integer weights in @a distribution must have exactly
|
||||
* @a count elements. The weights in the distribution array are summed up.
|
||||
@@ -266,13 +266,15 @@ rtems_status_code rtems_bdpart_create(
|
||||
);
|
||||
|
||||
/**
|
||||
* Registers the partitions as logical disks for the physical disk device with
|
||||
* name @a disk_name.
|
||||
* @brief Registers the partitions as logical disks for the physical disk
|
||||
* device with name @a disk_name.
|
||||
*
|
||||
* For each partition of the partition table @a partitions with @a count
|
||||
* partitions a logical disk is registered. The partition number equals the
|
||||
* partition table index plus one. The name of the logical disk device is the
|
||||
* concatenation of the physical disk device name and the partition number.
|
||||
*
|
||||
* @see rtems_blkdev_create_partition().
|
||||
*/
|
||||
rtems_status_code rtems_bdpart_register(
|
||||
const char *disk_name,
|
||||
@@ -281,16 +283,16 @@ rtems_status_code rtems_bdpart_register(
|
||||
);
|
||||
|
||||
/**
|
||||
* Reads the partition table from the disk device with name @a disk_name and
|
||||
* registers the partitions as logical disks.
|
||||
* @a brief Reads the partition table from the disk device with name @a
|
||||
* disk_name and registers the partitions as logical disks.
|
||||
*
|
||||
* @see rtems_bdpart_register() and rtems_fsmount().
|
||||
*/
|
||||
rtems_status_code rtems_bdpart_register_from_disk( const char *disk_name);
|
||||
|
||||
/**
|
||||
* Deletes the logical disks associated with the partitions of the disk device
|
||||
* with name @a disk_name.
|
||||
* @brief Deletes the logical disks associated with the partitions of the disk
|
||||
* device with name @a disk_name.
|
||||
*
|
||||
* The partition table @a partitions with @a count partitions will be used to
|
||||
* determine which disks need to be deleted. It may be obtained from
|
||||
@@ -303,8 +305,8 @@ rtems_status_code rtems_bdpart_unregister(
|
||||
);
|
||||
|
||||
/**
|
||||
* Mounts all supported file systems inside the logical disks derived from the
|
||||
* partitions of the physical disk device with name @a disk_name.
|
||||
* @brief Mounts all supported file systems inside the logical disks derived
|
||||
* from the partitions of the physical disk device with name @a disk_name.
|
||||
*
|
||||
* For each partition in the partition table @a partitions with @a count
|
||||
* partitions it will be checked if it contains a supported file system. In
|
||||
@@ -324,7 +326,7 @@ rtems_status_code rtems_bdpart_mount(
|
||||
);
|
||||
|
||||
/**
|
||||
* Unmounts all file systems mounted with rtems_bdpart_mount().
|
||||
* @brief Unmounts all file systems mounted with rtems_bdpart_mount().
|
||||
*/
|
||||
rtems_status_code rtems_bdpart_unmount(
|
||||
const char *disk_name,
|
||||
@@ -334,19 +336,19 @@ rtems_status_code rtems_bdpart_unmount(
|
||||
);
|
||||
|
||||
/**
|
||||
* Prints the partition table @a partitions with @a count partitions to
|
||||
* @brief Prints the partition table @a partitions with @a count partitions to
|
||||
* standard output.
|
||||
*/
|
||||
void rtems_bdpart_dump( const rtems_bdpart_partition *partitions, size_t count);
|
||||
|
||||
/**
|
||||
* Returns the partition type for the MBR partition type value @a mbr_type in
|
||||
* @a type.
|
||||
* @brief Returns the partition type for the MBR partition type value
|
||||
* @a mbr_type in @a type.
|
||||
*/
|
||||
void rtems_bdpart_to_partition_type( uint8_t mbr_type, uuid_t type);
|
||||
|
||||
/**
|
||||
* Converts the partition type in @a type to the MBR partition type.
|
||||
* @brief Converts the partition type in @a type to the MBR partition type.
|
||||
*
|
||||
* The result will be stored in @a mbr_type. Returns @c true in case of a
|
||||
* successful convertion and otherwise @c false. Both arguments must not be
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Manage Partitions of a Disk Device
|
||||
* @ingroup rtems_bdpart
|
||||
*
|
||||
* Block device partition management.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Prints the Partition Table @a Partitions with @a Count Partitions
|
||||
* @ingroup rtems_bdpart
|
||||
*
|
||||
* Block device partition management.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Block Device Partition Management
|
||||
* @ingroup rtems_bdpart
|
||||
*
|
||||
* Block device partition management.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Block Device Partition Management
|
||||
* @ingroup rtems_bdpart
|
||||
*
|
||||
* Block device partition management.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Block Device Partition Management
|
||||
* @ingroup rtems_bdpart
|
||||
*
|
||||
* Block device partition management.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009, 2010
|
||||
* embedded brains GmbH
|
||||
* Obere Lagerstr. 30
|
||||
* D-82178 Puchheim
|
||||
* Germany
|
||||
* <rtems@embedded-brains.de>
|
||||
* Copyright (c) 2009, 2012 embedded brains GmbH. All rights reserved.
|
||||
*
|
||||
* embedded brains GmbH
|
||||
* Obere Lagerstr. 30
|
||||
* 82178 Puchheim
|
||||
* Germany
|
||||
* <rtems@embedded-brains.de>
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
@@ -20,16 +20,46 @@
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/bdpart.h>
|
||||
|
||||
static char *create_logical_disk_name( const char *disk_name, char **marker)
|
||||
{
|
||||
size_t disk_name_size = strlen( disk_name);
|
||||
char *logical_disk_name = malloc( disk_name_size + RTEMS_BDPART_NUMBER_SIZE);
|
||||
|
||||
if (logical_disk_name != NULL) {
|
||||
strncpy( logical_disk_name, disk_name, disk_name_size);
|
||||
*marker = logical_disk_name + disk_name_size;
|
||||
}
|
||||
|
||||
return logical_disk_name;
|
||||
}
|
||||
|
||||
static rtems_status_code update_logical_disk_name(
|
||||
char *logical_disk_marker,
|
||||
size_t i
|
||||
)
|
||||
{
|
||||
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
||||
int rv = 0;
|
||||
|
||||
rv = snprintf( logical_disk_marker, RTEMS_BDPART_NUMBER_SIZE, "%zu", i + 1);
|
||||
if (rv >= RTEMS_BDPART_NUMBER_SIZE) {
|
||||
sc = RTEMS_INVALID_NAME;
|
||||
}
|
||||
|
||||
return sc;
|
||||
}
|
||||
|
||||
rtems_status_code rtems_bdpart_register(
|
||||
const char *disk_name,
|
||||
const rtems_bdpart_partition *pt,
|
||||
@@ -38,14 +68,9 @@ rtems_status_code rtems_bdpart_register(
|
||||
{
|
||||
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
||||
rtems_status_code esc = RTEMS_SUCCESSFUL;
|
||||
rtems_device_major_number major = 0;
|
||||
rtems_device_minor_number minor = 0;
|
||||
rtems_blkdev_bnum disk_end = 0;
|
||||
dev_t disk = 0;
|
||||
dev_t logical_disk = 0;
|
||||
char *logical_disk_name = NULL;
|
||||
char *logical_disk_marker = NULL;
|
||||
size_t disk_name_size = strlen( disk_name);
|
||||
size_t i = 0;
|
||||
int fd = -1;
|
||||
rtems_disk_device *dd = NULL;
|
||||
@@ -55,45 +80,34 @@ rtems_status_code rtems_bdpart_register(
|
||||
if (sc != RTEMS_SUCCESSFUL) {
|
||||
return sc;
|
||||
}
|
||||
disk = rtems_disk_get_device_identifier( dd);
|
||||
close( fd);
|
||||
|
||||
/* Get the disk device identifier */
|
||||
rtems_filesystem_split_dev_t( disk, major, minor);
|
||||
|
||||
/* Create logical disk name */
|
||||
logical_disk_name = malloc( disk_name_size + RTEMS_BDPART_NUMBER_SIZE);
|
||||
logical_disk_name = create_logical_disk_name(
|
||||
disk_name,
|
||||
&logical_disk_marker
|
||||
);
|
||||
if (logical_disk_name == NULL) {
|
||||
return RTEMS_NO_MEMORY;
|
||||
esc = sc;
|
||||
goto cleanup;
|
||||
}
|
||||
strncpy( logical_disk_name, disk_name, disk_name_size);
|
||||
logical_disk_marker = logical_disk_name + disk_name_size;
|
||||
|
||||
/* Create a logical disk for each partition */
|
||||
for (i = 0; i < count; ++i) {
|
||||
const rtems_bdpart_partition *p = pt + i;
|
||||
int rv = 0;
|
||||
|
||||
/* New minor number */
|
||||
++minor;
|
||||
|
||||
/* Create a new device identifier */
|
||||
logical_disk = rtems_filesystem_make_dev_t( major, minor);
|
||||
|
||||
/* Set partition number for logical disk name */
|
||||
rv = snprintf( logical_disk_marker, RTEMS_BDPART_NUMBER_SIZE, "%zu", i + 1);
|
||||
if (rv >= RTEMS_BDPART_NUMBER_SIZE) {
|
||||
esc = RTEMS_INVALID_NAME;
|
||||
sc = update_logical_disk_name( logical_disk_marker, i);
|
||||
if (sc != RTEMS_SUCCESSFUL) {
|
||||
esc = sc;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Create logical disk */
|
||||
sc = rtems_disk_create_log(
|
||||
logical_disk,
|
||||
disk,
|
||||
sc = rtems_blkdev_create_partition(
|
||||
logical_disk_name,
|
||||
disk_name,
|
||||
p->begin,
|
||||
p->end - p->begin,
|
||||
logical_disk_name
|
||||
p->end - p->begin
|
||||
);
|
||||
if (sc != RTEMS_SUCCESSFUL) {
|
||||
esc = sc;
|
||||
@@ -104,6 +118,7 @@ rtems_status_code rtems_bdpart_register(
|
||||
cleanup:
|
||||
|
||||
free( logical_disk_name);
|
||||
close( fd);
|
||||
|
||||
return esc;
|
||||
}
|
||||
@@ -132,11 +147,10 @@ rtems_status_code rtems_bdpart_unregister(
|
||||
)
|
||||
{
|
||||
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
||||
rtems_device_major_number major = 0;
|
||||
rtems_device_minor_number minor = 0;
|
||||
rtems_status_code esc = RTEMS_SUCCESSFUL;
|
||||
rtems_blkdev_bnum disk_end = 0;
|
||||
dev_t disk = 0;
|
||||
dev_t logical_disk = 0;
|
||||
char *logical_disk_name = NULL;
|
||||
char *logical_disk_marker = NULL;
|
||||
size_t i = 0;
|
||||
int fd = -1;
|
||||
rtems_disk_device *dd = NULL;
|
||||
@@ -146,26 +160,40 @@ rtems_status_code rtems_bdpart_unregister(
|
||||
if (sc != RTEMS_SUCCESSFUL) {
|
||||
return sc;
|
||||
}
|
||||
disk = rtems_disk_get_device_identifier( dd);
|
||||
close( fd);
|
||||
|
||||
/* Get the disk device identifier */
|
||||
rtems_filesystem_split_dev_t( disk, major, minor);
|
||||
/* Create logical disk name */
|
||||
logical_disk_name = create_logical_disk_name(
|
||||
disk_name,
|
||||
&logical_disk_marker
|
||||
);
|
||||
if (logical_disk_name == NULL) {
|
||||
esc = sc;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Create a logical disk for each partition */
|
||||
/* Delete the logical disk for each partition */
|
||||
for (i = 0; i < count; ++i) {
|
||||
/* New minor number */
|
||||
++minor;
|
||||
int rv = 0;
|
||||
|
||||
/* Get the device identifier */
|
||||
logical_disk = rtems_filesystem_make_dev_t( major, minor);
|
||||
/* Set partition number for logical disk name */
|
||||
sc = update_logical_disk_name( logical_disk_marker, i);
|
||||
if (sc != RTEMS_SUCCESSFUL) {
|
||||
esc = sc;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Delete logical disk */
|
||||
sc = rtems_disk_delete( logical_disk);
|
||||
if (sc != RTEMS_SUCCESSFUL) {
|
||||
return sc;
|
||||
rv = unlink( logical_disk_name);
|
||||
if (rv != 0) {
|
||||
esc = sc;
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
return RTEMS_SUCCESSFUL;
|
||||
cleanup:
|
||||
|
||||
free( logical_disk_name);
|
||||
close( fd);
|
||||
|
||||
return esc;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Block Device Partition Management
|
||||
* @ingroup rtems_bdpart
|
||||
*
|
||||
* Block device partition management.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Block Device Partition Management
|
||||
* @ingroup rtems_bdpart
|
||||
*
|
||||
* Block device partition management.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Block Device Statistics Command
|
||||
* @ingroup rtems_blkdev Block Device Management
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 embedded brains GmbH. All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Block Device IMFS
|
||||
* @ingroup libblock
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 embedded brains GmbH. All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Common IO Control Primitive
|
||||
* @ingroup rtems_blkdev
|
||||
*
|
||||
* Block device management.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Prints the Block Device Statistics
|
||||
* @ingroup rtems_blkdev Block Device Management
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 embedded brains GmbH. All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Block Device Management
|
||||
* @ingroup rtems_blkdev
|
||||
*
|
||||
* Block device management.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Block Device Disk Management Initialize
|
||||
* @ingroup rtems_disk Block Device Disk Management
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 embedded brains GmbH. All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
/*
|
||||
* flashdisk.c -- Flash disk block device implementation
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Flash Disk Block Device Implementation
|
||||
* @ingroup libblock
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2007 Chris Johns
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* ide_part_table.c
|
||||
*
|
||||
* The implementation of library supporting "MS-DOS-style" partition table
|
||||
*
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Library supporting "MS-DOS-style" Partition Table
|
||||
* @ingroup libblock
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002 OKTET Ltd., St.-Petersburg, Russia
|
||||
*
|
||||
* Author: Konstantin Abramenko <Konstantin.Abramenko@oktet.ru>
|
||||
@@ -14,7 +15,7 @@
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*
|
||||
*****************************************************************************/
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Provide SRAM support for the NV Disk
|
||||
* @ingroup libblock
|
||||
*/
|
||||
|
||||
/*
|
||||
* RTEMS Project (http://www.rtems.org/)
|
||||
*
|
||||
* Copyright 2007 Chris Johns (chrisj@rtems.org)
|
||||
*/
|
||||
/**
|
||||
* Provide SRAM support for the NV Disk.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
/*
|
||||
* nvdisk.c -- Non-volatile disk block device implementation
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Non-Volatile Disk Block Device Implementation
|
||||
* @ingroup libblock
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2007 Chris Johns
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
|
||||
@@ -1,38 +1,28 @@
|
||||
/*===============================================================*\
|
||||
| Project: RTEMS bdbuf inspector |
|
||||
+-----------------------------------------------------------------+
|
||||
| File: show_bdbuf.c
|
||||
+-----------------------------------------------------------------+
|
||||
| Copyright (c) 2005 |
|
||||
| Embedded Brains GmbH |
|
||||
| Obere Lagerstr. 30 |
|
||||
| D-82178 Puchheim |
|
||||
| Germany |
|
||||
| rtems@embedded-brains.de |
|
||||
+-----------------------------------------------------------------+
|
||||
| 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. |
|
||||
| |
|
||||
+-----------------------------------------------------------------+
|
||||
| this file contains functions to enable the monitor |
|
||||
| to show bdbuf information |
|
||||
| |
|
||||
| XXX!!! ATTETION!!! XXX!!! |
|
||||
| |
|
||||
| This module inspects the bdbuf data structures, |
|
||||
| assuming they are static, but in fact they are used very |
|
||||
| dynamically. Therefore the results show MAY BE INCORRECT in |
|
||||
| some cases. And, to cure this a bit, this module may block |
|
||||
| preemption for a rather long time and therefore it may |
|
||||
| BREAK THE REALTIME BEHAVIOUR OF YOUR SYSTEM (when in use) |
|
||||
+-----------------------------------------------------------------+
|
||||
| date history ID |
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
||||
| 26.09.06 creation doe |
|
||||
|*****************************************************************|
|
||||
\*===============================================================*/
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Enable the Monitor to Show bdbuf Information
|
||||
* @ingroup rtems_bdpart
|
||||
*
|
||||
* This module inspects the bdbuf data structures,
|
||||
* assuming they are static, but in fact they are used very
|
||||
* dynamically. Therefore the results show MAY BE INCORRECT in
|
||||
* some cases. And, to cure this a bit, this module may block
|
||||
* preemption for a rather long time and therefore it may
|
||||
* BREAK THE REALTIME BEHAVIOUR OF YOUR SYSTEM (when in use)
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005
|
||||
* Embedded Brains GmbH
|
||||
* Obere Lagerstr. 30
|
||||
* D-82178 Puchheim
|
||||
* Germany
|
||||
* rtems@embedded-brains.de
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
|
||||
@@ -136,6 +136,7 @@ libcsupport_a_SOURCES = src/gxx_wrappers.c src/getchark.c src/printk.c \
|
||||
src/sup_fs_deviceerrno.c \
|
||||
src/clonenode.c \
|
||||
src/freenode.c \
|
||||
src/resource_snapshot.c \
|
||||
$(BSD_LIBC_C_FILES) $(BASE_FS_C_FILES) $(MALLOC_C_FILES) \
|
||||
$(ERROR_C_FILES) $(ASSOCIATION_C_FILES)
|
||||
|
||||
|
||||
@@ -99,6 +99,93 @@ void newlib_delete_hook(
|
||||
0 /* fatal */ \
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
uint32_t active_barriers;
|
||||
uint32_t active_extensions;
|
||||
uint32_t active_message_queues;
|
||||
uint32_t active_partitions;
|
||||
uint32_t active_periods;
|
||||
uint32_t active_ports;
|
||||
uint32_t active_regions;
|
||||
uint32_t active_semaphores;
|
||||
uint32_t active_tasks;
|
||||
uint32_t active_timers;
|
||||
} rtems_resource_rtems_api;
|
||||
|
||||
typedef struct {
|
||||
uint32_t active_barriers;
|
||||
uint32_t active_condition_variables;
|
||||
uint32_t active_keys;
|
||||
uint32_t active_message_queues;
|
||||
uint32_t active_message_queue_descriptors;
|
||||
uint32_t active_mutexes;
|
||||
uint32_t active_rwlocks;
|
||||
uint32_t active_semaphores;
|
||||
uint32_t active_spinlocks;
|
||||
uint32_t active_threads;
|
||||
uint32_t active_timers;
|
||||
} rtems_resource_posix_api;
|
||||
|
||||
typedef struct {
|
||||
Heap_Information_block workspace_info;
|
||||
Heap_Information_block heap_info;
|
||||
rtems_resource_rtems_api rtems_api;
|
||||
rtems_resource_posix_api posix_api;
|
||||
int open_files;
|
||||
} rtems_resource_snapshot;
|
||||
|
||||
/**
|
||||
* @brief Tasks a snapshot of the resource usage of the system.
|
||||
*
|
||||
* @param[out] snapshot The snapshot of used resources.
|
||||
*
|
||||
* @see rtems_resource_snapshot_equal() and rtems_resource_snapshot_check().
|
||||
*
|
||||
* @code
|
||||
* #include <assert.h>
|
||||
*
|
||||
* #include <rtems/libcsupport.h>
|
||||
*
|
||||
* void example(void)
|
||||
* {
|
||||
* rtems_resource_snapshot before;
|
||||
*
|
||||
* test_setup();
|
||||
* rtems_resource_snapshot_take(&before);
|
||||
* test();
|
||||
* assert(rtems_resource_snapshot_check(&before));
|
||||
* test_cleanup();
|
||||
* }
|
||||
* @endcode
|
||||
*/
|
||||
void rtems_resource_snapshot_take(rtems_resource_snapshot *snapshot);
|
||||
|
||||
/**
|
||||
* @brief Compares two resource snapshots for equality.
|
||||
*
|
||||
* @return Returns true if the resource snapshots are equal, and false
|
||||
* otherwise.
|
||||
*
|
||||
* @see rtems_resource_snapshot_take().
|
||||
*/
|
||||
bool rtems_resource_snapshot_equal(
|
||||
const rtems_resource_snapshot *a,
|
||||
const rtems_resource_snapshot *b
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Takes a new resource snapshot and checks that it is equal to the
|
||||
* given snapshot.
|
||||
*
|
||||
* @param[in] snapshot The snapshot used for comparison with the new snapshot.
|
||||
*
|
||||
* @return Returns true if the resource snapshots are equal, and false
|
||||
* otherwise.
|
||||
*
|
||||
* @see rtems_resource_snapshot_take().
|
||||
*/
|
||||
bool rtems_resource_snapshot_check(const rtems_resource_snapshot *snapshot);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
127
cpukit/libcsupport/src/resource_snapshot.c
Normal file
127
cpukit/libcsupport/src/resource_snapshot.c
Normal file
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* Copyright (c) 2012 embedded brains GmbH. All rights reserved.
|
||||
*
|
||||
* embedded brains GmbH
|
||||
* Obere Lagerstr. 30
|
||||
* 82178 Puchheim
|
||||
* Germany
|
||||
* <rtems@embedded-brains.de>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <rtems/libcsupport.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include <rtems/malloc.h>
|
||||
#include <rtems/score/wkspace.h>
|
||||
#include <rtems/score/protectedheap.h>
|
||||
|
||||
#ifdef RTEMS_POSIX_API
|
||||
#include <rtems/posix/barrier.h>
|
||||
#include <rtems/posix/cond.h>
|
||||
#include <rtems/posix/mqueue.h>
|
||||
#include <rtems/posix/mutex.h>
|
||||
#include <rtems/posix/key.h>
|
||||
#include <rtems/posix/psignal.h>
|
||||
#include <rtems/posix/pthread.h>
|
||||
#include <rtems/posix/rwlock.h>
|
||||
#include <rtems/posix/semaphore.h>
|
||||
#include <rtems/posix/spinlock.h>
|
||||
#include <rtems/posix/timer.h>
|
||||
#endif
|
||||
|
||||
static const Objects_Information *objects_info_table[] = {
|
||||
&_Barrier_Information,
|
||||
&_Extension_Information,
|
||||
&_Message_queue_Information,
|
||||
&_Partition_Information,
|
||||
&_Rate_monotonic_Information,
|
||||
&_Dual_ported_memory_Information,
|
||||
&_Region_Information,
|
||||
&_Semaphore_Information,
|
||||
&_RTEMS_tasks_Information,
|
||||
&_Timer_Information
|
||||
#ifdef RTEMS_POSIX_API
|
||||
,
|
||||
&_POSIX_Barrier_Information,
|
||||
&_POSIX_Condition_variables_Information,
|
||||
&_POSIX_Keys_Information,
|
||||
&_POSIX_Message_queue_Information,
|
||||
&_POSIX_Message_queue_Information_fds,
|
||||
&_POSIX_Mutex_Information,
|
||||
&_POSIX_RWLock_Information,
|
||||
&_POSIX_Semaphore_Information,
|
||||
&_POSIX_Spinlock_Information,
|
||||
&_POSIX_Threads_Information,
|
||||
&_POSIX_Timer_Information
|
||||
#endif
|
||||
};
|
||||
|
||||
static int open_files(void)
|
||||
{
|
||||
int free_count = 0;
|
||||
rtems_libio_t *iop;
|
||||
|
||||
rtems_libio_lock();
|
||||
|
||||
iop = rtems_libio_iop_freelist;
|
||||
while (iop != NULL) {
|
||||
++free_count;
|
||||
|
||||
iop = iop->data1;
|
||||
}
|
||||
|
||||
rtems_libio_unlock();
|
||||
|
||||
return (int) rtems_libio_number_iops - free_count;
|
||||
}
|
||||
|
||||
void rtems_resource_snapshot_take(rtems_resource_snapshot *snapshot)
|
||||
{
|
||||
uint32_t *active = &snapshot->rtems_api.active_barriers;
|
||||
size_t i;
|
||||
|
||||
_Protected_heap_Get_information(RTEMS_Malloc_Heap, &snapshot->heap_info);
|
||||
|
||||
_Thread_Disable_dispatch();
|
||||
|
||||
_Heap_Get_information(&_Workspace_Area, &snapshot->workspace_info);
|
||||
|
||||
for (i = 0; i < RTEMS_ARRAY_SIZE(objects_info_table); ++i) {
|
||||
active [i] = _Objects_Active_count(objects_info_table[i]);
|
||||
}
|
||||
|
||||
_Thread_Enable_dispatch();
|
||||
|
||||
#ifndef RTEMS_POSIX_API
|
||||
memset(&snapshot->posix_api, 0, sizeof(snapshot->posix_api));
|
||||
#endif
|
||||
|
||||
snapshot->open_files = open_files();
|
||||
}
|
||||
|
||||
bool rtems_resource_snapshot_equal(
|
||||
const rtems_resource_snapshot *a,
|
||||
const rtems_resource_snapshot *b
|
||||
)
|
||||
{
|
||||
return memcmp(a, b, sizeof(*a)) == 0;
|
||||
}
|
||||
|
||||
bool rtems_resource_snapshot_check(const rtems_resource_snapshot *snapshot)
|
||||
{
|
||||
rtems_resource_snapshot now;
|
||||
|
||||
rtems_resource_snapshot_take(&now);
|
||||
|
||||
return rtems_resource_snapshot_equal(&now, snapshot);
|
||||
}
|
||||
@@ -159,42 +159,113 @@ typedef union {
|
||||
IMFS_generic_t generic;
|
||||
} IMFS_types_union;
|
||||
|
||||
/**
|
||||
* @addtogroup IMFSGenericNodes
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Initializes an IMFS node.
|
||||
*
|
||||
* @param[in,out] node The IMFS node.
|
||||
* @param[in] info The IMFS type information.
|
||||
*
|
||||
* @retval node Successful operation.
|
||||
* @retval NULL An error occurred. The @c errno indicates the error. This
|
||||
* will abort the make operation.
|
||||
*
|
||||
* @see IMFS_node_control, IMFS_node_initialize_default(), and
|
||||
* IMFS_node_initialize_generic().
|
||||
*/
|
||||
typedef IMFS_jnode_t *(*IMFS_node_control_initialize)(
|
||||
IMFS_jnode_t *node,
|
||||
const IMFS_types_union *info
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Initialize Default IMFS Node
|
||||
* @brief Returns the node and does nothing else.
|
||||
*
|
||||
* @param[in,out] node The IMFS node.
|
||||
* @param[in] info The IMFS type information.
|
||||
*
|
||||
* @retval node Returns always the node passed as parameter.
|
||||
*
|
||||
* @see IMFS_node_control.
|
||||
*/
|
||||
IMFS_jnode_t *IMFS_node_initialize_default(
|
||||
IMFS_jnode_t *node,
|
||||
const IMFS_types_union *info
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Returns the node and sets the generic node context.
|
||||
*
|
||||
* @param[in,out] node The IMFS node.
|
||||
* @param[in] info The IMFS type information.
|
||||
*
|
||||
* @retval node Returns always the node passed as parameter.
|
||||
*
|
||||
* @see IMFS_node_control.
|
||||
*/
|
||||
IMFS_jnode_t *IMFS_node_initialize_generic(
|
||||
IMFS_jnode_t *node,
|
||||
const IMFS_types_union *info
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Prepares the removal of an IMFS node from its parent directory.
|
||||
*
|
||||
* @param[in,out] node The IMFS node.
|
||||
*
|
||||
* @retval node Successful operation.
|
||||
* @retval NULL An error occurred. The @c errno indicates the error. This
|
||||
* will abort the removal operation.
|
||||
*
|
||||
* @see IMFS_node_control and IMFS_node_remove_default().
|
||||
*/
|
||||
typedef IMFS_jnode_t *(*IMFS_node_control_remove)(
|
||||
IMFS_jnode_t *node
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Remove Default IMFS Node
|
||||
* @brief Returns the node and does nothing else.
|
||||
*
|
||||
* @param[in,out] node The IMFS node.
|
||||
*
|
||||
* @retval node Returns always the node passed as parameter.
|
||||
*
|
||||
* @see IMFS_node_control.
|
||||
*/
|
||||
IMFS_jnode_t *IMFS_node_remove_default(
|
||||
IMFS_jnode_t *node
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Destroys an IMFS node.
|
||||
*
|
||||
* @param[in,out] node The IMFS node.
|
||||
*
|
||||
* @retval node Returns always the node passed as parameter.
|
||||
*
|
||||
* @see IMFS_node_control and IMFS_node_destroy_default().
|
||||
*/
|
||||
typedef IMFS_jnode_t *(*IMFS_node_control_destroy)( IMFS_jnode_t *node );
|
||||
|
||||
/**
|
||||
* @brief Destroy Default IMFS Node
|
||||
* @brief Returns the node and does nothing else.
|
||||
*
|
||||
* @param[in,out] node The IMFS node.
|
||||
*
|
||||
* @retval node Returns always the node passed as parameter.
|
||||
*
|
||||
* @see IMFS_node_control.
|
||||
*/
|
||||
IMFS_jnode_t *IMFS_node_destroy_default( IMFS_jnode_t *node );
|
||||
|
||||
/**
|
||||
* @brief IMFS node control.
|
||||
*/
|
||||
typedef struct {
|
||||
IMFS_jnode_types_t imfs_type;
|
||||
const rtems_filesystem_file_handlers_r *handlers;
|
||||
@@ -203,12 +274,19 @@ typedef struct {
|
||||
IMFS_node_control_destroy node_destroy;
|
||||
} IMFS_node_control;
|
||||
|
||||
/** @} */
|
||||
|
||||
/*
|
||||
* Major device number for the IMFS. This is not a real device number because
|
||||
* the IMFS is just a file system and does not have a driver.
|
||||
*/
|
||||
#define IMFS_DEVICE_MAJOR_NUMBER (0xfffe)
|
||||
|
||||
/**
|
||||
* @ingroup IMFSGenericNodes
|
||||
*
|
||||
* @brief Generic IMFS device major number.
|
||||
*/
|
||||
#define IMFS_GENERIC_DEVICE_MAJOR_NUMBER (0xfffd)
|
||||
|
||||
/*
|
||||
@@ -513,8 +591,62 @@ extern bool IMFS_is_imfs_instance(
|
||||
const rtems_filesystem_location_info_t *loc
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* @brief IMFS Make a Generic Node
|
||||
* @defgroup IMFSGenericNodes IMFS Generic Nodes
|
||||
*
|
||||
* @ingroup LibIO
|
||||
*
|
||||
* @brief Generic nodes are an alternative to standard drivers in RTEMS.
|
||||
*
|
||||
* The handlers of a generic node are called with less overhead compared to the
|
||||
* standard driver operations. The usage of file system node handlers enable
|
||||
* more features like support for fsync() and fdatasync(). The generic nodes
|
||||
* use the reference counting of the IMFS. This provides automatic node
|
||||
* destruction when the last reference vanishes.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Makes a generic IMFS node.
|
||||
*
|
||||
* @param[in] path The path to the new generic IMFS node.
|
||||
* @param[in] mode The node mode.
|
||||
* @param[in] node_control The node control.
|
||||
* @param[in] context The node control handler context.
|
||||
*
|
||||
* @retval 0 Successful operation.
|
||||
* @retval -1 An error occurred. The @c errno indicates the error.
|
||||
*
|
||||
* @code
|
||||
* #include <sys/stat.h>
|
||||
* #include <assert.h>
|
||||
* #include <fcntl.h>
|
||||
*
|
||||
* #include <rtems/imfs.h>
|
||||
*
|
||||
* static const IMFS_node_control some_node_control = {
|
||||
* .imfs_type = IMFS_GENERIC,
|
||||
* .handlers = &some_node_handlers,
|
||||
* .node_initialize = IMFS_node_initialize_generic,
|
||||
* .node_remove = IMFS_node_remove_default,
|
||||
* .node_destroy = some_node_destroy
|
||||
* };
|
||||
*
|
||||
* void example(void *some_node_context)
|
||||
* {
|
||||
* int rv;
|
||||
*
|
||||
* rv = IMFS_make_generic_node(
|
||||
* "/path/to/some/generic/node",
|
||||
* S_IFCHR | S_IRWXU | S_IRWXG | S_IRWXO,
|
||||
* &some_node_control,
|
||||
* some_node_context
|
||||
* );
|
||||
* assert(rv == 0);
|
||||
* }
|
||||
* @endcode
|
||||
*/
|
||||
extern int IMFS_make_generic_node(
|
||||
const char *path,
|
||||
@@ -523,6 +655,8 @@ extern int IMFS_make_generic_node(
|
||||
void *context
|
||||
);
|
||||
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Mount an IMFS
|
||||
*/
|
||||
@@ -805,6 +939,12 @@ static inline IMFS_jnode_t *IMFS_create_node(
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @addtogroup IMFSGenericNodes
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
static inline void *IMFS_generic_get_context_by_node(
|
||||
const IMFS_jnode_t *node
|
||||
)
|
||||
@@ -838,6 +978,8 @@ static inline dev_t IMFS_generic_get_device_identifier_by_node(
|
||||
);
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -32,6 +32,7 @@ IMFS_jnode_t *IMFS_allocate_node(
|
||||
)
|
||||
{
|
||||
IMFS_jnode_t *node;
|
||||
IMFS_jnode_t *initialized_node;
|
||||
struct timeval tv;
|
||||
|
||||
if ( namelen > IMFS_NAME_MAX ) {
|
||||
@@ -82,7 +83,12 @@ IMFS_jnode_t *IMFS_allocate_node(
|
||||
node->stat_ctime = (time_t) tv.tv_sec;
|
||||
node->st_ino = ++fs_info->ino_count;
|
||||
|
||||
return (*node->control->node_initialize)( node, info );
|
||||
initialized_node = (*node->control->node_initialize)( node, info );
|
||||
if ( initialized_node == NULL ) {
|
||||
free( node );
|
||||
}
|
||||
|
||||
return initialized_node;
|
||||
}
|
||||
|
||||
IMFS_jnode_t *IMFS_create_node_with_control(
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Obtain Pointer to BSP Boot Command String
|
||||
* @ingroup BSPCommandLine BSP Command Line Helpers
|
||||
*/
|
||||
|
||||
/*
|
||||
* COPYRIGHT (c) 1989-2009.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Obtain COPY of the Entire Matching Argument
|
||||
* @ingroup BSPCommandLine BSP Command Line Helpers
|
||||
*/
|
||||
|
||||
/*
|
||||
* COPYRIGHT (c) 1989-2009.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Obtain Pointer to the Entire Matching Argument
|
||||
* @ingroup BSPCommandLine BSP Command Line Helpers
|
||||
*/
|
||||
|
||||
/*
|
||||
* COPYRIGHT (c) 1989-2009.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Obtain COPY of the Right Hand Side of the Matching Argument
|
||||
* @ingroup BSPCommandLine BSP Command Line Helpers
|
||||
*/
|
||||
|
||||
/*
|
||||
* COPYRIGHT (c) 1989-2009.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
/*
|
||||
* CPU Usage Reporter - Shared Data
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief CPU Usage Data
|
||||
* @ingroup libmisc_cpuuse CPU Usage
|
||||
*
|
||||
* CPU Usage Reporter - Shared Data
|
||||
*/
|
||||
|
||||
/*
|
||||
* COPYRIGHT (c) 1989-2009
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
/*
|
||||
* CPU Usage Reporter
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief CPU Usage Report
|
||||
* @ingroup libmisc_cpuuse CPU Usage
|
||||
*/
|
||||
|
||||
/*
|
||||
* COPYRIGHT (c) 1989-2010.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
/*
|
||||
* CPU Usage Reporter
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief CPU Usage Reset
|
||||
* @ingroup libmisc_cpuuse CPU Usage
|
||||
*/
|
||||
|
||||
/*
|
||||
* COPYRIGHT (c) 1989-2009
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
|
||||
@@ -24,6 +24,12 @@
|
||||
#include <rtems/score/timestamp.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @defgroup libmisc_cpuuse CPU Usage
|
||||
*
|
||||
* @ingroup libmisc
|
||||
*/
|
||||
/**@{*/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -43,14 +49,18 @@ void rtems_cpu_usage_report_with_plugin(
|
||||
rtems_printk_plugin_t handler
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_cpu_usage_report
|
||||
/**
|
||||
* @brief Report CPU usage.
|
||||
*
|
||||
* CPU Usage Reporter
|
||||
*/
|
||||
|
||||
void rtems_cpu_usage_report( void );
|
||||
|
||||
/*
|
||||
* rtems_cpu_usage_reset
|
||||
/**
|
||||
* @brief Reset CPU usage.
|
||||
*
|
||||
* CPU Usage Reporter
|
||||
*/
|
||||
|
||||
void rtems_cpu_usage_reset( void );
|
||||
@@ -58,6 +68,6 @@ void rtems_cpu_usage_reset( void );
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/**@}*/
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
/* /dev/null
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Derived from rtems' stub driver.
|
||||
* @brief Null Device Driver Init Routine
|
||||
* @ingroup libmisc_devnull Device Driver
|
||||
*
|
||||
* Derived from rtems' stub driver.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Author: Ralf Corsepius (corsepiu@faw.uni-ulm.de)
|
||||
*
|
||||
* COPYRIGHT (c) 1989-2000.
|
||||
|
||||
@@ -21,6 +21,12 @@
|
||||
|
||||
#include <rtems/io.h> /* rtems_device_driver */
|
||||
|
||||
/**
|
||||
* @defgroup libmisc_devnull Device Driver
|
||||
*
|
||||
* @ingroup libmisc
|
||||
*/
|
||||
/**@{*/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -70,6 +76,6 @@ rtems_device_driver null_control(
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/**@}*/
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Devzero
|
||||
* @ingroup libmisc_devnull Device Driver
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011 embedded brains GmbH. All rights reserved.
|
||||
*
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Dump Buffer
|
||||
* @ingroup libmisc_dumpbuf Print Memory Buffer
|
||||
*/
|
||||
|
||||
/*
|
||||
* COPYRIGHT (c) 1997-2007.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
|
||||
@@ -17,12 +17,18 @@
|
||||
#ifndef __DUMP_BUFFER_h
|
||||
#define __DUMP_BUFFER_h
|
||||
|
||||
/**
|
||||
* @defgroup libmisc_dumpbuf Print Memory Buffer
|
||||
*
|
||||
* @ingroup libmisc
|
||||
*/
|
||||
/**@{*/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Print Memory Buffer
|
||||
* @brief Print memory buffer.
|
||||
*
|
||||
* This method prints @a length bytes beginning at @a buffer in
|
||||
* a nice format similar to what one would expect from a debugger
|
||||
@@ -39,6 +45,6 @@ void rtems_print_buffer(
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/**@}*/
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief MicroWindows Print
|
||||
* @ingroup libmisc_fb_mw Input Devices for MicroWindows
|
||||
*/
|
||||
|
||||
/*
|
||||
* COPYRIGHT (c) 1989-2011.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
@@ -86,5 +93,5 @@ void uid_print_message_with_plugin(
|
||||
(*handler)( context, "Invalid device type\n" );
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
/*
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief MicroWindows UID
|
||||
* @ingroup libmisc_fb_mw Input Devices for MicroWindows
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000 - Rosimildo da Silva
|
||||
*
|
||||
* MODULE DESCRIPTION:
|
||||
|
||||
@@ -15,6 +15,12 @@
|
||||
#include <sys/types.h>
|
||||
#include <rtems/bspIo.h>
|
||||
|
||||
/**
|
||||
* @defgroup libmisc_fb_mw Input Devices for MicroWindows
|
||||
*
|
||||
* @ingroup libmisc
|
||||
*/
|
||||
/**@{*/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -182,5 +188,5 @@ void uid_print_message_with_plugin(
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/**@}*/
|
||||
#endif /* _MW_UID_H */
|
||||
|
||||
@@ -1,32 +1,24 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* File system mount functions.
|
||||
* @brief File System Mount Functions
|
||||
* @ingroup rtems_fstab File System Mount Support
|
||||
*/
|
||||
|
||||
/*===============================================================*\
|
||||
| Project: RTEMS fsmount |
|
||||
+-----------------------------------------------------------------+
|
||||
| File: fsmount.c |
|
||||
+-----------------------------------------------------------------+
|
||||
| Copyright (c) 2003 IMD |
|
||||
| Ingenieurbuero fuer Microcomputertechnik Th. Doerfler |
|
||||
| <Thomas.Doerfler@imd-systems.de> |
|
||||
| all rights reserved |
|
||||
+-----------------------------------------------------------------+
|
||||
| this file contains the fsmount functions. These functions |
|
||||
| are used to mount a list of filesystems (and create their mount |
|
||||
| points before) |
|
||||
| |
|
||||
| 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. |
|
||||
| |
|
||||
+-----------------------------------------------------------------+
|
||||
| date history ID |
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
||||
| 02.07.03 creation doe |
|
||||
\*===============================================================*/
|
||||
/*
|
||||
* Copyright (c) 2003 IMD
|
||||
* Ingenieurbuero fuer Microcomputertechnik Th. Doerfler
|
||||
* <Thomas.Doerfler@imd-systems.de>
|
||||
* all rights reserved
|
||||
*
|
||||
* This file contains the fsmount functions. These functions
|
||||
* are used to mount a list of filesystems (and create their mount
|
||||
* points before).
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
|
||||
@@ -123,6 +123,8 @@ typedef struct {
|
||||
} rtems_fstab_entry;
|
||||
|
||||
/**
|
||||
* @brief Mounts the file systems listed in the file system mount table.
|
||||
*
|
||||
* Mounts the file systems listed in the file system mount table @a fstab of
|
||||
* size @a size.
|
||||
*
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Opens a Serial Port Directly, and Interprets Serial Data
|
||||
* @ingroup libmisc_mouse Mouse Parser Engine
|
||||
*/
|
||||
|
||||
/*
|
||||
* This code is derived from a UNIX Serial Port Mouse Driver with
|
||||
* the following notice:
|
||||
@@ -19,7 +26,7 @@
|
||||
* ==================================================================
|
||||
*
|
||||
* It has been modified to support the concept of being just a parser
|
||||
* fed data from an arbitrary source. It is independent of either
|
||||
* fed data from an arbitrary source. It is independent of either
|
||||
* a PS/2 driver or a serial port.
|
||||
*
|
||||
* It was moved to cpukit/libmisc/mouse by Joel Sherrill.
|
||||
@@ -135,7 +142,7 @@ static int MOU_Data( int ch, COORD *dx, COORD *dy, COORD *dz, BUTTON *bptr)
|
||||
if ( !parse ) {
|
||||
printk( "Mouse parser is not initialized!\n" );
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Loop over all the bytes read in the buffer, parsing them.
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
* ==================================================================
|
||||
*
|
||||
* It has been modified to support the concept of being just a parser
|
||||
* fed data from an arbitrary source. It is independent of either
|
||||
* fed data from an arbitrary source. It is independent of either
|
||||
* a PS/2 driver or a serial port.
|
||||
*
|
||||
* It was moved to cpukit/libmisc/mouse by Joel Sherrill.
|
||||
@@ -36,6 +36,12 @@
|
||||
|
||||
#include <rtems/mw_uid.h>
|
||||
|
||||
/**
|
||||
* @defgroup libmisc_mouse Mouse Parser Engine
|
||||
*
|
||||
* @ingroup libmisc
|
||||
*/
|
||||
/**@{*/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -79,7 +85,7 @@ typedef unsigned int BUTTON;
|
||||
typedef void (*mouse_parser_enqueue_handler)(unsigned char *, size_t);
|
||||
|
||||
/**
|
||||
* @brief Initialize the Mouse Parser Engine
|
||||
* @brief Initialize the mouse parser engine.
|
||||
*
|
||||
* This method initializes the Mouse Parser Engine for the mouse
|
||||
* of @a type. The @a type should be one of the following strings:
|
||||
@@ -92,7 +98,7 @@ typedef void (*mouse_parser_enqueue_handler)(unsigned char *, size_t);
|
||||
int mouse_parser_initialize(const char *type);
|
||||
|
||||
/**
|
||||
* @brief Enqueue Input to the Mouse Parser Engine
|
||||
* @brief Enqueue input to the mouse parser engine.
|
||||
*
|
||||
* This method is used to pass mouse input to the Mouse Parser Engine.
|
||||
*
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Serial Mouse Driver
|
||||
* @ingroup libmisc_mouse Serial Mouse Driver
|
||||
*/
|
||||
|
||||
/*
|
||||
* COPYRIGHT (c) 1989-2011.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
@@ -26,7 +33,7 @@ const char *serial_mouse_type;
|
||||
static int serial_mouse_l_rint(int c, struct rtems_termios_tty *tp)
|
||||
{
|
||||
unsigned char buf = c;
|
||||
|
||||
|
||||
/* call mouse_parser( void *ptr, char *buffer, int size ) */
|
||||
mouse_parser_enqueue( &buf, 1 );
|
||||
return 0;
|
||||
|
||||
@@ -23,6 +23,13 @@
|
||||
#define __SERIAL_MOUSE_h__
|
||||
|
||||
/* functions */
|
||||
|
||||
/**
|
||||
* @defgroup libmisc_mouse Serial Mouse Driver
|
||||
*
|
||||
* @ingroup libmisc
|
||||
*/
|
||||
/**@{*/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -35,7 +42,7 @@ extern "C" {
|
||||
serial_mouse_read, serial_mouse_write, serial_mouse_control }
|
||||
|
||||
/**
|
||||
* @brief Serial Mouse Driver Initialization
|
||||
* @brief The initialization of the serial mouse driver.
|
||||
*
|
||||
* This method initializes the serial mouse driver.
|
||||
*
|
||||
@@ -50,7 +57,7 @@ rtems_device_driver serial_mouse_initialize(
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Serial Mouse Driver Open
|
||||
* @brief Open device driver entry point for the serial mouse driver.
|
||||
*
|
||||
* This method implements the Open device driver entry
|
||||
* point for the serial mouse driver.
|
||||
@@ -66,7 +73,7 @@ rtems_device_driver serial_mouse_open(
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Serial Mouse Driver Close
|
||||
* @brief Close device driver entry point for the serial mouse driver.
|
||||
*
|
||||
* This method implements the Close device driver entry
|
||||
* point for the serial mouse driver.
|
||||
@@ -82,7 +89,7 @@ rtems_device_driver serial_mouse_close(
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Serial Mouse Driver Read
|
||||
* @brief Read device driver entry point for the serial mouse driver.
|
||||
*
|
||||
* This method implements the Read device driver entry
|
||||
* point for the serial mouse driver.
|
||||
@@ -98,7 +105,7 @@ rtems_device_driver serial_mouse_read(
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Serial Mouse Driver Write
|
||||
* @brief Write device driver entry point for the serial mouse driver.
|
||||
*
|
||||
* This method implements the Write device driver entry
|
||||
* point for the serial mouse driver.
|
||||
@@ -114,7 +121,7 @@ rtems_device_driver serial_mouse_write(
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Serial Mouse Driver IO Control
|
||||
* @brief IO Control device driver entry point for the serial mouse driver.
|
||||
*
|
||||
* This method implements the IO Control device driver entry
|
||||
* point for the serial mouse driver.
|
||||
@@ -130,7 +137,7 @@ rtems_device_driver serial_mouse_control(
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Obtain Serial Mouse Configuration Information
|
||||
* @brief Obtain serial mouse configuration information.
|
||||
*
|
||||
* This method is implemented by the BSP or application and
|
||||
* tells the driver what device to open() and what type of
|
||||
@@ -150,5 +157,5 @@ bool bsp_get_serial_mouse_device(
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/**@}*/
|
||||
#endif /* __tty_drv__ */
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
/*
|
||||
* Stack Overflow Check User Extension Set
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* NOTE: This extension set automatically determines at
|
||||
* @brief Stack Overflow Check User Extension Set
|
||||
* @ingroup libmisc_stackchk Stack Checker Mechanism
|
||||
*
|
||||
* NOTE: This extension set automatically determines at
|
||||
* initialization time whether the stack for this
|
||||
* CPU grows up or down and installs the correct
|
||||
* extension routines for that direction.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* COPYRIGHT (c) 1989-2010.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
@@ -409,7 +414,7 @@ static void Stack_check_Dump_threads_usage(
|
||||
stack = &Stack_check_Interrupt_stack;
|
||||
the_thread = 0;
|
||||
current = 0;
|
||||
} else
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
stack = &the_thread->Start.Initial_stack;
|
||||
|
||||
@@ -21,12 +21,18 @@
|
||||
#include <rtems/score/percpu.h> /* Thread_Control */
|
||||
#include <rtems/bspIo.h>
|
||||
|
||||
/**
|
||||
* @defgroup libmisc_stackchk Stack Checker Mechanism
|
||||
*
|
||||
* @ingroup libmisc
|
||||
*/
|
||||
/**@{*/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Has Current Task Blown Its Stack
|
||||
* @brief Checks if current task is blown its stack.
|
||||
*
|
||||
* This method is used to determine if the current stack pointer
|
||||
* of the currently executing task is within bounds.
|
||||
@@ -38,7 +44,7 @@ extern "C" {
|
||||
bool rtems_stack_checker_is_blown( void );
|
||||
|
||||
/**
|
||||
* @brief Print Stack Usage Report
|
||||
* @brief Print the stack usage report using printk.
|
||||
*
|
||||
* This method prints a stack usage report for the curently executing
|
||||
* task.
|
||||
@@ -48,7 +54,7 @@ bool rtems_stack_checker_is_blown( void );
|
||||
void rtems_stack_checker_report_usage( void );
|
||||
|
||||
/**
|
||||
* @brief Print Stack Usage Report
|
||||
* @brief Print the stack usage report using caller's routine.
|
||||
*
|
||||
* This method prints a stack usage report for the curently executing
|
||||
* task.
|
||||
@@ -135,6 +141,6 @@ void rtems_stack_checker_switch_extension(
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/**@}*/
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <rtems.h>
|
||||
|
||||
/**
|
||||
* @brief Convert String to Pointer (with validation)
|
||||
* @brief Convert String to Pointer (with validation).
|
||||
*
|
||||
* This method converts a string to a pointer (void *) with
|
||||
* basic numeric validation.
|
||||
@@ -45,7 +45,7 @@ rtems_status_code rtems_string_to_pointer(
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Convert String to Unsigned Character (with validation)
|
||||
* @brief Convert String to Unsigned Character (with validation).
|
||||
*
|
||||
* This method converts a string to an unsigned character with
|
||||
* range validation.
|
||||
@@ -67,7 +67,7 @@ rtems_status_code rtems_string_to_unsigned_char(
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Convert String to Int (with validation)
|
||||
* @brief Convert String to Int (with validation).
|
||||
*
|
||||
* This method converts a string to an int with range validation.
|
||||
*
|
||||
@@ -88,7 +88,7 @@ rtems_status_code rtems_string_to_int(
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Convert String to Unsigned Int (with validation)
|
||||
* @brief Convert String to Unsigned Int (with validation).
|
||||
*
|
||||
* This method converts a string to an unsigned int with range validation.
|
||||
*
|
||||
@@ -109,7 +109,7 @@ rtems_status_code rtems_string_to_unsigned_int(
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Convert String to Long (with validation)
|
||||
* @brief Convert String to Long (with validation).
|
||||
*
|
||||
* This method converts a string to a long with
|
||||
* range validation.
|
||||
@@ -131,7 +131,7 @@ rtems_status_code rtems_string_to_long(
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Convert String to Unsigned Long (with validation)
|
||||
* @brief Convert String to Unsigned Long (with validation).
|
||||
*
|
||||
* This method converts a string to an unsigned long with
|
||||
* range validation.
|
||||
@@ -153,7 +153,7 @@ rtems_status_code rtems_string_to_unsigned_long(
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Convert String to Long Long (with validation)
|
||||
* @brief Convert String to Long Long (with validation).
|
||||
*
|
||||
* This method converts a string to a long long with
|
||||
* range validation.
|
||||
@@ -175,7 +175,7 @@ rtems_status_code rtems_string_to_long_long(
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Convert String to Unsigned Long Long (with validation)
|
||||
* @brief Convert String to Unsigned Long Long (with validation).
|
||||
*
|
||||
* This method converts a string to an unsigned character with
|
||||
* range validation.
|
||||
@@ -197,7 +197,7 @@ rtems_status_code rtems_string_to_unsigned_long_long(
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Convert String to Float (with validation)
|
||||
* @brief Convert String to Float (with validation).
|
||||
*
|
||||
* This method converts a string to a float with range validation.
|
||||
*
|
||||
@@ -216,7 +216,7 @@ rtems_status_code rtems_string_to_float(
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Convert String to Double (with validation)
|
||||
* @brief Convert String to Double (with validation).
|
||||
*
|
||||
* This method converts a string to a double with range validation.
|
||||
*
|
||||
@@ -235,7 +235,7 @@ rtems_status_code rtems_string_to_double(
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Convert String to long double (with validation)
|
||||
* @brief Convert String to long double (with validation).
|
||||
*
|
||||
* This method converts a string to a long double with range validation.
|
||||
*
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Convert String to Float (with validation)
|
||||
* @ingroup libmisc_conv_help Conversion Helpers
|
||||
*/
|
||||
|
||||
/*
|
||||
* COPYRIGHT (c) 2009.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
@@ -46,7 +53,7 @@ rtems_status_code rtems_string_to_float (
|
||||
if ( end == s )
|
||||
return RTEMS_NOT_DEFINED;
|
||||
|
||||
if ( ( errno == ERANGE ) &&
|
||||
if ( ( errno == ERANGE ) &&
|
||||
(( result == 0 ) || ( result == HUGE_VALF ) || ( result == -HUGE_VALF )))
|
||||
return RTEMS_INVALID_NUMBER;
|
||||
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Convert String to long double (with validation)
|
||||
* @ingroup libmisc_conv_help Conversion Helpers
|
||||
*/
|
||||
|
||||
/*
|
||||
* COPYRIGHT (c) 2009.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
@@ -46,7 +53,7 @@ rtems_status_code rtems_string_to_long_double (
|
||||
if ( end == s )
|
||||
return RTEMS_NOT_DEFINED;
|
||||
|
||||
if ( ( errno == ERANGE ) &&
|
||||
if ( ( errno == ERANGE ) &&
|
||||
(( result == 0 ) || ( result == HUGE_VALL ) || ( result == -HUGE_VALL )))
|
||||
return RTEMS_INVALID_NUMBER;
|
||||
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Convert String to Unsigned Character (with validation)
|
||||
* @ingroup libmisc_conv_help Conversion Helpers
|
||||
*/
|
||||
|
||||
/*
|
||||
* COPYRIGHT (c) 2009.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
@@ -47,7 +54,7 @@ rtems_status_code rtems_string_to_unsigned_char (
|
||||
if ( end == s )
|
||||
return RTEMS_NOT_DEFINED;
|
||||
|
||||
if ( ( errno == ERANGE ) &&
|
||||
if ( ( errno == ERANGE ) &&
|
||||
(( result == 0 ) || ( result == ULONG_MAX )))
|
||||
return RTEMS_INVALID_NUMBER;
|
||||
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @brief Convert String to Unsigned Long Long (with validation)
|
||||
* @ingroup libmisc_conv_help Conversion Helpers
|
||||
*/
|
||||
|
||||
/*
|
||||
* COPYRIGHT (c) 2009.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
@@ -52,7 +59,7 @@ rtems_status_code rtems_string_to_unsigned_long_long (
|
||||
if ( end == s )
|
||||
return RTEMS_NOT_DEFINED;
|
||||
|
||||
if ( ( errno == ERANGE ) &&
|
||||
if ( ( errno == ERANGE ) &&
|
||||
(( result == 0 ) || ( result == ULONG_LONG_MAX )))
|
||||
return RTEMS_INVALID_NUMBER;
|
||||
|
||||
|
||||
@@ -645,6 +645,23 @@ RTEMS_INLINE_ROUTINE bool rtems_chain_get_with_empty_check(
|
||||
return _Chain_Get_with_empty_check( chain, node );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the node count of the chain.
|
||||
*
|
||||
* @param[in] chain The chain.
|
||||
*
|
||||
* @note It does NOT disable interrupts to ensure the atomicity of the
|
||||
* operation.
|
||||
*
|
||||
* @return The node count of the chain.
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE size_t rtems_chain_node_count_unprotected(
|
||||
const rtems_chain_control *chain
|
||||
)
|
||||
{
|
||||
return _Chain_Node_count_unprotected( chain );
|
||||
}
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -190,7 +190,8 @@ libscore_a_SOURCES += src/objectallocate.c src/objectclose.c \
|
||||
src/objectshrinkinformation.c src/objectgetnoprotection.c \
|
||||
src/objectidtoname.c src/objectgetnameasstring.c src/objectsetname.c \
|
||||
src/objectgetinfo.c src/objectgetinfoid.c src/objectapimaximumclass.c \
|
||||
src/objectnamespaceremove.c
|
||||
src/objectnamespaceremove.c \
|
||||
src/objectactivecount.c
|
||||
|
||||
## SCHEDULER_C_FILES
|
||||
libscore_a_SOURCES += src/scheduler.c
|
||||
@@ -326,6 +327,7 @@ libscore_a_SOURCES += src/userextaddset.c \
|
||||
libscore_a_SOURCES += src/apiext.c src/chain.c src/chainappend.c \
|
||||
src/chainextract.c src/chainget.c src/chaininsert.c \
|
||||
src/chainappendempty.c src/chainprependempty.c src/chaingetempty.c \
|
||||
src/chainnodecount.c \
|
||||
src/interr.c src/isr.c src/wkspace.c src/wkstringduplicate.c
|
||||
|
||||
EXTRA_DIST = src/Unlimited.txt
|
||||
|
||||
@@ -254,6 +254,18 @@ bool _Chain_Get_with_empty_check(
|
||||
Chain_Node **the_node
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Returns the node count of the chain.
|
||||
*
|
||||
* @param[in] chain The chain.
|
||||
*
|
||||
* @note It does NOT disable interrupts to ensure the atomicity of the
|
||||
* operation.
|
||||
*
|
||||
* @return The node count of the chain.
|
||||
*/
|
||||
size_t _Chain_Node_count_unprotected( const Chain_Control *chain );
|
||||
|
||||
#ifndef __RTEMS_APPLICATION__
|
||||
#include <rtems/score/chain.inl>
|
||||
#endif
|
||||
|
||||
@@ -862,6 +862,17 @@ void _Objects_Close(
|
||||
Objects_Control *the_object
|
||||
);
|
||||
|
||||
/**
|
||||
* @brief Returns the count of active objects.
|
||||
*
|
||||
* @param[in] information The object information table.
|
||||
*
|
||||
* @return The count of active objects.
|
||||
*/
|
||||
Objects_Maximum _Objects_Active_count(
|
||||
const Objects_Information *information
|
||||
);
|
||||
|
||||
/*
|
||||
* Pieces of object.inl are promoted out to the user
|
||||
*/
|
||||
|
||||
34
cpukit/score/src/chainnodecount.c
Normal file
34
cpukit/score/src/chainnodecount.c
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2012 embedded brains GmbH. All rights reserved.
|
||||
*
|
||||
* embedded brains GmbH
|
||||
* Obere Lagerstr. 30
|
||||
* 82178 Puchheim
|
||||
* Germany
|
||||
* <rtems@embedded-brains.de>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <rtems/score/chain.h>
|
||||
|
||||
size_t _Chain_Node_count_unprotected( const Chain_Control *chain )
|
||||
{
|
||||
size_t count = 0;
|
||||
const Chain_Node *tail = _Chain_Immutable_tail( chain );
|
||||
const Chain_Node *node = _Chain_Immutable_first( chain );
|
||||
|
||||
while ( node != tail ) {
|
||||
++count;
|
||||
|
||||
node = _Chain_Immutable_next( node );
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
29
cpukit/score/src/objectactivecount.c
Normal file
29
cpukit/score/src/objectactivecount.c
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 2012 embedded brains GmbH. All rights reserved.
|
||||
*
|
||||
* embedded brains GmbH
|
||||
* Obere Lagerstr. 30
|
||||
* 82178 Puchheim
|
||||
* Germany
|
||||
* <rtems@embedded-brains.de>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <rtems/score/object.h>
|
||||
|
||||
Objects_Maximum _Objects_Active_count(
|
||||
const Objects_Information *information
|
||||
)
|
||||
{
|
||||
size_t inactive = _Chain_Node_count_unprotected( &information->Inactive );
|
||||
size_t maximum = information->maximum;
|
||||
|
||||
return (Objects_Maximum) ( maximum - inactive );
|
||||
}
|
||||
@@ -28,6 +28,7 @@ provided by RTEMS is:
|
||||
@item @code{@value{DIRPREFIX}chain_is_first} - Is the Node the first in the chain ?
|
||||
@item @code{@value{DIRPREFIX}chain_is_last} - Is the Node the last in the chain ?
|
||||
@item @code{@value{DIRPREFIX}chain_has_only_one_node} - Does the node have one node ?
|
||||
@item @code{@value{DIRPREFIX}chain_node_count_unprotected} - Returns the node count of the chain (unprotected)
|
||||
@item @code{@value{DIRPREFIX}chain_is_head} - Is the node the head ?
|
||||
@item @code{@value{DIRPREFIX}chain_is_tail} - Is the node the tail ?
|
||||
@item @code{@value{DIRPREFIX}chain_extract} - Extract the node from the chain
|
||||
@@ -496,6 +497,33 @@ This function returns @code{true} if there is only one node on the chain and
|
||||
This function returns @code{true} if there is only one node on the chain and
|
||||
@code{false} otherwise.
|
||||
|
||||
@c
|
||||
@c
|
||||
@c
|
||||
@page
|
||||
@subsection Returns the node count of the chain (unprotected)
|
||||
|
||||
@cindex chain only one node
|
||||
|
||||
@subheading CALLING SEQUENCE:
|
||||
|
||||
@ifset is-C
|
||||
@findex @value{DIRPREFIX}chain_node_count_unprotected
|
||||
@example
|
||||
size_t @value{DIRPREFIX}chain_node_count_unprotected(
|
||||
const @value{DIRPREFIX}chain_control *the_chain
|
||||
);
|
||||
@end example
|
||||
@end ifset
|
||||
|
||||
@subheading RETURNS
|
||||
|
||||
This function returns the node count of the chain.
|
||||
|
||||
@subheading DESCRIPTION:
|
||||
|
||||
This function returns the node count of the chain.
|
||||
|
||||
@c
|
||||
@c
|
||||
@c
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <rtems/blkdev.h>
|
||||
#include <rtems/ide_part_table.h>
|
||||
#include <rtems/ramdisk.h>
|
||||
#include <rtems/libcsupport.h>
|
||||
|
||||
#define ASSERT_SC(sc) rtems_test_assert((sc) == RTEMS_SUCCESSFUL)
|
||||
|
||||
@@ -99,12 +100,27 @@ static void test_logical_disks(const char *const *rdax, bool exists)
|
||||
}
|
||||
}
|
||||
|
||||
static void initialize_swapout_task(void)
|
||||
{
|
||||
int fd = open(rda, O_RDONLY);
|
||||
int rv = 0;
|
||||
|
||||
rtems_test_assert(fd >= 0);
|
||||
|
||||
rv = rtems_disk_fd_sync(fd);
|
||||
rtems_test_assert(rv == 0);
|
||||
|
||||
rv = close(fd);
|
||||
rtems_test_assert(rv == 0);
|
||||
}
|
||||
|
||||
static void test_bdpart(void)
|
||||
{
|
||||
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
||||
rtems_bdpart_partition created_partitions [PARTITION_COUNT];
|
||||
rtems_bdpart_format actual_format;
|
||||
rtems_bdpart_partition actual_partitions [PARTITION_COUNT];
|
||||
rtems_resource_snapshot before;
|
||||
size_t actual_count = PARTITION_COUNT;
|
||||
size_t i = 0;
|
||||
|
||||
@@ -112,6 +128,10 @@ static void test_bdpart(void)
|
||||
memset(&actual_format, 0, sizeof(actual_format));
|
||||
memset(&actual_partitions [0], 0, sizeof(actual_partitions));
|
||||
|
||||
initialize_swapout_task();
|
||||
|
||||
rtems_resource_snapshot_take(&before);
|
||||
|
||||
for (i = 0; i < PARTITION_COUNT; ++i) {
|
||||
rtems_bdpart_to_partition_type(
|
||||
RTEMS_BDPART_MBR_FAT_32,
|
||||
@@ -168,6 +188,8 @@ static void test_bdpart(void)
|
||||
ASSERT_SC(sc);
|
||||
test_logical_disks(&bdpart_rdax [0], false);
|
||||
|
||||
rtems_test_assert(rtems_resource_snapshot_check(&before));
|
||||
|
||||
sc = rtems_bdpart_register_from_disk(rda);
|
||||
ASSERT_SC(sc);
|
||||
test_logical_disks(&bdpart_rdax [0], true);
|
||||
@@ -180,6 +202,8 @@ static void test_bdpart(void)
|
||||
ASSERT_SC(sc);
|
||||
test_logical_disks(&bdpart_rdax [0], false);
|
||||
|
||||
rtems_test_assert(rtems_resource_snapshot_check(&before));
|
||||
|
||||
rtems_bdpart_dump(&actual_partitions [0], actual_count);
|
||||
}
|
||||
|
||||
@@ -216,13 +240,13 @@ size_t rtems_ramdisk_configuration_size = 1;
|
||||
#define CONFIGURE_APPLICATION_EXTRA_DRIVERS RAMDISK_DRIVER_TABLE_ENTRY
|
||||
#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
|
||||
|
||||
#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 4
|
||||
#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 13
|
||||
|
||||
#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
|
||||
|
||||
#define CONFIGURE_MAXIMUM_TASKS 2
|
||||
|
||||
#define CONFIGURE_EXTRA_TASK_STACKS (8 * 1024)
|
||||
#define CONFIGURE_INIT_TASK_STACK_SIZE (32 * 1024)
|
||||
|
||||
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#include <rtems/imfs.h>
|
||||
#include <rtems/malloc.h>
|
||||
#include <rtems/libcsupport.h>
|
||||
|
||||
typedef enum {
|
||||
TEST_NEW,
|
||||
@@ -313,12 +314,44 @@ static void test_imfs_make_generic_node(void)
|
||||
rtems_test_assert(state == TEST_DESTROYED);
|
||||
}
|
||||
|
||||
static IMFS_jnode_t *node_initialize_error(
|
||||
IMFS_jnode_t *node,
|
||||
const IMFS_types_union *info
|
||||
)
|
||||
{
|
||||
errno = EIO;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static IMFS_jnode_t *node_remove_inhibited(IMFS_jnode_t *node)
|
||||
{
|
||||
rtems_test_assert(false);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
static IMFS_jnode_t *node_destroy_inhibited(IMFS_jnode_t *node)
|
||||
{
|
||||
rtems_test_assert(false);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
static const IMFS_node_control node_invalid_control = {
|
||||
.imfs_type = IMFS_DIRECTORY,
|
||||
.handlers = &node_handlers,
|
||||
.node_initialize = node_initialize,
|
||||
.node_remove = node_remove,
|
||||
.node_destroy = node_destroy
|
||||
.node_initialize = node_initialize_error,
|
||||
.node_remove = node_remove_inhibited,
|
||||
.node_destroy = node_destroy_inhibited
|
||||
};
|
||||
|
||||
static const IMFS_node_control node_initialization_error_control = {
|
||||
.imfs_type = IMFS_GENERIC,
|
||||
.handlers = &node_handlers,
|
||||
.node_initialize = node_initialize_error,
|
||||
.node_remove = node_remove_inhibited,
|
||||
.node_destroy = node_destroy_inhibited
|
||||
};
|
||||
|
||||
static void test_imfs_make_generic_node_errors(void)
|
||||
@@ -330,6 +363,9 @@ static void test_imfs_make_generic_node_errors(void)
|
||||
(rtems_filesystem_mount_table_entry_t *) rtems_chain_first(chain);
|
||||
const char *type = mt_entry->type;
|
||||
void *opaque = NULL;
|
||||
rtems_resource_snapshot before;
|
||||
|
||||
rtems_resource_snapshot_take(&before);
|
||||
|
||||
errno = 0;
|
||||
rv = IMFS_make_generic_node(
|
||||
@@ -340,6 +376,7 @@ static void test_imfs_make_generic_node_errors(void)
|
||||
);
|
||||
rtems_test_assert(rv == -1);
|
||||
rtems_test_assert(errno == EINVAL);
|
||||
rtems_test_assert(rtems_resource_snapshot_check(&before));
|
||||
|
||||
errno = 0;
|
||||
rv = IMFS_make_generic_node(
|
||||
@@ -350,30 +387,44 @@ static void test_imfs_make_generic_node_errors(void)
|
||||
);
|
||||
rtems_test_assert(rv == -1);
|
||||
rtems_test_assert(errno == EINVAL);
|
||||
rtems_test_assert(rtems_resource_snapshot_check(&before));
|
||||
|
||||
mt_entry->type = "XXX";
|
||||
errno = 0;
|
||||
mt_entry->type = "XXX";
|
||||
rv = IMFS_make_generic_node(
|
||||
path,
|
||||
S_IFCHR | S_IRWXU | S_IRWXG | S_IRWXO,
|
||||
&node_control,
|
||||
NULL
|
||||
);
|
||||
mt_entry->type = type;
|
||||
rtems_test_assert(rv == -1);
|
||||
rtems_test_assert(errno == ENOTSUP);
|
||||
mt_entry->type = type;
|
||||
rtems_test_assert(rtems_resource_snapshot_check(&before));
|
||||
|
||||
opaque = rtems_heap_greedy_allocate(NULL, 0);
|
||||
errno = 0;
|
||||
opaque = rtems_heap_greedy_allocate(NULL, 0);
|
||||
rv = IMFS_make_generic_node(
|
||||
path,
|
||||
S_IFCHR | S_IRWXU | S_IRWXG | S_IRWXO,
|
||||
&node_control,
|
||||
NULL
|
||||
);
|
||||
rtems_heap_greedy_free(opaque);
|
||||
rtems_test_assert(rv == -1);
|
||||
rtems_test_assert(errno == ENOMEM);
|
||||
rtems_heap_greedy_free(opaque);
|
||||
rtems_test_assert(rtems_resource_snapshot_check(&before));
|
||||
|
||||
errno = 0;
|
||||
rv = IMFS_make_generic_node(
|
||||
path,
|
||||
S_IFCHR | S_IRWXU | S_IRWXG | S_IRWXO,
|
||||
&node_initialization_error_control,
|
||||
NULL
|
||||
);
|
||||
rtems_test_assert(rv == -1);
|
||||
rtems_test_assert(errno == EIO);
|
||||
rtems_test_assert(rtems_resource_snapshot_check(&before));
|
||||
}
|
||||
|
||||
static void Init(rtems_task_argument arg)
|
||||
|
||||
@@ -586,6 +586,30 @@ static void test_heap_allocate(void)
|
||||
p1 = test_init_and_alloc( alloc_size, alignment, boundary, NULL );
|
||||
}
|
||||
|
||||
static void test_heap_free(void)
|
||||
{
|
||||
Heap_Control *heap = &TestHeap;
|
||||
void *p;
|
||||
Heap_Block *block;
|
||||
bool ok;
|
||||
|
||||
_Heap_Initialize( heap, &TestHeapMemory[0], sizeof(TestHeapMemory), 0 );
|
||||
|
||||
p = _Heap_Allocate( heap, 1 );
|
||||
rtems_test_assert( p != NULL );
|
||||
|
||||
block = _Heap_Block_of_alloc_area( (uintptr_t) p, heap->page_size );
|
||||
|
||||
/*
|
||||
* This will kick the next block outside of the heap area and the next
|
||||
* _Heap_Free() will detect this.
|
||||
*/
|
||||
block->size_and_flag += sizeof(TestHeapMemory);
|
||||
|
||||
ok = _Heap_Free( heap, p );
|
||||
rtems_test_assert( !ok );
|
||||
}
|
||||
|
||||
static void *test_create_used_block( void )
|
||||
{
|
||||
uintptr_t const alloc_size = 3 * TEST_DEFAULT_PAGE_SIZE;
|
||||
@@ -1147,6 +1171,29 @@ static void test_posix_memalign(void)
|
||||
|
||||
}
|
||||
|
||||
static void test_greedy_allocate(void)
|
||||
{
|
||||
Heap_Control *heap = &TestHeap;
|
||||
uintptr_t block_size = 1;
|
||||
void *p;
|
||||
|
||||
_Heap_Initialize( heap, &TestHeapMemory[0], sizeof(TestHeapMemory), 0 );
|
||||
|
||||
_Heap_Greedy_allocate( heap, &block_size, 1 );
|
||||
|
||||
p = _Heap_Allocate( heap, 1 );
|
||||
rtems_test_assert( p != NULL );
|
||||
|
||||
p = _Heap_Allocate( heap, 1 );
|
||||
rtems_test_assert( p == NULL );
|
||||
|
||||
/* The internal allocation fails */
|
||||
_Heap_Greedy_allocate( heap, &block_size, 1 );
|
||||
|
||||
p = _Heap_Allocate( heap, 1 );
|
||||
rtems_test_assert( p == NULL );
|
||||
}
|
||||
|
||||
rtems_task Init(
|
||||
rtems_task_argument argument
|
||||
)
|
||||
@@ -1184,6 +1231,7 @@ rtems_task Init(
|
||||
test_heap_initialize();
|
||||
test_heap_block_allocate();
|
||||
test_heap_allocate();
|
||||
test_heap_free();
|
||||
test_heap_resize_block();
|
||||
test_realloc();
|
||||
test_heap_cases_1();
|
||||
@@ -1194,6 +1242,7 @@ rtems_task Init(
|
||||
test_heap_info();
|
||||
test_protected_heap_info();
|
||||
test_rtems_heap_allocate_aligned_with_boundary();
|
||||
test_greedy_allocate();
|
||||
|
||||
test_posix_memalign();
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/rbheap.h>
|
||||
#include <rtems/malloc.h>
|
||||
|
||||
/* forward declarations to avoid warnings */
|
||||
static rtems_task Init(rtems_task_argument argument);
|
||||
@@ -389,6 +390,45 @@ static void test_alloc_many_chunks(void)
|
||||
TEST_PAGE_TREE(&control, indices_1, frees_1);
|
||||
}
|
||||
|
||||
static void test_alloc_misaligned(void)
|
||||
{
|
||||
rtems_rbheap_control control;
|
||||
void *p;
|
||||
|
||||
test_init_successful(&control);
|
||||
|
||||
p = rtems_rbheap_allocate(&control, PAGE_SIZE - 1);
|
||||
rtems_test_assert(p != NULL);
|
||||
}
|
||||
|
||||
static void test_alloc_with_malloc_extend(void)
|
||||
{
|
||||
rtems_status_code sc;
|
||||
rtems_rbheap_control control;
|
||||
void *p;
|
||||
void *opaque;
|
||||
|
||||
sc = rtems_rbheap_initialize(
|
||||
&control,
|
||||
area,
|
||||
sizeof(area),
|
||||
PAGE_SIZE,
|
||||
rtems_rbheap_extend_descriptors_with_malloc,
|
||||
NULL
|
||||
);
|
||||
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
|
||||
|
||||
opaque = rtems_heap_greedy_allocate(NULL, 0);
|
||||
|
||||
p = rtems_rbheap_allocate(&control, PAGE_SIZE);
|
||||
rtems_test_assert(p == NULL);
|
||||
|
||||
rtems_heap_greedy_free(opaque);
|
||||
|
||||
p = rtems_rbheap_allocate(&control, PAGE_SIZE);
|
||||
rtems_test_assert(p != NULL);
|
||||
}
|
||||
|
||||
static void test_free_null(void)
|
||||
{
|
||||
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
||||
@@ -564,6 +604,8 @@ static void Init(rtems_task_argument arg)
|
||||
test_alloc_huge_chunk();
|
||||
test_alloc_one_chunk();
|
||||
test_alloc_many_chunks();
|
||||
test_alloc_misaligned();
|
||||
test_alloc_with_malloc_extend();
|
||||
test_free_null();
|
||||
test_free_invalid();
|
||||
test_free_double();
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2011 embedded brains GmbH. All rights reserved.
|
||||
* Copyright (c) 2011-2012 embedded brains GmbH. All rights reserved.
|
||||
*
|
||||
* embedded brains GmbH
|
||||
* Obere Lagerstr. 30
|
||||
@@ -36,8 +36,12 @@
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
#include <rtems/libcsupport.h>
|
||||
|
||||
#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 5
|
||||
|
||||
#define CONFIGURE_MAXIMUM_BARRIERS 2
|
||||
#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 7
|
||||
#define CONFIGURE_MAXIMUM_PARTITIONS 37
|
||||
#define CONFIGURE_MAXIMUM_PERIODS 41
|
||||
#define CONFIGURE_MAXIMUM_REGIONS 43
|
||||
@@ -228,6 +232,7 @@ static rtems_task Init(rtems_task_argument argument)
|
||||
rtems_id id = RTEMS_ID_NONE;
|
||||
rtems_name name = rtems_build_name('C', 'O', 'N', 'F');
|
||||
rtems_extensions_table table;
|
||||
rtems_resource_snapshot snapshot;
|
||||
int i = 0;
|
||||
|
||||
puts("\n\n*** POSIX TEST CONFIG 01 ***");
|
||||
@@ -236,6 +241,10 @@ static rtems_task Init(rtems_task_argument argument)
|
||||
|
||||
print_info();
|
||||
|
||||
rtems_resource_snapshot_take(&snapshot);
|
||||
rtems_test_assert(rtems_resource_snapshot_equal(&snapshot, &snapshot));
|
||||
rtems_test_assert(rtems_resource_snapshot_check(&snapshot));
|
||||
|
||||
#ifdef CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS
|
||||
for (i = 3; i < CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS; ++i) {
|
||||
int oflag = O_WRONLY | O_CREAT | O_TRUNC;
|
||||
@@ -244,6 +253,10 @@ static rtems_task Init(rtems_task_argument argument)
|
||||
int fd = open(path, oflag, mode);
|
||||
rtems_test_assert(fd == i);
|
||||
}
|
||||
rtems_resource_snapshot_take(&snapshot);
|
||||
rtems_test_assert(
|
||||
snapshot.open_files == CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS
|
||||
);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIGURE_MAXIMUM_USER_EXTENSIONS
|
||||
@@ -252,6 +265,10 @@ static rtems_task Init(rtems_task_argument argument)
|
||||
sc = rtems_extension_create(name, &table, &id);
|
||||
directive_failed(sc, "rtems_extension_create");
|
||||
}
|
||||
rtems_resource_snapshot_take(&snapshot);
|
||||
rtems_test_assert(
|
||||
snapshot.rtems_api.active_extensions == CONFIGURE_MAXIMUM_USER_EXTENSIONS
|
||||
);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIGURE_MAXIMUM_BARRIERS
|
||||
@@ -259,6 +276,10 @@ static rtems_task Init(rtems_task_argument argument)
|
||||
sc = rtems_barrier_create(name, RTEMS_DEFAULT_ATTRIBUTES, 1, &id);
|
||||
directive_failed(sc, "rtems_barrier_create");
|
||||
}
|
||||
rtems_resource_snapshot_take(&snapshot);
|
||||
rtems_test_assert(
|
||||
snapshot.rtems_api.active_barriers == CONFIGURE_MAXIMUM_BARRIERS
|
||||
);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIGURE_MAXIMUM_MESSAGE_QUEUES
|
||||
@@ -272,6 +293,11 @@ static rtems_task Init(rtems_task_argument argument)
|
||||
);
|
||||
directive_failed(sc, "rtems_message_queue_create");
|
||||
}
|
||||
rtems_resource_snapshot_take(&snapshot);
|
||||
rtems_test_assert(
|
||||
snapshot.rtems_api.active_message_queues
|
||||
== CONFIGURE_MAXIMUM_MESSAGE_QUEUES
|
||||
);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIGURE_MAXIMUM_PARTITIONS
|
||||
@@ -286,6 +312,10 @@ static rtems_task Init(rtems_task_argument argument)
|
||||
);
|
||||
directive_failed(sc, "rtems_partition_create");
|
||||
}
|
||||
rtems_resource_snapshot_take(&snapshot);
|
||||
rtems_test_assert(
|
||||
snapshot.rtems_api.active_partitions == CONFIGURE_MAXIMUM_PARTITIONS
|
||||
);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIGURE_MAXIMUM_PERIODS
|
||||
@@ -293,6 +323,10 @@ static rtems_task Init(rtems_task_argument argument)
|
||||
sc = rtems_rate_monotonic_create(name, &id);
|
||||
directive_failed(sc, "rtems_rate_monotonic_create");
|
||||
}
|
||||
rtems_resource_snapshot_take(&snapshot);
|
||||
rtems_test_assert(
|
||||
snapshot.rtems_api.active_periods == CONFIGURE_MAXIMUM_PERIODS
|
||||
);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIGURE_MAXIMUM_REGIONS
|
||||
@@ -307,6 +341,10 @@ static rtems_task Init(rtems_task_argument argument)
|
||||
);
|
||||
directive_failed(sc, "rtems_region_create");
|
||||
}
|
||||
rtems_resource_snapshot_take(&snapshot);
|
||||
rtems_test_assert(
|
||||
snapshot.rtems_api.active_regions == CONFIGURE_MAXIMUM_REGIONS
|
||||
);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIGURE_MAXIMUM_SEMAPHORES
|
||||
@@ -320,6 +358,10 @@ static rtems_task Init(rtems_task_argument argument)
|
||||
);
|
||||
directive_failed(sc, "rtems_semaphore_create");
|
||||
}
|
||||
rtems_resource_snapshot_take(&snapshot);
|
||||
rtems_test_assert(
|
||||
snapshot.rtems_api.active_semaphores >= CONFIGURE_MAXIMUM_SEMAPHORES
|
||||
);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIGURE_MAXIMUM_TASKS
|
||||
@@ -334,6 +376,10 @@ static rtems_task Init(rtems_task_argument argument)
|
||||
);
|
||||
directive_failed(sc, "rtems_task_create");
|
||||
}
|
||||
rtems_resource_snapshot_take(&snapshot);
|
||||
rtems_test_assert(
|
||||
snapshot.rtems_api.active_tasks == CONFIGURE_MAXIMUM_TASKS
|
||||
);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIGURE_MAXIMUM_TASK_VARIABLES
|
||||
@@ -348,6 +394,10 @@ static rtems_task Init(rtems_task_argument argument)
|
||||
sc = rtems_timer_create(name, &id);
|
||||
directive_failed(sc, "rtems_timer_create");
|
||||
}
|
||||
rtems_resource_snapshot_take(&snapshot);
|
||||
rtems_test_assert(
|
||||
snapshot.rtems_api.active_timers == CONFIGURE_MAXIMUM_TIMERS
|
||||
);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIGURE_MAXIMUM_POSIX_BARRIERS
|
||||
@@ -356,6 +406,10 @@ static rtems_task Init(rtems_task_argument argument)
|
||||
eno = pthread_barrier_init(&barrier, NULL, 1);
|
||||
rtems_test_assert(eno == 0);
|
||||
}
|
||||
rtems_resource_snapshot_take(&snapshot);
|
||||
rtems_test_assert(
|
||||
snapshot.posix_api.active_barriers == CONFIGURE_MAXIMUM_POSIX_BARRIERS
|
||||
);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES
|
||||
@@ -364,6 +418,11 @@ static rtems_task Init(rtems_task_argument argument)
|
||||
eno = pthread_cond_init(&cond, NULL);
|
||||
rtems_test_assert(eno == 0);
|
||||
}
|
||||
rtems_resource_snapshot_take(&snapshot);
|
||||
rtems_test_assert(
|
||||
snapshot.posix_api.active_condition_variables
|
||||
== CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES
|
||||
);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIGURE_MAXIMUM_POSIX_KEYS
|
||||
@@ -372,6 +431,10 @@ static rtems_task Init(rtems_task_argument argument)
|
||||
eno = pthread_key_create(&key, posix_key_dtor);
|
||||
rtems_test_assert(eno == 0);
|
||||
}
|
||||
rtems_resource_snapshot_take(&snapshot);
|
||||
rtems_test_assert(
|
||||
snapshot.posix_api.active_keys == CONFIGURE_MAXIMUM_POSIX_KEYS
|
||||
);
|
||||
#endif
|
||||
|
||||
#ifdef POSIX_MQ_COUNT
|
||||
@@ -386,6 +449,15 @@ static rtems_task Init(rtems_task_argument argument)
|
||||
mqd_t mq = mq_open(path, oflag, mode, &attr);
|
||||
rtems_test_assert(mq >= 0);
|
||||
}
|
||||
rtems_resource_snapshot_take(&snapshot);
|
||||
rtems_test_assert(
|
||||
snapshot.posix_api.active_message_queue_descriptors
|
||||
== CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUE_DESCRIPTORS
|
||||
);
|
||||
rtems_test_assert(
|
||||
snapshot.posix_api.active_message_queues
|
||||
== CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES
|
||||
);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIGURE_MAXIMUM_POSIX_MUTEXES
|
||||
@@ -394,6 +466,10 @@ static rtems_task Init(rtems_task_argument argument)
|
||||
eno = pthread_mutex_init(&mutex, NULL);
|
||||
rtems_test_assert(eno == 0);
|
||||
}
|
||||
rtems_resource_snapshot_take(&snapshot);
|
||||
rtems_test_assert(
|
||||
snapshot.posix_api.active_mutexes == CONFIGURE_MAXIMUM_POSIX_MUTEXES
|
||||
);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIGURE_MAXIMUM_POSIX_RWLOCKS
|
||||
@@ -402,6 +478,10 @@ static rtems_task Init(rtems_task_argument argument)
|
||||
eno = pthread_rwlock_init(&rwlock, NULL);
|
||||
rtems_test_assert(eno == 0);
|
||||
}
|
||||
rtems_resource_snapshot_take(&snapshot);
|
||||
rtems_test_assert(
|
||||
snapshot.posix_api.active_rwlocks == CONFIGURE_MAXIMUM_POSIX_RWLOCKS
|
||||
);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIGURE_MAXIMUM_POSIX_SEMAPHORES
|
||||
@@ -413,6 +493,10 @@ static rtems_task Init(rtems_task_argument argument)
|
||||
sem_t *sem = sem_open(path, oflag, mode, value);
|
||||
rtems_test_assert(sem != SEM_FAILED);
|
||||
}
|
||||
rtems_resource_snapshot_take(&snapshot);
|
||||
rtems_test_assert(
|
||||
snapshot.posix_api.active_semaphores == CONFIGURE_MAXIMUM_POSIX_SEMAPHORES
|
||||
);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIGURE_MAXIMUM_POSIX_SPINLOCKS
|
||||
@@ -421,6 +505,10 @@ static rtems_task Init(rtems_task_argument argument)
|
||||
eno = pthread_spin_init(&spinlock, 0);
|
||||
rtems_test_assert(eno == 0);
|
||||
}
|
||||
rtems_resource_snapshot_take(&snapshot);
|
||||
rtems_test_assert(
|
||||
snapshot.posix_api.active_spinlocks == CONFIGURE_MAXIMUM_POSIX_SPINLOCKS
|
||||
);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIGURE_MAXIMUM_POSIX_THREADS
|
||||
@@ -429,6 +517,10 @@ static rtems_task Init(rtems_task_argument argument)
|
||||
eno = pthread_create(&thread, NULL, posix_thread, NULL);
|
||||
rtems_test_assert(eno == 0);
|
||||
}
|
||||
rtems_resource_snapshot_take(&snapshot);
|
||||
rtems_test_assert(
|
||||
snapshot.posix_api.active_threads == CONFIGURE_MAXIMUM_POSIX_THREADS
|
||||
);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIGURE_MAXIMUM_POSIX_TIMERS
|
||||
@@ -437,6 +529,10 @@ static rtems_task Init(rtems_task_argument argument)
|
||||
rv = timer_create(CLOCK_REALTIME, NULL, &timer_id);
|
||||
rtems_test_assert(rv == 0);
|
||||
}
|
||||
rtems_resource_snapshot_take(&snapshot);
|
||||
rtems_test_assert(
|
||||
snapshot.posix_api.active_timers == CONFIGURE_MAXIMUM_POSIX_TIMERS
|
||||
);
|
||||
#endif
|
||||
|
||||
printf("object creation done\n");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
*** POSIX TEST CONFIG 01 ***
|
||||
used blocks = 46, largest used block = 8264, used space = 64344
|
||||
free blocks = 1, largest free block = 97040, free space = 97040
|
||||
used blocks = 61, largest used block = 8264, used space = 78792
|
||||
free blocks = 1, largest free block = 115944, free space = 115944
|
||||
object creation done
|
||||
used blocks = 204, largest used block = 8264, used space = 160984
|
||||
free blocks = 1, largest free block = 400, free space = 400
|
||||
used blocks = 280, largest used block = 8264, used space = 193704
|
||||
free blocks = 1, largest free block = 1032, free space = 1032
|
||||
*** END OF POSIX TEST CONFIG 01 ***
|
||||
|
||||
@@ -136,7 +136,6 @@ static void test_chain_with_notification(void)
|
||||
rtems_test_assert( sc == RTEMS_SUCCESSFUL );
|
||||
rtems_test_assert( p == &a );
|
||||
|
||||
puts( "INIT - Verify rtems_chain_prepend_with_notification" );
|
||||
puts( "INIT - Verify rtems_chain_get_with_notification" );
|
||||
rtems_chain_initialize_empty( &chain );
|
||||
|
||||
@@ -199,6 +198,26 @@ static void test_chain_with_empty_check(void)
|
||||
rtems_test_assert( p == &b );
|
||||
}
|
||||
|
||||
static void test_chain_node_count(void)
|
||||
{
|
||||
rtems_chain_control chain;
|
||||
rtems_chain_node nodes[3];
|
||||
size_t count;
|
||||
size_t i;
|
||||
|
||||
puts( "INIT - Verify rtems_chain_node_count_unprotected" );
|
||||
|
||||
rtems_chain_initialize_empty( &chain );
|
||||
count = rtems_chain_node_count_unprotected( &chain );
|
||||
rtems_test_assert( count == 0 );
|
||||
|
||||
for (i = 0; i < RTEMS_ARRAY_SIZE( nodes ); ++i) {
|
||||
rtems_chain_append_unprotected( &chain, &nodes[i] );
|
||||
count = rtems_chain_node_count_unprotected( &chain );
|
||||
rtems_test_assert( count == i + 1 );
|
||||
}
|
||||
}
|
||||
|
||||
rtems_task Init(
|
||||
rtems_task_argument ignored
|
||||
)
|
||||
@@ -240,6 +259,7 @@ rtems_task Init(
|
||||
test_chain_get_with_wait();
|
||||
test_chain_control_layout();
|
||||
test_chain_control_initializer();
|
||||
test_chain_node_count();
|
||||
|
||||
puts( "*** END OF RTEMS CHAIN API TEST ***" );
|
||||
rtems_test_exit(0);
|
||||
|
||||
@@ -23,6 +23,7 @@ directives:
|
||||
rtems_chain_prepend_with_notification
|
||||
rtems_chain_get_with_notification
|
||||
rtems_chain_get_with_wait
|
||||
rtems_chain_node_count_unprotected
|
||||
|
||||
concepts:
|
||||
|
||||
|
||||
@@ -12,4 +12,5 @@ INIT - Verify rtems_chain_get_with_notification
|
||||
INIT - Verify rtems_chain_get_with_wait
|
||||
INIT - Verify rtems_chain_control layout
|
||||
INIT - Verify rtems_chain_control initializer
|
||||
INIT - Verify rtems_chain_node_count_unprotected
|
||||
*** END OF RTEMS CHAIN API TEST ***
|
||||
|
||||
@@ -77,12 +77,46 @@ static void test_with_timeout(void)
|
||||
rtems_test_assert(sc == RTEMS_UNSATISFIED);
|
||||
}
|
||||
|
||||
static void test_with_invalid_receiver(void)
|
||||
{
|
||||
rtems_status_code sc;
|
||||
|
||||
sc = rtems_event_system_send(0xffff, EVENT);
|
||||
rtems_test_assert(sc == RTEMS_INVALID_ID);
|
||||
}
|
||||
|
||||
static void test_with_invalid_address(void)
|
||||
{
|
||||
rtems_status_code sc;
|
||||
|
||||
sc = rtems_event_system_receive(EVENT, RTEMS_NO_WAIT, 0, NULL);
|
||||
rtems_test_assert(sc == RTEMS_INVALID_ADDRESS);
|
||||
}
|
||||
|
||||
static void test_get_pending_events(void)
|
||||
{
|
||||
rtems_status_code sc;
|
||||
rtems_event_set out;
|
||||
|
||||
sc = rtems_event_system_receive(
|
||||
RTEMS_PENDING_EVENTS,
|
||||
RTEMS_NO_WAIT,
|
||||
0,
|
||||
&out
|
||||
);
|
||||
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
|
||||
rtems_test_assert(out == 0);
|
||||
}
|
||||
|
||||
static void Init(rtems_task_argument arg)
|
||||
{
|
||||
puts("\n\n*** TEST SPEVENTSYSTEM 1 ***");
|
||||
|
||||
test_with_normal_and_system_event();
|
||||
test_with_timeout();
|
||||
test_with_invalid_receiver();
|
||||
test_with_invalid_address();
|
||||
test_get_pending_events();
|
||||
|
||||
puts("*** END OF TEST SPEVENTSYSTEM 1 ***");
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@ rtems_task Init(
|
||||
Objects_Locations location;
|
||||
Objects_Id id;
|
||||
Objects_Information *info;
|
||||
Objects_Maximum active_count;
|
||||
|
||||
puts( "\n\n*** TEST OBJECT GET NEXT ***" );
|
||||
|
||||
@@ -103,6 +104,10 @@ rtems_task Init(
|
||||
|
||||
/* XXX try with a manager with no objects created */
|
||||
|
||||
puts( "Init - _Objects_Active_count" );
|
||||
active_count = _Objects_Active_count( info );
|
||||
rtems_test_assert( active_count == 1 );
|
||||
|
||||
puts( "*** END OF TEST OBJECT GET NEXT ***" );
|
||||
rtems_test_exit( 0 );
|
||||
}
|
||||
|
||||
@@ -12,10 +12,13 @@ test set name: spobjgetnext
|
||||
|
||||
directives:
|
||||
|
||||
SCORE _Objects_Get_next
|
||||
_Objects_Get_next
|
||||
_Objects_Active_count
|
||||
|
||||
concepts:
|
||||
|
||||
+ Ensure that _Objects_Get_next handles error conditions properly.
|
||||
|
||||
+ Ensure the _Objects_Get_next behaves as expected.
|
||||
|
||||
+ Ensure the _Objects_Active_count behaves as expected.
|
||||
|
||||
@@ -4,4 +4,5 @@ Init - _Objects_Get_next - NULL location
|
||||
Init - _Objects_Get_next - NULL id
|
||||
1 RTEMS Task
|
||||
1 RTEMS Task
|
||||
Init - _Objects_Active_count
|
||||
*** END OF TEST OBJECT GET NEXT ***
|
||||
|
||||
Reference in New Issue
Block a user