Hi,
I'm using LPC2478.
My board connected to Analog Device ADE7878 chip that has Fast SPI that send continusly
data.
Its 3 wire protocol that start the CS bit then clock out 7*32 bits (total 7*4 bytes=28
bytes) then raise the CS - wait 30Micro Second and start again.
The Clock is about 4mhz.
I want to fill a large area (in sdram) with the data.
I use the DMA with SSP and it works perfect.
I connect the CS line also to EINT0 so I know when the transfer is finished and then I
reprogram the destinatin address for the DMA to fill the next block.
My problem is that the data is 32 bit - big endian (most first) and I need to swap the
bytes to use them as a 32 bit integer.
Because I deal with a lot of data I don't want to waste time of this swap.
I read that the DMA has a bit for Big Endian mode. But when I set it on I don't get data
at all (all 0).
I belive I have misunderstood of the SBSIZE DBSIZE SWidth & DWidth in the DMACC1Control
register.
Any help?
Regards,
Doron
------------------------------------
______________________________
controlSUITE software. Comprehensive. Intuitive. Optimized.
Real-world software for real-time control. Details Here!

(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )
You probably should take a look at
http://graphics.stanford.edu/~seander/bithacks.html
Reverse bits in word by lookup table
static const unsigned char BitReverseTable256[256] =
{
# define R2(n) n, n + 2*64, n + 1*64, n + 3*64
# define R4(n) R2(n), R2(n + 2*16), R2(n + 1*16), R2(n + 3*16)
# define R6(n) R4(n), R4(n + 2*4 ), R4(n + 1*4 ), R4(n + 3*4 )
R6(0), R6(2), R6(1), R6(3)
};
unsigned int v; // reverse 32-bit value, 8 bits at time
unsigned int c; // c will get v reversed
// Option 1:
c = (BitReverseTable256[v & 0xff] << 24) |
(BitReverseTable256[(v >> 8) & 0xff] << 16) |
(BitReverseTable256[(v >> 16) & 0xff] << 8) |
(BitReverseTable256[(v >> 24) & 0xff]);
// Option 2:
unsigned char * p = (unsigned char *) &v;
unsigned char * q = (unsigned char *) &c;
q[3] = BitReverseTable256[p[0]];
q[2] = BitReverseTable256[p[1]];
q[1] = BitReverseTable256[p[2]];
q[0] = BitReverseTable256[p[3]];
Reverse an N-bit quantity in parallel in 5 * lg(N) operations:
unsigned int v; // 32-bit word to reverse bit order
// swap odd and even bits
v = ((v >> 1) & 0x55555555) | ((v & 0x55555555) << 1);
// swap consecutive pairs
v = ((v >> 2) & 0x33333333) | ((v & 0x33333333) << 2);
// swap nibbles ...
v = ((v >> 4) & 0x0F0F0F0F) | ((v & 0x0F0F0F0F) << 4);
// swap bytes
v = ((v >> 8) & 0x00FF00FF) | ((v & 0x00FF00FF) << 8);
// swap 2-byte long pairs
v = ( v >> 16 ) | ( v << 16);
For example.
Dan
See the Jumentum Network BASIC project
http://jumentum.sourceforge.net/
--- In l...@yahoogroups.com, "almagor100"
wrote:
>
> Hi,
> I'm using LPC2478.
> My board connected to Analog Device ADE7878 chip that has Fast SPI that send continusly
data.
> Its 3 wire protocol that start the CS bit then clock out 7*32 bits (total 7*4 bytes=28
bytes) then raise the CS - wait 30Micro Second and start again.
> The Clock is about 4mhz.
> I want to fill a large area (in sdram) with the data.
> I use the DMA with SSP and it works perfect.
> I connect the CS line also to EINT0 so I know when the transfer is finished and then I
reprogram the destinatin address for the DMA to fill the next block.
> My problem is that the data is 32 bit - big endian (most first) and I need to swap the
bytes to use them as a 32 bit integer.
> Because I deal with a lot of data I don't want to waste time of this swap.
> I read that the DMA has a bit for Big Endian mode. But when I set it on I don't get data
at all (all 0).
>
> I belive I have misunderstood of the SBSIZE DBSIZE SWidth & DWidth in the DMACC1Control
register.
>
> Any help?
>
> Regards,
> Doron
>
------------------------------------

(You need to be a member of lpc2000 -- send a blank email to lpc2000-subscribe@yahoogroups.com )