source: rtems/testsuites/sptests/spfatal_support/consume_sems.c @ f97536d

5
Last change on this file since f97536d was f97536d, checked in by Sebastian Huber <sebastian.huber@…>, on 10/16/15 at 06:21:48

basdefs.h: Add and use RTEMS_UNUSED

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2012.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.org/license/LICENSE.
8 */
9
10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#include <rtems.h>
15
16/* forward declarations to avoid warnings */
17rtems_device_driver consume_semaphores_initialize(
18  rtems_device_major_number major RTEMS_UNUSED,
19  rtems_device_minor_number minor RTEMS_UNUSED,
20  void *pargp RTEMS_UNUSED
21);
22
23#define MAXIMUM 20
24rtems_id Semaphores[MAXIMUM];
25
26rtems_device_driver consume_semaphores_initialize(
27  rtems_device_major_number major RTEMS_UNUSED,
28  rtems_device_minor_number minor RTEMS_UNUSED,
29  void *pargp RTEMS_UNUSED
30)
31{
32  int               sems;
33  rtems_status_code status;
34
35  for ( sems=0 ; sems<MAXIMUM ; sems++ ) {
36    status = rtems_semaphore_create(
37      rtems_build_name( 'S', 'M', '1', ' ' ),
38      1,
39      RTEMS_DEFAULT_MODES,
40      RTEMS_NO_PRIORITY,
41      &Semaphores[sems]
42    );
43    if ( status == RTEMS_TOO_MANY )
44     break;
45  }
46
47  #if 0
48    printk( "Consumed %d\n", sems );
49    printk( "Freeing %d\n", SEMAPHORES_REMAINING );
50  #endif
51
52  #if defined(SEMAPHORES_REMAINING)
53  {
54    int i;
55
56    for ( i=0 ; i<SEMAPHORES_REMAINING ; i++ ) {
57      (void) rtems_semaphore_delete( Semaphores[i] );
58    }
59  }
60  #endif
61  return RTEMS_SUCCESSFUL;
62}
63
Note: See TracBrowser for help on using the repository browser.