This is an involuntary fork, created because the repository would not update mmSPI. SPI library used to communicate with an altera development board attached to four zigbee-header pins.
Dependents: Embedded_RTOS_Project
Fork of mmSPI by
Revision 36:32cdc295f859, committed 2013-09-17
- Comitter:
- gatedClock
- Date:
- Tue Sep 17 19:06:50 2013 +0000
- Parent:
- 35:6152c9709697
- Commit message:
- updates for RTOS class project.
Changed in this revision
mmSPI.cpp | Show annotated file Show diff for this revision Revisions of this file |
mmSPI.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 6152c9709697 -r 32cdc295f859 mmSPI.cpp --- a/mmSPI.cpp Sun Sep 01 02:29:08 2013 +0000 +++ b/mmSPI.cpp Tue Sep 17 19:06:50 2013 +0000 @@ -1,13 +1,13 @@ /*----------------------------------------------//------------------------------ student : m-moore email : gated.clock@gmail.com - class : usb device drivers + class : embedded RTOS directory : USB_device_project/mmSPI file : mmSPI.cpp - date : september 3, 2013. + date : september 19, 2013. ----copyright-----------------------------------//------------------------------ licensed for personal and academic use. - commercial use must be approved by the account-holder of + commercial use of original code must be approved by the account-holder of gated.clock@gmail.com ----description---------------------------------//------------------------------ this library provides the low-level SPI data and clock signaling @@ -318,6 +318,36 @@ return (pcReceive[6 - cRegister]); // return the particular reg value. } // read_register. //----------------------------------------------//------------------------------ +//----------------------------------------------//------------------------------ +/* + since the Tk UI often wants to obtain the content of all of the CPU registers, + this method may be used to obtain all of them at once, speading up the UI + read cycle. + + pRegisters[6] <- pcReceive[6] = R0 + pRegisters[5] <- pcReceive[5] = R1 + pRegisters[4] <- pcReceive[4] = R2 + pRegisters[3] <- pcReceive[3] = R3 + pRegisters[2] <- pcReceive[2] = PC + pRegisters[1] <- pcReceive[1] = IR-H + pRegisters[0] <- pcReceive[0] = IR-L +*/ + + void mmSPI::read_all_registers(char * pcRegisters) + { + int dLoop; // loop index. + + clear_transmit_vector(); // clear transmit vector. + + pcSend[7] = 0x02; // suppress cpu operation. + + transceive_vector(1,1,1,0); // snap & scan-out reg contents. + + // propagate register data. + for (dLoop = 0; dLoop < 7; dLoop++) pcRegisters[dLoop] = pcReceive[dLoop]; + + } // read_all_registers. +//----------------------------------------------//------------------------------ /* this method works by taking over the instruction decoder, and issuing the CPU commands which load the MM address/data into {R3,R2,R1}
diff -r 6152c9709697 -r 32cdc295f859 mmSPI.h --- a/mmSPI.h Sun Sep 01 02:29:08 2013 +0000 +++ b/mmSPI.h Tue Sep 17 19:06:50 2013 +0000 @@ -3,13 +3,13 @@ /*----------------------------------------------//------------------------------ student : m-moore email : gated.clock@gmail.com - class : usb device drivers + class : embedded RTOS directory : USB_device_project/mmSPI file : mmSPI.h - date : september 3, 2013. + date : september 19, 2013. ----copyright-----------------------------------//------------------------------ licensed for personal and academic use. - commercial use must be approved by the account-holder of + commercial use of original code must be approved by the account-holder of gated.clock@gmail.com ----description---------------------------------//------------------------------ this library provides the low-level SPI data and clock signaling @@ -40,9 +40,10 @@ void transceive_vector(char cPreCPU, char cPreSPI, char cScan, char cPostCPU); // write/read CPU registers. - void write_register(char cRegister, char cValue); - void write_IR (char cValueH, char cValueL); - char read_register (char cRegister); + void write_register (char cRegister, char cValue); + void write_IR (char cValueH, char cValueL); + char read_register (char cRegister); + void read_all_registers(char * pcRegisters); // write/read CPU main-memory. void write_memory(char cHData, char cLdata, char cAddress);