mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Antony Pavlov <antonynpavlov@gmail.com>
To: barebox@lists.infradead.org
Subject: [PATCH] make new y-modem (PATCH v2) work on big-endian CPU
Date: Wed,  7 Nov 2012 12:23:05 +0400	[thread overview]
Message-ID: <1352276585-20262-1-git-send-email-antonynpavlov@gmail.com> (raw)

apply this commit after that one:

    Author: Robert Jarzmik <robert.jarzmik@free.fr>
    Date:   Sun Nov 4 18:55:23 2012 +0100

        commands: change Y-Modem implementation
---
 lib/xymodem.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/lib/xymodem.c b/lib/xymodem.c
index 1469a9a..0e82ce2 100644
--- a/lib/xymodem.c
+++ b/lib/xymodem.c
@@ -257,8 +257,8 @@ static ssize_t xy_read_block(struct xyz_ctxt *proto, struct xy_block *blk,
 	uint64_t timeout)
 {
 	ssize_t rc, data_len = 0;
-	unsigned char hdr, seqs[2], crcs[2];
-	int crc = 0, hdr_found = 0;
+	unsigned char hdr, seqs[2];
+	uint16_t crc = 0, hdr_found = 0;
 	uint64_t start = get_time_ns();
 
 	while (!hdr_found) {
@@ -308,12 +308,13 @@ static ssize_t xy_read_block(struct xyz_ctxt *proto, struct xy_block *blk,
 
 	switch (proto->crc_mode) {
 	case CRC_ADD8:
-		rc = xy_gets(proto->cdev, proto->fifo, crcs, 1, timeout);
-		crc = crcs[0];
+		rc = xy_gets(proto->cdev, proto->fifo,
+				(unsigned char *)&crc, 1, timeout);
 		break;
 	case CRC_CRC16:
-		rc = xy_gets(proto->cdev, proto->fifo, crcs, 2, timeout);
-		crc = be16_to_cpu(*(uint16_t *)crcs);
+		rc = xy_gets(proto->cdev, proto->fifo,
+				(unsigned char *)&crc, 2, timeout);
+		crc = be16_to_cpu(crc);
 		break;
 	case CRC_NONE:
 		rc = 0;
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2012-11-07  8:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-07  8:23 Antony Pavlov [this message]
2012-11-07 23:41 ` Robert Jarzmik
2012-11-08  5:49   ` Antony Pavlov
2012-11-08 19:59     ` Robert Jarzmik
2012-11-08 19:57   ` Antony Pavlov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1352276585-20262-1-git-send-email-antonynpavlov@gmail.com \
    --to=antonynpavlov@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox