2000-08-15 Joel Sherrill <joel@OARcorp.com>

* src/ptimer1.c: Removed unused routine PRINT_ERRNO_S.
	* src/ptimer1.c: Removed unnecessary routine COPY_ITIMERSPEC_S
	and used structure copy instead.
	* src/ptimer1.c: Renamed timer_alive_t to POSIX_Timer_Control.
	* include/rtems/posix/timer.h: Ditto.
This commit is contained in:
Joel Sherrill
2000-08-15 13:19:57 +00:00
parent ea56c0a806
commit 939e29dc4d
8 changed files with 52 additions and 94 deletions

View File

@@ -1,11 +1,19 @@
2000-08-15 Joel Sherrill <joel@OARcorp.com>
* posix/src/ptimer1.c: Switched to using set_errno_and_return_minus_one()
* src/ptimer1.c: Removed unused routine PRINT_ERRNO_S.
* src/ptimer1.c: Removed unnecessary routine COPY_ITIMERSPEC_S
and used structure copy instead.
* src/ptimer1.c: Renamed timer_alive_t to POSIX_Timer_Control.
* include/rtems/posix/timer.h: Ditto.
2000-08-15 Joel Sherrill <joel@OARcorp.com>
* src/ptimer1.c: Switched to using set_errno_and_return_minus_one()
to ensure that errno was always set.
2000-08-15 Joel Sherrill <joel@OARcorp.com>
* posix/src/ptimer1.c (timer_settime): Converted use of rtems_clock_get
* src/ptimer1.c (timer_settime): Converted use of rtems_clock_get
to use SuperCore _TOD_Current variable.
2000-08-10 Joel Sherrill <joel@OARcorp.com>

View File

@@ -43,14 +43,14 @@ typedef struct {
unsigned32 ticks; /* Number of ticks of the initialization */
unsigned32 overrun; /* Number of expirations of the timer */
rtems_time_of_day time; /* Time in which the timer was started */
} timer_alive_t;
} POSIX_Timer_Control;
/*
* Array of Timers
*/
extern int timer_max;
extern timer_alive_t *timer_struct;
extern POSIX_Timer_Control *timer_struct;
#endif
/* end of include file */

View File

