1# Definitions for PCI boards
2# by D.J. Barrow dj_barrow@ariasoft.ie
3#
4# please note that you will need to edit the saved pcb file
5# by hand to move the board outline onto a seperate layer
6# I suggest one of the unused layers.
7
8define(`GETNUMARRAYS',`eval(($#)/2)')
9# $1: canonical name
10# $2: name on PCB
11# $3: boardheight,number of pins,arcradius,..., number of pins
12define(`PKG_PCIPINARRAY',
13	`
14        define(`cnt',`1')
15        define(`ARGS',`$4, $5, $6, $7')
16	args(ARGS)
17	define(`LEFTOFFSET',`100')
18	define(`EDGEGAP',`12')
19	define(`PINDIST',`50')
20    	define(`PINWIDTH',`25')
21	define(`NUMARRAYS',`GETNUMARRAYS(ARGS)')
22        define(`TOTALPINS1',forloop(`IDX',0,eval(NUMARRAYS-1),
23		``arg'eval((IDX*2)+2) + ')0)
24	define(`TOTALPINS',eval(TOTALPINS1))
25	ifelse(1,eval(NUMARRAYS>1),`
26		define(`TOTALDIAMETER1',forloop(`IDX',0,eval(NUMARRAYS-2),
27			``arg'eval((IDX*2)+3) + ')0)
28		define(`TOTALDIAMETER',eval(TOTALDIAMETER1))
29	')
30    	define(`PINCENTER',`eval(LEFTOFFSET+(PINDIST/2))')
31    	define(`PINRADIUS',`eval(PINWIDTH/2)')
32    	define(`PINLEFT',`eval(PINCENTER-PINRADIUS)')
33    	define(`PINRIGHT',`eval(PINCENTER+PINRADIUS)')
34    	define(`PENWIDTH',`eval(PINRADIUS+4)')
35    	define(`PENRADIUS',`eval(PENWIDTH/2)')
36    	define(`MAXIDX',`eval(TOTALPINS - 1)')
37    	define(`ARRAYWIDTH', `eval((TOTALPINS*PINDIST)+TOTALDIAMETER)')
38    	define(`CENTERX', `eval(((ARRAYWIDTH+LEFTOFFSET)/2))')
39    	define(`MINY',`20')
40    	define(`MIDY',`220')
41    	define(`MAXY',`270')
42    	define(`ARCRADIUS',`12')
43	define(`ARCDIAMETER',`eval(ARCRADIUS*2)')
44    	define(`LMAXY',`eval(MAXY+ARCRADIUS)')
45	define(`BOARDTOP',`eval(LMAXY-arg1)')
46	define(`SCREWBORDER',275)
47Element(0x00  "$1" "`$2'" "$3" CENTERX 10 1 30 0x00)
48(
49	Mark(CENTERX 135)
50	define(`ADDSIDE',0)
51	define(`FLAG',0x0)
52	define(`LOOPIDX1',eval(NUMARRAYS-1))
53	define(`LEFT1',`eval(PINLEFT-ARCRADIUS)')
54	define(`ARCRADIUS2',`100')
55	define(`SLOTWIDTH',`1000')
56	define(`BRACKETLEFT',`-1525')
57	define(`LEFT2',`eval(LEFT1-ARCRADIUS2)')
58	define(`LEFT3',`eval(LEFT1+ARCRADIUS2-SLOTWIDTH)')
59	define(`LEFT4',`eval(LEFT1-SLOTWIDTH)')
60	ElementArc(LEFT2 0 ARCRADIUS2 ARCRADIUS2 180 90 1)
61  	ElementLine(LEFT2 -ARCRADIUS2 LEFT3 -ARCRADIUS2 1)
62	ElementArc(LEFT3 0 ARCRADIUS2 ARCRADIUS2 270 90 1)
63	ElementLine(LEFT4 0 LEFT4 MAXY 1)
64        define(`LEFT5',`eval(LEFT4-ARCRADIUS)')
65	ElementArc(LEFT5 MAXY ARCRADIUS ARCRADIUS 90 90 1)
66        ElementLine(LEFT5 LMAXY BRACKETLEFT LMAXY 1)
67   	forloop(`SIDE',0,1,
68   	`
69		define(`IDX',`0')
70		define(`ADDDIAMETER',`0')
71		forloop(`IDX1',0,LOOPIDX1,
72		`
73			define(`CURRNUMPINS',`arg'eval((IDX1*2)+2))
74			ifelse(SIDE,`0',`
75				define(`CURRLEFT',`eval((PINDIST*IDX)+(ADDDIAMETER)+PINLEFT)')
76				define(`CURRRIGHT',`eval(CURRLEFT+((CURRNUMPINS-1)*PINDIST)+PINWIDTH)')
77				ElementLine(CURRLEFT LMAXY CURRRIGHT LMAXY 2)
78				ElementArc(CURRLEFT MAXY ARCRADIUS ARCRADIUS 0 90 2)
79				ElementArc(CURRRIGHT MAXY ARCRADIUS ARCRADIUS 90 90 2)
80				define(`CURRLEFT1',`eval(CURRLEFT-ARCRADIUS)')
81				define(`CURRRIGHT1',`eval(CURRRIGHT+ARCRADIUS)')
82		                ElementLine(CURRLEFT1 0 CURRLEFT1 MAXY 1)
83                                ElementLine(CURRRIGHT1 0 CURRRIGHT1 MAXY 1)
84		                ifelse(1,eval((NUMARRAYS>1)&&(IDX1<LOOPIDX1)),`
85					define(`CURRDIAMETER',`arg'eval((IDX1*2)+3))
86					define(`CURRRADIUS',`eval(CURRDIAMETER/2)')
87					ElementArc(eval(CURRRIGHT+EDGEGAP+(CURRDIAMETER/2)) 0 CURRRADIUS CURRRADIUS 180 180 1)
88				')
89	   			ifelse(1,eval(IDX1==LOOPIDX1),`
90					ElementLine(BRACKETLEFT LMAXY BRACKETLEFT BOARDTOP 1)
91					ElementLine(BRACKETLEFT BOARDTOP CURRRIGHT1 BOARDTOP 1)
92					ElementLine(CURRRIGHT1 BOARDTOP CURRRIGHT1 0 1)
93
94				        ElementArc(eval(BRACKETLEFT+SCREWBORDER) eval(LMAXY-SCREWBORDER) 125 125 0 360 1)
95				        ElementArc(eval(BRACKETLEFT+SCREWBORDER) eval(BOARDTOP+SCREWBORDER) 125 125 0 360 1)
96				')
97			')
98   			forloop(`IDX2',0,eval(CURRNUMPINS-1),
99   			`
100				define(`CURRX',`eval((PINDIST*IDX)+(ADDDIAMETER))')
101				define(`MINX',`eval(PINLEFT+CURRX)')
102				define(`MIDX',`eval(PINCENTER+CURRX)')
103				define(`MAXX',`eval(PINRIGHT+CURRX)')
104				define(`PINIDX',`eval(IDX+1+ADDSIDE)')
105	                        EDGECONN(MINX,MINY,MAXX,MINY,PENWIDTH,PINIDX,FLAG)
106				EDGECONN(MINX,MINY,MINX,MIDY,PENWIDTH,PINIDX,FLAG)
107				EDGECONN(MINX,MIDY,MIDX,MAXY,PENWIDTH,PINIDX,FLAG)
108				EDGECONN(MIDX,MINY,MIDX,MAXY,PENWIDTH,PINIDX,FLAG)
109				EDGECONN(MAXX,MINY,MAXX,MIDY,PENWIDTH,PINIDX,FLAG)
110				EDGECONN(MAXX,MIDY,MIDX,MAXY,PENWIDTH,PINIDX,FLAG)
111				define(`IDX',incr(IDX))
112			')
113
114			ifelse(1,eval((NUMARRAYS>1)&&(IDX1<LOOPIDX1)),`
115				define(`ADDDIAMETER1',forloop(`IDX2',0,eval(IDX1),
116				``arg'eval((IDX2*2)+3)+')0)
117				define(`ADDDIAMETER',eval(ADDDIAMETER1+(EDGEGAP*2)-PINDIST+PINWIDTH))
118			')
119		')
120		define(`ADDSIDE',`TOTALPINS')
121		define(`FLAG',0x80)
122  	')
123
124)')
125
126
127
128define(`PKG_PCI5V_AVE_HEIGHT',   `PKG_PCIPINARRAY(`$1', `$2', `$3', 2810,49,100,11)');
129define(`PKG_PCI5V_MIN_HEIGHT',   `PKG_PCIPINARRAY(`$1', `$2', `$3', 1420,49,100,11)');
130define(`PKG_PCI5V_MAX_HEIGHT',   `PKG_PCIPINARRAY(`$1', `$2', `$3', 4200,49,100,11)');
131define(`PKG_PCI5V_SMALL_HEIGHT', `PKG_PCIPINARRAY(`$1', `$2', `$3', 2063,49,100,11)');
132
133
134
135
136
137
138