📄 ucos_ii.ls
字号:
2638 0134 7c0ac5 std _OSIdleCtr
2639 ; 252 OSIdleCtrRun = 0L;
2641 ;***** ldd #0 ***** L0
2642 ;***** clra ***** C0
2643 ;***** clrb ***** C0
2644 0137 7c0abe std _OSIdleCtrRun+2
2645 ;***** ldd #0 ***** L0
2646 ;***** clra ***** C0
2647 ;***** clrb ***** C0
2648 013a 7c0abc std _OSIdleCtrRun
2649 ; 253 OSIdleCtrMax = 0L;
2651 ;***** ldd #0 ***** L0
2652 ;***** clra ***** C0
2653 ;***** clrb ***** C0
2654 013d 7c0ac2 std _OSIdleCtrMax+2
2655 ;***** ldd #0 ***** L0
2656 ;***** clra ***** C0
2657 ;***** clrb ***** C0
2658 0140 7c0ac0 std _OSIdleCtrMax
2659 ; 254 OSStatRdy = FALSE; /* Statistic task is not ready */
2661 ;***** clr _OSStatRdy ***** C0
2662 ;***** clra ***** C0
2663 0143 7a0abb staa _OSStatRdy
2664 ; 256 OSCtxSwCtr = 0; /* Clear the context switch counter */
2666 ;***** ldd #0 ***** L0
2667 ;***** clra ***** C0
2668 ;***** clrb ***** C0
2669 0146 7c0b59 std _OSCtxSwCtr+2
2670 ;***** ldd #0 ***** L0
2671 ;***** clra ***** C0
2672 ;***** clrb ***** C0
2673 0149 7c0b57 std _OSCtxSwCtr
2674 ; 257 OSRdyGrp = 0; /* Clear the ready list */
2676 ;***** clr _OSRdyGrp ***** C0
2677 ;***** clra ***** C0
2678 014c 7a0ab6 staa _OSRdyGrp
2679 ; 258 for (i = 0; i < OS_RDY_TBL_SIZE; i++) {
2681 ;***** clra ***** C0
2682 ;***** clrb ***** C0
2683 014f 6c80 std OFST-2,s
2684 ;***** ldy OFST-2,s ***** L6
2685 0151 b746 tfr d,y
2686 0153 L7211:
2687 ; 259 OSRdyTbl[i] = 0;
2689 ;***** ldy OFST-2,s ***** M4
2690 ;***** clr _OSRdyTbl,y ***** C0
2691 0153 c7 clrb
2692 0154 6bea0aae stab _OSRdyTbl,y
2693 ; 258 for (i = 0; i < OS_RDY_TBL_SIZE; i++) {
2695 ;***** ldy OFST-2,s ***** L1
2696 0158 02 iny
2699 ;***** ldd OFST-2,s ***** L5
2700 0159 8d0008 cpy #8
2701 015c 25f5 blo L7211
2702 ;***** sty OFST-2,s ***** S2
2703 ; 262 OSPrioCur = 0;
2705 ;***** clr _OSPrioCur ***** C0
2706 ;***** clrb ***** C0
2707 015e 7b0ab8 stab _OSPrioCur
2708 ; 263 OSPrioHighRdy = 0;
2710 ;***** clr _OSPrioHighRdy ***** C0
2711 0161 87 clra
2712 0162 7a0ab7 staa _OSPrioHighRdy
2713 ; 264 OSTCBHighRdy = (OS_TCB *)0; /* TCB Initialization */
2715 ;***** clra ***** C0
2716 ;***** clrb ***** C0
2717 0165 7c0aa6 std _OSTCBHighRdy
2718 ; 265 OSTCBCur = (OS_TCB *)0;
2720 ;***** clra ***** C0
2721 ;***** clrb ***** C0
2722 0168 7c0aaa std _OSTCBCur
2723 ; 266 OSTCBList = (OS_TCB *)0;
2725 ;***** clra ***** C0
2726 ;***** clrb ***** C0
2727 016b 7c0aa4 std _OSTCBList
2728 ; 267 for (i = 0; i < (OS_LOWEST_PRIO + 1); i++) { /* Clear the priority table */
2730 ;***** clra ***** C0
2731 ;***** clrb ***** C0
2732 016e 6c80 std OFST-2,s
2733 0170 L5311:
2734 ; 268 OSTCBPrioTbl[i] = (OS_TCB *)0;
2736 0170 ec80 ldd OFST-2,s
2737 0172 59 lsld
2738 0173 b746 tfr d,y
2739 0175 87 clra
2740 0176 c7 clrb
2741 0177 6cea0a24 std _OSTCBPrioTbl,y
2742 ; 267 for (i = 0; i < (OS_LOWEST_PRIO + 1); i++) { /* Clear the priority table */
2744 017b ed80 ldy OFST-2,s
2745 017d 02 iny
2746 017e 6d80 sty OFST-2,s
2749 ;***** ldd OFST-2,s ***** L5
2750 0180 8d0040 cpy #64
2751 0183 25eb blo L5311
2752 ; 270 for (i = 0; i < (OS_MAX_TASKS + OS_N_SYS_TASKS - 1); i++) { /* Init. list of free TCBs */
2754 ;***** clra ***** C0
2755 ;***** clrb ***** C0
2756 0185 6c80 std OFST-2,s
2757 0187 L3411:
2758 ; 271 OSTCBTbl[i].OSTCBNext = &OSTCBTbl[i + 1];
2760 0187 ec80 ldd OFST-2,s
2761 0189 cd001f ldy #31
2762 018c 13 emul
2763 018d b745 tfr d,x
2764 018f ec80 ldd OFST-2,s
2765 ;***** tfr y,x ***** T5
2766 0191 cd001f ldy #31
2767 0194 13 emul
2768 ;***** tfr x,y ***** T5
2769 0195 c3005f addd #L546_OSTCBTbl+31
2770 ;***** std L546_OSTCBTbl+14,y ***** T5
2771 0198 6ce2004e std L546_OSTCBTbl+14,x
2772 ; 270 for (i = 0; i < (OS_MAX_TASKS + OS_N_SYS_TASKS - 1); i++) { /* Init. list of free TCBs */
2774 019c ed80 ldy OFST-2,s
2775 019e 02 iny
2776 019f 6d80 sty OFST-2,s
2779 ;***** ldd OFST-2,s ***** L5
2780 01a1 8d0040 cpy #64
2781 01a4 25e1 blo L3411
2782 ; 273 OSTCBTbl[OS_MAX_TASKS + OS_N_SYS_TASKS - 1].OSTCBNext = (OS_TCB *)0; /* Last OS_TCB */
2784 01a6 87 clra
2785 01a7 c7 clrb
2786 01a8 7c080e std L546_OSTCBTbl+1998
2787 ; 274 OSTCBFreeList = &OSTCBTbl[0];
2789 01ab cc0040 ldd #L546_OSTCBTbl
2790 01ae 7c0aa8 std _OSTCBFreeList
2791 ; 277 for (i = 0; i < (OS_MAX_EVENTS - 1); i++) { /* Init. list of free EVENT control blocks */
2793 01b1 87 clra
2794 01b2 c7 clrb
2795 01b3 6c80 std OFST-2,s
2796 ;***** ldd OFST-2,s ***** L1
2797 01b5 L1511:
2798 ; 278 OSEventTbl[i].OSEventPtr = (OS_EVENT *)&OSEventTbl[i + 1];
2800 ;***** ldd OFST-2,s ***** M4
2801 01b5 cd000e ldy #14
2802 01b8 13 emul
2803 01b9 b746 tfr d,y
2804 01bb ec80 ldd OFST-2,s
2805 01bd 59 lsld
2806 01be 3b pshd
2807 01bf 59 lsld
2808 01c0 59 lsld
2809 01c1 59 lsld
2810 01c2 a3b1 subd 2,s+
2811 01c4 c30ad7 addd #_OSEventTbl+14
2812 01c7 6cea0ac9 std _OSEventTbl,y
2813 ; 277 for (i = 0; i < (OS_MAX_EVENTS - 1); i++) { /* Init. list of free EVENT control blocks */
2815 01cb ec80 ldd OFST-2,s
2816 ;***** iny ***** A4
2817 01cd c30001 addd #1
2818 01d0 6c80 std OFST-2,s
2821 ;***** ldd OFST-2,s ***** L1
2822 01d2 8c0009 cpd #9
2823 01d5 25de blo L1511
2824 ; 280 OSEventTbl[OS_MAX_EVENTS - 1].OSEventPtr = (OS_EVENT *)0;
2826 01d7 87 clra
2827 01d8 c7 clrb
2828 01d9 7c0b47 std _OSEventTbl+126
2829 ; 281 OSEventFreeList = &OSEventTbl[0];
2831 01dc cc0ac9 ldd #_OSEventTbl
2832 01df 7c0b55 std _OSEventFreeList
2833 ; 285 OSQInit(); /* Initialize the message queue structures */
2835 01e2 16093a jsr _OSQInit
2837 ; 289 OSMemInit(); /* Initialize the memory manager */
2839 01e5 1607a6 jsr _OSMemInit
2841 ; 294 OSTaskCreateExt(OSTaskIdle,
2841 ; 295 (void *)0, /* No arguments passed to OSTaskIdle() */
2841 ; 296 &OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE - 1], /* Set Top-Of-Stack */
2841 ; 297 OS_IDLE_PRIO, /* Lowest priority level */
2841 ; 298 OS_TASK_IDLE_ID,
2841 ; 299 &OSTaskIdleStk[0], /* Set Bottom-Of-Stack */
2841 ; 300 OS_TASK_IDLE_STK_SIZE,
2841 ; 301 (void *)0, /* No TCB extension */
2841 ; 302 OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR);/* Enable stack checking + clear stack */
2843 01e8 cc0003 ldd #3
2844 01eb 3b pshd
2845 ;***** clra ***** C0
2846 01ec c7 clrb
2847 01ed 3b pshd
2848 ;***** ldd #256 ***** L0
2849 ;***** ldaa #1 ***** L0
2850 01ee 42 inca
2851 01ef 3b pshd
2852 ;***** ldd #0 ***** L0
2853 01f0 87 clra
2854 ;***** clrb ***** C0
2855 01f1 3b pshd
2856 01f2 cc091f ldd #L146_OSTaskIdleStk
2857 01f5 3b pshd
2858 01f6 ccffff ldd #-1
2859 01f9 3b pshd
2860 01fa c63f ldab #63
2861 01fc 37 pshb
2862 01fd cc0a1e ldd #L146_OSTaskIdleStk+255
2863 0200 3b pshd
2864 0201 87 clra
2865 0202 c7 clrb
2866 0203 3b pshd
2867 0204 cc0380 ldd #_OSTaskIdle
2868 0207 160e36 jsr _OSTaskCreateExt
2870 020a 1bf011 leas 17,s
2871 ; 325 OSTaskCreateExt(OSTaskStat,
2871 ; 326 (void *)0, /* No args passed to OSTaskStat() */
2871 ; 327 &OSTaskStatStk[OS_TASK_STAT_STK_SIZE - 1],/* Set Top-Of-Stack */
2871 ; 328 OS_STAT_PRIO, /* One higher than the idle task */
2871 ; 329 OS_TASK_STAT_ID,
2871 ; 330 &OSTaskStatStk[0], /* Set Bottom-Of-Stack */
2871 ; 331 OS_TASK_STAT_STK_SIZE,
2871 ; 332 (void *)0, /* No TCB extension */
2871 ; 333 OS_TASK_OPT_STK_CHK | OS_TASK_OPT_STK_CLR); /* Enable stack checking + clear */
2873 020d cc0003 ldd #3
2874 0210 3b pshd
2875 ;***** clra ***** C0
2876 0211 c7 clrb
2877 0212 3b pshd
2878 ;***** ldd #256 ***** L0
2879 ;***** ldaa #1 ***** L0
2880 0213 42 inca
2881 0214 3b pshd
2882 ;***** ldd #0 ***** L0
2883 0215 87 clra
2884 ;***** clrb ***** C0
2885 0216 3b pshd
2886 0217 cc081f ldd #L346_OSTaskStatStk
2887 021a 3b pshd
2888 021b ccfffe ldd #-2
2889 021e 3b pshd
2890 021f c63e ldab #62
2891 0221 37 pshb
2892 0222 cc091e ldd #L346_OSTaskStatStk+255
2893 0225 3b pshd
2894 0226 87 clra
2895 0227 c7 clrb
2896 0228 3b pshd
2897 0229 cc039c ldd #_OSTaskStat
2898 022c 160e36 jsr _OSTaskCreateExt
2900 022f 1bf011 leas 17,s
2901 ; 359 }
2904 0232 31 puly
2905 0233 3d rts
2926 ; 384 void OSIntEnter (void)
2926 ; 385 {
2927 switch .text
2928 0234 _OSIntEnter:
2932 ; 386 OS_ENTER_CRITICAL();
2934 0234 1410 sei
2935 ; 387 OSIntNesting++; /* Increment ISR nesting level */
2937 0236 720aba inc _OSIntNesting
2938 ; 388 OS_EXIT_CRITICAL();
2940 0239 10ef cli
2941 ; 389 }
2944 023b 3d rts
2976 ; 410 void OSIntExit (void)
2976 ; 411 {
2977 switch .text
2978 023c _OSIntExit:
2982 ; 412 OS_ENTER_CRITICAL();
2984 023c 1410 sei
2985 ; 413 if ((--OSIntNesting | OSLockNesting) == 0) { /* Reschedule only if all ISRs completed & not locked */
2987 023e 730aba dec _OSIntNesting
2988 0241 f60aba ldab _OSIntNesting
2989 0244 fa0ab9 orab _OSLockNesting
2990 0247 2647 bne L3711
2991 ; 414 OSIntExitY = OSUnMapTbl[OSRdyGrp];
2993 0249 f60ab6 ldab _OSRdyGrp
2994 024c 87 clra
2995 024d b746 tfr d,y
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -