summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHao Zhang2011-06-18 11:47:44 -0500
committerHao Zhang2011-06-18 11:47:44 -0500
commit6324c7ba5dce75327dae9af8ee17c2d3c58f908e (patch)
tree91d1456e9aaf5b92cd10e7f76b0b8398f518d4ae /boot_loader/examples
parent7350edf118b1c6ad7cb1a899c1829f5a38b428cf (diff)
downloadmcsdk-tools-6324c7ba5dce75327dae9af8ee17c2d3c58f908e.tar.gz
mcsdk-tools-6324c7ba5dce75327dae9af8ee17c2d3c58f908e.tar.xz
mcsdk-tools-6324c7ba5dce75327dae9af8ee17c2d3c58f908e.zip
Added platform osal malloc and free functions
Diffstat (limited to 'boot_loader/examples')
-rw-r--r--boot_loader/examples/i2c/nand/src/i2c_boot_nand_example.c15
-rw-r--r--boot_loader/examples/i2c/nor/src/i2c_boot_nor_example.c15
-rw-r--r--boot_loader/examples/i2c/tftp/src/i2c_boot_tftp_example.c15
-rw-r--r--boot_loader/examples/srio/srioboot_ddrinit/src/srioboot_ddrinit.c16
-rw-r--r--boot_loader/examples/srio/srioboot_example/src/srioBootExample.c15
-rw-r--r--boot_loader/examples/srio/srioboot_helloworld/src/srioboot_helloworld.c15
6 files changed, 91 insertions, 0 deletions
diff --git a/boot_loader/examples/i2c/nand/src/i2c_boot_nand_example.c b/boot_loader/examples/i2c/nand/src/i2c_boot_nand_example.c
index 6ebede1..6aa0d50 100644
--- a/boot_loader/examples/i2c/nand/src/i2c_boot_nand_example.c
+++ b/boot_loader/examples/i2c/nand/src/i2c_boot_nand_example.c
@@ -49,6 +49,21 @@
49/* i2c_boot_nand_example version */ 49/* i2c_boot_nand_example version */
50char version[] = "01.00.00.00"; 50char version[] = "01.00.00.00";
51 51
52/* OSAL functions for Platform Library */
53uint8_t *Osal_platformMalloc (uint32_t num_bytes, uint32_t alignment)
54{
55 return malloc(num_bytes);
56}
57
58void Osal_platformFree (uint8_t *dataPtr, uint32_t num_bytes)
59{
60 /* Free up the memory */
61 if (dataPtr)
62 {
63 free(dataPtr);
64 }
65}
66
52/****************************************************************************** 67/******************************************************************************
53 * Function: print_platform_errno 68 * Function: print_platform_errno
54 ******************************************************************************/ 69 ******************************************************************************/
diff --git a/boot_loader/examples/i2c/nor/src/i2c_boot_nor_example.c b/boot_loader/examples/i2c/nor/src/i2c_boot_nor_example.c
index 0b43d49..7dceef2 100644
--- a/boot_loader/examples/i2c/nor/src/i2c_boot_nor_example.c
+++ b/boot_loader/examples/i2c/nor/src/i2c_boot_nor_example.c
@@ -49,6 +49,21 @@
49/* i2c_boot_nor_example version */ 49/* i2c_boot_nor_example version */
50char version[] = "01.00.00.00"; 50char version[] = "01.00.00.00";
51 51
52/* OSAL functions for Platform Library */
53uint8_t *Osal_platformMalloc (uint32_t num_bytes, uint32_t alignment)
54{
55 return malloc(num_bytes);
56}
57
58void Osal_platformFree (uint8_t *dataPtr, uint32_t num_bytes)
59{
60 /* Free up the memory */
61 if (dataPtr)
62 {
63 free(dataPtr);
64 }
65}
66
52/****************************************************************************** 67/******************************************************************************
53 * Function: print_platform_errno 68 * Function: print_platform_errno
54 ******************************************************************************/ 69 ******************************************************************************/
diff --git a/boot_loader/examples/i2c/tftp/src/i2c_boot_tftp_example.c b/boot_loader/examples/i2c/tftp/src/i2c_boot_tftp_example.c
index 55e447c..771cf4f 100644
--- a/boot_loader/examples/i2c/tftp/src/i2c_boot_tftp_example.c
+++ b/boot_loader/examples/i2c/tftp/src/i2c_boot_tftp_example.c
@@ -49,6 +49,21 @@
49/* i2c_boot_emac_example version */ 49/* i2c_boot_emac_example version */
50char version[] = "01.00.00.00"; 50char version[] = "01.00.00.00";
51 51
52/* OSAL functions for Platform Library */
53uint8_t *Osal_platformMalloc (uint32_t num_bytes, uint32_t alignment)
54{
55 return malloc(num_bytes);
56}
57
58void Osal_platformFree (uint8_t *dataPtr, uint32_t num_bytes)
59{
60 /* Free up the memory */
61 if (dataPtr)
62 {
63 free(dataPtr);
64 }
65}
66
52/****************************************************************************** 67/******************************************************************************
53 * Function: print_platform_errno 68 * Function: print_platform_errno
54 ******************************************************************************/ 69 ******************************************************************************/
diff --git a/boot_loader/examples/srio/srioboot_ddrinit/src/srioboot_ddrinit.c b/boot_loader/examples/srio/srioboot_ddrinit/src/srioboot_ddrinit.c
index eb36d88..db4c594 100644
--- a/boot_loader/examples/srio/srioboot_ddrinit/src/srioboot_ddrinit.c
+++ b/boot_loader/examples/srio/srioboot_ddrinit/src/srioboot_ddrinit.c
@@ -57,6 +57,22 @@
57 57
58#define BOOT_MAGIC_ADDR(x) (MAGIC_ADDR + (1<<28) + (x<<24)) 58#define BOOT_MAGIC_ADDR(x) (MAGIC_ADDR + (1<<28) + (x<<24))
59 59
60/* OSAL functions for Platform Library */
61uint8_t *Osal_platformMalloc (uint32_t num_bytes, uint32_t alignment)
62{
63 return malloc(num_bytes);
64}
65
66void Osal_platformFree (uint8_t *dataPtr, uint32_t num_bytes)
67{
68 /* Free up the memory */
69 if (dataPtr)
70 {
71 free(dataPtr);
72 }
73}
74
75
60void 76void
61start_boot 77start_boot
62( 78(
diff --git a/boot_loader/examples/srio/srioboot_example/src/srioBootExample.c b/boot_loader/examples/srio/srioboot_example/src/srioBootExample.c
index 4bed23b..bd72c46 100644
--- a/boot_loader/examples/srio/srioboot_example/src/srioBootExample.c
+++ b/boot_loader/examples/srio/srioboot_example/src/srioBootExample.c
@@ -76,6 +76,21 @@ volatile uint32_t bootEntryAddr = BOOT_ENTRY_ADDR; /* Base address of MSMC */
76/* Port error status registers */ 76/* Port error status registers */
77#define SRIO_PORT_ERR_STATUS_REG(x) (0x290b158 + x*0x20) 77#define SRIO_PORT_ERR_STATUS_REG(x) (0x290b158 + x*0x20)
78 78
79/* OSAL functions for Platform Library */
80uint8_t *Osal_platformMalloc (uint32_t num_bytes, uint32_t alignment)
81{
82 return malloc(num_bytes);
83}
84
85void Osal_platformFree (uint8_t *dataPtr, uint32_t num_bytes)
86{
87 /* Free up the memory */
88 if (dataPtr)
89 {
90 free(dataPtr);
91 }
92}
93
79/* Convert bytes to 32 bits */ 94/* Convert bytes to 32 bits */
80uint32_t byteto32bits(uint8_t *pDspCode) 95uint32_t byteto32bits(uint8_t *pDspCode)
81{ 96{
diff --git a/boot_loader/examples/srio/srioboot_helloworld/src/srioboot_helloworld.c b/boot_loader/examples/srio/srioboot_helloworld/src/srioboot_helloworld.c
index ead430c..7c4390f 100644
--- a/boot_loader/examples/srio/srioboot_helloworld/src/srioboot_helloworld.c
+++ b/boot_loader/examples/srio/srioboot_helloworld/src/srioboot_helloworld.c
@@ -70,6 +70,21 @@
70/* srioboot_helloworld version */ 70/* srioboot_helloworld version */
71char version[] = "01.00.00.01"; 71char version[] = "01.00.00.01";
72 72
73/* OSAL functions for Platform Library */
74uint8_t *Osal_platformMalloc (uint32_t num_bytes, uint32_t alignment)
75{
76 return malloc(num_bytes);
77}
78
79void Osal_platformFree (uint8_t *dataPtr, uint32_t num_bytes)
80{
81 /* Free up the memory */
82 if (dataPtr)
83 {
84 free(dataPtr);
85 }
86}
87
73/****************************************************************************** 88/******************************************************************************
74 * Function: write_uart 89 * Function: write_uart
75 ******************************************************************************/ 90 ******************************************************************************/