本文整理汇总了C++中rtems_build_name函数的典型用法代码示例。如果您正苦于以下问题:C++ rtems_build_name函数的具体用法?C++ rtems_build_name怎么用?C++ rtems_build_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rtems_build_name函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: spawnTask
/*
* Spawn a task
*/
static void spawnTask(rtems_task_entry entryPoint, rtems_task_priority priority, rtems_task_argument arg)
{
rtems_status_code sc;
rtems_id tid;
sc = rtems_task_create(rtems_build_name('t','a','s','k'),
priority,
RTEMS_MINIMUM_STACK_SIZE+(8*1024),
RTEMS_PREEMPT|RTEMS_TIMESLICE|RTEMS_NO_ASR|RTEMS_INTERRUPT_LEVEL(0),
RTEMS_FLOATING_POINT|RTEMS_LOCAL,
&tid);
if (sc != RTEMS_SUCCESSFUL)
rtems_panic("Can't create task: %s", rtems_status_text(sc));
sc = rtems_task_start(tid, entryPoint, arg);
if (sc != RTEMS_SUCCESSFUL)
rtems_panic("Can't start task: %s", rtems_status_text(sc));
}
示例2: bsp_interrupt_lock
static rtems_status_code bsp_interrupt_lock(void)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
if (_System_state_Is_up(_System_state_Get())) {
if (bsp_interrupt_mutex == RTEMS_ID_NONE) {
rtems_id mutex = RTEMS_ID_NONE;
rtems_interrupt_level level;
/* Create a mutex */
sc = rtems_semaphore_create (
rtems_build_name('I', 'N', 'T', 'R'),
1,
RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY,
0,
&mutex
);
if (sc != RTEMS_SUCCESSFUL) {
return sc;
}
/* Assign the mutex */
rtems_interrupt_disable(level);
if (bsp_interrupt_mutex == RTEMS_ID_NONE) {
/* Nobody else assigned the mutex in the meantime */
bsp_interrupt_mutex = mutex;
rtems_interrupt_enable(level);
} else {
/* Somebody else won */
rtems_interrupt_enable(level);
sc = rtems_semaphore_delete(mutex);
if (sc != RTEMS_SUCCESSFUL) {
return sc;
}
}
}
return rtems_semaphore_obtain(
bsp_interrupt_mutex,
RTEMS_WAIT,
RTEMS_NO_TIMEOUT
);
} else {
return RTEMS_SUCCESSFUL;
}
}
示例3: Init
rtems_task Init(
rtems_task_argument argument
)
{
uint32_t i;
char ch;
uint32_t cpu_num;
rtems_id id;
rtems_status_code status;
TEST_BEGIN();
locked_print_initialize();
for ( killtime=0; killtime<1000000; killtime++ )
;
for ( i=0; i<rtems_get_processor_count() -1; i++ ) {
ch = '1' + i;
status = rtems_task_create(
rtems_build_name( 'T', 'A', ch, ' ' ),
1,
RTEMS_MINIMUM_STACK_SIZE,
RTEMS_DEFAULT_MODES,
RTEMS_DEFAULT_ATTRIBUTES,
&id
);
directive_failed( status, "task create" );
cpu_num = rtems_get_current_processor();
locked_printf(" CPU %" PRIu32 " start task TA%c\n", cpu_num, ch);
status = rtems_task_start( id, Test_task, i+1 );
directive_failed( status, "task start" );
}
locked_printf(" kill 10 clock ticks\n" );
while ( rtems_clock_get_ticks_since_boot() < 10 )
;
rtems_cpu_usage_report();
TEST_END();
rtems_test_exit(0);
}
示例4: Init
/*
* RTEMS Startup Task
*/
rtems_task
Init (rtems_task_argument ignored)
{
rtems_status_code sc;
rtems_print_printer_printf(&rtems_test_printer);
rtems_test_begin();
sc = rtems_semaphore_create(rtems_build_name('P','m','t','x'),
1,
RTEMS_PRIORITY|RTEMS_BINARY_SEMAPHORE|RTEMS_INHERIT_PRIORITY|
RTEMS_NO_PRIORITY_CEILING|RTEMS_LOCAL,
0,
&printMutex);
if (sc != RTEMS_SUCCESSFUL)
rtems_panic("Can't create printf mutex:", rtems_status_text(sc));
printf("\"Network\" initializing!\n");
rtems_bsdnet_initialize_network();
printf("\"Network\" initialized!\n");
printf("Try running client with no server present.\n");
printf("Should fail with `connection refused'.\n");
clientWorker(0);
printf("\nStart server.\n");
spawnTask(serverTask, 150, 0);
printf("\nTry running client with server present.\n");
spawnTask(clientTask, 120, 1);
rtems_task_wake_after(500);
printf("\nTry running two clients.\n");
spawnTask(clientTask, 120, 2);
spawnTask(clientTask, 120, 3);
rtems_task_wake_after(500);
printf("\nTry running three clients.\n");
spawnTask(clientTask, 120, 4);
spawnTask(clientTask, 120, 5);
spawnTask(clientTask, 120, 6);
rtems_task_wake_after(500);
rtems_test_end();
exit( 0 );
}
示例5: graes_initialize
static rtems_device_driver graes_initialize(
rtems_device_major_number major,
rtems_device_minor_number unused,
void *arg
)
{
/* Device Semaphore created with count = 1 */
if ( rtems_semaphore_create(rtems_build_name('G', 'R', 'P', 'R'),
1,
RTEMS_FIFO|RTEMS_NO_INHERIT_PRIORITY|RTEMS_LOCAL|RTEMS_NO_PRIORITY_CEILING,
0,
&graes_dev_sem) != RTEMS_SUCCESSFUL ) {
return RTEMS_INTERNAL_ERROR;
}
return RTEMS_SUCCESSFUL;
}
示例6: Init
rtems_task Init(
rtems_task_argument argument
)
{
int i;
char ch;
int cpu_num;
rtems_id id;
rtems_status_code status;
locked_print_initialize();
locked_printf( "\n\n*** TEST SMP09 ***\n" );
for ( killtime=0; killtime<1000000; killtime++ )
;
for ( i=0; i<rtems_smp_get_number_of_processors() -1; i++ ) {
ch = '1' + i;
status = rtems_task_create(
rtems_build_name( 'T', 'A', ch, ' ' ),
1,
RTEMS_MINIMUM_STACK_SIZE,
RTEMS_DEFAULT_MODES,
RTEMS_DEFAULT_ATTRIBUTES,
&id
);
directive_failed( status, "task create" );
cpu_num = bsp_smp_processor_id();
locked_printf(" CPU %d start task TA%c\n", cpu_num, ch);
status = rtems_task_start( id, Test_task, i+1 );
directive_failed( status, "task start" );
}
locked_printf(" kill 10 clock ticks\n" );
while ( rtems_clock_get_ticks_since_boot() < 10 )
;
rtems_cpu_usage_report();
locked_printf( "*** END OF TEST SMP09 ***" );
rtems_test_exit(0);
}
示例7: test_mrsp_set_priority
static void test_mrsp_set_priority(void)
{
rtems_status_code sc;
rtems_id id;
rtems_id scheduler_id;
rtems_task_priority prio;
puts("test MrsP set priority");
sc = rtems_task_get_scheduler(RTEMS_SELF, &scheduler_id);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
sc = rtems_semaphore_create(
rtems_build_name('M', 'R', 'S', 'P'),
1,
RTEMS_MULTIPROCESSOR_RESOURCE_SHARING
| RTEMS_BINARY_SEMAPHORE,
1,
&id
);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
prio = RTEMS_CURRENT_PRIORITY;
sc = rtems_semaphore_set_priority(id, scheduler_id, prio, &prio);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
rtems_test_assert(prio == 1);
prio = 1;
sc = rtems_semaphore_set_priority(id, scheduler_id, prio, &prio);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
rtems_test_assert(prio == 1);
prio = 2;
sc = rtems_semaphore_set_priority(id, scheduler_id, prio, &prio);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
rtems_test_assert(prio == 1);
prio = RTEMS_CURRENT_PRIORITY;
sc = rtems_semaphore_set_priority(id, scheduler_id, prio, &prio);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
rtems_test_assert(prio == 2);
sc = rtems_semaphore_delete(id);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
}
示例8: Init
rtems_task Init(
rtems_task_argument argument
)
{
rtems_status_code sc;
rtems_id timer1;
struct timespec uptime;
TEST_BEGIN();
sc = rtems_timer_initiate_server(
1,
RTEMS_MINIMUM_STACK_SIZE,
RTEMS_DEFAULT_ATTRIBUTES
);
directive_failed( sc, "rtems_timer_initiate_server" );
sc = rtems_timer_create(rtems_build_name( 'T', 'M', 'R', '1' ), &timer1);
directive_failed( sc, "rtems_timer_create" );
Fired = 0;
timerRan = false;
Timer_Routine(timer1, NULL);
while (1) {
sc = rtems_task_wake_after( 10 );
directive_failed( sc, "rtems_task_wake_after" );
if ( timerRan == true ) {
timerRan = false;
sc = rtems_clock_get_uptime( &uptime );
directive_failed( sc, "rtems_clock_get_uptime" );
printf( "Timer fired at %" PRIdtime_t "\n", uptime.tv_sec );
}
if ( Fired >= 10 ) {
TEST_END();
rtems_test_exit( 0 );
}
/* technically the following is a critical section */
}
}
示例9: Init
rtems_task Init(
rtems_task_argument argument
)
{
int error;
uint32_t index;
rtems_status_code status;
rtems_printer_task_set_priority( &printer_task, 254 );
rtems_printer_task_set_file_descriptor( &printer_task, 1 );
rtems_printer_task_set_buffer_table( &printer_task, &buffers[ 0 ][ 0 ] );
rtems_printer_task_set_buffer_count( &printer_task, BUFFER_COUNT );
rtems_printer_task_set_buffer_size( &printer_task, BUFFER_SIZE );
error = rtems_print_printer_task( &rtems_test_printer, &printer_task );
rtems_test_assert( error == 0 );
TEST_BEGIN();
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', ' ' );
Task_name[ 6 ] = rtems_build_name( 'T', 'A', '6', ' ' );
for ( index = 1 ; index <= 6 ; index++ ) {
status = rtems_task_create(
Task_name[ index ],
Priorities[ index ],
RTEMS_MINIMUM_STACK_SIZE,
RTEMS_DEFAULT_MODES,
RTEMS_FLOATING_POINT,
&Task_id[ index ]
);
directive_failed( status, "rtems_task_create loop" );
}
for ( index = 1 ; index <= 6 ; index++ ) {
status = rtems_task_start( Task_id[ index ], Task_1_through_6, 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;
Count.count[ 6 ] = 0;
status = rtems_task_delete( RTEMS_SELF );
directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
}
示例10: vt100_init
int vt100_init(FILE *out_stream){
if ( !out_stream ){
stream = stdout;
}else{
stream = out_stream;
}
rtems_semaphore_create(
rtems_build_name('V', 'T', 'L', 'K'),
1,
RTEMS_FIFO | RTEMS_COUNTING_SEMAPHORE | RTEMS_NO_INHERIT_PRIORITY | \
RTEMS_NO_PRIORITY_CEILING,
0,
&(vt100_lock));
vt100_reset();
return 0;
}
示例11: rtems_rfs_mutex_create
int
rtems_rfs_mutex_create (rtems_rfs_mutex* mutex)
{
#if __rtems__
rtems_status_code sc;
sc = rtems_semaphore_create (rtems_build_name ('R', 'F', 'S', 'm'),
1, RTEMS_RFS_MUTEX_ATTRIBS, 0,
mutex);
if (sc != RTEMS_SUCCESSFUL)
{
if (rtems_rfs_trace (RTEMS_RFS_TRACE_MUTEX))
printf ("rtems-rfs: mutex: open failed: %s\n",
rtems_status_text (sc));
return EIO;
}
#endif
return 0;
}
示例12: 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" );
}
示例13: test_mrsp_set_priority_errors
static void test_mrsp_set_priority_errors(void)
{
rtems_status_code sc;
rtems_id id;
rtems_id scheduler_id;
rtems_task_priority prio;
puts("test MrsP set priority errors");
sc = rtems_task_get_scheduler(RTEMS_SELF, &scheduler_id);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
sc = rtems_semaphore_create(
rtems_build_name('C', 'O', 'N', 'T'),
0,
RTEMS_COUNTING_SEMAPHORE,
0,
&id
);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
prio = 1;
sc = rtems_semaphore_set_priority(RTEMS_ID_NONE, scheduler_id, prio, &prio);
rtems_test_assert(sc == RTEMS_INVALID_ID);
prio = 1;
sc = rtems_semaphore_set_priority(id, RTEMS_ID_NONE, prio, &prio);
rtems_test_assert(sc == RTEMS_INVALID_ID);
prio = 0xffffffff;
sc = rtems_semaphore_set_priority(id, scheduler_id, prio, &prio);
rtems_test_assert(sc == RTEMS_INVALID_PRIORITY);
prio = 1;
sc = rtems_semaphore_set_priority(id, scheduler_id, prio, NULL);
rtems_test_assert(sc == RTEMS_INVALID_ADDRESS);
prio = 1;
sc = rtems_semaphore_set_priority(id, scheduler_id, prio, &prio);
rtems_test_assert(sc == RTEMS_NOT_DEFINED);
sc = rtems_semaphore_delete(id);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
}
示例14: rtems_media_server_initialize
rtems_status_code rtems_media_server_initialize(
rtems_task_priority priority,
size_t stack_size,
rtems_mode modes,
rtems_attribute attributes
)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
if (server_id == RTEMS_ID_NONE) {
sc = rtems_media_initialize();
if (sc != RTEMS_SUCCESSFUL) {
goto error;
}
sc = rtems_task_create(
rtems_build_name('M', 'D', 'I', 'A'),
priority,
stack_size,
modes,
attributes,
&server_id
);
if (sc != RTEMS_SUCCESSFUL) {
goto error;
}
sc = rtems_task_start(server_id, media_server, 0);
if (sc != RTEMS_SUCCESSFUL) {
goto error;
}
}
return RTEMS_SUCCESSFUL;
error:
if (server_id != RTEMS_ID_NONE) {
rtems_task_delete(server_id);
}
return RTEMS_NO_MEMORY;
}
示例15: Init
rtems_task Init( rtems_task_argument ignored )
{
rtems_id thread;
rtems_status_code rc;
int sc;
struct timespec delay_request;
TEST_BEGIN();
puts( "Init - pthread key create with destructor - OK" );
sc = pthread_key_create( &key, destructor );
rtems_test_assert( !sc );
puts( "Init - thread create - OK" );
rc = rtems_task_create(
rtems_build_name( 'T', 'E', 'S', 'T' ),
1,
RTEMS_MINIMUM_STACK_SIZE,
RTEMS_DEFAULT_MODES,
RTEMS_DEFAULT_ATTRIBUTES,
&thread
);
rtems_test_assert( rc == RTEMS_SUCCESSFUL );
rc = rtems_task_start( thread, Test_Thread, (rtems_task_argument)Data_array );
rtems_test_assert( rc == RTEMS_SUCCESSFUL );
puts( "Init - sleep - let thread run - OK" );
delay_request.tv_sec = 0;
delay_request.tv_nsec = 8 * 100000000;
sc = nanosleep( &delay_request, NULL );
rtems_test_assert( !sc );
puts( "Init - verify destructor run - OK" );
rtems_test_assert( destructor_ran == true );
puts( "Init - pthread key delete - OK" );
sc = pthread_key_delete( key );
rtems_test_assert( sc == 0 );
TEST_END();
rtems_test_exit(0);
}