📄 board.c.svn-base
字号:
/* * File : board.c * This file is part of RT-Thread RTOS * COPYRIGHT (C) 2006, RT-Thread Develop Team * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://openlab.rt-thread.com/license/LICENSE. * * Change Logs: * Date Author Notes * 2006-10-25 Bernard first implementation */#include <rtthread.h>#include <rthw.h>#include <pxa270.h>#include "board.h"#define HZ 100#define CLOCK_TICK_RATE 3249600#define LATCH ((CLOCK_TICK_RATE + HZ/2) / HZ) /* For divider *//** * @addtogroup PXA270 *//*@{*/void rt_timer_handler(int vector){ int next_match; do { rt_tick_increase(); PXA2X0_OST_OSSR = 0x01; /* Clear match on timer 0 */ next_match = (PXA2X0_OST_OSMR0 += LATCH); } while( (signed long)(next_match - PXA2X0_OST_OSCR0) <= 8 );}extern volatile rt_uint8 _rt_hw_framebuffer[];
extern unsigned char asc16_font[];
/** * @brief init zaurus c1000 * * This function will init zaurus c1000 */void rt_hw_board_init(){ /* int OS Timer */ PXA2X0_OST_OIER = 0; /* disable any timer interrupts */ PXA2X0_OST_OSCR0= LATCH*2; /* push OSCR out of the way */ PXA2X0_OST_OSMR0= LATCH; /* set initial match */ PXA2X0_OST_OSSR = 0xf; /* clear status on all timers */ PXA2X0_OST_OSSR = 0x3f; /* clear all OS Timer status */ PXA2X0_OST_OIER = 0x10; /* enable OSMR4 interrupt */ /* install interrupt handler */ rt_hw_interrupt_install(PXA2X0_INT_OST0, rt_timer_handler, RT_NULL); rt_hw_interrupt_umask(PXA2X0_INT_OST0); PXA2X0_OST_OIER = 0x01; /* enable match on timer 0 to cause interrupts */ PXA2X0_OST_OSCR0= 0; /* initialize free-running timer */ rt_hw_kbd_init();
rt_hw_gpio_init();
rt_hw_lcd_init();
rt_hw_lcd_update();
rt_console_init(&_rt_hw_framebuffer[0], &asc16_font[0], 2);
rt_console_clear();}#define C1K_SCOOP_BASE 0x10800000#define GPIOWP 0x24/** * @param on, which led is operated, green or orange */void rt_hw_led_set(rt_uint32 enable){ volatile unsigned short *p; p = (unsigned short*) (C1K_SCOOP_BASE + GPIOWP); if (enable) { *p = *p | (1 << 1); } else { *p = *p & (~(1 << 1)); }}void rt_hw_led_flash(void){ int i; static int count = 0; rt_hw_led_set(1); for ( i = 0; i < 1000000; i++); rt_hw_led_set(0); for ( i = 0; i < 1000000; i++);}#ifdef RT_USING_FINSHextern void finsh_notify(void);void rt_serial_isr(int vector){ finsh_notify();}void rt_hw_finsh_init(){ /* install keyboard isr */}#endif/*@}*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -