Commit d0b46b44 authored by Claes Sjofors's avatar Claes Sjofors

Profinet async bugfix

parent b664f1e0
......@@ -247,6 +247,11 @@ static pwr_tStatus IoAgentWrite (
for (ii = 1; ii < local->device_data.size(); ii++) {
if (slave_list != NULL) {
sp = (pwr_sClass_PnDevice *) slave_list->op;
slave_list = slave_list->next;
}
if (local->device_data[ii]->device_state == PNAK_DEVICE_STATE_CONNECTED) {
for (jj = 0; jj < local->device_data[ii]->iocr_data.size(); jj++) {
......@@ -283,8 +288,6 @@ static pwr_tStatus IoAgentWrite (
}
if (slave_list != NULL) {
sp = (pwr_sClass_PnDevice *) slave_list->op;
slave_list = slave_list->next;
/* Check if there is a write request pending ?? */
......@@ -299,7 +302,7 @@ static pwr_tStatus IoAgentWrite (
}
pack_write_req(&local->service_req_res, local->device_data[ii]->device_ref, &sp->WriteReq);
sts = pnak_send_service_req_res(0, &local->service_req_res);
errh_Info( "Profinet - Asynch write, dev: %d", local->device_data[ii]->device_ref);
break;
}
}
......
......@@ -272,9 +272,9 @@ void pack_write_req(T_PNAK_SERVICE_REQ_RES *ServiceReqRes, unsigned short device
/* Calculate length of service */
service_desc->DataLength = sizeof(T_PN_SERVICE_GET_DEVICE_STATE_REQ) + wr_req->Length;
service_desc->DataLength = sizeof(T_PN_SERVICE_WRITE_REQ) + wr_req->Length;
pWR = (T_PN_SERVICE_WRITE_REQ *) service_desc + 1;
pWR = (T_PN_SERVICE_WRITE_REQ *) (service_desc + 1);
pWR->VersionHighByte = 1;
pWR->VersionLowByte = 0;
......@@ -292,7 +292,7 @@ void pack_write_req(T_PNAK_SERVICE_REQ_RES *ServiceReqRes, unsigned short device
pWR->LengthHighByte = _PN_U16_HIGH_BYTE(wr_req->Length);
pWR->LengthLowByte = _PN_U16_LOW_BYTE(wr_req->Length);
pData = (unsigned char *) pWR + 1;
pData = (unsigned char *) (pWR + 1);
memcpy(pData, wr_req->Data, wr_req->Length);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment