summaryrefslogtreecommitdiff
path: root/bsp/microblaze
diff options
context:
space:
mode:
Diffstat (limited to 'bsp/microblaze')
-rwxr-xr-xbsp/microblaze/application.c2
-rwxr-xr-xbsp/microblaze/board.c158
-rwxr-xr-xbsp/microblaze/board.h2
-rwxr-xr-xbsp/microblaze/rtconfig.h58
-rwxr-xr-xbsp/microblaze/startup.c72
5 files changed, 146 insertions, 146 deletions
diff --git a/bsp/microblaze/application.c b/bsp/microblaze/application.c
index a889b2605e..d2ec464861 100755
--- a/bsp/microblaze/application.c
+++ b/bsp/microblaze/application.c
@@ -16,7 +16,7 @@
int rt_application_init()
{
- return 0;
+ return 0;
}
/*@}*/
diff --git a/bsp/microblaze/board.c b/bsp/microblaze/board.c
index 1de9171151..817666999c 100755
--- a/bsp/microblaze/board.c
+++ b/bsp/microblaze/board.c
@@ -33,83 +33,83 @@
#include "serial.h"
#endif
-#define TIMER_CNTR_0 0
-#define PIV (XPAR_PROC_BUS_0_FREQ_HZ / RT_TICK_PER_SECOND)
-#define LEDS_DEVICE_ID XPAR_LEDS_4BITS_DEVICE_ID
-#define RS232_DEVICE_ID XPAR_USB_UART_DEVICE_ID
+#define TIMER_CNTR_0 0
+#define PIV (XPAR_PROC_BUS_0_FREQ_HZ / RT_TICK_PER_SECOND)
+#define LEDS_DEVICE_ID XPAR_LEDS_4BITS_DEVICE_ID
+#define RS232_DEVICE_ID XPAR_USB_UART_DEVICE_ID
#ifdef RT_USING_UART1
-#define USB_UART_BASE ((struct uartport *)XPAR_USB_UART_BASEADDR)
+#define USB_UART_BASE ((struct uartport *)XPAR_USB_UART_BASEADDR)
#endif
/* Global Variables: */
-XTmrCtr timer; /* The instance of the timer */
-XGpio gpio_output; /* The driver instance for GPIO Device configured as O/P */
-XUartLite uart_lite; /* Instance of the UartLite device */
-XIntc int_ctl; /* The instance of the Interrupt Controller */
-static rt_uint32_t led_data;
+XTmrCtr timer; /* The instance of the timer */
+XGpio gpio_output; /* The driver instance for GPIO Device configured as O/P */
+XUartLite uart_lite; /* Instance of the UartLite device */
+XIntc int_ctl; /* The instance of the Interrupt Controller */
+static rt_uint32_t led_data;
static int cnt;
static void rt_hw_board_led_init(void);
-/**
+/**
* This function will init led on the board
*/
static void rt_hw_board_led_init()
{
- rt_uint32_t status;
- led_data = 0;
- cnt = 0;
- status = XGpio_Initialize(&gpio_output, LEDS_DEVICE_ID);
- if (status != XST_SUCCESS)
- {
- return;
- }
+ rt_uint32_t status;
+ led_data = 0;
+ cnt = 0;
+ status = XGpio_Initialize(&gpio_output, LEDS_DEVICE_ID);
+ if (status != XST_SUCCESS)
+ {
+ return;
+ }
- /*
- * Set the direction for all signals to be outputs
- */
- XGpio_SetDataDirection(&gpio_output, 1, 0x0);
- /*
- * Set the GPIO outputs to high
- */
- XGpio_DiscreteWrite(&gpio_output, 1, 3);
+ /*
+ * Set the direction for all signals to be outputs
+ */
+ XGpio_SetDataDirection(&gpio_output, 1, 0x0);
+ /*
+ * Set the GPIO outputs to high
+ */
+ XGpio_DiscreteWrite(&gpio_output, 1, 3);
}
-/**
+/**
* This function will take the led on board on.
*
* @param n the number nth led
*/
void rt_hw_board_led_on(rt_uint32_t led)
{
- led_data |= led;
- XGpio_DiscreteWrite(&gpio_output, 1, led_data);
+ led_data |= led;
+ XGpio_DiscreteWrite(&gpio_output, 1, led_data);
}
-/**
+/**
* This function will take the led on board off.
*
* @param n the number nth led
*/
void rt_hw_board_led_off(rt_uint32_t led)
{
- led_data &= ~led;
- XGpio_DiscreteWrite(&gpio_output, 1, led_data);
+ led_data &= ~led;
+ XGpio_DiscreteWrite(&gpio_output, 1, led_data);
}
void rt_hw_led_flash(void)
{
- volatile rt_uint32_t i;
+ volatile rt_uint32_t i;
- rt_hw_board_led_off(1);
- for (i = 0; i < 20000; i ++);
+ rt_hw_board_led_off(1);
+ for (i = 0; i < 20000; i ++);
- rt_hw_board_led_on(1);
- for (i = 0; i < 20000; i ++);
+ rt_hw_board_led_on(1);
+ for (i = 0; i < 20000; i ++);
}
@@ -126,30 +126,30 @@ void rt_hw_led_flash(void)
*/
void rt_hw_console_output(const char* str)
{
- while (*str)
- {
+ while (*str)
+ {
- /* Transmit Character */
+ /* Transmit Character */
- XUartLite_SendByte(STDOUT_BASEADDRESS, *str);
- if (*str == '\n')
- XUartLite_SendByte(STDOUT_BASEADDRESS, '\r');
- str++;
- }
+ XUartLite_SendByte(STDOUT_BASEADDRESS, *str);
+ if (*str == '\n')
+ XUartLite_SendByte(STDOUT_BASEADDRESS, '\r');
+ str++;
+ }
}
static void rt_hw_console_init()
{
- rt_uint32_t status;
+ rt_uint32_t status;
- /*
- * Initialize the UartLite driver so that it is ready to use.
- */
- status = XUartLite_Initialize(&uart_lite, RS232_DEVICE_ID);
- if (status != XST_SUCCESS)
- {
- return;
- }
+ /*
+ * Initialize the UartLite driver so that it is ready to use.
+ */
+ status = XUartLite_Initialize(&uart_lite, RS232_DEVICE_ID);
+ if (status != XST_SUCCESS)
+ {
+ return;
+ }
}
#endif
@@ -157,16 +157,16 @@ static void rt_hw_console_init()
void rt_hw_timer_handler(void)
{
- rt_uint32_t csr;
- csr = XTmrCtr_ReadReg(timer.BaseAddress, TIMER_CNTR_0, XTC_TCSR_OFFSET);
- /*
- * Check if timer expired and interrupt occured
- */
- if (csr & XTC_CSR_INT_OCCURED_MASK)
- {
- rt_tick_increase();
- XTmrCtr_WriteReg(timer.BaseAddress, TIMER_CNTR_0, XTC_TCSR_OFFSET, csr | XTC_CSR_INT_OCCURED_MASK);
- }
+ rt_uint32_t csr;
+ csr = XTmrCtr_ReadReg(timer.BaseAddress, TIMER_CNTR_0, XTC_TCSR_OFFSET);
+ /*
+ * Check if timer expired and interrupt occured
+ */
+ if (csr & XTC_CSR_INT_OCCURED_MASK)
+ {
+ rt_tick_increase();
+ XTmrCtr_WriteReg(timer.BaseAddress, TIMER_CNTR_0, XTC_TCSR_OFFSET, csr | XTC_CSR_INT_OCCURED_MASK);
+ }
}
@@ -192,24 +192,24 @@ void rt_intc_init (void)
status = XIntc_Initialize(&int_ctl, XPAR_INTC_0_DEVICE_ID);
- /* install interrupt handler */
+ /* install interrupt handler */
rt_hw_interrupt_install(XPAR_INTC_0_TMRCTR_0_VEC_ID, (rt_isr_handler_t)rt_hw_timer_handler, RT_NULL);
- rt_hw_interrupt_umask(XPAR_INTC_0_TMRCTR_0_VEC_ID);
+ rt_hw_interrupt_umask(XPAR_INTC_0_TMRCTR_0_VEC_ID);
- XIntc_Start(&int_ctl, XIN_REAL_MODE);
+ XIntc_Start(&int_ctl, XIN_REAL_MODE);
}
void rt_tmr_init (void)
{
- rt_uint32_t ctl;
- XStatus status;
+ rt_uint32_t ctl;
+ XStatus status;
status = XTmrCtr_Initialize(&timer,XPAR_AXI_TIMER_0_DEVICE_ID);
- XTmrCtr_WriteReg(timer.BaseAddress, TIMER_CNTR_0, XTC_TLR_OFFSET, PIV);
+ XTmrCtr_WriteReg(timer.BaseAddress, TIMER_CNTR_0, XTC_TLR_OFFSET, PIV);
ctl = XTC_CSR_ENABLE_TMR_MASK | XTC_CSR_ENABLE_INT_MASK | XTC_CSR_AUTO_RELOAD_MASK | XTC_CSR_DOWN_COUNT_MASK;
- XTmrCtr_WriteReg(timer.BaseAddress, TIMER_CNTR_0, XTC_TCSR_OFFSET, ctl);
+ XTmrCtr_WriteReg(timer.BaseAddress, TIMER_CNTR_0, XTC_TCSR_OFFSET, ctl);
}
@@ -219,15 +219,15 @@ void rt_tmr_init (void)
*/
void rt_hw_board_init()
{
- microblaze_disable_icache();
- microblaze_disable_dcache();
- /* init hardware console */
- rt_hw_console_init();
+ microblaze_disable_icache();
+ microblaze_disable_dcache();
+ /* init hardware console */
+ rt_hw_console_init();
- /* init led */
- rt_hw_board_led_init();
+ /* init led */
+ rt_hw_board_led_init();
- /* init intc */
+ /* init intc */
rt_intc_init();
/* timer init */
diff --git a/bsp/microblaze/board.h b/bsp/microblaze/board.h
index 9e542c17c5..0047bfebed 100755
--- a/bsp/microblaze/board.h
+++ b/bsp/microblaze/board.h
@@ -13,7 +13,7 @@
#define __BOARD_H__
-#define MCK 50000000
+#define MCK 50000000
void rt_hw_board_led_on(rt_uint32_t);
void rt_hw_board_led_off(rt_uint32_t);
diff --git a/bsp/microblaze/rtconfig.h b/bsp/microblaze/rtconfig.h
index d054c175b9..feedfdd09b 100755
--- a/bsp/microblaze/rtconfig.h
+++ b/bsp/microblaze/rtconfig.h
@@ -2,19 +2,19 @@
#ifndef __RTTHREAD_CFG_H__
#define __RTTHREAD_CFG_H__
-#define IDLE_THREAD_STACK_SIZE 2048
+#define IDLE_THREAD_STACK_SIZE 2048
/* RT_NAME_MAX*/
-#define RT_NAME_MAX 32
+#define RT_NAME_MAX 32
/* RT_ALIGN_SIZE*/
-#define RT_ALIGN_SIZE 4
+#define RT_ALIGN_SIZE 4
/* PRIORITY_MAX*/
-#define RT_THREAD_PRIORITY_MAX 32
+#define RT_THREAD_PRIORITY_MAX 32
/* Tick per Second*/
-#define RT_TICK_PER_SECOND 100
+#define RT_TICK_PER_SECOND 100
/* SECTION: RT_DEBUG */
@@ -61,10 +61,10 @@
#define RT_USING_DEVICE
/* buffer size for UART reception*/
-#define RT_UART_RX_BUFFER_SIZE 64
+#define RT_UART_RX_BUFFER_SIZE 64
/* buffer size for UART transmission*/
-#define RT_UART_TX_BUFFER_SIZE 64
+#define RT_UART_TX_BUFFER_SIZE 64
/* Using UART1*/
#define RT_USING_UART1
@@ -78,7 +78,7 @@
/* SECTION: Console options */
#define RT_USING_CONSOLE
/* the buffer size of console*/
-#define RT_CONSOLEBUF_SIZE 256
+#define RT_CONSOLEBUF_SIZE 256
/* SECTION: FinSH shell options */
/* Using FinSH as Shell*/
@@ -137,10 +137,10 @@
#define RT_LWIP_TCP
/* the number of simulatenously active TCP connections*/
-#define RT_LWIP_TCP_PCB_NUM 5
+#define RT_LWIP_TCP_PCB_NUM 5
/* TCP sender buffer space*/
-#define RT_LWIP_TCP_SND_BUF 10240
+#define RT_LWIP_TCP_SND_BUF 10240
/* Enable SNMP protocol*/
/* #define RT_LWIP_SNMP */
@@ -149,42 +149,42 @@
/* #define RT_LWIP_DHCP */
/* ip address of target*/
-#define RT_LWIP_IPADDR0 192
-#define RT_LWIP_IPADDR1 168
-#define RT_LWIP_IPADDR2 0
-#define RT_LWIP_IPADDR3 30
+#define RT_LWIP_IPADDR0 192
+#define RT_LWIP_IPADDR1 168
+#define RT_LWIP_IPADDR2 0
+#define RT_LWIP_IPADDR3 30
/* gateway address of target*/
-#define RT_LWIP_GWADDR0 192
-#define RT_LWIP_GWADDR1 168
-#define RT_LWIP_GWADDR2 0
-#define RT_LWIP_GWADDR3 1
+#define RT_LWIP_GWADDR0 192
+#define RT_LWIP_GWADDR1 168
+#define RT_LWIP_GWADDR2 0
+#define RT_LWIP_GWADDR3 1
/* mask address of target*/
-#define RT_LWIP_MSKADDR0 255
-#define RT_LWIP_MSKADDR1 255
-#define RT_LWIP_MSKADDR2 255
-#define RT_LWIP_MSKADDR3 0
+#define RT_LWIP_MSKADDR0 255
+#define RT_LWIP_MSKADDR1 255
+#define RT_LWIP_MSKADDR2 255
+#define RT_LWIP_MSKADDR3 0
/* the number of blocks for pbuf*/
-#define RT_LWIP_PBUF_NUM 16
+#define RT_LWIP_PBUF_NUM 16
/* thread priority of tcpip thread*/
-#define RT_LWIP_TCPTHREAD_PRIORITY 128
+#define RT_LWIP_TCPTHREAD_PRIORITY 128
/* mail box size of tcpip thread to wait for*/
-#define RT_LWIP_TCPTHREAD_MBOX_SIZE 8
+#define RT_LWIP_TCPTHREAD_MBOX_SIZE 8
/* thread stack size of tcpip thread*/
-#define RT_LWIP_TCPTHREAD_STACKSIZE 4096
+#define RT_LWIP_TCPTHREAD_STACKSIZE 4096
/* thread priority of ethnetif thread*/
-#define RT_LWIP_ETHTHREAD_PRIORITY 144
+#define RT_LWIP_ETHTHREAD_PRIORITY 144
/* mail box size of ethnetif thread to wait for*/
-#define RT_LWIP_ETHTHREAD_MBOX_SIZE 32
+#define RT_LWIP_ETHTHREAD_MBOX_SIZE 32
/* thread stack size of ethnetif thread*/
-#define RT_LWIP_ETHTHREAD_STACKSIZE 1024
+#define RT_LWIP_ETHTHREAD_STACKSIZE 1024
#endif
diff --git a/bsp/microblaze/startup.c b/bsp/microblaze/startup.c
index 941a908f8f..eb32b0ad8f 100755
--- a/bsp/microblaze/startup.c
+++ b/bsp/microblaze/startup.c
@@ -6,7 +6,7 @@
* Change Logs:
* Date Author Notes
* 2006-08-31 Bernard first implementation
- * 2011-12-17 nl1031 for MicroBlaze
+ * 2011-12-17 nl1031 for MicroBlaze
*/
#include <rthw.h>
@@ -43,72 +43,72 @@ extern rt_err_t rt_hw_serial_init(void);
*/
void rtthread_startup(void)
{
- /* init hardware interrupt */
- rt_hw_interrupt_init();
+ /* init hardware interrupt */
+ rt_hw_interrupt_init();
- /* init board */
- rt_hw_board_init();
-
- rt_show_version();
+ /* init board */
+ rt_hw_board_init();
- /* init tick */
- rt_system_tick_init();
+ rt_show_version();
- /* init kernel object */
- rt_system_object_init();
+ /* init tick */
+ rt_system_tick_init();
- /* init timer system */
- rt_system_timer_init();
+ /* init kernel object */
+ rt_system_object_init();
+
+ /* init timer system */
+ rt_system_timer_init();
#ifdef RT_USING_HEAP
#ifdef __CC_ARM
- rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)0x204000);
+ rt_system_heap_init((void*)&Image$$RW_IRAM1$$ZI$$Limit, (void*)0x204000);
#elif __ICCARM__
rt_system_heap_init(__segment_end("HEAP"), (void*)0x204000);
#else
- rt_system_heap_init((void*)&__bss_end, (void*)(&__bss_end+0x4000));
+ rt_system_heap_init((void*)&__bss_end, (void*)(&__bss_end+0x4000));
#endif
#endif
- /* init scheduler system */
- rt_system_scheduler_init();
+ /* init scheduler system */
+ rt_system_scheduler_init();
#ifdef RT_USING_HOOK /* if the hook is used */
- /* set idle thread hook */
- rt_thread_idle_sethook(rt_hw_led_flash);
+ /* set idle thread hook */
+ rt_thread_idle_sethook(rt_hw_led_flash);
#endif
#ifdef RT_USING_DEVICE
- /* init hardware serial device */
- rt_hw_serial_init();
+ /* init hardware serial device */
+ rt_hw_serial_init();
#endif
- /* init application */
- rt_application_init();
+ /* init application */
+ rt_application_init();
#ifdef RT_USING_FINSH
- /* init finsh */
- finsh_system_init();
- finsh_set_device("uart1");
+ /* init finsh */
+ finsh_system_init();
+ finsh_set_device("uart1");
#endif
- /* init idle thread */
- rt_thread_idle_init();
+ /* init idle thread */
+ rt_thread_idle_init();
- /* start scheduler */
- rt_system_scheduler_start();
+ /* start scheduler */
+ rt_system_scheduler_start();
- /* never reach here */
- return ;
+ /* never reach here */
+ return ;
}
int main (void)
{
- /* invoke rtthread_startup */
- rtthread_startup();
-
- return 0;
+ /* invoke rtthread_startup */
+ rtthread_startup();
+
+ return 0;
}
/*@}*/