i2c.c (d58ff35122847a83ba55394e2ae3a1527b6febf5) i2c.c (634fef61076d644b989b86abc2f560d81a089a31)
1/*
2 * I2C Link Layer for ST21NFCA HCI based Driver
3 * Copyright (C) 2014 STMicroelectronics SAS. All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *

--- 163 unchanged lines hidden (view full) ---

172 u8 tmp;
173
174 *(u8 *)skb_push(skb, 1) = 0;
175
176 crc = crc_ccitt(0xffff, skb->data, skb->len);
177 crc = ~crc;
178
179 tmp = crc & 0x00ff;
1/*
2 * I2C Link Layer for ST21NFCA HCI based Driver
3 * Copyright (C) 2014 STMicroelectronics SAS. All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *

--- 163 unchanged lines hidden (view full) ---

172 u8 tmp;
173
174 *(u8 *)skb_push(skb, 1) = 0;
175
176 crc = crc_ccitt(0xffff, skb->data, skb->len);
177 crc = ~crc;
178
179 tmp = crc & 0x00ff;
180 *(u8 *)skb_put(skb, 1) = tmp;
180 skb_put_u8(skb, tmp);
181
182 tmp = (crc >> 8) & 0x00ff;
181
182 tmp = (crc >> 8) & 0x00ff;
183 *(u8 *)skb_put(skb, 1) = tmp;
183 skb_put_u8(skb, tmp);
184}
185
186static void st21nfca_hci_remove_len_crc(struct sk_buff *skb)
187{
188 skb_pull(skb, ST21NFCA_FRAME_HEADROOM);
189 skb_trim(skb, skb->len - ST21NFCA_FRAME_TAILROOM);
190}
191

--- 17 unchanged lines hidden (view full) ---

209 /*
210 * Compute CRC before byte stuffing computation on frame
211 * Note st21nfca_hci_add_len_crc is doing a byte stuffing
212 * on its own value
213 */
214 st21nfca_hci_add_len_crc(skb);
215
216 /* add ST21NFCA_SOF_EOF on tail */
184}
185
186static void st21nfca_hci_remove_len_crc(struct sk_buff *skb)
187{
188 skb_pull(skb, ST21NFCA_FRAME_HEADROOM);
189 skb_trim(skb, skb->len - ST21NFCA_FRAME_TAILROOM);
190}
191

--- 17 unchanged lines hidden (view full) ---

209 /*
210 * Compute CRC before byte stuffing computation on frame
211 * Note st21nfca_hci_add_len_crc is doing a byte stuffing
212 * on its own value
213 */
214 st21nfca_hci_add_len_crc(skb);
215
216 /* add ST21NFCA_SOF_EOF on tail */
217 *(u8 *)skb_put(skb, 1) = ST21NFCA_SOF_EOF;
217 skb_put_u8(skb, ST21NFCA_SOF_EOF);
218 /* add ST21NFCA_SOF_EOF on head */
219 *(u8 *)skb_push(skb, 1) = ST21NFCA_SOF_EOF;
220
221 /*
222 * Compute byte stuffing
223 * if byte == ST21NFCA_SOF_EOF or ST21NFCA_ESCAPE_BYTE_STUFFING
224 * insert ST21NFCA_ESCAPE_BYTE_STUFFING (escape byte)
225 * xor byte with ST21NFCA_BYTE_STUFFING_MASK

--- 431 unchanged lines hidden ---
218 /* add ST21NFCA_SOF_EOF on head */
219 *(u8 *)skb_push(skb, 1) = ST21NFCA_SOF_EOF;
220
221 /*
222 * Compute byte stuffing
223 * if byte == ST21NFCA_SOF_EOF or ST21NFCA_ESCAPE_BYTE_STUFFING
224 * insert ST21NFCA_ESCAPE_BYTE_STUFFING (escape byte)
225 * xor byte with ST21NFCA_BYTE_STUFFING_MASK

--- 431 unchanged lines hidden ---