application.c 988 字节
Newer Older
B
bernard.xiong 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
/*
 * File      : app.c
 * This file is part of RT-Thread RTOS
 * COPYRIGHT (C) 2006, RT-Thread Development Team
 *
 * The license and distribution terms for this file may be
 * found in the file LICENSE in this distribution or at
 * http://www.rt-thread.org/license/LICENSE
 *
 * Change Logs:
 * Date           Author       Notes
 * 2010-06-25     Bernard      first version
 */

/**
 * @addtogroup JZ47xx
 */
/*@{*/
#include <rtthread.h>

21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
#include <jz4755.h>
#include <mipsregs.h>

static struct rt_thread thread1;
static rt_uint8_t thread1_stack[1024];

void thread_entry(void* parameter)
{
	while (1)
	{
		rt_kprintf("IPR: 0x%08x, SR : 0x%08x, CAUSE: 0x%08x\n", INTC_IPR, read_c0_status(), read_c0_cause());

		rt_thread_delay(100);
	}
}

B
bernard.xiong 已提交
37 38
int rt_application_init()
{
39 40 41 42 43 44 45 46 47
	rt_err_t result;

	result = rt_thread_init(&thread1, "t1",
		thread_entry, RT_NULL,
		&thread1_stack[0], sizeof(thread1_stack),
		200, 10);
	if (result == RT_EOK)
		rt_thread_startup(&thread1);

B
bernard.xiong 已提交
48 49 50 51
	return 0;
}

/*@}*/