DeviceAndHostCommunication.#2
上传用户:gxz1972
上传日期:2019-09-13
资源大小:323k
文件大小:3k
源码类别:

传真(Fax)编程

开发平台:

C/C++

  1. //-----------------------------------------------------------------------------
  2. // DeviceAndHostCommunication.c
  3. //-----------------------------------------------------------------------------
  4. // Copyright 2007 Vson Technology, Inc.
  5. // http://www.usbmcu.com
  6. //
  7. // Program Description:
  8. //
  9. //
  10. //
  11. //
  12. //
  13. // MCU:            C8051F347
  14. // Tool chain:     Keil C51 7.50 / Keil EVAL C51
  15. //                 Silicon Laboratories IDE version 2.6
  16. // Command Line:   
  17. // Project Name:   TR1000
  18. //
  19. //
  20. // Release 1.0
  21. //    -All changes by Brian
  22. //    -24 JUL 2007
  23. //
  24. //
  25. //-----------------------------------------------------------------------------
  26. // Includes
  27. //-----------------------------------------------------------------------------
  28. #include "Include_H.h"
  29. //-----------------------------------------------------------------------------
  30. // State_Machine
  31. //-----------------------------------------------------------------------------
  32. //
  33. // Return Value : None
  34. // Parameters   : None
  35. //
  36. // Determine new state and act on current state
  37. //-----------------------------------------------------------------------------
  38. void State_Machine(void)
  39. {
  40.    switch (M_State)
  41.    {
  42.       case
  43.          ST_WAIT_DEV:                  // Stay in Wait State
  44.          break;
  45.       case
  46.          ST_IDLE_DEV:                  // Stay in Idle State
  47.          break;
  48.       case
  49.          ST_TX_CONFIG_RESPONSE_TO_HOST:   // Response Host After receive the Config Data
  50.          TxConfigResponse2Host(0x00);
  51.          break;
  52.       case
  53.          ST_TX_KEY_DATA_TO_HOST:   // transmit key data to the host
  54.          TxTeacherKeyData2Host();
  55.          break;
  56.       case
  57.          ST_TX_TOUCHPAD_DATA_TO_HOST:   // transmit touch pad data to the host
  58.          TxTouchPadData2Host();
  59.          break;
  60.       default:
  61.          M_State = ST_ERROR;           // Unknown State, stay in Error State
  62.          break;
  63.    }
  64. }
  65. void TxConfigResponse2Host(unsigned char ResponseResult)
  66. {
  67.    gaucTxData2HostBuffer[0] = ResponseResult;
  68.    // Place Config response packet (0x00) on the OUT FIFO
  69.    BulkOrInterruptIn (&gEp1InStatus, (BYTE*)&gaucTxData2HostBuffer, 1);
  70. }
  71. void TxTeacherKeyData2Host(void)
  72. {
  73.    BulkOrInterruptIn (&gEp1InStatus, (BYTE*)&gaucTxData2HostBuffer, 64);
  74. }
  75. void TxTouchPadData2Host(void)
  76. {
  77.    BulkOrInterruptIn (&gEp1InStatus, (BYTE*)&gaucTxData2HostBuffer, 64);
  78. }
  79. //-----------------------------------------------------------------------------
  80. // End Of File
  81. //-----------------------------------------------------------------------------