PAlib
Data Structures | Macros | Enumerations | Functions | Variables
General Functions

Data Structures

struct  PA_FifoMsg
 Represents a message sent through Fifo. More...
 
struct  PA_TransferRegion
 PAlib transfer region type. More...
 

Macros

#define FIFO_PALIB   FIFO_USER_08
 PAlib Fifo channel number...
 
#define PA_SendFifoMsg(msg)   fifoSendDatamsg(FIFO_PALIB, sizeof(PA_FifoMsg), (u8*) &msg)
 Send a PA_FifoMsg structure to the other CPU.
 
#define PA_SendFifoVal(val)   fifoSendValue32(FIFO_PALIB, val)
 Send a 32bit value to the other CPU.
 
#define PA_SendFifoCmd   PA_SendFifoVal
 Send a command value to the other CPU (same as PA_SendFifoVal but for readability).
 
#define PA_GetFifoMsg(msg, bytes)   fifoGetDatamsg(FIFO_PALIB, bytes, (u8*) &msg)
 Receive a PA_FifoMsg structure from the other CPU.
 
#define PA_FifoRetWait()   while(!fifoCheckValue32(FIFO_PALIB))
 Wait for the other CPU to send a return value.
 
#define PA_FifoRetVal()   fifoGetValue32(FIFO_PALIB)
 Get the other CPU's return value.
 
#define PA_LegacyIPCInit()
 [DEPRECATED] Initialize the legacy IPC system.
 
#define PA_LidClosed()   _PA_LidDown
 Check if the DS is closed. Returns 0 if open, 1 if closed.
 
#define PA_CloseLidSound(close_sound)
 Check if the DS is closed. If closed, it pauses the DS, and plays a sound.
 
#define PA_CloseLidSound2(close_sound, open_sound)
 Check if the DS is closed. If closed, it pauses the DS, and plays a sound. The sound system must be initialized before.
 
#define PA_WaitFor(something)   do{while(!(something)) PA_WaitForVBL();}while(0)
 Wait for a specific thing to happen...
 

Enumerations

enum  {
  PA_MSG_INPUT = 0x7000 , PA_MSG_MIC = 0x7100 , PA_MSG_DSLBRIGHT = 0x7102 , PA_MSG_PSG = 0x7103 ,
  PA_SHARED_MEM_SET = 0x7104
}
 PA_FifoMsg message types. More...
 
enum  { PA_MSG_MICSTOP = 0x7101 }
 PA_SendFifoCmd() commands. More...
 

Functions

static u32 PA_FifoGetRetVal ()
 Inline function to ease the getting of the return value (wait + get)
 
void PA_Init ()
 Initialise the library. Should be used at the beginning of main()
 
void PA_InitFifo ()
 Initialize the Fifo system. It is automatically done in PA_Init().
 
void PA_Init2D ()
 Resets to 2D state after using 3D functions.
 
void PA_SetVideoMode (u8 screen, u8 mode)
 Change the video mode... Use this with caution.
 
void PA_UpdateUserInfo (void)
 Updates the user info. This is automatically done in PA_Init. You can then get any info with the following variables : PA_UserInfo.Color (favorite color), .BdayDay, .BdayMonth, .AlarmHour, .AlarmMinute, .Name, .NameLength, .Message, .MessageLength, .Language.
 
void PA_UpdateRTC (void)
 Updates the Real Time Clock, with info on the current date and hour. Automatically updated in the PA VBL... Get the info with PA_RTC.Minutes, .Hour, .Seconds, .Day, .Month, and .Year.
 
static void PA_SwitchScreens ()
 Switch the bottom and top screens...
 
static void PA_SetAutoCheckLid (u8 on)
 Automatically check if the DS is closed in PA_WaitForVBL.
 
static void PA_SetLedBlink (u8 blink, u8 speed)
 Set teh DS Led blinking.
 
u8 PA_CheckLid ()
 Check if the DS is closed. If closed, it pauses the DS, and returns 1.
 
static void PA_WaitForVBL ()
 Wait for the VBlank to occur.
 
static void PA_SetScreenLight (u8 screen, u8 light)
 Set on or off the screen's light.
 
static void PA_SetDSLBrightness (u8 level)
 Set the DS Lite Light level...
 
bool PA_Locate (char *start, char *target, bool isDir, int depth, char *result)
 Find a directory in the file system within a given depth.
 
void PA_Error (const char *text)
 Displays an error message.
 

Variables

volatile PA_TransferRegion *volatile PA_Transfer
 PAlib transfer region (used for the storage of data coming from the ARM7). libnds also does this. As TransferRegion was removed we just skip the first 256 bytes.
 

