Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC ADC 100M 14b 4cha
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 ADC 100M 14b 4cha
Commits
65a2c177
Commit
65a2c177
authored
Mar 01, 2021
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/kernel: add a flag to disable endianness swap
parent
892b0630
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
42 deletions
+20
-42
fa-dma.c
software/kernel/fa-dma.c
+19
-42
fmc-adc-100m14b4cha.h
software/kernel/platform_data/fmc-adc-100m14b4cha.h
+1
-0
No files found.
software/kernel/fa-dma.c
View file @
65a2c177
...
...
@@ -5,43 +5,23 @@
*/
#include <linux/errno.h>
#include <asm/byteorder.h>
#ifdef CONFIG_FMC_ADC_SVEC
#include "vmebus.h"
#endif
#include "fmc-adc-100m14b4cha-private.h"
/* Endianess */
#ifndef LITTLE_ENDIAN
#define LITTLE_ENDIAN 0
#endif
#ifndef BIG_ENDIAN
#define BIG_ENDIAN 1
#endif
static
void
zfad_dma_done
(
struct
zio_cset
*
cset
);
static
int
__get_endian
(
void
)
{
int
i
=
1
;
char
*
p
=
(
char
*
)
&
i
;
if
(
p
[
0
]
==
1
)
return
LITTLE_ENDIAN
;
else
return
BIG_ENDIAN
;
}
/**
* Fix endianess from big to host endianess (32bit)
*/
static
void
__endianness
(
unsigned
int
byte_length
,
void
*
buffer
)
{
#ifdef __LITTLE_ENDIAN
/* CPU may be little endian, VME is big endian */
if
(
__get_endian
()
==
LITTLE_ENDIAN
)
{
/* swap samples and trig timetag all seen as 32bits words */
int
i
;
int
size
=
byte_length
/
4
;
...
...
@@ -49,7 +29,7 @@ static void __endianness(unsigned int byte_length, void *buffer)
for
(
i
=
0
;
i
<
size
;
++
i
,
++
ptr
)
*
ptr
=
__be32_to_cpu
(
*
ptr
);
}
#endif
}
struct
zfad_timetag
{
...
...
@@ -310,23 +290,20 @@ static int zfad_dma_block_to_pages(struct page **pages, unsigned int nr_pages,
}
static
void
zfad_dma_context_exit
_svec
(
struct
zio_cset
*
cset
,
static
void
zfad_dma_context_exit
(
struct
zio_cset
*
cset
,
struct
zfad_block
*
zfad_block
)
{
struct
fa_dev
*
fa
=
cset
->
zdev
->
priv_d
;
if
(
fa_is_flag_set
(
fa
,
FMC_ADC_SVEC
))
{
/* Fix data endianness */
if
(
!
fa_is_flag_set
(
fa
,
FMC_ADC_DMA_LITTLE_ENDIAN
))
__endianness
(
zfad_block
->
block
->
datalen
,
zfad_block
->
block
->
data
);
/* Free DMA descriptor */
kfree
(
zfad_block
->
dma_ctx
);
}
static
void
zfad_dma_context_exit
(
struct
zio_cset
*
cset
,
struct
zfad_block
*
zfad_block
)
{
struct
fa_dev
*
fa
=
cset
->
zdev
->
priv_d
;
if
(
fa_is_flag_set
(
fa
,
FMC_ADC_SVEC
))
zfad_dma_context_exit_svec
(
cset
,
zfad_block
);
}
}
static
int
zfad_dma_context_init_svec
(
struct
zio_cset
*
cset
,
...
...
software/kernel/platform_data/fmc-adc-100m14b4cha.h
View file @
65a2c177
...
...
@@ -16,6 +16,7 @@
* NOTE any other carrier is not supported!
*/
#define FMC_ADC_SVEC BIT(3)
#define FMC_ADC_DMA_LITTLE_ENDIAN BIT(4)
struct
fmc_adc_platform_data
{
unsigned
long
flags
;
...
...
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