summaryrefslogtreecommitdiff
path: root/bsp/taihu/applications
diff options
context:
space:
mode:
Diffstat (limited to 'bsp/taihu/applications')
-rw-r--r--bsp/taihu/applications/application.c78
-rw-r--r--bsp/taihu/applications/board.c4
-rw-r--r--bsp/taihu/applications/startup.c52
3 files changed, 67 insertions, 67 deletions
diff --git a/bsp/taihu/applications/application.c b/bsp/taihu/applications/application.c
index 6fa54e269f..24165d38a7 100644
--- a/bsp/taihu/applications/application.c
+++ b/bsp/taihu/applications/application.c
@@ -10,7 +10,7 @@
#include <rtthread.h>
-#define THREAD_STACK_SIZE 1024
+#define THREAD_STACK_SIZE 1024
#if 0
struct rt_semaphore sem1, sem2;
@@ -23,44 +23,44 @@ static rt_uint8_t thread2_stack[THREAD_STACK_SIZE];
static void thread1_entry(void* parameter)
{
- while (1)
- {
- rt_sem_release(&sem2);
- rt_kprintf("thread1..: %s\n", rt_thread_self()->name);
- rt_sem_take(&sem1, RT_WAITING_FOREVER);
- rt_kprintf("get semaphore: %s!\n", rt_thread_self()->name);
- }
+ while (1)
+ {
+ rt_sem_release(&sem2);
+ rt_kprintf("thread1..: %s\n", rt_thread_self()->name);
+ rt_sem_take(&sem1, RT_WAITING_FOREVER);
+ rt_kprintf("get semaphore: %s!\n", rt_thread_self()->name);
+ }
}
static void thread2_entry(void* parameter)
{
- while (1)
- {
- rt_sem_take(&sem2, RT_WAITING_FOREVER);
- rt_kprintf("thread2--->: %s\n", rt_thread_self()->name);
- rt_sem_release(&sem1);
- }
+ while (1)
+ {
+ rt_sem_take(&sem2, RT_WAITING_FOREVER);
+ rt_kprintf("thread2--->: %s\n", rt_thread_self()->name);
+ rt_sem_release(&sem1);
+ }
}
/* user application */
int rt_application_init()
{
- rt_err_t result;
+ rt_err_t result;
- rt_sem_init(&sem1, "s1", 0, RT_IPC_FLAG_FIFO);
- rt_sem_init(&sem2, "s2", 0, RT_IPC_FLAG_FIFO);
+ rt_sem_init(&sem1, "s1", 0, RT_IPC_FLAG_FIFO);
+ rt_sem_init(&sem2, "s2", 0, RT_IPC_FLAG_FIFO);
- result = rt_thread_init(&thread1, "t1", thread1_entry, RT_NULL,
- &thread1_stack[0], sizeof(thread1_stack), 10, 10);
- if (result == RT_EOK)
- rt_thread_startup(&thread1);
+ result = rt_thread_init(&thread1, "t1", thread1_entry, RT_NULL,
+ &thread1_stack[0], sizeof(thread1_stack), 10, 10);
+ if (result == RT_EOK)
+ rt_thread_startup(&thread1);
- result = rt_thread_init(&thread2, "t2", thread2_entry, RT_NULL,
- &thread2_stack[0], sizeof(thread2_stack), 18, 10);
- if (result == RT_EOK)
- rt_thread_startup(&thread2);
+ result = rt_thread_init(&thread2, "t2", thread2_entry, RT_NULL,
+ &thread2_stack[0], sizeof(thread2_stack), 18, 10);
+ if (result == RT_EOK)
+ rt_thread_startup(&thread2);
- return 0;
+ return 0;
}
#else
static struct rt_thread thread1;
@@ -70,27 +70,27 @@ rt_timer_t ttimer;
static void thread1_entry(void* parameter)
{
- rt_uint32_t count = 0;
- while (1)
- {
- rt_kprintf("%s: count = %d\n", rt_thread_self()->name, count ++);
+ rt_uint32_t count = 0;
+ while (1)
+ {
+ rt_kprintf("%s: count = %d\n", rt_thread_self()->name, count ++);
- rt_thread_delay(10);
- }
+ rt_thread_delay(10);
+ }
}
/* user application */
int rt_application_init()
{
- rt_err_t result;
+ rt_err_t result;
- result = rt_thread_init(&thread1, "t1", thread1_entry, RT_NULL,
- &thread1_stack[0], sizeof(thread1_stack), 10, 10);
+ result = rt_thread_init(&thread1, "t1", thread1_entry, RT_NULL,
+ &thread1_stack[0], sizeof(thread1_stack), 10, 10);
- ttimer = &(thread1.thread_timer);
- if (result == RT_EOK)
- rt_thread_startup(&thread1);
+ ttimer = &(thread1.thread_timer);
+ if (result == RT_EOK)
+ rt_thread_startup(&thread1);
- return 0;
+ return 0;
}
#endif
diff --git a/bsp/taihu/applications/board.c b/bsp/taihu/applications/board.c
index 03f5862c73..51b1658bd4 100644
--- a/bsp/taihu/applications/board.c
+++ b/bsp/taihu/applications/board.c
@@ -15,6 +15,6 @@
void rt_hw_board_init()
{
- rt_hw_serial_init();
- rt_console_set_device("uart1");
+ rt_hw_serial_init();
+ rt_console_set_device("uart1");
}
diff --git a/bsp/taihu/applications/startup.c b/bsp/taihu/applications/startup.c
index 897947dae8..95b5c59cb7 100644
--- a/bsp/taihu/applications/startup.c
+++ b/bsp/taihu/applications/startup.c
@@ -29,45 +29,45 @@ extern int __heap_end;
*/
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();
+ rt_show_version();
- /* init tick */
- rt_system_tick_init();
+ /* init tick */
+ rt_system_tick_init();
- /* init timer system */
- rt_system_timer_init();
+ /* init timer system */
+ rt_system_timer_init();
- /* init memory system */
+ /* init memory system */
#ifdef RT_USING_HEAP
- rt_system_heap_init((void*)&__heap_start, (void*)&__heap_end);
+ rt_system_heap_init((void*)&__heap_start, (void*)&__heap_end);
#endif
- /* init scheduler system */
- rt_system_scheduler_init();
+ /* init scheduler system */
+ rt_system_scheduler_init();
- /* 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 soft timer thread */
- rt_system_timer_thread_init();
+ /* init soft timer thread */
+ rt_system_timer_thread_init();
- /* 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 ;
}