diff options
| -rw-r--r-- | dev/kernel/HALKit/AMD64/Network/Generic+Basic+RTL8139.cc | 30 | ||||
| -rw-r--r-- | dev/kernel/KernelKit/Semaphore.h | 5 | ||||
| -rw-r--r-- | tools/fsck.hefs.cc | 2 |
3 files changed, 25 insertions, 12 deletions
diff --git a/dev/kernel/HALKit/AMD64/Network/Generic+Basic+RTL8139.cc b/dev/kernel/HALKit/AMD64/Network/Generic+Basic+RTL8139.cc index 3ccbfa24..bf0731c6 100644 --- a/dev/kernel/HALKit/AMD64/Network/Generic+Basic+RTL8139.cc +++ b/dev/kernel/HALKit/AMD64/Network/Generic+Basic+RTL8139.cc @@ -13,10 +13,9 @@ using namespace Kernel::HAL; STATIC UInt16 kRTLIOBase = 0xFFFF; -STATIC BOOL kTXEnabled = NO; - -STATIC UInt32 kRXOffset = 0UL; +STATIC BOOL kTXRXEnabled = NO; +STATIC UInt32 kRXOffset = 0UL; STATIC constexpr CONST UInt32 kRXBufferSize = 8192 + 16 + 1500; STATIC UInt8* kRXUpperLayer = nullptr; @@ -26,8 +25,8 @@ STATIC UInt8* kRXBuffer = nullptr; ///@brief RTL8139 Init routine. /***********************************************************************************/ -EXTERN_C Void rtl_init_nic_rtl8139(UInt16 io_base) noexcept { - if (kTXEnabled) return; +EXTERN_C BOOL rtl_init_nic_rtl8139(UInt16 io_base) noexcept { + if (kTXRXEnabled) return NO; kRTLIOBase = io_base; @@ -49,8 +48,7 @@ EXTERN_C Void rtl_init_nic_rtl8139(UInt16 io_base) noexcept { } if (timeout <= 0x1000) { - ke_panic(RUNTIME_CHECK_BAD_BEHAVIOR, "RTL8139: Reset failed"); - return; + return NO; } rt_out32(io_base + 0x30, (UInt32) (UIntPtr) kRXBuffer); @@ -61,7 +59,9 @@ EXTERN_C Void rtl_init_nic_rtl8139(UInt16 io_base) noexcept { rt_out16(io_base + 0x3C, 0x0005); - kTXEnabled = YES; + kTXRXEnabled = YES; + + return YES; } /***********************************************************************************/ @@ -69,7 +69,7 @@ EXTERN_C Void rtl_init_nic_rtl8139(UInt16 io_base) noexcept { /// @note This function is called when the device interrupts to retrieve network data. /***********************************************************************************/ -EXTERN_C void rtl_rtl8139_interrupt_handler() { +EXTERN_C Void rtl_rtl8139_interrupt_handler(UIntPtr rsp) { if (kRTLIOBase == 0xFFFF) return; UInt16 status = rt_in16(kRTLIOBase + 0x3E); @@ -111,4 +111,16 @@ EXTERN_C void rtl_rtl8139_interrupt_handler() { EXTERN_C UInt8* rtl_rtl8139_get_upper_layer() { return kRXUpperLayer; +} + +/***********************************************************************************/ +/// @brief RTL8139 set upper layer function +/// @param layer the upper layer. +/***********************************************************************************/ + +EXTERN_C BOOL rtl_rtl8139_set_upper_layer(UInt8* layer) { + if (!layer) return NO; + kRXUpperLayer = layer; + + return YES; }
\ No newline at end of file diff --git a/dev/kernel/KernelKit/Semaphore.h b/dev/kernel/KernelKit/Semaphore.h index 705d9f18..f73f36ed 100644 --- a/dev/kernel/KernelKit/Semaphore.h +++ b/dev/kernel/KernelKit/Semaphore.h @@ -42,8 +42,8 @@ inline BOOL rtl_sem_release(SemaphoreArr& sem) { } /// @brief Initializes the semaphore with an owner and a count of zero. -/// @param sem -/// @param owner +/// @param sem the semaphore array to use. +/// @param owner the owner to set, could be anything identifitable. /// @return inline BOOL rtl_sem_acquire(SemaphoreArr& sem, UInt64 owner) { if (!owner) { @@ -60,6 +60,7 @@ inline BOOL rtl_sem_acquire(SemaphoreArr& sem, UInt64 owner) { /// @brief Waits for the semaphore to be available, blocking until it is. /// @param sem /// @param timeout +/// @param condition condition pointer. /// @return inline BOOL rtl_sem_wait(SemaphoreArr& sem, UInt64 owner, UInt64 timeout, BOOL* condition = nullptr) { diff --git a/tools/fsck.hefs.cc b/tools/fsck.hefs.cc index 5a41cec2..eb6a66d8 100644 --- a/tools/fsck.hefs.cc +++ b/tools/fsck.hefs.cc @@ -13,7 +13,7 @@ static uint16_t kNumericalBase = 10; int main(int argc, char** argv) { if (argc < 2) { - mkfs::console_out() << "fsck: hefs: usage: fsck.hefs -i=<input_device>" << "\n"; + mkfs::console_out() << "fsck: hefs: usage: fsck.hefs -i=<input_device> -o=<origin>" << "\n"; return EXIT_FAILURE; } |
