18
18
#include "drv_uart.h"
19
19
20
20
#include <sbi.h>
21
-
21
+ #include "ioremap.h"
22
22
#include "sysctl_boot.h"
23
+ #include <riscv_mmu.h>
23
24
24
25
#ifdef RT_USING_SMART
25
26
#include <mmu.h>
@@ -59,6 +60,28 @@ void init_bss(void)
59
60
}
60
61
}
61
62
63
+ #define MEM_RESVERD_SIZE 0x1000 /*隔离区*/
64
+ #define MEM_IPCM_BASE 0x0
65
+ #define MEM_IPCM_SIZE 0
66
+
67
+
68
+ void init_ipcm_mem (void )
69
+ {
70
+ rt_uint32_t * dst ;
71
+ int i = 0 ;
72
+ dst = rt_ioremap ((void * )(MEM_IPCM_BASE + MEM_IPCM_SIZE - MEM_RESVERD_SIZE - MEM_RESVERD_SIZE ), MEM_RESVERD_SIZE );
73
+ if (dst == RT_NULL ) {
74
+ rt_kprintf ("ipcm ioremap error\n" );
75
+ }
76
+ rt_memset ((void * )dst , 0 , MEM_RESVERD_SIZE );
77
+ for (i = 0 ; i < (0x1000 / 4 ); i ++ ) {
78
+ if (dst [i ] != 0 ) {
79
+ rt_kprintf ("memest error addr:%p value:%d\n" , & dst [i ], dst [i ]);
80
+ }
81
+ }
82
+ rt_iounmap ((void * )dst );
83
+ }
84
+
62
85
static void __rt_assert_handler (const char * ex_string , const char * func , rt_size_t line )
63
86
{
64
87
rt_kprintf ("(%s) assertion failed at function:%s, line number:%d \n" , ex_string , func , line );
@@ -95,6 +118,11 @@ void rt_hw_board_init(void)
95
118
/* initialize memory system */
96
119
rt_system_heap_init (RT_HW_HEAP_BEGIN , RT_HW_HEAP_END );
97
120
#endif
121
+
122
+ #if MEM_IPCM_SIZE > MEM_RESVERD_SIZE
123
+ init_ipcm_mem ();
124
+ #endif
125
+
98
126
/* initalize interrupt */
99
127
rt_hw_interrupt_init ();
100
128
@@ -106,6 +134,12 @@ void rt_hw_board_init(void)
106
134
#ifdef RT_USING_CONSOLE
107
135
/* set console device */
108
136
rt_console_set_device (RT_CONSOLE_DEVICE_NAME );
137
+ #ifdef RT_USING_IPCM
138
+ extern int rt_virt_tty_device_init ();;
139
+ if (!rt_strcmp (RT_CONSOLE_DEVICE_NAME , "virt-tty" ))
140
+ rt_virt_tty_device_init ();
141
+ #endif
142
+
109
143
#endif /* RT_USING_CONSOLE */
110
144
111
145
#ifdef RT_USING_COMPONENTS_INIT
0 commit comments