?? emos_cpu.h
字號:
/****************************************************************************
*
* (c) Copyright 2001,2008, EMB system, All Rights Reserved.
* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF EMB SYSTEM, INC.
* The copyright notice above does not evidence any actual or intended
* publication of such source code.
*
* Subsystem: EMOS
* File: emos_cpu.h
* Author: zenf zhao
* Description: embedded software system queue management implement
*
****************************************************************************/
#ifndef _EMOS_CPU_H_
#define _EMOS_CPU_H_
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include "emos_inc.h"
#define EMOS_CPU_MINGW_MODE
//#define CPU_80X86_BCC
#ifdef CPU_80X86_BCC
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include <setjmp.h>
/* *********************************************************************************************************
* Intel 80x86 (Real-Mode, Large Model)
*
* Method #1: Disable/Enable interrupts using simple instructions. After critical section, interrupts
* will be enabled even if they were disabled before entering the critical section. You MUST
* change the constant in OS_CPU_A.ASM, function OSIntCtxSw() from 10 to 8.
*
* Method #2: Disable/Enable interrupts by preserving the state of interrupts. In other words, if
* interrupts were disabled before entering the critical section, they will be disabled when
* leaving the critical section. You MUST change the constant in OS_CPU_A.ASM, function
* OSIntCtxSw() from 8 to 10.
**********************************************************************************************************/
#ifdef EMOS_SIMULATION
#define EMOS_ENTER_CRITICAL() printf("take interrupt\r\n")
#define EMOS_EXIT_CRITICAL() printf("give interrupt\r\n")
#else
#define EMOS_CRITICAL_METHOD 2
#if EMOS_CRITICAL_METHOD == 1
#define EMOS_ENTER_CRITICAL() asm CLI /* Disable interrupts */
#define EMOS_EXIT_CRITICAL() asm STI /* Enable interrupts */
#endif
#if EMOS_CRITICAL_METHOD == 2
#define EMOS_ENTER_CRITICAL() asm {PUSHF; CLI} /* Disable interrupts */
#define EMOS_EXIT_CRITICAL() asm POPF /* Enable interrupts */
#endif
#endif
/**********************************************************************************************************
* Intel 80x86 (Real-Mode, Large Model) Miscellaneous
**********************************************************************************************************/
/* Stack grows from HIGH to LOW memory on 80x86 */
#define CPU_STK_GROWTH 1
/* Interrupt vector # used for context switch */
#define EMOS_ISR_NUM 0x80
#ifdef EMOS_SIMULATION
#define EMOS_TASK_SW() printf("emos interrupt gen\r\n")
#else
#define EMOS_TASK_SW() asm INT EMOS_ISR_NUM
#endif
/* Counter used to invoke DOS's tick handler every 'n' ticks */
extern uint8 gEmosTickDosCtr;
/*end of define CPU_80X86*/
#endif
#ifdef EMOS_CPU_MINGW_MODE
#include <windows.h>
//#define _WIN32_WINNT 0x0400
#define EMOS_CPU_EXT extern
#define CPU_STK_GROWTH 1
#define EMOS_TASK_SW() SetEvent(gEmosCtxSwW32Event)
EMOS_CPU_EXT CRITICAL_SECTION gEmosCriticalSection;
EMOS_CPU_EXT HANDLE gEmosCtxSwW32Event;
void EMOS_SLEEP(); /* Recommend to insert call of this function in Idle task */
void EMOS_STOP();
void EMOS_INIT_CRITICAL();
void EMOS_ENTER_CRITICAL();
void EMOS_EXIT_CRITICAL();
void emosStartHighRdy();
void emosIntCtxSw();
void emosInitHookBegin(void);
typedef struct {
void *pData;
uint16 opt;
void (*task)(void*);
HANDLE handle;
uint32 id;
int exit;
} EMOS_EMU_STK;
#endif
#endif
/*
* Please add "$" around "Id" and "Log".
* $Id$
* $Log$
*
*/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -