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

📄 ucos2avr.lss

📁 atmega单片机用的ucos系统 占用内存适中 是atmega单片机合适的操作系统
💻 LSS
📖 第 1 页 / 共 5 页
字号:
        OS_EXIT_CRITICAL();
     a74:	0f 90       	pop	r0
     a76:	0f be       	out	0x3f, r0	; 63
        ptcb->OSTCBStkPtr    = ptos;                       /* Load Stack pointer in TCB                */
     a78:	68 83       	st	Y, r22
     a7a:	79 83       	std	Y+1, r23	; 0x01
        ptcb->OSTCBPrio      = prio;                       /* Load task priority into TCB              */
     a7c:	1e 87       	std	Y+14, r17	; 0x0e
        ptcb->OSTCBStat      = OS_STAT_RDY;                /* Task is ready to run                     */
     a7e:	1c 86       	std	Y+12, r1	; 0x0c
        ptcb->OSTCBPendTO    = FALSE;                      /* Clear the Pend timeout flag              */
     a80:	1d 86       	std	Y+13, r1	; 0x0d
        ptcb->OSTCBDly       = 0;                          /* Task is not delayed                      */
     a82:	1a 86       	std	Y+10, r1	; 0x0a
     a84:	1b 86       	std	Y+11, r1	; 0x0b

#if OS_TASK_CREATE_EXT_EN > 0
        ptcb->OSTCBExtPtr    = pext;                       /* Store pointer to TCB extension           */
        ptcb->OSTCBStkSize   = stk_size;                   /* Store stack size                         */
        ptcb->OSTCBStkBottom = pbos;                       /* Store pointer to bottom of stack         */
        ptcb->OSTCBOpt       = opt;                        /* Store task options                       */
        ptcb->OSTCBId        = id;                         /* Store task ID                            */
#else
        pext                 = pext;                       /* Prevent compiler warning if not used     */
        stk_size             = stk_size;
        pbos                 = pbos;
        opt                  = opt;
        id                   = id;
#endif

#if OS_TASK_DEL_EN > 0
        ptcb->OSTCBDelReq    = OS_NO_ERR;
#endif

        ptcb->OSTCBY         = (INT8U)(prio >> 3);         /* Pre-compute X, Y, BitX and BitY          */
     a86:	81 2f       	mov	r24, r17
     a88:	86 95       	lsr	r24
     a8a:	86 95       	lsr	r24
     a8c:	86 95       	lsr	r24
     a8e:	88 8b       	std	Y+16, r24	; 0x10
#ifndef ALL_IN_ROM
        ptcb->OSTCBBitY      = OSMapTbl[ptcb->OSTCBY];
#else
        ptcb->OSTCBBitY      = pgm_read_byte(OSMapTbl+ptcb->OSTCBY);
     a90:	e8 2f       	mov	r30, r24
     a92:	ff 27       	eor	r31, r31
     a94:	e4 57       	subi	r30, 0x74	; 116
     a96:	fe 4f       	sbci	r31, 0xFE	; 254
     a98:	84 91       	lpm	r24, Z
     a9a:	8a 8b       	std	Y+18, r24	; 0x12
#endif
        ptcb->OSTCBX         = (INT8U)(prio & 0x07);
     a9c:	81 2f       	mov	r24, r17
     a9e:	87 70       	andi	r24, 0x07	; 7
     aa0:	8f 87       	std	Y+15, r24	; 0x0f
#ifndef ALL_IN_ROM
        ptcb->OSTCBBitX      = OSMapTbl[ptcb->OSTCBX];
#else
        ptcb->OSTCBBitX      = pgm_read_byte(OSMapTbl+ptcb->OSTCBX);
     aa2:	e8 2f       	mov	r30, r24
     aa4:	ff 27       	eor	r31, r31
     aa6:	e4 57       	subi	r30, 0x74	; 116
     aa8:	fe 4f       	sbci	r31, 0xFE	; 254
     aaa:	84 91       	lpm	r24, Z
     aac:	89 8b       	std	Y+17, r24	; 0x11
#endif

#if OS_EVENT_EN
        ptcb->OSTCBEventPtr  = (OS_EVENT *)0;              /* Task is not pending on an event          */
     aae:	1e 82       	std	Y+6, r1	; 0x06
     ab0:	1f 82       	std	Y+7, r1	; 0x07
#endif

#if (OS_VERSION >= 251) && (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0) && (OS_TASK_DEL_EN > 0)
        ptcb->OSTCBFlagNode  = (OS_FLAG_NODE *)0;          /* Task is not pending on an event flag     */
