diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-06-16 15:54:21 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-06-16 15:54:21 +0000 |
commit | 4cb19041d7d78d9ae29f878871e4d2b89b9abc22 (patch) | |
tree | 3efcf5818a29323bf55577ffbb324cd301249519 | |
parent | 2008-06-13 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-4cb19041d7d78d9ae29f878871e4d2b89b9abc22.tar.bz2 |
2008-06-16 Joel Sherrill <joel.sherrill@oarcorp.com>
* rtems/include/rtems/rtems/config.h,
rtems/include/rtems/rtems/tasks.h, rtems/src/taskgetnote.c,
rtems/src/tasks.c, rtems/src/tasksetnote.c, sapi/include/confdefs.h:
Add CONFIGURE_DISABLE_CLASSIC_API_NOTEPADS.
-rw-r--r-- | cpukit/ChangeLog | 7 | ||||
-rw-r--r-- | cpukit/rtems/include/rtems/rtems/config.h | 13 | ||||
-rw-r--r-- | cpukit/rtems/include/rtems/rtems/tasks.h | 12 | ||||
-rw-r--r-- | cpukit/rtems/src/taskgetnote.c | 4 | ||||
-rw-r--r-- | cpukit/rtems/src/tasks.c | 18 | ||||
-rw-r--r-- | cpukit/rtems/src/tasksetnote.c | 4 | ||||
-rw-r--r-- | cpukit/sapi/include/confdefs.h | 33 |
7 files changed, 77 insertions, 14 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 031ae1fb20..7ae2cf0639 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,10 @@ +2008-06-16 Joel Sherrill <joel.sherrill@oarcorp.com> + + * rtems/include/rtems/rtems/config.h, + rtems/include/rtems/rtems/tasks.h, rtems/src/taskgetnote.c, + rtems/src/tasks.c, rtems/src/tasksetnote.c, sapi/include/confdefs.h: + Add CONFIGURE_DISABLE_CLASSIC_API_NOTEPADS. + 2008-06-13 Joel Sherrill <joel.sherrill@oarcorp.com> * sapi/include/confdefs.h, score/include/rtems/score/priority.h: Add diff --git a/cpukit/rtems/include/rtems/rtems/config.h b/cpukit/rtems/include/rtems/rtems/config.h index 5afc3063d4..4298e6a215 100644 --- a/cpukit/rtems/include/rtems/rtems/config.h +++ b/cpukit/rtems/include/rtems/rtems/config.h @@ -48,6 +48,12 @@ typedef struct { uint32_t maximum_tasks; /** + * This field indicates whether Classic API notepads are + * enabled or disabled. + */ + boolean notepads_enabled; + + /** * This field contains the maximum number of Classic API * Timers which are configured for this application. */ @@ -110,6 +116,13 @@ typedef struct { rtems_initialization_tasks_table *User_initialization_tasks_table; } rtems_api_configuration_table; +/** + * This macro returns the value of the notepads enabled field + * in the Classic API configuration table. + */ +#define rtems_configuration_get_notepads_enabled() \ + rtems_configuration_get_rtems_api_configuration()->notepads_enabled + #ifdef __cplusplus } #endif diff --git a/cpukit/rtems/include/rtems/rtems/tasks.h b/cpukit/rtems/include/rtems/rtems/tasks.h index f09b0eb329..fe9f20ef45 100644 --- a/cpukit/rtems/include/rtems/rtems/tasks.h +++ b/cpukit/rtems/include/rtems/rtems/tasks.h @@ -201,16 +201,24 @@ typedef struct { /** * This is the API specific information required by each thread for * the RTEMS API to function correctly. + * + * @note Notepads must be the last entry in the structure and memory + * will be taken away from this structure when allocated if + * notespads are disabled by the application configuration. */ typedef struct { - /** This field contains the notepads for this task. */ - uint32_t Notepads[ RTEMS_NUMBER_NOTEPADS ]; /** This field contains the pending events for this task. */ rtems_event_set pending_events; /** This field contains the event wait condition for this task. */ rtems_event_set event_condition; /** This field contains the Classic API Signal information for this task. */ ASR_Information Signal; + /** + * This field contains the notepads for this task. + * + * @note MUST BE LAST ENTRY. + */ + uint32_t Notepads[ RTEMS_NUMBER_NOTEPADS ]; } RTEMS_API_Control; /** diff --git a/cpukit/rtems/src/taskgetnote.c b/cpukit/rtems/src/taskgetnote.c index dffb2da2d6..b3983f322a 100644 --- a/cpukit/rtems/src/taskgetnote.c +++ b/cpukit/rtems/src/taskgetnote.c @@ -17,6 +17,7 @@ #endif #include <rtems/system.h> +#include <rtems/config.h> #include <rtems/rtems/status.h> #include <rtems/rtems/support.h> #include <rtems/rtems/modes.h> @@ -60,6 +61,9 @@ rtems_status_code rtems_task_get_note( Objects_Locations location; RTEMS_API_Control *api; + if ( !rtems_configuration_get_notepads_enabled() ) + return RTEMS_NOT_CONFIGURED; + if ( !note ) return RTEMS_INVALID_ADDRESS; diff --git a/cpukit/rtems/src/tasks.c b/cpukit/rtems/src/tasks.c index afde09a704..442f5e6954 100644 --- a/cpukit/rtems/src/tasks.c +++ b/cpukit/rtems/src/tasks.c @@ -16,6 +16,7 @@ #endif #include <rtems/system.h> +#include <rtems/config.h> #include <rtems/rtems/status.h> #include <rtems/rtems/support.h> #include <rtems/rtems/modes.h> @@ -49,8 +50,17 @@ boolean _RTEMS_tasks_Create_extension( { RTEMS_API_Control *api; int i; + size_t to_allocate; - api = _Workspace_Allocate( sizeof( RTEMS_API_Control ) ); + /* + * Notepads must be the last entry in the structure and they + * can be left off if disabled in the configuration. + */ + to_allocate = sizeof( RTEMS_API_Control ); + if ( !rtems_configuration_get_notepads_enabled() ) + to_allocate -= (RTEMS_NUMBER_NOTEPADS * sizeof(uint32_t)); + + api = _Workspace_Allocate( to_allocate ); if ( !api ) return FALSE; @@ -61,8 +71,10 @@ boolean _RTEMS_tasks_Create_extension( _ASR_Initialize( &api->Signal ); created->task_variables = NULL; - for (i=0; i < RTEMS_NUMBER_NOTEPADS; i++) - api->Notepads[i] = 0; + if ( rtems_configuration_get_notepads_enabled() ) { + for (i=0; i < RTEMS_NUMBER_NOTEPADS; i++) + api->Notepads[i] = 0; + } return TRUE; } diff --git a/cpukit/rtems/src/tasksetnote.c b/cpukit/rtems/src/tasksetnote.c index c8d5f82b77..ebb501998e 100644 --- a/cpukit/rtems/src/tasksetnote.c +++ b/cpukit/rtems/src/tasksetnote.c @@ -17,6 +17,7 @@ #endif #include <rtems/system.h> +#include <rtems/config.h> #include <rtems/rtems/status.h> #include <rtems/rtems/support.h> #include <rtems/rtems/modes.h> @@ -59,6 +60,9 @@ rtems_status_code rtems_task_set_note( Objects_Locations location; RTEMS_API_Control *api; + if ( !rtems_configuration_get_notepads_enabled() ) + return RTEMS_NOT_CONFIGURED; + /* * NOTE: There is no check for < RTEMS_NOTEPAD_FIRST because that would * be checking an unsigned number for being negative. diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h index b78ba15033..e4747bc204 100644 --- a/cpukit/sapi/include/confdefs.h +++ b/cpukit/sapi/include/confdefs.h @@ -693,6 +693,12 @@ extern rtems_configuration_table Configuration; #define CONFIGURE_MAXIMUM_TASKS 0 #endif + #ifndef CONFIGURE_DISABLE_CLASSIC_API_NOTEPADS + #define CONFIGURE_NOTEPADS_ENABLED FALSE + #else + #define CONFIGURE_NOTEPADS_ENABLED TRUE + #endif + #ifndef CONFIGURE_MAXIMUM_TASK_VARIABLES #define CONFIGURE_MAXIMUM_TASK_VARIABLES 0 #endif @@ -742,6 +748,14 @@ extern rtems_configuration_table Configuration; #define CONFIGURE_TICKS_PER_TIMESLICE 50 #endif + #ifndef CONFIGURE_DISABLE_CLASSIC_NOTEPADS + #define CONFIGURE_MEMORY_PER_TASK_FOR_CLASSIC_API \ + sizeof(RTEMS_API_Control) + #else + #define CONFIGURE_MEMORY_PER_TASK_FOR_CLASSIC_API \ + (sizeof(RTEMS_API_Control) - (RTEMS_NUMBER_NOTEPADS * sizeof(uint32_t))) + #endif + /* * Initial Extension Set */ @@ -1202,7 +1216,7 @@ extern rtems_configuration_table Configuration; _Configure_Object_RAM(_tasks, sizeof(Thread_Control)) + \ ((_tasks) * \ (_Configure_From_workspace(CONFIGURE_MINIMUM_TASK_STACK_SIZE) + \ - _Configure_From_workspace(sizeof(RTEMS_API_Control)) + \ + _Configure_From_workspace(CONFIGURE_MEMORY_PER_TASK_FOR_CLASSIC_API) + \ _Configure_From_workspace(CONFIGURE_MEMORY_PER_TASK_FOR_LIBC_REENTRANCY) + \ _Configure_From_workspace(CONFIGURE_MEMORY_PER_TASK_FOR_POSIX_API) + \ _Configure_From_workspace(CONFIGURE_MEMORY_PER_TASK_FOR_ITRON_API))) + \ @@ -1222,28 +1236,28 @@ extern rtems_configuration_table Configuration; _Configure_Object_RAM(_timers, sizeof(Timer_Control) ) #define CONFIGURE_MEMORY_FOR_SEMAPHORES(_semaphores) \ - _Configure_Object_RAM(_semaphores, sizeof(Semaphore_Control) ) +_Configure_Object_RAM(_semaphores, sizeof(Semaphore_Control) ) #define CONFIGURE_MEMORY_FOR_MESSAGE_QUEUES(_queues) \ - _Configure_Object_RAM(_queues, sizeof(Message_queue_Control) ) +_Configure_Object_RAM(_queues, sizeof(Message_queue_Control) ) #define CONFIGURE_MEMORY_FOR_PARTITIONS(_partitions) \ - _Configure_Object_RAM(_partitions, sizeof(Partition_Control) ) +_Configure_Object_RAM(_partitions, sizeof(Partition_Control) ) #define CONFIGURE_MEMORY_FOR_REGIONS(_regions) \ - _Configure_Object_RAM(_regions, sizeof(Region_Control) ) +_Configure_Object_RAM(_regions, sizeof(Region_Control) ) #define CONFIGURE_MEMORY_FOR_PORTS(_ports) \ - _Configure_Object_RAM(_ports, sizeof(Dual_ported_memory_Control) ) +_Configure_Object_RAM(_ports, sizeof(Dual_ported_memory_Control) ) #define CONFIGURE_MEMORY_FOR_PERIODS(_periods) \ - _Configure_Object_RAM(_periods, sizeof(Rate_monotonic_Control) ) +_Configure_Object_RAM(_periods, sizeof(Rate_monotonic_Control) ) #define CONFIGURE_MEMORY_FOR_BARRIERS(_barriers) \ - _Configure_Object_RAM(_barriers, sizeof(Barrier_Control) ) +_Configure_Object_RAM(_barriers, sizeof(Barrier_Control) ) #define CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(_extensions) \ - _Configure_Object_RAM(_extensions, sizeof(Extension_Control) ) +_Configure_Object_RAM(_extensions, sizeof(Extension_Control) ) #ifdef CONFIGURE_MP_APPLICATION @@ -1496,6 +1510,7 @@ extern rtems_configuration_table Configuration; */ rtems_api_configuration_table Configuration_RTEMS_API = { CONFIGURE_MAXIMUM_TASKS, + CONFIGURE_NOTEPADS_ENABLED, CONFIGURE_MAXIMUM_TIMERS, CONFIGURE_MAXIMUM_SEMAPHORES + CONFIGURE_LIBIO_SEMAPHORES + CONFIGURE_TERMIOS_SEMAPHORES, |