亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? appcore.cpp

?? 基于Nuleus操作系統(tǒng)和s3c4510的編寫(xiě)的EFC。已經(jīng)包含了該EFC的設(shè)計(jì)說(shuō)明。這是個(gè)實(shí)際產(chǎn)品的代碼
?? CPP
?? 第 1 頁(yè) / 共 3 頁(yè)
字號(hào):
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2003, Ulink Telecom Equipment Co., Ltd. All rights reserved.
//
// File:
//
//    APPCORE.CPP
//
// Abstract:
//
//    Implementation of the CRTApp class.  The CRTApp class is the base class
//    from which you derive an application object. An application object provides
//	  member functions for initializing your application and for  running the
//	  tasks. Each application can only contain one object derived from CRTApp.
//
// History:
//
//    V1.0	2003-03-06	Alex Duan	Original version.
//    V1.1	2003-06-25	Alex Duan	Module of RTOS moved to CRTObject class.
//    V1.2	2003-11-16	Alex Duan	Add a group of functions for profile saving
//									and restoring.
//	  V1.3	2006-09-11	Bozhong Xu	Support distribute system and sub system. 
//									Move initialize task from InitTask to InitInstance function.
//									
///////////////////////////////////////////////////////////////////////////////
#define GLOBALS

#include "APPCORE.H"
#include "rtcDriver.h"
#include "FlashFile.h"

///////////////////////////////////////////////////////////////////////////////
// external variables and functions
extern "C"
{
	// system reset mode (Software reset/Hardware reset)(defined in init.s)
	extern BYTE RESET_MODE;
	// initializes the library and calls the global object's constructors
	void __rt_lib_init(void);
}

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// default file content of "System.ini"
//
//; System.ini
//; ==========
//;
//; This INI file contains information that is necessary for
//; firmware to support a device. The firmware reads this file
//; on startup and when the device changes. The format of the
//; contents may change at any time when the EFC updates.
//;
//; The entries have the following format, spaces can be added
//; before or after the equal sign:
//;
//; <Entry> = <Value>
//;
//; The [Device] section contains parameters of the whole device.
//; The [Message] section contains parameters of the communication.
//; The [Users] section contains parameters of system users.
//; The [Boards(m)] section contains parameters of one board.
//;   m(=0,1,...) is the index of the board in the device.
//; The [Interfaces(m,n)] section contains parameters of one interface.
//;   m(=0,1,...) is the index of the board;
//;   n(=0,1,...) is the index of the interface in the board.
//; Other sections can be added to this file too.
//; Last updated: 11/12/2003, Alex Duan

static LPCSTR s_pszSystem = "\
[Users]\r\n\
user1 = dvlp,dvlp,1\r\n\
user2 = support,support,2\r\n\
user3 = sundata,sundata,3\r\n\
user4 = ulinkcom,ulinkcom,4\r\n\
\r\n\
[Device]\r\n\
m_diInfo.strName = unit 1\r\n\
m_diInfo.aAddr.uAddrL = 1\r\n\
m_diInfo.aAddr.uAddrH = 0\r\n\
m_diInfo.aAddr.uGroup = 0\r\n\
m_diInfo.dMadeDate.uDay = 0\r\n\
m_diInfo.dMadeDate.uMonth = 0\r\n\
m_diInfo.dMadeDate.wYear = 0\r\n\
m_diInfo.strSerial =  \r\n\
m_diInfo.strProducer = Ulink Telecom Equipment Co., Ltd.\r\n\
m_ndDevice.strName = s3c4510\r\n\
m_ndDevice.auIP = 192.168.0.201\r\n\
m_ndDevice.auSubnet = 255.255.255.0\r\n\
m_ndDevice.auGateway = 192.168.0.1\r\n\
m_ndDevice.nPort = 5000\r\n\
m_ndDevice.auMac = 00-0B-9A-00-00-06\r\n\
\r\n\
[Message]\r\n\
SESSION::nTimeout = 0\r\n\
m_usUart[0].uPort = 0\r\n\
m_usUart[0].dwBaudRate = 9600\r\n\
m_usUart[0].uDataBits = 8\r\n\
m_usUart[0].uParity = 0\r\n\
m_usUart[0].uStopBits = 1\r\n\
m_usUart[1].uPort = 1\r\n\
m_usUart[1].dwBaudRate = 57600\r\n\
m_usUart[1].uDataBits = 8\r\n\
m_usUart[1].uParity = 0\r\n\
m_usUart[1].uStopBits = 1\r\n\
";
///////////////////////////////////////////////////////////////////////////////
// CProfileEntry

