2009-07-03 06:48:23 +08:00
|
|
|
/*
|
|
|
|
* File : rthw.h
|
|
|
|
* This file is part of RT-Thread RTOS
|
2012-03-17 14:43:49 +08:00
|
|
|
* COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
|
2009-07-03 06:48:23 +08:00
|
|
|
*
|
2013-06-24 17:06:09 +08:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2009-07-03 06:48:23 +08:00
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2006-03-18 Bernard the first version
|
|
|
|
* 2006-04-25 Bernard add rt_hw_context_switch_interrupt declaration
|
|
|
|
* 2006-09-24 Bernard add rt_hw_context_switch_to declaration
|
2012-12-29 17:36:16 +08:00
|
|
|
* 2012-12-29 Bernard add rt_hw_exception_install declaration
|
2009-07-03 06:48:23 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __RT_HW_H__
|
|
|
|
#define __RT_HW_H__
|
|
|
|
|
|
|
|
#include <rtthread.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2013-03-26 08:52:33 +08:00
|
|
|
/*
|
|
|
|
* CPU interfaces
|
|
|
|
*/
|
2009-07-03 06:48:23 +08:00
|
|
|
void rt_hw_cpu_icache_enable(void);
|
|
|
|
void rt_hw_cpu_icache_disable(void);
|
|
|
|
rt_base_t rt_hw_cpu_icache_status(void);
|
|
|
|
void rt_hw_cpu_dcache_enable(void);
|
|
|
|
void rt_hw_cpu_dcache_disable(void);
|
|
|
|
rt_base_t rt_hw_cpu_dcache_status(void);
|
|
|
|
void rt_hw_cpu_reset(void);
|
|
|
|
void rt_hw_cpu_shutdown(void);
|
|
|
|
|
2012-09-05 13:54:47 +08:00
|
|
|
rt_uint8_t *rt_hw_stack_init(void *entry,
|
|
|
|
void *parameter,
|
|
|
|
rt_uint8_t *stack_addr,
|
|
|
|
void *exit);
|
2009-07-03 06:48:23 +08:00
|
|
|
|
2013-03-26 08:52:33 +08:00
|
|
|
/*
|
|
|
|
* Interrupt handler definition
|
|
|
|
*/
|
|
|
|
typedef void (*rt_isr_handler_t)(int vector, void *param);
|
|
|
|
|
|
|
|
struct rt_irq_desc {
|
|
|
|
rt_isr_handler_t handler;
|
|
|
|
void *param;
|
|
|
|
|
|
|
|
#ifdef RT_USING_INTERRUPT_INFO
|
|
|
|
char name[RT_NAME_MAX];
|
|
|
|
rt_uint32_t counter;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Interrupt interfaces
|
|
|
|
*/
|
2009-07-03 06:48:23 +08:00
|
|
|
void rt_hw_interrupt_init(void);
|
|
|
|
void rt_hw_interrupt_mask(int vector);
|
|
|
|
void rt_hw_interrupt_umask(int vector);
|
2013-03-18 16:42:29 +08:00
|
|
|
rt_isr_handler_t rt_hw_interrupt_install(int vector,
|
2013-03-17 10:38:38 +08:00
|
|
|
rt_isr_handler_t handler,
|
2013-03-18 16:42:29 +08:00
|
|
|
void *param,
|
|
|
|
char *name);
|
2009-07-03 06:48:23 +08:00
|
|
|
|
|
|
|
rt_base_t rt_hw_interrupt_disable(void);
|
|
|
|
void rt_hw_interrupt_enable(rt_base_t level);
|
2013-03-26 08:52:33 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Context interfaces
|
|
|
|
*/
|
2009-07-03 06:48:23 +08:00
|
|
|
void rt_hw_context_switch(rt_uint32_t from, rt_uint32_t to);
|
|
|
|
void rt_hw_context_switch_to(rt_uint32_t to);
|
|
|
|
void rt_hw_context_switch_interrupt(rt_uint32_t from, rt_uint32_t to);
|
|
|
|
|
2011-09-23 13:57:31 +08:00
|
|
|
void rt_hw_console_output(const char *str);
|
2009-07-03 06:48:23 +08:00
|
|
|
|
|
|
|
void rt_hw_backtrace(rt_uint32_t *fp, rt_uint32_t thread_entry);
|
|
|
|
void rt_hw_show_memory(rt_uint32_t addr, rt_uint32_t size);
|
|
|
|
|
2012-12-29 17:36:16 +08:00
|
|
|
/*
|
2013-03-26 08:52:33 +08:00
|
|
|
* Exception interfaces
|
2012-12-29 17:36:16 +08:00
|
|
|
*/
|
2012-12-29 17:51:48 +08:00
|
|
|
void rt_hw_exception_install(rt_err_t (*exception_handle)(void* context));
|
2012-12-29 17:36:16 +08:00
|
|
|
|
2009-07-03 06:48:23 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|