1 | ############################################################################## |
---|
2 | ## |
---|
3 | ## *************************************************************************** |
---|
4 | ## ** ** |
---|
5 | ## ** Copyright (c) 1995-2006 Xilinx, Inc. All rights reserved. ** |
---|
6 | ## ** ** |
---|
7 | ## ** You may copy and modify these files for your own internal use solely ** |
---|
8 | ## ** with Xilinx programmable logic devices and Xilinx EDK system or ** |
---|
9 | ## ** create IP modules solely for Xilinx programmable logic devices and ** |
---|
10 | ## ** Xilinx EDK system. No rights are granted to distribute any files ** |
---|
11 | ## ** unless they are distributed in Xilinx programmable logic devices. ** |
---|
12 | ## ** ** |
---|
13 | ## *************************************************************************** |
---|
14 | ## |
---|
15 | ## Modified: |
---|
16 | ## June 20 2006: Added html elaboration step |
---|
17 | ############################################################################## |
---|
18 | |
---|
19 | proc generate {drv_handle} { |
---|
20 | puts "Generating Macros for warp_timer_plbw driver access ... " |
---|
21 | |
---|
22 | # initialize |
---|
23 | lappend config_table |
---|
24 | lappend addr_config_table |
---|
25 | lappend xparam_config_table |
---|
26 | |
---|
27 | # hardware version |
---|
28 | lappend config_table "C_XC_VERSION" |
---|
29 | # Low-level function names |
---|
30 | lappend config_table "C_XC_CREATE" "C_XC_RELEASE" "C_XC_OPEN" "C_XC_CLOSE" "C_XC_READ" "C_XC_WRITE" "C_XC_GET_SHMEM" |
---|
31 | # Optional parameters |
---|
32 | # (empty) |
---|
33 | |
---|
34 | # Memory map information |
---|
35 | sg_lappend config_table addr_config_table "C_MEMMAP_TIMER0_TIMELEFT" |
---|
36 | sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER0_TIMELEFT_N_BITS" |
---|
37 | sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER0_TIMELEFT_BIN_PT" |
---|
38 | # sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER0_TIMELEFT_ATTR" |
---|
39 | |
---|
40 | sg_lappend config_table addr_config_table "C_MEMMAP_TIMER1_TIMELEFT" |
---|
41 | sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER1_TIMELEFT_N_BITS" |
---|
42 | sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER1_TIMELEFT_BIN_PT" |
---|
43 | # sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER1_TIMELEFT_ATTR" |
---|
44 | |
---|
45 | sg_lappend config_table addr_config_table "C_MEMMAP_TIMER2_TIMELEFT" |
---|
46 | sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER2_TIMELEFT_N_BITS" |
---|
47 | sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER2_TIMELEFT_BIN_PT" |
---|
48 | # sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER2_TIMELEFT_ATTR" |
---|
49 | |
---|
50 | sg_lappend config_table addr_config_table "C_MEMMAP_TIMER3_TIMELEFT" |
---|
51 | sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER3_TIMELEFT_N_BITS" |
---|
52 | sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER3_TIMELEFT_BIN_PT" |
---|
53 | # sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER3_TIMELEFT_ATTR" |
---|
54 | |
---|
55 | sg_lappend config_table addr_config_table "C_MEMMAP_TIMER_CONTROL_R" |
---|
56 | sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER_CONTROL_R_N_BITS" |
---|
57 | sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER_CONTROL_R_BIN_PT" |
---|
58 | # sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER_CONTROL_R_ATTR" |
---|
59 | |
---|
60 | sg_lappend config_table addr_config_table "C_MEMMAP_TIMER_STATUS" |
---|
61 | sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER_STATUS_N_BITS" |
---|
62 | sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER_STATUS_BIN_PT" |
---|
63 | # sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER_STATUS_ATTR" |
---|
64 | |
---|
65 | sg_lappend config_table addr_config_table "C_MEMMAP_TIMER0_COUNTTO" |
---|
66 | sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER0_COUNTTO_N_BITS" |
---|
67 | sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER0_COUNTTO_BIN_PT" |
---|
68 | # sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER0_COUNTTO_ATTR" |
---|
69 | |
---|
70 | sg_lappend config_table addr_config_table "C_MEMMAP_TIMER1_COUNTTO" |
---|
71 | sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER1_COUNTTO_N_BITS" |
---|
72 | sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER1_COUNTTO_BIN_PT" |
---|
73 | # sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER1_COUNTTO_ATTR" |
---|
74 | |
---|
75 | sg_lappend config_table addr_config_table "C_MEMMAP_TIMER2_COUNTTO" |
---|
76 | sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER2_COUNTTO_N_BITS" |
---|
77 | sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER2_COUNTTO_BIN_PT" |
---|
78 | # sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER2_COUNTTO_ATTR" |
---|
79 | |
---|
80 | sg_lappend config_table addr_config_table "C_MEMMAP_TIMER3_COUNTTO" |
---|
81 | sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER3_COUNTTO_N_BITS" |
---|
82 | sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER3_COUNTTO_BIN_PT" |
---|
83 | # sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER3_COUNTTO_ATTR" |
---|
84 | |
---|
85 | sg_lappend config_table addr_config_table "C_MEMMAP_TIMER_CONTROL_W" |
---|
86 | sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER_CONTROL_W_N_BITS" |
---|
87 | sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER_CONTROL_W_BIN_PT" |
---|
88 | # sg_lappend config_table xparam_config_table "C_MEMMAP_TIMER_CONTROL_W_ATTR" |
---|
89 | |
---|
90 | # XPS parameters |
---|
91 | sg_lappend config_table xparam_config_table "DEVICE_ID" "C_BASEADDR" |
---|
92 | |
---|
93 | # generate xparameters.h |
---|
94 | eval xdefine_include_file $drv_handle "xparameters.h" "WARP_TIMER_PLBW" "NUM_INSTANCES" ${xparam_config_table} |
---|
95 | eval sg_xdefine_include_file $drv_handle "xparameters.h" "WARP_TIMER_PLBW" ${addr_config_table} |
---|
96 | # generate sg_plbiface_g.c |
---|
97 | eval xdefine_config_file $drv_handle "warp_timer_plbw_g.c" "WARP_TIMER_PLBW" ${config_table} |
---|
98 | } |
---|
99 | |
---|
100 | proc sg_xdefine_include_file {drv_handle file_name drv_string args} { |
---|
101 | # Open include file |
---|
102 | set file_handle [xopen_include_file $file_name] |
---|
103 | |
---|
104 | # Get all peripherals connected to this driver |
---|
105 | set periphs [xget_periphs $drv_handle] |
---|
106 | |
---|
107 | # Print all parameters for all peripherals |
---|
108 | set device_id 0 |
---|
109 | foreach periph $periphs { |
---|
110 | # base_addr of the peripheral |
---|
111 | set base_addr [xget_param_value $periph "C_BASEADDR"] |
---|
112 | |
---|
113 | puts $file_handle "" |
---|
114 | puts $file_handle "/* Definitions (address parameters) for peripheral [string toupper [xget_hw_name $periph]] */" |
---|
115 | foreach arg $args { |
---|
116 | set value [xget_param_value $periph $arg] |
---|
117 | if {[llength $value] == 0} { |
---|
118 | set value 0 |
---|
119 | } |
---|
120 | set value [expr ${base_addr} + ${value}] |
---|
121 | set value [xformat_address_string $value] |
---|
122 | puts $file_handle "#define [xget_name $periph $arg] $value" |
---|
123 | } |
---|
124 | |
---|
125 | puts $file_handle "/* software driver settings for peripheral [string toupper [xget_hw_name $periph]] */" |
---|
126 | puts $file_handle "#define XPAR_[string toupper [xget_hw_name ${periph}]]_XC_VERSION 1" |
---|
127 | puts $file_handle "#define XPAR_[string toupper [xget_hw_name ${periph}]]_XC_CREATE xc_warp_timer_plbw_create" |
---|
128 | puts $file_handle "#define XPAR_[string toupper [xget_hw_name ${periph}]]_XC_RELEASE xc_warp_timer_plbw_release" |
---|
129 | puts $file_handle "#define XPAR_[string toupper [xget_hw_name ${periph}]]_XC_OPEN xc_warp_timer_plbw_open" |
---|
130 | puts $file_handle "#define XPAR_[string toupper [xget_hw_name ${periph}]]_XC_CLOSE xc_warp_timer_plbw_close" |
---|
131 | puts $file_handle "#define XPAR_[string toupper [xget_hw_name ${periph}]]_XC_READ xc_warp_timer_plbw_read" |
---|
132 | puts $file_handle "#define XPAR_[string toupper [xget_hw_name ${periph}]]_XC_WRITE xc_warp_timer_plbw_write" |
---|
133 | puts $file_handle "#define XPAR_[string toupper [xget_hw_name ${periph}]]_XC_GET_SHMEM xc_warp_timer_plbw_getshmem" |
---|
134 | |
---|
135 | puts $file_handle "" |
---|
136 | } |
---|
137 | puts $file_handle "\n/******************************************************************/\n" |
---|
138 | close $file_handle |
---|
139 | } |
---|
140 | |
---|
141 | proc sg_lappend {required_config_table {extra_config_table ""} args} { |
---|
142 | upvar ${required_config_table} config_table_1 |
---|
143 | if {[string length ${extra_config_table}] != 0} { |
---|
144 | upvar ${extra_config_table} config_table_2 |
---|
145 | } |
---|
146 | |
---|
147 | foreach value ${args} { |
---|
148 | eval [list lappend config_table_1 ${value}] |
---|
149 | if {[string length ${extra_config_table}] != 0} { |
---|
150 | lappend config_table_2 ${value} |
---|
151 | } |
---|
152 | } |
---|
153 | } |
---|