1
2
3
4
5
6
7
8
9#ifndef __BFIN_CRC_H__
10#define __BFIN_CRC_H__
11
12
13struct crc_info {
14
15 unsigned char *in_addr;
16
17 unsigned char *out_addr;
18
19 unsigned long datasize;
20 union {
21
22 unsigned long crc_compare;
23
24 unsigned long val_verify;
25
26 unsigned long val_fill;
27 };
28
29 unsigned long crc_poly;
30 union {
31
32 unsigned long crc_result;
33
34 unsigned long pos_verify;
35 };
36
37 unsigned int bitmirr:1;
38 unsigned int bytmirr:1;
39 unsigned int w16swp:1;
40 unsigned int fdsel:1;
41 unsigned int rsltmirr:1;
42 unsigned int polymirr:1;
43 unsigned int cmpmirr:1;
44};
45
46
47#define CRC_IOC_MAGIC 'C'
48#define CRC_IOC_CALC_CRC _IOWR('C', 0x01, unsigned int)
49#define CRC_IOC_MEMCPY_CRC _IOWR('C', 0x02, unsigned int)
50#define CRC_IOC_VERIFY_VAL _IOWR('C', 0x03, unsigned int)
51#define CRC_IOC_FILL_VAL _IOWR('C', 0x04, unsigned int)
52
53
54#ifdef __KERNEL__
55
56#include <linux/types.h>
57#include <linux/spinlock.h>
58#include <linux/miscdevice.h>
59
60struct crc_register {
61 u32 control;
62 u32 datacnt;
63 u32 datacntrld;
64 u32 __pad_1[2];
65 u32 compare;
66 u32 fillval;
67 u32 datafifo;
68 u32 intren;
69 u32 intrenset;
70 u32 intrenclr;
71 u32 poly;
72 u32 __pad_2[4];
73 u32 status;
74 u32 datacntcap;
75 u32 __pad_3;
76 u32 result;
77 u32 curresult;
78 u32 __pad_4[3];
79 u32 revid;
80};
81
82
83#define CMPERR 0x00000002
84#define DCNTEXP 0x00000010
85#define IBR 0x00010000
86#define OBR 0x00020000
87#define IRR 0x00040000
88#define LUTDONE 0x00080000
89#define FSTAT 0x00700000
90#define MAX_FIFO 4
91
92
93#define BLKEN 0x00000001
94#define OPMODE 0x000000F0
95#define OPMODE_OFFSET 4
96#define MODE_DMACPY_CRC 1
97#define MODE_DATA_FILL 2
98#define MODE_CALC_CRC 3
99#define MODE_DATA_VERIFY 4
100#define AUTOCLRZ 0x00000100
101#define AUTOCLRF 0x00000200
102#define OBRSTALL 0x00001000
103#define IRRSTALL 0x00002000
104#define BITMIRR 0x00010000
105#define BITMIRR_OFFSET 16
106#define BYTMIRR 0x00020000
107#define BYTMIRR_OFFSET 17
108#define W16SWP 0x00040000
109#define W16SWP_OFFSET 18
110#define FDSEL 0x00080000
111#define FDSEL_OFFSET 19
112#define RSLTMIRR 0x00100000
113#define RSLTMIRR_OFFSET 20
114#define POLYMIRR 0x00200000
115#define POLYMIRR_OFFSET 21
116#define CMPMIRR 0x00400000
117#define CMPMIRR_OFFSET 22
118
119
120#define CMPERRI 0x02
121#define DCNTEXPI 0x10
122
123#endif
124
125#endif
126