You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
972 B

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __SEQUENTAL_IOPS_HEADER__
  2. #define __SEQUENTAL_IOPS_HEADER__
  3. #include "../../components/base/basicMutex.h"
  4. #include <queue.h>
  5. typedef struct S_IO_Sequence{
  6. basicMutex block;
  7. uint8_t * out_data;
  8. size_t out_size;
  9. bool sucess;
  10. uint8_t * in_data;
  11. size_t in_size;
  12. }IO_Sequence;
  13. typedef std::queue<IO_Sequence*> QIO_Sequence;
  14. class sequentalSerial: public hardwareResourceSerialProvider{
  15. private:
  16. basicMutex m_mCurrentIO;
  17. QIO_Sequence m_qIOQ;
  18. IO_Sequence * m_pCurrentIO;
  19. protected:
  20. IO_Sequence * fetchIO(){
  21. m_mCurrentIO.lock();
  22. if( m_qIOQ.size ){
  23. m_pCurrentIO = m_qIOQ.front();
  24. m_qIOQ.pop();
  25. } else m_pCurrentIO = NULL;
  26. m_mCurrentIO.unlock();
  27. retrun m_pCurrentIO;
  28. };
  29. public:
  30. explicit sequentalSerial( uint32_t dbID );
  31. ~sequentalSerial();
  32. bool sendData();
  33. bool receiveData( IO_Sequence *ptr );
  34. };
  35. #endif