本文整理汇总了C++中cyg_thread_delay函数的典型用法代码示例。如果您正苦于以下问题:C++ cyg_thread_delay函数的具体用法?C++ cyg_thread_delay怎么用?C++ cyg_thread_delay使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cyg_thread_delay函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: simple_program
/* this is a simple program which runs in a thread */
void simple_program(cyg_addrword_t data)
{
int message = (int) data;
int delay;
cyg_mutex_lock(&cliblock);
printf("Beginning execution; thread data is %d\n", message);
cyg_mutex_unlock(&cliblock);
cyg_thread_delay(200);
for (;;) {
/* delay = 1000 + (rand() % 50); */
delay = 5000*(1+message) + (rand() % 50);
/* note: printf() must be protected by a
call to cyg_mutex_lock() */
cyg_mutex_lock(&cliblock);
{
cyg_tick_count_t tick;
tick = cyg_current_time();
#if 0
printf("(%llu) Thread %d: and now a delay of %d clock ticks\n",
tick, message, delay);
#else
// printf("(%llu) Thread %d\n", tick, message);
#endif
}
cyg_mutex_unlock(&cliblock);
cyg_thread_delay(delay);
}
}
开发者ID:magic-gjh,项目名称:NT96655_FHD6600,代码行数:36,代码来源:twothreads.c
示例2: entry0
static void entry0( cyg_addrword_t data )
{
CHECK( 222 == (int)data );
cyg_thread_suspend(pt1);
cyg_thread_resume(pt1);
cyg_thread_delay(1);
cyg_thread_resume(pt1);
cyg_thread_delay(1);
CYG_TEST_PASS_FINISH("Kernel C API Thread 1 OK");
}
开发者ID:EPiCS,项目名称:reconos_v2,代码行数:15,代码来源:kthread1.c
示例3: kbd_scan
static void
kbd_scan(cyg_addrword_t param)
{
unsigned char ch;
unsigned char *ev;
diag_printf("Keyboard scan\n");
while (true) {
cyg_thread_delay(SCAN_DELAY);
if (aaed2000_KeyboardTest()) {
ch = aaed2000_KeyboardGetc();
if (num_events < MAX_EVENTS) {
num_events++;
ev = &_events[_event_put++];
if (_event_put == MAX_EVENTS) {
_event_put = 0;
}
*ev = ch;
if (kbd_select_active) {
kbd_select_active = false;
cyg_selwakeup(&kbd_select_info);
}
}
}
}
}
开发者ID:KarenHung,项目名称:ecosgit,代码行数:26,代码来源:aaed2000_kbd.c
示例4: vtsk_handle
/*
* Author: xiaoyang
* Created: 2011-9-22
* Parameters:
* Description:ecos thread for collecting
*/
void vtsk_handle(cyg_addrword_t data) {
// uart test
led_off(LEDG0);
//dprintf("test begin.\n");
//cyg_thread_delay(1000);
//led_on(LEDG0);
//apbuart_test(UART0_BASE);
//serial test
//dprintf("serial test begin.\n");
//serial_test();
//OV7660_init();
//OV7660_work();
//while (1) {
/*do your own work here*/
//dprintf("uart0 test ok.\n");
//led_on(LEDG0);
//cyg_thread_delay(50);
//led_off(LEDG0);
//cyg_thread_delay(50);
/*do your own work here*/
//}
//fs_test();
OV7660_init();
OV7660_work();
while(1){
ov7660_pin_test();
cyg_thread_delay(400);
}
dprintf("test end.\n");
}
开发者ID:ibeilin,项目名称:leon-wsn,代码行数:38,代码来源:vtask.c
示例5: cyg_clock_get_resolution
void NSFOSThread::sleep(UInt32 sleepTime)
{
static cyg_resolution_t timerResolution = cyg_clock_get_resolution(cyg_real_time_clock());
// Assumes cyg_clock_get_resolution(cyg_real_time_clock()).divisor is in Hz (ticks/sec), as per documentation.
cyg_thread_delay(((sleepTime * timerResolution.divisor) + 999) / 1000);
}
开发者ID:cherry-wb,项目名称:NorthStateFramework-cpp,代码行数:7,代码来源:NSFOSThread_eCOS.cpp
示例6: nasd_start
void
nasd_start(void)
{
int wait_time = 1 * 100; /* 1 second */
if (!_nas_pid ||
!oslib_waitpid(_nas_pid, NULL)) {
cyg_thread_create(7,
(cyg_thread_entry_t *)nas_main,
(cyg_addrword_t)NULL,
"NAS",
(void *)nas_main_stack,
sizeof(nas_main_stack),
&nas_main_hdl,
&nas_thread);
cyg_thread_resume(nas_main_hdl);
/* Make sure nas stared and initial completed. Otherwise,
* it may lost some wireless driver events.
*/
while (_nas_ready == 0 && wait_time > 0) {
cyg_thread_delay(10);
wait_time -= 10;
}
NASMSG("NAS task started\n");
}
}
开发者ID:NieHao,项目名称:Tomato-RAF,代码行数:28,代码来源:nas_ecos.c
示例7: igd_start
/* Initialize IGD */
void
igd_start(void)
{
char *value;
/*
* Stop igd_mainloop anyway,
* if not enabled.
*/
value = nvram_get("upnp_enable");
if (value == 0 || atoi(value) == 0) {
igd_stop_handler();
return;
}
if (igd_running == 0) {
igd_down = 0;
cyg_thread_create(
IGD_PRIORITY,
(cyg_thread_entry_t *)&igd_main,
0,
"IGD",
igd_main_stack,
sizeof(igd_main_stack),
&igd_main_tid,
&igd_main_thread);
cyg_thread_resume(igd_main_tid);
/* Wait until thread scheduled */
while (!igd_running && !igd_down)
cyg_thread_delay(1);
}
return;
}
开发者ID:jameshilliard,项目名称:broadcom-hnd,代码行数:36,代码来源:igd_ecos_main.c
示例8: program_flash
static void
program_flash(cyg_addrword_t arg)
{
diag_printf("PROGRAM FLASH here!\n");
HAL_UCACHE_SYNC(); // ROM space is marked cacheable which causes problems!
HAL_UCACHE_DISABLE(); // So, just disable caches.
identify_FLASH();
diag_printf("About to program FLASH using data at %x..%x\n", flash_buffer, flash_buffer_end);
diag_printf("*** Press RESET now to abort!\n");
cyg_thread_delay(5*100);
diag_printf("\n");
diag_printf("... Erase sector\n");
if (erase_sector(ROM_address)) {
diag_printf("... Programming FLASH\n");
while (flash_buffer < flash_buffer_end) {
if (!write_flash(flash_buffer++, ROM_address++)) break;
}
}
// Exit Program Mode
switch (manuf_code) {
case ATMEL_MANUF:
FLASH[ATMEL_SEQ_ADD1] = ATMEL_START_CMD1;
FLASH[ATMEL_SEQ_ADD2] = ATMEL_START_CMD2;
FLASH[ATMEL_SEQ_ADD1] = ATMEL_STOP_CMD;
break;
case INTEL_MANUF:
FLASH[0] = INTEL_STOP_CMD;
break;
}
diag_printf("All done!\n");
cyg_test_exit();
}
开发者ID:0xCA5A,项目名称:dd-wrt,代码行数:33,代码来源:prog_flash.c
示例9: simple_programB
void simple_programB(cyg_addrword_t data)
{
int msg = (int) data;
int delay;
printf("Starting thread : %d\n",msg);
cyg_thread_delay(200);
for(;;)
{
delay = 200 + (rand()%50);
resFree(resAllocated);
cyg_mutex_lock(&mut_t);
printf("Allocating resource for thread %d\n", msg);
cyg_mutex_unlock(&mut_t);
cyg_thread_delay(delay);
}
}
开发者ID:Bhaskarjyoti,项目名称:MtechAOS,代码行数:16,代码来源:ecosnew.c
示例10: identify_FLASH
void
identify_FLASH(void )
{
// Enter Software Product Identification Mode
FLASH[ATMEL_SEQ_ADD1] = ATMEL_START_CMD1;
FLASH[ATMEL_SEQ_ADD2] = ATMEL_START_CMD2;
FLASH[ATMEL_SEQ_ADD1] = ATMEL_ID_CMD;
// Wait at least 10ms
cyg_thread_delay(2);
// Read Manufacturer and device code from the device
manuf_code = FLASH[0] >> 16;
device_code = FLASH[1] >> 16;
diag_printf("manufacturer: 0x%04x, device: 0x%04x\n", manuf_code, device_code);
// Exit Software Product Identification Mode
switch (manuf_code) {
case ATMEL_MANUF:
FLASH[ATMEL_SEQ_ADD1] = ATMEL_START_CMD1;
FLASH[ATMEL_SEQ_ADD2] = ATMEL_START_CMD2;
FLASH[ATMEL_SEQ_ADD1] = ATMEL_STOP_CMD;
break;
case INTEL_MANUF:
FLASH[0] = INTEL_STOP_CMD;
break;
default:
diag_printf("Unrecognized FLASH manufacturer - I give up!\n");
cyg_test_exit();
}
}
开发者ID:0xCA5A,项目名称:dd-wrt,代码行数:32,代码来源:prog_flash.c
示例11: e_thread_delay
static int
e_thread_delay(lua_State *L)
{
int delay = luaL_checkint(L, 1);
cyg_thread_delay(delay);
return 0;
}
开发者ID:mambrus,项目名称:bitfire,代码行数:7,代码来源:lthreadlib.c
示例12: thread_a
// Thread A - signals thread B via semaphore.
void thread_a(cyg_addrword_t data)
{
// Store the data value passed in for this thread.
int msg = (int)data;
weak_function ();
while(thread_a_count < 5)
{
// Increment the thread a count.
thread_a_count++;
// Send out a message to the diagnostic port.
diag_printf("INFO:<Thread A, count: %d message: %d>\n", thread_a_count, msg);
// Delay for 1 second.
cyg_thread_delay(100);
// Signal thread B using the semaphore.
cyg_semaphore_post(&sem_signal_thread);
}
CYG_TEST_CHECK(weak_fn_called == 2 , "Application week function not called");
CYG_TEST_FINISH("Object loader test finished");
}
开发者ID:Palantir555,项目名称:ecos-mars-zx3,代码行数:27,代码来源:hello.c
示例13: net_test
void
net_test(cyg_addrword_t param)
{
extern void cyg_net_snmp_init(void);
CYG_TEST_INIT();
CYG_TEST_INFO("Start multiple SNMP server test");
init_all_network_interfaces();
autohost_init();
cyg_net_snmp_init();
TNR_INIT();
// Now command the host to do ping to us...
#ifdef CYGHWR_NET_DRIVER_ETH0
if (eth0_up) {
do_snmp_tests(ð0_bootp_data, 3, TESTTIME);
}
#endif
#ifdef CYGHWR_NET_DRIVER_ETH1
if (eth1_up) {
do_snmp_tests(ð1_bootp_data, 3, TESTTIME);
}
#endif
// Let the server run for 5 minutes
cyg_thread_delay(2*100); // let the stuff start up first
TNR_ON();
cyg_thread_delay(TESTTIME*100); // FIXME - assume cS clock.
// Additional delay 'cos host may be slower than us - and it has to
// complete a transfer anyway:
cyg_thread_delay( 30 *100); // FIXME - assume cS clock.
TNR_OFF();
autohost_end( 3 * (0
#ifdef CYGHWR_NET_DRIVER_ETH0
+ eth0_up
#endif
#ifdef CYGHWR_NET_DRIVER_ETH1
+ eth1_up
#endif
) ); // check for N pass messages from hosts
TNR_PRINT_ACTIVITY();
CYG_TEST_EXIT("Done");
}
开发者ID:Palantir555,项目名称:ecos-mars-zx3,代码行数:47,代码来源:snmpmulti.c
示例14: nas_sleep_ms
void
nas_sleep_ms(uint ms)
{
cyg_tick_count_t ostick;
ostick = ms / 10;
cyg_thread_delay(ostick);
}
开发者ID:NieHao,项目名称:Tomato-RAF,代码行数:8,代码来源:nas_ecos.c
示例15: hipri_test
void
hipri_test(CYG_ADDRESS id)
{
while( 1 )
{
cyg_thread_delay( CYGNUM_KERNEL_SCHED_TIMESLICE_TICKS/2 );
}
}
开发者ID:SQGiggsHuang,项目名称:ecosgit,代码行数:8,代码来源:timeslice2.c
示例16: cyg_httpd_init
static void cyg_httpd_init(cyg_addrword_t arg)
{
int i;
int err = 0;
/* Delay for a configurable length of time to give the application
* a chance to get going, or even complete, without interference
* from the HTTPD.
*/
if( CYGNUM_HTTPD_SERVER_DELAY > 0 )
{
cyg_thread_delay( CYGNUM_HTTPD_SERVER_DELAY );
}
server_address.sin_family = AF_INET;
server_address.sin_len = sizeof(server_address);
server_address.sin_addr.s_addr = INADDR_ANY;
server_address.sin_port = htons(CYGNUM_HTTPD_SERVER_PORT);
/* Get the network going. This is benign if the application has
* already done this.
*/
init_all_network_interfaces();
/* Create and bind the server socket.
*/
server_socket = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
CYG_ASSERT( server_socket > 0, "Socket create failed");
err = bind( server_socket, (struct sockaddr *)&server_address,
sizeof(server_address) );
CYG_ASSERT( err == 0, "bind() returned error");
err = listen( server_socket, SOMAXCONN );
CYG_ASSERT( err == 0, "listen() returned error" );
/* If we are configured to have more than one server thread,
* create them now.
*/
for( i = 1; i < CYGNUM_HTTPD_THREAD_COUNT; i++ )
{
cyg_thread_create( CYGNUM_HTTPD_THREAD_PRIORITY,
cyg_httpd_server,
0,
"HTTPD",
&httpd_stacks[i][0],
sizeof(httpd_stacks[i]),
&httpd_thread[i],
&httpd_thread_object[i]
);
cyg_thread_resume( httpd_thread[i] );
}
/* Now go be a server ourself.
*/
cyg_httpd_server(arg);
}
开发者ID:Joel397,项目名称:Ongoing_work_files,代码行数:58,代码来源:httpd.c
示例17: do_delay
static void
do_delay(int ticks)
{
#ifdef CYGPKG_KERNEL
cyg_thread_delay(ticks);
#else
CYGACC_CALL_IF_DELAY_US(10000*ticks);
#endif
}
开发者ID:axonim,项目名称:ecos-ax-som-bf609,代码行数:9,代码来源:assabet_pcmcia.c
示例18: main
int main( int argc, char *argv[] )
{
int i;
HAL_DCACHE_ENABLE();
printf("begin mutex_test_posix\n");
// initialize mutex with default attributes
pthread_mutex_init(&mutex, NULL);
pthread_mutex_lock(&mutex);
printf("creating hw thread... ");
POSIX_HWT_CREATE(0,0,thread_resources);
printf("ok\n");
cyg_thread_delay(50);
for(i = 0; i < 10; i++){
unsigned long ticks = cyg_current_time();
//printf("current time = %ld ticks\n",ticks); // XXX remove
pthread_mutex_unlock(&mutex);
while(cyg_current_time() - ticks < 10); // wait for 0.1 seconds
pthread_mutex_lock(&mutex);
ticks = cyg_current_time() - ticks;
//printf("delta t = %ld ticks\n", ticks); // XXX remove
printf("mutex lock and release by hwthread: ");
if(ticks > 20 && ticks < 40){
printf("success\n");
}
else if(ticks <= 20){
printf("too early\n"); // should not happen
}
else {
printf("too late\n"); // should not happen
}
cyg_thread_delay(50);
}
printf("mutex_test_posix done.\n");
return 0;
}
开发者ID:notooth,项目名称:reconos,代码行数:44,代码来源:mutex_test_posix.c
示例19: tftp_test
static void
tftp_test(struct bootp *bp)
{
int server_id, res;
extern struct tftpd_fileops dummy_fileops;
server_id = tftpd_start(0, &dummy_fileops);
if (server_id > 0) {
diag_printf("TFTP server created - id: %x\n", server_id);
// Only let the server run for 5 minutes
cyg_thread_delay(2*100); // let the tftpd start up first
TNR_ON();
cyg_thread_delay(5*60*100);
TNR_OFF();
res = tftpd_stop(server_id);
diag_printf("TFTP server stopped - res: %d\n", res);
} else {
diag_printf("Couldn't create a server!\n");
}
}
开发者ID:LucidOne,项目名称:Rovio,代码行数:19,代码来源:tftp_server_test.c
示例20: simple_multi_thread
int simple_multi_thread(void)
{
NET_DATA_T netdata1, netdata2, netdata3, netdata4, netdata5, netdata6, netdata7;
netdata1.iport = 40;
netdata1.pbuf = (char*)NON_CACHE(g_RemoteNet_Buf1);
netdata2.iport = 41;
netdata2.pbuf = (char*)NON_CACHE(g_RemoteNet_Buf2);
netdata3.iport = 42;
netdata3.pbuf = (char*)NON_CACHE(g_RemoteNet_Buf3);
netdata4.iport = 43;
netdata4.pbuf = (char*)NON_CACHE(g_RemoteNet_Buf4);
netdata5.iport = 44;
netdata5.pbuf = (char*)NON_CACHE(g_RemoteNet_Buf5);
netdata6.iport = 45;
netdata6.pbuf = (char*)NON_CACHE(g_RemoteNet_Buf6);
netdata7.iport = 46;
netdata7.pbuf = (char*)NON_CACHE(g_RemoteNet_Buf7);
cyg_thread_create(THREAD_PRIORITY, &simple_tcpserver, (cyg_addrword_t)&netdata1, "simple_tcpserver1",
thread_stack1, STACK_SIZE, &thread_handle1, &thread1);
cyg_thread_create(THREAD_PRIORITY, &simple_tcpserver, (cyg_addrword_t)&netdata2, "simple_tcpserver2",
thread_stack2, STACK_SIZE, &thread_handle2, &thread2);
cyg_thread_create(THREAD_PRIORITY, &simple_tcpserver, (cyg_addrword_t)&netdata3, "simple_tcpserver3",
thread_stack3, STACK_SIZE, &thread_handle3, &thread3);
cyg_thread_create(THREAD_PRIORITY, &simple_tcpserver, (cyg_addrword_t)&netdata4, "simple_tcpserver4",
thread_stack4, STACK_SIZE, &thread_handle4, &thread4);
cyg_thread_create(THREAD_PRIORITY, &simple_tcpserver, (cyg_addrword_t)&netdata5, "simple_tcpserver5",
thread_stack5, STACK_SIZE, &thread_handle5, &thread5);
cyg_thread_create(THREAD_PRIORITY, &simple_tcpserver, (cyg_addrword_t)&netdata6, "simple_tcpserver6",
thread_stack6, STACK_SIZE, &thread_handle6, &thread6);
//cyg_thread_create(THREAD_PRIORITY, &simple_tcpserver, (cyg_addrword_t)&netdata7, "simple_tcpserver7",
// thread_stack7, STACK_SIZE, &thread_handle7, &thread7);
/*
cyg_thread_create(THREAD_PRIORITY, &simple_udpserver, (cyg_addrword_t)&netdata1, "simple_udpserver1",
thread_stack1, STACK_SIZE, &thread_handle1, &thread1);
cyg_thread_create(THREAD_PRIORITY, &simple_udpserver, (cyg_addrword_t)&netdata2, "simple_udpserver2",
thread_stack2, STACK_SIZE, &thread_handle2, &thread2);
cyg_thread_create(THREAD_PRIORITY, &simple_udpserver, (cyg_addrword_t)&netdata3, "simple_udpserver3",
thread_stack3, STACK_SIZE, &thread_handle3, &thread3);
*/
tbegin = cyg_current_time();
cyg_thread_resume(thread_handle1);
cyg_thread_resume(thread_handle2);
cyg_thread_resume(thread_handle3);
cyg_thread_resume(thread_handle4);
cyg_thread_resume(thread_handle5);
cyg_thread_resume(thread_handle6);
//cyg_thread_resume(thread_handle7);
while(1)
{
cyg_thread_delay(100000);
}
}
开发者ID:LucidOne,项目名称:Rovio,代码行数:55,代码来源:RemoteBoundaryTest.c
注:本文中的cyg_thread_delay函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论