Home
"user manual"
Contents
1. X means route to local processor because ml means enable interrupts El steer en int 0 DMA INT STEER PCI DMA_INT_STEER_LOCAL read source and destination addresses length type snoop and channel validate and translate to API defined parameter values call the DMA library to initiate the transfer if DMA direct transfer steer type unsigned int src unsigned int dest unsigned int len channel snoop l DMA_SUCCESS PRINT dev DMA error in DMA transfer test n return ERROR return SUCCESS 1 4 DMA Driver Library Internals DLI This information is provided to assist in further development of the DMA library All of these functions are defined as static in the source file drivers dma dmal c 1 4 1 Common Data Structures and Values The following data structures tables and status values are defined see drivers dma dma h AN MOTOROLA Appendix I MPC8240 DMA Memory Controller 101 117 MPC8240 DMA Memory Controller unless otherwise noted for the Kahlua DMA driver library functions Thes are the register offsets Memory Block add define NUM_DMA_REG 7 define DMA MR REG O0 define DMA SR REG 1 define DMA CDAR REG 2 define DMA SAR REG 3 define DMA DAR REG 4 define DMA BCR REG 5 define DMA NDAR REG 6 in a table of the resses for the DMA registers Embedded Utilities The tab
2. Type SO this is a header record Count 10 interpreted as 0x10 indicates that 16 character pairs follow Address 0000 interpreted as 0x0000 The address field for SO is always 0x0000 Data Since this is a header record the information can be interpreted in a number of ways It doesn t really matter since you usually don t use this field for anything interesting Checksum AA the checksum Example 2 S21907000074000000700000003D20DEAD6129BEEF3C60000060E0 Separated 2 19 070000 74000000700000003D20DEAD6129BEEF3C60000060 EO0 Type S2 the record consists of memory loadable data and the address should be interpreted as 3 bytes Count 19 interpreted as 0x19 indicates that 25 character pairs follow Address 070000 data will be loaded at address 0x00070000 Data Memory loadable data representing executable code Checksum EO checksum Example 2 S804070000F4 Separated S8 04 070000 F4 Type S8 this is the record with the execution start address also indicates we have reached the end of our s record Count 04 interpreted as 0x04 indicates that 4 character AN MOTOROLA Appendix D S Record Format Description 10D 99 S Record Format Description pairs follow eAddress 070000 execution will begin at 0x00070000 Data None this field is unused for S8 records Checksum F4 checksum D 4 Summary of Formats The following table summarizes the length in char
3. Fixed flushhead in except2 s to work correctly Version 11 0 March 29 1999 Add AltiVec support for the MAX processor Added vector registers to register list Add assembler disassembler code for altivec mnemonics fl dsi has been expanded to display the flash memory range for each sector Version 10 7 February 25 1999 Add 1999 to copyright dates Add timeout to flash write to memory so an unfinished write to flash won t last for ever it will timeout and issue an error message Add test all flash write for protected sector and if protected issue an error and refuse the write Disable transpar tm from excimer Set DCFA bit from 0 to 1 for MAX chips only Dink32 R12 User s Manual M MOTOROLA History of MDINK32 DINK32 changes C 6 Version 10 6 January 25 1999 1 Implement the history c file and allow the about command to use constants for Version Revision and Release 2 Implement the fl dsi and fl se commands 3 Automatically detect flash between Board Rev 2 and 3 4 Remove the fw e command from DINK32 it is only available in MDINK32 C 7 Version 10 5 November 24 1998 1 Changed default reset address to be xfffO for standalone dink ind Fix bugs in trace command Version 10 4 November 11 1998 Recapture 10 3 LED post routine in MDINK Add BMC BASE HIGH for kahlua to reach the high config registers Added memory test feature during POR Corrected ending address for kahl
4. do 0 5nsl1 Onsl1 5nsl2 Ons wt diff If any key is pressed on startup recommendation is Backspace the ENV is ignored ENV allows for multiple command aliases Example 4 30 Dink32 R12 User s Manual M MOTOROLA Commands ENV R rd ENV X tr rd msr md 90000 90100 You can enter r to do rd or r r3 to do rd r3 or x to do all the above def s Aliases cannot be nested Note that the ENV does not distinguish between ENV vars and ALIAS vars they re lumped together ENV allows changing the prompt dynamically If the string PROMPT is defined in the ENV it is expanded and displayed using the following rules d dink name either DINK or MDINK P formal processor name e g MPC7400 p informal processor name e g MAX T current time 12 34 56PM t TAU temperature e g 26 if 26 deg C or 26u if not calibrated yet history index s _ CRLF All other characters are copied as is Flags c Clear Initialize the NVRAM d Delete named variable e s Saves environment to permanent storage used for excimer and maximer only Most of the SPR s can suppress the verbose mode see Section 4 1 30 regdisp rd Example This example sets the non verbose mode for certain commands DINK32 ARTHUR gt gt env c DINK32 ARTHUR gt gt env rdmode e After the non verbose mode is set the following command gives non verbose results Contrast this wit
5. 4 56 Dink32 R12 User s Manual M MOTOROLA Commands DINK32_ARTHUR gt gt rd msr MSR 0x00003930 POW 0 EE 0 PR 0 FP 1 ME 1 FRO 1 SE 0 BE 0 FE1 1 IP 0 IR 21 DR 1 RI 0 LE 0 TLB GPR 0 VMX 0 PM 0 DINK32_ARTHUR gt gt rd v msr Machine State Register MSR 0x00003930 00000000000000000011100100110000 PREFERE ae ae hice sate O4 RCA oa d x reserved M sees A A e a activates power management E o tt do e donee tlb gpr overlay enable a ra prep ce Aes te ost gue reserved ug qt IIT external interrupt enable Suchen ctc be TEL nee privilege level a td DET res con floating point available ia totem machin check enabl E MR Me ar floating point exception point O0 Er ME m single step trace enable A Pee reserved ENE floating point exception point 1 A 45 reserved Ets 18 exception prefix alte instruction address translation data address translation reserved performance monitor marked mode RESET or MC exception recoverable DINK32_ARTHUR gt gt Chapter 4 MDINK32 DINK32 Commands little endian mode enable 4 57 Commands 4 1 31 regmod rm modify registers PS rirxlrx lrx rylflfxlfx lfx fylsxlspr_namelnorthbridgelnblmpc 106Impc107Impc82 40 e regmod r entire general register family regmod rx one general purpose register regmod rx from rx to r31 regmod rx ry
6. Modification display and movement of system memory A simplified breakpoint command allowing setting displaying and removing breakpoints Single step trace and continued execution from a specified address Automatic decompression of compressed s record files while downloading Extensive on line help Ability to execute user assembled and or downloaded software in a controlled environment Logging function for generating a transcript of a debugging session Register set includes all of the PowerPC implementation specific registers Modification of memory at byte half word word and double word lengths Extensive support for the MPC 60x MPC 740 MPC750 MPC7400 simplified or extended mnemonics during assembly and disassembly of PowerPC instructions Ability to input immediate values to the assembler as binary decimal or hexadecimal Command line download functionality that allows the user to select the download port and then send the data An assembler and disassembler that understands branch labels and the ability to see and clear the branch table that DINK32 is using while assembling and disassembling PowerPC instructions Ability to read and write MPC106 configuration registers Not supported on Excimer and Maximer Support for PCI with new pci commands Not supported in minimal builds i e Excimer and Maximer Support for Excimer and Maximer flash fl dsi and se and automatically detect flash on Re
7. Returns Any defined status indicator Description Receive a buffer of data from the sending master If stop flag is set when the buffer is full and the sender does not signal STOP generate a STOP signal Caller is the slave performing receiving K 2 4 4 12C support functions unsigned int get eumbbar e Returns base address of the Embedded Utilities Memory Block Description See Embedded Utilities Memory Block and Configuration Register Summary for information about the Embedded Utilities Memory Block Base Address Register This function is defined in kahlua s NOTE I don t understand the initialization sequences for establishing the config addr and config data well enough at this point to be able to explain them however I think it is essential to offer the user a complete explanation of the initialization process unsigned int load runtime reg unsigned int eumbbar unsigned int reg e eumbbar is the address of the Embedded Utilities Memory Block AN MOTOROLA Appendix K MPC8240 120 Doorbell Driver 10K 155 MPC8240 120 Doorbell Driver e reg specifies the register I2CDR I2CFDR I2CADR I2CSR I2CCR e Returns register content Description The content of the specified register is returned This function is defined in drivers i2c i2c2 s unsigned int store runtime reg unsigned int eumbbar unsigned int reg unsigned int val e eumbbar is the address of the Embedded Utilities Memory Block e offset s
8. Assemble Breakpoint ops bkpt Device Display Device Tests Download assemble as bp da devdisp dd devtest dev download dl Flash commands flash fl Flash update fu s Go go Help help he Info info in Log session log Memory Display memdisp md Memory Modify memod mm Memory Fill memfill mf Memory Move memove mv Memory Search memsrch ms Memory Test memtest mt Menu menu me PCI Bus Probe pciprobe ppr PCI Slot Display pcidisp pd PCI Reg Modify pcimod pm PCI Config Regs perc nt pef Register Display regdisp rd Register Modify regmod rm Real Time Clock rtc Run Alias runalias ra Set Baud Rate setbaud sb Set Input Symbol table Trace Show SPRs Transparent Mode repeat last command setinput si symtab st tracey tir spr_name sx transpar tm DINK32_MPC603ev gt gt help Excimer DINK COMMAND Mnemonic LIST Command Command Mnemonic About about ab Assemble assemble as Benchmark benchmark bm Breakpoint ops bkpt bp Define Alias defalias da Disassemble disassem ds Download download dl Flash commands Play E1 Go go Help help he History history hist Info NEO dm Log session log emory Display memdisp md Memory Modify memod mm emory Fill memfill mf Memory Info meminfo mi emory Move memove mv Memory Search memsrch ms emory Test memtest mt Menu menu me Register Display regdisp rd Register Modify regmod rm Reset reset rst Run Alias runalias ra Set Baud Rate setbaud
9. unsigned char sender addr unsigned char buffer ptr unsigned int length unsigned int stop flag unsigned int is cnt e eumbbar is the address of the Embedded Utilities Memory Block e sender addr is the sender s I2C device address buffer ptr is pointer to the data buffer to transmit length is the number of bytes in the buffer stop flag 1 signal STOP when buffer is empty e O don tsignal STOP when buffer is empty e js cnt 1 this is a restart don t check MBB e O this is a not restart check MBB e Returns Any defined status indicator Description Set up to receive a buffer of data from the desired sender_addr If stop flag is set when the buffer is full and the sender does not signal STOP generate a STOP signal Caller is the master performing receiving If no STOP signal is generated the master can generate a START signal to another slave address The function does not actually perform the data buffer receive AN MOTOROLA Appendix J MPC8240 12C Driver Library 10J 131 MPC8240 I2C Driver Library it just sets up the DLI global variables to control the transaction and calls I2C_Start to send the slave address out on the I2C bus in receive mode The application must check the return status to find out if the bus was obtained then enter a loop of calling I2C Timer Event to poll the I2C handler to actually perform the transaction one byte at a time while checking the return status to determine if there we
10. 0 00 16 DINK32 ARTHUR gt gt 4 48 Dink32 R12 User s Manual M MOTOROLA 4 1 25 menu me show list of DINK32 commands menu same as help Commands MDINK32 Compatible This command will list all of the commands that are available in the current implementation of DINK32 Examples DINK32_ARTHUR gt gt menu Command About Benchmark Define Alias Download Go History Log session Memory Modify Memory Info Memory Search Menu Run Alias Set Input Register Modify Mnemonic about ab benchmark bm defalias da download dl go history hist log memod mm meminfo mi memsrch ms menu me regmod rm runalias ra setinput si Excimer DINK COMMAND LIST Command Assemble Breakpoint ops Disassemble Flash commands Help Info emory Display emory Fill emory Move emory Test Register Display Reset Set Baud Rate Show SPRs Symbol table symtab st Tau Transparent Mode transpar tm Trace repeat last command For additional details about a command please type h MDINK32_ARTHUR gt gt menu MINIMUM DINK COMMAND LIST Command About Download Flash ram to rom Flash display Help Go Menu Mnemonic about ab download dl fw i fl dst help he go menu me For additional details about a command please type h Chapter 4 MDINK32 DINK32 Commands Mnemonic assemble as bkpt bp disassem ds flash fl help he info in memd
11. 30 ns 2 clocks SDRAM Bank 0 Disabled SDRAM Bank 1 Disabled SDRAM Bank 2 Enabled Range 00000000 gt O0OOfffff 1 MBytes Speed 0 1 1 1 SDRAM Bank 3 Enabled Range 08000000 gt 080fffff 1 MBytes Speed 0 1 1 1 SDRAM Bank 4 Enabled Range 08400000 gt O94fffff 17 MBytes Speed 0 1 1 1 SDRAM Bank 5 Enabled Range 00000000 gt OOOfffff 1 MBytes Speed 0 1 1 1 SDRAM Bank 6 Enabled Range 00000000 gt O0OOfffff 1 MBytes Speed 0 1 1 1 SDRAM Bank 7 Disabled M MOTOROLA Chapter 4 MDINK32 DINK32 Commands 4 43 Commands 4 1 21 memod mm memory modify memod address e memod start memod start end Memory modify is an interactive command It will display the contents of the given memory address and allow the user to change the value stored there Memory is considered to be a contiguous set of 32 bit integers The plus form causes the command to start at a given address and continue until the end of memory or until the user types x to exit the memory modify loop The range form allows modifications for the inclusive range from start to end When the end address is reached the memory modify loop is automatically exited The user can type x at any time to exit the memory e b for byte hfor halfword e w for word default Examples DINK32 750 memod 60100 0x00060100 0x89898989 DINK32 750 gt gt memod b 601 0x00060100 0x44444444
12. M MOTOROLA Chapter 4 MDINK32 DINK32 Commands 4 17 Commands M M DDD Version 10 Written by Released Welcome to III N N K K 333 22222 for the MPC603 Revision 7 Motorola s RISC Applications Austin TX March 1 1999 Excimer A Minimum System PowerPC Design Copyright Motorola Inc 1993 1994 1995 1996 1997 4 18 Dink32 R12 User s Manual 199 8 Commands 4 1 3 assemble as DINK32 mini assembler assemble address e assemble start assemble start end The mini assembler for the DINK32 system will display the contents of memory at the given location and enter interactive mode The user will be queried for a valid mnemonics and operands which will be assembled into a valid opcode and stored at that memory location A location can be left unmodified by typing return to pass over it The plus form of the command will allow the user to start assembling code at a given start location and will be terminated at the end of memory The range version will start at the first address location and automatically terminate at the given end address At any point x can be entered as a mnemonic and assemble will terminate and return the user to the DINK32 prompt Branch labels are recognized by the assembler as a word followed by a colon at the address currently being displayed by the assembler The assembler tracks the current branch labels and automatically calculates the address to be ente
13. MOTOROLA Appendix F Updating DINK32 from the Web 10F 105 Updating DINK32 from the Web e unzip the dink32 12 O zip file it will unzip to readable e unzip the dink32 12 O0 objects file it will unzip to objects e copy one of the objects to the unzipped readable file eg cp r objects dink yk met readable make tch make dink 10F 106 Dink32 R12 User s Manual Dynamic functions such as printf Appendix G Dynamic functions such as printf G 1 General Information Many library functions such as printf are available via the DINK32 debugger In the past 1t has been necessary to ascertain the address of these functions which change with each compile from the cross reference listing and statically set these addresses in the programs that used these features The demo and dhrystone directories included with the DINK32 distribution contained examples of how to set these static function addresses With the release of DINK32 V11 1 and V12 0 these addresses are now dynamically ascertained and the user only need call a few functions and set up some defines This technique is described in this appendix Users with access to the entire DINK32 source base can modify or add DINK32 functions G 2 Methodology and implementation This method is implemented with a static structure that is filled with the current functions address during link time The table is allocated in the file par tb c Only users with access to this file can change
14. and Section 4 1 37 transpar tm The keyboard serial port k indicates serial port com1 which is used for normal communication between the terminal emulator and the evaluation board Thus sb kand dl k indicate to use the current serial port Thus for d1 k use the terminal emulator transfer send text file feature on the terminal emulator connected to coml The host serial port h indicates serial port com2 which is not normally used One can connect another terminal emulator to this serial port and with the dl h command download a file This port is only available with the Sandpoint and Yellowknife platforms NOTES The maximum baud rate on the Yellowknife and Sandpoint platform is 38400 The Excimer and Maximer platform will not return the current baud rate correctly The default baud rate on all platforms is 9600 Examples MDINK32_603e gt gt setbaud k 57600 Baud rate changing to 57600 B6 NOTE user must then change the baud rate on the terminal to correspond to 57600 4 62 Dink32 R12 User s Manual M MOTOROLA Commands MDINK32_603e gt gt AN MOTOROLA Chapter 4 MDINK32 DINK32 Commands 4 63 Commands 4 1 35 Symtab st displays DINK32 symbol table information symtab c symtab d This command shows selected DINK symbols and user defined symbols and their associated addresses User symbols can be defined by the as command The c option is to clear all user symbols The
15. c cal w fh Description This command displays or calibrates the TAU Thermal Assist Unit If no option is entered the current temperature is displayed with or without calibration TAU calibration values are always saved in the environment variable TAUCAL if ENV storage is available Flags c Calibrate the TAU to the actual temperature in C w Watch the TAU until a key is pressed e fh Show results in Fahrenheit TAU calibration values are always saved in the environment variable TAUCAL if ENV storage is available Example K32 ARTHUR gt gt tau 58 C uncalibrated K32_ARTHUR gt gt tau c 18 18 C K32 ARTHUR gt gt tau 18 C K32 ARTHUR gt gt tau fh 32 F UY H n QE oO 0 0 2 M MOTOROLA Chapter 4 MDINK32 DINK32 Commands 4 67 Commands 4 1 37 transpar im transparent mode for com2 non excimer build e transpar This command will put DINK32 into a transparent mode giving the user direct access to the host In other words as the user types data into the keyboard that data is sent directly to the host serial port In addition data that comes in from the host serial port will be forwarded to the keyboard serial port The user can exit from transparent mode by typing lt ctrl gt a See Section 4 1 10 download dl and Section 4 1 37 transpar tm Example DINK32_750 gt gt tm lt cntr a gt 4 68 Dink32 R12 User s Manu
16. from rx to ry e regmod f entire floating point family regmod fx one floating point register e regmod fx from fx to f31 e regmod fx fy from fx to fy e regmod SPR by name view spr by name such as hidO contents regmod sx one special purpose register regmod vx one altivec vector register regmod v all altivec vector registers e regmod y verbose display only valid if env c env rdmode e is set This command modifies the contents of the specified registers r f will access the entire general purpose or floating point family rx fx sx or spr name will access the specified register Multiple parameters may be entered The user can enter return to leave data unmodified or an x to quit If the form is used the command will display one register at a time and prompt the user for a new value It will continue to do this for the entire family starting with the specified register If the two address version is used the command will display one register at a time and prompt the user for a new value It will do this for all the registers specified in the range Note that special purpose and mpc106 registers can only be accessed individually and not as a family or with the or range forms mpc106 supports b h w options for byte halfword and word access Most of the SPR s can suppress the verbose mode see Section 4 1 30 regdisp rd Examples DINK32_603e gt gt rm r6 gpr06 0x000000
17. ruction gt 2100 exception has occurred Pointer 0x00002104 stw r13 Oxfff8 r01 exception has occurred Pointer 0x00002108 add r03 r00 r01 exception has occurred Pointer 0x0000210c mfspr r04 s0274 Dink32 R12 User s Manual M MOTOROLA Commands 4 1 2 about about M DINK32 version information MDINK32 Compatible The version information for the current implementation of the DINK32 monitor will be displayed on the terminal DINK32 Example DINK32 MPC603ev gt gt about A Reset Exception 0x100 initiated this restart Caches Enabled L1 ICache L1 DCache DDD LE E N N K K 333 222 D D JE NN N K K 3 3 2 2 D D dE N NN KK 33 22 D D I N NN K K 3 3 22 DDD ELT N N K K 3 3 3 22222 for MPC603ev Metaware Build Version 12 Revision O0 Written by Motorola s RISC Applications Austin TX Released November 30 1999 System Welcome to Excimer A Minimum System PowerPC Design Processor MPC603ev V12 1 133 MHz Memory 66 MHz Copyright Motorola Inc 1993 1994 1995 1996 1997 1998 1999 Changes for each release Errata for dink Future Enhancements and bug fixes are documented in the file history c DINK32_MPC603ev gt gt MDINK32 Example MDINK32 603e gt gt about Data Cache has been enabled Instruction Cache has been enabled M M DDD III N N K K 33 S 222 M MM D D E NN N K K 3 3 2 2 M MM D D I N NN KK 33 22 M M D D I N NN K K 3 3 22
18. 0x0a ORD 0x00000000 Q 2 sz M PR M MOTOROLA Chapter 4 MDINK32 DINK32 Commands 4 27 Commands 4 1 10 download a download data from the host MDINK32 Compatible RAM download Syntax download k keyboard port duart channel A download h host port duart channel B e download kl h q fx v o offset FLASH download Syntax download fl e o address download directly to flash memory This instruction provides the ability to receive data from the host keyboard via the serial port The data received can be in two formats S Records or compressed S Records which are automatically decompressed The data which is downloaded will be placed in memory locations specified by the input file for RAM or as specified for FLASH There are two separate forms one for RAM and one for FLASH downloads Information on S Records can be found in Appendix D RAM download options e The k option copies the data stream from the keyboard serial port into memory while h option copies data from the host serial port One of these two options must be supplied e The q option is quiet mode no indication of download progress is supplied e The fx option enables XON XOFF software flow control for downloading at higher speeds e The v option verifies a previous download printing an error message for each difference found The ooffset option adds a hexadecimal offset to the address of the S Recor
19. 1 e control register status register embedded utilities memory block etc Features provided by the Kahlua implementation that may or may not be common with other implementations 1 e not generic DMA operations are made available to the application however the interface is controlled by passing parameters defined in the API rather than the application having to have any knowledge of the Kahlua implementation i e registers embedded utilities memory block etc The API will be expanded to include chaining mode and additional DMA transfer control features in future releases DMA API functions showing the following AN MOTOROLA Appendix I MPC8240 DMA Memory Controller 101 113 MPC8240 DMA Memory Controller how the function is called i e function prototype parameter definition possible return values brief description of what the function does an explanation of how the functions are used by an application program DINK32 usage employed as examples ADMA Driver Library Internals DLI which provides information about the lower level software that is accessing the Kahlua specific implementation of the DMA interface e DMA DLI functions showing the following how the function is called 1 e function prototype parameter definition possible return values brief description of what the function does 1 3 DMA Application Program Interface API API functions description The DMA API funct
20. 48 00 DINK32_KAHLUA gt gt 4 60 Dink32 R12 User s Manual M MOTOROLA Commands 4 1 33 runalias ra run alias runalias This instruction will read in the string which the user has defined as an alias Then the commands in this string will be executed sequentially Also see the da and env commands Example DINK32_750 gt gt runalias The runalias command can also be embedded within a command line For example if the alias string has previously been defined as tr rd r Typing the command DINK32 750 gt gt log trace 2100 runalias log is identical to typing DINK32 750 gt gt log trace 2100 tr rd r log See defalias for a complete example M MOTOROLA Chapter 4 MDINK32 DINK32 Commands 4 61 Commands 4 1 34 Setbaud sb displays or changes the speed of the serial port mdink32 compatible e setbaud h k e setbaud h k rate This command sets the baud rate for the host serial port h or the keyboard serial port k by specifying the appropriate flag followed by a valid rate 2400 4800 9600 19200 38400 57600 If only a flag is specified the current baud rate for that serial port is returned e Example sb h would return the current baud rate for the host serial port Example sb k 9600 would set the host serial port baud rate to 9600 4 1 34 1 Host versus Keyboard Used by log sb dl and tr commands See Section 4 1 10 download dl Section 4 1 17 log log
21. Ck Ck Ck Ck Ck Ck Ck KKK Kk kk Ck Ck Ck Ck Ck Ck Ck Ck ck ck ck ck ck Ck Ck Ck Ck Ck Ck Ck Ck Ck Ck ok ko ko ck ok ko ko k k kk finclude dinkusr h int putcanon int a grab the character sent by printf in Hsds and use it in dink putchar us char C c a write char c return 1 int _getcanon extract the character received by scanf in Hsds and use it in dink putchar S unsigned long key key get KEYBOARD return get char key AN MOTOROLA Appendix G Dynamic functions such as printf 106 111 MPC8240 Kahlua Drivers Appendix H MPC8240 Kahlua Drivers H 1 Drivers directory There are four drivers for the MPC8240 integrated peripheral devices e DMA memory controller e 2C serial controller e 2O doorbell controller e EPIC interrupt controller Sample code for each of these drivers are in the directory drivers under dink32 Under the drivers directory are four directories one for each controller see Figure 3 1 The following sections describe the driver and the sample code Each driver is discussed in one of the following four appendices e Appendix I MPC8240 DMA Memory Controller e Appendix J MPC8240 I2C Driver Library e Appendix K MPC8240 I20 Doorbell Driver Appendix L MPC8240 EPIC Interrupt Driver 10H 112 Dink32 R12 User s Manual M MOTOROLA MPC8240 DMA Memory Controller Appendix MPC8240 DMA Memory Controller This section provides
22. DINK32 750 gt gt memod h 601 0x00060100 0x66444444 DINK32 750 gt gt memod w 601 0x00060100 0x33334444 DINK32 750 memod 60110 0x00060110 0x89898989 0x00060114 0x89898989 0x00060118 0x89898989 DINK32 750 gt gt memod 60200 0x00060200 0x89898989 0x00060204 0x00000000 12341234 0x00060208 0x00000000 2 4 44 Dink32 R12 User s Manual modify loop 44444444 22222222 60118 S dOLITEDBT 22222222 333339733 12341234 4 3 22 memove mv memory move e memove lt start addr gt end addrs dest addr gt Commands This command copies data from a block of memory bounded inclusively by the first two addresses to a block of memory starting at the third address The result of this command will be two identical blocks of memory If the third address falls between the first two addresses an error message is returned and memory will not be modified Examples DINK32 750 DINK32 750 0x00060100 0x00060110 0x00060120 0x00060130 0x00060140 0x00060150 DINK32 750 DINK32 750 0x00060100 0x00060110 0x00060120 0x00060130 0x00060140 0x00060150 memfill 60100 60110 ffffffff memdisp 60100 60150 EI fftffftf ELE EECLTE 00000000 00000000 00000000 00000000 gt gt memove 60100 60110 60140 f fffffftf 00000000 00000000 00000000 00000000 00000000 fftffftttf 00000000 00000000 00000000 00000000 00000000 memdisp
23. I2C library functions to report error and status condition information If no print function is supplied by the application the call to I2C Initialize must provide a NULL value for this parameter in which case the I2C library will not attempt to access a print function I2C Status I2C do transaction I2C INTERRUPT MODE en int I2C TRANSACTION MODE act unsigned char i2c_addr unsigned char data addr int len char buffer I2C STOP MODE stop int retry I2C RESTART MODE rsta Where e en int controls the I2C interrupt enable status currently use I2C INT DISABLE only polling mode e actis the type of transaction I2C MASTER RCV or I2C MASTER XMIT e 12c_addr is the I2C address of the slave device e data addr is the address of the data on the slave device AN MOTOROLA Appendix K MPC8240 120 Doorbell Driver 10K 145 MPC8240 120 Doorbell Driver enis the length in bytes of the data e buffer is a pointer to the buffer that contains the data xmit mode or receives the data rcv mode e stop controls sending an I2C STOP signal after completion curently use I2C STOP only retry is the timeout retry value currently ignored e rsta controls I2C restart currently use I2C NO RESTART only e Return I2C Status return value is either I2C SUCCESS or I2C ERROR Description Act as the I2C master to transmit or receive a buffer of data to or from an I2C slave device This func
24. Section 5 5 Embedded Utilities Memory Block Base Address Register Section 5 1 Configuration Register Access L 2 2 EPIC Register Summary The EPIC register map occupies a 256 Kilobyte range of the EUMB All EPIC registers are 32 bits wide and reside on 128 bit address boundaries The EPIC registers are divided into four distinct areas whose address offsets are based on the EUMB location in local memory controlled by the value in the EUMBBAR configuration register The EPIC address offset map areas e 0x4 1000 0x4 10F0 Global EPIC register map e 0x4 1100 0x4_FFFO Global timer register map e 0x5 0000 0x5 FFF0 Interrupt source configuration register map e 0x6 0000 0x6 OFFO0 Processor related register map Please refer to Section 12 2 in the MPC8420 User s Manual for the complete EPIC register address map table and Section 12 9 for all register definitions L 2 3 EPIC Modes e Pass through Mode This mode provides a mechanism to support alternate interrupt controllers such as the 8259 interrupt controller architecture Pass through is the default mode of the EPIC unit Mixed Mode This mode supports two subsequent interrupt modes either a serial interrupt mode up to 16 serial interrupt sources or a direct interrupt mode up to 5 interrupt sources Refer to Sections 12 4 12 6 in the MPC8240 User s Manual for more on EPIC modes L 3 Directory Structure DINK32 drivers epic e epic h contains all EPIC register address ma
25. and interpreted as one byte hex values in the case of the revision number and version number fields For the module name and text comment fields these values should be interpreted as hexadecimal values of ASCII characters S1 The address field is interpreted as a 2 byte address The data in the record is loaded into memory at the address specified S2 The address field is interpreted as a 3 byte address The data in the record is loaded into memory at the address specified S3 The address field is interpreted as a 4 byte address The data in the record is loaded into memory at the address specified S5 The address field is interpreted as a 2 byte value which represents a count of the number of 10D 98 Dink32 R12 User s Manual M MOTOROLA S Record Format Description S1 S2 and S3 records previously transmitted The data field is unused S7 The address field is interpreted as a 4 byte address and contains the execution start address The data field is unused S8 The address field is interpreted as a 3 byte address and contains the execution start address The data field is unused S9 The address field is interpreted as a 2 byte address and contains the execution start address The data field is unused D 3 Examples Following are some sample S record entries broken into their parts with a short explanation Example 1 S010000077726974656D656D2E73726563AA Separated S0 10 0000 77726974656D656D2E73726563 AA
26. as an offset from the Embedded Utilities Memory Block EUMB The EPIC unit supports two modes Mixed and Pass through The DINK32 EPIC driver sample code demonstrates EPIC in direct mode and also error checks for Pass through mode but Serial mode is not implemented due to the current inability to test this mode on the Sandpoint reference platform The EPIC registers are in little endian format If the system is in big endian mode the bytes must be appropriately swapped by software DINK32 is written for big endian mode and the sample code referred to in this appendix performs the appropriate byte swapping L 2 1 Embedded Utilities Memory Block EUMB The EUMB is a block of local and PCI memory space allocated to the control and status registers of the embedded utilities The embedded utilities of the MPC8240 are the Messaging Unit 1 0 DMA controller EPIC PC and ATU The local memory map location of the EUMB is controlled by the embedded utilities memory block base address register EUMBBAR The PCI bus memory map location of the EUMB is controlled by AN MOTOROLA Appendix L MPC8240 EPIC Interrupt Driver 10L 157 MPC8240 EPIC Interrupt Driver the peripheral control and status registers base address register PCSRBAR Since EPIC is only accessible from local memory only the EUMBBAR is of concern for this appendix Please refer to the following sections in the MPC8420 User s Manual Section 4 4 Embedded Utilities Memory Block
27. cs bit shall be used not the cc bit Hardware will not set clear this bit each time DMA transaction stops or starts Software shall do it cs bit shall not be used to halt chaining DMA transaction for modifying the descriptor That is the role of CC bit unsigned int cs 1 DMA MR structure for DMA Status register typedef struct dma sr unsigned int reservedO 24 unsigned int lme 1 unsigned int reservedl 2 unsigned int pe 1 unsigned int reserved2 1 unsigned int cb 1 unsigned int eosi 1 unsigned int eocai 1 DMA SR structure for DMA current descriptor address register typedef struct _dma_cdar unsigned int cda 27 unsigned int snen 1 unsigned int eosie 1 unsigned int ctt 2 unsigned int eotd 1 DMA_CDAR structure for DMA byte count register typedef struct _dma_bcr unsigned int reserved 6 unsigned int bcr 26 DMA BCR structure for DMA Next Descriptor Address register typedef struct dma ndar unsigned int nda 27 unsigned int ndsnen 1 unsigned int ndeosie 1 unsigned int ndctt 2 unsigned int eotd 1 DMA_NDAR structure for DMA current transaction info 101 120 Dink32 R12 User s Manual Ey MPC8240 DMA Memory Controller typedef struct _dma_curr unsigned int src_addr unsigned int dest_addr unsigned int byte_cnt DMA_CURR 1 5 Kahlua DMA Driver Lib
28. d option is to delete a single user symbol The user cannot delete or clear DINK s symbols The symbols in the table can be used as the address G symbol of the branch instruction while executing the as command Examples DINK32 603e gt gt as 60000 0x00060000 Oxff0000ef fsel 24 f00 00 03 brilixor rijur25ri3 0x00060000 Oxff0000ef BRANCH LABEL brl 0x00060000 Oxff0000ef fsel 24 00 00 03 xor r3 r4 r5 0x00060004 0Oxffc037fc fnmsub 30 00 31 06 br2 xor LD AS 0x00060004 Oxffc037fc BRANCH LABEL br2 0x00060004 O0Oxffc037fc fnmsub 30 00 31 f06 x VERIFYING BRANCH LABELS DONE VERIFYING BRANCH LABELS DINK32 603e gt gt ds 60000 0x00060000 0x7c832a78 BRANCH LABEL bri 0x00060000 0x7c832a78 xor r03 r04 r05 DINK32 603e gt gt as 60100 0x00060100 Ox85ffffc4 lwzu r15 Oxffc4 r31 br3 xor 153 0635 4 0x00060100 0x85ffffc4 BRANCH LABEL br3 0x00060100 0x85ffffc4 lwzu r15 Oxffc4 r31 x VERIFYING BRANCH LABELS DONE VERIFYING BRANCH LABELS DINK32 603e gt gt st Current list of DINK branch labels KEYBOARD 0x0 get_char Oxle5e4 write_char Ox5fac TBaseInit 0x39c4 TBaseReadLower 0x39e8 TBaseReadUpper 0x3a04 CacheInhibit 0x3a20 InvEnLlDcache 0x3a40 DisLlDcache 0x3a88 4 64 Dink32 R12 User s Manual InvEnLllcache DisL1Icache BurstMode RamInCBk RamInWThru dink loop
29. dink printf Ox3aac 0x3b00 Ox3bfe 0x3c3c Ox3c7c 0x5660 0x6368 Current list of USER branch labels beds btf2s br3 0x60000 0x60004 0x60100 DINK32 603e gt gt st d br2 DINK32 603e gt gt st Current list of DINK branch labels KEYBOARD get char write char TBaseInit TBaseReadLower r BaseReadUpper CacheInhibit InvEnLlDcache Dis InvEn Dis LiDcache lIcache Ll1Icache BurstMode RamInCBk RamInWThru dink loop dink printf Current list of USI bed bri 0x0 Oxle5e4 Ox5fac 0x39c4 0x39e8 0x3a04 0x3a20 0x3a40 0x3a88 Ox3aac 0x3b00 Ox3bfe 0x3c3c Ox 307 0x5660 0x6368 ER branch labels 0x60000 0x60100 DINK32 603e gt gt st c DINK32 603e gt gt st Current list of DINK branch labels KEYBOARD get char write char TBaseInit TBaseReadLower TBaseReadUpper CacheInhibit InvEn Dis InvEn Dis B Ra d din M MOTOROLA 1Dcache LlDcache slIcache LlIcache urstMode RamInCBk nInWThru ink loop k printf 0x0 Oxle5e4 Ox5fac 0x39c4 0x39e8 0x3a04 0x3a20 0x3a40 0x3a88 Ox3aac 0x3b00 Ox3bfe OX SESS 0x3c7c 0x5660 0x6368 Chapter 4 MDINK32 DINK32 Commands Commands 4 65 Commands Current list of US ER branch labels DINK32_603e gt gt 4 66 Dink32 R12 User s Manual Commands 4 1 36 tau tau TAU Thermal Assist Unit CONTROL tau
30. dinkyk dinkyk g Excimer dinkex src dinkex g src dinkex dinkex g The source files can be used to build DINK32 or MDINK32 The source files are c s and h Other files are makefile and READ ME Motorola uses the Metaware tool set to build MDINK32 and DINK32 in a UNIX environment The syntax of the makefile therefore complies with the make program available on UNIX machines The command to build DINK32 on a UNIX command line is make dink and the command to build MDINK32 is make mdink MDINK32 is a subset of DINK32 Both versions share many source files Of all the files that contribute to the making of MDINK32 the files that MDINK32 does not share with DINK32 is mpar_tb c and mhelp c DINK32 s version of mpar_tb c is par tb c and mhelp c is help c Both can also be build on UNIX with the GNU gcc tool set using makefile gcc and on a PC NT with the Metaware tool set using makefile pc The source files and the makefile of DINK32 and MDINK32 reside in the same directory structure However the object files 0 the ELF file and S record file of each version reside on a different directory When the make dink command is executed the dink dir directory is created and the output files produced by make are put in dink dir Likewise when the make mdink command is executed the mdink dir directory is created and the output files are put in mdink dir see Figure 3 1 In addition the make
31. epic dis Vector 0 23 Disable a particular interrupt vector e dev epic con Vector 0 23 Print content of a Source Vector Priority register e dev epic con Vector 0 23 Polarity 0l1 Sense 011 Priority 0 15 Program the Source Vector Priority register Example devepicin Initialize EPIC unit dev epic en Enable interrupt vector 1 dev epic ta 10 Set the Processor Task priority register to 10 dev epic dis 5 Disable interrupt vector 5 dev epic con 2 Print the configuration of Interrupt vector 2 dev epic con 7 0 5 Configure the source Vector Priority register of vector 7 to have the following properties Polarity 1 Sense 0 Priority 5 L 7 EPIC Unit Startup When the MPC8240 comes up running DINK32 the EUMBBAR is configured such that 10L 162 Dink32 R12 User s Manual M MOTOROLA MPC8240 EPIC Interrupt Driver the EUMB is located at an offset of OXFCOO 0000 from local memory The EPIC unit is untouched by the DINK32 initialization routines and is left in its default state of Pass Through mode External interrupts are also left untouched and left in the default state of disabled The following list shows the necessary initialization steps and routine calls needed to utilize the EPIC unit e epiclnit e For each interrupt vector to be used epicSourceConfig epicISRConnect e For each interrupt vector to be used epicIntEnable e epicCurTaskPrioSet e CoreExtIntEnable L 8 Ex
32. for testing prior to integration with EPIC different depending on if DINK is running on host or agent if target mode 0 running on host unsigned int kahlua pcsrbar get kahlua pcsrbar PRINT kahlua s pcsrbar Oxsx n kahlua_pcesrbar switch mode case 0 read agent s outbound DB register and print it out db_reg_content I20DBGet REMOTE kahlua_pcsrbar 10K 140 Dink32 R12 User s Manual M MOTOROLA MPC8240 120 Doorbell Driver PRINT Agent s outbound doorbell register Ox xMn db reg content break case 1 set agent s inbound doorbell register db reg content 1 bit I20DBPost REMOTE kahlua pcsrbar db reg content break case 2 VN nabl agent s outbound DB register interrupts if I20DBEnable REMOTE kahlua pcsrbar 0 I20SUCCESS PRINT Cannot enable agent s outbound doorbell interrupt n else PRINT Enabled agent s outbound doorbell interrupt n break case 3 Jo disable agent s outbound DB register interrupts if I20DBDisable REMOTE kahlua pcsrbar 0 I20SUCCESS PRINT Cannot disable agent s outbound doorbell interrupt n else PRINT Disabled agent s outbound doorbell interrupt n break tifdef DBG_I20 case 4 I20 ISR host break endif else running on agent PRINT kahlua s eumbbar Ox x n eumbbar Switch mode case 0 read a
33. if status tok get next token amp token temp SUCCESS return FAILUR El if status ascii to int dec temp sector number AN MOTOROLA Appendix A Adding Commands and Arguments 10A 89 Adding Commands and Arguments strlen temp SUCCESS PRINT Error getting decimal value n return status 10A 90 Dink32 R12 User s Manual Adding ERROR Groups to MDINK DINK32 Appendix B Adding ERROR Groups to MDINK DINK32 B 1 Error Group Files The two files used for adding an ERROR grouping to dink32 and mdink32 are err_tb h and errors h Both files contain the defined macro NUM_ERRORS and both must be changed whenever a new error group is added B 1 1 err_tb h About line 30 increment NUM_ERRORS by the number of error groups you are adding In this case change it from 46 to 47 define NUM ERRORS 47 Now add the new entry to the structure err element This structure has two parts the code and a string constant for the error message Add the message FLASH ERROR FLASH error 46 It is a good idea to add a comment to the end of any added lines for the struct entries with the error number B 1 2 errors h About line 51 increment the defined macro NUM ERRORS as in err tb h It is important to do this as err tb h includes this file However it then defines NUM ERRORS again as we saw above In effect overwriting the NUM ERRORS value in this file errors h This file
34. information about the generic Application Program Interface APD to the DMA Driver Library as well as information about the implementation of the Kahlua specific DMA Driver Library Internals DLI I 1 Background The intended audience for this document is assumed to be familiar with the DMA protocol It is a companion document to the Kahlua specification and other documentation which collectively give details of the DMA protocol and the Kahlua implementation This document provides information about the software written to access the Kahlua DMA interface This software is intended to assist in the development of higher level applications software that uses the DMA interface Note The DMA driver software is currently under development The only mode that is functional is a direct transfer chaining is not yet implemented Only transfers to and from local memory has been tested Controlling a remote agent processor is not yet implemented Of the various DMA transfer control options implemented in Kahlua the only ones currently available in this release of the DMA library are source address destination address length channel interrupt steering and snoop enable 1 2 Overview This document consists of these parts An Application Program Interface API which provides a very simple generic application level programmatic interface to the DMA driver library that hides all details of the Kahlua specific implementation of the interface
35. is used to define the code for each error message This code is printed out along with the string for the error About line 215 add the value for the FLASH ERROR code define FLASH ERROR 0xf100 OxF100 was chosen because it appears that the grouping is determined by the first two hex characters and the last two hex characters are just sequential increments for errors in that category So codes Oxf5xx through Oxffxx were already in use So chose Oxf1xx randomly from the available ones of Oxf0xx through Oxf4xx These are the only files that need to be changed The actual work is performed by err tb c When a dink32 function returns to the main dink32 loop it can return one of these error messages As in return FLASH_ERROR Then the function err print error about line 35 searches this structure err list comparing the error number with the err list 1 code When M MOTOROLA Appendix B Adding ERROR Groups to MDINK DINK32 10B 91 Adding ERROR Groups to MDINK DINK32 it finds the code it prints the code value and the error message If it can t find the code then 1t prints the message UNKNOWN ERROR 10B 92 Dink32 R12 User s Manual M MOTOROLA History of MDINK32 DINK32 changes Appendix C History of MDINK32 DINK32 changes C 1 Version 12 0 November 30 1999 1 Implement a dink transfer table to dynamically assign dink functions such as printf dinkloop getchar in a table so that it is no longer necessary to s
36. memfill start end data The range of memory spanning from the starting address to the ending address is filled in with the given 32 bit data pattern The fill is inclusive of the end point Examples DINK32 750 DINK32 750 DINK32 750 0x00060120 0x00060130 0x00060140 0x00060150 0x00060160 DINK32 750 DINK32 750 0x00060120 0x00060130 0x00060140 0x00060150 0x00060160 4 42 memfill 60100 60200 89898989 memfill 60140 6015c 00000000 memdisp 60120 60160 89898989 89898989 00000000 00000000 89898989 89898989 89898989 00000000 00000000 89898989 89898989 89898989 00000000 00000000 89898989 gt gt memfill 60144 60144 44444444 memdisp 60120 60160 89898989 89898989 00000000 00000000 89898989 89898989 89898989 00000000 00000000 89898989 89898989 89898989 00000000 00000000 89898989 Dink32 R12 User s Manual Commands 4 1 20 meminfo mi mi s c c mi displays information about the memory settings If no option is selected the current memory controller settings are decoded Options for SODIMM DIMM based systems only e s show I2C ROM info e c compare I2C info to memory controller settings for errors If c is entered a second time the settings will be corrected Setting the MEMOPT ENV variable is equivalent to entering mi c c at startup Example DINK32_ARTHUR gt gt mi Memory settings RO Speed
37. n epicISR for vect H TO 3 50 FHHrHHdHHubudHikHdukldudHiH ukHduiudHiH HiubnudH kHiaHrHdudH HkHiHkHdkHkHiuHikHuHnudHiuHBdungotmtpttucutntioonuutHut s t Vector 2 gt ISRAddr 32d94 count to 0x1000000 Vector 16 gt ISRAddr 32dd4 count to 0x2000000 Vector 17 gt ISRAddr 32e14 iority rupts in MSR icISR for vector 16 tine for Timer 0 or 17 tine for Timer 1 ort 16 tine for Timer 0 or 16 tine for Timer O0 ord 17 tine for Timer 1 ort 16 tine for Timer 0 or 16 ord 1 tine for interrupt 1 or tine for interrupt 1 or 6 tine for Timer 0 or 7 tine for Timer 1 ort 1 ord 2 tine for interrupt 2 ord 2 tine for interrupt 2 ord 6 tine for Timer 0 ord 6 The user can show that DINK32 can still respond to user is input by manually disabling the timer interrupts To disable the timers access their vector priority registers located in local memory by typing the following this modifies the memory location oftimerO vector priority register mm ffc041120 enter this sets the interrupt mask bit 00000080 enter 10L 166 Dink32 R12 User s Manual MPC8240 EPIC Interrupt Driver this modifies the memory location of timerl vector priority register mm ffc041160 enter this sets the interrupt mask bit 00000080 enter Once the two registers are modified neither timers should
38. poll the I2C handler to actually perform the transaction one byte at a time while checking the return status to determine if there were any errors and if the transaction has completed I2CStatus I2C get unsigned int eumbbar unsigned char sender addr unsigned char buffer ptr unsigned int length unsigned int stop flag unsigned int is cnt e eumbbar is the address of the Embedded Utilities Memory Block sender addr is the sender s I2C device address buffer ptr is pointer to the data buffer to transmit length is the number of bytes in the buffer stop flag 1 signal STOP when buffer is empty e O don tsignal STOP when buffer is empty e is cnt 1 this is a restart don t check MBB e O this is a not restart check MBB e Returns Any defined status indicator Description Set up to receive a buffer of data from the desired sender addr If stop flag is set when the buffer is full and the sender does not signal STOP generate a STOP signal Caller is the master performing receiving If no STOP signal is generated the master can generate a START signal to another slave address The function does not actually perform the data buffer receive it just sets up the DLI global variables to control the transaction and calls I2C_Start to send the slave address out on the I2C bus in receive mode The application must check the return status to find out if the bus was obtained then enter a loop of calling I2C Timer Event to
39. sb Set Input 4 38 setinput si Show SPRs Dink32 R12 User s Manual Spr name sx M MOTOROLA Commands Symbol table symtab st au tau Transparent Mode transpar tm Trace trace tr repeat last command For additional details about a command please type help lt mnemonic gt DINK32 MPC603ev gt gt MDINK MINIMUM DINK COMMAND LIST Command Mnemonic AU OU E us about ab Download download dl Help help he Go go Menu menu me DINK32 750 help go Individual Commands DINK32 MPC603ev gt gt help go Q O Mnemonic go Syntax go lt address gt Description This command allows the user to xecut user code starting at the specified address Execution will continue until a breakpoint or an exception occurs If the form is used then execution will start at the address defined by the contents of bits 0 29 of SRRO The user should terminate their code with an illegal opcode or with a breakpoint The value of dink loop is initially placed in the User Programming Model link register If you terminate your code with a blr to that location you will re enter DINK In the process however you will perform the prolog of the dink loop function which will sav registers ex lr off onto the currently defined stack ie the value in r1 This may be an unexpected side effect Note If a breakpoint is encountered the user must clear the breakpoint in order for execu
40. the contents of the table thereby determining which DINK32 functions are available par tb c is only available via the motorola sales office it is not included on the web site However all users can use the technique for linking their code with the these DINK32 functions The structure is defined in dink h as dink exports typedef struct int version 0 unsigned long keyboard 4 int printf const char jek 8 unsigned int dink loop Ja DS int is char in duart 16 unsigned int menu 20 unsigned int par about E 24 unsigned int disassemble long long e Tg wy char get char unsigned long PE 32k char write char char f Lao o dink exports and populated in par tb c as dink transfer table dink exports dink transfer table 1 amp KEYBOARD int const char dink printf dink loop AN MOTOROLA Appendix G Dynamic functions such as printf 10G 107 Dynamic functions such as printf is_char_in_duart menu par_about disassemble get_char write_char y As you can see at this time these are the only functions that are supported Additional or replacement DINK32 functions can be added to the table This table is allocated and linked into the DINK32 binaries The user typically downloads his her program into the starting location of free memory at this release address 0x90000 Unfortunately the user prog
41. two summary help menus one for dink32 and the other for mdink32 They are discriminated by the dink type variable dink type 0 for dink32 and dink type 1 for mdink32 Simply add the summary command to the appropriate menu The menus are simply PRINT statements in the function menu There is no distinction between dink32 and mdink32 for the specific command help file Simply build a function called help command such as help info This function consists entirely of PRINT commands describing the new command To make the specific help commands available specify the help function with the command function in the command tb h file There are two steps 1 add an extern for the command and help functions Such as extern STATUS par bm and extern void help bm for the benchmark command 2 Add the command name tag function and help function name to the structure cmd struct dink cmds struct cmd struct dink_cmds NUM_CMD ab about NO TAG par about help about as assemble MODIFY TAG par asdm help asm ds disassem DISPLAY TAG par asdm help disasm The entry in this table will register your command and your help file The members of each entry are short name long name tag function name and help function name The tag is used to specify the argument list for your function and is invoked in the par head parser function in par tb c NO TAB indicates that no command pointer
42. 00 12345678 4 58 Dink32 R12 User s Manual M MOTOROLA Commands DINK32_603e gt gt rd r6 gpr06 0x12345678 gpr07 0x00000000 DINK32 603e gt gt rm mpcl06 70 ADDR VALUE DESCRIPTION 0x70 0x0000 Power management config 1 new value 1234 DINK32 603e gt gt rd mpc106 70 ADDR VALUE DESCRIPTION 0x70 0x1234 Power management config 1 DINK32 603e gt gt rm f4 f7 s8 displays the contents of floating point register 4 and prompts the user for new data then increments through registers 5 7 Then the contents of s8 are displayed and can be modified DINK32 603e gt gt rm mpcl06 h Oxaa sets the contents of the mpcl06 register in halfword starting at offset Oxaa AN MOTOROLA Chapter 4 MDINK32 DINK32 Commands 4 59 Commands 4 1 32 FC tc modify display real time clock lt yellowknife and sandpoint only gt rtc s w The rtc command allows setting or displaying the real time clock available on the Yellowknife or Sandpoint systems e 5 Sets the clock you are prompted for the date and time e W Watches the clock The date and time are repeated until a key is pressed on the keyboard If no option is given the current date and time are displayed Example DINK32_KAHLUA gt gt rtc 2000 00 14 03 38 14 DINK32 KAHLUA gt gt rtc s Year 2 99 Month 06 Day soc Hour i Minute 48 Second 00 Set to 1999 06 21 11 48 00 1999 06 21 11
43. 00000003D20DEAD6129BEEF3C60000060E0 s2190700156300003CC0004060C600007D20192E7CE0182E7C07EC s21907002A480040820014386304007C0330004180FFE848000059 S20907003F004800000068 S804070000F4 This information is an encoding of data to be loaded into memory by a S record loader The address at which the data is loaded is determined by the information in the S record The data is verified through the use of a checksum located at the end of each record Each record in a file should be followed by a linefeed The general format of an S record is as follows Type char 2 Count char 2 Address Ghar 4 6 or 8 Data char 0 64 Checksum char 2 Note that the fields are composed of characters Depending on the field these characters may be interpreted as hexadecimal values or as ASCII characters Typically the values in the Type field are interpreted as characters while the values in all other fields are interpreted as hex digits Type Describes the type of S record entry There are S0 S1 S2 S3 S5 S7 S8 and S9 types This information is used to determine the format of the remainder of the characters in the entry The specific format for each S record type is discussed in the next section Count When the two characters comprising this field are interpreted as a hex value indicates the number of remaining character pairs in the record Address These characters are interpreted as a hex address They indica
44. 060100 0Ox85ffffc4 lwzu r00 r02 r05 0 0 0x00060104 Ox00ffffa0d WORD 0x00060108 Oxff0040ef fsel r0 r13 r23 0x1 0xa 0x0006010c Oxfe4004ff fnmadd 0x00060110 OxOOffff01 WORD rl5 Oxtftc4 ral OxOOffffaO0 24 00 08 03 18 00 OxOOffff01 19 E OD loop lfd f0 0x0ec5 rl branch label 0x0006011 0x0006011 0x0006011 0x0006011 CES 4 0 269 E 0x0006011 0x000601 oN ooo c0 OxOOffff01 BRANCH LAB OxOOffff01 WORD OxOOffff00 WORD Oxef0040fd fnmsubs Ox7 0000ff WORD Ox22ffbf80 subfic EL loop OxOOffff01 OxOOffff00 24 00 Orr EZO 22 ORTE lfd 00 0x0503 r0 03 08 cmpw 0x7 0000ff T2353 bne cr3 loop Oxbf80 x VERIFYING BRANCH LABI DONE VERIFYING BRANC H LAB DINK32 603e gt gt st Current KEYBOARD get char rite char TBaseInit TBaseReadLower TBaseReadUpper CacheInhibit InvEbnLlDcache DisLlDcache InvEnLlicache DisL1Icache BurstMode RamInCBk RamInWThru dink loop dink printf Ww L Current list of USI list of DINK branch labels 0x0 Oxle5e4 Ox5fac 0x39c4 0x39e8 0x3a04 0x3a20 0x3a40 0x3a88 Ox3aac 0x3b00 Ox3bfe Qx3c3G6 0x3c7c 0x5660 0x6368 ER branch labels loop 0x60110 DINK32_603e gt gt assemble 60300 60310 0x00060300 0x00060304 0x00060308 0x0006030c 0x60010 0x00060310 0x00060310 DINK32 603e gt gt Oxff000 Ox82ffff00 l
45. 1 NOTE This function is tested only for the master transmit and master receive in polling mode I don t think it is tested even in those modes for situations when the slave does not acknowledge or bus arbitration is lost or buffers overflow etc K 2 4 3 The following DLI functions were written but not used and not tested I2CStatus I2C write unsigned int eumbbar unsigned char buffer ptr unsigned int length unsigned int stop flag e eumbbar is the address of the Embedded Utilities Memory Block e buffer_ptr is pointer to the data buffer to transmit length is the number of bytes in the buffer 10K 154 Dink32 R12 User s Manual M MOTOROLA MPC8240 120 Doorbell Driver stop flag 1 signal STOP when buffer is empty e O don signal STOP when buffer is empty Returns Any defined status indicator Description Send a buffer of data to the requiring master If stop flag is set after the whole buffer is sent generate a STOP signal provided that the requiring receiver doesn t signal the STOP in the middle Caller is the slave performing transmitting I2CStatus I2C read unsigned int eumbbar unsigned char buffer ptr unsigned int length unsigned int stop flag e eumbbar is the address of the Embedded Utilities Memory Block e buffer ptr is pointer to the data buffer to transmit length is the number of bytes in the buffer stop flag 1 signal STOP when buffer is empty e O don signal STOP when buffer is empty
46. 103 Updating DINK32 from the Web Appendix F Updating DINK32 from the Web F 1 General Information The DINK32 web site is part of the motorola non confidential web site The URL is http www mot com SPS PowerPC tecsupport tools DINK32 index html The format in general includes elf and sfiles for DINK32 both debug and non debug on F 1 1 For YellowKnife and Sandpoint Using a ROM burner or in line ROM emulator load the dink32 sfile See Section 4 1 13 fupdate fu F 1 2 For Excimer and Maximer Using the mdink32 facility running on an Excimer and Maximer board download the new dink32 with the command dl fl o ffc00000 then using your terminals ascii download facility download the dink32 sfile See Section 4 1 14 fw fw e and Section 4 1 10 download dl MDINK32 is not supplied as elf or sfiles on this site However all the code some code is purposefully removed and the object files are substituted is available to build mdink32 Loading MDINK32 requires unprotecting sector 15 on the Excimer and Maximer and using some type of emulator to download the code Selected DINK32 code is available at this site Some files are not released in source form however the object code for the removed files are supplied so that DINK32 can be built All the source including the removed code is available from the Motorola confidential site and can be obtained from you Motorola Salesperson F 2 Makeing a DINK32 or MDINK32 from t
47. 2C ISR unsigned int eumbbar e eumbbar is the address of the Embedded Utilities Memory Block e Returns DCADDRESS if address phase for master receive results from call to 12C_Slave_Addr if being addressed as slave untested results from call to 12C_Master_Xmit if master transmit data mode results from call to I2C_Master_Rcv if master receive data mode results from call to I2C Slave Xmit if slave transmit data mode untested results from call to I2C Slave Rcv if slave receive data mode untested I2CSUCCESS if slave has not acknowledged generated STOP untested I2CSUCCESS if master has not acknowledged wait for STOP untested I2CSUCCESS if bus arbitration lost untested Description Read the DDCCR and DCSR to determine why the I2CSR MIF bit was set which caused this function to be called Handle condition see above in possible return values This function is called in polling mode as the handler function when an I2C event has occurred It is intended to be a model for an interrupt service routine for polling mode but this is untested and the design has not been reviewed or confirmed This function may only be called when the following condition is met RCSR MIF 1 This function is tested only for the master transmit and master receive in polling mode I don t think it is tested even in those modes for situations when the slave does not acknowledge or bus arbitration is lost or buffers overflo
48. 2CStatus I2C Slave Xmit unsigned int eumbbar NOTE untested e eumbbar is the address of the Embedded Utilities Memory Block Returns I2CSUCCESS if data byte sent I2CBUFFEMPTY if no data in sending buffer Description Slave sends one byte of data to requesting master The DLI global variables ByteToXmit XmitByte and XmitBuf are used to determine which byte if any to send This function may only be called when the following conditions are met I2CSR MIF 1 I2CSR MCF 1 2CSR RXAK 0 DCCR MSTA 0 DCCR MTX 1 I2CStatus I2C Slave Rcv unsigned int eumbbar NOTE untested e eumbbar is the address of the Embedded Utilities Memory Block e Returns I2CSUCCESS if data byte received IZCBUFFFULL if buffer is full or no more data expected Description Slave receives one byte of data from master transmitter The DLI global variables ByteToRcv RcvByte and RcvBufFulStop are used to control the accepting of the data byte or setting the acknowledge bit I2CCR TXAK if the expected number of bytes have been received This function may only be called when the following conditions are met I2CSR MIF 1 I2CSR MCF 1 I2CCR MSTA 0 DCCR MTX 0 I2CStatus I2C_Slave_Addr unsigned int eumbbar NOTE untested e eumbbar is the address of the Embedded Utilities Memory Block AN MOTOROLA Appendix K MPC8240 120 Doorbell Driver 10K 153 MPC8240 120 Doorbell Driver e Returns I2CADDRESS if asked to receive data results from
49. 32 Commands 4 47 Commands e addrl addr2 Specifies the starting and ending address respectively The addresses must be aligned to the size of the access as specified by the b h w option Note be careful not to test memory regions used by DINK 0x90000 is a safe starting point for DINK 11 0 2 or earlier Examples DINK32_ARTHUR gt gt mt q 90000 1fffffc This quickly tests the default 32MB SDRAM DIMM on Yellowknife Sandpoint systems DINK32_ARTHUR gt gt mt q 90000 1fffffc PASS 1 DUBCKE Teste uet eee A A O AO REA ene ueri e ies uc PASS Completed tests No errors DINK32_ARTHUR gt gt mt b a 1 0 x 90000 1ffffff Use all defined test to test 32MB of memory using only byte accesses Repeat the test forever unless an error occurs DINK32_ARTHUR gt gt mt b a Te O x 90000 1fffff PASS 1 Quick Tostadas PASS Random Pattern Testi A E iS eeu SE eee ed us e ls PASS Walking 1 Se ES A A ie le AA RUE a fe cate ee Be PASS Walking Ots TASA A a eee WOCa ue aua encre Nu Bic n UE UE ES PASS Address Marcel Tostre ne see reds x EE rye ERR V ERE ELLE ie Rave e hes S PASS Weite Sensitivity TGSsStus cei ege Bs EL e e PUR e ee PASS DINK32 ARTHUR gt gt mt n S t 90000 1fffff Test 32MB using only the write sensitivity test and report the elapsed time DINK32 ARTHUR gt gt mt t n S 90000 A0000 PASS 1 Wrote Sensitivity MO E A oh sie Pale uiu rie ALA ca RUE rm I e Ho PASS Completed tests No errors Elapsed time
50. 60100 60150 ffffffff ELECEBEL 00000000 00000000 EEFLERCE EEECEBET TEEDECBE 00000000 00000000 00000000 PLECE 00000000 Chapter 4 MDINK32 DINK32 Commands Perret EE 00000000 00000000 00000000 ftfttfftftf 00000000 ffftffrftf 00000000 00000000 00000000 00000000 00000000 EIfffffff 00000000 00000000 00000000 BEEE EEEE 00000000 4 45 Commands 4 1 23 memsrch ms memory search ms lt address gt lt address gt lt data gt This command searches for a 32 bit data pattern in the inclusive block specified by the range of the two addresses If the second address is less than the first address an error message is returned and no search is performed If the pattern is found the addresses of matching data are printed to the screen The command ms 50100 50200 fff01234 searches for the data pattern fff01234 in memory locations 0x50100 to 0x50200 inclusive and prints the matching addresses Example DINK32 603e gt gt md 60100 60120 0x00060100 10ff7f00 OOffff00 ff2023ff ff0402ff dod cad 0x00060110 OO0ffff00 OO0ffff00 ff5008ff SUA ROS NI nnn D 0x00060120 00efef00 OO0ffff00 ffOl00ff RU NOE PT 0 DINK32 603e ms 60100 60120 ff5008ff 0x00060118 4 46 Dink32 R12 User s Manual ff1002ff ff0030ff Commands 4 1 2 memtest mi memory test e mt d dev bl hl w 1 loop t h a q addr1 addr2 The memtest command performs various memory tests on local memory or device registe
51. 87308 DUART Yellowknife and Sandpoint Reference Design or National Semiconductor 16552 DUART Excimer and Maximer Minimal Evaluation Board 512 K byte EPROM or Flash 512 K byte RAM 3 5 MDINK32 Software Build Process MDINK32 can be built from the dink source base Information for building MDINK32 is given in the DINK32 build section There is only one version of mdink32 for all Excimer 3 6 Dink32 R12 User s Manual M MOTOROLA MDINK32 Memory Model and Maximer boards Flash memory is automatically detected 3 6 MDINK32 Memory Model See Figure 3 3 MDINK32 DINK32 Memory Model Excimer and Maximer The following sections describe the DINK32 design methodology the minimum required hardware configuration and the memory model The current release of DINK32 is Version 12 0 3 7 New features for DINK32 V12 0 1 Detects MPC107 2 Added makefiles for the GNU gcc compiler in every directory 3 New commands env tau 4 Support for dynamically assigned dink function addresses for downloaded programs see Appendix G Dynamic functions such as printf Improved printf formats including floating point displays Dm Quiet mode on many register displays 7 Shared memory between host and agent targets using the Address Translation Unit ATU 3 8 DINK32 Design Methodology The modular design of the DINK32 program its extensive commenting and its design methodology enable efficient user modification of the
52. ACHE 12 Implement a new makefile makefile gcc and conform the dink code to build with the gcc PowerPC eabi compatible compiler Build and load works all memory features are broken This will be fixed in the next release 13 Implemented flash programming for PCI hosted boot ROM on YK SP platforms The command fl h transfers 512k from a specified memory location to the flash 14 Added share memory between host and agent targets using the Address Translation Unit ATU M MOTOROLA Appendix C History of MDINK32 DINK32 changes 10C 93 History of MDINK32 DINK32 changes C 2 A NDAN KRW N 10C 94 Version 11 0 2 June 1 1999 Fixed invalid cacheing on 603 603 does not reset the cache invalidate bits in hardware so added the facility in software Detects MPC107 About command now reports board and processor identification Improved the help facility Added makefiles for the PC makefile_pc in every directory Version 11 0 1 May 1 1999 Not Released Change the location of Stack pointer load save DINK code now occupies through 0x0080000 USER CODE MUST NOT START EARLIER THAN 0x0090000 Fixed vector alignment Fixed VSCR register implementation issue Fixed access issue for registers VRSAVE RSCR FPSCR RTCU RTCL amp RPA Fixed HIDI display for 603e 604e Fixed breakpoint exception problem broken in rev10 7 for 603e Fixed location of exception vectors after EH1200 they were wrong
53. G External Serial Source 6 0x0 EPIC SR INT7 VEC REG External Serial Source 7 0x0 EPIC_SR_INT8_VEC_REG External Serial Source 8 0x0 EPIC SR INT9 VEC REG External Serial Source 9 0x0 EPIC_SR_INT10_VEC_REG External Serial Source 10 0x0 EPIC_SR_INT11_VEC_REG External Serial Source 11 0x0 EPIC_SR_INT12_VEC_REG External Serial Source 12 0x0 EPIC_SR_INT13_VEC_REG External Serial Source 13 0x0 EPIC_SR_INT14_VEC_REG External Serial Source 14 0x0 EPIC SR INT15 VEC REG External Serial Source 15 0x0 EPIC O_VEC_REG Global Timer Source 0 0x0 EPIC 1 VEC REG Global Timer Source 1 0x0 EPIC 2_VEC_REG Global Timer Source 2 0x0 EPIC 3_VEC_REG Global Timer Source 3 0x0 EPIC I2C IN VEC REG Internal I2C Source 0x0 EPIC_DMAO_IN VEC REG Internal DMAO Source 0x0 EPIC_DMA1_IN VEC_REG Internal DMA1 Source 0x0 EPIC_MSG_IN VEC_REG Internal Message Source 0x0 y Each of th 24 ntries conforms to the following vector priority register address offset text description Interrupt Service Routine address Jia The first column of the structure contains the macro for each of the 24 interrupt AN MOTOROLA Appendix L MPC8240 EPIC Interrupt Driver 10L 159 MPC8240 EPIC Interrupt Driver vector priority register address offsets in EPIC The middle column is the text description of the interrupt vector and the last column is the add
54. ISRConnect 1 IRO1ISR set int 2 to active low edge sensitive priority 10 printf Configure Int 2 n tmp epicIntSourceConfig 2 0 0 10 epicISRConnect 2 IRO2ISR set timer 0 printf setting timer 0 base count to 0x10000001n SysEUMBBARWrite EPIC TMO BASE COUNT REG 0x01000000 epicISRConnect 16 TimerOISR set timer 1 printf setting timer 1 base count to 0x20000001n SySEUMBBARWrite EPIC TM1 BASE COUNT REG 0x02000000 epicISRConnect 17 TimerlISR I set priority and vectors and clear mask for timer 0 printf configuring timer 0n SySEUMBBARWrite EPIC TMO VEC REG 0x000a0010 set priority and vectors and clear mask for timer 1 printf configuring timer lin sysEUMBBARWrite EPIC_TM1_VEC_REG 0x000a0011 enable interrupt vector 1 printf Enable Int lin epicIntEnable 1 enable interrupt vector 2 printf Enable Int 2 n epicIntEnable 2 lower current task priority printf Lower Current Task Priority n epicCurTaskPrioSet 5 enabl xternal interrupts printf Enable External Interrupts in MSR n CoreExtIntEnable endif EPICDBG L 9 3 Running the Interactive Demo The interactive demo requires that DINK32 is running on a Sandpoint system with an MPC8240 PMC module From the DINK32 command line initialize
55. LID STRING unable to extract string from input stream e OxFF04 BUFFER EMPTY input buffer is empty e OxFF05 INVALID MODE input buffer is in an unrecognized mode e OxFF06 TOK INTERNAL ERROR internal tokenizer error e OxFF07 TOO MANY IBS too many open input buffers e OxFF08 NO OPEN IBS no open input buffers 8 1 6 Screen Toolbox Errors e OxFC00 RESERVED WORD used a reserved word as an argument 8 1 7 Breakpoint Errors e OxFA00 FULL BPDS breakpoint data structure is full 8 1 8 Download Errors OxF900 NOT IN S RECORD FORMAT not in S Record Format e OxF901 UNREC RECORD TYPE unrecognized record type e OxF902 CONVERSION ERROR ascii to int conversion error e OxF903 INVALID MEMORY bad S Record memory address 8 1 9 Compression and Decompression Errors e OxF800 COMP UNK CHARACTER unknown compressed character OxF801 COMP UNKNOWN STATE unknown binary state e OxF802 NOT IN COMPRESSED FORMAT not in compressed S Record format 8 1 10 DUART Handling Errors OxF700 UNKNOWN PORT STATE unrecognized serial port configuration 8 80 Dink32 R12 User s Manual M MOTOROLA Exceptions e OxF600 TM NEEDS BOTH PORTS transparent mode needs access to two serial ports 8 1 11 Register Errors e OxF600 SPR NOT FOUND cannot find register in special purpose register file 8 1 12 Flash Errors e OxF100 FLASH ERROR error in flash command activity 8 2 Exceptions There are twenty one exceptions in this version of DINK32 A message indicating which exception has o
56. Logical address is 0x10000000 BL Block Length is Ox3ff 128 MB Range is 0x10000000 Ox17ffffff VS is 0x1 Supervisor mode access VP is 0x1 User mode access For batl 0x1000001a BRPN Physical address is 0x10000000 WIMG 0x3 W off Not Write Through i e Write back I off Not Cache Inhibited i e use cache M on Memory Coherent G on Guarded PP Block Access Protection Control 0x2 Read and Write 6 3 Memory Test A simple memory test is included in DINK as an option It is enabled via a define in config h If MEMORY TEST is defined then before DINK is copied from ROM to RAM a memory test will be performed from address 0x0 to the MEMORY END 0x0000 location If MEMORY END is defined as 0x7 then the test is performed between 0x0 and 0x70000 The address of the memory location is written into the memory location and then read back If an error is detected then the verify loop will go to an infinite loop located at error memory test The location of this loop can be found in the map file and can easily b The following listing will show up on the flash screen Memory test performed from 0x00000000 0x70000 The user may feel free to enhance the memory test algorithm by adding additional test into the memory test function located in except2 s Note The user must ensure that the ending address MEMORY_END is valid or the debug M MOTOROLA Chapter 6 Utilities 6 75 Memory Test monitor may not boot There is al
57. MDINK32 DINK32 User s Guide Interactive Debugger for PowerPC Microprocessors Motorola RISC Applications Release Date November 30 1999 Updated December 6 1999 Version 12 0 Revision 0 0 Altivec Enabled MOTOROLA MDINK32 DINK32 Version 12 0 User s Guide O Copyright Motorola Inc 1993 1999 ALL RIGHTS RESERVED You are hereby granted a copyright license to use modify and distribute the SOFTWARE so long as this entire notice is retained without alteration in any modified and or redistributed versions and that such modified versions are clearly identified as such No licenses are granted by implica tion or otherwise under any patents or trademarks of Motorola Inc The SOFTWARE is provided on an AS IS basis and without warranty To the maximum extent permitted by applicable law MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESSED OR IMPLIED INCLUDING IMPLIED WARRANTIES OF MERCHANTABIL ITY OR FITNESS FOR A PARTICULAR PURPOSE AND ANY WARRANTY AGAINST INFRINGEMENT WITH REGARD TO THE SOFTWARE INCLUDING ANY MODIFIED VERSIONS THEREOF AND ANY ACCOMPANYING WRITTEN MATERIALS To the maximum extent permitted by applicable law IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING WITHOUT LIMITATION DAMAGES FOR LOSS OF BUSINESS PROFTTS BUSINESS INTERRUPTION LOSS OF BUSINESS INFORMATION OR OTHER PECUNIARY LOSS ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE Motorola assumes no responsibility for
58. NT Type return to continue or x to quit 4 50 Dink32 R12 User s Manual M MOTOROLA Commands 4 1 27 pcidisp pa pci display on systems with a PCI bus pcidisp lt devNum gt lt regNum gt This command reads a configuration register regNum of a PCI device devNum The devNum depends on the PCI slot the device is attached and it can be found by executing the ppr PCI Device Probe command Example DINK32_750 gt gt pcidisp 11 10 0x10 0x12345678 Base Address Register 0 M MOTOROLA Chapter 4 MDINK32 DINK32 Commands 4 51 Commands 4 1 28 pcimod pm pci modify on systems with a PCI bus pcimod lt devNum gt lt regNum gt This command is used to modify the content of a configuration register regNum of a PCI device devNum The DevNum depends on the PCI slot the device is attached to and it can be found by executing the ppr PCI Device Probe command This command first displays the current value of the desired register then asks the user to enter the new value This command does not return an error if the register requested is a read only register Example DINK32 750 pcimod 11 10 0x10 0x00000000 Base Address Register O0 New Value 12345678 DINK32 750 gt gt pcidisp 11 10 0x10 0x12345678 Base Address Register 0 4 52 Dink32 R12 User s Manual M MOTOROLA Commands 4 1 29 pciprobe ppr pci probe command on systems with a PCI bus non excimer build pciprobe This com
59. PI in both currently implemented modes master transmit and master receive The DINK32 program runs interactively to allow the user to transmit or receive a buffer of data from an I2C device at address 0x50 on the Kahlua PMC card DINK32 obtains information from the user as follows read write mode I2C device address for the data this 1s the address of the data on the I2C device not the I2C bus address of the device itself which is hard coded in DINK32 the raw data if in write mode and the length of the data to transfer to or from the device Note that the initialization call to configure the I2C interface is actually made only once the first time the user requests an I2C transmit or receive operation Each transmit or receive operation is performed by a single call to an I2C API function The DINK32 program is an interactive application so it gives the I2C library access to its own print output function These are the steps DINK32 takes to perform a master transmit transaction 1 Call I2C Initialize if needed to set the Kahlua I2C address polling mode and identify the optional print function 10 126 Dink32 R12 User s Manual M MOTOROLA MPC8240 I2C Driver Library 2 Call ID2C do transaction to transmit the buffer of data These are the steps DINK32 takes to perform a master receive transaction in polling mode 1 Call I2C Initialize if needed to set the Kahlua I2C address polling mode and identify the optional print funct
60. PRINT Required Flags n value sector number 0 181n PRINT Flags su unprotect indicated sector n PRINT Required Flags n value sector number 0 181n PRINT Flags se erase indicated sectorin PRINT Required Flags n value sector number 0 18 n PRINT Example fl sp n 5 sector protect sector 5 n A 2 Input Arguments Now we are ready to specify input arguments Arguments are effected by entries in two tables one is toks h and the other is toks c The toks h table is a set of lines of define macros Each argument is treated as a member of a symbol table called SYMBOL_BASE_TOK The base of the table is defined as some value There are several 10A 86 Dink32 R12 User s Manual M MOTOROLA Adding Commands and Arguments such bases for various other symbols such as the REG GEN BASE TOK By reading the comments at the beginning of the file we ascertain that this is a scheme to guarantee that all tokens command arguments register names etc have a unique integer value that can be used by the tokenizer to uniquely identify any symbol desired by the dink32 code A 2 1 Input Token Facility Specify the name of your token with a define macro and give it the value of one more than the previous values Note either do not exceed the MAX SYMBOLS TOKENS size defined in toks h currently set at 32 or increase the value example toks h define DASH TO SYMBOL BASE TOK 2 symbol2 the d
61. RR cate or Ot tastes Sent E ans a Sequencer hang dispatch time out bus address parity error bus data parity error cache parity error invalid microcode instruction pio bus protocol error reserved checkstop enables cache error in main reserved in array init DINK32 750 gt gt regdisp rl f2 r3 f4 r8 s5 gpr00 0x00000000 gpr01 0x00060000 fpr02 0x0000000000000000 fpr03 0x0200feed010cab00 gpr02 0x00000000 gpr03 0x000068ac fpr04 0x0000000000000000 fpr05 0x0000000000000000 gpr08 0x00000000 gpr09 0x00000000 DINK32 750 gt gt regdisp r23 gpr22 Ox2cab4dad gpr23 0x00000000 gpr24 0x00000000 gpr25 0x00000000 gpr26 0x00000000 gpr27 0x00700007 gpr28 0x00000000 gpr29 0x00000000 gpr30 Ox00face00 gpr31 0x00000000 DINK32_MAX gt gt rd v2 VE 2 0x00000000 00000000 00000000 00abcdef DINK32 MAX gt gt rm v2 Vr 23 0x00000000 00000000 00000000 00abcdef gt 12345678 DINK32 MAX gt gt rd v2 vr 2 0x00000000 00000000 00000000 12345678 DINK32 MAX gt gt rd v vr On OXTEELIECTEL Efffffftf EELECTEEE Efffftfftf vr l4 Oxffffffff Ffffffff ffffffff Ffffffff vr 2 0x00000000 00000000 00123456 78abcdef vr 29 Ox PE REE ERE PERE EEE REL REL ETETELEFEE vr 30 Oxffffffff Ffffffff ffffffff Ffffffff vr 31 0x00000000 12345678 abcdef00 87654321 This example contrasts the verbose mode versus the non verbose mode of display See the command env
62. Read the 12test readme for more information E 4 1 Building The demo can be built with the UNIX or PC command make There are seven targets composed of a UNIX PowerPC target a UNIX native target and a PC target The l2test src file can be downloaded with the DINK32 command d1 k It can be executed with the DINK32 command go 90000 There are two makefiles e makefile used for this release of DINK32 R12 and beyond e makefile dink11 used for previous releases of dDINK32 E 4 2 Function Addresses All dink function addresses are determined dynamically see Appendix G for more information E 5 printtest The directory contains source files that can be built to build an application that can then be downloaded into dink at address 0x90000 and run This application will test the various printf features E 5 1 Building The demo can be built with the UNIX or PC command make There are seven targets composed of a UNIX PowerPC target a UNIX native target and a PC target The l2test src file can be downloaded with the DINK32 command d1 k There are two makefiles e makefile use the UNIX PowerPC cross tools 10E 102 Dink32 R12 User s Manual M MOTOROLA Example Code makefile pc use the PC PowerPC cross tools It can be executed with the DINK32 command go 90000 E 5 2 Function Addresses All dink function addresses are determined dynamically see Appendix G for more information Appendix E Example Code 10E
63. This command is also available in MDINK32 Where commands are different between MDINK32 and DINK32 the DINK32 format will be shown first plus Usually implies that the command form includes This allows the command to continue to the next stopping place appropriate for its functionality range Indicates a two address form and usually signifies an inclusive area of code or memory that will be operated on by the command entire family Refers to a family of registers The general purpose registers are a family of thirty two 32 bit registers numbered O to 31 The floating point registers are a family of thirty two 64 bit registers numbered 0 to 31 The altivec registers are a family of thirty two 128 bit registers numbered 0 to 31 The special purpose registers are not classified as a family due to their architectural design 66 99 X Typing x will exit a command if DINK32 is in an interactive mode when a particular command form is used 4 1 Commands M MOTOROLA Chapter 4 MDINK32 DINK32 Commands 4 15 Commands 4 1 1 period repeat last command MDINK32 Compatible Typing a period will repeat the last command entered Example DINK32 750 A Run Mode o Current inst DINK32 750 A Run Mode o Current inst DINK32 750 A Run Mode o Current inst DINK32 750 gt 4 16 trace r Trace ruction gt trace r Trace ruction gt r Trace
64. This information is provided to assist in further development of the I2C library to enable the application to operate as an I2C slave device interrupt enabled mode bus retention between consecutive transactions correct handling of device time out no slave device response no acknowledgment I2C bus arbitration loss etc All of these functions are defined as static in the source file drivers 12c 12c1 c K 2 4 1 Common Data Structures and Values These data structures and status values are defined see drivers i2c i2c h for the Kahlua I2C driver library functions These are the offsets in the Embedded Utilities Memory Block for the I2C registers define I2CADR 0x00003000 define I2CFDR 0x00003004 define I2CCR 0x00003008 define I2CSR 0x0000300C define I2CDR 0x00003010 typedef enum i2cstatus I2CSUCCESS 0x3000 I2CADDRESS I2CERROR I2CBUFFFULL I2CBUFFEMPTY I2CXMITERROR 10K 148 Dink32 R12 User s Manual M MOTOROLA MPC8240 120 Doorbell Driver I2CRCVERROR I2CBUSBUSY I2CALOSS I2CNOEVENT I2CStatus hese structures reflect the bit assignments of the I2C registers ypedef struct i2oc ctrl nsigned int reservedO 24 nsigned int men 1 nsigned int mien 1 nsigned int msta Is nsigned int mtx 1 nsigned int txak 1 nsigned int rsta 1 nsigned int reservedl 2 12C_CTRL ypedef struct _i2c_stat SSESSESSSSSs tw Geese eo eG Ge tH nsigned in
65. acters bytes of each field for the different S record types It is useful as a reference when parsing records manually during debug Table 10 1 Summary of Formats in Bytes Type Count Address Data Checksum S0 2 n a 0 60 2 1 2 2 byte address 0 64 2 S2 2 3 byte address 0 64 2 3 2 4 byte address 0 64 2 S5 2 2 byte count 0 2 S7 2 4 byte execution address 0 2 S8 2 3 byte execution address 0 2 S9 2 4 byte execution address 0 2 10D 100 Dink32 R12 User s Manual M MOTOROLA Example Code Appendix E Example Code E 1 General Information Four example directories are included in the DINK32 distribution These directories include all the source files a makefile and a README All these directories contain examples of using the new dynamic dink addresses as described in Appendix G E 2 Demo The demo directory contains source files that can be built to build an application that can then be downloaded into dink at address 0x90000 and run E 2 1 Building The demo can be built with the UNIX or PC command make f makedemo The demo src file can be downloaded with the DINK32 command d1 k It can be executed with the DINK32 command go 90000 Demo will run continuously It can be stopped by a reset or by setting the flow control to none before the go 90000 E 2 2 Function Addresses All dink function addresses are determined dynamically see Appendix G for more information E 3 Dhrysto
66. al M MOTOROLA Commands 4 1 38 trace single step trace race address trace This allows the user to single step through a user program The microprocessor will execute a single instruction and then return control back to the firmware If a specific address is given then a single instruction is executed from that address However if the plus form is used then the address of the instruction to execute is derived from bits 0 29 of the SRRO Machine Status Save Restore register After the instruction has been executed control is returned to the firmware DINK32 and the user can examine the programming model or continue to trace through instructions Example DINK32_750 gt gt ds 2100 0x00002100 0x7c0802a6 mfspr r00 s0008 DINK32 750 gt gt trace 2100 A Run Mode or Trace exception has occurred Current instruction Pointer 0x00002104 stw r13 Oxfff8 r01 DINK32 750 gt gt trace A Run Mode or Trace exception has occurred Current instruction Pointer 0x00002108 add r03 r00 r01 DINK32 750 A Run Mode or Trace exception has occurred Current instruction Pointer 0x0000210c mfspr r04 s0274 AN MOTOROLA Chapter 4 MDINK32 DINK32 Commands 4 69 Commands Chapter 5 DINK32 Command Form Summary period repeat last command about about displays version information assemble as address assemble at one address bkpt bp set delete list breakpoints 1 2 3 4 5 def
67. alias da command list define alias for listed commands 6 devdisp dd list display contents of device registers 7 devmod dm list modify device data in device registers 8 devtest dev list perform an I O test on Kahlua 9 disassem ds address disassemble at one address 10 download dl download S Record file to board RAM or flash 11 env env Environment controls 12 flash fl flash commands 13 fupdate fu copy PCI boot rom to local PPMC 14 fw fw e erase all of Flash memory and load RAM to ROM mdink32 15 go go address execute from given address 16 help he command show more information on command 17 log log record debug session to host 18 memdisp md address display memory at one address 19 memfill mf start end data fill memory block with data pattern 20 meminfo mi displays information about the memory settings 21 memod mm address modify memory at one address 22 memove mv start end dest move memory block to destination 23 memsrch ms start end data search memory block for data 24 memtest mt perform various memory tests on local memory or device registers 25 menu me show list of available commands 26 pciconf pcf display all config registers of a PCI device 27 pcidisp pd display contents of a PCI config register 28 pcimod pm modifies PCI device config register data 29 pciprobe ppr scans for PCI devices 30 regdisp rd display entire general register fami
68. ar si uses the getarg tok function as this code fragment shows if status getarg tok amp state SUCCESS return status PRINT Set Input Port switch state case BOTH_TOK duart_configuration BOTH_PORTS A more extensive method is to use the functions tok_is_next_token and tok_get_next_token These examples are from the new flash_commands that will be in the next release The code shown below extracts the arguments from the command line This code will parse the line fl sp n 5 however it will give an error for these lines Rl sp ni El hex value fl xp 1 xp instead of valid sp su se etc fl sp 1 missing n fl sp n missing a decimal value toks h define SECTOR PROTECT TOK SYMBOL BASE TOK 15 symboll15 sp for sector protect define SECTOR UNPROTECT TOK SYMBOL BASE TOK 16 symbol16 x su for sector unprotect define SECTOR ERASE TOK SYMBOL BASE TOK 17 symbol17 se for sector erase define FLASH COPY TOK SYMBOL BASE TOK 18 symbol18 cp for flash copy define SECTOR NUMBER TOK SYMBOL BASE TOK 19 symboll19 tant for sector number toks c ADD TOKEN sp SECTOR PROTECT TOK amp i symboll15 Sector Protect E ADD TOKEN su SECTOR UNPROTECT TOK eL symboll6 Sector Unpr
69. as tr rd r Alias defined as tr rd r DINK32 will now single step and display the register set ach time runalias is entered DINK32 750 gt gt runalias A Run Mode or Trace exception has occurred Current Instruction Pointer 0x00002108 add r03 r00 r01 gpr00 0x00000000 gpr01 0x00060000 gpr02 0x00000000 gpr03 0x0002bc00 gpr04 0x00000000 gpr05 0x00000000 gpr06 0x00000000 gpr07 0x00000000 gpr08 0x00000000 gpr09 0x00000000 gpr10 0x00000000 gpr11 0x00000000 gpr12 0x00000000 gpr13 0x00000000 gpr14 0x00000000 gpr15 0x00000000 gpr16 0x00000000 gpr17 0x00000000 gpr18 0x00000000 gpr19 0x00000000 gpr20 0x00000000 gpr21 0x00000000 gpr22 0x00000000 gpr23 0x00000000 gpr24 0x00000000 gpr25 0x00000000 gpr26 0x00000000 gpr27 0x00000000 gpr28 0x00000000 gpr29 0x00000000 gpr30 0x00000000 gpr31 0x00000000 M MOTOROLA Chapter 4 MDINK32 DINK32 Commands 4 23 Commands 4 1 6 devdisp aa DINK32 Peripheral device display dd devdisp e dd device bl hl w addr1 addr2 The devdisp command displays the contents of device registers in a manner similar to that of the memory display command device e b h w for devices e addrl e addr2 Is the name of the device If not entered display all known devices Set size of device accesses If not specified the default size is bytes Is the starting address to display Is the optional ending address e The dd command with
70. ash symbol m define BOTH TOK SYMBOL BASE TOK 8 symbol8 to select both serial ports define HOST TOK SYMBOL BASE TOK 9 symbol9 select only the host port fine KEY TOK SYMBOL BASE TOK 10 symbol10 select only the keyboard fine QUEST TOK SYMBOL BASE TOK 11 symbol11 the question This example is for the si setinput command It defines the dash token and the k h and command arguments which are invoked as si k I h 1 2 The ADD_TOKEN macro in toks c adds these symbols to tokenizer so that the function can search the argument list example toks c ADD_TOKEN both BOTH_TOK 81 symbol8 to select both serial ports ADD TOKEN host HOST TOK amp i symbol9 to select only the host port ADD TOKEN key KEY TOK amp i symboll10 to select only the keyboard port ADD TOKEN k KEY TOK amp i same as above ADD TOKEN NO QUEST TOK amp i symbolll the question mark 2 symbol Note that the token is a null terminated string not a single character In this example we AN MOTOROLA Appendix A Adding Commands and Arguments 10A 87 Adding Commands and Arguments are looking for the strings both host key k and and the comment tells us which symbol it refers to in the toks h file There are at least two ways to get these tokens p
71. ata from the command line validates it and calls the I2C library function to perform the task CK CK Ck CK OK Ck Ck Ck KK OK Ck CK Kk OK Ck CK Ok AR A ko ko x static STATUS test i2c int act int en int int retry 800 len 0 rsta 0 addr 0 unsigned char eprom_addr 0x50 read transaction address addr read of bytes to transfer len validate the data address length etc If transmitting get the raw data into the transmit buffer E xmit buffer read built in I2C device on Kahlua PMC card if act DISPLAY TAG AN MOTOROLA Appendix K MPC8240 120 Doorbell Driver 10K 147 MPC8240 120 Doorbell Driver if I2C do transaction en int I2C MASTER RCV eprom addr addr len rcv buffer I2C STOP retry I2C NO RESTART I2C SUCCESS PRINT dev I2C error in master receive test n return ERROR else rcv buffer len 0 ensure NULL terminated string PRINT s rcv buffer expecting only printable data PRINT An write to built in I2C device on Kahlua PMC card if act MODIFY TAG if I2C do transaction en int I2C MASTER XMIT eprom addr addr len xmit buffer I2C STOP retry I2C NO RESTART I2C SUCCESS PRINT dev I2C error in master transmit test n return ERROR return SUCCESS K 2 4 12C Driver Library Internals DLI
72. ay about function disassemble DINK32 disassemble instruction get KEYBOARD Return address of keyboard com port get char DINK32 get next character from the duart buffer essentially the keyboard for the user This function requires the KEYBOARD value obtained from get KEYBOARD as an argument See G 6 example program getcannon for an example of the correct way to obtain this value M MOTOROLA Appendix G Dynamic functions such as printf 10G 109 Dynamic functions such as printf Table 2 dinkusr s Functions Function name Function definition write_char DINK32 put character to the output buffer The simple steps for using these dynamic addresses are 1 Use DINK32 V11 1 or later 2 Use define for local functions that you wish to connect to the DINK32 functions example define printf dink printf 3 The first executable statement in your C code must be set up transfer base 4 Now whenever your program calls one of these functions such as printf it will transfer control to the equivalent DINK32 function G 5 Error Conditions The only error condition is a trapword exception which indicates that the dink transfer table address is zero This is caused by one of the following conditions 1 The user has not called set up transfer base 2 R12 is getting trashed before set up transfer base is called 3 The DINK32 version does not support dynamic functions DINK32 V11 0 2 was
73. blocks of memory if the user enters return at the prompts until the end of memory is reached or until the user enters an x If the two address version is used the command will display the contents of memory between and including each address specified in the range If more than four lines of data are requested the user can then enter an x at the prompt to quit before the end of the display range The start address is normalized to the previous quad word boundary Likewise the ending address is normalized to the next quad word boundary For example if the start address was 0x00000104 then the first memory address to be displayed would be 0x00000100 If the end address was 0x00000104 then the last memory location to be displayed would be 0x0000010C Examples DINK32 750 memdisp 60100 60200 0x00060100 00000041 00000042 00000043 00000044 0x00060200 00000000 00000000 00000000 00000000 DINK32 750 memdisp 60100 60130 0 0 0 0 0 0 0 x00060100 x00060110 x00060120 x00060130 DINK32 750 x00060260 x00060270 x00060280 00000041 00000042 00000045 00000046 00000000 00000000 00000000 00000000 gt gt memdisp 60260 00000000 00000000 00000000 00000000 00000000 00000000 Chapter 4 MDINK32 DINK32 Commands 00000043 00000047 00000000 00000000 00000000 00000000 00000000 00000044 00000048 00000000 00000000 00000000 00000000 24002400 4 41 Commands 4 1 19 memfill memory fill
74. call to I2C Slave Xmit if asked to transmit data Description Process slave address phase Called from I2C ISR This function may only be called when the following conditions are met I2CSR MIF 1 I2CSR MAAS 1 I2CStatus I2C_ISR unsigned int eumbbar e eumbbar is the address of the Embedded Utilities Memory Block e Returns DCADDRESS if address phase for master receive results from call to I2C Slave Addr if being addressed as slave untested results from call to I2C Master Xmit if master transmit data mode results from call to I2C Master Rcv if master receive data mode results from call to I2C Slave Xmit if slave transmit data mode untested results from call to I2C Slave Rcv if slave receive data mode untested I2CSUCCESS if slave has not acknowledged generated STOP untested I2CSUCCESS if master has not acknowledged wait for STOP untested I2CSUCCESS if bus arbitration lost untested Description Read the DCCR and DCSR to determine why the I2CSR MIF bit was set which caused this function to be called Handle condition see above in possible return values This function is called in polling mode as the handler function when an I2C event has occurred It is intended to be a model for an interrupt service routine for polling mode but this is untested and the design has not been reviewed or confirmed This function may only be called when the following condition is met RCSR MIF
75. ccurred is displayed for all of them except System Reset e 0x0100 System Reset e 0x0200 Machine Check e 0x0300 Data Access e 0x0400 Instruction Access e 0x0500 External Interrupt e 0x0600 Alignment e 0x0700 Program e 0x0800 Floating Point Unavailable e 0x0900 Decrementer e 0x0A00 I O Controller Interface Error e 0x0CO00 System Call e 0x0D00 Trace e Ox0E0O Floating Point Assist e O0xOF00 Performance Monitor e 0x1000 Instruction Translation Miss e 0x1100 Data Load Translation Miss e 0x1200 Data Store Translation Miss e 0x1300 Instruction Address Breakpoint e 0x1400 System Management Interrupt e 0x1600 Java Mode denorm detection e 0x2000 Run Mode or Trace AN MOTOROLA Chapter 8 Errors and Exceptions 8 81 Exceptions System Reset occurs when the software is booted up or the evaluation board is reset The other exceptions occur due to interrupts or errors in the execution of the code When using DINK the user is notified of exceptions by a message that appears on the terminal Control is returned to the firmware If the exception was caused by the completion of a trace or by arriving at a breakpoint during execution of the user s code the user can continue testing Otherwise the user may need to modify the code to correct a problem and download the program again to resume testing For details on what causes each exception see the Programming Environments Manuals PEM and the appropriate PowerPC User s Manual for the part in q
76. code Thus DINK32 provides a flexible and powerful framework for users who desire additional functionality Hardware Configuration Requirements This DINK32 software package can be executed on microprocessor boards that include the following devices and minimum memory configuration e PowerPC M 601 603 e 604 e 740 750 7400 microprocessors e National Semiconductor PC87308 DUART Yellowknife and Sandpoint Reference Design or National Semiconductor 16552 DUART Excimer and Maximer Minimal Evaluation Board 512 K byte EPROM or Flash e 32 M byte RAM M MOTOROLA Chapter 3 MDINK32 DINK32 Features 8 7 DINK Software Build Process 3 9 DINK Software Build Process There are two types of platforms 1 YellowKnife and Sandpoint DINK32 is loaded at Oxfff00000 The config h file must set the RESET BASE macro to RESET BASE OTHERS as shown in Table 3 1 RESET BASE value Table 3 1 RESET BASE value Macro Name Value RESET BASE OTHERS OxFFFO default RESET BASE EXCIMER OxFFCO 2 Excimer and Maximer The config h file must set the RESET BASE macro to RESET BASE EXCIMER as shown in Table 3 1 RESET BASE value DINK32 is a sophisticated debug ROM program Most hardware specific features such as the specific PowerPC processor the memory map the target platforms etc are automatically detected at run time This flexibility allows a single version of DINK32 to run on dif
77. cription Set the I2C control register I2CStatus I2C put unsigned int eumbbar unsigned char rcv addr unsigned char buffer ptr unsigned int length unsigned int stop flag unsigned int is cnt e eumbbar is the address of the Embedded Utilities Memory Block rcv addr is the receiver s I2C device address e buffer ptr is pointer to the data buffer to transmit length is the number of bytes in the buffer stop flag 1 signal STOP when buffer is empty e 0 don t signal STOP when buffer is empty is cnt 1 this is a restart don t check MBB e this is a not restart check MBB Returns Any defined status indicator Description Set up to send a buffer of data to the intended rcv addr If stop flag is set after the whole buffer is sent generate a STOP signal provided that the receiver doesn t signal the STOP in the middle Caller is the master performing transmitting If no STOP signal is generated at the end of current transaction the master can generate a START signal to another slave address The function does not actually perform the data buffer transmit 10K 150 Dink32 R12 User s Manual M MOTOROLA MPC8240 120 Doorbell Driver 1t just sets up the DLI global variables to control the transaction and calls I2C_Start to send the slave address out on the I2C bus in transmit mode The application must check the return status to find out if the bus was obtained then enter a loop of calling I2C Timer Event to
78. cros and all function declarations epicl c contains all C language routines 10L 158 Dink32 R12 User s Manual M MOTOROLA MPC8240 EPIC Interrupt Driver e epic2 s contains all Assembly language routines e epicUtil s contains assembly routines to load and store to registers in the EUMB e makefile used by the DINK32 makefile to build this directory into a driver library e Readme txt a text version of this appendix L 4 EPIC Cross Reference Table Structure The following table is defined in epicl c in order to cross reference interrupt vector numbers with the corresponding interrupt vector priority register address and interrupt service routine address Register Address Offset Vector Description ISR Addr cross reference table struct SrcVecTable SrcVecTable MAXVEC EPIC_EX_INTO_VEC_REG External Direct Serial Source 0 0x0 EPIC EX INT1 VEC REG External Direct Serial Source 1 0x0 EPIC_EX_INT2_VEC_REG External Direct Serial Source 2 0x0 EPIC_EX_INT3_VEC_REG External Direct Serial Source 3 0x0 EPIC_EX_INT4_VEC_REG External Direct Serial Source 4 0x0 EPIC_SR_INT5_VEC_REG External Serial Source 5 0x0 EPIC SR INT6 VEC RE
79. cters For bigger descriptions this line can be changed lt batlower_value gt is a hex value lt batupper_value gt is a hex value As an example if you wanted to decode two pairs of bats 2 ibat0 10000001 10000 fff dbat0 1000001a 10000fff If you want a description line you can use batlower batupper 0 as in 3 This is a test O O ibat0 10000001 10000fff dbat0 1000001a 10000fff The output is Bat Decoder nter the bat values and display the meaning IBAT and DBAT have same meaning Format description upperbat value lowerbat value How many bat entry pairs one pair per line Pleas nter the Lower and Upper bat value in hex This is a test Decoding the bat Both bats are zero Disabled Pleas nter the Lower and Upper bat value in hex ibat0 Decoding the bat For batu Ox10000fff 6 74 Dink32 R12 User s Manual M MOTOROLA BEPI Logical address is Memory Test 0x10000000 BL Block Length is Ox3ff 128 MB Range is 0x10000000 Ox17ffffff VS is 0x1 Supervisor mode access VP is 0x1 User mode access For batl 0x10000001 BRPN Physical address is 0x10000000 WIMG 0x0 W off Not Write Through i e Write back I off Not Cache Inhibited i e use cache M off Not Memory Coherent i e non coherent G off Not Guarded i e unguarded PP Block Access Protection Control 0x1 Read Only Pleas nter the Lower and Upper bat value in hex dbat0 Decoding the bat For batu 0x10000fff BEPI
80. ctions in some configuration table When the integration takes place this document will be updated to reflect the details The code for the entire I2O ISR host function follows Note that the only type of interrupt that is currently handled is doorbell interrupt from the message unit but there are comments in the code indicating where to check for other causes of interrupts The code can be found in 1201 c K 1 3 Enable Doorbell Interrupts Since the agent is servicing the inbound doorbell the agent enables it by calling the I2O library function I2ODBEnable which clears the Inbound Doorbell Interrupt Mask IDIM bit in the Inbound Doorbell Interrupt Mask Register IMIMR The IMIMR is at offset 0x104 in the agent s Embedded Utilities Memory Block EUMB whose address is in the agents EUMBBAR Similarly since the host is servicing the agent s outbound doorbell the host enables it by calling the I2O library function I2ODBDisable which clears the Outbound Doorbell Interrupt Mask ODIM bit in the agent s Outbound Message Interrupt Mask Register OMIMR The OMIMR is at offset 0x34 in the agent s PCSR block whose address is in the agents PCSRBAR at offset Ox14 in the agent s Configuration Registers The address of the agent s Configuration Registers are known by the host and are accessible from the PCI bus At present the user interface in DINK32 allows the user to set or clear the ODIM or IDIM bit The functions I2ODBEnable and IZODBD
81. cution the stack pointer rl is set to Ox8fff0 Hence the user stack begins at Ox8fff0 Examples DINK32 750 gt gt ds 181dc 181f8 0x000181dc 0x3c600000 addis r03 r00 0x0000 0x000181e0 0x60631234 ori r03 r03 0x1234 0x000181e4 0x3c800000 addis r04 r00 0x0000 0x000181e8 0x60845678 ori r04 r04 0x5678 0x000181ec 0x7c632214 add r03 r03 r04 0x000181f0 0x38841234 addi r04 r04 0x1234 0x000181f4 0x7c032000 cmp 0 0 r03 r04 0x000181f8 0x4182ffe4 bc OxOc 0x02 Oxffe4 DINK32 750 gt gt bkpt 181f4 breakpoint set at 0x000181f4 DINK32 750 gt gt go 181dc A Program exception has occurred Breakpoint Encountered Current Instruction Pointer 0x000181f4 cmp 0 0 r03 r04 DINK32 750 gt gt go A Run Mode or Trace exception has occurred A Program exception has occurred Breakpoint Encountered Current Instruction Pointer 0x000181f4 cmp 0 0 r03 r04 M MOTOROLA Chapter 4 MDINK32 DINK32 Commands 4 37 Commands 4 1 16 help ne help on DINK32 commands MDINK32 Compatible help command This provides information on the commands implemented by DINK32 Since MDINK32 only has a subset of commands the help command displays different information Examples DINK32 KAHLUA gt gt help Sandpoint MPC8240 DINK COMMAND LIST Command Mnemonic Command Mnemonic ADO U Er Benchmark Define Alias Device Modify Disassemble about ab benchmark bm defalias devmod dm disassem ds
82. d y set the direction to forward ee set the direction to reverse set the direction to 0 dm will keep examining and modifying the same location until v or is entered hex a value to write e help DINK32_ARTHUR gt gt dm nvram 40 0x0040 14 enter skip 0x0041 3E 47 new value 0x0042 27 go back 0x0041 47 48 right value 0x0040 14 v go forward 0x0041 48 lt enter gt 0x0041 48 enter 0x0041 48 enter 0x0041 4A enter erratic bit M MOTOROLA Chapter 4 MDINK32 DINK32 Commands 4 25 Commands 4 1 8 devtest dev DINK32 Peripheral device test lt Kahlua only dev devtest e dev l epic dev r i2c lt addr gt n lt timeout gt dev w i2c lt addr gt n str lt timeout gt dev DMA p lt type gt src dest chn lt n gt Perform a given I O test on Kahlua DINK32 KAHLUA devtest r i2c 0x40 FE FE FE FE 47 4A 4E 4E EE FE TE FE 47 4A 4E 4F Q2 GUMN GJMN 4 26 Dink32 R12 User s Manual M MOTOROLA Commands 4 1 9 disassem as DINK32 mini disassembler e disassem address e disassem start e disassem start end The mini disassembler for the DINK32 system displays the contents of memory at the given address The contents are shown in hexadecimal opcode format as well as in PowerPC assembly instruction format If the
83. d lines to relocate code FLASH download options e The fl option indicates a load to FLASH memory e The e option indicates to erase all of flash memory before the load The o address specifies the offset address default is Oxfff00000 Default download baud rate is 9600 Maximum baud rate on Excimer and Maximer is 57600 and Yellowknife and Sandpoint is 38400 See Section 4 1 34 setbaud sb 4 28 Dink32 R12 User s Manual M MOTOROLA Commands Examples DINK32_750 gt gt dl Sk Set Input Port set to Keyboard Port Download Complete Use the following example when upgrading DINK on Excimer with a s record from the PowerPC website MDINK32 603e gt gt dl f1 o ffc00000 Offset Oxffc00000 Writing new data to flash Line 50 NOTE The complet sequence for upgrading DINK on Excimer would be MDINK32 603e gt gt fw e Reboot the Excimer board MDINK32 603e gt gt sb k 57600 MDINK32 603e gt gt dl fl o ffc00000 MDINK32 603e gt gt M MOTOROLA Chapter 4 MDINK32 DINK32 Commands 4 29 Commands 4 1 11 en V env Syntax env c d s var value Description This command displays or sets environment variables stored in the NVRAM if available If no argument is given the current settings are displayed Note quotes are usually required The ENV command manipulates environment variables which are of the form VAR DEF or VAR def def def Quotes a
84. destination address registers SAR and DAR and the byte count register BCR by calling DMA Bld Curr which maps them according to channel and host and ensure the channel is free 8 Write the mode register by calling DMA Set Mode AN MOTOROLA Appendix I MPC8240 DMA Memory Controller 101 121 MPC8240 DMA Memory Controller 9 Begin the DMA transfer by calling DMA Start which ensures the channel is free and then clears and sets the mode register channel start CS bit 10 The proceeding steps 6 through 9 are done in a sequence so that each call must return a successful status prior to executing the following step The status is checked and error conditions are reported at this point if all did not execute successfully 11 If this point is reached the DMA transfer was initiated successfully return success status These are descriptions of the DMA library functions reference above in the DMA direct transfer processing steps DMAStatus DMA Get Mode LOCATION host unsigned eumbbar unsigned int channel DMA MR mode hostis LOCAL or REMOTE only LOCAL is currently tested e eumbbar is EUMBBAR for LOCAL or PCSRBAR for REMOTE e channel is DMA_CHN_0 or DMA CHN 1 e mode is a pointer to the structure DMA MR to receive the mode register contents Return value is DMASUCCESS or DMAINVALID Description Read the DMA mode register DMAStatus DMA Poke Desp LOCATION host unsigned eumbbar unsigned int channel DMA CDAR de
85. e check e Returns LOSUCCESS Description Enable the specified doorbell interrupt by clearing the appropriate mask bits I20STATUS I20DBDisable LOCATION loc unsigned int base unsigned int in db e Same as IZODBEnable but it disables the specified interrupts bysetting the mask bits unsigned int I20DBGet LOCATION loc unsigned int base loc LOCAL or REMOTE Use LOCAL if called from agent REMOTE ifcalled from host This controls the use of the base parameter as PCSR ifREMOTE or EUMB ifLOCAL and selection of outbound if REMOTE or inbound if LOCAL doorbell registers e base is the base address of PCSR or EUMB 10K 142 Dink32 R12 User s Manual M MOTOROLA MPC8240 120 Doorbell Driver e Returns Contents of agent s inbound if loc LOCAL or outbound if loc REMOTE doorbell register Description Returns content of specified doorbell register and clears the doorbell register void I20DBPost LOCATION loc unsigned int base unsigned int msg loc LOCAL or REMOTE Use LOCAL if called from agent REMOTE ifcalled from host This controls the use of the base parameter as PCSR ifREMOTE or EUMB if LOCAL and selection of outbound if REMOTE or inbound if LOCAL doorbell registers e base is the base address of PCSR or EUMB e msg is the 32 bit value written to the specified doorbell register Description The 32 bit value is written to the specified doorbell register I20STATUS I20InMsgStatGet unsi
86. e dink32 src and create the compressed file c dink32 src Unix dcomp e c dink32 src e dink32 src This command will decompress expand the file c dink32 src and creat the decompressed i e expanded file e dink32 src e dink32 src is equivalent to the original dink32 src file UNIX ls 1 c dink32 src e dink32 src dink32 src rw r 1 maurie 361189 Jan 22 09 43 c dink32 src W cg 2 1 maurie 597181 Jan 22 09 41 dink32 src SIM E 5 5 1 maurie 597181 Jan 22 10 41 e dink32 src 6 2 bat decode 6 2 1 Overview The bat decode program will decode BATU and BATL hex values supplied in hex The value of the bats will be displayed and described 6 2 2 Building To compile and link the program use this command This description uses the generic CC for the compiler invocation CC bat decoder c o bat decoder out 6 2 3 Command syntax Usage M MOTOROLA Chapter 6 Utilities 6 73 bat_decode bat_decoder out lt inputfile gt outputfile Examples bat_decoder out lt bat in gt bat out Note that this program uses stdin and stdout so the lt symbol and gt symbol are required example Input description lt an integer gt How many bat pairs per line are supplied lt some_description gt lt batlower_value gt lt batupper_value gt where lt some_description gt has no spaces or tabs use underscore to connect names must be 19 characters or less The character array has only 20 chara
87. ed status indicator Description 10J 132 Dink32 R12 User s Manual M MOTOROLA MPC8240 I2C Driver Library Generate a STOP signal to terminate the master transaction I2CStatus I2C Master Xmit unsigned int eumbbar e eumbbar is the address of the Embedded Utilities Memory Block Returns Any defined status indicator Description Master sends one byte of data to slave receiver The DLI global variables ByteToXmit XmitByte and XmitBufEmptyStop are used to determine which data byte or STOP to transmit If a data byte is sent it is written to the I2CDR This function may only be called when the following conditions are met RCSR MIF 1 I2CSR MCF 1 I2CSR RXAK 0 DCCR MSTA 1 DCCR MTX 1 I2CStatus I2C Master Rcv unsigned int eumbbar e eumbbar is the address of the Embedded Utilities Memory Block Returns Any defined status indicator Description Master receives one byte of data from slave transmitter The DLI global variables ByteToRcv RcvByte and RcvBufFulStop are used to control the accepting of the data byte or sending of a STOP if the buffer is full This function may only be called when the following conditions are met I2CSR MIF 1 I2CSR MCF 1 I2CCR MSTA 1 I2CCR MTX 0 I2CStatus I2C Slave Xmit unsigned int eumbbar NOTE untested e eumbbar is the address of the Embedded Utilities Memory Block e Returns I2CSUCCESS if data byte sent I2CBUFFEMPTY if no data in sending buffer Descriptio
88. ent I2C bus arbitration loss etc All of these functions are defined as static in the source file drivers 12c 12c1 c J 4 1 Common Data Structures and Values These data structures and status values are defined see drivers i2c i2c h for the Kahlua I2C driver library functions These are the offsets in the Embedded Utilities Memory Block for the I2C registers define I2CADR 0x00003000 define IZCFDR 0x00003004 define IZCCR 0x00003008 10J 128 Dink32 R12 User s Manual M MOTOROLA MPC8240 I2C Driver Library define I2CSR 0x0000300C define I2CDR 0x00003010 typedef enum i2cstatus I2CSUCC I2CADDR I2CERRO I2CBUFF I2CBUFF I2CXMIT I2CRCVE I2CBUSB I2CALOSS I2CNOEVENT I2CStatus 0x3000 nn nn ULL PTY RROR ROR Go pi b t uJ pj bl n lt These structures reflect the bit assignments of the I2C registers typedef struct _i2c_ctrl nsigned int reservedO 24 nsigned int men 1 nsigned int mien 1 nsigned int msta qs nsigned int mtx 1 nsigned int txak 1 nsigned int rsta 1 nsigned int reservedl 2 I2C CTRL ypedef struct i2c stat A eripi e E gi e IUE E nsigned int rsrv0 24 nsigned int mcf 1 nsigned int maas 1 nsigned int mbb 1 nsigned int mal 1 nsigned int rsrvl 1 nsigned int srw 1 nsigned int mif 1 nsigned int rxak 1 I2C STAT Values to indicate rece
89. ferent platforms with different processors for example the same version of DINK32 will boot the Yellowknife X2 platform with memory map A the Yellowknife X4 platform with memory Map B the Sandpoint as well as the Excimer and Maximer platforms with all the supported PowerPC processors The ROM device on the Yellowknife and Sandpoint system is the Plastic Leaded Chip Carrier PLCC device Upgrading the firmware on such system could be as easy as removing and replacing the old ROM with the new one The ROM devices on the Excimer and Maximer platform however are the thin small surface mount packages TSSOP It is not easy to remove such devices on the target hardware for upgrading To solve this problem Motorola provides a smaller version of DINK32 called MDINK The main purpose of mdink is to download DINK32 or other boot program to ROM thus it provides a robust way for upgrading the firmware There are two different versions of DINK 1 DINK32 provides the capability to download and debug application programs 2 MDINK322 provides the capability to download and upgrade firmware Only DINK32 is available in executable form It is delivered in the following eight file formats as shown in Table 3 2 DINK32 File Formats 3 8 Dink32 R12 User s Manual M MOTOROLA DINK Software Build Process Table 3 2 DINK32 File Formats Board S record S Record g elf elf dwarf g Yellowknife and Sandpoint dinkyk src dinkyk g src
90. file makefile pc is used to build on the PC windowns platform and the makefile gcc is used to build on UNIX with a GNU gcc compiler M MOTOROLA Chapter 3 MDINK32 DINK32 Features 3 9 DINK32 Memory Model DINK32 dink dir h c s mdink_dir drivers epic dma i20 i2c board h o dink32 src dink32 board h o mdink32 src mdink32 Figure 3 1 DINK32 MDINK32 Directory Organization When compiling a version of DINK32 to upgrade an Excimer and Maximer board it is important to realize that this module while relocatable has a dependency that must be accounted for during compilation Since MDINK32 and DINK32 both copy themselves to RAM and then execute from RAM it is important to know which address range to copy from FLASH to RAM If you are building an image which will be located at the reset vector OxFFF00100 then the define RESET BASE which is located in the config h file must be set to OxFFFO If however you are upgrading a version of DINK32 on an Excimer or Maximer board RESET BASE should be changed to OxFFCO before building your new image This S record would then be loaded at address OXFFCO00000 This is the original configuration that came with the Excimer and Maximer board The command to download a new version of DINK32 on an Excimer and Maximer board would be dl fl o ffc00000 if there is nothing at location Oxffc00000 If replacing an older version then fw e would be used to erase the versi
91. gent s inbound DB register and print it out db_reg_content T20DBGet LOCAL eumbbar PRINT Agent s inbound doorbell register Oxx n db_reg_content break case 1 set agent s outbound doorbell register db_reg_content al lt lt dus I20DBPost LOCAL eumbbar db reg content break case 2 AN MOTOROLA Appendix K MPC8240 120 Doorbell Driver 10K 141 MPC8240 120 Doorbell Driver enabl agent s inbound DB register interrupts XE I20DBEnable LOCAL eumbbar 3 I20SUCCESS PRINT Cannot enable agent s inbound doorbell interrupt n else PRINT Enabled agent s inbound doorbell interrupt n break case 3 disable agent s inbound DB register interrupts I4 I20DBDisable LOCAL eumbbar 3 I20SUCCESS PRINT Cannot disable agent s inbound doorbell interrupt n else PRINT Disabled agent s inbound doorbell interrupt n break ifdef DBG_I20 case 4 I20 ISR agent break endif K 1 4 3 Descriptions of the 120 library functions I20STATUS I20DBEnable LOCATION loc unsigned int base unsigned int in_db loc LOCAL or REMOTE Use LOCAL if called from agent REMOTE if called from host This controls the use of the base parameter as PCSR ifREMOTE or EUMB if LOCAL and selection of outbound if REMOTE or inbound if LOCAL mask registers e base is the base address of PCSR or EUMB in dbis used for LOCAL to control enabling of doorbell and or machin
92. gned int eumbbarl20IMSTAT val eumbbar is the base address of the agent s EUMB e val receives the agent s inbound message interrupt statusregister e Returns I2OSUCCESS Description The agent s Inbound Message Interrupt Status Register IMISR content is masked by the agent s Inbound Message Interrupt Mask Register IMIMR and placed in the address given in the val parameter The IMISRregister is cleared I20STATUS I200utMsgStatGet unsigned int pcsrbar I200MSTAT val e pesrbar is the base address of the agent s PCSR e va receives the agent s outbound message interrupt statusregister e Returns LOSUCCESS Description The agent s Outbound Message Interrupt Status Register OMISR content is masked by the agent s Outbound Message Interrupt Mask Register OMIMR and placed in the address given in the val parameter The OMISRregister is cleared K 2 12C Driver Library This section provides information about the generic Application Program Interface API to the I2C Driver Library as well as information about the implementation of the Kahlua specific I2C Driver Library Internals DLI AN MOTOROLA Appendix K MPC8240 120 Doorbell Driver 10K 143 MPC8240 120 Doorbell Driver K 2 1 Background The intended audience for this document is assumed to be familiar with the I2C bus protocol It is a companion document to the Kahlua specification and other documentation which collectively give details of the I2C protocol and the Kahlua implemen
93. h the verbose display in Section 4 1 30 regdisp rd DINK32 ARTHUR gt gt rd msr MSR 0x00003930 POW 0 EE 0 PR 0 FP 1 ME BE 0 FE1 21 IP 0 IR 1 DR TLB GPR 0 VMX 0 PM 0 0 1 FEO 1 SE 1 RI 0 LE 0 M MOTOROLA Chapter 4 MDINK32 DINK32 Commands 4 31 Commands 4 1 12 flash 1 flash memory commands mdink32 limited compatibility flash This command will perform a variety of flash memory operations Syntax fl flags o value s sector number Description This command performs actions to the flash memory e dsi display sector information dink32 mdink32 e e erase all of flash dink32 mdink32 cp copy MDINK from RAM to Flash dink32 only Required Flags o value copy address in flash Optional Flags e erase flash first sp protect indicated sector dink32 only Required Flags n value sector number 0 18 su unprotect indicated sector dink32 only Required Flags n value sector number 0 18 se erase indicated sector mdink32 dink32 Required Flags n value sector number 0 18 For Version 12 0 cp is not implemented Sector Protect Unprotect commands require a 12V power supply See AMD Bulletin NVD Flash Sector Protection available on the www amd com web site Example DINK32 603e gt gt f1 se n 6 D Erasing sector 6 DINK32 603e gt gt f1l dsi Display Sector Info
94. he MSR EE bit CoreExtIntDisable disables external interrupts by clearing the MSR EE bit Low Level Exception Handler epic exception Save the current interrupted programming model state Calls epicISR to service the interrupt Restore the programming model state and RFI back to interrupted process L 5 2 High Level Routines The following routines are in the epicl c source file L 5 2 1 EPIC Initialization Routines epicInit initialize the EPIC Unit by Setting the reset bit in the Global Configuration Register which will Disables all interrupts 10L 160 Dink32 R12 User s Manual M MOTOROLA MPC8240 EPIC Interrupt Driver Clears all pending and in service interrupts Sets EPIC timers to base count Sets the value of the Processor Current Task Priority to the highest priority OxF thus disabling interrupt delivery to the processor Reset spurious vector to Ox FF Default to pass through mode e Sets the EPIC operation mode to Mixed Mode vs Pass Through or 8259 compatible mode Jf IRQType input is Direct IRQs IRQType is written to the SIE bit of the EPIC Interrupt Configuration Register ICR clkRatio is ignored If IRQType is Serial IRQs Note not supported in DINK32 both IRQType and clkRatio will be written to the ICR register epicCurTaskPrioSet Change the current task priority value epicIntISRConnect Register an ISR with the EPIC unit cros
95. he Release This release does not include several source files These source files are included here as empty files None of the dink dir or mdink dir directories are included in this distribution In order to modify any of the source files and remake a dink or mdink it is necessary to copy the appropriate directory from the objects directory to this source directory and name it dink dir or mdink dir The objects directories are 10F 104 Dink32 R12 User s Manual M MOTOROLA dink_excimer_met dink_yk_met mdink_excimer_met dink_excimer_met_g dink_yk_met_g mdink_excimer_met_g dink excimer pc dink yk pc mdink excimer pc dink excimer pc g dink yk pc g mdink excimer pc g dink excimer gcc dink yk gcc mdink excimer gcc The naming convention is The steps to make a succesful compile are dink dink mdink mdink excimer excimer or maximer met metaware compiler on unix gcc gnu gcc compiler on unix pc metaware compiler on an NT PC Updating DINK32 from the Web 1 copy one of the sfile directories to the source directory and call it dink dir or mdink dir make tch This will touch all the object files in the dink dir or mdink dir directories so that none of the empty c files will replace the associated object file make your source file changes make dink or make mdink If you forget the make tch then remove the dink dir or mdink dir directory and recopy it example M
96. he address of the Embedded Utilities Memory Block cv addris the receiver s I2C device address e buffer ptr is pointer to the data buffer to transmit length is the number of bytes in the buffer stop flag 1 signal STOP when buffer is empty e 0 don t signal STOP when buffer is empty e is cnt 1 this is a restart don t check MBB e this is a not restart check MBB Returns Any defined status indicator 10 130 Dink32 R12 User s Manual M MOTOROLA MPC8240 I2C Driver Library Description Set up to send a buffer of data to the intended rcv addr If stop flag is set after the whole buffer is sent generate a STOP signal provided that the receiver doesn t signal the STOP in the middle Caller is the master performing transmitting If no STOP signal is generated at the end of current transaction the master can generate a START signal to another slave address The function does not actually perform the data buffer transmit it just sets up the DLI global variables to control the transaction and calls I2C Start to send the slave address out on the I2C bus in transmit mode The application must check the return status to find out if the bus was obtained then enter a loop of calling I2C Timer Event to poll the I2C handler to actually perform the transaction one byte at a time while checking the return status to determine if there were any errors and if the transaction has completed I2CStatus I2C get unsigned int eumbbar
97. interrupt then the vector number is used to reference the vector ISR from the cross reference table The vector ISR is then called to service the particular interrupt Once the ISR completes and returns an end of interrupt is issued by calling epicEOI Control then returns to epic exception AN MOTOROLA Appendix L MPC8240 EPIC Interrupt Driver 10L 163 MPC8240 EPIC Interrupt Driver Epic exception finishes by restoring state and performs an RFI return from interrupt back to the interrupted process L 9 Example Usage on Sandpoint Reference Platform The EPIC driver source code currently defaults to a debug state This state is controlled by the DEPICDBG compiler directive in the makefile located in the EPIC source directory The compiler directive allows the driver code to be much more verbose and informative when exercising the EPIC units features in the debug state Demonstration code is also inserted in this debug state The demo code is inserted into the epicInit routine and allows for an interactive demonstration of external interrupts The external interrupts demonstrated are IRQ lines 1 and 2 and Global Timers 0 and 1 L 9 1 L 9 1 Sandpoint Reference Platform The Sandpoint Reference Platform provides a means to test external interrupts via two slide switches S5 and S6 located on the mother board Although these switches can be manipulated to demo the EPIC unit this is not the intended fu
98. interrupt again DINK32 should still be accepting user commands and switches S5 and S6 can still be manipulated to generated interrupts L 10 Code and Documentation Updates For the most up to date versions of the EPIC sample driver code and this appendix document please visit the following URL http www mot com SPS PowerPC teksupport faqsolutions code index html AN MOTOROLA Appendix L MPC8240 EPIC Interrupt Driver 10L 167
99. ion 2 Call I2C do transaction to receive the buffer of data The following code samples have been excerpted from the DINK32 application to illustrate the use of the I2C API define PRINT dink printf int dink printf unsigned char fmt body of application print output function see Appendix In the function par devtest for testing the I2C devic interfac A initialize the I2C handler to I2C address 48 if needed if I2CInited 0 I2C Status status if status I2C Initialize 48 en int PRINT I2C SUCCESS PRINT devtest I2C error in initiation n return ERROR else I2CInited 1 return test i2c action en int static unsigned char rcv buffer BUFFER LENGTH 0 static unsigned char xmit buffer BUFFER LENGTH 0 PARA RK KK KK KARA RA A A AAA A ke function test 12c description run i2c test by polling the device note Test i2c device on PMC card 0x50 serial EPROM The device test data is currently only printable characters This function gets some data from the command line validates it and calls the I2C library function to perform the task CK OK CK CK OK Ck Ck Ck CK KK Ck CK CK Ck Ok Ck Ck Ok Ok Ck Ck Ck Ck Ok Ck Sk Ck Ck Ck Ck Ck CK Ck Ck Ak Ck Ck Ck Xk Pk Pk Sk X Sk Mk Sk X ko k ko ko x static STATUS test i2c int act int en int int retry 800 len 0 rsta 0 addr 0 sx ob Gb ob cb oe
100. ion prototypes defined return values and enumerated input parameter values are declared in drivers dma dma export h The functions are defined in the source file drivers dma dmal c DMA Status DMA_Initialize int app print function char app print functionisthe address of the optional application s print function otherwise NULL if not available Return DMA Status return value is either DMA SUCCESS or DMA ERROR Description Configure the DMA driver prior to use as follows The optional print function if supplied by the application must be similar to the C standard library printf library function accepts a format string and a variable number zero or more of additional arguments This optional function may be used by the library functions to report error and status condition information If no print function is supplied by the application the application must provide a NULL value for this parameter in which case the library will not attempt to access a print function NOTE Each DMA transfer will be configured individually by the function call that initiates the transfer If it is desirable to establish a default configuration these could be added as 101 114 Dink32 R12 User s Manual M MOTOROLA OU c c c tl tJ MPC8240 DMA Memory Controller parameters Alternately the first or most recent transfer configuration values could also be used to establish defaults NOTE This function call t
101. is sent to your function i e define your function with a null argument list as STATUS newcommand CMD TAG will send you a pointer to a string with the invocation command from the command line but not the argument list Le define your function with a string pointer such as STATUS newcommand char dink cmd dink cmd will be a null terminated string containing only the invocation command Such as dink cmd new command AN MOTOROLA Appendix A Adding Commands and Arguments 10A 85 Adding Commands and Arguments Example existing about command help c void help about PRINT ABOUT An PRINT An PRINT Mnemonic about ab An PRINT Syntax ab An PRINT Description This command displays the general information PRINT on DINK32 n PRINT Example ab would display the opening screen of DINK32 NT S Example fl command help c void help flash RINT FLASH COMMANDS An P r PRINT An PRINT Mnemonic flash fl n PRINT Syntax fl flags o value s sector number n PRINT Description This command performs actions to the flash memory n PRINT Flags e erase erase all of flashin PRINT Flags cp copy copy MDINK from RAM to Flash n PRINT Required Flags o value copy address in flash n PRINT Optional Flags e erase flash firstin PRINT Flags sp protect indicated sector n
102. isable are defined in drivers 120 1201 c to perform this task See the code in test 120 for a usage example It is interesting to note that the observed behavior of the Kahlua chip with regard to message unit registers is not dependant on the ODIM and IDIM bit settings Even if the ODIM or IDIM mask bits are set writes to the affected doorbell are not blocked and the appropriate bit is set in the message unit s status register It is up to software to apply the mask to the status register to determine whether or not to take any action The interrupt should not occur AN MOTOROLA Appendix K MPC8240 120 Doorbell Driver 10K 139 MPC8240 120 Doorbell Driver if the mask bit is set but this has not yet been tested K 1 4 Writing and Reading Doorbell Registers The functions I2ODBPost and I2ODBGet are defined in drivers i20 1201 c to write a bit pattern to or return the contents of the agent s inbound and outbound doorbell registers Note that the agent application accesses both inbound and outbound doorbell registers via its own EUMB and the host application accesses these same doorbell registers via the agent s PCSR See the code in test 120 for usage examples K 1 4 1 Host Rings an Agent via Agent s Inbound Doorbell The host application calls the I2O library function IZODBPost to write the bit pattern to the agent s Inbound Door Bell Register IDBR If the inbound doorbell is enabled this generates a Message Unit interrupt
103. isp md memfill mf memove mv memtest mt regdisp rd reset rst setbaud sb Spr name sx tau trace tr lp mnemonic lp mnemonic 4 49 Commands 4 1 26 pciconf pct pci probe command on systems with a PCI bus pciconf lt devNum gt This command displays 26 common PCI configuration registers and 16 additional device specific registers of a PCI device The devNum depends on which PCI slot the device is attached to and it can be found by executing the ppr PCI Device Probe command Example DINK32_750 gt gt ppr devNo PCI ADR DEVICE ID VENDOR ID 11 0x80005800 0x0565 0xl0ad ADDR VALUE DESCRIPTION 0x00 Oxl0ad Vendor ID 0x02 0x0565 Device ID 0x04 0x0007 PCI command 0x06 0x0200 PCI status 0x08 0x04 Revision ID 0x09 0x00 Standard Programming Interface 0x0a 0x01 Subclass code 0x0b 0x06 Class code 0x0c 0x00 Cach lin siz 0x0d 0x00 Latency timer 0x0e 0x80 Header type OxOf 0x00 BIST control 0x10 0x00000000 Base Address Register 0 0x14 0x00000000 Base Address Register 1 0x18 0x00000000 Base Address Register 2 Oxlc 0x00000000 Base Address Register 3 0x20 0x00000000 Base Address Register 4 0x24 0x00000000 Base Address Register 5 0x28 0x00000000 Cardbus CIS Pointer 0x2c 0x0000 Subsystem Vendor ID 0x2e 0x0000 Subsystem ID 0x30 0x00000000 Expansion ROM Base Address 0x3c 0x00 Interrupt line 0x3d 0x00 Interrupt pin 0x3e 0x00 MIN G
104. ister BCR specified by host and channel to the given values DMAStatus DMA Start LOCATION host unsigned eumbbar unsigned int channel hostis LOCAL or REMOTE only LOCAL is currently tested e eumbbar is EUMBBAR for LOCAL or PCSRBAR for REMOTE e channel is DMA_CHN_0 or DMA CHN 1 Return value is DMASUCCESS DMACHNBUSY or DMAINVALID Description Start the DMA transfer on the specified host and channel Ensure the channel is free then clear and set the CS bit in the mode register That 0 to 1 transition triggers the DMA transfer AN MOTOROLA Appendix I MPC8240 DMA Memory Controller 101 123 MPC8240 I2C Driver Library Appendix J MPC8240 I2C Driver Library This section provides information about the generic Application Program Interface API to the I2C Driver Library as well as information about the implementation of the Kahlua specific I2C Driver Library Internals DLI J 1 Background The intended audience for this document is assumed to be familiar with the I2C bus protocol It is a companion document to the Kahlua specification and other documentation which collectively give details of the I2C protocol and the Kahlua implementation This document provides information about the software written to access the Kahlua I2C interface This software is intended to assist in the development of higher level applications software that uses the I2C interface Note The I2C driver software is currently under development The on
105. ive or transmit mode typedef enum i2c mode RCV 0 XMIT 1 I2C_MODE J 5 Kahlua 12C Driver Library Internals function descriptions I2CStatus I2C Init unsigned int eumbbar unsigned char fdr unsigned char addr AN MOTOROLA Appendix J MPC8240 12C Driver Library 10J 129 MPC8240 I2C Driver Library unsigned int en int e eumbbar is the address of the Embedded Utilities Memory Block fdris the frequency divider value used to set the I2C clock rate e addr is the Kahlua chip s I2C slave device address en int controls the I2C interrupt enable status 1 enable O disable Return I2CStatus return value is always I2CSUCCESS Description Set the frequency divider I2CFDR FDR listening address I2ZCADR 7 1 and interrupt enable mode I2CCR MIEN I2C CTRL I2C Get Ctrl unsigned int eumbbar e eumbbar is the address of the Embedded Utilities Memory Block e Return I2C_CTRL is the contents of the I2C control register RCCR Description Read the I2C control register void I2C Set Ctrl unsigned int eumbbar I2C CTRL ctrl e eumbbar is the address of the Embedded Utilities Memory Block e ctrl is the contents of the I2C control register I2ZCCR Return none Description Set the I2C control register I2CStatus I2C put unsigned int eumbbar unsigned char rcv addr unsigned char buffer ptr unsigned int length unsigned int stop flag unsigned int is cnt e eumbbar is t
106. le that contains the addresses of the local and remote registers for both DMA channels defined in drivers dma dmal c unsigned int dma reg tb 14 m y local DMA registers O itj JG 0 de EP iu cJ pios ge s D m gs E om m gp op UU UUUUUUUUUuuUu uud 0 MR 0 SR 0 CDAR _0 _O_DAR _O_BCR _O_NDAR 1_MR 1 SR 1 CDAR 1 SAR 1 DAR 1 BCR _SAR DAR DMA R x R DAR _BCR _O_NDAR 1_MR 1 SR 1 CDAR 1 SAR 1 DAR 1 BCR 1 NDAR gt 0x00001100 0x00001104 0x0000110 0x00001110 0x00001118 0x00001120 0x0000112 0x00001200 0x00001204 0x0000120 0x00001210 0x00001218 0x00001220 0x0000122 registers 0x00000100 0x00000104 0x0000010 0x00000110 0x00000118 0x00000120 0x0000012 0x00000200 0x00000204 0x00000208 0x00000210 0x00000218 0x00000220 0x00000224 These values are the function status return values 101 118 Dink32 R12 User s Manual typedef enum _dmastatus n c CCESS ERROR ERROR HNBUSY OSINT OCAINT NVALID EVENT AStatus 0x1000 E Fl Q UUUOUUUGUJ SEE ES E UH D pH O MPC8240 DMA Memory Controller These structures reflect the bi
107. ly 5 70 Dink32 R12 User s Manual M MOTOROLA Commands 31 regmod rm modify entire general register family 32 rtc rtc set and or display the real time clock 33 runalias ra execute the commands in the alias 34 setbaud sb display or change the serial port baud rate 35 symtab st displays DINK32 symbol table 36 tau tau display temperature from the Thermal Assist Unix 37 transpar tm transparent mode Yellowknife only 38 trace tr address trace from given address AN MOTOROLA Chapter 5 DINK32 Command Form Summary 5 71 S Record Compression Decompression Chapter 6 Utilities 6 1 S Record Compression Decompression 6 1 1 Overview To assist in the compression of S Record files a conversion utility is included with the source code for DINK32 The dcomp utility is written in portable ANSI compliant C which is easily compiled under UNIX or a PC The dcomp utility performs both compression and decompression of S records It is provided so that the user may compress their S record before downloading them to the board They will automatically detected as compressed S records by DINK and decompressed before being written to the proper memory locations 6 1 2 Building 6 1 2 1 Files The dcomp package consists of two c files dc tb c dc unix c and three header files dink h errors h and sublib h However these header files call other header files so dcomp must be built in the dink32 source directory 6 1 2 2 Modification
108. ly modes that are functional are the master transmit and master receive in polling mode J 2 Overview This document consists of these parts An Application Program Interface API which provides a very simple generic application level programmatic interface to the I2C driver library that hides all details of the Kahlua specific implementation of the I2C interface 1 e control register status register embedded utilities memory block etc 2C API functions showing the following how the function is called i e function prototype parameter definition possible return values brief description of what the function does an explanation of how the functions are used by an application program DINK32 usage employed as examples e AnI2C Driver Library Internals DLI which provides information about the lower level software that is accessing the Kahlua specific implementation of the I2C interface DC DLI functions showing the following how the function is called 1 e function prototype parameter definition 10J 124 Dink32 R12 User s Manual M MOTOROLA MPC8240 I2C Driver Library possible return values brief description of what the function does J 3 12C Application Program Interface API J 3 1 API functions description The I2C API function prototypes defined return values and enumerated input parameter values are declared in drivers 12c 12c_export h The functions a
109. mand scans all legal PCI device numbers from 10 to 31 and detects whether any device is attached to them If a PCI device is found the following information is displayed Device number PCI address Device Id and Vendor Id Example DINK32_750 gt gt pciprobe Dev PCT ADDR DEVICE ID VENDOR ID CLASS 11 0x80005800 0x0565 0x1l0ad Bridg Interfac 12 0x80006000 cannot probe self 15 0x80007800 0x2000 0x1022 Network Interface AN MOTOROLA Chapter 4 MDINK32 DINK32 Commands 4 53 Commands 4 1 30 regdisp ra display registers Syntax tay e rlrxlrx Irx rylflfxIfx Ifx fylsxispr namelnorthbridgelnblmpc106lmpc107lmpc82 40 e regdisp r entire general register family regdisp rx one general purpose register regdisp rx from rx to r31 regdisp rx ry from rx to ry regdisp f entire floating point family regdisp fx one floating point register regdisp fx from fx to f31 e regdisp fx fy from fx to fy e regdisp SPR by name view spr by name such as hidO contents regdisp sx one special purpose register regdisp vx one altivec vector register regdisp v all altivec vector registers e regdisp v verbose display only valid if env c env rdmode e is set This will display the contents of the specified registers This command offers the user several options for viewing the registers The whole family of general purpose registers or floating point registers can be
110. must be repeated for each breakpoint Setting a breakpoint will not remove a breakpoint from an address if a breakpoint already exists there Deleting a breakpoint from an invalid index has no effect Breakpoints can be set or deleted one at a time and all are displayed during a breakpoint list A maximum of 20 breakpoints can be set in the system Examples DINK32 750 gt gt bkpt 60100 Breakpoint set at 0x00060100 DINK32 750 gt gt bkpt Current breakpoint list 1 0x00060100 DINK32 750 gt gt bkpt d 1 Breakpoint deleted DINK32 750 gt gt bkpt Current Breakpoint List 4 22 Dink32 R12 User s Manual M MOTOROLA Commands 4 1 5 defalias aa define alias The runalias ra command is the companion to this command While these commands da and ra are still available the env command is more flexible e defalias This command will allow the user to define an alias to a list of commands separated by a semicolon Once the alias has been defined runalias can be used instead of retyping the list of commands Only one alias may be set at a time and using defalias a second time will overwrite the previously aliased command list Below is an example of using an alias to single step and display registers Example DINK32 750 gt gt trace 2100 A Run Mode or Trace exception has occurred Current Instruction Pointer 0x00002104 lwz r03 0Ox0000 r02 DINK32 750 gt gt defalias Current alias definition New ali
111. n Slave sends one byte of data to requesting master The DLI global variables ByteToXmit XmitByte and XmitBuf are used to determine which byte if any to send This function may only be called when the following conditions are met I2CSR MIF 1 I2CSR MCF 1 2CSR RXAK 0 DCCR MSTA 0 DCCR MTX 1 I2CStatus I2C Slave Rcv unsigned int eumbbar NOTE untested e eumbbar is the address of the Embedded Utilities Memory Block Returns I2CSUCCESS if data byte received I2CBUFFFULL if buffer is full or no more data expected Description M MOTOROLA Appendix J MPC8240 I2C Driver Library 10J 133 MPC8240 I2C Driver Library Slave receives one byte of data from master transmitter The DLI global variables ByteToRcv RcvByte and RcvBufFulStop are used to control the accepting of the data byte or setting the acknowledge bit 2CCR TXAK if the expected number of bytes have been received This function may only be called when the following conditions are met I2CSR MIF 1 IDCSR MCF 1 I2CCR MSTA 0 I2CCR MTX 0 I2CStatus I2C Slave Addr unsigned int eumbbar NOTE untested e eumbbar is the address of the Embedded Utilities Memory Block Returns 2CADDRESS if asked to receive data results from call to I2C Slave Xmit if asked to transmit data Description Process slave address phase Called from I2C ISR This function may only be called when the following conditions are met I2CSR MIF 1 I2CSR MAAS 1 I2CStatus I
112. nction of the switches The intended usage of these switches is described in the document titled Sandpoint PPMC Processor PCI Mezzanine Card Host Board Technical Summary Switch S5 manipulates a 5V signal that originates from the interrupt output line of the Winbond southbridge chip in the center of mother board With S5 slid to the left a 5V signal is passed on with S5 slid right a OV signal is passed on The EPIC IRQO 4 interrupt lines can be configured to be active low or active high triggered Switch S6 specifies to which IRQ line IRQ1 or IRQ 2 the interrupt signal from S5 is passed With the S6 slid right IRQI is selected With S6 slid left IRQ2 is selected L 9 2 Demo Code Snippet The following code is included in the epicInit routine when compiled with the DEPICDBG compiler directive EPIC test code difdef EPICDBG The following test code enables is specific for the Sandpoint System Steps Configure interrupts for IRQ1 and IRQ2 Set base counts for timerO0 and timeri TimerO will interrupt twice for every one timerl interrupt Enable interrupts for timer0 and timerl Enable interrupts for IRQ1 and IRQ2 Lower the current task priority Enables external interrupts 10L 164 Dink32 R12 User s Manual M MOTOROLA MPC8240 EPIC Interrupt Driver set int 1 to active low edge sensitive priority 10 printf Configure Int lin tmp epicIntSourceConfig 1 0 0 10 epic
113. ndpoint For large programs we suggest changing the baud rate to 57600 before the download One can start and debug the downloaded program in any baud rate However before pressing the reset button restore the baud rate to 9600 4 go 90000 One needs to build the executable program so that it starts at address 0x90000 Upon invocation the program will use r1 as the stack pointer which will have been set to Ox8fff0 by DINK32 Note Hardware flow control is implemented on the Excimer and Maximer platform and is required for file downloading Example DINK32 750 gt gt sb k 57600 Change the baud rate to 57600 Also change the setting on your terminal emulator DINK32 750 gt gt dl k Downloading in s record format M MOTOROLA Chapter 7 User Program Execution 7 77 Execution Steps Download Complete DINK32_750 gt gt Set breakpoints if necessary and xecut th user program at the location to which it was downloaded using go or trace DINK32_750 gt gt go lt address gt DINK32_750 gt gt trace lt address gt 7 78 Dink32 R12 User s Manual M MOTOROLA Error Codes Chapter 8 Errors and Exceptions 8 1 Error Codes 8 1 1 Parser Errors OxFB00 UNKNOWN_COMMAND unknown command OxFB01 UNKNOWN_REGISTER unknown register OxFB02 ILLEGAL_RD_STAGE cannot specify whole register family in range OxFB03 ILLEGAL_REG_FAMILY cannot specify a range of special registers OxFB04 RANGE CROSS FAMILY cannot specify a ra
114. ne The dhrystone directory contains source files that can be built to build an application that can then be downloaded into dink at address 0x90000 and run The dhrystone directory has two subdirectories ties MWnosc and watch The makefile is contained in the MWnosc directory This directory contains all the code necessary to build and run a Dhrystone benchmark program Before starting execution change the value of hidO and dbatll DINK32 by default starts the downloaded program with caches off and cache inabled in the dbats Change hidO to 0000cc00 and dbat11 to 12 Use these commands rm hidO 0000cc00 rm dbat11 12 E 3 1 Building The demo can be built with the UNIX or PC command make After making the dhrystone src download the file dhry src with the DINK32 command d1 k Then change the hidO register to 8000C000 and change the dbat1L to 12 There are two makefiles M MOTOROLA Appendix E Example Code 10E 101 Example Code e makefile use the UNIX PowerPC cross tools makefile pc use the PC PowerPC cross tools It can be executed with the DINK32 command go 90000 E 3 2 Function Addresses All dink function addresses are determined dynamically see Appendix G for more information E 4 L2test The directory contains source files that can be built to build an application that can then be downloaded into dink at address 0x90000 and run This application will test the L2 cache and exercise the performance monitor
115. nge across register families OxFB05 UNIMPLEMENTED STAGE invalid rd or rmm parameter format OxFB06 UNKNOWN OPERATOR unknown operator in arguments OxFB07 INVALID FILENAME invalid download filename 8 1 2 Errors from Error Checking Toolbox OxFD00 INVALID NOT valid OxFDO1 VALID valid OxFD02 INVALID SIZE the input was not 8 characters long OxFD03 OUT OF BOUNDS ADDRESS the address given falls outside of valid memory defined by MEM START to MEM END OxFD04 INVALID HEX INPUT one of more of the characters entered are not valid hex characters Valid hex characters are 0 9 A F a f OxFDOS INVALID REGISTER a given register does not exist OxFD07 NOT WORD ALIGNED the given address is not word aligned A word aligned address ends in 0x0 0x4 0x8 0xc OxFD08 REVERSED ADDRESS the starting address is greater than the ending address OxFD09 RANGE OVERLAP the address specified as the destination is within the source 8 1 3 addresses OxFDOA ERROR an error occurred OxFDOB INVALID PARAM invalid input parameter AN MOTOROLA Chapter 8 Errors and Exceptions 8 79 Error Codes 8 1 4 Get Argument Errors e OxFE00 INVALID NUMBER ARGS invalid number of command arguments e OxFE01 UNKNOWN PARAMETER unknown type of parameter 8 1 5 Tokenizer Toolbox Errors e OxFF00 ILLEGAL CHARACTER unrecognized character in input stream e OxFF01 TTL NOT SORTED token translation list not sorted e OxFF02 TTL NOT DEFINED token translation list not assigned e OxFF03 INVA
116. no parameters will display a list of all the known devices Example DINK32 ARTHUR gt gt dd Device Start End Sizes mem 00000000 FFFFFFFF BHW nvram 00000000 00000FFF B i2c 00000000 0000007F B rtc 00000000 0000000D B rtcram 0000000E 000000FF B apc 00000040 00000048 B DINK32 ARTHUR gt gt dd nvram 40 0x0040 14 3E 27 9C FA CO 04 0x0050 dd x DINK32 ARTHUR gt gt 4 24 Dink32 R12 User s Manual 6B 2A 87 08 9C 66 7E Commands 4 1 7 devmod dm DINK32 Peripheral device modify devmod dm dm device bl hl w addr1 addr2 The device modify command allows interactive modification of device data in registers and or indirect memory The dd command operates similar to the mm command with some additional flexibility device Is the name of the device If not entered display all known devices e b h w Set size of device accesses If not specified the default size is bytes for devices addrl Is the starting address to display addr2 Is the optional ending address or if not specified then display modify until user types x or ESC While examining data the contents may be modified by entering a hexadecimal value The value entered is truncated to the specified size and is then written to the device or memory When prompted for location any of the following may be entered enter go to the next location using the current selected direction defaults to forwar
117. ntent and clears the register Similarly the I20 ISR host function checks the agent s Outbound Message Interrupt Status Register 10K 138 Dink32 R12 User s Manual M MOTOROLA MPC8240 120 Doorbell Driver OMISR to determine if the cause of the interrupt was due to the agent s outbound doorbell It is important to note that the I2O ISR host must be expanded to check for any kind of expected interrupt from the agent not just message unit interrupts The I2O library function 1200utMsgStatGet is used to read the OMISR It returns the content of the OMISR after applying the mask value in the Outbound Message Interrupt Mask Register OMIMR and clears the status register The RO library function I2ODBGet is used to read the ODBR It returns the content and clears the register The two functions I20 ISR host and I2O ISR agent are defined in the source file drivers i20 i201 c and are linked into the libdrivera library For testing they are currently manually called when requested by the user in the function test 120 Eventually the host and agent will register an interrupt service routine ISR with their respective Embedded Programmable Interrupt Controller EPIC systems Details about how to register the ISRs with EPIC are not yet specified It may take the form of a function call to an EPIC provided function that accepts a pointer to the ISR function Alternately it may be integrated by the linker by placing a reference to the ISR fun
118. o transaction I2C INTERRUPT MODE en int I2C TRANSACTION MODE act unsigned char i2c_addr unsigned char data addr int len char buffer I2C STOP MODE stop AN MOTOROLA Appendix J MPC8240 12C Driver Library 10J 125 MPC8240 I2C Driver Library int retry I2C RESTART MODE rsta e en int controls the I2C interrupt enable status currently use I2C INT DISABLE only polling mode e actis the type of transaction I2C MASTER RCV or I2C MASTER XMIT e 12c_addr is the I2C address of the slave device e data addr is the address of the data on the slave device e len is the length in bytes of the data e buffer is a pointer to the buffer that contains the data xmit mode or receives the data rev mode e stop controls sending an I2C STOP signal after completion curently use I2C STOP only retry is the timeout retry value currently ignored rsta controls I2C restart currently use I2C NO RESTART only e Return I2C Status return value is either I2C SUCCESS or I2C ERROR Description Act as the I2C master to transmit or receive a buffer of data to or from an I2C slave device This function currently only implements a simple master transmit or a master receive transaction It does not yet support the application retaining I2C bus ownership between transactions operating in interrupt mode or acting as an I2C slave device J 3 2 API Example Usage The ROM monitor program DINK32 uses the I2C A
119. ode RCV A DLI global variable MasterRcvAddress is set if mode RCV used by I2C ISR function I2CStatus I2C Stop unsigned int eumbbar e eumbbar is the address of the Embedded Utilities Memory Block e Returns Any defined status indicator Description Generate a STOP signal to terminate the master transaction I2CStatus I2C Master Xmit unsigned int eumbbar e eumbbar is the address of the Embedded Utilities Memory Block e Returns Any defined status indicator Description Master sends one byte of data to slave receiver The DLI global variables ByteToXmit XmitByte and XmitBufEmptyStop are used to determine which data byte or STOP to transmit If a data byte is sent it is written to the I2CDR This function may only be called when the following conditions are met RCSR MIF 1 I2CSR MCF 1 I2CSR RXAK 10K 152 Dink32 R12 User s Manual M MOTOROLA MPC8240 120 Doorbell Driver 0 DCCR MSTA 21 I2CCR MTX 1 I2CStatus I2C Master Rcv unsigned int eumbbar e eumbbar is the address of the Embedded Utilities Memory Block Returns Any defined status indicator Description Master receives one byte of data from slave transmitter The DLI global variables ByteToRcv RcvByte and RcvBufFulStop are used to control the accepting of the data byte or sending of a STOP if the buffer is full This function may only be called when the following conditions are met I2CSR MIF 1 I2CSR MCF 1 I2CCR MSTA 1 DCCR MTX 0 I
120. of header file The dink h file uses the define macro ON BOARD which is set by config h Since dcomp must be built with ON BOARD undefined it is necessary to modify the config h file Ensure that you return config h to it s released form before trying to build dink32 or mdink32 At about line 84 of the config h file you will find the line define ON BOARD Comment out this line After the change this code will be For trying to build a version that runs under Unix comment out the Zdefine for ON BOARD define ON BOARD 6 1 2 3 Build command Use any available c compiler such as UNIX cc or gcc or Metaware or PC compiler cl Microsoft c compiler This description uses the generic CC for the compiler invocation CC dc unix c de_tb c o dcomp This command will build the executable dcomp Dcomp will run on the machine on which it is built It does not run on the Excimer and Maximer or Yellowknife and Sandpoint board 6 72 Dink32 R12 User s Manual M MOTOROLA bat_decode 6 1 3 Command syntax Usage dcomp options input file gt output_file Options c Compress an SRecord file e Expand a previously compressed file into an SRecord file Examples dcomp c a out mx gt a out cmp dcomp e a out cmp a out mx Note that this program uses stdin and stdout so the symbol and symbol are required example Unix dcomp c dink32 src gt c_dink32 src This command will compress the fil
121. ollowing page M MOTOROLA Chapter 3 MDINK32 DINK32 Features 3 11 DINK32 Memory Model 512 K byte EPROM User Memory DINK32 stack data text Exception table OxFFFFFFFF End of ROM space OxFFFSFFFF End of DINK32 Code OxFFF00100 Reset Vector Top of User Memory depending on the amount of RAM installed 1M 0x000FFFFF Typical size is 32M 0x00200000 0x00090000 Start of User Memory 0x0008FFFF Top of Stack for user 0x00080000 Top of Stack for DINK32 0x00070000 Bottom of stack Ox0006FFFF Top of data section 0x00040000 Bottom of data section 0x000303FF Top of RODATA 0x0002FDOO0O Bottom of RODATA 0x0002FFFF Top of text section 0x00003000 Bottom of text section 0x00002FFF Top of Exception table 0x00000000 Bottom of Exception Table Note The text and data sections are approximates depending on each build version Actual locations can be ascertained from the xref txt file in the dink dir directory Figure 3 2 DINK32 Memory Model Yellowknife and Sandpoint 3 12 Dink32 R12 User s Manual M MOTOROLA Chapter 3 MDINK32 DINK32 Features DINK32 Memory Model DINK32 Memory Model System ROM 4 Meg Flash ROM MDINK32 User Flash Space DINK32 System RAM User Memory DINK32 stack data text Exception table OxFFFFFFFF End of ROM space OxFFF60000 End of MDINK32 Code O
122. on and everything else that was not sector protected in Flash See Table 3 1 RESET BASE value 3 10 DINK32 Memory Model The memory model for DINK32 is shown in Figure 3 2 DINK32 Memory Model 3 10 Dink32 R12 User s Manual M MOTOROLA DINK32 Memory Model Yellowknife and Sandpoint or Figure 3 3 MDINK32 DINK32 Memory Model Excimer and Maximer The exception vectors and exception code are located within address offsets 0x0000 0x2100 The DINK32 code through 0x80000 is copied from the EPROM to RAM so that the data structures can be modified at run time For example the data structures for the chip registers need to be modified when the register modify command is executed The EPROM must be located at address OXFFF00000 because this is the beginning of the exception address space at system reset The RAM must be located at address 0x00000000 since that is the low memory exception address space where the DINK32 code will be copied Available user memory space begins at address 0x90000 and ends at the RAM s upper boundary address space below 0x90000 is reserved for DINK32 DINK32 sets the stack pointer rl to 0x80000 for the C portion of the DINK32 code DINK32 sets the user s stack pointer rl to Ox8fff0 As long as the user once started with a go or trace command does not use more than OxfffO bytes for it s stack there is no conflict with the stack used by DINK32 Please reference Figure 3 2 and Figure 3 3 on the f
123. on name For example to link the user code printf to the DINK32 printf function define printf dink_printf to link the user code put char to DINK32 write char define put char writechar See the directories demo and dhrystone for examples of setting up these define statements G 4 Using the Dynamic Functions Using these functions is implemented via the assembly language file dinkusr s and the include file dinkusr h The user includes dinkusr h and links in dinkusr s during compilation link time All of the functions in this table except set up transfer base transfer control to the DINK32 function while leaving the link register lr unchanged This effectively transfers control to the DINK32 function and the DINK32 function on completion returns directly to the caller in the user s code The functions supplied in dinkusr s are shown in the table below Table 2 dinkusr s Functions Function name Function definition set up transfer base Capture the dink transfer table address from r21 and store it into a local memory cell for future use You must call this func tion before using any of the functions below and it should be called immediately after entry such as the first statement in main dink printf DINK32 entry into printf dink_loop DINK32 idle loop is char in duart DINK32 function to determine if a character has been received menu DINK32 display menu function par about DINK32 displ
124. otect ADD TOKEN se SECTOR ERASE TOK amp i symboll7 Sector Erase ADD TOKEN cp FLASH COPY TOK amp i symbol18 Sector Erase ADD TOKEN n SECTOR NUMBER TOK 1 symboll9 Sector Number value 10A 88 Dink32 R12 User s Manual M MOTOROLA Adding Commands and Arguments fl c This code checks the first token for a dash then the second token for one of sp su se e cp The function get_sector_number gets the sector number specified if tok is next token DASH TOK PRINT Must specify sp su S cp snes s return FAILURE if status tok_get_next_token amp token temp SUCCESS PRINT Must specify sp su S ep Va return status switch token case SECTOR_PROTECT_TOK get sector number amp sector number PRINT Got sp n is dNn sector number break case SECTOR UNPROTECT TOK get sector number amp sector number PRINT Got su n is d Mn sector number break This code gets the next token which must be a n and then gets the next token which must be an ascii string containing one valid decimal number which will be converted to int by the ascii to int dec function if tok is next token DASH TOK PRINT Must specify n n return FAILURE if status tok get next token amp token temp SUCCESS if token SECTOR_NUMBER_TOK PRINT Must specify n n return FAILURE
125. pecifies the register RCDR I2CFDR I2CADR I2CSR I2CCR e val is the value to be written to the register Return No return value used it should be declared void Description The value is written to the specified register This function is defined in drivers 12c 12c2 s 10K 156 Dink32 R12 User s Manual M MOTOROLA MPC8240 EPIC Interrupt Driver Appendix L MPC8240 EPIC Interrupt Driver This appendix describes the sample EPIC driver source code provided in this DINK32 release and its usage on the Sandpoint Reference Platform running DINK32 L 1 General Description EPIC is the embedded programmable interrupt controller feature implemented on Motorolas MPC8240 integrated processor It is derived from the Open Programmable Interrupt Controller PIC Register Interface Specification R1 2 developed by AMD and Cyrix EPIC on the MPC8240 provides support for up to five external interrupts or one serial style interrupt line supporting 16 interrupts four internal logic driven interrupts DMAO DMA1 IFC I0 four global timers and it supports a pass through mode Please refer to Chapter 12 of the MPC8240 User s Manual for a more in depth description of EPIC on the MPC8240 L 2 EPIC Specifics Unlike other embedded features of the MPC8240 such as DMA and I 0 the EPIC unit is accessible from the local processor only The control and status registers of this unit cannot be accessed by external PCI devices The EPIC registers are accessed
126. plus form is used the command goes into interactive mode and will continue reading and disassembling until the end of memory is reached or until the user types x If the range form is used the command will continue reading and disassembling for each inclusive address in the range specified Note that the above parameter forms can be combined by separating the forms with a comma or white space This will display multiple disassembled portions of the memory space with one command Branch labels entered during an assemble session are displayed during disassembly In order for branch labels to be calculated correctly branch labels must be entered before instructions refer to that label Examples DINK32 750 gt gt ds 60100 0x00060100 0x58402800 rimi r00 r02 0x05 0x00 0x00 DINK32 750 gt gt ds 60118 60120 0x00060118 0xc8000503 1lfd 00 0x0503 r00 0x0006011c 0x243f002c dozi r01 r31 0x002c 0x00060120 0x00000000 WORD 0x00000000 DINK32 750 gt gt ds 60100 0x00060100 0x58402800 0x00060104 0xc8010ec5 0x00060108 Ox5da0b854 0x0006010c 0x00000000 0x00060110 0x00000000 WORD 0x00000000 0x00060114 0x605affff Ei X264 02 QOxffft 0x00060118 0xc8000503 1fd 00 0x0503 r00 0x0006011c 0x243f002c dozi r01 r31 0x002c 0x00060120 0x00000000 WORD 0x00000000 0x00060124 0x00000000 WORD 0x00000000 x to quit anything else to continue Imi r00 r02 0x05 0x00 0x00 Fd 00 Ox0ec5 r01 lwnm r00 r13 r23 0x01
127. poll the I2C handler to actually perform the transaction one byte at a time while checking the return status to determine if there were any errors and if the transaction has completed I2CStatus I2C Timer Event unsigned int eumbbar I2CStatus handler unsigned int e eumbbar is the address of the Embedded Utilities Memory Block AN MOTOROLA Appendix K MPC8240 120 Doorbell Driver 10K 151 MPC8240 120 Doorbell Driver handler is a pointer to the function to call to handle any existing status event Returns I2CNOEVENT if there is no completed event the I2CSR MIF bit is not set results from call to the handler function if there was a pending event completed Description In polling mode I2C Timer Event can be called to check the I2C status and call the given or the default I2C ISR handler function if the I2CSR MIF bit is set I2CStatus I2C Start unsigned int eumbbar unsigned char slave addr I2C MODE mode unsigned int is cnt e eumbbar is the address of the Embedded Utilities Memory Block slave addr is the I2C address of the receiver e mode XMIT 1 put write e RCV 0 get read e is cnt 1 this is a restart don t check MBB e this is a not restart check MBB Returns Any defined status indicator Description Generate a START signal in the desired mode Caller is the master The slave addr is written to bits 7 1 of the I2CDR and bit O of the I2CDR is set to 0 for mode XMIT or 1 for m
128. r This function does not implement any validation of the transfer It does check the status of the DMA channel to determine if it is OK to initiate a transfer but the application must AN MOTOROLA Appendix I MPC8240 DMA Memory Controller 101 115 MPC8240 DMA Memory Controller handle verification and error conditions via the interrupt mechanisms 1 3 1 API Example Usage The ROM monitor program DINK32 currently uses the DMA API to initiate a direct data transfer in local memory only The DINK32 program runs interactively to allow the user to transfer a block of data in local memory DINK32 obtains information from the user as follows interrupt steering transfer type source address of the data destination target address length of the data to transfer DMA channel and snoop control Note that the initialization call to configure the DMA interface is made once the first time the user requests a DMA transfer operation Each transmit or receive operation is initiated by a single call to a DMA API function The DINK32 program is an interactive application so it gives the DMA library access to its own print output function DINK32 does not currently implement any handling of interrupts for error handling or completion of transfer verification These are the steps DINK32 takes to perform a DMA transfer 1 Call DMA_Initialize if first transfer to identify the optional print function 2 Call DMA_direct_transfer to transmit the buffe
129. r of data The following code samples have been excerpted from the DINK32 application to illustrate the use of the DMA API define PRINT dink printf int dink printf unsigned char fmt body of application print output function In the function par_devtest for testing the DMA device interfac e initialize the DMA handler if needed if DMAInite 0 DMA Status status if status DMA Initialize PRINT DMA SUCCESS PRINT devtest DMA error in initiationin return ERROR else DMAInited 1 return test dma en int en int is the steering control option uh 1 KARA AA AAA function test_dma 101 116 Dink32 R12 User s Manual M MOTOROLA MPC8240 DMA Memory Controller description run dma test note test local dma channel OK OK CK CK OK CK Ck CK CK KK Ck CK CK kk Ck CK Ok Ok Ck Ck Ck OK Ok Ck Sk Ck CK Ck Ck Ck CK Ck Ck Ak Kk Ck Ck Xk Pk Sk Sk kt Sk Ak Sk X ko ko ko ko x Static STATUS test dma int en int int len 0 chn 0 long src 0 dest 0 int mode 0 DMA_SNOOP_MODE snoop DMA_SNOOP_DISABLE DMA CHANNEL channel DMA INTERRUPT STEER steer The default for en int is 0 the default for steering DMA interrupts is to route them to the PCI bus through INTA At least that is the DINK default behavior If the DINK user puts a on the command line that
130. ram has no way of determining where the dink_transfer_table is located Therefore when DINK32 transfers control to the user program it sets the address of the dink transfer table in general purpose register 21 in go tr2 s This register appears to be immune from being used by the compiler prior to the invocation of the user programs start address usually main Therefore the user must call the supplied function set up transfer base or equivalent which is described below in G 4 After this call the address of the dink transfer table is available to the user program G 3 Setting up the static locations The table below shows all the functions that are currently supported Table 1 DINK32 dynamic names DINK32 name Common name Version of table 1 amp KEYBOARD com port for Keyboard support dink printf printf dink loop DINK32 idle function is char in duart has DINK32 detected a character menu entry point for DINK32 menu function par about entry point for DINK32 about function disassemble entry point for DINK32 disassemble function get char get char get next character from com port write char put char send character to com port To change or add any new DINK32 functions one must change the dink transfer table 10G 108 Dink32 R12 User s Manual M MOTOROLA Dynamic functions such as printf To use any of these functions in user code define the user code function name to be the dink functi
131. ransmit the buffer of data These are the steps DINK32 takes to perform a master receive transaction in polling mode 1 Call I2C Initialize if needed to set the Kahlua I2C address polling mode and identify the optional print function 2 Call ID2C do transaction to receive the buffer of data The following code samples have been excerpted from the DINK32 application to illustrate 10K 146 Dink32 R12 User s Manual M MOTOROLA MPC8240 120 Doorbell Driver the use of the 12C API from par_devtest in device c define PRINT dink printf int dink printf unsigned char fmt body of application print output function In the function par devtest for testing the 12 devic interfac initialize the I2C handler to I2C address 48 if needed if I2CInited 0 I2C Status status if status I2C Initialize 48 en int PRINT I2C SUCCI Gl SS PRINT devtest I2C error in initiationin return ERROR else I2CInited 1 return test_i2c action en int static unsigned char rcv buffer BUFFER LENGTH 0 static unsigned char xmit_buffer BUFFER_LENGTH 0 O amp K KOK KK RK RR OK CK CK AA A AAA function test_i2c description run i2c test by polling the device note Test i2c device on PMC card 0x50 serial EPROM The device test data is currently only printable characters This function gets some d
132. rary Internals function descriptions The API function DMA_direct_transfer described above accepts predefined parameter values to initialize a DMA transfer These parameters are used by the DMA driver library functions to set up the Kahlua DMA status and mode registers so that the application does not have to interface to the Kahlua processor on such a low level A description of the processing performed in the DMA_direct_transfer function and descriptions of the lower level DMA driver library functions follow This is a description of the DMA_direct_transfer processing which initiates a simple direct transfer 1 Read the mode register MR by calling DMA_Get_Mode 2 Set the values in the mode register as follows IRSQ is set from the int steer parameter if steering DMA interrupts to PCT set EIE and EOTIE the other mode controls are currently hard coded PDE cleared DAHS 3 however this is ignored because DAHE is cleared SAHS 3 however this is ignored because SAHE is cleared PRC is cleared DL is cleared CTM is set direct mode CC is cleared 3 Validate the length of transfer value report error and return if too large 4 Read the current descriptor address register by calling DMA Poke Desp 5 Set the values in the CDAR as follows SNEN is set from the snoop parameter CTT is set from the type parameter 6 Write the CDAR by calling DMA Bld Desp which checks the channel status to ensure it is free 7 Write the source and
133. re any errors and if the transaction has completed I2CStatus I2C Timer em unsigned int eumbbar I2CStatus handler unsigned int e eumbbar is the address of he Embedded Utilities Memory Block e handler is a pointer to the function to call to handle any existing status event Returns I2CNOEVENT if there is no completed event the I2CSR MIF bit is not set results from call to the handler function if there was a pending event completed Description In polling mode I2C Timer Event can be called to check the I2C status and call the given or the default I2C ISR handler function if the I2CSR MIF bit is set I2CStatus I2C Start unsigned int eumbbar unsigned char slave addr I2C MODE mode unsigned int is cnt e eumbbar is the address of the Embedded Utilities Memory Block slave addr is the I2C address of the receiver e mode XMIT 1 put write e RCV 0 get read e is cnt 1 this is a restart don t check MBB e this is a not restart check MBB e Returns Any defined status indicator Description Generate a START signal in the desired mode Caller is the master The slave addr is written to bits 7 1 of the I2CDR and bit 0 of the I2CDR is set to 0 for mode 2 XMIT or 1 for mode RCV A DLI global variable MasterRcvAddress is set if mode RCV used by I2C ISR function I2CStatus I2C Stop unsigned int eumbbar e eumbbar is the address of the Embedded Utilities Memory Block e Returns Any defin
134. re defined in the source file drivers 12c 12c1 c I2C Status I2C Initialize unsigned char addr I2C INTERRUPT MODE en int int app print function char e addr is the Kahlua chip s I2C slave device adi s en int controls the I2C interrupt enable status I2C INT ENABLE enable I2C INT DISABLE disable app print function is the address of the optional application s print function otherwise NULL if not available e Return I2C Status return value is either I2C SUCCESS or I2C ERROR Description Configure the I2C library prior to use as follows The interrupt enable should be set to I2C INT DISABLE the I2C library currently only supports polling mode The slave address can be set to the I2C listening address of the device running the application program but the DLI does not yet support the application s device responding as an I2C slave to another I2C master device The optional print function if supplied by the application must be similar to the C standard library printf library function accepts a format string and a variable number zero or more of additional arguments This optional function may be used by the I2C library functions to report error and status condition information If no print function is supplied by the application the call to I2C Initialize must provide a NULL value for this parameter in which case the I2C library will not attempt to access a print function I2C Status I2C d
135. re needed if non alphanumeric characters are included For YK SP NVRAM is used and preserved and 4K is available For Excimer and Maximer the uppermost 1K of SRAM is used Currently Excimer and Maximer don t save restore SRAM gt Flash Since Excimer and Maximer don t wipe the SRAM it can be somewhat useful since it will be preserved between resets Using ENV the system can be configured on startup The following variables are checked e IO sets I O type and modes IO COM1 Use standard COM port IO COM1 96001192001 Use standard COM port and optionally set serial port IO PMC 96001192001 Use serial port on PMC8240 etc IO XIO Use VGA card in first slot with a VGA class code IO XIO USE nn Use VGA card on slot nn even if it doesn t appear to be a video card old cards w out CLASS codes e MEMOPT if defined the equivalent of meminfo c c is run which tunes memory using SDRAM LC info and bus speed ALIAS stores last defined alias da ra e MDMODE if set to 1 use the dm dd commands in place of the mm md commands If set to 3 do that and also enable denser output for md e RDMODE if setto q quieten the register display for SPR s If set to e explain the fields of SPRs e TAUCAL saves restores the TAU calibration field 32 bit ULONG e 2CACHE sets L2 cache parameters Options are L2CACHE 256KI512KI1MI2M 11 1 5 21 2 5 3 3 5 late
136. red into future instructions The symtab st instruction is available for manipulating the branch table in DINK32 Branch labels within PowerPC assembly instructions will not be recognized by the assembler if the branch label has not yet been entered into the table The user may display the branch table list with the st instruction The DINK32 assembler ignores any comments preceded by a and any org and dc commands The assembler does not interpret these lines as anything It only ignores them The simplified mnemonics that DINK32 Version 10 5 understands is quite extensive In general immediate values including condition register bit offsets are assumed to be hexadecimal unless preceded by Ob binary or Od decimal Floating point and general purpose registers are recognized just like previous versions of DINK32 where the register number may be preceded by an r general purpose or an f floating point but is not necessary Simplified branch mnemonics involving the condition registers may have the condition register number preceded by cr but isn t necessary The assembler always expects a cr field for compare and branch instructions where according to the architecture crO is implied if a cr field is not given DINK32 does not implement the implied crO functionality of the simplified mnemonics Examples M MOTOROLA Chapter 4 MDINK32 DINK32 Commands 4 19 Commands DINK32_603e gt gt as 60100 0x00
137. ress of the registered interrupt service routine ISR for each interrupt vector Currently the structure is initialized such that each vector ISR address is 0x0 This can be modified such that each defaults to a catch all ISR address instead of 0x0 As each interrupt vector is set up an ISR must be registered with EPIC via the epicISRConnect routine in the epicl c source file This routine takes the ISR function name and stores the address of that function in the ISR Address structure location corresponding to the interrupt vector number Although each interrupt s vector priority register allows the vector number to range from 0 255 this structure limits the vector number range from 0 23 So as each interrupt s vector priority register is set up the 8 bit vector field value must match the vector number location in the structure L 5 EPIC Sample Routines The EPIC sample routines are contained in the epicl c and epic2 s files All C language routines are in epicl c and all assembly language routines are in epic2 s These routines along with the structure described in L 4 EPIC Cross Reference Table Structure can be used as sample code for systems using the MPC8240 EPIC Unit L 6 EPIC Commands in DINK32 describes how these routines are used by DINK32 L 5 1 Low Level Routines The following routines are in the epic2 s source file e External Interrupt Control Routines CoreExtIntEnable enables external interrupts by setting t
138. riggers the DMA library to read the eumbbar so that it is available to the driver so it is a requirement that the application first call DMA Initialize before starting any DMA transfers This could be eliminated if the other functions read the eumbbar if it has not already been done A Status DMA direct transfer DMA INTERRUPT STEER int steer A TRANSFER TYPE type nsigned int source nsigned int dest nsigned int len A CHANNEL channel A SNOOP MODE snoop int steer controls interrupt steering use defined constants as follows DMA INT STEER LOCAL to steer to local processor DMA INT STEER PCI to steer to PCI bus through INTA _ type is the type of transfer use defined constants as follows DMA M2M local memory to local memory note this is currently the only one tested DMA M2P local memory to PCI DMA P2M PCI to local memory DMA_P2P PCI to PCI source 1s the source address of the data to transfer dest is the destination address the target of the transfer len is the length in bytes of the data channel is the DMA channel to use for the transfer use defined constants as follows DMA CHN 90 Kahlua has two channels zero and one DMA CHN 1 snoop controls processor snooping of the DMA channel buffer use defined constants a follows DMA SNOOP DISABLE DMA SNOOP ENABLE Return DMA_ Status return value is either DMA SUCCESS or DMA ERROR Description Initiate the DMA transfe
139. rmation 0 7 Excimer Rev 2 and prior Description value Manufacturer ID is 0x1 Device ID is 0x225b Sector SAO UNPROTECTED Sector SA1 UNPROTECTED Sector SA2 UNPROTECTED Sector SA3 UNPROTECTED Sector SA4 UNPROTECTED Sector SA5 UNPROTECTED Sector SA6 UNPROTECTED Sector SA7 UNPROTECTED Sector SA8 UNPROTECTED Sector SA9 UNPROTECTED 4 32 Dink32 R12 User s Manual M MOTOROLA Sector SAI Sector SA1 Sector SAI Sector SA1 Sector SAI Sector SAI Sector SA1 Sector SA1 Sector SAI AANA 01 OS PFKon e 2 uwutuuwuuwuuu W WY tu Ud vu Ud UD y RO RO RO RO RO RO RO RO RO ECTE ECTE ECTE ECTE ECTE ECTE ECTE ECTE XU Aeg 22 Rs ND 7 ECTE Chapter 4 MDINK32 DINK32 Commands Commands 4 33 Commands 4 1 13 fupdate tu FLASH update fupdate fu e fupdate h o offset e fudpate i The flash update command is used to initialize the contents of the flash devices on a Sandpoint or Yellowknife system There are two separate functions e PPMC ROM Initialization When used with the 1 option the host ROM the 32 pin PLCC socket on Sandpoint or Yellowknife motherboards can be copied to the local flash devices on PPMC cards To use this feature the system must be set to boot from the host ROM on PCI usually true and the PROGMODE switch must be set on the PPMC card refer
140. rs The basic format is mt d dev bl hl w 1 loop t h a q addr1 addr2 e d device Test the indicated device instead of memory Use the dm command to get a list of devices NOTE testing non volatile I2C EEPROM devices can destroy valuable information as well as reduce the life expectancy of those devices e b h w Test memory or device using byte half word or word accesses Memory can be tested in any size while devices may be limited to bytes If not specified the default size is word for memory and bytes for devices e loop cnt Specifies the number of times the memory test should perform all tests If not specified each test is performed once while if 0 is specified the test is run forever e x If specified the testing halts immediately when any error is found This is useful for extended passes to trap on any error q Perform only a quick test Perform all defined memory tests can be slow nlist Perform only specified memory tests Tests are selected by adding one or more of the following letters to list 0 walking 0 s test non destructive slow 1 walking 1 s test non destructive slow A address data test destructive Q quick pattern test non destructive R random pattern test non destructive S write sensitivity test destructive slow e t Show elapsed time only on systems with a real time clock M MOTOROLA Chapter 4 MDINK32 DINK
141. rs spans a wide market range DINK32 has to be extensible and portable as well as being specific enough to be useful for a wide variety of applications It is designed to be both a hardware and software debugging tool DINK32 was written in ANSI C and built with modular routines around a central core Only a few necessary functions were written in PowerPC assembly This document describes the DINK32 software the DINK32 command set utilities user program execution errors and exceptions and restrictions MDINK32 Minimal DINK32 is a limited version of DINK32 It s major purpose is to download versions of DINK32 to the board Currently MDINK32 is only available on Excimer and Maximer boards MDINK32 is supplied with the board It is burned into sector A15 which is protected The user can obtain new executable versions of DINK32 from the web site and download them onto the Excimer and Maximer board via MDINK32 New versions of MDINK32 are only available by returning the board to Motorola for an MDINK32 upgrade or building it from the source code 2 4 Dink32 R12 User s Manual M MOTOROLA Chapter 3 MDINK32 DINK32 Features The MDINK32 DINK32 software package provides Supports the MPC601 MPC603 MPC603e MPC604 MPC604e MPC740 MPC750 and the MPC7400 Modification and display of general purpose floating point altivec and special purpose registers Assembly and disassembly of PowerPC instructions for modification and display of code
142. s rd v and you can do rd e to get the fields explained where possible Not all SPRs are quietened just the most interesting ones The 601 registers are not suppressed To enable quiet mode use these commands env c env rdmode e see Section 4 1 11 env env Verbosity is suppressed for e XER SDRI CR IABR PMCALR SRRO FPSCR MMCRO SIA e CTR SRRI MSR PMCI THRM2DSISR SPRGx SRx PMC2 THRM3 e DAR EAR HIDI MMCRI THRMI DEC PVR PMC3 ICTC e L2CR USIA HASHI HIDI DBATxU e UPMC2 UMMCRI HASH2 SDA DBATxL e UPMC3 UMMCRO IMISS DABR TBU e UPMC4 DMISS ICMP IBATxU TBL e UPMCI DCMP RPA IBATxL MSSCRO e MSSCRI UBAMR PIR UMMCR2 e VRSAVE VSCR MMCR2 BAMR Field descriptions are interpreted for e DBATxU DBATxL SRx PVRIBATXU IBATxL HID1 L2CR e CR FPSCR MSR IABRTHRM1 THRM2 THRM3 L2CR DABR MPC10x PICR1 A8 and PICR2 AC Examples DINK32 750 gt gt regdisp r1 r2 f4 f6 hid0 gpr00 0x00000000 gpr01 0x00060000 gpr02 0x00000000 gpr03 0x000068ac fpr04 0x0000000000000000 fpr05 0x0000000000000000 fpr06 0x0000000000000000 fpr07 0x0000000000000000 DINK32 750 regdisp hidO0 Hardware Implementation Dependent O0 hid0 0x80010080 10000000000000010000000010000000 AN MOTOROLA Chapter 4 MDINK32 DINK32 Commands 4 55 Commands master checkstop enable microcode selftest checkstop checkstop following a machine in the tlb in cache directory multi side hit Pecs IE uh deut eas Re E rbd a SN multi side hit AC RC RCM
143. s reference table L 5 2 2 High Level Exception Handler epicISR this routine is a catch all for all EPIC related interrupts perform IACK interrupt acknowledge to get the vector number check if the vector number is a spurious vector cross reference vector ISR interrupt service routine from table call the vector ISR e perform EOI end of interrupt for the interrupt vector L 5 2 3 Direct Serial Register Control Routines epicIntEnable enable an interrupt source epicIntDisable disable and interrupt source epicIntSourceConfig configure and interrupt source L 5 2 4 Global Timer Register Control Routines epicTmBaseSet set the base count value for a timer epicTmBaseGet get the base count value for a timer epicTmCountGet get the current counter value for a timer AN MOTOROLA Appendix L MPC8240 EPIC Interrupt Driver 10L 161 MPC8240 EPIC Interrupt Driver epicTmInhibit inhibit counting for a timer epicTmEnable enable counting for a timer L 6 EPIC Commands in DINK32 The following commands are typed from the DINK32 command line to control the EPIC unit help dev epic Display usage of EPIC commands e dev epic Display content and addresses of EPIC registers and current task priority e devepicin Initialize the EPIC unit this calls the epicInit routine e dev epic ta Number Change the Processor Task priority register e dev epic en Vector 0 23 Enable a particular interrupt vector dev
144. so a memory test command mt 6 76 Dink32 R12 User s Manual Execution Steps Chapter 7 User Program Execution The DINK32 firmware includes a file transfer utility that allows the user to download S Record files from the host to the target board This download function stores the S Records into memory starting at the address given in the S Record file The user can then use the go or trace command to execute the user program Listed below are the steps to take to execute a user program 7 1 Execution Steps Download the user program to run on DINK32 1 Create an executable S Record file of the user program to be run on DINK32 Most modern compiler vendors supply a facility for converting an executable or generating an S Record file directly E g Gnu supplies an elfhex tool Metaware supplies an elf2hex tool Ensure that the S Record is a Motorola type S Record file 2 Download the s record file into memory on the target board using the DINK32 download command The same command is used for compressed s Record files Using a terminal program receive an S Record file into the target board The recommeded settings are databits 8 parity none stopbits 1 flowcontrol hardware although none will work and baud rate 57600 on excimer 38400 for yellowknife 3 This optional step may be desired The default baud rate is 9600 however DINK32 is capable of downloading at 57600 on Excimer and Maximer and 38400 on Yellowknife and Sa
145. sp hostis LOCAL or REMOTE only LOCAL is currently tested e eumbbar is EUMBBAR for LOCAL or PCSRBAR for REMOTE e channel is DMA_CHN_0 or DMA CHN 1 e desp is a pointer to the structure DMA CDAR to receive the CDAR contents Return value is DMASUCCESS or DMAINVALID Description Read the current descriptor address register CDAR specified by host and channel DMAStatus DMA Bld Desp LOCATION host unsigned eumbbar unsigned int channel DMA CDAR mode hostis LOCAL or REMOTE only LOCAL is currently tested 101 122 Dink32 R12 User s Manual M MOTOROLA MPC8240 DMA Memory Controller e eumbbar is EUMBBAR for LOCAL or PCSRBAR for REMOTE e channel is DMA_CHN_0 or DMA_CHN_ 1 e desp is a pointer to the structure DMA CDAR holding the CDAR control bits Return value is DMASUCCESS DMACHNBUSY or DMAINVALID Description Set the current descriptor address register CDAR specified by host and channel to the given values DMAStatus DMA_Bld_Curr LOCATION host unsigned eumbbar unsigned int channel DMA_CURR desp e host is LOCAL or REMOTE only LOCAL is currently tested eumbbar is EUMBBAR for LOCAL or PCSRBAR for REMOTE e channel is DMA_CHN_0 or DMA CHN 1 e desp is a pointer to the structure DMA_CURR holding the source destination and byte count Return value is DMASUCCESS DMACHNBUSY or DMAINVALID Description Set the source address register SAR destination address register DAR and byte count reg
146. specific but the register offsets and bit definitions of the registers are specified for the Kahlua chip memory map B and will be the same for all applications Details about the register offsets within the EUMB and PCSR as well as bit definitions within registers are found in the Kahlua or Kahlua User s Manual When the Kahlua host and agent come up running the DINK32 application the host application assigns the agent s PCI address for the PCSR and writes it in the agent s PCSRBAR by calling config kahlua agent The agent application initializes its own EUMBBAR this actually happens in the KahluaInit function defined in kahlua s and inbound and outbound address translation windows This is done during initialization in the main function main c Try to enable a Kahlua slave device This is only enabled for Map B E if address map 0 B AN MOTOROLA Appendix K MPC8240 120 Doorbell Driver 10K 137 MPC8240 120 Doorbell Driver if target mode 0 probe PCI to see if we have a kahlua if pciKahluaProbe KAHLUA ID LO VENDOR ID HI amp target add r 1 PRINT Host n config kahlua agent else if target type KAHLUA ID LO lt lt 16 VENDOR ID HI FU RINT Agent n Inbound address translation sysEUMBBARWrite L_ATU_ITWR ATU_BASE ATU_IW_64K pciRegSet PCI_REG_BASE PCI_LMBAR_REG PCI_MEM_ADR Outbound address transla
147. t assignments of the DMA registers typedef enum dma_mr_bit IROS 0x00080000 PDE 0x00040000 DAHTS 0x00030000 SAHTS 0x0000c000 DAHE 0x00002000 SAHE 0x00001000 PRC 0x00000c00 ETE 0x00000080 EOTIE 0x00000040 DL 0x00000008 CTM 0x00000004 CC 0x00000002 CS 0x00000001 DMA_MR_BIT typedef enum dma_sr_bit LME 0x00000080 P CB E 0x00000010 0x00000004 EOSI 0x00000002 EOCAI 0x00000001 DMA_SR_BIT structure for DMA Mode Register typedef struct _dma_mr unsigned int reservedO 1253 unsigned int irgs 1 unsigned int pde 1 unsigned int dahts 2 unsigned int sahts 25 unsigned int dahe 1 unsigned int sahe 1 unsigned int prc 2 unsigned int reservedl 1 unsigned int eie 1 unsigned int eotie 1 unsigned int reserved2 3 unsigned int dl 1 unsigned int ctm 1 M MOTOROLA Appendix I MPC8240 DMA Memory Controller ry 101 119 MPC8240 DMA Memory Controller if chaining mod is nabled any time user can modify the descriptor and does not need to halt the current DMA transaction Set CC bit enable DMA to process the modified descriptors Hardware will clear this bit each time DMA starts NE unsigned int cc 1 cs bit has dua role halt the current DMA transaction and re start DMA transaction In chaining mode if the descriptor needs modification
148. t rsrv0 24 nsigned int mcf 1 nsigned int maas 1 nsigned int mbb 1 nsigned int mal 1 nsigned int rsrvl 1 nsigned int srw 1 nsigned int mif 1 nsigned int rxak 1 I2C STAT Values to indicate receive or transmit mode typedef enum i2c mode RCV 0 XMIT 1 I2C_MODE K 2 4 2 Kahlua 12C Driver Library Internals function descriptions I2CStatus I2C_Init unsigned int eumbbar unsigned char fdr unsigned char addr unsigned int en_int e eumbbar is the address of the Embedded Utilities Memory Block fdris the frequency divider value used to set the I2C clock rate e addr is the Kahlua chip s I2C slave device address en int controls the I2C interrupt enable status 1 enable O disable Return I2CStatus return value is always I2CSUCCESS Description Set the frequency divider I2CFDR FDR listening address I2ZCADR 7 1 and interrupt AN MOTOROLA Appendix K MPC8240 120 Doorbell Driver 10K 149 MPC8240 120 Doorbell Driver enable mode I2CCR MIEN I2C CTRL I2C Get Ctrl unsigned int eumbbar eumbbar is the address of the Embedded Utilities Memory Block e Return I2C_CTRL is the contents of the I2C control register I2CCR Description Read the I2C control register void I2C Set Ctrl unsigned int eumbbar I2C CTRL ctr1 e eumbbar is the address of the Embedded Utilities Memory Block e ctrl is the contents of the I2C control register I2CCR Return none Des
149. tatically determine the function address and change them in demo or dhrystones or any user program Configuration environment variables are saved in NVRAM for yk sp saved in RAM for Excimer and Maximer New command env manipulates these configurations Also implements multiple command aliases however da and ra are still available New command tau display and or calibrate the Thermal Assist Unit Faster download and no need to set character delays on the serial line implemented by turning on the duart FIFO Turn on both banks of memory in the YellowKnife and Sandpoint now 32Megabytes is available on dink32 startup 6 Improved printf format facilities including floating point Most commands can now be placed into quiet mode and verbose mode can be used with the v command Default is verbose on both same as always with or without ENV The e mode expands fields and can be made default with env RDMODE e Only Excimer and Maximer require the setup and RDMODE can be Q quiet E expand fields or anything else On Excimer and Maximer it can be set up with these commands env c env rdmode 0 The dl command can be placed in silent mode with the q Id or rm can use these aliases for the memory register northbridge nb mpc106 mpc107 or mpc8240 10 Fixed command termination character x so it will not restart if unexpected 11 Fixed problems with double prompts printed on startup with DC
150. tation This document provides information about the software written to access the Kahlua I2C interface This software is intended to assist in the development of higher level applications software that uses the I2C interface Note The I2C driver software is currently under development The only modes that are functional are the master transmit and master receive in polling mode K 2 2 Overview This document consists of these parts An Application Program Interface API which provides a very simple generic application level programmatic interface to the I2C driver library that hides all details of the Kahlua specific implementation of the I2C interface 1 e control register status register embedded utilities memory block etc 2C API functions showing the following how the function is called 1 e function prototype parameter definition possible return values brief description of what the function does an explanation of how the functions are used by an application program DINK32 usage employed as examples e An IPC Driver Library Internals DLI which provides information about the lower level software that is accessing the Kahlua specific implementation of the I2C interface e 2CDLI functions showing the following how the function is called i e function prototype parameter definition possible return values brief description of what the function does K 2 3 I2C Applica
151. te the address where the data is to be loaded into memory The address may be interpreted as a 2 3 or 4 bytes address depending on the type of record 2 byte addresses require 4 characters 3 byte addresses require 6 characters and 4 byte addresses require 8 characters AN MOTOROLA Appendix D S Record Format Description 10D 97 S Record Format Description Data This field can have anywhere from 0 to 64 characters representing 0 32 hexadecimal bytes These values will be loaded into memory at the address specified in the address field Checksum These 2 characters are interpreted as a hexadecimal byte This number is determined as follows Sum the byte values of each pair of hex digits in the count address and data fields of the record Take the one s complement The least significant byte of the result is used as the checksum D 2 Specific Formats Each of the record types has a slightly different format These are all derived from the general format specified above and are summarized in the following table TypeDescription S0 Contains header information for the S record This data isn t actually loaded into memory The address field of an SO record 1s unused and will contain 0x0000 The data field contains the header information which is divided into several sub fields char 20 module name char 2 version number char 2 revision number char 0 36 text comment Each subfield is composed of ASCII characters These are paired
152. ter 4 MDINK32 DINK32 Commands 4 35 Commands 4 1 14 W tw e Specific FLASH download MDINK22 Only fw e o lt flash address gt This command copies the contents of the entire 512K of RAM to FLASH starting at flash address OXFFF00000 The parameter e is required The optional parameter o flash address can be used to specify a specific address to copy from ram to rom address I e replacing flash address Oxfff00000 with the flash address of the user s choosing Examples MDINK32 603e gt gt fw e Chip erase set Erasing entire flash memory Entering verify erase loop Flash erased Done erasing flash memory Copying 512K ram to flash address fff00000 4 36 Dink32 R12 User s Manual M MOTOROLA Commands 4 1 15 YO go execute user code MDINK32 Compatible go address go This command allows the user to execute user code starting at the given address The plus form will allow execution at the address in the SRRO Machine Status Save Restore register bits 0 29 This is useful for continuing where a breakpoint or a user break lt ctrl gt c had previously stopped execution A program exception occurs when a breakpoint or illegal opcode is encountered The breakpoint address will be displayed and the instruction at that address will be disassembled Note If a breakpoint is encountered the user must clear the breakpoint in order for execution to continue When the user program begins exe
153. ternal Interrupt Exception Path in DINK32 The path of an external interrupt exception in DINK32 begins at the 0x500 interrupt exception vector All DINK32 exception vector locations are set up in the same manner which is to save the exception type and pass the exception handling to a catch all exception handler This handler is called handle ex and is located in the except2 s DINK32 source file In the handle ex handler a check is performed to see if the exception was a 0x500 and if DINK32 is running on an MPC8240 If the two conditions are true the exception handling is passed to the EPIC low level interrupt handler epic exception located in the epic2 s sourcefile Epic exception handles any necessary context switching and saving of state before calling the EPIC high level interrupt handler epicISR located in the epicl c source file Note Currently epic exception first checks the mode of the EPIC unit If in pass through mode an error message is printed stating that the EPIC unit is in pass through mode and must be initialized EpicISR acknowledges the interrupt by calling the epicIACK which returns the vector number of the interrupting vector source This vector number is then compared to the spurious vector value located in the EPIC Spurious Vector Register If the interrupting vector is a spurious vector the interrupt is ignored and state is restored to the interrupted process If the interrupting vector is a valid
154. the last version that DID NOT support this feature Ensure that you are using DINK32 V12 0 or greater G 6 Alternative method for Metaware only While printf is fairly straightforward scanf is more complex In the drystone directory a local copy of scanf is supplied in the file support c Scanf and printf can also be emulated in a simpler program when using the metaware compiler Two metaware functions are supplied to the user to give control to characters that are scanned into and out of the program buffers Refer to the metaware documentation for more information than is given here When the user compiles and links with the Hsds flag two functions int _putcanon int a and int _getcanon are called whenever the user gets or receives a character Thus the user can write the simple functions shown below and scanf and printf will use the DINK32 functions for printf and scanf In this case it is not necessary to use define to change the name of the printf or scanf functions or write your own printf or scanf function It is still necessary to call set up transfer base as the first statement in your program 10G 110 Dink32 R12 User s Manual M MOTOROLA Dynamic functions such as printf PARRA KK KK KK Re CK kk Ck Ck Ck CK Ok Ck Ck Ck OK A A Ck Ck CK CK Ck AA A A A c Functions to capture characters from printf and scanf using the Hsds hooks in the metaware compiler mlo 7 22 99 ACC Ck Ck Ck Ck Ck Ck kk kk Ck Ck Ck Ck Ck
155. the EPIC unit by typing the EPIC initialization command DINK32 will respond with initialization messages and then immediately start taking the timer interrupts The user may now also manipulate the S5 and S6 switches to trigger interrupts on the IRQ1 and IRQ2 lines Of course while all these external interrupts are being handled DINK32 continues to run and will accept user input at the command line while simultaneously writing status to the terminal DINK32_KAHLUA gt gt dev epic in Initialize epic Configure Int 1 In epicISRConnect Vector 1 gt ISRAddr 32d54 Configure Int 2 AN MOTOROLA Appendix L MPC8240 EPIC Interrupt Driver 10L 165 MPC8240 EPIC Interrupt Driver n epicISRConnect etting timer 0 base n epicISRConnect etting timer 1 base n epicISRConnect onfiguring timer 0 onfiguring timer nable Int 1 nable Int 2 ower Current Task Pr nable External Inter INK32 KAHLUA gt gt In ep nterrupt Service Rou n epicIS for vect nterrupt Service Rou n epicIS for vect nterrupt rvice Rou n epicIS for vect nterrupt Service Rou n epicIS for vect nterrupt Service Rou n epicIS for vect nterrupt rvice Rou n epicIS for vect n epicIS for vect nterrupt Service Rou n epicIS for vect nterrupt Service Rou n epicIS for vect nterrupt Service Rou n epicIS for vect nterrupt rvice Rou n epicIS for vect n epicIS for vect nterrupt Service Rou n epicIS for vect nterrupt Service Rou n epicIS for vect nterrupt rvice Rou
156. the mainte nance and support of the SOFTWARE 2 Dink32 R12 User s Manual M MOTOROLA Chapter 1 DINK32 User s Guide Index Chapter 1 DINK32 User s Guide Index Chapter 2 Introduction Chapter 3 MDINK32 DINK32 Features Chapter 4 MDINK32 DINK32 Commands Chapter 5 DINK32 Command Form Summary Chapter 6 Utilities Chapter 7 User Program Execution Chapter 8 Errors and Exceptions Chapter 9 Restrictions Chapter 10 Known Bugs Appendix A Adding Commands and Arguments Appendix B Adding ERROR Groups to MDINK DINK32 Appendix C History of MDINK32 DINK32 changes Appendix D S Record Format Description Appendix E Example Code Appendix F Updating DINK32 from the Web Appendix G Dynamic functions such as printf Appendix H MPC8240 Kahlua Drivers Appendix I MPC8240 DMA Memory Controller Appendix J MPC8240 I2C Driver Library Appendix K MPC8240 I20 Doorbell Driver Appendix L MPC8240 EPIC Interrupt Driver M MOTOROLA Chapter 1 DINK32 User s Guide Index 1 3 Chapter 2 Introduction DINK is an acronym for Demonstrative Interactive Nano Kernel DINK32 is a flexible software tool enabling evaluation and debugging of the PowerPC 32 bit microprocessors The introduction of the PowerPC microprocessor architecture provided an opportunity to create an interactive debugger independent from previous debug monitors Since the family of PowerPC microprocesso
157. tion SysEUMBBARWrite L ATU OTWR 0x100000 ATU IW 64K sysEUMBBARWrite L_ATU_OMBAR 0x81000000 K 1 2 Interrupt Service Routines 120_ISR_host and 120 ISR agent There is a fundamental difference in the interrupt service routine ISR for the host and agent the I2O ISR agent function only has to handle inbound message unit interrupts but the I2O ISR host must handle any possible interrupt from a Kahlua agent not limited to the agent s outbound message unit The ISRs implemented at present just check for doorbell activity If a doorbell event occurred the ISR prints out a simple message including the doorbell register content and the doorbell register is cleared Otherwise the ISR prints a message that it was unable to determine the cause of the interrupt The I20 ISR agent function checks the Inbound Message Interrupt Status Register IMISR to determine the cause of the message unit interrupt The Message Unit interrupt can occur because of doorbell message register or message queue activity The ISR will distinguish and handle the interrupt accordingly but at first stage implementation only doorbell interrupts will be handled The RO library function I2OInMsgsStatGet is used to read the IMISR It returns the content of the IMISR after applying the mask value in the Inbound Message Interrupt Mask Register IMIMR and clears the status register The RO library function I2ODBGet is used to read the IDBR It returns the co
158. tion Program Interface API K 2 3 1 API functions description The I2C API function prototypes defined return values and enumerated input parameter 10K 144 Dink32 R12 User s Manual M MOTOROLA MPC8240 120 Doorbell Driver values are declared in drivers i2c i2c_export h The functions are defined in the source file drivers 12c 12c1 c I2C Status I2C Initialize unsigned char addr I2C INTERRUPT MODE en int int app print function char e addr is the Kahlua chip s I2C slave device address en int controls the I2C interrupt enable status I2C INT ENABLE enable DC INT DISABLE disable app print function is the address of the optional application s print function otherwise NULL if not available e Return I2C Status return value is either I2C SUCCESS or I2C ERROR Description Configure the I2C library prior to use as follows The interrupt enable should be set to I2C INT DISABLE the I2C library currently only supports polling mode The slave address can be set to the I2C listening address of the device running the application program but the DLI does not yet support the application s device responding as an I2C slave to another I2C master device The optional print function if supplied by the application must be similar to the C standard library printf library function accepts a format string and a variable number zero or more of additional arguments This optional function may be used by the
159. tion currently only implements a simple master transmit or a master receive transaction It does not yet support the application retaining I2C bus ownership between transactions operating in interrupt mode or acting as an I2C slave device K 2 3 2 API Example Usage The ROM monitor program DINK32 uses the I2C API in both currently implemented modes master transmit and master receive The DINK32 program runs interactively to allow the user to transmit or receive a buffer of data from an I2C device at address 0x50 on the Kahlua PMC card DINK32 obtains information from the user as follows read write mode I2C device address for the data this 1s the address of the data on the I2C device not the I2C bus address of the device itself which is hard coded in DINK32 the raw data if in write mode and the length of the data to transfer to or from the device Note that the initialization call to configure the I2C interface is actually made only once the first time the user requests an I2C transmit or receive operation Each transmit or receive operation is performed by a single call to an I2C API function The DINK32 program is an interactive application so it gives the I2C library access to its own print output function These are the steps DINK32 takes to perform a master transmit transaction 1 Call I2C Initialize if needed to set the Kahlua I2C address polling mode and identify the optional print function 2 Call ID2C do transaction to t
160. tion to continue DINK32 MPC603ev gt gt AN MOTOROLA Chapter 4 MDINK32 DINK32 Commands 4 39 Commands 4 1 17 lOg tog Toggles logging Only available on yellowknife and sandpoint log This command provides the capability to log a debug session The command toggles the logging function When logging is enabled all characters sent to the terminal will be echoed to the host port the second com port com2 duart channel B in the system On Yellowknife this will be the alternate com port to the terminal port See Section 4 1 34 setbaud sb Example DINK32_750 gt gt log You are enabling logging After this message all input and output to your terminal will be mirrored out to the host port Now would be a time to open an editor on the host and get into insert mode DINK32_750 gt gt log Logging disabled 4 40 Dink32 R12 User s Manual M MOTOROLA Commands 4 1 18 memdisp ma display memory e memdisp address e memdisp start e memdisp start end This command displays data stored in the specified memory locations The display will always be aligned on a 16 byte boundary in which the address given will be included In order to keep from saturating the screen a maximum of four lines of data are displayed on the screen followed by a prompt To continue viewing data the user enters return at the prompt Multiple parameters may be entered If the form is used the command will continue to display
161. to PPMC documentation for details Motherboard Flash updates When used with the h option the host ROM can be updated with new versions of DINK or with the boot code of an RTOS Usually the memory contents will be downloaded DINK upgrade or an RTOS boot image See Section 4 1 10 download dl for details on loading the memory image NOTE The entire flash is erased and replaced with the supplied contents If the programming mode fails or is interrupted the flash may be unusable If the DINK32 code is replaced with another program DINK will be lost unless the new program has similar facilities to download and program DINK into the flash ROM Examples Use the following example store a program in the PCI based ROM of a Sandpoint or Yellowknife for example a DINK upgrade DINK32 750 gt gt dl k o 100000 Download from Keyboard Port Offset Srecords by 0x00100000 Download Complete DINK32 750 gt gt fu h 100000 YK SP PCI Flash Programmer Are you sure Y Check flash type AMD Am29F040 Erasing flash OK 4 34 Dink32 R12 User s Manual M MOTOROLA Commands Program flash E OK Verifying flash OK DINK32 750 gt gt Use the following example to copy DINK32 into a local bus Flash on a PPMCcard DINK32 750 gt gt fu i PPMC Local Flash Programmer Are you sure Y Check flash type AMD Am29LV800BB Erasing flash OK Program flash OK Verifying flash OK DINK32_750 gt gt AN MOTOROLA Chap
162. to the agent processor and the agent s EPIC unit will execute the I2O ISR agent function to determine the cause of the message unit interrupt and handle it appropriately If the inbound doorbell is not enabled no interrupt is generated but the doorbell and the status register bit are still set The agent application reads the IDBR by calling the I2O library function I2ODBGet This clears the IDBR K 1 4 2 Agent Rings a Host via Agent s Outbound Doorbell The agent application calls the I2O library function IZODBPost to write the bit pattern to the agent s Outbound Door Bell Register ODBR If the outbound doorbell is enabled this causes the outbound interrupt signal INTA_ to go active which interrupts the host processor After the ISR is integrated into the EPIC unit this mechanism will be documented here If the outbound doorbell is not enabled no interrupt is generated but the doorbell and the status register bit are still set The host application reads the ODBR by calling the I2O library function IZODBGet This clears the ODBR Sample application code Here is some sample code from the DINK32 function test i20 in device c that provides examples of how the I2O library functions can be used by an application When this section of code is entered the DINK32 user interface has already set the local variables mode and bit Mode reflects the user request Bit is the doorbell bit number to set Mode 4 to manually run the ISR s
163. transpire during communication via the I2O doorbell registers between host and agent applications running on Kahlua are described This implementation enables basic doorbell communication It can be expanded to include other Kahlua message unit activity via the message registers and the I2O message queue K 1 1 System startup and memory map initialization An understanding of the agent s Embedded Utilities Memory Block Base Address Register EUMBBAR and Peripheral Control and Status Registers Base Address Register PCSRBAR is important for I2O doorbell communication because both host and agent use the agent s inbound and outbound doorbell registers and message unit status and control registers The host accesses the agent s registers via the agent s PCSR and the agent accesses its own registers via its own EUMB It is worth noting that some registers such as the doorbell registers can be accessed via either the PCSR or the EUMB Other registers such as the message unit s status and interrupt mask registers can only be accessed via one or the other of the PCSR or EUMB but not both The I2O library functions require the caller to provide the base address which will be either the PCSR or the EUMB and a parameter indicating which is used In the DINK32 environment functions are provided to obtain both of these base addresses get kahlua pcsrbar and get eumbbar The methods of setting and obtaining the PCSR and EUMB base addresses are application
164. ua X4 configuartion Added basic Kahlua support uo ROO Qo C 9 Version 10 3 no date 1 This was never released C 10 Version 10 2 September 11 1998 1 This release is the same as Version 10 Revision 1 C 11 Version 10 1 September 10 1999 1 Enable ICACHE and DCACHE C 12 Version 9 5 August 5 1998 1 Implement flash commands fw e and basic flash erase and write support 2 Split dink into two types mdink minimal dink and dink 3 Implement support for excimer M MOTOROLA Appendix C History of MDINK32 DINK32 changes 10C 95 History of MDINK32 DINK32 changes C 13 Version 9 4 May 22 1998 1 Implement L2 Backside Code 2 Turned on DCACHE and ICACHE as default at boot time 3 Added Yellowknife X4 boot code Map A amp B C 14 Prior to Version 9 4 Approximately October 10 1997 1 Merged CHRP and PREP 2 Added W_ACCESS Word access H_ACCESS and B_ACCESS 3 One version of dink works with all processors 601 603 604 and ARTHUR 10C 96 Dink32 R12 User s Manual S Record Format Description Appendix D S Record Format Description D 1 General Format An S record is a file that consists of a sequence of specially formatted ASCII character strings Each line of the S record file adheres to the same general format with some variation of the specific fields and must be 78 bytes or fewer in length A typical S record file might look like this s010000077726974656D656D2E73726563AA 219070000740000007
165. uestion 8 82 Dink32 R12 User s Manual M MOTOROLA Special Purpose Registers Chapter 9 Restrictions 9 1 Special Purpose Registers There are four Special Purpose General Registers SPRGs numbered 0 through 3 DINK32 makes use of SPRG2 and SPRG3 so any user values placed into these two registers will be destroyed when ever control is returned to DINK32 The user is encouraged to place any values that are of interest or necessity into only SPRGO and SPRGI although the user can use the other two SPRGs for calculations or temporary storage AN MOTOROLA Chapter 9 Restrictions 9 83 Chapter 10 Known Bugs 10 1 Known Bugs 10 84 setbaud On Excimer and Maximer platform the sb h or k without a baud rate will always return 0 All of the user caches may not be flushed on exceptions and breakpoints The assembler will silently ignore any register it doesn t recognize inserting 0 in it s place For example mfspr r3 1010 will substitute mfsrp r3 0 env is not in the help menu however help env is available The gcc built version of DINK32 srecord and elf file is 50 larger than the Metaware build Dink32 R12 User s Manual M MOTOROLA Adding Commands and Arguments Appendix A Adding Commands and Arguments A 1 Help All help information is displayed by the help c file The help file has two types of help the main summary menu and the specific help information for a specific command A 1 1 Help Menus There are
166. upport functions unsigned int get eumbbar e Returns base address of the Embedded Utilities Memory Block Description See Embedded Utilities Memory Block and Configuration Register Summary for information about the Embedded Utilities Memory Block Base Address Register This function is defined in kahlua s M MOTOROLA Appendix J MPC8240 I2C Driver Library 10J 135 MPC8240 I2C Driver Library unsigned int load runtime reg unsigned int eumbbar amp nbsp unsigned int reg e eumbbar is the address of the Embedded Utilities Memory Block e reg specifies the register I2CDR IZCFDR I2CADR I2CSR I2CCR e Returns register content Description The content of the specified register is returned This function is defined in drivers i2c i2c2 s unsigned int store runtime reg unsigned int eumbbar amp nbsp unsigned int reg amp nbsp unsigned int val e eumbbar is the address of the Embedded Utilities Memory Block e offset specifies the register RCDR I2CFDR I2CADR I2CSR I2CCR e val is the value to be written to the register Return No return value used it should be declared void Description The value is written to the specified register This function is defined in drivers 12c 12c2 s 10 136 Dink32 R12 User s Manual M MOTOROLA MPC8240 120 Doorbell Driver Appendix K MPC8240 120 Doorbell Driver K 1 120 Description of Doorbell Communication between Agent and Host The sequence of events that
167. viewed by typing regdisp r or regdisp f respectively A single register can be viewed by specifying rx fx or sx where the first character denotes the register family and the second character denotes the register number Special purpose registers may be selected by their standard abbreviations as well as their register number The plus form displays the contents of the register family starting with the given register up to and including the last register in that family The range form displays the contents of the registers from rx to ry or from fx to fy 99 ee Note that the entire family plus and range forms are not available in the special purpose register family This is due to the architectural design feature in which the special purpose registers all have unique register numbers and are not numbered sequentially The above parameter forms can be combined by separating them with a comma or white space This will display multiple registers in different register families with one command Note that the register display is aligned on an even numbered register boundary so if an even numbered register needs to be displayed the odd numbered register following it is 4 54 Dink32 R12 User s Manual M MOTOROLA Commands also displayed Most of the SPRs can suppress the verbose mode This is still the default for compatibility purposes If suppressed you can get verbose mode by with the following command
168. vision 2 versus 3 of the board fl dsi has been expanded to display the memory range for each sector M MOTOROLA Chapter 3 MDINK32 DINK32 Features 8 5 MDINK32 Overview Support for Excimer and Maximer flash fl sp and su e Support for Max chip and altivec registers and instructions e Support for Kalua chip e Support for MPC107 Memory bridge e Support for dynamically assigned dink function addresses for downloaded programs see Appendix G Dynamic functions such as printf 3 1 MDINK32 Overview The following sections describe the MDINK32 methodology and limited command set the minimum required hardware configuration and the memory model MDINK32 is only available with the Excimer and Maximer platform The current release of MDINK32 is Version 12 0 3 2 New features for MDINK32 V12 0 No new functionality 3 3 MDINK32 Design Methodology The MDINK32 program s only purpose is to download DINK32 programs MDINK32 is loaded at Oxfff00000 and begins execution at Oxfff00100 It s limited command set is designed to allow easy loading of DINK32 or other programs into FLASH or ROM memory and starting those programs 3 4 Hardware Configuration Requirements This MDINK32 software package can be executed on the same microprocessor boards that support DINK32 which include the following devices and minimum memory configuration e PowerPC 601 603 e 604 e 740 750 MPC7400 microprocessors e National Semiconductor PC
169. w etc 10 134 Dink32 R12 User s Manual M MOTOROLA MPC8240 I2C Driver Library J 5 1 DLI Functions Written but not Used and not Tested I2CStatus I2C write unsigned int eumbbar unsigned char buffer ptr unsigned int length unsigned int stop flag e eumbbar is the address of the Embedded Utilities Memory Block e buffer ptr is pointer to the data buffer to transmit e length is the number of bytes in the buffer stop flag 1 signal STOP when buffer is empty e 0 don t signal STOP when buffer is empty Returns Any defined status indicator Description Send a buffer of data to the requiring master If stop flag is set after the whole buffer is sent generate a STOP signal provided that the requiring receiver doesn t signal the STOP in the middle Caller is the slave performing transmitting I2CStatus I2C read unsigned int eumbbar unsigned char buffer ptr unsigned int length unsigned int stop flag e eumbbar is the address of the Embedded Utilities Memory Block e buffer ptr is pointer to the data buffer to transmit length is the number of bytes in the buffer stop flag 1 signal STOP when buffer is empty e 0 don t signal STOP when buffer is empty Returns Any defined status indicator Description Receive a buffer of data from the sending master If stop flag is set when the buffer is full and the sender does not signal STOP generate a STOP signal Caller is the slave performing receiving J 6 12C s
170. wz OxOOffff00 Oxef0080ff OxOAffff00 OxOAffff00 r31 fadd 1 2 3 stw 1 2 ELG 00 r23 Oxff00 OxOOffff00 24 00 24 00 WORD fnmadds fnmadd sc bdnz 10 3 Off 035 WORD WORD OxOAffff00 OxOAffff00 Comment nop DINK32_MAX gt gt as 70010 4 20 Dink32 R12 User s Manual 0x00070010 Oxff8000ff fnmadd 28 00 03 00 DINK32 MAX gt gt as 70014 0x00070014 Oxff0000ff fnmadd f24 00 03 00 0x00070018 Ox00fbff00 WORD 0xO0O0fbff00 v3 v19 v3 v31 0x0007001c OxOOffff00 WORD OxOOffff00 v30 v16 v17 7 0x00070020 Oxff0000ff fnmadd 24 00 03 00 DINK32 MAX gt gt ds 70010 0x00070010 0x10600604 mfvscr V3 0x00070014 0x10006644 mtvscr V12 0x00070018 0x10731fe0 vmhaddshs V3 V19 V3 V31 0x0007001c 0x13d089ec vsldoi V30 V16 V17 0x7 0x00070020 Oxff0000ff fnmadd 24 00 03 00 AN MOTOROLA Chapter 4 MDINK32 DINK32 Commands Commands mfvscr v3 mtvscr v12 vmhaddshs vsldoi 4 21 Commands 4 1 4 bkpt bp set delete list breakpoints bkpt bkptaddress e bkpt d index The bkpt command allows the user to set a breakpoint at a given address delete a breakpoint at a given index in the breakpoint list and list the current breakpoints by index and address Breakpoints allow the user to run an application program and stop execution when code at the specified address is encountered This command will set or delete only one breakpoint at a time and
171. x obe E unsigned char eprom addr 0x50 read transaction address addr read 4 of bytes to transfer AN MOTOROLA Appendix J MPC8240 12C Driver Library 10J 127 MPC8240 I2C Driver Library len validate the data address length etc If transmitting get the raw data into the transmit buffer 2s xmit buffer read built in I2C device on Kahlua PMC card if act DISPLAY TAG if I2C do transaction en int I2C MASTER RCV eprom addr addr len rcv buffer I2C STOP retry I2C NO RESTART I2C SUCCESS PRINT dev I2C error in master receive test n return ERROR else rcv buffer len 0 ensure NULL terminated string PRINT s rcv buffer expecting only printable data PRINT An write to built in I2C device on Kahlua PMC card if act MODIFY TAG if I2C do transaction en int I2C MASTER XMIT eprom addr addr len xmit buffer I2C STOP retry I2C NO RESTART I2C SUCCESS PRINT dev I2C error in master transmit test n return ERROR return SUCCESS J 4 12C Driver Library Internals DLI This information is provided to assist in further development of the I2C library to enable the application to operate as an I2C slave device interrupt enabled mode bus retention between consecutive transactions correct handling of device time out no slave device response no acknowledgm
172. xFFF00100 Reset Vector MDINK32 OxFFEFFFFF Top of User Flash Space OxFFC90000 Bottom of User Flash Space OxFFC8FFFF End of DINK32 Code OxFFC00100 Start of DINK32 Code OxFFCO00000 Beginning of Flash space Top of User Memory 0x000FFFFF 1 Meg 0x00090000 Start of User Memory Ox0008FFEF Top of Stack for user 0x00080000 Top of Stack for DINK32 0x00070000 Bottom of stack Ox0006FFFF Top of data section 0x00040000 Bottom of data section 0x00030000 Top of RODATA 0x0002FD00 Bottom of RODATA 0x0002FFFF Top of text section 0x00003000 Bottom of text section 0x00002FFF Top of Exception table 0x00000000 Bottom of Exception Table Note The text and data sections are approximates depending on each build version Figure 3 3 MDINK32 DINK32 Memory Model Excimer and Maximer 3 14 Dink32 R12 User s Manual M MOTOROLA Commands Chapter 4 MDINK32 DINK32 Commands This chapter describes the DINK32 user commands The full command mnemonic is listed in the upper left hand corner and the short command abbreviation is listed next in smaller type All commands listed except fw e are available to DINK32 those commands available to MDINK32 are marked as MDINK32 Compatible Commands appear in boldface throughout this chapter Note All addresses entered must be in hexadecimal but not preceded by Ox Leading zeros will be added as needed Definitions MDINK32 Compatible
Download Pdf Manuals
Related Search
Related Contents
User manual Käyttöohje TP-LINK TL-SG108E network switch SERVICE MANUAL - Pdfstream.manualsonline.com CEL Series Operation Manual (pdf 2 MB) User's manual for TIMRET: a micro-computer program for silviculture 1550-C Operations Manual KIPS BAY MEDICAL, INC. Manuel d`installation d`un Concentrateur intégrateur de câble d Copyright © All rights reserved.
Failed to retrieve file