diff options
author | Paul Kocialkowski <contact@paulk.fr> | 2012-11-18 13:01:44 +0100 |
---|---|---|
committer | Paul Kocialkowski <contact@paulk.fr> | 2012-11-18 13:03:28 +0100 |
commit | 617169fce836a9b31d6c629a4b16c886b311fb3f (patch) | |
tree | 82d46fff18213a4a6a1d903b5932a8bd247f4265 /samsung-ipc/device | |
parent | 1c46f2f4e6d462799878844344860e836cae4b3f (diff) | |
download | hardware_replicant_libsamsung-ipc-617169fce836a9b31d6c629a4b16c886b311fb3f.tar.gz hardware_replicant_libsamsung-ipc-617169fce836a9b31d6c629a4b16c886b311fb3f.tar.bz2 hardware_replicant_libsamsung-ipc-617169fce836a9b31d6c629a4b16c886b311fb3f.zip |
Aries: Stick a bit more with SEC ril, preventing some failures
Change-Id: I54f069f32f85528176b8e06ac587d8948fae47f2
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Diffstat (limited to 'samsung-ipc/device')
-rw-r--r-- | samsung-ipc/device/aries/aries_ipc.c | 110 |
1 files changed, 54 insertions, 56 deletions
diff --git a/samsung-ipc/device/aries/aries_ipc.c b/samsung-ipc/device/aries/aries_ipc.c index 9e095d6..cf49272 100644 --- a/samsung-ipc/device/aries/aries_ipc.c +++ b/samsung-ipc/device/aries/aries_ipc.c @@ -184,8 +184,6 @@ int aries_modem_bootstrap(struct ipc_client *client) } ipc_client_log(client, "aries_ipc_bootstrap: sending AT in ASCII done"); - usleep(50000); //FIXME - /* Write the first part of modem.img. */ FD_ZERO(&fds); FD_SET(s3c2410_serial3_fd, &fds); @@ -193,7 +191,7 @@ int aries_modem_bootstrap(struct ipc_client *client) timeout.tv_sec=5; timeout.tv_usec=0; - if(select(FD_SETSIZE, &fds, NULL, NULL, &timeout) == 0) + if(select(s3c2410_serial3_fd + 1, &fds, NULL, NULL, &timeout) == 0) { ipc_client_log(client, "aries_ipc_bootstrap: select timeout passed"); goto error; @@ -206,10 +204,13 @@ int aries_modem_bootstrap(struct ipc_client *client) if(bootcore_version != BOOTCORE_VERSION) goto error; + FD_ZERO(&fds); + FD_SET(s3c2410_serial3_fd, &fds); + timeout.tv_sec=5; timeout.tv_usec=0; - if(select(FD_SETSIZE, &fds, NULL, NULL, &timeout) == 0) + if(select(s3c2410_serial3_fd + 1, &fds, NULL, NULL, &timeout) == 0) { ipc_client_log(client, "aries_ipc_bootstrap: select timeout passed"); goto error; @@ -219,18 +220,9 @@ int aries_modem_bootstrap(struct ipc_client *client) read(s3c2410_serial3_fd, &info_size, sizeof(info_size)); ipc_client_log(client, "aries_ipc_bootstrap: got info_size: 0x%x", info_size); - timeout.tv_sec=5; - timeout.tv_usec=0; - - if(select(FD_SETSIZE, NULL, &fds, NULL, &timeout) == 0) - { - ipc_client_log(client, "aries_ipc_bootstrap: select timeout passed"); - goto error; - } - /* Send PSI magic. */ data=PSI_MAGIC; - write(s3c2410_serial3_fd, &data, sizeof(data)); + write(s3c2410_serial3_fd, &data, sizeof(uint8_t)); ipc_client_log(client, "aries_ipc_bootstrap: sent PSI_MAGIC (0x%x)", PSI_MAGIC); /* Send PSI data len. */ @@ -239,7 +231,7 @@ int aries_modem_bootstrap(struct ipc_client *client) for(i=0 ; i < 2 ; i++) { - write(s3c2410_serial3_fd, data_p, 1); + write(s3c2410_serial3_fd, data_p, sizeof(uint8_t)); data_p++; } ipc_client_log(client, "aries_ipc_bootstrap: sent PSI_DATA_LEN (0x%x)", PSI_DATA_LEN); @@ -253,7 +245,10 @@ int aries_modem_bootstrap(struct ipc_client *client) for(i=0 ; i < PSI_DATA_LEN ; i++) { - if(select(FD_SETSIZE, NULL, &fds, NULL, &timeout) == 0) + FD_ZERO(&fds); + FD_SET(s3c2410_serial3_fd, &fds); + + if(select(s3c2410_serial3_fd + 1, NULL, &fds, NULL, &timeout) == 0) { ipc_client_log(client, "aries_ipc_bootstrap: select timeout passed"); goto error; @@ -267,10 +262,10 @@ int aries_modem_bootstrap(struct ipc_client *client) ipc_client_log(client, "aries_ipc_bootstrap: first part of radio.img sent; crc_byte is 0x%x", crc_byte); - timeout.tv_sec=5; - timeout.tv_usec=0; + FD_ZERO(&fds); + FD_SET(s3c2410_serial3_fd, &fds); - if(select(FD_SETSIZE, NULL, &fds, NULL, &timeout) == 0) + if(select(s3c2410_serial3_fd + 1, NULL, &fds, NULL, &timeout) == 0) { ipc_client_log(client, "aries_ipc_bootstrap: select timeout passed"); goto error; @@ -280,13 +275,16 @@ int aries_modem_bootstrap(struct ipc_client *client) ipc_client_log(client, "aries_ipc_bootstrap: crc_byte sent"); + timeout.tv_sec=5; + timeout.tv_usec=0; + data = 0; for(i = 0 ; data != 0x01 ; i++) { - timeout.tv_sec=5; - timeout.tv_usec=0; + FD_ZERO(&fds); + FD_SET(s3c2410_serial3_fd, &fds); - if(select(FD_SETSIZE, &fds, NULL, NULL, &timeout) == 0) + if(select(s3c2410_serial3_fd + 1, &fds, NULL, NULL, &timeout) == 0) { ipc_client_log(client, "aries_ipc_bootstrap: select timeout passed"); goto error; @@ -304,28 +302,26 @@ int aries_modem_bootstrap(struct ipc_client *client) ipc_client_log(client, "aries_ipc_bootstrap: close s3c2410_serial3"); close(s3c2410_serial3_fd); - FD_ZERO(&fds); - FD_SET(onedram_fd, &fds); - - timeout.tv_sec=5; + timeout.tv_sec=3; timeout.tv_usec=0; - ipc_client_log(client, "aries_ipc_bootstrap: wait for 0x12341234 from onedram"); - if(select(FD_SETSIZE, &fds, NULL, NULL, &timeout) == 0) - { - ipc_client_log(client, "aries_ipc_bootstrap: select timeout passed"); - goto error; - } + ipc_client_log(client, "aries_ipc_bootstrap: wait for 0x%04x from onedram", ONEDRAM_INIT_READ); - read(onedram_fd, &onedram_data, sizeof(onedram_data)); + onedram_data = 0; + while(onedram_data != ONEDRAM_INIT_READ) { + FD_ZERO(&fds); + FD_SET(onedram_fd, &fds); - if(onedram_data != ONEDRAM_INIT_READ) - { - ipc_client_log(client, "aries_ipc_bootstrap: wrong onedram init magic (got 0x%04x)", onedram_data); - goto error; - } + if(select(onedram_fd + 1, &fds, NULL, NULL, &timeout) == 0) + { + ipc_client_log(client, "aries_ipc_bootstrap: select timeout passed"); + goto error; + } - ipc_client_log(client, "aries_ipc_bootstrap: got 0x%04x", onedram_data); + read(onedram_fd, &onedram_data, sizeof(onedram_data)); + + ipc_client_log(client, "aries_ipc_bootstrap: read 0x%04x from onedram", onedram_data); + } ipc_client_log(client, "aries_ipc_bootstrap: writing the rest of modem.img to onedram."); @@ -339,8 +335,8 @@ int aries_modem_bootstrap(struct ipc_client *client) ipc_client_log(client, "aries_ipc_bootstrap: could not map onedram to memory"); goto error; } - - // it sometimes hangs here + + ipc_client_log(client, "aries_ipc_bootstrap: mapped onedram to 0x%x", onedram_p); memcpy(onedram_p, data_p, RADIO_IMG_READ_SIZE - PSI_DATA_LEN); @@ -378,27 +374,29 @@ int aries_modem_bootstrap(struct ipc_client *client) onedram_data = ONEDRAM_DEINIT_CMD; - timeout.tv_sec=5; - timeout.tv_usec=0; - ipc_client_log(client, "aries_ipc_bootstrap: send 0x%04x", onedram_data); write(onedram_fd, &onedram_data, sizeof(onedram_data)); - if(select(FD_SETSIZE, &fds, NULL, NULL, &timeout) == 0) - { - ipc_client_log(client, "aries_ipc_bootstrap: select timeout passed"); - goto error; - } + timeout.tv_sec=3; + timeout.tv_usec=0; - read(onedram_fd, &onedram_data, sizeof(onedram_data)); + ipc_client_log(client, "aries_ipc_bootstrap: wait for 0x%04x from onedram", ONEDRAM_DEINIT_READ); - if(onedram_data != ONEDRAM_DEINIT_READ) - { - ipc_client_log(client, "aries_ipc_bootstrap: wrong onedram deinit magic (got 0x%04x)", onedram_data); - goto error; - } + onedram_data = 0; + while(onedram_data != ONEDRAM_DEINIT_READ) { + FD_ZERO(&fds); + FD_SET(onedram_fd, &fds); - ipc_client_log(client, "aries_ipc_bootstrap: got 0x%04x", onedram_data); + if(select(onedram_fd + 1, &fds, NULL, NULL, &timeout) == 0) + { + ipc_client_log(client, "aries_ipc_bootstrap: select timeout passed"); + goto error; + } + + read(onedram_fd, &onedram_data, sizeof(onedram_data)); + + ipc_client_log(client, "aries_ipc_bootstrap: read 0x%04x from onedram", onedram_data); + } close(onedram_fd); |