source: rtems/testsuites/psxtmtests/psxtmmutex07/init.c @ 8fbe2e6

4.115
Last change on this file since 8fbe2e6 was 8fbe2e6, checked in by Joel Sherrill <joel.sherrill@…>, on 09/04/14 at 13:59:49

Use correct prototype of benchmark_timer_read()

This change starts with removing the effectively empty file
timerdrv.h. The prototypes for benchmark_timer_XXX() were in
btimer.h which was not universally used. Thus every use of
timerdrv.h had to be changed to btimer.h. Then the prototypes
for benchmark_timer_read() had to be adjusted to return
benchmark_timer_t rather than int or uint32_t.

I took this opportunity to also correct the file headers to
separate the copyright from the file description comments which
is needed to ensure the copyright isn't propagated into Doxygen
output.

  • Property mode set to 100644
File size: 2.2 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2013.
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 <timesys.h>
15#include <rtems/btimer.h>
16#include <errno.h>
17#include <pthread.h>
18#include "test_support.h"
19
20const char rtems_test_name[] = "PSXTMMUTEX 07";
21
22/* forward declarations to avoid warnings */
23void *POSIX_Init(void *argument);
24void test_mutex_setprioceiling(void);
25void test_mutex_getprioceiling(void);
26
27pthread_mutex_t MutexId;
28
29void test_mutex_setprioceiling(void)
30{
31  benchmark_timer_t end_time;
32  int  status;
33  int  old_ceiling;
34
35  benchmark_timer_initialize();
36    status = pthread_mutex_setprioceiling( &MutexId, 5, &old_ceiling );
37  end_time = benchmark_timer_read();
38  rtems_test_assert( status == 0 );
39
40  put_time(
41    "pthread_mutex_setprioceiling: only case",
42    end_time,
43    1,        /* Only executed once */
44    0,
45    0
46  );
47}
48
49void test_mutex_getprioceiling(void)
50{
51  benchmark_timer_t end_time;
52  int  status;
53  int  current_ceiling;
54
55  benchmark_timer_initialize();
56    status = pthread_mutex_getprioceiling( &MutexId, &current_ceiling );
57  end_time = benchmark_timer_read();
58  rtems_test_assert( status == 0 );
59
60  put_time(
61    "pthread_mutex_getprioceiling: only case",
62    end_time,
63    1,        /* Only executed once */
64    0,
65    0
66  );
67}
68
69void *POSIX_Init(
70  void *argument
71)
72{
73  int  status;
74
75  TEST_BEGIN();
76  /* create mutex*/
77  status = pthread_mutex_init( &MutexId, NULL );
78  rtems_test_assert( status == 0 );
79
80  test_mutex_getprioceiling();
81  test_mutex_setprioceiling();
82  test_mutex_getprioceiling();
83
84  /* destroy mutex */
85  status = pthread_mutex_destroy( &MutexId );
86  rtems_test_assert( status == 0 );
87 
88  TEST_END();
89
90  rtems_test_exit(0);
91}
92
93
94/* configuration information */
95
96#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
97#define CONFIGURE_APPLICATION_NEEDS_TIMER_DRIVER
98
99#define CONFIGURE_MAXIMUM_POSIX_THREADS     1
100#define CONFIGURE_MAXIMUM_POSIX_MUTEXES     1
101#define CONFIGURE_POSIX_INIT_THREAD_TABLE
102
103#define CONFIGURE_INIT
104
105#include <rtems/confdefs.h>
106/* end of file */
Note: See TracBrowser for help on using the repository browser.