Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of SerialFlash by
Diff: SST25DeviceImpl.h
- Revision:
- 0:d0117f54a7ee
- Child:
- 2:6f8ab876b516
diff -r 000000000000 -r d0117f54a7ee SST25DeviceImpl.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/SST25DeviceImpl.h Tue Mar 01 15:44:13 2011 +0000
@@ -0,0 +1,57 @@
+#pragma once
+
+#include <string>
+
+class ISPI;
+
+class SST25DeviceImpl
+{
+public:
+ static bool IsSupported(ISPI* pSPI);
+ static SST25DeviceImpl* Create(ISPI* pSPI);
+ ~SST25DeviceImpl(void);
+
+ std::string GetDeviceName() const;
+ int GetCapacity() const;
+ int Read(int address, void* buffer, int length);
+ int Write(int address, const void* buffer, int length);
+ void ChipErase(void);
+
+private:
+ ISPI* const _pSPI;
+ int _operationFrequency;
+ struct DeviceProperty
+ {
+ std::string deviceName;
+ int capacity;
+ int blockProtectionMask;
+ int pageSize;
+ void (SST25DeviceImpl::*pfnWriter)(int address, const void* buffer, int length);
+
+ int operationClkHz;
+ } const& _property;
+ static const DeviceProperty* findMatchDevice(ISPI* pSPI);
+
+ SST25DeviceImpl(ISPI* pSPI, const DeviceProperty& property);
+ void writeAddress(int address);
+ static void readId(ISPI* pSPI, int& manufacturersId, int& deviceId);
+
+ int readStatusRegister(void);
+ void writeStatusRegister(int value);
+ void writeEnable(void);
+ void writeDisable(void);
+ void waitForReady(void);
+
+ void byteProgram(int address, int value);
+ void pageProgram(int address, const void* buffer);
+ void beginAAIProgram(int address, int data);
+ void nextAAIProgram(int data);
+ void endAAIProgram(void);
+ void beginAAIWordProgram(int address, int data);
+ void nextAAIWordProgram(int data);
+
+ void writeBytes(int address, const void* buffer, int length);
+ void writeAAI(int address, const void* buffer, int length);
+ void writeAAIWord(int address, const void* buffer, int length);
+ void writePage(int address, const void* buffer, int length);
+};
