⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exdevice.c

📁 M-System DOC(Disk on a Chip) Flash芯片映像读写工具, 可以进行二片Flash芯片的内容互相拷贝, 提高烧录程序的效率.
💻 C
📖 第 1 页 / 共 2 页
字号:
 ***********************************************************************/

ExStatus EXAPI CloseErrorMsgDevice( ExDevice* pDevice )
{
	ExRemoveFromCloseAllList( pDevice );
	return ExOsCloseErrorMsgDevice( pDevice->data );
}

/***********************************************************************
 * Name : WriteErrorMsgDevice
 *   Write to Error Message Device
 *
 *
 * Parameters:
 *   pDevice  - pointer to a device
 *	 pStr	  -  pointer to a string that will be send to the Error msg device
 * Outputs:
 *   ExStatus -  status of the operation
 *
 ***********************************************************************/
ExStatus EXAPI WriteErrorMsgDevice( ExDevice* pDevice, void* pStr )
{
	return ExOsWriteErrorMsgDevice( pDevice->data, (EXCHAR*)pStr );
}

#endif /* EX_USE_ERROR_MSG_DEVICE */

/*---------------------------------------------------------------------------------*/
/* Progress Bar device functions */

#ifdef EX_USE_PROGRESS_BAR_DEVICE

/***********************************************************************
 * Name : OpenPrgBarDevice
 *   Open Progress Bar Device
 *
 *
 * Parameters:
 *   pDevice      - pointer to a device
 *	 pPrgBarName  - Progress Bar Name
 *	 dwPrgBarSize - Total number of items that will be assesed by the progress bar
 * Outputs:
 *   ExStatus -  status of the operation
 *
 ***********************************************************************/
ExStatus EXAPI OpenPrgBarDevice( ExDevice* pDevice, EXCHAR* pPrgBarName, EXDWORD dwPrgBarSize )
{
	if( ( exstat = ExOsOpenPrgBarDevice( &pDevice->data, pPrgBarName, dwPrgBarSize ) ) != EX_OK )
		return exstat;
	return ExAddToCloseAllList( pDevice, EX_PROGRESS_BAR_DEVICE );
}

/***********************************************************************
 * Name : ClosePrgBarDevice
 *   close Progress Bar Device
 *
 *
 * Parameters:
 *   pDevice      - pointer to a device
 *
 *
 * Outputs:
 *   ExStatus -  status of the operation
 *
 ***********************************************************************/
ExStatus EXAPI ClosePrgBarDevice( ExDevice* pDevice )
{
	ExRemoveFromCloseAllList( pDevice );
	return ExOsClosePrgBarDevice( pDevice->data );
}

/***********************************************************************
 * Name : WritePrgBarDevice
 *   write to the Progress Bar Device
 *
 *
 * Parameters:
 *   pDevice      - pointer to a device
 *	 dwDoneSoFar  - number of items that are done so far
 *
 * Outputs:
 *   ExStatus -  status of the operation
 *
 ***********************************************************************/
ExStatus EXAPI WritePrgBarDevice( ExDevice* pDevice, EXDWORD dwDoneSoFar )
{
	return ExOsWritePrgBarDevice( pDevice->data, dwDoneSoFar );
}

#endif /* EX_USE_ERROR_MSG_DEVICE */

/*---------------------------------------------------------------------------------*/
/* Serial file device functions */
#ifdef EX_USE_SERIAL_DEVICE

/***********************************************************************
 * Name : OpenSerialReadFileDevice
 *   Open Serial File Device for reading
 *
 *
 * Parameters:
 *   pDevice      - pointer to a device
 *	 pFileName    - pointer to a file name
 *
 * Outputs:
 *   ExStatus -  status of the operation
 *
 ***********************************************************************/
ExStatus EXAPI OpenSerialReadFileDevice( ExDevice* pDevice, EXCHAR* pFileName )
{
	if( ( exstat = ExOsOpenFile( &pDevice->data, pFileName, EX_READ_ONLY_FILE ) ) != EX_OK )
		return exstat;
	return ExAddToCloseAllList( pDevice, EX_SERIAL_READ_DEVICE );
}

/***********************************************************************
 * Name : OpenSerialWriteFileDevice
 *   Open Serial File Device for writing
 *
 *
 * Parameters:
 *   pDevice      - pointer to a device
 *	 pFileName    - pointer to a file name
 *
 * Outputs:
 *   ExStatus -  status of the operation
 *
 ***********************************************************************/
ExStatus EXAPI OpenSerialWriteFileDevice( ExDevice* pDevice, EXCHAR* pFileName )
{
	if( ( exstat = ExOsOpenFile( &pDevice->data, pFileName, EX_WRITE_ONLY_FILE ) ) != EX_OK )
		return exstat;
	return ExAddToCloseAllList( pDevice, EX_SERIAL_WRITE_DEVICE );
}