CProfileEntry::CProfileEntry()
{
	nReadRights  = ACCESS_LEVEL_READONLY;
	nWriteRights = ACCESS_LEVEL_GENERAL;
	pNext = NULL;
}

CProfileEntry::~CProfileEntry()
{
	if (pNext != NULL)
	{
		delete pNext;
		pNext = NULL;
	}
}

///////////////////////////////////////////////////////////////////////////////
// CProfileSection
CProfileSection::CProfileSection()
{
	nReadRights  = ACCESS_LEVEL_READONLY;
	nWriteRights = ACCESS_LEVEL_GENERAL;
	pEntryHeader = NULL;
	pNext  = NULL;
}

CProfileSection::~CProfileSection()
{
	if (pEntryHeader != NULL)
	{
		delete pEntryHeader;
		pEntryHeader = NULL;
	}
	if (pNext != NULL)
	{
		delete pNext;
		pNext = NULL;
	}
}

///////////////////////////////////////////////////////////////////////////////
// CRTApp

IMPLEMENT_DYNAMIC(CRTApp, CRTObject)

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CRTApp* CRTApp::ms_pInstance = NULL;
CRTApp::CRTApp(DWORD dwPoolSize, DWORD dwMinAlloc)
{
	ASSERT_VALID(this);
	ASSERT(ms_pInstance == NULL); // insure only one instance

	ms_pInstance = this;
	m_dwPoolSize = dwPoolSize;
	m_dwMinAlloc = dwMinAlloc;
	m_pcdDevice	 = NULL;
#ifdef __EFC_MASTER // Added by xbz	
	m_pcmMessage = NULL;	
	m_pceEventLog= NULL;
	m_pcuUser	 = NULL;
#endif
	m_bModified	 = FALSE;
	m_pNextMemory= NULL;
	m_pSectionHeader = NULL;

	m_bDistributed = FALSE;
	m_bSubsystem = FALSE;
	m_bWatchdog = TRUE;
	m_bRTC = TRUE;	
}

///////////////////////////////////////////////////////////////////////////////
// Remarks:
//		This destructor will not be called in real-time system, so if you are
//		sensitive the size of the code, you can comment out the lines inside
//		this function. I write these codes only to keep integrality of class.
CRTApp::~CRTApp()
{
	// free memory of system default objects
	if (m_pcdDevice) 
		delete m_pcdDevice;
#ifdef __EFC_MASTER // Added by xbz
	if (m_pcuUser)
		delete m_pcuUser;
	if (m_pceEventLog) 
		delete m_pceEventLog;	
	if (m_pcmMessage) 
		delete m_pcmMessage;
#endif
	if (m_pSectionHeader)
		delete m_pSectionHeader;
}

///////////////////////////////////////////////////////////////////////////////
// Application entry point

void Application_Initialize(void* pMemory)
{
#if !defined(WIN32)
	__rt_lib_init();
#endif // !defined(WIN32)

	ASSERT(GetApp());
	ASSERT(GetApp()->m_dwPoolSize);
	ASSERT(GetApp()->m_dwMinAlloc);

	//
	// create memory pool for the application
	//
	VERIFY(NU_Create_Memory_Pool(&System_Memory, (LPSTR)"SystemMemory", 
		pMemory, GetApp()->m_dwPoolSize, GetApp()->m_dwMinAlloc, 
		NU_FIFO) == NU_SUCCESS);

	pMemory = (BYTE*)pMemory + GetApp()->m_dwPoolSize;
	GetApp()->m_pNextMemory = pMemory; // Added by Bozhong Xu

	if (!GetApp()->IsSubSystem()) // Added by Bozhong Xu
	{
		//
		// create memory pool for the network
		//
		NU_MEMORY_POOL NetMemory;
		VERIFY(NU_Create_Memory_Pool(&NetMemory, (LPSTR)"NetMemory",
			pMemory, NU_NET_BUFFER_POOL_SIZE, 50, NU_FIFO) == NU_SUCCESS);
		
		GetApp()->m_pNextMemory = (BYTE*)pMemory + NU_NET_BUFFER_POOL_SIZE;
		
		// call network initialization
		VERIFY(NU_Init_Net(&NetMemory) == NU_SUCCESS);
	}	

	// create application initialization task.
	VERIFY(GetApp()->CreateTask("InitTask", (PFNTASK)&CRTApp::InitTask));
}

// This task is used to init the system only.
void CRTApp::InitTask(DWORD argc, void *argv)
{
	UNUSED_ARG(argc, argv);	
	
	// Set file section name
	SetSectionString("App");
	
	if (m_bWatchdog)
	{
		// reset watchdog
		SetBitVal(IOPDATA, IO_WATCHDOG, !GetBitVal(IOPDATA, IO_WATCHDOG));
	}

	// Create a event for saving data
	m_evSave = CreateEventGroup("Event_Save");
	ASSERT(m_evSave);

	
	if (m_bRTC)
	{
		// (1) Initializes the Real-Time Clock
		rtcInit();
		
		if (m_bWatchdog)
		{
			// reset watchdog
			SetBitVal(IOPDATA, IO_WATCHDOG, !GetBitVal(IOPDATA, IO_WATCHDOG));	
		}
	}

	// (2) Creates device and startup watchdog timer
	OnCreateDevice();
	if (m_bWatchdog)
		VERIFY(m_pcdDevice->OnWatchdogTimer());

	// It it is not a sub system, we should create CUser, CEventLog,
	// and CMessage object
#ifdef __EFC_MASTER // Added by xbz
	if (!m_bSubsystem)
	{		
		OnCreateEventLog();		
		OnCreateUser();
		OnCreateMessage();
	}	
#endif
	// (3) Load system parameters
	CFlashFile file;
	if (!file.Open("System.ini", CFile::modeRead)) // modeRead: do not save
	{// if file not found, then default file text been read
		LPCSTR lpszBase = CRTApp::GetDefaultConfig(); // Parent class's config
		LPCSTR lpszDerived = GetDefaultConfig();	  // Child class's config
		file.WriteLine(lpszBase);
		if (lpszDerived != lpszBase)
		{
			file.WriteLine(lpszDerived);
		}
		file.SeekToBegin();
	}
	LoadFromFile(file);
	file.Close();

	// (4) call system object's init function.
#ifdef __EFC_MASTER // Added by xbz	
	if (m_pcmMessage)
		m_pcmMessage->OnInitMessage();
#endif	
	VERIFY(m_pcdDevice->OnInitDevice());

	// (5) Creates a task saving configuration to flash
	VERIFY(CreateTask("FileTask", (PFNTASK)&CRTApp::FileTask));
	
	// (6) Adds the system reset event	
//	BYTE pReset;
//	memcpy(&pReset,&RESET_MODE,1);
//	BYTE auParam[5] = {EVENT_SYSTEM_RESET, pReset, 1, 0, 0};
//	m_pcdDevice->OnAddEventToTable(auParam);
	RESET_MODE = 1; // 0: Hardware reset, 1: software reset
//	AddEvent(EVENT_SYSTEM_RESET, &RESET_MODE, 1);

	// Calls initialization
	VERIFY(InitInstance());
	
	// Deletes the init task
	VERIFY(DeleteTask("InitTask"));
}

// Creates the system CDevice object
void CRTApp::OnCreateDevice()
{
	ASSERT(m_pcdDevice == NULL);		
	m_pcdDevice = new CDevice();
	VERIFY(m_pcdDevice);
}

#ifdef __EFC_MASTER // Added by xbz
// Creates the system CEventLog object
void CRTApp::OnCreateEventLog()
{
	ASSERT(m_pceEventLog == NULL);
	m_pceEventLog = new CEventLog();
	VERIFY(m_pceEventLog);
}

