HYPERBUS
HYPERBUS peripheral is a driver which provides an interface with storage devices which follows HYPERRAM/HYPERFLASH protocol. The driver supports single bit, four bit and eight bit data lines to communicate with the connected media.
Features Supported
Support for Cypress® HyperRAM
Up to 166 MHz maximum memory bus operation for reads
Low pin count interface with LVCMOS I/O pins (can be muxed with other FSS interfaces (OSPIs)) Two memory chip selects
Linear incrementing mode for reads and writes
Asynchronous bus clock
SysConfig Features
It is strongly recommend to use SysConfig where it is available instead of using direct SW API calls. This will help simplify the SW application and also catch common mistakes early in the development cycle.
Features not Supported
Cache-line wrap and fixed address modes for reads or writes
General Purpose Output register (FSS0_HPB0_MC_GPOR) of the HBMC is not used
HyperFlash
ECC
OTFA
Example Usage
Include the below file to access the APIs
#include <stdio.h>
#include <drivers/hyperbus.h>
Instance Open Example
gHyperBusHandle = HYPERBUS_open(0);
DebugP_assert(gHyperBusHandle != NULL);
Instance Close Example
HYPERBUS_close(gHyperBusHandle);
API
- group APIs for HYPERBUS
This module contains APIs to program and use the HYPERBUS module. The APIs can be used by other drivers to get access to HYPERBUS and also by application to initiate data transfer operation.
HYPERBUS ECC error type
-
HYPERBUS_ECC_1B_ERROR
-
HYPERBUS_ECC_2B_ERROR
-
HYPERBUS_ECC_WRITE_NONALIGN_ERROR
-
HYPERBUS_ECC_ERR_ALL
Defines
-
HYPERBUS_MEM_OFFSET
Memory offset for HYPERBUS controller.
-
HYPERBUS_MCR_CONFIGURABLE_CS_LOW_TIME
Memory Configuration Register defines.
0x1 = configurable CS# low time, 0x0 otherwise
-
HYPERBUS_MCR_NO_CONFIGURABLE_CS_LOW_TIME
-
HYPERBUS_MCR_MAXLEN_2_BYTE
Maximum Length defines.
This bit indicates maximum read/write transaction length to memory. This bit is ignored when MAXEN bit is 0. 000000000: 2 Byte [1 HyperBus CK] 000000001: 4 Byte [2 HyperBus CK] 000000010: 6 Byte [3 HyperBus CK] 111111111: 1024 Byte [512 HyperBus CK]
-
HYPERBUS_MCR_MAXLEN_4_BYTE
-
HYPERBUS_MCR_MAXLEN_6_BYTE
-
HYPERBUS_MCR_MAXLEN_1024_BYTE
-
HYPERBUS_MCR_MERGE_WRAP_INCR
Memory Configuration Register defines.
0x1 = merge WRAP and INCR, 0x0 otherwise
-
HYPERBUS_MCR_NO_MERGE_WRAP_INCR
-
HYPERBUS_MCR_ASYMM_CACHE_SUPPORT
Memory Configuration Register defines.
0x1 = asymmetry cache support, 0x0 otherwise
-
HYPERBUS_MCR_NO_ASYMM_CACHE_SUPPORT
-
HYPERBUS_MCR_MEM_SPACE
Memory Configuration Register defines.
0x0 = memory space, 0x1 = CR space
-
HYPERBUS_MCR_CR_SPACE
-
HYPERBUS_MCR_HYPERFLASH
Memory Configuration Register defines.
0x0 = HyperFlash, 0x1 = HyperRAM
-
HYPERBUS_MCR_HYPERRAM
-
HYPERBUS_MCR_WRAPSIZE_NONE
Memory Configuration Register defines.
0x0 = wrap size none, 0x1 = 64B, 0x2 = 16B, 0x3 = 32B
-
HYPERBUS_MCR_WRAPSIZE_64B
-
HYPERBUS_MCR_WRAPSIZE_16B
-
HYPERBUS_MCR_WRAPSIZE_32B
-
HYPERBUS_DMA_CH_INVALID
Invalid DMA channel index value.
-
HYPERBUS_FSS_FSAS_GENREGS_SYSCONFIG_ECC_ENABLE
Value to enable ECC in SYSCONFIG register.
-
HYPERBUS_FSS_FSAS_GENREGS_SYSCONFIG_ECC_DISABLE
Value to disable ECC in SYSCONFIG register.
-
HYPERBUS_FSS_FSAS_GENREGS_STATUS_RAW_ECC_WRITE_NONALIGN_ERR_MASK
Mask for write non-aligned error field in STATUS_RAW register.
-
HYPERBUS_FSS_FSAS_GENREGS_STATUS_RAW_ECC_WRITE_NONALIGN_ERR_SHIFT
Shift for write non-aligned error field in STATUS_RAW register.
-
HYPERBUS_FSS_FSAS_GENREGS_STATUS_RAW_ECC_DOUBLE_BIT_ERR_MASK
Mask for double bit error field in STATUS_RAW register.
-
HYPERBUS_FSS_FSAS_GENREGS_STATUS_RAW_ECC_DOUBLE_BIT_ERR_SHIFT
Shift for double bit error field in STATUS_RAW register.
-
HYPERBUS_FSS_FSAS_GENREGS_STATUS_RAW_ECC_SINGLE_BIT_ERR_MASK
Mask for single bit error field in STATUS_RAW register.
-
HYPERBUS_FSS_FSAS_GENREGS_STATUS_RAW_ECC_SINGLE_BIT_ERR_SHIFT
Shift for single bit error field in STATUS_RAW register.
-
HYPERBUS_FSS_FSAS_GENREGS_ERR_ECC_TYPE_OFFSET
Offset of ECC error type register in Hyperbus FSS module.
-
HYPERBUS_FSS_FSAS_GENREGS_ERR_WRT_TYPE_OFFSET
Offset of write error type register in Hyperbus FSS module.
-
HYPERBUS_FSS_FSAS_GENREGS_ECC_ERR_CLEAR_VALUE
Value to clear ECC error in Hyperbus FSS module.
-
HYPERBUS_FSS_FSAS_GENREGS_IRQ_EOI_OFFSET
Offset of EOI register in Hyperbus FSS module.
-
HYPERBUS_FSS_FSAS_GENREGS_IRQ_EOI_VECTOR
Value to write to EOI register to clear interrupt in Hyperbus FSS module.
-
HYPERBUS_FSS_FSAS_GENREGS_STATUS_RAW_OFFSET
Offset of STATUS_RAW register in Hyperbus FSS module.
-
HYPERBUS_FSS_FSAS_GENREGS_IRQ_STATUS_OFFSET
Offset of IRQ status register in Hyperbus FSS module.
-
HYPERBUS_FSS_FSAS_GENREGS_IRQ_ENABLE_SET_OFFSET
Offset of IRQ enable set register in Hyperbus FSS module.
-
HYPERBUS_FSS_FSAS_GENREGS_IRQ_ENABLE_CLR_OFFSET
Offset of IRQ enable clear register in Hyperbus FSS module.
-
HYPERBUS_FSS_FSAS_GENREGS_IRQ_ENABLE_SET_VALUE
Value to write to IRQ enable set register to enable interrupts in Hyperbus FSS module.
-
HYPERBUS_FSS_FSAS_GENREGS_IRQ_ENABLE_CLR_VALUE
Value to write to IRQ enable clear register to disable interrupts in Hyperbus FSS module.
-
HYPERBUS_FSS_FSAS_ECC_REGION_START_OFFSET
Offset of ECC region start address register in Hyperbus FSS module.
-
HYPERBUS_FSS_FSAS_ECC_REGION_SIZE_OFFSET
Offset of ECC region size register in Hyperbus FSS module.
-
HYPERBUS_FSS_FSAS_ECC_REGION_OFFSET_STEP
Offset step to access ECC region start address and size registers.
-
HYPERBUS_FSS_FSAS_ECC_REGION_START_ADDR_SHIFT
Shift value to get ECC region start address in 4KBytes steps.
The offset is a 32-bit value that is divided by 4KBytes (0x1000). The result is the start address of the ECC region.
0x0 means the start address is 0 and the region is disabled 0x1 means the start address is 4KBytes 0xA means the start address is 40KBytes 0xF_FFFF means the start address is 4GBytes
-
HYPERBUS_FSS_FSAS_ECC_REGION_SIZE_SHIFT
Shift value to get ECC region size in 4KBytes steps.
The size is a 32-bit value that is divided by 4KBytes (0x1000). The result is the size of the ECC region.
0x0 means the size is 0 and the region is disabled 0x1 means the size is 4KBytes 0xA means the size is 40KBytes 0xF_FFFF means the size is 4GBytes
-
HYPERBUS_FSS_FSAS_NUM_ECC_REGIONS
Number of ECC regions supported by the Hyperbus FSS module.
-
HYPERBUS_FSS_FSAS_ECC_REGION0
First ECC region in Hyperbus FSS module (region 0)
Used to specify the first ECC region when configuring or selecting regions for ECC operations.
-
HYPERBUS_FSS_FSAS_ECC_REGION1
Second ECC region in Hyperbus FSS module (region 1)
Used to specify the second ECC region when configuring or selecting regions for ECC operations.
-
HYPERBUS_FSS_FSAS_ECC_REGION2
Third ECC region in Hyperbus FSS module (region 2)
Used to specify the third ECC region when configuring or selecting regions for ECC operations.
-
HYPERBUS_FSS_FSAS_ECC_REGION3
Fourth ECC region in Hyperbus FSS module (region 3)
Used to specify the fourth ECC region when configuring or selecting regions for ECC operations.
Typedefs
-
typedef void *HYPERBUS_Handle
A handle that is returned from a HYPERBUS_open() call.
-
typedef void (*HYPERBUS_ECCCallbackFxn)(HYPERBUS_Handle hyperbusHandle, uint8_t errorType)
The definition of a callback function used by the HYPERBUS driver when ECC error interrupts occur.
- Param hyperbusHandle:
HYPERBUS_Handle
- Param errorType:
Type of ECC error that occurred
Enums
Functions
-
void HYPERBUS_init(void)
This function initializes the HYPERBUS module.
-
void HYPERBUS_deinit(void)
This function de-initializes the HYPERBUS module.
-
HYPERBUS_Handle HYPERBUS_open(uint32_t index)
This function opens a given HYPERBUS peripheral.
See also
See also
- Parameters:
index – Index of config to use in the HYPERBUS_Config array
- Pre:
HYPERBUS controller has been initialized using HYPERBUS_init()
- Returns:
A HYPERBUS_Handle on success or a NULL on an error or if it has been opened already
-
void HYPERBUS_close(HYPERBUS_Handle handle)
Function to close a HYPERBUS peripheral specified by the HYPERBUS handle.
See also
- Parameters:
handle – HYPERBUS_Handle returned from HYPERBUS_open()
- Pre:
HYPERBUS_open() has to be called first
-
HYPERBUS_Handle HYPERBUS_getHandle(uint32_t index)
This function returns the handle of an open HYPERBUS Instance from the instance index.
See also
See also
- Parameters:
index – Index of config to use in the HYPERBUS_Config array
- Pre:
HYPERBUS controller has been opened using HYPERBUS_open()
- Returns:
An HYPERBUS_Handle if it has been opened already or NULL otherwise
-
uint32_t HYPERBUS_getHyperBusDataBaseAddr(HYPERBUS_Handle handle)
This function gets the SOC mapped data base address of the HyperRam.
- Parameters:
handle – An HYPERBUS_Handle returned from an HYPERBUS_open()
- Pre:
HYPERBUS controller has been opened using HYPERBUS_open()
- Returns:
Data BaseAddress of the HyperRam
-
static uint32_t HYPERBUS_makeMemCfg(HYPERBUS_Handle handle, HYPERBUS_MemCfg *pHyperBusMemCfg)
This function returns the memory configuration of the HYPERBUS Instance.
- Parameters:
handle – An HYPERBUS_Handle returned from an HYPERBUS_open()
pHyperBusMemCfg – An HYPERBUS_MemCfg to be filled
- Pre:
HYPERBUS controller has been opened using HYPERBUS_open()
- Returns:
memory configuration of the HYPERBUS Instance
-
static uint32_t HYPERBUS_makeMemTiming(HYPERBUS_Handle handle, HYPERBUS_MemTiming *pHyperBusMemTiming)
This function returns the memory Timings of the HYPERBUS Instance.
- Parameters:
handle – An HYPERBUS_Handle returned from an HYPERBUS_open()
pHyperBusMemTiming – An HYPERBUS_MemTiming to be filled
- Pre:
HYPERBUS controller has been opened using HYPERBUS_open()
- Returns:
memory Timings of the HYPERBUS Instance
-
static void HYPERBUS_isr(void *args)
This function is called by the HwiP module to service interrupts generated by the FSS of the HYPERBUS controller.
- Parameters:
args – Pointer to the HYPERBUS_Config structure associated with the interrupting HYPERBUS peripheral
-
int32_t HYPERBUS_configureECC(HYPERBUS_Handle handle)
This function configures the ECC regions for the HYPERBUS Instance.
- Parameters:
handle – An HYPERBUS_Handle returned from an HYPERBUS_open()
- Pre:
HYPERBUS controller has been opened using HYPERBUS_open()
- Returns:
0 on success else a negative value
-
int32_t HYPERBUS_setECCRegion(HYPERBUS_Handle handle, uint8_t region)
This function sets the ECC region for the HYPERBUS Instance.
- Parameters:
handle – An HYPERBUS_Handle returned from an HYPERBUS_open()
region – Region to be set, value should be one of the HYPERBUS_ECC_REGION defines
- Pre:
HYPERBUS controller has been opened using HYPERBUS_open()
- Returns:
0 on success else a negative value
-
int32_t HYPERBUS_enableECC(HYPERBUS_Handle handle, uint8_t enableFlag)
This function enables or disables ECC for the HYPERBUS Instance.
- Parameters:
handle – An HYPERBUS_Handle returned from an HYPERBUS_open()
enableFlag – Flag to enable or disable ECC, set to 1 to enable or 0 to disable
- Pre:
HYPERBUS controller has been opened using HYPERBUS_open()
- Returns:
0 on success else a negative value
-
int32_t HYPERBUS_clearECCError(HYPERBUS_Handle handle, uint8_t errorType)
This function clears the ECC error for the HYPERBUS Instance.
- Parameters:
handle – An HYPERBUS_Handle returned from an HYPERBUS_open()
errorType – Type of error to clear, value should be one of the HYPERBUS_ECC_ERROR_TYPE defines
- Pre:
HYPERBUS controller has been opened using HYPERBUS_open()
- Returns:
0 on success else a negative value
-
int32_t HYPERBUS_getECCErrorInfo(HYPERBUS_Handle handle, HYPERBUS_ECCErrorInfo *ECCErrorInfo)
This function returns the ECC error information for the HYPERBUS Instance.
- Parameters:
handle – An HYPERBUS_Handle returned from an HYPERBUS_open()
ECCErrorInfo – Pointer to the HYPERBUS_ECCErrorInfo structure to be filled
- Pre:
HYPERBUS controller has been opened using HYPERBUS_open()
- Returns:
0 on success else a negative value
Variables
-
HYPERBUS_Config gHyperBusConfig[]
Externally defined driver configuration array.
-
uint32_t gHyperBusConfigNum
Externally defined driver configuration array size.
-
HYPERBUS_ECCRegion gHyperBusEccRegion[HYPERBUS_FSS_FSAS_NUM_ECC_REGIONS]
-
struct HYPERBUS_ECCErrorInfo
- #include <hyperbus.h>
ECC Error Information structure.
This structure provides information about the ECC error
-
struct HYPERBUS_ECCRegions
- #include <hyperbus.h>
ECC region The structure specifies the ECC region start address and size.
-
struct HYPERBUS_ECCRegion
- #include <hyperbus.h>
Structure containing ECC region params.
-
struct HYPERBUS_MemCfg
- #include <hyperbus.h>
Memory Configuration Structure.
This structure holds the memory configuration settings for the HYPERBUS.
-
struct HYPERBUS_fssDataIf
- #include <hyperbus.h>
FSS Data Interface Structure.
This structure contains the global and local addresses of the data interface
-
struct HYPERBUS_fssHandle
- #include <hyperbus.h>
FSS Handle Structure.
This structure contains the base addresses of the configuration and data interface
-
struct HYPERBUS_MemTiming
- #include <hyperbus.h>
Register structure for the Memory Timing Register.
-
struct HYPERBUS_Params
- #include <hyperbus.h>
HYPERBUS Parameters.
HYPERBUS Parameters are used to with the HYPERBUS_open() call.
-
struct HYPERBUS_Attrs
- #include <hyperbus.h>
HYPERBUS instance attributes - used during init time.
-
struct HYPERBUS_Object
- #include <hyperbus.h>
HYPERBUS driver object.
-
struct HYPERBUS_Config
- #include <hyperbus.h>
HYPERBUS driver configuration structure.
This structure is used to pass configuration information to the HYPERBUS driver.
-
HYPERBUS_ECC_1B_ERROR