亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? demo.c

?? Nucleus實時操作系統是Accelerater Technology公司開發的嵌入式RTOS產品,Nucleus的核心是一個實時的多任務內核——Nucleus PLUS
?? C
字號:
/* Include necessary Nucleus PLUS files.  */

#include  "nucleus.h"
#include  "string.h"
#include  "stdlib.h"

struct LAPDL{
	int	length;
	char *info;
}*rdl,*dl0;

struct q921{
	unsigned char link;
	unsigned char status;
	unsigned char self;
	unsigned char peer;
	unsigned char lap3;
	unsigned char  rej;
	unsigned char ack;
	unsigned char channalc;
	unsigned char rc;
	unsigned char pf;
	unsigned char pending;
	unsigned char vs;
	unsigned char vr;
	unsigned char va;
	int i,j;
}pstn;

/* Define Application data structures.  */

NU_TASK         Task_0;
NU_TASK         Task_1;
NU_TASK         Task_2;
NU_TASK         Task_3;
NU_TASK         Task_4;
NU_TASK         Task_5;


UNSIGNED        *LEDADDR=(UNSIGNED *)0x60000;
NU_QUEUE        Queue_0;
NU_PIPE	Pipe_0;
NU_SEMAPHORE    Semaphore_0;
NU_EVENT_GROUP  Event_Group_0;
NU_MEMORY_POOL  System_Memory;


/* Allocate global counters. */
UNSIGNED  Task_Time;
UNSIGNED  Task_2_messages_received;
UNSIGNED  Task_2_invalid_messages;
UNSIGNED  Task_1_messages_sent;
NU_TASK  *Who_has_the_resource;
NU_TIMER timer;
UNSIGNED  Event_Detections;


/* Define prototypes for function references.  */
void    task_0(UNSIGNED argc, VOID *argv);
void    task_1(UNSIGNED argc, VOID *argv);
void    task_2(UNSIGNED argc, VOID *argv);
void    task_3_and_4(UNSIGNED argc, VOID *argv);
void    task_5(UNSIGNED argc, VOID *argv);
void 	timer_expire();

/* Define the Application_Initialize routine that determines the initial
   Nucleus PLUS application environment.  */
   
void    Application_Initialize(void *first_available_memory)
{

VOID           *pointer;


    /* Create a system memory pool that will be used to allocate task stacks,
       queue areas, etc.  */
    NU_Create_Memory_Pool(&System_Memory, "SYSMEM", 
                        first_available_memory, 4096, 50, NU_FIFO);
                        
    /* Create each task in the system.  */
    
    /* Create task 0.  */
    NU_Allocate_Memory(&System_Memory, &pointer, 500, NU_NO_SUSPEND);
    NU_Create_Task(&Task_0, "TASK 0", task_0, 0, NU_NULL, pointer, 500, 1, 20,
                                                      NU_PREEMPT, NU_START);

    /* Create task 1.  */
    NU_Allocate_Memory(&System_Memory, &pointer, 500, NU_NO_SUSPEND);
    NU_Create_Task(&Task_1, "TASK 1", task_1, 0, NU_NULL, pointer, 500, 10, 5,
                                                      NU_PREEMPT, NU_START);

    /* Create task 2.  */
    NU_Allocate_Memory(&System_Memory, &pointer, 500, NU_NO_SUSPEND);
    NU_Create_Task(&Task_2, "TASK 2", task_2, 0, NU_NULL, pointer, 500, 10, 5,
                                                      NU_PREEMPT, NU_START);
	
    /* Create task 3.  Note that task 4 uses the same instruction area.  */
    NU_Allocate_Memory(&System_Memory, &pointer, 500, NU_NO_SUSPEND);
    NU_Create_Task(&Task_3, "TASK 3", task_3_and_4, 0, NU_NULL, pointer, 
                                        500, 5, 0, NU_PREEMPT, NU_START);

    /* Create task 4.  Note that task 3 uses the same instruction area.  */
    NU_Allocate_Memory(&System_Memory, &pointer, 500, NU_NO_SUSPEND);
    NU_Create_Task(&Task_4, "TASK 4", task_3_and_4, 0, NU_NULL, pointer, 
                                        500, 5, 0, NU_PREEMPT, NU_START);

    /* Create task 5.  */
    NU_Allocate_Memory(&System_Memory, &pointer, 500, NU_NO_SUSPEND);
    NU_Create_Task(&Task_5, "TASK 5", task_5, 0, NU_NULL, pointer, 500, 7, 0, 
                                                      NU_PREEMPT, NU_START);


    /* Create communication queue.  */
    NU_Allocate_Memory(&System_Memory, &pointer, 100*sizeof(UNSIGNED), 
                                                        NU_NO_SUSPEND);
    NU_Create_Queue(&Queue_0, "QUEUE 0", pointer, 100, NU_FIXED_SIZE, 1, 
                                                                      NU_FIFO);

    NU_Create_Pipe(&Pipe_0,"PIPE 0",pointer,2600,NU_VARIABLE_SIZE,10,NU_FIFO);
    /* Create synchronization semaphore.  */
    NU_Create_Semaphore(&Semaphore_0, "SEM 0", 1, NU_FIFO);
    
    /* Create event flag group.  */
    NU_Create_Event_Group(&Event_Group_0, "EVGROUP0");
	NU_Create_Timer(&timer,"any name",timer_expire,0,23,5,NU_ENABLE_TIMER);
}


/* Define the system timer task.  More complicated systems might use a 
   routine like this to perform periodic message sending and other time
   oriented functions.  */


void   task_0(UNSIGNED argc, VOID *argv)
{
	int i;
	UNSIGNED send_message;
STATUS          status;
/* STATUS	led;
int 	i; */

    /* Access argc and argv just to avoid compilation warnings.  */
    status =  (STATUS) argc + (STATUS) argv;
/*	led=0;*/
    /* Set the clock to 0.  This clock ticks every 18 system timer ticks. */
    Task_Time =  0;
/*	i=1;*/
    while(1)
    {
    
        /* Sleep for 18 timer ticks.  The value of the tick is programmable
           in INT_SIM.S and is relative to the speed of the target system.  */
        NU_Sleep(18);
        		NU_Sleep(100);
		
//		status=NU_Send_To_Pipe(&pipe_ifr,frm0,sizeof(struct frame),NU_SUSPEND);
//		status=NU_Send_To_Queue(&queue_dl,&send_message,1,NU_SUSPEND);
		i=4;
		send_message=100;
		
		if(i==4){
			pstn.status=8;
			NU_Send_To_Queue(&Queue_0,&send_message,1,NU_SUSPEND);
			NU_Sleep(1);
			i=3;
		}
		
		if(i==3){
			pstn.status=7;
			NU_Send_To_Queue(&Queue_0,&send_message,1,NU_SUSPEND);
			NU_Sleep(1);
			i=2;
		}

		if(i==2){
			pstn.status=5;
			NU_Send_To_Queue(&Queue_0,&send_message,1,NU_SUSPEND);
			NU_Sleep(1);
			i=1;
		}

		if(i==1){
			pstn.status=9;
			NU_Send_To_Queue(&Queue_0,&send_message,1,NU_SUSPEND);
			NU_Sleep(1);
			i=4;
		}
/*        *LEDADDR=i;
		i=i<<1;
		if(i>=64) i=1;        */

        /* Increment the time.  */
        Task_Time++;
        
        /* Set an event flag to lift the suspension on task 5.  */
        status =  NU_Set_Events(&Event_Group_0, 1, NU_OR);
    }
}


/* Define the queue sending task.  Note that the only things that cause
   this task to suspend are queue full conditions and the time slice
   specified in the configuration file.  */

