1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html> 3 4<head> 5<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 6<META http-equiv="Content-Style-Type" content="text/css"> 7<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css"> 8<title>PMICInitEx</title> 9</head> 10 11<body> 12 13<h1>PMICInitEx</h1> 14 15<h2>Syntax</h2> 16<dl><dd><pre class="construction"> 17#include <revolution/pmic.h> 18 19// Working area size on MEM2 that the PMIC library uses 20#define PMIC_MEM2_WORK 17408 // 17 KB 21 22#define PMIC_READ_BUFFER_MSEC (48) // 48 msec 23#define PMIC_READ_BUFFER_SAMPLES (PMIC_READ_BUFFER_MSEC * 16) // @16 kHz, @mono 24#define PMIC_READ_BUFFER_SIZE (PMIC_READ_BUFFER_SAMPLES * sizeof(s16)) // @s16 25 26PMIC_ERR PMICInitEx(void* mem2, s32 size); 27</pre></dd></dl> 28 29<h2>Arguments</h2> 30<TABLE class="arguments" border="1" > 31 <tr> 32<th>mem2</th> 33<td>Starting address of the work region allocated in MEM2 for the PMIC library.</td> 34 </tr> 35 <tr> 36<th>size</th> 37<td>Size of the buffer for the audio data obtained from the Wii Speak.</td> 38 </tr> 39</TABLE> 40 41<h2>Return Values</h2> 42<p> 43Returns one of the following. 44</p> 45 46<TABLE class="arguments" border="1" > 47 <tr> 48<th>PMIC_ERR_OK</th> 49<td>The library has been initialized normally.</td> 50 </tr> 51 <tr> 52<th>PMIC_ERR_INVALID_ARGUMENTS</th> 53<td>The correct argument was not passed.</td> 54 </tr> 55 <tr> 56<th>PMIC_ERR_BUSY</th> 57<td>The state is in transition. Call the function again.</td> 58 </tr> 59 <tr> 60<th>PMIC_ERR_FATAL</th> 61<td>A fatal error has occurred.</td> 62 </tr> 63</TABLE> 64 65<H2>Description</H2> 66<p>Initializes the PMIC library. This function must be called once before using any other PMIC functions.</p> 67 68<p>When the PMIC library is initialized, it will allocate work buffers, including one for audio data obtained from the Wii Speak and one for reference data to send to the Wii Speak, in the region specified by <SPAN class="argument">mem2</SPAN>. If you use this function to initialize the library, you can assign an arbitrary size to the buffer for audio data obtained from the Wii Speak.</p> 69 70<p>For example, assume that we will use a buffer for 96 ms of audio data, which is twice the default 48 ms used when the <code>PMICInit</code> function initializes the library.</p> 71 72<dl><dd><pre class="construction"> 73PMIC_MEM2_WORK - PMIC_READ_BUFFER_SIZE + 96 * 16 * sizeof(s16) // Bytes 74</pre></dd></dl> 75 76<p>A region of the size above would need to be allocated in MEM2 and then passed to this function as its first argument, <SPAN class="argument">mem2</SPAN>. In this case a value of <code>96*16*sizeof(s16)</code> would be passed to the second argument, <SPAN class="argument">size</SPAN>.</p> 77 78<p><B>Note: The default work size <code>PMIC_MEM2_WORK</code> includes the default audio data buffer for 48 milliseconds' worth of data.</B></p> 79 80<p>After calling this function, be sure to call the <code>PMICProbe</code> function once before calling the <code>PMICOpen(Async)</code> functions.</p> 81 82<H2>See Also</H2> 83<p> 84<a href="PMICInit.html"><CODE>PMICInit</CODE></a><BR> <a href="PMICProbe.html"><CODE>PMICProbe</CODE></a><BR> <a href="PMICOpen.html"><CODE>PMICOpen</CODE></a><BR> <a href="PMICOpenAsync.html"><CODE>PMICOpenAsync</CODE></a><BR> <a href="PMICRead.html"><CODE>PMICRead</CODE></a> 85</p> 86 87<H2>Revision History</H2> 88<p> 892009/06/01 Added description related to calling <code>PMICProbe</code>.<br>2008/11/04 Added <B>Description</B>.<br>2008/10/21 Initial version. 90</p> 91 92<hr><p>CONFIDENTIAL</p></body> 93 94</html> 95