26 #include <linux/kernel.h>
31 #define DATA_BLOB_LENGTH 3
32 #define MATCH_DATA_LENGTH 8192
33 #define ALTERA_REQUEST_SIZE 1024
34 #define ALTERA_BUFFER_SIZE (MATCH_DATA_LENGTH + ALTERA_REQUEST_SIZE)
36 static u32 altera_bits_req(
u32 n)
61 databyte = buffer[*in_index];
62 result |= (((databyte >> (
CHAR_BITS - *bits_avail))
63 & (0xff >> (
CHAR_BITS - *bits_avail))) << shift);
65 if (bits <= *bits_avail) {
66 result &= (0xffff >> (
SHORT_BITS - (bits + shift)));
91 for (i = 0; i < out_length; ++
i)
95 for (i = 0; i <
sizeof(in_length); ++
i) {
96 data_length = data_length | (
97 altera_read_packed(in,
103 if (data_length > out_length) {
109 while (i < data_length) {
111 if (altera_read_packed(in, 1, &bits_avail,
114 if (i < data_length) {
115 out[
i] = (
u8)altera_read_packed(in,
124 offset = altera_read_packed(in, altera_bits_req((
s16)
125 (i > match_data_length ?
126 match_data_length : i)),
129 length = altera_read_packed(in,
CHAR_BITS,
133 if (i < data_length) {