@@ -34,8 +34,10 @@
#include <asm/byteorder.h>
#include "smscoreapi.h"
+#include "smsendian.h"
#include "sms-cards.h"
#include "smsir.h"
+
#define MAX_GPIO_PIN_NUMBER 31
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10)
@@ -465,6 +467,8 @@ static int smscore_init_ir(struct smscor
msg->msgData[0] = coredev->ir.controller;
msg->msgData[1] = coredev->ir.timeout;
+ smsendian_handle_tx_message(
+ (struct SmsMsgHdr_ST2 *)msg);
rc = smscore_sendrequest_and_wait(coredev, msg,
msg->xMsgHeader. msgLength,
&coredev->ir_init_done);
@@ -545,6 +549,7 @@ static int smscore_load_firmware_family2
sms_debug("sending reload command.");
SMS_INIT_MSG(msg, MSG_SW_RELOAD_START_REQ,
sizeof(struct SmsMsgHdr_ST));
+ smsendian_handle_tx_message((struct SmsMsgHdr_ST *)msg);
rc = smscore_sendrequest_and_wait(coredev, msg,
msg->msgLength,
&coredev->reload_start_done);
@@ -563,6 +568,7 @@ static int smscore_load_firmware_family2
DataMsg->MemAddr = mem_address;
memcpy(DataMsg->Payload, payload, payload_size);
+ smsendian_handle_tx_message((struct SmsMsgHdr_ST *)msg);
if ((coredev->device_flags & SMS_ROM_NO_RESPONSE) &&
(coredev->mode == DEVICE_MODE_NONE))
rc = coredev->sendrequest_handler(
@@ -595,6 +601,7 @@ static int smscore_load_firmware_family2
TriggerMsg->msgData[3] = 0; /* Parameter */
TriggerMsg->msgData[4] = 4; /* Task ID */
+ smsendian_handle_tx_message((struct SmsMsgHdr_ST *)msg);
if (coredev->device_flags & SMS_ROM_NO_RESPONSE) {
rc = coredev->sendrequest_handler(
coredev->context, TriggerMsg,
@@ -608,7 +615,7 @@ static int smscore_load_firmware_family2
} else {
SMS_INIT_MSG(msg, MSG_SW_RELOAD_EXEC_REQ,
sizeof(struct SmsMsgHdr_ST));
-
+ smsendian_handle_tx_message((struct SmsMsgHdr_ST *)msg);
rc = coredev->sendrequest_handler(coredev->context,
msg, msg->msgLength);
}
@@ -767,6 +774,7 @@ static int smscore_detect_mode(struct sm
SMS_INIT_MSG(msg, MSG_SMS_GET_VERSION_EX_REQ,
sizeof(struct SmsMsgHdr_ST));
+ smsendian_handle_tx_message((struct SmsMsgHdr_ST *)msg);
rc = smscore_sendrequest_and_wait(coredev, msg, msg->msgLength,
&coredev->version_ex_done);
if (rc == -ETIME) {
@@ -895,6 +903,7 @@ int smscore_set_device_mode(struct smsco
sizeof(struct SmsMsgData_ST));
msg->msgData[0] = mode;
+ smsendian_handle_tx_message((struct SmsMsgHdr_ST *)msg);
rc = smscore_sendrequest_and_wait(
coredev, msg, msg->xMsgHeader.msgLength,
&coredev->init_device_done);
@@ -1102,6 +1111,8 @@ void smscore_onresponse(struct smscore_d
rc = client->onresponse_handler(client->context, cb);
if (rc < 0) {
+ smsendian_handle_rx_message((struct SmsMsgData_ST *)phdr);
+
switch (phdr->msgType) {
case MSG_SMS_GET_VERSION_EX_RES:
{
@@ -1604,6 +1615,7 @@ int smscore_gpio_configure(struct smscor
pMsg->msgData[5] = 0;
}
+ smsendian_handle_tx_message((struct SmsMsgHdr_ST *)pMsg);
rc = smscore_sendrequest_and_wait(coredev, pMsg, totalLen,
&coredev->gpio_configuration_done);
@@ -1653,6 +1665,7 @@ int smscore_gpio_set_level(struct smscor
pMsg->msgData[1] = NewLevel;
/* Send message to SMS */
+ smsendian_handle_tx_message((struct SmsMsgHdr_ST *)pMsg);
rc = smscore_sendrequest_and_wait(coredev, pMsg, totalLen,
&coredev->gpio_set_level_done);
@@ -1701,6 +1714,7 @@ int smscore_gpio_get_level(struct smscor
pMsg->msgData[1] = 0;
/* Send message to SMS */
+ smsendian_handle_tx_message((struct SmsMsgHdr_ST *)pMsg);
rc = smscore_sendrequest_and_wait(coredev, pMsg, totalLen,
&coredev->gpio_get_level_done);