libctru  v1.6.0
Data Structures | Enumerations | Functions
pxidev.h File Reference

Gamecard PXI service. More...

#include <3ds/services/fs.h>

Go to the source code of this file.

Data Structures

struct  PXIDEV_SPIBuffer
 Card SPI transfer buffer. More...
 

Enumerations

enum  PXIDEV_WaitType {
  WAIT_NONE = 0,
  WAIT_SLEEP = 1,
  WAIT_IREQ_RETURN = 2,
  WAIT_IREQ_CONTINUE = 3
}
 Card SPI wait operation type. More...
 
enum  PXIDEV_DeassertType {
  DEASSERT_NONE = 0,
  DEASSERT_BEFORE_WAIT = 1,
  DEASSERT_AFTER_WAIT = 2
}
 Card SPI register deassertion type. More...
 

Functions

Result pxiDevInit (void)
 Initializes pxi:dev.
 
void pxiDevExit (void)
 Shuts down pxi:dev.
 
static u8 pxiDevMakeTransferOption (FS_CardSpiBaudRate baudRate, FS_CardSpiBusMode busMode)
 Creates a packed card SPI transfer option value. More...
 
static u64 pxiDevMakeWaitOperation (PXIDEV_WaitType waitType, PXIDEV_DeassertType deassertType, u64 timeout)
 Creates a packed card SPI wait operation value. More...
 
Result PXIDEV_SPIMultiWriteRead (PXIDEV_SPIBuffer *header, PXIDEV_SPIBuffer *writeBuffer1, PXIDEV_SPIBuffer *readBuffer1, PXIDEV_SPIBuffer *writeBuffer2, PXIDEV_SPIBuffer *readBuffer2, PXIDEV_SPIBuffer *footer)
 Performs multiple card SPI writes and reads. More...
 
Result PXIDEV_SPIWriteRead (u32 *bytesRead, u64 initialWaitOperation, PXIDEV_SPIBuffer *writeBuffer, PXIDEV_SPIBuffer *readBuffer)
 Performs a single card SPI write and read. More...
 

Detailed Description

Gamecard PXI service.

Enumeration Type Documentation

◆ PXIDEV_DeassertType

Card SPI register deassertion type.

Enumerator
DEASSERT_NONE 

Do not deassert.

DEASSERT_BEFORE_WAIT 

Deassert before waiting.

DEASSERT_AFTER_WAIT 

Deassert after waiting.

◆ PXIDEV_WaitType

Card SPI wait operation type.

Enumerator
WAIT_NONE 

Do not wait.

WAIT_SLEEP 

Sleep for the specified number of nanoseconds.

WAIT_IREQ_RETURN 

Wait for IREQ, return if timeout.

WAIT_IREQ_CONTINUE 

Wait for IREQ, continue if timeout.

Function Documentation

◆ PXIDEV_SPIMultiWriteRead()

Result PXIDEV_SPIMultiWriteRead ( PXIDEV_SPIBuffer header,
PXIDEV_SPIBuffer writeBuffer1,
PXIDEV_SPIBuffer readBuffer1,
PXIDEV_SPIBuffer writeBuffer2,
PXIDEV_SPIBuffer readBuffer2,
PXIDEV_SPIBuffer footer 
)

Performs multiple card SPI writes and reads.

Parameters
headerHeader to lead the transfers with. Must be, at most, 8 bytes in size.
writeBuffer1Buffer to make first transfer from.
readBuffer1Buffer to receive first response to.
writeBuffer2Buffer to make second transfer from.
readBuffer2Buffer to receive second response to.
footerFooter to follow the transfers with. Must be, at most, 8 bytes in size. Wait operation is unused.

◆ PXIDEV_SPIWriteRead()

Result PXIDEV_SPIWriteRead ( u32 bytesRead,
u64  initialWaitOperation,
PXIDEV_SPIBuffer writeBuffer,
PXIDEV_SPIBuffer readBuffer 
)

Performs a single card SPI write and read.

Parameters
bytesReadPointer to output the number of bytes received to.
initialWaitOperationWait operation to perform before transferring data.
writeBufferBuffer to transfer data from.
readBufferBuffer to receive data to.

◆ pxiDevMakeTransferOption()

static u8 pxiDevMakeTransferOption ( FS_CardSpiBaudRate  baudRate,
FS_CardSpiBusMode  busMode 
)
inlinestatic

Creates a packed card SPI transfer option value.

Parameters
baudRateBaud rate to use when transferring.
busModeBus mode to use when transferring.
Returns
A packed card SPI transfer option value.

◆ pxiDevMakeWaitOperation()

static u64 pxiDevMakeWaitOperation ( PXIDEV_WaitType  waitType,
PXIDEV_DeassertType  deassertType,
u64  timeout 
)
inlinestatic

Creates a packed card SPI wait operation value.

Parameters
waitTypeType of wait to perform.
deassertTypeType of register deassertion to perform.
timeoutTimeout, in nanoseconds, to wait, if applicable.
Returns
A packed card SPI wait operation value.