void   task_1(UNSIGNED argc, VOID *argv)
{

STATUS         status; 
UNSIGNED       Send_Message;
char *ch="1234567890";
int i;
    /* Access argc and argv just to avoid compilation warnings.  */
    status =  (STATUS) argc + (STATUS) argv;

    /* Initialize the message counter.  */
    Task_1_messages_sent =  0;

    /* Initialize the message contents.  The receiver will examine the 
       message contents for errors.  */
	rdl=malloc(sizeof(struct LAPDL));
	Send_Message = 0;
	i=0;    
	rdl->length=10;
	rdl->info=malloc(strlen(ch)*sizeof(char));
	rdl->info=strcpy(rdl->info,"1234567890");
    while(1)
    {
    
         /* Send the message to Queue_0, which task 2 reads from.  Note
            that if the destination queue fills up this task suspends until
            room becomes available.  */
         NU_Sleep(18);
         status=NU_Send_To_Pipe(&Pipe_0,rdl,sizeof(struct LAPDL),NU_SUSPEND);
/*         status =  NU_Send_To_Queue(&Queue_0, &Send_Message, 1, NU_SUSPEND);*/
         
         /* Determine if the message was sent successfully.  */
/*         if (status == NU_SUCCESS){*/
/*       		*LEDADDR=i;*/
/*       		i++;
       		if(i>63) i=0;*/
       		
       		if(status==NU_SUCCESS){
       			*LEDADDR=i;
       			i++;
       			if(i>63) i=0;
       		}
             Task_1_messages_sent++;
         
             
         /* Modify the contents of the next message to send.  */
         Send_Message++;
    }
}


/* Define the queue receiving task.  Note that the only things that cause
   this task to suspend are queue empty conditions and the time slice
   specified in the configuration file.   */

void   task_2(UNSIGNED argc, VOID *argv)
{

STATUS         status; 
UNSIGNED       Receive_Message;
UNSIGNED       received_size;
UNSIGNED       message_expected;
CHAR  name[8];
VOID *start_address;
UNSIGNED pipe_size,available,messages,message_size,tasks_waiting;
OPTION message_type,suspend_type;
NU_TASK *first_task;
int i;
    /* Access argc and argv just to avoid compilation warnings.  */
    status =  (STATUS) argc + (STATUS) argv;

    /* Initialize the message counter.  */
    Task_2_messages_received =  0;

    /* Initialize the message error counter.  */
    Task_2_invalid_messages =  0;

    /* Initialize the message contents to expect.  */
    message_expected =  0;
    dl0=malloc(sizeof(struct LAPDL));
    i=0;
    while(1)
    {
    
	NU_Sleep(50);         
/* Retrieve a message from Queue_0, which task 1 writes to.  Note
            that if the source queue is empty this task suspends until
            something becomes available.  */
         NU_Pipe_Information(&Pipe_0,name,&start_address,&pipe_size,&available,&messages,
         	&message_type,&message_size,&suspend_type,&tasks_waiting,&first_task);
 
         status =  NU_Receive_From_Pipe(&Pipe_0, dl0, sizeof(struct LAPDL), 
                                &received_size, NU_SUSPEND);
        
         /* Determine if the message was received successfully.  */
         if (status == NU_SUCCESS){
/*        		*LEDADDR=i;*/
        		i++;
        		if(i>63) i=0; 
             Task_2_messages_received++;
         }    
         /* Check the contents of the message against what this task
            is expecting.  */
         if ((received_size != 1) ||
             (Receive_Message != message_expected))
             Task_2_invalid_messages++;
         
         /* Modify the expected contents of the next message.  */
         message_expected++;
    }
}


/* Tasks 3 and 4 want a single resource.  Once one of the tasks gets the
   resource, it keeps it for 30 clock ticks before releasing it.  During
   this time the other task suspends waiting for the resource.  Note that
   both task 3 and 4 use the same instruction areas but have different 
   stacks.  */
   
void  task_3_and_4(UNSIGNED argc, VOID *argv)
{

STATUS  status;

    /* Access argc and argv just to avoid compilation warnings.  */
    status =  (STATUS) argc + (STATUS) argv;

    /* Loop to allocate and deallocate the resource.  */
    while(1)
    {
    
         /* Allocate the resource.  Suspend until it becomes available.  */
         status =  NU_Obtain_Semaphore(&Semaphore_0, NU_SUSPEND);
         
         /* If the status is successful, show that this task owns the 
            resource.  */
         if (status ==  NU_SUCCESS)
         {
         
             Who_has_the_resource =  NU_Current_Task_Pointer();
             
             /* Sleep for 100 ticks to cause the other task to suspend on 
                the resource.  */
             NU_Sleep(100);
             
             /* Release the semaphore.  */
             NU_Release_Semaphore(&Semaphore_0);
        }
    }
}

	
/* Define the task that waits for the event to be set by task 0.  */

void  task_5(UNSIGNED argc, VOID *argv)
{

STATUS        status;
UNSIGNED      event_group;


    /* Access argc and argv just to avoid compilation warnings.  */
    status =  (STATUS) argc + (STATUS) argv;

    /* Initialize the event detection counter.  */
    Event_Detections =  0;
    
    /* Continue this process forever.  */
    while(1)
    {
    
        /* Wait for an event and consume it.  */
        status =  NU_Retrieve_Events(&Event_Group_0, 1, NU_OR_CONSUME,
                                     &event_group, NU_SUSPEND);
                          
        /* If the status is okay, increment the counter.  */
        if (status == NU_SUCCESS)
           Event_Detections++;
    }
}

void timer_expire()
{
	;
}


