FreeBSD Bugzilla – Attachment 125471 Details for
Bug 169090
New Port: comms/ge-x2212-2 An EEPROM programmer for GE Phoenix SX Radios
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
file.shar
file.shar (text/plain), 18.39 KB, created by
Stephen Hurd
on 2012-06-15 05:40:01 UTC
(
hide
)
Description:
file.shar
Filename:
MIME Type:
Creator:
Stephen Hurd
Created:
2012-06-15 05:40:01 UTC
Size:
18.39 KB
patch
obsolete
># This is a shell archive. Save it in a file, remove anything before ># this line, and then unpack it by entering "sh file". Note, it may ># create directories; files and directories will be owned by you and ># have default permissions. ># ># This archive contains: ># ># ge-x2212-2 ># ge-x2212-2/Makefile ># ge-x2212-2/distinfo ># ge-x2212-2/files ># ge-x2212-2/files/patch-all ># ge-x2212-2/files/schematic.txt ># ge-x2212-2/pkg-descr ># >echo c - ge-x2212-2 >mkdir -p ge-x2212-2 > /dev/null 2>&1 >echo x - ge-x2212-2/Makefile >sed 's/^X//' >ge-x2212-2/Makefile << '88180f40bca5cea79a332bf47957d342' >X# New ports collection makefile for: ge-x2212-2 >X# Date created: 2012-06-14 >X# Whom: Stephen Hurd <shurd@sasktel.net> >X# >X# $FreeBSD: $ >X# >X >XPORTNAME= ge-x2212-2 >XPORTVERSION= 0.0.2010.09.15 >XCATEGORIES= comms hamradio >XMASTER_SITES= http://members.shaw.ca/swstuff/ >XDISTNAME= ${PORTNAME}-15sept2010 >X >XMAINTAINER= shurd@sasktel.net >XCOMMENT= An EEPROM programmer for GE Phoenix SX Radios >X >XWRKSRC= ${WRKDIR}/${PORTNAME} >XUSE_GNOME= libgnomeui >XGNU_CONFIGURE= yes >X >XPLIST_FILES= bin/ge-x2212-2 >XPORTDOCS= schematic.txt >X >Xpost-install: >X.if !defined(NOPORTDOCS) >X ${MKDIR} ${DOCSDIR} >X ${INSTALL_MAN} ${FILESDIR}/schematic.txt ${DOCSDIR} >X.endif >X >X.include <bsd.port.mk> >88180f40bca5cea79a332bf47957d342 >echo x - ge-x2212-2/distinfo >sed 's/^X//' >ge-x2212-2/distinfo << '153557d86a7797fdbe9249b2ff118923' >XSHA256 (ge-x2212-2-15sept2010.tar.gz) = c1f11a29c32c7b115e178efce0da8564dff3bb5bc154bbb0c68814ea0e0a908b >XSIZE (ge-x2212-2-15sept2010.tar.gz) = 225098 >153557d86a7797fdbe9249b2ff118923 >echo c - ge-x2212-2/files >mkdir -p ge-x2212-2/files > /dev/null 2>&1 >echo x - ge-x2212-2/files/patch-all >sed 's/^X//' >ge-x2212-2/files/patch-all << '802054332547d83be21b2b69a958f821' >Xdiff -ur ../ge-x2212-2/src/callbacks.c ./src/callbacks.c >X--- ../ge-x2212-2/src/callbacks.c 2010-09-15 17:10:17.000000000 -0700 >X+++ ./src/callbacks.c 2012-06-14 02:20:04.000000000 -0700 >X@@ -9,6 +9,11 @@ >X #include "interface.h" >X #include "support.h" >X >X+#ifdef USE_PPI_DEV >X+#include <dev/ppbus/ppi.h> >X+#include <dev/ppbus/ppbconf.h> >X+#endif >X+ >X >X #ifdef __GLIBC__ >X #include <sys/io.h> >X@@ -20,6 +25,7 @@ >X #define DIRBIT 0x20 >X >X extern GtkWidget *app1; >X+extern gboolean uhf; >X >X // new port defines to get 0x378 working on lp0 >X #define LPTBASE 0x378 >X@@ -76,6 +82,36 @@ >X "ch09cct", "ch10cct", "ch11cct", "ch12cct", >X "ch13cct", "ch14cct", "ch15cct", "ch16cct" }; >X >X+#ifdef USE_PPI_DEV >X+static void ppi_outb(u_int8_t outb_val, int addr) { >X+ int outb_action=-1; >X+ >X+ if(addr==LPTBASE || addr==LPTDAT) >X+ outb_action=PPISDATA; >X+ else if(addr==LPTSTAT) >X+ outb_action=PPISSTATUS; >X+ else if(addr==LPTCTRL) >X+ outb_action=PPISCTRL; >X+ ioctl(fd0, outb_action, &outb_val); >X+} >X+ >X+static u_int8_t ppi_inb(int addr) >X+{ >X+ u_int8_t ret=0; >X+ >X+ if(addr==LPTBASE || addr==LPTDAT) >X+ ioctl(fd0, PPIGDATA, &ret); >X+ else if(addr==LPTSTAT) >X+ ioctl(fd0, PPIGSTATUS, &ret); >X+ else if(addr==LPTCTRL) >X+ ioctl(fd0, PPIGCTRL, &ret); >X+ return ret; >X+} >X+ >X+#define outb(v,a) ppi_outb((v),(a)) >X+#define inb(a) ppi_inb(a) >X+#endif >X+ >X /* convert 2 ascii chars in hex to a decimal number */ >X static int hex2( unsigned char a, unsigned char b) >X { >X@@ -111,7 +147,9 @@ >X /* release parallel port */ >X if (fd0 > 0) >X close(fd0); >X+#ifndef USE_PPI_DEV >X ioperm(LPTDAT, 3, 0); >X+#endif >X } >X //===================================================================== >X // >X@@ -209,6 +247,7 @@ >X case 0x03: space = 6250.0; break; >X default: fprintf(stderr,"Invalid channel spacing code %d\n",r); >X } >X+ if(uhf) space *= 3; >X >X // g_print("ref = %fhz, spacing = %fhz \n",ref,space); >X >X@@ -736,6 +775,35 @@ >X return 0; >X } >X >X+gboolean freq_good(double freq) >X+{ >X+ if(uhf) >X+ return ( freq >= 134.33*3 && freq <= 185.66*3 ); >X+ return ( freq >= 136.0 && freq <= 174.0 ); >X+} >X+ >X+int calc_divisor(double freq, double space, gboolean is_rx) >X+{ >X+ int divisor = (((freq + (is_rx?45.0:0))*1e6) + (space/2.0)) / space; >X+ /* Out of range... */ >X+ if(divisor > 0xffff || divisor < 0) >X+ divisor=0; >X+ return divisor; >X+} >X+ >X+double calc_realfreq(int divisor, double space, gboolean is_rx) >X+{ >X+ return ((divisor * space ) - (is_rx?45e6:0))/1e6; /* in mhz */ >X+} >X+ >X+void fill_ch(unsigned char *chbuff, int divisor) >X+{ >X+ chbuff[1] = ( divisor & 0x8000) >> 12; >X+ chbuff[2] = (divisor & 0x780) >> 7; >X+ chbuff[3] = (divisor & 0x7800) >> 11; >X+ chbuff[4] = divisor & 0xf; >X+ chbuff[5] = ((divisor & 0x30) >> 4) + ((divisor & 0x40) >> 3); >X+} >X >X //===================================================================== >X // >X@@ -743,15 +811,37 @@ >X //===================================================================== >X void encoderom( void ) >X { >X- int i; >X+ int i,j; >X int chan; >X- double freq, realfreq; >X+ double realfreq; >X+ double rx_freq; >X+ double tx_freq; >X int divisor; >X unsigned char *chbuff; >X- >X+ double spaces[3]; >X+ double errors[3]; >X+ int spacecode[3]; >X+ int sc_idx; >X+ >X+ if(uhf) { >X+ spaces[0]=12500.0; >X+ spaces[1]=15000.0; >X+ spaces[2]=18750.0; >X+ spacecode[0]=1; >X+ spacecode[1]=2; >X+ spacecode[2]=3; >X+ } >X+ else { >X+ spaces[0]=5000.0; >X+ spaces[1]=12500.0/3.0; >X+ spaces[2]=6250.0; >X+ spacecode[0]=2; >X+ spacecode[1]=1; >X+ spacecode[2]=3; >X+ } >X GtkWidget *wid; >X G_CONST_RETURN gchar *txt; >X- >X+ >X /* start with a clean image */ >X memset(x2212,0,sizeof(x2212)); >X >X@@ -778,55 +868,61 @@ >X /* single digit conversion */ >X x2212[0x40] = hex2bin(txt[0]) - 1; >X >X- /* number of channels in radio... to do this we need to look */ >X- /* at all the rx channels and count any in the range of 136-174 */ >X- chan = 0; >X- for ( i = 0; i<16; i++ ) >X- { >X- wid = lookup_widget(app1,rxfreq[i]); >X- txt = gtk_entry_get_text((GtkEntry *)wid); >X- freq = atof(txt); >X- if ( freq >= 136.0 && freq <= 174.0 ) chan++; >X- } >X- if ( chan < 1 ) >X- fprintf(stderr,"Warning, no valid channels found\n"); >X- x2212[0x80] = chan - 1; >X- >X+ chan=0; >X /* now lets fill in all the channels */ >X for ( i = 0; i<16; i++ ) >X { >X /* rx freq lookup off the screen */ >X wid = lookup_widget(app1,rxfreq[i]); >X txt = gtk_entry_get_text((GtkEntry *)wid); >X- freq = atof(txt); >X+ rx_freq = atof(txt); >X+ >X+ if ( !freq_good(rx_freq) ) { >X+ if(rx_freq > 0) >X+ g_printf("Warning, ignoring and removing invalid channel %d\n",i+1); >X+ continue; >X+ } >X+ chan++; >X+ if(chan != i+1) >X+ g_printf("Warning, channel %d will be renumbered to %d\n",i+1,chan); >X+ >X+ /* tx freq lookup off the screen */ >X+ wid = lookup_widget(app1,txfreq[i]); >X+ txt = gtk_entry_get_text((GtkEntry *)wid); >X+ tx_freq = atof(txt); >X+ >X+ for(j=0; j<3; j++) { >X+ divisor = calc_divisor(rx_freq, spaces[j], TRUE); >X+ realfreq = calc_realfreq(divisor, spaces[j], TRUE); /* in mhz */ >X+ errors[j] = fabs(rx_freq-realfreq); >X+ divisor = calc_divisor(tx_freq, spaces[j], FALSE); >X+ realfreq = calc_realfreq(divisor, spaces[j], FALSE); /* in mhz */ >X+ errors[j] += fabs(tx_freq-realfreq)*2; >X+ } >X+ sc_idx=0; >X+ for(j=1; j<3; j++) { >X+ if(errors[j] < errors[sc_idx]) >X+ sc_idx=j; >X+ } >X+// if(sc_idx) >X+// g_printf("Using non-standard spacing of %fHz for channel %d\n",spaces[sc_idx],i+1); >X >X- /* 3 gross assumptions!!!, timebomb below */ >X ref = 13.2e6; >X- space = 5000.0; >X-#define REFCODE 2 >X >X /* point to the 8 bytes of rx channel data for specified channel */ >X- chbuff = &x2212[0] + (((i+1) % 16) * 16); >X+ chbuff = &x2212[0] + ((chan % 16) * 16); >X /* there are 20 packed bits of freq info... lets build the numbers */ >X >X /* fill in info for valid rx channels */ >X- if ( freq >= 136.0 && freq <= 174.0 ) >X+ if ( freq_good(rx_freq) ) >X { >X- /* we have a choice of 3 ch spacings when building info */ >X- /* for a particular rx and tx channel pair */ >X- /* as a start, we assume 5khz will do.. should probably */ >X- /* try all 3 and use the one with the least error */ >X- divisor = (((freq + 45.0)*1e6) + (space/2.0)) / space; >X- realfreq = ((divisor * space ) - 45e6)/1e6; /* in mhz */ >X- if ( fabs(freq-realfreq) > 0.001 ) >X+ divisor = calc_divisor(rx_freq, spaces[sc_idx], TRUE); >X+ realfreq = calc_realfreq(divisor, spaces[sc_idx], TRUE); /* in mhz */ >X+ if ( fabs(rx_freq-realfreq) > 0.001 ) >X fprintf(stderr,"Warning ch %d freq error: %f <> %fmhz\n", >X- i+1,realfreq,freq); >X- chbuff[1] = REFCODE + (( divisor & 0x8000) >> 12); >X- chbuff[2] = (divisor & 0x780) >> 7; >X- chbuff[3] = (divisor & 0x7800) >> 11; >X- chbuff[4] = divisor & 0xf; >X- chbuff[5] = ((divisor & 0x30) >> 4) + ((divisor & 0x40) >> 3); >X- >X+ i+1,realfreq,rx_freq); >X+ fill_ch(chbuff, divisor); >X+ chbuff[1] |= spacecode[sc_idx]; >X } >X /* fill in the rx cg code (1st 2 digits of entrybox) */ >X wid = lookup_widget(app1,rxcg[i]); >X@@ -835,28 +931,19 @@ >X chbuff[7] = hex2bin(txt[1]); >X >X /* now fill in the tx info */ >X- /* tx freq lookup off the screen */ >X- wid = lookup_widget(app1,txfreq[i]); >X- txt = gtk_entry_get_text((GtkEntry *)wid); >X- freq = atof(txt); >X- >X /* point to the 8 bytes of tx channel data for specified channel */ >X- chbuff = &x2212[0] + (((i+1) % 16) * 16) + 8; >X+ chbuff = &x2212[0] + ((chan % 16) * 16) + 8; >X /* there are 20 packed bits of freq info... lets build the numbers */ >X >X /* fill in info for valid tx channels */ >X- if ( freq >= 136.0 && freq <= 174.0 ) >X+ if ( freq_good(tx_freq) ) >X { >X- divisor = ((freq*1e6) + (space/2.0)) / space; >X- realfreq = divisor * space /1e6; /* in mhz */ >X- if ( fabs(freq-realfreq) > 0.001 ) >X+ divisor = calc_divisor(tx_freq, spaces[sc_idx], FALSE); >X+ realfreq = calc_realfreq(divisor, spaces[sc_idx], FALSE); /* in mhz */ >X+ if ( fabs(tx_freq-realfreq) > 0.001 ) >X fprintf(stderr,"Warning ch %d freq error: %f <> %fmhz\n", >X- i+1,realfreq,freq); >X- chbuff[1] = ( divisor & 0x8000) >> 12; >X- chbuff[2] = (divisor & 0x780) >> 7; >X- chbuff[3] = (divisor & 0x7800) >> 11; >X- chbuff[4] = divisor & 0xf; >X- chbuff[5] = ((divisor & 0x30) >> 4) + ((divisor & 0x40) >> 3); >X+ i+1,realfreq,tx_freq); >X+ fill_ch(chbuff, divisor); >X } >X /* fill in the tx cg code (1st 2 digits of entrybox) */ >X wid = lookup_widget(app1,txcg[i]); >X@@ -869,6 +956,11 @@ >X if (gtk_toggle_button_get_active((GtkToggleButton *)wid)) >X chbuff[1] = chbuff[1] + 0x04; >X } >X+ /* number of channels in radio... to do this we need to look */ >X+ /* at all the rx channels and count any in the range of 136-174 */ >X+ if ( chan < 1 ) >X+ fprintf(stderr,"Warning, no valid channels found\n"); >X+ x2212[0x80] = chan - 1; >X } >X >X >X@@ -1148,19 +1240,30 @@ >X } >X >X /* to read and write to the parallel port, we need it open as root */ >X+#ifdef USE_PPI_DEV >X+ fd0 = open("/dev/ppi0", O_RDWR | O_NONBLOCK); >X+#else >X fd0 = open("/dev/lp0", O_RDWR | O_NONBLOCK); >X+#endif >X if (fd0 >= 0) >X { >X+#ifndef USE_PPI_DEV >X int stat = ioperm(LPTDAT, 3, 1); >X if ( stat == -1 ) >X perror("ioperm failed "); >X+#endif >X } >X else >X { >X+#ifdef USE_PPI_DEV >X+ fprintf(stderr,"\n\n*** open on /dev/ppi0 failed...Do you have permission?\n"); >X+ perror("/dev/lp0"); >X+#else >X fprintf(stderr,"\n\n*** open on /dev/lp0 failed...Do you have permission?\n"); >X fprintf(stderr,"*** you may need to 'sudo modprobe parport_pc'\n"); >X fprintf(stderr,"*** 'sudo ge-x2212-2'\n"); >X perror("/dev/lp0"); >X+#endif >X done(); >X } >X // g_print("Using port: 0x%x \n", LPTDAT); >Xdiff -ur ../ge-x2212-2/src/callbacks.h ./src/callbacks.h >X--- ../ge-x2212-2/src/callbacks.h 2004-09-27 13:13:40.000000000 -0700 >X+++ ./src/callbacks.h 2012-06-07 09:34:52.000000000 -0700 >X@@ -1,5 +1,8 @@ >X #include <gnome.h> >X >X+#ifdef __FreeBSD__ >X+#define USE_PPI_DEV >X+#endif >X >X void >X on_new1_activate (GtkMenuItem *menuitem, >Xdiff -ur ../ge-x2212-2/src/interface.c ./src/interface.c >X--- ../ge-x2212-2/src/interface.c 2010-09-15 17:33:07.000000000 -0700 >X+++ ./src/interface.c 2012-06-14 02:09:15.000000000 -0700 >X@@ -18,6 +18,8 @@ >X #include "interface.h" >X #include "support.h" >X >X+extern gboolean uhf; >X+ >X #define GLADE_HOOKUP_OBJECT(component,widget,name) \ >X gtk_object_set_data_full (GTK_OBJECT (component), name, \ >X gtk_widget_ref (widget), (GtkDestroyNotify) gtk_widget_unref) >X@@ -267,7 +269,7 @@ >X GtkWidget *combo_entry5; >X GtkWidget *appbar1; >X >X- app1 = gnome_app_new ("Ge-x2212-2", "GE Phoenix SX X2212 EEProm programmer (VHF 16ch scan) by Lawrence Glaister VE7IT 15-Sept-2010"); >X+ app1 = gnome_app_new ("Ge-x2212-2", uhf?"GE Phoenix SX X2212 EEProm programmer (UHF 16ch scan) by Lawrence Glaister VE7IT 15-Sept-2010":"GE Phoenix SX X2212 EEProm programmer (VHF 16ch scan) by Lawrence Glaister VE7IT 15-Sept-2010"); >X >X bonobodock1 = GNOME_APP (app1)->dock; >X gtk_widget_show (bonobodock1); >X@@ -678,7 +680,7 @@ >X gtk_table_attach (GTK_TABLE (table1), ch01rx, 1, 2, 1, 2, >X (GtkAttachOptions) (0), >X (GtkAttachOptions) (0), 2, 2); >X- gtk_entry_set_text (GTK_ENTRY (ch01rx), "146.5200"); >X+ gtk_entry_set_text (GTK_ENTRY (ch01rx), uhf?"446.0000":"146.5200"); >X gtk_entry_set_width_chars (GTK_ENTRY (ch01rx), 9); >X >X ch02rx = gtk_entry_new (); >X@@ -742,7 +744,7 @@ >X gtk_table_attach (GTK_TABLE (table1), ch01tx, 3, 4, 1, 2, >X (GtkAttachOptions) (0), >X (GtkAttachOptions) (0), 2, 2); >X- gtk_entry_set_text (GTK_ENTRY (ch01tx), "146.5200"); >X+ gtk_entry_set_text (GTK_ENTRY (ch01tx), uhf?"446.0000":"146.5200"); >X gtk_entry_set_width_chars (GTK_ENTRY (ch01tx), 9); >X >X ch02tx = gtk_entry_new (); >Xdiff -ur ../ge-x2212-2/src/main.c ./src/main.c >X--- ../ge-x2212-2/src/main.c 2004-09-26 22:10:30.000000000 -0700 >X+++ ./src/main.c 2012-06-13 22:04:32.000000000 -0700 >X@@ -14,14 +14,31 @@ >X >X /* globval so we can do widget lookups */ >X GtkWidget *app1; >X+gboolean uhf=FALSE; >X >X int >X main (int argc, char *argv[]) >X { >X+ gchar **remaining_args = NULL; >X+ GOptionEntry option_entries[] = { >X+ { "uhf", >X+ 'u', >X+ 0, >X+ G_OPTION_ARG_NONE, >X+ &uhf, >X+ "Use UHF rather than VHF calculations", >X+ NULL >X+ }, >X+ { NULL } >X+ }; >X+ GOptionContext *option_context; >X+ option_context = g_option_context_new (NULL); >X+ g_option_context_add_main_entries (option_context, option_entries, NULL); >X >X gnome_program_init (PACKAGE, VERSION, LIBGNOMEUI_MODULE, >X argc, argv, >X GNOME_PARAM_APP_DATADIR, PACKAGE_DATA_DIR, >X+ GNOME_PARAM_GOPTION_CONTEXT, option_context, >X NULL); >X >X /* >X@@ -31,7 +48,6 @@ >X */ >X app1 = create_app1 (); >X >X- >X gtk_widget_show (app1); >X >X gtk_main (); >802054332547d83be21b2b69a958f821 >echo x - ge-x2212-2/files/schematic.txt >sed 's/^X//' >ge-x2212-2/files/schematic.txt << '1ad63b8ee23ed0b3deac12ad3041caaf' >X X2212 programmer schematic >X >XParallel port X2212 / X22C12 eeprom >X >X2 (D0) ------------+---------------------------------------- 6 (A0) >X3 (D1) ----------+-|---------------------------------------- 5 (A1) >X4 (D2) --------+-|-|---------------------------------------- 4 (A2) >X5 (D3) ------+-|-|-|---------------------------------------- 3 (A3) >X6 (D4) ------|-|-|-|---------------------------------------- 2 (A4) >X7 (D5) ------|-|-|-|---------------------------------------- 16 (A5) >X8 (D6) ------|-|-|-|---------------------------------------- 17 (A6) >X9 (D7) ------|-|-|-|---------------------------------------- 1 (A7) >X | | | | +------------+ >X | | | +--|3 d0 q0 2|-------+---------------- 12 (D0) >X | | +----|4 d1 q1 5|-------|-+-------------- 13 (D1) >X | +------|7 d2 q2 6|-------|-|-+------------ 14 (D2) >X +--------|8 d3 q3 9|-------|-|-|-+---------- 15 (D3) >X +--|1 /OE LE 11|--+ | | | | >X | +------------+ | | | | | >X | 74xx373 or 374 | | | | | >X1 (/C0) -----------+------------------+----|-|-|-|---------- 11 (/WE) >X | | | | >X15 (S3) -----------------------------------+ | | | >X13 (S4) -------------------------------------+ | | >X12 (S5) ---------------------------------------+ | >X10 (S6) -----------------------------------------+ >X >X14 (/C1) --------------------------------------------------> 7 (/CS) >X16 (C2) --------------------------------------------------> 9 (/STORE) >X17 (/C3) --------------------------------------------------> 10 (/RECALL) >X >XAlso connect grounds: pins 18-25 on LPTx -> pin 10 on '373 -> pin 8 on 2212 >XConnect 5V to pin 20 on '373, and pin 18 on 2212. If you dont trust your >X5v supply, put a 5.1v zener across the X2212 power pins and use a 10ohm >Xquarter watt resistor in series with the plus supply lead. This may save >Xthe logic chips if you hook it up to 12 volts by mistake (it will certainly >Xlet you know by letting the smoke out of the resistor!). >1ad63b8ee23ed0b3deac12ad3041caaf >echo x - ge-x2212-2/pkg-descr >sed 's/^X//' >ge-x2212-2/pkg-descr << '2cb0ed2017b3faba35a47bf8e726a896' >XThis program is a software package for programming the X22C12 EEPROM in the GE >XPhoenix SX radios (specifically the VHF and UHF 16 channel scanning versions). >XThe X2212 is removed from the radio, placed in the parallel port adaper socket >Xand can be read/written/verified or archived. The prom contents can be saved >Xin a hex file format or exported as a text file for printing. Changing >Xfrequencies and channel guard settings is as easy as filling in the blanks. >X >XWWW: http://members.shaw.ca/swstuff/phoenix2212.html >2cb0ed2017b3faba35a47bf8e726a896 >exit
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 169090
: 125471