#endif

#if (OS_MBOX_EN > 0) || ((OS_Q_EN > 0) && (OS_MAX_QS > 0))
        ptcb->OSTCBMsg       = (void *)0;                  /* No message received                      */
     ab2:	18 86       	std	Y+8, r1	; 0x08
     ab4:	19 86       	std	Y+9, r1	; 0x09
#endif

#if OS_TASK_PROFILE_EN > 0
        ptcb->OSTCBCtxSwCtr    = 0L;                       /* Initialize profiling variables           */
        ptcb->OSTCBCyclesStart = 0L;
        ptcb->OSTCBCyclesTot   = 0L;
        ptcb->OSTCBStkBase     = (OS_STK *)0;
        ptcb->OSTCBStkUsed     = 0L;
#endif

#if OS_TASK_NAME_SIZE > 1
        ptcb->OSTCBTaskName[0] = '?';                      /* Unknown name at task creation            */
     ab6:	8f e3       	ldi	r24, 0x3F	; 63
     ab8:	8b 8b       	std	Y+19, r24	; 0x13
        ptcb->OSTCBTaskName[1] = OS_ASCII_NUL;
     aba:	1c 8a       	std	Y+20, r1	; 0x14
#endif

#if OS_VERSION >= 204
        OSTCBInitHook(ptcb);
     abc:	ce 01       	movw	r24, r28
     abe:	0e 94 95 0c 	call	0x192a
#endif

        OSTaskCreateHook(ptcb);                            /* Call user defined hook                   */
     ac2:	ce 01       	movw	r24, r28
     ac4:	0e 94 90 0c 	call	0x1920
        
        OS_ENTER_CRITICAL();
     ac8:	0f b6       	in	r0, 0x3f	; 63
     aca:	f8 94       	cli
     acc:	0f 92       	push	r0
        OSTCBPrioTbl[prio] = ptcb;
     ace:	e1 2f       	mov	r30, r17
     ad0:	ff 27       	eor	r31, r31
     ad2:	ee 0f       	add	r30, r30
     ad4:	ff 1f       	adc	r31, r31
     ad6:	eb 5c       	subi	r30, 0xCB	; 203
     ad8:	fa 4f       	sbci	r31, 0xFA	; 250
     ada:	c0 83       	st	Z, r28
     adc:	d1 83       	std	Z+1, r29	; 0x01
        ptcb->OSTCBNext    = OSTCBList;                    /* Link into TCB chain                      */
     ade:	e0 91 30 03 	lds	r30, 0x0330
     ae2:	f0 91 31 03 	lds	r31, 0x0331
     ae6:	ea 83       	std	Y+2, r30	; 0x02
     ae8:	fb 83       	std	Y+3, r31	; 0x03
        ptcb->OSTCBPrev    = (OS_TCB *)0;
     aea:	1c 82       	std	Y+4, r1	; 0x04
     aec:	1d 82       	std	Y+5, r1	; 0x05
        if (OSTCBList != (OS_TCB *)0) {
     aee:	30 97       	sbiw	r30, 0x00	; 0
     af0:	11 f0       	breq	.+4      	; 0xaf6
            OSTCBList->OSTCBPrev = ptcb;
     af2:	c4 83       	std	Z+4, r28	; 0x04
     af4:	d5 83       	std	Z+5, r29	; 0x05
        }
        OSTCBList               = ptcb;
     af6:	d0 93 31 03 	sts	0x0331, r29
     afa:	c0 93 30 03 	sts	0x0330, r28
        OSRdyGrp               |= ptcb->OSTCBBitY;         /* Make task ready to run                   */
     afe:	80 91 e2 03 	lds	r24, 0x03E2
     b02:	9a 89       	ldd	r25, Y+18	; 0x12
     b04:	89 2b       	or	r24, r25
     b06:	80 93 e2 03 	sts	0x03E2, r24
        OSRdyTbl[ptcb->OSTCBY] |= ptcb->OSTCBBitX;
     b0a:	88 89       	ldd	r24, Y+16	; 0x10
     b0c:	e8 2f       	mov	r30, r24
     b0e:	ff 27       	eor	r31, r31
     b10:	ed 51       	subi	r30, 0x1D	; 29
     b12:	fc 4f       	sbci	r31, 0xFC	; 252
     b14:	80 81       	ld	r24, Z
     b16:	99 89       	ldd	r25, Y+17	; 0x11
     b18:	89 2b       	or	r24, r25
     b1a:	80 83       	st	Z, r24
        OSTaskCtr++;                                       /* Increment the #tasks counter             */
     b1c:	80 91 dd 03 	lds	r24, 0x03DD
     b20:	8f 5f       	subi	r24, 0xFF	; 255
     b22:	80 93 dd 03 	sts	0x03DD, r24
        OS_EXIT_CRITICAL();
     b26:	0f 90       	pop	r0
     b28:	0f be       	out	0x3f, r0	; 63
        return (OS_NO_ERR);
     b2a:	80 e0       	ldi	r24, 0x00	; 0
     b2c:	90 e0       	ldi	r25, 0x00	; 0
     b2e:	04 c0       	rjmp	.+8      	; 0xb38
    }
    OS_EXIT_CRITICAL();
     b30:	0f 90       	pop	r0
     b32:	0f be       	out	0x3f, r0	; 63
    return (OS_NO_MORE_TCB);
     b34:	86 e4       	ldi	r24, 0x46	; 70
     b36:	90 e0       	ldi	r25, 0x00	; 0
     b38:	df 91       	pop	r29
     b3a:	cf 91       	pop	r28
     b3c:	1f 91       	pop	r17
     b3e:	08 95       	ret

