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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? coffloader.cpp

?? dsp2808控制的代碼
?? CPP
?? 第 1 頁 / 共 4 頁
字號:
/*
 *  Copyright 2003 by Spectrum Digital Incorporated.
 *  All rights reserved. Property of Spectrum Digital Incorporated.
 */

// CoffLoader.cpp
#include "stdafx.h"
#include "SDLoader.h"
#include "SDLoaderDlg.h"

/* ==============================
   Valid register names and size
    {"PC",       sizeof(TREG_32)
    {"SP",       sizeof(TREG_16)
    {"ACC",      sizeof(TREG_32)
    {"P",        sizeof(TREG_32)
    {"T",        sizeof(TREG_16)
    {"ST0",      sizeof(TREG_16)
    {"ST1",      sizeof(TREG_16)
    {"AR0",      sizeof(TREG_16)
    {"AR1",      sizeof(TREG_16)
    {"AR2",      sizeof(TREG_16)
    {"AR3",      sizeof(TREG_16)
    {"AR4",      sizeof(TREG_16)
    {"AR5",      sizeof(TREG_16)
    {"XAR6",     sizeof(TREG_32)
    {"XAR7",     sizeof(TREG_32)
    {"IER",      sizeof(TREG_16)
    {"DP",       sizeof(TREG_16)
    {"IFR",      sizeof(TREG_16)
    {"DBGIER",   sizeof(TREG_16)
    // Added June 2004.
    {"DBGIM",    sizeof(TREG_16)
    {"HPI",      sizeof(TREG_16)
    {"PREEMPT",  sizeof(TREG_16)
    // This is little hack to get C28xx XARx regs.  The ids
    // still match C27xx but low level driver will return 32
    // bit value
    {"XAR0",     sizeof(TREG_32)
    {"XAR1",     sizeof(TREG_32)
    {"XAR2",     sizeof(TREG_32)
    {"XAR3",     sizeof(TREG_32)
    {"XAR4",     sizeof(TREG_32)
    {"XAR5",     sizeof(TREG_32)
*/

/*F***************************************************************************
* NAME:  Constructor
*
* DESCRIPTION:  Do basic initialization here.
*
*
*F***************************************************************************/
CoffLoader::CoffLoader( )               
{
    m_pSdti_Intf      = NULL; 
    m_Sdti_Hndl       = NULL; 
    m_isConnected     = FALSE;

    m_coffHndl        = NULL;         
    m_coffLib         = NULL;  
	m_symlist         = NULL;
    m_swbplist        = NULL;
    m_numSymbols      = 0;

    m_verboseError    = TRUE;
    m_verboseMessage  = TRUE;
    m_SciLoopBack     = FALSE;
    m_CanLoopBack     = FALSE;
    m_I2CLoopBack     = FALSE;

    m_isRealTimeAllowed = FALSE;
}

/*F***************************************************************************
* NAME: Destructor 
*
* DESCRIPTION:  Do cleanup here.  In theory the main code cleans up after
*               itself.  But just in case there is a untested exit path we
*               can catch it here.  Beware clean up has to be done in reverse
*               order.
*
*F***************************************************************************/
CoffLoader::~CoffLoader( ) 
{
    CloseConnection();
}

/*F***************************************************************************
* NAME:   Message( CString MsgString ) 
*
* DESCRIPTION:  
*      This function allows for messages to be posted back to the main dialog
*      window.  Each message string is allocated as a new CString object. This
*      ensures no memory problems when the code load has completed.
*
*F***************************************************************************/
void CoffLoader::Message( CString MsgString )
{
	if( m_verboseMessage == TRUE )
	{
		/* Create a new CString object */ 
		CString * message = new CString( MsgString );

		/* Post the message to the Dialog Window */ 
		m_mainWindow->PostMessage( UWM_ONTHREADMESSAGE, 0, ( LPARAM )message );
	}
}
/*F***************************************************************************
* NAME:   ErrMsg( CString MsgString ) 
*
* DESCRIPTION:  
*      This function allows for erros to be posted back to the main dialog
*      window.  Each message string is allocated as a new CString object. This
*      ensures no memory problems when the code load has completed.
*
*F***************************************************************************/
void CoffLoader::ErrMsg( CString MsgString )
{
	if( m_verboseError == TRUE )
	{
		/* Create a new CString object */ 
		CString * message = new CString( MsgString );

		/* Post the message to the Dialog Window */ 
		m_mainWindow->PostMessage( UWM_ONTHREADMESSAGE, 0, ( LPARAM )message );
	}
}


