forked from Imagelibrary/rtems
Added unused priority ceiling parameter to rtems_semaphore_create.
Rearranged code to created thread handler routines to initialize, start, restart, and "close/delete" a thread. Made internal threads their own object class. This now uses the thread support routines for starting and initializing a thread. Insured deleted tasks are freed to the Inactive pool associated with the correct Information block. Added an RTEMS API specific data area to the thread control block. Beginnings of removing the word "rtems" from the core.
This commit is contained in:
@@ -16,8 +16,12 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/libio.h>
|
||||
#include <bsp.h>
|
||||
#include <clockdrv.h>
|
||||
|
||||
void Clock_exit( void );
|
||||
rtems_isr Clock_isr( rtems_vector_number vector );
|
||||
|
||||
|
||||
/*
|
||||
* The interrupt vector number associated with the clock tick device
|
||||
@@ -30,6 +34,7 @@
|
||||
* Clock_driver_ticks is a monotonically increasing counter of the
|
||||
* number of clock ticks since the driver was initialized.
|
||||
*/
|
||||
|
||||
volatile rtems_unsigned32 Clock_driver_ticks;
|
||||
|
||||
/*
|
||||
@@ -42,29 +47,19 @@ volatile rtems_unsigned32 Clock_driver_ticks;
|
||||
|
||||
rtems_unsigned32 Clock_isrs; /* ISRs until next tick */
|
||||
|
||||
/*
|
||||
* These are set by clock driver during its init
|
||||
*/
|
||||
|
||||
rtems_device_major_number rtems_clock_major = ~0;
|
||||
rtems_device_minor_number rtems_clock_minor;
|
||||
|
||||
/*
|
||||
* The previous ISR on this clock tick interrupt vector.
|
||||
*/
|
||||
|
||||
rtems_isr_entry Old_ticker;
|
||||
|
||||
/*
|
||||
* Clock_initialize
|
||||
*
|
||||
* Device driver entry point for clock tick driver initialization.
|
||||
*/
|
||||
|
||||
rtems_device_driver Clock_initialize(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void *pargp,
|
||||
rtems_id tid,
|
||||
rtems_unsigned32 *rval
|
||||
)
|
||||
{
|
||||
Install_clock( Clock_isr );
|
||||
}
|
||||
|
||||
/*
|
||||
* Reinstall_clock
|
||||
*
|
||||
@@ -141,3 +136,55 @@ void Clock_exit( void )
|
||||
/* XXX: If necessary, restore the old vector */
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Clock_initialize
|
||||
*
|
||||
* Device driver entry point for clock tick driver initialization.
|
||||
*/
|
||||
|
||||
rtems_device_driver Clock_initialize(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void *pargp
|
||||
)
|
||||
{
|
||||
Install_clock((rtems_isr_entry) Clock_isr);
|
||||
|
||||
/*
|
||||
* make major/minor avail to others such as shared memory driver
|
||||
*/
|
||||
rtems_clock_major = major;
|
||||
rtems_clock_minor = minor;
|
||||
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
rtems_device_driver Clock_control(
|
||||
rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void *pargp
|
||||
)
|
||||
{
|
||||
rtems_libio_ioctl_args_t *args = pargp;
|
||||
|
||||
if (args == 0)
|
||||
goto done;
|
||||
|
||||
/*
|
||||
* This is hokey, but until we get a defined interface
|
||||
* to do this, it will just be this simple...
|
||||
*/
|
||||
|
||||
if (args->command == rtems_build_name('I', 'S', 'R', ' '))
|
||||
{
|
||||
Clock_isr(CLOCK_VECTOR);
|
||||
}
|
||||
else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
|
||||
{
|
||||
ReInstall_clock(args->buffer);
|
||||
}
|
||||
|
||||
done:
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems.h>
|
||||
#include <clockdrv.h>
|
||||
|
||||
/*
|
||||
* Define the time limits for RTEMS Test Suite test durations.
|
||||
@@ -67,6 +68,20 @@ extern "C" {
|
||||
|
||||
extern rtems_configuration_table BSP_Configuration;
|
||||
|
||||
/*
|
||||
* Console driver init
|
||||
*/
|
||||
|
||||
rtems_device_driver console_initialize(
|
||||
rtems_device_major_number, rtems_device_minor_number minor, void *);
|
||||
|
||||
#define CONSOLE_DRIVER_TABLE_ENTRY \
|
||||
{ console_initialize, NULL, NULL, NULL, NULL, NULL }
|
||||
|
||||
/*
|
||||
* NOTE: Use the standard Clock driver entry
|
||||
*/
|
||||
|
||||
/* functions */
|
||||
|
||||
void bsp_cleanup( void );
|
||||
|
||||
@@ -111,10 +111,13 @@ rtems_libio_init(void)
|
||||
rtems_libio_last_iop = rtems_libio_iops + (rtems_libio_number_iops - 1);
|
||||
}
|
||||
|
||||
rc = rtems_semaphore_create(RTEMS_LIBIO_SEM,
|
||||
1,
|
||||
RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY,
|
||||
&rtems_libio_semaphore);
|
||||
rc = rtems_semaphore_create(
|
||||
RTEMS_LIBIO_SEM,
|
||||
1,
|
||||
RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&rtems_libio_semaphore
|
||||
);
|
||||
if (rc != RTEMS_SUCCESSFUL)
|
||||
rtems_fatal_error_occurred(rc);
|
||||
}
|
||||
@@ -199,9 +202,13 @@ rtems_libio_allocate(void)
|
||||
* Got one; create a semaphore for it
|
||||
*/
|
||||
|
||||
rc = rtems_semaphore_create(RTEMS_LIBIO_IOP_SEM(iop - rtems_libio_iops),
|
||||
1, RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY,
|
||||
&iop->sem);
|
||||
rc = rtems_semaphore_create(
|
||||
RTEMS_LIBIO_IOP_SEM(iop - rtems_libio_iops),
|
||||
1,
|
||||
RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY,
|
||||
RTEMS_NO_PRIORITY,
|
||||
&iop->sem
|
||||
);
|
||||
if (rc != RTEMS_SUCCESSFUL)
|
||||
goto failed;
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ void MY_task_set_note(
|
||||
unsigned32 note
|
||||
)
|
||||
{
|
||||
the_thread->Notepads[ notepad ] = note;
|
||||
the_thread->RTEMS_API->Notepads[ notepad ] = note;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ unsigned32 MY_task_get_note(
|
||||
unsigned32 notepad
|
||||
)
|
||||
{
|
||||
return the_thread->Notepads[ notepad ];
|
||||
return the_thread->RTEMS_API->Notepads[ notepad ];
|
||||
}
|
||||
|
||||
void *MY_CPU_Context_FP_start(
|
||||
|
||||
@@ -21,16 +21,16 @@ rtems_monitor_task_canonical(
|
||||
Thread_Control *rtems_thread = (Thread_Control *) thread_void;
|
||||
|
||||
canonical_task->entry = rtems_thread->Start.entry_point;
|
||||
canonical_task->argument = rtems_thread->Start.initial_argument;
|
||||
canonical_task->argument = rtems_thread->Start.numeric_argument;
|
||||
canonical_task->stack = rtems_thread->Start.Initial_stack.area;
|
||||
canonical_task->stack_size = rtems_thread->Start.Initial_stack.size;
|
||||
canonical_task->priority = rtems_thread->current_priority;
|
||||
canonical_task->state = rtems_thread->current_state;
|
||||
canonical_task->wait_id = rtems_thread->Wait.id;
|
||||
canonical_task->events = rtems_thread->pending_events;
|
||||
canonical_task->events = rtems_thread->RTEMS_API->pending_events;
|
||||
canonical_task->modes = rtems_thread->current_modes;
|
||||
canonical_task->attributes = rtems_thread->attribute_set;
|
||||
(void) memcpy(canonical_task->notepad, rtems_thread->Notepads, sizeof(canonical_task->notepad));
|
||||
canonical_task->attributes = 0 /* XXX FIX ME rtems_thread->RTEMS_API->attribute_set */;
|
||||
(void) memcpy(canonical_task->notepad, rtems_thread->RTEMS_API->Notepads, sizeof(canonical_task->notepad));
|
||||
(void) memcpy(&canonical_task->wait_args, &rtems_thread->Wait.Extra, sizeof(canonical_task->wait_args));
|
||||
}
|
||||
|
||||
|
||||
@@ -433,7 +433,7 @@ void Stack_check_Dump_usage( void )
|
||||
class_index++ ) {
|
||||
information = _Objects_Information_table[ class_index ];
|
||||
if ( information && information->is_thread ) {
|
||||
for ( i=1 ; i < information->maximum ; i++ ) {
|
||||
for ( i=1 ; i <= information->maximum ; i++ ) {
|
||||
the_thread = (Thread_Control *)information->local_table[ i ];
|
||||
Stack_check_Dump_threads_usage( the_thread );
|
||||
if ( the_thread == _Thread_Executing )
|
||||
|
||||
Reference in New Issue
Block a user