forked from Imagelibrary/rtems
2009-07-22 Joel Sherrill <joel.sherrill@oarcorp.com>
* psxsem01/Makefile.am, psxsem01/init.c: Much clean up. * psxsem01/system.h: Removed.
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
2009-07-22 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||||
|
|
||||||
|
* psxsem01/Makefile.am, psxsem01/init.c: Much clean up.
|
||||||
|
* psxsem01/system.h: Removed.
|
||||||
|
|
||||||
2009-07-22 Joel Sherrill <joel.sherrill@oarcorp.com>
|
2009-07-22 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||||
|
|
||||||
* psxsem01/init.c: Eliminate warning.
|
* psxsem01/init.c: Eliminate warning.
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
MANAGERS = all
|
MANAGERS = all
|
||||||
|
|
||||||
rtems_tests_PROGRAMS = psxsem01
|
rtems_tests_PROGRAMS = psxsem01
|
||||||
psxsem01_SOURCES = init.c system.h ../include/pmacros.h \
|
psxsem01_SOURCES = init.c ../include/pmacros.h \
|
||||||
../../support/src/test_support.c
|
../../support/src/test_support.c
|
||||||
|
|
||||||
dist_rtems_tests_DATA = psxsem01.scn
|
dist_rtems_tests_DATA = psxsem01.scn
|
||||||
|
|||||||
@@ -1,11 +1,25 @@
|
|||||||
#define CONFIGURE_INIT
|
/*
|
||||||
#include "system.h"
|
* COPYRIGHT (c) 1989-2009.
|
||||||
|
* On-Line Applications Research Corporation (OAR).
|
||||||
|
*
|
||||||
|
* The license and distribution terms for this file may be
|
||||||
|
* found in the file LICENSE in this distribution or at
|
||||||
|
* http://www.rtems.com/license/LICENSE.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
|
#include <semaphore.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <tmacros.h>
|
#include <tmacros.h>
|
||||||
|
#include <pmacros.h>
|
||||||
#include "test_support.h"
|
#include "test_support.h"
|
||||||
|
|
||||||
|
#define MAX_SEMS 10
|
||||||
|
|
||||||
void *POSIX_Init(
|
void *POSIX_Init(
|
||||||
void *argument
|
void *argument
|
||||||
)
|
)
|
||||||
@@ -13,7 +27,7 @@ void *POSIX_Init(
|
|||||||
int status;
|
int status;
|
||||||
int value;
|
int value;
|
||||||
int i;
|
int i;
|
||||||
sem_t sems[CONFIGURE_MAXIMUM_POSIX_SEMAPHORES];
|
sem_t sems[MAX_SEMS];
|
||||||
sem_t sem2;
|
sem_t sem2;
|
||||||
sem_t *n_sem1;
|
sem_t *n_sem1;
|
||||||
sem_t *n_sem2;
|
sem_t *n_sem2;
|
||||||
@@ -28,7 +42,7 @@ void *POSIX_Init(
|
|||||||
fatal_posix_service_status( errno, EINVAL, "sem_init errorno EINVAL" );
|
fatal_posix_service_status( errno, EINVAL, "sem_init errorno EINVAL" );
|
||||||
|
|
||||||
puts( "Init: sem_init - SUCCESSFUL" );
|
puts( "Init: sem_init - SUCCESSFUL" );
|
||||||
for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_SEMAPHORES; i++) {
|
for (i = 0; i < MAX_SEMS; i++) {
|
||||||
status = sem_init(&sems[i], 0, i);
|
status = sem_init(&sems[i], 0, i);
|
||||||
sprintf(failure_msg, "sem_init %d", i );
|
sprintf(failure_msg, "sem_init %d", i );
|
||||||
fatal_posix_service_status( status, 0, failure_msg);
|
fatal_posix_service_status( status, 0, failure_msg);
|
||||||
@@ -44,7 +58,7 @@ void *POSIX_Init(
|
|||||||
fatal_posix_service_status( errno, ENOSYS, "sem_init errno set to ENOSYS");
|
fatal_posix_service_status( errno, ENOSYS, "sem_init errno set to ENOSYS");
|
||||||
|
|
||||||
puts( "Init: sem_getvalue - SUCCESSFUL ");
|
puts( "Init: sem_getvalue - SUCCESSFUL ");
|
||||||
for (i = 0; i < CONFIGURE_MAXIMUM_POSIX_SEMAPHORES; i++) {
|
for (i = 0; i < MAX_SEMS; i++) {
|
||||||
status = sem_getvalue(&sems[i], &value);
|
status = sem_getvalue(&sems[i], &value);
|
||||||
sprintf( failure_msg, "sem_getvalue %d", i );
|
sprintf( failure_msg, "sem_getvalue %d", i );
|
||||||
fatal_posix_service_status( status, 0, failure_msg );
|
fatal_posix_service_status( status, 0, failure_msg );
|
||||||
@@ -143,7 +157,7 @@ void *POSIX_Init(
|
|||||||
fatal_posix_service_status( errno, EINVAL, "sem_post errno EINVAL");
|
fatal_posix_service_status( errno, EINVAL, "sem_post errno EINVAL");
|
||||||
|
|
||||||
puts( "Init: sem_destroy - SUCCESSFUL" );
|
puts( "Init: sem_destroy - SUCCESSFUL" );
|
||||||
for (i = 1; i < CONFIGURE_MAXIMUM_POSIX_SEMAPHORES; i++) {
|
for (i = 1; i < MAX_SEMS; i++) {
|
||||||
status = sem_destroy(&sems[i]);
|
status = sem_destroy(&sems[i]);
|
||||||
sprintf( failure_msg, "sem_destroy %d", i );
|
sprintf( failure_msg, "sem_destroy %d", i );
|
||||||
fatal_posix_service_status( status, 0, failure_msg );
|
fatal_posix_service_status( status, 0, failure_msg );
|
||||||
@@ -287,3 +301,19 @@ void *POSIX_Init(
|
|||||||
|
|
||||||
return NULL; /* just so the compiler thinks we returned something */
|
return NULL; /* just so the compiler thinks we returned something */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* configuration information */
|
||||||
|
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
|
||||||
|
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
|
||||||
|
|
||||||
|
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
|
||||||
|
|
||||||
|
#define CONFIGURE_MAXIMUM_POSIX_THREADS 1
|
||||||
|
#define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES MAX_SEMS
|
||||||
|
|
||||||
|
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
|
||||||
|
#define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE \
|
||||||
|
(RTEMS_MINIMUM_STACK_SIZE * 4)
|
||||||
|
|
||||||
|
#define CONFIGURE_INIT
|
||||||
|
#include <rtems/confdefs.h>
|
||||||
|
|||||||
@@ -1,54 +0,0 @@
|
|||||||
/* system.h
|
|
||||||
*
|
|
||||||
* This include file contains information that is included in every
|
|
||||||
* function in the test set.
|
|
||||||
*
|
|
||||||
* COPYRIGHT (c) 1989-1999.
|
|
||||||
* On-Line Applications Research Corporation (OAR).
|
|
||||||
*
|
|
||||||
* The license and distribution terms for this file may be
|
|
||||||
* found in the file LICENSE in this distribution or at
|
|
||||||
* http://www.rtems.com/license/LICENSE.
|
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* functions */
|
|
||||||
|
|
||||||
#include <pmacros.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <sched.h>
|
|
||||||
#include <semaphore.h>
|
|
||||||
#include <tmacros.h>
|
|
||||||
|
|
||||||
void *POSIX_Init(
|
|
||||||
void *argument
|
|
||||||
);
|
|
||||||
|
|
||||||
void *Task_1_through_3(
|
|
||||||
void *argument
|
|
||||||
);
|
|
||||||
|
|
||||||
/* configuration information */
|
|
||||||
|
|
||||||
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
|
|
||||||
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
|
|
||||||
|
|
||||||
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
|
|
||||||
|
|
||||||
#define CONFIGURE_MAXIMUM_POSIX_THREADS 2
|
|
||||||
#define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 10
|
|
||||||
|
|
||||||
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
|
|
||||||
#define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE \
|
|
||||||
(RTEMS_MINIMUM_STACK_SIZE * 4)
|
|
||||||
|
|
||||||
#include <rtems/confdefs.h>
|
|
||||||
|
|
||||||
/* global variables */
|
|
||||||
|
|
||||||
TEST_EXTERN pthread_t Init_id;
|
|
||||||
TEST_EXTERN pthread_t Task_id;
|
|
||||||
|
|
||||||
/* end of include file */
|
|
||||||
Reference in New Issue
Block a user