DeviceAndHostCommunication.#2
上传用户:gxz1972
上传日期:2019-09-13
资源大小:323k
文件大小:3k
源码类别:
传真(Fax)编程
开发平台:
C/C++
- //-----------------------------------------------------------------------------
- // DeviceAndHostCommunication.c
- //-----------------------------------------------------------------------------
- // Copyright 2007 Vson Technology, Inc.
- // http://www.usbmcu.com
- //
- // Program Description:
- //
- //
- //
- //
- //
- // MCU: C8051F347
- // Tool chain: Keil C51 7.50 / Keil EVAL C51
- // Silicon Laboratories IDE version 2.6
- // Command Line:
- // Project Name: TR1000
- //
- //
- // Release 1.0
- // -All changes by Brian
- // -24 JUL 2007
- //
- //
- //-----------------------------------------------------------------------------
- // Includes
- //-----------------------------------------------------------------------------
- #include "Include_H.h"
- //-----------------------------------------------------------------------------
- // State_Machine
- //-----------------------------------------------------------------------------
- //
- // Return Value : None
- // Parameters : None
- //
- // Determine new state and act on current state
- //-----------------------------------------------------------------------------
- void State_Machine(void)
- {
- switch (M_State)
- {
- case
- ST_WAIT_DEV: // Stay in Wait State
- break;
- case
- ST_IDLE_DEV: // Stay in Idle State
- break;
- case
- ST_TX_CONFIG_RESPONSE_TO_HOST: // Response Host After receive the Config Data
- TxConfigResponse2Host(0x00);
- break;
- case
- ST_TX_KEY_DATA_TO_HOST: // transmit key data to the host
- TxTeacherKeyData2Host();
- break;
- case
- ST_TX_TOUCHPAD_DATA_TO_HOST: // transmit touch pad data to the host
- TxTouchPadData2Host();
- break;
- default:
- M_State = ST_ERROR; // Unknown State, stay in Error State
- break;
- }
- }
- void TxConfigResponse2Host(unsigned char ResponseResult)
- {
- gaucTxData2HostBuffer[0] = ResponseResult;
- // Place Config response packet (0x00) on the OUT FIFO
- BulkOrInterruptIn (&gEp1InStatus, (BYTE*)&gaucTxData2HostBuffer, 1);
- }
- void TxTeacherKeyData2Host(void)
- {
- BulkOrInterruptIn (&gEp1InStatus, (BYTE*)&gaucTxData2HostBuffer, 64);
- }
- void TxTouchPadData2Host(void)
- {
- BulkOrInterruptIn (&gEp1InStatus, (BYTE*)&gaucTxData2HostBuffer, 64);
- }
- //-----------------------------------------------------------------------------
- // End Of File
- //-----------------------------------------------------------------------------