@@ -74,7 +74,7 @@ void TIMER_INITIALIZE_S ( int timer_pos )
* ***************************************************************************/
int timer_max;
timer_alive_t *timer_struct;
POSIX_Timer_Control *timer_struct;
void _POSIX_Timer_Manager_initialization ( int max_timers )
@@ -82,7 +82,7 @@ void _POSIX_Timer_Manager_initialization ( int max_timers )
int index;
timer_struct = _Workspace_Allocate_or_fatal_error(
max_timers * sizeof(timer_alive_t) );
max_timers * sizeof(POSIX_Timer_Control) );
/*
* Initialize all the timers

View File

@@ -70,32 +70,6 @@ static void PRINT_MSG_S ( char *msg )
}
/* ***************************************************************************
* PRINT_ERRNO_S
*
* Description: Print the value of the global variable errno in the display
* ***************************************************************************/
static void PRINT_ERRNO_S ()
{
#ifdef DEBUG_MESSAGES
switch (errno)
{
case EINVAL:
PRINT_MSG_S ( "errno EINVAL"); break;
case EPERM:
PRINT_MSG_S ( "errno EPERM"); break;
case ESRCH:
PRINT_MSG_S ( "errno ESRCH"); break;
case EAGAIN:
PRINT_MSG_S ( "errno EAGAIN"); break;
default :
printf ("errno: %d\n", errno);
break;
}
#endif
}
/* ***************************************************************************
* TIMER_INITIALIZE_S
*
@@ -317,24 +291,21 @@ int timer_create(
int timer_pos; /* Position in the table of timers */
/*
* The data of the structure evp are checked in order to verify if they
* are coherent.
* The data of the structure evp are checked in order to verify if they
* are coherent.
*/
if (evp != NULL) {
/* The structure has data */
if ( ( evp->sigev_notify != SIGEV_NONE ) &&
( evp->sigev_notify != SIGEV_SIGNAL ) ) {
/* The structure has data */
if ( ( evp->sigev_notify != SIGEV_NONE ) &&
( evp->sigev_notify != SIGEV_SIGNAL ) ) {
/* The value of the field sigev_notify is not valid */
set_errno_and_return_minus_one( EINVAL );
}
}
/*
* A timer is created using the primitive rtems_timer_create
* A timer is created using the primitive rtems_timer_create
*/
return_v = rtems_timer_create ( clock_id, &timer_id );
@@ -524,11 +495,11 @@ int timer_settime(
/* The old data of the timer are returned */
if ( ovalue )
COPY_ITIMERSPEC_S ( &timer_struct[timer_pos].timer_data, ovalue );
*ovalue = timer_struct[timer_pos].timer_data;
/* The new data are set */
COPY_ITIMERSPEC_S ( value, &timer_struct[timer_pos].timer_data );
timer_struct[timer_pos].timer_data = *value;
/* Indicates that the timer is created and stopped */
@@ -582,9 +553,9 @@ int timer_settime(
* returns the old ones in "ovalue" */
if ( ovalue )
COPY_ITIMERSPEC_S ( &timer_struct[timer_pos].timer_data, ovalue );
*ovalue = timer_struct[timer_pos].timer_data;
COPY_ITIMERSPEC_S ( value, &timer_struct[timer_pos].timer_data );
timer_struct[timer_pos].timer_data = *value;
/* It indicates that the time is running */
@@ -656,9 +627,9 @@ int timer_settime(
* returns the old ones in "ovalue" */
if ( ovalue )
COPY_ITIMERSPEC_S ( &timer_struct[timer_pos].timer_data, ovalue );
*ovalue = timer_struct[timer_pos].timer_data;
COPY_ITIMERSPEC_S ( value, &timer_struct[timer_pos].timer_data );
timer_struct[timer_pos].timer_data = *value;
/* It indicates that the time is running */

View File

@@ -1,11 +1,19 @@
2000-08-15 Joel Sherrill <joel@OARcorp.com>
* posix/src/ptimer1.c: Switched to using set_errno_and_return_minus_one()
* src/ptimer1.c: Removed unused routine PRINT_ERRNO_S.
* src/ptimer1.c: Removed unnecessary routine COPY_ITIMERSPEC_S
and used structure copy instead.
* src/ptimer1.c: Renamed timer_alive_t to POSIX_Timer_Control.
* include/rtems/posix/timer.h: Ditto.
2000-08-15 Joel Sherrill <joel@OARcorp.com>
* src/ptimer1.c: Switched to using set_errno_and_return_minus_one()
to ensure that errno was always set.
2000-08-15 Joel Sherrill <joel@OARcorp.com>
* posix/src/ptimer1.c (timer_settime): Converted use of rtems_clock_get
* src/ptimer1.c (timer_settime): Converted use of rtems_clock_get
to use SuperCore _TOD_Current variable.
2000-08-10 Joel Sherrill <joel@OARcorp.com>

View File

@@ -43,14 +43,14 @@ typedef struct {
unsigned32 ticks; /* Number of ticks of the initialization */
unsigned32 overrun; /* Number of expirations of the timer */
rtems_time_of_day time; /* Time in which the timer was started */
} timer_alive_t;
} POSIX_Timer_Control;
/*
* Array of Timers
*/
extern int timer_max;
extern timer_alive_t *timer_struct;
extern POSIX_Timer_Control *timer_struct;
#endif
/* end of include file */

View File

@@ -74,7 +74,7 @@ void TIMER_INITIALIZE_S ( int timer_pos )
* ***************************************************************************/
int timer_max;
timer_alive_t *timer_struct;
POSIX_Timer_Control *timer_struct;
void _POSIX_Timer_Manager_initialization ( int max_timers )
@@ -82,7 +82,7 @@ void _POSIX_Timer_Manager_initialization ( int max_timers )
int index;
timer_struct = _Workspace_Allocate_or_fatal_error(
max_timers * sizeof(timer_alive_t) );
max_timers * sizeof(POSIX_Timer_Control) );
/*
* Initialize all the timers

View File

@@ -70,32 +70,6 @@ static void PRINT_MSG_S ( char *msg )
}
/* ***************************************************************************
* PRINT_ERRNO_S
*
* Description: Print the value of the global variable errno in the display
* ***************************************************************************/
static void PRINT_ERRNO_S ()
{
#ifdef DEBUG_MESSAGES
switch (errno)
{
case EINVAL:
PRINT_MSG_S ( "errno EINVAL"); break;
case EPERM:
PRINT_MSG_S ( "errno EPERM"); break;
case ESRCH:
PRINT_MSG_S ( "errno ESRCH"); break;
case EAGAIN:
PRINT_MSG_S ( "errno EAGAIN"); break;
default :
printf ("errno: %d\n", errno);
break;
}
#endif
}
/* ***************************************************************************
* TIMER_INITIALIZE_S
*
@@ -317,24 +291,21 @@ int timer_create(
int timer_pos; /* Position in the table of timers */
/*
* The data of the structure evp are checked in order to verify if they
* are coherent.
* The data of the structure evp are checked in order to verify if they
* are coherent.
*/
if (evp != NULL) {
/* The structure has data */
if ( ( evp->sigev_notify != SIGEV_NONE ) &&
( evp->sigev_notify != SIGEV_SIGNAL ) ) {
/* The structure has data */
if ( ( evp->sigev_notify != SIGEV_NONE ) &&
( evp->sigev_notify != SIGEV_SIGNAL ) ) {
/* The value of the field sigev_notify is not valid */
set_errno_and_return_minus_one( EINVAL );
}
}
/*
* A timer is created using the primitive rtems_timer_create
* A timer is created using the primitive rtems_timer_create
*/
return_v = rtems_timer_create ( clock_id, &timer_id );
@@ -524,11 +495,11 @@ int timer_settime(
/* The old data of the timer are returned */
if ( ovalue )
COPY_ITIMERSPEC_S ( &timer_struct[timer_pos].timer_data, ovalue );
*ovalue = timer_struct[timer_pos].timer_data;
/* The new data are set */
COPY_ITIMERSPEC_S ( value, &timer_struct[timer_pos].timer_data );
timer_struct[timer_pos].timer_data = *value;
/* Indicates that the timer is created and stopped */
@@ -582,9 +553,9 @@ int timer_settime(
* returns the old ones in "ovalue" */
if ( ovalue )
COPY_ITIMERSPEC_S ( &timer_struct[timer_pos].timer_data, ovalue );
*ovalue = timer_struct[timer_pos].timer_data;
COPY_ITIMERSPEC_S ( value, &timer_struct[timer_pos].timer_data );
timer_struct[timer_pos].timer_data = *value;
/* It indicates that the time is running */
@@ -656,9 +627,9 @@ int timer_settime(
* returns the old ones in "ovalue" */
if ( ovalue )
COPY_ITIMERSPEC_S ( &timer_struct[timer_pos].timer_data, ovalue );
*ovalue = timer_struct[timer_pos].timer_data;
COPY_ITIMERSPEC_S ( value, &timer_struct[timer_pos].timer_data );
timer_struct[timer_pos].timer_data = *value;
/* It indicates that the time is running */