Horizon
ipc7351b.h
1 /*
2  * Copyright 2018 Martin Ã…berg
3  *
4  * This file is part of Footag.
5  *
6  * Footag is free software: you can redistribute it and/or modify it under the
7  * terms of the GNU General Public License as published by the Free Software
8  * Foundation, either version 3 of the License, or (at your option) any later
9  * version.
10  *
11  * Footag is distributed in the hope that it will be useful, but WITHOUT ANY
12  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14  * details.
15  *
16  * You should have received a copy of the GNU General Public License along with
17  * this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef FOOTAG_IPC7351B_H
21 #define FOOTAG_IPC7351B_H
22 
23 /*
24  * This is an implementation of
25  * "IPC-7351B: Generic Requirements for Surface Mount Design and
26  * Land Pattern Standard"
27  *
28  * The document is available for purchase from IPC.
29  *
30  * The following parts of the standard are covered by the implementation:
31  * - Land pattern dimension and spacing calculations
32  * - Courtyard properties
33  *
34  * These parts are not implemented:
35  * - Land pattern naming convention
36  *
37  * Note also that the following items are not part of IPC-7351B or this
38  * implementation:
39  * - Silk screen
40  * - Assembly outline
41  *
42  * This implementation uses metric mm units exclusively.
43  */
44 
45 #include <footag/footol.h>
46 
47 /*
48  * The following lead dimensions convention is used in IPC-7351B. It applies to
49  * different lead types.
50  *
51  * | -------- l -------- |
52  * _ _______ _______
53  * | | | |
54  * w | | | | -
55  * _ |_______| |_______| |
56  *
57  * pitch
58  * _ _______ _______
59  * | | | | |
60  * w | | | | -
61  * _ |_______| |_______|
62  *
63  * | - t - |
64  *
65  * The convention is used for describing leads and their relation.
66  */
67 struct ipcb_comp {
68  /* lead termination end to lead termination end */
69  struct footol l;
70  /* lead length */
71  struct footol t;
72  /* width of lead or termination */
73  struct footol w;
74 };
75 
76 /* Lead types are somewhat related to solder joint goal tables. */
77 enum ipcb_leadtype {
78  IPCB_LEADTYPE_CHIP,
79  IPCB_LEADTYPE_MOLDED,
80  IPCB_LEADTYPE_GULLWING,
81  IPCB_LEADTYPE_SIDECONCAVE,
82  IPCB_LEADTYPE_NUM,
83 };
84 
85 /*
86  * - Density level {A,B,C} (Land pattern geometry variation)
87  * or if you prefer:
88  * - {Maximum (Most),Median (Nominal),Minimum (Least)} {Land
89  * protrusion,material condition}
90  */
91 enum ipcb_density {
92  IPCB_DENSITY_M,
93  IPCB_DENSITY_N,
94  IPCB_DENSITY_L,
95  IPCB_DENSITY_NUM,
96 };
97 
98 static const char IPCB_DENSITY_TO_CHAR[IPCB_DENSITY_NUM] = {'M','N','L'};
99 
100 /* Attributes related to library policy. These are component independent. */
101 struct ipcb_attr {
102  enum ipcb_density density;
103  /* PCB fabrication tolerance */
104  double f;
105  /* Part placement tolerance */
106  double p;
107 };
108 
109 /* Output parameters generated by land dimension calculation functions. */
110 
111 struct ipcb_ref {
112  const char *where;
113  const char *what;
114 };
115 
116 /*
117  * "Two-side" style
118  *
119  * Land dimensions convention used by the library
120  *
121  * | - h - |
122  * _ _______ _______
123  * | | | |
124  * w | | | |
125  * _ |_______| |_______|
126  *
127  * | -- dist -- |
128  */
129 struct ipcb_twospec {
130  struct ipcb_ref ref;
131  double smin;
132  double zmax, gmin, xmax;
133  double round;
134  double cyexc;
135  /* user friendly */
136  struct {
137  /* length between pad centers */
138  double dist;
139  double w;
140  double h;
141  } land;
142 };
143 
144 /* BGA style */
145 struct ipcb_bgaspec {
146  struct ipcb_ref ref;
147  double diam;
148 };
149 
150 /*
151  * Calculate land dimensions for two-side style
152  *
153  * comp: component dimensions
154  * attr: library policy attributes
155  * spec: result
156  * return: 0 iff success
157  */
158 
159 int ipcb_get_chip(
160  struct ipcb_twospec *spec,
161  const struct ipcb_comp *comp,
162  const struct ipcb_attr *attr
163 );
164 
165 int ipcb_get_melf(
166  struct ipcb_twospec *spec,
167  const struct ipcb_comp *comp,
168  const struct ipcb_attr *attr
169 );
170 
171 int ipcb_get_molded(
172  struct ipcb_twospec *spec,
173  const struct ipcb_comp *comp,
174  const struct ipcb_attr *attr
175 );
176 
177 /* concave leads on sides and not at the corners */
178 int ipcb_get_sideconcave(
179  struct ipcb_twospec *spec,
180  const struct ipcb_comp *comp,
181  const struct ipcb_attr *attr
182 );
183 
184 int ipcb_get_concavearray(
185  struct ipcb_twospec *spec,
186  const struct ipcb_comp *comp,
187  const struct ipcb_attr *attr
188 );
189 
190 int ipcb_get_convexarray(
191  struct ipcb_twospec *spec,
192  const struct ipcb_comp *comp,
193  const struct ipcb_attr *attr
194 );
195 
196 int ipcb_get_flatarray(
197  struct ipcb_twospec *spec,
198  const struct ipcb_comp *comp,
199  const struct ipcb_attr *attr
200 );
201 
202 int ipcb_get_gullwing(
203  struct ipcb_twospec *spec,
204  const struct ipcb_comp *comp,
205  const struct ipcb_attr *attr,
206  double pitch
207 );
208 
209 int ipcb_get_jlead(
210  struct ipcb_twospec *spec,
211  const struct ipcb_comp *comp,
212  const struct ipcb_attr *attr
213 );
214 
215 int ipcb_get_son(
216  struct ipcb_twospec *spec,
217  const struct ipcb_comp *comp,
218  const struct ipcb_attr *attr
219 );
220 
221 int ipcb_get_qfn(
222  struct ipcb_twospec *spec,
223  const struct ipcb_comp *comp,
224  const struct ipcb_attr *attr
225 );
226 
227 int ipcb_get_pson(
228  struct ipcb_twospec *spec,
229  const struct ipcb_comp *comp,
230  const struct ipcb_attr *attr,
231  double pullback
232 );
233 
234 int ipcb_get_capae(
235  struct ipcb_twospec *spec,
236  const struct ipcb_comp *comp,
237  const struct ipcb_attr *attr,
238  double height
239 );
240 
241 int ipcb_get_sodfl(
242  struct ipcb_twospec *spec,
243  const struct ipcb_comp *comp,
244  const struct ipcb_attr *attr
245 );
246 
247 /*
248  * Calculate land dimensions for BGA style
249  *
250  * diam: nominal ball diameter
251  * spec: result
252  * return: 0 iff success
253  */
254 int ipcb_get_bga(
255  struct ipcb_bgaspec *spec,
256  double diam,
257  int collapsing
258 );
259 
260 #endif
261 
ipcb_attr
Definition: ipc7351b.h:101
ipcb_bgaspec
Definition: ipc7351b.h:145
ipcb_twospec
Definition: ipc7351b.h:129
footol
Definition: footol.h:27
ipcb_comp
Definition: ipc7351b.h:67
ipcb_ref
Definition: ipc7351b.h:111