Skip to content

Commit

Permalink
week 0 - selfhw: implemented a not-working async transfer QH and qTDs
Browse files Browse the repository at this point in the history
  • Loading branch information
Speedstor committed Oct 2, 2022
1 parent 8a0b7ae commit 96b16cc
Show file tree
Hide file tree
Showing 11 changed files with 194 additions and 309 deletions.
10 changes: 4 additions & 6 deletions .vscode/dryrun.log
@@ -1,6 +1,4 @@
make --dry-run --always-make --keep-going --print-directory
make: Entering directory '/home/wistorio/fun/github/ponchoOS'
make: Leaving directory '/home/wistorio/fun/github/ponchoOS'

make: *** No targets specified and no makefile found. Stop.

make.exe --dry-run --keep-going --print-directory
'make.exe' is not recognized as an internal or external command,
operable program or batch file.

280 changes: 4 additions & 276 deletions .vscode/targets.log
@@ -1,276 +1,4 @@
make all --print-data-base --no-builtin-variables --no-builtin-rules --question
make: *** No rule to make target 'all'. Stop.

# GNU Make 4.3
# Built for x86_64-pc-linux-gnu
# Copyright (C) 1988-2020 Free Software Foundation, Inc.
# License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
# This is free software: you are free to change and redistribute it.
# There is NO WARRANTY, to the extent permitted by law.

# Make data base, printed on Tue Sep 20 14:40:47 2022

# Variables

# environment
GDK_BACKEND = x11
# environment
LC_ALL = C
# environment
GNOME_SHELL_SESSION_MODE = ubuntu
# environment
SSH_AGENT_LAUNCHER = gnome-keyring
# environment
LOG_LEVEL = info
# environment
GJS_DEBUG_OUTPUT = stderr
# environment
VSCODE_CWD = /home/wistorio
# environment
WINDOWPATH = 2
# default
MAKE_COMMAND := make
# environment
QT_ACCESSIBILITY = 1
# automatic
@D = $(patsubst %/,%,$(dir $@))
# environment
VSCODE_HANDLES_UNCAUGHT_ERRORS = true
# default
.VARIABLES :=
# environment
PWD = /home/wistorio/fun/github/ponchoOS
# automatic
%D = $(patsubst %/,%,$(dir $%))
# environment
PS1 = \[\033[38;5;76m\]>\[\] \[\]\[\033[38;5;243m\][\[\]\[\033[38;5;248m\]\@\[\]\[\033[38;5;243m\]]\[\] \[\]\[\033[38;5;220m\]\[\033[48;5;238m\]\w\[\] \$ \[\]
# environment
XDG_DATA_DIRS = /usr/share/ubuntu:/usr/share/gnome:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop
# automatic
^D = $(patsubst %/,%,$(dir $^))
# automatic
%F = $(notdir $%)
# environment
VSCODE_CODE_CACHE_PATH = /home/wistorio/.config/Code/CachedData/e4503b30fc78200f846c62cf8091b76ff5547662
# environment
LANG = C
# environment
XAUTHORITY = /run/user/1000/gdm/Xauthority
# default
.LOADED :=
# default
.INCLUDE_DIRS = /usr/local/include /usr/include /usr/include
# makefile
MAKEFLAGS = pqrR
# makefile
CURDIR := /home/wistorio/fun/github/ponchoOS
# environment
APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL = 1
# environment
LESSOPEN = | /usr/bin/lesspipe %s
# automatic
*D = $(patsubst %/,%,$(dir $*))
# environment
MFLAGS = -pqrR
# environment
SSH_AUTH_SOCK = /run/user/1000/keyring/ssh
# default
.SHELLFLAGS := -c
# environment
XDG_CONFIG_DIRS = /etc/xdg/xdg-ubuntu:/etc/xdg
# automatic
+D = $(patsubst %/,%,$(dir $+))
# environment
XDG_SESSION_DESKTOP = ubuntu
# makefile
MAKEFILE_LIST :=
# automatic
@F = $(notdir $@)
# environment
VSCODE_PID = 8802
# environment
XDG_SESSION_TYPE = x11
# automatic
?D = $(patsubst %/,%,$(dir $?))
# environment
SESSION_MANAGER = local/wistorio-thinkpad:@/tmp/.ICE-unix/2754,unix/wistorio-thinkpad:/tmp/.ICE-unix/2754
# automatic
*F = $(notdir $*)
# environment
CHROME_DESKTOP = code-url-handler.desktop
# environment
DBUS_SESSION_BUS_ADDRESS = unix:path=/run/user/1000/bus
# automatic
<D = $(patsubst %/,%,$(dir $<))
# environment
VSCODE_NLS_CONFIG = {"locale":"en-us","availableLanguages":{},"_languagePackSupport":true}
# default
MAKE_HOST := x86_64-pc-linux-gnu
# environment
GNOME_DESKTOP_SESSION_ID = this-is-deprecated
# makefile
SHELL = /bin/sh
# default
MAKECMDGOALS := all
# environment
XMODIFIERS = @im=ibus
# environment
GJS_DEBUG_TOPICS = JS ERROR;JS LOG
# environment
SHLVL = 0
# environment
MAKELEVEL := 0
# default
MAKE = $(MAKE_COMMAND)
# environment
PATH = /home/wistorio/.local/bin:/home/wistorio/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/usr/local/build-i686-elf/bin
# default
MAKEFILES :=
# automatic
^F = $(notdir $^)
# environment
TZ = America/Los_Angeles
# environment
INVOCATION_ID = 533b53a5bd9e48de8c88a5473611bb79
# environment
USERNAME = wistorio
# environment
LESSCLOSE = /usr/bin/lesspipe %s %s
# automatic
?F = $(notdir $?)
# environment
XDG_CURRENT_DESKTOP = Unity
# environment
LS_COLORS = :di=0;36:
# automatic
+F = $(notdir $+)
# environment
DESKTOP_SESSION = ubuntu
# environment
ORIGINAL_XDG_CURRENT_DESKTOP = ubuntu:GNOME
# 'override' directive
GNUMAKEFLAGS :=
# environment
LOGNAME = wistorio
# environment
LOG_DST = /home/wistorio/.config/Code/logs/20220920T144035/exthost2/dendron.dendron/dendron.log
# environment
GIO_LAUNCHED_DESKTOP_FILE = /usr/share/applications/code.desktop
# makefile
.DEFAULT_GOAL :=
# environment
SYSTEMD_EXEC_PID = 2782
# environment
DISPLAY = :1
# environment
USER = wistorio
# environment
GTK_MODULES = gail:atk-bridge
# default
MAKE_VERSION := 4.3
# environment
MANAGERPID = 2339
# environment
GIO_LAUNCHED_DESKTOP_FILE_PID = 8802
# environment
_ = /usr/share/code/code
# environment
XDG_RUNTIME_DIR = /run/user/1000
# environment
GPG_AGENT_INFO = /run/user/1000/gnupg/S.gpg-agent:0:1
# environment
JOURNAL_STREAM = 8:45063
# environment
XDG_SESSION_CLASS = user
# environment
VSCODE_AMD_ENTRYPOINT = vs/workbench/api/node/extensionHostProcess
# environment
HOME = /home/wistorio
# environment
QT_IM_MODULE = ibus
# environment
ELECTRON_RUN_AS_NODE = 1
# environment
VSCODE_IPC_HOOK = /run/user/1000/vscode-d05c5a85-1.70.2-main.sock
# default
.RECIPEPREFIX :=
# automatic
<F = $(notdir $<)
# default
SUFFIXES :=
# default
.FEATURES := target-specific order-only second-expansion else-if shortest-stem undefine oneshell nocomment grouped-target extra-prereqs archives jobserver output-sync check-symlink load
# environment
XDG_MENU_PREFIX = gnome-
# environment
GDMSESSION = ubuntu
# variable set hash-table stats:
# Load=96/1024=9%, Rehash=0, Collisions=2/123=2%

# Pattern-specific Variable Values

# No pattern-specific variable values.

# Directories

# . (device 66309, inode 131226): 15 files, no impossibilities.

# 15 files, no impossibilities in 1 directories.

# Implicit Rules

# No implicit rules.

# Files

# Not a target:
Makefile:
# Implicit rule search has been done.
# File does not exist.
# File has been updated.
# Failed to be updated.

# Not a target:
.DEFAULT:
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.

# Not a target:
all:
# Command line target.
# Implicit rule search has been done.
# File does not exist.
# File has not been updated.

# Not a target:
makefile:
# Implicit rule search has been done.
# File does not exist.
# File has been updated.
# Failed to be updated.

# Not a target:
GNUmakefile:
# Implicit rule search has been done.
# File does not exist.
# File has been updated.
# Failed to be updated.

# files hash-table stats:
# Load=6/1024=1%, Rehash=0, Collisions=0/15=0%
# VPATH Search Paths

# No 'vpath' search paths.

# No general ('VPATH' variable) search path.

# strcache buffers: 1 (0) / strings = 23 / storage = 233 B / avg = 10 B
# current buf: size = 8162 B / used = 233 B / count = 23 / avg = 10 B

# strcache performance: lookups = 26 / hit rate = 11%
# hash-table stats:
# Load=23/8192=0%, Rehash=0, Collisions=0/26=0%
# Finished Make data base on Tue Sep 20 14:40:47 2022


make.exe all --print-data-base --no-builtin-variables --no-builtin-rules --question
'make.exe' is not recognized as an internal or external command,
operable program or batch file.

Binary file modified OVMFbin/OVMF_VARS-pure-efi.fd
Binary file not shown.
2 changes: 2 additions & 0 deletions kernel/Makefile
Expand Up @@ -30,6 +30,8 @@ kernel: $(OBJS) link

sure: kernel buildimg run

build: kernel buildimg

go: buildimg run

$(OBJDIR)/sys/interrupts/interrupts.o: $(SRCDIR)/sys/interrupts/interrupts.cpp
Expand Down
Binary file modified kernel/bin/CustomOS.img
Binary file not shown.
Binary file modified kernel/bin/kernel.elf
Binary file not shown.
6 changes: 5 additions & 1 deletion kernel/run2.bat
Expand Up @@ -11,5 +11,9 @@ qemu-system-x86_64 -machine q35 ^
-drive if=pflash,format=raw,unit=0,file=%OVMFDIR%/OVMF_CODE-pure-efi.fd,readonly=on ^
-drive if=pflash,format=raw,unit=1,file=%OVMFDIR%/OVMF_VARS-pure-efi.fd -net none ^
-device usb-ehci,id=ehci ^
-device usb-mouse,bus=ehci.0
-device usb-mouse,bus=ehci.0
pause

@REM -drive if=none,id=stick,format=raw,file=/path/to/file.img \
@REM -device nec-usb-xhci,id=xhci \
@REM -device usb-storage,bus=xhci.0,drive=stick
7 changes: 6 additions & 1 deletion kernel/src/sys/devices/usb/EhciPacketDef.h
Expand Up @@ -5,14 +5,19 @@

namespace USB {
#define QTD_ERR_COUNT 0b11
#define EMPTY_LENGTH 0
#define DEFAULT_MAX_PACKET_LENGTH 0x40

// setup packets
#define SETUP_PACKET_LENGTH 8
#define SETUP_STATUS 0b10000000
uint64_t GET_DESCRIPTOR_DATA_BUFFER = 0x00080E80;
uint64_t GET_DESCRIPTOR_DATA_BUFFER = 0x0000400080060001;



// PIDs
#define PID_OUT 0b00
#define PID_IN 0b01
#define PID_SETUP 0b10
}

Expand Down
19 changes: 19 additions & 0 deletions kernel/src/sys/devices/usb/EhciStructs.h
Expand Up @@ -4,6 +4,10 @@
#include <stdint.h>

namespace USB {
// general help defs
#define UPPER_64_MASK 0xFFFFFFFF00000000
#define LEAST_5_BIT_MASK (0b11111)

// Ehci --------
struct EhciStructuralParams {
uint8_t NumPorts:4;
Expand Down Expand Up @@ -159,6 +163,21 @@ namespace USB {
#define QTD_TOKEN_STATUS_SPLIT_TRANSACTION_STATUS (1 << 1)
#define QTD_TOKEN_STATUS_PING (1 << 0)

#define QH_TYP_ITD 0b00 // isochronous transfer descriptor
#define QH_TYP_QH 0b01 // queue head
#define QH_TYP_SITD 0b10 // split transaction isochronous transfer descriptor
#define QH_TYP_FSTN 0b11 // Frame Span Traversal Node
#define QH_TYP_SHIFT 1

#define QH_MAX_PACKET_LENGHT_SHIFT 16
#define QH_HEAD_RECLAMATION_FLAG (1 << 15)
#define QH_DATA_TOGGLE_CONTROL (1 << 14)
#define QH_EPS_FULL_SPEED (0b00 << 12)
#define QH_EPS_LOW_SPEED (0b01 << 12)
#define QH_EPS_HIGH_SPEED (0b10 << 12)
#define QH_ENDPOINT_NUMBER_SHIFT 8
#define QH_INACTIVE_ON_NEXT_TRANS (1 << 7)

// mindshare whitepaper p.16
struct EhciCapbilites {
uint8_t length;
Expand Down

0 comments on commit 96b16cc

Please sign in to comment.