]> git.karo-electronics.de Git - karo-tx-redboot.git/blobdiff - packages/redboot/v2_0/src/wince.c
TX51 pre-release
[karo-tx-redboot.git] / packages / redboot / v2_0 / src / wince.c
index d8324dd12f3f9d34412d7a68461639a9f0d0ec35..dc26041d133a12dfc6281af055f8f34305a1114c 100755 (executable)
@@ -133,11 +133,11 @@ void ce_process_edbg(ce_net *net, ce_bin *bin);
 #ifdef CYGPKG_REDBOOT_NETWORKING
 // Redboot network based commands
 RedBoot_cmd(
-           "ceconnect",
-           "Set up a connection to the CE host PC over TCP/IP and download the run-time image",
-           "[-v] [-t <timeout>] [-h <host>]",
-           ce_load
-           );
+       "ceconnect",
+       "Set up a connection to the CE host PC over TCP/IP and download the run-time image",
+       "[-v] [-t <timeout>] [-h <host>]",
+       ce_load
+       );
 #endif
 
 ///////////////////////////////////////////////////////////////////////////////////////////////
@@ -161,7 +161,7 @@ bool ce_is_bin_image(void *image, int imglen)
 {
        if (imglen < CE_BIN_SIGN_LEN) {
                diag_printf("Not a valid CE image: image size %u shorter than minimum %u\n",
-                           imglen, CE_BIN_SIGN_LEN);
+                                       imglen, CE_BIN_SIGN_LEN);
                return 0;
        }
        if (is_rom_addr(image)) {
@@ -169,7 +169,7 @@ bool ce_is_bin_image(void *image, int imglen)
                void *err_addr;
 
                if (flash_read(image, sign_buf,
-                              CE_BIN_SIGN_LEN, &err_addr) != FLASH_ERR_OK) {
+                                               CE_BIN_SIGN_LEN, &err_addr) != FLASH_ERR_OK) {
                        return 0;
                }
                return memcmp(sign_buf, CE_BIN_SIGN, CE_BIN_SIGN_LEN) == 0;
@@ -244,7 +244,7 @@ int ce_parse_bin(ce_bin *bin)
                                        void *err_addr;
 
                                        if (flash_read(pbData, &bin->parsePtr[bin->parseLen],
-                                                      copyLen, &err_addr) != FLASH_ERR_OK) {
+                                                                       copyLen, &err_addr) != FLASH_ERR_OK) {
                                                return CE_PR_ERROR;
                                        }
                                } else {
@@ -259,7 +259,7 @@ int ce_parse_bin(ce_bin *bin)
                                                bin->rtiPhysAddr = CE_FIX_ADDRESS(bin->rtiPhysAddr);
                                                if (!is_ram_addr(bin->rtiPhysAddr)) {
                                                        diag_printf("Invalid address %08lx in CE_PS_RTI_ADDR section\n",
-                                                                   bin->rtiPhysAddr);
+                                                                               bin->rtiPhysAddr);
                                                        return CE_PR_ERROR;
                                                }
                                        } else if (bin->parseState == CE_PS_E_ADDR) {
@@ -267,7 +267,7 @@ int ce_parse_bin(ce_bin *bin)
                                                        bin->ePhysAddr = CE_FIX_ADDRESS(bin->ePhysAddr);
                                                        if (!is_ram_addr(bin->ePhysAddr)) {
                                                                diag_printf("Invalid address %08lx in CE_PS_E_ADDR section\n",
-                                                                           bin->ePhysAddr);
+                                                                                       bin->ePhysAddr);
                                                                return CE_PR_ERROR;
                                                        }
                                                }
@@ -299,7 +299,7 @@ int ce_parse_bin(ce_bin *bin)
                                                void *err_addr;
 
                                                if (flash_read(pbData, bin->parsePtr,
-                                                              copyLen, &err_addr) != FLASH_ERR_OK) {
+                                                                               copyLen, &err_addr) != FLASH_ERR_OK) {
                                                        return CE_PR_ERROR;
                                                }
                                                pbData += copyLen;
@@ -387,8 +387,8 @@ bool ce_lookup_ep_bin(ce_bin *bin)
 
        // Lookup entry point
        header = (ce_rom_hdr*)CE_FIX_ADDRESS(*(unsigned int*)(bin->rtiPhysAddr +
-                                                             ROM_SIGNATURE_OFFSET +
-                                                             sizeof(unsigned int)));
+                                                                                                                       ROM_SIGNATURE_OFFSET +
+                                                                                                                       sizeof(unsigned int)));
        tentry = (ce_toc_entry*)(header + 1);
 
        for (i = 0; i < header->nummods; i++) {
@@ -461,7 +461,7 @@ void setup_std_drv_globals(ce_std_driver_globals *std_drv_glb)
        std_drv_glb->header.bspVersion = 1;
 
        std_drv_glb->kitl.flags = 0;
-       diag_sprintf(std_drv_glb->deviceId, "Triton");          
+       diag_sprintf(std_drv_glb->deviceId, "Triton");
 
 #ifdef CYGPKG_REDBOOT_NETWORKING
        memcpy(&std_drv_glb->kitl.mac[0], __local_enet_addr, sizeof(__local_enet_addr));
@@ -631,7 +631,7 @@ void ce_load(int argc, char *argv[])
                        if (verbose) {
                                if (use_timeout) {
                                        diag_printf("Waiting for connection, timeout %d sec\n",
-                                                   timeout);
+                                                               timeout);
                                } else {
                                        diag_printf("Waiting for connection, enter ^C to abort\n");
                                }
@@ -743,7 +743,7 @@ int ce_recv_frame(ce_net *net, int timeout)
        // Receive UDP packet
 
        net->dataLen = __udp_recvfrom(net->data, sizeof(net->data), &net->srvAddrRecv,
-                                     &net->locAddr, &timeo);
+                                                               &net->locAddr, &timeo);
 
        if (net->dataLen < 0) {
                // Error! No data available
@@ -827,8 +827,8 @@ int ce_send_bootme(ce_net *net)
        // Some diag output ...
        if (net->verbose) {
                diag_printf("Sending BOOTME request [%d] to %s\n",
-                           net->secNum,
-                           inet_ntoa((in_addr_t *)&net->srvAddrSend));
+                                       net->secNum,
+                                       inet_ntoa((in_addr_t *)&net->srvAddrSend));
        }
 
        // Send packet
@@ -854,7 +854,8 @@ int ce_process_download(ce_net *net, ce_bin *bin)
        int ret = CE_PR_MORE;
 
        if (net->dataLen >= 2) {
-               switch (ntohs(*(unsigned short*)net->data)) {
+               unsigned short *wdata = (unsigned short*)net->data;
+               switch (ntohs(*wdata)) {
                case EDBG_CMD_WRITE_REQ:
                        if (!net->link) {
                                // Check file name for WRITE request
@@ -867,8 +868,8 @@ int ce_process_download(ce_net *net, ce_bin *bin)
                                        // Some diag output
                                        if (net->verbose) {
                                                diag_printf("Locked Down download link, IP: %s, port: %d\n",
-                                                           inet_ntoa((in_addr_t *)&net->srvAddrRecv),
-                                                           net->srvAddrRecv.sin_port);
+                                                                       inet_ntoa((in_addr_t *)&net->srvAddrRecv),
+                                                                       net->srvAddrRecv.sin_port);
                                        }
 
                                        // Lock down EShell download link
@@ -1016,4 +1017,3 @@ void ce_process_edbg(ce_net *net, ce_bin *bin)
        ce_send_frame(net);
 }
 #endif
-