From ce317f2fdc28f90b57a3fcbd56af2a3ff0c12d73 Mon Sep 17 00:00:00 2001 From: nnhy Date: Sat, 29 Oct 2016 03:07:37 +0000 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E5=A4=96=E9=9A=90=E8=97=8F=E4=B8=AD?= =?UTF-8?q?=E6=96=AD=E5=A4=B4=E6=96=87=E4=BB=B6=EF=BC=8C=E6=99=AE=E9=80=9A?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=97=A0=E9=9C=80=E6=93=8D=E4=BD=9C=E4=B8=AD?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BootConfig.h | 3 --- Device/CAN.h | 2 +- Device/Port.h | 6 +----- Kernel/Heap.cpp | 2 +- Kernel/Interrupt.h | 32 -------------------------------- Kernel/Sys.cpp | 1 + Kernel/Sys.h | 38 +++++++++++++++++++++++++++++++++++--- Kernel/Thread.cpp | 3 +-- Kernel/Z_Debug.cpp | 2 +- 9 files changed, 41 insertions(+), 48 deletions(-) diff --git a/BootConfig.h b/BootConfig.h index 95110433..d6ee36b7 100644 --- a/BootConfig.h +++ b/BootConfig.h @@ -4,9 +4,6 @@ #include "Sys.h" #include "Config.h" -/* 引脚定义 */ -#include "Platform\Pin.h" - #pragma pack(push) #pragma pack(1) diff --git a/Device/CAN.h b/Device/CAN.h index 15c6e33c..8e19c66e 100644 --- a/Device/CAN.h +++ b/Device/CAN.h @@ -1,7 +1,7 @@ #ifndef __CAN_H__ #define __CAN_H__ -#include "Platform\Pin.h" +#include "Sys.h" // CAN类 class Can diff --git a/Device/Port.h b/Device/Port.h index a0100155..d8680310 100644 --- a/Device/Port.h +++ b/Device/Port.h @@ -1,11 +1,7 @@ #ifndef _Port_H_ #define _Port_H_ -#include "Core\Type.h" -#include "Core\Delegate.h" - -/* 引脚定义 */ -#include "Platform\Pin.h" +#include "Sys.h" #ifdef STM32F4 #define GPIO_MAX_SPEED 100 diff --git a/Kernel/Heap.cpp b/Kernel/Heap.cpp index 3805b897..a86a4c8b 100644 --- a/Kernel/Heap.cpp +++ b/Kernel/Heap.cpp @@ -1,4 +1,4 @@ -#include "Core\Type.h" +#include "Sys.h" #include "Interrupt.h" #include "Heap.h" diff --git a/Kernel/Interrupt.h b/Kernel/Interrupt.h index 8e66b898..a6ed96ce 100644 --- a/Kernel/Interrupt.h +++ b/Kernel/Interrupt.h @@ -71,18 +71,6 @@ extern TInterrupt Interrupt; // 初始化函数 Interrupt.Init() 在 Sys.cpp 内 TSys::TSys() 中被调用 // -// 智能IRQ,初始化时备份,销毁时还原 -// SmartIRQ相当霸道,它直接关闭所有中断,再也没有别的任务可以跟当前任务争夺MCU -class SmartIRQ -{ -public: - SmartIRQ(bool enable = false); - ~SmartIRQ(); - -private: - uint _state; -}; - // 智能锁。初始化时锁定一个整数,销毁时解锁 class Lock { @@ -108,26 +96,6 @@ extern "C" #endif } -#if DEBUG -// 函数栈。 -// 进入函数时压栈函数名,离开时弹出。便于异常时获取主线程调用列表 -class TraceStack -{ -public: - TraceStack(cstring name); - ~TraceStack(); - - static void Show(); -}; - -#define TS(name) TraceStack __ts(name) - -#else - -#define TS(name) ((void)0) - -#endif - #endif /* diff --git a/Kernel/Sys.cpp b/Kernel/Sys.cpp index b9d42e0f..f9e1c1df 100644 --- a/Kernel/Sys.cpp +++ b/Kernel/Sys.cpp @@ -1,5 +1,6 @@ #include "Sys.h" +#include "Interrupt.h" #include "TTime.h" TSys Sys; diff --git a/Kernel/Sys.h b/Kernel/Sys.h index 5ec7a082..1fe0db27 100644 --- a/Kernel/Sys.h +++ b/Kernel/Sys.h @@ -17,6 +17,9 @@ #include "Core\Dictionary.h" #include "Core\Delegate.h" +/* 引脚定义 */ +#include "Platform\Pin.h" + // 强迫内联 #define _force_inline __attribute__( ( always_inline ) ) __INLINE @@ -155,9 +158,6 @@ public: ushort Checksum; // 校验 }; -//#include "Time.h" -#include "Interrupt.h" - void EnterCritical(); void ExitCritical(); @@ -167,6 +167,38 @@ void ExitCritical(); uint _REV(uint value); ushort _REV16(ushort value); +// 智能IRQ,初始化时备份,销毁时还原 +// SmartIRQ相当霸道,它直接关闭所有中断,再也没有别的任务可以跟当前任务争夺MCU +class SmartIRQ +{ +public: + SmartIRQ(bool enable = false); + ~SmartIRQ(); + +private: + uint _state; +}; + +#if DEBUG +// 函数栈。 +// 进入函数时压栈函数名,离开时弹出。便于异常时获取主线程调用列表 +class TraceStack +{ +public: + TraceStack(cstring name); + ~TraceStack(); + + static void Show(); +}; + +#define TS(name) TraceStack __ts(name) + +#else + +#define TS(name) ((void)0) + +#endif + #endif //_Sys_H_ /* diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp index f79b8b67..a2d36c50 100644 --- a/Kernel/Thread.cpp +++ b/Kernel/Thread.cpp @@ -1,7 +1,6 @@ #include "Thread.h" #include "Task.h" - -//#include "Platform\stm32.h" +#include "Interrupt.h" //#define TH_DEBUG DEBUG #define TH_DEBUG 0 diff --git a/Kernel/Z_Debug.cpp b/Kernel/Z_Debug.cpp index d8f19fdd..f076d1f9 100644 --- a/Kernel/Z_Debug.cpp +++ b/Kernel/Z_Debug.cpp @@ -1,6 +1,6 @@ #include "Sys.h" -//#include "Platform\stm32.h" +#include "Interrupt.h" #include