/*F***************************************************************************
* NAME: OpenConnection( void )    
*
* DESCRIPTION: Open emulation connection
*
*
*F***************************************************************************/
BOOL CoffLoader::OpenConnection( void )
{

    // Just one connection per session
    if( m_isConnected == TRUE )
        return( FALSE );

    // Create SD_TARGET_INTERFACE 
    if ( ! SDTI_GetInterface( ( void** )&m_pSdti_Intf, CSTRING_TO_PCHAR( m_procFamily ) ) )
    {
        ErrMsg( "ERROR \tCannot fetch SD Target Interface for processor type "
                + m_procFamily );
        return( FALSE );
    }

    // Create m_Sdti_Hndl, TMS320C27XX_28XX is the name embedded into the ccs .dvr file.
	// If we specify a name then SDTI will check for valid name.  Else pass NULL and
	// take what you get.
	//
    if ( ! m_pSdti_Intf->pCfg->CreateHndl( &m_Sdti_Hndl,
                                          CSTRING_TO_PCHAR( m_driverPath ),
                                          CSTRING_TO_PCHAR( m_driverName ),
										  "TMS320C27XX_28XX" ))
    {
        ErrMsg( "ERROR \tCannot create a SDTI handle for processor type "
                + m_procFamily + " in driver " + m_driverName );
        return( FALSE );
    }

    // The SetOptions function will inform the drivers on what the
    // board setting is currently being used and which processor on the board
    // the user wants to access.
    //
    // The physical link between computer and target board may vary from a
    // parallel port ( address 0x378 ) to usb ( address 0x540 ).  Each type of link
    // has an associated port address used for emulation.
    //
    // The diverse board configurations require an external board file to be
    // used.  This board file contains the type of processors used and the
    // position of each on the scan chain.
    //
    // To access a single processor on the board, the drivers needs to
    // identified it through the board file's scan chain.  Each processor is
    // designated with a "cpu_#", where # is the position.
    //
    // DevConnectRealtime             (YES/NO)
    // DevRunOnDisconnect             (YES/NO)
    // DevEnableMemoryMapChecking     (YES/NO)
    // DevMaxMemoryBlockSize          (256-2048)
    // DevForceStatusCheck            (YES/NO) 

    // Set emulator port address 
    if ( ! m_pSdti_Intf->pCfg->SetOptions( m_Sdti_Hndl, CSTRING_TO_PCHAR( "EmuPortAddr=" + m_procAddr ) ) )
    {
        ErrMsg( "ERROR \tFailed to Set Option [ EmuPortAddr="
                + m_procAddr + " ]." );
        return( FALSE );
    }

    // Set device board file
    if ( ! m_pSdti_Intf->pCfg->SetOptions( m_Sdti_Hndl, CSTRING_TO_PCHAR( m_BoardFile ) ) )
    {
        ErrMsg( "ERROR \tFailed to Set Option [ DevBoardName="
                  + m_workingDirectory + m_targetPath + m_boardName + " ]." );
        return( FALSE );
    }

    // Set device processor 
    if ( ! m_pSdti_Intf->pCfg->SetOptions( m_Sdti_Hndl, CSTRING_TO_PCHAR( "DevProcName=" + m_procName ) ) )
    {
        ErrMsg( "ERROR \tFailed to Set Option [ DevProcName="
                + m_procName + " ]." );
        return( FALSE );
    }
    // Set the memory block size
    if ( ! m_pSdti_Intf->pCfg->SetOptions( m_Sdti_Hndl, CSTRING_TO_PCHAR( "DevMaxMemoryBlockSize=2048") ) )
    {
        ErrMsg( "ERROR \tFailed to Set Option [ DevProcName="
                + m_procName + " ]." );
        return( FALSE );
    }

    //
    //   Once the configuration settings are complete, the computer
    // can now connect to the processor.  After a successful connection to the
    // processor, all non-configuration functions become available to use.
    // 
    // Connect to target processor 
    if ( ! m_pSdti_Intf->pCfg->Connect( m_Sdti_Hndl ) )
    {
        ErrMsg( "ERROR \tFailed to CONNECT to Target." );
		// Flush error/messages for debug
		while( CheckEvents() ){}
        return( FALSE );
    }
    
    m_isConnected = TRUE;
    return( TRUE );
}

