summaryrefslogtreecommitdiffstats
path: root/cpukit/sapi
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2007-04-17 20:32:13 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2007-04-17 20:32:13 +0000
commit0ab34c90a20c03d84cad1b357da8fbc0258be6c0 (patch)
tree7d12c026af64c5f6c33746e8c5681a9a562b2054 /cpukit/sapi
parent2007-04-17 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-0ab34c90a20c03d84cad1b357da8fbc0258be6c0.tar.bz2
2007-04-17 Joel Sherrill <joel@OARcorp.com>
* itron/Makefile.am, itron/src/eventflags.c, itron/src/fmempool.c, itron/src/itronintr.c, itron/src/itrontime.c, itron/src/network.c, itron/src/port.c, itron/src/sysmgmt.c, itron/src/task.c, itron/src/vmempool.c, posix/Makefile.am, posix/src/pthread.c, rtems/src/taskinitusers.c, rtems/src/tasks.c, sapi/include/confdefs.h, sapi/src/io.c: Various modification to reduce executable size. Most were refactoring of files. Split ITRON API files. Implemented mechanism to avoid initialization task/thread loop being linked in when that style of task initialization was not being used. * itron/src/acp_por.c, itron/src/act_cyc.c, itron/src/cal_por.c, itron/src/chg_iXX.c, itron/src/clr_flg.c, itron/src/cre_flg.c, itron/src/cre_mpf.c, itron/src/cre_mpl.c, itron/src/cre_por.c, itron/src/def_alm.c, itron/src/def_cyc.c, itron/src/def_exc.c, itron/src/def_int.c, itron/src/def_svc.c, itron/src/del_flg.c, itron/src/del_mpf.c, itron/src/del_mpl.c, itron/src/del_por.c, itron/src/dis_int.c, itron/src/dly_tsk.c, itron/src/ena_int.c, itron/src/fwd_por.c, itron/src/get_blf.c, itron/src/get_blk.c, itron/src/get_tim.c, itron/src/get_ver.c, itron/src/itroninittasks.c, itron/src/loc_cpu.c, itron/src/nget_nod.c, itron/src/nget_ver.c, itron/src/nrea_dat.c, itron/src/nwri_dat.c, itron/src/pacp_por.c, itron/src/pcal_por.c, itron/src/pget_blf.c, itron/src/pget_blk.c, itron/src/pol_flg.c, itron/src/ref_alm.c, itron/src/ref_cfg.c, itron/src/ref_cyc.c, itron/src/ref_flg.c, itron/src/ref_iXX.c, itron/src/ref_mpf.c, itron/src/ref_mpl.c, itron/src/ref_por.c, itron/src/ref_sys.c, itron/src/rel_blf.c, itron/src/rel_blk.c, itron/src/ret_int.c, itron/src/ret_tmr.c, itron/src/ret_wup.c, itron/src/rpl_rdv.c, itron/src/set_flg.c, itron/src/set_tim.c, itron/src/tacp_por.c, itron/src/tcal_por.c, itron/src/tget_blf.c, itron/src/tget_blk.c, itron/src/twai_flg.c, itron/src/unl_cpu.c, itron/src/wai_flg.c, posix/src/pthreadinitthreads.c: New files.
Diffstat (limited to 'cpukit/sapi')
-rw-r--r--cpukit/sapi/include/confdefs.h54
-rw-r--r--cpukit/sapi/src/io.c214
2 files changed, 151 insertions, 117 deletions
diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
index 0ccf4daaa4..de481788a6 100644
--- a/cpukit/sapi/include/confdefs.h
+++ b/cpukit/sapi/include/confdefs.h
@@ -1182,6 +1182,48 @@ rtems_configuration_table Configuration = {
#endif /* CONFIGURE_HAS_OWN_CONFIGURATION_TABLE */
+/*
+ * If the user has configured a set of Classic API Initialization Tasks,
+ * then we need to install the code that runs that loop.
+ */
+#ifdef CONFIGURE_INIT
+ #ifdef CONFIGURE_RTEMS_INIT_TASKS_TABLE
+ void (_RTEMS_tasks_Initialize_user_tasks_body)(void);
+ void (*_RTEMS_tasks_Initialize_user_tasks_p)(void) =
+ _RTEMS_tasks_Initialize_user_tasks_body;
+ #else
+ void (*_RTEMS_tasks_Initialize_user_tasks_p)(void) = NULL;
+ #endif
+#endif
+
+/*
+ * If the user has configured a set of POSIX Initialization Threads,
+ * then we need to install the code that runs that loop.
+ */
+#ifdef CONFIGURE_INIT
+ #ifdef CONFIGURE_POSIX_INIT_THREAD_TABLE
+ void _POSIX_Threads_Initialize_user_threads_body(void);
+ void (*_POSIX_Threads_Initialize_user_threads_p)(void) =
+ _POSIX_Threads_Initialize_user_threads_body;
+ #else
+ void (*_POSIX_Threads_Initialize_user_threads_p)(void) = NULL;
+ #endif
+#endif
+
+/*
+ * If the user has configured a set of ITRON Initialization Tasks,
+ * then we need to install the code that runs that loop.
+ */
+#ifdef CONFIGURE_INIT
+ #ifdef CONFIGURE_ITRON_INIT_TASK_TABLE
+ void _ITRON_Task_Initialize_user_tasks_body(void);
+ void (*_ITRON_Initialize_user_tasks_p)(void) =
+ _ITRON_Task_Initialize_user_tasks_body;
+ #else
+ void (*_ITRON_Initialize_user_tasks_p)(void) = NULL;
+ #endif
+#endif
+
#ifdef __cplusplus
}
#endif
@@ -1212,5 +1254,17 @@ rtems_configuration_table Configuration = {
#error "CONFIGURATION ERROR: No initialization tasks or threads configured!!"
#endif
+/*
+ * These names have been obsoleted so make the user application stop compiling
+ */
+#if defined(CONFIGURE_TEST_NEEDS_TIMER_DRIVER) || \
+ defined(CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER) || \
+ defined(CONFIGURE_TEST_NEEDS_CLOCK_DRIVER) || \
+ defined(CONFIGURE_TEST_NEEDS_RTC_DRIVER) || \
+ defined(CONFIGURE_TEST_NEEDS_STUB_DRIVER)
+#error "CONFIGURATION ERROR: CONFIGURE_TEST_XXX constants are obsolete"
+#endif
+
+
#endif
/* end of include file */
diff --git a/cpukit/sapi/src/io.c b/cpukit/sapi/src/io.c
index af3d090492..62f058563b 100644
--- a/cpukit/sapi/src/io.c
+++ b/cpukit/sapi/src/io.c
@@ -35,10 +35,10 @@
*/
void _IO_Manager_initialization(
- rtems_driver_address_table *driver_table,
- uint32_t drivers_in_table,
- uint32_t number_of_drivers,
- uint32_t number_of_devices
+ rtems_driver_address_table *driver_table,
+ uint32_t drivers_in_table,
+ uint32_t number_of_drivers,
+ uint32_t number_of_devices
)
{
void *tmp;
@@ -46,23 +46,9 @@ void _IO_Manager_initialization(
rtems_driver_name_t *np;
if ( number_of_drivers < drivers_in_table )
- number_of_drivers = drivers_in_table;
-
- tmp = _Workspace_Allocate_or_fatal_error(
- sizeof( rtems_driver_address_table ) * ( number_of_drivers )
- );
-
- _IO_Driver_address_table = (rtems_driver_address_table *) tmp;
-
- memset(
- _IO_Driver_address_table, 0,
- sizeof( rtems_driver_address_table ) * ( number_of_drivers )
- );
-
- if ( drivers_in_table )
- for ( index = 0 ; index < drivers_in_table ; index++ )
- _IO_Driver_address_table[index] = driver_table[index];
+ number_of_drivers = drivers_in_table;
+ _IO_Driver_address_table = driver_table;
_IO_Number_of_drivers = number_of_drivers;
_IO_Number_of_devices = number_of_devices;
@@ -124,41 +110,39 @@ rtems_status_code rtems_io_register_driver(
rtems_device_major_number *registered_major
)
{
- *registered_major = 0;
-
- /*
- * Test for initialise/open being present to indicate the driver slot is
- * in use.
- */
-
- if ( major >= _IO_Number_of_drivers )
- return RTEMS_INVALID_NUMBER;
-
- if ( major == 0 )
- {
- for ( major = _IO_Number_of_drivers - 1 ; major ; major-- )
- if ( _IO_Driver_address_table[major].initialization_entry == 0 &&
- _IO_Driver_address_table[major].open_entry == 0 )
- break;
-
- if (( major == 0 ) &&
- ( _IO_Driver_address_table[major].initialization_entry == 0 &&
- _IO_Driver_address_table[major].open_entry == 0 ))
- return RTEMS_TOO_MANY;
- }
+ *registered_major = 0;
+
+ /*
+ * Test for initialise/open being present to indicate the driver slot is
+ * in use.
+ */
+
+ if ( major >= _IO_Number_of_drivers )
+ return RTEMS_INVALID_NUMBER;
+
+ if ( major == 0 ) {
+ for ( major = _IO_Number_of_drivers - 1 ; major ; major-- )
+ if ( _IO_Driver_address_table[major].initialization_entry == 0 &&
+ _IO_Driver_address_table[major].open_entry == 0 )
+ break;
+
+ if (( major == 0 ) &&
+ ( _IO_Driver_address_table[major].initialization_entry == 0 &&
+ _IO_Driver_address_table[major].open_entry == 0 ))
+ return RTEMS_TOO_MANY;
+ }
- if ( _IO_Driver_address_table[major].initialization_entry == 0 &&
- _IO_Driver_address_table[major].open_entry == 0 )
- {
- _IO_Driver_address_table[major] = *driver_table;
- *registered_major = major;
+ if ( _IO_Driver_address_table[major].initialization_entry == 0 &&
+ _IO_Driver_address_table[major].open_entry == 0 ) {
+ _IO_Driver_address_table[major] = *driver_table;
+ *registered_major = major;
- rtems_io_initialize( major, 0, NULL );
+ rtems_io_initialize( major, 0, NULL );
- return RTEMS_SUCCESSFUL;
- }
+ return RTEMS_SUCCESSFUL;
+ }
- return RTEMS_RESOURCE_IN_USE;
+ return RTEMS_RESOURCE_IN_USE;
}
/*PAGE
@@ -176,19 +160,18 @@ rtems_status_code rtems_io_register_driver(
*/
rtems_status_code rtems_io_unregister_driver(
- rtems_device_major_number major
+ rtems_device_major_number major
)
{
- if ( major < _IO_Number_of_drivers )
- {
- memset(
- &_IO_Driver_address_table[major],
- 0,
- sizeof( rtems_driver_address_table )
- );
- return RTEMS_SUCCESSFUL;
- }
- return RTEMS_UNSATISFIED;
+ if ( major < _IO_Number_of_drivers ) {
+ memset(
+ &_IO_Driver_address_table[major],
+ 0,
+ sizeof( rtems_driver_address_table )
+ );
+ return RTEMS_SUCCESSFUL;
+ }
+ return RTEMS_UNSATISFIED;
}
/*PAGE
@@ -214,31 +197,28 @@ rtems_status_code rtems_io_register_name(
rtems_device_minor_number minor
)
{
- rtems_driver_name_t *np;
- uint32_t level;
- uint32_t index;
-
- /* find an empty slot */
- for( index=0, np = _IO_Driver_name_table ;
- index < _IO_Number_of_devices ;
- index++, np++ )
- {
-
- _ISR_Disable(level);
- if (np->device_name == 0)
- {
- np->device_name = device_name;
- np->device_name_length = strlen(device_name);
- np->major = major;
- np->minor = minor;
- _ISR_Enable(level);
-
- return RTEMS_SUCCESSFUL;
- }
- _ISR_Enable(level);
- }
-
- return RTEMS_TOO_MANY;
+ rtems_driver_name_t *np;
+ uint32_t level;
+ uint32_t index;
+
+ /* find an empty slot */
+ for( index=0, np = _IO_Driver_name_table ;
+ index < _IO_Number_of_devices ;
+ index++, np++ ) {
+
+ _ISR_Disable(level);
+ if (np->device_name == 0) {
+ np->device_name = device_name;
+ np->device_name_length = strlen(device_name);
+ np->major = major;
+ np->minor = minor;
+ _ISR_Enable(level);
+
+ return RTEMS_SUCCESSFUL;
+ }
+ _ISR_Enable(level);
+ }
+ return RTEMS_TOO_MANY;
}
#endif
@@ -263,13 +243,13 @@ rtems_status_code rtems_io_initialize(
void *argument
)
{
- rtems_device_driver_entry callout;
+ rtems_device_driver_entry callout;
- if ( major >= _IO_Number_of_drivers )
- return RTEMS_INVALID_NUMBER;
+ if ( major >= _IO_Number_of_drivers )
+ return RTEMS_INVALID_NUMBER;
- callout = _IO_Driver_address_table[major].initialization_entry;
- return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL;
+ callout = _IO_Driver_address_table[major].initialization_entry;
+ return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL;
}
/*PAGE
@@ -293,13 +273,13 @@ rtems_status_code rtems_io_open(
void *argument
)
{
- rtems_device_driver_entry callout;
+ rtems_device_driver_entry callout;
- if ( major >= _IO_Number_of_drivers )
- return RTEMS_INVALID_NUMBER;
+ if ( major >= _IO_Number_of_drivers )
+ return RTEMS_INVALID_NUMBER;
- callout = _IO_Driver_address_table[major].open_entry;
- return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL;
+ callout = _IO_Driver_address_table[major].open_entry;
+ return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL;
}
/*PAGE
@@ -323,13 +303,13 @@ rtems_status_code rtems_io_close(
void *argument
)
{
- rtems_device_driver_entry callout;
+ rtems_device_driver_entry callout;
- if ( major >= _IO_Number_of_drivers )
- return RTEMS_INVALID_NUMBER;
+ if ( major >= _IO_Number_of_drivers )
+ return RTEMS_INVALID_NUMBER;
- callout = _IO_Driver_address_table[major].close_entry;
- return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL;
+ callout = _IO_Driver_address_table[major].close_entry;
+ return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL;
}
/*PAGE
@@ -353,13 +333,13 @@ rtems_status_code rtems_io_read(
void *argument
)
{
- rtems_device_driver_entry callout;
+ rtems_device_driver_entry callout;
- if ( major >= _IO_Number_of_drivers )
- return RTEMS_INVALID_NUMBER;
+ if ( major >= _IO_Number_of_drivers )
+ return RTEMS_INVALID_NUMBER;
- callout = _IO_Driver_address_table[major].read_entry;
- return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL;
+ callout = _IO_Driver_address_table[major].read_entry;
+ return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL;
}
/*PAGE
@@ -383,13 +363,13 @@ rtems_status_code rtems_io_write(
void *argument
)
{
- rtems_device_driver_entry callout;
+ rtems_device_driver_entry callout;
- if ( major >= _IO_Number_of_drivers )
- return RTEMS_INVALID_NUMBER;
+ if ( major >= _IO_Number_of_drivers )
+ return RTEMS_INVALID_NUMBER;
- callout = _IO_Driver_address_table[major].write_entry;
- return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL;
+ callout = _IO_Driver_address_table[major].write_entry;
+ return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL;
}
/*PAGE
@@ -413,11 +393,11 @@ rtems_status_code rtems_io_control(
void *argument
)
{
- rtems_device_driver_entry callout;
+ rtems_device_driver_entry callout;
- if ( major >= _IO_Number_of_drivers )
- return RTEMS_INVALID_NUMBER;
+ if ( major >= _IO_Number_of_drivers )
+ return RTEMS_INVALID_NUMBER;
- callout = _IO_Driver_address_table[major].control_entry;
- return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL;
+ callout = _IO_Driver_address_table[major].control_entry;
+ return callout ? callout(major, minor, argument) : RTEMS_SUCCESSFUL;
}