fix(UML-1462): Исправлен баг в очереди чтения pdo. Поправил комментарии к коду

This commit is contained in:
algin 2023-06-06 13:32:10 +03:00
parent 001d330b0b
commit a8d6b23a4b
5 changed files with 19 additions and 24 deletions

View File

@ -57,7 +57,6 @@ void EthEcatPdoFMMU::wait_op() {
}
init_sem.post();
process_sem.pend();
}
void EthEcatPdoFMMU::process_write_queue(uint8_t* process_data, uint32_t len) {
@ -82,7 +81,7 @@ void EthEcatPdoFMMU::process_read_queue(uint8_t* process_data, uint32_t len) {
mutex_read_.lock();
next = queue_read_.get_next();
queue_write_.detach();
queue_read_.detach();
mutex_read_.unlock();
@ -100,8 +99,6 @@ void EthEcatPdoFMMU::process() {
std::vector<uint8_t> process_data(std::min(logical_full_length_write, logical_full_length_read));
free_rtos::Timer& ecat_timer = ecat_buffer_.get_ecat().get_ecat_timer();
ecat_timer.Start();
while(1) {
ecat_timer.Wait();

View File

@ -266,7 +266,7 @@ bool EthEcat::safeop_to_op() {
//ClockP_usleep(3000000ul);
if(success == true) {
process_sem_.post();
ecat_timer_.Start();
}
DebugP_log("stat.state = %d, stat.fault = %d\r\n", stat.state, stat.fault);

View File

@ -23,7 +23,7 @@ public:
static bool init(Eth& eth, TEthMacPorts port_id, uint16_t address_base);
static void process(); // Внутри бесконечный цикл. Запускать в отдельном потоке
std::vector<ecat_buffer::PDOMap>& get_ecat_pdo_map();
static std::vector<ecat_buffer::PDOMap>& get_ecat_pdo_map();
template<typename... DataTypes>
static ecat_sdo_mailbox::CompleteSize sdo_write(size_t slave_index, uint16_t index, uint8_t subindex, DataTypes&... data) {

View File

@ -17,26 +17,26 @@
namespace free_rtos {
enum {
ECT_PDOOUTPUTOFFSET = 0x1100,
ECT_PDOINPUTOFFSET = 0x1400
ECT_PDOOUTPUTOFFSET = 0x1100, // write, output, rx buffer offset
ECT_PDOINPUTOFFSET = 0x1400 // read, input, tx buffer offset
};
enum {
ECT_RXPDOMAPINDEX = 0x1C12,
ECT_TXPDOMAPINDEX = 0x1C13
ECT_RXPDOMAPINDEX = 0x1C12, // write, output, rx pdo map index
ECT_TXPDOMAPINDEX = 0x1C13 // read, input, tx pdo map index
};
namespace ecat_buffer {
/*
index[0x1C..]
subindex[0x00] = block_count (1 byte)
block_index_map[0x1C..][n]
subindex[0x00] = block_count (1 byte из 2 bytes)
subindex[0x01] = block_0_index (2 bytes)
...
subindex[n] = block_n-1_index (2 bytes)
block_index
block_subindex[0x00] = object_count (1 byte / 4 bytes)
object_descriptor_map[block_n_index][m]
block_subindex[0x00] = object_count (1 byte из 4 bytes)
block_subindex[0x01] = object_0_descriptor (4 bytes)
...
block_subindex[m] = object_m_descriptor (4 bytes)
@ -45,6 +45,9 @@ object_descriptor
size (1 byte)
object_subindex (1 byte)
object_index (2 bytes)
data_size_map[0x1C..]
pdo_data_size
*/
struct PDODescriptor {
@ -58,8 +61,11 @@ struct PDOMap {
std::map<uint16_t, std::map<uint8_t, PDODescriptor>> object_descriptor_map;
std::map<uint16_t, uint16_t> data_size_map; // Размеры в байтах !
uint16_t pdo_output_offset{ECT_PDOOUTPUTOFFSET};
uint16_t pdo_input_offset{ECT_PDOINPUTOFFSET};
const uint16_t pdo_output_offset{ECT_PDOOUTPUTOFFSET};
const uint16_t pdo_input_offset{ECT_PDOINPUTOFFSET};
const uint16_t rx_pdo_map_index{ECT_RXPDOMAPINDEX};
const uint16_t tx_pdo_map_index{ECT_TXPDOMAPINDEX};
};
struct FMMUGlobalProperties {

View File

@ -42,14 +42,6 @@ public:
return next;
}
QueueEntity* operator+(QueueEntity *next) {
attach(next);
//set_next(next);
return next;
}
private:
DataType *data_{nullptr};