123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- // This file is part of parrocchetto.
- // parrocchetto is free software: you can redistribute it and/or modify
- // it under the terms of the GNU General Public License as published by
- // the Free Software Foundation, either version 3 of the License, or
- // (at your option) any later version.
- // parrocchetto is distributed in the hope that it will be useful,
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- // GNU General Public License for more details.
- // You should have received a copy of the GNU General Public License
- // along with parrocchetto. If not, see <http://www.gnu.org/licenses/>.
- #ifndef FLASH_H
- #define FLASH_H
- #include <xc.h>
- #include <stdint.h>
- #include "spi1.h"
- #ifdef __cplusplus
- extern "C" {
- #endif /* __cplusplus */
- #define flash_init() flash_W25Q32JV_init()
- #define flash_read(page_addr, byte_addr, buf, size) flash_W25Q32JV_read(page_addr, byte_addr, buf, size)
- #define flash_pageread(addr, page) flash_W25Q32JV_pageread(addr, page)
- #define flash_pagewrite(addr, page) flash_W25Q32JV_pagewrite(addr, page)
- #define flash_sectorerase(addr) flash_W25Q32JV_sectorerase(addr)
- #define flash_erase() flash_W25Q32JV_erase()
- #define flash_busywait(addr) flash_W25Q32JV_busywait()
- #define flash_isbusy() flash_W25Q32JV_isbusy()
-
- void flash_AT45DB041D_init();
- uint8_t flash_AT45DB041D_identify(void);
- uint8_t flash_AT45DB041D_getstatus(void);
- void flash_AT45DB041D_erase();
- void flash_AT45DB041D_pageread(uint16_t addr, uint8_t* page);
- void flash_AT45DB041D_pagewrite(uint16_t addr, const uint8_t* page);
- void flash_W25Q32JV_init();
- uint8_t flash_W25Q32JV_identify(void);
- uint8_t flash_W25Q32JV_getstatus1(void);
- void flash_W25Q32JV_busywait(void);
- inline uint8_t flash_W25Q32JV_isbusy(void);
- void flash_W25Q32JV_read(uint16_t page_addr, uint8_t byte_addr, uint8_t* buf, uint8_t size);
- void flash_W25Q32JV_pageread(uint16_t addr, uint8_t* page);
- void flash_W25Q32JV_pagewrite(uint16_t addr, const uint8_t* page);
- void flash_W25Q32JV_sectorerase(uint16_t addr);
- void flash_W25Q32JV_erase();
- #ifdef __cplusplus
- }
- #endif
- #endif // FLASH_H
|