application.c 1.8 KB
Newer Older
L
luohui2320@gmail.com 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
/*
 * File      : application.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
 * 2011-01-13     weety		first version
 */

/**
 * @addtogroup at91sam9260
 */
/*@{*/

#include <rtthread.h>

#ifdef RT_USING_LED
#include "led.h"
#endif

#ifdef RT_USING_LED
void rt_led_thread_entry(void* parameter)
{
	rt_uint8_t cnt = 0;
	led_init();
	while(1)
	{
		/* light on leds for one second */
		rt_thread_delay(40);
		cnt++;
		if (cnt&0x01)
			led_on(1);
		else
			led_off(1);
		if (cnt&0x02)
			led_on(2);
		else
			led_off(2);
		if (cnt&0x04)
			led_on(3);
		else
			led_off(3);
			
	}
}
#endif

int rt_application_init()
{
#ifdef RT_USING_LED
	rt_thread_t led_thread;

#if (RT_THREAD_PRIORITY_MAX == 32)
	

	led_thread = rt_thread_create("led",
								rt_led_thread_entry, RT_NULL,
								512, 20, 20);
								
#else
	

	led_thread = rt_thread_create("led",
								rt_led_thread_entry, RT_NULL,
								512, 200, 20);
								
#endif


	if(led_thread != RT_NULL)
		rt_thread_startup(led_thread);
#endif

	return 0;
}

/* NFSv3 Initialization */
#if defined(RT_USING_DFS) && defined(RT_USING_LWIP) && defined(RT_USING_DFS_NFS)
#include <dfs_nfs.h>
void nfs_start(void)
{
	nfs_init();

	if (dfs_mount(RT_NULL, "/nfs", "nfs", 0, RT_NFS_HOST_EXPORT) == 0)
	{
		rt_kprintf("NFSv3 File System initialized!\n");
	}
	else
		rt_kprintf("NFSv3 File System initialzation failed!\n");
}

#include "finsh.h"
FINSH_FUNCTION_EXPORT(nfs_start, start net filesystem);
#endif

/*@}*/