Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC DEL 1ns 4cha - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
FMC DEL 1ns 4cha - Software
Commits
92b41d36
Commit
92b41d36
authored
May 17, 2013
by
Juan David González Cobas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
calibration: lift jhash from 3.8
jhash changed from 2.6.24.7-rt27, so we have to lift it from a later kernel
parent
0c955a31
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
1 deletion
+78
-1
calibration.c
kernel/calibration.c
+78
-1
No files found.
kernel/calibration.c
View file @
92b41d36
...
...
@@ -13,7 +13,6 @@
#include <linux/moduleparam.h>
#include <linux/time.h>
#include <linux/firmware.h>
#include <linux/jhash.h>
#include "fine-delay.h"
#include "../sdb-lib/libsdbfs.h"
...
...
@@ -28,6 +27,82 @@ module_param(calibration_default, int, 0444);
module_param
(
calibration_save
,
int
,
0444
);
module_param
(
calibration_check
,
int
,
0444
);
/* jhash() differs in 2.6.24 and the calibration hashes
* were computed with a later version. Hence, we lift
* this code from 3.8
*/
struct
__una_u32
{
u32
x
;
}
__packed
;
static
inline
u32
__get_unaligned_cpu32
(
const
void
*
p
)
{
const
struct
__una_u32
*
ptr
=
(
const
struct
__una_u32
*
)
p
;
return
ptr
->
x
;
}
#define JHASH_INITVAL 0xdeadbeef
/* __jhash_mix -- mix 3 32-bit values reversibly. */
#define __jhash_mix(a, b, c) \
{ \
a -= c; a ^= rol32(c, 4); c += b; \
b -= a; b ^= rol32(a, 6); a += c; \
c -= b; c ^= rol32(b, 8); b += a; \
a -= c; a ^= rol32(c, 16); c += b; \
b -= a; b ^= rol32(a, 19); a += c; \
c -= b; c ^= rol32(b, 4); b += a; \
}
/* __jhash_final - final mixing of 3 32-bit values (a,b,c) into c */
#define __jhash_final(a, b, c) \
{ \
c ^= b; c -= rol32(b, 14); \
a ^= c; a -= rol32(c, 11); \
b ^= a; b -= rol32(a, 25); \
c ^= b; c -= rol32(b, 16); \
a ^= c; a -= rol32(c, 4); \
b ^= a; b -= rol32(a, 14); \
c ^= b; c -= rol32(b, 24); \
}
static
inline
u32
jhash
(
const
void
*
key
,
u32
length
,
u32
initval
)
{
u32
a
,
b
,
c
;
const
u8
*
k
=
key
;
/* Set up the internal state */
a
=
b
=
c
=
JHASH_INITVAL
+
length
+
initval
;
/* All but the last block: affect some 32 bits of (a,b,c) */
while
(
length
>
12
)
{
a
+=
__get_unaligned_cpu32
(
k
);
b
+=
__get_unaligned_cpu32
(
k
+
4
);
c
+=
__get_unaligned_cpu32
(
k
+
8
);
__jhash_mix
(
a
,
b
,
c
);
length
-=
12
;
k
+=
12
;
}
/* Last block: affect all 32 bits of (c) */
/* All the case statements fall through */
switch
(
length
)
{
case
12
:
c
+=
(
u32
)
k
[
11
]
<<
24
;
case
11
:
c
+=
(
u32
)
k
[
10
]
<<
16
;
case
10
:
c
+=
(
u32
)
k
[
9
]
<<
8
;
case
9
:
c
+=
k
[
8
];
case
8
:
b
+=
(
u32
)
k
[
7
]
<<
24
;
case
7
:
b
+=
(
u32
)
k
[
6
]
<<
16
;
case
6
:
b
+=
(
u32
)
k
[
5
]
<<
8
;
case
5
:
b
+=
k
[
4
];
case
4
:
a
+=
(
u32
)
k
[
3
]
<<
24
;
case
3
:
a
+=
(
u32
)
k
[
2
]
<<
16
;
case
2
:
a
+=
(
u32
)
k
[
1
]
<<
8
;
case
1
:
a
+=
k
[
0
];
__jhash_final
(
a
,
b
,
c
);
case
0
:
/* Nothing left to add */
break
;
}
return
c
;
}
/* Stupid dumping tool */
static
void
dumpstruct
(
char
*
name
,
void
*
ptr
,
int
size
)
{
...
...
@@ -169,6 +244,8 @@ int fd_handle_eeprom_calibration(struct fd_dev *fd)
(
long
)
calib
->
zero_offset
[
i
]);
dev_info
(
d
,
"calib: tdc_offset %i
\n
"
,
calib
->
tdc_zero_offset
);
dev_info
(
d
,
"calib: vcxo %i
\n
"
,
calib
->
vcxo_default_tune
);
dev_info
(
d
,
"calib hash: %08x
\n
"
,
hash
);
dev_info
(
d
,
"calib hash original: %08x
\n
"
,
horig
);
}
if
(
hash
!=
horig
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment