| LibDriver W25QXX 1.0.0 W25QXX full function driver

Data Structures | Typedefs | Enumerations | Functions
w25qxx basic driver function
w25qxx driver function

w25qxx basic driver modules More...

## Data Structures
struct | w25qxx_handle_s
| w25qxx handle structure definition More...
struct | w25qxx_info_s
| w25qxx information structure definition More...

## Typedefs
typedef struct w25qxx_handle_s | w25qxx_handle_t
| w25qxx handle structure definition More...
typedef struct w25qxx_info_s | w25qxx_info_t
| w25qxx information structure definition More...

## Enumerations
enum | w25qxx_type_t { W25Q80 = 0XEF13U , W25Q16 = 0XEF14U , W25Q32 = 0XEF15U , W25Q64 = 0XEF16U , W25Q128 = 0XEF17U , W25Q256 = 0XEF18U }
| w25qxx type enumeration definition More...
enum | w25qxx_interface_t { W25QXX_INTERFACE_SPI = 0x00 , W25QXX_INTERFACE_QSPI = 0x01 }
| w25qxx interface enumeration definition More...
enum | w25qxx_bool_t { W25QXX_BOOL_FALSE = 0x00 , W25QXX_BOOL_TRUE = 0x01 }
| w25qxx bool enumeration definition More...
enum | w25qxx_address_mode_t { W25QXX_ADDRESS_MODE_3_BYTE = 0x00 , W25QXX_ADDRESS_MODE_4_BYTE = 0x01 }
| w25qxx address mode enumeration definition More...

## Functions
uint8_t | w25qxx_info (w25qxx_info_t *info)
| get chip's information More...
uint8_t | w25qxx_set_dual_quad_spi (w25qxx_handle_t *handle, w25qxx_bool_t enable)
| enable or disable the dual quad spi More...
uint8_t | w25qxx_get_dual_quad_spi (w25qxx_handle_t *handle, w25qxx_bool_t *enable)
| get the dual quad spi status More...
uint8_t | w25qxx_set_type (w25qxx_handle_t *handle, w25qxx_type_t type)
| set the chip type More...
uint8_t | w25qxx_get_type (w25qxx_handle_t *handle, w25qxx_type_t *type)
| get the chip type More...
uint8_t | w25qxx_set_interface (w25qxx_handle_t *handle, w25qxx_interface_t interface)
| set the chip interface More...
uint8_t | w25qxx_get_interface (w25qxx_handle_t *handle, w25qxx_interface_t *interface)
| get the chip interface More...
uint8_t | w25qxx_set_address_mode (w25qxx_handle_t *handle, w25qxx_address_mode_t mode)
| set the chip address mode More...
uint8_t | w25qxx_get_address_mode (w25qxx_handle_t *handle, w25qxx_address_mode_t *mode)
| get the chip address mode More...
uint8_t | w25qxx_init (w25qxx_handle_t *handle)
| initialize the chip More...
uint8_t | w25qxx_deinit (w25qxx_handle_t *handle)
| close the chip More...
uint8_t | w25qxx_read (w25qxx_handle_t *handle, uint32_t addr, uint8_t *data, uint32_t len)
| read data More...
uint8_t | w25qxx_write (w25qxx_handle_t *handle, uint32_t addr, uint8_t *data, uint32_t len)
| write data More...
uint8_t | w25qxx_only_spi_read (w25qxx_handle_t *handle, uint32_t addr, uint8_t *data, uint32_t len)
| read only in the spi interface More...
uint8_t | w25qxx_fast_read (w25qxx_handle_t *handle, uint32_t addr, uint8_t *data, uint32_t len)
| read in the fast mode More...
uint8_t | w25qxx_page_program (w25qxx_handle_t *handle, uint32_t addr, uint8_t *data, uint16_t len)
| page program More...
uint8_t | w25qxx_sector_erase_4k (w25qxx_handle_t *handle, uint32_t addr)
| erase the 4k sector More...
uint8_t | w25qxx_block_erase_32k (w25qxx_handle_t *handle, uint32_t addr)
| erase the 32k block More...
uint8_t | w25qxx_block_erase_64k (w25qxx_handle_t *handle, uint32_t addr)
| erase the 64k block More...
uint8_t | w25qxx_chip_erase (w25qxx_handle_t *handle)
| erase the chip More...
uint8_t | w25qxx_power_down (w25qxx_handle_t *handle)
| power down More...
uint8_t | w25qxx_release_power_down (w25qxx_handle_t *handle)
| release power down More...
uint8_t | w25qxx_get_manufacturer_device_id (w25qxx_handle_t *handle, uint8_t *manufacturer, uint8_t *device_id)
| get the manufacturer && device id information More...

## Detailed Description

