1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /****************************************************************
4 Siano Mobile Silicon, Inc.
5 MDTV receiver kernel modules.
6 Copyright (C) 2006-2009, Uri Shkolnik
9 ****************************************************************/
11 #include <linux/export.h>
12 #include <asm/byteorder.h>
14 #include "smsendian.h"
15 #include "smscoreapi.h"
17 void smsendian_handle_tx_message(void *buffer
)
20 struct sms_msg_data
*msg
= (struct sms_msg_data
*)buffer
;
24 switch (msg
->x_msg_header
.msg_type
) {
25 case MSG_SMS_DATA_DOWNLOAD_REQ
:
27 msg
->msg_data
[0] = le32_to_cpu((__force __le32
)(msg
->msg_data
[0]));
32 msg_words
= (msg
->x_msg_header
.msg_length
-
33 sizeof(struct sms_msg_hdr
))/4;
35 for (i
= 0; i
< msg_words
; i
++)
36 msg
->msg_data
[i
] = le32_to_cpu((__force __le32
)msg
->msg_data
[i
]);
40 #endif /* __BIG_ENDIAN */
42 EXPORT_SYMBOL_GPL(smsendian_handle_tx_message
);
44 void smsendian_handle_rx_message(void *buffer
)
47 struct sms_msg_data
*msg
= (struct sms_msg_data
*)buffer
;
51 switch (msg
->x_msg_header
.msg_type
) {
52 case MSG_SMS_GET_VERSION_EX_RES
:
54 struct sms_version_res
*ver
=
55 (struct sms_version_res
*) msg
;
56 ver
->chip_model
= le16_to_cpu((__force __le16
)ver
->chip_model
);
60 case MSG_SMS_DVBT_BDA_DATA
:
61 case MSG_SMS_DAB_CHANNEL
:
62 case MSG_SMS_DATA_MSG
:
69 msg_words
= (msg
->x_msg_header
.msg_length
-
70 sizeof(struct sms_msg_hdr
))/4;
72 for (i
= 0; i
< msg_words
; i
++)
73 msg
->msg_data
[i
] = le32_to_cpu((__force __le32
)msg
->msg_data
[i
]);
78 #endif /* __BIG_ENDIAN */
80 EXPORT_SYMBOL_GPL(smsendian_handle_rx_message
);
82 void smsendian_handle_message_header(void *msg
)
85 struct sms_msg_hdr
*phdr
= (struct sms_msg_hdr
*)msg
;
87 phdr
->msg_type
= le16_to_cpu((__force __le16
)phdr
->msg_type
);
88 phdr
->msg_length
= le16_to_cpu((__force __le16
)phdr
->msg_length
);
89 phdr
->msg_flags
= le16_to_cpu((__force __le16
)phdr
->msg_flags
);
90 #endif /* __BIG_ENDIAN */
92 EXPORT_SYMBOL_GPL(smsendian_handle_message_header
);