Aviate Audio Multiverse Library
Public Member Functions | Public Attributes | List of all members
Aviate::SramMemSlot Class Reference

This object is used for data transfers to/from the external SPI SRAM. More...

#include <SramManager.h>

Public Member Functions

 SramMemSlot ()
 constructor
 
bool clear ()
 clear the entire contents of the slot by writing zeros More...
 
bool isUseDma () const
 check if SRAM is using DMA for transfers More...
 
bool isWriteBusy () const
 Check if a DMA write is still pending or in progress. More...
 
bool isReadBusy () const
 Check if a DMA read is complete and data is available. More...
 
size_t size ()
 Get the size of the memory slot in bytes. More...
 
bool setWritePosition (size_t offsetBytes)
 set a new write position (in bytes) for circular operation More...
 
size_t getWritePosition () const
 returns the currently set write pointer pointer More...
 
bool setReadPosition (size_t offsetBytes)
 set a new read position (in bytes) for circular operation More...
 
size_t getReadPosition () const
 returns the currently set read pointer pointer More...
 
bool zero (size_t offsetBytes, size_t numBytes)
 Write a block of zeros (8-bit) to the memory at the specified offset. More...
 
bool write (size_t offsetBytes, uint8_t *src, size_t numBytes)
 Write a block of 8-bit data to the memory at the specified offset. More...
 
bool read (size_t offsetBytes, uint8_t *dest, size_t numBytes)
 Read a block of 8-bit data from the memory at the specified location. More...
 
bool zeroAdvance (size_t numBytes)
 Write a block of 16-bit data zeros in circular operation. More...
 
bool writeAdvance (uint8_t data)
 Write a single 16-bit data to the next location in circular operation. More...
 
bool writeAdvance (uint8_t *src, size_t numBytes)
 Write a block of 16-bit data from the specified location in circular operation. More...
 
uint8_t readAdvance ()
 Read the next byte in memory during circular operation. More...
 
bool readAdvance (uint8_t *dest, size_t numBytes)
 Read the next block of numWords during circular operation. More...
 
bool zero16 (size_t offsetWords, size_t numWords)
 Write a block of zeros (16-bit) to the memory at the specified offset. More...
 
bool write16 (size_t offsetWords, int16_t *src, size_t numWords)
 Write a block of 16-bit data to the memory at the specified offset. More...
 
bool read16 (size_t offsetWords, int16_t *dest, size_t numWords)
 Read a block of 16-bit data from the memory at the specified location. More...
 
bool zeroAdvance16 (size_t numWords)
 Write a block of 16-bit data zeros in circular operation. More...
 
bool writeAdvance16 (int16_t *src, size_t numWords)
 Write a block of 16-bit data from the specified location in circular operation. More...
 
bool writeAdvance16 (int16_t data)
 Write a single 16-bit data to the next location in circular operation. More...
 
uint16_t readAdvance16 ()
 Read the next in memory during circular operation. More...
 
bool readAdvance16 (int16_t *dest, size_t numWords)
 Read the next block of numWords during circular operation. More...
 
bool enable () const
 Ensures the underlying SPI interface is enabled. More...
 
bool isEnabled () const
 Checks whether underlying SPI interface is enabled. More...
 

Public Attributes

friend SramManager
 SramManager is a friend of this class.
 
friend AudioDelay
 AudioDelay is a friend of this class.
 

Detailed Description

This object is used for data transfers to/from the external SPI SRAM.

Member Function Documentation

◆ clear()

bool Aviate::SramMemSlot::clear ( )

clear the entire contents of the slot by writing zeros

Returns
true on success

◆ enable()

bool Aviate::SramMemSlot::enable ( ) const

Ensures the underlying SPI interface is enabled.

Returns
true on success, false on error

◆ getReadPosition()

size_t Aviate::SramMemSlot::getReadPosition ( ) const

returns the currently set read pointer pointer

Returns
the read position value

◆ getWritePosition()

size_t Aviate::SramMemSlot::getWritePosition ( ) const

returns the currently set write pointer pointer

Returns
the write position value

◆ isEnabled()

bool Aviate::SramMemSlot::isEnabled ( ) const

Checks whether underlying SPI interface is enabled.

Returns
true if enabled, false if not enabled

◆ isReadBusy()

bool Aviate::SramMemSlot::isReadBusy ( ) const

Check if a DMA read is complete and data is available.

Returns
true if read data is available, false if transfers are outstanding

◆ isUseDma()

bool Aviate::SramMemSlot::isUseDma ( ) const

check if SRAM is using DMA for transfers

Returns
true if DMA is in use, otherwise false

◆ isWriteBusy()

bool Aviate::SramMemSlot::isWriteBusy ( ) const

Check if a DMA write is still pending or in progress.

Returns
true when write had been completed, otherwise false

◆ read()

bool Aviate::SramMemSlot::read ( size_t  offsetBytes,
uint8_t *  dest,
size_t  numBytes 
)

Read a block of 8-bit data from the memory at the specified location.

Parameters
offsetBytesoffset in 8-bit bytes from start of slot
destpointer to destination for the read data
numBytesnumber of 8-bit bytes to transfer
Returns
true on success, else false on error

◆ read16()

bool Aviate::SramMemSlot::read16 ( size_t  offsetWords,
int16_t *  dest,
size_t  numWords 
)