w25qxx basic driver modules

## Typedef Documentation

## ◆ w25qxx_handle_t

typedef struct w25qxx_handle_s w25qxx_handle_t

w25qxx handle structure definition

## ◆ w25qxx_info_t

typedef struct w25qxx_info_s w25qxx_info_t

w25qxx information structure definition

## Enumeration Type Documentation

## ◆ w25qxx_address_mode_t

enum w25qxx_address_mode_t

w25qxx address mode enumeration definition

Enumerator
W25QXX_ADDRESS_MODE_3_BYTE | 3 byte mode
W25QXX_ADDRESS_MODE_4_BYTE | 4 byte mode

Definition at line 93 of file driver_w25qxx.h.

## ◆ w25qxx_bool_t

enum w25qxx_bool_t

w25qxx bool enumeration definition

Enumerator
W25QXX_BOOL_FALSE | false
W25QXX_BOOL_TRUE | true

Definition at line 84 of file driver_w25qxx.h.

## ◆ w25qxx_interface_t

enum w25qxx_interface_t

w25qxx interface enumeration definition

Enumerator
W25QXX_INTERFACE_SPI | spi interface
W25QXX_INTERFACE_QSPI | dspi qspi interface

Definition at line 75 of file driver_w25qxx.h.

## ◆ w25qxx_type_t

enum w25qxx_type_t

w25qxx type enumeration definition

Enumerator
W25Q80 | w25q80
W25Q16 | w25q16
W25Q32 | w25q32
W25Q64 | w25q64
W25Q128 | w25q128
W25Q256 | w25q256

Definition at line 62 of file driver_w25qxx.h.

## Function Documentation

## ◆ w25qxx_block_erase_32k()

uint8_t w25qxx_block_erase_32k | ( | w25qxx_handle_t * | handle,
|  | uint32_t | addr
| ) |  |

erase the 32k block

Parameters

  [in] | *handle | points to a w25qxx handle structure
  [in] | addr | is the erase address

Returns
  status code
  - 0 success
  - 1 block erase 32k failed
  - 2 handle is NULL
  - 3 handle is not initialized
  - 4 addr is invalid
  - 5 address mode is invalid
  - 6 block erase 32k timeout

Note
  none

Definition at line 5419 of file driver_w25qxx.c.

## ◆ w25qxx_block_erase_64k()

uint8_t w25qxx_block_erase_64k | ( | w25qxx_handle_t * | handle,
|  | uint32_t | addr
| ) |  |

erase the 64k block

Parameters

  [in] | *handle | points to a w25qxx handle structure
  [in] | addr | is the erase address

Returns
  status code
  - 0 success
  - 1 block erase 64k failed
  - 2 handle is NULL
  - 3 handle is not initialized
  - 4 addr is invalid
  - 5 address mode is invalid
  - 6 block erase 64k timeout

Note
  none

Definition at line 5758 of file driver_w25qxx.c.

## ◆ w25qxx_chip_erase()

uint8_t w25qxx_chip_erase | ( | w25qxx_handle_t * | handle | ) |

erase the chip

Parameters

  [in] | *handle | points to a w25qxx handle structure

Returns
  status code
  - 0 success
  - 1 chip erase failed
  - 2 handle is NULL
  - 3 handle is not initialized
  - 4 erase timeout

Note
  none

Definition at line 1459 of file driver_w25qxx.c.

## ◆ w25qxx_deinit()

uint8_t w25qxx_deinit | ( | w25qxx_handle_t * | handle | ) |

close the chip

Parameters

  [in] | *handle | points to a w25qxx handle structure

Returns
  status code
  - 0 success
  - 1 spi or qspi deinit failed
  - 2 handle is NULL
  - 3 handle is not initialized
  - 4 power down failed

Note
  none

Definition at line 7195 of file driver_w25qxx.c.

## ◆ w25qxx_fast_read()

uint8_t w25qxx_fast_read | ( | w25qxx_handle_t * | handle,
|  | uint32_t | addr,
|  | uint8_t * | data,
|  | uint32_t | len
| ) |  |

read in the fast mode

Parameters

  [in] | *handle | points to a w25qxx handle structure
  [in] | addr | is the read address
  [out] | *data | points to a data buffer
  [in] | len | is the data length

Returns
  status code
  - 0 success
  - 1 fast read failed
  - 2 handle is NULL
  - 3 handle is not initialized
  - 4 address mode is invalid

Note
  none

Definition at line 3634 of file driver_w25qxx.c.

## ◆ w25qxx_get_address_mode()

uint8_t w25qxx_get_address_mode | ( | w25qxx_handle_t * | handle,
|  | w25qxx_address_mode_t * | mode
| ) |  |

get the chip address mode

Parameters

  [in] | *handle | points to a w25qxx handle structure
  [out] | *mode | points to an address mode buffer

Returns
  status code
  - 0 success
  - 2 handle is NULL
  - 3 handle is not initialized

Note
  none

Definition at line 405 of file driver_w25qxx.c.

## ◆ w25qxx_get_dual_quad_spi()

uint8_t w25qxx_get_dual_quad_spi | ( | w25qxx_handle_t * | handle,
|  | w25qxx_bool_t * | enable
| ) |  |

get the dual quad spi status

Parameters

  [in] | *handle | points to a w25qxx handle structure
  [out] | enable | points to a bool value buffer

Returns
  status code
  - 0 success
  - 2 handle is NULL

Note
  none

Definition at line 196 of file driver_w25qxx.c.

## ◆ w25qxx_get_interface()

uint8_t w25qxx_get_interface | ( | w25qxx_handle_t * | handle,
|  | w25qxx_interface_t * | interface
| ) |  |

get the chip interface

Parameters

  [in] | *handle | points to a w25qxx handle structure
  [out] | *interface | points to a chip interface buffer

Returns
  status code
  - 0 success
  - 2 handle is NULL

Note
  none

Definition at line 280 of file driver_w25qxx.c.

## ◆ w25qxx_get_manufacturer_device_id()

uint8_t w25qxx_get_manufacturer_device_id | ( | w25qxx_handle_t * | handle,
|  | uint8_t * | manufacturer,
|  | uint8_t * | device_id
| ) |  |

get the manufacturer && device id information

Parameters

  [in] | *handle | points to a w25qxx handle structure
  [out] | *manufacturer | points to a manufacturer buffer
  [out] | *device_id | points to a device id buffer

Returns
  status code
  - 0 success
  - 1 get manufacturer device id failed
  - 2 handle is NULL
  - 3 handle is not initialized

Note
  none

Definition at line 1952 of file driver_w25qxx.c.

## ◆ w25qxx_get_type()

uint8_t w25qxx_get_type | ( | w25qxx_handle_t * | handle,
|  | w25qxx_type_t * | type
| ) |  |

get the chip type

Parameters

  [in] | *handle | points to a w25qxx handle structure
  [out] | *type | points to a chip type buffer

Returns
  status code
  - 0 success
  - 2 handle is NULL

Note
  none

Definition at line 238 of file driver_w25qxx.c.

## ◆ w25qxx_info()

uint8_t w25qxx_info | ( | w25qxx_info_t * | info | ) |

get chip's information

Parameters

  [out] | *info | points to a w25qxx info structure

Returns
  status code
  - 0 success
  - 2 handle is NULL

Note
  none

Definition at line 8566 of file driver_w25qxx.c.

## ◆ w25qxx_init()

uint8_t w25qxx_init | ( | w25qxx_handle_t * | handle | ) |

initialize the chip

Parameters

  [in] | *handle | points to a w25qxx handle structure

Returns
  status code
  - 0 success
  - 1 spi or qspi initialization failed
  - 2 handle is NULL
  - 3 linked functions is NULL
  - 4 get manufacturer device id failed
  - 5 enter qspi failed
  - 6 id is invalid
  - 7 reset failed
  - 8 set address mode failed

Note
  none

Definition at line 6819 of file driver_w25qxx.c.

## ◆ w25qxx_only_spi_read()

uint8_t w25qxx_only_spi_read | ( | w25qxx_handle_t * | handle,
|  | uint32_t | addr,
|  | uint8_t * | data,
|  | uint32_t | len
| ) |  |

read only in the spi interface

Parameters

  [in] | *handle | points to a w25qxx handle structure
  [in] | addr | is the read address
  [out] | *data | points to a data buffer
  [in] | len | is the data length

Returns
  status code
  - 0 success
  - 1 only spi read failed
  - 2 handle is NULL
  - 3 handle is not initialized
  - 4 address mode is invalid
  - 5 only spi interface can use this function

Note
  none

Definition at line 3465 of file driver_w25qxx.c.

## ◆ w25qxx_page_program()

uint8_t w25qxx_page_program | ( | w25qxx_handle_t * | handle,
|  | uint32_t | addr,
|  | uint8_t * | data,
|  | uint16_t | len
| ) |  |

page program

Parameters

  [in] | *handle | points to a w25qxx handle structure
  [in] | addr | is the programming address
  [in] | *data | points to a data buffer
  [in] | len | is the data length

Returns
  status code
  - 0 success
  - 1 page program failed
  - 2 handle is NULL
  - 3 handle is not initialized
  - 4 addr is invalid
  - 5 address mode is invalid
  - 6 page program timeout
  - 7 length is over 256

Note
  len <= 256

Definition at line 4569 of file driver_w25qxx.c.

