----------------------------------------------------------------------------------------
kal_create_hisr
Prototype: kal_hisrid kal_create_hisr (kal_char* hisr_name, kal_uint8 priority, kal_uint32 stack_size,
kal_hisr_func_ptr entry_func, kal_uint8 options)
Header file: kal_release.h
Input: hisr_name is name of HISR to be created, priority tells the HISR priority, either 1 or 2.; stack_size is
stack size associates with this HISR, which is in terms of bytes, if options is KAL_FALSE, stack will be
allocated from internal SRAM, otherwise from external SRAM. Only timing critical HISR is suggested to
put its stack at internal SRAM. Finally, entry_func tells the HISR entry function.
Output: ID of the HISR.
Description: Function used to create an HISR.
Remark: Priority number 0 is strictly prohibited, which is specially reserved the highest priority HISR.
我现在看虚拟终端的创建,和我们创建一个task基本上是一样的,只是在kal层内这个task 的优先级已经被锁定了,这里的priority内部包装的调度优先级.
for(index=0;index<MAX_VISUAL_DEVICE;index++)
{
VISUAL_HISR_TABLE[index].hisr_func = VISUAL_ERROR_HISR;
VISUAL_HISR_TABLE[index].hisr_count = 0;
}
清空table VISUAL_HISR_STRUCT VISUAL_HISR_TABLE[MAX_VISUAL_DEVICE];
visual_hisr = kal_create_hisr("VISUHISR",1,1024,VISUAL_HISR,NULL); 注册task虚拟hisr
用户自定义的虚拟中断
typedef enum {
VISUAL_UNKNOWN_ID=0,
VISUAL_CAMERA_HISR_ID,
VISUAL_MPEG4_ENC_HISR_ID,
VISUAL_MPEG4_DEC_HISR_ID,
VISUAL_IMGDMA_HISR_ID,
VISUAL_MP4_SEEK_HISR_ID,
VISUAL_G2D_HISR_ID,
VISUAL_JPEG_DEC_HISR_ID,
VISUAL_JPEG_ENC_HISR_ID,
VISUAL_JPEG_DEC_CB_HISR_ID,
VISUAL_MP4_ENC_RECOVERY_HISR_ID,
VISUAL_RESIZER_HISR_ID,
VISUAL_IMGPROC_HISR_ID,
VISUAL_GIF_HISR_ID,
VISUAL_PNG_HISR_ID,
VISUAL_MP4_EDITOR_LISR_HISR_ID,
VISUAL_MPEG4_ENC_FIRST_HISR_ID,
VISUAL_MPEG4_ENC_FIRST_DMA_HISR_ID,
VISUAL_MPEG4_DEC_FIRST_HISR_ID,
VISUAL_MPEG4_SEEK_FIRST_HISR_ID,
VISUAL_H264_SEEK_HISR_ID,
VISUAL_H264_DEC_HISR_ID,
MAX_VISUAL_DEVICE,
VISUAL_UNKNOWN_HISR_ID = 0xfe
} VISUAL_HISR_ID;
VISUAL_Register_HISR(VISUAL_PNG_HISR_ID,png_hisr_entry); 注册虚拟使用
visual_active_hisr(VISUAL_PNG_HISR_ID); 启动这个visual isr
我们通过代码可以看到这个visual isr 可以用来配合实体的isr做处理,临时提高的处理的级别,而且能够在让实体的isr占用的时间缩短的同时又将需要执行的任务拿到优先级比较高的task里面去运行,这样的机制可以让我们去做一些软件的临时优先处理.