⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 os_core.s43

📁 ucos2.52在msp430上移植
💻 S43
📖 第 1 页 / 共 5 页
字号:
; 416.	
; 417.	/*$PAGE*/
; 418.	/*
; 419.	*********************************************************************************************************
; 420.	*                                            DUMMY FUNCTION
; 421.	*
; 422.	* Description: This function doesn't do anything.  It is called by OSTaskDel().
; 423.	*
; 424.	* Arguments  : none
; 425.	*
; 426.	* Returns    : none
; 427.	*********************************************************************************************************
; 428.	*/
; 429.	
; 430.	#if OS_TASK_DEL_EN > 0
; 431.	void  OS_Dummy (void)
; 432.	{
; 433.	}
	RET		
OS_EventTaskRdy:
; 434.	#endif
; 435.	
; 436.	/*$PAGE*/
; 437.	/*
; 438.	*********************************************************************************************************
; 439.	*                             MAKE TASK READY TO RUN BASED ON EVENT OCCURING
; 440.	*
; 441.	* Description: This function is called by other uC/OS-II services and is used to ready a task that was
; 442.	*              waiting for an event to occur.
; 443.	*
; 444.	* Arguments  : pevent    is a pointer to the event control block corresponding to the event.
; 445.	*
; 446.	*              msg       is a pointer to a message.  This pointer is used by message oriented services
; 447.	*                        such as MAILBOXEs and QUEUEs.  The pointer is not used when called by other
; 448.	*                        service functions.
; 449.	*
; 450.	*              msk       is a mask that is used to clear the status byte of the TCB.  For example,
; 451.	*                        OSSemPost() will pass OS_STAT_SEM, OSMboxPost() will pass OS_STAT_MBOX etc.
; 452.	*
; 453.	* Returns    : none
; 454.	*
; 455.	* Note       : This function is INTERNAL to uC/OS-II and your application should not call it.
; 456.	*********************************************************************************************************
; 457.	*/
; 458.	#if OS_EVENT_EN > 0
; 459.	INT8U  OS_EventTaskRdy (OS_EVENT *pevent, void *msg, INT8U msk)
; 460.	{
	PUSH	R10	
	PUSH	R11	
	PUSH	R8	
	PUSH	R9	
	PUSH	R6	
	MOV.B	12(SP),R15	
; 461.	    OS_TCB *ptcb;
; 462.	    INT8U   x;
; 463.	    INT8U   y;
; 464.	    INT8U   bitx;
; 465.	    INT8U   bity;
; 466.	    INT8U   prio;
; 467.	
; 468.	
; 469.	    y    = OSUnMapTbl[pevent->OSEventGrp];            /* Find highest prio. task waiting for message   */
	MOV.B	1(R12),R13	
	MOV.B	OSUnMapTbl(R13),R10	
; 470.	    bity = OSMapTbl[y];
	MOV.B	R10,R13	
	MOV.B	OSMapTbl(R13),R11	
; 471.	    x    = OSUnMapTbl[pevent->OSEventTbl[y]];
	MOV.B	R10,R13	
	ADD	R12,R13	
	MOV.B	6(R13),R13	
	MOV.B	OSUnMapTbl(R13),R9	
; 472.	    bitx = OSMapTbl[x];
	MOV.B	R9,R13	
	MOV.B	OSMapTbl(R13),R8	
; 473.	    prio = (INT8U)((y << 3) + x);                     /* Find priority of task getting the msg         */
	MOV.B	R10,R13	
	ADD.B	R13,R13	
	ADD.B	R13,R13	
	ADD.B	R13,R13	
	ADD.B	R9,R13	
; 474.	    if ((pevent->OSEventTbl[y] &= ~bitx) == 0x00) {   /* Remove this task from the waiting list        */
	MOV.B	R10,R9	
	ADD	R12,R9	
	MOV.B	R8,R6	
	XOR.B	#-1,R6	
	AND.B	R6,6(R9)	
	CMP.B	#0,6(R9)	
	JNE	(?0109)	
; 475.	        pevent->OSEventGrp &= ~bity;                  /* Clr group bit if this was only task pending   */
	MOV.B	R11,R9	
	XOR.B	#-1,R9	
	AND.B	R9,1(R12)	
?0109:
; 476.	    }
; 477.	    ptcb                 =  OSTCBPrioTbl[prio];       /* Point to this task's OS_TCB                   */
	MOV.B	R13,R9	
	ADD	R9,R9	
	MOV	OSTCBPrioTbl(R9),R12	
; 478.	    ptcb->OSTCBDly       =  0;                        /* Prevent OSTimeTick() from readying task       */
	MOV	#0,26(R12)	
; 479.	    ptcb->OSTCBEventPtr  = (OS_EVENT *)0;             /* Unlink ECB from this task                     */
	MOV	#0,18(R12)	
; 480.	#if ((OS_Q_EN > 0) && (OS_MAX_QS > 0)) || (OS_MBOX_EN > 0)
; 481.	    ptcb->OSTCBMsg       = msg;                       /* Send message directly to waiting task         */
	MOV	R14,20(R12)	
; 482.	#else
; 483.	    msg                  = msg;                       /* Prevent compiler warning if not used          */
; 484.	#endif
; 485.	    ptcb->OSTCBStat     &= ~msk;                      /* Clear bit associated with event type          */
	XOR.B	#-1,R15	
	AND.B	R15,28(R12)	
; 486.	    if (ptcb->OSTCBStat == OS_STAT_RDY) {             /* See if task is ready (could be susp'd)        */
	CMP.B	#0,28(R12)	
	JNE	(?0115)	
; 487.	        OSRdyGrp        |=  bity;                     /* Put task in the ready to run list             */
	BIS.B	R11,&OSRdyGrp	
; 488.	        OSRdyTbl[y]     |=  bitx;
	BIS.B	R8,OSRdyTbl(R10)	
?0115:
; 489.	    }
; 490.	    return (prio);
	MOV.B	R13,R12	
; 491.	}
	POP	R6	
	POP	R9	
	POP	R8	
	POP	R11	
	POP	R10	
	RET		
