comm.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #ifndef _WONX_SYS_COMM_H_
  2. #define _WONX_SYS_COMM_H_
  3. #include "service.h"
  4. /*****************************************************************************/
  5. /* 年眶の年盗 */
  6. /*****************************************************************************/
  7. #define COMM_SPEED_9600 0
  8. #define COMM_SPEED_38400 1
  9. #define XMODE_SEND 0
  10. #define XMODE_RECEIVE 1
  11. #define XMODE_SEND_ENCRYPTED 2
  12. #define XMODE_RECEIVE_ENCRYPTED 3
  13. #define XMODE_AUTO_ERASE 4
  14. #define ERR_SIO_OK 0x0000
  15. #define ERR_SIO_BUSY 0x8100
  16. #define ERR_SIO_TIMEOUT 0x8101
  17. #define ERR_SIO_OVERRUN 0x8102
  18. #define ERR_SIO_CANCEL 0x8103
  19. #define ERR_XM_STATECODE 0x8104
  20. #define ERR_XM_CANCELED 0x8105
  21. #define ERR_XM_BLOCK_LOST 0x8106
  22. #define ERR_XM_TOO_LARGE 0x8107
  23. enum {
  24. XM_START = 1,
  25. XM_NEGO,
  26. XM_BLOCK,
  27. XM_BLOCK_RETRY,
  28. XM_CLOSE,
  29. XM_ABORT,
  30. XM_DONE,
  31. XM_ERASE_BANK
  32. };
  33. typedef struct {
  34. int state;
  35. char mode;
  36. char retry_c;
  37. int block_c;
  38. int block_max;
  39. int block_size;
  40. int bank;
  41. int offset;
  42. int timeout_c;
  43. } xmodeminfo;
  44. /*****************************************************************************/
  45. /* 高垂簇眶の离咐 */
  46. /*****************************************************************************/
  47. void comm_open(void);
  48. void comm_close(void);
  49. int comm_send_char(unsigned char c);
  50. int comm_receive_char(void);
  51. int comm_receive_with_timeout(int timeout);
  52. int comm_send_string(char * string);
  53. int comm_send_block(void * buffer, int size);
  54. int comm_receive_block(void * buffer, int size);
  55. void comm_set_timeout(int recv_timeout, int send_timeout);
  56. void comm_set_baudrate(int baudrate);
  57. int comm_get_baudrate(void);
  58. void comm_set_cancel_key(unsigned int pattern);
  59. unsigned int comm_get_cancel_key(void);
  60. int comm_xmodem(void * xmodem);
  61. #endif