mirror of https://github.com/AxioDL/jbus.git
156 lines
58 KiB
HTML
156 lines
58 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
|
<meta name="generator" content="Doxygen 1.8.11"/>
|
|
<title>JBus: include/jbus/Endpoint.hpp Source File</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
<link href="navtree.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="resize.js"></script>
|
|
<script type="text/javascript" src="navtreedata.js"></script>
|
|
<script type="text/javascript" src="navtree.js"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(initResizable);
|
|
$(window).load(resizeHeight);
|
|
</script>
|
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="search/searchdata.js"></script>
|
|
<script type="text/javascript" src="search/search.js"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(function() { init_search(); });
|
|
</script>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr style="height: 56px;">
|
|
<td id="projectalign" style="padding-left: 0.5em;">
|
|
<div id="projectname">JBus
|
|
</div>
|
|
<div id="projectbrief">JoyBus communication server</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.11 -->
|
|
<script type="text/javascript">
|
|
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
|
</script>
|
|
<div id="navrow1" class="tabs">
|
|
<ul class="tablist">
|
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
|
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
|
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
|
<li>
|
|
<div id="MSearchBox" class="MSearchBoxInactive">
|
|
<span class="left">
|
|
<img id="MSearchSelect" src="search/mag_sel.png"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
alt=""/>
|
|
<input type="text" id="MSearchField" value="Search" accesskey="S"
|
|
onfocus="searchBox.OnSearchFieldFocus(true)"
|
|
onblur="searchBox.OnSearchFieldFocus(false)"
|
|
onkeyup="searchBox.OnSearchFieldChange(event)"/>
|
|
</span><span class="right">
|
|
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
|
|
</span>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div id="navrow2" class="tabs2">
|
|
<ul class="tablist">
|
|
<li><a href="files.html"><span>File List</span></a></li>
|
|
</ul>
|
|
</div>
|
|
</div><!-- top -->
|
|
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
|
<div id="nav-tree">
|
|
<div id="nav-tree-contents">
|
|
<div id="nav-sync" class="sync"></div>
|
|
</div>
|
|
</div>
|
|
<div id="splitbar" style="-moz-user-select:none;"
|
|
class="ui-resizable-handle">
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
$(document).ready(function(){initNavTree('Endpoint_8hpp_source.html','');});
|
|
</script>
|
|
<div id="doc-content">
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
</div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<iframe src="javascript:void(0)" frameborder="0"
|
|
name="MSearchResults" id="MSearchResults">
|
|
</iframe>
|
|
</div>
|
|
|
|
<div class="header">
|
|
<div class="headertitle">
|
|
<div class="title">Endpoint.hpp</div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<a href="Endpoint_8hpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="preprocessor">#ifndef JBUS_ENDPOINT_HPP</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="preprocessor">#define JBUS_ENDPOINT_HPP</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> </div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="preprocessor">#include "<a class="code" href="Common_8hpp.html">Common.hpp</a>"</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="preprocessor">#include "<a class="code" href="Socket_8hpp.html">Socket.hpp</a>"</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="preprocessor">#include "optional.hpp"</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="preprocessor">#include <thread></span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="preprocessor">#include <mutex></span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="preprocessor">#include <condition_variable></span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> </div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> <span class="keyword">namespace </span><a class="code" href="namespacejbus.html">jbus</a></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> {</div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> </div><div class="line"><a name="l00016"></a><span class="lineno"><a class="line" href="classjbus_1_1Endpoint.html"> 16</a></span> <span class="keyword">class </span><a class="code" href="classjbus_1_1Endpoint.html">Endpoint</a></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span> {</div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span>  <span class="keyword">class </span>KawasedoChallenge</div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span>  {</div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  <span class="keyword">struct </span>DSPSecParms</div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  {</div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  <span class="comment">/* Nonce challenge (first read from GBA, hence already little-endian) */</span></div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  <a class="code" href="namespacejbus.html#ae4a7d015f3b8913ec0b563caa0a53221">u32</a> x0_gbaChallenge;</div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span> </div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  <span class="comment">/* Palette of pulsing logo on GBA during transmission [0,6] */</span></div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  <a class="code" href="namespacejbus.html#ae4a7d015f3b8913ec0b563caa0a53221">u32</a> x4_logoPalette;</div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span> </div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  <span class="comment">/* Speed and direction of palette interpolation [-4,4] */</span></div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  <a class="code" href="namespacejbus.html#ae4a7d015f3b8913ec0b563caa0a53221">u32</a> x8_logoSpeed;</div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span> </div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span>  <span class="comment">/* Length of JoyBoot program to upload */</span></div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  <a class="code" href="namespacejbus.html#ae4a7d015f3b8913ec0b563caa0a53221">u32</a> xc_progLength;</div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span> </div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  <span class="comment">/* Unwrapped public key */</span></div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span>  <a class="code" href="namespacejbus.html#ae4a7d015f3b8913ec0b563caa0a53221">u32</a> x20_publicKey;</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span> </div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  <span class="comment">/* Message authentication code */</span></div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  <a class="code" href="namespacejbus.html#ae4a7d015f3b8913ec0b563caa0a53221">u32</a> x24_authInitCode;</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span> </div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  <span class="keywordtype">void</span> ProcessGBACrypto()</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  {</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  <span class="comment">/* Unwrap key from challenge using 'sedo' magic number (to encrypt JoyBoot program) */</span></div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  x20_publicKey = x0_gbaChallenge ^ 0x6f646573;</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span> </div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span>  <span class="comment">/* Pack palette parameters */</span></div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  <a class="code" href="namespacejbus.html#aff2760609de15f92daafbdff7be79b33">u16</a> paletteSpeedCoded;</div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  <a class="code" href="namespacejbus.html#aa767fe4f71e145e2c0b12eccbeb83071">s16</a> logoSpeed = <span class="keyword">static_cast<</span><a class="code" href="namespacejbus.html#a416b65eae1b2ff9ab63c4c71ff857ea4">s8</a><span class="keyword">></span>(x8_logoSpeed);</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  <span class="keywordflow">if</span> (logoSpeed < 0)</div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  paletteSpeedCoded = ((-logoSpeed + 2) * 2) | (x4_logoPalette << 4);</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  <span class="keywordflow">else</span> <span class="keywordflow">if</span> (logoSpeed == 0)</div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  paletteSpeedCoded = (x4_logoPalette * 2) | 0x70;</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  <span class="keywordflow">else</span> <span class="comment">/* logo_speed > 0 */</span></div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  paletteSpeedCoded = ((logoSpeed - 1) * 2) | (x4_logoPalette << 4);</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span> </div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  <span class="comment">/* JoyBoot ROMs start with a padded header; this is the length beyond that header */</span></div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  <a class="code" href="namespacejbus.html#a33e5022738a0799c066372ce74d04c37">s32</a> lengthNoHeader = ROUND_UP_8(xc_progLength) - 0x200;</div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span> </div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  <span class="comment">/* The JoyBus protocol transmits in 4-byte packets while flipping a state flag;</span></div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span> <span class="comment"> * so the GBA BIOS counts the program length in 8-byte packet-pairs */</span></div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  <a class="code" href="namespacejbus.html#aff2760609de15f92daafbdff7be79b33">u16</a> packetPairCount = (lengthNoHeader < 0) ? 0 : lengthNoHeader / 8;</div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  paletteSpeedCoded |= (packetPairCount & 0x4000) >> 14;</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span> </div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span>  <span class="comment">/* Pack together encoded transmission parameters */</span></div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  <a class="code" href="namespacejbus.html#ae4a7d015f3b8913ec0b563caa0a53221">u32</a> t1 = (((packetPairCount << 16) | 0x3f80) & 0x3f80ffff) * 2;</div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  t1 += (<span class="keyword">static_cast<</span><a class="code" href="namespacejbus.html#aa767fe4f71e145e2c0b12eccbeb83071">s16</a><span class="keyword">></span>(<span class="keyword">static_cast<</span><a class="code" href="namespacejbus.html#a416b65eae1b2ff9ab63c4c71ff857ea4">s8</a><span class="keyword">></span>(t1 >> 8)) & packetPairCount) << 16;</div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  <a class="code" href="namespacejbus.html#ae4a7d015f3b8913ec0b563caa0a53221">u32</a> t2 = ((paletteSpeedCoded & 0xff) << 16) + (t1 & 0xff0000) + ((t1 >> 8) & 0xffff00);</div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  <a class="code" href="namespacejbus.html#ae4a7d015f3b8913ec0b563caa0a53221">u32</a> t3 = paletteSpeedCoded << 16 | ((t2 << 8) & 0xff000000) | (t1 >> 16) | 0x80808080;</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span> </div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  <span class="comment">/* Wrap with 'Kawa' or 'sedo' (Kawasedo is the author of the BIOS cipher) */</span></div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  x24_authInitCode = t3 ^ ((t3 & 0x200) != 0 ? 0x6f646573 : 0x6177614b);</div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  }</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  } xf8_dspHmac;</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span> </div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  <a class="code" href="namespacejbus.html#a33e5022738a0799c066372ce74d04c37">s32</a> x0_pColor;</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  <a class="code" href="namespacejbus.html#a33e5022738a0799c066372ce74d04c37">s32</a> x4_pSpeed;</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  <span class="keyword">const</span> <a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a>* x8_progPtr;</div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  <a class="code" href="namespacejbus.html#ae4a7d015f3b8913ec0b563caa0a53221">u32</a> xc_progLen;</div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  <a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a>* x10_statusPtr;</div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  <a class="code" href="namespacejbus.html#ae1577e03ea8c6e27361cb389c992280d">FGBACallback</a> x14_callback;</div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  <a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a> x18_readBuf[4];</div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  <a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a> x1c_writeBuf[4];</div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  <a class="code" href="namespacejbus.html#a33e5022738a0799c066372ce74d04c37">s32</a> x20_byteInWindow;</div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  <a class="code" href="namespacejbus.html#a36fb1f7488218c972a50b1f9dd547b81">u64</a> x28_ticksAfterXf;</div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  <a class="code" href="namespacejbus.html#ae4a7d015f3b8913ec0b563caa0a53221">u32</a> x30_justStarted;</div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  <a class="code" href="namespacejbus.html#ae4a7d015f3b8913ec0b563caa0a53221">u32</a> x34_bytesSent;</div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  <a class="code" href="namespacejbus.html#ae4a7d015f3b8913ec0b563caa0a53221">u32</a> x38_crc;</div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  <a class="code" href="namespacejbus.html#ae4a7d015f3b8913ec0b563caa0a53221">u32</a> x3c_checkStore[7];</div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  <a class="code" href="namespacejbus.html#a33e5022738a0799c066372ce74d04c37">s32</a> x58_currentKey;</div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  <a class="code" href="namespacejbus.html#a33e5022738a0799c066372ce74d04c37">s32</a> x5c_initMessage;</div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  <a class="code" href="namespacejbus.html#a33e5022738a0799c066372ce74d04c37">s32</a> x60_gameId;</div><div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  <a class="code" href="namespacejbus.html#ae4a7d015f3b8913ec0b563caa0a53221">u32</a> x64_totalBytes;</div><div class="line"><a name="l00100"></a><span class="lineno"> 100</span>  <span class="keywordtype">bool</span> m_started = <span class="keyword">true</span>;</div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span> </div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  <span class="keywordtype">void</span> _0Reset(<a class="code" href="classjbus_1_1ThreadLocalEndpoint.html">ThreadLocalEndpoint</a>& endpoint, <a class="code" href="namespacejbus.html#a7118bfa3cb9d51e588418220bca20117">EJoyReturn</a> status);</div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  <span class="keywordtype">void</span> _1GetStatus(<a class="code" href="classjbus_1_1ThreadLocalEndpoint.html">ThreadLocalEndpoint</a>& endpoint, <a class="code" href="namespacejbus.html#a7118bfa3cb9d51e588418220bca20117">EJoyReturn</a> status);</div><div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  <span class="keywordtype">void</span> _2ReadChallenge(<a class="code" href="classjbus_1_1ThreadLocalEndpoint.html">ThreadLocalEndpoint</a>& endpoint, <a class="code" href="namespacejbus.html#a7118bfa3cb9d51e588418220bca20117">EJoyReturn</a> status);</div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  <span class="keywordtype">void</span> _3DSPCrypto(<a class="code" href="classjbus_1_1ThreadLocalEndpoint.html">ThreadLocalEndpoint</a>& endpoint, <a class="code" href="namespacejbus.html#a7118bfa3cb9d51e588418220bca20117">EJoyReturn</a> status);</div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  <span class="keywordtype">void</span> _DSPCryptoInit();</div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  <span class="keywordtype">void</span> _DSPCryptoDone(<a class="code" href="classjbus_1_1ThreadLocalEndpoint.html">ThreadLocalEndpoint</a>& endpoint);</div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  <span class="keywordtype">void</span> _4TransmitProgram(<a class="code" href="classjbus_1_1ThreadLocalEndpoint.html">ThreadLocalEndpoint</a>& endpoint, <a class="code" href="namespacejbus.html#a7118bfa3cb9d51e588418220bca20117">EJoyReturn</a> status);</div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  <span class="keywordtype">void</span> _5StartBootPoll(<a class="code" href="classjbus_1_1ThreadLocalEndpoint.html">ThreadLocalEndpoint</a>& endpoint, <a class="code" href="namespacejbus.html#a7118bfa3cb9d51e588418220bca20117">EJoyReturn</a> status);</div><div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  <span class="keywordtype">void</span> _6BootPoll(<a class="code" href="classjbus_1_1ThreadLocalEndpoint.html">ThreadLocalEndpoint</a>& endpoint, <a class="code" href="namespacejbus.html#a7118bfa3cb9d51e588418220bca20117">EJoyReturn</a> status);</div><div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  <span class="keywordtype">void</span> _7BootAcknowledge(<a class="code" href="classjbus_1_1ThreadLocalEndpoint.html">ThreadLocalEndpoint</a>& endpoint, <a class="code" href="namespacejbus.html#a7118bfa3cb9d51e588418220bca20117">EJoyReturn</a> status);</div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  <span class="keywordtype">void</span> _8BootDone(<a class="code" href="classjbus_1_1ThreadLocalEndpoint.html">ThreadLocalEndpoint</a>& endpoint, <a class="code" href="namespacejbus.html#a7118bfa3cb9d51e588418220bca20117">EJoyReturn</a> status);</div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span> </div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  <span class="keyword">auto</span> bindThis(<span class="keywordtype">void</span>(KawasedoChallenge::*ptmf)(<a class="code" href="classjbus_1_1ThreadLocalEndpoint.html">ThreadLocalEndpoint</a>&, <a class="code" href="namespacejbus.html#a7118bfa3cb9d51e588418220bca20117">EJoyReturn</a>))</div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  {</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  <span class="keywordflow">return</span> std::bind(ptmf, <span class="keyword">this</span>, std::placeholders::_1, std::placeholders::_2);</div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  }</div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span> </div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  <span class="keyword">public</span>:</div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  KawasedoChallenge(<a class="code" href="classjbus_1_1Endpoint.html">Endpoint</a>& endpoint, <a class="code" href="namespacejbus.html#a33e5022738a0799c066372ce74d04c37">s32</a> paletteColor, <a class="code" href="namespacejbus.html#a33e5022738a0799c066372ce74d04c37">s32</a> paletteSpeed,</div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  <span class="keyword">const</span> <a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a>* programp, <a class="code" href="namespacejbus.html#a33e5022738a0799c066372ce74d04c37">s32</a> length, <a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a>* status, <a class="code" href="namespacejbus.html#ae1577e03ea8c6e27361cb389c992280d">FGBACallback</a>&& callback);</div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  <span class="keywordtype">bool</span> started()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_started; }</div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  <a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a> percentComplete()<span class="keyword"> const</span></div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span> <span class="keyword"> </span>{</div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  <span class="keywordflow">if</span> (!x64_totalBytes)</div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  <span class="keywordflow">return</span> 0;</div><div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  <span class="keywordflow">return</span> x34_bytesSent * 100 / x64_totalBytes;</div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  }</div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  <span class="keywordtype">bool</span> isDone()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> !x14_callback; }</div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  };</div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span> </div><div class="line"><a name="l00132"></a><span class="lineno"><a class="line" href="classjbus_1_1Endpoint.html#ab5de6af29530791b0b2958002f1d3603"> 132</a></span>  <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classjbus_1_1ThreadLocalEndpoint.html">ThreadLocalEndpoint</a>;</div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span> </div><div class="line"><a name="l00134"></a><span class="lineno"> 134</span>  <span class="keyword">enum</span> EJoybusCmds</div><div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  {</div><div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  CMD_RESET = 0xff,</div><div class="line"><a name="l00137"></a><span class="lineno"> 137</span>  CMD_STATUS = 0x00,</div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  CMD_READ = 0x14,</div><div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  CMD_WRITE = 0x15</div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  };</div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span> </div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="namespacejbus.html#a36fb1f7488218c972a50b1f9dd547b81">u64</a> BITS_PER_SECOND = 115200;</div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span>  <span class="keyword">static</span> <span class="keyword">const</span> <a class="code" href="namespacejbus.html#a36fb1f7488218c972a50b1f9dd547b81">u64</a> BYTES_PER_SECOND = BITS_PER_SECOND / 8;</div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span> </div><div class="line"><a name="l00145"></a><span class="lineno"> 145</span>  <a class="code" href="classjbus_1_1net_1_1Socket.html">net::Socket</a> m_dataSocket;</div><div class="line"><a name="l00146"></a><span class="lineno"> 146</span>  <a class="code" href="classjbus_1_1net_1_1Socket.html">net::Socket</a> m_clockSocket;</div><div class="line"><a name="l00147"></a><span class="lineno"> 147</span>  std::thread m_transferThread;</div><div class="line"><a name="l00148"></a><span class="lineno"> 148</span>  std::mutex m_syncLock;</div><div class="line"><a name="l00149"></a><span class="lineno"> 149</span>  std::condition_variable m_syncCv;</div><div class="line"><a name="l00150"></a><span class="lineno"> 150</span>  std::condition_variable m_issueCv;</div><div class="line"><a name="l00151"></a><span class="lineno"> 151</span>  std::experimental::optional<KawasedoChallenge> m_joyBoot;</div><div class="line"><a name="l00152"></a><span class="lineno"> 152</span>  <a class="code" href="namespacejbus.html#ae1577e03ea8c6e27361cb389c992280d">FGBACallback</a> m_callback;</div><div class="line"><a name="l00153"></a><span class="lineno"> 153</span>  <a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a> m_buffer[5];</div><div class="line"><a name="l00154"></a><span class="lineno"> 154</span>  <a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a>* m_readDstPtr = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00155"></a><span class="lineno"> 155</span>  <a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a>* m_statusPtr = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00156"></a><span class="lineno"> 156</span>  <a class="code" href="namespacejbus.html#a36fb1f7488218c972a50b1f9dd547b81">u64</a> m_lastGCTick = 0;</div><div class="line"><a name="l00157"></a><span class="lineno"> 157</span>  <a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a> m_lastCmd = 0;</div><div class="line"><a name="l00158"></a><span class="lineno"> 158</span>  <a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a> m_chan;</div><div class="line"><a name="l00159"></a><span class="lineno"> 159</span>  <span class="keywordtype">bool</span> m_booted = <span class="keyword">false</span>;</div><div class="line"><a name="l00160"></a><span class="lineno"> 160</span>  <span class="keywordtype">bool</span> m_cmdIssued = <span class="keyword">false</span>;</div><div class="line"><a name="l00161"></a><span class="lineno"> 161</span>  <span class="keywordtype">bool</span> m_running = <span class="keyword">true</span>;</div><div class="line"><a name="l00162"></a><span class="lineno"> 162</span> </div><div class="line"><a name="l00163"></a><span class="lineno"> 163</span>  <span class="keywordtype">void</span> clockSync();</div><div class="line"><a name="l00164"></a><span class="lineno"> 164</span>  <span class="keywordtype">void</span> send(<span class="keyword">const</span> <a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a>* buffer);</div><div class="line"><a name="l00165"></a><span class="lineno"> 165</span>  <span class="keywordtype">size_t</span> receive(<a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a>* buffer);</div><div class="line"><a name="l00166"></a><span class="lineno"> 166</span>  <span class="keywordtype">size_t</span> runBuffer(<a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a>* buffer, std::unique_lock<std::mutex>& lk);</div><div class="line"><a name="l00167"></a><span class="lineno"> 167</span>  <span class="keywordtype">bool</span> idleGetStatus(std::unique_lock<std::mutex>& lk);</div><div class="line"><a name="l00168"></a><span class="lineno"> 168</span>  <span class="keywordtype">void</span> transferProc();</div><div class="line"><a name="l00169"></a><span class="lineno"> 169</span>  <span class="keywordtype">void</span> transferWakeup(<a class="code" href="classjbus_1_1ThreadLocalEndpoint.html">ThreadLocalEndpoint</a>& endpoint, <a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a> status);</div><div class="line"><a name="l00170"></a><span class="lineno"> 170</span> </div><div class="line"><a name="l00171"></a><span class="lineno"> 171</span>  <span class="keyword">auto</span> bindSync()</div><div class="line"><a name="l00172"></a><span class="lineno"> 172</span>  {</div><div class="line"><a name="l00173"></a><span class="lineno"> 173</span>  <span class="keywordflow">return</span> std::bind(&Endpoint::transferWakeup, <span class="keyword">this</span>,</div><div class="line"><a name="l00174"></a><span class="lineno"> 174</span>  std::placeholders::_1, std::placeholders::_2);</div><div class="line"><a name="l00175"></a><span class="lineno"> 175</span>  }</div><div class="line"><a name="l00176"></a><span class="lineno"> 176</span> </div><div class="line"><a name="l00177"></a><span class="lineno"> 177</span> <span class="keyword">public</span>:</div><div class="line"><a name="l00181"></a><span class="lineno"> 181</span>  <span class="keywordtype">void</span> <a class="code" href="classjbus_1_1Endpoint.html#a1cae93f2e1e097b10b34810a0d04333f">stop</a>();</div><div class="line"><a name="l00182"></a><span class="lineno"> 182</span> </div><div class="line"><a name="l00186"></a><span class="lineno"> 186</span>  <a class="code" href="namespacejbus.html#a7118bfa3cb9d51e588418220bca20117">EJoyReturn</a> <a class="code" href="classjbus_1_1Endpoint.html#a50401a9a9d658f1f68e3dde61d5dfbce">GBAGetProcessStatus</a>(<a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a>& percentOut);</div><div class="line"><a name="l00187"></a><span class="lineno"> 187</span> </div><div class="line"><a name="l00192"></a><span class="lineno"> 192</span>  <a class="code" href="namespacejbus.html#a7118bfa3cb9d51e588418220bca20117">EJoyReturn</a> <a class="code" href="classjbus_1_1Endpoint.html#a4ba9120b99057be42940b797708b790e">GBAGetStatusAsync</a>(<a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a>* status, <a class="code" href="namespacejbus.html#ae1577e03ea8c6e27361cb389c992280d">FGBACallback</a>&& callback);</div><div class="line"><a name="l00193"></a><span class="lineno"> 193</span> </div><div class="line"><a name="l00197"></a><span class="lineno"> 197</span>  <a class="code" href="namespacejbus.html#a7118bfa3cb9d51e588418220bca20117">EJoyReturn</a> <a class="code" href="classjbus_1_1Endpoint.html#a779ba524cf30f41e29fd53a626ba2acf">GBAGetStatus</a>(<a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a>* status);</div><div class="line"><a name="l00198"></a><span class="lineno"> 198</span> </div><div class="line"><a name="l00203"></a><span class="lineno"> 203</span>  <a class="code" href="namespacejbus.html#a7118bfa3cb9d51e588418220bca20117">EJoyReturn</a> <a class="code" href="classjbus_1_1Endpoint.html#a81d86608ffb93b3211a915fa1712beb4">GBAResetAsync</a>(<a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a>* status, <a class="code" href="namespacejbus.html#ae1577e03ea8c6e27361cb389c992280d">FGBACallback</a>&& callback);</div><div class="line"><a name="l00204"></a><span class="lineno"> 204</span> </div><div class="line"><a name="l00208"></a><span class="lineno"> 208</span>  <a class="code" href="namespacejbus.html#a7118bfa3cb9d51e588418220bca20117">EJoyReturn</a> <a class="code" href="classjbus_1_1Endpoint.html#a9065f6189182596a3f5c498e8ef98b40">GBAReset</a>(<a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a>* status);</div><div class="line"><a name="l00209"></a><span class="lineno"> 209</span> </div><div class="line"><a name="l00215"></a><span class="lineno"> 215</span>  <a class="code" href="namespacejbus.html#a7118bfa3cb9d51e588418220bca20117">EJoyReturn</a> <a class="code" href="classjbus_1_1Endpoint.html#a047d724cc9ccb8253cb8464c24b9ccd4">GBAReadAsync</a>(<a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a>* dst, <a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a>* status, <a class="code" href="namespacejbus.html#ae1577e03ea8c6e27361cb389c992280d">FGBACallback</a>&& callback);</div><div class="line"><a name="l00216"></a><span class="lineno"> 216</span> </div><div class="line"><a name="l00221"></a><span class="lineno"> 221</span>  <a class="code" href="namespacejbus.html#a7118bfa3cb9d51e588418220bca20117">EJoyReturn</a> <a class="code" href="classjbus_1_1Endpoint.html#a775c816f52ca45117759b5b23eb45683">GBARead</a>(<a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a>* dst, <a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a>* status);</div><div class="line"><a name="l00222"></a><span class="lineno"> 222</span> </div><div class="line"><a name="l00228"></a><span class="lineno"> 228</span>  <a class="code" href="namespacejbus.html#a7118bfa3cb9d51e588418220bca20117">EJoyReturn</a> <a class="code" href="classjbus_1_1Endpoint.html#a06506d0cfa26d461f239ed761264d7b0">GBAWriteAsync</a>(<span class="keyword">const</span> <a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a>* src, <a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a>* status, <a class="code" href="namespacejbus.html#ae1577e03ea8c6e27361cb389c992280d">FGBACallback</a>&& callback);</div><div class="line"><a name="l00229"></a><span class="lineno"> 229</span> </div><div class="line"><a name="l00234"></a><span class="lineno"> 234</span>  <a class="code" href="namespacejbus.html#a7118bfa3cb9d51e588418220bca20117">EJoyReturn</a> <a class="code" href="classjbus_1_1Endpoint.html#a6e59373aa28a23097129470deaeb46dd">GBAWrite</a>(<span class="keyword">const</span> <a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a>* src, <a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a>* status);</div><div class="line"><a name="l00235"></a><span class="lineno"> 235</span> </div><div class="line"><a name="l00244"></a><span class="lineno"> 244</span>  <a class="code" href="namespacejbus.html#a7118bfa3cb9d51e588418220bca20117">EJoyReturn</a> <a class="code" href="classjbus_1_1Endpoint.html#aad76a9374e4e151540f678798548a843">GBAJoyBootAsync</a>(<a class="code" href="namespacejbus.html#a33e5022738a0799c066372ce74d04c37">s32</a> paletteColor, <a class="code" href="namespacejbus.html#a33e5022738a0799c066372ce74d04c37">s32</a> paletteSpeed,</div><div class="line"><a name="l00245"></a><span class="lineno"> 245</span>  <span class="keyword">const</span> <a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a>* programp, <a class="code" href="namespacejbus.html#a33e5022738a0799c066372ce74d04c37">s32</a> length, <a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a>* status,</div><div class="line"><a name="l00246"></a><span class="lineno"> 246</span>  <a class="code" href="namespacejbus.html#ae1577e03ea8c6e27361cb389c992280d">FGBACallback</a>&& callback);</div><div class="line"><a name="l00247"></a><span class="lineno"> 247</span> </div><div class="line"><a name="l00250"></a><span class="lineno"><a class="line" href="classjbus_1_1Endpoint.html#a6aa5fa9049740d739b03e303719a764a"> 250</a></span>  <span class="keywordtype">unsigned</span> <a class="code" href="classjbus_1_1Endpoint.html#a6aa5fa9049740d739b03e303719a764a">getChan</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_chan; }</div><div class="line"><a name="l00251"></a><span class="lineno"> 251</span> </div><div class="line"><a name="l00254"></a><span class="lineno"><a class="line" href="classjbus_1_1Endpoint.html#a21b883cf30eb52ca355163617960788e"> 254</a></span>  <span class="keywordtype">void</span> <a class="code" href="classjbus_1_1Endpoint.html#a21b883cf30eb52ca355163617960788e">setChan</a>(<span class="keywordtype">unsigned</span> chan)</div><div class="line"><a name="l00255"></a><span class="lineno"> 255</span>  {</div><div class="line"><a name="l00256"></a><span class="lineno"> 256</span>  <span class="keywordflow">if</span> (chan > 3)</div><div class="line"><a name="l00257"></a><span class="lineno"> 257</span>  chan = 3;</div><div class="line"><a name="l00258"></a><span class="lineno"> 258</span>  m_chan = chan;</div><div class="line"><a name="l00259"></a><span class="lineno"> 259</span>  }</div><div class="line"><a name="l00260"></a><span class="lineno"> 260</span> </div><div class="line"><a name="l00263"></a><span class="lineno"><a class="line" href="classjbus_1_1Endpoint.html#a930f7ae80af4e13ff50122f2a54c63da"> 263</a></span>  <span class="keywordtype">bool</span> <a class="code" href="classjbus_1_1Endpoint.html#a930f7ae80af4e13ff50122f2a54c63da">connected</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_running; }</div><div class="line"><a name="l00264"></a><span class="lineno"> 264</span> </div><div class="line"><a name="l00265"></a><span class="lineno"> 265</span>  <a class="code" href="classjbus_1_1Endpoint.html#a39ddcbf5ac7078d59a4d99d291e3f0fa">Endpoint</a>(<a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a> chan, <a class="code" href="classjbus_1_1net_1_1Socket.html">net::Socket</a>&& data, <a class="code" href="classjbus_1_1net_1_1Socket.html">net::Socket</a>&& clock);</div><div class="line"><a name="l00266"></a><span class="lineno"> 266</span>  <a class="code" href="classjbus_1_1Endpoint.html#ad39f268d3bee438e5176cc7f4cf59675">~Endpoint</a>();</div><div class="line"><a name="l00267"></a><span class="lineno"> 267</span> };</div><div class="line"><a name="l00268"></a><span class="lineno"> 268</span> </div><div class="line"><a name="l00272"></a><span class="lineno"><a class="line" href="classjbus_1_1ThreadLocalEndpoint.html"> 272</a></span> <span class="keyword">class </span><a class="code" href="classjbus_1_1ThreadLocalEndpoint.html">ThreadLocalEndpoint</a></div><div class="line"><a name="l00273"></a><span class="lineno"> 273</span> {</div><div class="line"><a name="l00274"></a><span class="lineno"><a class="line" href="classjbus_1_1ThreadLocalEndpoint.html#a500d74fc41e3ab6b4889a579193566ed"> 274</a></span>  <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classjbus_1_1Endpoint.html">Endpoint</a>;</div><div class="line"><a name="l00275"></a><span class="lineno"> 275</span>  <a class="code" href="classjbus_1_1Endpoint.html">Endpoint</a>& m_ep;</div><div class="line"><a name="l00276"></a><span class="lineno"> 276</span>  <a class="code" href="classjbus_1_1Endpoint.html#ab5de6af29530791b0b2958002f1d3603">ThreadLocalEndpoint</a>(<a class="code" href="classjbus_1_1Endpoint.html">Endpoint</a>& ep) : m_ep(ep) {}</div><div class="line"><a name="l00277"></a><span class="lineno"> 277</span> </div><div class="line"><a name="l00278"></a><span class="lineno"> 278</span> <span class="keyword">public</span>:</div><div class="line"><a name="l00283"></a><span class="lineno"> 283</span>  <a class="code" href="namespacejbus.html#a7118bfa3cb9d51e588418220bca20117">EJoyReturn</a> <a class="code" href="classjbus_1_1Endpoint.html#a4ba9120b99057be42940b797708b790e">GBAGetStatusAsync</a>(<a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a>* status, <a class="code" href="namespacejbus.html#ae1577e03ea8c6e27361cb389c992280d">FGBACallback</a>&& callback);</div><div class="line"><a name="l00284"></a><span class="lineno"> 284</span> </div><div class="line"><a name="l00289"></a><span class="lineno"> 289</span>  <a class="code" href="namespacejbus.html#a7118bfa3cb9d51e588418220bca20117">EJoyReturn</a> <a class="code" href="classjbus_1_1Endpoint.html#a81d86608ffb93b3211a915fa1712beb4">GBAResetAsync</a>(<a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a>* status, <a class="code" href="namespacejbus.html#ae1577e03ea8c6e27361cb389c992280d">FGBACallback</a>&& callback);</div><div class="line"><a name="l00290"></a><span class="lineno"> 290</span> </div><div class="line"><a name="l00296"></a><span class="lineno"> 296</span>  <a class="code" href="namespacejbus.html#a7118bfa3cb9d51e588418220bca20117">EJoyReturn</a> <a class="code" href="classjbus_1_1Endpoint.html#a047d724cc9ccb8253cb8464c24b9ccd4">GBAReadAsync</a>(<a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a>* dst, <a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a>* status, <a class="code" href="namespacejbus.html#ae1577e03ea8c6e27361cb389c992280d">FGBACallback</a>&& callback);</div><div class="line"><a name="l00297"></a><span class="lineno"> 297</span> </div><div class="line"><a name="l00303"></a><span class="lineno"> 303</span>  <a class="code" href="namespacejbus.html#a7118bfa3cb9d51e588418220bca20117">EJoyReturn</a> <a class="code" href="classjbus_1_1Endpoint.html#a06506d0cfa26d461f239ed761264d7b0">GBAWriteAsync</a>(<span class="keyword">const</span> <a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a>* src, <a class="code" href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">u8</a>* status, <a class="code" href="namespacejbus.html#ae1577e03ea8c6e27361cb389c992280d">FGBACallback</a>&& callback);</div><div class="line"><a name="l00304"></a><span class="lineno"> 304</span> </div><div class="line"><a name="l00307"></a><span class="lineno"><a class="line" href="classjbus_1_1ThreadLocalEndpoint.html#a1205d985c7e71b42a9cf2c1be06383b2"> 307</a></span>  <span class="keywordtype">int</span> <a class="code" href="classjbus_1_1ThreadLocalEndpoint.html#a1205d985c7e71b42a9cf2c1be06383b2">getChan</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_ep.<a class="code" href="classjbus_1_1Endpoint.html#a6aa5fa9049740d739b03e303719a764a">getChan</a>(); }</div><div class="line"><a name="l00308"></a><span class="lineno"> 308</span> };</div><div class="line"><a name="l00309"></a><span class="lineno"> 309</span> </div><div class="line"><a name="l00310"></a><span class="lineno"> 310</span> }</div><div class="line"><a name="l00311"></a><span class="lineno"> 311</span> </div><div class="line"><a name="l00312"></a><span class="lineno"> 312</span> <span class="preprocessor">#endif // JBUS_ENDPOINT_HPP</span></div><div class="ttc" id="classjbus_1_1Endpoint_html_a775c816f52ca45117759b5b23eb45683"><div class="ttname"><a href="classjbus_1_1Endpoint.html#a775c816f52ca45117759b5b23eb45683">jbus::Endpoint::GBARead</a></div><div class="ttdeci">EJoyReturn GBARead(u8 *dst, u8 *status)</div><div class="ttdoc">Send READ command to GBA synchronously. </div></div>
|
|
<div class="ttc" id="namespacejbus_html_aff2760609de15f92daafbdff7be79b33"><div class="ttname"><a href="namespacejbus.html#aff2760609de15f92daafbdff7be79b33">jbus::u16</a></div><div class="ttdeci">uint16_t u16</div><div class="ttdef"><b>Definition:</b> Common.hpp:14</div></div>
|
|
<div class="ttc" id="classjbus_1_1Endpoint_html_a779ba524cf30f41e29fd53a626ba2acf"><div class="ttname"><a href="classjbus_1_1Endpoint.html#a779ba524cf30f41e29fd53a626ba2acf">jbus::Endpoint::GBAGetStatus</a></div><div class="ttdeci">EJoyReturn GBAGetStatus(u8 *status)</div><div class="ttdoc">Get JOYSTAT register from GBA synchronously. </div></div>
|
|
<div class="ttc" id="namespacejbus_html_a416b65eae1b2ff9ab63c4c71ff857ea4"><div class="ttname"><a href="namespacejbus.html#a416b65eae1b2ff9ab63c4c71ff857ea4">jbus::s8</a></div><div class="ttdeci">int8_t s8</div><div class="ttdef"><b>Definition:</b> Common.hpp:11</div></div>
|
|
<div class="ttc" id="namespacejbus_html_ae1577e03ea8c6e27361cb389c992280d"><div class="ttname"><a href="namespacejbus.html#ae1577e03ea8c6e27361cb389c992280d">jbus::FGBACallback</a></div><div class="ttdeci">std::function< void(ThreadLocalEndpoint &endpoint, EJoyReturn status)> FGBACallback</div><div class="ttdoc">Standard callback for asynchronous jbus::Endpoint APIs. </div><div class="ttdef"><b>Definition:</b> Common.hpp:169</div></div>
|
|
<div class="ttc" id="namespacejbus_html_a19d112b8b9f912fca094b41ce26c4fef"><div class="ttname"><a href="namespacejbus.html#a19d112b8b9f912fca094b41ce26c4fef">jbus::u8</a></div><div class="ttdeci">uint8_t u8</div><div class="ttdef"><b>Definition:</b> Common.hpp:12</div></div>
|
|
<div class="ttc" id="classjbus_1_1Endpoint_html_ab5de6af29530791b0b2958002f1d3603"><div class="ttname"><a href="classjbus_1_1Endpoint.html#ab5de6af29530791b0b2958002f1d3603">jbus::Endpoint::ThreadLocalEndpoint</a></div><div class="ttdeci">friend class ThreadLocalEndpoint</div><div class="ttdef"><b>Definition:</b> Endpoint.hpp:132</div></div>
|
|
<div class="ttc" id="namespacejbus_html"><div class="ttname"><a href="namespacejbus.html">jbus</a></div><div class="ttdef"><b>Definition:</b> Common.hpp:8</div></div>
|
|
<div class="ttc" id="classjbus_1_1net_1_1Socket_html"><div class="ttname"><a href="classjbus_1_1net_1_1Socket.html">jbus::net::Socket</a></div><div class="ttdef"><b>Definition:</b> Socket.hpp:104</div></div>
|
|
<div class="ttc" id="classjbus_1_1Endpoint_html_a06506d0cfa26d461f239ed761264d7b0"><div class="ttname"><a href="classjbus_1_1Endpoint.html#a06506d0cfa26d461f239ed761264d7b0">jbus::Endpoint::GBAWriteAsync</a></div><div class="ttdeci">EJoyReturn GBAWriteAsync(const u8 *src, u8 *status, FGBACallback &&callback)</div><div class="ttdoc">Send WRITE command to GBA asynchronously. </div></div>
|
|
<div class="ttc" id="namespacejbus_html_a36fb1f7488218c972a50b1f9dd547b81"><div class="ttname"><a href="namespacejbus.html#a36fb1f7488218c972a50b1f9dd547b81">jbus::u64</a></div><div class="ttdeci">uint64_t u64</div><div class="ttdef"><b>Definition:</b> Common.hpp:18</div></div>
|
|
<div class="ttc" id="classjbus_1_1Endpoint_html_a39ddcbf5ac7078d59a4d99d291e3f0fa"><div class="ttname"><a href="classjbus_1_1Endpoint.html#a39ddcbf5ac7078d59a4d99d291e3f0fa">jbus::Endpoint::Endpoint</a></div><div class="ttdeci">Endpoint(u8 chan, net::Socket &&data, net::Socket &&clock)</div></div>
|
|
<div class="ttc" id="Socket_8hpp_html"><div class="ttname"><a href="Socket_8hpp.html">Socket.hpp</a></div></div>
|
|
<div class="ttc" id="namespacejbus_html_aa767fe4f71e145e2c0b12eccbeb83071"><div class="ttname"><a href="namespacejbus.html#aa767fe4f71e145e2c0b12eccbeb83071">jbus::s16</a></div><div class="ttdeci">int16_t s16</div><div class="ttdef"><b>Definition:</b> Common.hpp:13</div></div>
|
|
<div class="ttc" id="namespacejbus_html_a33e5022738a0799c066372ce74d04c37"><div class="ttname"><a href="namespacejbus.html#a33e5022738a0799c066372ce74d04c37">jbus::s32</a></div><div class="ttdeci">int32_t s32</div><div class="ttdef"><b>Definition:</b> Common.hpp:15</div></div>
|
|
<div class="ttc" id="classjbus_1_1Endpoint_html_a4ba9120b99057be42940b797708b790e"><div class="ttname"><a href="classjbus_1_1Endpoint.html#a4ba9120b99057be42940b797708b790e">jbus::Endpoint::GBAGetStatusAsync</a></div><div class="ttdeci">EJoyReturn GBAGetStatusAsync(u8 *status, FGBACallback &&callback)</div><div class="ttdoc">Get JOYSTAT register from GBA asynchronously. </div></div>
|
|
<div class="ttc" id="classjbus_1_1Endpoint_html_a047d724cc9ccb8253cb8464c24b9ccd4"><div class="ttname"><a href="classjbus_1_1Endpoint.html#a047d724cc9ccb8253cb8464c24b9ccd4">jbus::Endpoint::GBAReadAsync</a></div><div class="ttdeci">EJoyReturn GBAReadAsync(u8 *dst, u8 *status, FGBACallback &&callback)</div><div class="ttdoc">Send READ command to GBA asynchronously. </div></div>
|
|
<div class="ttc" id="classjbus_1_1Endpoint_html_aad76a9374e4e151540f678798548a843"><div class="ttname"><a href="classjbus_1_1Endpoint.html#aad76a9374e4e151540f678798548a843">jbus::Endpoint::GBAJoyBootAsync</a></div><div class="ttdeci">EJoyReturn GBAJoyBootAsync(s32 paletteColor, s32 paletteSpeed, const u8 *programp, s32 length, u8 *status, FGBACallback &&callback)</div><div class="ttdoc">Initiate JoyBoot sequence on this endpoint. </div></div>
|
|
<div class="ttc" id="classjbus_1_1Endpoint_html_a6e59373aa28a23097129470deaeb46dd"><div class="ttname"><a href="classjbus_1_1Endpoint.html#a6e59373aa28a23097129470deaeb46dd">jbus::Endpoint::GBAWrite</a></div><div class="ttdeci">EJoyReturn GBAWrite(const u8 *src, u8 *status)</div><div class="ttdoc">Send WRITE command to GBA synchronously. </div></div>
|
|
<div class="ttc" id="namespacejbus_html_a7118bfa3cb9d51e588418220bca20117"><div class="ttname"><a href="namespacejbus.html#a7118bfa3cb9d51e588418220bca20117">jbus::EJoyReturn</a></div><div class="ttdeci">EJoyReturn</div><div class="ttdef"><b>Definition:</b> Common.hpp:157</div></div>
|
|
<div class="ttc" id="classjbus_1_1ThreadLocalEndpoint_html_a1205d985c7e71b42a9cf2c1be06383b2"><div class="ttname"><a href="classjbus_1_1ThreadLocalEndpoint.html#a1205d985c7e71b42a9cf2c1be06383b2">jbus::ThreadLocalEndpoint::getChan</a></div><div class="ttdeci">int getChan() const </div><div class="ttdoc">Get virtual SI channel assigned to this endpoint. </div><div class="ttdef"><b>Definition:</b> Endpoint.hpp:307</div></div>
|
|
<div class="ttc" id="classjbus_1_1Endpoint_html"><div class="ttname"><a href="classjbus_1_1Endpoint.html">jbus::Endpoint</a></div><div class="ttdef"><b>Definition:</b> Endpoint.hpp:16</div></div>
|
|
<div class="ttc" id="classjbus_1_1Endpoint_html_ad39f268d3bee438e5176cc7f4cf59675"><div class="ttname"><a href="classjbus_1_1Endpoint.html#ad39f268d3bee438e5176cc7f4cf59675">jbus::Endpoint::~Endpoint</a></div><div class="ttdeci">~Endpoint()</div></div>
|
|
<div class="ttc" id="namespacejbus_html_ae4a7d015f3b8913ec0b563caa0a53221"><div class="ttname"><a href="namespacejbus.html#ae4a7d015f3b8913ec0b563caa0a53221">jbus::u32</a></div><div class="ttdeci">uint32_t u32</div><div class="ttdef"><b>Definition:</b> Common.hpp:16</div></div>
|
|
<div class="ttc" id="classjbus_1_1Endpoint_html_a930f7ae80af4e13ff50122f2a54c63da"><div class="ttname"><a href="classjbus_1_1Endpoint.html#a930f7ae80af4e13ff50122f2a54c63da">jbus::Endpoint::connected</a></div><div class="ttdeci">bool connected() const </div><div class="ttdoc">Get connection status of this endpoint. </div><div class="ttdef"><b>Definition:</b> Endpoint.hpp:263</div></div>
|
|
<div class="ttc" id="classjbus_1_1Endpoint_html_a6aa5fa9049740d739b03e303719a764a"><div class="ttname"><a href="classjbus_1_1Endpoint.html#a6aa5fa9049740d739b03e303719a764a">jbus::Endpoint::getChan</a></div><div class="ttdeci">unsigned getChan() const </div><div class="ttdoc">Get virtual SI channel assigned to this endpoint. </div><div class="ttdef"><b>Definition:</b> Endpoint.hpp:250</div></div>
|
|
<div class="ttc" id="classjbus_1_1Endpoint_html_a1cae93f2e1e097b10b34810a0d04333f"><div class="ttname"><a href="classjbus_1_1Endpoint.html#a1cae93f2e1e097b10b34810a0d04333f">jbus::Endpoint::stop</a></div><div class="ttdeci">void stop()</div><div class="ttdoc">Request stop of I/O thread and block until joined. Further use of this Endpoint will return GBA_NOT_R...</div></div>
|
|
<div class="ttc" id="classjbus_1_1Endpoint_html_a9065f6189182596a3f5c498e8ef98b40"><div class="ttname"><a href="classjbus_1_1Endpoint.html#a9065f6189182596a3f5c498e8ef98b40">jbus::Endpoint::GBAReset</a></div><div class="ttdeci">EJoyReturn GBAReset(u8 *status)</div><div class="ttdoc">Send RESET command to GBA synchronously. </div></div>
|
|
<div class="ttc" id="Common_8hpp_html"><div class="ttname"><a href="Common_8hpp.html">Common.hpp</a></div></div>
|
|
<div class="ttc" id="classjbus_1_1Endpoint_html_a21b883cf30eb52ca355163617960788e"><div class="ttname"><a href="classjbus_1_1Endpoint.html#a21b883cf30eb52ca355163617960788e">jbus::Endpoint::setChan</a></div><div class="ttdeci">void setChan(unsigned chan)</div><div class="ttdoc">Set virtual SI channel assigned to this endpoint. </div><div class="ttdef"><b>Definition:</b> Endpoint.hpp:254</div></div>
|
|
<div class="ttc" id="classjbus_1_1Endpoint_html_a81d86608ffb93b3211a915fa1712beb4"><div class="ttname"><a href="classjbus_1_1Endpoint.html#a81d86608ffb93b3211a915fa1712beb4">jbus::Endpoint::GBAResetAsync</a></div><div class="ttdeci">EJoyReturn GBAResetAsync(u8 *status, FGBACallback &&callback)</div><div class="ttdoc">Send RESET command to GBA asynchronously. </div></div>
|
|
<div class="ttc" id="classjbus_1_1Endpoint_html_a50401a9a9d658f1f68e3dde61d5dfbce"><div class="ttname"><a href="classjbus_1_1Endpoint.html#a50401a9a9d658f1f68e3dde61d5dfbce">jbus::Endpoint::GBAGetProcessStatus</a></div><div class="ttdeci">EJoyReturn GBAGetProcessStatus(u8 &percentOut)</div><div class="ttdoc">Get status of last asynchronous operation. </div></div>
|
|
<div class="ttc" id="classjbus_1_1ThreadLocalEndpoint_html"><div class="ttname"><a href="classjbus_1_1ThreadLocalEndpoint.html">jbus::ThreadLocalEndpoint</a></div><div class="ttdef"><b>Definition:</b> Endpoint.hpp:272</div></div>
|
|
</div><!-- fragment --></div><!-- contents -->
|
|
</div><!-- doc-content -->
|
|
<!-- start footer part -->
|
|
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
|
<ul>
|
|
<li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a></li><li class="navelem"><a class="el" href="dir_4525d057f72f34aebe3436e89afccf45.html">jbus</a></li><li class="navelem"><a class="el" href="Endpoint_8hpp.html">Endpoint.hpp</a></li>
|
|
<li class="footer">Generated by
|
|
<a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
|
|
</ul>
|
|
</div>
|
|
</body>
|
|
</html>
|