📄 os_core.ls1
字号:
803 ; OS_ENTER_CRITICAL();
804 ; #if OS_ARG_CHK_EN > 0
805 ; if (pevent == (OS_EVENT *)0) { /* Is 'pevent' a NULL pointer?
*/
806 ; OS_EXIT_CRITICAL(); /* Yes
*/
807 ; *err = OS_ERR_PEVENT_NULL;
808 ; return;
809 ; }
810 ; if (pname == (char *)0) { /* Is 'pname' a NULL pointer?
*/
811 ; OS_EXIT_CRITICAL(); /* Yes
*/
812 ; *err = OS_ERR_PNAME_NULL;
813 ; return;
814 ; }
815 ; #endif
816 ; switch (pevent->OSEventType) {
817 ; case OS_EVENT_TYPE_SEM:
818 ; case OS_EVENT_TYPE_MUTEX:
819 ; case OS_EVENT_TYPE_MBOX:
820 ; case OS_EVENT_TYPE_Q:
821 ; break;
822 ;
823 ; default:
824 ; OS_EXIT_CRITICAL();
825 ; *err = OS_ERR_EVENT_TYPE;
826 ; return;
827 ; }
828 ; len = strlen(pname); /* Can we fit the string in the storage
area? */
829 ; if (len > (OS_EVENT_NAME_SIZE - 1)) { /* No
*/
830 ; OS_EXIT_CRITICAL();
831 ; *err = OS_ERR_EVENT_NAME_TOO_LONG;
832 ; return;
833 ; }
834 ; (void)strcpy(pevent->OSEventName, pname); /* Yes, copy name to the event control b
lock */
835 ; OS_EXIT_CRITICAL();
836 ; *err = OS_NO_ERR;
837 ; }
838 ; #endif
839 ;
840 ; /*$PAGE*/
841 ; /*
842 ; *****************************************************************************************
****************
843 ; * INITIALIZATION
844 ; *
845 ; * Description: This function is used to initialize the internals of uC/OS-II and MUST be
called prior to
846 ; * creating any uC/OS-II object and, prior to calling OSStart().
847 ; *
848 ; * Arguments : none
849 ; *
850 ; * Returns : none
851 ; *****************************************************************************************
****************
852 ; */
853 ;
854 ; void OSInit (void) KCREENTRANT
855
A51 MACRO ASSEMBLER OS_CORE 04/04/2007 13:38:31 PAGE 15
---- 856 RSEG ?PR?_?OSInit?OS_CORE
0000 857 _?OSInit:
858 USING 0
859 ; SOURCE LINE # 230
860 ; {
861 ; #if OS_VERSION >= 204
862 ; OSInitHookBegin(); /* Call port specific in
itialization code */
863 ; SOURCE LINE # 233
0000 120000 F 864 LCALL _?OSInitHookBegin
865 ; #endif
866 ;
867 ; OS_InitMisc(); /* Initialize miscellane
ous variables */
868 ; SOURCE LINE # 236
0003 120000 F 869 LCALL OS_InitMisc
870 ;
871 ; OS_InitRdyList(); /* Initialize the Ready
List */
872 ; SOURCE LINE # 238
0006 120000 F 873 LCALL OS_InitRdyList
874 ;
875 ; OS_InitTCBList(); /* Initialize the free l
ist of OS_TCBs */
876 ; SOURCE LINE # 240
0009 120000 F 877 LCALL OS_InitTCBList
878 ;
879 ; OS_InitEventList(); /* Initialize the free l
ist of OS_EVENTs */
880 ; SOURCE LINE # 242
000C 120000 F 881 LCALL OS_InitEventList
882 ;
883 ; #if (OS_VERSION >= 251) && (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
884 ; OS_FlagInit(); /* Initialize the event
flag structures */
885 ; #endif
886 ;
887 ; #if (OS_MEM_EN > 0) && (OS_MAX_MEM_PART > 0)
888 ; OS_MemInit(); /* Initialize the memory
manager */
889 ; #endif
890 ;
891 ; #if (OS_Q_EN > 0) && (OS_MAX_QS > 0)
892 ; OS_QInit(); /* Initialize the messag
e queue structures */
893 ; #endif
894 ;
895 ; OS_InitTaskIdle(); /* Create the Idle Task
*/
896 ; SOURCE LINE # 256
000F 120000 F 897 LCALL OS_InitTaskIdle
898 ; #if OS_TASK_STAT_EN > 0
899 ; OS_InitTaskStat(); /* Create the Statistic
Task */
900 ; #endif
901 ;
902 ; #if OS_VERSION >= 204
903 ; OSInitHookEnd(); /* Call port specific in
it. code */
904 ; SOURCE LINE # 262
0012 020000 F 905 LJMP _?OSInitHookEnd
906 ; END OF _?OSInit
907
908 ; #endif
909 ; }
910 ; /*$PAGE*/
A51 MACRO ASSEMBLER OS_CORE 04/04/2007 13:38:31 PAGE 16
911 ; /*
912 ; *****************************************************************************************
****************
913 ; * ENTER ISR
914 ; *
915 ; * Description: This function is used to notify uC/OS-II that you are about to service an
interrupt
916 ; * service routine (ISR). This allows uC/OS-II to keep track of interrupt ne
sting and thus
917 ; * only perform rescheduling at the last nested ISR.
918 ; *
919 ; * Arguments : none
920 ; *
921 ; * Returns : none
922 ; *
923 ; * Notes : 1) This function should be called ith interrupts already disabled
924 ; * 2) Your ISR can directly increment OSIntNesting without calling this funct
ion because
925 ; * OSIntNesting has been declared 'global'.
926 ; * 3) You MUST still call OSIntExit() even though you increment OSIntNesting
directly.
927 ; * 4) You MUST invoke OSIntEnter() and OSIntExit() in pair. In other words,
for every call
928 ; * to OSIntEnter() at the beginning of the ISR you MUST have a call to OSI
ntExit() at the
929 ; * end of the ISR.
930 ; * 5) You are allowed to nest interrupts up to 255 levels deep.
931 ; * 6) I removed the OS_ENTER_CRITICAL() and OS_EXIT_CRITICAL() around the inc
rement because
932 ; * OSIntEnter() is always called with interrupts disabled.
933 ; *****************************************************************************************
****************
934 ; */
935 ;
936 ; void OSIntEnter (void) KCREENTRANT
937
---- 938 RSEG ?PR?_?OSIntEnter?OS_CORE
0000 939 _?OSIntEnter:
940 USING 0
941 ; SOURCE LINE # 291
942 ; {
943 ; if (OSRunning == TRUE) {
944 ; SOURCE LINE # 293
0000 7800 F 945 MOV R0,#LOW (OSRunning)
0002 E6 946 MOV A,@R0
0003 B4010C 947 CJNE A,#01H,?C0004
948 ; if (OSIntNesting < 255u) {
949 ; SOURCE LINE # 294
0006 900000 F 950 MOV DPTR,#OSIntNesting
0009 E0 951 MOVX A,@DPTR
000A C3 952 CLR C
000B 94FF 953 SUBB A,#0FFH
000D 5003 954 JNC ?C0004
955 ; OSIntNesting++; /* Increment ISR nesting level
*/
956 ; SOURCE LINE # 295
000F E0 957 MOVX A,@DPTR
0010 04 958 INC A
0011 F0 959 MOVX @DPTR,A
960 ; }
961 ; SOURCE LINE # 296
962 ; }
963 ; SOURCE LINE # 297
964 ; }
965 ; SOURCE LINE # 298
0012 966 ?C0004:
A51 MACRO ASSEMBLER OS_CORE 04/04/2007 13:38:31 PAGE 17
0012 22 967 RET
968 ; END OF _?OSIntEnter
969
970 ; /*$PAGE*/
971 ; /*
972 ; *****************************************************************************************
****************
973 ; * EXIT ISR
974 ; *
975 ; * Description: This function is used to notify uC/OS-II that you have completed serviving
an ISR. When
976 ; * the last nested ISR has completed, uC/OS-II will call the scheduler to det
ermine whether
977 ; * a new, high-priority task, is ready to run.
978 ; *
979 ; * Arguments : none
980 ; *
981 ; * Returns : none
982
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -