cpu_to_le32 : Any similar fn in QNX?

Hi everyone,
I am tryig to port Linux code to QNX.
Is there a function similar to cpu_to_le32 ( linux) for QNX.?
I found that the le32_to_cpu fn is replaced by ENDIAN_LE32 in QNX.

Thanks In Advance
Sarath

Take a look at gulliver.h. You just need to make sure you define
BIGENDIAN or LITTLEENDIAN (these are defined automatically by our
recursive makefiles) and the meaning of ENDIAN_LE32 and ENDIAN_BE32 will be
swapped as appropriate.

cheers,

Kris

“sarath chandran” <sarath.chandran@tatainfotech.com> wrote in message
news:aknph6$46g$1@inn.qnx.com

Hi everyone,
I am tryig to port Linux code to QNX.
Is there a function similar to cpu_to_le32 ( linux) for QNX.?
I found that the le32_to_cpu fn is replaced by ENDIAN_LE32 in QNX.

Thanks In Advance
Sarath

The endianess is always defined for you. ENDIAN_LE32 should work
in both cases here.

-seanb

Kris Warkentin <kewarken@qnx.com> wrote:

Take a look at gulliver.h. You just need to make sure you define
BIGENDIAN or LITTLEENDIAN (these are defined automatically by our
recursive makefiles) and the meaning of ENDIAN_LE32 and ENDIAN_BE32 will be
swapped as appropriate.

cheers,

Kris

“sarath chandran” <> sarath.chandran@tatainfotech.com> > wrote in message
news:aknph6$46g$> 1@inn.qnx.com> …
Hi everyone,
I am tryig to port Linux code to QNX.
Is there a function similar to cpu_to_le32 ( linux) for QNX.?
I found that the le32_to_cpu fn is replaced by ENDIAN_LE32 in QNX.

Thanks In Advance
Sarath

“Sean Boudreau” <seanb@node25.ott.qnx.com> wrote in message
news:aknv66$f11$1@nntp.qnx.com

The endianess is always defined for you. ENDIAN_LE32 should work
in both cases here.

Assuming you’re using qcc. “qcc -Vgcc_ntoshle” (for example) works but
“ntosh-gcc -ml -m4” will not define LITTLEENDIAN. But you are correct:
I was mistaken in that it’s qcc that does it, not our recursive makefiles.

Kris

-seanb

Kris Warkentin <> kewarken@qnx.com> > wrote:
Take a look at gulliver.h. You just need to make sure you define
BIGENDIAN or LITTLEENDIAN (these are defined automatically by
our
recursive makefiles) and the meaning of ENDIAN_LE32 and ENDIAN_BE32 will
be
swapped as appropriate.

cheers,

Kris

“sarath chandran” <> sarath.chandran@tatainfotech.com> > wrote in message
news:aknph6$46g$> 1@inn.qnx.com> …
Hi everyone,
I am tryig to port Linux code to QNX.
Is there a function similar to cpu_to_le32 ( linux) for QNX.?
I found that the le32_to_cpu fn is replaced by ENDIAN_LE32 in QNX.

Thanks In Advance
Sarath

\

Thanks Kris .Thats a lottta Info…
But still i have sime doubts…
My code is something like this…
frag[0].length = cpu_to_le32(np->rx_buf_sz | LastFrag);

Here “length” will be used by the NIC in its DMa transfer operation…

Do u think simply an ENDIAN_LE32 will work … !!!

Please clarify
regards
Sarath




“Kris Warkentin” <kewarken@qnx.com> wrote in message
news:ako4gb$lm6$1@nntp.qnx.com

“Sean Boudreau” <> seanb@node25.ott.qnx.com> > wrote in message
news:aknv66$f11$> 1@nntp.qnx.com> …

The endianess is always defined for you. ENDIAN_LE32 should work
in both cases here.

Assuming you’re using qcc. “qcc -Vgcc_ntoshle” (for example) works but
“ntosh-gcc -ml -m4” will not define LITTLEENDIAN. But you are
correct:
I was mistaken in that it’s qcc that does it, not our recursive makefiles.

Kris

-seanb

Kris Warkentin <> kewarken@qnx.com> > wrote:
Take a look at gulliver.h. You just need to make sure you define
BIGENDIAN or LITTLEENDIAN (these are defined automatically by
our
recursive makefiles) and the meaning of ENDIAN_LE32 and ENDIAN_BE32
will
be
swapped as appropriate.

cheers,

Kris

“sarath chandran” <> sarath.chandran@tatainfotech.com> > wrote in message
news:aknph6$46g$> 1@inn.qnx.com> …
Hi everyone,
I am tryig to port Linux code to QNX.
Is there a function similar to cpu_to_le32 ( linux) for QNX.?
I found that the le32_to_cpu fn is replaced by ENDIAN_LE32 in QNX.

