]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/mcsdk-tools.git/blobdiff - post/src/post.c
Added RBL EMAC boot example
[keystone-rtos/mcsdk-tools.git] / post / src / post.c
index 2902574a9e300f90fe1b792bdcd07d7a0c7b9b53..1044dc9dfe0dc664237d0c554e7196e43504b4ef 100644 (file)
@@ -1,34 +1,34 @@
 /******************************************************************************
  * Copyright (c) 2011 Texas Instruments Incorporated - http://www.ti.com
- * 
- *  Redistribution and use in source and binary forms, with or without 
- *  modification, are permitted provided that the following conditions 
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
  *  are met:
  *
- *    Redistributions of source code must retain the above copyright 
+ *    Redistributions of source code must retain the above copyright
  *    notice, this list of conditions and the following disclaimer.
  *
  *    Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the 
- *    documentation and/or other materials provided with the   
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
  *    distribution.
  *
  *    Neither the name of Texas Instruments Incorporated nor the names of
  *    its contributors may be used to endorse or promote products derived
  *    from this software without specific prior written permission.
  *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
- *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
- *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
- *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * 
+ *
  *****************************************************************************/
 
 #include <string.h>
@@ -42,9 +42,9 @@
 char post_version[] = POST_VERSION;
 
 /******************************************************************************
- * Function:    post_display_led_error  
+ * Function:    post_display_led_error
  ******************************************************************************/
-void 
+void
 post_display_led_error
 (
     POST_TEST_ID     test_id
@@ -52,7 +52,7 @@ post_display_led_error
 {
     uint8_t     led_status[POST_MAX_NUM_LED];
     uint32_t    i;
-        
+
     memset(led_status, POST_LED_ON, POST_MAX_NUM_LED);
     while (TRUE)
     {
@@ -81,9 +81,9 @@ post_display_led_error
 }
 
 /******************************************************************************
- * Function:    post_write_uart  
+ * Function:    post_write_uart
  ******************************************************************************/
-Bool 
+Bool
 post_write_uart
 (
     char*      msg
@@ -105,9 +105,9 @@ post_write_uart
 }
 
 /******************************************************************************
- * Function:    post_display_status  
+ * Function:    post_display_status
  ******************************************************************************/
-void 
+void
 post_display_status
 (
     POST_TEST_ID        test_id,
@@ -156,7 +156,7 @@ post_display_status
             if (post_write_uart(msg) != TRUE)
             {
                 post_display_led_error(POST_TEST_UART);   /* Never return from this function */
-            }      
+            }
             post_display_led_error(test_id);  /* Never return from this function */
         }
         break;
@@ -164,9 +164,9 @@ post_display_status
 }
 
 /******************************************************************************
- * Function:    post_test_external_memory  
+ * Function:    post_test_external_memory
  ******************************************************************************/
-Bool 
+Bool
 post_test_external_memory
 (
     void
@@ -174,7 +174,7 @@ post_test_external_memory
 {
     Bool    test_passed = TRUE;
 
-    if(platform_external_memory_test(0, 0) != Platform_EOK) 
+    if(platform_external_memory_test(0, 0) != Platform_EOK)
     {
         test_passed = FALSE;
     }
@@ -183,9 +183,9 @@ post_test_external_memory
 }
 
 /******************************************************************************
- * Function:    post_test_eeprom  
+ * Function:    post_test_eeprom
  ******************************************************************************/
-Bool 
+Bool
 post_test_eeprom
 (
     void
@@ -196,15 +196,15 @@ post_test_eeprom
     PLATFORM_DEVICE_info    *p_device;
 
     p_device = platform_device_open(POST_EEPROM_TEST_DEVICE_ID, 0);
-    if (p_device == NULL) 
+    if (p_device == NULL)
     {
         return FALSE;
     }
 
-    if(platform_device_read(p_device->handle, 
-                            POST_EEPROM_TEST_READ_ADDRESS, 
-                            test_buf, 
-                            POST_EEPROM_TEST_READ_LENGTH) != Platform_EOK) 
+    if(platform_device_read(p_device->handle,
+                            POST_EEPROM_TEST_READ_ADDRESS,
+                            test_buf,
+                            POST_EEPROM_TEST_READ_LENGTH) != Platform_EOK)
     {
         test_passed = FALSE;
     }
@@ -214,9 +214,9 @@ post_test_eeprom
 }
 
 /******************************************************************************
- * Function:    post_test_nand  
+ * Function:    post_test_nand
  ******************************************************************************/
-Bool 
+Bool
 post_test_nand
 (
     void
@@ -228,16 +228,16 @@ post_test_nand
     PLATFORM_DEVICE_info    *p_device;
 
     p_device = platform_device_open(POST_NAND_TEST_DEVICE_ID, 0);
-    if (p_device == NULL) 
+    if (p_device == NULL)
     {
         return FALSE;
     }
 
     addr = (POST_NAND_TEST_READ_BLOCK_NUM * p_device->page_count + POST_NAND_TEST_READ_PAGE_NUM) * p_device->page_size;
-    if(platform_device_read(p_device->handle, 
-                            addr, 
-                            test_buf, 
-                            POST_NAND_TEST_READ_LENGTH) != Platform_EOK) 
+    if(platform_device_read(p_device->handle,
+                            addr,
+                            test_buf,
+                            POST_NAND_TEST_READ_LENGTH) != Platform_EOK)
     {
         test_passed = FALSE;
     }
@@ -247,9 +247,9 @@ post_test_nand
 }
 
 /******************************************************************************
- * Function:    post_test_nor 
+ * Function:    post_test_nor
  ******************************************************************************/
-Bool 
+Bool
 post_test_nor
 (
     void
@@ -260,15 +260,15 @@ post_test_nor
     PLATFORM_DEVICE_info    *p_device;
 
     p_device = platform_device_open(POST_NOR_TEST_DEVICE_ID, 0);
-    if (p_device == NULL) 
+    if (p_device == NULL)
     {
         return FALSE;
     }
 
-    if(platform_device_read(p_device->handle, 
-                            POST_NOR_TEST_READ_ADDR, 
-                            test_buf, 
-                            POST_NOR_TEST_READ_LENGTH) != Platform_EOK) 
+    if(platform_device_read(p_device->handle,
+                            POST_NOR_TEST_READ_ADDR,
+                            test_buf,
+                            POST_NOR_TEST_READ_LENGTH) != Platform_EOK)
     {
         test_passed = FALSE;
     }
@@ -327,9 +327,9 @@ post_serial_num_isvalid
 }
 
 /******************************************************************************
- * Function:    post_write_serial_no  
+ * Function:    post_write_serial_no
  ******************************************************************************/
-void 
+void
 post_write_serial_no
 (
     void
@@ -338,9 +338,9 @@ post_write_serial_no
     uint32_t                i, j;
     uint8_t                 msg[20], msg2[2];
     PLATFORM_DEVICE_info    *p_device;
-   
+
     /* Check if user key in the passcode "ti" to enter board serial number */
-    if (platform_uart_read(msg, POST_UART_READ_TIMEOUT) != Platform_EOK) 
+    if (platform_uart_read(msg, POST_UART_READ_TIMEOUT) != Platform_EOK)
     {
         return;
     }
@@ -349,7 +349,7 @@ post_write_serial_no
         return;
     }
 
-    if (platform_uart_read(msg, POST_UART_READ_TIMEOUT) != Platform_EOK) 
+    if (platform_uart_read(msg, POST_UART_READ_TIMEOUT) != Platform_EOK)
     {
         return;
     }
@@ -360,7 +360,7 @@ post_write_serial_no
 
     /* Passcode verified, prompt the user to enter serial number */
     p_device = platform_device_open(PLATFORM_DEVID_EEPROM50, 0);
-    if (p_device == NULL) 
+    if (p_device == NULL)
     {
         return;
     }
@@ -397,7 +397,7 @@ post_write_serial_no
             msg[j] = 0xff;
         }
     }
-    
+
     if(platform_device_write(p_device->handle, POST_SERIAL_NUM_ADDR, msg, 16) == Platform_EOK)
     {
         post_write_uart("\r\n\r\nSerial number programmed to EEPROM successfully! ");
@@ -413,7 +413,7 @@ post_write_serial_no
 /******************************************************************************
  * Function:    main function for POST
  ******************************************************************************/
-void 
+void
 main
 (
     void
@@ -494,7 +494,7 @@ main
             post_write_uart(msg);
         }
 
-        sa_enable = *(volatile uint32_t *)0x20c0000;
+        sa_enable = *(volatile uint32_t *)0x20c0004;
         sa_enable &= 0x1;
 
         if (sa_enable)