Changeset a0e6488 in rtems-docs


Ignore:
Timestamp:
Aug 2, 2018, 1:25:43 PM (15 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
8fd9e62
Parents:
24326a8
git-author:
Sebastian Huber <sebastian.huber@…> (08/02/18 13:25:43)
git-committer:
Sebastian Huber <sebastian.huber@…> (08/03/18 06:50:34)
Message:

c-user: Update partition create documentation

Add an example.

Close #3482.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c-user/partition_manager.rst

    r24326a8 ra0e6488  
    163163       - partition created successfully
    164164     * - ``RTEMS_INVALID_NAME``
    165        - invalid partition name
     165       - invalid partition ``name``
    166166     * - ``RTEMS_TOO_MANY``
    167167       - too many partitions created
    168168     * - ``RTEMS_INVALID_ADDRESS``
    169        - address not on four byte boundary
     169       - ``starting_address`` is not on a pointer size boundary
    170170     * - ``RTEMS_INVALID_ADDRESS``
    171171       - ``starting_address`` is NULL
     
    173173       - ``id`` is NULL
    174174     * - ``RTEMS_INVALID_SIZE``
    175        - length or buffer size is 0
     175       - ``length`` or ``buffer_size`` is 0
    176176     * - ``RTEMS_INVALID_SIZE``
    177        - length is less than the buffer size
     177       - ``length`` is less than the ``buffer_size``
    178178     * - ``RTEMS_INVALID_SIZE``
    179        - buffer size not a multiple of 4
     179       - ``buffer_size`` is not an integral multiple of the pointer size
     180     * - ``RTEMS_INVALID_SIZE``
     181       - ``buffer_size`` is less than two times the pointer size
    180182     * - ``RTEMS_MP_NOT_CONFIGURED``
    181183       - multiprocessing not configured
     
    195197    This directive will not cause the calling task to be preempted.
    196198
    197     The ``starting_address`` must be properly aligned for the target
    198     architecture.
    199 
    200     The ``buffer_size`` parameter must be a multiple of the CPU alignment
    201     factor.  Additionally, ``buffer_size`` must be large enough to hold two
    202     pointers on the target architecture.  This is required for RTEMS to manage
    203     the buffers when they are free.
     199    The partition buffer area specified by the ``starting_address`` must be
     200    properly aligned.  It must be possible to directly store target
     201    architecture pointers and the also the user data.  For example, if the user
     202    data contains some long double or vector data types, the partition buffer
     203    area and the buffer size must take the alignment of these types into
     204    account which is usually larger than the pointer alignment.  A cache line
     205    alignment may be also a factor.
     206
     207    The ``buffer_size`` parameter must be an integral multiple of the pointer
     208    size on the target architecture.  Additionally, ``buffer_size`` must be
     209    large enough to hold two pointers on the target architecture.  This is
     210    required for RTEMS to manage the buffers when they are free.
    204211
    205212    Memory from the partition is not used by RTEMS to store the Partition
     
    226233    The total number of global objects, including partitions, is limited by the
    227234    maximum_global_objects field in the Configuration Table.
     235
     236EXAMPLE:
     237    .. code-block:: c
     238
     239        #include <rtems.h>
     240        #include <rtems/chain.h>
     241
     242        #include <assert.h>
     243
     244        typedef struct {
     245          char  less;
     246          short more;
     247        } item;
     248
     249        union {
     250          item             data;
     251          rtems_chain_node node;
     252        } items[ 13 ];
     253
     254        rtems_id create_partition(void)
     255        {
     256          rtems_id          id;
     257          rtems_status_code sc;
     258
     259          sc = rtems_partition_create(
     260            rtems_build_name( 'P', 'A', 'R', 'T' ),
     261            items,
     262            sizeof( items ),
     263            sizeof( items[ 0 ] ),
     264            RTEMS_DEFAULT_ATTRIBUTES,
     265            &id
     266          );
     267          assert(sc == RTEMS_SUCCESSFUL);
     268
     269          return id;
     270        }
    228271
    229272.. raw:: latex
Note: See TracChangeset for help on using the changeset viewer.