00001 /*This file is prepared for Doxygen automatic documentation generation.*/ 00017 /* Copyright (c) 2009 Atmel Corporation. All rights reserved. 00018 * 00019 * Redistribution and use in source and binary forms, with or without 00020 * modification, are permitted provided that the following conditions are met: 00021 * 00022 * 1. Redistributions of source code must retain the above copyright notice, this 00023 * list of conditions and the following disclaimer. 00024 * 00025 * 2. Redistributions in binary form must reproduce the above copyright notice, 00026 * this list of conditions and the following disclaimer in the documentation 00027 * and/or other materials provided with the distribution. 00028 * 00029 * 3. The name of Atmel may not be used to endorse or promote products derived 00030 * from this software without specific prior written permission. 00031 * 00032 * 4. This software may only be redistributed and used in connection with an Atmel 00033 * AVR product. 00034 * 00035 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 00036 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00037 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 00038 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 00039 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00040 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00041 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00042 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00043 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00044 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE 00045 * 00046 */ 00047 00048 #ifndef _AT45DBX_H_ 00049 #define _AT45DBX_H_ 00050 00051 00052 #include "conf_access.h" 00053 00054 #if AT45DBX_MEM == DISABLE 00055 #error at45dbx.h is #included although AT45DBX_MEM is disabled 00056 #endif 00057 00058 00059 #include "spi.h" 00060 00061 00062 //_____ D E F I N I T I O N S ______________________________________________ 00063 00071 00072 #define AT45DBX_2MB 21 00073 #define AT45DBX_4MB 22 00074 #define AT45DBX_8MB 23 00076 00078 #define AT45DBX_SECTOR_BITS 9 00079 00081 #define AT45DBX_SECTOR_SIZE (1 << AT45DBX_SECTOR_BITS) 00082 00083 00084 //_____ D E C L A R A T I O N S ____________________________________________ 00085 00088 00089 00099 extern Bool at45dbx_init(spi_options_t spiOptions, unsigned int pba_hz); 00100 00106 extern Bool at45dbx_mem_check(void); 00107 00117 extern Bool at45dbx_read_open(U32 sector); 00118 00121 extern void at45dbx_read_close(void); 00122 00136 extern Bool at45dbx_write_open(U32 sector); 00137 00140 extern void at45dbx_write_close(void); 00141 00143 00144 00147 00148 00156 extern U8 at45dbx_read_byte(void); 00157 00168 extern Bool at45dbx_write_byte(U8 b); 00169 00171 00172 00175 00176 00193 extern Bool at45dbx_read_multiple_sector(U16 nb_sector); 00194 00200 extern void at45dbx_read_multiple_sector_callback(const void *psector); 00201 00218 extern Bool at45dbx_write_multiple_sector(U16 nb_sector); 00219 00225 extern void at45dbx_write_multiple_sector_callback(void *psector); 00226 00228 00229 00232 00233 00246 extern Bool at45dbx_read_sector_2_ram(void *ram); 00247 00260 extern Bool at45dbx_write_sector_from_ram(const void *ram); 00261 00263 00264 00265 #endif // _AT45DBX_H_