rthw.h 3.0 KB
Newer Older
1 2 3
/*
 * File      : rthw.h
 * This file is part of RT-Thread RTOS
D
dzzxzz 已提交
4
 * COPYRIGHT (C) 2006 - 2012, RT-Thread Development Team
5
 *
B
Bernard Xiong 已提交
6 7 8 9 10 11 12 13 14 15 16 17 18
 *  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.
19 20 21 22 23 24
 *
 * 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
25
 * 2012-12-29     Bernard      add rt_hw_exception_install declaration
26 27 28 29 30 31 32 33 34 35 36
 */

#ifndef __RT_HW_H__
#define __RT_HW_H__

#include <rtthread.h>

#ifdef __cplusplus
extern "C" {
#endif

37 38 39
/*
 * CPU interfaces
 */
40 41 42 43 44 45 46 47 48
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);

49 50 51 52
rt_uint8_t *rt_hw_stack_init(void       *entry,
                             void       *parameter,
                             rt_uint8_t *stack_addr,
                             void       *exit);
53

54 55 56 57 58
/*
 * Interrupt handler definition
 */
typedef void (*rt_isr_handler_t)(int vector, void *param);

Y
yiyue.fang 已提交
59 60 61 62
struct rt_irq_desc
{
    rt_isr_handler_t handler;
    void            *param;
63 64

#ifdef RT_USING_INTERRUPT_INFO
Y
yiyue.fang 已提交
65 66
    char             name[RT_NAME_MAX];
    rt_uint32_t      counter;
67 68 69 70 71 72
#endif
};

/*
 * Interrupt interfaces
 */
73 74 75
void rt_hw_interrupt_init(void);
void rt_hw_interrupt_mask(int vector);
void rt_hw_interrupt_umask(int vector);
Y
yiyue.fang 已提交
76 77 78 79
rt_isr_handler_t rt_hw_interrupt_install(int              vector,
                                         rt_isr_handler_t handler,
                                         void            *param,
                                         char            *name);
80 81 82

rt_base_t rt_hw_interrupt_disable(void);
void rt_hw_interrupt_enable(rt_base_t level);
83 84 85 86

/*
 * Context interfaces
 */
87 88 89 90
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);

D
dzzxzz 已提交
91
void rt_hw_console_output(const char *str);
92 93 94 95

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);

96
/*
97
 * Exception interfaces
98
 */
Y
yiyue.fang 已提交
99
void rt_hw_exception_install(rt_err_t (*exception_handle)(void *context));
100

101 102 103 104 105
#ifdef __cplusplus
}
#endif

#endif