namespacetk.tex 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. \doxysection{tk Namespace Reference}
  2. \hypertarget{namespacetk}{}\label{namespacetk}\index{tk@{tk}}
  3. \doxysubsubsection*{Namespaces}
  4. \begin{DoxyCompactItemize}
  5. \item
  6. namespace \doxymbox{\hyperlink{namespacetk_1_1detail}{detail}}
  7. \end{DoxyCompactItemize}
  8. \doxysubsubsection*{Classes}
  9. \begin{DoxyCompactItemize}
  10. \item
  11. class \doxymbox{\hyperlink{classtk_1_1_actor}{Actor}}
  12. \begin{DoxyCompactList}\small\item\em メッセージ駆動型タスク (アクター) の基底クラス \end{DoxyCompactList}\item
  13. class \doxymbox{\hyperlink{classtk_1_1_event_hub}{Event\+Hub}}
  14. \begin{DoxyCompactList}\small\item\em メッセージ型ごとの超軽量 Pub/\+\+Sub ディスパッチャ \end{DoxyCompactList}\item
  15. class \doxymbox{\hyperlink{classtk_1_1_lock_guard}{Lock\+Guard}}
  16. \begin{DoxyCompactList}\small\item\em ミューテックスのロックをスコープ単位で安全に管理する RAII クラス (std::\+lock\+\_\+guard 相当) \end{DoxyCompactList}\item
  17. struct \doxymbox{\hyperlink{structtk_1_1_message}{Message}}
  18. \begin{DoxyCompactList}\small\item\em デフォルトの軽量メッセージ構造体 \end{DoxyCompactList}\item
  19. class \doxymbox{\hyperlink{classtk_1_1_mutex}{Mutex}}
  20. \begin{DoxyCompactList}\small\item\em 所有権・優先度順ウェイクアップ・\+RAII 対応のミューテックス (排他ロック) \end{DoxyCompactList}\item
  21. class \doxymbox{\hyperlink{classtk_1_1_preempt_guard}{Preempt\+Guard}}
  22. \begin{DoxyCompactList}\small\item\em プリエンプション禁止をスコープ単位で安全に管理する RAII クラス \end{DoxyCompactList}\item
  23. class \doxymbox{\hyperlink{classtk_1_1_semaphore}{Semaphore}}
  24. \begin{DoxyCompactList}\small\item\em 計数セマフォ (Counting \doxylink{classtk_1_1_semaphore}{Semaphore}) / バイナリセマフォ \end{DoxyCompactList}\item
  25. struct \doxymbox{\hyperlink{structtk_1_1_task_handle}{Task\+Handle}}
  26. \begin{DoxyCompactList}\small\item\em タスクの識別ハンドル \end{DoxyCompactList}\end{DoxyCompactItemize}
  27. \doxysubsubsection*{Typedefs}
  28. \begin{DoxyCompactItemize}
  29. \item
  30. using \doxymbox{\hyperlink{namespacetk_a8908cf1e54cdc4e14ac3003126722cfc}{Task\+Fn}} = void (\texorpdfstring{$\ast$}{*})(void\texorpdfstring{$\ast$}{*} arg)
  31. \item
  32. using \doxymbox{\hyperlink{namespacetk_add371a241ec6c1695ef4e67935317edd}{task\+\_\+mask\+\_\+t}} = uint32\+\_\+t
  33. \item
  34. using \doxymbox{\hyperlink{namespacetk_ab1f2fa3d79e99f13610bd330a0df928b}{Binary\+Semaphore}} = \doxymbox{\hyperlink{classtk_1_1_semaphore}{Semaphore}}
  35. \begin{DoxyCompactList}\small\item\em バイナリセマフォ (初期値1, 最大1) の型エイリアス \end{DoxyCompactList}\end{DoxyCompactItemize}
  36. \doxysubsubsection*{Enumerations}
  37. \begin{DoxyCompactItemize}
  38. \item
  39. enum \doxymbox{\hyperlink{namespacetk_a3d47fbd63b95ed3b46bed70c2fa1e50e}{Prio}} : uint32\+\_\+t \{ \doxymbox{\hyperlink{namespacetk_a3d47fbd63b95ed3b46bed70c2fa1e50eabbefd771d1fb2ac0708c1bd5371e5a75}{PRIO\+\_\+\+REALTIME}} = 1
  40. , \doxymbox{\hyperlink{namespacetk_a3d47fbd63b95ed3b46bed70c2fa1e50ea614240a3a3fc1094c6daa0fdca92ba37}{PRIO\+\_\+\+HIGH}} = 5
  41. , \doxymbox{\hyperlink{namespacetk_a3d47fbd63b95ed3b46bed70c2fa1e50ea0e6779023b97999c2cef66ba1d4d1fca}{PRIO\+\_\+\+NORMAL}} = 9
  42. , \doxymbox{\hyperlink{namespacetk_a3d47fbd63b95ed3b46bed70c2fa1e50eacf084edcfe985b77c205a37c3bd60519}{PRIO\+\_\+\+LOW}} = 13
  43. \}
  44. \begin{DoxyCompactList}\small\item\em タスクの優先度レベル \end{DoxyCompactList}\end{DoxyCompactItemize}
  45. \doxysubsubsection*{Functions}
  46. \begin{DoxyCompactItemize}
  47. \item
  48. {\footnotesize template$<$typename Msg\+Type$>$ }\\size\+\_\+t \doxymbox{\hyperlink{namespacetk_a083495c9bf857a63f6c20a20aac0ca52}{publish}} (const Msg\+Type \&msg)
  49. \begin{DoxyCompactList}\small\item\em メッセージの型を指定して、購読しているすべての \doxylink{classtk_1_1_actor}{Actor} へ同報配信します \end{DoxyCompactList}\item
  50. size\+\_\+t \doxymbox{\hyperlink{namespacetk_a5549bec310750722a1964de1145b9fed}{publish}} (uint32\+\_\+t id, uintptr\+\_\+t arg=0)
  51. \begin{DoxyCompactList}\small\item\em \doxylink{structtk_1_1_message}{tk::\+\+Message} 型の同報配信ショートカット \end{DoxyCompactList}\item
  52. \doxymbox{\hyperlink{structtk_1_1_task_handle}{Task\+Handle}} \doxymbox{\hyperlink{namespacetk_a6e721332f5a7d85998345ed218de7394}{create}} (\doxymbox{\hyperlink{namespacetk_a8908cf1e54cdc4e14ac3003126722cfc}{Task\+Fn}} fn, void \texorpdfstring{$\ast$}{*}arg=nullptr, uint32\+\_\+t prio=\doxymbox{\hyperlink{namespacetk_a3d47fbd63b95ed3b46bed70c2fa1e50ea0e6779023b97999c2cef66ba1d4d1fca}{PRIO\+\_\+\+NORMAL}})
  53. \begin{DoxyCompactList}\small\item\em タスクを生成・登録します \end{DoxyCompactList}\item
  54. void \doxymbox{\hyperlink{namespacetk_a675f1829b87e2a43239b6f80a526d0ed}{start}} ()
  55. \begin{DoxyCompactList}\small\item\em tinykernel スケジューラを起動します \end{DoxyCompactList}\item
  56. void \doxymbox{\hyperlink{namespacetk_a8081956b0a19b87d5b7c81b772373397}{yield}} ()
  57. \begin{DoxyCompactList}\small\item\em 現在実行中のタスクを一時中断し、同優先度の他のタスクへ CPU を譲渡します \end{DoxyCompactList}\item
  58. void \doxymbox{\hyperlink{namespacetk_aae83f84121085578a7568437a8dc2447}{sleep\+\_\+ms}} (uint32\+\_\+t ms)
  59. \begin{DoxyCompactList}\small\item\em 現在のタスクを指定時間スリープさせます \end{DoxyCompactList}\item
  60. void \doxymbox{\hyperlink{namespacetk_aba50cfc62cb8be71cf96df7f495a7a3d}{exit}} (int code=0)
  61. \begin{DoxyCompactList}\small\item\em 現在のタスクを終了・破棄します \end{DoxyCompactList}\item
  62. uint64\+\_\+t \doxymbox{\hyperlink{namespacetk_a46e15375fba47cbd1a93278f17e77848}{now\+\_\+ms}} ()
  63. \begin{DoxyCompactList}\small\item\em システム起動時からの経過時間をミリ秒単位で取得します \end{DoxyCompactList}\item
  64. bool \doxymbox{\hyperlink{namespacetk_a6540aa25eb8562f6d6c8b37977d6cfe8}{lock}} ()
  65. \begin{DoxyCompactList}\small\item\em ハードウェアスピンロックと全割り込み禁止によるクリティカルセクションに入ります \end{DoxyCompactList}\item
  66. void \doxymbox{\hyperlink{namespacetk_a752b12f6862815c94a52347af52578b7}{unlock}} (bool was\+\_\+enabled)
  67. \begin{DoxyCompactList}\small\item\em \doxylink{namespacetk_a6540aa25eb8562f6d6c8b37977d6cfe8}{tk::\+lock()} で入ったクリティカルセクションを抜けます \end{DoxyCompactList}\item
  68. void \doxymbox{\hyperlink{namespacetk_a3254a7e2a9f5ed3abe44e8cf62a8dcfe}{preempt\+\_\+disable}} ()
  69. \begin{DoxyCompactList}\small\item\em 自コアのタスクスイッチ (プリエンプション) を一時的に禁止します \end{DoxyCompactList}\item
  70. void \doxymbox{\hyperlink{namespacetk_a70e6ee5f456e67a24ce13ff0fd04e4d9}{preempt\+\_\+enable}} ()
  71. \begin{DoxyCompactList}\small\item\em 自コアのタスクスイッチ (プリエンプション) を再開します \end{DoxyCompactList}\end{DoxyCompactItemize}
  72. \label{namespacetk_doc-typedef-members}
  73. \Hypertarget{namespacetk_doc-typedef-members}
  74. \doxysubsection{Typedef Documentation}
  75. \Hypertarget{namespacetk_ab1f2fa3d79e99f13610bd330a0df928b}\index{tk@{tk}!BinarySemaphore@{BinarySemaphore}}
  76. \index{BinarySemaphore@{BinarySemaphore}!tk@{tk}}
  77. \doxysubsubsection{\texorpdfstring{BinarySemaphore}{BinarySemaphore}}
  78. {\footnotesize\ttfamily \label{namespacetk_ab1f2fa3d79e99f13610bd330a0df928b}
  79. using \doxymbox{\hyperlink{namespacetk_ab1f2fa3d79e99f13610bd330a0df928b}{tk::\+\+Binary\+Semaphore}} = \doxymbox{\hyperlink{classtk_1_1_semaphore}{Semaphore}}}
  80. バイナリセマフォ (初期値1, 最大1) の型エイリアス
  81. \Hypertarget{namespacetk_add371a241ec6c1695ef4e67935317edd}\index{tk@{tk}!task\_mask\_t@{task\_mask\_t}}
  82. \index{task\_mask\_t@{task\_mask\_t}!tk@{tk}}
  83. \doxysubsubsection{\texorpdfstring{task\_mask\_t}{task\_mask\_t}}
  84. {\footnotesize\ttfamily \label{namespacetk_add371a241ec6c1695ef4e67935317edd}
  85. using \doxymbox{\hyperlink{namespacetk_add371a241ec6c1695ef4e67935317edd}{tk::\+task\+\_\+mask\+\_\+t}} = uint32\+\_\+t}
  86. \Hypertarget{namespacetk_a8908cf1e54cdc4e14ac3003126722cfc}\index{tk@{tk}!TaskFn@{TaskFn}}
  87. \index{TaskFn@{TaskFn}!tk@{tk}}
  88. \doxysubsubsection{\texorpdfstring{TaskFn}{TaskFn}}
  89. {\footnotesize\ttfamily \label{namespacetk_a8908cf1e54cdc4e14ac3003126722cfc}
  90. using \doxymbox{\hyperlink{namespacetk_a8908cf1e54cdc4e14ac3003126722cfc}{tk::\+\+Task\+Fn}} = void (\texorpdfstring{$\ast$}{*})(void\texorpdfstring{$\ast$}{*} arg)}
  91. タスク関数のシグネチャ (void func(void\texorpdfstring{$\ast$}{*} arg))
  92. \label{namespacetk_doc-enum-members}
  93. \Hypertarget{namespacetk_doc-enum-members}
  94. \doxysubsection{Enumeration Type Documentation}
  95. \Hypertarget{namespacetk_a3d47fbd63b95ed3b46bed70c2fa1e50e}\index{tk@{tk}!Prio@{Prio}}
  96. \index{Prio@{Prio}!tk@{tk}}
  97. \doxysubsubsection{\texorpdfstring{Prio}{Prio}}
  98. {\footnotesize\ttfamily \label{namespacetk_a3d47fbd63b95ed3b46bed70c2fa1e50e}
  99. enum \doxymbox{\hyperlink{namespacetk_a3d47fbd63b95ed3b46bed70c2fa1e50e}{tk::\+\+Prio}} :\+ uint32\+\_\+t}
  100. タスクの優先度レベル
  101. 数値が小さいほど高優先度です。0..15 の範囲で指定します (15 はアイドルタスク専用)。 \begin{DoxyEnumFields}[2]{Enumerator}
  102. \raisebox{\heightof{T}}[0pt][0pt]{\index{PRIO\_REALTIME@{PRIO\_REALTIME}!tk@{tk}}
  103. \index{tk@{tk}!PRIO\_REALTIME@{PRIO\_REALTIME}}
  104. }\Hypertarget{namespacetk_a3d47fbd63b95ed3b46bed70c2fa1e50eabbefd771d1fb2ac0708c1bd5371e5a75}\label{namespacetk_a3d47fbd63b95ed3b46bed70c2fa1e50eabbefd771d1fb2ac0708c1bd5371e5a75}
  105. PRIO\+\_\+\+REALTIME&リアルタイム最優先 \\
  106. \hline
  107. \raisebox{\heightof{T}}[0pt][0pt]{\index{PRIO\_HIGH@{PRIO\_HIGH}!tk@{tk}}
  108. \index{tk@{tk}!PRIO\_HIGH@{PRIO\_HIGH}}
  109. }\Hypertarget{namespacetk_a3d47fbd63b95ed3b46bed70c2fa1e50ea614240a3a3fc1094c6daa0fdca92ba37}\label{namespacetk_a3d47fbd63b95ed3b46bed70c2fa1e50ea614240a3a3fc1094c6daa0fdca92ba37}
  110. PRIO\+\_\+\+HIGH&高優先度 \\
  111. \hline
  112. \raisebox{\heightof{T}}[0pt][0pt]{\index{PRIO\_NORMAL@{PRIO\_NORMAL}!tk@{tk}}
  113. \index{tk@{tk}!PRIO\_NORMAL@{PRIO\_NORMAL}}
  114. }\Hypertarget{namespacetk_a3d47fbd63b95ed3b46bed70c2fa1e50ea0e6779023b97999c2cef66ba1d4d1fca}\label{namespacetk_a3d47fbd63b95ed3b46bed70c2fa1e50ea0e6779023b97999c2cef66ba1d4d1fca}
  115. PRIO\+\_\+\+NORMAL&通常優先度 (デフォルト) \\
  116. \hline
  117. \raisebox{\heightof{T}}[0pt][0pt]{\index{PRIO\_LOW@{PRIO\_LOW}!tk@{tk}}
  118. \index{tk@{tk}!PRIO\_LOW@{PRIO\_LOW}}
  119. }\Hypertarget{namespacetk_a3d47fbd63b95ed3b46bed70c2fa1e50eacf084edcfe985b77c205a37c3bd60519}\label{namespacetk_a3d47fbd63b95ed3b46bed70c2fa1e50eacf084edcfe985b77c205a37c3bd60519}
  120. PRIO\+\_\+\+LOW&低優先度 \\
  121. \hline
  122. \end{DoxyEnumFields}
  123. \label{namespacetk_doc-func-members}
  124. \Hypertarget{namespacetk_doc-func-members}
  125. \doxysubsection{Function Documentation}
  126. \Hypertarget{namespacetk_a6e721332f5a7d85998345ed218de7394}\index{tk@{tk}!create@{create}}
  127. \index{create@{create}!tk@{tk}}
  128. \doxysubsubsection{\texorpdfstring{create()}{create()}}
  129. {\footnotesize\ttfamily \label{namespacetk_a6e721332f5a7d85998345ed218de7394}
  130. \doxymbox{\hyperlink{structtk_1_1_task_handle}{tk::\+\+Task\+Handle}} tk::\+create (\begin{DoxyParamCaption}\item[{\doxymbox{\hyperlink{namespacetk_a8908cf1e54cdc4e14ac3003126722cfc}{Task\+Fn}}}]{fn}{, }\item[{void \texorpdfstring{$\ast$}{*}}]{arg}{ = {\ttfamily nullptr}, }\item[{uint32\+\_\+t}]{prio}{ = {\ttfamily \doxymbox{\hyperlink{namespacetk_a3d47fbd63b95ed3b46bed70c2fa1e50ea0e6779023b97999c2cef66ba1d4d1fca}{PRIO\+\_\+\+NORMAL}}}}\end{DoxyParamCaption})}
  131. タスクを生成・登録します
  132. \doxylink{namespacetk_a675f1829b87e2a43239b6f80a526d0ed}{tk::\+start()} を呼び出す前に登録する必要があります。
  133. \begin{DoxyParams}{Parameters}
  134. {\em fn} & タスク関数ポインタ (void (\texorpdfstring{$\ast$}{*})(void\texorpdfstring{$\ast$}{*} arg)) \\
  135. \hline
  136. {\em arg} & タスク関数に渡すユーザー引数ポインタ (省略時: nullptr) \\
  137. \hline
  138. {\em prio} & タスクの優先度 (省略時: \doxylink{namespacetk_a3d47fbd63b95ed3b46bed70c2fa1e50ea0e6779023b97999c2cef66ba1d4d1fca}{tk::\+\+PRIO\+\_\+\+NORMAL}) \\
  139. \hline
  140. \end{DoxyParams}
  141. \begin{DoxyReturn}{Returns}
  142. \doxylink{structtk_1_1_task_handle}{Task\+Handle} 生成されたタスクのハンドル。登録失敗時は is\+\_\+valid() が false
  143. \end{DoxyReturn}
  144. \Hypertarget{namespacetk_aba50cfc62cb8be71cf96df7f495a7a3d}\index{tk@{tk}!exit@{exit}}
  145. \index{exit@{exit}!tk@{tk}}
  146. \doxysubsubsection{\texorpdfstring{exit()}{exit()}}
  147. {\footnotesize\ttfamily \label{namespacetk_aba50cfc62cb8be71cf96df7f495a7a3d}
  148. void tk::\+exit (\begin{DoxyParamCaption}\item[{int}]{code}{ = {\ttfamily 0}}\end{DoxyParamCaption})}
  149. 現在のタスクを終了・破棄します
  150. \begin{DoxyParams}{Parameters}
  151. {\em code} & 終了コード (予約用、省略時: 0) \\
  152. \hline
  153. \end{DoxyParams}
  154. \begin{DoxyNote}{Note}
  155. タスク関数の末尾に到達した場合は自動的に呼ばれます。
  156. \end{DoxyNote}
  157. \Hypertarget{namespacetk_a6540aa25eb8562f6d6c8b37977d6cfe8}\index{tk@{tk}!lock@{lock}}
  158. \index{lock@{lock}!tk@{tk}}
  159. \doxysubsubsection{\texorpdfstring{lock()}{lock()}}
  160. {\footnotesize\ttfamily \label{namespacetk_a6540aa25eb8562f6d6c8b37977d6cfe8}
  161. bool tk::\+lock (\begin{DoxyParamCaption}{}{}\end{DoxyParamCaption})}
  162. ハードウェアスピンロックと全割り込み禁止によるクリティカルセクションに入ります
  163. \begin{DoxyReturn}{Returns}
  164. true 呼び出し前の割り込みが有効だった場合
  165. false 呼び出し前の割り込みが無効だった場合
  166. \end{DoxyReturn}
  167. \begin{DoxyWarning}{Warning}
  168. 長時間のロックは避けてください。数マイクロ秒以内のレジスタ操作等に使用します。
  169. \end{DoxyWarning}
  170. \Hypertarget{namespacetk_a46e15375fba47cbd1a93278f17e77848}\index{tk@{tk}!now\_ms@{now\_ms}}
  171. \index{now\_ms@{now\_ms}!tk@{tk}}
  172. \doxysubsubsection{\texorpdfstring{now\_ms()}{now\_ms()}}
  173. {\footnotesize\ttfamily \label{namespacetk_a46e15375fba47cbd1a93278f17e77848}
  174. uint64\+\_\+t tk::\+now\+\_\+ms (\begin{DoxyParamCaption}{}{}\end{DoxyParamCaption})}
  175. システム起動時からの経過時間をミリ秒単位で取得します
  176. \begin{DoxyReturn}{Returns}
  177. uint64\+\_\+t 経過ミリ秒数 (分解能: 1 / TK\+\_\+\+TICKS\+\_\+\+PER\+\_\+\+SEC 秒)
  178. \end{DoxyReturn}
  179. \Hypertarget{namespacetk_a3254a7e2a9f5ed3abe44e8cf62a8dcfe}\index{tk@{tk}!preempt\_disable@{preempt\_disable}}
  180. \index{preempt\_disable@{preempt\_disable}!tk@{tk}}
  181. \doxysubsubsection{\texorpdfstring{preempt\_disable()}{preempt\_disable()}}
  182. {\footnotesize\ttfamily \label{namespacetk_a3254a7e2a9f5ed3abe44e8cf62a8dcfe}
  183. void tk::\+preempt\+\_\+disable (\begin{DoxyParamCaption}{}{}\end{DoxyParamCaption})}
  184. 自コアのタスクスイッチ (プリエンプション) を一時的に禁止します
  185. 割り込み (Sys\+Tick やタイマー、\+NVIC) は停止しないため、通信クロックや時刻更新を 阻害することなく、自タスクの処理をアトミックに実行できます。ネスト (入れ子) 呼び出しに対応しています。
  186. \begin{DoxySeeAlso}{See also}
  187. \doxylink{classtk_1_1_preempt_guard}{tk::\+\+Preempt\+Guard}, \doxylink{namespacetk_a70e6ee5f456e67a24ce13ff0fd04e4d9}{tk::\+preempt\+\_\+enable()}
  188. \end{DoxySeeAlso}
  189. \Hypertarget{namespacetk_a70e6ee5f456e67a24ce13ff0fd04e4d9}\index{tk@{tk}!preempt\_enable@{preempt\_enable}}
  190. \index{preempt\_enable@{preempt\_enable}!tk@{tk}}
  191. \doxysubsubsection{\texorpdfstring{preempt\_enable()}{preempt\_enable()}}
  192. {\footnotesize\ttfamily \label{namespacetk_a70e6ee5f456e67a24ce13ff0fd04e4d9}
  193. void tk::\+preempt\+\_\+enable (\begin{DoxyParamCaption}{}{}\end{DoxyParamCaption})}
  194. 自コアのタスクスイッチ (プリエンプション) を再開します
  195. ネストカウンタが 0 に戻った時点で、保留されていたタスクスイッチが即座に実行されます。
  196. \begin{DoxySeeAlso}{See also}
  197. \doxylink{classtk_1_1_preempt_guard}{tk::\+\+Preempt\+Guard}, \doxylink{namespacetk_a3254a7e2a9f5ed3abe44e8cf62a8dcfe}{tk::\+preempt\+\_\+disable()}
  198. \end{DoxySeeAlso}
  199. \Hypertarget{namespacetk_a083495c9bf857a63f6c20a20aac0ca52}\index{tk@{tk}!publish@{publish}}
  200. \index{publish@{publish}!tk@{tk}}
  201. \doxysubsubsection{\texorpdfstring{publish()}{publish()}\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
  202. {\footnotesize\ttfamily \label{namespacetk_a083495c9bf857a63f6c20a20aac0ca52}
  203. template$<$typename Msg\+Type$>$ \\
  204. size\+\_\+t tk::\+publish (\begin{DoxyParamCaption}\item[{const Msg\+Type \&}]{msg}{}\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}
  205. メッセージの型を指定して、購読しているすべての \doxylink{classtk_1_1_actor}{Actor} へ同報配信します
  206. 送信側は \doxylink{classtk_1_1_actor}{Actor} のインスタンスや名前を知る必要がありません (完全疎結合)。 メッセージの実体は各 \doxylink{classtk_1_1_actor}{Actor} のキューへ値コピーされるため、スタック上のローカル変数でも安全に渡せます。
  207. \begin{DoxyTemplParams}{Template Parameters}
  208. {\em Msg\+Type} & 配信するメッセージ型 \\
  209. \hline
  210. \end{DoxyTemplParams}
  211. \begin{DoxyParams}{Parameters}
  212. {\em msg} & 送信するメッセージ \\
  213. \hline
  214. \end{DoxyParams}
  215. \begin{DoxyReturn}{Returns}
  216. size\+\_\+t 配信に成功した \doxylink{classtk_1_1_actor}{Actor} の数
  217. \end{DoxyReturn}
  218. \begin{DoxyCode}{0}
  219. \DoxyCodeLine{MyEvent\ ev\{1,\ \textcolor{stringliteral}{"{}Button\ Pressed"{}}\};}
  220. \DoxyCodeLine{\doxymbox{\hyperlink{namespacetk_a083495c9bf857a63f6c20a20aac0ca52}{tk::publish}}(ev);\ \textcolor{comment}{//\ MyEvent\ を受け付けるすべての\ Actor\ に届く}}
  221. \end{DoxyCode}
  222. \Hypertarget{namespacetk_a5549bec310750722a1964de1145b9fed}\index{tk@{tk}!publish@{publish}}
  223. \index{publish@{publish}!tk@{tk}}
  224. \doxysubsubsection{\texorpdfstring{publish()}{publish()}\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
  225. {\footnotesize\ttfamily \label{namespacetk_a5549bec310750722a1964de1145b9fed}
  226. size\+\_\+t tk::\+publish (\begin{DoxyParamCaption}\item[{uint32\+\_\+t}]{id}{, }\item[{uintptr\+\_\+t}]{arg}{ = {\ttfamily 0}}\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}
  227. \doxylink{structtk_1_1_message}{tk::\+\+Message} 型の同報配信ショートカット
  228. \begin{DoxyParams}{Parameters}
  229. {\em id} & メッセージ\+ID \\
  230. \hline
  231. {\em arg} & 引数 (省略時: 0) \\
  232. \hline
  233. \end{DoxyParams}
  234. \begin{DoxyReturn}{Returns}
  235. size\+\_\+t 配信に成功した \doxylink{classtk_1_1_actor}{Actor} の数
  236. \end{DoxyReturn}
  237. \Hypertarget{namespacetk_aae83f84121085578a7568437a8dc2447}\index{tk@{tk}!sleep\_ms@{sleep\_ms}}
  238. \index{sleep\_ms@{sleep\_ms}!tk@{tk}}
  239. \doxysubsubsection{\texorpdfstring{sleep\_ms()}{sleep\_ms()}}
  240. {\footnotesize\ttfamily \label{namespacetk_aae83f84121085578a7568437a8dc2447}
  241. void tk::\+sleep\+\_\+ms (\begin{DoxyParamCaption}\item[{uint32\+\_\+t}]{ms}{}\end{DoxyParamCaption})}
  242. 現在のタスクを指定時間スリープさせます
  243. スリープ中はタスクが休止状態になり、\+CPU は他のタスクへ自動的に割り当てられます (CPU消費ゼロ)。
  244. \begin{DoxyParams}{Parameters}
  245. {\em ms} & スリープする時間 (ミリ秒) \\
  246. \hline
  247. \end{DoxyParams}
  248. \begin{DoxyNote}{Note}
  249. タスクコンテキスト内から呼び出す必要があります。
  250. \end{DoxyNote}
  251. \Hypertarget{namespacetk_a675f1829b87e2a43239b6f80a526d0ed}\index{tk@{tk}!start@{start}}
  252. \index{start@{start}!tk@{tk}}
  253. \doxysubsubsection{\texorpdfstring{start()}{start()}}
  254. {\footnotesize\ttfamily \label{namespacetk_a675f1829b87e2a43239b6f80a526d0ed}
  255. void tk::\+start (\begin{DoxyParamCaption}{}{}\end{DoxyParamCaption})}
  256. tinykernel スケジューラを起動します
  257. Core 0 のスケジューラを開始し、\+Core 1 を自動ブートしてデュアルコア並行実行を開始します。 この関数から制御が戻ることはありません (Never returns)。 \Hypertarget{namespacetk_a752b12f6862815c94a52347af52578b7}\index{tk@{tk}!unlock@{unlock}}
  258. \index{unlock@{unlock}!tk@{tk}}
  259. \doxysubsubsection{\texorpdfstring{unlock()}{unlock()}}
  260. {\footnotesize\ttfamily \label{namespacetk_a752b12f6862815c94a52347af52578b7}
  261. void tk::\+unlock (\begin{DoxyParamCaption}\item[{bool}]{was\+\_\+enabled}{}\end{DoxyParamCaption})}
  262. \doxylink{namespacetk_a6540aa25eb8562f6d6c8b37977d6cfe8}{tk::\+lock()} で入ったクリティカルセクションを抜けます
  263. \begin{DoxyParams}{Parameters}
  264. {\em was\+\_\+enabled} & \doxylink{namespacetk_a6540aa25eb8562f6d6c8b37977d6cfe8}{tk::\+lock()} の戻り値 \\
  265. \hline
  266. \end{DoxyParams}
  267. \Hypertarget{namespacetk_a8081956b0a19b87d5b7c81b772373397}\index{tk@{tk}!yield@{yield}}
  268. \index{yield@{yield}!tk@{tk}}
  269. \doxysubsubsection{\texorpdfstring{yield()}{yield()}}
  270. {\footnotesize\ttfamily \label{namespacetk_a8081956b0a19b87d5b7c81b772373397}
  271. void tk::\+yield (\begin{DoxyParamCaption}{}{}\end{DoxyParamCaption})}
  272. 現在実行中のタスクを一時中断し、同優先度の他のタスクへ CPU を譲渡します
  273. \begin{DoxyNote}{Note}
  274. タスクコンテキスト内から呼び出す必要があります。
  275. \end{DoxyNote}