summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Erik Werner <martinerikwerner@gmail.com>2019-09-03 01:48:28 +0200
committerChris Johns <chrisj@rtems.org>2019-09-03 09:48:35 +1000
commit2e711f2b4b59398a18d21ea34bdb064c459fdd45 (patch)
treee79c0d7ee12a966fdd93d717ec573657ea1e55ce
parentb836c43f190cb731dc13cfa786e8ea66fa10e584 (diff)
downloadrtems-docs-2e711f2b4b59398a18d21ea34bdb064c459fdd45.tar.bz2
Address several issues from compiling examples
Compiling the code from examples "code-block:: c" along with public includes and a bsp exposed a few issues amongst a lot of false positives. Address some of these: * Terminate struct declarations with ';'. Mainly for pedantic correctness. * Show ptrdiff_t instead of size_t for the sbrk() prototype, matching the current argument type in rtems. * Replace some occurrences of unsigned16 with uint16_t. * Fix odd type declaration, "uint8_t char*" -> "char*". * Use appropriate helper to get chain head instead of invalid access to nonexistent struct member. * Remove several excess '\' escapes. * Use RTEMS_SELF instead of undefined SELF. * Use rtems_task instead of void for task functions. * Add missing stack size parameter in task creation. * Use rtems_interrupt_level instead of undefined rtems_interrupt. * Correct return value format for rtems_object_id_get_api() rtems_object_id_get_index() (enum and uint16_t) and also fix corresponding print formatting. * Correct return value documentation for rtems_object_id_get_class(), rtems_object_id_get_node() and rtems_object_id_get_index() int -> uint32_t. * Use RTEMS_SUCCESSFUL instead of undefined RTEMS_STATUS_SUCCESSFUL and fix return value variable name in rate monotonic examples. * Use RTEMS_TIMEOUT instead of undefined TIMEOUT and RTEMS_PERIOD_STATUS instead of undefined STATUS. * Add missing fields to ftpd configuration. * Correct parameter types in ftpd hook prototype, unsigned char * -> void *. * Fix various code-block:: attributes, c -> makefile and c -> shell. * Add missing parenthesis in socket buffer memory calculation example. * Remove typedef in declaration of mq_attr since it is defiend without typedef in reality. * Update siginfo_t declaration to match current reality. * Update shell user command definition example to include mode, uid and gid.
-rw-r--r--bsp-howto/console.rst2
-rw-r--r--bsp-howto/miscellanous_support.rst2
-rw-r--r--bsp-howto/real_time_clock.rst4
-rw-r--r--c-user/chains.rst4
-rw-r--r--c-user/configuring_a_system.rst2
-rw-r--r--c-user/constant_bandwidth_server.rst6
-rw-r--r--c-user/fatal_error.rst7
-rw-r--r--c-user/interrupt_manager.rst8
-rw-r--r--c-user/key_concepts.rst4
-rw-r--r--c-user/object_services.rst19
-rw-r--r--c-user/rate_monotonic_manager.rst19
-rw-r--r--c-user/task_manager.rst2
-rw-r--r--networking/network_servers.rst10
-rw-r--r--networking/networking_driver.rst4
-rw-r--r--networking/using_networking_rtems_app.rst6
-rw-r--r--posix-users/message_passing.rst2
-rw-r--r--posix-users/signal.rst16
-rw-r--r--shell/configuration_and_init.rst15
-rw-r--r--shell/file_and_directory.rst6
-rw-r--r--shell/general_commands.rst2
20 files changed, 71 insertions, 69 deletions
diff --git a/bsp-howto/console.rst b/bsp-howto/console.rst
index 83b10b4..aef13a8 100644
--- a/bsp-howto/console.rst
+++ b/bsp-howto/console.rst
@@ -168,7 +168,7 @@ The handler table for the polled mode should look like the following.
.set_attributes = my_driver_set_attributes,
.ioctl = my_driver_ioctl, /* optional, may be NULL */
.mode = TERMIOS_POLLED
- }
+ };
The :c:func:`my_driver_poll_write()` routine is responsible for writing ``n``
characters from ``buf`` to the serial device specified by ``base``.
diff --git a/bsp-howto/miscellanous_support.rst b/bsp-howto/miscellanous_support.rst
index cea744d..77b7194 100644
--- a/bsp-howto/miscellanous_support.rst
+++ b/bsp-howto/miscellanous_support.rst
@@ -138,7 +138,7 @@ prototype for this routine:
.. code-block:: c
- void * sbrk(size_t increment)
+ void * sbrk(ptrdiff_t increment)
The ``increment`` amount is based upon the ``sbrk_amount`` parameter passed to
the ``bsp_libc_init`` during system initialization.
diff --git a/bsp-howto/real_time_clock.rst b/bsp-howto/real_time_clock.rst
index ee40a6c..62ec09e 100644
--- a/bsp-howto/real_time_clock.rst
+++ b/bsp-howto/real_time_clock.rst
@@ -67,8 +67,8 @@ table is below:
bool dmv177_icm7170_probe(int minor)
{
- volatile unsigned16 *card_resource_reg;
- card_resource_reg = (volatile unsigned16 *) DMV170_CARD_RESORCE_REG;
+ volatile uint16_t *card_resource_reg;
+ card_resource_reg = (volatile uint16_t *) DMV170_CARD_RESORCE_REG;
if ( (*card_resource_reg & DMV170_RTC_INST_MASK) == DMV170_RTC_INSTALLED )
return TRUE;
return FALSE;
diff --git a/c-user/chains.rst b/c-user/chains.rst
index c47d318..0dce1d9 100644
--- a/c-user/chains.rst
+++ b/c-user/chains.rst
@@ -149,7 +149,7 @@ to the control. Consider a user structure and chain control:
typedef struct foo
{
rtems_chain_node node;
- uint8_t char* data;
+ char* data;
} foo;
rtems_chain_control chain;
@@ -192,7 +192,7 @@ placed on another chain:
rtems_chain_initialize_empty (out);
- node = chain->first;
+ node = rtems_chain_head (chain);
while (!rtems_chain_is_tail (chain, node))
{
bar = (foo*) node;
diff --git a/c-user/configuring_a_system.rst b/c-user/configuring_a_system.rst
index c7a8808..85c4e0f 100644
--- a/c-user/configuring_a_system.rst
+++ b/c-user/configuring_a_system.rst
@@ -3869,7 +3869,7 @@ that the two systems cannot interfere in an undesirable way.
RTEMS_SCHEDULER_PRIORITY_SMP(work, CONFIGURE_MAXIMUM_PRIORITY + 1);
/* Configuration Step 3 - Scheduler Table */
- #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \\
+ #define CONFIGURE_SCHEDULER_TABLE_ENTRIES \
RTEMS_SCHEDULER_TABLE_PRIORITY_SMP( \
io, \
rtems_build_name('I', 'O', ' ', ' ') \
diff --git a/c-user/constant_bandwidth_server.rst b/c-user/constant_bandwidth_server.rst
index e1ab20e..eddc89a 100644
--- a/c-user/constant_bandwidth_server.rst
+++ b/c-user/constant_bandwidth_server.rst
@@ -190,7 +190,7 @@ overrun.
rtems_cbs_server_id server_id
)
{
- printk( "Budget overrun, fixing the task\\n" );
+ printk( "Budget overrun, fixing the task\n" );
return;
}
@@ -206,8 +206,8 @@ overrun.
params.budget = 4;
rtems_cbs_initialize();
- rtems_cbs_create_server( &params, &overrun_handler, &server_id )
- rtems_cbs_attach_thread( server_id, SELF );
+ rtems_cbs_create_server( &params, &overrun_handler, &server_id );
+ rtems_cbs_attach_thread( server_id, RTEMS_SELF );
rtems_rate_monotonic_create( argument, &rmid );
while ( 1 ) {
diff --git a/c-user/fatal_error.rst b/c-user/fatal_error.rst
index 82fd82a..f785647 100644
--- a/c-user/fatal_error.rst
+++ b/c-user/fatal_error.rst
@@ -158,7 +158,7 @@ INTERNAL_ERROR_THREAD_EXITTED (5)
.. code-block:: c
- void task( rtems_arg arg )
+ rtems_task task( rtems_task_argument arg )
{
/* Classic API tasks must not return */
}
@@ -171,6 +171,7 @@ INTERNAL_ERROR_THREAD_EXITTED (5)
sc = rtems_task_create(
rtems_build_name('T', 'A', 'S', 'K'),
1,
+ RTEMS_MINIMUM_STACK_SIZE,
RTEMS_DEFAULT_MODES,
RTEMS_DEFAULT_ATTRIBUTES,
&task_id
@@ -258,7 +259,7 @@ INTERNAL_ERROR_THREAD_QUEUE_ENQUEUE_STICKY_FROM_BAD_STATE (29)
.. code-block:: c
- void bad( rtems_id timer_id, void *arg )
+ rtems_timer_service_routine bad( rtems_id timer_id, void *arg )
{
rtems_id *sem_id;
@@ -268,7 +269,7 @@ INTERNAL_ERROR_THREAD_QUEUE_ENQUEUE_STICKY_FROM_BAD_STATE (29)
assert( 0 );
}
- void fire_bad_timer( rtems_task_argument arg )
+ rtems_task fire_bad_timer( rtems_task_argument arg )
{
rtems_status_code sc;
rtems_id sem_id;
diff --git a/c-user/interrupt_manager.rst b/c-user/interrupt_manager.rst
index 5352781..5eb7270 100644
--- a/c-user/interrupt_manager.rst
+++ b/c-user/interrupt_manager.rst
@@ -348,7 +348,7 @@ NOTES:
void critical_section( void )
{
- rtems_interrupt level;
+ rtems_interrupt_level level;
/*
* Please note that the rtems_interrupt_disable() is a macro. The
@@ -363,7 +363,7 @@ NOTES:
/* Critical section, maskable interrupts are disabled */
{
- rtems_interrupt level2;
+ rtems_interrupt_level level2;
rtems_interrupt_disable( level2 );
@@ -503,7 +503,7 @@ NOTES:
void local_critical_section( void )
{
- rtems_interrupt level;
+ rtems_interrupt_level level;
/*
* Please note that the rtems_interrupt_local_disable() is a macro.
@@ -521,7 +521,7 @@ NOTES:
*/
{
- rtems_interrupt level2;
+ rtems_interrupt_level level2;
rtems_interrupt_local_disable( level2 );
diff --git a/c-user/key_concepts.rst b/c-user/key_concepts.rst
index c8f5e87..6bc1c3e 100644
--- a/c-user/key_concepts.rst
+++ b/c-user/key_concepts.rst
@@ -157,10 +157,10 @@ prototyped as follows:
.. code-block:: c
- uint32_t rtems_object_id_get_api( rtems_id );
+ Objects_APIs rtems_object_id_get_api( rtems_id );
uint32_t rtems_object_id_get_class( rtems_id );
uint32_t rtems_object_id_get_node( rtems_id );
- uint32_t rtems_object_id_get_index( rtems_id );
+ uint16_t rtems_object_id_get_index( rtems_id );
An object control block is a data structure defined by RTEMS which contains the
information necessary to manage a particular object type. For efficiency
diff --git a/c-user/object_services.rst b/c-user/object_services.rst
index 2524d52..544ff02 100644
--- a/c-user/object_services.rst
+++ b/c-user/object_services.rst
@@ -114,7 +114,7 @@ printing the values.
void printObjectId(rtems_id id)
{
printf(
- "API=%d Class=%d Node=%d Index=%d\n",
+ "API=%d Class=%" PRIu32 " Node=%" PRIu32 " Index=%" PRIu16 "\n",
rtems_object_id_get_api(id),
rtems_object_id_get_class(id),
rtems_object_id_get_node(id),
@@ -157,13 +157,14 @@ parts and "pretty-printed."
void prettyPrintObjectId(rtems_id id)
{
- int tmpAPI, tmpClass;
+ int tmpAPI;
+ uint32_t tmpClass;
tmpAPI = rtems_object_id_get_api(id),
tmpClass = rtems_object_id_get_class(id),
printf(
- "API=%s Class=%s Node=%d Index=%d\n",
+ "API=%s Class=%s Node=%" PRIu32 " Index=%" PRIu16 "\n",
rtems_object_get_api_name(tmpAPI),
rtems_object_get_api_class_name(tmpAPI, tmpClass),
rtems_object_id_get_node(id),
@@ -373,8 +374,8 @@ OBJECT_ID_GET_CLASS - Obtain Class from Id
CALLING SEQUENCE:
.. code-block:: c
- int rtems_object_id_get_class(
- rtems_id id
+ uint32_t rtems_object_id_get_class(
+ rtems_id id
);
DIRECTIVE STATUS CODES:
@@ -403,8 +404,8 @@ OBJECT_ID_GET_NODE - Obtain Node from Id
CALLING SEQUENCE:
.. code-block:: c
- int rtems_object_id_get_node(
- rtems_id id
+ uint32_t rtems_object_id_get_node(
+ rtems_id id
);
DIRECTIVE STATUS CODES:
@@ -433,8 +434,8 @@ OBJECT_ID_GET_INDEX - Obtain Index from Id
CALLING SEQUENCE:
.. code-block:: c
- int rtems_object_id_get_index(
- rtems_id id
+ uint16_t rtems_object_id_get_index(
+ rtems_id id
);
DIRECTIVE STATUS CODES:
diff --git a/c-user/rate_monotonic_manager.rst b/c-user/rate_monotonic_manager.rst
index 927042b..1cc55fe 100644
--- a/c-user/rate_monotonic_manager.rst
+++ b/c-user/rate_monotonic_manager.rst
@@ -522,8 +522,8 @@ executes every 100 clock ticks.
rtems_status_code status;
name = rtems_build_name( 'P', 'E', 'R', 'D' );
status = rtems_rate_monotonic_create( name, &period );
- if ( status != RTEMS_STATUS_SUCCESSFUL ) {
- printf( "rtems_monotonic_create failed with status of %d.\n", rc );
+ if ( status != RTEMS_SUCCESSFUL ) {
+ printf( "rtems_monotonic_create failed with status of %d.\n", status );
exit( 1 );
}
while ( 1 ) {
@@ -533,11 +533,11 @@ executes every 100 clock ticks.
}
/* missed period so delete period and SELF */
status = rtems_rate_monotonic_delete( period );
- if ( status != RTEMS_STATUS_SUCCESSFUL ) {
+ if ( status != RTEMS_SUCCESSFUL ) {
printf( "rtems_rate_monotonic_delete failed with status of %d.\n", status );
exit( 1 );
}
- status = rtems_task_delete( SELF ); /* should not return */
+ status = rtems_task_delete( RTEMS_SELF ); /* should not return */
printf( "rtems_task_delete returned with status of %d.\n", status );
exit( 1 );
}
@@ -568,21 +568,20 @@ ticks. The last thirty clock ticks are not used by this task.
{
rtems_name name_1, name_2;
rtems_id period_1, period_2;
- rtems_status_code status;
name_1 = rtems_build_name( 'P', 'E', 'R', '1' );
name_2 = rtems_build_name( 'P', 'E', 'R', '2' );
(void ) rtems_rate_monotonic_create( name_1, &period_1 );
(void ) rtems_rate_monotonic_create( name_2, &period_2 );
while ( 1 ) {
- if ( rtems_rate_monotonic_period( period_1, 100 ) == TIMEOUT )
+ if ( rtems_rate_monotonic_period( period_1, 100 ) == RTEMS_TIMEOUT )
break;
- if ( rtems_rate_monotonic_period( period_2, 40 ) == TIMEOUT )
+ if ( rtems_rate_monotonic_period( period_2, 40 ) == RTEMS_TIMEOUT )
break;
/*
* Perform first set of actions between clock
* ticks 0 and 39 of every 100 ticks.
*/
- if ( rtems_rate_monotonic_period( period_2, 30 ) == TIMEOUT )
+ if ( rtems_rate_monotonic_period( period_2, 30 ) == RTEMS_TIMEOUT )
break;
/*
* Perform second set of actions between clock 40 and 69
@@ -590,14 +589,14 @@ ticks. The last thirty clock ticks are not used by this task.
*
* Check to make sure we didn't miss the period_2 period.
*/
- if ( rtems_rate_monotonic_period( period_2, STATUS ) == TIMEOUT )
+ if ( rtems_rate_monotonic_period( period_2, RTEMS_PERIOD_STATUS ) == RTEMS_TIMEOUT )
break;
(void) rtems_rate_monotonic_cancel( period_2 );
}
/* missed period so delete period and SELF */
(void ) rtems_rate_monotonic_delete( period_1 );
(void ) rtems_rate_monotonic_delete( period_2 );
- (void ) task_delete( SELF );
+ (void ) rtems_task_delete( RTEMS_SELF );
}
The above task creates two rate monotonic periods as part of its
diff --git a/c-user/task_manager.rst b/c-user/task_manager.rst
index 45027f8..fdbf41b 100644
--- a/c-user/task_manager.rst
+++ b/c-user/task_manager.rst
@@ -1553,7 +1553,7 @@ EXAMPLE:
#include <rtems.h>
#include <assert.h>
- void task( rtems_task_argument arg );
+ rtems_task task( rtems_task_argument arg );
void example( void )
{
diff --git a/networking/network_servers.rst b/networking/network_servers.rst
index dcf2739..941a6e2 100644
--- a/networking/network_servers.rst
+++ b/networking/network_servers.rst
@@ -60,7 +60,13 @@ Example hooks structure and configuration structure folllow.
40, /* FTPD task priority */
512*1024, /* Maximum hook 'file' size */
0, /* Use default port */
- ftp_hooks /* Local ftp hooks */
+ ftp_hooks, /* Local ftp hooks */
+ 0, /* Use / as root */
+ 1, /* Max. connections */
+ 0, /* Infinite idle timeout */
+ 0, /* Read-write access */
+ 0, /* Ignore login check */
+ true /* Say hello */
};
Specifying 0 for the well-known port causes FTPD to use the UNIX standard FTPD
@@ -75,7 +81,7 @@ The prototype for the ``untar`` hook (and hooks, in general) is:
.. code-block:: c
- int Untar_FromMemory(unsigned char *tar_buf, unsigned long size);
+ int Untar_FromMemory(void *tar_buf, size_t size);
An example FTP transcript which exercises this hook is:
diff --git a/networking/networking_driver.rst b/networking/networking_driver.rst
index e7a7017..c161c2b 100644
--- a/networking/networking_driver.rst
+++ b/networking/networking_driver.rst
@@ -99,14 +99,14 @@ to be compiled with the appropriate flags. This can be accomplished by adding
is inside the RTEMS source tree or is built using the RTEMS application
Makefiles, then adding the following line accomplishes this:
-.. code-block:: c
+.. code-block:: makefile
DEFINES += -D__INSIDE_RTEMS_BSD_TCPIP_STACK__
This is equivalent to the following list of definitions. Early versions of the
RTEMS BSD network stack required that all of these be defined.
-.. code-block:: c
+.. code-block:: makefile
-D_COMPILING_BSD_KERNEL_ -DKERNEL -DINET -DNFS \
-DDIAGNOSTIC -DBOOTP_COMPAT
diff --git a/networking/using_networking_rtems_app.rst b/networking/using_networking_rtems_app.rst
index 3d117dc..0d3e245 100644
--- a/networking/using_networking_rtems_app.rst
+++ b/networking/using_networking_rtems_app.rst
@@ -14,7 +14,7 @@ Including the required managers
The FreeBSD networking code requires several RTEMS managers in the application:
-.. code-block:: c
+.. code-block:: makefile
MANAGERS = io event semaphore
@@ -25,7 +25,7 @@ The networking tasks allocate a lot of memory. For most applications the heap
should be at least 256 kbytes. The amount of memory set aside for the heap can
be adjusted by setting the ``CFLAGS_LD`` definition as shown below:
-.. code-block:: c
+.. code-block:: makefile
CFLAGS_LD += -Wl,--defsym -Wl,HeapSize=0x80000
@@ -210,7 +210,7 @@ the first two entries in this structure.
.. code-block:: c
- 40 * (1024 + sizeof(struct sockaddr_in)
+ 40 * (1024 + sizeof(struct sockaddr_in))
``unsigned long tcp_tx_buf_size``
This configuration parameter specifies the maximum amount of buffer memory
diff --git a/posix-users/message_passing.rst b/posix-users/message_passing.rst
index 0df9cc6..50c43dd 100644
--- a/posix-users/message_passing.rst
+++ b/posix-users/message_passing.rst
@@ -77,7 +77,7 @@ queue.
.. code-block:: c
- typedef struct mq_attr{
+ struct mq_attr{
long mq_flags;
long mq_maxmsg;
long mq_msgsize;
diff --git a/posix-users/signal.rst b/posix-users/signal.rst
index 86f2a3e..1b4694c 100644
--- a/posix-users/signal.rst
+++ b/posix-users/signal.rst
@@ -400,16 +400,12 @@ The prototype of the ``siginfo_t`` structure is the following:
{
int si_signo; /* Signal number */
int si_code; /* Cause of the signal */
- pid_t si_pid; /* Sending process ID */
- uid_t si_uid; /* Real user ID of sending process */
- void* si_addr; /* Address of faulting instruction */
- int si_status; /* Exit value or signal */
union sigval
{
int sival_int; /* Integer signal value */
void* sival_ptr; /* Pointer signal value */
} si_value; /* Signal value */
- }
+ } siginfo_t;
**NOTES:**
@@ -778,16 +774,12 @@ The prototype of the ``siginfo_t`` structure is the following:
{
int si_signo; /* Signal number */
int si_code; /* Cause of the signal */
- pid_t si_pid; /* Sending process ID */
- uid_t si_uid; /* Real user ID of sending process */
- void* si_addr; /* Address of faulting instruction */
- int si_status; /* Exit value or signal */
union sigval
{
int sival_int; /* Integer signal value */
void* sival_ptr; /* Pointer signal value */
} si_value; /* Signal value */
- }
+ } siginfo_t;
.. _sigtimedwait:
@@ -837,7 +829,7 @@ The ``timespec`` structure is defined as follows:
{
time_t tv_sec; /* Seconds */
long tv_nsec; /* Nanoseconds */
- }
+ };
**NOTES:**
@@ -895,7 +887,7 @@ The ``sigval`` union is specified as:
{
int sival_int; /* Integer signal value */
void* sival_ptr; /* Pointer signal value */
- }
+ };
**NOTES:**
diff --git a/shell/configuration_and_init.rst b/shell/configuration_and_init.rst
index 610ed2e..6977905 100644
--- a/shell/configuration_and_init.rst
+++ b/shell/configuration_and_init.rst
@@ -103,12 +103,15 @@ provided an alias for ``usercmd`` named ``userecho``.
return 0;
}
rtems_shell_cmd_t Shell_USERCMD_Command = {
- "usercmd", /* name */
- "usercmd n1 \[n2 \[n3...]]", /* usage */
- "user", /* topic */
- main_usercmd, /* command */
- NULL, /* alias */
- NULL /* next */
+ "usercmd", /* name */
+ "usercmd n1 [n2 [n3...]]", /* usage */
+ "user", /* topic */
+ main_usercmd, /* command */
+ NULL, /* alias */
+ NULL, /* next */
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH, /* mode */
+ 0, /* uid */
+ 0 /* gid */
};
rtems_shell_alias_t Shell_USERECHO_Alias = {
"usercmd", /* command */
diff --git a/shell/file_and_directory.rst b/shell/file_and_directory.rst
index 8609736..c1837ac 100644
--- a/shell/file_and_directory.rst
+++ b/shell/file_and_directory.rst
@@ -100,7 +100,7 @@ NOTES:
EXAMPLES:
The following is an example of how to use ``blksync``:
- .. code-block:: c
+ .. code-block:: shell
blksync /dev/hda1
@@ -1469,7 +1469,7 @@ ln - make links
.. index:: ln
SYNOPSYS:
- .. code-block:: c
+ .. code-block:: shell
ln [-fhinsv] source_file [target_file]
ln [-fhinsv] source_file ... target_dir
@@ -1729,7 +1729,7 @@ mkdir - create a directory
.. index:: mkdir
SYNOPSYS:
- .. code-block:: c
+ .. code-block:: shell
mkdir dir [dir1 .. dirN]
diff --git a/shell/general_commands.rst b/shell/general_commands.rst
index 381c7d9..c74ae45 100644
--- a/shell/general_commands.rst
+++ b/shell/general_commands.rst
@@ -1030,7 +1030,7 @@ time - time command execution
.. index:: time
SYNOPSYS:
- .. code-block:: c
+ .. code-block:: shell
time command [argument ...]