⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ucosii_v2_1_0.tcl

📁 ucos2在macroblaze上的移植代码
💻 TCL
📖 第 1 页 / 共 2 页
字号:
# (c) Copyright 2003 Xilinx Inc.# All rights reserved.# uses xillib.tcl# --------------------------------------# Tcl procedure generate# -------------------------------------proc generate {os_handle} {    global env    set need_config_file "false"    # Copy over the right set of files as src based on processor type    set prochandle [xget_processor]    set proctype [xget_value $prochandle "OPTION" "IPNAME"]        # proctype should be "microblaze" or "ppc405"    set mbsrcdir "./src/microblaze"    set ppcsrcdir "./src/ppc405"    switch $proctype {	"microblaze" { 	    foreach entry [glob -nocomplain [file join $mbsrcdir *]] {		file copy -force $entry "./src/"	    }	    set need_config_file "true"	}	"ppc405"  {	    foreach entry [glob -nocomplain [file join $ppcsrcdir *]] {		file copy -force $entry "./src/"	    }	}	"ppc405_virtex4"  {	    foreach entry [glob -nocomplain [file join $ppcsrcdir *]] {		file copy -force $entry "./src/"	    }	}	"default" {puts "unknown processor type\n"}    }        # Remove microblaze and ppc405 directories...    file delete -force $mbsrcdir    file delete -force $ppcsrcdir    # Handle stdin and stdout    xhandle_stdin $os_handle    xhandle_stdout $os_handle        set file_handle [xopen_include_file "xparameters.h"]    puts $file_handle "\n/******************************************************************/\n"    close $file_handle    # Create config file for microblaze interrupt handling    if {[string compare -nocase $need_config_file "true"] == 0} {	xhandle_mb_interrupts    }    # Generate xil_malloc.h if required    set xil_malloc [xget_value $os_handle "PARAMETER" "need_xil_malloc"]    if {[string compare -nocase $xil_malloc "true"] == 0} {	xcreate_xil_malloc_config_file     }

	create_os_config_file $os_handle}# --------------------------------------# Tcl procedure xhandle_mb_interrupts# -------------------------------------- proc xhandle_mb_interrupts {} {    set default_interrupt_handler "XNullHandler"    set default_arg "XNULL"    set source_interrupt_handler $default_interrupt_handler    set source_handler_arg $default_arg        # Handle the interrupt pin    set periph [xget_processor]     set source_ports [xget_interrupt_sources $periph]    if {[llength $source_ports] > 1} {	error "Too many interrupting ports on the MicroBlaze.  Should only find 1" "" "libgen_error"	return    }        if {[llength $source_ports] == 1} {	set source_port [lindex $source_ports 0]	if {[llength $source_port] != 0} {	    set source_port_name [xget_value $source_port "NAME"]		    set source_periph [xget_handle $source_port "PARENT"]	    set source_name [xget_value $source_periph "NAME"]	    set source_driver [xget_swhandle $source_name]	    if {[string compare -nocase $source_driver ""] != 0} {		set int_array [xget_handle $source_driver "ARRAY" "interrupt_handler"]		if {[llength $int_array] != 0} {		    set int_array_elems [xget_handle $int_array "ELEMENTS" "*"]		    if {[llength $int_array_elems] != 0} {			foreach int_array_elem $int_array_elems {			    set int_port [xget_value $int_array_elem "PARAMETER" "int_port"]			    set mhs_handle [xget_value $int_array_elem "PARAMETER" "mhsinst"]			    if {[llength $int_port] != 0} {				if {[string compare -nocase $int_port $source_port_name] == 0 && \					$mhs_handle == $source_periph } {				    set source_interrupt_handler [xget_value $int_array_elem "PARAMETER" "int_handler"]				    set source_handler_arg [xget_value $int_array_elem "PARAMETER" "int_handler_arg"]				    if {[string compare -nocase $source_handler_arg DEVICE_ID] == 0 } {					set source_handler_arg [xget_name $source_periph "DEVICE_ID"]				    } else {					if {[string compare -nocase "global" [xget_port_type $source_port]] == 0} {					    set source_handler_arg $default_arg					} else {					    set source_handler_arg [xget_name $source_periph "C_BASEADDR"]					}				    }				    break				}			    }			}		    }		}	    }	}    }        # Generate microblaze_interrupts_g.c file...    xcreate_mb_intr_config_file $source_interrupt_handler $source_handler_arg     }# -------------------------------------------# Tcl procedure xcreate_mb_intr_config)file# ------------------------------------------- proc xcreate_mb_intr_config_file {handler arg} {        set mb_table "MB_InterruptVectorTable"    set filename [file join "src" "microblaze_interrupts_g.c"]     file delete $filename    set config_file [open $filename w]    xprint_generated_header $config_file "Interrupt Handler Table for MicroBlaze Processor"        puts $config_file "#include \"microblaze_interrupts_i.h\""    puts $config_file "#include \"xparameters.h\""    puts $config_file "\n"    puts $config_file [format "extern void %s (void *);" $handler]    puts $config_file "\n/*"    puts $config_file "* The interrupt handler table for microblaze processor"    puts $config_file "*/\n"    puts $config_file [format "%sEntry %s\[\] =" $mb_table $mb_table]    puts $config_file "\{"    puts -nonewline $config_file [format "\t%s" $handler]    puts -nonewline $config_file [format ",\n\t(void*) %s" $arg]    puts -nonewline $config_file "\n\};"    close $config_file}# ---------------------------------------------# Tcl procedure xcreate_xil_malloc_config_file# ---------------------------------------------proc xcreate_xil_malloc_config_file {} {        set filename [file join "src" "xil_malloc.h"]     file delete $filename    set config_file [open $filename w]    xprint_generated_header $config_file "Xilinx Malloc Definition file"    puts $config_file "#define malloc xil_malloc"    puts $config_file "#define free xil_free"    puts $config_file "#define msize xil_msize"    puts $config_file "#define realloc xil_realloc"    puts $config_file "#define calloc xil_calloc"    puts $config_file "\n"    close $config_file    }
# ----------------------------------------------
# Tcl procedure create_os_config_file
# ----------------------------------------------
proc create_os_config_file {ucos_handle} {


    set filename "../../../code/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.  Since the OS is not *"
	puts $config_file "* configurable for this example, this file is not used.                                                  *"  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -