Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Difference From ae2a86 To b4376737b9d4a127
2020-01-05
| ||
09:20 | Correct use of locks Leaf check-in: a10bd48ca7 user: crees tags: trunk | |
2020-01-04
| ||
21:20 | Forgot to pass mtx pointer... check-in: b4376737b9 user: crees tags: trunk | |
21:10 | Put some mutexes in and move the inits check-in: 418af28deb user: crees tags: trunk | |
2020-01-02
| ||
22:46 | Replace removed timeout with callout functions check-in: ad269d7cbc user: crees tags: trunk | |
22:41 | Initial import check-in: ae2a86d1f1 user: crees tags: trunk | |
22:40 | initial empty check-in check-in: f81c5aa884 user: crees tags: trunk | |
Changes to kernel/OS/FreeBSD/os_freebsd.c.
︙ | ︙ | |||
469 470 471 472 473 474 475 | typedef struct tmout_desc { volatile int active; int timestamp; void (*func) (void *); void *arg; | | > > | 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 | typedef struct tmout_desc { volatile int active; int timestamp; void (*func) (void *); void *arg; struct callout timer; } tmout_desc_t; static volatile int next_id = 0; #define MAX_TMOUTS 128 tmout_desc_t tmouts[MAX_TMOUTS] = { {0} }; int timeout_random = 0x12123400; static struct mtx oss_timeout_mutex; void oss_timer_callback (void *arg) { int ix; tmout_desc_t *tmout = arg; |
︙ | ︙ | |||
503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 | timeout_id_t oss_timeout (void (*func) (void *), void *arg, unsigned long long ticks) { tmout_desc_t *tmout = NULL; int id, n; timeout_random++; n = 0; id = -1; while (id == -1 && n < MAX_TMOUTS) { if (!tmouts[next_id].active) { tmouts[next_id].active = 1; id = next_id++; tmout = &tmouts[id]; break; } next_id = (next_id + 1) % MAX_TMOUTS; } if (id == -1) /* No timer slots available */ { cmn_err (CE_CONT, "Timeout table full\n"); return 0; } tmout->func = func; tmout->arg = arg; tmout->timestamp = id | (timeout_random & ~0xff); | > > > > | > > > > > | | 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 | timeout_id_t oss_timeout (void (*func) (void *), void *arg, unsigned long long ticks) { tmout_desc_t *tmout = NULL; int id, n; mtx_lock(&oss_timeout_mutex); timeout_random++; n = 0; id = -1; while (id == -1 && n < MAX_TMOUTS) { if (!tmouts[next_id].active) { tmouts[next_id].active = 1; id = next_id++; tmout = &tmouts[id]; break; } next_id = (next_id + 1) % MAX_TMOUTS; } if (id == -1) /* No timer slots available */ { mtx_unlock(&oss_timeout_mutex); cmn_err (CE_CONT, "Timeout table full\n"); return 0; } tmout->func = func; tmout->arg = arg; tmout->timestamp = id | (timeout_random & ~0xff); mtx_unlock(&oss_timeout_mutex); callout_reset(&tmout->timer, ticks, oss_timer_callback, tmout); return id | (timeout_random & ~0xff); } void oss_untimeout (timeout_id_t id) { tmout_desc_t *tmout; int ix; ix = id & 0xff; if (ix < 0 || ix >= MAX_TMOUTS) return; mtx_lock(&oss_timeout_mutex); timeout_random++; tmout = &tmouts[ix]; mtx_unlock(&oss_timeout_mutex); if (tmout->timestamp != id) /* Expired timer */ return; if (tmout->active) callout_stop(&tmout->timer); tmout->active = 0; tmout->timestamp = 0; } int oss_get_procinfo (int what) { |
︙ | ︙ | |||
614 615 616 617 618 619 620 621 622 623 624 625 626 627 | getmicrotime (&timecopy); return timecopy.tv_sec; } int soundcard_attach (void) { oss_device_t *osdev; if (module_lookupbyname("sound") != NULL) { cmn_err (CE_WARN, "Open Sound System conflicts with FreeBSD driver\n"); cmn_err (CE_CONT, "Please remove sound(4) from kernel or unload it\n"); return EBUSY; | > | 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 | getmicrotime (&timecopy); return timecopy.tv_sec; } int soundcard_attach (void) { int i; oss_device_t *osdev; if (module_lookupbyname("sound") != NULL) { cmn_err (CE_WARN, "Open Sound System conflicts with FreeBSD driver\n"); cmn_err (CE_CONT, "Please remove sound(4) from kernel or unload it\n"); return EBUSY; |
︙ | ︙ | |||
645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | #endif osdev->major = oss_major; oss_register_device (osdev, "OSS core services"); oss_common_init (osdev); return 0; } int soundcard_detach (void) { int i; if (refcount > 0 || open_devices > 0) return EBUSY; oss_unload_drivers (); osdev_delete (core_osdev); for (i = 0; i < nmemblocks; i++) KERNEL_FREE (memblocks[i]); | > > > > > > > > > > > | 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 | #endif osdev->major = oss_major; oss_register_device (osdev, "OSS core services"); oss_common_init (osdev); mtx_init(&oss_timeout_mutex, "OSS timeout", NULL, MTX_DEF); for (i = 0; i < MAX_TMOUTS; ++i) callout_init_mtx(&tmouts[i].timer, &oss_timeout_mutex, CALLOUT_RETURNUNLOCKED); return 0; } int soundcard_detach (void) { int i; if (refcount > 0 || open_devices > 0) return EBUSY; for (i = 0; i < MAX_TMOUTS; ++i) callout_drain(&tmouts[i].timer); mtx_destroy(&oss_timeout_mutex); oss_unload_drivers (); osdev_delete (core_osdev); for (i = 0; i < nmemblocks; i++) KERNEL_FREE (memblocks[i]); |
︙ | ︙ |