Main Page   Hardware Class Hierarchy   Hardware API     Mapping Class Hierarchy  Mapping API 

oeeprom_spi.h

00001 /* 
00002 Object Oriented Mobile Robot Model (OOMRM) C++  Library Copyright (C) 2002-2005  Derek Jones
00003 
00004 This library is free software; you can redistribute it  and/or
00005 modify it under the terms of the GNU Lesser General Public
00006 License  as published by the Free Software Foundation; either
00007 version 2.1 of the  License, or (at your option) any later version.
00008 
00009 This library is  distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY;  without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A  PARTICULAR PURPOSE.  See the GNU
00012 Lesser General Public License for more  details.
00013 
00014 You should have received a copy of the GNU Lesser General  Public
00015 License along with this library; if not, write to the Free  Software
00016 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA   02111-1307  USA
00017 
00018 $Id: oeeprom_spi.h,v 1.1.1.1 2006/05/11 05:22:41 derek Exp $ 
00019 */
00020 
00021 #ifndef _SPI_EEPROM_256
00022 #define _SPI_EEPROM_256
00023 #include <hardware/ospi.h>
00024 
00025 /* 
00026 1 = CS
00027 2 = SO
00028 3 = WP   (high)
00029 4 = GND
00030 5 = SI
00031 6 = SCK 
00032 7 = HOLD (high; low to suspend)
00033 8 = VCC
00034 
00035 MRM board
00036 to 
00037 1 = GND
00038 2 = VCC
00039 3 = MISO
00040 4 = MOSI
00041 5 = SCK
00042 6 = PCS
00043 7 = I/O PORT_F 3 for CS0-1; PORT_F 1 for CS2-3
00044 8 = IRQ PORT F 4 for CS0-1; PORT F 2 for CS2-3 
00045 
00046 CONVERTER EEPROM->MRM HEADER = { 4, 8, 2, 5, 6, 1, WP(3), HOLD(7) }
00047 
00048 
00049 NOTES: will bypass (leave open) pin 7/8 of MRM as I'm using these for other things.
00050        will connect to EEPROM header and simply tie pins 7/8 high (no write protect/no suspend operations).
00051 */
00052 // Valid OP-CODES for AT25HP256/512 EEPROM
00053 //enum EEPROM_COMMAND { NOOP=0, WRSR, WRITE, READ, WRDI, RDSR, WREN }; 
00054 
00055 typedef union {
00056     struct {
00057         uint8 WPEN:1;
00058         uint8 UNUSED:3;
00059         uint8 BP1:1;
00060         uint8 BP0:1;
00061         uint8 WEN:1;
00062         uint8 RDY:1;
00063     } BITS;
00064     uint8 FULLWORD;
00065 } RDSR_T;
00066 
00067 
00069 class oEEPROM_SPI : oSPI
00070 {
00071 public:
00072   oEEPROM_SPI(IOLINE cs);       
00073   void read(word address,word rxdata[]); 
00074   void write(word address, uint8 content); 
00075 private:
00076 };
00077 #endif

Generated on Mon Oct 8 19:32:44 2007 for OOMRM Hardware API by doxygen1.3