summaryrefslogtreecommitdiff
path: root/tvapi/libtv/tvsetting/CBlobDevice.h (plain)
blob: 43f2d4902e00eecfe3b04c35c4a8b9708e9ec422
1#ifndef BLOB_BASE_DEVICE_H
2#define BLOB_BASE_DEVICE_H
3
4class CBlobDevice
5{
6
7public:
8 static const int CC_MAX_FILE_PATH = 256;
9 static const int CC_ERR_FILE_HANDLE = -1;
10 static const int CC_INIT_BYTE_VAL = 0xFF;
11 static const int CC_SSM_PROTECT_ON = 0;
12 static const int CC_SSM_PROTECT_OFF = 1;
13
14 static const int CC_DEVICE_E2PROM = (0);
15 static const int CC_DEVICE_SPI = (1);
16 static const int CC_DEVICE_FILE = (2);
17 static const int CC_DEVICE_RAM = (3);
18
19 CBlobDevice();
20 virtual ~CBlobDevice();
21
22 virtual int WriteBytes(int offset, int size, unsigned char *buf) = 0;
23 virtual int ReadBytes(int offset, int size, unsigned char *buf) = 0;
24 virtual int EraseAllData() = 0;
25 virtual int InitCheck() = 0;
26 virtual int OpenDevice() = 0;
27 virtual int CloseDevice() = 0;
28 int WriteOneByte(int offset, unsigned char val)
29 {
30 return WriteBytes(offset, 1, &val);
31 }
32 int ReadOneByte(int offset, unsigned char *ptrVal)
33 {
34 return ReadBytes(offset, 1, ptrVal);
35 }
36
37 int m_dev_type; //device type
38 int m_dev_total_size; //device total size(Byte)
39
40 char m_dev_path[CC_MAX_FILE_PATH]; //device path
41 int m_dev_fd;
42
43protected:
44 unsigned char *mDataBuf;
45
46private:
47 int IsFileExist(const char *file_name);
48
49};
50
51#endif // ANDROID_SSM_BASE_H
52