Thanks In Advance
Sarath



\

Yep, we do this all the time in our drivers. From pcnet’s transmit.c:

tfd->addr = ENDIAN_LE32(iov->iov_phys | ext->bmstr);


chris



sarath chandran <sarath.chandran@tatainfotech.com> wrote:

Thanks Kris .Thats a lottta Info…
But still i have sime doubts…
My code is something like this…
frag[0].length = cpu_to_le32(np->rx_buf_sz | LastFrag);

Here “length” will be used by the NIC in its DMa transfer operation…

Do u think simply an ENDIAN_LE32 will work … !!!

Please clarify
regards
Sarath




“Kris Warkentin” <> kewarken@qnx.com> > wrote in message
news:ako4gb$lm6$> 1@nntp.qnx.com> …
“Sean Boudreau” <> seanb@node25.ott.qnx.com> > wrote in message
news:aknv66$f11$> 1@nntp.qnx.com> …

The endianess is always defined for you. ENDIAN_LE32 should work
in both cases here.

Assuming you’re using qcc. “qcc -Vgcc_ntoshle” (for example) works but
“ntosh-gcc -ml -m4” will not define LITTLEENDIAN. But you are
correct:
I was mistaken in that it’s qcc that does it, not our recursive makefiles.

Kris

-seanb

Kris Warkentin <> kewarken@qnx.com> > wrote:
Take a look at gulliver.h. You just need to make sure you define
BIGENDIAN or LITTLEENDIAN (these are defined automatically by
our
recursive makefiles) and the meaning of ENDIAN_LE32 and ENDIAN_BE32
will
be
swapped as appropriate.

cheers,

Kris

“sarath chandran” <> sarath.chandran@tatainfotech.com> > wrote in message
news:aknph6$46g$> 1@inn.qnx.com> …
Hi everyone,
I am tryig to port Linux code to QNX.
Is there a function similar to cpu_to_le32 ( linux) for QNX.?
I found that the le32_to_cpu fn is replaced by ENDIAN_LE32 in QNX.

Thanks In Advance
Sarath






\


Chris McKillop <cdm@qnx.com> “The faster I go, the behinder I get.”
Software Engineer, QSSL – Lewis Carroll –
http://qnx.wox.org/

Chris McKillop <cdm@qnx.com> wrote:

Yep, we do this all the time in our drivers. From pcnet’s transmit.c:

tfd->addr = ENDIAN_LE32(iov->iov_phys | ext->bmstr);

My copy of transmit.c has:

tfd->addr = ENDIAN_LE32(iov->iov_phys + ext->bmstr);

This was changed since certain boards need a negative translation.

sarath chandran <> sarath.chandran@tatainfotech.com> > wrote:
Thanks Kris .Thats a lottta Info…
But still i have sime doubts…
My code is something like this…
frag[0].length = cpu_to_le32(np->rx_buf_sz | LastFrag);

Here “length” will be used by the NIC in its DMa transfer operation…

Do u think simply an ENDIAN_LE32 will work … !!!

Please clarify
regards
Sarath




“Kris Warkentin” <> kewarken@qnx.com> > wrote in message
news:ako4gb$lm6$> 1@nntp.qnx.com> …
“Sean Boudreau” <> seanb@node25.ott.qnx.com> > wrote in message
news:aknv66$f11$> 1@nntp.qnx.com> …

The endianess is always defined for you. ENDIAN_LE32 should work
in both cases here.

Assuming you’re using qcc. “qcc -Vgcc_ntoshle” (for example) works but
“ntosh-gcc -ml -m4” will not define LITTLEENDIAN. But you are
correct:
I was mistaken in that it’s qcc that does it, not our recursive makefiles.

Kris

-seanb

Kris Warkentin <> kewarken@qnx.com> > wrote:
Take a look at gulliver.h. You just need to make sure you define
BIGENDIAN or LITTLEENDIAN (these are defined automatically by
our
recursive makefiles) and the meaning of ENDIAN_LE32 and ENDIAN_BE32
will
be
swapped as appropriate.

cheers,

Kris

“sarath chandran” <> sarath.chandran@tatainfotech.com> > wrote in message
news:aknph6$46g$> 1@inn.qnx.com> …
Hi everyone,
I am tryig to port Linux code to QNX.
Is there a function similar to cpu_to_le32 ( linux) for QNX.?
I found that the le32_to_cpu fn is replaced by ENDIAN_LE32 in QNX.

Thanks In Advance
Sarath









\

Chris McKillop <> cdm@qnx.com> > “The faster I go, the behinder I get.”
Software Engineer, QSSL – Lewis Carroll –
http://qnx.wox.org/