bond/include/kernel/hal/intr.h

61 lines
1.3 KiB
C
Raw Normal View History

2018-03-24 00:58:24 +00:00
#ifndef KERNEL_HAL_INTR_H
#define KERNEL_HAL_INTR_H
#include "type.h"
2018-01-26 08:43:22 +00:00
/**
* IRQL Definitions
*/
2018-03-24 00:58:24 +00:00
typedef uint32 k_irql;
2018-01-26 08:43:22 +00:00
#define IRQL_DISABLED_LEVEL (1 << 3)
#define IRQL_DPC_LEVEL (1 << 2)
#define IRQL_APC_LEVEL (1 << 1)
#define IRQL_PASSIVE_LEVEL (1 << 0)
2018-03-24 00:58:24 +00:00
k_irql SXAPI hal_set_irql(k_irql irql);
2018-02-18 04:06:57 +00:00
2018-03-24 00:58:24 +00:00
k_irql SXAPI hal_get_irql(void);
2018-02-18 04:06:57 +00:00
2018-03-24 00:58:24 +00:00
uint32 SXAPI hal_get_core_id(void);
void SXAPI hal_issue_interrupt(uint32 target_core, uint32 vector);
2018-01-26 08:43:22 +00:00
/**
* Interrupt Handler Registration
*/
2018-03-24 00:58:24 +00:00
struct intr_info
{
2018-03-24 00:58:24 +00:00
uint32 timer_intr_vec;
uint32 apc_intr_vec;
uint32 dpc_intr_vec;
};
2018-03-24 00:58:24 +00:00
typedef void (SXAPI *intr_handler)(void *context, void *intr_stack);
2018-01-26 08:43:22 +00:00
2018-03-24 00:58:24 +00:00
void SXAPI hal_register_interrupt_handler(uint32 coreid, uint32 index, intr_handler handler, void *context);
2018-01-26 08:43:22 +00:00
2018-03-24 00:58:24 +00:00
void SXAPI hal_deregister_interrupt_handler(uint32 coreid, uint32 index);
2018-01-26 08:43:22 +00:00
/**
* Exception Handler Registration
*/
2016-06-25 01:47:29 +00:00
typedef enum
{
2018-02-18 04:06:57 +00:00
unrecoverable_exc,
div_by_zero_exc,
general_protection_exc,
invalid_op_exc,
page_fault_exc,
unsupported_exc,
debug_exc
2017-02-01 03:26:08 +00:00
} exc_type_t;
2016-06-25 01:47:29 +00:00
2018-03-24 00:58:24 +00:00
typedef void (SXAPI *exc_handler)(uint64 exc_addr, uint64 exc_stack, uint64 error_code);
void SXAPI hal_register_exception_handler(uint32 coreid, uint32 index, exc_handler handler);
2016-06-25 01:47:29 +00:00
2018-03-24 00:58:24 +00:00
void SXAPI hal_deregister_exception_handler(uint32 coreid, uint32 index);
2016-06-25 01:47:29 +00:00
2018-03-24 00:58:24 +00:00
#endif