本文整理汇总了C++中rtems_task_suspend函数的典型用法代码示例。如果您正苦于以下问题:C++ rtems_task_suspend函数的具体用法?C++ rtems_task_suspend怎么用?C++ rtems_task_suspend使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rtems_task_suspend函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Task02
rtems_task Task02( rtems_task_argument ignored )
{
/* Benchmark code */
benchmark_timer_initialize();
for ( count = 0; count < BENCHMARKS; count++ ) {
if ( sem_exe == 1 ) {
rtems_semaphore_obtain( sem_id, RTEMS_WAIT, 0 );
}
rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
if ( sem_exe == 1 ) {
rtems_semaphore_release( sem_id );
}
rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
}
telapsed = benchmark_timer_read();
/* Check which run this was */
if (sem_exe == 0) {
tswitch_overhead = telapsed;
rtems_task_suspend( Task_id[0] );
rtems_task_suspend( RTEMS_SELF );
} else {
put_time(
"Rhealstone: Semaphore Shuffle",
telapsed,
(BENCHMARKS * 2), /* Total number of semaphore-shuffles*/
tswitch_overhead, /* Overhead of loop and task switches */
0
);
TEST_END();
rtems_test_exit( 0 );
}
}
开发者ID:AlexShiLucky,项目名称:rtems,代码行数:35,代码来源:semshuffle.c
示例2: reset
static void reset(test_context *ctx)
{
rtems_status_code sc;
size_t i;
for (i = 0; i < TASK_COUNT; ++i) {
set_priority(ctx->task_ids[i], P(i));
set_affinity(ctx->task_ids[i], A(1, 1));
}
for (i = CPU_COUNT; i < TASK_COUNT; ++i) {
sc = rtems_task_suspend(ctx->task_ids[i]);
rtems_test_assert(sc == RTEMS_SUCCESSFUL || sc == RTEMS_ALREADY_SUSPENDED);
}
for (i = 0; i < CPU_COUNT; ++i) {
sc = rtems_task_resume(ctx->task_ids[i]);
rtems_test_assert(sc == RTEMS_SUCCESSFUL || sc == RTEMS_INCORRECT_STATE);
}
/* Order the idle threads explicitly */
for (i = 0; i < CPU_COUNT; ++i) {
const Per_CPU_Control *c;
const Thread_Control *h;
c = _Per_CPU_Get_by_index(CPU_COUNT - 1 - i);
h = c->heir;
sc = rtems_task_suspend(h->Object.id);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
}
}
开发者ID:gedare,项目名称:rtems,代码行数:32,代码来源:init.c
示例3: timer
/*
* Use a timer to execute the actions, since it runs with thread dispatching
* disabled. This is necessary to check the expected processor allocations.
*/
static void timer(rtems_id id, void *arg)
{
test_context *ctx;
rtems_status_code sc;
size_t i;
ctx = arg;
i = ctx->action_index;
if (i == 0) {
sc = rtems_task_suspend(ctx->master_id);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
}
if (i < RTEMS_ARRAY_SIZE(test_actions)) {
const test_action *action = &test_actions[i];
rtems_id task;
ctx->action_index = i + 1;
task = ctx->task_ids[action->index];
switch (action->kind) {
case KIND_SET_PRIORITY:
set_priority(task, action->data.priority);
break;
case KIND_SET_AFFINITY:
set_affinity(task, action->data.cpu_set);
break;
case KIND_BLOCK:
sc = rtems_task_suspend(task);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
break;
case KIND_UNBLOCK:
sc = rtems_task_resume(task);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
break;
default:
rtems_test_assert(action->kind == KIND_RESET);
reset(ctx);
break;
}
check_cpu_allocations(ctx, action);
sc = rtems_timer_reset(id);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
} else {
sc = rtems_task_resume(ctx->master_id);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
sc = rtems_event_transient_send(ctx->master_id);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
}
}
开发者ID:gedare,项目名称:rtems,代码行数:59,代码来源:init.c
示例4: Task_1
rtems_task Task_1(
rtems_task_argument argument
)
{
rtems_id tid2;
rtems_id tid3;
uint32_t pass;
rtems_status_code status;
status = rtems_task_ident( Task_name[ 2 ], 1, &tid2 );
directive_failed( status, "rtems_task_ident of TA2" );
status = rtems_task_ident( Task_name[ 3 ], 1, &tid3 );
directive_failed( status, "rtems_task_ident of TA3" );
for ( pass=1 ; pass <= 3 ; pass++ ) {
puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" );
status = rtems_task_wake_after( 5*rtems_clock_get_ticks_per_second() );
directive_failed( status, "rtems_task_wake_after of TA1" );
puts( "TA1 - rtems_task_suspend - suspend TA3" );
status = rtems_task_suspend( tid3 );
if ( pass == 1 ) {
fatal_directive_status(
status,
RTEMS_ALREADY_SUSPENDED,
"rtems_task_suspend of TA3"
);
} else {
directive_failed( status, "rtems_task_suspend of TA3" );
}
puts( "TA1 - rtems_task_resume - resume TA2" );
status = rtems_task_resume( tid2 );
directive_failed( status, "rtems_task_resume of TA2" );
puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" );
status = rtems_task_wake_after( 5*rtems_clock_get_ticks_per_second() );
directive_failed( status, "rtems_task_wake_after" );
puts( "TA1 - rtems_task_suspend - suspend TA2" );
status = rtems_task_suspend( tid2 );
directive_failed( status, "rtems_task_suspend of TA2" );
puts( "TA1 - rtems_task_resume - resume TA3" );
status = rtems_task_resume( tid3 );
directive_failed( status, "rtems_task_resume" );
}
TEST_END();
rtems_test_exit( 0 );
}
开发者ID:AlexShiLucky,项目名称:rtems,代码行数:53,代码来源:task1.c
示例5: Task_1_through_3
rtems_task Task_1_through_3(
rtems_task_argument argument
)
{
rtems_id tid;
rtems_time_of_day time;
rtems_status_code status;
status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
directive_failed( status, "rtems_task_ident of self" );
while ( FOREVER ) {
status = rtems_timer_fire_after(
Timer_id[ argument ],
task_number( tid ) * 5 * TICKS_PER_SECOND,
Resume_task,
NULL
);
directive_failed( status, "tm_fire_after failed" );
status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
directive_failed( status, "rtems_clock_get failed" );
if ( time.second >= 35 ) {
puts( "*** END OF TEST 24 ***" );
rtems_test_exit( 0 );
}
put_name( Task_name[ task_number( tid ) ], FALSE );
print_time( " - rtems_clock_get - ", &time, "\n" );
status = rtems_task_suspend( RTEMS_SELF );
directive_failed( status, "rtems_task_suspend" );
}
}
开发者ID:jfpmonteiro,项目名称:rtems-4.8-rhealstone,代码行数:35,代码来源:task1.c
示例6: task
/*
* Task that calls the function we want to trace
*/
static void task(rtems_task_argument arg)
{
rtems_status_code sc;
uint32_t i;
for ( i = 0; i < ITERATIONS; i++ ) {
/*
* Wait until the previous task in the task chain
* has completed its operation.
*/
sc = rtems_semaphore_obtain(task_data[arg].prev_sem, 0, 0);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
add_number_wrapper(arg, i);
/*
* Signal the next task in the chain to continue
*/
sc = rtems_semaphore_release(task_data[arg].task_sem);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
}
/* Signal the main task that this task has finished */
sc = rtems_semaphore_release(finished_sem);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
rtems_task_suspend(rtems_task_self());
}
开发者ID:WattTech,项目名称:rtems,代码行数:30,代码来源:init.c
示例7: task_high
static void task_high(rtems_task_argument arg)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
rtems_bdbuf_buffer *bd = NULL;
sc = rtems_task_suspend(RTEMS_SELF);
ASSERT_SC(sc);
printk("H: try access: 0\n");
sc = rtems_bdbuf_get(dd, 0, &bd);
ASSERT_SC(sc);
printk("H: access: 0\n");
printk("H: release: 0\n");
sc = rtems_bdbuf_release(bd);
ASSERT_SC(sc);
printk("H: release done: 0\n");
printk("*** END OF TEST BLOCK 4 ***\n");
exit(0);
}
开发者ID:aniwang2013,项目名称:leon-rtems,代码行数:26,代码来源:init.c
示例8: suspend
static void suspend(rtems_id task)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
sc = rtems_task_suspend(task);
ASSERT_SC(sc);
}
开发者ID:FullMentalPanic,项目名称:RTEMS_NEW_TOOL_CHAIN,代码行数:7,代码来源:init.c
示例9: Init
/*
* RTEMS Startup Task
*/
rtems_task
Init (rtems_task_argument ignored)
{
putenv ("TERM=xterm");
main (0, NULL);
rtems_task_suspend (RTEMS_SELF);
}
开发者ID:SayCV,项目名称:rtems-addon-packages,代码行数:10,代码来源:init.c
示例10: low_task
static void low_task( rtems_task_argument arg )
{
rtems_test_assert( test_no_preempt_step == 1 );
test_no_preempt_step = 2;
rtems_task_suspend(RTEMS_SELF);
rtems_test_assert(0);
}
开发者ID:Avanznow,项目名称:rtems,代码行数:8,代码来源:task1.c
示例11: Init
rtems_task Init(
rtems_task_argument argument
)
{
rtems_status_code status;
rtems_time_of_day time;
int i;
char ch[4];
rtems_id id;
locked_print_initialize();
locked_printf( "\n\n*** SMP08 TEST ***\n" );
time.year = 1988;
time.month = 12;
time.day = 31;
time.hour = 9;
time.minute = 0;
time.second = 0;
time.ticks = 0;
status = rtems_clock_set( &time );
/* Create/verify synchronisation semaphore */
status = rtems_semaphore_create(
rtems_build_name ('S', 'E', 'M', '1'),
1,
RTEMS_LOCAL |
RTEMS_SIMPLE_BINARY_SEMAPHORE |
RTEMS_PRIORITY,
1,
&Semaphore
);
directive_failed( status, "rtems_semaphore_create" );
/* Show that the init task is running on this cpu */
PrintTaskInfo( "Init", &time );
for ( i=1; i <= rtems_smp_get_processor_count() *3; i++ ) {
sprintf(ch, "%02" PRId32, i );
status = rtems_task_create(
rtems_build_name( 'T', 'A', ch[0], ch[1] ),
2,
RTEMS_MINIMUM_STACK_SIZE,
RTEMS_DEFAULT_MODES,
RTEMS_DEFAULT_ATTRIBUTES,
&id
);
directive_failed( status, "task create" );
status = rtems_task_start( id, Test_task, i+1 );
directive_failed( status, "task start" );
}
/* FIXME: Task deletion currently not supported */
(void) rtems_task_suspend( RTEMS_SELF );
}
开发者ID:chch1028,项目名称:rtems,代码行数:58,代码来源:init.c
示例12: epicsThreadSuspendSelf
void
epicsThreadSuspendSelf (void)
{
rtems_status_code sc;
sc = rtems_task_suspend (RTEMS_SELF);
if(sc != RTEMS_SUCCESSFUL)
errlogPrintf("epicsThreadSuspendSelf failed: %s\n", rtems_status_text (sc));
}
开发者ID:ukaea,项目名称:epics,代码行数:9,代码来源:osdThread.c
示例13: Middle_tasks
rtems_task Middle_tasks(
rtems_task_argument argument
)
{
(void) rtems_task_suspend( RTEMS_SELF );
Task_index++;
(void) rtems_task_resume( Task_id[ Task_index ] );
}
开发者ID:0871087123,项目名称:rtems,代码行数:9,代码来源:task1.c
示例14: worker_task
static void worker_task(rtems_task_argument arg)
{
rtems_status_code sc;
all_tests();
sc = rtems_task_suspend(RTEMS_SELF);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
}
开发者ID:krohini1593,项目名称:rtems,代码行数:9,代码来源:init.c
示例15: Init
static rtems_task Init(rtems_task_argument argument)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
rtems_bdbuf_buffer *bd = NULL;
dev_t dev = 0;
printk("\n\n*** TEST BLOCK 3 ***\n");
sc = rtems_disk_io_initialize();
ASSERT_SC(sc);
sc = ramdisk_register(BLOCK_SIZE, BLOCK_COUNT, false, "/dev/rda", &dev);
ASSERT_SC(sc);
dd = rtems_disk_obtain(dev);
rtems_test_assert(dd != NULL);
sc = rtems_task_create(
rtems_build_name(' ', 'L', 'O', 'W'),
PRIORITY_LOW,
0,
RTEMS_DEFAULT_MODES,
RTEMS_DEFAULT_ATTRIBUTES,
&task_id_low
);
ASSERT_SC(sc);
sc = rtems_task_start(task_id_low, task_low, 0);
ASSERT_SC(sc);
sc = rtems_task_create(
rtems_build_name('H', 'I', 'G', 'H'),
PRIORITY_HIGH,
0,
RTEMS_DEFAULT_MODES,
RTEMS_DEFAULT_ATTRIBUTES,
&task_id_high
);
ASSERT_SC(sc);
sc = rtems_task_start(task_id_high, task_high, 0);
ASSERT_SC(sc);
sc = rtems_bdbuf_get(dd, 0, &bd);
ASSERT_SC(sc);
sc = rtems_bdbuf_sync(bd);
ASSERT_SC(sc);
printk("I: sync done: 0\n");
sync_done = true;
sc = rtems_task_suspend(RTEMS_SELF);
ASSERT_SC(sc);
}
开发者ID:aniwang2013,项目名称:leon-rtems,代码行数:56,代码来源:init.c
示例16: fileio_start_shell
void fileio_start_shell(void)
{
printf(" =========================\n");
printf(" starting shell\n");
printf(" =========================\n");
shell_init("SHLL",0,100,"/dev/console",
B9600 | CS8,
0);
rtems_task_suspend(RTEMS_SELF);
}
开发者ID:jfpmonteiro,项目名称:rtems-4.8-rhealstone,代码行数:10,代码来源:init.c
示例17: Middle_tasks
rtems_task Middle_tasks(
rtems_task_argument argument
)
{
task_index++;
if ( argument != 0 )
(void) rtems_task_restart( Task_id[ task_index ], 0xffffffff );
else
(void) rtems_task_suspend( RTEMS_SELF );
}
开发者ID:FullMentalPanic,项目名称:RTEMS_NEW_TOOL_CHAIN,代码行数:11,代码来源:task1.c
示例18: Task_1
void Task_1()
{
rtems_status_code status;
while (1) {
puts( "TA2 - rtems_task_suspend RTEMS_SELF" );
status = rtems_task_suspend( RTEMS_SELF );
directive_failed( status, "TA2 rtems_task_suspend RTEMS_SELF" );
}
}
开发者ID:FullMentalPanic,项目名称:RTEMS_NEW_TOOL_CHAIN,代码行数:12,代码来源:task1.c
示例19: Init
rtems_task Init(
rtems_task_argument argument
)
{
uint32_t index;
rtems_status_code status;
rtems_id rmid;
rtems_name period;
TEST_BEGIN();
period = rtems_build_name( 'I', 'G', 'N', 'R' );
status = rtems_rate_monotonic_create( period, &rmid );
directive_failed( status, "rtems_rate_monotonic_create" );
printf(
"INIT - rtems_rate_monotonic_create id = 0x%08" PRIxrtems_id " (stays inactive)\n",
rmid
);
Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' );
Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' );
for ( index = 1 ; index <= 5 ; index++ ) {
status = rtems_task_create(
Task_name[ index ],
Priorities[ index ],
RTEMS_MINIMUM_STACK_SIZE * 4,
RTEMS_DEFAULT_MODES,
(index == 5) ? RTEMS_FLOATING_POINT : RTEMS_DEFAULT_ATTRIBUTES,
&Task_id[ index ]
);
directive_failed( status, "rtems_task_create loop" );
}
for ( index = 1 ; index <= 5 ; index++ ) {
status = rtems_task_start( Task_id[ index ], Task_1_through_5, index );
directive_failed( status, "rtems_task_start loop" );
}
Count.count[ 1 ] = 0;
Count.count[ 2 ] = 0;
Count.count[ 3 ] = 0;
Count.count[ 4 ] = 0;
Count.count[ 5 ] = 0;
status = rtems_task_suspend( RTEMS_SELF );
directive_failed( status, "rtems_task_suspend of RTEMS_SELF" );
}
开发者ID:AlexShiLucky,项目名称:rtems,代码行数:52,代码来源:init.c
注:本文中的rtems_task_suspend函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论