54 #include <rtems/test.h> 66 RtemsPartReqReturnBuffer_Pre_Id_Id,
67 RtemsPartReqReturnBuffer_Pre_Id_Invalid,
68 RtemsPartReqReturnBuffer_Pre_Id_NA
69 } RtemsPartReqReturnBuffer_Pre_Id;
72 RtemsPartReqReturnBuffer_Pre_InUse_True,
73 RtemsPartReqReturnBuffer_Pre_InUse_False,
74 RtemsPartReqReturnBuffer_Pre_InUse_NA
75 } RtemsPartReqReturnBuffer_Pre_InUse;
78 RtemsPartReqReturnBuffer_Post_Status_Ok,
79 RtemsPartReqReturnBuffer_Post_Status_InvId,
80 RtemsPartReqReturnBuffer_Post_Status_InUse,
81 RtemsPartReqReturnBuffer_Post_Status_NA
82 } RtemsPartReqReturnBuffer_Post_Status;
109 RtemsPartReqReturnBuffer_Instance;
111 static const char *
const RtemsPartReqReturnBuffer_PreDesc_Id[] = {
117 static const char *
const RtemsPartReqReturnBuffer_PreDesc_InUse[] = {
123 static const char *
const *
const RtemsPartReqReturnBuffer_PreDesc[] = {
124 RtemsPartReqReturnBuffer_PreDesc_Id,
125 RtemsPartReqReturnBuffer_PreDesc_InUse,
129 #define PART_NAME rtems_build_name( 'N', 'A', 'M', 'E' ) 131 #define BUFFER_COUNT 1 133 #define BUFFER_SIZE ( 2 * sizeof( void * ) ) 136 buffers[ BUFFER_COUNT ][ BUFFER_SIZE ];
138 static void RtemsPartReqReturnBuffer_Pre_Id_Prepare(
140 RtemsPartReqReturnBuffer_Pre_Id state
144 case RtemsPartReqReturnBuffer_Pre_Id_Id: {
145 ctx->id = ctx->id_value;
149 case RtemsPartReqReturnBuffer_Pre_Id_Invalid: {
154 case RtemsPartReqReturnBuffer_Pre_Id_NA:
159 static void RtemsPartReqReturnBuffer_Pre_InUse_Prepare(
161 RtemsPartReqReturnBuffer_Pre_InUse state
167 case RtemsPartReqReturnBuffer_Pre_InUse_True: {
171 T_not_null( ctx->buffer );
175 case RtemsPartReqReturnBuffer_Pre_InUse_False: {
180 case RtemsPartReqReturnBuffer_Pre_InUse_NA:
185 static void RtemsPartReqReturnBuffer_Post_Status_Check(
187 RtemsPartReqReturnBuffer_Post_Status state
194 case RtemsPartReqReturnBuffer_Post_Status_Ok: {
195 T_rsc_success( ctx->status );
196 ctx->id_value = 0xffffffff;
201 T_eq_u32(
id, 0xffffffff );
205 case RtemsPartReqReturnBuffer_Post_Status_InvId: {
211 T_eq_u32(
id, ctx->id_value );
215 case RtemsPartReqReturnBuffer_Post_Status_InUse: {
221 T_eq_u32(
id, ctx->id_value );
225 case RtemsPartReqReturnBuffer_Post_Status_NA:
230 static size_t RtemsPartReqReturnBuffer_Scope(
void *arg,
char *buf,
size_t n )
237 return T_get_scope( RtemsPartReqReturnBuffer_PreDesc, buf, n, ctx->
pcs );
243 static T_fixture RtemsPartReqReturnBuffer_Fixture = {
247 .scope = RtemsPartReqReturnBuffer_Scope,
248 .initial_context = &RtemsPartReqReturnBuffer_Instance
251 static const uint8_t RtemsPartReqReturnBuffer_TransitionMap[][ 1 ] = {
253 RtemsPartReqReturnBuffer_Post_Status_InUse
255 RtemsPartReqReturnBuffer_Post_Status_Ok
257 RtemsPartReqReturnBuffer_Post_Status_InvId
259 RtemsPartReqReturnBuffer_Post_Status_InvId
263 static const struct {
265 uint8_t Pre_Id_NA : 1;
266 uint8_t Pre_InUse_NA : 1;
267 } RtemsPartReqReturnBuffer_TransitionInfo[] = {
279 static void RtemsPartReqReturnBuffer_Prepare(
289 sizeof( buffers[ 0 ] ),
296 static void RtemsPartReqReturnBuffer_Action(
303 static void RtemsPartReqReturnBuffer_Cleanup(
309 if ( ctx->buffer != NULL ) {
314 if ( ctx->id_value != 0xffffffff ) {
324 RtemsPartReqReturnBuffer,
325 &RtemsPartReqReturnBuffer_Fixture
331 ctx = T_fixture_context();
336 ctx->
pcs[ 0 ] = RtemsPartReqReturnBuffer_Pre_Id_Id;
337 ctx->
pcs[ 0 ] < RtemsPartReqReturnBuffer_Pre_Id_NA;
340 if ( RtemsPartReqReturnBuffer_TransitionInfo[ index ].Pre_Id_NA ) {
341 ctx->
pcs[ 0 ] = RtemsPartReqReturnBuffer_Pre_Id_NA;
342 index += ( RtemsPartReqReturnBuffer_Pre_Id_NA - 1 )
343 * RtemsPartReqReturnBuffer_Pre_InUse_NA;
347 ctx->
pcs[ 1 ] = RtemsPartReqReturnBuffer_Pre_InUse_True;
348 ctx->
pcs[ 1 ] < RtemsPartReqReturnBuffer_Pre_InUse_NA;
351 if ( RtemsPartReqReturnBuffer_TransitionInfo[ index ].Pre_InUse_NA ) {
352 ctx->
pcs[ 1 ] = RtemsPartReqReturnBuffer_Pre_InUse_NA;
353 index += ( RtemsPartReqReturnBuffer_Pre_InUse_NA - 1 );
356 if ( RtemsPartReqReturnBuffer_TransitionInfo[ index ].Skip ) {
361 RtemsPartReqReturnBuffer_Prepare( ctx );
362 RtemsPartReqReturnBuffer_Pre_Id_Prepare( ctx, ctx->
pcs[ 0 ] );
363 RtemsPartReqReturnBuffer_Pre_InUse_Prepare( ctx, ctx->
pcs[ 1 ] );
364 RtemsPartReqReturnBuffer_Action( ctx );
365 RtemsPartReqReturnBuffer_Post_Status_Check(
367 RtemsPartReqReturnBuffer_TransitionMap[ index ][ 0 ]
369 RtemsPartReqReturnBuffer_Cleanup( ctx );
rtems_status_code rtems_partition_get_buffer(rtems_id id, void **buffer)
Tries to get a buffer from the specified partition.
This status code indicates that the object still had resources in use.
#define RTEMS_DEFAULT_ATTRIBUTES
This is the default value for an attribute set.
rtems_status_code rtems_partition_create(rtems_name name, void *starting_address, uintptr_t length, size_t buffer_size, rtems_attribute attribute_set, rtems_id *id)
Creates a partition.
rtems_status_code rtems_partition_delete(rtems_id id)
Deletes the specified partition.
rtems_status_code rtems_partition_return_buffer(rtems_id id, void *buffer)
Returns a buffer to the specified partition.
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
#define RTEMS_ALIGNED(_alignment)
Instructs the compiler in a declaration or definition to enforce the specified alignment.
bool in_action_loop
This member indicates if the test action loop is currently executed.
This header file defines the RTEMS Classic API.
This status code indicates that an object identifier was invalid.
Objects_Id rtems_id
Values of this type identify an RTEMS object.
rtems_status_code rtems_partition_ident(rtems_name name, uint32_t node, rtems_id *id)
Identifies a partition object by the specified object name.
size_t pcs[2]
This member defines the pre-condition states for the next action.
Test context for spec:/rtems/part/req/return-buffer test case.
This status code indicates that an object name was invalid.
#define RTEMS_SEARCH_LOCAL_NODE
%
#define RTEMS_PARTITION_ALIGNMENT
This constant defines the minimum alignment of a partition buffer in bytes.