Detailed Description

Initialise the lib, and other general functions...

Macro Definition Documentation

◆ PA_LegacyIPCInit

#define PA_LegacyIPCInit ( )
Value:
do{ \
memset((void*) &PA_IPC, 0, sizeof(PA_IPCType)); \
PA_Transfer->mailData = (u32)(&PA_IPC); \
}while(0)
volatile PA_TransferRegion *volatile PA_Transfer
PAlib transfer region (used for the storage of data coming from the ARM7). libnds also does this....
LEGACY vuint32 mailData
Legacy IPC field.
Definition PA_Transfer.h:33

[DEPRECATED] Initialize the legacy IPC system.

Deprecated:

◆ PA_CloseLidSound

#define PA_CloseLidSound (   close_sound)
Value:
do{\
if(PA_LidClosed()){\
PA_PlaySimpleSound(close_sound);\
PA_CheckLid(); \
}}while(0)
#define PA_LidClosed()
Check if the DS is closed. Returns 0 if open, 1 if closed.
Definition PA_General.h:258

Check if the DS is closed. If closed, it pauses the DS, and plays a sound.

Parameters
close_soundSound to play, check the sounds doc if you're not sure what to do here

◆ PA_CloseLidSound2

#define PA_CloseLidSound2 (   close_sound,
  open_sound 
)
Value:
do{\
if(PA_LidClosed()){\
PA_PlaySimpleSound(close_sound);\
PA_CheckLid(); \
PA_PlaySimpleSound(open_sound); \
}}while(0)

Check if the DS is closed. If closed, it pauses the DS, and plays a sound. The sound system must be initialized before.

Parameters
close_soundSound to play when closes, check the sounds doc if you're not sure what to do here
open_soundSound to play when opens, check the sounds doc if you're not sure what to do here

◆ PA_WaitFor

#define PA_WaitFor (   something)    do{while(!(something)) PA_WaitForVBL();}while(0)

Wait for a specific thing to happen...

Parameters
somethingThing to wait for, like Pad.Newpress.A, or Stylus.Newpress, etc...

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

PA_FifoMsg message types.

Enumerator
PA_MSG_INPUT 

Input message (ARM7->ARM9)

PA_MSG_MIC 

Microphone record message (ARM9->ARM7)

PA_MSG_DSLBRIGHT 

DS lite screen brightness message (ARM9->ARM7)

PA_MSG_PSG 

PSG play message (ARM9->ARM7)

PA_SHARED_MEM_SET 

Sends a memory buffer to the ARM7 to be used as shared memory.

◆ anonymous enum

anonymous enum

PA_SendFifoCmd() commands.

Enumerator
PA_MSG_MICSTOP 

Microphone stop recording message (ARM9->ARM7)

Function Documentation

◆ PA_SetVideoMode()

void PA_SetVideoMode ( u8  screen,
u8  mode 
)

Change the video mode... Use this with caution.

Parameters
screenScreen...
modeMode 0 for normal, 1 for 1 rotating backgrounds, 2 for 2
Examples
Backgrounds/Effects/Mode7/source/main.c.

◆ PA_SetAutoCheckLid()

static inline void PA_SetAutoCheckLid ( u8  on)
inlinestatic

Automatically check if the DS is closed in PA_WaitForVBL.

Parameters
on1 for on, 0 for off

◆ PA_SetLedBlink()

static void PA_SetLedBlink ( u8  blink,
u8  speed 
)
inlinestatic

Set teh DS Led blinking.

Parameters
blink1 for blinking, 0 for always on
speedSpeed : 0 for slow, 1 for fast

◆ PA_SetScreenLight()

void PA_SetScreenLight ( u8  screen,
u8  light 
)
inlinestatic

Set on or off the screen's light.

Parameters
screenScreen...
lightLight, 1 for on, 0 for off

◆ PA_SetDSLBrightness()

static inline void PA_SetDSLBrightness ( u8  level)
inlinestatic

Set the DS Lite Light level...

Parameters
levelLight level (0-3)

◆ PA_Locate()

bool PA_Locate ( char *  start,
char *  target,
bool  isDir,
int  depth,
char *  result 
)

Find a directory in the file system within a given depth.

Parameters
startfrom which directory to start, use "/" to search from the root
targetwhat to look for: the name of a file or directory
isDirlook for a directory or a file?
depthhow much depth level (in number of directories) to traverse; limiting this speeds up the search on crowded cards. A reasonable value is, for example, 3.
resultpointer to a buffer where the result will be stored
Returns
true if the target was found