📄 ucos-ii_v2_1_0.tcl
字号:
proc copy_os_files {ucos_handle} {
set sw_proc_handle [xget_libgen_proc_handle] set hw_proc_handle [xget_handle $sw_proc_handle "IPINST"] set proctype [xget_value $hw_proc_handle "OPTION" "IPNAME"]
set msr_instr [xget_value $hw_proc_handle "PARAMETER" "C_USE_MSR_INSTR"]
set source_path [xget_value $ucos_handle "PARAMETER" "OS_SOURCE_LOCATION"]
set core_name [file join $source_path os_core.c]
set flag_name [file join $source_path os_flag.c]
set mbox_name [file join $source_path os_mbox.c]
set mem_name [file join $source_path os_mem.c]
set mutex_name [file join $source_path os_mutex.c]
set q_name [file join $source_path os_q.c]
set sem_name [file join $source_path os_sem.c]
set task_name [file join $source_path os_task.c]
set time_name [file join $source_path os_time.c]
set tmr_name [file join $source_path os_tmr.c]
set ucosii_name [file join $source_path ucos_ii.h]
file copy -force $core_name $flag_name $mbox_name $mem_name $mutex_name $q_name $sem_name $task_name $time_name $tmr_name $ucosii_name ./src/
file copy -force $ucosii_name ../../include/
set port_path [xget_value $ucos_handle "PARAMETER" "OS_PORT_LOCATION"]
set dbg_name [file join $port_path os_dbg.c]
if { $proctype == "microblaze" } {
if { $msr_instr != 1 } {
set cpus_name [file join $port_path os_cpu_a.s]
} else {
set cpus_name [file join $port_path USE_MSR_INSTR/os_cpu_a.s]
}
} else {
set cpus_name [file join $port_path os_cpu_a.S]
}
set cpuc_name [file join $port_path os_cpu_c.c]
set cpuh_name [file join $port_path os_cpu.h]
file copy -force $dbg_name $cpus_name $cpuc_name $cpuh_name ./src/
file copy -force $cpuh_name ../../include/
if {[xget_value $ucos_handle "PARAMETER" "OS_VIEW_MODULE"] == 1} {
set view_source [xget_value $ucos_handle "PARAMETER" "OS_VIEW_SOURCE_LOCATION"]
set sourcec_name [file join $view_source OS_VIEW.c]
set sourceh_name [file join $view_source OS_VIEW.h]
file copy -force $sourcec_name $sourceh_name ./src/
file copy -force $sourceh_name ../../include/
set view_port [xget_value $ucos_handle "PARAMETER" "OS_VIEW_PORT_LOCATION"]
set portc_name [file join $view_port OS_VIEWc.c]
set porth_name [file join $view_port OS_VIEWc.h]
file copy -force $portc_name $porth_name ./src/
file copy -force $porth_name ../../include/
}
set bsp_path [xget_value $ucos_handle "PARAMETER" "BSP_LOCATION"]
set bspc_name [file join $bsp_path bsp.c]
set bsph_name [file join $bsp_path bsp.h]
file copy -force $bspc_name $bsph_name ./src/
file copy -force $bsph_name ../../include/
set app_path [xget_value $ucos_handle "PARAMETER" "APP_LOCATION"]
set app_cfg_file [file join $app_path app_cfg.h]
set include_file [file join $app_path includes.h]
file copy -force $app_cfg_file ../../include/
file copy -force $include_file ../../include/
}
################################################################################ Tcl procedure create_os_config_file###############################################################################
proc create_os_config_file {ucos_handle} {
set filename "./src/os_cfg.h"
file delete $filename
set config_file [open $filename w]
puts $config_file "/*"
puts $config_file "**********************************************************************************************************"
puts $config_file "* This is the uC/OS-II configuration file created by the LibGen generate procedure. The constants in *"
puts $config_file "* this file can be modified through your project's Software Platform Settings. *"
puts $config_file "* *"
puts $config_file "**********************************************************************************************************"
puts $config_file "*/\n\n"
puts $config_file "#ifndef OS_CFG_H"
puts $config_file "#define OS_CFG_H\n"
puts $config_file " /* ------------------------ uC/OS-View ------------------------ */"
set view_en [xget_value $ucos_handle "PARAMETER" "OS_VIEW_MODULE"]
puts $config_file [format "#define OS_VIEW_MODULE %s /* When 1, indicates that uC/OS-View is present */\n" $view_en]
puts $config_file " /* --------------------- TASK STACK SIZE ---------------------- */"
set task_tmr_stk_size [xget_value $ucos_handle "PARAMETER" "OS_TASK_TMR_STK_SIZE"]
puts $config_file [format "#define OS_TASK_TMR_STK_SIZE %s /* Timer task stack size (# of OS_STK wide entries) */" $task_tmr_stk_size]
set task_stat_stk_size [xget_value $ucos_handle "PARAMETER" "OS_TASK_STAT_STK_SIZE"]
puts $config_file [format "#define OS_TASK_STAT_STK_SIZE %s /* Statistics task stack size (# of OS_STK wide entries) */" $task_stat_stk_size]
set task_idle_stk_size [xget_value $ucos_handle "PARAMETER" "OS_TASK_IDLE_STK_SIZE"]
puts $config_file [format "#define OS_TASK_IDLE_STK_SIZE %s /* Idle task stack size (# of OS_STK wide entries) */\n" $task_idle_stk_size]
puts $config_file " /* ---------------------- MISCELLANEOUS ----------------------- */"
set arg_chk_en [xget_value $ucos_handle "PARAMETER" "OS_ARG_CHK_EN"]
puts $config_file [format "#define OS_ARG_CHK_EN %s /* Enable (1) or Disable (0) argument checking */" $arg_chk_en]
set cpu_hooks_en [xget_value $ucos_handle "PARAMETER" "OS_CPU_HOOKS_EN"]
puts $config_file [format "#define OS_CPU_HOOKS_EN %s /* uC/OS-II hooks are found in the processor port files */\n" $cpu_hooks_en]
set debug_en [xget_value $ucos_handle "PARAMETER" "OS_DEBUG_EN"]
puts $config_file [format "#define OS_DEBUG_EN %s /* Enable(1) debug variables */\n" $debug_en]
set event_name_size [xget_value $ucos_handle "PARAMETER" "OS_EVENT_NAME_SIZE"]
puts $config_file [format "#define OS_EVENT_NAME_SIZE %s /* Determine the size of the name of a Sem, Mutex, Mbox or Q */\n" $event_name_size]
set lowest_prio [xget_value $ucos_handle "PARAMETER" "OS_LOWEST_PRIO"]
puts $config_file [format "#define OS_LOWEST_PRIO %s /* Defines the lowest priority that can be assigned ... */" $lowest_prio]
puts $config_file " /* ... MUST NEVER be higher than 63 */\n"
set max_events [xget_value $ucos_handle "PARAMETER" "OS_MAX_EVENTS"]
puts $config_file [format "#define OS_MAX_EVENTS %s /* Max. number of event control blocks in your application */" $max_events]
set max_flags [xget_value $ucos_handle "PARAMETER" "OS_MAX_FLAGS"]
puts $config_file [format "#define OS_MAX_FLAGS %s /* Max. number of Event Flag Groups in your application */" $max_flags]
set max_mem_part [xget_value $ucos_handle "PARAMETER" "OS_MAX_MEM_PART"]
puts $config_file [format "#define OS_MAX_MEM_PART %s /* Max. number of memory partitions */" $max_mem_part]
set max_qs [xget_value $ucos_handle "PARAMETER" "OS_MAX_QS"]
puts $config_file [format "#define OS_MAX_QS %s /* Max. number of queue control blocks in your application */" $max_qs]
set max_tasks [xget_value $ucos_handle "PARAMETER" "OS_MAX_TASKS"]
puts $config_file [format "#define OS_MAX_TASKS %s /* Max. number of tasks in your application, MUST be >= 2 */\n" $max_tasks]
set sched_lock_en [xget_value $ucos_handle "PARAMETER" "OS_SCHED_LOCK_EN"]
puts $config_file [format "#define OS_SCHED_LOCK_EN %s /* Include code for OSSchedLock() and OSSchedUnlock() when 1 */\n" $sched_lock_en]
set task_stat_en [xget_value $ucos_handle "PARAMETER" "OS_TASK_STAT_EN"]
puts $config_file [format "#define OS_TASK_STAT_EN %s /* Enable (1) or Disable(0) the statistics task */" $task_stat_en]
set task_stat_stk_chk_en [xget_value $ucos_handle "PARAMETER" "OS_TASK_STAT_STK_CHK_EN"]
puts $config_file [format "#define OS_TASK_STAT_STK_CHK_EN %s /* Check task stacks from statistic task */\n" $task_stat_stk_chk_en]
set tick_step_en [xget_value $ucos_handle "PARAMETER" "OS_TICK_STEP_EN"]
puts $config_file [format "#define OS_TICK_STEP_EN %s /* Enable tick stepping feature for uC/OS-View */" $tick_step_en]
set ticks_per_sec [xget_value $ucos_handle "PARAMETER" "OS_TICKS_PER_SEC"]
puts $config_file [format "#define OS_TICKS_PER_SEC %s /* Set the number of ticks in one second */\n" $ticks_per_sec]
puts $config_file " /* ----------------------- EVENT FLAGS -------------------------*/"
set flag_en [xget_value $ucos_handle "PARAMETER" "OS_FLAG_EN"]
puts $config_file [format "#define OS_FLAG_EN %s /* Enable (1) or Disable (0) code generation for EVENT FLAGS */" $flag_en]
set flag_wait_clr_en [xget_value $ucos_handle "PARAMETER" "OS_FLAG_WAIT_CLR_EN"]
puts $config_file [format "#define OS_FLAG_WAIT_CLR_EN %s /* Include code for Wait on Clear EVENT FLAGS */" $flag_wait_clr_en]
set flag_accept_en [xget_value $ucos_handle "PARAMETER" "OS_FLAG_ACCEPT_EN"]
puts $config_file [format "#define OS_FLAG_ACCEPT_EN %s /* Include code for OSFlagAccept() */" $flag_accept_en]
set flag_del_en [xget_value $ucos_handle "PARAMETER" "OS_FLAG_DEL_EN"]
puts $config_file [format "#define OS_FLAG_DEL_EN %s /* Include code for OSFlagDel() */" $flag_del_en]
set flag_name_size [xget_value $ucos_handle "PARAMETER" "OS_FLAG_NAME_SIZE"]
puts $config_file [format "#define OS_FLAG_NAME_SIZE %s /* Determine the size of the name of an event flag group */" $flag_name_size]
set flag_query_en [xget_value $ucos_handle "PARAMETER" "OS_FLAG_QUERY_EN"]
puts $config_file [format "#define OS_FLAG_QUERY_EN %s /* Include code for OSFlagQuery() */\n" $flag_query_en]
set flag_nbits [xget_value $ucos_handle "PARAMETER" "OS_FLAGS_NBITS"]
puts $config_file "#if OS_VERSION >= 280"
puts $config_file [format "#define OS_FLAGS_NBITS %s /* Size in #bits of OS_FLAGS data type (8, 16 or 32) */" $flag_nbits]
puts $config_file "#endif\n"
puts $config_file " /* -------------------- MESSAGE MAILBOXES --------------------- */"
set mbox_en [xget_value $ucos_handle "PARAMETER" "OS_MBOX_EN"]
puts $config_file [format "#define OS_MBOX_EN %s /* Enable (1) or Disable (0) code generation for MAILBOXES */" $mbox_en]
set mbox_accept_en [xget_value $ucos_handle "PARAMETER" "OS_MBOX_ACCEPT_EN"]
puts $config_file [format "#define OS_MBOX_ACCEPT_EN %s /* Include code for OSMboxAccept() */" $mbox_accept_en]
set mbox_del_en [xget_value $ucos_handle "PARAMETER" "OS_MBOX_DEL_EN"]
puts $config_file [format "#define OS_MBOX_DEL_EN %s /* Include code for OSMboxDel() */" $mbox_del_en]
set mbox_post_en [xget_value $ucos_handle "PARAMETER" "OS_MBOX_POST_EN"]
puts $config_file [format "#define OS_MBOX_POST_EN %s /* Include code for OSMboxPost() */" $mbox_post_en]
set mbox_post_opt_en [xget_value $ucos_handle "PARAMETER" "OS_MBOX_POST_OPT_EN"]
puts $config_file [format "#define OS_MBOX_POST_OPT_EN %s /* Include code for OSMboxPostOpt() */" $mbox_post_opt_en]
set mbox_query_en [xget_value $ucos_handle "PARAMETER" "OS_MBOX_QUERY_EN"]
puts $config_file [format "#define OS_MBOX_QUERY_EN %s /* Include code for OSMboxQuery() */\n" $mbox_query_en]
puts $config_file " /* --------------------- MEMORY MANAGEMENT -------------------- */"
set mem_en [xget_value $ucos_handle "PARAMETER" "OS_MEM_EN"]
puts $config_file [format "#define OS_MEM_EN %s /* Enable (1) or Disable (0) code generation for MEMORY MANAGER */" $mem_en]
set mem_query_en [xget_value $ucos_handle "PARAMETER" "OS_MEM_QUERY_EN"]
puts $config_file [format "#define OS_MEM_QUERY_EN %s /* Include code for OSMemQuery() */" $mem_query_en]
set mem_name_size [xget_value $ucos_handle "PARAMETER" "OS_MEM_NAME_SIZE"]
puts $config_file [format "#define OS_MEM_NAME_SIZE %s /* Determine the size of a memory partition name */\n" $mem_name_size]
puts $config_file " /* ---------------- MUTUAL EXCLUSION SEMAPHORES --------------- */"
set mutex_en [xget_value $ucos_handle "PARAMETER" "OS_MUTEX_EN"]
puts $config_file [format "#define OS_MUTEX_EN %s /* Enable (1) or Disable (0) code generation for MUTEX */" $mutex_en]
set mutex_accept_en [xget_value $ucos_handle "PARAMETER" "OS_MUTEX_ACCEPT_EN"]
puts $config_file [format "#define OS_MUTEX_ACCEPT_EN %s /* Include code for OSMutexAccept() */" $mutex_accept_en]
set mutex_del_en [xget_value $ucos_handle "PARAMETER" "OS_MUTEX_DEL_EN"]
puts $config_file [format "#define OS_MUTEX_DEL_EN %s /* Include code for OSMutexDel() */" $mutex_del_en]
set mutex_query_en [xget_value $ucos_handle "PARAMETER" "OS_MUTEX_QUERY_EN"]
puts $config_file [format "#define OS_MUTEX_QUERY_EN %s /* Include code for OSMutexQuery() */\n" $mutex_query_en]
puts $config_file " /* ---------------------- MESSAGE QUEUES ---------------------- */"
set q_en [xget_value $ucos_handle "PARAMETER" "OS_Q_EN"]
puts $config_file [format "#define OS_Q_EN %s /* Enable (1) or Disable (0) code generation for QUEUES */" $q_en]
set q_accept_en [xget_value $ucos_handle "PARAMETER" "OS_Q_ACCEPT_EN"]
puts $config_file [format "#define OS_Q_ACCEPT_EN %s /* Include code for OSQAccept() */" $q_accept_en]
set q_del_en [xget_value $ucos_handle "PARAMETER" "OS_Q_DEL_EN"]
puts $config_file [format "#define OS_Q_DEL_EN %s /* Include code for OSQDel() */" $q_del_en]
set q_flush_en [xget_value $ucos_handle "PARAMETER" "OS_Q_FLUSH_EN"]
puts $config_file [format "#define OS_Q_FLUSH_EN %s /* Include code for OSQFlush() */" $q_flush_en]
set q_post_en [xget_value $ucos_handle "PARAMETER" "OS_Q_POST_EN"]
puts $config_file [format "#define OS_Q_POST_EN %s /* Include code for OSQPost() */" $q_post_en]
set q_post_front_en [xget_value $ucos_handle "PARAMETER" "OS_Q_POST_FRONT_EN"]
puts $config_file [format "#define OS_Q_POST_FRONT_EN %s /* Include code for OSQPostFront() */" $q_post_front_en]
set q_post_opt_en [xget_value $ucos_handle "PARAMETER" "OS_Q_POST_OPT_EN"]
puts $config_file [format "#define OS_Q_POST_OPT_EN %s /* Include code for OSQPostOpt() */" $q_post_opt_en]
set q_query_en [xget_value $ucos_handle "PARAMETER" "OS_Q_QUERY_EN"]
puts $config_file [format "#define OS_Q_QUERY_EN %s /* Include code for OSQQuery() */\n" $q_query_en]
puts $config_file " /* ------------------------ SEMAPHORES ------------------------ */"
set sem_en [xget_value $ucos_handle "PARAMETER" "OS_SEM_EN"]
puts $config_file [format "#define OS_SEM_EN %s /* Enable (1) or Disable (0) code generation for SEMAPHORES */" $sem_en]
set sem_accept_en [xget_value $ucos_handle "PARAMETER" "OS_SEM_ACCEPT_EN"]
puts $config_file [format "#define OS_SEM_ACCEPT_EN %s /* Include code for OSSemAccept() */" $sem_accept_en]
set sem_del_en [xget_value $ucos_handle "PARAMETER" "OS_SEM_DEL_EN"]
puts $config_file [format "#define OS_SEM_DEL_EN %s /* Include code for OSSemDel() */" $sem_del_en]
set sem_query_en [xget_value $ucos_handle "PARAMETER" "OS_SEM_QUERY_EN"]
puts $config_file [format "#define OS_SEM_QUERY_EN %s /* Include code for OSSemQuery() */" $sem_query_en]
set sem_set_en [xget_value $ucos_handle "PARAMETER" "OS_SEM_SET_EN"]
puts $config_file [format "#define OS_SEM_SET_EN %s /* Include code for OSSemSet() RRW - New in V2.76 */\n" $sem_set_en]
puts $config_file " /* --------------------- TASK MANAGEMENT ---------------------- */"
set task_change_prio_en [xget_value $ucos_handle "PARAMETER" "OS_TASK_CHANGE_PRIO_EN"]
puts $config_file [format "#define OS_TASK_CHANGE_PRIO_EN %s /* Include code for OSTaskChangePrio() */" $task_change_prio_en]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -