Specifications

290 www.xilinx.com Embedded System Tools Guide (EDK 6.2i)
1-800-255-7778 UG111 (v1.4) January 30, 2004
Chapter 20: Microprocessor Library Definition (MLD)
R
PROPERTY defines the properties associated with the construct defined in the BEGIN
construct. Here “HEADER” is a property with value “xilmfs.h”, defined by the “file”
interface. FUNCTION defines a function supported by the interface. Here “open”, “close”,
“read”, “write”, “lseek” are functions of “file” interface with values “mfs_file_open”,
“mfs_file_close”, “mfs_file_read”, “mfs_file_write”, “mfs_file_lseek”.These functions are
defined in the header file “xilmfs.h”.
BEGIN INTERFACE filesystem
BEGIN INTERFACE defines an interface the library supports. Here “file” is the name of the
interface.
PROPERTY HEADER="xilmfs.h" ;
FUNCTION NAME=cd, VALUE=mfs_change_dir ;
FUNCTION NAME=opendir, VALUE=mfs_dir_open ;
FUNCTION NAME=closedir, VALUE=mfs_dir_close ;
FUNCTION NAME=readdir, VALUE=mfs_dir_read ;
FUNCTION NAME=deletedir, VALUE=mfs_delete_dir ;
FUNCTION NAME=pwd, VALUE=mfs_get_current_dir_name ;
FUNCTION NAME=rename, VALUE=mfs_rename_file ;
FUNCTION NAME=exists, VALUE=mfs_exists_file ;
FUNCTION NAME=delete, VALUE=mfs_delete_file ;
END INTERFACE
END LIBRARY
END is used with the construct name that was used in the BEGIN statement. Here END is
used with INTERFACE and LIBRARY constructs to indicate the end of each of
INTERFACE and LIBRARY constructs.
Example Tcl File of a library
The following is the xilmfs_v2_1_0.tcl file corresponding the xilmfs_v2_1_0.mld file
described in the previous section. The “mfs_drc” procedure would be invoked by libgen
for xilmfs library while running DRCs for libraries. The generate routine generates
constants in a header file and a c file for xilmfs library based on the library definition
segment in the MSS file.
proc mfs_drc {lib_handle} {
puts "MFS DRC ..."
}
proc mfs_open_include_file {file_name} {
set filename [file join "../../include/" $file_name]
if {[file exists $filename]} {
set config_inc [open $filename a]
} else {
set config_inc [open $filename a]
xprint_generated_header $config_inc "MFS Parameters"
}
return $config_inc
}
proc generate {lib_handle} {
puts "MFS generate ..."
file copy "src/xilmfs.h" "../../include/xilmfs.h"
set conffile [mfs_open_include_file "mfs_config.h"]
puts $conffile "#ifndef _MFS_CONFIG_H"