Read a block of 16-bit data from the memory at the specified location.

Parameters
offsetWordsoffset in 16-bit words from start of slot
destpointer to destination for the read data
numWordsnumber of 16-bit words to transfer
Returns
true on success, else false on error

◆ readAdvance() [1/2]

uint8_t Aviate::SramMemSlot::readAdvance ( )

Read the next byte in memory during circular operation.

Returns
the next 8-bit data word in memory

◆ readAdvance() [2/2]

bool Aviate::SramMemSlot::readAdvance ( uint8_t *  dest,
size_t  numBytes 
)

Read the next block of numWords during circular operation.

, dest is ignored when using DMA

Parameters
destpointer to the destination of the read.
numBytesnumber of 16-bit words to transfer
Returns
true on success, else false on error

◆ readAdvance16() [1/2]

uint16_t Aviate::SramMemSlot::readAdvance16 ( )

Read the next in memory during circular operation.

Returns
the next 16-bit data word in memory

◆ readAdvance16() [2/2]

bool Aviate::SramMemSlot::readAdvance16 ( int16_t *  dest,
size_t  numWords 
)

Read the next block of numWords during circular operation.

, dest is ignored when using DMA

Parameters
destpointer to the destination of the read.
numWordsnumber of 16-bit words to transfer
Returns
true on success, else false on error

◆ setReadPosition()

bool Aviate::SramMemSlot::setReadPosition ( size_t  offsetBytes)

set a new read position (in bytes) for circular operation

Parameters
offsetBytesmoves the read pointer to the specified offset from the slot start
Returns
true on success, else false if offset is beyond slot boundaries.

◆ setWritePosition()

bool Aviate::SramMemSlot::setWritePosition ( size_t  offsetBytes)

set a new write position (in bytes) for circular operation

Parameters
offsetBytesmoves the write pointer to the specified offset from the slot start
Returns
true on success, else false if offset is beyond slot boundaries.

◆ size()

size_t Aviate::SramMemSlot::size ( )

Get the size of the memory slot in bytes.

Returns
slot size in bytes

◆ write()

bool Aviate::SramMemSlot::write ( size_t  offsetBytes,
uint8_t *  src,
size_t  numBytes 
)

Write a block of 8-bit data to the memory at the specified offset.

Parameters
offsetBytesoffset in 8-bit bytes from start of slot
srcpointer to start of block of 16-bit data
numBytesnumber of 8-bit bytes to transfer
Returns
true on success, else false on error

◆ write16()

bool Aviate::SramMemSlot::write16 ( size_t  offsetWords,
int16_t *  src,
size_t  numWords 
)

Write a block of 16-bit data to the memory at the specified offset.

Parameters
offsetWordsoffset in 16-bit words from start of slot
srcpointer to start of block of 16-bit data
numWordsnumber of 16-bit words to transfer
Returns
true on success, else false on error

◆ writeAdvance() [1/2]

bool Aviate::SramMemSlot::writeAdvance ( uint8_t *  src,
size_t  numBytes 
)

Write a block of 16-bit data from the specified location in circular operation.

Parameters
srcpointer to the start of the block of data to write to memory
numBytesnumber of 16-bit words to transfer
Returns
true on success, else false on error

◆ writeAdvance() [2/2]

bool Aviate::SramMemSlot::writeAdvance ( uint8_t  data)

Write a single 16-bit data to the next location in circular operation.

Parameters
datathe 16-bit word to transfer
Returns
true on success, else false on error

◆ writeAdvance16() [1/2]

bool Aviate::SramMemSlot::writeAdvance16 ( int16_t *  src,
size_t  numWords 
)

Write a block of 16-bit data from the specified location in circular operation.

Parameters
srcpointer to the start of the block of data to write to memory
numWordsnumber of 16-bit words to transfer
Returns
true on success, else false on error

◆ writeAdvance16() [2/2]

bool Aviate::SramMemSlot::writeAdvance16 ( int16_t  data)

Write a single 16-bit data to the next location in circular operation.

Parameters
datathe 16-bit word to transfer
Returns
true on success, else false on error

◆ zero()

bool Aviate::SramMemSlot::zero ( size_t  offsetBytes,
size_t  numBytes 
)

Write a block of zeros (8-bit) to the memory at the specified offset.

Parameters
offsetBytesoffset in 8-bit bytes from start of slot
numBytesnumber of 8-bit bytes to transfer
Returns
true on success, else false on error

◆ zero16()

bool Aviate::SramMemSlot::zero16 ( size_t  offsetWords,
size_t  numWords 
)

Write a block of zeros (16-bit) to the memory at the specified offset.

Parameters
offsetWordsoffset in 16-bit words from start of slot
numWordsnumber of 16-bit words to transfer
Returns
true on success, else false on error

◆ zeroAdvance()

bool Aviate::SramMemSlot::zeroAdvance ( size_t  numBytes)

Write a block of 16-bit data zeros in circular operation.

Parameters
numBytesnumber of 16-bit words to transfer
Returns
true on success, else false on error

◆ zeroAdvance16()

bool Aviate::SramMemSlot::zeroAdvance16 ( size_t  numWords)

Write a block of 16-bit data zeros in circular operation.

Parameters
numWordsnumber of 16-bit words to transfer
Returns
true on success, else false on error

The documentation for this class was generated from the following file: