📄 hw_lib.h
字号:
#ifndef HW_LIB_H
#define HW_LIB_H
#ifdef __cplusplus
extern "C"
{
#endif
#ifndef _HAVE_U32
#define _HAVE_U32
typedef unsigned int u32;
#endif
/************************************************************************/
/*
alloc a block of physical-linear memory
out
ret : virtual address of the memory
*phy : physical address */
/************************************************************************/
void* hw_alloc_physmem( int size , u32*phy );
/************************************************************************/
/* free memory allocated by hw_alloc_physmem
in
vir : virtual address allocated
size: size of the memory block
phy : physical address allocated
*/
/************************************************************************/
void hw_free_physmem( void*vir);
/************************************************************************/
/* map physical space to virtual
in
phy : address
out
ret : mapped virtual address */
/************************************************************************/
void* hw_map_io( u32 phy , int size , int cacheenable );
/************************************************************************/
/* free mapped space */
/************************************************************************/
void hw_unmap_io( void*vir , int size );
#define InterruptID_ITUInput 1
#define InterruptID_ITUOutput 2
#define InterruptID_Mp4Decoder 3
#define InterruptID_Mp4Encoder 4
#define InterruptID_VIA 5
/************************************************************************/
/* initial interrupt
in
id : interrupt id(irq or system_interrupt
out
ret : handle
*/
/************************************************************************/
void* hw_init_interrupt( int id );
/************************************************************************/
/* wait until interrupt occure or time out
in
handle : handle initialized by hw_init_interrupt
timeout : time out value for wait
out
*status : store interrupt status
ret : 0 indicate success, -1 indicate fail.
*/
/************************************************************************/
int hw_wait_interrupt( void*handle , unsigned int timeout );
/************************************************************************/
/* tell system interrupt has been handled
in
handle : handle : handle initialized by hw_init_interrupt
*/
/************************************************************************/
void hw_complete_interrupt( void*handle );
/************************************************************************/
/* release interrupt handling
in
handle : handle : handle initialized by hw_init_interrupt */
/************************************************************************/
void hw_release_interrupt( void*handle );
/************************************************************************/
/* sleep
in
ms : m-seconds
*/
/************************************************************************/
void hw_delay( int ms );
/************************************************************************/
/* initial a object for critical-section
out
ret : handle of the object
*/
/************************************************************************/
void* hw_init_critical(void);
/************************************************************************/
/* enter a critical-section
in
h : handle of the object
*/
/************************************************************************/
int hw_enter_critical(void*h);
/************************************************************************/
/* leave a critical-section
in
h : handle of the object
*/
/************************************************************************/
int hw_leave_critical(void*h);
/************************************************************************/
/* release a critical-section
in
h : handle of the object
*/
/************************************************************************/
void hw_release_critical(void*h);
/************************************************************************/
/* flush cache of the range of memory
in
vir : address of the memory
size : range of flushing
*/
/************************************************************************/
int hw_flush_cache( void* vir , int size );
/************************************************************************/
/* create a thread
in
func : function address for thread
param : param that pass to the function
out
ret : handle of the thread
*/
/************************************************************************/
void* hw_create_thread( void*func , void*param );
/************************************************************************/
/* release thread
in
handle : handle of the thread
*/
/************************************************************************/
void hw_release_thread( void*handle );
/************************************************************************/
/* create a event object
out
ret : handle of the object
*/
/************************************************************************/
void* hw_create_event();
/************************************************************************/
/* set the event object
in
handle : handle of the object
*/
/************************************************************************/
int hw_set_event( void*handle );
/************************************************************************/
/* wait for event triggle
in
handle : handle of the object
timeout : time to wait
out
ret : 0 indicate success, 1 indicate time out, <0 indicate error
*/
/************************************************************************/
int hw_wait_event( void*handle , int timeout );
/************************************************************************/
/* release event object
in
handle : handle of the object
*/
/************************************************************************/
int hw_release_event( void*handle );
u32 hw_get_sys_tick();
int hw_get_framebuffer( u32*framebuffer , u32*width , u32*height);
#define HW_TRACE_ERROR 0x01
#define HW_TRACE_IMPORTANT 0x02
#define HW_TRACE_TRACE 0x04
int hw_trace_init( int type , int prio );
int hw_trace_msg( int prio , char* fmt, ...);
int hw_trace_end();
#ifdef __cplusplus
}
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -