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

enum 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

enum 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

  header | Header to lead the transfers with. Must be, at most, 8 bytes in size.
  writeBuffer1 | Buffer to make first transfer from.
  readBuffer1 | Buffer to receive first response to.
  writeBuffer2 | Buffer to make second transfer from.
  readBuffer2 | Buffer to receive second response to.
  footer | Footer 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

  bytesRead | Pointer to output the number of bytes received to.
  initialWaitOperation | Wait operation to perform before transferring data.
  writeBuffer | Buffer to transfer data from.
  readBuffer | Buffer to receive data to.

## pxiDevMakeTransferOption()

static u8 pxiDevMakeTransferOption | ( | FS_CardSpiBaudRate | baudRate,
|  | FS_CardSpiBusMode | busMode
| ) |  |

inlinestatic

Creates a packed card SPI transfer option value.

Parameters

  baudRate | Baud rate to use when transferring.
  busMode | Bus 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

  waitType | Type of wait to perform.
  deassertType | Type of register deassertion to perform.
  timeout | Timeout, in nanoseconds, to wait, if applicable.

Returns
  A packed card SPI wait operation value.