aboutsummaryrefslogtreecommitdiff
path: root/pipe_image.c
diff options
context:
space:
mode:
authorWojtek Kosior <kwojtus@protonmail.com>2019-11-20 08:29:33 +0100
committerWojtek Kosior <kwojtus@protonmail.com>2019-11-20 08:29:33 +0100
commit6eba61fede40efda3651bceb559f8d1fa372fa73 (patch)
treeb90f28b2c0c58e5a62cfde0008769292520ff600 /pipe_image.c
parent42fa390951fa7a35cc60d935ae3140d735ec61e1 (diff)
parentd302f79c13df6ecaa63c477c6a811fa94996b7cb (diff)
downloadrpi-MMU-example-6eba61fede40efda3651bceb559f8d1fa372fa73.tar.gz
rpi-MMU-example-6eba61fede40efda3651bceb559f8d1fa372fa73.zip
merge alice to bob
Diffstat (limited to 'pipe_image.c')
-rw-r--r--pipe_image.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/pipe_image.c b/pipe_image.c
index 987ae99..7e27fb9 100644
--- a/pipe_image.c
+++ b/pipe_image.c
@@ -15,7 +15,7 @@
int main(int argc, const char **argv) {
const char *image_file_name = "kernel.img";
_Bool stdout_instead_of_uart = 0;
-
+
if (argc > 1)
if (!strcmp(argv[1], "--stdout"))
{
@@ -50,7 +50,7 @@ int main(int argc, const char **argv) {
const int comport=16;
if (!stdout_instead_of_uart)
- if (RS232_OpenComport(comport, 115200, "8N1", 0) == 1)
+ if (RS232_OpenComport(comport, 115200, "8N1", 1) == 1)
err(-1, "Error opening comport");
uint32_t image_size_le = htole32(image_size);
@@ -63,7 +63,7 @@ int main(int argc, const char **argv) {
else
{
if (RS232_SendBuf(comport, (unsigned char*) &image_size_le, 4)
- == 1)
+ == -1)
err(-1, "error writing number to serial");
}
@@ -84,13 +84,27 @@ int main(int argc, const char **argv) {
}
else
{
- if (RS232_SendBuf(comport, buf, bytes_read) == 1)
+ if (RS232_SendBuf(comport, buf, bytes_read) == -1)
err(-1, "error writing to serial");
}
bytes_left -= bytes_read;
}
-
+/*
+ while(1){
+ int bytes_read=read(0,buf,sizeof(buf));
+ if (stdout_instead_of_uart)
+ {
+ if (fwrite((unsigned char*) buf, bytes_read, 1, stdout) != 1)
+ err(-1, "error writing to stdout");
+ }
+ else
+ {
+ if (RS232_SendBuf(comport, buf, bytes_read) == 1)
+ err(-1, "error writing to serial");
+ }
+ }
+ */
if (!stdout_instead_of_uart)
RS232_CloseComport(comport);