/* spifs.h - spi control. Taken from intbasic3.
 *  Copyright (C) 2022 by Jed Marti
 *   This program 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.
 *
 *  This program 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 this program.  If not, see https://www.gnu.org/licenses/.
 */

#ifndef spi_h
#define spi_h

// AT45DB081E Commands.
#define SPI_ERASE1        0xC7
#define SPI_ERASE2        0x94
#define SPI_ERASE3        0x80
#define SPI_ERASE4        0x9A
#define SPI_STATUS        0xD7
#define SPI_DEVID         0x9F
#define SPI_WRITE_BUF     0x82
#define SPI_READ          0x03

// Write a sector.
void spiWriteSector(uint16_t sctr, uint8_t __xdata *buf);

// Read a sector.
void spiReadSector(uint16_t sctr, uint8_t __xdata *buf);

// Erase the device.
void spiErase(void);

// Read the chip ID and display.
void spiID(void);

//void spi264(void);
#endif


// EOF
