mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-11 19:24:10 +01:00
ad3d470f40
write transaction to improve efficieny.
51 lines
2.0 KiB
C
51 lines
2.0 KiB
C
/**
|
|
******************************************************************************
|
|
*
|
|
* @addtogroup PIOS PIOS Core hardware abstraction layer
|
|
* @{
|
|
* @addtogroup PIOS_FLASH Flash device handler
|
|
* @{
|
|
*
|
|
* @file pios_flash_w25x.h
|
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
|
* @brief Driver for talking to W25X flash chip (and most JEDEC chips)
|
|
* @see The GNU Public License (GPL) Version 3
|
|
*
|
|
*****************************************************************************/
|
|
/*
|
|
* 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, write to the Free Software Foundation, Inc.,
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*/
|
|
|
|
struct pios_flash_jedec_cfg {
|
|
uint32_t sector_erase;
|
|
uint32_t chip_erase;
|
|
};
|
|
|
|
struct pios_flash_chunk {
|
|
uint8_t * addr;
|
|
uint32_t len;
|
|
};
|
|
|
|
int32_t PIOS_Flash_Jedec_Init(uint32_t spi_id, uint32_t slave_num, const struct pios_flash_jedec_cfg * cfg);
|
|
int32_t PIOS_Flash_Jedec_ReadStatus();
|
|
int32_t PIOS_Flash_Jedec_ReadID();
|
|
int32_t PIOS_Flash_Jedec_EraseChip();
|
|
int32_t PIOS_Flash_Jedec_EraseSector(uint32_t add);
|
|
int32_t PIOS_Flash_Jedec_WriteData(uint32_t addr, uint8_t * data, uint16_t len);
|
|
int32_t PIOS_Flash_Jedec_ReadData(uint32_t addr, uint8_t * data, uint16_t len);
|
|
int32_t PIOS_Flash_Jedec_WriteChunks(uint32_t addr, struct pios_flash_chunk * p_chunk, uint32_t num);
|
|
int32_t PIOS_Flash_Jedec_StartTransaction();
|
|
int32_t PIOS_Flash_Jedec_EndTransaction();
|