// Creates the system CUser object
void CRTApp::OnCreateUser()
{
	ASSERT(m_pcuUser == NULL);
	m_pcuUser = new CUser();
	VERIFY(m_pcuUser);
}

// Creates the system CMessage object
void CRTApp::OnCreateMessage()
{
	ASSERT(m_pcmMessage == NULL);
	m_pcmMessage = new CMessage();
	VERIFY(m_pcmMessage);
}
#endif

// Set Save flags
void CRTApp::SetModifiedFlag(BOOL bModified)
{ 
	m_bModified = bModified; 

	if (bModified)
		NU_Set_Events(m_evSave, 0x01, NU_OR);
}

// Task used to save configuration file & events
void CRTApp::FileTask(DWORD argc, void *argv)
{
	UNUSED_ARG(argc, argv);
	CFlashFile file;
	UNSIGNED flags;
	while (1) 
	{
		if (NU_Retrieve_Events(m_evSave, 0x01, NU_OR_CONSUME, 
			&flags, NU_SUSPEND) == NU_SUCCESS)		
		{
			file.Open("System.ini", CFile::modeCreate);
			file.SeekToBegin();
			SaveToFile(file);
			file.Close(); // save to flash
			SetModifiedFlag(FALSE);
		}
	}
}

// read data from file
BOOL CRTApp::LoadFromFile(CFile &file, int nRights)
{
	if (nRights == 0)
		return FALSE; // no rights to load

	CString strLine, strUnit;
	CProfileSection *pSection = NULL;
	CProfileEntry *pEntry = NULL;
	int pos;

//	BOOL bAppFile = FALSE;//Added by bella yu 2005/01/25
	
	while (file.ReadLine(strLine))
	{
/*

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一区在线观看免费| 亚洲欧洲精品一区二区三区| 风间由美一区二区av101| 亚洲国产成人tv| 日本一区二区免费在线| 91久久一区二区| 麻豆精品一区二区综合av| 久久精品亚洲乱码伦伦中文 | 精品国产乱码久久久久久久| 成人中文字幕在线| 琪琪久久久久日韩精品| 国产拍欧美日韩视频二区| 欧美色网站导航| 99在线热播精品免费| 日本vs亚洲vs韩国一区三区 | 精品国产凹凸成av人网站| 99久久精品一区| 蜜桃av一区二区三区| 亚洲精品国产a| 国产无人区一区二区三区| 欧美最猛黑人xxxxx猛交| 国内精品久久久久影院薰衣草 | 日韩成人精品在线观看| 国产精品久久免费看| 日韩一区二区在线观看视频| 在线观看视频欧美| 成人午夜激情在线| 美女免费视频一区| 亚洲国产成人精品视频| 综合网在线视频| 欧美国产日本韩| 日韩欧美在线一区二区三区| 欧美精品一二三| 一本高清dvd不卡在线观看| 精品午夜久久福利影院| 天天av天天翘天天综合网| 中文字幕免费观看一区| 日韩欧美一级片| 欧美成人a∨高清免费观看| 欧美性受极品xxxx喷水| 成人精品免费看| 国产福利精品一区| 蜜臀av国产精品久久久久| 亚洲精品视频在线观看免费| 国产精品高潮呻吟| 国产欧美日韩精品一区| 精品av久久707| 日韩丝袜美女视频| 欧美顶级少妇做爰| 成人自拍视频在线| 国产不卡视频一区| 国产成人一区二区精品非洲| 久久99精品国产91久久来源| 国产精品一区二区视频| 成人动漫视频在线| 色婷婷综合视频在线观看| 欧美性猛片aaaaaaa做受| 欧美日韩在线播放三区| 欧美性三三影院| 91精品国产综合久久婷婷香蕉 | 免费成人你懂的| 日本亚洲免费观看| 国产成人精品一区二区三区四区| 高清在线观看日韩| 日本久久电影网| 日韩一区二区免费视频| 久久久亚洲综合| 综合在线观看色| 日本不卡1234视频| 懂色中文一区二区在线播放| 色综合 综合色| 欧美一区二区三区在线看| 久久久五月婷婷| 亚洲一区二区三区四区不卡| 免费av网站大全久久| 成人美女在线视频| 欧美猛男gaygay网站| 久久精品一区二区三区不卡牛牛| 亚洲女人小视频在线观看| 免费精品视频最新在线| 99热99精品| 欧美不卡视频一区| 一区在线中文字幕| 麻豆成人久久精品二区三区红 | 日韩一区二区免费在线电影| 国产精品色在线观看| 日韩成人精品在线| 91亚洲精品乱码久久久久久蜜桃| 91精品国产综合久久小美女| 国产精品免费人成网站| 日产精品久久久久久久性色| av网站免费线看精品| 日韩精品一区二区三区视频在线观看 | 国产91在线观看丝袜| 欧美精品九九99久久| 国产精品无圣光一区二区| 三级久久三级久久| av不卡在线观看| 久久久综合网站| 日本系列欧美系列| 欧美性猛片aaaaaaa做受| 国产人伦精品一区二区| 日本欧美在线看| 一本一道久久a久久精品综合蜜臀| 欧美一级二级三级乱码| 一区二区三区丝袜| 成人午夜av电影| 精品欧美久久久| 天天色图综合网| 91国产视频在线观看| 国产精品麻豆久久久| 国产在线不卡一区| 欧美成人video| 日本成人在线网站| 欧美日韩亚洲综合| 亚洲精品欧美综合四区| av电影在线不卡| 国产日韩欧美不卡在线| 经典三级一区二区| 精品久久久久久综合日本欧美 | 国产美女在线观看一区| 欧美成人官网二区| 免费在线观看一区| 日韩一卡二卡三卡国产欧美| 亚洲国产日韩精品| 欧美日韩国产区一| 亚洲国产综合91精品麻豆| 欧洲国内综合视频| 亚洲午夜久久久久久久久电影网 | av中文字幕亚洲| 国产精品丝袜一区| 波多野结衣在线一区| 国产精品每日更新| 成人一区在线看| 中文字幕第一区| 91日韩在线专区| 亚洲三级在线看| 欧洲精品视频在线观看| 亚洲成人一二三| 3d动漫精品啪啪| 久久99久久99精品免视看婷婷 | 国产精品久久久久9999吃药| 国产suv精品一区二区6| 日本一区二区三级电影在线观看| 懂色av一区二区三区免费观看| 26uuu精品一区二区| 国内外精品视频| 国产精品视频观看| 欧美主播一区二区三区| 天天操天天干天天综合网| 日韩欧美成人激情| 丁香激情综合国产| 亚洲精品写真福利| 欧美一区欧美二区| 国产精品99久久久| 18成人在线观看| 欧洲精品一区二区三区在线观看| 午夜国产不卡在线观看视频| 欧美一二区视频| 成人午夜av影视| 亚洲一区二区视频在线观看| 91精品欧美综合在线观看最新| 国内精品不卡在线| 亚洲欧美综合在线精品| 欧美日韩精品一区二区三区蜜桃| 麻豆精品在线视频| 国产精品乱码一区二三区小蝌蚪| 在线观看成人小视频| 热久久国产精品| 中文字幕欧美区| 欧美日韩精品二区第二页| 免费精品视频在线| 国产精品伦理一区二区| 欧美日韩国产小视频在线观看| 国产一区二区网址| 亚洲女子a中天字幕| 精品国产网站在线观看| 色呦呦国产精品| 国产麻豆一精品一av一免费| 中文字幕视频一区| 日韩欧美你懂的| 色综合天天性综合| 久久av资源网| 亚洲一区欧美一区| 国产色一区二区| 欧美理论片在线| eeuss影院一区二区三区| 美女性感视频久久| 亚洲欧洲综合另类在线| 欧美xxx久久| 欧美伊人精品成人久久综合97| 国产精品996| 日韩精品电影在线| 亚洲三级在线免费观看| 久久看人人爽人人| 欧美一区二区三区在线观看 | 欧美日韩国产色站一区二区三区| 国产91高潮流白浆在线麻豆 | 亚洲精品一区二区三区香蕉| 在线亚洲高清视频|