![]() |
|
If you can't view the Datasheet, Please click here to try to view without PDF Reader . |
|
Datasheet File OCR Text: |
a engineer to engineer note ee-158 technical notes on using analog devices ? dsp components and development tools phone: ? (800) ? analog-d, ? fax: ? (781) ? 461-3010, ? email: ? dsp.support@analog.com, ? ftp: ? ftp.analog.com, ? web: ? www.analog.com/dsp ? copyright ? 2002, ? analog ? devices, ? inc. ? all ? rights ? reserved. ? analog ? devices ? assumes ? no ? responsibility ? for ? customer ? product ? design ? or ? the ? use ? or ? application ? of ? customers ? products ? or ? for ? any ? infringements ? of ? patents ? or ? rights ? of ? others ? which ? may ? result ? from ? analog ? devices ? assistance. ? all ? trademarks ? and ? logos ? are ? property ? of ? their ? respective ? holders. ?? information ? furnished ? by ? analog ? devices ? applications ? and ? development ? tools ? engineers ? is ? believed ? to ? be ? accurate ? and ? reliable, ? however ? no ? responsibility ? is ? assumed ? by ? analog ? devices ? regarding ? the ? technical ? accuracy ? of ? the ? content ? provided ? in ? all ? analog ? devices ? engineer-to-engineer ? notes. ? adsp-2181 ? ez-kit ? lite ? idma ? to ? pc ? printer ? port ? interface ? contributed ? by ? hs, ? last ? change ? 11-apr-2002 ? introduction: ? the ? adsp-218x ? family ? can ? be ? used ? either ? in ? host ? or ? full ? memory ? interface ? configuration, ? adsp- 2181 ? and ? adsp-2183 ? offer ? both ? interfaces ? at ? the ? same ? time. ? this ? host ? port ? interface ? allows ? through ? the ? idma ? port ? easy ? read ? / ? write ? access ? to ? the ? internal ? memory ? of ? the ? dsp. ? with ? little ? additional ? software ? on ? the ? dsp ? even ? dsp ? system ? registers ? can ? be ? accessed ? or ? external ? overlays ? be ? booted. ? application ? idea: ? the ? idma ? interface ? is ? an ? easy ? to ? handle ? asynchronous ? 16bit ? wide ? interface ? and ? requires ? only ? four ? strobe ? lines ? to ? operate ? and ? synchronize ? it ? to ? the ? dsp ? clock. ? due ? to ? idma ? long ? read ? and ? write ? capabilities, ? almost ? every ? host ? can ? access ? this ? interface. ? often ? dsp ? software ? is ? developed ? on ? a ? pc ? platform ? using ? visualdsp. ? code ? verification ? is ? usually ? done ? with ? the ? simulator. ? even ? todays ? pcs ? do ? not ? match ? the ? performance ? of ? the ? dsp, ? so ? regression ? testing ? by ? driving ? test ? vector ? to ? an ? easy ? to ? use ? hardware ? platform ? is ? desired. ? with ? a ? little ? external ? circuitry, ? which ? can ? be ? easily ? fitted ? to ? an ? adds-2181-ez-lite, ? application ? code ? can ? be ? booted ? into ? to ? dsp ? and ? test ? vectors ? driven ? from ? a ? bi- directional ? pc ? parallel ? port ? (printer ? port). ? hardware ? design: ? the ? idma ? interface ? of ? the ? adsp-218x ? family ? requires ? just ? few ? data ? and ? strobe ? lines ? to ? operate ? the ? interface. ? to ? realize ? the ? interface, ? the ? four ? strobe ? lines ? and ? 16 ? data ? lines ? must ? be ? connected ? to ? the ? pc ? printer ? port ? by ? a ? port ? expander. ? an ? i8255 ? offers ? three ? freely ? programmable ? data ? ports, ? which ? can ? be ? switched ? between ? input ? and ? output. ? a ? fourth ? internal ? register ? controls ? the ? setting ? of ? the ? device. ? to ? access ? the ? port ? expander, ? the ? 8 ? data ? lines ? of ? the ? pc ? printer ? port ? are ? connected ? to ? the ? i/o ? data ? port. ? the ? 8255 ? has ? two ? additional ? address ? line ? to ? select ? the ? internal ? ports ? and ? requires ? besides ? read ? or ? write ? a ? chip ? select. ? as ? the ? pc ? printer ? port ? has ? only ? eight ? data ? lines ? and ? four ? output ? strobes, ? a ? little ? glue ? logic ? (exnor ? of ? /wr ? and ? /rd) ? is ? required ? to ? realize ? the ? interface ? for ? /cs. ? the ? i8255 ? has ? a ? nasty ? trait ? of ? pulling ? all ? signals ? low ? when ? the ? direction ? of ? any ? the ? data ? ports ? pa, ? pb ? or ? pc ? is ? changed. ? to ? avoid ? troubles ? at ? the ? idma ? side, ? all ? four ? strobe ? lines ? (ial, ? /is, ? /ird ? and ? /iwr) ? have ? therefore ? an ? additional ? inverter ? placed. ? after ? these ? inverters, ? pa ? of ? the ? i8255 ? is ? used ? to ? drive ? the ? idma ? strobe ? lines, ? while ? pb ? and ? pc ? are ? used ? as ? 16bit ? iad ? data ? port. ? a ? complete ? schematic ? of ? a ? 5v ? pc ? to ? dsp ? interface ? is ? presented ? in ? this ? document. ? to ? make ? the ? interface ? compatible ? with ? other ? 3.3v ? adsp-218x ? components, ? level ? transceivers ? like ? 74lvt245 ? have ? to ? be ? put ? in ? between ? pa, ? pb ? and ? pc ? and ? switched ? accordingly. ? software ? design: ? to ? ease ? the ? application ? and ? to ? provide ? a ? generic ? example ? of ? routines, ? a ? driver ? for ? pc ? systems ? allowing ? direct ? i/o ? access ? to ? pc ? system ? resources ? is ? provided. ?? to ? access ? the ? idma ? port, ? first ? the ? i8255 ? must ? be ? set ? up ? correctly ? from ? the ? reset ? state. ? afterwards, ? a ? write ? to ? the ? pa ? port ? allows ? to ? drive ? the ? required ? strobe ? signals. ? further ? writes ? to ? the ? pb ? and ? pc ? port ? will ? latch ? the ? data ? to ? be ? transmitted ? to ? the ? adsp- 218x. ? a ? write ? sequence ? will ? look ? like: ? 1 pa: ? set ? ial ? 2 pb, ? pc: ? drive ? address ? 3 pa: ? clear ? ial ? 4 pa: ? set ? write ? strobes ? /is, ? /iwr ? 5 pb, ? pc; ? drive ? data ? 6 pa: ? set ? write ? strobe ? is; ? iwr ? table ? 1: ? typical ? write ? sequence ? to ? drive ? multiple ? data ? words ? into ? the ? adsp-218x ? through ? idma ? interface, ? it ? is ? just ? necessary ? to ? repeat ? steps ? 4 ? to ? 6. ? a ? read ? sequence ? looks ? like ? the ? write ? sequence, ? with ? a ? little ? difference: ? before ? data ? is ? read ? in ? step ? 5, ? the ? pb ? and ? pc ? port ? direction ? must ? be ? switched ? between ? step ? 3 ? and ? 4 ? to ? an ? input ? and ? must ? be ? changed ? again ? past ? step ? 6. ?
? ee-158 page 2 technical notes on using analog devices? dsp components and development tools phone: (800) analog-d, fax: (781)461-3010, email: dsp.support@analog.com, ftp: ftp.analog.com, web: www.analog.com/dsp first ? time ? preparations: ? by ? default, ? the ? adds-2181-ez-kit-lite ? is ? configured ? for ? bdma ? booting. ? to ? allow ? idma ? and ? host ? booting, ? the ? bmode ? pin ? (pin ? 35 ? on ? the ? adsp- 2181 ? package) ? must ? be ? lifted ? from ? ground ? and ? connected ? the ? vcc. ? following ? figure ? shows ? the ? change. ? if ? just ? idma ? data ? access ? without ? boot ? capabilities ? is ? desired, ? there ? is ? no ? need ? to ? change. ? ? ? figure1: ? bmode ? pin ? change ? booting ? from ? the ? eprom ? is ? still ? supported, ? as ? a ? bdma ? bootloader, ? which ? can ? be ? downloaded ? through ? the ? idma ? interface, ? is ? supplied. ? additionally ? to ? this, ? the ? connector ? must ? be ? soldered ? into ? p2 ? of ? the ? ez-kit ? lite, ? as ? shown ? in ? figure ? 2. ? ? figure ? 2: ? location ? of ? the ? idma ? interface ? connector. ? having ? performed ? these ? two ? changes, ? the ? interface ? is ? operational, ? just ? connect ? a ? straight ? 25pin ? connector ? cable ? between ? the ? pc ? and ? the ? ez-idma ? adaptor ? card. ? please ? make ? sure ? at ? that ? point, ? that ? your ? pc ? printer ? port ? is ? bidirectional ? to ? prevent ? damage ? to ? the ? pc ? when ? reading ? back ? data ? from ? the ? idma ? port. ? the ? supplied ? routines ? can ? added ? to ? a ? pc ? program ? allowing ? easy ? regression ? testing. ? api ? functions: ? a ? list ? of ? provided ? api ? functions ? is ? given ? below. ? the ? compete ? sources ? are ? attached ? to ? this ? document. ? reset_board: ?? bring ? the ? i8255 ? in ? a ? defined ? state ? boot_2181: ?? download ? and ? start ? a ? dsp ? executable ? set_address: ?? set ? a ? new ? idma ? address ? put_data: ?? drive ? a ? dataword ? from ? the ? pc ? to ? 218x ? get_data: ?? retrive ? a ? dataword ? from ? 218x ?? get_status: ?? query ? the ? state ? of ? fl1 ? file_open_read: ? open ? ascii ? file ? for ? read ? file_open_write: ? open ? ascii ? file ? for ? write ? get_int_ff: ?? collect ? a ? 16bit ? integer ? word ? from ? file ? get_hex_ff: ?? collect ? a ? 16bit ? hex ? word ? from ? file ? get_char_ff: ?? collect ? single ? character ? from ? file ? find_port: ?? detect ? pc ? printer ? port ? boot_ext_ovlaymgr: ? prepare ? for ? boot ? into ? external ? overlays ? boot_ext_ovlay: ? download ? code ? / ? data ? to ? external ? overlay ? ? references: ? http://www.analog.com/dsp ? adds-2181-ez-lite ? documentation ? adsp-2181 ? data ? sheet ? intel ? i8255 ? data ? sheet ? visualdsp ? documentation ? ? ? ? ? ? ee-158 page 3 technical notes on using analog devices? dsp components and development tools phone: (800) analog-d, fax: (781)461-3010, email: dsp.support@analog.com, ftp: ftp.analog.com, web: www.analog.com/dsp figure ? 3: ? schematics ? for ? the ? ez-idma ? interface ? ? ee-158 page 4 technical notes on using analog devices? dsp components and development tools phone: (800) analog-d, fax: (781)461-3010, email: dsp.support@analog.com, ftp: ftp.analog.com, web: www.analog.com/dsp ? figure ? 4: ? adds-2181-ez-lite ? and ? ez-idma ? prototype ? card ? ? ee-158 page 5 technical notes on using analog devices? dsp components and development tools phone: (800) analog-d, fax: (781)461-3010, email: dsp.support@analog.com, ftp: ftp.analog.com, web: www.analog.com/dsp /****************************************************************************** * * ez81_idma.cpp * * copyright (c) 2000 hs scan service, all rights reserved * 2001 adopted by analog devices, free redistribution allowed * * * history * 10-sep-2000 hs document created * 02-feb-2001 hs updated for generic test shell * 17-may-2001 hs support booting external overlays * * comment: * * *****************************************************************************/ #include "stdafx.h" #include "stdio.h" #include "stdlib.h" #include "dos.h" #include "conio.h" #include "string.h" #include "ez81_idma.h" /****************************************************************************** *** *** function prototypes *** *****************************************************************************/ void reset_board(); int boot_2181(file* fname); int boot_ext_ovlaymgr(); int boot_ext_ovlay(int type, int num, file* fname); void set_address(int mem_type, unsigned int addr); void put_data(int mem_type, unsigned long data); long get_data(int mem_type); file* file_open_read(char* fname); file* file_open_write(char* fname); int get_int_ff(file* fptr); int get_hex_ff(file* fptr); int find_port(); void delay(int count); long ext_boot_loader[145] = { 0x000000, 0x18030f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x0a001f, 0x340015, 0x380017, 0x340008, 0x340009, 0x380008, 0x380009, 0x400000, 0x930010, 0x4ffff0, 0x930020, 0x473000, 0x93fe60, 0x40fff0, 0x93ffe0, 0x404000, 0x93fff0, 0x83001a, 0x227a0f, 0x180400, 0x4ffff0, 0x930020, 0x400104, 0x26e20f, 0x34001e, 0x1806b0, 0x400114, 0x26e20f, 0x34001e, 0x180700, 0x400204, 0x26e20f, 0x34002e, 0x1806b0, 0x400214, 0x26e20f, 0x34002e, 0x180700, 0x400304, 0x26e20f, 0x34001f, 0x1807b0, 0x400314, 0x26e20f, 0x34001f, 0x180800, 0x400404, 0x26e20f, 0x34002f, 0x1807b0, 0x400414, 0x26e20f, 0x34002f, 0x180800, 0x34000e, 0x34000f, 0x400504, 0x26e20f, 0x1808b0, 0x18040f, 0x400000, 0x930010, 0x390000, 0x3a0001, 0x18074f, 0x400000, 0x930010, 0x390000, 0x3b0001, 0x3d0005, 0x14077e, 0x500003, 0x580007, 0x400000, 0x930020, 0x18040f, 0x400000, 0x930010, 0x360000, 0x340001, 0x18084f, 0x400000, 0x930010, 0x360000, 0x350001, 0x3d0005, 0x14087e, 0x600001, 0x680005, 0x400000, 0x930020, 0x18040f, 0x380000, 0x418000, 0x3c00f7, 0x580003, 0x18000f }; ? ee-158 page 6 technical notes on using analog devices? dsp components and development tools phone: (800) analog-d, fax: (781)461-3010, email: dsp.support@analog.com, ftp: ftp.analog.com, web: www.analog.com/dsp /****************************************************************************** *** *** functions *** *****************************************************************************/ inline void wr_to_8255(unsigned char reg, unsigned char val) { _outp(ctrl, reg | d8255_wr ); /* write to control */ _outp(data, val ); /* write to data port */ _outp(ctrl, reg | d8255_dl ); /* idle 8255 */ } inline unsigned char rd_from_8255(unsigned char reg) { unsigned char read; _outp(ctrl, reg | d8255_dl | pport_bi ); /* write to control */ _outp(ctrl, reg | d8255_rd | pport_bi ); /* write to control */ read = _inp(data); /* collect data */ _outp(ctrl, reg | d8255_dl | pport_bi ); /* write to control */ return (read); } /****************************************************************************** * * reset board * *****************************************************************************/ void reset_board() { wr_to_8255(d8255_cc, d82_bco); /* put 8255 in output mode */ wr_to_8255(d8255_pa, d8x_dle); /* init idma strobes on 218x */ set_address(dm,0); put_data(dm,0); } /****************************************************************************** * * set idma address * *****************************************************************************/ void set_address(int mem_type, unsigned int addr) { if (addr!=0xffff) { addr |= mem_type; /* set up address */ wr_to_8255(d8255_pb, (unsigned char) (addr & 0x00ff) ); wr_to_8255(d8255_pc, (unsigned char) ((addr & 0xff00) >> 8) ); /* latch it */ wr_to_8255(d8255_pa, d8x_ial); wr_to_8255(d8255_pa, d8x_dle); } } /****************************************************************************** * * put data to idma port * *****************************************************************************/ void put_data(int mem_type, unsigned long data) { if (mem_type == 0) /* pm memory */ { /* set up data */ wr_to_8255(d8255_pb, (unsigned char) ((data & 0x00ff00) >> 8) ); wr_to_8255(d8255_pc, (unsigned char) ((data & 0xff0000) >> 16) ); ? ee-158 page 7 technical notes on using analog devices? dsp components and development tools phone: (800) analog-d, fax: (781)461-3010, email: dsp.support@analog.com, ftp: ftp.analog.com, web: www.analog.com/dsp /* latch it */ wr_to_8255(d8255_pa, d8x_dle); wr_to_8255(d8255_pa, d8x_iwr); wr_to_8255(d8255_pa, d8x_dle); /* set up data */ wr_to_8255(d8255_pb, (unsigned char) (data & 0x0000ff) ); /* latch it */ wr_to_8255(d8255_pa, d8x_dle); wr_to_8255(d8255_pa, d8x_iwr); wr_to_8255(d8255_pa, d8x_dle); } else /* dm memory */ { /* set up data */ wr_to_8255(d8255_pb, (unsigned char) (data & 0x00ff) ); wr_to_8255(d8255_pc, (unsigned char) ((data & 0xff00) >> 8) ); /* latch it */ wr_to_8255(d8255_pa, d8x_dle); wr_to_8255(d8255_pa, d8x_iwr); wr_to_8255(d8255_pa, d8x_dle); } } /****************************************************************************** * * get data from idma port * *****************************************************************************/ long get_data(int mem_type) { long data = 0; unsigned char rl, rm, rh; if (mem_type == 0) /* pm memory */ { /* switch 8255 to input */ wr_to_8255(d8255_cc, d82_bci); /* first access */ wr_to_8255(d8255_pa, d8x_dle); wr_to_8255(d8255_pa, d8x_ird); /* open latch */ /* latch bc port */ rm = rd_from_8255(d8255_pb); /* get mid */ rh = rd_from_8255(d8255_pc); /* get high */ wr_to_8255(d8255_pa, d8x_dle); /* close latch */ /* second access */ wr_to_8255(d8255_pa, d8x_ird); /* open latch */ /* latch b port */ rl = rd_from_8255(d8255_pb); /* get low */ wr_to_8255(d8255_pa, d8x_dle); /* switch pport back to output */ wr_to_8255(d8255_cc, d82_bco); wr_to_8255(d8255_pa, d8x_dle); data = (rh<<16) | (rm<<8) | rl; } else /* dm memory */ { /* switch 8255 to input */ wr_to_8255(d8255_cc, d82_bci); wr_to_8255(d8255_pa, d8x_dle); wr_to_8255(d8255_pa, d8x_ird); /* open latch */ /* latch bc port */ rl = rd_from_8255(d8255_pb); /* get low */ rh = rd_from_8255(d8255_pc); /* get high */ wr_to_8255(d8255_pa, d8x_dle); ? ee-158 page 8 technical notes on using analog devices? dsp components and development tools phone: (800) analog-d, fax: (781)461-3010, email: dsp.support@analog.com, ftp: ftp.analog.com, web: www.analog.com/dsp /* switch pport back to output */ wr_to_8255(d8255_cc, d82_bco); wr_to_8255(d8255_pa, d8x_dle); data = (rh<<8) | rl; } return data; } /****************************************************************************** * * boot adsp-218x * *****************************************************************************/ int boot_2181(file* fname) { static char *pam = "@pa"; static char *dam = "@da"; static char *bend = "#"; char *p; char in_str[12]; char addr_str[6]; char inst_str[8]; char data_str[6]; unsigned int addr, data; unsigned long inst,inst_0; reset_board(); /* set 8255 state */ do { fgets(in_str, 12, fname); /* fetch textline */ if (strstr(in_str, pam) != null) /* is instruction */ { strcpy(addr_str, fgets(in_str, 12, fname)); addr = strtoul(addr_str,&p,16); do { strcpy(inst_str, fgets(in_str, 12, fname)); if (strstr(in_str, bend) == null) { inst = strtoul(inst_str, &p, 16); if(addr==0) { inst_0=inst; /* save instruction 0 */ addr++; } else { set_address(pm, addr); put_data(pm, inst); addr=0xffff; } } } while(strstr(in_str, bend) == null); /* until end of block */ } } while (!feof(fname)); rewind(fname); /* next parse for data */ do { fgets(in_str, 12, fname); /* get textline */ ? ee-158 page 9 technical notes on using analog devices? dsp components and development tools phone: (800) analog-d, fax: (781)461-3010, email: dsp.support@analog.com, ftp: ftp.analog.com, web: www.analog.com/dsp if (strstr(in_str, dam) != null) /* data follows */ { strcpy(addr_str, fgets(in_str, 12, fname)); addr = strtoul(addr_str, &p, 16); do { strcpy(data_str, fgets(in_str, 12, fname)); if (strstr(in_str, bend) == null) { data = strtoul(data_str, &p, 16); set_address(dm, addr); put_data(dm, data); addr=0xffff; } } while(strstr(in_str, bend) == null); /* until end of block */ } } while (!feof(fname)); set_address(pm, 0); /* kick off dsp */ put_data(pm, inst_0); /* write instructon 0 */ return(1); } /****************************************************************************** * * download boot manager * *****************************************************************************/ int boot_ext_ovlaymgr() { int i; long inst0; set_address(pm, 0x0001); for (i=0; i< 145; i++) { if (i == 0) inst0 = ext_boot_loader[i]; else put_data(pm, ext_boot_loader[i]); /* write instructon */ } set_address(pm, 0x0000); /* kick off dsp */ put_data(pm, inst0); /* write instructon 0 */ return 1; } /****************************************************************************** * * boot external adsp-218x * *****************************************************************************/ int boot_ext_ovlay(int type, int num, file* fname) { static char *pam = "@pa"; static char *dam = "@da"; static char *bend = "#"; char *p; char in_str[12]; char addr_str[6]; char inst_str[8]; char data_str[6]; unsigned int addr, command, i, result; unsigned int data[8192]; unsigned long inst[8192]; ? ee-158 page 10 technical notes on using analog devices? dsp components and development tools phone: (800) analog-d, fax: (781)461-3010, email: dsp.support@analog.com, ftp: ftp.analog.com, web: www.analog.com/dsp /* * implemented commands in 2181_boot_manager * * 0x00 = wait * * 0x10 = pmovlay 1, lower 4k * 0x11 = pmovlay 1, upper 4k * 0x20 = pmovlay 2, lower 4k * 0x21 = pmovlay 2, upper 4k * * 0x30 = dmovlay 1, lower 4k * 0x31 = dmovlay 1, upper 4k * 0x40 = dmovlay 2, lower 4k * 0x41 = dmovlay 2, upper 4k * * 0x50 = final init, boot internal */ // test for final init if (num == 0) { command = 0x50; set_address(dm, 0x3001); put_data(dm, command); return (1); } /* rewind file */ rewind(fname); if (type == pm) /* parse for pm memory */ { do { fgets(in_str, 12, fname); /* fetch textline */ if (strstr(in_str, pam) != null) /* is instruction */ { strcpy(addr_str, fgets(in_str, 12, fname)); addr = strtoul(addr_str,&p,16); if (addr < 0x2000) { printf("\n\n file error - executable contains code for non overlay section @ addr 0x%04x", addr); printf("\n section skipped, cf. map file \n"); } else { addr = addr - 0x2000; /* subtract ovlay */ do { strcpy(inst_str, fgets(in_str, 12, fname)); if (strstr(in_str, bend) == null) inst[addr++] = strtoul(inst_str, &p, 16); } while(strstr(in_str, bend) == null); /* until end of block */ } } } while (!feof(fname)); } else /* parse for dm memory */ { do { fgets(in_str, 12, fname); /* get textline */ if (strstr(in_str, dam) != null) /* data follows */ { strcpy(addr_str, fgets(in_str, 12, fname)); addr = strtoul(addr_str, &p, 16); if (addr > 0x2000) { printf("\n\n file error - executable contains data for non overlay section @ addr 0x%04x", addr); printf("\n section skipped, cf. map file \n"); } else ? ee-158 page 11 technical notes on using analog devices? dsp components and development tools phone: (800) analog-d, fax: (781)461-3010, email: dsp.support@analog.com, ftp: ftp.analog.com, web: www.analog.com/dsp { do { strcpy(data_str, fgets(in_str, 12, fname)); if (strstr(in_str, bend) == null) data[addr++] = strtoul(data_str, &p, 16); } while(strstr(in_str, bend) == null); /* until end of block */ } } } while (!feof(fname)); } /* download sections */ if (type == pm) { command = (num << 4); /* low block */ set_address(pm, 0x1000); /* set download address */ for (i=0; i< 0x1000; i++) { put_data(pm, inst[i]); /* dump code */ } set_address(dm, 0x3001); /* set command address */ put_data(dm, command); /* write command */ do { set_address(dm, 0x3002); result = get_data(dm); } while (result != 0); /* wait for success */ command = command + 1; /* high block */ set_address(pm, 0x1000); /* set download address */ for (i=0x1000; i< 0x2000; i++) { put_data(pm, inst[i]); /* dump code */ } set_address(dm, 0x3001); /* set command address */ put_data(dm, command); /* write commadn */ do { set_address(dm, 0x3002); result = get_data(dm); } while (result != 0); /* wait for success */ } else /* type == dm */ { command = ((num + 2) << 4); /* low block */ set_address(dm, 0x2000); /* set download address */ for (i=0; i< 0x1000; i++) { put_data(dm, data[i]); /* dump data */ } set_address(dm, 0x3001); /* set command address */ put_data(dm, command); /* write command */ do { set_address(dm, 0x3002); result = get_data(dm); } while (result != 0); /* wait for success */ command = command + 1; /* high block */ set_address(dm, 0x2000); /* set download address */ for (i=0x1000; i< 0x2000; i++) { put_data(dm, data[i]); /* dump data */ } set_address(dm, 0x3001); /* set command address */ put_data(dm, command); /* write command */ do { set_address(dm, 0x3002); ? ee-158 page 12 technical notes on using analog devices? dsp components and development tools phone: (800) analog-d, fax: (781)461-3010, email: dsp.support@analog.com, ftp: ftp.analog.com, web: www.analog.com/dsp result = get_data(dm); } while (result != 0); /* write for success */ } return (1); } /****************************************************************************** * * file open for write access * *****************************************************************************/ file* file_open_write(char* fname) { file *fptr; if ((fptr = fopen(fname,"wt")) == null) printf("\ncan not open file %s\n", fname); else printf("\nsuccess opening %s for write", fname); return fptr; } /****************************************************************************** * * file open for read access * *****************************************************************************/ file* file_open_read(char* fname) { file *fptr; if ((fptr = fopen(fname,"rt")) == null) printf("\ncan not open file %s\n", fname); else printf("\nsuccess opening %s for read", fname); return fptr; } /****************************************************************************** * * get int value from current file position * *****************************************************************************/ int get_int_ff(file* fptr) { int result, readval; result = fscanf(fptr, "%d", &readval); if (result == eof) readval = 0; return readval; } /****************************************************************************** * * get hex value from current file position * *****************************************************************************/ int get_hex_ff(file* fptr) { int result, readval; result = fscanf(fptr, "%lx", &readval); if (result == eof) readval = 0; return (int) readval; ? ee-158 page 13 technical notes on using analog devices? dsp components and development tools phone: (800) analog-d, fax: (781)461-3010, email: dsp.support@analog.com, ftp: ftp.analog.com, web: www.analog.com/dsp } /****************************************************************************** * * find printer port * *****************************************************************************/ int find_port() { unsigned int *ptraddr; unsigned int address; int a; ptraddr=(unsigned int *)0x00000408; /*bios location */ for (a = 0; a < 3; a++) { address = *ptraddr; if (address == 0) printf("no port found for lpt%d \n",a+1); else printf("address assigned to lpt%d is %xh\n",a+1,address); *ptraddr++; } return (address); } /****************************************************************************** * * delay * *****************************************************************************/ void delay(int count) { int i, res; for (i=0; i ? ee-158 page 15 technical notes on using analog devices? dsp components and development tools phone: (800) analog-d, fax: (781)461-3010, email: dsp.support@analog.com, ftp: ftp.analog.com, web: www.analog.com/dsp *** *** idma defines *** *****************************************************************************/ #define pm 0x0000 #define dm 0x4000 /****************************************************************************** *** *** function prototypes *** *****************************************************************************/ void reset_board(); int boot_2181(file* fname); int boot_ext_ovlaymgr(void); int boot_ext_ovlay(int type, int num, file* fname); void set_address(int mem_type, unsigned int addr); void put_data(int mem_type, unsigned long data); long get_data(int mem_type); file* file_open_read(char* fname); file* file_open_write(char* fname); int get_int_ff(file* fptr); int get_hex_ff(file* fptr); int find_port(); #endif // ___ez_idma81___ listing ? 2: ? api ? include ? file ? ? ? ee-158 page 16 technical notes on using analog devices? dsp components and development tools phone: (800) analog-d, fax: (781)461-3010, email: dsp.support@analog.com, ftp: ftp.analog.com, web: www.analog.com/dsp ? #include "ez81_idma.h" #include "ez_support.h" #include "stdio.h" #include "conio.h" int main(int argc, char* argv[]) { file* exefile; printf("\n\nplease press reset on the ez kit lite"); getch(); // reset ez_idma adaptor card reset_board(); // boot dsp executable manager for external overlays boot_ext_ovlaymgr(); // pm external overlay 1 exefile = file_open_read(progpath"page1.exe"); if (exefile == null) { printf("program aborted\n"); fcloseall(); getch(); return false; } boot_ext_ovlay(pm, 1, exefile); fclose(exefile); // pm external overlay 2 exefile = file_open_read(progpath"page2.exe"); if (exefile == null) { printf("program aborted\n"); fcloseall(); getch(); return false; } boot_ext_ovlay(pm, 2, exefile); fclose(exefile); // final init boot_ext_ovlay(pm, 0, exefile); // do your regression test here } listing ? 3: ? example ? boot ? api ? use ? on ? pc, ? function ? calls ? printed ? in ? boldface ? ? ? |
Price & Availability of EE-158-15
![]() |
|
|
All Rights Reserved © IC-ON-LINE 2003 - 2022 |
[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy] |
Mirror Sites : [www.datasheet.hk]
[www.maxim4u.com] [www.ic-on-line.cn]
[www.ic-on-line.com] [www.ic-on-line.net]
[www.alldatasheet.com.cn]
[www.gdcy.com]
[www.gdcy.net] |