// note that these buffers are independent // of the buffering capacity withing the // FTDI chip, or the UART FIFO's or whatever // else might exist at the hardware level. #define TxBuffSize (0x800) #define RxBuffSize (0x800) class TDebugDisplayForm; class prop_serial { public: CString m_strVersion; CString m_strCPUInfo; // total bytes written during a session bool m_bCommOpen; LPVOID m_pRxBuff; //[RxBuffSize]; LPVOID m_pTxBuff; //[TxBuffSize-1]; HANDLE m_hEventRx; private: CString m_strCommId; char m_cVersion; int m_iErrorCount; int m_iPortId; DCB m_CommDCB; HANDLE m_hCommHandle; bool m_bFatalError; bool m_bDebugActive; bool m_bAbortMode; bool m_bVersionMode; DWORD m_dwTxBuffPos; DWORD m_dwLastError; DWORD m_dwRxBuffStart; DWORD m_dwRxBuffEnd; DWORD m_dwBytesRead; DWORD m_dwBytesWritten; OVERLAPPED m_overlap; #if 0 _progress_form ProgressForm; #endif public: prop_serial(); bool open_com(); bool close_com(); bool reset_hardware(); bool detect_hardware (); bool set_version_string(); bool open_forth (); int GetComPortNumber(); void StartDebug(); void TxByte(unsigned char); void TxString(CString); void TxString(const char*); void RxComm(); bool RxCheck(); protected: void make_com_string(int id); void reset_dcb (LPDCB pDCB); void reset_com_timeouts (); void reset_buffers (); void reset_flags (); void flush_rx (bool z); bool version_check(); void LoadHardware(); bool HardwareFound(); void OperateDebug(); // transmit data void TxBase64(unsigned char); void TxHex(unsigned char x); void Byte(unsigned char); void TxComm(); // recieve data unsigned char RxByte(); unsigned char RxGet(); // errors and housekeeping static char *GetErrorString(int); static void Waitms(int); void CommError(CString); void Abort(); };