?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
免费成人美女在线观看.| 国产69精品久久久久777| 九九九精品视频| 99视频超级精品| 日韩精品在线一区二区| 一区二区三区精密机械公司| 精品一区二区三区在线观看国产| 色综合久久综合中文综合网| 久久精品一区二区三区不卡 | 91精品国产麻豆国产自产在线| 久久毛片高清国产| 日韩国产成人精品| 欧美性xxxxx极品少妇| 亚洲你懂的在线视频| 国产91精品一区二区| 精品国产精品网麻豆系列| 亚洲电影中文字幕在线观看| 色香色香欲天天天影视综合网| 久久精品亚洲精品国产欧美| 久久99热这里只有精品| 欧美日韩国产一二三| 亚洲一区二区在线视频| 色屁屁一区二区| 中文字幕一区二区三区蜜月| 国产99久久久国产精品免费看| 精品国产乱码久久| 精品中文字幕一区二区小辣椒| 91精品中文字幕一区二区三区| 亚洲国产视频直播| 在线观看不卡一区| 亚洲国产精品欧美一二99| 一本色道a无线码一区v| 亚洲卡通欧美制服中文| 一道本成人在线| 亚洲一区二区在线视频| 欧美日韩高清一区二区| 肉色丝袜一区二区| 欧美精品第1页| 久久国产精品一区二区| 欧美精品一区二区在线播放| 国产精品一二三区| 亚洲国产成人在线| 91亚洲国产成人精品一区二三| 中文字幕欧美一区| 91免费看片在线观看| 亚洲免费毛片网站| 欧美日韩一级视频| 青草av.久久免费一区| 26uuu国产在线精品一区二区| 黄页视频在线91| 久久久国产精品午夜一区ai换脸| 风流少妇一区二区| 亚洲免费毛片网站| 欧美一级理论性理论a| 国产剧情一区二区三区| 欧美高清在线一区| 欧美性一二三区| 激情综合网最新| 亚洲视频小说图片| 欧美一区日韩一区| 成人动漫视频在线| 五月婷婷综合激情| 亚洲国产成人午夜在线一区 | 成人精品小蝌蚪| 亚洲综合色丁香婷婷六月图片| 日韩美女一区二区三区四区| 成人手机电影网| 亚洲一级二级三级| 久久综合九色综合97_久久久| 99久久久国产精品| 麻豆国产一区二区| 综合久久国产九一剧情麻豆| 在线播放91灌醉迷j高跟美女| 国产精品1区二区.| 亚洲第一会所有码转帖| 国产欧美1区2区3区| 欧美日本一道本在线视频| 国产成人av资源| 日本91福利区| 亚洲乱码国产乱码精品精可以看 | 国产精品一区久久久久| 亚洲国产aⅴ天堂久久| 国产亚洲视频系列| 51久久夜色精品国产麻豆| 99久久久精品| 国产精品一线二线三线精华| 偷拍自拍另类欧美| 中文字幕日韩av资源站| 久久久久国产精品麻豆ai换脸| 欧美精品少妇一区二区三区| 99久久免费视频.com| 国产精品亚洲综合一区在线观看| 亚洲国产一区视频| 日韩美女视频19| 欧美国产乱子伦| 久久免费电影网| 精品少妇一区二区三区在线视频| 91国偷自产一区二区开放时间| 国产精品一区二区91| 男人的天堂亚洲一区| 亚洲国产日韩综合久久精品| 国产精品久久99| 国产日产精品一区| 精品久久国产老人久久综合| 7777女厕盗摄久久久| 91视频.com| 成人黄色免费短视频| 岛国一区二区三区| 国产大陆精品国产| 国产一区二区免费视频| 极品少妇xxxx精品少妇| 美女视频第一区二区三区免费观看网站| 一区二区三区国产豹纹内裤在线| 亚洲免费在线看| 亚洲综合在线观看视频| 亚洲国产wwwccc36天堂| 三级不卡在线观看| 久久精品国产在热久久| 高清免费成人av| 成人午夜视频网站| 91在线免费播放| 欧美亚洲一区二区三区四区| 欧美午夜精品一区二区蜜桃| 911精品国产一区二区在线| 日韩欧美一二区| 精品国产一区二区三区四区四| 久久婷婷色综合| 欧美国产成人精品| 亚洲综合精品自拍| 日本成人在线视频网站| 精品一二三四区| 国产精品一区二区三区网站| 丰满亚洲少妇av| 欧美在线视频不卡| 日韩一区二区免费视频| 欧美极品美女视频| 一区二区三区欧美| 美女性感视频久久| 成人高清免费观看| 欧美无人高清视频在线观看| 日韩欧美高清一区| 国产精品久久午夜| 亚洲成精国产精品女| 国产一区视频导航| 色婷婷激情一区二区三区| 日韩视频一区二区| 中文字幕中文乱码欧美一区二区| 亚洲大型综合色站| 国产在线播精品第三| 色综合一个色综合亚洲| 日韩视频一区在线观看| 国产精品久久久久久久久免费樱桃 | 欧美日韩高清影院| 国产亚洲一二三区| 亚洲h精品动漫在线观看| 国产精品资源在线| 91精品国产一区二区人妖| 国产精品久久久久久亚洲毛片 | 99亚偷拍自图区亚洲| 91精品国产综合久久精品麻豆| 欧美韩日一区二区三区| 亚洲成av人片在线观看无码| 国产成人精品午夜视频免费| 欧美美女网站色| 亚洲女同一区二区| 国产精选一区二区三区| 欧美福利视频导航| 国产精品剧情在线亚洲| 国产综合色在线视频区| 欧美久久一区二区| 亚洲三级电影网站| 国产福利电影一区二区三区| 777午夜精品免费视频| 亚洲日本一区二区| 激情五月婷婷综合| 欧美一级理论片| 天天色天天爱天天射综合| 97超碰欧美中文字幕| 久久综合久久鬼色中文字| 天堂久久久久va久久久久| 97精品久久久午夜一区二区三区 | 色香色香欲天天天影视综合网| 国产农村妇女毛片精品久久麻豆 | 国产最新精品精品你懂的| 337p亚洲精品色噜噜| 亚洲国产aⅴ天堂久久| 97久久精品人人做人人爽| 中文字幕av不卡| 国产成人免费在线观看| 精品国产乱码久久久久久蜜臀 | 亚洲妇熟xx妇色黄| 在线看不卡av| 亚洲一区二区黄色| 在线免费av一区| 亚洲图片欧美一区| 欧美日韩久久一区二区| 亚洲成人精品在线观看| 欧美特级限制片免费在线观看| 亚洲愉拍自拍另类高清精品| 91精彩视频在线|