no-OS
Classes | Functions
flash.c File Reference

Implementation of the flash driver for ADuCM302x. More...

#include <drivers/flash/adi_flash.h>
#include <drivers/dma/adi_dma.h>
#include <stdlib.h>
#include <malloc.h>
#include <string.h>
#include "flash.h"
#include "flash_extra.h"
#include "error.h"
Include dependency graph for flash.c:

Classes

struct  adicup_flash_dev
 Aducm3029 flash controller handler. More...
 

Functions

int32_t flash_init (struct flash_dev **device, struct flash_init_param *init_param)
 
int32_t flash_remove (struct flash_dev *dev)
 
int32_t flash_clear_page (struct flash_dev *dev, int32_t page_no)
 
int32_t flash_write_page (struct flash_dev *dev, int32_t page_no, uint32_t *data)
 
int32_t flash_write (struct flash_dev *dev, uint32_t flash_addr, uint32_t *array, uint32_t array_size)
 
int32_t flash_read (struct flash_dev *dev, uint32_t flash_addr, uint32_t *array, uint32_t size)
 

Detailed Description

Implementation of the flash driver for ADuCM302x.

Author
Andrei Drimbarean (adnre.nosp@m.i.dr.nosp@m.imbar.nosp@m.ean@.nosp@m.analo.nosp@m.g.co.nosp@m.m)

Copyright 2021(c) Analog Devices, Inc.

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Function Documentation

◆ flash_clear_page()

int32_t flash_clear_page ( struct flash_dev dev,
int32_t  page_no 
)

Erase a flash page.

Parameters
[in]dev- Pointer to the flash device handler.
[in]page_no- Page number.
Returns
0 in case of success, negative error code otherwise.

◆ flash_init()

int32_t flash_init ( struct flash_dev **  device,
struct flash_init_param init_param 
)

Initialize flash controller.

Parameters
[out]device- Pointer to the driver handler.
[in]init_param- Pointer to the initialization structure.
Returns
0 in case of success, error code otherwise.
Here is the caller graph for this function:

◆ flash_read()

int32_t flash_read ( struct flash_dev dev,
uint32_t  flash_addr,
uint32_t *  array,
uint32_t  size 
)

Read data from the flash memory.

Parameters
[in]dev- Pointer to the flash device handler.
[in]flash_addr- Start address of the read.
[out]array- Pointer to the container for the read data.
[in]size- Size of the read data in 32-bit words.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ flash_remove()

int32_t flash_remove ( struct flash_dev dev)

Free memory allocated by flash_init().

Parameters
[in]dev- Pointer to the driver handler.
Returns
0 in case of success, error code otherwise.
Here is the caller graph for this function:

◆ flash_write()

int32_t flash_write ( struct flash_dev dev,
uint32_t  flash_addr,
uint32_t *  array,
uint32_t  array_size 
)

Write data in flash memory.

Parameters
[in]dev- Pointer to the flash device handler.
[in]flash_addr- Start address of the write.
[in]array- Pointer to the data to be written.
[in]array_size- Size of the written data in 32-bit words.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ flash_write_page()

int32_t flash_write_page ( struct flash_dev dev,
int32_t  page_no,
uint32_t *  data 
)

Write a page in flash memory.

Parameters
[in]dev- Pointer to the flash device handler.
[in]page_no- Page number.
[in]data- Pointer to the data to be written. data length must be FLASH_PAGE_SIZE_WORDS in size.
Returns
0 in case of success, negative error code otherwise.