libquadflash API 1 General Operations

Similar documents
Application Note: AN00188 Using QuadSPI flash memory for persistent storage with xcore-200

Application Note: AN00189 Using QuadSPI for application overlay data

DFU loader for XMOS USB AUDIO devices

Application Note: AN00144 xcore-xa - xcore ARM Boot Library

Embedded Webserver Demo (SPI Flash) Quickstart Guide

Lock handling Library

Application Note: AN00142 xcore-xa - xcore ARM Bridge Library

Use xtimecomposer to simulate a program

GPIO Library. Features. Operating modes. Software version and dependencies. Related application notes GPIO (1.1.0)

A buffered receiver. receiver task FIFO ...

DFU loader for XMOS USB AUDIO devices

Supporting custom flash devices

Configuration Pins Ports Clocks Ram Logical cores Master ~1.5K 1 Slave ~2.1K 1

Application Note: AN00152 xscope - Bi-Directional Endpoint

Application Note: AN10005 A buffered receiver

XS1 Link Performance and Design Guidelines

Application Note: AN00194 Getting Started with VCD Tracing in xtimecomposer

Display Controller Component

Application Note: AN00193 Getting Started with Debugging in xtimecomposer

AVB-DC Quick Start Guide

Application Note: AN00198 Getting Started with Simulator Tracing in xtimecomposer Studio

Configuration Pins Ports Clocks Ram Logical cores SDRAM server 20 4 (1-bit), 1 (16-bit) 1 ~4.0K 1 Memory address allocator ~0.

I2S Master slicekit Loopback Demo Quickstart Guide

TiWi-SL Wi-Fi Component

XC-3 LED Tile Control Kit Quick Start Guide

XC-1A Development Board Tutorial

XMOS Technology Whitepaper

Use the XTA from the command line

Display controller library

LCD Component REV A. Publication Date: 2012/10/15 XMOS 2012, All Rights Reserved.

Application Note: AN00130 USB HID Class - Extended on slicekit

Introduction to XS1 ports

LIN Bus Demo Quickstart Guide

Application Note: AN00151 xscope - Custom Host Endpoint

Application Note: AN00160 How to use the SPI library as SPI master

Wi-Fi Component REV A. Publication Date: 2013/3/8 XMOS 2013, All Rights Reserved.

Startkit support library

Mailbox Client Intel Stratix 10 FPGA IP Core User Guide

Intel Platform Innovation Framework for EFI SMBus Host Controller Protocol Specification. Version 0.9 April 1, 2004

Mailbox Client Intel Stratix 10 FPGA IP Core User Guide

Mellanox Scalable Hierarchical Aggregation and Reduction Protocol (SHARP) API Guide. Version 1.0

LCD component REV A. Publication Date: 2013/11/15 XMOS 2013, All Rights Reserved.

TiWi-SL Simple Web Server Demo Quickstart Guide

Assembly Programming for the XMOS ABI

XC Input and Output. 1 Outputting Data

Application Note: AN00153 Programming OTP memory via SPI boot

IA-64 Software Conventions and Runtime Architecture Guide September 2000

Intel Active Management Technology Release 1.0 Host Interface Design Guide

LCD Component REV A. Publication Date: 2013/2/19 XMOS 2013, All Rights Reserved.

XMOS xsoftip Audio BiQuad Function Library

xtimecomposer supports a single XN file that contains a single network definition. The network definition is specified as follows:

AT03262: SAM D/R/L/C System Pin Multiplexer (SYSTEM PINMUX) Driver. Introduction. SMART ARM-based Microcontrollers APPLICATION NOTE

Ethernet Slice Simple Webserver Application Quickstart

Application Note: AN00174 A startkit glowing LED demo

ESP8266 Application Note Firmware Download Protocol

Application Note: AN00175 A startkit LED demo

Application Note: AN00192 Getting Started with Timing Analysis in xtimecomposer Studio

Application Note: AN00182 USB HID Class - Extended on xcore-200 Explorer

Application Note C Library Source Code for M29W256 Flash Memory Using the Flash Device Driver Software Interface

Configuration Pins Ports Clocks Ram Logical cores I2S Master 3 + data lines 3 x (1-bit) + data lines I2S Master (frame-based)

ESP8266 Flash RW Operation

CPEG421/621 Tutorial

Realtek Over-The-Air Programing

Structures, Unions Alignment, Padding, Bit Fields Access, Initialization Compound Literals Opaque Structures Summary. Structures

LatticeMico32 SPI Flash Controller

Upgrading Software to SynqNet Phase II

Desktop Management BIOS Specification

Adaptive Digital Pre-Distortion API

Extending startkit using the PCIe slot and slicecards

Multi-Uart Com Port Demo Quickstart Guide

AN4491 Application note

Simple FFT function library

µtasker Document µtasker FAT Emulation

Promira Serial Platform

Computer System and programming in C

WDF File Access Library

XC-3 Hardware Manual. Version 1.3. Publication Date: 2009/09/25 Copyright 2009 XMOS Ltd. All Rights Reserved.

C Programming. Course Outline. C Programming. Code: MBD101. Duration: 10 Hours. Prerequisites:

XC-1 Hardware Manual. Version Publication Date: 2009/11/12 Copyright 2009 XMOS Ltd. All Rights Reserved.

smxnand RTOS Innovators Flash Driver General Features

Boot Loader. Bootloader

Technical Note. Software Driver for M29EW NOR Flash Memory. Introduction. TN-13-12: Software Driver for M29EW NOR Flash Memory.

CLD SC58x CDC Library v.1.00 Users Guide Users Guide Revision For Use With Analog Devices ADSP-SC58x Series Processors. Closed Loop Design, LLC

Active Serial Memory Interface

Application Note: AN00176 A startkit tic-tac-toe demo

NVJPEG. DA _v0.2.0 October nvjpeg Libary Guide

VueMetrix Firmware Uploader

xcore VocalFusion Speaker Evaluation Kit Quick Start Guide

Small Logger File System

Motor Objects. Methods

Application Note Software Device Drivers for the M29Fxx Flash Memory Device

TIP670-SW-95. QNX-Neutrino Device Driver. User Manual. The Embedded I/O Company. Digital I/O. Version 1.0.x. Issue August 2008.

Linux SDK for UPnP Devices v1.4

Architecture Specification

Application Note: AN00181 xcore-200 explorer - Accelerometer

XMOS xsoftip Audio Delay-line Function Library

Variables Data types Variable I/O. C introduction. Variables. Variables 1 / 14

CODE TIME TECHNOLOGIES. Abassi RTOS. Media I/F

Embedded Webserver Library Programming Guide

National Aeronautics and Space and Administration Space Administration. cfe Release 6.6

Transcription:

libquadflash API IN THIS DOCUMENT General Operations Boot Partition s Data Partition s The libquadflash library provides functions for reading and writing data to Quad-SPI flash devices that use the xcore format shown in the diagram below. Figure 1: Flash format diagram 0 BOOT PARTITION DATA PARTITION Flash loader Factory Upgrade Upgrade 0 1 2 3 image image image Default 0 bytes (unavailable) Hardware protected Sector boundaries All functions are prototyped in the header file <quadflash.h>. Except where otherwise stated, functions return 0 on success and non-zero on failure. 1 General Operations The program must explicitly open a connection to the Quad-SPI device before attempting to use it, and must disconnect once finished accessing the device. The functions fl_connect and fl_connecttodevice require an argument of type fl_qspiports, which defines the four ports and clock block used to connect to the device. typedef struct { out port qspics ; out port qspisclk ; out buffered port :32 qspisio ; clock qspiclkblk ; } fl_qspiports ; Publication Date: 2016/10/31 XMOS 2016, All Rights Reserved Document Number:

libquadflash API 2/8 fl_connect fl_connect opens a connection to the specified Quad-SPI device. fl_connect(fl_qspiports *SPI) fl_connecttodevice fl_connecttodevice opens a connection to an Quad-SPI device. It iterates through an array of n Quad-SPI device specifications, attempting to connect using each specification until one succeeds. fl_connecttodevice(fl_qspiports *SPI, fl_devicespec spec[], unsigned n) typedef enum { UNKNOWN = 0, ISSI_IS25LQ016B, ISSI_IS25LQ032B, ISSI_IS25LQ080B, SPANSION_S25FL116K, SPANSION_S25FL132K, SPANSION_S25FL164K, } fl_quadflashid ; fl_getflash fl_getflash returns an enum value for the flash device. The enumeration of devices known to libquadflash is given below. If the function call fl_connecttodevice(p, spec, n) is used to connect to a flash device, fl_getflash returns the parameter value spec[i].flashid where i is the index of the connected device. fl_getflash(void) fl_getflashsize fl_getflashsize returns the capacity of the Quad-SPI device in bytes. unsigned fl_getflashsize(void)

libquadflash API 3/8 fl_disconnect fl_disconnect closes the connection to the Quad-SPI device. fl_disconnect(void) 2 Boot Partition s By default, the size of the boot partition is set to the size of the flash device. Access to boot images is provided through an iterator erface. fl_getfactoryimage fl_getfactoryimage provides information about the factory boot image. fl_getfactoryimage(fl_bootimageinfo *bootimageinfo) fl_getnextbootimage fl_getnextbootimage provides information about the next upgrade image. Once located, an image can be upgraded. s are also provided for reading the contents of an upgrade image. fl_getnextbootimage(fl_bootimageinfo *bootimageinfo) fl_getimageversion fl_getimageversion returns the version number of the specified image. unsigned fl_getimageversion(fl_bootimageinfo *bootimageinfo)

