Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / obp / obp / dev / network / common / link-params.fth
CommitLineData
920dae64
AT
1\ ========== Copyright Header Begin ==========================================
2\
3\ Hypervisor Software File: link-params.fth
4\
5\ Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
6\
7\ - Do no alter or remove copyright notices
8\
9\ - Redistribution and use of this software in source and binary forms, with
10\ or without modification, are permitted provided that the following
11\ conditions are met:
12\
13\ - Redistribution of source code must retain the above copyright notice,
14\ this list of conditions and the following disclaimer.
15\
16\ - Redistribution in binary form must reproduce the above copyright notice,
17\ this list of conditions and the following disclaimer in the
18\ documentation and/or other materials provided with the distribution.
19\
20\ Neither the name of Sun Microsystems, Inc. or the names of contributors
21\ may be used to endorse or promote products derived from this software
22\ without specific prior written permission.
23\
24\ This software is provided "AS IS," without a warranty of any kind.
25\ ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
26\ INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
27\ PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
28\ MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
29\ ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
30\ DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN
31\ OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR
32\ FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
33\ DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
34\ ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
35\ SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
36\
37\ You acknowledge that this software is not designed, licensed or
38\ intended for use in the design, construction, operation or maintenance of
39\ any nuclear facility.
40\
41\ ========== Copyright Header End ============================================
42id: @(#)link-params.fth 1.3 07/01/23
43purpose: Declarations for storing and setting up link information.
44copyright: Copyright 2007 Sun Microsystems, Inc. All Rights Reserved
45copyright: Use is subject to license terms.
46
47headerless
48
49\ Values for transceiver in use.
500 constant no-xcvr
511 constant internal-xcvr
522 constant external-xcvr
533 constant pcs-xcvr
54
55no-xcvr instance value xcvr-in-use
56
57\ Link speeds.
58d# 0 constant auto-speed
59d# 10 constant 10Mbps
60d# 100 constant 100Mbps
61d# 1000 constant 1000Mbps
62d# 10000 constant 10Gbps
63
64\ Link duplex modes.
650 constant auto-duplex
661 constant half-duplex
672 constant full-duplex
68
69\ Gigabit link clock modes.
700 constant auto-link-clock
711 constant master-link-clock
722 constant slave-link-clock
73
74\ Link speed, duplex and link-clock selected by user.
75auto-speed instance value user-speed
76auto-duplex instance value user-duplex
77auto-link-clock instance value user-link-clock
78
79\ Chosen link speed and duplex modes.
800 instance value chosen-speed
810 instance value chosen-duplex
82
83\ MAC modes.
841 constant int-loopback
852 constant promiscuous
86
870 instance value mac-mode
88
89: full-duplex-link? ( -- flag ) chosen-duplex full-duplex = ;
90: half-duplex-link? ( -- flag ) chosen-duplex half-duplex = ;
91
92: pcs-xcvr? ( -- flag ) xcvr-in-use pcs-xcvr = ;
93: mif-xcvr? ( -- flag ) xcvr-in-use pcs-xcvr <> ;
94
95: set-chosen-speed&duplex ( speed mode -- )
96 to chosen-duplex to chosen-speed
97;
98
99: .link-speed,duplex ( speed mode -- )
100 swap case
101 10Mbps of ." 10 Mbps " endof
102 100Mbps of ." 100 Mbps " endof
103 1000Mbps of ." 1000 Mbps " endof
104 endcase
105 case
106 half-duplex of ." half duplex " endof
107 full-duplex of ." full duplex " endof
108 endcase
109;
110
111: speed=auto ( -- ) auto-speed to user-speed ;
112: speed=10 ( -- ) 10Mbps to user-speed ;
113: speed=100 ( -- ) 100Mbps to user-speed ;
114: speed=1000 ( -- ) 1000Mbps to user-speed ;
115: speed=10000 ( -- ) 10Gbps to user-speed ;
116
117: duplex=auto ( -- ) auto-duplex to user-duplex ;
118: duplex=half ( -- ) half-duplex to user-duplex ;
119: duplex=full ( -- ) full-duplex to user-duplex ;
120
121: link-clock=auto ( -- ) auto-link-clock to user-link-clock ;
122: link-clock=master ( -- ) master-link-clock to user-link-clock ;
123: link-clock=slave ( -- ) slave-link-clock to user-link-clock ;
124
125: mode=promiscuous ( -- ) promiscuous to mac-mode ;
126
127headers