mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-30 00:00:11 +01:00
whitespace cleanups
This commit is contained in:
parent
28753933e0
commit
08cab16c60
2 changed files with 21 additions and 22 deletions
|
@ -11,12 +11,12 @@
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* any later version.
|
* any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*********************************************************************************/
|
*********************************************************************************/
|
||||||
|
@ -82,7 +82,7 @@ static void * SendToIPPort(void *arg)
|
||||||
OpalPrint("%s: SendToIPPort: No transimission block for this controller. Stopping thread.\n", PROGNAME);
|
OpalPrint("%s: SendToIPPort: No transimission block for this controller. Stopping thread.\n", PROGNAME);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
/* This call unblocks when the 'Data Ready' line of a send icon is asserted. */
|
/* This call unblocks when the 'Data Ready' line of a send icon is asserted. */
|
||||||
ret = OpalWaitForAsyncSendRequest(&SendID);
|
ret = OpalWaitForAsyncSendRequest(&SendID);
|
||||||
|
@ -127,7 +127,7 @@ static void * SendToIPPort(void *arg)
|
||||||
|
|
||||||
for (int i = 0; i < msg->length; i++)
|
for (int i = 0; i < msg->length; i++)
|
||||||
msg->data[i].f = (float) mdldata[i];
|
msg->data[i].f = (float) mdldata[i];
|
||||||
|
|
||||||
len = MSG_LEN(msg->length);
|
len = MSG_LEN(msg->length);
|
||||||
|
|
||||||
msg_hton(msg);
|
msg_hton(msg);
|
||||||
|
@ -137,7 +137,7 @@ static void * SendToIPPort(void *arg)
|
||||||
msg[i] = (float) mdldata[i];
|
msg[i] = (float) mdldata[i];
|
||||||
imsg[i] = htonl(imsg[i]);
|
imsg[i] = htonl(imsg[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
len = cnt * sizeof(float);
|
len = cnt * sizeof(float);
|
||||||
#else
|
#else
|
||||||
#error Unknown protocol
|
#error Unknown protocol
|
||||||
|
@ -205,12 +205,12 @@ static void * RecvFromIPPort(void *arg)
|
||||||
OpalPrint("%s: Timeout while waiting for data\n", PROGNAME, errno);
|
OpalPrint("%s: Timeout while waiting for data\n", PROGNAME, errno);
|
||||||
if (ret == -1) /* a more serious error, so we print it */
|
if (ret == -1) /* a more serious error, so we print it */
|
||||||
OpalPrint("%s: Error %d while waiting for data\n", PROGNAME, errno);
|
OpalPrint("%s: Error %d while waiting for data\n", PROGNAME, errno);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the number of signals to send back to the model */
|
/* Get the number of signals to send back to the model */
|
||||||
OpalGetAsyncRecvIconDataLength(&mdldata_size, RecvID);
|
OpalGetAsyncRecvIconDataLength(&mdldata_size, RecvID);
|
||||||
cnt = mdldata_size / sizeof(double);
|
cnt = mdldata_size / sizeof(double);
|
||||||
|
@ -228,23 +228,23 @@ static void * RecvFromIPPort(void *arg)
|
||||||
OpalPrint("%s: Skipping invalid packet\n", PROGNAME);
|
OpalPrint("%s: Skipping invalid packet\n", PROGNAME);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cnt > msg->length) {
|
if (cnt > msg->length) {
|
||||||
OpalPrint("%s: Number of signals for RecvID=%d (%d) exceeds what was received (%d)\n",
|
OpalPrint("%s: Number of signals for RecvID=%d (%d) exceeds what was received (%d)\n",
|
||||||
PROGNAME, RecvID, cnt, msg->length);
|
PROGNAME, RecvID, cnt, msg->length);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < msg->length; i++)
|
for (int i = 0; i < msg->length; i++)
|
||||||
mdldata[i] = (double) msg->data[i].f;
|
mdldata[i] = (double) msg->data[i].f;
|
||||||
|
|
||||||
/* Update OPAL model */
|
/* Update OPAL model */
|
||||||
OpalSetAsyncRecvIconStatus(msg->sequence, RecvID); /* Set the Status to the message ID */
|
OpalSetAsyncRecvIconStatus(msg->sequence, RecvID); /* Set the Status to the message ID */
|
||||||
#elif PROTOCOL == GTNET_SKT
|
#elif PROTOCOL == GTNET_SKT
|
||||||
uint32_t *imsg = (uint32_t *) msg;
|
uint32_t *imsg = (uint32_t *) msg;
|
||||||
for (int i = 0; i < cnt; i++) {
|
for (int i = 0; i < cnt; i++) {
|
||||||
imsg[i] = ntohl(imsg[i]);
|
imsg[i] = ntohl(imsg[i]);
|
||||||
mdldata[i] = (double) msg[i];
|
mdldata[i] = (double) msg[i];
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#error Unknown protocol
|
#error Unknown protocol
|
||||||
#endif
|
#endif
|
||||||
|
@ -298,7 +298,7 @@ int main(int argc, char *argv[])
|
||||||
/* Get IP Controler Parameters (ie: ip address, port number...) and
|
/* Get IP Controler Parameters (ie: ip address, port number...) and
|
||||||
* initialize the device on the QNX node. */
|
* initialize the device on the QNX node. */
|
||||||
memset(&IconCtrlStruct, 0, sizeof(IconCtrlStruct));
|
memset(&IconCtrlStruct, 0, sizeof(IconCtrlStruct));
|
||||||
|
|
||||||
ret = OpalGetAsyncCtrlParameters(&IconCtrlStruct, sizeof(IconCtrlStruct));
|
ret = OpalGetAsyncCtrlParameters(&IconCtrlStruct, sizeof(IconCtrlStruct));
|
||||||
if (ret != EOK) {
|
if (ret != EOK) {
|
||||||
OpalPrint("%s: ERROR: Could not get controller parameters (%d).\n", PROGNAME, ret);
|
OpalPrint("%s: ERROR: Could not get controller parameters (%d).\n", PROGNAME, ret);
|
||||||
|
@ -316,7 +316,7 @@ int main(int argc, char *argv[])
|
||||||
ret = pthread_create(&tid_send, NULL, SendToIPPort, NULL);
|
ret = pthread_create(&tid_send, NULL, SendToIPPort, NULL);
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
OpalPrint("%s: ERROR: Could not create thread (SendToIPPort), errno %d\n", PROGNAME, errno);
|
OpalPrint("%s: ERROR: Could not create thread (SendToIPPort), errno %d\n", PROGNAME, errno);
|
||||||
|
|
||||||
ret = pthread_create(&tid_recv, NULL, RecvFromIPPort, NULL);
|
ret = pthread_create(&tid_recv, NULL, RecvFromIPPort, NULL);
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
OpalPrint("%s: ERROR: Could not create thread (RecvFromIPPort), errno %d\n", PROGNAME, errno);
|
OpalPrint("%s: ERROR: Could not create thread (RecvFromIPPort), errno %d\n", PROGNAME, errno);
|
||||||
|
@ -332,7 +332,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
/* Close the ip port and shared memories */
|
/* Close the ip port and shared memories */
|
||||||
socket_close(&skt, IconCtrlStruct);
|
socket_close(&skt, IconCtrlStruct);
|
||||||
|
|
||||||
OpalCloseAsyncMem (ASYNC_SHMEM_SIZE, ASYNC_SHMEM_NAME);
|
OpalCloseAsyncMem (ASYNC_SHMEM_SIZE, ASYNC_SHMEM_NAME);
|
||||||
OpalSystemCtrl_UnRegister(PRINT_SHMEM_NAME);
|
OpalSystemCtrl_UnRegister(PRINT_SHMEM_NAME);
|
||||||
|
|
||||||
|
|
|
@ -10,12 +10,12 @@
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* any later version.
|
* any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*********************************************************************************/
|
*********************************************************************************/
|
||||||
|
@ -49,8 +49,7 @@ int socket_init(struct socket *s, Opal_GenAsyncParam_Ctrl IconCtrlStruct)
|
||||||
OpalPrint("%s: This version of %s only supports UDP\n", PROGNAME, PROGNAME);
|
OpalPrint("%s: This version of %s only supports UDP\n", PROGNAME, PROGNAME);
|
||||||
return EIO;
|
return EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
OpalPrint("%s: Version : %s\n", PROGNAME, VERSION);
|
OpalPrint("%s: Version : %s\n", PROGNAME, VERSION);
|
||||||
OpalPrint("%s: Remote Address : %s\n", PROGNAME, IconCtrlStruct.StringParam[0]);
|
OpalPrint("%s: Remote Address : %s\n", PROGNAME, IconCtrlStruct.StringParam[0]);
|
||||||
OpalPrint("%s: Remote Port : %d\n", PROGNAME, (int) IconCtrlStruct.FloatParam[1]);
|
OpalPrint("%s: Remote Port : %d\n", PROGNAME, (int) IconCtrlStruct.FloatParam[1]);
|
||||||
|
@ -90,7 +89,7 @@ int socket_init(struct socket *s, Opal_GenAsyncParam_Ctrl IconCtrlStruct)
|
||||||
OpalPrint("%s: ERROR: Could not set TTL for multicast send (%d)\n", PROGNAME, errno);
|
OpalPrint("%s: ERROR: Could not set TTL for multicast send (%d)\n", PROGNAME, errno);
|
||||||
return EIO;
|
return EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = setsockopt(s->sd, IPPROTO_IP, IP_MULTICAST_LOOP, (char *)&LOOP, sizeof(LOOP));
|
ret = setsockopt(s->sd, IPPROTO_IP, IP_MULTICAST_LOOP, (char *)&LOOP, sizeof(LOOP));
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
OpalPrint("%s: ERROR: Could not set loopback for multicast send (%d)\n", PROGNAME, errno);
|
OpalPrint("%s: ERROR: Could not set loopback for multicast send (%d)\n", PROGNAME, errno);
|
||||||
|
@ -187,4 +186,4 @@ int socket_recv(struct socket *s, char *data, int len, double timeout)
|
||||||
|
|
||||||
/* Perform the reception */
|
/* Perform the reception */
|
||||||
return recvfrom(s->sd, data, len, 0, (struct sockaddr *) &client_ad, &client_ad_size);
|
return recvfrom(s->sd, data, len, 0, (struct sockaddr *) &client_ad, &client_ad_size);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue