免费 KAL Programming Guide
KAL Programming GuideRevision History....................................................................................................................................................... 2
1 Overview.......................................................................................................................................................... 8
2 Fundamental Data Types ............................................................................................................................... 9
3 Task Management......................................................................................................................................... 10
3.1 Description ............................................................................................................................................... 10
3.2 Data Structures and Data Types ............................................................................................................... 12
3.3 Task Management API .............................................................................................................................. 15
kal_activate_hisr .................................................................................................................................................... 15
kal_change_priority ............................................................................................................................................... 15
kal_create_hisr....................................................................................................................................................... 15
kal_get_my_task_index......................................................................................................................................... 15
kal_get_mytask_priority........................................................................................................................................ 16
kal_get_task_self_id .............................................................................................................................................. 16
kal_if_hisr ............................................................................................................................................................... 16
kal_sleep_task........................................................................................................................................................ 16
stack_change_priority_by_module_ID ................................................................................................................. 16
3.4 Customization........................................................................................................................................... 17
4 Task Synchronization Management............................................................................................................. 20
4.1 Description ............................................................................................................................................... 20
4.1.1 Event group........................................................................................................................................ 20
4.2 Data structures and Data Types................................................................................................................ 21
4.3 Task Synchronization APIs........................................................................................................................ 22
4.3.1 MUTEX .............................................................................................................................................. 22
kal_create_mutex................................................................................................................................................... 22
kal_take_mutex ...................................................................................................................................................... 22
kal_give_mutex ...................................................................................................................................................... 22
4.3.2 Semaphore......................................................................................................................................... 22
kal_create_sem ...................................................................................................................................................... 22
kal_take_sem.......................................................................................................................................................... 22
kal_give_sem.......................................................................................................................................................... 23
4.3.3 Event group........................................................................................................................................ 23
kal_create_event_group........................................................................................................................................ 23
kal_set_eg_events ................................................................................................................................................. 23
kal_retrieve_eg_events ......................................................................................................................................... 23
4.4 Example ................................................................................................................................................... 24
5 Task Communication Management.............................................................................................................. 25
5.1 Data Structures and Data Types ............................................................................................................... 25
5.1.1 Access behavior of local parameter and peer buffer ........................................................................... 27
5.2 Task Communication APIs ........................................................................................................................ 28
allocate_ilm ............................................................................................................................................................ 28
append_to_peer_buff ............................................................................................................................................ 28
cancel_ilm............................................................................................................................................................... 28
construct_local_para............................................................................................................................................. 28
construct_peer_buff .............................................................................................................................................. 29
free_ilm ................................................................................................................................................................... 29
free_local_para....................................................................................................................................................... 29
free_local_para....................................................................................................................................................... 30
hold_local_para...................................................................................................................................................... 30
get_local_para_ptr ................................................................................................................................................. 30
get_pdu_ptr ............................................................................................................................................................ 30
hold_peer_buff ....................................................................................................................................................... 30
msg_get_ext_queue_info...................................................................................................................................... 30
msg_get_ext_queue_length.................................................................................................................................. 31
msg_send_ext_queue ........................................................................................................................................... 31
msg_send_int_queue ............................................................................................................................................ 31
prepend_to_peer_buff ........................................................................................................................................... 31
receive_msg_ext_q................................................................................................................................................ 32
receive_msg_int_q................................................................................................................................................. 32
remove_hdr_of_peer_buff..................................................................................................................................... 32
remove_tail_of_peer_buff ..................................................................................................................................... 32
update_peer_buff_hdr ........................................................................................................................................... 32
5.3 Example ................................................................................................................................................... 34
6 Timer Management ....................................................................................................................................... 36
6.1 Descriptions.............................................................................................................................................. 36
6.1.1 KAL timer ........................................................................................................................................... 36
6.1.2 Stack timer ......................................................................................................................................... 36
6.1.3 Event scheduler ................................................................................................................................. 37
6.2 Data Structures and Data Types ............................................................................................................... 38
6.2.1 KAL timer ........................................................................................................................................... 38
6.2.2 Stack timer ......................................................................................................................................... 38
6.2.3 Event scheduler ................................................................................................................................. 39
6.3 APIs.......................................................................................................................................................... 41
6.3.1 KAL timer ........................................................................................................................................... 41
kal_cancel_timer .................................................................................................................................................... 41
kal_create_timer..................................................................................................................................................... 41
kal_delete_timer..................................................................................................................................................... 41
kal_get_time ........................................................................................................................................................... 41
kal_get_time_remaining ........................................................................................................................................ 41
kal_get_timer_statistics ........................................................................................................................................ 41
kal_set_timer.......................................................................................................................................................... 41
6.3.2 Stack timer ......................................................................................................................................... 42
stack_deinit_timer ................................................................................................................................................. 42
stack_init_timer...................................................................................................................................................... 42
stack_is_time_out_valid........................................................................................................................................ 42
stack_process_time_out ....................................................................................................................................... 42
stack_start_timer ................................................................................................................................................... 42
stack_stop_timer ................................................................................................................................................... 43
stack_timer_status ................................................................................................................................................ 43
6.3.3 Event scheduler ................................................................................................................................. 43
evshed_cancel_event ............................................................................................................................................ 43
evshed_delete_all_events..................................................................................................................................... 43
evshed_get_rem_time ........................................................................................................................................... 44
evshed_resume_all_events................................................................................................................................... 44
evshed_set_event .................................................................................................................................................. 44
evshed_suspend_all_events................................................................................................................................. 44
evshed_timer_handler........................................................................................................................................... 44
new_evshed............................................................................................................................................................ 44
6.4 Examples.................................................................................................................................................. 46
7 Memory Management ................................................................................................................................... 48
7.1 Descriptions.............................................................................................................................................. 48
7.1.1 Control buffer ..................................................................................................................................... 48
7.1.2 ADM................................................................................................................................................... 51
7.1.3 System memory and debug memory .................................................................................................. 51
7.2 Data Structures and Data Types ............................................................................................................... 53
7.2.1 Control buffer ..................................................................................................................................... 53
7.2.2 ADM................................................................................................................................................... 55
7.3 Memory management APIs ....................................................................................................................... 57
7.3.1 Control buffer ..................................................................................................................................... 57
get_ctrl_buffer........................................................................................................................................................ 57
free_ctrl_buffer....................................................................................................................................................... 57
kal_query_ctrlbuf_max_consumption .................................................................................................................. 57
7.3.2 ADM................................................................................................................................................... 57
kal_adm_create ...................................................................................................................................................... 57
kal_adm_delete ...................................................................................................................................................... 57
kal_adm_alloc ........................................................................................................................................................ 58
kal_adm_free .......................................................................................................................................................... 58
kal_adm_get_max_alloc_size ............................................................................................................................... 58
kal_adm_get_total_left_size.................................................................................................................................. 58
7.3.3 System and debug memory ................................................................................................................ 58
kal_sys_mem_query_freesize............................................................................................................................... 58
kal_debug_mem_query_freesize.......................................................................................................................... 59
7.4 Examples.................................................................................................................................................. 60
8 Utility APIs..................................................................................................................................................... 61
8.1 Memory operation..................................................................................................................................... 61
kal_mem_cmp ........................................................................................................................................................ 61
kal_mem_cpy ......................................................................................................................................................... 61
kal_mem_set .......................................................................................................................................................... 61
8.2 Boot mode querying ................................................................................................................................. 61
stack_query_boot_mode....................................................................................................................................... 61
8.3 Multi-bytes string processing ..................................................................................................................... 61
kal_dchar_strlen .................................................................................................................................................... 61
kal_dchar_strcpy ................................................................................................................................................... 62
kal_dchar_strncpy ................................................................................................................................................. 62
kal_dchar_strcmp .................................................................................................................................................. 62
kal_dchar_strncmp................................................................................................................................................ 62
kal_dchar_strcat .................................................................................................................................................... 62
kal_dchar_strncat .................................................................................................................................................. 62
kal_dchar_strchr .................................................................................................................................................... 63
kal_dchar_strrchr................................................................................................................................................... 63
kal_dchar2char....................................................................................................................................................... 63
kal_wsprintf............................................................................................................................................................ 63
kal_wstrlen ............................................................................................................................................................. 63
kal_wstrcpy ............................................................................................................................................................ 63
kal_wstrncpy .......................................................................................................................................................... 64
kal_wstrcmp ........................................................................................................................................................... 64
kal_wstrncmp......................................................................................................................................................... 64
kal_wstrcat ............................................................................................................................................................. 64
kal_wstrncat ........................................................................................................................................................... 64
kal_wstrchr............................................................................................................................................................. 65
kal_wstrrchr............................................................................................................................................................ 65
8.4 Reentrance functions................................................................................................................................ 65
kal_strtok_r............................................................................................................................................................. 65
kal_gmtime_r.......................................................................................................................................................... 65
8.5 Exception handling ................................................................................................................................... 65
ASSERT .................................................................................................................................................................. 65
EXT_ASSERT ......................................................................................................................................................... 65
【文件名】:08725@52RD_KAL_Programming_Guide.pdf
【格 式】:pdf
【大 小】:799K
【简 介】:
【目 录】:
<p align=right><font color=red>+3 RD币</font></p> 感谢
十分感谢 太感谢楼主了。
灰常感谢锕!!! 好东西啊~~~太感谢LZ了~~~~~ 多谢楼主分享,正在找这个东东 谢谢 非常感谢楼主分享这么好的资料 谢谢啊! 感谢共享,还是免费的好啊 谢谢楼主了,正需要,看看 太感谢楼主了 楼主您人太好啦! 谢谢, 谢谢楼主,辛苦了!!!!!!!!!!!!1 千言万语汇成一句话:谢谢楼主 楼主好人 支持,楼主的无私奉献精神 太感谢LZ了