00001
00025 #include "register_functions.c"
00026 #include "pga.h"
00027
00028
00035 int
00036 pga_create_element ()
00037 {
00038 gdouble xmax;
00039 gdouble xmin;
00040 gdouble ymax;
00041 gdouble ymin;
00042 gdouble x_text;
00043 gdouble y_text;
00044 gdouble dx;
00045 gint pin_number;
00046 gchar *pin_pad_name = g_strdup ("");
00047 FlagType pad_flag;
00048 ElementTypePtr element;
00049 gint i;
00050 gint j;
00051
00052 if (!element)
00053 {
00054 if (verbose)
00055 g_log ("", G_LOG_LEVEL_WARNING,
00056 _("could not create a valid element pointer for a %s package."),
00057 footprint_type);
00058 return (EXIT_FAILURE);
00059 }
00060
00061
00062 element->MarkX = 0;
00063 element->MarkY = 0;
00064
00065
00066
00067
00068
00069 if ((multiplier * ((-package_body_length / 2.0) - courtyard_clearance_with_package)) < xmin)
00070 {
00071 xmin = (multiplier * ((-package_body_length / 2.0) - courtyard_clearance_with_package));
00072 }
00073 if ((multiplier * ((package_body_length / 2.0) + courtyard_clearance_with_package)) > xmax)
00074 {
00075 xmax = (multiplier * ((package_body_length / 2.0) + courtyard_clearance_with_package));
00076 }
00077 if ((multiplier * ((-package_body_width / 2.0) - courtyard_clearance_with_package)) < ymin)
00078 {
00079 ymin = (multiplier * ((-package_body_width / 2.0) - courtyard_clearance_with_package));
00080 }
00081 if ((multiplier * ((package_body_width / 2.0) + courtyard_clearance_with_package)) > ymax)
00082 {
00083 ymax = (multiplier * ((package_body_width / 2.0) + courtyard_clearance_with_package));
00084 }
00085
00086 if (multiplier * (-courtyard_length / 2.0) < xmin)
00087 {
00088 xmin = multiplier * (-courtyard_length / 2.0);
00089 }
00090 if (multiplier * (courtyard_length / 2.0) > xmax)
00091 {
00092 xmax = multiplier * (courtyard_length / 2.0);
00093 }
00094 if (multiplier * (-courtyard_width / 2.0) < ymin)
00095 {
00096 ymin = multiplier * (-courtyard_width / 2.0);
00097 }
00098 if (multiplier * (courtyard_width / 2.0) > ymax)
00099 {
00100 ymax = multiplier * (courtyard_width / 2.0);
00101 }
00102
00103 element->Name[1].Scale = 100;
00104 element->Name[1].X = 0.0 ;
00105 element->Name[1].Y = (ymin - 10000.0);
00106 element->Name[1].TextString = footprint_name;
00107 element->Name[1].Element = element;
00108 element->Name[1].Direction = EAST;
00109 element->Name[1].ID = ID++;
00110
00111 element->Name[2].Scale = 100;
00112 element->Name[2].X = 0.0 ;
00113 element->Name[2].Y = (ymin - 10000.0);
00114 element->Name[2].TextString = footprint_refdes;
00115 element->Name[2].Element = element;
00116 element->Name[2].Direction = EAST;
00117 element->Name[2].ID = ID++;
00118
00119 element->Name[3].Scale = 100;
00120 element->Name[3].X = 0.0 ;
00121 element->Name[3].Y = (ymin - 10000.0);
00122 element->Name[3].TextString = footprint_value;
00123 element->Name[3].Element = element;
00124 element->Name[3].Direction = EAST;
00125 element->Name[3].ID = ID++;
00126
00127 if (pad_shapes_type == SQUARE)
00128 {
00129 pad_flag.f = SQUARE;
00130 }
00131 else
00132 {
00133 pad_flag.f = CLEAR;
00134 }
00135 pin_number = 1;
00136 for (i = 0; (i < number_of_rows); i++)
00137
00138
00139
00140 {
00141 for (j = 0; (j < number_of_columns); j++)
00142
00143
00144 {
00145 if (pin1_square && (pin_number == 1))
00146 pad_flag.f = SQUARE;
00147 else
00148 pad_flag.f = CLEAR;
00149 pin_pad_name = g_strdup_printf ("%s%d", (row_letters[i]), (j + 1));
00150 if (get_pin_pad_exception (pin_pad_name))
00151 {
00152 create_new_pin
00153 (
00154 element,
00155 (int) (multiplier * ((((- number_of_columns -1) / 2.0) + 1 + j) * pitch_x)),
00156 (int) (multiplier * ((((-number_of_rows - 1) / 2.0) + 1 + i) * pitch_y)),
00157 (int) (multiplier * pad_diameter),
00158 (int) (multiplier * pad_clearance),
00159 (int) (multiplier * (pad_diameter + pad_solder_mask_clearance)),
00160 (int) (multiplier * pin_drill_diameter),
00161 pin_pad_name,
00162 g_strdup_printf ("%d", pin_number),
00163 pad_flag
00164 );
00165 }
00166 pin_number++;
00167 }
00168 }
00169
00170 if (courtyard)
00171 {
00172 create_new_line
00173 (
00174 element,
00175 (int) (multiplier * (-package_body_length / 2.0)),
00176 (int) (multiplier * (-package_body_width / 2.0)),
00177 (int) (multiplier * (-package_body_length / 2.0)),
00178 (int) (multiplier * (package_body_width / 2.0)),
00179 (int) (multiplier * silkscreen_line_width)
00180 );
00181 create_new_line
00182 (
00183 element,
00184 (int) (multiplier * (package_body_length / 2.0)),
00185 (int) (multiplier * (-package_body_width / 2.0)),
00186 (int) (multiplier * (package_body_length / 2.0)),
00187 (int) (multiplier * (package_body_width / 2.0)),
00188 (int) (multiplier * silkscreen_line_width)
00189 );
00190 create_new_line
00191 (
00192 element,
00193 (int) (multiplier * (-package_body_length / 2.0)),
00194 (int) (multiplier * (-package_body_width / 2.0)),
00195 (int) (multiplier * (package_body_length / 2.0)),
00196 (int) (multiplier * (-package_body_width / 2.0)),
00197 (int) (multiplier * silkscreen_line_width)
00198 );
00199 create_new_line
00200 (
00201 element,
00202 (int) (multiplier * (package_body_length / 2.0)),
00203 (int) (multiplier * (package_body_width / 2.0)),
00204 (int) (multiplier * (-package_body_length / 2.0)),
00205 (int) (multiplier * (package_body_width / 2.0)),
00206 (int) (multiplier * silkscreen_line_width)
00207 );
00208 }
00209
00210 if (silkscreen_indicate_1)
00211 {
00212 fprintf (fp, "# Write a pin 1 marker on the silkscreen\n");
00213 for (dx = 0.0; dx < (pitch_x / 2.0); dx = dx + silkscreen_line_width)
00214 {
00215 create_new_line
00216 (
00217 element,
00218 (int) (multiplier * (-package_body_length / 2.0)),
00219 (int) (multiplier * ((-package_body_width / 2.0) + dx)),
00220 (int) (multiplier * ((-package_body_length / 2.0) + dx)),
00221 (int) (multiplier * (-package_body_width / 2.0)),
00222 (int) (multiplier * silkscreen_line_width)
00223 );
00224 }
00225 }
00226
00227 if (courtyard)
00228 {
00229 create_new_line
00230 (
00231 element,
00232 (int) (xmin),
00233 (int) (ymin),
00234 (int) (xmin),
00235 (int) (ymax),
00236 (int) (multiplier * courtyard_line_width)
00237 );
00238 create_new_line
00239 (
00240 element,
00241 (int) (xmax),
00242 (int) (ymin),
00243 (int) (xmax),
00244 (int) (ymax),
00245 (int) (multiplier * courtyard_line_width)
00246 );
00247 create_new_line
00248 (
00249 element,
00250 (int) (xmin),
00251 (int) (ymin),
00252 (int) (xmax),
00253 (int) (ymin),
00254 (int) (multiplier * courtyard_line_width)
00255 );
00256 create_new_line
00257 (
00258 element,
00259 (int) (xmax),
00260 (int) (ymax),
00261 (int) (xmin),
00262 (int) (ymax),
00263 (int) (multiplier * courtyard_line_width)
00264 );
00265 }
00266
00267 if (attributes_in_footprint)
00268 {
00269 element = create_attributes_in_element (element);
00270 }
00271
00272 if (verbose)
00273 {
00274 g_log ("", G_LOG_LEVEL_INFO,
00275 _("created an element for a %s package: %s."),
00276 footprint_type,
00277 footprint_filename);
00278 }
00279 current_element = (ElementTypePtr) &element;
00280 return (EXIT_SUCCESS);
00281 }
00282
00283
00293 int
00294 pga_create_packages_list ()
00295 {
00296 g_list_free (packages_list);
00297 packages_list = g_list_append (packages_list, "PGA");
00298 return (EXIT_SUCCESS);
00299 }
00300
00301
00331 int
00332 pga_drc ()
00333 {
00334 int result = EXIT_SUCCESS;
00335 if (verbose)
00336 {
00337 g_log ("", G_LOG_LEVEL_INFO,
00338 (_("[%s] DRC Check: checking package %s.")),
00339 footprint_type, footprint_name);
00340 }
00341
00342 switch (pad_shapes_type)
00343 {
00344 case NO_SHAPE:
00345 {
00346 if (verbose)
00347 {
00348 g_log ("", G_LOG_LEVEL_WARNING,
00349 (_("[%s] DRC Error: NO_SHAPE specified for check for allowed pad shapes.")),
00350 footprint_type);
00351 }
00352 result = EXIT_FAILURE;
00353 break;
00354 }
00355 case ROUND:
00356 {
00357 break;
00358 }
00359 case SQUARE:
00360 {
00361 if (verbose)
00362 {
00363 g_log ("", G_LOG_LEVEL_WARNING,
00364 (_("[%s] DRC Error: square pad shape specified for check for allowed pad shapes.")),
00365 footprint_type);
00366 }
00367 result = EXIT_FAILURE;
00368 break;
00369 }
00370 case OCTAGONAL:
00371 {
00372 if (verbose)
00373 {
00374 g_log ("", G_LOG_LEVEL_WARNING,
00375 (_("[%s] DRC Error: octagonal pad shape specified for check for allowed pad shapes.")),
00376 footprint_type);
00377 }
00378 result = EXIT_FAILURE;
00379 break;
00380 }
00381 case ROUND_ELONGATED:
00382 {
00383 if (verbose)
00384 {
00385 g_log ("", G_LOG_LEVEL_WARNING,
00386 (_("[%s] DRC Error: round elongated pad shape specified for check for allowed pad shapes.")),
00387 footprint_type);
00388 }
00389 result = EXIT_FAILURE;
00390 break;
00391 }
00392 default:
00393 {
00394 if (verbose)
00395 {
00396 g_log ("", G_LOG_LEVEL_WARNING,
00397 (_("[%s] DRC Error: no valid pad shape type specified.")),
00398 footprint_type);
00399 }
00400 result = EXIT_FAILURE;
00401 break;
00402 }
00403 }
00404
00405 if (package_body_length <= 0.0)
00406 {
00407 if (verbose)
00408 {
00409 g_log ("", G_LOG_LEVEL_WARNING,
00410 (_("[%s] DRC Error: check for package body length is <= 0.0.")),
00411 footprint_type);
00412 }
00413 result = EXIT_FAILURE;
00414 }
00415 if (package_body_width <= 0.0)
00416 {
00417 if (verbose)
00418 {
00419 g_log ("", G_LOG_LEVEL_WARNING,
00420 (_("[%s] DRC Error: check for package body width is <= 0.0.")),
00421 footprint_type);
00422 }
00423 result = EXIT_FAILURE;
00424 }
00425 if (package_body_height <= 0.0)
00426 {
00427 if (verbose)
00428 {
00429 g_log ("", G_LOG_LEVEL_WARNING,
00430 (_("[%s] DRC Error: check for package body height is <= 0.0.")),
00431 footprint_type);
00432 }
00433 result = EXIT_FAILURE;
00434 }
00435
00436 if (courtyard_length <= 0.0)
00437 {
00438 if (verbose)
00439 {
00440 g_log ("", G_LOG_LEVEL_WARNING,
00441 (_("[%s] DRC Error: check for courtyard length is <= 0.0.")),
00442 footprint_type);
00443 }
00444 result = EXIT_FAILURE;
00445 }
00446 if (courtyard_width <= 0.0)
00447 {
00448 if (verbose)
00449 {
00450 g_log ("", G_LOG_LEVEL_WARNING,
00451 (_("[%s] DRC Error: check for courtyard width is <= 0.0.")),
00452 footprint_type);
00453 }
00454 result = EXIT_FAILURE;
00455 }
00456
00457 if (pitch_x - pad_diameter < pad_clearance)
00458 {
00459 if (verbose)
00460 {
00461 g_log ("", G_LOG_LEVEL_WARNING,
00462 (_("[%s] DRC Error: check for minimum clearance between copper (X-direction).")),
00463 footprint_type);
00464 }
00465 result = EXIT_FAILURE;
00466 }
00467
00468 if (pitch_y - pad_diameter < pad_clearance)
00469 {
00470 if (verbose)
00471 {
00472 g_log ("", G_LOG_LEVEL_WARNING,
00473 (_("[%s] DRC Error: check for minimum clearance between copper (Y-direction).")),
00474 footprint_type);
00475 }
00476 result = EXIT_FAILURE;
00477 }
00484 if (fiducial)
00485 {
00486
00487 if (fiducial_pad_diameter == 0.0)
00488 {
00489 if (verbose)
00490 {
00491 g_log ("", G_LOG_LEVEL_WARNING,
00492 (_("[%s] DRC Error: check for zero width fiducial pad.")),
00493 footprint_type);
00494 }
00495 result = EXIT_FAILURE;
00496 }
00497
00498 if (fiducial_pad_solder_mask_clearance == 0.0)
00499 {
00500 if (verbose)
00501 {
00502 g_log ("", G_LOG_LEVEL_WARNING,
00503 (_("[%s] DRC Error: check for zero width solder mask clearance.")),
00504 footprint_type);
00505 }
00506 result = EXIT_FAILURE;
00507 }
00508
00509
00510 #if 0
00511 if ()
00512 {
00513 if (verbose)
00514 {
00515 g_log ("", G_LOG_LEVEL_WARNING,
00516 (_("[%s] DRC Error: check for distance between fiducial and nearest pad.")),
00517 footprint_type);
00518 }
00519 result = EXIT_FAILURE;
00520 }
00521 #endif
00522 }
00523
00524
00525 if (package_body_length - courtyard_length < courtyard_clearance_with_package)
00526 {
00527 if (verbose)
00528 {
00529 g_log ("", G_LOG_LEVEL_WARNING,
00530 (_("[%s] DRC Error: check for clearance of the package length with regard to the courtyard dimensions.")),
00531 footprint_type);
00532 }
00533 result = EXIT_FAILURE;
00534 }
00535
00536
00537 if (package_body_width - courtyard_width < courtyard_clearance_with_package)
00538 {
00539 if (verbose)
00540 {
00541 g_log ("", G_LOG_LEVEL_WARNING,
00542 (_("[%s] DRC Error: check for clearance of the package width with regard to the courtyard dimensions.")),
00543 footprint_type);
00544 }
00545 result = EXIT_FAILURE;
00546 }
00552
00553 if (silkscreen_package_outline && (silkscreen_line_width == 0.0))
00554 {
00555 if (verbose)
00556 {
00557 g_log ("", G_LOG_LEVEL_WARNING,
00558 (_("[%s] DRC Error: line width 0.0 specified for check for a reasonable silk line width.")),
00559 footprint_type);
00560 }
00561 result = EXIT_FAILURE;
00562 }
00563 switch (units_type)
00564 {
00565 case NO_UNITS:
00566 {
00567 if (verbose)
00568 {
00569 g_log ("", G_LOG_LEVEL_WARNING,
00570 (_("[%s] DRC Error: no units specified for check for a reasonable silk line width.")),
00571 footprint_type);
00572 }
00573 result = EXIT_FAILURE;
00574 break;
00575 }
00576 case MIL:
00577 if (silkscreen_package_outline && (silkscreen_line_width > 40.0))
00578 {
00579 if (verbose)
00580 {
00581 g_log ("", G_LOG_LEVEL_WARNING,
00582 (_("[%s] DRC Error: line width > 40.0 mil specified check for a reasonable silk line width.")),
00583 footprint_type);
00584 }
00585 result = EXIT_FAILURE;
00586 break;
00587 }
00588 case MIL_100:
00589 if (silkscreen_package_outline && (silkscreen_line_width > 4000.0))
00590 {
00591 if (verbose)
00592 {
00593 g_log ("", G_LOG_LEVEL_WARNING,
00594 (_("[%s] DRC Error: line width > 40.0 mil specified check for a reasonable silk line width.")),
00595 footprint_type);
00596 }
00597 result = EXIT_FAILURE;
00598 break;
00599 }
00600 case MM:
00601 if (silkscreen_package_outline && (silkscreen_line_width > 1.0))
00602 {
00603 if (verbose)
00604 {
00605 g_log ("", G_LOG_LEVEL_WARNING,
00606 (_("[%s] DRC Error: line width > 1.0 mm specified check for a reasonable silk line width.")),
00607 footprint_type);
00608 }
00609 result = EXIT_FAILURE;
00610 break;
00611 }
00612 default:
00613 {
00614 if (verbose)
00615 {
00616 g_log ("", G_LOG_LEVEL_WARNING,
00617 (_("[%s] DRC Error: no valid units type specified for check for a reasonable silk line width.")),
00618 footprint_type);
00619 }
00620 result = EXIT_FAILURE;
00621 break;
00622 }
00623 }
00624
00625 if (verbose && (result == EXIT_SUCCESS))
00626 {
00627 g_log ("", G_LOG_LEVEL_INFO,
00628 (_("[%s] DRC Check: no errors while checking package %s.")),
00629 footprint_type, footprint_name);
00630 }
00631 return (result);
00632 }
00633
00634
00648 int
00649 pga_get_default_footprint_values ()
00650 {
00651 if (!strcmp (footprint_name, "?PGA100"))
00652 {
00653 footprint_units = g_strdup ("mm");
00654 number_of_pins = 100;
00655 package_body_width = 11.00;
00656 package_body_length = 11.00;
00657 package_body_height = 1.40;
00658 package_is_radial = FALSE;
00659 number_of_columns = 10;
00660 number_of_rows = 10;
00661 pitch_x = 1.00;
00662 pitch_y = 1.00;
00663 count_x = 0;
00664 count_y = 0;
00665 pad_shape = g_strdup ("circular pad");
00666 pin_drill_diameter = 0.0;
00667 pad_diameter = 0.40;
00668 pad_clearance = 0.15;
00669 pad_solder_mask_clearance = 0.15;
00670 courtyard_length = 13.00;
00671 courtyard_width = 13.00;
00672 silkscreen_length = 11.00;
00673 silkscreen_width = 11.00;
00674 g_free (footprint_name);
00675 footprint_name = g_strdup ("PGA100");
00676 return (EXIT_SUCCESS);
00677 }
00678 else
00679 {
00680 fprintf (stderr,
00681 _("WARNING: default values for footprint %s not found.\n"),
00682 footprint_name);
00683 return (EXIT_FAILURE);
00684 }
00685 return (EXIT_FAILURE);
00686 }
00687
00688
00689 #if GUI
00690
00697 int
00698 pga_set_gui_constraints ()
00699 {
00700
00701 GtkWidget *package_is_radial_checkbutton = lookup_widget (GTK_WIDGET (widget),
00702 "package_is_radial_checkbutton");
00703 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (package_is_radial_checkbutton), FALSE);
00704 gtk_widget_set_sensitive (package_is_radial_checkbutton, FALSE);
00705
00706
00707 GtkWidget *count_x_entry = lookup_widget (GTK_WIDGET (widget),
00708 "count_x_entry");
00709 gtk_entry_set_text (GTK_ENTRY (count_x_entry), "");
00710 gtk_widget_set_sensitive (count_x_entry, FALSE);
00711 GtkWidget *count_y_entry = lookup_widget (GTK_WIDGET (widget),
00712 "count_y_entry");
00713 gtk_entry_set_text (GTK_ENTRY (count_y_entry), "");
00714 gtk_widget_set_sensitive (count_y_entry, FALSE);
00715 GtkWidget *number_1_position_entry = lookup_widget (GTK_WIDGET (widget),
00716 "number_1_position_entry");
00717 gtk_combo_box_set_active (GTK_COMBO_BOX (number_1_position_entry), 1);
00718 gtk_widget_set_sensitive (number_1_position_entry, FALSE);
00719 GtkWidget *pin_pad_exceptions_button = lookup_widget (GTK_WIDGET (widget),
00720 "pin_pad_exceptions_button");
00721 gtk_widget_set_sensitive (pin_pad_exceptions_button, TRUE);
00722 GtkWidget *pad_shape_entry = lookup_widget (GTK_WIDGET (widget),
00723 "pad_shape_entry");
00724 gtk_combo_box_set_active (GTK_COMBO_BOX (pad_shape_entry), 1);
00725 gtk_widget_set_sensitive (pad_shape_entry, FALSE);
00726 GtkWidget *pad_length_entry = lookup_widget (GTK_WIDGET (widget),
00727 "pad_length_entry");
00728 gtk_entry_set_text (GTK_ENTRY (pad_length_entry), "");
00729 gtk_widget_set_sensitive (pad_length_entry, FALSE);
00730 GtkWidget *pad_width_entry = lookup_widget (GTK_WIDGET (widget),
00731 "pad_width_entry");
00732 gtk_entry_set_text (GTK_ENTRY (pad_width_entry), "");
00733 gtk_widget_set_sensitive (pad_width_entry, FALSE);
00734
00735
00736 gui_constraints_disable_thermal_tab_widgets (widget);
00737
00738
00739 gui_constraints_disable_heel_and_toe_goals_tab_widgets (widget);
00740 return (EXIT_SUCCESS);
00741 }
00742 #endif
00743
00744
00751 int
00752 pga_write_footprint ()
00753 {
00754 gdouble xmax;
00755 gdouble xmin;
00756 gdouble ymax;
00757 gdouble ymin;
00758 gdouble x_text;
00759 gdouble y_text;
00760 gdouble dx;
00761 gint pin_number;
00762 gchar *pin_pad_name = g_strdup ("");
00763 gchar *pin_pad_flags = g_strdup ("");
00764 gint i;
00765 gint j;
00766
00767
00768 fp = fopen (footprint_filename, "w");
00769 if (!fp)
00770 {
00771 g_log ("", G_LOG_LEVEL_WARNING,
00772 _("could not open file for %s footprint: %s."),
00773 footprint_type, footprint_filename);
00774 fclose (fp);
00775 return (EXIT_FAILURE);
00776 }
00777
00778 if (license_in_footprint)
00779 {
00780 write_license ();
00781 }
00782
00783
00784 xmin = multiplier *
00785 (
00786 ((-pitch_x * number_of_columns) / 2.0) -
00787 (pad_diameter / 2.0) -
00788 pad_solder_mask_clearance
00789 );
00790 xmax = multiplier *
00791 (
00792 ((pitch_x * number_of_columns) / 2.0) +
00793 (pad_diameter / 2.0) +
00794 pad_solder_mask_clearance
00795 );
00796 ymin = multiplier *
00797 (
00798 ((-pitch_y * number_of_rows) / 2.0) -
00799 (pad_diameter / 2.0) -
00800 pad_solder_mask_clearance
00801 );
00802 ymax = multiplier *
00803 (
00804 ((pitch_y * number_of_rows) / 2.0) +
00805 (pad_diameter / 2.0) +
00806 pad_solder_mask_clearance
00807 );
00808
00809
00810 if ((multiplier * ((-package_body_length / 2.0) - courtyard_clearance_with_package)) < xmin)
00811 xmin = (multiplier * ((-package_body_length / 2.0) - courtyard_clearance_with_package));
00812 if ((multiplier * ((package_body_length / 2.0) + courtyard_clearance_with_package)) > xmax)
00813 xmax = (multiplier * ((package_body_length / 2.0) + courtyard_clearance_with_package));
00814 if ((multiplier * ((-package_body_width / 2.0) - courtyard_clearance_with_package)) < ymin)
00815 ymin = (multiplier * ((-package_body_width / 2.0) - courtyard_clearance_with_package));
00816 if ((multiplier * ((package_body_width / 2.0) + courtyard_clearance_with_package)) > ymax)
00817 ymax = (multiplier * ((package_body_width / 2.0) + courtyard_clearance_with_package));
00818
00819 if (multiplier * (-courtyard_length / 2.0) < xmin)
00820 xmin = multiplier * (-courtyard_length / 2.0);
00821 if (multiplier * (courtyard_length / 2.0) > xmax)
00822 xmax = multiplier * (courtyard_length / 2.0);
00823 if (multiplier * (-courtyard_width / 2.0) < ymin)
00824 ymin = multiplier * (-courtyard_width / 2.0);
00825 if (multiplier * (courtyard_width / 2.0) > ymax)
00826 ymax = multiplier * (courtyard_width / 2.0);
00827
00828
00829 x_text = 0.0 ;
00830 y_text = (ymin - 10000.0);
00831 write_element_header (x_text, y_text);
00832
00833 pin_number = 1;
00834 for (i = 0; (i < number_of_rows); i++)
00835
00836
00837
00838 {
00839 for (j = 0; (j < number_of_columns); j++)
00840
00841
00842 {
00843 if (pin1_square && (pin_number == 1))
00844 pin_pad_flags = g_strdup ("square");
00845 else
00846 pin_pad_flags = g_strdup ("");
00847 pin_pad_name = g_strdup_printf ("%s%d", (row_letters[i]), (j + 1));
00848 if (get_pin_pad_exception (pin_pad_name))
00849 {
00850 write_pin
00851 (
00852 pin_number,
00853 pin_pad_name,
00854 multiplier * ((((- number_of_columns -1) / 2.0) + 1 + j) * pitch_x),
00855 multiplier * ((((-number_of_rows - 1) / 2.0) + 1 + i) * pitch_y),
00856 multiplier * pad_diameter,
00857 multiplier * pad_clearance,
00858 multiplier * (pad_diameter + pad_solder_mask_clearance),
00859 multiplier * pin_drill_diameter,
00860 pin_pad_flags
00861 );
00862 }
00863 pin_number++;
00864 }
00865 }
00866
00867 if (silkscreen_package_outline)
00868 {
00869 fprintf (fp, "# Write a package body on the silkscreen\n");
00870 write_rectangle
00871 (
00872 multiplier * (-package_body_length / 2.0),
00873 multiplier * (-package_body_width / 2.0),
00874 multiplier * (package_body_length / 2.0),
00875 multiplier * (package_body_width / 2.0),
00876 multiplier * silkscreen_line_width
00877 );
00878 }
00879
00880 if (silkscreen_indicate_1)
00881 {
00882 fprintf (fp, "# Write a pin 1 marker on the silkscreen\n");
00883 for (dx = 0.0; dx < (pitch_x / 2.0); dx = dx + silkscreen_line_width)
00884 {
00885 write_element_line
00886 (
00887 multiplier * (-package_body_length / 2.0),
00888 multiplier * ((-package_body_width / 2.0) + dx),
00889 multiplier * ((-package_body_length / 2.0) + dx),
00890 multiplier * (-package_body_width / 2.0),
00891 multiplier * (silkscreen_line_width)
00892 );
00893 }
00894 }
00895
00896 if (courtyard)
00897 {
00898 fprintf (fp, "# Write a courtyard on the silkscreen\n");
00899 write_rectangle
00900 (
00901 xmin,
00902 ymin,
00903 xmax,
00904 ymax,
00905 multiplier * courtyard_line_width
00906 );
00907 }
00908
00909 if (attributes_in_footprint)
00910 {
00911 write_attributes ();
00912 }
00913
00914 fprintf (fp, "\n");
00915 fprintf (fp, ")\n");
00916 fclose (fp);
00917
00918 if (verbose)
00919 {
00920 g_log ("", G_LOG_LEVEL_INFO,
00921 _("wrote a footprint for a %s package: %s."),
00922 footprint_type,
00923 footprint_filename);
00924 }
00925 return (EXIT_SUCCESS);
00926 }
00927
00928
00932 static fpw_function_t
00933 pga_function_list[] =
00934 {
00935 #if GUI
00936 {
00937 "Set GUI constraints",
00938 pga_set_gui_constraints,
00939 "Set GUI constraints for a PGA package",
00940 NULL
00941 },
00942 #endif
00943 {
00944 "Create element",
00945 pga_create_element,
00946 "Create an element for a PGA package",
00947 NULL
00948 },
00949 {
00950 "Create Packages List",
00951 pga_create_packages_list,
00952 "Create a list of known PGA packages",
00953 NULL
00954 },
00955 {
00956 "DRC PGA Element",
00957 pga_drc,
00958 "Design Rule Check for a PGA package",
00959 NULL
00960 },
00961 {
00962 "Default Element Values",
00963 pga_get_default_footprint_values,
00964 "Get default values for a selected PGA package",
00965 NULL
00966 },
00967 {
00968 "Write footprint",
00969 pga_write_footprint,
00970 "Write a footprint for a selected PGA package",
00971 NULL
00972 }
00973 };
00974
00975
00976 REGISTER_FUNCTIONS (pga_function_list)
00977
00978
00979
00982 void
00983 pga_init ()
00984 {
00985 register_pga_function_list ();
00986 }
00987
00988
00989