OS_EventTaskWait:
; 492.	#endif
; 493.	/*$PAGE*/
; 494.	/*
; 495.	*********************************************************************************************************
; 496.	*                                   MAKE TASK WAIT FOR EVENT TO OCCUR
; 497.	*
; 498.	* Description: This function is called by other uC/OS-II services to suspend a task because an event has
; 499.	*              not occurred.
; 500.	*
; 501.	* Arguments  : pevent   is a pointer to the event control block for which the task will be waiting for.
; 502.	*
; 503.	* Returns    : none
; 504.	*
; 505.	* Note       : This function is INTERNAL to uC/OS-II and your application should not call it.
; 506.	*********************************************************************************************************
; 507.	*/
; 508.	#if OS_EVENT_EN > 0
; 509.	void  OS_EventTaskWait (OS_EVENT *pevent)
; 510.	{
; 511.	    OSTCBCur->OSTCBEventPtr = pevent;            /* Store pointer to event control block in TCB        */
	MOV	&OSTCBCur,R13	
	MOV	R12,18(R13)	
; 512.	    if ((OSRdyTbl[OSTCBCur->OSTCBY] &= ~OSTCBCur->OSTCBBitX) == 0x00) {   /* Task no longer ready      */
	MOV	&OSTCBCur,R13	
	MOV.B	31(R13),R13	
	MOV	&OSTCBCur,R14	
	MOV.B	32(R14),R14	
	XOR.B	#-1,R14	
	AND.B	R14,OSRdyTbl(R13)	
	CMP.B	#0,OSRdyTbl(R13)	
	JNE	(?0121)	
; 513.	        OSRdyGrp &= ~OSTCBCur->OSTCBBitY;        /* Clear event grp bit if this was only task pending  */
	MOV	&OSTCBCur,R13	
	MOV.B	33(R13),R13	
	XOR.B	#-1,R13	
	AND.B	R13,&OSRdyGrp	
?0121:
; 514.	    }
; 515.	    pevent->OSEventTbl[OSTCBCur->OSTCBY] |= OSTCBCur->OSTCBBitX;          /* Put task in waiting list  */
	MOV	&OSTCBCur,R13	
	MOV.B	31(R13),R13	
	ADD	R12,R13	
	MOV	&OSTCBCur,R14	
	BIS.B	32(R14),6(R13)	
; 516.	    pevent->OSEventGrp                   |= OSTCBCur->OSTCBBitY;
	MOV	&OSTCBCur,R13	
	BIS.B	33(R13),1(R12)	
; 517.	}
	RET		
OS_EventTO:
; 518.	#endif
; 519.	/*$PAGE*/
; 520.	/*
; 521.	*********************************************************************************************************
; 522.	*                              MAKE TASK READY TO RUN BASED ON EVENT TIMEOUT
; 523.	*
; 524.	* Description: This function is called by other uC/OS-II services to make a task ready to run because a
; 525.	*              timeout occurred.
; 526.	*
; 527.	* Arguments  : pevent   is a pointer to the event control block which is readying a task.
; 528.	*
; 529.	* Returns    : none
; 530.	*
; 531.	* Note       : This function is INTERNAL to uC/OS-II and your application should not call it.
; 532.	*********************************************************************************************************
; 533.	*/
; 534.	#if OS_EVENT_EN > 0
; 535.	void  OS_EventTO (OS_EVENT *pevent)
; 536.	{
; 537.	    if ((pevent->OSEventTbl[OSTCBCur->OSTCBY] &= ~OSTCBCur->OSTCBBitX) == 0x00) {
	MOV	&OSTCBCur,R13	
	MOV.B	31(R13),R13	
	ADD	R12,R13	
	MOV	&OSTCBCur,R14	
	MOV.B	32(R14),R14	
	XOR.B	#-1,R14	
	AND.B	R14,6(R13)	
	CMP.B	#0,6(R13)	
	JNE	(?0127)	
; 538.	        pevent->OSEventGrp &= ~OSTCBCur->OSTCBBitY;
	MOV	&OSTCBCur,R13	
	MOV.B	33(R13),R13	
	XOR.B	#-1,R13	
	AND.B	R13,1(R12)	
?0127:
; 539.	    }
; 540.	    OSTCBCur->OSTCBStat     = OS_STAT_RDY;       /* Set status to ready                                */
	MOV	&OSTCBCur,R12	
	MOV.B	#0,28(R12)	
; 541.	    OSTCBCur->OSTCBEventPtr = (OS_EVENT *)0;     /* No longer waiting for event                        */
	MOV	&OSTCBCur,R12	
	MOV	#0,18(R12)	
; 542.	}
	RET		
OS_EventWaitListInit:
; 543.	#endif
; 544.	/*$PAGE*/
; 545.	/*
; 546.	*********************************************************************************************************
; 547.	*                                 INITIALIZE EVENT CONTROL BLOCK'S WAIT LIST
; 548.	*
; 549.	* Description: This function is called by other uC/OS-II services to initialize the event wait list.
; 550.	*
; 551.	* Arguments  : pevent    is a pointer to the event control block allocated to the event.
; 552.	*
; 553.	* Returns    : none
; 554.	*
; 555.	* Note       : This function is INTERNAL to uC/OS-II and your application should not call it.
; 556.	*********************************************************************************************************
; 557.	*/
; 558.	#if ((OS_Q_EN > 0) && (OS_MAX_QS > 0)) || (OS_MBOX_EN > 0) || (OS_SEM_EN > 0) || (OS_MUTEX_EN > 0)
; 559.	void  OS_EventWaitListInit (OS_EVENT *pevent)
; 560.	{
; 561.	    INT8U  *ptbl;
; 562.	
; 563.	
; 564.	    pevent->OSEventGrp = 0x00;                   /* No task waiting on event                           */
	MOV.B	#0,1(R12)	
; 565.	    ptbl               = &pevent->OSEventTbl[0];
	ADD	#6,R12	
; 566.	
; 567.	#if OS_EVENT_TBL_SIZE > 0
; 568.	    *ptbl++            = 0x00;
	MOV.B	#0,0(R12)	
	ADD	#1,R12	
; 569.	#endif
; 570.	
; 571.	#if OS_EVENT_TBL_SIZE > 1
; 572.	    *ptbl++            = 0x00;
	MOV.B	#0,0(R12)	
; 573.	#endif
; 574.	
; 575.	#if OS_EVENT_TBL_SIZE > 2
; 576.	    *ptbl++            = 0x00;
; 577.	#endif
; 578.	
; 579.	#if OS_EVENT_TBL_SIZE > 3
; 580.	    *ptbl++            = 0x00;
; 581.	#endif
; 582.	
; 583.	#if OS_EVENT_TBL_SIZE > 4
; 584.	    *ptbl++            = 0x00;
; 585.	#endif
; 586.	
; 587.	#if OS_EVENT_TBL_SIZE > 5
; 588.	    *ptbl++            = 0x00;
; 589.	#endif
; 590.	
; 591.	#if OS_EVENT_TBL_SIZE > 6
; 592.	    *ptbl++            = 0x00;
; 593.	#endif
; 594.	
; 595.	#if OS_EVENT_TBL_SIZE > 7
; 596.	    *ptbl              = 0x00;
; 597.	#endif
; 598.	}
	RET		
OS_InitEventList:
; 599.	#endif
; 600.	/*$PAGE*/
; 601.	/*
; 602.	*********************************************************************************************************
; 603.	*                                             INITIALIZATION
; 604.	*                           INITIALIZE THE FREE LIST OF EVENT CONTROL BLOCKS
; 605.	*
; 606.	* Description: This function is called by OSInit() to initialize the free list of event control blocks.
; 607.	*
; 608.	* Arguments  : none
; 609.	*
; 610.	* Returns    : none
; 611.	*********************************************************************************************************
; 612.	*/
; 613.	
; 614.	static  void  OS_InitEventList (void)
; 615.	{
; 616.	#if (OS_EVENT_EN > 0) && (OS_MAX_EVENTS > 0)
; 617.	#if (OS_MAX_EVENTS > 1)
; 618.	    INT16U     i;
; 619.	    OS_EVENT  *pevent1;
; 620.	    OS_EVENT  *pevent2;
; 621.	
; 622.	
; 623.	    pevent1 = &OSEventTbl[0];
	MOV	#OSEventTbl,R14	
; 624.	    pevent2 = &OSEventTbl[1];
	MOV	#(OSEventTbl+8),R13	
; 625.	    for (i = 0; i < (OS_MAX_EVENTS - 1); i++) {                  /* Init. list of free EVENT control blocks  */
	MOV	#0,R12	
?0139:
	CMP	#1,R12	
	MOV.B	#0,0(R14)	
	JC	(?0138)	
; 626.	        pevent1->OSEventType = OS_EVENT_TYPE_UNUSED;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -