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
= buffer
;
23 u32
*msg_data
= &msg
->msg_data
;
25 switch (msg
->x_msg_header
.msg_type
) {
26 case MSG_SMS_DATA_DOWNLOAD_REQ
:
28 msg
->msg_data
= le32_to_cpu((__force __le32
)(msg
->msg_data
));
33 msg_words
= (msg
->x_msg_header
.msg_length
-
34 sizeof(struct sms_msg_hdr
))/4;
36 for (i
= 0; i
< msg_words
; i
++)
37 msg_data
[i
] = le32_to_cpu((__force __le32
)msg_data
[i
]);
41 #endif /* __BIG_ENDIAN */
43 EXPORT_SYMBOL_GPL(smsendian_handle_tx_message
);
45 void smsendian_handle_rx_message(void *buffer
)
48 struct sms_msg_data
*msg
= (struct sms_msg_data
*)buffer
;
52 switch (msg
->x_msg_header
.msg_type
) {
53 case MSG_SMS_GET_VERSION_EX_RES
:
55 struct sms_version_res
*ver
=
56 (struct sms_version_res
*) msg
;
57 ver
->chip_model
= le16_to_cpu((__force __le16
)ver
->chip_model
);
61 case MSG_SMS_DVBT_BDA_DATA
:
62 case MSG_SMS_DAB_CHANNEL
:
63 case MSG_SMS_DATA_MSG
:
70 u32
*msg_data
= &msg
->msg_data
;
71 msg_words
= (msg
->x_msg_header
.msg_length
-
72 sizeof(struct sms_msg_hdr
))/4;
74 for (i
= 0; i
< msg_words
; i
++)
75 msg_data
[i
] = le32_to_cpu((__force __le32
)msg_data
[i
]);
80 #endif /* __BIG_ENDIAN */
82 EXPORT_SYMBOL_GPL(smsendian_handle_rx_message
);
84 void smsendian_handle_message_header(void *msg
)
87 struct sms_msg_hdr
*phdr
= (struct sms_msg_hdr
*)msg
;
89 phdr
->msg_type
= le16_to_cpu((__force __le16
)phdr
->msg_type
);
90 phdr
->msg_length
= le16_to_cpu((__force __le16
)phdr
->msg_length
);
91 phdr
->msg_flags
= le16_to_cpu((__force __le16
)phdr
->msg_flags
);
92 #endif /* __BIG_ENDIAN */
94 EXPORT_SYMBOL_GPL(smsendian_handle_message_header
);