Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions kernel/audio/virtio_audio_pci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ void VirtioAudioDriver::config_channel_maps(){
void VirtioAudioDriver::handle_interrupt(){
select_queue(&audio_dev, EVENT_QUEUE);
struct virtq_used* used = (struct virtq_used*)(uintptr_t)audio_dev.common_cfg->queue_device;
// TODO: desc isn't used in this function, was it supposed to be?
struct virtq_desc* desc = (struct virtq_desc*)(uintptr_t)audio_dev.common_cfg->queue_desc;
struct virtq_avail* avail = (struct virtq_avail*)(uintptr_t)audio_dev.common_cfg->queue_driver;

Expand Down
2 changes: 1 addition & 1 deletion kernel/input/dwc2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ bool DWC2Driver::request_sized_descriptor(uint8_t address, uint8_t endpoint, uin
usb_setup_packet packet = {
.bmRequestType = rType,
.bRequest = request,
.wValue = (type << 8) | descriptor_index,
.wValue = (uint16_t)((type << 8) | descriptor_index),
.wIndex = wIndex,
.wLength = descriptor_size
};
Expand Down
2 changes: 1 addition & 1 deletion kernel/input/input_dispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ bool sys_shortcut_triggered(uint16_t pid, uint16_t sid){
}

bool input_init(){
for (int i = 0; i < 16; i++) shortcuts[i] = (shortcut){0};
for (int i = 0; i < 16; i++) shortcuts[i] = {};
if (BOARD_TYPE == 2 && RPI_BOARD != 5){
input_driver = new DWC2Driver();//TODO: QEMU & 3 Only
return input_driver->init();
Expand Down
6 changes: 2 additions & 4 deletions kernel/input/xhci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,15 +411,13 @@ bool XHCIDriver::request_sized_descriptor(uint8_t address, uint8_t endpoint, uin
usb_setup_packet packet = {
.bmRequestType = rType,
.bRequest = request,
.wValue = (type << 8) | descriptor_index,
.wValue = (uint16_t)((type << 8) | descriptor_index),
.wIndex = wIndex,
.wLength = descriptor_size
};

// kprintf("RT: %x R: %x V: %x I: %x L: %x",packet.bmRequestType,packet.bRequest,packet.wValue,packet.wIndex,packet.wLength);

bool is_in = (rType & 0x80) != 0;

xhci_ring *transfer_ring = &endpoint_map[address << 8 | endpoint];

trb* setup_trb = &transfer_ring->ring[transfer_ring->index++];
Expand Down Expand Up @@ -482,7 +480,7 @@ uint32_t XHCIDriver::calculate_interval(uint32_t speed, uint32_t received_interv

uint32_t i;
for (i = 3; i < 11; i++)
if (125 * (1 << i) >= 1000 * received_interval) break;
if (125u * (1 << i) >= 1000 * received_interval) break;

return i;
}
Expand Down
14 changes: 5 additions & 9 deletions kernel/networking/port_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@

static port_entry_t g_port_table[PROTO_COUNT][MAX_PORTS];//tab proto/port

static inline bool port_valid(uint32_t p) {
return p > 0 && p < MAX_PORTS;
}

static inline bool proto_valid(protocol_t proto) {
return (uint32_t)proto < PROTO_COUNT;
}
Expand Down Expand Up @@ -57,7 +53,7 @@ bool port_bind_manual(protocol_t proto,
uint16_t pid,
port_recv_handler_t handler)
{
if (!proto_valid(proto) || !port_valid(port)) return false;
if (!proto_valid(proto)) return false;
port_entry_t *e = &g_port_table[proto][port];
if (e->used) return false;
e->used = true;
Expand All @@ -70,7 +66,7 @@ bool port_unbind(protocol_t proto,
uint16_t port,
uint16_t pid)
{
if (!proto_valid(proto) || !port_valid(port)) return false;
if (!proto_valid(proto)) return false;
port_entry_t *e = &g_port_table[proto][port];
if (!e->used || e->pid != pid) return false;
e->used = false;
Expand All @@ -93,17 +89,17 @@ void port_unbind_all(uint16_t pid) {
}

bool port_is_bound(protocol_t proto, uint16_t port) {
if (!proto_valid(proto) || !port_valid(port)) return false;
if (!proto_valid(proto)) return false;
return g_port_table[proto][port].used;
}

uint16_t port_owner_of(protocol_t proto, uint16_t port) {
if (!proto_valid(proto) || !port_valid(port)) return PORT_FREE_OWNER;
if (!proto_valid(proto)) return PORT_FREE_OWNER;
return g_port_table[proto][port].pid;
}

port_recv_handler_t port_get_handler(protocol_t proto, uint16_t port) {
if (!proto_valid(proto) || !port_valid(port)) return NULL;
if (!proto_valid(proto)) return NULL;
return g_port_table[proto][port].used
? g_port_table[proto][port].handler
: NULL;
Expand Down