Prusa MINI Firmware overview
w25x.h
Go to the documentation of this file.
1 //w25x.h
2 #ifndef _W25X_H
3 #define _W25X_H
4 
5 #include <inttypes.h>
6 
7 #define W25X_STATUS_BUSY 0x01
8 #define W25X_STATUS_WEL 0x02
9 #define W25X_STATUS_BP0 0x04
10 #define W25X_STATUS_BP1 0x08
11 #define W25X_STATUS_TB 0x20
12 #define W25X_STATUS_SRP 0x80
13 
14 #define W25X_SPI_ENTER() // spi_setup(W25X20CL_SPCR, W25X20CL_SPSR)
15 
16 #if defined(__cplusplus)
17 extern "C" {
18 #endif //defined(__cplusplus)
19 
20 extern int8_t w25x_init(void);
21 extern void w25x_enable_wr(void);
22 extern void w25x_disable_wr(void);
23 extern uint8_t w25x_rd_status_reg(void);
24 extern void w25x_wr_status_reg(uint8_t val);
25 extern void w25x_rd_data(uint32_t addr, uint8_t *data, uint16_t cnt);
26 extern void w25x_page_program(uint32_t addr, uint8_t *data, uint16_t cnt);
27 extern void w25x_page_program_P(uint32_t addr, uint8_t *data, uint16_t cnt);
28 extern void w25x_sector_erase(uint32_t addr);
29 extern void w25x_block32_erase(uint32_t addr);
30 extern void w25x_block64_erase(uint32_t addr);
31 extern void w25x_chip_erase(void);
32 extern void w25x_page_program(uint32_t addr, uint8_t *data, uint16_t cnt);
33 extern void w25x_rd_uid(uint8_t *uid);
34 extern void w25x_wait_busy(void);
35 
36 #if defined(__cplusplus)
37 }
38 #endif //defined(__cplusplus)
39 #endif //_W25X_H
version_build
const char version_build[]
Definition: version.c:37
w25x_block32_erase
void w25x_block32_erase(uint32_t addr)
Definition: w25x.c:139
w25x_enable_wr
void w25x_enable_wr(void)
Definition: w25x.c:66
_CMD_MFRID_DEVID
#define _CMD_MFRID_DEVID
Definition: w25x.c:34
_CMD_PAGE_PROGRAM
#define _CMD_PAGE_PROGRAM
Definition: w25x.c:26
w25x_chip_erase
void w25x_chip_erase(void)
Definition: w25x.c:147
__SPI_HandleTypeDef
SPI handle Structure definition.
Definition: stm32f4xx_hal_spi.h:120
w25x_rd_uid
void w25x_rd_uid(uint8_t *uid)
Definition: w25x.c:153
_CMD_RD_UID
#define _CMD_RD_UID
Definition: w25x.c:37
_CMD_RD_STATUS_REG
#define _CMD_RD_STATUS_REG
Definition: w25x.c:20
w25x_sector_erase
void w25x_sector_erase(uint32_t addr)
Definition: w25x.c:135
w25x_disable_wr
void w25x_disable_wr(void)
Definition: w25x.c:72
w25x_rd_uid
void w25x_rd_uid(uint8_t *uid)
Definition: w25x.c:153
_SPI_RX
#define _SPI_RX()
Definition: w25x.c:45
w25x_block64_erase
void w25x_block64_erase(uint32_t addr)
Definition: w25x.c:143
data
uint8_t data[8]
Definition: masstorage.h:49
w25x_page_program
void w25x_page_program(uint32_t addr, uint8_t *data, uint16_t cnt)
Definition: w25x.c:104
hspi3
SPI_HandleTypeDef hspi3
Definition: main.c:82
_DEVID_NEW
#define _DEVID_NEW
Definition: w25x.c:15
w25x_chip_erase
void w25x_chip_erase(void)
Definition: w25x.c:147
version_firmware_name
const char version_firmware_name[]
Definition: version.c:24
w25x_wr_status_reg
void w25x_wr_status_reg(uint8_t val)
Definition: w25x.c:86
w25x_mfrid_devid
int w25x_mfrid_devid(void)
Definition: w25x.c:165
FW_BUILDSX
#define FW_BUILDSX
Definition: config.h:12
w25x_enable_wr
void w25x_enable_wr(void)
Definition: w25x.c:66
w25x_block64_erase
void w25x_block64_erase(uint32_t addr)
Definition: w25x.c:143
w25x_wait_busy
void w25x_wait_busy(void)
Definition: w25x.c:177
_CMD_WR_STATUS_REG
#define _CMD_WR_STATUS_REG
Definition: w25x.c:21
W25X_SPI_ENTER
#define W25X_SPI_ENTER()
Definition: w25x.h:14
w25x_erase
void w25x_erase(uint8_t cmd, uint32_t addr)
Definition: w25x.c:126
w25x_wr_status_reg
void w25x_wr_status_reg(uint8_t val)
Definition: w25x.c:86
w25x_rd_status_reg
uint8_t w25x_rd_status_reg(void)
Definition: w25x.c:78
_DEVID
#define _DEVID
Definition: w25x.c:14
_CMD_BLOCK64_ERASE
#define _CMD_BLOCK64_ERASE
Definition: w25x.c:29
version_build_nr
const int version_build_nr
build number
Definition: version.c:44
w25x_disable_wr
void w25x_disable_wr(void)
Definition: w25x.c:72
_CMD_CHIP_ERASE
#define _CMD_CHIP_ERASE
Definition: w25x.c:30
w25x_block32_erase
void w25x_block32_erase(uint32_t addr)
Definition: w25x.c:139
w25x_rd_status_reg
uint8_t w25x_rd_status_reg(void)
Definition: w25x.c:78
_CS_HIGH
#define _CS_HIGH()
Definition: w25x.c:40
w25x_rd_data
void w25x_rd_data(uint32_t addr, uint8_t *data, uint16_t cnt)
Definition: w25x.c:93
w25x_page_program
void w25x_page_program(uint32_t addr, uint8_t *data, uint16_t cnt)
Definition: w25x.c:104
_MFRID
#define _MFRID
Definition: w25x.c:13
uint8_t
const uint8_t[]
Definition: 404_html.c:3
W25X_STATUS_BUSY
#define W25X_STATUS_BUSY
Definition: w25x.h:7
STR
#define STR(x)
Definition: version.c:11
_CMD_ENABLE_WR
#define _CMD_ENABLE_WR
Definition: w25x.c:17
_CMD_BLOCK32_ERASE
#define _CMD_BLOCK32_ERASE
Definition: w25x.c:28
main.h
: Header for main.c file. This file contains the common defines of the application.
_CS_LOW
#define _CS_LOW()
Definition: w25x.c:39
_CMD_DISABLE_WR
#define _CMD_DISABLE_WR
Definition: w25x.c:19
version.h
w25x_page_program_P
void w25x_page_program_P(uint32_t addr, uint8_t *data, uint16_t cnt)
Definition: w25x.c:115
config.h
version_version
const char version_version[]
semantic version (https://semver.org) is Prusa3D standard
Definition: version.c:31
VERSION
#define VERSION(ver)
Definition: version.c:20
HAL_MAX_DELAY
#define HAL_MAX_DELAY
Definition: stm32f4xx_hal_def.h:76
HAL_SPI_TransmitReceive
HAL_StatusTypeDef HAL_SPI_TransmitReceive(SPI_HandleTypeDef *hspi, uint8_t *pTxData, uint8_t *pRxData, uint16_t Size, uint32_t Timeout)
w25x_sector_erase
void w25x_sector_erase(uint32_t addr)
Definition: w25x.c:135
w25x_rd_data
void w25x_rd_data(uint32_t addr, uint8_t *data, uint16_t cnt)
Definition: w25x.c:93
w25x_wait_busy
void w25x_wait_busy(void)
Definition: w25x.c:177
_CMD_SECTOR_ERASE
#define _CMD_SECTOR_ERASE
Definition: w25x.c:27
spi_txrx
static uint8_t spi_txrx(uint8_t tx)
Definition: w25x.c:49
w25x.h
w25x_page_program_P
void w25x_page_program_P(uint32_t addr, uint8_t *data, uint16_t cnt)
Definition: w25x.c:115
w25x_init
int8_t w25x_init(void)
Definition: w25x.c:57
_SPI_TX
#define _SPI_TX(b)
Definition: w25x.c:44
_CMD_RD_DATA
#define _CMD_RD_DATA
Definition: w25x.c:22
w25x_init
int8_t w25x_init(void)
Definition: w25x.c:57