## ◆ w25qxx_power_down()

uint8_t w25qxx_power_down | ( | w25qxx_handle_t * | handle | ) |

power down

Parameters

  [in] | *handle | points to a w25qxx handle structure

Returns
  status code
  - 0 success
  - 1 power down failed
  - 2 handle is NULL
  - 3 handle is not initialized

Note
  none

Definition at line 1792 of file driver_w25qxx.c.

## ◆ w25qxx_read()

uint8_t w25qxx_read | ( | w25qxx_handle_t * | handle,
|  | uint32_t | addr,
|  | uint8_t * | data,
|  | uint32_t | len
| ) |  |

read data

Parameters

  [in] | *handle | points to a w25qxx handle structure
  [in] | addr | is the read address
  [out] | *data | points to a data buffer
  [in] | len | is the data length

Returns
  status code
  - 0 success
  - 1 read failed
  - 2 handle is NULL
  - 3 handle is not initialized
  - 4 address mode is invalid

Note
  none

Definition at line 7289 of file driver_w25qxx.c.

## ◆ w25qxx_release_power_down()

uint8_t w25qxx_release_power_down | ( | w25qxx_handle_t * | handle | ) |

release power down

Parameters

  [in] | *handle | points to a w25qxx handle structure

Returns
  status code
  - 0 success
  - 1 release power down failed
  - 2 handle is NULL
  - 3 handle is not initialized

Note
  none

Definition at line 1875 of file driver_w25qxx.c.

## ◆ w25qxx_sector_erase_4k()

uint8_t w25qxx_sector_erase_4k | ( | w25qxx_handle_t * | handle,
|  | uint32_t | addr
| ) |  |

erase the 4k sector

Parameters

  [in] | *handle | points to a w25qxx handle structure
  [in] | addr | is the erase address

Returns
  status code
  - 0 success
  - 1 sector erase 4k failed
  - 2 handle is NULL
  - 3 handle is not initialized
  - 4 addr is invalid
  - 5 address mode is invalid
  - 6 sector erase 4k timeout

Note
  none

Definition at line 5080 of file driver_w25qxx.c.

## ◆ w25qxx_set_address_mode()

uint8_t w25qxx_set_address_mode | ( | w25qxx_handle_t * | handle,
|  | w25qxx_address_mode_t | mode
| ) |  |

set the chip address mode

Parameters

  [in] | *handle | points to a w25qxx handle structure
  [in] | mode | is the address mode

Returns
  status code
  - 0 success
  - 1 set address mode failed
  - 2 handle is NULL
  - 3 handle is not initialized
  - 4 current type can't use this function

Note
  none

Definition at line 304 of file driver_w25qxx.c.

## ◆ w25qxx_set_dual_quad_spi()

uint8_t w25qxx_set_dual_quad_spi | ( | w25qxx_handle_t * | handle,
|  | w25qxx_bool_t | enable
| ) |  |

enable or disable the dual quad spi

Parameters

  [in] | *handle | points to a w25qxx handle structure
  [in] | enable | is a bool value

Returns
  status code
  - 0 success
  - 2 handle is NULL

Note
  none

Definition at line 175 of file driver_w25qxx.c.

## ◆ w25qxx_set_interface()

uint8_t w25qxx_set_interface | ( | w25qxx_handle_t * | handle,
|  | w25qxx_interface_t | interface
| ) |  |

set the chip interface

Parameters

  [in] | *handle | points to a w25qxx handle structure
  [in] | interface | is the chip interface

Returns
  status code
  - 0 success
  - 2 handle is NULL

Note
  none

Definition at line 259 of file driver_w25qxx.c.

## ◆ w25qxx_set_type()

uint8_t w25qxx_set_type | ( | w25qxx_handle_t * | handle,
|  | w25qxx_type_t | type
| ) |  |

set the chip type

Parameters

  [in] | *handle | points to a w25qxx handle structure
  [in] | type | is the chip type

Returns
  status code
  - 0 success
  - 2 handle is NULL

Note
  none

Definition at line 217 of file driver_w25qxx.c.

## ◆ w25qxx_write()

uint8_t w25qxx_write | ( | w25qxx_handle_t * | handle,
|  | uint32_t | addr,
|  | uint8_t * | data,
|  | uint32_t | len
| ) |  |

write data

Parameters

  [in] | *handle | points to a w25qxx handle structure
  [in] | addr | is the write address
  [in] | *data | points to a data buffer
  [in] | len | is the data length

Returns
  status code
  - 0 success
  - 1 write failed
  - 2 handle is NULL
  - 3 handle is not initialized
  - 4 read failed
  - 5 erase sector failed

Note
  none

Definition at line 8415 of file driver_w25qxx.c.