00000b40 <OSMboxAccept>:
     b40:	fc 01       	movw	r30, r24
     b42:	00 97       	sbiw	r24, 0x00	; 0
     b44:	09 f4       	brne	.+2      	; 0xb48
     b46:	08 95       	ret
     b48:	80 81       	ld	r24, Z
     b4a:	81 30       	cpi	r24, 0x01	; 1
     b4c:	19 f0       	breq	.+6      	; 0xb54
     b4e:	80 e0       	ldi	r24, 0x00	; 0
     b50:	90 e0       	ldi	r25, 0x00	; 0
     b52:	08 95       	ret
     b54:	0f b6       	in	r0, 0x3f	; 63
     b56:	f8 94       	cli
     b58:	0f 92       	push	r0
     b5a:	84 81       	ldd	r24, Z+4	; 0x04
     b5c:	95 81       	ldd	r25, Z+5	; 0x05
     b5e:	14 82       	std	Z+4, r1	; 0x04
     b60:	15 82       	std	Z+5, r1	; 0x05
     b62:	0f 90       	pop	r0
     b64:	0f be       	out	0x3f, r0	; 63
     b66:	08 95       	ret
     b68:	08 95       	ret

00000b6a <OSMboxCreate>:
*********************************************************************************************************
*/

OS_EVENT  *OSMboxCreate (void *msg)
{
     b6a:	cf 93       	push	r28
     b6c:	df 93       	push	r29
     b6e:	9c 01       	movw	r18, r24
    OS_EVENT  *pevent;
#if OS_CRITICAL_METHOD == 3                      /* Allocate storage for CPU status register           */
    OS_CPU_SR  cpu_sr;



    cpu_sr = 0;                                  /* Prevent compiler warning                           */
#endif    
    if (OSIntNesting > 0) {                      /* See if called from ISR ...                         */
     b70:	80 91 ed 03 	lds	r24, 0x03ED
     b74:	88 23       	and	r24, r24
     b76:	19 f0       	breq	.+6      	; 0xb7e
        return ((OS_EVENT *)0);                  /* ... can't CREATE from an ISR                       */
     b78:	80 e0       	ldi	r24, 0x00	; 0
     b7a:	90 e0       	ldi	r25, 0x00	; 0
     b7c:	20 c0       	rjmp	.+64     	; 0xbbe
    }
    OS_ENTER_CRITICAL();
     b7e:	0f b6       	in	r0, 0x3f	; 63
     b80:	f8 94       	cli
     b82:	0f 92       	push	r0
    pevent = OSEventFreeList;                    /* Get next free event control block                  */
     b84:	c0 91 eb 03 	lds	r28, 0x03EB
     b88:	d0 91 ec 03 	lds	r29, 0x03EC
    if (OSEventFreeList != (OS_EVENT *)0) {      /* See if pool of free ECB pool was empty             */
     b8c:	20 97       	sbiw	r28, 0x00	; 0
     b8e:	31 f0       	breq	.+12     	; 0xb9c
        OSEventFreeList = (OS_EVENT *)OSEventFreeList->OSEventPtr;
     b90:	8c 81       	ldd	r24, Y+4	; 0x04
     b92:	9d 81       	ldd	r25, Y+5	; 0x05
     b94:	90 93 ec 03 	sts	0x03EC, r25
     b98:	80 93 eb 03 	sts	0x03EB, r24
    }
    OS_EXIT_CRITICAL();
     b9c:	0f 90       	pop	r0
     b9e:	0f be       	out	0x3f, r0	; 63
    if (pevent != (OS_EVENT *)0) {
     ba0:	20 97       	sbiw	r28, 0x00	; 0
     ba2:	61 f0       	breq	.+24     	; 0xbbc
        pevent->OSEventType    = OS_EVENT_TYPE_MBOX;
     ba4:	81 e0       	ldi	r24, 0x01	; 1
     ba6:	88 83       	st	Y, r24
        pevent->OSEventCnt     = 0;
     ba8:	1a 82       	std	Y+2, r1	; 0x02
     baa:	1b 82       	std	Y+3, r1	; 0x03
        pevent->OSEventPtr     = msg;            /* Deposit message in event control block             */
     bac:	2c 83       	std	Y+4, r18	; 0x04
     bae:	3d 83       	std	Y+5, r19	; 0x05
#if OS_EVENT_NAME_SIZE > 1
        pevent->OSEventName[0] = '?';
     bb0:	8f e3       	ldi	r24, 0x3F	; 63
     bb2:	8e 87       	std	Y+14, r24	; 0x0e
        pevent->OSEventName[1] = OS_ASCII_NUL;
     bb4:	1f 86       	std	Y+15, r1	; 0x0f
#endif
        OS_EventWaitListInit(pevent);
     bb6:	ce 01       	movw	r24, r28
     bb8:	0e 94 84 03 	call	0x708
    }
    return (pevent);                             /* Return pointer to event control block              */
     bbc:	ce 01       	movw	r24, r28
     bbe:	df 91       	pop	r29
     bc0:	cf 91       	pop	r28
     bc2:	08 95       	ret

00000bc4 <OSMboxDel>:
}
/*$PAGE*/
/*
*********************************************************************************************************
*                                         DELETE A MAIBOX
*
* Description: This function deletes a mailbox and readies all tasks pending on the mailbox.
*
* Arguments  : pevent        is a pointer to the event control block associated with the desired
*                            mailbox.
*
*              opt           determines delete options as follows:
*                            opt == OS_DEL_NO_PEND   Delete the mailbox ONLY if no task pending
*                            opt == OS_DEL_ALWAYS    Deletes the mailbox even if tasks are waiting.
*                                                    In this case, all the tasks pending will be readied.
*
*              err           is a pointer to an error code that can contain one of the following values:
*                            OS_NO_ERR               The call was successful and the mailbox was deleted
*                            OS_ERR_DEL_ISR          If you attempted to delete the mailbox from an ISR
*                            OS_ERR_INVALID_OPT      An invalid option was specified
*                            OS_ERR_TASK_WAITING     One or more tasks were waiting on the mailbox
*                            OS_ERR_EVENT_TYPE       If you didn't pass a pointer to a mailbox
*                            OS_ERR_PEVENT_NULL      If 'pevent' is a NULL pointer.
*
* Returns    : pevent        upon error
*              (OS_EVENT *)0 if the mailbox was successfully deleted.
*
* Note(s)    : 1) This function must be used with care.  Tasks that would normally expect the presence of
*                 the mailbox MUST check the return code of OSMboxPend().
*              2) OSMboxAccept() callers will not know that the intended mailbox has been deleted!
*              3) This call can potentially disable interrupts for a long time.  The interrupt disable
*                 time is directly proportional to the number of tasks waiting on the mailbox.
*              4) Because ALL tasks pending on the mailbox will be readied, you MUST be careful in
*                 applications where the mailbox is used for mutual exclusion because the resource(s)
*                 will no longer be guarded by the mailbox.
*********************************************************************************************************
*/

#if OS_MBOX_DEL_EN > 0
OS_EVENT  *OSMboxDel (OS_EVENT *pevent, INT8U opt, INT8U *err)
{
     bc4:	ff 92       	push	r15
     bc6:	0f 93       	push	r16
     bc8:	1f 93       	push	r17
     bca:	cf 93       	push	r28
     bcc:	df 93       	push	r29
     bce:	ec 01       	movw	r28, r24
     bd0:	8a 01       	movw	r16, r20
    BOOLEAN    tasks_waiting;
#if OS_CRITICAL_METHOD == 3                                /* 

⌨️ 快捷键说明

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