/*F***************************************************************************
* NAME: CloseConnection( void )    
*
* DESCRIPTION: Close emulation connection
*
*
*F***************************************************************************/
BOOL CoffLoader::CloseConnection(void)
{
    // Delete breakpoints if they exists
    if( m_swbplist != NULL ) {
        DeleteSwbpList();
        m_swbplist = NULL;
    }

    // Delete symbols
    if( m_symlist != NULL ) {
		DeleteSymbolList();
		m_symlist = NULL;
	}

	// Close any open handles and free lists if they are still active
	//
    if( (m_coffLib != NULL)	&& ( m_coffHndl != NULL )) {
        m_coffLib->COFFR_FileClose( m_coffHndl );
		m_coffHndl = NULL;
	}

    // Close the emulation connection
	if( (m_pSdti_Intf != NULL ) && ( m_Sdti_Hndl != NULL )) {
        m_pSdti_Intf->pCfg->Disconnect( m_Sdti_Hndl );

        m_pSdti_Intf->pCfg->FreeHndl( m_Sdti_Hndl );
		m_Sdti_Hndl = NULL;

        /* Sleep for 2 second so usb device can disconnect from windows.
         * Windows USB Issue */ 
        Sleep(2000);

	}

    m_isConnected = FALSE;
    return( TRUE );
}

BOOL CoffLoader::CheckConnection(void)
{
    if(     ( m_pSdti_Intf   == NULL )
        ||  ( m_Sdti_Hndl    == NULL )
        ||  ( m_isConnected  == FALSE)) {
        return( FALSE );
    }else {
        return( TRUE );
    }
}
/*F***************************************************************************
* NAME: InitEvent( void )    
*
* DESCRIPTION: Set the status event to a NULL state.
*
*
*F***************************************************************************/
void CoffLoader::InitEvent( void ) 
{	
	m_Evt.EvtId   = 0;
	m_Evt.Taddr   = 0;
	m_Evt.Space   = M_NATURAL;
	m_Evt.Type    = EVT_NONE;
	m_Evt.System  = EVT_SYS_NONE;
	m_Evt.Error   = 0;
}

/*F***************************************************************************
* NAME:  CheckEvents( void )  
*
* DESCRIPTION:  The SDTI interface puts pretty much all status and errors into
*               and event queue.  This is a common place to pull all the events
*               and process they come in.
*
*F***************************************************************************/
BOOL CoffLoader::CheckEvents( void )
{
    BOOL              isEvt;
	
    // Always test for connection to prevent user calling in disconnected
    // state or with NULL handles.
    if( CheckConnection() == FALSE ) {
        return( FALSE );
    }

	InitEvent();

    isEvt = m_pSdti_Intf->pExe->IsEvent( m_Sdti_Hndl, &m_Evt );
    if( isEvt )
    {
		// Event processing flow:
		// 1) Handle error events first
		// 2) Then spurious errors that are do not generate system events.
		//    Generally code mishap.
		// 3) Then handle target events like breakpoints and such

		if( m_Evt.System != EVT_SYS_NONE )
        {
			// 1) System error events

			// If system warning event then do not send error message.
			// These are for internal processing.  Return that we saw
			// an event so that caller can continue processing other
			// events as required.
			if( m_Evt.System == EVT_SYS_WARN )
				return( isEvt );
			else
			{
				// If we have a DISCONNECTED error then return isEvt==FALSE.
				// If you are disconnected you will always get a disconnected
				// error, i.e. an endless loop
				//
				if( m_Evt.Error == CFG_ERR_DISCONNECTED )
					return( FALSE );

    			CString Error;
       
				if( m_Evt.Error > (CFG_ERR_GENERIC -1 ) ) {
					Error.Format( "ERR: SDTI error: Id: %x, Addr: 0x%x, Space: %x, Type: %x, System: 0x%x, Error: %d",
									m_Evt.EvtId, 
									m_Evt.Taddr, 
									m_Evt.Space, 
									m_Evt.Type,
									m_Evt.System, 
									m_Evt.Error );
				}
				else if ( m_Evt.Error < 0 ) {	
                    // Handle the USB connection error special
                    if( m_Evt.Error == -4037 ) {
                        Error.Format( "ERR: USB Error: %d, USB connection not found or in use by another application",
									                       m_Evt.Error );
                    }
                    else {
					    Error.Format( "ERR: OTIS error: Id: %x, Addr: 0x%x, Space: %x, Type: %x, System: 0x%x, Error: %d",
									    m_Evt.EvtId, 
									    m_Evt.Taddr, 
									    m_Evt.Space, 
									    m_Evt.Type,
									    m_Evt.System, 
									    m_Evt.Error );
                    }
				}

				if( !Error.IsEmpty() ) {
					ErrMsg( Error + "\r\n");
				}
			}
        }
		else
		{
	  	    // This should not occur but here for safety
			if( m_Evt.Error )
			{
				// 2) Spurious events

				// If we have a DISCONNECTED error then return isEvt==FALSE.
				// If you are disconnected you will always get a disconnected
				// error, i.e. an endless loop
				//
				if( m_Evt.Error == CFG_ERR_DISCONNECTED )
					return( FALSE );
				else
				{
					switch( m_Evt.Error )
					{
						case CFG_ERR_LIB_HANDLE:
							ErrMsg("ERR: Could not obtain a handle to specified driver");
							break;
						case CFG_ERR_LIB_INTERFACE:
							ErrMsg("ERR: Driver interface is not supported");
							break;
						case CFG_ERR_LIB_VERSION:
							ErrMsg("ERR: Driver version is incorrect");
							break;
						case CFG_ERR_FAMILY:
							ErrMsg("ERR: Processor family is not supported");
							break;
						default:
							ErrMsg("MSG: Execution event detected");
							break;
					}
				}
			}
			else if( m_Evt.Type != EVT_NONE )
			{

				// 3) Target events like breakpoints.  Nothing to do but could
				//    add some messages and stuff.   
   			    CString StopEvent;

                switch( m_Evt.Type )
                {
                    case EVT_HALT:
     			        StopEvent.Format( "Stopped at Addr: 0x%x",m_Evt.Taddr );
                        break;

                    case EVT_SWBP:
     			        StopEvent.Format( "Breakpoint at Addr: 0x%x",m_Evt.Taddr );
                        break;
                    case EVT_HWIAQ:
     			        StopEvent.Format( "Hardware IAQ at Addr: 0x%x",m_Evt.Taddr );
                        break;

                    case EVT_HWDATA:
     			        StopEvent.Format( "Hardware data break at Addr: 0x%x",m_Evt.Taddr );
                        break;
                }
                
          		if( !StopEvent.IsEmpty() ) {
				    Message( StopEvent );
				}

			}
		}
    }

    return( isEvt );
}