/***********************************************************************
 * Name : CloseReadSerialFileDevice
 *   Close Serial File Device that was opened for reading
 *
 *
 * Parameters:
 *   pDevice      - pointer to a device
 *
 * Outputs:
 *   ExStatus -  status of the operation
 *
 ***********************************************************************/
ExStatus EXAPI CloseReadSerialFileDevice( ExDevice* pDevice )
{
	ExRemoveFromCloseAllList( pDevice );
	return ExOsCloseFile( pDevice->data, EX_READ_ONLY_FILE );
}

/***********************************************************************
 * Name : CloseWriteSerialFileDevice
 *   Close Serial File Device that was opened for writing
 *
 *
 * Parameters:
 *   pDevice      - pointer to a device
 *
 * Outputs:
 *   ExStatus -  status of the operation
 *
 ***********************************************************************/
ExStatus EXAPI CloseWriteSerialFileDevice( ExDevice* pDevice )
{
	ExRemoveFromCloseAllList( pDevice );
	return ExOsCloseFile( pDevice->data, EX_WRITE_ONLY_FILE );
}

/***********************************************************************
 * Name : ReadSerialFileDevice
 *   Read data from Serial File Device
 *
 *
 * Parameters:
 *   pDevice      - pointer to a device
 *	 pBuff		  - buffer to which data will be read
 *	 Len		  - number of bytes to read
 * Outputs:
 *   ExStatus     - status of the operation
 *	 retBytesRead - number of bytes read
 *
 ***********************************************************************/
ExStatus EXAPI ReadSerialFileDevice( ExDevice* pDevice, void EXFAR* pBuff, EXDWORD Len ,EXDWORD* retBytesRead )
{
	return ExOsReadFromFile( pDevice->data, Len,pBuff, retBytesRead );
}

/***********************************************************************
 * Name : WriteSerialFileDevice
 *   write data to Serial File Device
 *
 *
 * Parameters:
 *   pDevice      - pointer to a device
 *	 pBuff		  - buffer from which data will be written
 *	 Len		  - number of bytes to read
 * Outputs:
 *   ExStatus     - status of the operation
 *
 ***********************************************************************/
ExStatus EXAPI WriteSerialFileDevice( ExDevice* pDevice, void EXFAR* pBuff, EXDWORD Len )
{
	return ExOsWriteToFile( pDevice->data, Len, pBuff );
}

ExStatus EXAPI SeekSerialFileDevice ( ExDevice* pDevice,EXDWORD dwOffset,int Origin)
{
	return ExOsSeekSerialFileDevice  (pDevice->data,dwOffset,Origin );
}


/***********************************************************************
 * Name : GetLengthOfSerialFileDevice
 *   Get Length Of Serial File
 *
 *
 * Parameters:
 *   pDevice      - pointer to a device
 *
 * Outputs:
 *   ExStatus     - status of the operation
 *	 retLen       - pointer to the len of the file
 ***********************************************************************/
ExStatus EXAPI GetLengthOfSerialFileDevice( ExDevice* pDevice, EXDWORD* retLen )
{
	return ExOsGetLengthOfSerialFileDevice( pDevice->data, retLen );
}

#endif /* EX_USE_SERIAL_DEVICE */


#ifdef EX_USE_USER_INPUT
/*---------------------------------------------------------------------------------*/
/* user input device functions */

/***********************************************************************
 * Name : OpenUserInputDevice
 *   Open User Input Device
 *
 *
 * Parameters:
 *   pDevice      - pointer to a device
 *
 * Outputs:
 *   ExStatus     - status of the operation
 *
 ***********************************************************************/
ExStatus EXAPI OpenUserInputDevice( ExDevice* pDevice )
{
	if( ( exstat = ExOsOpenUserInputDevice( &pDevice->data ) ) != EX_OK )
		return exstat;
	return ExAddToCloseAllList( pDevice, EX_USER_INPUT_DEVICE );
}

/***********************************************************************
 * Name : CloseUserInputDevice
 *   Close User Input Device
 *
 *
 * Parameters:
 *   pDevice      - pointer to a device
 *
 * Outputs:
 *   ExStatus     - status of the operation
 *
 ***********************************************************************/
ExStatus EXAPI CloseUserInputDevice( ExDevice* pDevice )
{
	ExRemoveFromCloseAllList( pDevice );
	return ExOsCloseUserInputDevice( pDevice->data );
}

/***********************************************************************
 * Name : WaitForCharUserInputDevice
 *   Disply the choices that user have, and wait for an char input
 *
 *
 * Parameters:
 *   pDevice		    - pointer to a device
 *	 waitForCharChoices - pointer to the struct that contain user options data
 * Outputs:
 *   ExStatus     - status of the operation
 *
 ***********************************************************************/
ExStatus EXAPI WaitForCharUserInputDevice( ExDevice* pDevice, ExWaitForCharChoices* waitForCharChoices )
{
    return ExOsWaitForCharUserInputDevice(  waitForCharChoices );
}

#endif	/* EX_USE_USER_INPUT */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -