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.
41 lines
972 B
41 lines
972 B
#ifndef __SEQUENTAL_IOPS_HEADER__
|
|
#define __SEQUENTAL_IOPS_HEADER__
|
|
|
|
#include "../../components/base/basicMutex.h"
|
|
#include <queue.h>
|
|
|
|
typedef struct S_IO_Sequence{
|
|
basicMutex block;
|
|
uint8_t * out_data;
|
|
size_t out_size;
|
|
bool sucess;
|
|
uint8_t * in_data;
|
|
size_t in_size;
|
|
}IO_Sequence;
|
|
|
|
typedef std::queue<IO_Sequence*> QIO_Sequence;
|
|
|
|
class sequentalSerial: public hardwareResourceSerialProvider{
|
|
private:
|
|
basicMutex m_mCurrentIO;
|
|
QIO_Sequence m_qIOQ;
|
|
IO_Sequence * m_pCurrentIO;
|
|
protected:
|
|
IO_Sequence * fetchIO(){
|
|
m_mCurrentIO.lock();
|
|
if( m_qIOQ.size ){
|
|
m_pCurrentIO = m_qIOQ.front();
|
|
m_qIOQ.pop();
|
|
} else m_pCurrentIO = NULL;
|
|
m_mCurrentIO.unlock();
|
|
retrun m_pCurrentIO;
|
|
};
|
|
public:
|
|
explicit sequentalSerial( uint32_t dbID );
|
|
~sequentalSerial();
|
|
bool sendData();
|
|
bool receiveData( IO_Sequence *ptr );
|
|
};
|
|
|
|
|
|
#endif
|