Line No. | Rev | Author | Line |
---|---|---|---|
1 | 32 | kaklik | /********************************************************************* |
2 | * |
||
3 | * SPI Flash Interface Headers |
||
4 | * - Tested to be compatible with SST25VF016B |
||
5 | * - Expected compatibility with all SST25VFxxxB devices |
||
6 | * |
||
7 | ********************************************************************* |
||
8 | * FileName: SPIFlash.h |
||
9 | * Dependencies: None |
||
10 | * Processor: PIC18, PIC24F, PIC24H, dsPIC30F, dsPIC33F, PIC32 |
||
11 | * Compiler: Microchip C32 v1.05 or higher |
||
12 | * Microchip C30 v3.12 or higher |
||
13 | * Microchip C18 v3.30 or higher |
||
14 | * HI-TECH PICC-18 PRO 9.63PL2 or higher |
||
15 | * Company: Microchip Technology, Inc. |
||
16 | * |
||
17 | * Software License Agreement |
||
18 | * |
||
19 | * Copyright (C) 2002-2009 Microchip Technology Inc. All rights |
||
20 | * reserved. |
||
21 | * |
||
22 | * Microchip licenses to you the right to use, modify, copy, and |
||
23 | * distribute: |
||
24 | * (i) the Software when embedded on a Microchip microcontroller or |
||
25 | * digital signal controller product ("Device") which is |
||
26 | * integrated into Licensee's product; or |
||
27 | * (ii) ONLY the Software driver source files ENC28J60.c, ENC28J60.h, |
||
28 | * ENCX24J600.c and ENCX24J600.h ported to a non-Microchip device |
||
29 | * used in conjunction with a Microchip ethernet controller for |
||
30 | * the sole purpose of interfacing with the ethernet controller. |
||
31 | * |
||
32 | * You should refer to the license agreement accompanying this |
||
33 | * Software for additional information regarding your rights and |
||
34 | * obligations. |
||
35 | * |
||
36 | * THE SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT |
||
37 | * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT |
||
38 | * LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A |
||
39 | * PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL |
||
40 | * MICROCHIP BE LIABLE FOR ANY INCIDENTAL, SPECIAL, INDIRECT OR |
||
41 | * CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF |
||
42 | * PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR SERVICES, ANY CLAIMS |
||
43 | * BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE |
||
44 | * THEREOF), ANY CLAIMS FOR INDEMNITY OR CONTRIBUTION, OR OTHER |
||
45 | * SIMILAR COSTS, WHETHER ASSERTED ON THE BASIS OF CONTRACT, TORT |
||
46 | * (INCLUDING NEGLIGENCE), BREACH OF WARRANTY, OR OTHERWISE. |
||
47 | * |
||
48 | * |
||
49 | * Author Date Comment |
||
50 | *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
||
51 | * E. Wood 3/20/08 Original |
||
52 | ********************************************************************/ |
||
53 | #ifndef __SPIFLASH_H |
||
54 | #define __SPIFLASH_H |
||
55 | |||
56 | #include "HardwareProfile.h" |
||
57 | |||
58 | #define SPI_FLASH_SST |
||
59 | #define SPI_FLASH_SECTOR_SIZE (4096ul) |
||
60 | #define SPI_FLASH_PAGE_SIZE (0ul) // SST has no page boundary requirements |
||
61 | |||
62 | //#define SPI_FLASH_SPANSION |
||
63 | //#define SPI_FLASH_SECTOR_SIZE (65536ul) |
||
64 | //#define SPI_FLASH_SECTOR_SIZE (262144ul) |
||
65 | //#define SPI_FLASH_SECTOR_SIZE (524288ul) |
||
66 | //#define SPI_FLASH_PAGE_SIZE (256) |
||
67 | |||
68 | #define SPI_FLASH_SECTOR_MASK (SPI_FLASH_SECTOR_SIZE - 1) |
||
69 | #define SPI_FLASH_PAGE_MASK (SPI_FLASH_PAGE_SIZE - 1) |
||
70 | |||
71 | |||
72 | #if defined(SPIFLASH_CS_TRIS) |
||
73 | void SPIFlashInit(void); |
||
74 | void SPIFlashReadArray(DWORD dwAddress, BYTE *vData, WORD wLen); |
||
75 | void SPIFlashBeginWrite(DWORD dwAddr); |
||
76 | void SPIFlashWrite(BYTE vData); |
||
77 | void SPIFlashWriteArray(BYTE *vData, WORD wLen); |
||
78 | void SPIFlashEraseSector(DWORD dwAddr); |
||
79 | #else |
||
80 | // If you get any of these linker errors, it means that you either have an |
||
81 | // error in your HardwareProfile.h or TCPIPConfig.h definitions. The code |
||
82 | // is attempting to call a function that can't possibly work because you |
||
83 | // have not specified what pins and SPI module the physical SPI Flash chip |
||
84 | // is connected to. Alternatively, if you don't have an SPI Flash chip, it |
||
85 | // means you have enabled a stack feature that requires SPI Flash hardware. |
||
86 | // In this case, you need to edit TCPIPConfig.h and disable this stack |
||
87 | // feature. The linker error tells you which object file this error was |
||
88 | // generated from. It should be a clue as to what feature you need to |
||
89 | // disable. |
||
90 | void You_cannot_call_the_SPIFlashInit_function_without_defining_SPIFLASH_CS_TRIS_in_HardwareProfile_h_first(void); |
||
91 | void You_cannot_call_the_SPIFlashReadArray_function_without_defining_SPIFLASH_CS_TRIS_in_HardwareProfile_h_first(void); |
||
92 | void You_cannot_call_the_SPIFlashBeginWrite_function_without_defining_SPIFLASH_CS_TRIS_in_HardwareProfile_h_first(void); |
||
93 | void You_cannot_call_the_SPIFlashWrite_function_without_defining_SPIFLASH_CS_TRIS_in_HardwareProfile_h_first(void); |
||
94 | void You_cannot_call_the_SPIFlashWriteArray_function_without_defining_SPIFLASH_CS_TRIS_in_HardwareProfile_h_first(void); |
||
95 | void You_cannot_call_the_SPIFlashEraseSector_function_without_defining_SPIFLASH_CS_TRIS_in_HardwareProfile_h_first(void); |
||
96 | #define SPIFlashInit() You_cannot_call_the_SPIFlashInit_function_without_defining_SPIFLASH_CS_TRIS_in_HardwareProfile_h_first() |
||
97 | #define SPIFlashReadArray(a,b,c) You_cannot_call_the_SPIFlashReadArray_function_without_defining_SPIFLASH_CS_TRIS_in_HardwareProfile_h_first() |
||
98 | #define SPIFlashBeginWrite(a) You_cannot_call_the_SPIFlashBeginWrite_function_without_defining_SPIFLASH_CS_TRIS_in_HardwareProfile_h_first() |
||
99 | #define SPIFlashWrite(a) You_cannot_call_the_SPIFlashWrite_function_without_defining_SPIFLASH_CS_TRIS_in_HardwareProfile_h_first() |
||
100 | #define SPIFlashWriteArray(a,b) You_cannot_call_the_SPIFlashWriteArray_function_without_defining_SPIFLASH_CS_TRIS_in_HardwareProfile_h_first() |
||
101 | #define SPIFlashEraseSector(a) You_cannot_call_the_SPIFlashEraseSector_function_without_defining_SPIFLASH_CS_TRIS_in_HardwareProfile_h_first() |
||
102 | #endif |
||
103 | |||
104 | #endif |
Powered by WebSVN v2.8.3