omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / aienux / crates / aienos-kernel / usb_xhci_test.om
| 1 | note Behavioral test suite for aienos-kernel USB & xHCI stack (usb_xhci.om) |
| 2 | note Composed with si/directives/om2.om and usb_xhci.om. |
| 3 | note Returns 0 on pass and distinct non-zero exit codes on every failure. |
| 4 | |
| 5 | fn kux_test_sink_eq sink view KuxTextSink want view uchar * to bool |
| 6 | if ne get sink cnt len want |
| 7 | ret false |
| 8 | end |
| 9 | n = len want |
| 10 | for i ulong n bound 64 |
| 11 | if ne get sink buf i get want i |
| 12 | ret false |
| 13 | end |
| 14 | end |
| 15 | ret true |
| 16 | end |
| 17 | |
| 18 | fn kux_test_make_report dst edit uchar 8 mods uchar k0 uchar k1 uchar k2 uchar k3 uchar to void |
| 19 | put dst 0 mods |
| 20 | put dst 1 uchar 0 |
| 21 | put dst 2 k0 |
| 22 | put dst 3 k1 |
| 23 | put dst 4 k2 |
| 24 | put dst 5 k3 |
| 25 | put dst 6 uchar 0 |
| 26 | put dst 7 uchar 0 |
| 27 | end |
| 28 | |
| 29 | fn kux_test_descriptors to int |
| 30 | kbd_desc = new uchar 34 0 |
| 31 | comp = new uchar 57 0 |
| 32 | dev1 = new uchar 8 0 |
| 33 | dev2 = new uchar 10 0 |
| 34 | dev_short = new uchar 3 0 |
| 35 | bad_cfg = new uchar 4 0 |
| 36 | res = new KuxBootKbd false 0 0 0 0 0 |
| 37 | |
| 38 | note QEMU 8.2.2 usb-kbd config descriptor (34 bytes) |
| 39 | put kbd_desc 0 uchar 9 |
| 40 | put kbd_desc 1 uchar 2 |
| 41 | put kbd_desc 2 uchar 34 |
| 42 | put kbd_desc 4 uchar 1 |
| 43 | put kbd_desc 5 uchar 1 |
| 44 | put kbd_desc 6 uchar 8 |
| 45 | put kbd_desc 7 uchar 0xa0 |
| 46 | put kbd_desc 8 uchar 50 |
| 47 | put kbd_desc 9 uchar 9 |
| 48 | put kbd_desc 10 uchar 4 |
| 49 | put kbd_desc 13 uchar 1 |
| 50 | put kbd_desc 14 uchar 3 |
| 51 | put kbd_desc 15 uchar 1 |
| 52 | put kbd_desc 16 uchar 1 |
| 53 | put kbd_desc 18 uchar 9 |
| 54 | put kbd_desc 19 uchar 0x21 |
| 55 | put kbd_desc 20 uchar 0x11 |
| 56 | put kbd_desc 21 uchar 0x01 |
| 57 | put kbd_desc 23 uchar 1 |
| 58 | put kbd_desc 24 uchar 0x22 |
| 59 | put kbd_desc 25 uchar 63 |
| 60 | put kbd_desc 27 uchar 7 |
| 61 | put kbd_desc 28 uchar 5 |
| 62 | put kbd_desc 29 uchar 0x81 |
| 63 | put kbd_desc 30 uchar 3 |
| 64 | put kbd_desc 31 uchar 8 |
| 65 | put kbd_desc 33 uchar 7 |
| 66 | |
| 67 | if not kux_find_boot_keyboard kbd_desc res |
| 68 | ret 1 |
| 69 | end |
| 70 | if ne get res cfg uchar 1 |
| 71 | ret 2 |
| 72 | end |
| 73 | if ne get res iface uchar 0 |
| 74 | ret 2 |
| 75 | end |
| 76 | if ne get res ep_addr uchar 0x81 |
| 77 | ret 2 |
| 78 | end |
| 79 | if ne get res max_pkt ushort 8 |
| 80 | ret 2 |
| 81 | end |
| 82 | if ne get res ival uchar 7 |
| 83 | ret 2 |
| 84 | end |
| 85 | |
| 86 | note Composite device: mouse + keyboard OUT + keyboard IN |
| 87 | put comp 0 uchar 9 |
| 88 | put comp 1 uchar 2 |
| 89 | put comp 2 uchar 50 |
| 90 | put comp 4 uchar 2 |
| 91 | put comp 5 uchar 2 |
| 92 | put comp 7 uchar 0xa0 |
| 93 | put comp 8 uchar 50 |
| 94 | put comp 9 uchar 9 |
| 95 | put comp 10 uchar 4 |
| 96 | put comp 13 uchar 1 |
| 97 | put comp 14 uchar 3 |
| 98 | put comp 15 uchar 1 |
| 99 | put comp 16 uchar 2 |
| 100 | put comp 18 uchar 7 |
| 101 | put comp 19 uchar 5 |
| 102 | put comp 20 uchar 0x81 |
| 103 | put comp 21 uchar 3 |
| 104 | put comp 22 uchar 4 |
| 105 | put comp 24 uchar 10 |
| 106 | put comp 25 uchar 9 |
| 107 | put comp 26 uchar 4 |
| 108 | put comp 27 uchar 1 |
| 109 | put comp 29 uchar 2 |
| 110 | put comp 30 uchar 3 |
| 111 | put comp 31 uchar 1 |
| 112 | put comp 32 uchar 1 |
| 113 | put comp 34 uchar 7 |
| 114 | put comp 35 uchar 5 |
| 115 | put comp 36 uchar 0x02 |
| 116 | put comp 37 uchar 3 |
| 117 | put comp 38 uchar 8 |
| 118 | put comp 40 uchar 10 |
| 119 | put comp 41 uchar 9 |
| 120 | put comp 42 uchar 0x21 |
| 121 | put comp 43 uchar 0x11 |
| 122 | put comp 44 uchar 0x01 |
| 123 | put comp 46 uchar 1 |
| 124 | put comp 47 uchar 0x22 |
| 125 | put comp 48 uchar 63 |
| 126 | |
| 127 | note Without keyboard IN endpoint (first 50 bytes) |
| 128 | if kux_find_boot_keyboard part comp 0 50 res |
| 129 | ret 3 |
| 130 | end |
| 131 | |
| 132 | note Append keyboard IN endpoint 0x83 and update wTotalLength to 57 |
| 133 | put comp 2 uchar 57 |
| 134 | put comp 50 uchar 7 |
| 135 | put comp 51 uchar 5 |
| 136 | put comp 52 uchar 0x83 |
| 137 | put comp 53 uchar 3 |
| 138 | put comp 54 uchar 8 |
| 139 | put comp 56 uchar 4 |
| 140 | if not kux_find_boot_keyboard comp res |
| 141 | ret 4 |
| 142 | end |
| 143 | if ne get res cfg uchar 2 |
| 144 | ret 5 |
| 145 | end |
| 146 | if ne get res iface uchar 1 |
| 147 | ret 5 |
| 148 | end |
| 149 | if ne get res ep_addr uchar 0x83 |
| 150 | ret 5 |
| 151 | end |
| 152 | if ne get res ival uchar 4 |
| 153 | ret 5 |
| 154 | end |
| 155 | |
| 156 | note Stops at wTotalLength, zero-length, overrun, truncation, bad type |
| 157 | put kbd_desc 2 uchar 27 |
| 158 | if kux_find_boot_keyboard kbd_desc res |
| 159 | ret 6 |
| 160 | end |
| 161 | put kbd_desc 2 uchar 34 |
| 162 | put kbd_desc 9 uchar 0 |
| 163 | if kux_find_boot_keyboard kbd_desc res |
| 164 | ret 7 |
| 165 | end |
| 166 | put kbd_desc 9 uchar 9 |
| 167 | put kbd_desc 27 uchar 200 |
| 168 | if kux_find_boot_keyboard kbd_desc res |
| 169 | ret 8 |
| 170 | end |
| 171 | put kbd_desc 27 uchar 7 |
| 172 | if kux_find_boot_keyboard part kbd_desc 0 20 res |
| 173 | ret 9 |
| 174 | end |
| 175 | put bad_cfg 0 uchar 9 |
| 176 | put bad_cfg 1 uchar 1 |
| 177 | if kux_find_boot_keyboard bad_cfg res |
| 178 | ret 10 |
| 179 | end |
| 180 | |
| 181 | note control_max_packet |
| 182 | put dev1 0 uchar 18 |
| 183 | put dev1 1 uchar 1 |
| 184 | put dev1 3 uchar 2 |
| 185 | put dev1 7 uchar 64 |
| 186 | if ne kux_control_max_packet dev1 uchar 64 |
| 187 | ret 11 |
| 188 | end |
| 189 | put dev2 0 uchar 18 |
| 190 | put dev2 1 uchar 1 |
| 191 | put dev2 2 uchar 0x10 |
| 192 | put dev2 3 uchar 0x01 |
| 193 | put dev2 7 uchar 8 |
| 194 | put dev2 8 uchar 0x27 |
| 195 | put dev2 9 uchar 0x06 |
| 196 | if ne kux_control_max_packet dev2 uchar 8 |
| 197 | ret 12 |
| 198 | end |
| 199 | put dev1 1 uchar 2 |
| 200 | if ne kux_control_max_packet dev1 uchar 0 |
| 201 | ret 13 |
| 202 | end |
| 203 | put dev1 1 uchar 1 |
| 204 | put dev1 7 uchar 0 |
| 205 | if ne kux_control_max_packet dev1 uchar 0 |
| 206 | ret 14 |
| 207 | end |
| 208 | put dev_short 0 uchar 18 |
| 209 | put dev_short 1 uchar 1 |
| 210 | if ne kux_control_max_packet dev_short uchar 0 |
| 211 | ret 15 |
| 212 | end |
| 213 | ret 0 |
| 214 | end |
| 215 | |
| 216 | fn kux_test_hid to int |
| 217 | dec = new KuxKbdDec 0 |
| 218 | sink = new KuxTextSink 0 0 0 |
| 219 | rep = new uchar 8 0 |
| 220 | short_rep = new uchar 4 0 |
| 221 | ev = new KuxKeyEvent 0 0 |
| 222 | |
| 223 | note Make, release, held key does not repeat |
| 224 | kux_kbd_init dec |
| 225 | kux_sink_init sink ulong 16 |
| 226 | kux_test_make_report rep uchar 0 uchar 0x04 uchar 0 uchar 0 uchar 0 |
| 227 | n = kux_kbd_handle_report dec rep sink |
| 228 | if ne n ulong 1 |
| 229 | ret 20 |
| 230 | end |
| 231 | if ne get sink cnt ulong 1 |
| 232 | ret 20 |
| 233 | end |
| 234 | if ne get sink buf 0 uchar 97 |
| 235 | ret 20 |
| 236 | end |
| 237 | kux_sink_init sink ulong 16 |
| 238 | kux_test_make_report rep uchar 0 uchar 0 uchar 0 uchar 0 uchar 0 |
| 239 | n = kux_kbd_handle_report dec rep sink |
| 240 | if ne n ulong 0 |
| 241 | ret 21 |
| 242 | end |
| 243 | kux_sink_init sink ulong 16 |
| 244 | kux_test_make_report rep uchar 0 uchar 0x04 uchar 0 uchar 0 uchar 0 |
| 245 | n = kux_kbd_handle_report dec rep sink |
| 246 | if ne n ulong 1 |
| 247 | ret 22 |
| 248 | end |
| 249 | kux_sink_init sink ulong 16 |
| 250 | n = kux_kbd_handle_report dec rep sink |
| 251 | if ne n ulong 0 |
| 252 | ret 23 |
| 253 | end |
| 254 | |
| 255 | note Shift and digits (left shift A!, right shift )\n) |
| 256 | kux_kbd_init dec |
| 257 | kux_sink_init sink ulong 16 |
| 258 | kux_test_make_report rep KUX_MOD_LSHIFT uchar 0x04 uchar 0x1e uchar 0 uchar 0 |
| 259 | n = kux_kbd_handle_report dec rep sink |
| 260 | if ne get sink cnt ulong 2 |
| 261 | ret 24 |
| 262 | end |
| 263 | if ne get sink buf 0 uchar 65 |
| 264 | ret 24 |
| 265 | end |
| 266 | if ne get sink buf 1 uchar 33 |
| 267 | ret 24 |
| 268 | end |
| 269 | |
| 270 | kux_kbd_init dec |
| 271 | kux_sink_init sink ulong 16 |
| 272 | kux_test_make_report rep KUX_MOD_RSHIFT uchar 0x27 uchar 0x28 uchar 0 uchar 0 |
| 273 | n = kux_kbd_handle_report dec rep sink |
| 274 | if ne get sink cnt ulong 2 |
| 275 | ret 25 |
| 276 | end |
| 277 | if ne get sink buf 0 uchar 41 |
| 278 | ret 25 |
| 279 | end |
| 280 | if ne get sink buf 1 uchar 10 |
| 281 | ret 25 |
| 282 | end |
| 283 | |
| 284 | note Punctuation and space: " -,./" and "{}|:\"~" and "_+~<>?" |
| 285 | kux_kbd_init dec |
| 286 | kux_sink_init sink ulong 16 |
| 287 | kux_test_make_report rep uchar 0 uchar 0x2c uchar 0x2d uchar 0x36 uchar 0x37 |
| 288 | put rep 6 uchar 0x38 |
| 289 | n = kux_kbd_handle_report dec rep sink |
| 290 | if ne get sink cnt ulong 5 |
| 291 | ret 26 |
| 292 | end |
| 293 | if ne get sink buf 0 uchar 32 |
| 294 | ret 26 |
| 295 | end |
| 296 | if ne get sink buf 1 uchar 45 |
| 297 | ret 26 |
| 298 | end |
| 299 | if ne get sink buf 2 uchar 44 |
| 300 | ret 26 |
| 301 | end |
| 302 | if ne get sink buf 3 uchar 46 |
| 303 | ret 26 |
| 304 | end |
| 305 | if ne get sink buf 4 uchar 47 |
| 306 | ret 26 |
| 307 | end |
| 308 | |
| 309 | kux_kbd_init dec |
| 310 | kux_sink_init sink ulong 16 |
| 311 | kux_test_make_report rep KUX_MOD_LSHIFT uchar 0x2f uchar 0x30 uchar 0x31 uchar 0x33 |
| 312 | put rep 6 uchar 0x34 |
| 313 | put rep 7 uchar 0x35 |
| 314 | n = kux_kbd_handle_report dec rep sink |
| 315 | if ne get sink cnt ulong 6 |
| 316 | ret 27 |
| 317 | end |
| 318 | if ne get sink buf 0 uchar 123 |
| 319 | ret 27 |
| 320 | end |
| 321 | if ne get sink buf 1 uchar 125 |
| 322 | ret 27 |
| 323 | end |
| 324 | if ne get sink buf 2 uchar 124 |
| 325 | ret 27 |
| 326 | end |
| 327 | if ne get sink buf 3 uchar 58 |
| 328 | ret 27 |
| 329 | end |
| 330 | if ne get sink buf 4 uchar 34 |
| 331 | ret 27 |
| 332 | end |
| 333 | if ne get sink buf 5 uchar 126 |
| 334 | ret 27 |
| 335 | end |
| 336 | |
| 337 | kux_kbd_init dec |
| 338 | kux_sink_init sink ulong 16 |
| 339 | kux_test_make_report rep KUX_MOD_LSHIFT uchar 0x2d uchar 0x2e uchar 0x32 uchar 0x36 |
| 340 | put rep 6 uchar 0x37 |
| 341 | put rep 7 uchar 0x38 |
| 342 | n = kux_kbd_handle_report dec rep sink |
| 343 | if ne get sink cnt ulong 6 |
| 344 | ret 28 |
| 345 | end |
| 346 | if ne get sink buf 0 uchar 95 |
| 347 | ret 28 |
| 348 | end |
| 349 | if ne get sink buf 1 uchar 43 |
| 350 | ret 28 |
| 351 | end |
| 352 | if ne get sink buf 2 uchar 126 |
| 353 | ret 28 |
| 354 | end |
| 355 | if ne get sink buf 3 uchar 60 |
| 356 | ret 28 |
| 357 | end |
| 358 | if ne get sink buf 4 uchar 62 |
| 359 | ret 28 |
| 360 | end |
| 361 | if ne get sink buf 5 uchar 63 |
| 362 | ret 28 |
| 363 | end |
| 364 | |
| 365 | note Control keys and arrows: Backspace, Tab, Escape, Up -> \x08\t\x1b\x1b[A |
| 366 | kux_kbd_init dec |
| 367 | kux_sink_init sink ulong 32 |
| 368 | kux_test_make_report rep uchar 0 uchar 0x2a uchar 0x2b uchar 0x29 uchar 0 |
| 369 | n = kux_kbd_handle_report dec rep sink |
| 370 | kux_test_make_report rep uchar 0 uchar 0 uchar 0 uchar 0 uchar 0 |
| 371 | n = kux_kbd_handle_report dec rep sink |
| 372 | kux_test_make_report rep uchar 0 KUX_USAGE_UP_ARROW uchar 0 uchar 0 uchar 0 |
| 373 | n = kux_kbd_handle_report dec rep sink |
| 374 | if ne get sink cnt ulong 6 |
| 375 | ret 29 |
| 376 | end |
| 377 | if ne get sink buf 0 uchar 8 |
| 378 | ret 29 |
| 379 | end |
| 380 | if ne get sink buf 1 uchar 9 |
| 381 | ret 29 |
| 382 | end |
| 383 | if ne get sink buf 2 uchar 0x1b |
| 384 | ret 29 |
| 385 | end |
| 386 | if ne get sink buf 3 uchar 0x1b |
| 387 | ret 29 |
| 388 | end |
| 389 | if ne get sink buf 4 uchar 91 |
| 390 | ret 29 |
| 391 | end |
| 392 | if ne get sink buf 5 uchar 65 |
| 393 | ret 29 |
| 394 | end |
| 395 | |
| 396 | note Rollover phantom report does not release held key; wrong length ignored |
| 397 | kux_kbd_init dec |
| 398 | kux_sink_init sink ulong 8 |
| 399 | kux_test_make_report rep uchar 0 uchar 0x04 uchar 0 uchar 0 uchar 0 |
| 400 | n = kux_kbd_handle_report dec rep sink |
| 401 | kux_sink_init sink ulong 8 |
| 402 | kux_test_make_report rep uchar 0 uchar 1 uchar 1 uchar 1 uchar 1 |
| 403 | put rep 6 uchar 1 |
| 404 | put rep 7 uchar 1 |
| 405 | n = kux_kbd_handle_report dec rep sink |
| 406 | if ne n ulong 0 |
| 407 | ret 30 |
| 408 | end |
| 409 | kux_test_make_report rep uchar 0 uchar 0x04 uchar 0 uchar 0 uchar 0 |
| 410 | n = kux_kbd_handle_report dec rep sink |
| 411 | if ne get sink cnt ulong 0 |
| 412 | ret 31 |
| 413 | end |
| 414 | n = kux_kbd_handle_report dec short_rep sink |
| 415 | if ne n ulong 0 |
| 416 | ret 32 |
| 417 | end |
| 418 | |
| 419 | note Unmapped usages dropped (CapsLock, F1, F12) |
| 420 | kux_kbd_init dec |
| 421 | kux_sink_init sink ulong 8 |
| 422 | kux_test_make_report rep uchar 0 KUX_USAGE_CAPS_LOCK KUX_USAGE_F1 KUX_USAGE_F12 uchar 0 |
| 423 | n = kux_kbd_handle_report dec rep sink |
| 424 | if ne n ulong 0 |
| 425 | ret 33 |
| 426 | end |
| 427 | |
| 428 | note Sink truncates at capacity 4 ("hello" -> "hell") |
| 429 | kux_sink_init sink ulong 4 |
| 430 | put ev kind KUX_KEY_CHAR |
| 431 | put ev ch uchar 104 |
| 432 | kux_sink_record sink ev |
| 433 | put ev ch uchar 101 |
| 434 | kux_sink_record sink ev |
| 435 | put ev ch uchar 108 |
| 436 | kux_sink_record sink ev |
| 437 | put ev ch uchar 108 |
| 438 | kux_sink_record sink ev |
| 439 | put ev ch uchar 111 |
| 440 | kux_sink_record sink ev |
| 441 | if ne get sink cnt ulong 4 |
| 442 | ret 34 |
| 443 | end |
| 444 | if ne get sink buf 3 uchar 108 |
| 445 | ret 34 |
| 446 | end |
| 447 | ret 0 |
| 448 | end |
| 449 | |
| 450 | fn kux_test_fill_uac1 dst edit uchar 73 to void |
| 451 | note Real UAC1 descriptor (73 bytes) |
| 452 | put dst 0 uchar 9 |
| 453 | put dst 1 uchar 2 |
| 454 | put dst 2 uchar 73 |
| 455 | put dst 4 uchar 2 |
| 456 | put dst 5 uchar 1 |
| 457 | put dst 7 uchar 0x80 |
| 458 | put dst 8 uchar 50 |
| 459 | put dst 9 uchar 9 |
| 460 | put dst 10 uchar 4 |
| 461 | put dst 14 uchar 1 |
| 462 | put dst 15 uchar 1 |
| 463 | put dst 18 uchar 9 |
| 464 | put dst 19 uchar 0x24 |
| 465 | put dst 20 uchar 1 |
| 466 | put dst 22 uchar 1 |
| 467 | put dst 23 uchar 0x26 |
| 468 | put dst 25 uchar 1 |
| 469 | put dst 26 uchar 1 |
| 470 | put dst 27 uchar 9 |
| 471 | put dst 28 uchar 4 |
| 472 | put dst 29 uchar 1 |
| 473 | put dst 32 uchar 1 |
| 474 | put dst 33 uchar 2 |
| 475 | put dst 36 uchar 9 |
| 476 | put dst 37 uchar 4 |
| 477 | put dst 38 uchar 1 |
| 478 | put dst 39 uchar 1 |
| 479 | put dst 40 uchar 1 |
| 480 | put dst 41 uchar 1 |
| 481 | put dst 42 uchar 2 |
| 482 | put dst 45 uchar 7 |
| 483 | put dst 46 uchar 0x24 |
| 484 | put dst 47 uchar 1 |
| 485 | put dst 48 uchar 1 |
| 486 | put dst 49 uchar 2 |
| 487 | put dst 50 uchar 3 |
| 488 | put dst 52 uchar 11 |
| 489 | put dst 53 uchar 0x24 |
| 490 | put dst 54 uchar 2 |
| 491 | put dst 55 uchar 1 |
| 492 | put dst 56 uchar 2 |
| 493 | put dst 57 uchar 2 |
| 494 | put dst 58 uchar 16 |
| 495 | put dst 59 uchar 1 |
| 496 | put dst 60 uchar 0x80 |
| 497 | put dst 61 uchar 0xbb |
| 498 | put dst 63 uchar 9 |
| 499 | put dst 64 uchar 5 |
| 500 | put dst 65 uchar 1 |
| 501 | put dst 66 uchar 1 |
| 502 | put dst 67 uchar 192 |
| 503 | put dst 69 uchar 1 |
| 504 | end |
| 505 | |
| 506 | fn kux_test_fill_uac2 dst edit uchar 85 to void |
| 507 | note Real UAC2 descriptor (85 bytes) |
| 508 | put dst 0 uchar 9 |
| 509 | put dst 1 uchar 2 |
| 510 | put dst 2 uchar 85 |
| 511 | put dst 4 uchar 2 |
| 512 | put dst 5 uchar 1 |
| 513 | put dst 7 uchar 0x80 |
| 514 | put dst 8 uchar 50 |
| 515 | put dst 9 uchar 9 |
| 516 | put dst 10 uchar 4 |
| 517 | put dst 14 uchar 1 |
| 518 | put dst 15 uchar 1 |
| 519 | put dst 18 uchar 9 |
| 520 | put dst 19 uchar 0x24 |
| 521 | put dst 20 uchar 1 |
| 522 | put dst 22 uchar 2 |
| 523 | put dst 23 uchar 9 |
| 524 | put dst 25 uchar 1 |
| 525 | put dst 26 uchar 1 |
| 526 | put dst 27 uchar 8 |
| 527 | put dst 28 uchar 0x24 |
| 528 | put dst 29 uchar 0x0a |
| 529 | put dst 30 uchar 3 |
| 530 | put dst 31 uchar 7 |
| 531 | put dst 35 uchar 9 |
| 532 | put dst 36 uchar 4 |
| 533 | put dst 37 uchar 1 |
| 534 | put dst 40 uchar 1 |
| 535 | put dst 41 uchar 2 |
| 536 | put dst 44 uchar 9 |
| 537 | put dst 45 uchar 4 |
| 538 | put dst 46 uchar 1 |
| 539 | put dst 47 uchar 1 |
| 540 | put dst 48 uchar 1 |
| 541 | put dst 49 uchar 1 |
| 542 | put dst 50 uchar 2 |
| 543 | put dst 53 uchar 16 |
| 544 | put dst 54 uchar 0x24 |
| 545 | put dst 55 uchar 1 |
| 546 | put dst 56 uchar 1 |
| 547 | put dst 58 uchar 1 |
| 548 | put dst 59 uchar 1 |
| 549 | put dst 63 uchar 2 |
| 550 | put dst 64 uchar 3 |
| 551 | put dst 69 uchar 6 |
| 552 | put dst 70 uchar 0x24 |
| 553 | put dst 71 uchar 2 |
| 554 | put dst 72 uchar 1 |
| 555 | put dst 73 uchar 2 |
| 556 | put dst 74 uchar 16 |
| 557 | put dst 75 uchar 9 |
| 558 | put dst 76 uchar 5 |
| 559 | put dst 77 uchar 1 |
| 560 | put dst 78 uchar 1 |
| 561 | put dst 79 uchar 192 |
| 562 | put dst 81 uchar 1 |
| 563 | end |
| 564 | |
| 565 | fn kux_test_audio_desc to int |
| 566 | uac1 = new uchar 73 0 |
| 567 | uac2 = new uchar 85 0 |
| 568 | st = new KuxAudioStream false 0 0 0 0 0 0 0 0 0 0 false 0 0 0 |
| 569 | |
| 570 | kux_test_fill_uac1 uac1 |
| 571 | kux_test_fill_uac2 uac2 |
| 572 | |
| 573 | note UAC1 and UAC2 parsing |
| 574 | if not kux_audio_select_output uac1 st |
| 575 | ret 40 |
| 576 | end |
| 577 | if ne get st ver KUX_AUDIO_UAC1 |
| 578 | ret 41 |
| 579 | end |
| 580 | if ne get st iface uchar 1 |
| 581 | ret 41 |
| 582 | end |
| 583 | if ne get st alt uchar 1 |
| 584 | ret 41 |
| 585 | end |
| 586 | if ne get st chans uchar 2 |
| 587 | ret 41 |
| 588 | end |
| 589 | if ne get st bit_res uchar 16 |
| 590 | ret 41 |
| 591 | end |
| 592 | |
| 593 | if not kux_audio_select_output uac2 st |
| 594 | ret 42 |
| 595 | end |
| 596 | if ne get st ver KUX_AUDIO_UAC2 |
| 597 | ret 43 |
| 598 | end |
| 599 | if not get st has_clk |
| 600 | ret 43 |
| 601 | end |
| 602 | if ne get st clk_src uchar 3 |
| 603 | ret 43 |
| 604 | end |
| 605 | |
| 606 | note Regression: UAC1 AS_GENERAL bDelay at offset 49 != channels |
| 607 | put uac1 49 uchar 7 |
| 608 | if not kux_audio_select_output uac1 st |
| 609 | ret 44 |
| 610 | end |
| 611 | if ne get st chans uchar 2 |
| 612 | ret 45 |
| 613 | end |
| 614 | |
| 615 | note Regression: short UAC1 FORMAT_TYPE_I (bLength 7 < 8) does not trap |
| 616 | put uac1 52 uchar 7 |
| 617 | ok_short = kux_audio_select_output uac1 st |
| 618 | if ok_short |
| 619 | ret 46 |
| 620 | end |
| 621 | |
| 622 | note service_interval_us |
| 623 | if ne kux_service_interval_us false uchar 1 uint 1000 |
| 624 | ret 47 |
| 625 | end |
| 626 | if ne kux_service_interval_us true uchar 1 uint 125 |
| 627 | ret 47 |
| 628 | end |
| 629 | if ne kux_service_interval_us true uchar 4 uint 1000 |
| 630 | ret 47 |
| 631 | end |
| 632 | if ne kux_service_interval_us true uchar 0 uint 0 |
| 633 | ret 47 |
| 634 | end |
| 635 | if ne kux_service_interval_us true uchar 17 uint 0 |
| 636 | ret 47 |
| 637 | end |
| 638 | ret 0 |
| 639 | end |
| 640 | |
| 641 | fn kux_test_audio_44k to int |
| 642 | fr = new KuxPcmFramer false 0 0 0 0 0 |
| 643 | src7 = new short 256 7 |
| 644 | out90 = new short 90 0 |
| 645 | cur_arr = new ulong 1 0 |
| 646 | |
| 647 | note Fractional 44.1 kHz packet pattern totals 44100 in 1000 ms |
| 648 | if not kux_pcm_framer_init fr uint 44100 uchar 1 uchar 2 uint 1000 |
| 649 | ret 48 |
| 650 | end |
| 651 | frames = ulong 0 |
| 652 | saw44 = false |
| 653 | saw45 = false |
| 654 | for i ulong 1000 |
| 655 | n = div kux_pcm_next_bytes fr ulong 2 |
| 656 | frames = add frames n |
| 657 | if eq n ulong 44 |
| 658 | saw44 = true |
| 659 | end |
| 660 | if eq n ulong 45 |
| 661 | saw45 = true |
| 662 | end |
| 663 | end |
| 664 | if ne frames ulong 44100 |
| 665 | ret 49 |
| 666 | end |
| 667 | if not saw44 |
| 668 | ret 50 |
| 669 | end |
| 670 | if not saw45 |
| 671 | ret 50 |
| 672 | end |
| 673 | |
| 674 | note Stereo 44.1 kHz scheduler emits 176400 bytes in 1 s |
| 675 | if not kux_pcm_framer_init fr uint 44100 uchar 2 uchar 2 uint 1000 |
| 676 | ret 51 |
| 677 | end |
| 678 | put cur_arr 0 ulong 0 |
| 679 | total_b = ulong 0 |
| 680 | for i ulong 1000 |
| 681 | ns = kux_pcm_fill_i16 fr src7 cur_arr out90 |
| 682 | total_b = add total_b mul ns ulong 2 |
| 683 | end |
| 684 | if ne total_b ulong 176400 |
| 685 | ret 52 |
| 686 | end |
| 687 | ret 0 |
| 688 | end |
| 689 | |
| 690 | fn kux_test_audio_tone_isoch to int |
| 691 | fr = new KuxPcmFramer false 0 0 0 0 0 |
| 692 | tone = new KuxTestTone false 0 0 |
| 693 | ring5 = new short 5 0 |
| 694 | out192 = new short 192 0 |
| 695 | cur_arr = new ulong 1 0 |
| 696 | trbs = new uint 8 0 |
| 697 | trb = new KuxTrb 0 |
| 698 | |
| 699 | note Ring wraps and TestTone is bounded [-32767, 32767] |
| 700 | if not kux_pcm_framer_init fr uint 48000 uchar 2 uchar 2 uint 1000 |
| 701 | ret 53 |
| 702 | end |
| 703 | put ring5 0 short 1 |
| 704 | put ring5 1 short 2 |
| 705 | put ring5 2 short 3 |
| 706 | put ring5 3 short 4 |
| 707 | put ring5 4 short 5 |
| 708 | put cur_arr 0 ulong 3 |
| 709 | ns2 = kux_pcm_fill_i16 fr ring5 cur_arr out192 |
| 710 | if ne ns2 ulong 96 |
| 711 | ret 54 |
| 712 | end |
| 713 | if ne get out192 0 short 4 |
| 714 | ret 55 |
| 715 | end |
| 716 | if ne get out192 1 short 5 |
| 717 | ret 55 |
| 718 | end |
| 719 | if ne get out192 2 short 1 |
| 720 | ret 55 |
| 721 | end |
| 722 | if ne get out192 3 short 2 |
| 723 | ret 55 |
| 724 | end |
| 725 | if ne get cur_arr 0 ulong 4 |
| 726 | ret 56 |
| 727 | end |
| 728 | |
| 729 | if not kux_tone_init tone uint 440 uint 48000 |
| 730 | ret 57 |
| 731 | end |
| 732 | for i ulong 1000 |
| 733 | smp = kux_tone_next tone |
| 734 | if lt smp short -32767 |
| 735 | ret 58 |
| 736 | end |
| 737 | if gt smp short 32767 |
| 738 | ret 58 |
| 739 | end |
| 740 | end |
| 741 | |
| 742 | note Isoch TRB frame wrap (2046 + 2 = 0, next = 1) and oversized guard |
| 743 | kux_trb_isoch trb ulong 0x1000 uint 192 ushort and add ushort 2046 ushort 2 ushort 0x7ff false false |
| 744 | kux_ring_store_trb trbs ulong 0 trb |
| 745 | kux_trb_isoch trb ulong 0x2000 uint 192 ushort and add ushort 2046 ushort 3 ushort 0x7ff false false |
| 746 | kux_ring_store_trb trbs ulong 1 trb |
| 747 | kux_isoch_mark_last trbs ulong 2 |
| 748 | if ne and shr get trbs 3 20 uint 0x7ff uint 0 |
| 749 | ret 59 |
| 750 | end |
| 751 | if ne and shr get trbs 7 20 uint 0x7ff uint 1 |
| 752 | ret 59 |
| 753 | end |
| 754 | if ne get trbs 2 uint 192 |
| 755 | ret 59 |
| 756 | end |
| 757 | if eq and get trbs 7 KUX_TRB_IOC uint 0 |
| 758 | ret 59 |
| 759 | end |
| 760 | if not kux_pcm_framer_init fr uint 96000 uchar 2 uchar 2 uint 1000 |
| 761 | ret 60 |
| 762 | end |
| 763 | if le kux_pcm_peek_bytes fr ulong 192 |
| 764 | ret 60 |
| 765 | end |
| 766 | ret 0 |
| 767 | end |
| 768 | |
| 769 | fn kux_test_audio to int |
| 770 | rc = kux_test_audio_desc |
| 771 | if ne rc 0 |
| 772 | ret rc |
| 773 | end |
| 774 | rc = kux_test_audio_44k |
| 775 | if ne rc 0 |
| 776 | ret rc |
| 777 | end |
| 778 | ret kux_test_audio_tone_isoch |
| 779 | end |
| 780 | |
| 781 | fn kux_test_xhci_core to int |
| 782 | regs = new uint 6 0 |
| 783 | caps = new KuxCaps false 0 0 0 0 0 0 false 0 |
| 784 | |
| 785 | note PCI MMIO base recognition |
| 786 | if ne kux_xhci_mmio_base uint 0x0c033001 uint 0x00004004 uint 0x80 ulong 0x8000004000 |
| 787 | ret 70 |
| 788 | end |
| 789 | if ne kux_xhci_mmio_base uint 0x0c033000 uint 0x0000000c uint 0x6 ulong 0x600000000 |
| 790 | ret 71 |
| 791 | end |
| 792 | if ne kux_xhci_mmio_base uint 0x0c033000 uint 0xfe000000 uint 0x1234 ulong 0xfe000000 |
| 793 | ret 72 |
| 794 | end |
| 795 | if ne kux_xhci_mmio_base uint 0x0c032000 uint 0x10000004 uint 0 ulong 0 |
| 796 | ret 73 |
| 797 | end |
| 798 | if ne kux_xhci_mmio_base uint 0x0c030000 uint 0x10000004 uint 0 ulong 0 |
| 799 | ret 73 |
| 800 | end |
| 801 | if ne kux_xhci_mmio_base uint 0x06000000 uint 0x10000004 uint 0 ulong 0 |
| 802 | ret 73 |
| 803 | end |
| 804 | if ne kux_xhci_mmio_base uint 0xffffffff uint 0x10000004 uint 0 ulong 0 |
| 805 | ret 73 |
| 806 | end |
| 807 | if ne kux_xhci_mmio_base uint 0x0c033000 uint 0x00001001 uint 0 ulong 0 |
| 808 | ret 74 |
| 809 | end |
| 810 | if ne kux_xhci_mmio_base uint 0x0c033000 uint 0x10000002 uint 0 ulong 0 |
| 811 | ret 74 |
| 812 | end |
| 813 | if ne kux_xhci_mmio_base uint 0x0c033000 uint 0x00000004 uint 0 ulong 0 |
| 814 | ret 74 |
| 815 | end |
| 816 | if ne kux_xhci_mmio_base uint 0x0c033000 uint 0xffffffff uint 0xffffffff ulong 0 |
| 817 | ret 74 |
| 818 | end |
| 819 | |
| 820 | note QEMU xHCI capabilities decode |
| 821 | put regs 0 uint 0x01000040 |
| 822 | put regs 1 uint 0x08001040 |
| 823 | put regs 2 uint 0x0000000f |
| 824 | put regs 3 uint 0x00087001 |
| 825 | put regs 4 uint 0x2000 |
| 826 | put regs 5 uint 0x1000 |
| 827 | if not kux_caps_decode regs caps |
| 828 | ret 75 |
| 829 | end |
| 830 | if ne get caps op_off ulong 0x40 |
| 831 | ret 76 |
| 832 | end |
| 833 | if ne get caps max_slots uchar 64 |
| 834 | ret 76 |
| 835 | end |
| 836 | if ne get caps max_ports uchar 8 |
| 837 | ret 76 |
| 838 | end |
| 839 | if ne get caps scratch ushort 0 |
| 840 | ret 76 |
| 841 | end |
| 842 | if not get caps addr64 |
| 843 | ret 76 |
| 844 | end |
| 845 | if ne get caps ctx_bytes ulong 32 |
| 846 | ret 76 |
| 847 | end |
| 848 | if ne get caps db_off ulong 0x2000 |
| 849 | ret 76 |
| 850 | end |
| 851 | if ne get caps rt_off ulong 0x1000 |
| 852 | ret 76 |
| 853 | end |
| 854 | |
| 855 | note Scratchpads (hi=1, lo=2 -> 34), 64-byte contexts, absent blocks |
| 856 | put regs 0 uint 0x01100020 |
| 857 | put regs 1 uint 0x04000020 |
| 858 | put regs 2 or shl uint 1 21 shl uint 2 27 |
| 859 | put regs 3 uint 4 |
| 860 | put regs 4 uint 0x3003 |
| 861 | put regs 5 uint 0x201f |
| 862 | if not kux_caps_decode regs caps |
| 863 | ret 77 |
| 864 | end |
| 865 | if ne get caps scratch ushort 34 |
| 866 | ret 78 |
| 867 | end |
| 868 | if ne get caps ctx_bytes ulong 64 |
| 869 | ret 78 |
| 870 | end |
| 871 | if get caps addr64 |
| 872 | ret 78 |
| 873 | end |
| 874 | if ne get caps db_off ulong 0x3000 |
| 875 | ret 78 |
| 876 | end |
| 877 | if ne get caps rt_off ulong 0x2000 |
| 878 | ret 78 |
| 879 | end |
| 880 | |
| 881 | put regs 0 uint 0xffffffff |
| 882 | if kux_caps_decode regs caps |
| 883 | ret 79 |
| 884 | end |
| 885 | put regs 0 uint 0x01000010 |
| 886 | if kux_caps_decode regs caps |
| 887 | ret 79 |
| 888 | end |
| 889 | put regs 0 uint 0x01000040 |
| 890 | put regs 1 uint 0x08001000 |
| 891 | if kux_caps_decode regs caps |
| 892 | ret 79 |
| 893 | end |
| 894 | |
| 895 | note PORTSC neutral and speed |
| 896 | pv = or KUX_PORTSC_CONNECTED or KUX_PORTSC_ENABLED or KUX_PORTSC_POWER or shl uint 3 10 or KUX_PORTSC_RESET_CHANGE shl uint 1 17 |
| 897 | neut = kux_portsc_neutral pv |
| 898 | if ne and neut KUX_PORTSC_ENABLED uint 0 |
| 899 | ret 80 |
| 900 | end |
| 901 | if ne and neut KUX_PORTSC_CHANGES uint 0 |
| 902 | ret 80 |
| 903 | end |
| 904 | if eq and neut KUX_PORTSC_POWER uint 0 |
| 905 | ret 80 |
| 906 | end |
| 907 | if ne kux_portsc_speed pv uchar 3 |
| 908 | ret 81 |
| 909 | end |
| 910 | if ne kux_op_portsc uchar 1 ulong 0x400 |
| 911 | ret 81 |
| 912 | end |
| 913 | if ne kux_op_portsc uchar 3 ulong 0x420 |
| 914 | ret 81 |
| 915 | end |
| 916 | ret 0 |
| 917 | end |
| 918 | |
| 919 | fn kux_test_trb to int |
| 920 | s = new KuxSetup 0 0 0 0 0 |
| 921 | t = new KuxTrb 0 |
| 922 | |
| 923 | note SetupPacket wire order |
| 924 | kux_setup_get_desc s KUX_DESC_DEVICE uchar 0 ushort 18 |
| 925 | if ne kux_setup_dw0 s uint 0x01000680 |
| 926 | ret 90 |
| 927 | end |
| 928 | if ne kux_setup_dw1 s uint 0x00120000 |
| 929 | ret 90 |
| 930 | end |
| 931 | kux_setup_set_boot_proto s uchar 1 |
| 932 | if ne kux_setup_dw0 s uint 0x00000b21 |
| 933 | ret 91 |
| 934 | end |
| 935 | if ne kux_setup_dw1 s uint 0x00000001 |
| 936 | ret 91 |
| 937 | end |
| 938 | kux_setup_set_cfg s uchar 1 |
| 939 | if ne kux_setup_dw0 s uint 0x00010900 |
| 940 | ret 92 |
| 941 | end |
| 942 | if ne kux_setup_dw1 s uint 0 |
| 943 | ret 92 |
| 944 | end |
| 945 | |
| 946 | note Control stages: Setup, Data, Status |
| 947 | kux_setup_get_desc s KUX_DESC_CONFIG uchar 0 ushort 64 |
| 948 | kux_trb_setup_stage t s |
| 949 | if ne kux_trb_kind t KUX_TRB_SETUP_STAGE |
| 950 | ret 93 |
| 951 | end |
| 952 | if ne get t w 2 uint 8 |
| 953 | ret 93 |
| 954 | end |
| 955 | if eq and get t w 3 KUX_TRB_IDT uint 0 |
| 956 | ret 93 |
| 957 | end |
| 958 | if ne and get t w 3 shl uint 3 16 KUX_TRB_TRT_IN |
| 959 | ret 93 |
| 960 | end |
| 961 | kux_trb_data_stage t s ulong 0x123456789abcdef0 |
| 962 | if ne kux_trb_kind t KUX_TRB_DATA_STAGE |
| 963 | ret 94 |
| 964 | end |
| 965 | if ne kux_trb_ptr t ulong 0x123456789abcdef0 |
| 966 | ret 94 |
| 967 | end |
| 968 | if ne get t w 2 uint 64 |
| 969 | ret 94 |
| 970 | end |
| 971 | if eq and get t w 3 KUX_TRB_DIR_IN uint 0 |
| 972 | ret 94 |
| 973 | end |
| 974 | kux_trb_status_stage t s |
| 975 | if ne kux_trb_kind t KUX_TRB_STATUS_STAGE |
| 976 | ret 95 |
| 977 | end |
| 978 | if ne and get t w 3 KUX_TRB_DIR_IN uint 0 |
| 979 | ret 95 |
| 980 | end |
| 981 | if eq and get t w 3 KUX_TRB_IOC uint 0 |
| 982 | ret 95 |
| 983 | end |
| 984 | |
| 985 | note No-data control transfer |
| 986 | kux_setup_set_cfg s uchar 1 |
| 987 | kux_trb_setup_stage t s |
| 988 | if ne and get t w 3 shl uint 3 16 uint 0 |
| 989 | ret 96 |
| 990 | end |
| 991 | kux_trb_status_stage t s |
| 992 | if eq and get t w 3 KUX_TRB_DIR_IN uint 0 |
| 993 | ret 96 |
| 994 | end |
| 995 | |
| 996 | note Command TRBs |
| 997 | kux_trb_address_device t ulong 0x80001000 uchar 3 |
| 998 | if ne kux_trb_kind t KUX_TRB_ADDRESS_DEVICE |
| 999 | ret 97 |
| 1000 | end |
| 1001 | if ne kux_trb_slot_id t uchar 3 |
| 1002 | ret 97 |
| 1003 | end |
| 1004 | if ne kux_trb_ptr t ulong 0x80001000 |
| 1005 | ret 97 |
| 1006 | end |
| 1007 | kux_trb_enable_slot t |
| 1008 | if ne get t w 3 shl uint 9 10 |
| 1009 | ret 98 |
| 1010 | end |
| 1011 | kux_trb_configure_ep t ulong 0x40 uchar 1 |
| 1012 | if ne kux_trb_kind t KUX_TRB_CONFIGURE_EP |
| 1013 | ret 98 |
| 1014 | end |
| 1015 | kux_trb_evaluate_ctx t ulong 0x40 uchar 1 |
| 1016 | if ne kux_trb_kind t KUX_TRB_EVALUATE_CTX |
| 1017 | ret 98 |
| 1018 | end |
| 1019 | kux_trb_disable_slot t uchar 2 |
| 1020 | if ne kux_trb_slot_id t uchar 2 |
| 1021 | ret 98 |
| 1022 | end |
| 1023 | |
| 1024 | note Event TRB decoding |
| 1025 | put t w 0 uint 0x1000 |
| 1026 | put t w 1 uint 2 |
| 1027 | put t w 2 or shl uint 13 24 uint 3 |
| 1028 | put t w 3 or shl uint 1 24 or shl uint 3 16 or shl uint 32 10 uint 1 |
| 1029 | if ne kux_trb_kind t KUX_TRB_TRANSFER_EVENT |
| 1030 | ret 99 |
| 1031 | end |
| 1032 | if ne kux_trb_ptr t ulong 0x200001000 |
| 1033 | ret 99 |
| 1034 | end |
| 1035 | if ne kux_trb_residual t uint 3 |
| 1036 | ret 99 |
| 1037 | end |
| 1038 | if ne kux_trb_cc t KUX_CC_SHORT_PACKET |
| 1039 | ret 99 |
| 1040 | end |
| 1041 | if not kux_trb_completed_ok t |
| 1042 | ret 99 |
| 1043 | end |
| 1044 | if ne kux_trb_ep_id t uchar 3 |
| 1045 | ret 99 |
| 1046 | end |
| 1047 | if ne kux_trb_slot_id t uchar 1 |
| 1048 | ret 99 |
| 1049 | end |
| 1050 | if not kux_trb_cycle t |
| 1051 | ret 99 |
| 1052 | end |
| 1053 | kux_trb_set_cycle t false |
| 1054 | if kux_trb_cycle t |
| 1055 | ret 99 |
| 1056 | end |
| 1057 | put t w 2 shl uint 6 24 |
| 1058 | if kux_trb_completed_ok t |
| 1059 | ret 100 |
| 1060 | end |
| 1061 | |
| 1062 | note Normal, Link, and Isoch TRBs |
| 1063 | kux_trb_normal t ulong 0x9000 uint 8 |
| 1064 | if ne kux_trb_kind t KUX_TRB_NORMAL |
| 1065 | ret 101 |
| 1066 | end |
| 1067 | if ne get t w 2 uint 8 |
| 1068 | ret 101 |
| 1069 | end |
| 1070 | if ne and get t w 3 or KUX_TRB_IOC KUX_TRB_ISP or KUX_TRB_IOC KUX_TRB_ISP |
| 1071 | ret 101 |
| 1072 | end |
| 1073 | kux_trb_link t ulong 0x4000 |
| 1074 | if ne kux_trb_kind t KUX_TRB_LINK |
| 1075 | ret 102 |
| 1076 | end |
| 1077 | if eq and get t w 3 KUX_TRB_TOGGLE_CYCLE uint 0 |
| 1078 | ret 102 |
| 1079 | end |
| 1080 | kux_trb_isoch t ulong 0x123456789abcdef0 uint 176 ushort 0x456 false false |
| 1081 | if ne kux_trb_kind t KUX_TRB_ISOCH |
| 1082 | ret 103 |
| 1083 | end |
| 1084 | if ne kux_trb_ptr t ulong 0x123456789abcdef0 |
| 1085 | ret 103 |
| 1086 | end |
| 1087 | if ne get t w 2 uint 176 |
| 1088 | ret 103 |
| 1089 | end |
| 1090 | if ne and shr get t w 3 20 uint 0x7ff uint 0x456 |
| 1091 | ret 103 |
| 1092 | end |
| 1093 | if ne and get t w 3 KUX_TRB_CHAIN uint 0 |
| 1094 | ret 103 |
| 1095 | end |
| 1096 | if ne and get t w 3 KUX_TRB_IOC uint 0 |
| 1097 | ret 103 |
| 1098 | end |
| 1099 | if ne and get t w 3 shl uint 7 7 uint 0 |
| 1100 | ret 103 |
| 1101 | end |
| 1102 | kux_trb_isoch t ulong 0x2000 uint 180 ushort 7 true true |
| 1103 | if eq and get t w 3 KUX_TRB_SIA uint 0 |
| 1104 | ret 104 |
| 1105 | end |
| 1106 | if eq and get t w 3 KUX_TRB_IOC uint 0 |
| 1107 | ret 104 |
| 1108 | end |
| 1109 | if ne and get t w 3 KUX_TRB_CHAIN uint 0 |
| 1110 | ret 104 |
| 1111 | end |
| 1112 | ret 0 |
| 1113 | end |
| 1114 | |
| 1115 | fn kux_test_prod_ring to int |
| 1116 | mem4 = new uint 16 0 |
| 1117 | mem3 = new uint 12 0 |
| 1118 | pr = new KuxProdRing false 0 0 0 false |
| 1119 | trb = new KuxTrb 0 |
| 1120 | seen = new KuxTrb 0 |
| 1121 | dma = ulong 0x100000 |
| 1122 | |
| 1123 | note ProducerRing across 20 wraps with consumer model |
| 1124 | if not kux_prod_ring_init pr mem4 ulong 4 dma |
| 1125 | ret 110 |
| 1126 | end |
| 1127 | c_idx = ulong 0 |
| 1128 | c_cyc = true |
| 1129 | kux_ring_load_trb mem4 c_idx seen |
| 1130 | if eq kux_trb_cycle seen c_cyc |
| 1131 | ret 111 |
| 1132 | end |
| 1133 | for n ulong 20 |
| 1134 | put trb w 0 uint and n ulong 0xffffffff |
| 1135 | put trb w 1 uint 0 |
| 1136 | put trb w 2 uint 0 |
| 1137 | put trb w 3 shl uint KUX_TRB_NORMAL 10 |
| 1138 | if ne kux_prod_ring_push pr mem4 trb add dma mul ulong 16 rem n ulong 3 |
| 1139 | ret 112 |
| 1140 | end |
| 1141 | note Consumer takes one TRB, obeying Link + Toggle Cycle |
| 1142 | took = false |
| 1143 | for step ulong 4 |
| 1144 | kux_ring_load_trb mem4 c_idx seen |
| 1145 | if ne kux_trb_cycle seen c_cyc |
| 1146 | break |
| 1147 | end |
| 1148 | if eq kux_trb_kind seen KUX_TRB_LINK |
| 1149 | if ne kux_trb_ptr seen dma |
| 1150 | ret 113 |
| 1151 | end |
| 1152 | if ne and get seen w 3 KUX_TRB_TOGGLE_CYCLE uint 0 |
| 1153 | c_cyc = not c_cyc |
| 1154 | end |
| 1155 | c_idx = ulong 0 |
| 1156 | else |
| 1157 | c_idx = add c_idx 1 |
| 1158 | took = true |
| 1159 | break |
| 1160 | end |
| 1161 | end |
| 1162 | if not took |
| 1163 | ret 114 |
| 1164 | end |
| 1165 | if ne get seen w 0 uint and n ulong 0xffffffff |
| 1166 | ret 115 |
| 1167 | end |
| 1168 | end |
| 1169 | |
| 1170 | note Dequeue pointer carries cycle state and flips after Link |
| 1171 | if not kux_prod_ring_init pr mem3 ulong 3 dma |
| 1172 | ret 116 |
| 1173 | end |
| 1174 | if ne kux_prod_ring_deq_ptr pr or dma ulong 1 |
| 1175 | ret 117 |
| 1176 | end |
| 1177 | put trb w 0 uint 0 |
| 1178 | put trb w 3 uint 0 |
| 1179 | a1 = kux_prod_ring_push pr mem3 trb |
| 1180 | if ne kux_prod_ring_deq_ptr pr or add dma ulong 16 ulong 1 |
| 1181 | ret 118 |
| 1182 | end |
| 1183 | a2 = kux_prod_ring_push pr mem3 trb |
| 1184 | if ne kux_prod_ring_deq_ptr pr dma |
| 1185 | ret 119 |
| 1186 | end |
| 1187 | kux_ring_load_trb mem3 ulong 2 seen |
| 1188 | if not kux_trb_cycle seen |
| 1189 | ret 120 |
| 1190 | end |
| 1191 | if kux_prod_ring_init pr mem3 ulong 1 dma |
| 1192 | ret 121 |
| 1193 | end |
| 1194 | ret 0 |
| 1195 | end |
| 1196 | |
| 1197 | fn kux_test_event_ring to int |
| 1198 | mem3 = new uint 12 0 |
| 1199 | er = new KuxEventRing false 0 0 0 false |
| 1200 | trb = new KuxTrb 0 |
| 1201 | seen = new KuxTrb 0 |
| 1202 | erst = new uint 4 0 |
| 1203 | dma = ulong 0x100000 |
| 1204 | |
| 1205 | note EventRing consumes matching cycles and wraps without Link |
| 1206 | if not kux_event_ring_init er mem3 ulong 3 dma |
| 1207 | ret 122 |
| 1208 | end |
| 1209 | kux_event_ring_erst er erst |
| 1210 | if ne get erst 0 uint 0x100000 |
| 1211 | ret 123 |
| 1212 | end |
| 1213 | if ne get erst 1 uint 0 |
| 1214 | ret 123 |
| 1215 | end |
| 1216 | if ne get erst 2 uint 3 |
| 1217 | ret 123 |
| 1218 | end |
| 1219 | if ne get erst 3 uint 0 |
| 1220 | ret 123 |
| 1221 | end |
| 1222 | if kux_event_ring_pop er mem3 seen |
| 1223 | ret 124 |
| 1224 | end |
| 1225 | for i ulong 3 |
| 1226 | put trb w 0 add uint 10 uint and i ulong 0xffffffff |
| 1227 | put trb w 1 uint 0 |
| 1228 | put trb w 2 shl uint 1 24 |
| 1229 | put trb w 3 or shl uint 33 10 KUX_TRB_CYCLE |
| 1230 | kux_ring_store_trb mem3 i trb |
| 1231 | end |
| 1232 | if not kux_event_ring_pop er mem3 seen |
| 1233 | ret 125 |
| 1234 | end |
| 1235 | if ne get seen w 0 uint 10 |
| 1236 | ret 125 |
| 1237 | end |
| 1238 | if ne kux_event_ring_deq_ptr er add dma ulong 16 |
| 1239 | ret 126 |
| 1240 | end |
| 1241 | if not kux_event_ring_pop er mem3 seen |
| 1242 | ret 127 |
| 1243 | end |
| 1244 | if ne get seen w 0 uint 11 |
| 1245 | ret 127 |
| 1246 | end |
| 1247 | if not kux_event_ring_pop er mem3 seen |
| 1248 | ret 128 |
| 1249 | end |
| 1250 | if ne get seen w 0 uint 12 |
| 1251 | ret 128 |
| 1252 | end |
| 1253 | if ne kux_event_ring_deq_ptr er dma |
| 1254 | ret 129 |
| 1255 | end |
| 1256 | if kux_event_ring_pop er mem3 seen |
| 1257 | ret 130 |
| 1258 | end |
| 1259 | put trb w 0 uint 13 |
| 1260 | put trb w 3 shl uint 33 10 |
| 1261 | kux_ring_store_trb mem3 ulong 0 trb |
| 1262 | if not kux_event_ring_pop er mem3 seen |
| 1263 | ret 131 |
| 1264 | end |
| 1265 | if ne get seen w 0 uint 13 |
| 1266 | ret 131 |
| 1267 | end |
| 1268 | if kux_event_ring_pop er mem3 seen |
| 1269 | ret 132 |
| 1270 | end |
| 1271 | ret 0 |
| 1272 | end |
| 1273 | |
| 1274 | fn kux_test_rings to int |
| 1275 | rc = kux_test_prod_ring |
| 1276 | if ne rc 0 |
| 1277 | ret rc |
| 1278 | end |
| 1279 | ret kux_test_event_ring |
| 1280 | end |
| 1281 | |
| 1282 | fn kux_test_contexts to int |
| 1283 | w32 = new uint 264 0xdeadbeef |
| 1284 | w64 = new uint 528 0 |
| 1285 | ctx = new KuxInCtx false 0 |
| 1286 | cfg = new KuxEpCfg 0 0 0 0 0 0 0 |
| 1287 | |
| 1288 | note interrupt_interval |
| 1289 | if ne kux_interrupt_interval KUX_SPEED_FULL uchar 7 uchar 5 |
| 1290 | ret 140 |
| 1291 | end |
| 1292 | if ne kux_interrupt_interval KUX_SPEED_FULL uchar 10 uchar 6 |
| 1293 | ret 140 |
| 1294 | end |
| 1295 | if ne kux_interrupt_interval KUX_SPEED_LOW uchar 1 uchar 3 |
| 1296 | ret 140 |
| 1297 | end |
| 1298 | if ne kux_interrupt_interval KUX_SPEED_FULL uchar 255 uchar 10 |
| 1299 | ret 140 |
| 1300 | end |
| 1301 | if ne kux_interrupt_interval KUX_SPEED_FULL uchar 0 uchar 3 |
| 1302 | ret 140 |
| 1303 | end |
| 1304 | if ne kux_interrupt_interval KUX_SPEED_HIGH uchar 4 uchar 3 |
| 1305 | ret 140 |
| 1306 | end |
| 1307 | if ne kux_interrupt_interval KUX_SPEED_SUPER uchar 0 uchar 0 |
| 1308 | ret 140 |
| 1309 | end |
| 1310 | if ne kux_interrupt_interval KUX_SPEED_HIGH uchar 200 uchar 15 |
| 1311 | ret 140 |
| 1312 | end |
| 1313 | |
| 1314 | note endpoint_dci and default_control_max_packet |
| 1315 | if ne kux_endpoint_dci uchar 0x81 uchar 3 |
| 1316 | ret 141 |
| 1317 | end |
| 1318 | if ne kux_endpoint_dci uchar 0x82 uchar 5 |
| 1319 | ret 141 |
| 1320 | end |
| 1321 | if ne kux_endpoint_dci uchar 0x01 uchar 2 |
| 1322 | ret 141 |
| 1323 | end |
| 1324 | if ne kux_endpoint_dci uchar 0x8f uchar 31 |
| 1325 | ret 141 |
| 1326 | end |
| 1327 | if ne kux_endpoint_dci uchar 0x80 uchar 0 |
| 1328 | ret 141 |
| 1329 | end |
| 1330 | if ne kux_default_ctrl_max_pkt KUX_SPEED_LOW ushort 8 |
| 1331 | ret 142 |
| 1332 | end |
| 1333 | if ne kux_default_ctrl_max_pkt KUX_SPEED_HIGH ushort 64 |
| 1334 | ret 142 |
| 1335 | end |
| 1336 | if ne kux_default_ctrl_max_pkt KUX_SPEED_SUPER ushort 512 |
| 1337 | ret 142 |
| 1338 | end |
| 1339 | |
| 1340 | note 32-byte InputContext for Address Device |
| 1341 | if not kux_in_ctx_init ctx w32 ulong 32 |
| 1342 | ret 143 |
| 1343 | end |
| 1344 | kux_in_ctx_add ctx w32 uint 3 |
| 1345 | kux_in_ctx_slot ctx w32 KUX_SPEED_FULL uchar 5 uchar 1 |
| 1346 | put cfg ep_type KUX_EP_CONTROL |
| 1347 | put cfg max_burst uchar 0 |
| 1348 | put cfg max_pkt ushort 8 |
| 1349 | put cfg ival uchar 0 |
| 1350 | put cfg deq ulong 0x40001001 |
| 1351 | put cfg avg_trb ushort 8 |
| 1352 | put cfg max_esit ushort 0 |
| 1353 | kux_in_ctx_ep ctx w32 KUX_CONTROL_DCI cfg |
| 1354 | if ne get w32 1 uint 3 |
| 1355 | ret 144 |
| 1356 | end |
| 1357 | if ne get w32 0 uint 0 |
| 1358 | ret 144 |
| 1359 | end |
| 1360 | if ne get w32 8 or shl uint 1 27 shl uint 1 20 |
| 1361 | ret 145 |
| 1362 | end |
| 1363 | if ne get w32 9 shl uint 5 16 |
| 1364 | ret 145 |
| 1365 | end |
| 1366 | if ne get w32 17 or shl uint 3 1 or shl uint 4 3 shl uint 8 16 |
| 1367 | ret 146 |
| 1368 | end |
| 1369 | if ne get w32 18 uint 0x40001001 |
| 1370 | ret 146 |
| 1371 | end |
| 1372 | if ne get w32 19 uint 0 |
| 1373 | ret 146 |
| 1374 | end |
| 1375 | if ne get w32 20 uint 8 |
| 1376 | ret 146 |
| 1377 | end |
| 1378 | for i ulong 243 |
| 1379 | if ne get w32 add i 21 uint 0 |
| 1380 | ret 147 |
| 1381 | end |
| 1382 | end |
| 1383 | |
| 1384 | note 64-byte InputContext + DCI 0 ignored + bad sizes refused |
| 1385 | if not kux_in_ctx_init ctx w64 ulong 64 |
| 1386 | ret 148 |
| 1387 | end |
| 1388 | kux_in_ctx_slot ctx w64 KUX_SPEED_HIGH uchar 2 uchar 3 |
| 1389 | put cfg ep_type KUX_EP_INTR_IN |
| 1390 | put cfg max_burst uchar 0 |
| 1391 | put cfg max_pkt ushort 8 |
| 1392 | put cfg ival uchar 6 |
| 1393 | put cfg deq ulong 0x200000001 |
| 1394 | put cfg avg_trb ushort 8 |
| 1395 | put cfg max_esit ushort 8 |
| 1396 | kux_in_ctx_ep ctx w64 uchar 3 cfg |
| 1397 | put cfg deq ulong 0xffffffffffffffff |
| 1398 | kux_in_ctx_ep ctx w64 uchar 0 cfg |
| 1399 | if ne get w64 16 or shl uint 3 27 shl uint 3 20 |
| 1400 | ret 149 |
| 1401 | end |
| 1402 | if ne get w64 17 shl uint 2 16 |
| 1403 | ret 149 |
| 1404 | end |
| 1405 | if ne get w64 64 shl uint 6 16 |
| 1406 | ret 150 |
| 1407 | end |
| 1408 | if ne get w64 65 or shl uint 3 1 or shl uint 7 3 shl uint 8 16 |
| 1409 | ret 150 |
| 1410 | end |
| 1411 | if ne get w64 66 uint 1 |
| 1412 | ret 150 |
| 1413 | end |
| 1414 | if ne get w64 67 uint 2 |
| 1415 | ret 150 |
| 1416 | end |
| 1417 | if ne get w64 68 or uint 8 shl uint 8 16 |
| 1418 | ret 150 |
| 1419 | end |
| 1420 | if ne get w64 18 uint 0 |
| 1421 | ret 151 |
| 1422 | end |
| 1423 | if kux_in_ctx_init ctx w64 ulong 48 |
| 1424 | ret 152 |
| 1425 | end |
| 1426 | if kux_in_ctx_init ctx part w64 0 100 ulong 32 |
| 1427 | ret 152 |
| 1428 | end |
| 1429 | |
| 1430 | note Isochronous OUT endpoint context + high-bandwidth burst |
| 1431 | if not kux_in_ctx_init ctx w32 ulong 32 |
| 1432 | ret 153 |
| 1433 | end |
| 1434 | kux_isoch_out_ep cfg KUX_SPEED_HIGH uchar 4 ushort 192 ushort 192 ulong 0x12345001 |
| 1435 | kux_in_ctx_ep ctx w32 uchar 2 cfg |
| 1436 | if ne get w32 24 shl uint 3 16 |
| 1437 | ret 154 |
| 1438 | end |
| 1439 | if ne get w32 25 or shl KUX_CERR 1 or shl uint KUX_EP_ISOCH_OUT 3 shl uint 192 16 |
| 1440 | ret 154 |
| 1441 | end |
| 1442 | if ne get w32 26 uint 0x12345001 |
| 1443 | ret 154 |
| 1444 | end |
| 1445 | if ne get w32 28 or uint 192 shl uint 192 16 |
| 1446 | ret 154 |
| 1447 | end |
| 1448 | if ne kux_isoch_interval KUX_SPEED_FULL uchar 1 uchar 3 |
| 1449 | ret 155 |
| 1450 | end |
| 1451 | if ne kux_isoch_interval KUX_SPEED_FULL uchar 2 uchar 4 |
| 1452 | ret 155 |
| 1453 | end |
| 1454 | if ne kux_isoch_interval KUX_SPEED_HIGH uchar 4 uchar 3 |
| 1455 | ret 155 |
| 1456 | end |
| 1457 | kux_isoch_out_ep cfg KUX_SPEED_HIGH uchar 1 ushort 0x1400 ushort 3072 ulong 0x1000 |
| 1458 | if ne get cfg max_pkt ushort 1024 |
| 1459 | ret 156 |
| 1460 | end |
| 1461 | if ne get cfg max_burst uchar 2 |
| 1462 | ret 156 |
| 1463 | end |
| 1464 | kux_isoch_out_ep cfg KUX_SPEED_FULL uchar 1 ushort 0x1400 ushort 1023 ulong 0x1000 |
| 1465 | if ne get cfg max_pkt ushort 1024 |
| 1466 | ret 157 |
| 1467 | end |
| 1468 | if ne get cfg max_burst uchar 0 |
| 1469 | ret 157 |
| 1470 | end |
| 1471 | ret 0 |
| 1472 | end |
| 1473 | |
| 1474 | fn kux_test_ctrl_init to int |
| 1475 | st = new KuxCtrlState 0 0 0 0 0 0 0 0 false false false 0 0 0 0 |
| 1476 | caps = new KuxCaps false 0 0 0 0 0 0 false 0 |
| 1477 | dl = new KuxDeadline 0 0 0 |
| 1478 | dev_desc = new uchar 8 0 |
| 1479 | |
| 1480 | note Deadline expiration (counter-based) |
| 1481 | kux_deadline_init dl ulong 1000 ulong 1000000 ulong 10 |
| 1482 | if kux_deadline_expired dl ulong 10500 |
| 1483 | ret 160 |
| 1484 | end |
| 1485 | if not kux_deadline_expired dl ulong 11001 |
| 1486 | ret 161 |
| 1487 | end |
| 1488 | |
| 1489 | note Capability validation: reject scratchpad and 32-bit DMA > 4 GiB |
| 1490 | kux_ctrl_init st |
| 1491 | put caps ok true |
| 1492 | put caps scratch ushort 2 |
| 1493 | put caps addr64 true |
| 1494 | put caps ctx_bytes ulong 32 |
| 1495 | if kux_ctrl_validate_caps st caps ulong 0x10000 |
| 1496 | ret 162 |
| 1497 | end |
| 1498 | if ne get st err KUX_ERR_UNSUPPORTED |
| 1499 | ret 162 |
| 1500 | end |
| 1501 | |
| 1502 | kux_ctrl_init st |
| 1503 | put caps scratch ushort 0 |
| 1504 | put caps addr64 false |
| 1505 | if kux_ctrl_validate_caps st caps ulong 0x100000000 |
| 1506 | ret 163 |
| 1507 | end |
| 1508 | kux_ctrl_init st |
| 1509 | put caps addr64 true |
| 1510 | if not kux_ctrl_validate_caps st caps ulong 0x100000000 |
| 1511 | ret 164 |
| 1512 | end |
| 1513 | |
| 1514 | note Reset and Run state machine transitions |
| 1515 | if ne kux_ctrl_step_reset st uint 0 KUX_USBSTS_HALTED KUX_ST_HALTED |
| 1516 | ret 165 |
| 1517 | end |
| 1518 | if ne kux_ctrl_step_reset st uint 0 uint 0 KUX_ST_RESET_DONE |
| 1519 | ret 166 |
| 1520 | end |
| 1521 | if not kux_ctrl_step_run st uint 0 |
| 1522 | ret 167 |
| 1523 | end |
| 1524 | if ne get st state KUX_ST_RUNNING |
| 1525 | ret 167 |
| 1526 | end |
| 1527 | |
| 1528 | note Reported max packet size for SuperSpeed (2^9 = 512) and FullSpeed (8) |
| 1529 | put dev_desc 0 uchar 18 |
| 1530 | put dev_desc 1 uchar 1 |
| 1531 | put dev_desc 7 uchar 9 |
| 1532 | if ne kux_ctrl_reported_max_pkt KUX_SPEED_SUPER ushort 512 dev_desc ushort 512 |
| 1533 | ret 168 |
| 1534 | end |
| 1535 | put dev_desc 7 uchar 8 |
| 1536 | if ne kux_ctrl_reported_max_pkt KUX_SPEED_FULL ushort 64 dev_desc ushort 8 |
| 1537 | ret 168 |
| 1538 | end |
| 1539 | ret 0 |
| 1540 | end |
| 1541 | |
| 1542 | fn kux_test_ctrl_events to int |
| 1543 | st = new KuxCtrlState 0 0 0 0 0 0 0 0 false false false 0 0 0 0 |
| 1544 | kbd = new KuxBootKbd true 1 0 0x81 8 7 |
| 1545 | words = new uint 264 0 |
| 1546 | rep_mem = new uint 16 0 |
| 1547 | ev_mem = new uint 16 0 |
| 1548 | rep_ring = new KuxProdRing false 0 0 0 false |
| 1549 | ev_ring = new KuxEventRing false 0 0 0 false |
| 1550 | ev = new KuxTrb 0 |
| 1551 | |
| 1552 | kux_ctrl_init st |
| 1553 | put st port uchar 1 |
| 1554 | put st slot uchar 1 |
| 1555 | if not kux_prod_ring_init rep_ring rep_mem ulong 4 ulong 0x200000 |
| 1556 | ret 169 |
| 1557 | end |
| 1558 | if not kux_event_ring_init ev_ring ev_mem ulong 4 ulong 0x300000 |
| 1559 | ret 169 |
| 1560 | end |
| 1561 | if not kux_ctrl_build_kbd_ctx st words KUX_SPEED_FULL kbd kux_prod_ring_deq_ptr rep_ring |
| 1562 | ret 170 |
| 1563 | end |
| 1564 | if ne get st dci uchar 3 |
| 1565 | ret 170 |
| 1566 | end |
| 1567 | if ne get st state KUX_ST_ATTACHED |
| 1568 | ret 170 |
| 1569 | end |
| 1570 | arm_addr = kux_ctrl_arm_report st rep_ring rep_mem ulong 0x400000 |
| 1571 | if ne arm_addr ulong 0x200000 |
| 1572 | ret 171 |
| 1573 | end |
| 1574 | if ne get st db_cnt uint 1 |
| 1575 | ret 171 |
| 1576 | end |
| 1577 | |
| 1578 | note Good transfer event (slot 1, dci 3, residual 0, CC=SUCCESS) |
| 1579 | put ev w 0 uint 0x200000 |
| 1580 | put ev w 1 uint 0 |
| 1581 | put ev w 2 shl uint 1 24 |
| 1582 | put ev w 3 uint 0x01038001 |
| 1583 | if ne kux_ctrl_handle_event st ev KUX_EV_REPORT_READY |
| 1584 | ret 172 |
| 1585 | end |
| 1586 | if not kux_ctrl_retire st ev_ring |
| 1587 | ret 173 |
| 1588 | end |
| 1589 | if ne get st last_erdp or ulong 0x300000 KUX_RT_ERDP_BUSY |
| 1590 | ret 173 |
| 1591 | end |
| 1592 | |
| 1593 | note Stall event halts controller |
| 1594 | put ev w 2 shl uint 6 24 |
| 1595 | if ne kux_ctrl_handle_event st ev KUX_EV_HALTED |
| 1596 | ret 174 |
| 1597 | end |
| 1598 | if not get st is_halted |
| 1599 | ret 174 |
| 1600 | end |
| 1601 | if ne kux_ctrl_handle_event st ev KUX_EV_IGNORED |
| 1602 | ret 175 |
| 1603 | end |
| 1604 | ret 0 |
| 1605 | end |
| 1606 | |
| 1607 | fn kux_test_controller to int |
| 1608 | rc = kux_test_ctrl_init |
| 1609 | if ne rc 0 |
| 1610 | ret rc |
| 1611 | end |
| 1612 | ret kux_test_ctrl_events |
| 1613 | end |
| 1614 | |
| 1615 | fn main to int |
| 1616 | rc = kux_test_descriptors |
| 1617 | if ne rc 0 |
| 1618 | ret rc |
| 1619 | end |
| 1620 | rc = kux_test_hid |
| 1621 | if ne rc 0 |
| 1622 | ret rc |
| 1623 | end |
| 1624 | rc = kux_test_audio |
| 1625 | if ne rc 0 |
| 1626 | ret rc |
| 1627 | end |
| 1628 | rc = kux_test_xhci_core |
| 1629 | if ne rc 0 |
| 1630 | ret rc |
| 1631 | end |
| 1632 | rc = kux_test_trb |
| 1633 | if ne rc 0 |
| 1634 | ret rc |
| 1635 | end |
| 1636 | rc = kux_test_rings |
| 1637 | if ne rc 0 |
| 1638 | ret rc |
| 1639 | end |
| 1640 | rc = kux_test_contexts |
| 1641 | if ne rc 0 |
| 1642 | ret rc |
| 1643 | end |
| 1644 | rc = kux_test_controller |
| 1645 | if ne rc 0 |
| 1646 | ret rc |
| 1647 | end |
| 1648 | ret 0 |
| 1649 | end |