libquadflash API 4/8 fl_startimagereplace fl_startimagereplace prepares the Quad-SPI device for replacing an image. The old image can no longer be assumed to exist after this call. Attempting to write o the data partition or the space of another upgrade image is invalid. A non-zero return value signifies that the preparation is not yet complete and that the function should be called again. This behavior allows the latency of a sector erase to be masked by the program. fl_startimagereplace(fl_bootimageinfo *, unsigned maxsize) fl_startimageadd fl_startimageadd prepares the Quad-SPI device for adding an image after the specified image. The start of the new image is at least padding bytes after the previous image. Attempting to write o the data partition or the space of another upgrade image is invalid. A non-zero return value signifies that the preparation is not yet complete and that the function must be called again. This behavior allows the latency of a sector erase to be masked by the program. fl_startimageadd(fl_bootimageinfo*, unsigned maxsize, unsigned padding) fl_startimageaddat fl_startimageaddat prepares the Quad-SPI device for adding an image at the specified address offset from the base of the first sector after the factory image. Attempting to write o the data partition or the space of another upgrade image is invalid. A non-zero return value signifies that the preparation is not yet complete and that the function must be called again. fl_startimageaddat(unsigned offset, unsigned maxsize) fl_writeimagepage fl_writeimagepage waits until the Quad-SPI device is able to accept a request and then outputs the next page of data to the device. Attempting to write past the maximum size passed to fl_startimagereplace, fl_startimageadd or fl_startimageaddat is invalid. Continued on next page

libquadflash API 5/8 fl_writeimagepage(const unsigned char page[]) fl_writeimageend fl_writeimageend waits until the Quad-SPI device has written the last page of data to its memory. fl_writeimageend(void) fl_startimageread fl_startimageread prepares the Quad-SPI device for reading the contents of the specified upgrade image. fl_startimageread(fl_bootimageinfo *b) fl_readimagepage fl_readimagepage inputs the next page of data from the Quad-SPI device and writes it to the array page. fl_readimagepage(unsigned char page[]) fl_deleteimage fl_deleteimage erases the upgrade image with the specified image. fl_deleteimage(fl_bootimageinfo* b) 3 Data Partition s All flash devices are assumed to have uniform page sizes but are not assumed to have uniform sector sizes. Read and write operations occur at the page level, and erase operations occur at the sector level. This means that to write part of a sector, a buffer size of at least one sector is required to preserve other data.

libquadflash API 6/8 In the following functions, writes to the data partition and erasures from the data partition are not fail-safe. If the operation is errupted, for example due to a power failure, the data in the page or sector is undefined. fl_getdatapartitionsize fl_getdatapartitionsize returns the size of the data partition in bytes. unsigned fl_getdatapartitionsize(void) fl_readdata fl_readdata reads a number of bytes from an offset o the data partition and writes them to the array dst. fl_readdata(unsigned offset, unsigned size, unsigned char dst[]) fl_getwritescratchsize fl_getwritescratchsize returns the buffer size needed by fl_writedata for the given parameters. unsigned fl_getwritescratchsize(unsigned offset, unsigned size) fl_writedata fl_writedata writes the array src to the specified offset in the data partition. It uses the array buffer to preserve page data that must be re-written. fl_writedata(unsigned offset, unsigned size, const unsigned char src[], unsigned char buffer[]) 3.1 Page-Level s

libquadflash API 7/8 fl_getpagesize fl_getpagesize returns the page size in bytes. unsigned fl_getpagesize(void) fl_getnumdatapages fl_getnumdatapages returns the number of pages in the data partition. unsigned fl_getnumdatapages(void) fl_writedatapage fl_writedatapage writes the array data to the n-th page in the data partition. The data array must be at least as big as the page size; if larger, the highest elements are ignored. unsigned fl_writedatapage(unsigned n, const unsigned char data[]) fl_readdatapage fl_readdatapage reads the n-th page in the data partition and writes it to the array data. The size of data must be at least as large as the page size. unsigned fl_readdatapage(unsigned n, unsigned char data[]) 3.2 Sector-Level s fl_getnumdatasectors fl_getnumdatasectors returns the number of sectors in the data partition. unsigned fl_getnumdatasectors(void)

libquadflash API 8/8 fl_getdatasectorsize fl_getdatasectorsize returns the size of the n-th sector in the data partition in bytes. unsigned fl_getdatasectorsize(unsigned n) fl_erasedatasector fl_erasedatasector erases the n-th sector in the data partition. unsigned fl_erasedatasector(unsigned n) fl_erasealldatasectors fl_erasealldatasectors erases all sectors in the data partition. unsigned fl_erasealldatasectors(void) Copyright 2016, All Rights Reserved. Xmos Ltd. is the owner or licensee of this design, code, or Information (collectively, the Information ) and is providing it to you AS IS with no warranty of any kind, express or implied and shall have no liability in relation to its use. Xmos Ltd. makes no representation that the Information, or any particular implementation thereof, is or will be free from any claims of infringement and again, shall have no liability in relation to any such claims.