/*F***************************************************************************
* NAME:   WaitForHaltEvent( ) 
*
* DESCRIPTION:  Following a run command we can wait for target to halt
*               execution.  If we get a system event then this is probably
*               and error.  In in this case we still break out so that caller
*               can take action.  Otherwise any event other the EVT_NONE will
*               have halted the processor.
*
*F***************************************************************************/
BOOL CoffLoader::WaitForHaltEvent( )
{
	BOOL isEvt = FALSE;
	long  TimeOutInMs = (long)(((m_ExecTimeoutMs+9)/10)*10);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲美女偷拍久久| 国产欧美一区二区在线观看| 亚洲欧美日韩电影| 色婷婷综合久久久中文一区二区| 中文字幕va一区二区三区| 粉嫩13p一区二区三区| 亚洲三级在线播放| 欧美网站一区二区| 青青草精品视频| 久久精品免视看| 不卡的电影网站| 亚洲成人精品影院| 日韩精品一区二区三区在线观看| 国产精品一区在线观看你懂的| 欧美国产精品久久| 99久久精品费精品国产一区二区| 亚洲免费观看在线观看| 欧美乱妇15p| 国产麻豆精品95视频| 中文字幕中文字幕在线一区 | 91精品国产综合久久福利软件| 日本欧美肥老太交大片| 欧美激情一区二区三区四区| 色天使久久综合网天天| 久久精品国产99国产| 中文av一区特黄| 欧美日韩国产影片| 精品一区二区久久久| 亚洲欧洲制服丝袜| 日韩美一区二区三区| 91视频免费看| 国内精品视频一区二区三区八戒| 国产精品女人毛片| 宅男在线国产精品| 91小视频免费观看| 韩国av一区二区三区在线观看| 中文字幕亚洲电影| 久久综合给合久久狠狠狠97色69| 色综合久久综合网欧美综合网| 蜜桃视频第一区免费观看| 亚洲欧美aⅴ...| 久久久777精品电影网影网| 欧美日韩国产片| 岛国精品一区二区| 蜜乳av一区二区| 亚洲另类春色校园小说| 国产日韩精品一区二区三区 | 欧美成人三级在线| 99精品国产91久久久久久| 久久精品国产第一区二区三区| 亚洲欧美日韩电影| 欧美高清一级片在线观看| 日韩一卡二卡三卡四卡| 欧美私人免费视频| 99久久国产综合精品女不卡| 国产激情91久久精品导航| 日本最新不卡在线| 亚洲aⅴ怡春院| 亚洲天堂2014| 国产精品激情偷乱一区二区∴| 69成人精品免费视频| 欧美午夜精品久久久久久孕妇 | 日韩视频免费观看高清完整版在线观看 | 色欲综合视频天天天| 国产精品夜夜爽| 精品一区二区三区免费毛片爱| 婷婷六月综合网| 亚洲电影一级黄| 亚洲图片自拍偷拍| 一区二区高清视频在线观看| 中文字幕制服丝袜一区二区三区| 久久综合色之久久综合| 日韩一区二区三区三四区视频在线观看| 色素色在线综合| 在线免费观看日韩欧美| 色综合久久久久综合体| 91在线观看一区二区| 成人激情免费网站| 99久久99久久久精品齐齐| 不卡一卡二卡三乱码免费网站| 成人av集中营| 成人a级免费电影| 99视频精品全部免费在线| 成人国产精品免费观看| 91一区一区三区| 日本高清无吗v一区| 在线免费观看成人短视频| 在线亚洲精品福利网址导航| 91久久精品一区二区| 欧美这里有精品| 3atv一区二区三区| 精品国产免费人成电影在线观看四季| 欧美tickle裸体挠脚心vk| 久久久久久久久免费| 国产三级精品三级| 亚洲欧美色图小说| 亚洲午夜精品在线| 日本不卡一区二区| 国产麻豆精品一区二区| 成人一区在线看| 日本精品一区二区三区高清| 56国语精品自产拍在线观看| 精品国产不卡一区二区三区| 国产午夜精品福利| 亚洲精品一二三| 蜜桃视频第一区免费观看| 国产乱国产乱300精品| 94-欧美-setu| 欧美一区二区三区公司| 国产网站一区二区| 欧美高清在线视频| 亚洲国产成人av| 国产一区二区三区在线观看免费视频 | 韩国视频一区二区| 91一区一区三区| 欧美一区二区三区四区视频 | 日韩美女视频一区| 日韩中文字幕不卡| 精品一区二区三区日韩| 91尤物视频在线观看| 日韩精品自拍偷拍| 亚洲欧美日韩一区| 美女性感视频久久| 99精品在线观看视频| 欧美一级在线视频| 亚洲美女偷拍久久| 国产精品一级片| 欧美高清一级片在线| 国产精品久久久99| 老司机午夜精品| 欧美影视一区在线| 国产欧美一区二区三区鸳鸯浴| 香蕉影视欧美成人| 97精品超碰一区二区三区| 日韩免费看网站| 亚洲成人精品影院| 91在线视频网址| 国产清纯白嫩初高生在线观看91| 视频一区二区三区入口| 一本色道久久加勒比精品| 欧美精品一区二区高清在线观看| 亚洲一区精品在线| 成人黄色片在线观看| 久久综合色一综合色88| 天天影视涩香欲综合网| 91老师片黄在线观看| 精品国产123| 午夜视频一区二区三区| 91高清在线观看| 国产精品乱子久久久久| 国产一区美女在线| 日韩视频中午一区| 天堂久久一区二区三区| 欧美视频精品在线| 亚洲一区二区精品视频| 91在线小视频| 亚洲女同ⅹxx女同tv| 91亚洲精品乱码久久久久久蜜桃| 国产三级一区二区| 国产一区在线看| 精品久久久久久久一区二区蜜臀| 免费成人结看片| 宅男噜噜噜66一区二区66| 午夜亚洲国产au精品一区二区| 欧美这里有精品| 亚洲第一精品在线| 欧美日韩国产综合一区二区| 亚洲自拍欧美精品| 在线观看免费成人| 亚洲丰满少妇videoshd| 欧美性生活大片视频| 亚洲福利电影网| 91精品国产91久久久久久一区二区| 亚洲一区二区三区四区在线免费观看| 成人av电影在线播放| 亚洲天堂a在线| 欧美性大战久久久久久久蜜臀| 亚洲最大成人网4388xx| 欧美性视频一区二区三区| 五月婷婷综合网| 91精品国产综合久久福利软件 | 夜夜嗨av一区二区三区网页 | 一本到高清视频免费精品| 综合久久一区二区三区| 一本到不卡精品视频在线观看| 亚洲自拍偷拍欧美| 欧美一区二区精美| 精品一区二区在线播放| 中文字幕精品—区二区四季| 91免费在线播放| 亚洲成av人影院在线观看网| 日韩欧美一区二区久久婷婷| 韩国v欧美v日本v亚洲v| 中文欧美字幕免费| 欧美午夜精品久久久久久孕妇| 麻豆国产一区二区| 欧美国产在线观看| 欧美午夜在线观看| 国产精品一线二线三线精华| 亚洲视频一区二区在线观看|