Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9ee27c5595 | ||
|
|
dc7d6dd842 | ||
|
|
a8ade5e0c2 |
No files matched your search
@@ -1,54 +0,0 @@
|
||||
# =============================================================================
|
||||
# Apps
|
||||
# User-facing applications, games, multimedia, UI and desktop resources
|
||||
# =============================================================================
|
||||
|
||||
^programs/(cmm|demos|emulator|games|media|other)/.* @KolibriOS/apps
|
||||
^contrib/(games|media|other)/.* @KolibriOS/apps
|
||||
^skins/.* @KolibriOS/apps
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# System
|
||||
# Kernel, drivers, filesystems, SDK, libraries, toolchain and system utilities
|
||||
# =============================================================================
|
||||
|
||||
^kernel/.* @KolibriOS/system
|
||||
^drivers/.* @KolibriOS/system
|
||||
|
||||
^programs/(bcc32|develop|fs|hd_load|system|testing)/.* @KolibriOS/system
|
||||
^contrib/(C_Layer|sdk|toolchain)/.* @KolibriOS/system
|
||||
|
||||
# Shared system/API includes in programs/
|
||||
^programs/[^/]+\\.inc$ @KolibriOS/system
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Network
|
||||
# Network stack, network drivers, protocols, libraries and network applications
|
||||
# =============================================================================
|
||||
|
||||
^kernel/trunk/network/.* @KolibriOS/network
|
||||
|
||||
^drivers/ethernet/.* @KolibriOS/network
|
||||
^drivers/(mii|netdrv)\\.inc$ @KolibriOS/network
|
||||
|
||||
^programs/network/.* @KolibriOS/network
|
||||
^programs/network\\.inc$ @KolibriOS/network
|
||||
|
||||
^programs/develop/libraries/(http|network|kos_mbedtls)/.* @KolibriOS/network
|
||||
|
||||
^contrib/network/.* @KolibriOS/network
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# DevOps
|
||||
# CI/CD, repository infrastructure, build system and autobuild configuration
|
||||
# =============================================================================
|
||||
|
||||
^\\.gitea/.* @KolibriOS/devops
|
||||
^_tools/.* @KolibriOS/devops
|
||||
|
||||
^\\.gitmodules$ @KolibriOS/devops
|
||||
^build\\.txt$ @KolibriOS/devops
|
||||
^tup\\.config\\.template$ @KolibriOS/devops
|
||||
@@ -19,38 +19,3 @@
|
||||
owner: "{{ storage_user }}"
|
||||
group: "{{ storage_user }}"
|
||||
mode: preserve
|
||||
|
||||
# per-program binaries browsable at <version>/<lang>/data/, like on the old builds server
|
||||
- name: Creating build tree folders
|
||||
ansible.builtin.file:
|
||||
path: "{{ storage_path }}/{{ version }}/{{ item | basename | regex_replace('\\.tar\\.gz$', '') }}/data"
|
||||
state: directory
|
||||
owner: "{{ storage_user }}"
|
||||
group: "{{ storage_user }}"
|
||||
mode: '0755'
|
||||
with_fileglob: "{{ tree_artifact_path }}/*.tar.gz"
|
||||
|
||||
- name: Unpacking build trees
|
||||
ansible.builtin.unarchive:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ storage_path }}/{{ version }}/{{ item | basename | regex_replace('\\.tar\\.gz$', '') }}/data"
|
||||
owner: "{{ storage_user }}"
|
||||
group: "{{ storage_user }}"
|
||||
with_fileglob: "{{ tree_artifact_path }}/*.tar.gz"
|
||||
|
||||
# stable URL for the newest build: <storage_path>/latest/<lang>/...
|
||||
- name: Updating latest symlink
|
||||
ansible.builtin.file:
|
||||
src: "{{ version }}"
|
||||
dest: "{{ storage_path }}/latest"
|
||||
state: link
|
||||
force: true
|
||||
owner: "{{ storage_user }}"
|
||||
group: "{{ storage_user }}"
|
||||
|
||||
# emulators hardcode <site root>/<lang>/data/data/kolibri.img; storage_path is the ci folder, one level under the site root
|
||||
- name: Sending bare images to stable emulator paths
|
||||
ansible.builtin.copy:
|
||||
src: "{{ stable_artifact_path }}/"
|
||||
dest: "{{ storage_path }}/../"
|
||||
mode: preserve
|
||||
@@ -162,13 +162,12 @@ jobs:
|
||||
tup init
|
||||
tup variant ${{ matrix.lang }}.config
|
||||
|
||||
# build the image for language variant; keep the tup log for publishing
|
||||
# build the image for language variant
|
||||
- name: Build KolibriOS
|
||||
run: |
|
||||
set -o pipefail
|
||||
export PATH=/home/autobuild/tools/win32/bin:$PATH
|
||||
source kos32-export-env-vars ${{ gitea.workspace }}
|
||||
tup build-${{ matrix.lang }} 2>&1 | tee build.log
|
||||
tup build-${{ matrix.lang }}
|
||||
|
||||
# stamp the cache with its commit so later builds diff against it
|
||||
- name: Record cache base commit
|
||||
@@ -182,26 +181,15 @@ jobs:
|
||||
id: vars
|
||||
run: echo "descr=$(git describe --tags)" >> $GITEA_OUTPUT
|
||||
|
||||
# stage build outputs under their final names, plus distribution kit and checksums
|
||||
- name: Prepare artifacts
|
||||
# rename build outputs to their final names so artifacts are bare files
|
||||
- name: Rename images
|
||||
run: |
|
||||
set -e
|
||||
BASE="kolibrios-${{ steps.vars.outputs.descr }}-${{ matrix.lang }}"
|
||||
for ext in img iso raw; do
|
||||
cp "build-${{ matrix.lang }}/data/kolibri.$ext" "$BASE.$ext"
|
||||
cp "build-${{ matrix.lang }}/data/kolibri.$ext" \
|
||||
"kolibrios-${{ steps.vars.outputs.descr }}-${{ matrix.lang }}.$ext"
|
||||
done
|
||||
# zip: distr targets Windows/DOS users, Explorer opens it natively
|
||||
(cd "build-${{ matrix.lang }}/data" && zip -r -9 -q "${{ gitea.workspace }}/$BASE.distr.zip" distribution_kit)
|
||||
# whole build tree for per-program downloads; the big images ship separately
|
||||
tar -C "build-${{ matrix.lang }}" \
|
||||
--exclude './data/kolibri.iso' \
|
||||
--exclude './data/kolibri.raw' \
|
||||
--exclude './data/distribution_kit' \
|
||||
-czf "$BASE.tree.tar.gz" .
|
||||
sha256sum "$BASE".img "$BASE".iso "$BASE".raw "$BASE".distr.zip > "$BASE.sha256sums.txt"
|
||||
mv build.log "$BASE.build.log"
|
||||
|
||||
# publish the images; longer retention for the floppy image
|
||||
#publish the three images; longer retention for the floppy image.
|
||||
- name: Upload floppy image
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
@@ -223,34 +211,6 @@ jobs:
|
||||
path: kolibrios-${{ steps.vars.outputs.descr }}-${{ matrix.lang }}.raw
|
||||
retention-days: 15
|
||||
|
||||
- name: Upload distribution kit
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: kolibrios-${{ steps.vars.outputs.descr }}-${{ matrix.lang }}.distr.zip
|
||||
path: kolibrios-${{ steps.vars.outputs.descr }}-${{ matrix.lang }}.distr.zip
|
||||
retention-days: 30
|
||||
|
||||
- name: Upload checksums
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: kolibrios-${{ steps.vars.outputs.descr }}-${{ matrix.lang }}.sha256sums.txt
|
||||
path: kolibrios-${{ steps.vars.outputs.descr }}-${{ matrix.lang }}.sha256sums.txt
|
||||
retention-days: 90
|
||||
|
||||
- name: Upload build log
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: kolibrios-${{ steps.vars.outputs.descr }}-${{ matrix.lang }}.build.log
|
||||
path: kolibrios-${{ steps.vars.outputs.descr }}-${{ matrix.lang }}.build.log
|
||||
retention-days: 90
|
||||
|
||||
- name: Upload build tree
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: kolibrios-${{ steps.vars.outputs.descr }}-${{ matrix.lang }}.tree.tar.gz
|
||||
path: kolibrios-${{ steps.vars.outputs.descr }}-${{ matrix.lang }}.tree.tar.gz
|
||||
retention-days: 15
|
||||
|
||||
deploy:
|
||||
name: "Publish Images"
|
||||
runs-on: ubuntu-latest
|
||||
@@ -275,50 +235,31 @@ jobs:
|
||||
run: |
|
||||
set -eu
|
||||
|
||||
rm -rf ./norm-artifacts ./stable-artifacts ./tree-artifacts
|
||||
mkdir -p ./norm-artifacts ./stable-artifacts ./tree-artifacts
|
||||
rm -rf ./norm-artifacts
|
||||
mkdir -p ./norm-artifacts
|
||||
|
||||
find ./artifacts -type f -name 'kolibrios-*' | while read -r file; do
|
||||
fname="$(basename "$file")" # kolibrios-<descr>-<lang>.<suffix>
|
||||
case "$fname" in
|
||||
*.tree.tar.gz) stem="${fname%.tree.tar.gz}";;
|
||||
*.distr.zip) stem="${fname%.distr.zip}";;
|
||||
*.sha256sums.txt) stem="${fname%.sha256sums.txt}";;
|
||||
*.build.log) stem="${fname%.build.log}";;
|
||||
*.img) stem="${fname%.img}";;
|
||||
*.iso) stem="${fname%.iso}";;
|
||||
*.raw) stem="${fname%.raw}";;
|
||||
*) continue;;
|
||||
esac
|
||||
lang="${stem##*-}" # <lang> has no dashes, <descr> may
|
||||
find ./artifacts -type f \( \
|
||||
-name 'kolibrios-*.img' -o \
|
||||
-name 'kolibrios-*.iso' -o \
|
||||
-name 'kolibrios-*.raw' \
|
||||
\) | while read -r file; do
|
||||
fname="$(basename "$file")" # kolibrios-<descr>-<lang>.<ext>
|
||||
name_without_ext="${fname%.*}"
|
||||
lang="${name_without_ext##*-}"
|
||||
|
||||
mkdir -p "./norm-artifacts/$lang"
|
||||
case "$fname" in
|
||||
*.tree.tar.gz)
|
||||
# unpacked on the server into <version>/<lang>/data/ for per-program downloads
|
||||
cp "$file" "./tree-artifacts/$lang.tar.gz";;
|
||||
*.sha256sums.txt)
|
||||
cp "$file" "./norm-artifacts/$lang/sha256sums.txt";;
|
||||
*.build.log)
|
||||
cp "$file" "./norm-artifacts/$lang/build.log";;
|
||||
*.img)
|
||||
cp "$file" "./norm-artifacts/$lang/$fname"
|
||||
# emulators (e.g. v86) hardcode <lang>/data/data/kolibri.img at the site root
|
||||
mkdir -p "./stable-artifacts/$lang/data/data"
|
||||
cp "$file" "./stable-artifacts/$lang/data/data/kolibri.img";;
|
||||
*)
|
||||
cp "$file" "./norm-artifacts/$lang/$fname";;
|
||||
esac
|
||||
cp "$file" "./norm-artifacts/$lang/$fname"
|
||||
done
|
||||
|
||||
# derive the version (git describe) from an artifact name: kolibrios-<descr>-<lang>.iso -> <descr>
|
||||
sample="$(find ./norm-artifacts -type f -name 'kolibrios-*.iso' | head -n1)"
|
||||
# derive the version (git describe) from an artifact name:
|
||||
# kolibrios-<descr>-<lang>.<ext> -> <descr>
|
||||
sample="$(find ./norm-artifacts -type f -name 'kolibrios-*' | head -n1)"
|
||||
base="$(basename "${sample%.*}")" # kolibrios-<descr>-<lang>
|
||||
version="${base%-*}" # kolibrios-<descr>
|
||||
version="${version#kolibrios-}" # <descr>
|
||||
echo "version=$version" >> $GITEA_OUTPUT
|
||||
|
||||
find ./norm-artifacts ./stable-artifacts ./tree-artifacts -type f -print
|
||||
find ./norm-artifacts -type f -print
|
||||
|
||||
- name: Setup SSH
|
||||
run: |
|
||||
@@ -344,6 +285,4 @@ jobs:
|
||||
-e "storage_path=${{ secrets.STORAGE_PATH }}" \
|
||||
-e "version=${{ steps.normalize.outputs.version }}" \
|
||||
-e "artifact_path=${{ gitea.workspace }}/norm-artifacts" \
|
||||
-e "stable_artifact_path=${{ gitea.workspace }}/stable-artifacts" \
|
||||
-e "tree_artifact_path=${{ gitea.workspace }}/tree-artifacts" \
|
||||
-v
|
||||
@@ -34,10 +34,11 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
token: ${{ secrets.BOT_TOKEN }}
|
||||
|
||||
- name: Bump ${{ matrix.name }} and open PR
|
||||
env:
|
||||
TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
TOKEN: ${{ secrets.BOT_TOKEN }}
|
||||
API: ${{ github.api_url }}
|
||||
REPO: ${{ github.repository }}
|
||||
NAME: ${{ matrix.name }}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
branch = main
|
||||
[submodule "programs/develop/oberon07"]
|
||||
path = programs/develop/oberon07
|
||||
url = https://git.kolibrios.org/KolibriOS/oberon-07-compiler.git
|
||||
url = https://github.com/AntKrotov/oberon-07-compiler.git
|
||||
branch = master
|
||||
[submodule "programs/cmm"]
|
||||
path = programs/cmm
|
||||
|
||||
@@ -427,7 +427,7 @@ tup.append_table(img_files, {
|
||||
{"DOCPACK", VAR_PROGS .. "/system/docpack/docpack"},
|
||||
{"DEFAULT.SKN", VAR_SKINS .. "/../skins/Leency/Shkvorka/Shkvorka.skn"},
|
||||
{"DISPTEST", VAR_PROGS .. "/testing/disptest/disptest"},
|
||||
{"END", VAR_PROGS .. "/system/end/light/end"},
|
||||
{"END", VAR_PROGS .. "/system/end/end"},
|
||||
{"ESKIN", VAR_PROGS .. "/system/eskin/eskin"},
|
||||
{"GMON", VAR_PROGS .. "/system/gmon/gmon"},
|
||||
{"HDD_INFO", VAR_PROGS .. "/system/hdd_info/hdd_info"},
|
||||
@@ -573,7 +573,6 @@ tup.append_table(img_files, {
|
||||
{"DRIVERS/UHCI.SYS", VAR_DRVS .. "/usb/uhci.sys"},
|
||||
{"DRIVERS/OHCI.SYS", VAR_DRVS .. "/usb/ohci.sys"},
|
||||
{"DRIVERS/EHCI.SYS", VAR_DRVS .. "/usb/ehci.sys"},
|
||||
{"DRIVERS/XHCI.SYS", VAR_DRVS .. "/usb/xhci/xhci.sys"},
|
||||
{"DRIVERS/USBHID.SYS", VAR_DRVS .. "/usb/usbhid/usbhid.sys"},
|
||||
{"DRIVERS/USBFTDI.SYS", VAR_DRVS .. "/usb/usbftdi/usbftdi.sys"},
|
||||
{"DRIVERS/USBOTHER.SYS",VAR_DRVS .. "/usb/usbother/usbother.sys"},
|
||||
|
||||
@@ -1,644 +0,0 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;;
|
||||
;; sky2.inc - Marvell Yukon-2 (88E805x and friends) registers
|
||||
;; for KolibriOS
|
||||
;;
|
||||
;; Minimal subset needed to probe the chip and read the permanent
|
||||
;; MAC address. Expand later for rings, BMU, status LE, etc.
|
||||
;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
|
||||
; PCI Power Management (capability; standard offset when present)
|
||||
; We poke the common location used by bge: config offset 0x4C is often PMCSR
|
||||
; on these chips (capability linked). OpenBSD uses BGE_PCI_PWRMGMT_CMD.
|
||||
PCI_PWRMGMT_CMD = 0x4C
|
||||
PCI_PWR_D0 = 0x00
|
||||
PCI_PWR_D3hot = 0x03
|
||||
PCI_PWR_PME_ENABLE = 0x0100
|
||||
|
||||
;----------------------------------------------------------------------
|
||||
; PCI vendor / device IDs (subset of the Yukon-2 family)
|
||||
;----------------------------------------------------------------------
|
||||
PCI_VENDOR_MARVELL = 0x11AB
|
||||
|
||||
; Common 88E805x / Yukon-2 device IDs
|
||||
PCI_DEVICE_88E8021 = 0x4340
|
||||
PCI_DEVICE_88E8022 = 0x4341
|
||||
PCI_DEVICE_88E8035 = 0x4350
|
||||
PCI_DEVICE_88E8036 = 0x4351
|
||||
PCI_DEVICE_88E8038 = 0x4352
|
||||
PCI_DEVICE_88E8039 = 0x4353
|
||||
PCI_DEVICE_88E8040 = 0x4354
|
||||
PCI_DEVICE_88E8040T = 0x4355
|
||||
PCI_DEVICE_88E8052 = 0x4360
|
||||
PCI_DEVICE_88E8053 = 0x4361
|
||||
PCI_DEVICE_88E8055 = 0x4363 ; the one we care about first
|
||||
PCI_DEVICE_88E8056 = 0x4364
|
||||
PCI_DEVICE_88E8057 = 0x4362
|
||||
PCI_DEVICE_88E8058 = 0x436A
|
||||
PCI_DEVICE_88E8071 = 0x436B
|
||||
PCI_DEVICE_88E8072 = 0x436C
|
||||
PCI_DEVICE_88E8075 = 0x4370
|
||||
|
||||
;----------------------------------------------------------------------
|
||||
; Control / Status registers (block 0)
|
||||
;----------------------------------------------------------------------
|
||||
B0_RAP = 0x0000
|
||||
B0_CTST = 0x0004 ; Control/Status (16-bit)
|
||||
B0_POWER_CTRL = 0x0007
|
||||
B0_ISRC = 0x0008
|
||||
B0_IMSK = 0x000C
|
||||
B0_HWE_ISRC = 0x0010
|
||||
B0_HWE_IMSK = 0x0014
|
||||
|
||||
; Yukon-2 special ISR registers
|
||||
B0_Y2_SP_ISRC2 = 0x001C
|
||||
B0_Y2_SP_ISRC3 = 0x0020
|
||||
B0_Y2_SP_EISR = 0x0024
|
||||
B0_Y2_SP_LISR = 0x0028
|
||||
B0_Y2_SP_ICR = 0x002C
|
||||
|
||||
; CTST bits we care about for a minimal bring-up
|
||||
CS_RST_SET = 0x0001
|
||||
CS_RST_CLR = 0x0002
|
||||
CS_MRST_SET = 0x0004
|
||||
CS_MRST_CLR = 0x0008
|
||||
CS_STOP_MASTER = 0x0020
|
||||
CS_STOP_DONE = 0x0040
|
||||
CS_SW_IRQ = 0x0200
|
||||
CS_CL_SW_IRQ = 0x0100
|
||||
|
||||
;----------------------------------------------------------------------
|
||||
; Block 2 – MAC addresses, chip ID, clocks
|
||||
;----------------------------------------------------------------------
|
||||
B2_MAC_1 = 0x0100 ; port 0 permanent MAC (6 bytes)
|
||||
B2_MAC_2 = 0x0108 ; port 1 (if dual)
|
||||
B2_MAC_3 = 0x0110
|
||||
B2_CONN_TYP = 0x0118
|
||||
B2_PMD_TYP = 0x0119
|
||||
B2_MAC_CFG = 0x011A ; chip revision in bits 7:4
|
||||
B2_CHIP_ID = 0x011B
|
||||
B2_E_0 = 0x011C
|
||||
B2_Y2_CLK_GATE = 0x011D
|
||||
B2_Y2_HW_RES = 0x011E
|
||||
B2_E_3 = 0x011F
|
||||
B2_Y2_CLK_CTRL = 0x0120
|
||||
|
||||
; Chip ID values (read from B2_CHIP_ID)
|
||||
CHIP_ID_YUKON_XL = 0xB3
|
||||
CHIP_ID_YUKON_EC_U = 0xB4 ; 88E8055 is often this
|
||||
CHIP_ID_YUKON_EX = 0xB5
|
||||
CHIP_ID_YUKON_EC = 0xB6
|
||||
CHIP_ID_YUKON_FE = 0xB7
|
||||
CHIP_ID_YUKON_FE_P = 0xB8
|
||||
CHIP_ID_YUKON_SUPR = 0xB9
|
||||
CHIP_ID_YUKON_UL_2 = 0xBA
|
||||
CHIP_ID_YUKON_OPT = 0xBC
|
||||
CHIP_ID_YUKON_PRM = 0xBD
|
||||
CHIP_ID_YUKON_OP_2 = 0xBE
|
||||
|
||||
; B2_MAC_CFG
|
||||
CFG_CHIP_R_MSK = 0xF0 ; revision in bits 7:4
|
||||
CFG_SNG_MAC = 0x01 ; 1 = single MAC
|
||||
|
||||
;----------------------------------------------------------------------
|
||||
; ASF / test-control / RAM-interface (used during reset)
|
||||
;----------------------------------------------------------------------
|
||||
B28_Y2_ASF_STAT_CMD = 0x0E68 ; 32 bit ASF Status and Command Reg
|
||||
Y2_ASF_RESET = 1 shl 3 ; ASF system in reset state
|
||||
Y2_ASF_DISABLE = 1 shl 12 ; ASF unit disable (in B0_CTST)
|
||||
|
||||
B2_TST_CTRL1 = 0x0158 ; 8 bit Test Control Register 1
|
||||
TST_CFG_WRITE_ON = 1 shl 1 ; Enable Config Reg WR
|
||||
TST_CFG_WRITE_OFF = 1 shl 0 ; Disable Config Reg WR
|
||||
|
||||
; Standard PCI config space status register (offset 0x06) - sticky error bits,
|
||||
; write-1-to-clear. Cleared during reset in case a previous driver load / BIOS
|
||||
; left an error latched (matches Linux sky2_reset()).
|
||||
PCI_STATUS_ERROR_BITS = 0xF900 ; PARITY | SIG_SYSERR | REC_MABORT |
|
||||
; REC_TABORT | SIG_TABORT | DET_PARITY
|
||||
|
||||
Y2_CLK_DIV_DIS = 1 shl 0 ; disable core clock division (B2_Y2_CLK_CTRL)
|
||||
Y2_LED_STAT_ON = 1 shl 9 ; "driver loaded" status LED on (B0_CTST)
|
||||
|
||||
;----------------------------------------------------------------------
|
||||
; Block 8 / Tx Arbiter, GMAC control (SK_REG-style: stride 0x80/port)
|
||||
;----------------------------------------------------------------------
|
||||
GMAC_CTRL = 0x0F00 ; 32 bit GMAC Control Reg
|
||||
GMAC_IRQ_MSK = 0x0F0C ; 8 bit GMAC Interrupt Mask Reg
|
||||
GMAC_LINK_CTRL = 0x0F10 ; 16 bit GMAC Link Control Reg
|
||||
|
||||
GMLC_RST_CLR = 1 shl 1 ; Clear GMAC Link Reset
|
||||
GMLC_RST_SET = 1 shl 0 ; Set GMAC Link Reset
|
||||
|
||||
; GMAC_CTRL bits (this is the GMAC core's OWN reset - distinct from
|
||||
; GMAC_LINK_CTRL above, and from GPHY_CTRL below. All three are separate
|
||||
; reset domains and Linux/OpenBSD both toggle all three during bring-up.
|
||||
GMC_LOOP_OFF = 1 shl 4
|
||||
GMC_PAUSE_ON = 1 shl 3
|
||||
GMC_RST_CLR = 1 shl 1 ; Clear GMAC (core) Reset
|
||||
GMC_RST_SET = 1 shl 0 ; Set GMAC (core) Reset
|
||||
|
||||
; GPHY_CTRL - the internal PHY block's own reset (separate register,
|
||||
; offset 0xf04, SK_REG-style stride 0x80/port like GMAC_CTRL/LINK_CTRL).
|
||||
; Missing this entirely is what left the PHY permanently unresponsive
|
||||
; to MDIO on first bring-up - see field log from 2026-08-08.
|
||||
GPHY_CTRL = 0x0F04
|
||||
GPC_RST_CLR = 1 shl 1 ; Clear GPHY Reset
|
||||
GPC_RST_SET = 1 shl 0 ; Set GPHY Reset
|
||||
|
||||
;----------------------------------------------------------------------
|
||||
; MMIO-mirrored PCI config space. The chip exposes a window of its own
|
||||
; PCI config space directly in MMIO (NOT the same thing as a real PCI
|
||||
; config cycle via PciRead/PciWrite) - used for the per-chip "OUR_REG"
|
||||
; power-control registers below. See sky2_pci_read32/if_msk.c
|
||||
; SK_Y2_PCI_REG() in the reference drivers.
|
||||
;----------------------------------------------------------------------
|
||||
Y2_CFG_SPC = 0x1C00
|
||||
|
||||
PCI_DEV_REG1 = 0x40
|
||||
PCI_DEV_REG2 = 0x44
|
||||
PCI_DEV_REG3 = 0x80
|
||||
PCI_DEV_REG4 = 0x84
|
||||
PCI_DEV_REG5 = 0x88
|
||||
PCI_CFG_REG_1 = 0x94
|
||||
|
||||
; PCI_DEV_REG2 bits
|
||||
PCI_EN_DUMMY_RD = 1 shl 3 ; Enable dummy read
|
||||
PCI_REV_DESC = 1 shl 2 ; Reverse descriptor bytes (BE CPUs only)
|
||||
PCI_USEDATA64 = 1 shl 0 ; Use 64-bit data bus extension
|
||||
|
||||
; PCI_DEV_REG1 bits - per-port PHY power-down / "coma" mode. These must
|
||||
; be CLEARED or the internal PHY stays powered down and MDIO will never
|
||||
; respond, no matter how long you poll (matches the observed symptom).
|
||||
PCI_Y2_PHY1_POWD = 1 shl 26
|
||||
PCI_Y2_PHY2_POWD = 1 shl 27
|
||||
PCI_Y2_PHY1_COMA = 1 shl 28
|
||||
PCI_Y2_PHY2_COMA = 1 shl 29
|
||||
|
||||
; PCI_DEV_REG4 ASPM control bits, masked off during the EC-Ultra/EX/FE+
|
||||
; "advanced power control" bring-up sequence (SKY2_HW_ADV_POWER_CTL)
|
||||
P_FORCE_ASPM_REQUEST = 1 shl 15
|
||||
P_ASPM_GPHY_LINK_DOWN = 1 shl 14
|
||||
P_ASPM_INT_FIFO_EMPTY = 1 shl 13
|
||||
P_ASPM_CLKRUN_REQUEST = 1 shl 12
|
||||
P_ASPM_CONTROL_MSK = P_FORCE_ASPM_REQUEST or P_ASPM_GPHY_LINK_DOWN \
|
||||
or P_ASPM_CLKRUN_REQUEST or P_ASPM_INT_FIFO_EMPTY
|
||||
|
||||
; PCI_DEV_REG5 Vmain_av timer bits, similarly masked
|
||||
P_CTL_TIM_VMAIN_AV_MSK = 3 shl 27
|
||||
|
||||
B2_GP_IO = 0x015C
|
||||
GLB_GPIO_STAT_RACE_DIS = 1 shl 13 ; workaround for dev 4.107 on EC-U/EX
|
||||
|
||||
Y2_HW_WOL_ON = 1 shl 15
|
||||
|
||||
;----------------------------------------------------------------------
|
||||
; GMAC / PHY block (per-port, stride 0x1000, base 0x2800 for port 0)
|
||||
;----------------------------------------------------------------------
|
||||
BASE_GMAC_1 = 0x2800 ; port 0 GMAC/PHY register block
|
||||
BASE_GMAC_2 = 0x3800 ; port 1 GMAC/PHY register block
|
||||
|
||||
; Offsets relative to the per-port GMAC block (add to BASE_GMAC_n)
|
||||
GM_GP_STAT = 0x0000 ; 16 bit r/o General Purpose Status
|
||||
GM_GP_CTRL = 0x0004 ; 16 bit r/w General Purpose Control
|
||||
GM_TX_CTRL = 0x0008
|
||||
GM_RX_CTRL = 0x000C
|
||||
GM_SERIAL_MODE = 0x0018 ; 16 bit r/w Serial Mode Register
|
||||
GM_MC_ADDR_H1 = 0x0034
|
||||
GM_MC_ADDR_H2 = 0x0038
|
||||
GM_MC_ADDR_H3 = 0x003C
|
||||
GM_MC_ADDR_H4 = 0x0040
|
||||
GM_SMI_CTRL = 0x0080 ; 16 bit r/w SMI (MDIO) Control
|
||||
GM_SMI_DATA = 0x0084 ; 16 bit r/w SMI Data
|
||||
GM_PHY_ADDR = 0x0088 ; 16 bit r/w GPHY Address
|
||||
|
||||
; GM_GP_STAT bits
|
||||
GM_GPSR_SPEED = 1 shl 15 ; 1 = 100 Mbps (see GIG_SPEED for 1000)
|
||||
GM_GPSR_DUPLEX = 1 shl 14 ; 1 = Full duplex
|
||||
GM_GPSR_FC_TX_DIS = 1 shl 13
|
||||
GM_GPSR_LINK_UP = 1 shl 12 ; Link Up Status
|
||||
GM_GPSR_GIG_SPEED = 1 shl 4 ; 1 = 1000 Mbps
|
||||
|
||||
; GM_GP_CTRL bits
|
||||
GM_GPCR_TX_ENA = 1 shl 12
|
||||
GM_GPCR_RX_ENA = 1 shl 11
|
||||
|
||||
; GM_RX_CTRL bits
|
||||
GM_RXCR_UCF_ENA = 1 shl 15 ; enable unicast filtering
|
||||
GM_RXCR_MCF_ENA = 1 shl 14 ; enable multicast filtering
|
||||
|
||||
; GM_SMI_CTRL bits/fields
|
||||
GM_SMI_CT_PHY_A_MSK = 0x1F shl 11
|
||||
GM_SMI_CT_REG_A_MSK = 0x1F shl 6
|
||||
GM_SMI_CT_OP_RD = 1 shl 5 ; opcode read (0 = write)
|
||||
GM_SMI_CT_RD_VAL = 1 shl 4 ; read completed, data valid
|
||||
GM_SMI_CT_BUSY = 1 shl 3 ; operation in progress
|
||||
|
||||
PHY_ADDR_MARV = 0 ; internal PHY is always MDIO addr 0
|
||||
PHY_RETRIES = 20 ; MDIO poll retries; each retry sleeps
|
||||
; ~1ms (Sleep() is ms, not centiseconds -
|
||||
; confirmed empirically), so 20 = ~20ms
|
||||
; worst-case before giving up
|
||||
|
||||
;----------------------------------------------------------------------
|
||||
; Marvell internal PHY (88E1xxx) register numbers, via GM_SMI_*
|
||||
;----------------------------------------------------------------------
|
||||
PHY_MARV_CTRL = 0x00 ; PHY Control
|
||||
PHY_MARV_AUNE_ADV = 0x04 ; Auto-Neg. Advertisement
|
||||
PHY_MARV_1000T_CTRL = 0x09 ; 1000Base-T Control
|
||||
PHY_MARV_PHY_CTRL = 0x10 ; PHY Specific Control
|
||||
PHY_MARV_PHY_STAT = 0x11 ; PHY Specific Status
|
||||
PHY_MARV_INT_MASK = 0x12 ; Interrupt Mask
|
||||
PHY_MARV_INT_STAT = 0x13 ; Interrupt Status (r/o, clear-on-read)
|
||||
PHY_MARV_EXT_CTRL = 0x14 ; Ext. PHY Specific Control
|
||||
|
||||
; PHY_MARV_CTRL bits
|
||||
PHY_CT_RESET = 1 shl 15 ; (sc) reset all PHY regs
|
||||
PHY_CT_SPS_LSB = 1 shl 13 ; speed select, low bit -> PHY_CT_SP100
|
||||
PHY_CT_ANE = 1 shl 12 ; Auto-Negotiation Enabled
|
||||
PHY_CT_RE_CFG = 1 shl 9 ; (sc) Restart Auto-Negotiation
|
||||
PHY_CT_DUP_MD = 1 shl 8 ; Duplex Mode (forced)
|
||||
PHY_CT_SPS_MSB = 1 shl 6 ; speed select, high bit -> PHY_CT_SP1000
|
||||
PHY_CT_SP1000 = PHY_CT_SPS_MSB
|
||||
PHY_CT_SP100 = PHY_CT_SPS_LSB
|
||||
|
||||
; PHY_MARV_AUNE_ADV bits
|
||||
PHY_AN_CSMA = 1 shl 0 ; selector = IEEE 802.3 (always set)
|
||||
PHY_M_AN_10_HD = 1 shl 5
|
||||
PHY_M_AN_10_FD = 1 shl 6
|
||||
PHY_M_AN_100_HD = 1 shl 7
|
||||
PHY_M_AN_100_FD = 1 shl 8
|
||||
|
||||
; PHY_MARV_1000T_CTRL bits
|
||||
PHY_M_1000C_AHD = 1 shl 8 ; advertise 1000Base-T half duplex
|
||||
PHY_M_1000C_AFD = 1 shl 9 ; advertise 1000Base-T full duplex
|
||||
|
||||
; PHY_MARV_PHY_CTRL bits (copper, "newer PHY" variants incl. EC Ultra)
|
||||
PHY_M_PC_MDIX_MSK = 3 shl 5
|
||||
PHY_M_PC_ENA_AUTO = 3 ; enable automatic MDI/MDIX crossover
|
||||
PHY_M_PC_EN_DET_MSK = 3 shl 8 ; energy detect mask
|
||||
PHY_M_PC_DSC_MSK = 7 shl 12 ; downshift counter mask
|
||||
PHY_M_PC_DOWN_S_ENA = 1 shl 11 ; downshift enable
|
||||
|
||||
; PHY_MARV_PHY_STAT bits
|
||||
PHY_M_PS_SPEED_MSK = 3 shl 14
|
||||
PHY_M_PS_SPEED_1000 = 1 shl 15
|
||||
PHY_M_PS_SPEED_100 = 1 shl 14
|
||||
PHY_M_PS_FULL_DUP = 1 shl 13
|
||||
PHY_M_PS_LINK_UP = 1 shl 10
|
||||
PHY_M_PS_MDI_X_STAT = 1 shl 6
|
||||
|
||||
; PHY_MARV_INT_MASK / PHY_MARV_INT_STAT bits. Reading INT_STAT clears the
|
||||
; pending condition at the PHY - no separate ack is needed once this is
|
||||
; serviced (confirmed against both reference drivers: neither writes
|
||||
; back to INT_STAT, and the top-level B0_ISRC bit below is just a live
|
||||
; passthrough of the PHY's own interrupt line).
|
||||
PHY_M_IS_LSP_CHANGE = 1 shl 14 ; Link Speed Changed
|
||||
PHY_M_IS_DUP_CHANGE = 1 shl 13 ; Duplex Mode Changed
|
||||
PHY_M_IS_LST_CHANGE = 1 shl 10 ; Link Status Changed
|
||||
PHY_M_DEF_MSK = PHY_M_IS_LSP_CHANGE or PHY_M_IS_DUP_CHANGE \
|
||||
or PHY_M_IS_LST_CHANGE
|
||||
|
||||
;----------------------------------------------------------------------
|
||||
; Chip-level (not per-port) interrupt status/mask. B0_ISRC/B0_IMSK are
|
||||
; already declared above (block 0 registers); B0_ISRC is a live,
|
||||
; read-only OR of every currently-asserting enabled source - nothing
|
||||
; needs to be written back to it, only to the underlying source that
|
||||
; set it (here, PHY_MARV_INT_STAT above).
|
||||
;----------------------------------------------------------------------
|
||||
Y2_IS_IRQ_PHY1 = 1 shl 4 ; interrupt from PHY on port 0
|
||||
Y2_IS_STAT_BMU = 1 shl 30 ; status BMU (RX/TX completion) interrupt
|
||||
|
||||
;----------------------------------------------------------------------
|
||||
; List-element (LE) descriptor rings. Yukon-2 uses a uniform 8-byte
|
||||
; descriptor for TX, RX, AND the status/completion ring: addr(4),
|
||||
; length(2), ctrl/css(1), opcode(1). Cross-checked byte-for-byte
|
||||
; against OpenBSD's msk_tx_desc/msk_rx_desc (if_skreg.h) as well as
|
||||
; Linux's sky2_tx_le/sky2_rx_le/sky2_status_le - full agreement.
|
||||
;
|
||||
; Deliberately out of scope for this pass: 64-bit DMA addressing
|
||||
; (OP_ADDR64 - not needed, this is a 32-bit OS so every physical
|
||||
; address already fits in the low 32 bits), scatter-gather/multi-
|
||||
; fragment packets, VLAN tagging, checksum offload, RSS, jumbo
|
||||
; frames, and TX/RX interrupt-coalescing timers (STAT_*_TIMER_INI -
|
||||
; left at their power-on-reset default, which just means the status
|
||||
; ring reports completions eagerly rather than batched).
|
||||
;----------------------------------------------------------------------
|
||||
OP_ADDR64 = 0x21
|
||||
OP_BUFFER = 0x40
|
||||
OP_PACKET = 0x41
|
||||
OP_RXSTAT = 0x60
|
||||
OP_TXINDEXLE = 0x68
|
||||
HW_OWNER = 0x80 ; opcode-byte bit: entry owned by hardware
|
||||
LE_EOP = 0x80 ; ctrl-byte bit: end of packet (TX only)
|
||||
|
||||
; Receive Frame Status bits (in a status-ring RX entry's "status" field)
|
||||
GMR_FS_LEN = 0x7FFF shl 16
|
||||
GMR_FS_RX_OK = 1 shl 8
|
||||
GMR_FS_GOOD_FC = 1 shl 7
|
||||
GMR_FS_BAD_FC = 1 shl 6
|
||||
GMR_FS_MII_ERR = 1 shl 5
|
||||
GMR_FS_LONG_ERR = 1 shl 4
|
||||
GMR_FS_FRAGMENT = 1 shl 3
|
||||
GMR_FS_CRC_ERR = 1 shl 1
|
||||
GMR_FS_RX_FF_OV = 1 shl 0
|
||||
GMR_FS_ANY_ERR = GMR_FS_RX_FF_OV or GMR_FS_CRC_ERR or GMR_FS_FRAGMENT \
|
||||
or GMR_FS_LONG_ERR or GMR_FS_MII_ERR or GMR_FS_BAD_FC
|
||||
|
||||
CSS_LINK_BIT = 1 shl 0 ; port number, within a status entry's css byte
|
||||
|
||||
;----------------------------------------------------------------------
|
||||
; Queue block (Q_CSR/Q_WM/Q_AL/Q_TEST/Q_DONE) - stride B8_Q_REGS-based,
|
||||
; one block per queue (RX1/RX2/sync-TX1/sync-TX2/async-TX1/async-TX2).
|
||||
; We only ever use RX1 (port 0 receive) and async-TX1 (port 0 transmit).
|
||||
;----------------------------------------------------------------------
|
||||
B8_Q_REGS = 0x0400
|
||||
Q_R1 = 0x0000 ; RX queue, port 0
|
||||
Q_XS1 = 0x0200 ; sync TX queue, port 0 (kept disabled)
|
||||
Q_XA1 = 0x0280 ; async TX queue, port 0 - the one we use
|
||||
|
||||
Q_DONE = 0x24 ; 16 bit - Done Index
|
||||
Q_CSR = 0x34 ; 32 bit - BMU Control/Status
|
||||
Q_TEST = 0x38 ; 32 bit - Test/Control
|
||||
Q_WM = 0x40 ; 16 bit - FIFO Watermark
|
||||
Q_AL = 0x42 ; 8 bit - FIFO Alignment
|
||||
|
||||
BMU_CLR_IRQ_PAR = 1 shl 11
|
||||
BMU_CLR_IRQ_CHK = 1 shl 10
|
||||
BMU_START = 1 shl 8
|
||||
BMU_FIFO_ENA = 1 shl 5
|
||||
BMU_FIFO_RST = 1 shl 4
|
||||
BMU_OP_ON = 1 shl 3
|
||||
BMU_OP_OFF = 1 shl 2
|
||||
BMU_FIFO_OP_ON = 1 shl 7
|
||||
BMU_RST_CLR = 1 shl 1
|
||||
BMU_CLR_RESET = BMU_FIFO_RST or BMU_OP_OFF or BMU_RST_CLR
|
||||
BMU_OPER_INIT = BMU_CLR_IRQ_PAR or BMU_CLR_IRQ_CHK or BMU_START \
|
||||
or BMU_FIFO_ENA or BMU_OP_ON
|
||||
BMU_WM_DEFAULT = 0x600
|
||||
|
||||
F_TX_CHK_AUTO_OFF = 1 shl 31 ; Q_TEST: disable TX descriptor auto-check
|
||||
F_TX_CHK_AUTO_ON = 1 shl 30
|
||||
F_M_RX_RAM_DIS = 1 shl 24 ; Q_TEST bit: MAC Rx RAM read port
|
||||
; disabled - required on EC-Ultra
|
||||
; chip_rev > A0 (ours is rev 3), see
|
||||
; Linux sky2_rx_start()
|
||||
CHIP_REV_YU_EC_U_A0 = 1
|
||||
|
||||
;----------------------------------------------------------------------
|
||||
; Prefetch unit - the interface between the driver's LE ring and the
|
||||
; hardware. Separate register block from Q_CSR above despite similar
|
||||
; per-queue addressing (base + queue-offset + reg).
|
||||
;----------------------------------------------------------------------
|
||||
Y2_B8_PREF_REGS = 0x0450
|
||||
|
||||
PREF_UNIT_CTRL = 0x00 ; 32 bit
|
||||
PREF_UNIT_LAST_IDX = 0x04 ; 16 bit
|
||||
PREF_UNIT_ADDR_LO = 0x08 ; 32 bit
|
||||
PREF_UNIT_ADDR_HI = 0x0C ; 32 bit
|
||||
PREF_UNIT_GET_IDX = 0x10 ; 16 bit
|
||||
PREF_UNIT_PUT_IDX = 0x14 ; 16 bit
|
||||
|
||||
PREF_UNIT_RST_SET = 1 shl 0
|
||||
PREF_UNIT_RST_CLR = 1 shl 1
|
||||
PREF_UNIT_OP_ON = 1 shl 3
|
||||
|
||||
;----------------------------------------------------------------------
|
||||
; RAM buffer arbiter - per-queue FIFO sizing within the chip's internal
|
||||
; RAM. Sizes are in "qwords" (8-byte units) per the hardware register
|
||||
; definition; sky2_ramset-equivalent code below converts from KB.
|
||||
;----------------------------------------------------------------------
|
||||
B16_RAM_REGS = 0x0800
|
||||
|
||||
RB_START = 0x00 ; 32 bit
|
||||
RB_END = 0x04 ; 32 bit
|
||||
RB_WP = 0x08 ; 32 bit
|
||||
RB_RP = 0x0C ; 32 bit
|
||||
RB_RX_UTPP = 0x10 ; 32 bit - Rx upper thresh, pause pkt
|
||||
RB_RX_LTPP = 0x14 ; 32 bit - Rx lower thresh, pause pkt
|
||||
RB_RX_UTHP = 0x18 ; 32 bit - Rx upper thresh, high prio
|
||||
RB_RX_LTHP = 0x1C ; 32 bit - Rx lower thresh, high prio
|
||||
RB_CTRL = 0x28 ; 32 bit
|
||||
|
||||
RB_ENA_STFWD = 1 shl 5 ; enable store & forward (Tx queues)
|
||||
RB_ENA_OP_MD = 1 shl 3
|
||||
RB_DIS_OP_MD = 1 shl 2
|
||||
RB_RST_CLR = 1 shl 1
|
||||
RB_RST_SET = 1 shl 0
|
||||
|
||||
B2_E_0 = 0x011C ; 8 bit - internal RAM size, in 4K blocks
|
||||
|
||||
;----------------------------------------------------------------------
|
||||
; TX arbiter - per-port, SK_REG-style addressing (stride 0x80/port,
|
||||
; same block as GMAC_CTRL/GPHY_CTRL/GMAC_LINK_CTRL).
|
||||
;----------------------------------------------------------------------
|
||||
TXA_ITI_INI = 0x0200 ; 32 bit
|
||||
TXA_LIM_INI = 0x0208 ; 32 bit
|
||||
TXA_CTRL = 0x0210 ; 8 bit
|
||||
TXA_ENA_FSYNC = 1 shl 7
|
||||
TXA_DIS_FSYNC = 1 shl 6
|
||||
TXA_ENA_ALLOC = 1 shl 5
|
||||
TXA_DIS_ALLOC = 1 shl 4
|
||||
TXA_START_RC = 1 shl 3
|
||||
TXA_STOP_RC = 1 shl 2
|
||||
TXA_ENA_ARB = 1 shl 1
|
||||
TXA_DIS_ARB = 1 shl 0
|
||||
|
||||
;----------------------------------------------------------------------
|
||||
; Status/completion ring (card-wide, not per-port). The BMU writes
|
||||
; completion entries here as RX/TX work finishes; the driver polls
|
||||
; each entry's HW_OWNER bit rather than tracking a separate hardware
|
||||
; "put index" register, which keeps the interrupt handler simple and
|
||||
; is exactly the same safety check Linux does per-entry regardless.
|
||||
;----------------------------------------------------------------------
|
||||
STAT_FIFO_ISR_WM= 0x0ead ; 8 bit Status FIFO ISR Watermark Reg
|
||||
|
||||
|
||||
STAT_LEV_TIMER_INI = 0x0eb0 ; 32 bit Level Timer Init. Value Reg
|
||||
STAT_LEV_TIMER_CTRL = 0x0eb8 ; 8 bit Level Timer Control Reg
|
||||
STAT_CTRL = 0x0E80 ; 32 bit
|
||||
STAT_LAST_IDX = 0x0E84 ; 16 bit
|
||||
STAT_LIST_ADDR_LO = 0x0E88 ; 32 bit
|
||||
STAT_LIST_ADDR_HI = 0x0E8C ; 32 bit
|
||||
STAT_TX_IDX_TH = 0x0E98 ; 16 bit
|
||||
STAT_PUT_IDX = 0x0E9C ; 16 bit
|
||||
STAT_FIFO_WM = 0x0EAC ; 8 bit
|
||||
STAT_TX_TIMER_INI = 0x0ec0 ; 32 bit Tx Timer Init. Value Reg
|
||||
STAT_ISR_TIMER_CNT = 0x0ed4 ; 32 bit ISR Timer Counter Reg
|
||||
STAT_ISR_TIMER_CTRL = 0x0ed8 ; 8 bit ISR Timer Control Reg
|
||||
STAT_TX_TIMER_CTRL = 0x0ec8 ; 8 bit Tx Timer Control Reg
|
||||
STAT_ISR_TIMER_INI = 0x0ed0 ; 32 bit ISR Timer Init. Value Reg
|
||||
|
||||
SC_STAT_OP_ON = 1 shl 3
|
||||
SC_STAT_RST_CLR = 1 shl 1
|
||||
SC_STAT_RST_SET = 1 shl 0
|
||||
SC_STAT_CLR_IRQ = 1 shl 4
|
||||
|
||||
;----------------------------------------------------------------------
|
||||
; Ring sizing. Both counts must be powers of two (ring-wrap uses a
|
||||
; mask, not a divide). Kept modest and identical to what RTL8169/
|
||||
; i8254x already use in this tree.
|
||||
;----------------------------------------------------------------------
|
||||
TX_LE_SIZE = 128 ; must be a power of 2, between 128 and 2048
|
||||
RX_LE_SIZE = 128 ; must be a power of 2, between 128 and 2048
|
||||
ST_RING_SIZE = 512 ; comfortably more than TX+RX combined
|
||||
RX_BUF_SIZE = 1536 ; MTU 1500 + Ethernet header + slack
|
||||
|
||||
;----------------------------------------------------------------------
|
||||
; Generic 8-byte list-element layout, shared by TX/RX/status rings
|
||||
; (see the LE ring comment above for the cross-reference).
|
||||
;----------------------------------------------------------------------
|
||||
struct le
|
||||
addr dd ?
|
||||
length dw ?
|
||||
ctrl db ? ; "css" on a status-ring entry
|
||||
opcode db ?
|
||||
ends
|
||||
|
||||
;----------------------------------------------------------------------
|
||||
; Device structure (extends ETH_DEVICE)
|
||||
;----------------------------------------------------------------------
|
||||
struct device ETH_DEVICE
|
||||
|
||||
; PCI / MMIO
|
||||
mmio_addr dd ?
|
||||
pci_bus dd ?
|
||||
pci_dev dd ?
|
||||
irq_line db ?
|
||||
rb 3
|
||||
|
||||
; Chip identification
|
||||
chip_id db ? ; CHIP_ID_YUKON_*
|
||||
chip_rev db ?
|
||||
port db ? ; 0 for single-port cards
|
||||
rb 1
|
||||
|
||||
chip_name dd ? ; pointer to ASCII name
|
||||
|
||||
; Link state, as last read from GM_GP_STAT (see link_status).
|
||||
; device.state (in ETH_DEVICE, standard kernel-facing field) is
|
||||
; kept in sync with these and is what NetLinkChanged reports.
|
||||
link_up db ? ; 0 = down, 1 = up
|
||||
link_duplex db ? ; 0 = half, 1 = full
|
||||
link_speed dw ? ; Mbps: 10 / 100 / 1000 (0 if link down)
|
||||
|
||||
; ---- TX/RX/status rings. Embedded directly in the device
|
||||
; struct, same pattern RTL8169 uses in this tree: the struct
|
||||
; itself is allocated via allocate_and_clear, which guarantees
|
||||
; physical contiguity up to 8 pages (32K) - our rings total
|
||||
; well under 2K, so this is safe. Raw byte reservation (not a
|
||||
; typed struct array) matching RTL8169's own tx_ring/rx_ring
|
||||
; convention - this struct.inc doesn't support array-of-custom-
|
||||
; struct fields, only single-instance nesting; per-entry access
|
||||
; is done via sizeof.le * slot_index offset math instead.
|
||||
|
||||
rb 0x1000-($ and 0xfff) ; align 256
|
||||
tx_le rb TX_LE_SIZE * sizeof.le
|
||||
|
||||
rb 0x1000-($ and 0xfff) ; align 256
|
||||
rx_le rb RX_LE_SIZE * sizeof.le
|
||||
|
||||
rb 0x1000-($ and 0xfff) ; align 256
|
||||
st_le rb ST_RING_SIZE * sizeof.le
|
||||
|
||||
; Software-only bookkeeping, parallel to the rings above but
|
||||
; NOT hardware-visible - just our own buffer-pointer tracking.
|
||||
; (NetAlloc'd pointer per slot; 0 = slot has no owned buffer.)
|
||||
tx_buf rd TX_LE_SIZE
|
||||
rx_buf rd RX_LE_SIZE
|
||||
|
||||
; Ring indices. All are plain 0-based slot numbers, wrapped
|
||||
; with a power-of-two mask (SIZE-1), not divided.
|
||||
tx_prod dw ? ; next free TX slot to fill
|
||||
tx_cons dw ? ; oldest TX slot still in flight
|
||||
rx_put dw ? ; next RX slot to (re)submit
|
||||
rx_next dw ? ; oldest RX slot awaiting completion
|
||||
st_idx dw ? ; next status-ring slot to read
|
||||
|
||||
ends
|
||||
|
||||
|
||||
|
||||
RX_GMF_CTRL_T = 0x0C48
|
||||
TX_GMF_CTRL_T = 0x0D48
|
||||
RX_GMF_LP_THR = 0x0C4A ; 8 bit Rx GMAC FIFO low pause threshold
|
||||
RX_GMF_UP_THR = 0x0C4B ; 8 bit Rx GMAC FIFO upper pause threshold
|
||||
GMF_RST_SET = 1 shl 0
|
||||
GMF_RST_CLR = 1 shl 1
|
||||
GMF_OPER_ON = 1 shl 3
|
||||
GMF_RX_F_FL_ON = 1 shl 7
|
||||
; TX GMF high bits (Yukon-EC Ultra) - store & forward required when no RAM
|
||||
TX_STFW_DIS = 1 shl 31
|
||||
TX_STFW_ENA = 1 shl 30
|
||||
TX_JUMBO_ENA = 1 shl 23
|
||||
TX_JUMBO_DIS = 1 shl 22
|
||||
|
||||
; RAM Interface (B3_*) - initialized during reset even when there is no
|
||||
; external RAM. Still required for the internal FIFO/GMF data path.
|
||||
B3_RI_WTO_R1 = 0x0190
|
||||
B3_RI_WTO_XA1 = 0x0191
|
||||
B3_RI_WTO_XS1 = 0x0192
|
||||
B3_RI_RTO_R1 = 0x0193
|
||||
B3_RI_RTO_XA1 = 0x0194
|
||||
B3_RI_RTO_XS1 = 0x0195
|
||||
B3_RI_WTO_R2 = 0x0196
|
||||
B3_RI_WTO_XA2 = 0x0197
|
||||
B3_RI_WTO_XS2 = 0x0198
|
||||
B3_RI_RTO_R2 = 0x0199
|
||||
B3_RI_RTO_XA2 = 0x019a
|
||||
B3_RI_RTO_XS2 = 0x019b
|
||||
B3_RI_CTRL = 0x01a0
|
||||
RI_RST_CLR = 1 shl 1
|
||||
RI_RST_SET = 1 shl 0
|
||||
SK_RI_TO_53 = 36 ; Linux/OpenBSD default timeout value
|
||||
|
||||
; GM_GP_CTRL extra bits (speed/duplex force)
|
||||
GM_GPCR_GIGS_ENA = 1 shl 7
|
||||
GM_GPCR_DUP_FULL = 1 shl 5
|
||||
GM_GPCR_SPEED_100 = 1 shl 3
|
||||
GM_GPCR_SPEED_1000 = (GM_GPCR_GIGS_ENA or GM_GPCR_SPEED_100)
|
||||
GM_GPCR_AU_DUP_DIS = 1 shl 2
|
||||
GM_GPCR_AU_FCT_DIS = 1 shl 1
|
||||
GM_GPCR_AU_SPD_DIS = 1 shl 0
|
||||
|
||||
TIM_START = 1 shl 2 ; ; Start Timer
|
||||
TIM_STOP = 1 shl 1 ; ; Stop Timer
|
||||
TIM_CLR_IRQ = 1 shl 0 ; ; Clear Timer IRQ (!IRQM)
|
||||
|
||||
|
||||
|
||||
GM_SRC_ADDR_1L = 0x001c;, ; 16 bit r/w Source Address 1 (low)
|
||||
GM_SRC_ADDR_1M = 0x0020;, ; 16 bit r/w Source Address 1 (middle)
|
||||
GM_SRC_ADDR_1H = 0x0024;, ; 16 bit r/w Source Address 1 (high)
|
||||
GM_SRC_ADDR_2L = 0x0028;, ; 16 bit r/w Source Address 2 (low)
|
||||
GM_SRC_ADDR_2M = 0x002c;, ; 16 bit r/w Source Address 2 (middle)
|
||||
GM_SRC_ADDR_2H = 0x0030;, ; 16 bit r/w Source Address 2 (high)
|
||||
|
||||
|
||||
|
||||
Y2_IS_HW_ERR = 1 shl 31 ; Interrupt HW Error
|
||||
Y2_IS_STAT_BMU = 1 shl 30 ; Status BMU Interrupt
|
||||
Y2_IS_ASF = 1 shl 29 ; ASF subsystem Interrupt
|
||||
Y2_IS_CPU_TO = 1 shl 28 ; CPU Timeout
|
||||
Y2_IS_POLL_CHK = 1 shl 27 ; Check IRQ from polling unit
|
||||
Y2_IS_TWSI_RDY = 1 shl 26 ; IRQ on end of TWSI Tx
|
||||
Y2_IS_IRQ_SW = 1 shl 25 ; SW forced IRQ
|
||||
Y2_IS_TIMINT = 1 shl 24 ; IRQ from Timer
|
||||
|
||||
Y2_IS_IRQ_PHY2 = 1 shl 12 ; Interrupt from PHY 2
|
||||
Y2_IS_IRQ_MAC2 = 1 shl 11 ; Interrupt from MAC 2
|
||||
Y2_IS_CHK_RX2 = 1 shl 10 ; Descriptor error Rx 2
|
||||
Y2_IS_CHK_TXS2 = 1 shl 9 ; Descriptor error TXS 2
|
||||
Y2_IS_CHK_TXA2 = 1 shl 8 ; Descriptor error TXA 2
|
||||
|
||||
Y2_IS_PSM_ACK = 1 shl 7 ; PSM Acknowledge (Yukon-Optima only)
|
||||
Y2_IS_PTP_TIST = 1 shl 6 ; PTP Time Stamp (Yukon-Optima only)
|
||||
Y2_IS_PHY_QLNK = 1 shl 5 ; PHY Quick Link (Yukon-Optima only)
|
||||
|
||||
Y2_IS_IRQ_PHY1 = 1 shl 4 ; Interrupt from PHY 1
|
||||
Y2_IS_IRQ_MAC1 = 1 shl 3 ; Interrupt from MAC 1
|
||||
Y2_IS_CHK_RX1 = 1 shl 2 ; Descriptor error Rx 1
|
||||
Y2_IS_CHK_TXS1 = 1 shl 1 ; Descriptor error TXS 1
|
||||
Y2_IS_CHK_TXA1 = 1 shl 0 ; Descriptor error TXA 1
|
||||
@@ -1,3 +0,0 @@
|
||||
if tup.getconfig("NO_FASM") ~= "" then return end
|
||||
ROOT = "../../.."
|
||||
tup.rule("xhci.asm", "fasm %f %o " .. tup.getconfig("PESTRIP_CMD") .. tup.getconfig("KPACK_CMD"), "%B.sys")
|
||||
@@ -1,993 +0,0 @@
|
||||
; Device slots, contexts and pipes for the xHCI driver.
|
||||
; This file is included from xhci.asm.
|
||||
|
||||
; =============================================================================
|
||||
; ============================ Context helpers ================================
|
||||
; =============================================================================
|
||||
|
||||
; Returns the address of one context inside a context structure.
|
||||
; in: eax = base of the structure, ecx = index of the context,
|
||||
; esi -> usb_controller.
|
||||
; out: eax = address of the context.
|
||||
proc xhci_context
|
||||
push ecx edx
|
||||
mov edx, [esi+xhci_controller.ContextSize-XCD]
|
||||
imul edx, ecx
|
||||
add eax, edx
|
||||
pop edx ecx
|
||||
ret
|
||||
endp
|
||||
|
||||
; Zeroes the Input Context. The caller must hold CmdLock.
|
||||
; in: esi -> usb_controller.
|
||||
proc xhci_clear_input_ctx
|
||||
push eax ecx edi
|
||||
mov edi, [esi+xhci_controller.InputCtx-XCD]
|
||||
xor eax, eax
|
||||
mov ecx, 33*64/4
|
||||
rep stosd
|
||||
pop edi ecx eax
|
||||
ret
|
||||
endp
|
||||
|
||||
; Returns the pipe of the default control endpoint of the same device, which
|
||||
; represents the device as a whole.
|
||||
; in: ebx -> xhci_pipe. out: eax -> xhci_pipe or 0.
|
||||
proc xhci_ctrl_pipe
|
||||
mov eax, [ebx+xhci_pipe.DevPage]
|
||||
test eax, eax
|
||||
jz .nothing
|
||||
mov eax, [eax+XHCI_PIPES_OFS+1*4]
|
||||
test eax, eax
|
||||
jz .nothing
|
||||
sub eax, sizeof.xhci_pipe
|
||||
.nothing:
|
||||
ret
|
||||
endp
|
||||
|
||||
; Fills the Slot Context of the Input Context from the device description kept
|
||||
; in a pipe. The caller must hold CmdLock.
|
||||
; in: esi -> usb_controller, ebx -> xhci_pipe describing the device,
|
||||
; ecx = value for the Context Entries field.
|
||||
proc xhci_fill_slot_ctx
|
||||
push eax ecx edx edi
|
||||
mov eax, [esi+xhci_controller.InputCtx-XCD]
|
||||
push ecx
|
||||
movi ecx, 1
|
||||
call xhci_context
|
||||
pop ecx
|
||||
mov edi, eax
|
||||
; dword 0: Route String, Speed and Context Entries.
|
||||
mov eax, [ebx+xhci_pipe.Route]
|
||||
and eax, 0FFFFFh
|
||||
if XHCI_SUPERSPEED
|
||||
; A SuperSpeed root-port device carries the raw PORTSC speed identifier;
|
||||
; its kernel-visible Speed pretends high-speed and must not get here.
|
||||
mov edx, [ebx+xhci_pipe.PSIV]
|
||||
test edx, edx
|
||||
jnz .havespeed
|
||||
end if
|
||||
mov edx, [ebx+xhci_pipe.Speed]
|
||||
cmp edx, USB_SPEED_FS
|
||||
jz .fs
|
||||
cmp edx, USB_SPEED_LS
|
||||
jz .ls
|
||||
movi edx, XHCI_PSI_HS
|
||||
jmp .havespeed
|
||||
.fs:
|
||||
movi edx, XHCI_PSI_FS
|
||||
jmp .havespeed
|
||||
.ls:
|
||||
movi edx, XHCI_PSI_LS
|
||||
.havespeed:
|
||||
shl edx, 20
|
||||
or eax, edx
|
||||
shl ecx, 27
|
||||
or eax, ecx
|
||||
mov [edi], eax
|
||||
; dword 1: Root Hub Port Number.
|
||||
mov eax, [ebx+xhci_pipe.RootPort]
|
||||
shl eax, 16
|
||||
mov [edi+4], eax
|
||||
; dword 2: the Transaction Translator, if the device is served by one.
|
||||
mov eax, [ebx+xhci_pipe.TTSlot]
|
||||
test eax, eax
|
||||
jz @f
|
||||
mov edx, [ebx+xhci_pipe.TTPort]
|
||||
shl edx, 8
|
||||
or eax, edx
|
||||
@@:
|
||||
mov [edi+8], eax
|
||||
and dword [edi+12], 0
|
||||
pop edi edx ecx eax
|
||||
ret
|
||||
endp
|
||||
|
||||
; Fills the Endpoint Context of the Input Context for the given pipe.
|
||||
; The caller must hold CmdLock.
|
||||
; in: esi -> usb_controller, ebx -> xhci_pipe.
|
||||
proc xhci_fill_ep_ctx
|
||||
push eax ecx edx edi
|
||||
mov eax, [esi+xhci_controller.InputCtx-XCD]
|
||||
mov ecx, [ebx+xhci_pipe.DCI]
|
||||
inc ecx
|
||||
call xhci_context
|
||||
mov edi, eax
|
||||
; dword 0: Interval.
|
||||
mov eax, [ebx+xhci_pipe.Interval]
|
||||
shl eax, 16
|
||||
mov [edi], eax
|
||||
; dword 1: Error Count, Endpoint Type, Max Burst Size and Max Packet Size.
|
||||
mov eax, [ebx+xhci_pipe.EpType]
|
||||
shl eax, 3
|
||||
or eax, 3 shl 1 ; three retries before giving up
|
||||
mov edx, [ebx+xhci_pipe.MaxPacket]
|
||||
mov ecx, edx
|
||||
shr ecx, 11
|
||||
and ecx, 3 ; extra transactions per microframe
|
||||
shl ecx, 8
|
||||
or eax, ecx
|
||||
if XHCI_SUPERSPEED
|
||||
; A SuperSpeed bulk endpoint may allow bursts of several packets; the field
|
||||
; shares its bits with the extra-transactions ones, which are zero then.
|
||||
mov ecx, [ebx+xhci_pipe.MaxBurst]
|
||||
shl ecx, 8
|
||||
or eax, ecx
|
||||
end if
|
||||
and edx, 7FFh
|
||||
shl edx, 16
|
||||
or eax, edx
|
||||
mov [edi+4], eax
|
||||
; dwords 2 and 3: the TR Dequeue Pointer with the Dequeue Cycle State.
|
||||
mov eax, [ebx+xhci_pipe.Enqueue]
|
||||
shl eax, 4
|
||||
add eax, [ebx+xhci_pipe.RingPhys]
|
||||
or eax, [ebx+xhci_pipe.Cycle]
|
||||
mov [edi+8], eax
|
||||
and dword [edi+12], 0
|
||||
; dword 4: Average TRB Length, only a hint for the bandwidth scheduler.
|
||||
mov eax, [ebx+xhci_pipe.MaxPacket]
|
||||
and eax, 7FFh
|
||||
cmp [ebx+xhci_pipe.EpType], XHCI_EP_CONTROL
|
||||
jnz @f
|
||||
movi eax, 8
|
||||
@@:
|
||||
mov [edi+16], eax
|
||||
and dword [edi+20], 0
|
||||
pop edi edx ecx eax
|
||||
ret
|
||||
endp
|
||||
|
||||
; =============================================================================
|
||||
; ============================== Slot commands ================================
|
||||
; =============================================================================
|
||||
|
||||
; Issues the Address Device command for a newly created default control pipe.
|
||||
; in: esi -> usb_controller, ebx -> xhci_pipe. out: eax = 0 on failure.
|
||||
proc xhci_address_device
|
||||
push ebx ecx edx edi
|
||||
lea ecx, [esi+xhci_controller.CmdLock-XCD]
|
||||
invoke MutexLock
|
||||
call xhci_clear_input_ctx
|
||||
mov edx, [esi+xhci_controller.InputCtx-XCD]
|
||||
mov dword [edx+4], 3 ; add the Slot Context and endpoint zero
|
||||
movi ecx, 1
|
||||
call xhci_fill_slot_ctx
|
||||
call xhci_fill_ep_ctx
|
||||
mov [ebx+xhci_pipe.MaxDCI], 1
|
||||
; Point the DCBAA entry of the slot at the Device Context.
|
||||
mov eax, [esi+xhci_controller.CommonPage-XCD]
|
||||
mov ecx, [ebx+xhci_pipe.SlotId]
|
||||
mov edx, [ebx+xhci_pipe.DevPagePhys]
|
||||
mov [eax+ecx*8], edx
|
||||
and dword [eax+ecx*8+4], 0
|
||||
mov edx, [ebx+xhci_pipe.SlotId]
|
||||
shl edx, 24
|
||||
or edx, XHCI_TRB_ADDRESS_DEV shl 10
|
||||
mov eax, [esi+xhci_controller.InputCtxPhys-XCD]
|
||||
push ebx
|
||||
xor ebx, ebx
|
||||
xor ecx, ecx
|
||||
call xhci_cmd_submit
|
||||
pop ebx
|
||||
push eax
|
||||
lea ecx, [esi+xhci_controller.CmdLock-XCD]
|
||||
invoke MutexUnlock
|
||||
pop eax
|
||||
cmp eax, XHCI_CC_SUCCESS
|
||||
jz .ok
|
||||
DEBUGF 1,'K : XHCI: Address Device failed, code %d\n',eax
|
||||
xor eax, eax
|
||||
jmp .nothing
|
||||
.ok:
|
||||
movi eax, 1
|
||||
.nothing:
|
||||
pop edi edx ecx ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
; Issues a Configure Endpoint command that adds the given endpoint.
|
||||
; in: esi -> usb_controller, ebx -> xhci_pipe of the endpoint,
|
||||
; edi -> xhci_pipe of the default control endpoint of the same device.
|
||||
; out: eax = completion code.
|
||||
proc xhci_configure_endpoint
|
||||
push ebx ecx edx esi edi
|
||||
lea ecx, [esi+xhci_controller.CmdLock-XCD]
|
||||
invoke MutexLock
|
||||
call xhci_clear_input_ctx
|
||||
; Drop the endpoint and add it again, so that reopening an endpoint that has
|
||||
; been closed before also works.
|
||||
mov ecx, [ebx+xhci_pipe.DCI]
|
||||
movi eax, 1
|
||||
shl eax, cl
|
||||
mov edx, [esi+xhci_controller.InputCtx-XCD]
|
||||
mov [edx], eax
|
||||
or eax, 1 ; the Slot Context is always added
|
||||
mov [edx+4], eax
|
||||
call xhci_fill_ep_ctx
|
||||
; The Context Entries field must cover every endpoint in use by the device.
|
||||
mov ecx, [ebx+xhci_pipe.DCI]
|
||||
cmp ecx, [edi+xhci_pipe.MaxDCI]
|
||||
jae @f
|
||||
mov ecx, [edi+xhci_pipe.MaxDCI]
|
||||
@@:
|
||||
mov [edi+xhci_pipe.MaxDCI], ecx
|
||||
push ebx
|
||||
mov ebx, edi
|
||||
call xhci_fill_slot_ctx
|
||||
pop ebx
|
||||
mov edx, [ebx+xhci_pipe.SlotId]
|
||||
shl edx, 24
|
||||
or edx, XHCI_TRB_CONFIG_EP shl 10
|
||||
mov eax, [esi+xhci_controller.InputCtxPhys-XCD]
|
||||
push ebx
|
||||
xor ebx, ebx
|
||||
xor ecx, ecx
|
||||
call xhci_cmd_submit
|
||||
pop ebx
|
||||
push eax
|
||||
lea ecx, [esi+xhci_controller.CmdLock-XCD]
|
||||
invoke MutexUnlock
|
||||
pop eax
|
||||
pop edi esi edx ecx ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
; Tells the controller where the endpoint has to continue from.
|
||||
; in: esi -> usb_controller, ebx -> xhci_pipe.
|
||||
proc xhci_set_dequeue
|
||||
pushad
|
||||
cmp [ebx+xhci_pipe.SlotId], 0
|
||||
jz .nothing
|
||||
mov eax, [ebx+xhci_pipe.Dequeue]
|
||||
shl eax, 4
|
||||
add eax, [ebx+xhci_pipe.RingPhys]
|
||||
or eax, [ebx+xhci_pipe.Cycle]
|
||||
mov ecx, [ebx+xhci_pipe.DCI]
|
||||
shl ecx, 16
|
||||
mov edx, [ebx+xhci_pipe.SlotId]
|
||||
shl edx, 24
|
||||
or edx, ecx
|
||||
or edx, XHCI_TRB_SET_DEQ shl 10
|
||||
xor ebx, ebx
|
||||
xor ecx, ecx
|
||||
call xhci_cmd_sync
|
||||
cmp eax, XHCI_CC_SUCCESS
|
||||
jz .nothing
|
||||
DEBUGF 1,'K : XHCI: Set TR Dequeue Pointer failed, code %d\n',eax
|
||||
.nothing:
|
||||
popad
|
||||
ret
|
||||
endp
|
||||
|
||||
; =============================================================================
|
||||
; =============================== New device ==================================
|
||||
; =============================================================================
|
||||
|
||||
; Called from xhci_port_init and from the hub support code when a new device
|
||||
; has been connected and reset. Enables a device slot for it and hands it over
|
||||
; to the protocol layer.
|
||||
; in: esi -> usb_controller, eax = speed. out: eax = 0 on failure.
|
||||
proc xhci_new_device
|
||||
push ebx ecx edx edi
|
||||
mov [esi+usb_controller.ResettingSpeed], al
|
||||
; 1. Reserve room for the pseudo-pipe that describes the new device. Only the
|
||||
; fields read by xhci_init_pipe are filled in; the layout matches a real pipe,
|
||||
; so the result can be passed to usb_new_device as a usb_pipe pointer.
|
||||
sub esp, sizeof.xhci_pipe + 4
|
||||
mov ebx, esp
|
||||
push ebx
|
||||
mov edi, ebx
|
||||
xor eax, eax
|
||||
mov ecx, (sizeof.xhci_pipe + 4)/4
|
||||
rep stosd
|
||||
pop ebx
|
||||
mov [ebx+sizeof.xhci_pipe], esi ; usb_pipe.Controller
|
||||
movzx eax, [esi+usb_controller.ResettingSpeed]
|
||||
mov [ebx+xhci_pipe.Speed], eax
|
||||
; 2. Compute the root hub port, the route string and the tier of the device.
|
||||
movzx edx, [esi+usb_controller.ResettingPort]
|
||||
mov edi, [esi+usb_controller.ResettingHub]
|
||||
test edi, edi
|
||||
jnz .behind_hub
|
||||
mov eax, [esi+xhci_controller.PortMap-XCD+edx*4]
|
||||
mov [ebx+xhci_pipe.RootPort], eax
|
||||
if XHCI_SUPERSPEED
|
||||
mov eax, [esi+xhci_controller.ResettingPSIV-XCD]
|
||||
mov [ebx+xhci_pipe.PSIV], eax
|
||||
end if
|
||||
jmp .have_topology
|
||||
.behind_hub:
|
||||
; The parent hub is a device too, and its own pipe carries the topology data.
|
||||
mov eax, [edi+USB_HUB_CONFIGPIPE]
|
||||
sub eax, sizeof.xhci_pipe
|
||||
mov ecx, [eax+xhci_pipe.RootPort]
|
||||
mov [ebx+xhci_pipe.RootPort], ecx
|
||||
mov ecx, [eax+xhci_pipe.Depth]
|
||||
mov eax, [eax+xhci_pipe.Route]
|
||||
; The route string holds one nibble per tier, at most five of them.
|
||||
cmp ecx, 5
|
||||
jae .have_route
|
||||
push ecx edx
|
||||
shl ecx, 2
|
||||
inc edx ; the route uses 1-based port numbers
|
||||
cmp edx, 15
|
||||
jbe @f
|
||||
movi edx, 15
|
||||
@@:
|
||||
shl edx, cl
|
||||
or eax, edx
|
||||
pop edx ecx
|
||||
.have_route:
|
||||
inc ecx
|
||||
mov [ebx+xhci_pipe.Depth], ecx
|
||||
mov [ebx+xhci_pipe.Route], eax
|
||||
; 3. Low- and full-speed devices behind a high-speed hub need the address of
|
||||
; the Transaction Translator that serves them.
|
||||
cmp [ebx+xhci_pipe.Speed], USB_SPEED_HS
|
||||
jz .have_topology
|
||||
push ebx
|
||||
mov ecx, edx
|
||||
mov edx, edi
|
||||
invoke usbhc_api.usb_get_tt
|
||||
pop ebx
|
||||
test edx, edx
|
||||
jz .have_topology
|
||||
sub edx, sizeof.xhci_pipe
|
||||
mov eax, [edx+xhci_pipe.SlotId]
|
||||
mov [ebx+xhci_pipe.TTSlot], eax
|
||||
inc ecx
|
||||
mov [ebx+xhci_pipe.TTPort], ecx
|
||||
.have_topology:
|
||||
; 4. Ask the controller for a device slot.
|
||||
xor eax, eax
|
||||
push ebx
|
||||
xor ebx, ebx
|
||||
xor ecx, ecx
|
||||
mov edx, XHCI_TRB_ENABLE_SLOT shl 10
|
||||
call xhci_cmd_sync
|
||||
pop ebx
|
||||
cmp eax, XHCI_CC_SUCCESS
|
||||
jnz .fail
|
||||
test edx, edx
|
||||
jz .fail
|
||||
mov [ebx+xhci_pipe.SlotId], edx
|
||||
DEBUGF 1,'K : XHCI new device: slot %d, root port %d, route %x, speed %d\n',edx,[ebx+xhci_pipe.RootPort],[ebx+xhci_pipe.Route],[ebx+xhci_pipe.Speed]
|
||||
; 5. Hand the device over to the protocol layer. It opens the pipe of the
|
||||
; default control endpoint, and that is where the slot is really addressed.
|
||||
lea ecx, [ebx+sizeof.xhci_pipe]
|
||||
invoke usbhc_api.usb_new_device
|
||||
test eax, eax
|
||||
jnz .done
|
||||
; 6. The protocol layer has failed; release the slot again.
|
||||
mov edx, [ebx+xhci_pipe.SlotId]
|
||||
shl edx, 24
|
||||
or edx, XHCI_TRB_DISABLE_SLOT shl 10
|
||||
xor eax, eax
|
||||
xor ebx, ebx
|
||||
xor ecx, ecx
|
||||
call xhci_cmd_sync
|
||||
xor eax, eax
|
||||
jmp .done
|
||||
.fail:
|
||||
dbgstr 'XHCI: Enable Slot failed'
|
||||
xor eax, eax
|
||||
.done:
|
||||
add esp, sizeof.xhci_pipe + 4
|
||||
pop edi edx ecx ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
; =============================================================================
|
||||
; ================================= Pipes =====================================
|
||||
; =============================================================================
|
||||
|
||||
proc xhci_alloc_pipe
|
||||
push ebx ecx edi
|
||||
mov ebx, xhci_ep_mutex
|
||||
invoke usbhc_api.usb_allocate_common, sizeof.xhci_pipe + sizeof.usb_pipe
|
||||
test eax, eax
|
||||
jz @f
|
||||
; Zero the whole block: the kernel may call FreePipe for a pipe whose InitPipe
|
||||
; has never run, and that path must not act on garbage.
|
||||
mov edi, eax
|
||||
push eax
|
||||
xor eax, eax
|
||||
movi ecx, (sizeof.xhci_pipe + sizeof.usb_pipe + 3)/4
|
||||
rep stosd
|
||||
pop eax
|
||||
add eax, sizeof.xhci_pipe
|
||||
@@:
|
||||
pop edi ecx ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
proc xhci_free_pipe stdcall, ptr:dword
|
||||
push ebx esi edi
|
||||
mov ebx, [ptr]
|
||||
sub ebx, sizeof.xhci_pipe
|
||||
mov esi, [ebx+sizeof.xhci_pipe+usb_pipe.Controller]
|
||||
test esi, esi
|
||||
jz .free
|
||||
cmp [ebx+xhci_pipe.SlotId], 0
|
||||
jz .drop_pipe
|
||||
cmp [ebx+xhci_pipe.DCI], 1
|
||||
jnz .drop_pipe
|
||||
; This is the default control endpoint, that is, the handle of the whole
|
||||
; device: release the slot together with the per-device page.
|
||||
mov ecx, [ebx+xhci_pipe.SlotId]
|
||||
mov edx, ecx
|
||||
shl edx, 24
|
||||
or edx, XHCI_TRB_DISABLE_SLOT shl 10
|
||||
xor eax, eax
|
||||
push ebx
|
||||
xor ebx, ebx
|
||||
xor ecx, ecx
|
||||
call xhci_cmd_sync
|
||||
pop ebx
|
||||
; The controller may access the Device Context until the command above
|
||||
; completes, so only now may the DCBAA entry and the slot table forget it.
|
||||
mov ecx, [ebx+xhci_pipe.SlotId]
|
||||
mov edi, [esi+xhci_controller.CommonPage-XCD]
|
||||
and dword [edi+ecx*8], 0
|
||||
and dword [edi+ecx*8+4], 0
|
||||
and [esi+xhci_controller.SlotPages-XCD+ecx*4], 0
|
||||
mov eax, [ebx+xhci_pipe.DevPage]
|
||||
test eax, eax
|
||||
jz .drop_ring
|
||||
invoke KernelFree, eax
|
||||
and [ebx+xhci_pipe.DevPage], 0
|
||||
jmp .drop_ring
|
||||
.drop_pipe:
|
||||
; Remove the pipe from the per-device table, if it is still listed there.
|
||||
; On disconnect the kernel releases the pipes of a device in arbitrary order,
|
||||
; and the pipe of the default control endpoint - the owner of the per-device
|
||||
; page - may well be freed before this one, taking the page with it. The
|
||||
; authoritative pointer is the one in SlotPages: it is cleared when the slot
|
||||
; is released, so it can never point to freed memory.
|
||||
mov ecx, [ebx+xhci_pipe.SlotId]
|
||||
test ecx, ecx
|
||||
jz .drop_ring
|
||||
mov eax, [esi+xhci_controller.SlotPages-XCD+ecx*4]
|
||||
test eax, eax
|
||||
jz .drop_ring
|
||||
mov ecx, [ebx+xhci_pipe.DCI]
|
||||
cmp ecx, 32
|
||||
jae .drop_ring
|
||||
and dword [eax+XHCI_PIPES_OFS+ecx*4], 0
|
||||
.drop_ring:
|
||||
mov eax, [ebx+xhci_pipe.Ring]
|
||||
test eax, eax
|
||||
jz @f
|
||||
invoke KernelFree, eax
|
||||
and [ebx+xhci_pipe.Ring], 0
|
||||
@@:
|
||||
mov eax, [ebx+xhci_pipe.RingMap]
|
||||
test eax, eax
|
||||
jz .free
|
||||
invoke KernelFree, eax
|
||||
and [ebx+xhci_pipe.RingMap], 0
|
||||
.free:
|
||||
pop edi esi ebx
|
||||
mov eax, [ptr]
|
||||
sub eax, sizeof.xhci_pipe
|
||||
invoke usbhc_api.usb_free_common, eax
|
||||
ret
|
||||
endp
|
||||
|
||||
; Allocates the transfer ring of a pipe.
|
||||
; in: ebx -> xhci_pipe. out: eax = 0 on failure.
|
||||
proc xhci_alloc_ring
|
||||
push ecx edx
|
||||
call xhci_alloc_page
|
||||
test eax, eax
|
||||
jz .nothing
|
||||
mov [ebx+xhci_pipe.RingMap], eax
|
||||
call xhci_alloc_page
|
||||
test eax, eax
|
||||
jnz @f
|
||||
invoke KernelFree, [ebx+xhci_pipe.RingMap]
|
||||
and [ebx+xhci_pipe.RingMap], 0
|
||||
xor eax, eax
|
||||
jmp .nothing
|
||||
@@:
|
||||
mov [ebx+xhci_pipe.Ring], eax
|
||||
mov [ebx+xhci_pipe.RingPhys], edx
|
||||
; The last entry returns to the beginning of the ring and toggles the cycle.
|
||||
lea ecx, [eax+(XHCI_RING_TRBS-1)*16]
|
||||
mov [ecx], edx
|
||||
mov dword [ecx+12], (XHCI_TRB_LINK shl 10) + XHCI_TRB_TC
|
||||
and [ebx+xhci_pipe.Enqueue], 0
|
||||
and [ebx+xhci_pipe.Dequeue], 0
|
||||
and [ebx+xhci_pipe.Reserved], 0
|
||||
and [ebx+xhci_pipe.FirstFix], 0
|
||||
mov [ebx+xhci_pipe.Cycle], XHCI_TRB_C
|
||||
movi eax, 1
|
||||
.nothing:
|
||||
pop edx ecx
|
||||
ret
|
||||
endp
|
||||
|
||||
; Stores the pipe in the per-device table used by the event ring handler.
|
||||
; in: ebx -> xhci_pipe.
|
||||
proc xhci_register_pipe
|
||||
push eax ecx edx
|
||||
mov eax, [ebx+xhci_pipe.DevPage]
|
||||
test eax, eax
|
||||
jz @f
|
||||
mov ecx, [ebx+xhci_pipe.DCI]
|
||||
cmp ecx, 32
|
||||
jae @f
|
||||
lea edx, [ebx+sizeof.xhci_pipe]
|
||||
mov [eax+XHCI_PIPES_OFS+ecx*4], edx
|
||||
@@:
|
||||
pop edx ecx eax
|
||||
ret
|
||||
endp
|
||||
|
||||
; Computes the Interval field of the Endpoint Context of an interrupt endpoint.
|
||||
; The kernel passes bInterval from the endpoint descriptor: for high-speed
|
||||
; devices it is an exponent of 125 us periods, for low- and full-speed devices
|
||||
; it is a number of frames.
|
||||
; in: ebx -> xhci_pipe, eax = bInterval.
|
||||
proc xhci_calc_interval
|
||||
push eax ecx
|
||||
cmp [ebx+xhci_pipe.Speed], USB_SPEED_HS
|
||||
jnz .low_speed
|
||||
test eax, eax
|
||||
jz @f
|
||||
dec eax
|
||||
@@:
|
||||
jmp .clamp
|
||||
.low_speed:
|
||||
; One frame equals eight periods of 125 us, hence the offset of three.
|
||||
test eax, eax
|
||||
jnz @f
|
||||
movi eax, 1
|
||||
@@:
|
||||
bsr ecx, eax
|
||||
lea eax, [ecx+3]
|
||||
.clamp:
|
||||
cmp eax, 15
|
||||
jbe @f
|
||||
movi eax, 15
|
||||
@@:
|
||||
mov [ebx+xhci_pipe.Interval], eax
|
||||
pop ecx eax
|
||||
ret
|
||||
endp
|
||||
|
||||
; Called from usb_open_pipe.
|
||||
; in: edi -> usb_pipe for the target, ecx -> usb_pipe of the config pipe,
|
||||
; esi -> usb_controller, eax -> usb_gtd of the first descriptor,
|
||||
; [ebp+12] = endpoint, [ebp+16] = maxpacket, [ebp+20] = type,
|
||||
; [ebp+24] = interval.
|
||||
; out: eax = 0 on failure.
|
||||
proc xhci_init_pipe
|
||||
virtual at ebp+8
|
||||
.config_pipe dd ?
|
||||
.endpoint dd ?
|
||||
.maxpacket dd ?
|
||||
.type dd ?
|
||||
.interval dd ?
|
||||
end virtual
|
||||
push ebx
|
||||
sub edi, sizeof.xhci_pipe
|
||||
sub ecx, sizeof.xhci_pipe
|
||||
mov ebx, edi ; ebx -> xhci_pipe being initialized
|
||||
; 1. Copy the description of the device from the config pipe.
|
||||
mov eax, [ecx+xhci_pipe.SlotId]
|
||||
mov [ebx+xhci_pipe.SlotId], eax
|
||||
mov eax, [ecx+xhci_pipe.DevPage]
|
||||
mov [ebx+xhci_pipe.DevPage], eax
|
||||
mov eax, [ecx+xhci_pipe.DevPagePhys]
|
||||
mov [ebx+xhci_pipe.DevPagePhys], eax
|
||||
mov eax, [ecx+xhci_pipe.Speed]
|
||||
mov [ebx+xhci_pipe.Speed], eax
|
||||
mov eax, [ecx+xhci_pipe.RootPort]
|
||||
mov [ebx+xhci_pipe.RootPort], eax
|
||||
mov eax, [ecx+xhci_pipe.Route]
|
||||
mov [ebx+xhci_pipe.Route], eax
|
||||
mov eax, [ecx+xhci_pipe.Depth]
|
||||
mov [ebx+xhci_pipe.Depth], eax
|
||||
mov eax, [ecx+xhci_pipe.TTSlot]
|
||||
mov [ebx+xhci_pipe.TTSlot], eax
|
||||
mov eax, [ecx+xhci_pipe.TTPort]
|
||||
mov [ebx+xhci_pipe.TTPort], eax
|
||||
if XHCI_SUPERSPEED
|
||||
mov eax, [ecx+xhci_pipe.PSIV]
|
||||
mov [ebx+xhci_pipe.PSIV], eax
|
||||
end if
|
||||
; 2. Work out the Device Context Index and the endpoint type.
|
||||
mov eax, [.endpoint]
|
||||
test eax, eax
|
||||
jz .control_ep
|
||||
mov ecx, eax
|
||||
and ecx, 15
|
||||
add ecx, ecx
|
||||
test al, 80h
|
||||
jz @f
|
||||
inc ecx
|
||||
or [ebx+xhci_pipe.Flags], XHCI_PIPE_IN
|
||||
@@:
|
||||
mov [ebx+xhci_pipe.DCI], ecx
|
||||
mov eax, [.type]
|
||||
cmp eax, BULK_PIPE
|
||||
jz .bulk
|
||||
cmp eax, INTERRUPT_PIPE
|
||||
jz .interrupt
|
||||
; A control endpoint other than endpoint zero is unusual but legal.
|
||||
mov [ebx+xhci_pipe.EpType], XHCI_EP_CONTROL
|
||||
jmp .have_type
|
||||
.bulk:
|
||||
movi eax, XHCI_EP_BULK_OUT
|
||||
test [ebx+xhci_pipe.Flags], XHCI_PIPE_IN
|
||||
jz @f
|
||||
movi eax, XHCI_EP_BULK_IN
|
||||
@@:
|
||||
mov [ebx+xhci_pipe.EpType], eax
|
||||
jmp .have_type
|
||||
.interrupt:
|
||||
movi eax, XHCI_EP_INT_OUT
|
||||
test [ebx+xhci_pipe.Flags], XHCI_PIPE_IN
|
||||
jz @f
|
||||
movi eax, XHCI_EP_INT_IN
|
||||
@@:
|
||||
mov [ebx+xhci_pipe.EpType], eax
|
||||
mov eax, [.interval]
|
||||
call xhci_calc_interval
|
||||
.have_type:
|
||||
mov eax, [.maxpacket]
|
||||
mov [ebx+xhci_pipe.MaxPacket], eax
|
||||
if XHCI_SUPERSPEED
|
||||
call xhci_ss_get_burst
|
||||
end if
|
||||
jmp .alloc_ring
|
||||
.control_ep:
|
||||
; The default control endpoint always has index one. Until the real packet size
|
||||
; is known from the device descriptor, use the value the specification requires
|
||||
; for the speed of the device: the kernel asks for 64 regardless of the speed,
|
||||
; which is wrong for low- and full-speed devices.
|
||||
mov [ebx+xhci_pipe.DCI], 1
|
||||
mov [ebx+xhci_pipe.EpType], XHCI_EP_CONTROL
|
||||
movi eax, 64
|
||||
cmp [ebx+xhci_pipe.Speed], USB_SPEED_HS
|
||||
jz @f
|
||||
movi eax, 8
|
||||
@@:
|
||||
if XHCI_SUPERSPEED
|
||||
; A SuperSpeed device always uses 512 bytes on the default control endpoint.
|
||||
cmp [ebx+xhci_pipe.PSIV], XHCI_PSI_SS
|
||||
jb @f
|
||||
mov eax, 512
|
||||
@@:
|
||||
end if
|
||||
mov [ebx+xhci_pipe.MaxPacket], eax
|
||||
.alloc_ring:
|
||||
; 3. Allocate the transfer ring.
|
||||
call xhci_alloc_ring
|
||||
test eax, eax
|
||||
jz .fail
|
||||
; 4. Choose the software list the pipe belongs to and insert it there. The
|
||||
; hardware knows nothing about these lists; they exist only so that the kernel
|
||||
; can walk all pipes and reinsert an aborted one.
|
||||
lea edx, [esi+xhci_controller.ControlED-XCD]
|
||||
cmp [.type], BULK_PIPE
|
||||
jb @f
|
||||
lea edx, [esi+xhci_controller.BulkED-XCD]
|
||||
jz @f
|
||||
lea edx, [esi+xhci_controller.IntED-XCD]
|
||||
@@:
|
||||
lea edi, [ebx+sizeof.xhci_pipe]
|
||||
mov [edi+usb_pipe.BaseList], edx
|
||||
mov ecx, [edx+usb_pipe.NextVirt]
|
||||
mov [edi+usb_pipe.NextVirt], ecx
|
||||
mov [edi+usb_pipe.PrevVirt], edx
|
||||
mov [ecx+usb_pipe.PrevVirt], edi
|
||||
mov [edx+usb_pipe.NextVirt], edi
|
||||
; 5. Now do the hardware part.
|
||||
cmp [.endpoint], 0
|
||||
jz .address_device
|
||||
call xhci_register_pipe
|
||||
mov edi, [.config_pipe]
|
||||
sub edi, sizeof.xhci_pipe
|
||||
call xhci_configure_endpoint
|
||||
xhci_trace 'K : XHCI open pipe: slot %d dci %d\n', [ebx+xhci_pipe.SlotId], [ebx+xhci_pipe.DCI]
|
||||
cmp eax, XHCI_CC_SUCCESS
|
||||
jz .success
|
||||
DEBUGF 1,'K : XHCI: Configure Endpoint failed, code %d\n',eax
|
||||
jmp .unlink_fail
|
||||
.address_device:
|
||||
; 6. This is a new device: allocate its Device Context, publish the slot and
|
||||
; let the controller give the device a bus address.
|
||||
call xhci_alloc_page
|
||||
test eax, eax
|
||||
jz .unlink_fail
|
||||
mov [ebx+xhci_pipe.DevPage], eax
|
||||
mov [ebx+xhci_pipe.DevPagePhys], edx
|
||||
mov ecx, [ebx+xhci_pipe.SlotId]
|
||||
mov [esi+xhci_controller.SlotPages-XCD+ecx*4], eax
|
||||
call xhci_register_pipe
|
||||
call xhci_address_device
|
||||
test eax, eax
|
||||
jz .free_devpage
|
||||
.success:
|
||||
; usb_open_pipe keeps the pointer to the new pipe in edi across this call, so
|
||||
; it has to be handed back untouched; the branch above has overwritten it with
|
||||
; the pipe of the default control endpoint.
|
||||
lea edi, [ebx+sizeof.xhci_pipe]
|
||||
pop ebx
|
||||
movi eax, 1
|
||||
ret
|
||||
.free_devpage:
|
||||
mov ecx, [ebx+xhci_pipe.SlotId]
|
||||
and [esi+xhci_controller.SlotPages-XCD+ecx*4], 0
|
||||
mov eax, [ebx+xhci_pipe.DevPage]
|
||||
invoke KernelFree, eax
|
||||
and [ebx+xhci_pipe.DevPage], 0
|
||||
.unlink_fail:
|
||||
; Undo the insertion into the software list before failing.
|
||||
lea edi, [ebx+sizeof.xhci_pipe]
|
||||
mov eax, [edi+usb_pipe.NextVirt]
|
||||
mov edx, [edi+usb_pipe.PrevVirt]
|
||||
mov [eax+usb_pipe.PrevVirt], edx
|
||||
mov [edx+usb_pipe.NextVirt], eax
|
||||
.fail:
|
||||
lea edi, [ebx+sizeof.xhci_pipe]
|
||||
pop ebx
|
||||
xor eax, eax
|
||||
ret
|
||||
endp
|
||||
|
||||
; Removes the pipe from the hardware configuration of the device.
|
||||
; in: esi -> usb_controller, ebx -> usb_pipe.
|
||||
proc xhci_unlink_pipe
|
||||
pushad
|
||||
sub ebx, sizeof.xhci_pipe
|
||||
cmp [ebx+xhci_pipe.SlotId], 0
|
||||
jz .nothing
|
||||
cmp [ebx+xhci_pipe.DCI], 1
|
||||
jz .nothing ; the slot itself is released by FreePipe
|
||||
call xhci_ctrl_pipe
|
||||
test eax, eax
|
||||
jz .nothing
|
||||
mov edi, eax ; edi -> pipe of endpoint zero
|
||||
lea ecx, [esi+xhci_controller.CmdLock-XCD]
|
||||
invoke MutexLock
|
||||
call xhci_clear_input_ctx
|
||||
mov ecx, [ebx+xhci_pipe.DCI]
|
||||
movi eax, 1
|
||||
shl eax, cl
|
||||
mov edx, [esi+xhci_controller.InputCtx-XCD]
|
||||
mov [edx], eax ; drop this endpoint
|
||||
mov dword [edx+4], 1 ; keep the Slot Context
|
||||
mov ecx, [edi+xhci_pipe.MaxDCI]
|
||||
test ecx, ecx
|
||||
jnz @f
|
||||
movi ecx, 1
|
||||
@@:
|
||||
push ebx
|
||||
mov ebx, edi
|
||||
call xhci_fill_slot_ctx
|
||||
pop ebx
|
||||
mov edx, [ebx+xhci_pipe.SlotId]
|
||||
shl edx, 24
|
||||
or edx, XHCI_TRB_CONFIG_EP shl 10
|
||||
mov eax, [esi+xhci_controller.InputCtxPhys-XCD]
|
||||
xor ebx, ebx
|
||||
xor ecx, ecx
|
||||
call xhci_cmd_submit
|
||||
lea ecx, [esi+xhci_controller.CmdLock-XCD]
|
||||
invoke MutexUnlock
|
||||
.nothing:
|
||||
popad
|
||||
ret
|
||||
endp
|
||||
|
||||
; Temporarily removes the pipe from the hardware schedule.
|
||||
; in: esi -> usb_controller, ebx -> usb_pipe.
|
||||
proc xhci_disable_pipe
|
||||
pushad
|
||||
sub ebx, sizeof.xhci_pipe
|
||||
cmp [ebx+xhci_pipe.SlotId], 0
|
||||
jz .nothing
|
||||
mov ecx, [ebx+xhci_pipe.DCI]
|
||||
shl ecx, 16
|
||||
mov edx, [ebx+xhci_pipe.SlotId]
|
||||
shl edx, 24
|
||||
or edx, ecx
|
||||
or edx, XHCI_TRB_STOP_EP shl 10
|
||||
xor eax, eax
|
||||
xor ebx, ebx
|
||||
xor ecx, ecx
|
||||
call xhci_cmd_sync
|
||||
.nothing:
|
||||
popad
|
||||
ret
|
||||
endp
|
||||
|
||||
; Reinserts the pipe into the hardware schedule after xhci_disable_pipe, with
|
||||
; an empty transfer queue.
|
||||
; in: esi -> usb_controller, ebx -> usb_pipe,
|
||||
; edx -> current descriptor, eax -> new last descriptor.
|
||||
proc xhci_enable_pipe
|
||||
pushad
|
||||
sub ebx, sizeof.xhci_pipe
|
||||
mov eax, [ebx+xhci_pipe.Ring]
|
||||
test eax, eax
|
||||
jz .nothing
|
||||
; The queue is empty now, so the ring can be restarted from its beginning.
|
||||
mov edi, eax
|
||||
xor eax, eax
|
||||
mov ecx, 0x1000/4
|
||||
rep stosd
|
||||
mov edi, [ebx+xhci_pipe.RingMap]
|
||||
mov ecx, 0x1000/4
|
||||
rep stosd
|
||||
mov edi, [ebx+xhci_pipe.Ring]
|
||||
add edi, (XHCI_RING_TRBS-1)*16
|
||||
mov eax, [ebx+xhci_pipe.RingPhys]
|
||||
mov [edi], eax
|
||||
mov dword [edi+12], (XHCI_TRB_LINK shl 10) + XHCI_TRB_TC
|
||||
and [ebx+xhci_pipe.Enqueue], 0
|
||||
and [ebx+xhci_pipe.Dequeue], 0
|
||||
and [ebx+xhci_pipe.Reserved], 0
|
||||
and [ebx+xhci_pipe.FirstFix], 0
|
||||
mov [ebx+xhci_pipe.Cycle], XHCI_TRB_C
|
||||
call xhci_set_dequeue
|
||||
.nothing:
|
||||
popad
|
||||
ret
|
||||
endp
|
||||
|
||||
; =============================================================================
|
||||
; ========================== Address and packet size ==========================
|
||||
; =============================================================================
|
||||
|
||||
; Called from usb_set_address_callback. The bus address is chosen by the
|
||||
; controller itself while executing the Address Device command, so the only
|
||||
; thing left to do is to remember the number the kernel has reserved: it asks
|
||||
; for it back on disconnect in order to mark it free again.
|
||||
; in: esi -> usb_controller, ebx -> usb_pipe, cl = address.
|
||||
proc xhci_set_device_address
|
||||
movzx eax, cl
|
||||
mov [ebx+xhci_pipe.Address-sizeof.xhci_pipe], eax
|
||||
jmp [usbhc_api.usb_subscribe_control]
|
||||
endp
|
||||
|
||||
; in: esi -> usb_controller, ebx -> usb_pipe. out: eax = address.
|
||||
proc xhci_get_device_address
|
||||
mov eax, [ebx+xhci_pipe.Address-sizeof.xhci_pipe]
|
||||
ret
|
||||
endp
|
||||
|
||||
; Called from usb_get_descr8_callback once the real packet size of the default
|
||||
; control endpoint is known. On xHCI that value lives in the Endpoint Context,
|
||||
; so an Evaluate Context command is needed to update it.
|
||||
; in: esi -> usb_controller, ebx -> usb_pipe, ecx = packet size.
|
||||
proc xhci_set_endpoint_packet_size
|
||||
push ebx ecx edx edi
|
||||
sub ebx, sizeof.xhci_pipe
|
||||
if XHCI_SUPERSPEED
|
||||
; For a SuperSpeed device bMaxPacketSize0 is an exponent, and the only value
|
||||
; the specification allows is 9: use 512 directly instead of the raw byte.
|
||||
cmp [ebx+xhci_pipe.PSIV], XHCI_PSI_SS
|
||||
jb @f
|
||||
mov ecx, 512
|
||||
@@:
|
||||
end if
|
||||
mov [ebx+xhci_pipe.MaxPacket], ecx
|
||||
lea ecx, [esi+xhci_controller.CmdLock-XCD]
|
||||
invoke MutexLock
|
||||
call xhci_clear_input_ctx
|
||||
mov edx, [esi+xhci_controller.InputCtx-XCD]
|
||||
mov dword [edx+4], 2 ; evaluate the default control endpoint
|
||||
call xhci_fill_ep_ctx
|
||||
mov edx, [ebx+xhci_pipe.SlotId]
|
||||
shl edx, 24
|
||||
or edx, XHCI_TRB_EVAL_CTX shl 10
|
||||
mov eax, [esi+xhci_controller.InputCtxPhys-XCD]
|
||||
push ebx
|
||||
xor ebx, ebx
|
||||
xor ecx, ecx
|
||||
call xhci_cmd_submit
|
||||
pop ebx
|
||||
cmp eax, XHCI_CC_SUCCESS
|
||||
jz @f
|
||||
DEBUGF 1,'K : XHCI: Evaluate Context failed, code %d\n',eax
|
||||
@@:
|
||||
lea ecx, [esi+xhci_controller.CmdLock-XCD]
|
||||
invoke MutexUnlock
|
||||
pop edi edx ecx ebx
|
||||
jmp [usbhc_api.usb_subscribe_control]
|
||||
endp
|
||||
|
||||
; If the descriptor that has just completed is the answer to a request for the
|
||||
; hub descriptor, tell the controller that the device is a hub: it has to know
|
||||
; that in order to serve the devices behind it.
|
||||
; in: ebx -> usb_gtd.
|
||||
proc xhci_check_hub_descriptor
|
||||
pushad
|
||||
cmp [ebx+usb_gtd.Callback], 0
|
||||
jz .nothing
|
||||
mov eax, [ebx+usb_gtd.Pipe]
|
||||
mov esi, [eax+usb_pipe.Controller]
|
||||
sub eax, sizeof.xhci_pipe
|
||||
test [eax+xhci_pipe.Flags], XHCI_PIPE_HUBPEND
|
||||
jz .nothing
|
||||
and [eax+xhci_pipe.Flags], not XHCI_PIPE_HUBPEND
|
||||
cmp [ebx+xhci_gtd.Status-sizeof.xhci_gtd], XHCI_CC_SUCCESS
|
||||
jnz .nothing
|
||||
mov edx, [eax+xhci_pipe.HubBuf]
|
||||
test edx, edx
|
||||
jz .nothing
|
||||
cmp byte [edx+1], 29h ; bDescriptorType
|
||||
jnz .nothing
|
||||
or [eax+xhci_pipe.Flags], XHCI_PIPE_ISHUB
|
||||
mov ebx, eax ; ebx -> xhci_pipe of the hub
|
||||
movzx edi, byte [edx+2] ; bNbrPorts
|
||||
movzx ebp, byte [edx+3] ; low byte of wHubCharacteristics
|
||||
shr ebp, 5
|
||||
and ebp, 3 ; Transaction Translator Think Time
|
||||
DEBUGF 1,'K : XHCI: device on slot %d is a hub with %d ports\n',[ebx+xhci_pipe.SlotId],edi
|
||||
lea ecx, [esi+xhci_controller.CmdLock-XCD]
|
||||
invoke MutexLock
|
||||
call xhci_clear_input_ctx
|
||||
mov eax, [esi+xhci_controller.InputCtx-XCD]
|
||||
mov dword [eax+4], 1 ; only the Slot Context is evaluated
|
||||
mov ecx, [ebx+xhci_pipe.MaxDCI]
|
||||
test ecx, ecx
|
||||
jnz @f
|
||||
movi ecx, 1
|
||||
@@:
|
||||
call xhci_fill_slot_ctx
|
||||
; Patch the Slot Context with the fields that describe a hub. Only Configure
|
||||
; Endpoint takes them into account, Evaluate Context would ignore them.
|
||||
mov eax, [esi+xhci_controller.InputCtx-XCD]
|
||||
movi ecx, 1
|
||||
call xhci_context
|
||||
or dword [eax], 1 shl 26 ; this device is a hub
|
||||
cmp [ebx+xhci_pipe.Speed], USB_SPEED_HS
|
||||
jnz @f
|
||||
shl ebp, 16
|
||||
or [eax+8], ebp
|
||||
@@:
|
||||
shl edi, 24
|
||||
or [eax+4], edi ; Number of Ports
|
||||
mov edx, [ebx+xhci_pipe.SlotId]
|
||||
shl edx, 24
|
||||
or edx, XHCI_TRB_CONFIG_EP shl 10
|
||||
mov eax, [esi+xhci_controller.InputCtxPhys-XCD]
|
||||
xor ebx, ebx
|
||||
xor ecx, ecx
|
||||
call xhci_cmd_submit
|
||||
cmp eax, XHCI_CC_SUCCESS
|
||||
jz @f
|
||||
DEBUGF 1,'K : XHCI: cannot mark the device as a hub, code %d\n',eax
|
||||
@@:
|
||||
lea ecx, [esi+xhci_controller.CmdLock-XCD]
|
||||
invoke MutexUnlock
|
||||
.nothing:
|
||||
popad
|
||||
ret
|
||||
endp
|
||||
@@ -1,135 +0,0 @@
|
||||
; SuperSpeed support for the xHCI driver, included from xhci.asm when
|
||||
; XHCI_SUPERSPEED is enabled. The pieces too small to live here - the port
|
||||
; map, the Slot Context speed, the 512-byte default control endpoint, the
|
||||
; Max Burst field of the Endpoint Context - sit in the other files under
|
||||
; "if XHCI_SUPERSPEED" guards; this file keeps the self-contained procedures.
|
||||
;
|
||||
; The kernel USB stack knows nothing about SuperSpeed, so it never learns
|
||||
; about it: a SuperSpeed device is announced as a high-speed one, which also
|
||||
; keeps the Transaction Translator logic away from it. The raw PORTSC speed
|
||||
; identifier travels in xhci_pipe.PSIV instead and reaches everything that
|
||||
; really needs it. SuperSpeed hubs are not supported: the kernel only speaks
|
||||
; the USB2 hub protocol, so a device behind a USB3 hub is served by the USB2
|
||||
; half of that hub at high speed.
|
||||
|
||||
; =============================================================================
|
||||
; ============================ SuperSpeed ports ===============================
|
||||
; =============================================================================
|
||||
|
||||
; Called from xhci_new_port for a SuperSpeed root port instead of the USB2
|
||||
; reset entry point: a SuperSpeed link trains itself and the port enables
|
||||
; itself on connect, reporting the speed with no reset at all. When the link
|
||||
; is already up, skip straight to the reset recovery stage, after which
|
||||
; xhci_port_init picks the device up; otherwise try a warm reset.
|
||||
; in: esi -> usb_controller, ecx = port index.
|
||||
proc xhci_ss_start_port
|
||||
push eax edx
|
||||
and [esi+usb_controller.ResettingHub], 0
|
||||
mov [esi+usb_controller.ResettingPort], cl
|
||||
push ecx
|
||||
invoke GetTimerTicks
|
||||
pop ecx
|
||||
mov [esi+usb_controller.ResetTime], eax
|
||||
mov [esi+xhci_controller.ResetStart-XCD], eax
|
||||
call xhci_port_reg
|
||||
mov eax, [edx]
|
||||
test al, XHCI_PORT_PED
|
||||
jz .warm_reset
|
||||
mov [esi+usb_controller.ResettingStatus], 2
|
||||
DEBUGF 1,'K : XHCI %x: SS port %d link is up, PORTSC=%x\n',esi,ecx,eax
|
||||
jmp .nothing
|
||||
.warm_reset:
|
||||
; Connected, but the link has not come up. The Port Reset bit is set while a
|
||||
; warm reset is running, so the ordinary reset-wait machinery in
|
||||
; xhci_port_reset_done serves this case unchanged; the extra WRC change bit is
|
||||
; acknowledged there together with the usual ones.
|
||||
mov dword [edx], XHCI_PORT_PP + XHCI_PORT_WPR
|
||||
mov [esi+usb_controller.ResettingStatus], 1
|
||||
DEBUGF 1,'K : XHCI %x: warm-resetting port %d, PORTSC=%x\n',esi,ecx,eax
|
||||
.nothing:
|
||||
pop edx eax
|
||||
ret
|
||||
endp
|
||||
|
||||
; The kernel restarts pending root ports through the NewPortReset entry of
|
||||
; usb_hardware_func directly, bypassing xhci_new_port; SuperSpeed ports must
|
||||
; not get the USB2 reset on that path either, so the entry points here.
|
||||
; in: esi -> usb_controller, ecx = port index.
|
||||
proc xhci_ss_port_reset
|
||||
bt [esi+xhci_controller.SSPortMask-XCD], ecx
|
||||
jnc xhci_new_port.reset
|
||||
call xhci_ss_start_port
|
||||
ret
|
||||
endp
|
||||
|
||||
; =============================================================================
|
||||
; ===================== Endpoint Companion descriptors ========================
|
||||
; =============================================================================
|
||||
|
||||
; Reads the SuperSpeed Endpoint Companion descriptor of a bulk endpoint and
|
||||
; keeps its bMaxBurst for the Endpoint Context, allowing bursts of up to
|
||||
; bMaxBurst+1 packets per transaction. Zero (no bursts) is always legal, so
|
||||
; any failure just leaves the field alone. Only bulk endpoints are considered:
|
||||
; a nonzero burst on a periodic endpoint would also require the Max ESIT
|
||||
; Payload fields, and real interrupt endpoints do not burst anyway.
|
||||
; Relies on the stack frame of usb_open_pipe exactly like xhci_init_pipe does:
|
||||
; [ebp+8] is the config pipe of the device.
|
||||
; in: ebx -> xhci_pipe of a non-control endpoint being opened.
|
||||
proc xhci_ss_get_burst
|
||||
push eax ecx edx edi
|
||||
; 1. Only SuperSpeed bulk endpoints are of interest.
|
||||
cmp [ebx+xhci_pipe.PSIV], XHCI_PSI_SS
|
||||
jb .nothing
|
||||
mov eax, [ebx+xhci_pipe.EpType]
|
||||
and al, 3
|
||||
cmp al, 2 ; bulk endpoint types are 2 and 6
|
||||
jnz .nothing
|
||||
; 2. Find the configuration data kept by the kernel behind the device
|
||||
; descriptor; it holds the endpoint descriptors with their companions.
|
||||
mov eax, [ebp+8]
|
||||
mov eax, [eax+usb_pipe.DeviceData]
|
||||
test eax, eax
|
||||
jz .nothing
|
||||
movzx edx, [eax+usb_device_data.DeviceDescrSize]
|
||||
mov edi, [eax+usb_device_data.ConfigDataSize]
|
||||
lea ecx, [eax+edx+usb_device_data.DeviceDescriptor]
|
||||
add edi, ecx ; edi -> end of the configuration data
|
||||
; 3. Reconstruct bEndpointAddress from the Device Context Index.
|
||||
mov edx, [ebx+xhci_pipe.DCI]
|
||||
shr edx, 1
|
||||
test [ebx+xhci_pipe.Flags], XHCI_PIPE_IN
|
||||
jz @f
|
||||
or dl, 80h
|
||||
@@:
|
||||
; 4. Walk the descriptors to the one of this endpoint.
|
||||
.walk:
|
||||
lea eax, [ecx+2]
|
||||
cmp eax, edi
|
||||
ja .nothing
|
||||
movzx eax, byte [ecx] ; bLength
|
||||
test eax, eax
|
||||
jz .nothing ; malformed data, stop
|
||||
cmp byte [ecx+1], 5 ; an endpoint descriptor?
|
||||
jnz .advance
|
||||
cmp [ecx+2], dl ; bEndpointAddress
|
||||
jnz .advance
|
||||
; 5. The companion descriptor (type 30h) immediately follows its endpoint.
|
||||
add ecx, eax
|
||||
lea eax, [ecx+3]
|
||||
cmp eax, edi
|
||||
ja .nothing
|
||||
cmp byte [ecx+1], 30h ; SuperSpeed Endpoint Companion
|
||||
jnz .nothing
|
||||
movzx eax, byte [ecx+2] ; bMaxBurst
|
||||
cmp eax, 15
|
||||
ja .nothing
|
||||
mov [ebx+xhci_pipe.MaxBurst], eax
|
||||
DEBUGF 1,'K : XHCI: slot %d dci %d bursts %d+1 packets\n',[ebx+xhci_pipe.SlotId],[ebx+xhci_pipe.DCI],eax
|
||||
jmp .nothing
|
||||
.advance:
|
||||
add ecx, eax
|
||||
jmp .walk
|
||||
.nothing:
|
||||
pop edi edx ecx eax
|
||||
ret
|
||||
endp
|
||||
@@ -18,7 +18,24 @@ saverd_fileinfo:
|
||||
.name:
|
||||
dd ?
|
||||
endg
|
||||
sysfn_saveramdisk: ; 18.6 = SAVE FLOPPY IMAGE (HD version only)
|
||||
sysfn_saveramdisk: ; 18.6 = SAVE RAMDISK IMAGE
|
||||
; ecx -> path to the image file; ecx = 0 - write the image back to the
|
||||
; medium it was booted from (a floppy or the file found by rdload.inc)
|
||||
test ecx, ecx
|
||||
jnz .have_path
|
||||
if ~ defined extended_primary_loader
|
||||
mov ecx, read_image_fsinfo.name
|
||||
cmp [BOOT.rd_load_from], RD_LOAD_FROM_HD
|
||||
je .have_path
|
||||
end if
|
||||
movi eax, ERROR_UNSUPPORTED_FS
|
||||
cmp [BOOT.rd_load_from], RD_LOAD_FROM_FLOPPY
|
||||
jne .done
|
||||
mov ebx, 1
|
||||
call save_image
|
||||
imul eax, ERROR_DEVICE ; 0 -> 0, 1 -> ERROR_DEVICE
|
||||
jmp .done
|
||||
.have_path:
|
||||
mov ebx, saverd_fileinfo
|
||||
mov [ebx+21], ecx
|
||||
mov eax, [ramdisk_actual_size]
|
||||
@@ -27,5 +44,6 @@ sysfn_saveramdisk: ; 18.6 = SAVE FLOPPY IMAGE (HD version only)
|
||||
pushad
|
||||
call file_system_lfn_protected ;in ebx
|
||||
popad
|
||||
.done:
|
||||
mov [esp+32], eax
|
||||
ret
|
||||
@@ -781,12 +781,21 @@ picture rb Xsize*Ysize*4 ; 32 бита
|
||||
* ebx = 6 - номер подфункции
|
||||
* ecx = указатель на строку с полным именем файла
|
||||
(например, "/hd0/1/kolibri/kolibri.img")
|
||||
* ecx = 0 - записать образ обратно на носитель, с которого была
|
||||
загружена система: на дискету или в файл образа, найденный при
|
||||
загрузке на разделе жёсткого диска
|
||||
Возвращаемое значение:
|
||||
* eax = 0 - успешно
|
||||
* иначе eax = код ошибки файловой системы
|
||||
Замечания:
|
||||
* Все папки в указанном пути должны существовать, иначе вернётся
|
||||
значение 5, "файл не найден".
|
||||
* Для ecx = 0: если рамдиск не был загружен с перезаписываемого
|
||||
носителя (например, образ заранее загружен в память
|
||||
загрузчиком), вернётся значение 2; ошибка записи на дискету
|
||||
вернёт значение 11.
|
||||
* Устройство-источник загрузки можно заранее узнать подфункцией
|
||||
13 функции 26.
|
||||
|
||||
---------------------- Константы для регистров: ----------------------
|
||||
eax - SF_SYSTEM (18)
|
||||
@@ -1654,6 +1663,27 @@ Remarks:
|
||||
eax - SF_SYSTEM_GET (26)
|
||||
ebx - SSF_ACCESS_PCI (12)
|
||||
======================================================================
|
||||
===== Функция 26, подфункция 13 - откуда загружен рамдиск. ===========
|
||||
======================================================================
|
||||
Параметры:
|
||||
* eax = 26 - номер функции
|
||||
* ebx = 13 - номер подфункции
|
||||
Возвращаемое значение:
|
||||
* eax = устройство, с которого при загрузке был прочитан образ
|
||||
рамдиска:
|
||||
* 1 = дискета
|
||||
* 2 = раздел жёсткого диска
|
||||
* 3 = образ заранее загружен в память загрузчиком
|
||||
* 4 = рамдиск создан пустым (отформатирован при загрузке)
|
||||
* 5 = рамдиска нет
|
||||
Замечания:
|
||||
* Для сохранения рамдиска на загрузочный носитель используйте
|
||||
функцию 18.6 с ecx = 0; она успешна для значений 1 и 2.
|
||||
|
||||
---------------------- Константы для регистров: ----------------------
|
||||
eax - SF_SYSTEM_GET (26)
|
||||
ebx - SSF_RD_BOOT_SOURCE (13)
|
||||
======================================================================
|
||||
================ Функция 29 - получить системную дату. ===============
|
||||
======================================================================
|
||||
Параметры:
|
||||
@@ -5230,7 +5260,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
|
||||
-EINVAL (-11), -EFAULT (-14), -ENFILE (-23), -EMFILE (-24)
|
||||
Примечания:
|
||||
* В случае успеха pipefd[0] является дескриптором чтения, а pipefd[1]
|
||||
- дескриптором записи.
|
||||
- дескриптором записи.
|
||||
|
||||
---------------------- Константы для регистров: ----------------------
|
||||
eax - SF_POSIX (77)
|
||||
|
||||
@@ -769,12 +769,20 @@ Parameters:
|
||||
* ebx = 6 - subfunction number
|
||||
* ecx = pointer to the full path to file
|
||||
(for example, "/hd0/1/kolibri/kolibri.img")
|
||||
* ecx = 0 - write the image back to the medium the system was
|
||||
booted from: the floppy drive, or the image file found on a hard
|
||||
disk partition at boot
|
||||
Returned value:
|
||||
* eax = 0 - success
|
||||
* else eax = error code of the file system
|
||||
Remarks:
|
||||
* All folders in the given path must exist, otherwise function
|
||||
returns value 5, "file not found".
|
||||
* For ecx = 0: if the ramdisk was not loaded from a writable
|
||||
medium (e.g. it was preloaded to memory by the loader), function
|
||||
returns value 2; a failed floppy write returns value 11.
|
||||
* The boot source device can be checked in advance with
|
||||
subfunction 13 of function 26.
|
||||
|
||||
---------------------- Constants for registers: ----------------------
|
||||
eax - SF_SYSTEM (18)
|
||||
@@ -1639,6 +1647,26 @@ Remarks:
|
||||
eax - SF_SYSTEM_GET (26)
|
||||
ebx - SSF_ACCESS_PCI (12)
|
||||
======================================================================
|
||||
== Function 26, subfunction 13 - get ramdisk boot source device. =====
|
||||
======================================================================
|
||||
Parameters:
|
||||
* eax = 26 - function number
|
||||
* ebx = 13 - subfunction number
|
||||
Returned value:
|
||||
* eax = device the ramdisk image was loaded from at boot:
|
||||
* 1 = floppy drive
|
||||
* 2 = hard disk partition
|
||||
* 3 = image preloaded to memory by the loader
|
||||
* 4 = ramdisk was created empty (formatted at boot)
|
||||
* 5 = no ramdisk
|
||||
Remarks:
|
||||
* To save the ramdisk back to the boot medium use function 18.6
|
||||
with ecx = 0; it succeeds for values 1 and 2.
|
||||
|
||||
---------------------- Constants for registers: ----------------------
|
||||
eax - SF_SYSTEM_GET (26)
|
||||
ebx - SSF_RD_BOOT_SOURCE (13)
|
||||
======================================================================
|
||||
=================== Function 29 - get system date. ===================
|
||||
======================================================================
|
||||
Parameters:
|
||||
|
||||
@@ -48,10 +48,6 @@ dtext:
|
||||
add esp, 28
|
||||
ret
|
||||
|
||||
.nomem:
|
||||
add esp, 40
|
||||
ret
|
||||
|
||||
.redirect:
|
||||
mov ebp, [edi]
|
||||
add edi, 8
|
||||
@@ -85,8 +81,6 @@ dtext:
|
||||
mov [esp+32], eax
|
||||
imul ebp, eax
|
||||
stdcall kernel_alloc, ebp
|
||||
test eax, eax
|
||||
jz .nomem
|
||||
mov ecx, ebp
|
||||
shr ecx, 2
|
||||
mov [esp+36], eax
|
||||
|
||||
@@ -1634,6 +1634,7 @@ sys_getsetup:
|
||||
; 10 = not used
|
||||
; 11 = get the state "lba read"
|
||||
; 12 = get the state "pci access"
|
||||
; 13 = get device the ramdisk was loaded from
|
||||
;-----------------------------------------------------------------------------
|
||||
; F.26.2 - get keyboard layout
|
||||
sub ebx, 2
|
||||
@@ -1725,12 +1726,21 @@ sys_getsetup:
|
||||
@@:
|
||||
; F.26.12 - Find out whether low-level PCI access is enabled
|
||||
dec ebx
|
||||
jnz .error
|
||||
jnz @f
|
||||
|
||||
mov eax, [pci_access_enabled]
|
||||
mov [esp + SYSCALL_STACK.eax], eax
|
||||
ret
|
||||
;--------------------------------------
|
||||
@@:
|
||||
; F.26.13 - get device the ramdisk was loaded from, RD_LOAD_FROM_*
|
||||
dec ebx
|
||||
jnz .error
|
||||
|
||||
movzx eax, byte [BOOT.rd_load_from]
|
||||
mov [esp + SYSCALL_STACK.eax], eax
|
||||
ret
|
||||
;--------------------------------------
|
||||
.error:
|
||||
or [esp + SYSCALL_STACK.eax], -1
|
||||
ret
|
||||
|
||||
@@ -2124,11 +2124,11 @@ socket_free:
|
||||
mov ebx, eax
|
||||
cmp [eax + STREAM_SOCKET.rcv.start_ptr], 0
|
||||
je @f
|
||||
stdcall kernel_free, [eax + STREAM_SOCKET.rcv.start_ptr]
|
||||
stdcall free_kernel_space, [eax + STREAM_SOCKET.rcv.start_ptr]
|
||||
@@:
|
||||
cmp [ebx + STREAM_SOCKET.snd.start_ptr], 0
|
||||
je @f
|
||||
stdcall kernel_free, [ebx + STREAM_SOCKET.snd.start_ptr]
|
||||
stdcall free_kernel_space, [ebx + STREAM_SOCKET.snd.start_ptr]
|
||||
@@:
|
||||
mov eax, ebx
|
||||
.no_stream:
|
||||
|
||||
@@ -84,6 +84,12 @@ SF_SCREEN_PUT_IMAGE=25
|
||||
SF_SYSTEM_GET=26
|
||||
SSF_TIME_COUNT=9
|
||||
SSF_TIME_COUNT_PRO=10
|
||||
SSF_RD_BOOT_SOURCE=13
|
||||
RD_LOAD_FROM_FLOPPY=1
|
||||
RD_LOAD_FROM_HD=2
|
||||
RD_LOAD_FROM_MEMORY=3
|
||||
RD_LOAD_FROM_FORMAT=4
|
||||
RD_LOAD_FROM_NONE=5
|
||||
SF_GET_SYS_DATE=29
|
||||
SF_CURRENT_FOLDER=30
|
||||
SSF_SET_CF=1
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
@fasm free3d04.asm free3d04
|
||||
if not exist free3d04 ( @pause )
|
||||
@@ -1,6 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix en_US >lang.inc
|
||||
@fasm end.asm end
|
||||
@kpack end
|
||||
@fasm free3d04.asm free3d04
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -1,6 +1,5 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix ru_RU >lang.inc
|
||||
@fasm end.asm end
|
||||
@kpack end
|
||||
@fasm free3d04.asm free3d04
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -9,10 +9,9 @@
|
||||
;
|
||||
; Compile with FASM for Menuet (requires .INC files - see DATA Section)
|
||||
;
|
||||
; Willow - greatly srinked code size by using packed texture and FPU to calculate sine table
|
||||
; Willow - greatly srinked code size by using GIF texture and FPU to calculate sine table
|
||||
;
|
||||
; Textures are stored as a single 64x512 PNG embedded into the binary and
|
||||
; decoded at startup with libimg.
|
||||
; !!!! Don't use GIF_LITE.INC in your apps - it's modified for FREE3D !!!!
|
||||
;
|
||||
; Heavyiron - new 0-function of drawing window from kolibri (do not work correctly with menuet)
|
||||
|
||||
@@ -39,17 +38,15 @@ use32
|
||||
dd APP_MEM;0x100000 ; memory for app
|
||||
dd APP_MEM;0x100000 ; esp
|
||||
dd 0x0 , 0x0 ; I_Param , I_Icon
|
||||
include 'lang.inc'
|
||||
include '..\..\macros.inc'
|
||||
include '..\..\proc32.inc'
|
||||
include '..\..\dll.inc'
|
||||
include '..\..\develop\libraries\libs-dev\libimg\libimg.inc'
|
||||
COLOR_ORDER equ OTHER
|
||||
include 'gif_lite.inc'
|
||||
|
||||
START: ; start of execution
|
||||
mcall 68,11 ; init heap, libimg needs it
|
||||
stdcall dll.Load,@IMPORT
|
||||
test eax,eax
|
||||
jnz finish
|
||||
call load_textures
|
||||
mov esi,textures
|
||||
mov edi,ceil-8
|
||||
call ReadGIF
|
||||
mov esi,sinus
|
||||
mov ecx,360*10
|
||||
fninit
|
||||
@@ -294,34 +291,6 @@ m_right: ; turn right
|
||||
mcall
|
||||
|
||||
|
||||
; *********************************************
|
||||
; ******* LOAD TEXTURES ********
|
||||
; *********************************************
|
||||
; Decodes the embedded 64x512 PNG (8 stacked 64x64 tiles) into the raw
|
||||
; 0x00RRGGBB texture bank at [ceil].
|
||||
|
||||
load_textures:
|
||||
invoke img.decode,textures,textures.size,0
|
||||
test eax,eax
|
||||
jz finish
|
||||
mov ebx,eax
|
||||
invoke img.convert,ebx,0,Image.bpp32,0,0
|
||||
push eax
|
||||
invoke img.destroy,ebx
|
||||
pop ebx
|
||||
test ebx,ebx
|
||||
jz finish
|
||||
mov esi,[ebx+Image.Data]
|
||||
mov edi,ceil
|
||||
mov ecx,TEX_SIZE*8/4
|
||||
.copy:
|
||||
lodsd
|
||||
and eax,0x00FFFFFF ; drop alpha, the renderer stores 32 bit dwords
|
||||
stosd ; into a 24 bit image buffer
|
||||
loop .copy
|
||||
invoke img.destroy,ebx
|
||||
ret
|
||||
|
||||
; *********************************************
|
||||
; ******* WINDOW DEFINITIONS AND DRAW ********
|
||||
; *********************************************
|
||||
@@ -1011,21 +980,13 @@ dd 0x0001FFFF ; initial player position * 0xFFFF
|
||||
vpy:
|
||||
dd 0x0001FFFF
|
||||
|
||||
title db 'Fisheye Raycasting Engine Etc. FREE3D',0
|
||||
title db 'FISHEYE RAYCASTING ENGINE ETC. FREE3D',0
|
||||
|
||||
sindegree dd 0.0
|
||||
sininc dd 0.0017453292519943295769236907684886
|
||||
sindiv dd 6553.5
|
||||
textures:
|
||||
file 'texture.png'
|
||||
.size = $ - textures
|
||||
|
||||
align 16
|
||||
@IMPORT:
|
||||
|
||||
library libimg , 'libimg.obj'
|
||||
|
||||
import libimg , libimg.init , 'lib_init' , img.decode , 'img_decode' , img.convert , 'img_convert', img.destroy , 'img_destroy'
|
||||
file 'texture.gif'
|
||||
|
||||
align 4
|
||||
|
||||
|
||||
@@ -0,0 +1,487 @@
|
||||
; GIF LITE v3.0 by Willow
|
||||
; Written in pure assembler by Ivushkin Andrey aka Willow
|
||||
; Modified by Diamond
|
||||
;
|
||||
; This include file will contain functions to handle GIF image format
|
||||
;
|
||||
; Created: August 15, 2004
|
||||
; Last changed: June 24, 2007
|
||||
|
||||
; Requires kglobals.inc (iglobal/uglobal macro)
|
||||
; (program must 'include "kglobals.inc"' and say 'IncludeUGlobal'
|
||||
; somewhere in uninitialized data area).
|
||||
|
||||
; Configuration: [changed from program which includes this file]
|
||||
; 1. The constant COLOR_ORDER: must be one of
|
||||
; PALETTE - for 8-bit image with palette (sysfunction 65)
|
||||
; MENUETOS - for MenuetOS and KolibriOS color order (sysfunction 7)
|
||||
; OTHER - for standard color order
|
||||
; 2. Define constant GIF_SUPPORT_INTERLACED if you want to support interlaced
|
||||
; GIFs.
|
||||
; 3. Single image mode vs multiple image mode:
|
||||
; if the program defines the variable 'gif_img_count' of type dword
|
||||
; somewhere, ReadGIF will enter multiple image mode: gif_img_count
|
||||
; will be initialized with image count, output format is GIF_list,
|
||||
; the function GetGIFinfo retrieves Nth image info. Otherwise, ReadGIF
|
||||
; uses single image mode: exit after end of first image, output is
|
||||
; <dd width,height, times width*height[*3] db image>
|
||||
|
||||
if ~ (COLOR_ORDER in <PALETTE,MENUETOS,OTHER>)
|
||||
; This message may not appear under MenuetOS, so watch...
|
||||
display 'Please define COLOR_ORDER: PALETTE, MENUETOS or OTHER',13,10
|
||||
end if
|
||||
|
||||
if defined gif_img_count
|
||||
; virtual structure, used internally
|
||||
|
||||
struct GIF_list
|
||||
NextImg rd 1
|
||||
Left rw 1
|
||||
Top rw 1
|
||||
Width rw 1
|
||||
Height rw 1
|
||||
Delay rd 1
|
||||
Displacement rd 1 ; 0 = not specified
|
||||
; 1 = do not dispose
|
||||
; 2 = restore to background color
|
||||
; 3 = restore to previous
|
||||
if COLOR_ORDER eq PALETTE
|
||||
Image rd 1
|
||||
end if
|
||||
ends
|
||||
|
||||
struct GIF_info
|
||||
Left rw 1
|
||||
Top rw 1
|
||||
Width rw 1
|
||||
Height rw 1
|
||||
Delay rd 1
|
||||
Displacement rd 1
|
||||
if COLOR_ORDER eq PALETTE
|
||||
Palette rd 1
|
||||
end if
|
||||
ends
|
||||
|
||||
; ****************************************
|
||||
; FUNCTION GetGIFinfo - retrieve Nth image info
|
||||
; ****************************************
|
||||
; in:
|
||||
; esi - pointer to image list header
|
||||
; ecx - image_index (0...img_count-1)
|
||||
; edi - pointer to GIF_info structure to be filled
|
||||
|
||||
; out:
|
||||
; eax - pointer to RAW data, or 0, if error
|
||||
|
||||
GetGIFinfo:
|
||||
push esi ecx edi
|
||||
xor eax,eax
|
||||
jecxz .eloop
|
||||
.lp:
|
||||
mov esi,[esi]
|
||||
test esi,esi
|
||||
jz .error
|
||||
loop .lp
|
||||
.eloop:
|
||||
lodsd
|
||||
movsd
|
||||
movsd
|
||||
movsd
|
||||
movsd
|
||||
if COLOR_ORDER eq PALETTE
|
||||
lodsd
|
||||
mov [edi],esi
|
||||
else
|
||||
mov eax,esi
|
||||
end if
|
||||
.error:
|
||||
pop edi ecx esi
|
||||
ret
|
||||
|
||||
end if
|
||||
|
||||
_null fix 0x1000
|
||||
|
||||
; ****************************************
|
||||
; FUNCTION ReadGIF - unpacks GIF image
|
||||
; ****************************************
|
||||
; in:
|
||||
; esi - pointer to GIF file in memory
|
||||
; edi - pointer to output image list
|
||||
|
||||
; out:
|
||||
; eax - 0, all OK;
|
||||
; eax - 1, invalid signature;
|
||||
; eax >=8, unsupported image attributes
|
||||
;
|
||||
|
||||
ReadGIF:
|
||||
push esi edi
|
||||
mov [.cur_info],edi
|
||||
xor eax,eax
|
||||
mov [.globalColor],eax
|
||||
if defined gif_img_count
|
||||
mov [gif_img_count],eax
|
||||
mov [.anim_delay],eax
|
||||
mov [.anim_disp],eax
|
||||
end if
|
||||
inc eax
|
||||
cmp dword[esi],'GIF8'
|
||||
jne .ex ; signature
|
||||
mov ecx,[esi+0xa]
|
||||
add esi,0xd
|
||||
mov edi,esi
|
||||
test cl,cl
|
||||
jns .nextblock
|
||||
mov [.globalColor],esi
|
||||
call .Gif_skipmap
|
||||
.nextblock:
|
||||
cmp byte[edi],0x21
|
||||
jne .noextblock
|
||||
inc edi
|
||||
if defined gif_img_count
|
||||
cmp byte[edi],0xf9 ; Graphic Control Ext
|
||||
jne .no_gc
|
||||
movzx eax,word [edi+3]
|
||||
mov [.anim_delay],eax
|
||||
mov al,[edi+2]
|
||||
shr al,2
|
||||
and eax,7
|
||||
mov [.anim_disp],eax
|
||||
add edi,7
|
||||
jmp .nextblock
|
||||
.no_gc:
|
||||
end if
|
||||
inc edi
|
||||
.block_skip:
|
||||
movzx eax,byte[edi]
|
||||
lea edi,[edi+eax+1]
|
||||
test eax,eax
|
||||
jnz .block_skip
|
||||
jmp .nextblock
|
||||
.noextblock:
|
||||
mov al,8
|
||||
cmp byte[edi],0x2c ; image beginning
|
||||
jne .ex
|
||||
if defined gif_img_count
|
||||
inc [gif_img_count]
|
||||
end if
|
||||
inc edi
|
||||
mov esi,[.cur_info]
|
||||
if defined gif_img_count
|
||||
add esi,4
|
||||
end if
|
||||
xchg esi,edi
|
||||
if defined GIF_SUPPORT_INTERLACED
|
||||
movzx ecx,word[esi+4]
|
||||
mov [.width],ecx
|
||||
movzx eax,word[esi+6]
|
||||
imul eax,ecx
|
||||
if ~(COLOR_ORDER eq PALETTE)
|
||||
lea eax,[eax*3]
|
||||
end if
|
||||
mov [.img_end],eax
|
||||
inc eax
|
||||
mov [.row_end],eax
|
||||
and [.pass],0
|
||||
test byte[esi+8],40h
|
||||
jz @f
|
||||
if ~(COLOR_ORDER eq PALETTE)
|
||||
lea ecx,[ecx*3]
|
||||
end if
|
||||
mov [.row_end],ecx
|
||||
@@:
|
||||
end if
|
||||
if defined gif_img_count
|
||||
movsd
|
||||
movsd
|
||||
mov eax,[.anim_delay]
|
||||
stosd
|
||||
mov eax,[.anim_disp]
|
||||
stosd
|
||||
else
|
||||
movzx eax,word[esi+4]
|
||||
stosd
|
||||
movzx eax,word[esi+6]
|
||||
stosd
|
||||
add esi,8
|
||||
end if
|
||||
push edi
|
||||
mov ecx,[esi]
|
||||
inc esi
|
||||
test cl,cl
|
||||
js .uselocal
|
||||
push [.globalColor]
|
||||
mov edi,esi
|
||||
jmp .setPal
|
||||
.uselocal:
|
||||
call .Gif_skipmap
|
||||
push esi
|
||||
.setPal:
|
||||
movzx ecx,byte[edi]
|
||||
inc ecx
|
||||
mov [.codesize],ecx
|
||||
dec ecx
|
||||
if ~(COLOR_ORDER eq PALETTE)
|
||||
pop [.Palette]
|
||||
end if
|
||||
lea esi,[edi+1]
|
||||
mov edi,.gif_workarea
|
||||
xor eax,eax
|
||||
lodsb ; eax - block_count
|
||||
add eax,esi
|
||||
mov [.block_ofs],eax
|
||||
mov [.bit_count],8
|
||||
mov eax,1
|
||||
shl eax,cl
|
||||
mov [.CC],eax
|
||||
mov ecx,eax
|
||||
inc eax
|
||||
mov [.EOI],eax
|
||||
mov eax, _null shl 16
|
||||
.filltable:
|
||||
stosd
|
||||
inc eax
|
||||
loop .filltable
|
||||
if COLOR_ORDER eq PALETTE
|
||||
pop eax
|
||||
pop edi
|
||||
push edi
|
||||
scasd
|
||||
push esi
|
||||
mov esi,eax
|
||||
mov ecx,[.CC]
|
||||
@@:
|
||||
lodsd
|
||||
dec esi
|
||||
bswap eax
|
||||
shr eax,8
|
||||
stosd
|
||||
loop @b
|
||||
pop esi
|
||||
pop eax
|
||||
mov [eax],edi
|
||||
else
|
||||
pop edi
|
||||
end if
|
||||
if defined GIF_SUPPORT_INTERLACED
|
||||
mov [.img_start],edi
|
||||
add [.img_end],edi
|
||||
add [.row_end],edi
|
||||
end if
|
||||
.reinit:
|
||||
mov edx,[.EOI]
|
||||
inc edx
|
||||
push [.codesize]
|
||||
pop [.compsize]
|
||||
call .Gif_get_sym
|
||||
cmp eax,[.CC]
|
||||
je .reinit
|
||||
call .Gif_output
|
||||
.cycle:
|
||||
movzx ebx,ax
|
||||
call .Gif_get_sym
|
||||
cmp eax,edx
|
||||
jae .notintable
|
||||
cmp eax,[.CC]
|
||||
je .reinit
|
||||
cmp eax,[.EOI]
|
||||
je .end
|
||||
call .Gif_output
|
||||
.add:
|
||||
mov dword [.gif_workarea+edx*4],ebx
|
||||
cmp edx,0xFFF
|
||||
jae .cycle
|
||||
inc edx
|
||||
bsr ebx,edx
|
||||
cmp ebx,[.compsize]
|
||||
jne .noinc
|
||||
inc [.compsize]
|
||||
.noinc:
|
||||
jmp .cycle
|
||||
.notintable:
|
||||
push eax
|
||||
mov eax,ebx
|
||||
call .Gif_output
|
||||
push ebx
|
||||
movzx eax,bx
|
||||
call .Gif_output
|
||||
pop ebx eax
|
||||
jmp .add
|
||||
.end:
|
||||
if defined GIF_SUPPORT_INTERLACED
|
||||
mov edi,[.img_end]
|
||||
end if
|
||||
if defined gif_img_count
|
||||
mov eax,[.cur_info]
|
||||
mov [eax],edi
|
||||
mov [.cur_info],edi
|
||||
add esi,2
|
||||
xchg esi,edi
|
||||
.nxt:
|
||||
cmp byte[edi],0
|
||||
jnz .continue
|
||||
inc edi
|
||||
jmp .nxt
|
||||
.continue:
|
||||
cmp byte[edi],0x3b
|
||||
jne .nextblock
|
||||
xchg esi,edi
|
||||
and dword [eax],0
|
||||
end if
|
||||
xor eax,eax
|
||||
.ex:
|
||||
pop edi esi
|
||||
ret
|
||||
|
||||
.Gif_skipmap:
|
||||
; in: ecx - image descriptor, esi - pointer to colormap
|
||||
; out: edi - pointer to area after colormap
|
||||
|
||||
and ecx,111b
|
||||
inc ecx ; color map size
|
||||
mov ebx,1
|
||||
shl ebx,cl
|
||||
lea ebx,[ebx*2+ebx]
|
||||
lea edi,[esi+ebx]
|
||||
ret
|
||||
|
||||
.Gif_get_sym:
|
||||
mov ecx,[.compsize]
|
||||
push ecx
|
||||
xor eax,eax
|
||||
.shift:
|
||||
ror byte[esi],1
|
||||
rcr eax,1
|
||||
dec [.bit_count]
|
||||
jnz .loop1
|
||||
inc esi
|
||||
cmp esi,[.block_ofs]
|
||||
jb .noblock
|
||||
push eax
|
||||
xor eax,eax
|
||||
lodsb
|
||||
test eax,eax
|
||||
jnz .nextbl
|
||||
mov eax,[.EOI]
|
||||
sub esi,2
|
||||
add esp,8
|
||||
jmp .exx
|
||||
.nextbl:
|
||||
add eax,esi
|
||||
mov [.block_ofs],eax
|
||||
pop eax
|
||||
.noblock:
|
||||
mov [.bit_count],8
|
||||
.loop1:
|
||||
loop .shift
|
||||
pop ecx
|
||||
rol eax,cl
|
||||
.exx:
|
||||
xor ecx,ecx
|
||||
ret
|
||||
|
||||
.Gif_output:
|
||||
push esi eax edx
|
||||
mov edx,.gif_workarea
|
||||
.next:
|
||||
push word[edx+eax*4]
|
||||
mov ax,word[edx+eax*4+2]
|
||||
inc ecx
|
||||
cmp ax,_null
|
||||
jnz .next
|
||||
shl ebx,16
|
||||
mov bx,[esp]
|
||||
.loop2:
|
||||
pop ax
|
||||
|
||||
if COLOR_ORDER eq PALETTE
|
||||
stosb
|
||||
else
|
||||
lea esi,[eax+eax*2]
|
||||
add esi,[.Palette]
|
||||
|
||||
if COLOR_ORDER eq MENUETOS
|
||||
mov esi,[esi]
|
||||
bswap esi
|
||||
shr esi,8
|
||||
mov [edi],esi
|
||||
add edi,3
|
||||
else
|
||||
movsb
|
||||
movsb
|
||||
movsb
|
||||
mov byte [edi],0
|
||||
inc edi
|
||||
end if
|
||||
end if
|
||||
|
||||
if defined GIF_SUPPORT_INTERLACED
|
||||
cmp edi,[.row_end]
|
||||
jb .norowend
|
||||
mov eax,[.width]
|
||||
if ~(COLOR_ORDER eq PALETTE)
|
||||
lea eax,[eax*3]
|
||||
end if
|
||||
push eax
|
||||
sub edi,eax
|
||||
add eax,eax
|
||||
cmp [.pass],3
|
||||
jz @f
|
||||
add eax,eax
|
||||
cmp [.pass],2
|
||||
jz @f
|
||||
add eax,eax
|
||||
@@:
|
||||
add edi,eax
|
||||
pop eax
|
||||
cmp edi,[.img_end]
|
||||
jb .nextrow
|
||||
mov edi,[.img_start]
|
||||
inc [.pass]
|
||||
add edi,eax
|
||||
cmp [.pass],3
|
||||
jz @f
|
||||
add edi,eax
|
||||
cmp [.pass],2
|
||||
jz @f
|
||||
add edi,eax
|
||||
add edi,eax
|
||||
@@:
|
||||
.nextrow:
|
||||
add eax,edi
|
||||
mov [.row_end],eax
|
||||
xor eax,eax
|
||||
.norowend:
|
||||
end if
|
||||
|
||||
loop .loop2
|
||||
pop edx eax esi
|
||||
ret
|
||||
|
||||
uglobal
|
||||
align 4
|
||||
ReadGIF.globalColor rd 1
|
||||
ReadGIF.cur_info rd 1 ; image table pointer
|
||||
ReadGIF.codesize rd 1
|
||||
ReadGIF.compsize rd 1
|
||||
ReadGIF.bit_count rd 1
|
||||
ReadGIF.CC rd 1
|
||||
ReadGIF.EOI rd 1
|
||||
if ~(COLOR_ORDER eq PALETTE)
|
||||
ReadGIF.Palette rd 1
|
||||
end if
|
||||
ReadGIF.block_ofs rd 1
|
||||
if defined GIF_SUPPORT_INTERLACED
|
||||
ReadGIF.row_end rd 1
|
||||
ReadGIF.img_end rd 1
|
||||
ReadGIF.img_start rd 1
|
||||
ReadGIF.pass rd 1
|
||||
ReadGIF.width rd 1
|
||||
end if
|
||||
if defined gif_img_count
|
||||
ReadGIF.anim_delay rd 1
|
||||
ReadGIF.anim_disp rd 1
|
||||
end if
|
||||
ReadGIF.gif_workarea rb 16*1024
|
||||
endg
|
||||
@@ -10,11 +10,11 @@ By Dieter Marfurt
|
||||
|
||||
--------------------------------------------
|
||||
|
||||
Format of the texture file:
|
||||
Format of texture include files:
|
||||
|
||||
texture.png - a 64*512 image holding the 8 textures of 64*64 pixels
|
||||
stacked vertically. It is embedded into the binary and decoded at
|
||||
startup with libimg.
|
||||
dd 0x00RRGGBB,0x00RRGGBB....
|
||||
|
||||
for 64*64 pixels.
|
||||
|
||||
Have fun!
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 14 KiB |
@@ -5,7 +5,7 @@ void shell_cls()
|
||||
__shell_init();
|
||||
if (__shell_is_init == __SHELL_INIT_OK)
|
||||
{
|
||||
__shell_shm->cmd = SHELL_CLS;
|
||||
*__shell_shm = SHELL_CLS;
|
||||
__SHELL_WAIT();
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ void shell_exit()
|
||||
{
|
||||
if (__shell_is_init == __SHELL_INIT_OK)
|
||||
{
|
||||
__shell_shm->cmd = SHELL_EXIT;
|
||||
*__shell_shm = SHELL_EXIT;
|
||||
__SHELL_WAIT();
|
||||
_ksys_shm_close(__shell_shm_name);
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@ unsigned shell_get_pid()
|
||||
__shell_init();
|
||||
if (__shell_is_init == __SHELL_INIT_OK)
|
||||
{
|
||||
__shell_shm->cmd = SHELL_PID;
|
||||
*__shell_shm = SHELL_PID;
|
||||
__SHELL_WAIT();
|
||||
memcpy(&pid, __shell_shm->data, sizeof(unsigned));
|
||||
memcpy(&pid, __shell_shm + 1, sizeof(unsigned));
|
||||
}
|
||||
|
||||
return pid;
|
||||
|
||||
@@ -6,10 +6,10 @@ char shell_getc()
|
||||
|
||||
if (__shell_is_init == __SHELL_INIT_OK)
|
||||
{
|
||||
__shell_shm->cmd = SHELL_GETC;
|
||||
*__shell_shm = SHELL_GETC;
|
||||
__SHELL_WAIT();
|
||||
|
||||
return __shell_shm->data[0];
|
||||
return *(__shell_shm + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -7,9 +7,9 @@ void shell_gets(char *str, int n)
|
||||
|
||||
if (__shell_is_init == __SHELL_INIT_OK)
|
||||
{
|
||||
__shell_shm->cmd = SHELL_GETS;
|
||||
*__shell_shm = SHELL_GETS;
|
||||
__SHELL_WAIT();
|
||||
|
||||
strncpy(str, __shell_shm->data, n);
|
||||
strncpy(str, __shell_shm + 1, n);
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
char app_name[13];
|
||||
char __shell_shm_name[32];
|
||||
struct shell_shm_buffer *__shell_shm = NULL;
|
||||
char *__shell_shm = NULL;
|
||||
enum __SHELL_INIT_STATE __shell_is_init = __SHELL_NOT_LOADED;
|
||||
|
||||
int __shell_shm_init()
|
||||
@@ -17,12 +17,12 @@ int __shell_shm_init()
|
||||
|
||||
_ksys_thread_info(&proc_info, -1);
|
||||
PID = proc_info.pid;
|
||||
strncpy(app_name, proc_info.name, sizeof(app_name) - 1);
|
||||
strncpy(app_name, (&proc_info)->name, 12);
|
||||
|
||||
itoa(PID, __shell_shm_name);
|
||||
strcat(__shell_shm_name, "-SHELL");
|
||||
|
||||
return _ksys_shm_open(__shell_shm_name, KSYS_SHM_OPEN_ALWAYS | KSYS_SHM_WRITE, sizeof(*__shell_shm), (char **)&__shell_shm);
|
||||
return _ksys_shm_open(__shell_shm_name, KSYS_SHM_OPEN_ALWAYS | KSYS_SHM_WRITE, SHELL_SHM_MAX, &__shell_shm);
|
||||
}
|
||||
|
||||
void __shell_init()
|
||||
|
||||
@@ -7,12 +7,12 @@
|
||||
|
||||
int shell_ping()
|
||||
{
|
||||
__shell_shm->cmd = SHELL_PING;
|
||||
*__shell_shm = SHELL_PING;
|
||||
|
||||
_ksys_thread_yield(); // hope shell is fast enough
|
||||
|
||||
size_t i = 0;
|
||||
while (__shell_shm->cmd != SHELL_OK)
|
||||
while (*__shell_shm != SHELL_OK)
|
||||
{
|
||||
if (i > (SHELL_PING_TIMEOUT / SHELL_PING_MIN_DELAY))
|
||||
{
|
||||
|
||||
@@ -5,8 +5,8 @@ void shell_printf(const char *format, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
vsnprintf(__shell_shm->data, sizeof(__shell_shm->data), format, ap);
|
||||
__shell_shm->cmd = SHELL_PUTS;
|
||||
vsnprintf(__shell_shm + 1, SHELL_SHM_MAX, format, ap);
|
||||
*__shell_shm = SHELL_PUTS;
|
||||
va_end(ap);
|
||||
__SHELL_WAIT();
|
||||
}
|
||||
@@ -6,8 +6,8 @@ void shell_putc(char c)
|
||||
|
||||
if (__shell_is_init == __SHELL_INIT_OK)
|
||||
{
|
||||
__shell_shm->data[0] = c;
|
||||
__shell_shm->cmd = SHELL_PUTC;
|
||||
*(__shell_shm + 1) = c;
|
||||
*__shell_shm = SHELL_PUTC;
|
||||
__SHELL_WAIT();
|
||||
}
|
||||
}
|
||||
@@ -6,16 +6,16 @@ void shell_write_string(const char *s, size_t len)
|
||||
__shell_init();
|
||||
if (__shell_is_init == __SHELL_INIT_OK)
|
||||
{
|
||||
if (len > sizeof(__shell_shm->data) - 1)
|
||||
if (len > SHELL_SHM_MAX - 1)
|
||||
{
|
||||
shell_write_string(s, sizeof(__shell_shm->data) - 1); // Outputs as much as it can.
|
||||
shell_write_string(s + (sizeof(__shell_shm->data) - 1), len - (sizeof(__shell_shm->data) - 1)); // Outputs the rest.
|
||||
shell_write_string(s, SHELL_SHM_MAX - 1); // Outputs as much as it can.
|
||||
shell_write_string(s + (SHELL_SHM_MAX - 1), len - (SHELL_SHM_MAX - 1)); // Outputs the rest.
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(__shell_shm->data, 0, sizeof(__shell_shm->data)); // without int shell show \t, \n, lose chars and other trash
|
||||
memcpy(__shell_shm->data, s, len);
|
||||
__shell_shm->cmd = SHELL_PUTS;
|
||||
memset(__shell_shm, 0, SHELL_SHM_MAX); // without int shell show \t, \n, lose chars and other trash
|
||||
memcpy(__shell_shm + 1, s, len);
|
||||
*__shell_shm = SHELL_PUTS;
|
||||
__SHELL_WAIT();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,17 +9,15 @@
|
||||
#define __EXTERN extern
|
||||
#endif
|
||||
|
||||
enum SHELL_API_COMMANDS {
|
||||
SHELL_OK = 0,
|
||||
SHELL_EXIT = 1,
|
||||
SHELL_PUTC = 2,
|
||||
SHELL_PUTS = 3,
|
||||
SHELL_GETC = 4,
|
||||
SHELL_GETS = 5,
|
||||
SHELL_CLS = 6,
|
||||
SHELL_PID = 7,
|
||||
SHELL_PING = 8
|
||||
};
|
||||
#define SHELL_OK 0
|
||||
#define SHELL_EXIT 1
|
||||
#define SHELL_PUTC 2
|
||||
#define SHELL_PUTS 3
|
||||
#define SHELL_GETC 4
|
||||
#define SHELL_GETS 5
|
||||
#define SHELL_CLS 6
|
||||
#define SHELL_PID 7
|
||||
#define SHELL_PING 8
|
||||
|
||||
#define SHELL_SHM_MAX 1024 * 16
|
||||
|
||||
@@ -30,22 +28,15 @@ enum __SHELL_INIT_STATE {
|
||||
__SHELL_INIT_FAILED = 3 // fail init shell
|
||||
};
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct shell_shm_buffer {
|
||||
uint8_t cmd;
|
||||
char data[SHELL_SHM_MAX - sizeof(((struct shell_shm_buffer*)NULL)->cmd)];
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
__EXTERN char __shell_shm_name[32];
|
||||
__EXTERN struct shell_shm_buffer* __shell_shm;
|
||||
__EXTERN char* __shell_shm;
|
||||
__EXTERN enum __SHELL_INIT_STATE __shell_is_init;
|
||||
__EXTERN void __shell_init();
|
||||
|
||||
#define __SHELL_WAIT() \
|
||||
do { \
|
||||
_ksys_thread_yield(); \
|
||||
} while (__shell_shm->cmd);
|
||||
} while (*__shell_shm);
|
||||
|
||||
__EXTERN int shell_ping();
|
||||
__EXTERN unsigned shell_get_pid();
|
||||
@@ -61,5 +52,4 @@ __EXTERN void shell_printf(const char* format, ...);
|
||||
__EXTERN void shell_write_string(const char* s, size_t len);
|
||||
|
||||
__EXTERN void shell_cls();
|
||||
|
||||
#endif
|
||||
@@ -913,7 +913,7 @@ static off_t get_fileinfo(struct reader *rds,char *buf)
|
||||
#define syncsafe_to_long(buf,res) \
|
||||
( \
|
||||
(((buf)[0]|(buf)[1]|(buf)[2]|(buf)[3]) & 0x80) ? 0 : \
|
||||
(res = (((unsigned long) (buf)[0]) << 21) \
|
||||
(res = (((unsigned long) (buf)[0]) << 27) \
|
||||
| (((unsigned long) (buf)[1]) << 14) \
|
||||
| (((unsigned long) (buf)[2]) << 7) \
|
||||
| ((unsigned long) (buf)[3]) \
|
||||
|
||||
@@ -1,263 +1,262 @@
|
||||
driverlist:
|
||||
db 'RTL8139',0 ; Realtek 8139
|
||||
dd 0x813910ec
|
||||
dd 0x813810ec
|
||||
dd 0x12111113
|
||||
dd 0x13601500
|
||||
dd 0x13604033
|
||||
dd 0x13001186
|
||||
dd 0x13401186
|
||||
dd 0xab0613d1
|
||||
dd 0xa1171259
|
||||
dd 0xa11e1259
|
||||
dd 0xab0614ea
|
||||
dd 0xab0714ea
|
||||
dd 0x123411db
|
||||
dd 0x91301432
|
||||
dd 0x101202ac
|
||||
dd 0x0106018a
|
||||
dd 0x1211126c
|
||||
dd 0x81391743
|
||||
dd 0x8139021b
|
||||
dd 0x0 ; end
|
||||
|
||||
db 'RTL8029',0 ; Realtek 8029 (PCI NE2000)
|
||||
dd 0x802910ec
|
||||
dd 0x0
|
||||
|
||||
db 'I8255X',0 ; Intel eepro100
|
||||
dd 0x10298086
|
||||
dd 0x10308086
|
||||
;dd 0x10318086
|
||||
;dd 0x10328086
|
||||
;dd 0x10338086
|
||||
;dd 0x10348086
|
||||
;dd 0x10388086
|
||||
dd 0x10398086
|
||||
;dd 0x103A8086
|
||||
;dd 0x103B8086
|
||||
;dd 0x103C8086
|
||||
;dd 0x103D8086
|
||||
;dd 0x103E8086
|
||||
;dd 0x10508086
|
||||
;dd 0x10518086
|
||||
;dd 0x10528086
|
||||
;dd 0x10538086
|
||||
;dd 0x10548086
|
||||
;dd 0x10558086
|
||||
;dd 0x10568086
|
||||
;dd 0x10578086
|
||||
;dd 0x10598086
|
||||
;dd 0x10648086
|
||||
;dd 0x10658086
|
||||
;dd 0x10668086
|
||||
;dd 0x10678086
|
||||
dd 0x10688086
|
||||
;dd 0x10698086
|
||||
;dd 0x106A8086
|
||||
;dd 0x106B8086
|
||||
;dd 0x10918086
|
||||
;dd 0x10928086
|
||||
;dd 0x10938086
|
||||
;dd 0x10948086
|
||||
;dd 0x10958086
|
||||
;dd 0x10fe8086
|
||||
dd 0x12098086
|
||||
dd 0x12298086
|
||||
dd 0x24498086
|
||||
;dd 0x24598086
|
||||
;dd 0x245D8086
|
||||
;dd 0x27DC8086
|
||||
dd 0x0
|
||||
|
||||
db 'RTL8169',0 ; Realtek 8169
|
||||
dd 0x816710ec
|
||||
dd 0x816810ec
|
||||
dd 0x816910ec
|
||||
dd 0x011616ec
|
||||
dd 0x43001186
|
||||
dd 0x813610ec
|
||||
dd 0x0
|
||||
|
||||
db '3C59X',0 ; 3Com 59x
|
||||
dd 0x590010b7
|
||||
dd 0x592010b7
|
||||
dd 0x597010b7
|
||||
dd 0x595010b7
|
||||
dd 0x595110b7
|
||||
dd 0x595210b7
|
||||
dd 0x900010b7
|
||||
dd 0x900110b7
|
||||
dd 0x900410b7
|
||||
dd 0x900510b7
|
||||
dd 0x900610b7
|
||||
dd 0x900A10b7
|
||||
dd 0x905010b7
|
||||
dd 0x905110b7
|
||||
dd 0x905510b7
|
||||
dd 0x905810b7
|
||||
dd 0x905A10b7
|
||||
dd 0x920010b7
|
||||
dd 0x980010b7
|
||||
dd 0x980510b7
|
||||
dd 0x764610b7
|
||||
dd 0x505510b7
|
||||
dd 0x605510b7
|
||||
dd 0x605610b7
|
||||
dd 0x5b5710b7
|
||||
dd 0x505710b7
|
||||
dd 0x515710b7
|
||||
dd 0x525710b7
|
||||
dd 0x656010b7
|
||||
dd 0x656210b7
|
||||
dd 0x656410b7
|
||||
dd 0x450010b7
|
||||
dd 0x0
|
||||
|
||||
db 'SIS900',0
|
||||
dd 0x09001039
|
||||
dd 0x70161039
|
||||
dd 0x0
|
||||
|
||||
db 'PCNET32',0
|
||||
dd 0x20001022
|
||||
dd 0x26251022
|
||||
dd 0x20011022
|
||||
dd 0x0
|
||||
|
||||
db 'FORCEDETH',0 ; nVidia nForce
|
||||
dd 0x006610de
|
||||
dd 0x01c310de
|
||||
dd 0x00D610de
|
||||
dd 0x008610de
|
||||
dd 0x008c10de
|
||||
dd 0x00e610de
|
||||
dd 0x00df10de
|
||||
dd 0x005610de
|
||||
dd 0x005710de
|
||||
dd 0x003710de
|
||||
dd 0x003810de
|
||||
dd 0x026810de
|
||||
dd 0x026910de
|
||||
dd 0x037210de
|
||||
dd 0x037310de
|
||||
dd 0x03e510de
|
||||
dd 0x03e610de
|
||||
dd 0x03ee10de
|
||||
dd 0x03ef10de
|
||||
dd 0x045010de
|
||||
dd 0x045110de
|
||||
dd 0x045210de
|
||||
dd 0x045310de
|
||||
dd 0x054c10de
|
||||
dd 0x054d10de
|
||||
dd 0x054e10de
|
||||
dd 0x054f10de
|
||||
dd 0x07dc10de
|
||||
dd 0x07dd10de
|
||||
dd 0x07de10de
|
||||
dd 0x07df10de
|
||||
dd 0x076010de
|
||||
dd 0x076110de
|
||||
dd 0x076210de
|
||||
dd 0x076310de
|
||||
dd 0x0ab010de
|
||||
dd 0x0ab110de
|
||||
dd 0x0ab210de
|
||||
dd 0x0ab310de
|
||||
dd 0x0d7d10de
|
||||
dd 0x0
|
||||
|
||||
db 'MTD80X',0 ; Myson / Surecom
|
||||
dd 0x08031516
|
||||
dd 0x08001516
|
||||
dd 0x08911516
|
||||
dd 0x0
|
||||
|
||||
db 'DEC21X4X',0
|
||||
dd 0x00021011
|
||||
dd 0x00091011
|
||||
dd 0x00141011
|
||||
dd 0x00191011
|
||||
dd 0x000211AD
|
||||
dd 0x051210D9
|
||||
dd 0x053110D9
|
||||
dd 0x1400125B
|
||||
dd 0x09851317
|
||||
dd 0x0
|
||||
|
||||
db 'R6040',0 ; eBox integrated network
|
||||
dd 0x604017F3
|
||||
dd 0x0
|
||||
|
||||
db 'I8254X',0
|
||||
dd 0x10008086 ; 82542 (Fiber)
|
||||
dd 0x10018086 ; 82543GC (Fiber)
|
||||
dd 0x10048086 ; 82543GC (Copper)
|
||||
dd 0x10088086 ; 82544EI (Copper)
|
||||
dd 0x10098086 ; 82544EI (Fiber)
|
||||
dd 0x100A8086 ; 82540EM
|
||||
dd 0x100C8086 ; 82544GC (Copper)
|
||||
dd 0x100D8086 ; 82544GC (LOM)
|
||||
dd 0x100E8086 ; 82540EM
|
||||
dd 0x100F8086 ; 82545EM (Copper)
|
||||
dd 0x10108086 ; 82546EB (Copper)
|
||||
dd 0x10118086 ; 82545EM (Fiber)
|
||||
dd 0x10128086 ; 82546EB (Fiber)
|
||||
dd 0x10138086 ; 82541EI
|
||||
dd 0x10148086 ; 82541ER
|
||||
dd 0x10158086 ; 82540EM (LOM)
|
||||
dd 0x10168086 ; 82540EP (Mobile)
|
||||
dd 0x10178086 ; 82540EP
|
||||
dd 0x10188086 ; 82541EI
|
||||
dd 0x10198086 ; 82547EI
|
||||
dd 0x101a8086 ; 82547EI (Mobile)
|
||||
dd 0x101d8086 ; 82546EB
|
||||
dd 0x101e8086 ; 82540EP (Mobile)
|
||||
dd 0x10268086 ; 82545GM
|
||||
dd 0x10278086 ; 82545GM
|
||||
dd 0x10288086 ; 82545GM
|
||||
dd 0x105b8086 ; 82546GB (Copper)
|
||||
dd 0x10758086 ; 82547GI
|
||||
dd 0x10768086 ; 82541GI
|
||||
dd 0x10778086 ; 82541GI
|
||||
dd 0x10788086 ; 82541ER
|
||||
dd 0x10798086 ; 82546GB
|
||||
dd 0x107a8086 ; 82546GB
|
||||
dd 0x107b8086 ; 82546GB
|
||||
dd 0x107c8086 ; 82541PI
|
||||
dd 0x10b58086 ; 82546GB (Copper)
|
||||
dd 0x11078086 ; 82544EI
|
||||
dd 0x11128086 ; 82544GC
|
||||
dd 0x15A18086 ; I218-V
|
||||
dd 0x0
|
||||
|
||||
db 'RHINE', 0 ; VIA Rhine
|
||||
dd 0x30431106
|
||||
dd 0x61001106
|
||||
dd 0x30651106
|
||||
dd 0x31061106
|
||||
dd 0x30531106
|
||||
dd 0x0
|
||||
|
||||
db 'AR81XX', 0
|
||||
dd 0x10631969 ; AR8131
|
||||
;dd 0x10621969 ; AR8132
|
||||
;dd 0x10731969 ; AR8151 V1
|
||||
;dd 0x10831969 ; AR8151 V2
|
||||
;dd 0x20601969 ; AR8152 V1
|
||||
dd 0x20621969 ; AR8152 V2
|
||||
dd 0x10911969 ; AR8161
|
||||
;dd 0xe0911969 ; E2200
|
||||
;dd 0xe0a11969 ; E2400
|
||||
;dd 0xe0b11969 ; E2500
|
||||
dd 0x10901969 ; AR8162
|
||||
dd 0x10A11969 ; AR8171 (QCA8171)
|
||||
dd 0x10A01969 ; AR8172 (QCA8172)
|
||||
dd 0x0
|
||||
|
||||
db 'MAR_YUK2',0
|
||||
dd 0x436311AB ; 88E8055
|
||||
dd 0x0
|
||||
|
||||
dd 0x0 ; driverlist end
|
||||
driverlist:
|
||||
db 'RTL8139',0 ; Realtek 8139
|
||||
dd 0x813910ec
|
||||
dd 0x813810ec
|
||||
dd 0x12111113
|
||||
dd 0x13601500
|
||||
dd 0x13604033
|
||||
dd 0x13001186
|
||||
dd 0x13401186
|
||||
dd 0xab0613d1
|
||||
dd 0xa1171259
|
||||
dd 0xa11e1259
|
||||
dd 0xab0614ea
|
||||
dd 0xab0714ea
|
||||
dd 0x123411db
|
||||
dd 0x91301432
|
||||
dd 0x101202ac
|
||||
dd 0x0106018a
|
||||
dd 0x1211126c
|
||||
dd 0x81391743
|
||||
dd 0x8139021b
|
||||
dd 0x0 ; end
|
||||
|
||||
db 'RTL8029',0 ; Realtek 8029 (PCI NE2000)
|
||||
dd 0x802910ec
|
||||
dd 0x0
|
||||
|
||||
db 'I8255X',0 ; Intel eepro100
|
||||
dd 0x10298086
|
||||
dd 0x10308086
|
||||
;dd 0x10318086
|
||||
;dd 0x10328086
|
||||
;dd 0x10338086
|
||||
;dd 0x10348086
|
||||
;dd 0x10388086
|
||||
dd 0x10398086
|
||||
;dd 0x103A8086
|
||||
;dd 0x103B8086
|
||||
;dd 0x103C8086
|
||||
;dd 0x103D8086
|
||||
;dd 0x103E8086
|
||||
;dd 0x10508086
|
||||
;dd 0x10518086
|
||||
;dd 0x10528086
|
||||
;dd 0x10538086
|
||||
;dd 0x10548086
|
||||
;dd 0x10558086
|
||||
;dd 0x10568086
|
||||
;dd 0x10578086
|
||||
;dd 0x10598086
|
||||
;dd 0x10648086
|
||||
;dd 0x10658086
|
||||
;dd 0x10668086
|
||||
;dd 0x10678086
|
||||
dd 0x10688086
|
||||
;dd 0x10698086
|
||||
;dd 0x106A8086
|
||||
;dd 0x106B8086
|
||||
;dd 0x10918086
|
||||
;dd 0x10928086
|
||||
;dd 0x10938086
|
||||
;dd 0x10948086
|
||||
;dd 0x10958086
|
||||
;dd 0x10fe8086
|
||||
dd 0x12098086
|
||||
dd 0x12298086
|
||||
dd 0x24498086
|
||||
;dd 0x24598086
|
||||
;dd 0x245D8086
|
||||
;dd 0x27DC8086
|
||||
dd 0x0
|
||||
|
||||
db 'RTL8169',0 ; Realtek 8169
|
||||
dd 0x816710ec
|
||||
dd 0x816810ec
|
||||
dd 0x816910ec
|
||||
dd 0x011616ec
|
||||
dd 0x43001186
|
||||
dd 0x813610ec
|
||||
dd 0x0
|
||||
|
||||
db '3C59X',0 ; 3Com 59x
|
||||
dd 0x590010b7
|
||||
dd 0x592010b7
|
||||
dd 0x597010b7
|
||||
dd 0x595010b7
|
||||
dd 0x595110b7
|
||||
dd 0x595210b7
|
||||
dd 0x900010b7
|
||||
dd 0x900110b7
|
||||
dd 0x900410b7
|
||||
dd 0x900510b7
|
||||
dd 0x900610b7
|
||||
dd 0x900A10b7
|
||||
dd 0x905010b7
|
||||
dd 0x905110b7
|
||||
dd 0x905510b7
|
||||
dd 0x905810b7
|
||||
dd 0x905A10b7
|
||||
dd 0x920010b7
|
||||
dd 0x980010b7
|
||||
dd 0x980510b7
|
||||
dd 0x764610b7
|
||||
dd 0x505510b7
|
||||
dd 0x605510b7
|
||||
dd 0x605610b7
|
||||
dd 0x5b5710b7
|
||||
dd 0x505710b7
|
||||
dd 0x515710b7
|
||||
dd 0x525710b7
|
||||
dd 0x656010b7
|
||||
dd 0x656210b7
|
||||
dd 0x656410b7
|
||||
dd 0x450010b7
|
||||
dd 0x0
|
||||
|
||||
db 'SIS900',0
|
||||
dd 0x09001039
|
||||
dd 0x70161039
|
||||
dd 0x0
|
||||
|
||||
db 'PCNET32',0
|
||||
dd 0x20001022
|
||||
dd 0x26251022
|
||||
dd 0x20011022
|
||||
dd 0x0
|
||||
|
||||
db 'FORCEDETH',0 ; nVidia nForce
|
||||
dd 0x006610de
|
||||
dd 0x01c310de
|
||||
dd 0x00D610de
|
||||
dd 0x008610de
|
||||
dd 0x008c10de
|
||||
dd 0x00e610de
|
||||
dd 0x00df10de
|
||||
dd 0x005610de
|
||||
dd 0x005710de
|
||||
dd 0x003710de
|
||||
dd 0x003810de
|
||||
dd 0x026810de
|
||||
dd 0x026910de
|
||||
dd 0x037210de
|
||||
dd 0x037310de
|
||||
dd 0x03e510de
|
||||
dd 0x03e610de
|
||||
dd 0x03ee10de
|
||||
dd 0x03ef10de
|
||||
dd 0x045010de
|
||||
dd 0x045110de
|
||||
dd 0x045210de
|
||||
dd 0x045310de
|
||||
dd 0x054c10de
|
||||
dd 0x054d10de
|
||||
dd 0x054e10de
|
||||
dd 0x054f10de
|
||||
dd 0x07dc10de
|
||||
dd 0x07dd10de
|
||||
dd 0x07de10de
|
||||
dd 0x07df10de
|
||||
dd 0x076010de
|
||||
dd 0x076110de
|
||||
dd 0x076210de
|
||||
dd 0x076310de
|
||||
dd 0x0ab010de
|
||||
dd 0x0ab110de
|
||||
dd 0x0ab210de
|
||||
dd 0x0ab310de
|
||||
dd 0x0d7d10de
|
||||
dd 0x0
|
||||
|
||||
db 'MTD80X',0 ; Myson / Surecom
|
||||
dd 0x08031516
|
||||
dd 0x08001516
|
||||
dd 0x08911516
|
||||
dd 0x0
|
||||
|
||||
db 'DEC21X4X',0
|
||||
dd 0x00021011
|
||||
dd 0x00091011
|
||||
dd 0x00141011
|
||||
dd 0x00191011
|
||||
dd 0x000211AD
|
||||
dd 0x051210D9
|
||||
dd 0x053110D9
|
||||
dd 0x1400125B
|
||||
dd 0x09851317
|
||||
dd 0x0
|
||||
|
||||
db 'R6040',0 ; eBox integrated network
|
||||
dd 0x604017F3
|
||||
dd 0x0
|
||||
|
||||
db 'I8254X',0
|
||||
dd 0x10008086 ; 82542 (Fiber)
|
||||
dd 0x10018086 ; 82543GC (Fiber)
|
||||
dd 0x10048086 ; 82543GC (Copper)
|
||||
dd 0x10088086 ; 82544EI (Copper)
|
||||
dd 0x10098086 ; 82544EI (Fiber)
|
||||
dd 0x100A8086 ; 82540EM
|
||||
dd 0x100C8086 ; 82544GC (Copper)
|
||||
dd 0x100D8086 ; 82544GC (LOM)
|
||||
dd 0x100E8086 ; 82540EM
|
||||
dd 0x100F8086 ; 82545EM (Copper)
|
||||
dd 0x10108086 ; 82546EB (Copper)
|
||||
dd 0x10118086 ; 82545EM (Fiber)
|
||||
dd 0x10128086 ; 82546EB (Fiber)
|
||||
dd 0x10138086 ; 82541EI
|
||||
dd 0x10148086 ; 82541ER
|
||||
dd 0x10158086 ; 82540EM (LOM)
|
||||
dd 0x10168086 ; 82540EP (Mobile)
|
||||
dd 0x10178086 ; 82540EP
|
||||
dd 0x10188086 ; 82541EI
|
||||
dd 0x10198086 ; 82547EI
|
||||
dd 0x101a8086 ; 82547EI (Mobile)
|
||||
dd 0x101d8086 ; 82546EB
|
||||
dd 0x101e8086 ; 82540EP (Mobile)
|
||||
dd 0x10268086 ; 82545GM
|
||||
dd 0x10278086 ; 82545GM
|
||||
dd 0x10288086 ; 82545GM
|
||||
dd 0x105b8086 ; 82546GB (Copper)
|
||||
dd 0x10758086 ; 82547GI
|
||||
dd 0x10768086 ; 82541GI
|
||||
dd 0x10778086 ; 82541GI
|
||||
dd 0x10788086 ; 82541ER
|
||||
dd 0x10798086 ; 82546GB
|
||||
dd 0x107a8086 ; 82546GB
|
||||
dd 0x107b8086 ; 82546GB
|
||||
dd 0x107c8086 ; 82541PI
|
||||
dd 0x10b58086 ; 82546GB (Copper)
|
||||
dd 0x11078086 ; 82544EI
|
||||
dd 0x11128086 ; 82544GC
|
||||
dd 0x15A18086 ; I218-V
|
||||
dd 0x0
|
||||
|
||||
db 'RHINE', 0 ; VIA Rhine
|
||||
dd 0x30431106
|
||||
dd 0x61001106
|
||||
dd 0x30651106
|
||||
dd 0x31061106
|
||||
dd 0x30531106
|
||||
dd 0x0
|
||||
|
||||
|
||||
db 'AR81XX', 0
|
||||
dd 0x10631969 ; AR8131
|
||||
;dd 0x10621969 ; AR8132
|
||||
;dd 0x10731969 ; AR8151 V1
|
||||
;dd 0x10831969 ; AR8151 V2
|
||||
;dd 0x20601969 ; AR8152 V1
|
||||
dd 0x20621969 ; AR8152 V2
|
||||
dd 0x10911969 ; AR8161
|
||||
;dd 0xe0911969 ; E2200
|
||||
;dd 0xe0a11969 ; E2400
|
||||
;dd 0xe0b11969 ; E2500
|
||||
dd 0x10901969 ; AR8162
|
||||
dd 0x10A11969 ; AR8171 (QCA8171)
|
||||
dd 0x10A01969 ; AR8172 (QCA8172)
|
||||
|
||||
|
||||
dd 0x0
|
||||
|
||||
dd 0x0 ; driverlist end
|
||||
@@ -202,8 +202,6 @@ mainloop:
|
||||
mov bh, byte[ebp + interface.number]
|
||||
mov bl, 7
|
||||
mcall 76 ; Number of IP conflicts
|
||||
cmp eax, -1
|
||||
je @f
|
||||
cmp eax, [ebp + interface.ip_conflicts]
|
||||
je @f
|
||||
mov [ebp + interface.ip_conflicts], eax
|
||||
@@ -217,8 +215,8 @@ mainloop:
|
||||
mov bh, byte[ebp + interface.number]
|
||||
mov bl, 0 ; Get device type
|
||||
mcall 74
|
||||
cmp eax, 1
|
||||
jne .link_down
|
||||
test eax, eax ; No device
|
||||
jz .link_down
|
||||
|
||||
; Check if link is still there
|
||||
mov bl, 10 ; Get Link status
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
if tup.getconfig("NO_FASM") ~= "" then return end
|
||||
tup.rule("end.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "end")
|
||||
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR")
|
||||
tup.include(HELPERDIR .. "/use_fasm.lua")
|
||||
tup.rule("end.asm", FASM .. " -dlang=" .. tup.getconfig("LANG") .. " %f %o " .. tup.getconfig("KPACK_CMD"), "end")
|
||||
@@ -1 +0,0 @@
|
||||
Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,Гh,╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl╟мl═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s═▓s╚и`пНBГh,Гh,╟мl╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯMЩ{7Гh,Гh,╟мl╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯMЩ{7Гh,Гh,╟мl╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯMЩ{7Гh,Гh,╟мl╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯM─ЯMЩ{7Гh,Гh,╟мl╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С:╢С9╖С7╕С5╕С5╕С5╕С5╕С5╖С7╡С:╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<╡С<Line truncated
|
||||
@@ -1,3 +0,0 @@
|
||||
@fasm end.asm end
|
||||
@kpack end
|
||||
@pause
|
||||
@@ -1,139 +1,302 @@
|
||||
; SPDX-License-Identifier: NOASSERTION
|
||||
;
|
||||
|
||||
; END - the shutdown dialog of KolibriOS
|
||||
;
|
||||
; END
|
||||
; Offers kernel restart / reboot / power off and optionally saves the
|
||||
; RAM-disk before leaving: when the "save changes" checkbox is on, the
|
||||
; image is written back to the boot medium (SF 18.6 with ecx = 0).
|
||||
; A failed save cancels the shutdown so the user never loses changes
|
||||
; silently.
|
||||
;
|
||||
; <diamond> note that 'mov al,xx' is shorter than 'mov eax,xx'
|
||||
; and if we know that high 24 bits of eax are zero, we can use 1st form
|
||||
; the same about ebx,ecx,edx
|
||||
;
|
||||
; 15.02.2007 merge old END with new one (fron Veliant & Leency) by Heavyiron
|
||||
; Authors: Veliant, Leency, Heavyiron, Burer
|
||||
|
||||
include "..\..\macros.inc"
|
||||
use32
|
||||
org 0
|
||||
|
||||
meos_app_start
|
||||
code
|
||||
db 'MENUET01'
|
||||
dd 1
|
||||
dd START
|
||||
dd IM_END
|
||||
dd I_END
|
||||
dd stacktop
|
||||
dd 0
|
||||
dd 0
|
||||
|
||||
draw:
|
||||
include '../../macros.inc'
|
||||
include '../../proc32.inc'
|
||||
include '../../dll.inc'
|
||||
include '../../KOSfuncs.inc'
|
||||
include '../../encoding.inc'
|
||||
include '../../gui_patterns.inc'
|
||||
include '../../string.inc'
|
||||
|
||||
mov al,12 ; eax=12 - tell os about redraw start
|
||||
mov ebx,1
|
||||
mcall
|
||||
WIN_W = 440
|
||||
WIN_H = 200
|
||||
BOT_PANEL_H = 70
|
||||
BUT_W = 116
|
||||
BUT_Y = WIN_H-60
|
||||
|
||||
mov al,14 ; eax=14 - get screen max x & max y
|
||||
mcall
|
||||
BTN_CANCEL = 1
|
||||
BTN_KERNEL = 2
|
||||
BTN_REBOOT = 3
|
||||
BTN_POWEROFF = 4
|
||||
BTN_CHECKBOX = 5
|
||||
|
||||
movzx ecx, ax
|
||||
shr eax, 16
|
||||
shr ecx, 1
|
||||
shr eax, 1
|
||||
sub eax, 157
|
||||
sub ecx, 100
|
||||
mov ebx, eax
|
||||
shl ebx, 16
|
||||
add ebx, 253
|
||||
shl ecx, 16
|
||||
add ecx, 154
|
||||
; mcall 18,9 shutdown codes
|
||||
SHUTDOWN_POWEROFF = 2
|
||||
SHUTDOWN_REBOOT = 3
|
||||
SHUTDOWN_KERNEL = 4
|
||||
|
||||
xor eax,eax ; define and draw window
|
||||
mov edx,0x41ffffff
|
||||
mcall
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
mov al, 7
|
||||
mov ebx, background
|
||||
mov ecx, 254 shl 16 + 155
|
||||
xor edx, edx
|
||||
mcall
|
||||
START:
|
||||
mcall SF_SYS_MISC, SSF_HEAP_INIT
|
||||
mcall SF_SYS_MISC, SSF_MEM_OPEN, checkbox_sharedname
|
||||
mov [checkbox_img], eax
|
||||
|
||||
stdcall dll.Load, importLib
|
||||
test eax, eax
|
||||
jnz .no_ini ; no libini - live without autosave
|
||||
inc [ini_ok]
|
||||
invoke ini_get_int, ini_file, ini_sec, key_autosave, 0
|
||||
mov [autosave], eax
|
||||
.no_ini:
|
||||
|
||||
mov al,8
|
||||
mcall ,58 shl 16 + 32,59 shl 16 + 34, 1 shl 30 + 1
|
||||
inc edx
|
||||
mcall ,110 shl 16 + 32,54 shl 16 + 32
|
||||
inc edx
|
||||
mcall ,161 shl 16 + 32,59 shl 16 + 34
|
||||
inc edx
|
||||
mcall ,193 shl 16 + 43,125 shl 16 + 16,
|
||||
inc edx
|
||||
mcall ,144 shl 16 + 43
|
||||
|
||||
mov al,12 ;end of redraw
|
||||
mov ebx,2
|
||||
mcall
|
||||
redraw:
|
||||
call draw_window
|
||||
|
||||
still:
|
||||
mcall SF_WAIT_EVENT
|
||||
dec eax
|
||||
jz redraw
|
||||
dec eax
|
||||
jz on_key
|
||||
|
||||
; button event
|
||||
mcall SF_GET_BUTTON
|
||||
shr eax, 8
|
||||
cmp eax, BTN_CANCEL
|
||||
je exit
|
||||
cmp eax, BTN_KERNEL
|
||||
je restart_kernel
|
||||
cmp eax, BTN_REBOOT
|
||||
je reboot
|
||||
cmp eax, BTN_POWEROFF
|
||||
je power_off
|
||||
cmp eax, BTN_CHECKBOX
|
||||
je toggle_checkbox
|
||||
jmp still
|
||||
|
||||
mov eax,10 ; wait here for event
|
||||
mcall
|
||||
on_key:
|
||||
mcall SF_GET_KEY
|
||||
cmp ah, 13 ; Enter
|
||||
je reboot
|
||||
cmp ah, 19 ; Ctrl+S
|
||||
je toggle_checkbox
|
||||
cmp ah, 180 ; Home
|
||||
je restart_kernel
|
||||
cmp ah, 181 ; End
|
||||
je power_off
|
||||
cmp ah, 27 ; Esc
|
||||
jne still
|
||||
|
||||
dec eax
|
||||
jz draw
|
||||
dec eax
|
||||
jnz button
|
||||
key:
|
||||
mov al,2 ; now eax=2 - get key code
|
||||
mcall
|
||||
mov al,ah
|
||||
cmp al,13
|
||||
jz restart
|
||||
cmp al,27
|
||||
jz close_1
|
||||
cmp al,180
|
||||
jz restart_kernel
|
||||
cmp al,181
|
||||
jz power_off
|
||||
jmp still
|
||||
exit:
|
||||
mcall SF_TERMINATE_PROCESS
|
||||
|
||||
button:
|
||||
mov al,17 ; now eax=17 - get pressed button id
|
||||
mcall
|
||||
xchg al,ah
|
||||
dec eax
|
||||
jz restart_kernel
|
||||
dec eax
|
||||
jz power_off
|
||||
dec eax
|
||||
jz restart
|
||||
dec eax
|
||||
jnz run_rdsave
|
||||
; we have only one button left, this is close button
|
||||
; dec eax
|
||||
; jnz still
|
||||
close_1:
|
||||
or eax,-1
|
||||
mcall
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
power_off:
|
||||
push 2
|
||||
jmp mcall_and_close
|
||||
power_off:
|
||||
mov [shutdown_code], SHUTDOWN_POWEROFF
|
||||
jmp save_and_shutdown
|
||||
|
||||
restart:
|
||||
push 3
|
||||
jmp mcall_and_close
|
||||
reboot:
|
||||
mov [shutdown_code], SHUTDOWN_REBOOT
|
||||
jmp save_and_shutdown
|
||||
|
||||
restart_kernel:
|
||||
push 4
|
||||
mcall_and_close:
|
||||
pop ecx
|
||||
mcall 18,9
|
||||
jmp close_1
|
||||
restart_kernel:
|
||||
mov [shutdown_code], SHUTDOWN_KERNEL
|
||||
|
||||
run_rdsave:
|
||||
mov eax,70
|
||||
mov ebx,rdsave
|
||||
mcall
|
||||
jmp still
|
||||
save_and_shutdown:
|
||||
cmp [ini_ok], 0
|
||||
je @f
|
||||
invoke ini_set_int, ini_file, ini_sec, key_autosave, [autosave]
|
||||
|
||||
@@:
|
||||
cmp [autosave], 1
|
||||
jne .shutdown
|
||||
|
||||
data
|
||||
background file 'back.raw'
|
||||
rdsave:
|
||||
dd 7
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
dd 0
|
||||
db '/sys/rdsave',0
|
||||
udata
|
||||
mcall SF_DRAW_TEXT, <55,108>, 0x90FF990A, TEXT_SAVING
|
||||
|
||||
meos_app_end
|
||||
mcall SF_SYSTEM, SSF_RD_TO_HDD, 0 ; save back to the boot medium
|
||||
test eax, eax
|
||||
jz .shutdown
|
||||
|
||||
.save_failed: ; the image is not saved - cancel the shutdown
|
||||
call draw_window
|
||||
mcall SF_DRAW_TEXT, <55,108>, 0x90FF5050, TEXT_SAVE_FAILED
|
||||
jmp still
|
||||
|
||||
.shutdown:
|
||||
mcall SF_SYSTEM, SSF_SHUTDOWN, [shutdown_code]
|
||||
mcall SF_TERMINATE_PROCESS
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
toggle_checkbox:
|
||||
xor [autosave], 1
|
||||
call draw_checkbox
|
||||
jmp still
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
draw_window:
|
||||
mcall SF_REDRAW, SSF_BEGIN_DRAW
|
||||
|
||||
mcall SF_GET_SCREEN_SIZE
|
||||
movzx ecx, ax
|
||||
shr eax, 17
|
||||
shl eax, 16
|
||||
lea ebx, [eax-(WIN_W/2) shl 16+WIN_W-1]
|
||||
shr ecx, 1
|
||||
shl ecx, 16
|
||||
lea ecx, [ecx-(WIN_H/2) shl 16+WIN_H-1]
|
||||
xor eax, eax
|
||||
mov edx, 0x41000000
|
||||
mcall ; borderless window centered on the screen
|
||||
|
||||
DrawWideRectangle 0, 0, WIN_W, WIN_H, 2, 0xA3A7AA
|
||||
mcall SF_DRAW_RECT, <2,WIN_W-4>, <2,WIN_H-BOT_PANEL_H-2>, 0x202020
|
||||
mcall SF_DRAW_RECT, <2,WIN_W-4>, <WIN_H-BOT_PANEL_H-2,BOT_PANEL_H>, 0x4B4B4B
|
||||
|
||||
mcall SF_DRAW_TEXT, <30,21>, 0x91FFFFFF, TEXT_WTITLE
|
||||
mcall SF_DRAW_TEXT, <55,70>, 0x90FFFFFF, TEXT_RDSAVE1
|
||||
mcall SF_DRAW_TEXT, <55,86>, 0x90FFFFFF, TEXT_RDSAVE2
|
||||
mcall SF_DRAW_TEXT, <WIN_W-23,5>, 0x81FFFFFF, TEXT_CANCEL
|
||||
|
||||
mcall SF_DEFINE_BUTTON, <WIN_W-35,32>, <2,22>, BTN_CANCEL+BT_HIDE
|
||||
mcall SF_DEFINE_BUTTON, <32,14>, <70,14>, BTN_CHECKBOX+BT_HIDE
|
||||
mcall SF_DEFINE_BUTTON, <47,WIN_W-47>, <68,34>, BTN_CHECKBOX+BT_HIDE+BT_NOFRAME
|
||||
DrawRectangle3D 32, 70, 14, 14, 0x606060, 0xAFAFAF
|
||||
call draw_checkbox
|
||||
|
||||
stdcall shutdown_button, 20, 0x4E91C5, BTN_KERNEL, TEXT_KERNEL, TEXT_HOME
|
||||
stdcall shutdown_button, 160, 0x41C166, BTN_REBOOT, TEXT_REBOOT, TEXT_ENTER
|
||||
stdcall shutdown_button, 300, 0xC75C54, BTN_POWEROFF, TEXT_OFF, TEXT_END
|
||||
|
||||
mcall SF_REDRAW, SSF_END_DRAW
|
||||
ret
|
||||
|
||||
; one big colored button with a centered caption and a hotkey hint
|
||||
proc shutdown_button x:dword, bgcol:dword, id:dword, caption:dword, hotkey:dword
|
||||
mov ebx, [x]
|
||||
sub ebx, 3
|
||||
mcall SF_DRAW_RECT, <ebx,BUT_W+7>, <BUT_Y-3,43+6>, 0x202020
|
||||
mcall SF_DEFINE_BUTTON, <[x],BUT_W>, <BUT_Y,43-1>, [id], [bgcol]
|
||||
stdcall string.length, [caption]
|
||||
neg eax
|
||||
lea ebx, [eax*4+BUT_W/2] ; center the 8 px wide characters
|
||||
add ebx, [x]
|
||||
mcall SF_DRAW_TEXT, <ebx,BUT_Y+8>, 0x90FFFFFF, [caption]
|
||||
add ebx, 1 shl 16 ; draw twice for a bold effect
|
||||
mcall
|
||||
stdcall string.length, [hotkey]
|
||||
neg eax
|
||||
lea ebx, [eax*3+BUT_W/2] ; center the 6 px wide characters
|
||||
add ebx, [x]
|
||||
shl ebx, 16
|
||||
add ebx, BUT_Y+26
|
||||
mcall SF_DRAW_TEXT, , 0x80FFFFFF, [hotkey]
|
||||
ret
|
||||
endp
|
||||
|
||||
draw_checkbox:
|
||||
cmp [autosave], 0
|
||||
je .unset
|
||||
|
||||
cmp [checkbox_img], 0
|
||||
je .no_image
|
||||
|
||||
mcall SF_PUT_IMAGE, [checkbox_img], <13,13>, <33,71>
|
||||
ret
|
||||
|
||||
.no_image:
|
||||
mcall SF_DRAW_RECT, <33,13>, <71,13>, 0xFFFFFF
|
||||
mcall SF_DRAW_RECT, <34,11>, <72,11>, 0x58C33C
|
||||
ret
|
||||
|
||||
.unset:
|
||||
mcall SF_DRAW_RECT, <33,13>, <71,13>, 0xFFFFFF
|
||||
ret
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
;--- Data ----------------------------------------------------------
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
if lang eq ru_RU
|
||||
TEXT_WTITLE cp866 'Завершение работы',0
|
||||
TEXT_RDSAVE1 cp866 'Сохранить изменения, сделанные в',0
|
||||
TEXT_RDSAVE2 cp866 'процессе работы в системе (Ctrl+S)',0
|
||||
TEXT_KERNEL cp866 'Ядро',0
|
||||
TEXT_REBOOT cp866 'Перезагрузка',0
|
||||
TEXT_OFF cp866 'Выключение',0
|
||||
TEXT_SAVING cp866 'Сохранение образа...',0
|
||||
TEXT_SAVE_FAILED cp866 'Не удалось сохранить образ!',0
|
||||
else if lang eq es_ES
|
||||
TEXT_WTITLE cp850 'Apagar el equipo',0
|
||||
TEXT_RDSAVE1 cp850 'Guardar los cambios hechos durante',0
|
||||
TEXT_RDSAVE2 cp850 'la sesión de trabajo (Ctrl+S)',0
|
||||
TEXT_KERNEL cp850 'Núcleo',0
|
||||
TEXT_REBOOT cp850 'Reiniciar',0
|
||||
TEXT_OFF cp850 'Apagar',0
|
||||
TEXT_SAVING cp850 'Guardando la imagen...',0
|
||||
TEXT_SAVE_FAILED cp850 'No se pudo guardar la imagen!',0
|
||||
else ; Default to en_US
|
||||
TEXT_WTITLE db 'Shutdown computer',0
|
||||
TEXT_RDSAVE1 db 'Save all changes that were done',0
|
||||
TEXT_RDSAVE2 db 'during system work (Ctrl+S)',0
|
||||
TEXT_KERNEL db 'Kernel',0
|
||||
TEXT_REBOOT db 'Reboot',0
|
||||
TEXT_OFF db 'Power off',0
|
||||
TEXT_SAVING db 'Saving RAM-drive...',0
|
||||
TEXT_SAVE_FAILED db 'Failed to save the RAM-drive!',0
|
||||
end if
|
||||
|
||||
TEXT_HOME db 'Home',0
|
||||
TEXT_ENTER db 'Enter',0
|
||||
TEXT_END db 'End',0
|
||||
TEXT_CANCEL db 'x',0
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
ini_file db '/sys/settings/app.ini',0
|
||||
ini_sec db 'RDSave',0
|
||||
key_autosave db 'autosave',0
|
||||
|
||||
checkbox_sharedname db 'CHECKBOX',0
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
align 4
|
||||
importLib:
|
||||
library libini, 'libini.obj'
|
||||
|
||||
import libini, \
|
||||
ini_get_int, 'ini_get_int', \
|
||||
ini_set_int, 'ini_set_int'
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
IM_END:
|
||||
|
||||
align 4
|
||||
checkbox_img rd 1
|
||||
autosave rd 1
|
||||
ini_ok rd 1
|
||||
shutdown_code rd 1
|
||||
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
align 32
|
||||
rb 4096
|
||||
stacktop:
|
||||
I_END:
|
||||
@@ -1,7 +0,0 @@
|
||||
if tup.getconfig("NO_FASM") ~= "" then return end
|
||||
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../.." or tup.getconfig("HELPERDIR")
|
||||
tup.include(HELPERDIR .. "/use_fasm.lua")
|
||||
add_include(tup.getvariantdir())
|
||||
|
||||
tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en_US" or tup.getconfig("LANG")) .. " > %o", {"lang.inc"})
|
||||
tup.rule({"end.asm", extra_inputs = {"lang.inc"}}, FASM .. " %f %o " .. tup.getconfig("KPACK_CMD"), "end")
|
||||
@@ -1,6 +0,0 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix de_DE >lang.inc
|
||||
@fasm end.asm end
|
||||
@kpack end
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -1,6 +0,0 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix it_IT >lang.inc
|
||||
@fasm end.asm end
|
||||
@kpack end
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -1,71 +0,0 @@
|
||||
WIN_W = 440
|
||||
WIN_H = 200
|
||||
BOT_PANEL_H = 70
|
||||
;---------------------------------------------------------------------
|
||||
CANCEL_BUTTON_ID = 1+BT_HIDE
|
||||
HOME_BUTTON_ID = 2
|
||||
REBOOT_BUTTON_ID = 3
|
||||
POWEROFF_BUTTON_ID = 4
|
||||
CHECKBOX_BUTTON_ID = 5+BT_HIDE
|
||||
;---------------------------------------------------------------------
|
||||
TEXT_HOME: db 'Home',0
|
||||
TEXT_ENTER: db 'Enter',0
|
||||
TEXT_END: db 'End',0
|
||||
TEXT_CANCEL: db 'x',0
|
||||
;---------------------------------------------------------------------
|
||||
|
||||
; Language support for locales: ru_RU (CP866), de_DE, it_IT, en_US
|
||||
|
||||
if lang eq ru_RU
|
||||
TEXT_WTITLE: db 'Завершение работы',0
|
||||
TEXT_RDSAVE1: db 'Сохранить изменения, сделанные в',0
|
||||
TEXT_RDSAVE2: db 'процессе работы в системе (Ctrl+S)',0
|
||||
TEXT_KERNEL: db 'Ядро',0
|
||||
TEXT_REBOOT: db 'Перезагрузка',0
|
||||
TEXT_OFF: db 'Выключение',0
|
||||
TEXT_SAVING: db 'Сохранение образа...',0
|
||||
else if lang eq de_DE
|
||||
TEXT_WTITLE: db 'Shutdown computer',0
|
||||
TEXT_RDSAVE1: db 'Save all changes that were done',0
|
||||
TEXT_RDSAVE2: db 'during system work (Ctrl+S)',0
|
||||
TEXT_KERNEL: db 'Kernel',0
|
||||
TEXT_REBOOT: db 'Neustart',0
|
||||
TEXT_OFF: db 'Beenden',0
|
||||
TEXT_SAVING: db 'Saving RAM-drive...',0
|
||||
else if lang eq it_IT
|
||||
TEXT_WTITLE: db 'Shutdown computer',0
|
||||
TEXT_RDSAVE1: db 'Save all changes that were done',0
|
||||
TEXT_RDSAVE2: db 'during system work (Ctrl+S)',0
|
||||
TEXT_KERNEL: db 'Kernel',0
|
||||
TEXT_REBOOT: db 'Riavvio',0
|
||||
TEXT_OFF: db 'Spegni',0
|
||||
TEXT_SAVING: db 'Saving RAM-drive...',0
|
||||
else ; Default to en_US
|
||||
TEXT_WTITLE: db 'Shutdown computer',0
|
||||
TEXT_RDSAVE1: db 'Save all changes that were done',0
|
||||
TEXT_RDSAVE2: db 'during system work (Ctrl+S)',0
|
||||
TEXT_KERNEL: db 'Kernel',0
|
||||
TEXT_REBOOT: db 'Reboot',0
|
||||
TEXT_OFF: db 'Power off',0
|
||||
TEXT_SAVING: db 'Saving RAM-drive...',0
|
||||
end if
|
||||
;---------------------------------------------------------------------
|
||||
rdsave:
|
||||
dd SSF_START_APP,0,hide,0,0
|
||||
db '/sys/rdsave',0
|
||||
hide db 'h',0
|
||||
asettings db 'settings',0
|
||||
aautosave db 'autosave',0
|
||||
ini_file db '/sys/settings/rdsave.ini',0
|
||||
;---------------------------------------------------------------------
|
||||
importLib:
|
||||
library \
|
||||
libini, 'libini.obj'
|
||||
|
||||
import libini, \
|
||||
ini_set_int ,'ini_set_int', \
|
||||
ini_get_int ,'ini_get_int'
|
||||
;---------------------------------------------------------------------
|
||||
checkbox_sharedname db 'CHECKBOX',0
|
||||
checkbox_img dd ?
|
||||
;---------------------------------------------------------------------
|
||||
@@ -1,221 +0,0 @@
|
||||
; END
|
||||
; KolibriOS Team 2005-2021
|
||||
|
||||
use32 ; включить 32-битный режим ассемблера
|
||||
org 0x0 ; адресация с нуля
|
||||
|
||||
db 'MENUET01' ; 8-байтный идентификатор MenuetOS
|
||||
dd 0x01 ; версия заголовка (всегда 1)
|
||||
dd START ; адрес первой команды
|
||||
dd IM_END ; размер программы
|
||||
dd I_END ; количество памяти
|
||||
dd stacktop ; адрес вершины стека
|
||||
dd 0x0 ; адрес буфера для параметров
|
||||
dd 0x0
|
||||
|
||||
include 'lang.inc'
|
||||
include '../../../macros.inc'
|
||||
include '../../../proc32.inc'
|
||||
include '../../../dll.inc'
|
||||
include '../../../KOSfuncs.inc'
|
||||
include '../../../gui_patterns.inc'
|
||||
include '../../../string.inc'
|
||||
|
||||
START:
|
||||
mcall SF_SYS_MISC, SSF_HEAP_INIT
|
||||
mcall SF_SYS_MISC, SSF_MEM_OPEN, checkbox_sharedname
|
||||
mov [checkbox_img], eax
|
||||
|
||||
stdcall dll.Load,importLib
|
||||
or eax, eax
|
||||
jnz redraw
|
||||
|
||||
invoke ini_get_int,ini_file,asettings,aautosave,0
|
||||
mov [autosave],eax
|
||||
redraw:
|
||||
call draw_window
|
||||
still:
|
||||
mcall SF_WAIT_EVENT ;wait here for event
|
||||
dec eax
|
||||
jz redraw
|
||||
dec eax
|
||||
jz key
|
||||
dec eax
|
||||
jz button
|
||||
jmp still
|
||||
|
||||
key:
|
||||
mcall SF_GET_KEY ;get key code
|
||||
mov al,ah
|
||||
cmp al,13
|
||||
je restart
|
||||
cmp al,19
|
||||
je checkbox
|
||||
cmp al,180
|
||||
je restart_kernel
|
||||
cmp al,181
|
||||
je power_off
|
||||
cmp al,27
|
||||
jne still
|
||||
|
||||
close:
|
||||
mcall SF_TERMINATE_PROCESS
|
||||
|
||||
button:
|
||||
mcall SF_GET_BUTTON ;get pressed button id
|
||||
xchg al,ah
|
||||
dec eax
|
||||
jz close
|
||||
dec eax
|
||||
jz restart_kernel
|
||||
dec eax
|
||||
jz restart
|
||||
dec eax
|
||||
jnz checkbox
|
||||
|
||||
power_off:
|
||||
push 2
|
||||
jmp mcall_and_close
|
||||
|
||||
restart:
|
||||
push 3
|
||||
jmp mcall_and_close
|
||||
|
||||
restart_kernel:
|
||||
push 4
|
||||
|
||||
mcall_and_close:
|
||||
invoke ini_set_int,ini_file,asettings,aautosave,[autosave]
|
||||
cmp [autosave],1
|
||||
jne no_save
|
||||
|
||||
mcall SF_DRAW_TEXT,<55,108>,0x90FF990A,TEXT_SAVING
|
||||
|
||||
mcall SF_FILE,rdsave
|
||||
test eax,eax
|
||||
js no_save
|
||||
mov ecx,eax
|
||||
mcall SF_SYSTEM,SSF_GET_THREAD_SLOT
|
||||
mov ecx,eax
|
||||
@@:
|
||||
push ecx
|
||||
mcall SF_WAIT_EVENT_TIMEOUT,100
|
||||
dec eax
|
||||
jnz no_red
|
||||
call draw_window
|
||||
no_red:
|
||||
pop ecx
|
||||
mcall SF_THREAD_INFO,proc_info
|
||||
cmp [proc_info+50],9
|
||||
je no_save
|
||||
jmp @b
|
||||
no_save:
|
||||
pop ecx
|
||||
mcall SF_SYSTEM,SSF_SHUTDOWN
|
||||
mcall SF_TERMINATE_PROCESS
|
||||
ret
|
||||
|
||||
checkbox:
|
||||
cmp [autosave],1
|
||||
je .1
|
||||
mov [autosave],1
|
||||
jmp .draw
|
||||
.1:
|
||||
mov [autosave],0
|
||||
.draw:
|
||||
call draw_checkbox_flag
|
||||
jmp still
|
||||
|
||||
draw_window:
|
||||
mcall SF_REDRAW,SSF_BEGIN_DRAW
|
||||
|
||||
mcall SF_GET_SCREEN_SIZE
|
||||
movzx ecx,ax
|
||||
shr eax,17
|
||||
shl eax,16
|
||||
lea ebx,[eax-(WIN_W/2) shl 16+WIN_W-1]
|
||||
shr ecx,1
|
||||
shl ecx,16
|
||||
lea ecx,[ecx-(WIN_H/2) shl 16+WIN_H-1]
|
||||
|
||||
xor eax,eax
|
||||
mov edx, 0x41000000
|
||||
mcall ;define and draw window
|
||||
|
||||
DrawWideRectangle 0, 0, WIN_W, WIN_H, 2, 0xA3A7AA
|
||||
mcall SF_DRAW_RECT, <2,WIN_W-4>, <2,WIN_H-BOT_PANEL_H-2>, 0x202020
|
||||
mcall SF_DRAW_RECT, <2,WIN_W-4>, <WIN_H-BOT_PANEL_H-2,BOT_PANEL_H>, 0x4B4B4B
|
||||
|
||||
mcall SF_DRAW_TEXT, <30,21>, 0x91FFFfff, TEXT_WTITLE
|
||||
mcall SF_DRAW_TEXT, <55,70>, 0x90FFFfff, TEXT_RDSAVE1
|
||||
mcall SF_DRAW_TEXT, <55,86>, 0x90FFFfff, TEXT_RDSAVE2
|
||||
mcall SF_DRAW_TEXT, <WIN_W-23,5>, 0x81FFFfff, TEXT_CANCEL
|
||||
|
||||
mcall SF_DEFINE_BUTTON, <WIN_W-35,32>, <2,22>, CANCEL_BUTTON_ID
|
||||
mcall SF_DEFINE_BUTTON, <32,14>, <70,14>, CHECKBOX_BUTTON_ID
|
||||
mcall SF_DEFINE_BUTTON, <47,WIN_W-47>, <68,34>, CHECKBOX_BUTTON_ID+BT_NOFRAME
|
||||
DrawRectangle3D 32, 70, 14, 14, 0x606060, 0xAFAFAF
|
||||
call draw_checkbox_flag
|
||||
|
||||
stdcall EndButton, 20, 0x4E91C5, HOME_BUTTON_ID, TEXT_KERNEL, TEXT_HOME
|
||||
stdcall EndButton, 160, 0x41C166, REBOOT_BUTTON_ID, TEXT_REBOOT, TEXT_ENTER
|
||||
stdcall EndButton, 300, 0xC75C54, POWEROFF_BUTTON_ID, TEXT_OFF, TEXT_END
|
||||
|
||||
mcall SF_REDRAW,SSF_END_DRAW
|
||||
ret
|
||||
|
||||
proc EndButton x, bgcol, id, but_text, hotkey_text
|
||||
BUTY = WIN_H-60
|
||||
BUTW = 116
|
||||
mov ebx,[x]
|
||||
sub ebx,3
|
||||
mcall SF_DRAW_RECT, <ebx,BUTW+7>, <BUTY-3,43+6>, 0x202020
|
||||
mcall SF_DEFINE_BUTTON, <[x],BUTW>, <BUTY,43-1>, [id], [bgcol]
|
||||
; -strlen(but_text)*8 + BUTW / 2 + x, BUTY+8
|
||||
stdcall string.length, [but_text]
|
||||
neg eax
|
||||
lea ebx,[eax*4+BUTW/2]
|
||||
add ebx,[x]
|
||||
mcall SF_DRAW_TEXT, <ebx,BUTY+8>, 0x90FFFfff, [but_text]
|
||||
add ebx,1 shl 16
|
||||
mcall
|
||||
stdcall string.length, [hotkey_text]
|
||||
neg eax
|
||||
lea ebx,[eax*3+BUTW/2]
|
||||
add ebx,[x]
|
||||
shl ebx,16
|
||||
add ebx,BUTY+26
|
||||
mcall SF_DRAW_TEXT, , 0x80FFFfff, [hotkey_text]
|
||||
ret
|
||||
endp
|
||||
|
||||
draw_checkbox_flag:
|
||||
cmp [autosave],0
|
||||
je .flag_unset
|
||||
cmp [checkbox_img],0
|
||||
je .flag_set_but_no_checkbox_img
|
||||
.flag_set:
|
||||
mcall SF_PUT_IMAGE, [checkbox_img], <13,13>, <33,71>
|
||||
ret
|
||||
.flag_set_but_no_checkbox_img:
|
||||
mcall SF_DRAW_RECT, <33,13>, <71,13>, 0xffffff
|
||||
mcall SF_DRAW_RECT, <34,11>, <72,11>, 0x58C33C
|
||||
ret
|
||||
.flag_unset:
|
||||
mcall SF_DRAW_RECT, <33,13>, <71,13>, 0xFFFfff
|
||||
ret
|
||||
;---------------------------------------------------------------------
|
||||
include 'data.inc'
|
||||
;---------------------------------------------------------------------
|
||||
IM_END:
|
||||
;---------------------------------------------------------------------
|
||||
align 4
|
||||
proc_info rb 1024
|
||||
autosave rd 1
|
||||
;---------------------------------------------------------------------
|
||||
library_path rb 4096
|
||||
;---------------------------------------------------------------------
|
||||
align 32
|
||||
rb 4096
|
||||
stacktop:
|
||||
I_END: ; метка конца программы
|
||||
@@ -1,29 +0,0 @@
|
||||
#!gmake
|
||||
|
||||
# Macro
|
||||
FASM=/opt/bin/fasm
|
||||
KPACK=/opt/bin/kpack
|
||||
LANG=lang.inc
|
||||
FILE=end
|
||||
SOURCE=${FILE}.asm
|
||||
OUT=${FILE}.bin
|
||||
|
||||
en:
|
||||
echo "lang fix en_US" > ${LANG}
|
||||
${FASM} ${SOURCE} ${OUT}
|
||||
${KPACK} ${OUT}
|
||||
de:
|
||||
echo "lang fix de_DE" > ${LANG}
|
||||
${FASM} ${SOURCE} ${OUT}
|
||||
${KPACK} ${OUT}
|
||||
ru:
|
||||
echo "lang fix ru_RU" > ${LANG}
|
||||
${FASM} ${SOURCE} ${OUT}
|
||||
${KPACK} ${OUT}
|
||||
it:
|
||||
echo "lang fix it_IT" > ${LANG}
|
||||
${FASM} ${SOURCE} ${OUT}
|
||||
${KPACK} ${OUT}
|
||||
|
||||
clean:
|
||||
rm -f ${LANG} ${OUT}
|
||||
@@ -1,7 +1,4 @@
|
||||
if tup.getconfig("NO_FASM") ~= "" then return end
|
||||
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR")
|
||||
tup.include(HELPERDIR .. "/use_fasm.lua")
|
||||
add_include(tup.getvariantdir())
|
||||
|
||||
tup.rule("echo lang fix " .. ((tup.getconfig("LANG") == "") and "en_US" or tup.getconfig("LANG")) .. " > %o", {"lang.inc"})
|
||||
tup.rule({"rdsave.asm", extra_inputs = {"lang.inc"}}, FASM .. " %f %o " .. tup.getconfig("KPACK_CMD"), "rdsave")
|
||||
tup.rule("rdsave.asm", FASM .. " -dlang=" .. tup.getconfig("LANG") .. " %f %o " .. tup.getconfig("KPACK_CMD"), "rdsave")
|
||||
@@ -1,4 +0,0 @@
|
||||
[RDSave]
|
||||
path=/usbhd0/1/kolibri.img
|
||||
autoclose=0
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/bin/bash
|
||||
# This script does for linux the same as build.bat for DOS,
|
||||
# it compiles the KoOS kernel, hopefully ;-)
|
||||
|
||||
echo "lang fix en_US"
|
||||
echo "lang fix en_US" > lang.inc
|
||||
fasm -m 16384 rdsave.asm rdsave
|
||||
rm -f lang.inc
|
||||
exit 0
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix en_US >lang.inc
|
||||
@fasm rdsave.asm rdsave
|
||||
@kpack rdsave
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -1,6 +0,0 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix et_EE >lang.inc
|
||||
@fasm rdsave.asm rdsave
|
||||
@kpack rdsave
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -1,6 +0,0 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix it_IT >lang.inc
|
||||
@fasm rdsave.asm rdsave
|
||||
@kpack rdsave
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -1,6 +0,0 @@
|
||||
@erase lang.inc
|
||||
@echo lang fix ru_RU >lang.inc
|
||||
@fasm rdsave.asm rdsave
|
||||
@kpack rdsave
|
||||
@erase lang.inc
|
||||
@pause
|
||||
@@ -1,25 +0,0 @@
|
||||
#!gmake
|
||||
|
||||
# Macro
|
||||
FASM=/opt/bin/fasm
|
||||
KPACK=/opt/bin/kpack
|
||||
LANG=lang.inc
|
||||
FILE=rdsave
|
||||
SOURCE=${FILE}.asm
|
||||
OUT=${FILE}.bin
|
||||
|
||||
en:
|
||||
echo "lang fix en_US" > ${LANG}
|
||||
${FASM} ${SOURCE} ${OUT}
|
||||
ru:
|
||||
echo "lang fix ru_RU" > ${LANG}
|
||||
${FASM} ${SOURCE} ${OUT}
|
||||
it:
|
||||
echo "lang fix it_IT" > ${LANG}
|
||||
${FASM} ${SOURCE} ${OUT}
|
||||
et:
|
||||
echo "lang fix et_EE" > ${LANG}
|
||||
${FASM} ${SOURCE} ${OUT}
|
||||
|
||||
clean:
|
||||
rm -f ${LANG} ${OUT}
|
||||
@@ -1,120 +0,0 @@
|
||||
; by ManHunter / PCL
|
||||
; http://www.manhunter.ru
|
||||
;-----------------------------------------------------
|
||||
; Функция получения длины строки (Fast)
|
||||
;-----------------------------------------------------
|
||||
; lpStr - указатель на строку ASCIIZ
|
||||
; На выходе: EAX - длина строки без учета завершающего
|
||||
; нулевого байта
|
||||
;-----------------------------------------------------
|
||||
;proc _lstrlen lpStr:DWORD
|
||||
; mov eax, [lpStr]
|
||||
; sub eax, 4
|
||||
;@@:
|
||||
; add eax, 4
|
||||
; cmp byte [eax], 0
|
||||
; je .szlen_lb1
|
||||
; cmp byte [eax+1], 0
|
||||
; je .szlen_lb2
|
||||
; cmp byte [eax+2], 0
|
||||
; je .szlen_lb3
|
||||
; cmp byte [eax+3], 0
|
||||
; jne @b
|
||||
; sub eax, [lpStr]
|
||||
; add eax, 3
|
||||
; ret
|
||||
;.szlen_lb3:
|
||||
; sub eax, [lpStr]
|
||||
; add eax, 2
|
||||
; ret
|
||||
;.szlen_lb2:
|
||||
; sub eax, [lpStr]
|
||||
; add eax, 1
|
||||
; ret
|
||||
;.szlen_lb1:
|
||||
; sub eax, [lpStr]
|
||||
; ret
|
||||
;endp
|
||||
|
||||
;-----------------------------------------------------
|
||||
; Функция получения длины строки
|
||||
;-----------------------------------------------------
|
||||
; lpStr - указатель на строку ASCIIZ
|
||||
; На выходе: EAX - длина строки без учета завершающего
|
||||
; нулевого байта
|
||||
;-----------------------------------------------------
|
||||
proc _lstrlen lpStr:DWORD
|
||||
mov eax, [lpStr]
|
||||
@@: inc eax
|
||||
cmp byte [eax], 0
|
||||
jne @b
|
||||
sub eax, [lpStr]
|
||||
ret
|
||||
endp
|
||||
;-----------------------------------------------------
|
||||
; Функция быстрого слияния двух строк
|
||||
; используются функции _lstrlen, _lstrcpy
|
||||
;-----------------------------------------------------
|
||||
; lpDst - указатель на исходную строку ASCIIZ
|
||||
; lpSrc - указатель на добавляемую строку ASCIIZ
|
||||
;-----------------------------------------------------
|
||||
proc _lstrcat lpDst:DWORD, lpSrc:DWORD
|
||||
pusha
|
||||
|
||||
stdcall _lstrlen,[lpDst]
|
||||
add eax,[lpDst]
|
||||
|
||||
stdcall _lstrcpy,eax,[lpSrc]
|
||||
|
||||
popa
|
||||
ret
|
||||
endp
|
||||
|
||||
;-----------------------------------------------------
|
||||
; Функция быстрого копирования строки
|
||||
; используются функции _lstrlen, _memcopy
|
||||
;-----------------------------------------------------
|
||||
; lpDst - указатель на приемник
|
||||
; lpSrc - указатель на строку ASCIIZ
|
||||
;-----------------------------------------------------
|
||||
proc _lstrcpy lpDst:DWORD, lpSrc:DWORD
|
||||
pusha
|
||||
|
||||
stdcall _lstrlen,[lpSrc]
|
||||
inc eax
|
||||
stdcall _memcopy,[lpDst],[lpSrc],eax
|
||||
|
||||
popa
|
||||
ret
|
||||
endp
|
||||
|
||||
;-----------------------------------------------------
|
||||
; Функция быстрого копирования участка памяти
|
||||
;-----------------------------------------------------
|
||||
; lpDst - указатель на приемник
|
||||
; lpSrc - указатель на источник
|
||||
; dSize - размер копируемого блока
|
||||
;-----------------------------------------------------
|
||||
proc _memcopy lpDst:DWORD, lpSrc:DWORD, dSize:DWORD
|
||||
pusha
|
||||
|
||||
; Установить указатели на источник и приемник
|
||||
cld
|
||||
mov edi,[lpDst]
|
||||
mov esi,[lpSrc]
|
||||
|
||||
mov ecx,[dSize]
|
||||
push ecx
|
||||
; Разделить на 4 и получить длину в DWORD
|
||||
shr ecx,2
|
||||
; Скопировать основную часть строки DWORD'ами
|
||||
rep movsd
|
||||
pop ecx
|
||||
; Получить остаток от деления на 4
|
||||
and ecx,3
|
||||
; Скопировать остаток строки байтами
|
||||
rep movsb
|
||||
|
||||
popa
|
||||
ret
|
||||
endp
|
||||
@@ -1,9 +1,10 @@
|
||||
#include <shell_api.h>
|
||||
|
||||
#include "../program_console.h"
|
||||
|
||||
|
||||
int program_console(int pid) {
|
||||
char name[32];
|
||||
struct shell_shm_buffer *buffer;
|
||||
char *buffer;
|
||||
char *buf1k;
|
||||
int result;
|
||||
int i;
|
||||
@@ -32,55 +33,55 @@ int program_console(int pid) {
|
||||
|
||||
is_end = 0;
|
||||
for (;;) {
|
||||
command = buffer->cmd;
|
||||
|
||||
command = *(buffer);
|
||||
|
||||
switch (command) {
|
||||
case SHELL_EXIT:
|
||||
buffer->cmd = SHELL_OK;
|
||||
case SC_EXIT:
|
||||
*buffer = SC_OK;
|
||||
is_end = 1;
|
||||
break;
|
||||
|
||||
case SHELL_OK:
|
||||
|
||||
case SC_OK:
|
||||
kol_sleep(5);
|
||||
break;
|
||||
|
||||
case SHELL_CLS:
|
||||
case SC_CLS:
|
||||
con_cls();
|
||||
buffer->cmd = SHELL_OK;
|
||||
*buffer = SC_OK;
|
||||
break;
|
||||
|
||||
case SC_PUTC:
|
||||
printf("%c", *(buffer+1));
|
||||
*buffer = SC_OK;
|
||||
break;
|
||||
|
||||
case SHELL_PUTC:
|
||||
printf("%c", buffer->data[0]);
|
||||
buffer->cmd = SHELL_OK;
|
||||
case SC_PUTS:
|
||||
printf("%s", buffer+1 );
|
||||
*buffer = SC_OK;
|
||||
break;
|
||||
|
||||
case SC_GETC:
|
||||
*(buffer+1) = (char) getch() ;
|
||||
*buffer = SC_OK;
|
||||
break;
|
||||
|
||||
case SHELL_PUTS:
|
||||
printf("%s", &buffer->data );
|
||||
buffer->cmd = SHELL_OK;
|
||||
break;
|
||||
|
||||
case SHELL_GETC:
|
||||
buffer->data[0] = (char) getch() ;
|
||||
buffer->cmd = SHELL_OK;
|
||||
break;
|
||||
|
||||
case SHELL_GETS:
|
||||
gets(buffer->data, size - 2);
|
||||
buffer->cmd = SHELL_OK;
|
||||
break;
|
||||
|
||||
case SHELL_PID:
|
||||
case SC_GETS:
|
||||
gets(buffer+1, size-2);
|
||||
*buffer = SC_OK;
|
||||
break;
|
||||
|
||||
case SC_PID:
|
||||
buf1k=malloc(1024);
|
||||
kol_process_info(-1, buf1k);
|
||||
memcpy(buffer->data, buf1k+30, sizeof(unsigned));
|
||||
buffer->cmd = SHELL_OK;
|
||||
memcpy(buffer+1, buf1k+30, sizeof(unsigned));
|
||||
*buffer = SC_OK;
|
||||
free(buf1k);
|
||||
break;
|
||||
|
||||
case SHELL_PING:
|
||||
buffer->cmd = SHELL_OK;
|
||||
|
||||
case SC_PING:
|
||||
*buffer = SC_OK;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
printf (CON_APP_ERROR);
|
||||
return 0;
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
if tup.getconfig("NO_FASM") ~= "" then return end
|
||||
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../../../programs" or tup.getconfig("HELPERDIR")
|
||||
tup.include(HELPERDIR .. "/use_fasm.lua")
|
||||
add_include(tup.getvariantdir())
|
||||
|
||||
tup.rule("Zune.dtp.asm", 'fasm "%f" "%o"', "Zune.dtp")
|
||||
tup.rule({"Zune.asm", extra_inputs = {"Zune.dtp"}}, FASM .. ' "%f" "%o" ' .. tup.getconfig("KPACK_CMD"), "Zune.skn")
|
||||
@@ -1,31 +0,0 @@
|
||||
include 'skin.inc'
|
||||
|
||||
SKIN_PARAMS \
|
||||
height = bmp_base.height,\ ; skin height
|
||||
margins = [5:1:43:1],\ ; margins [left:top:right:bottom]
|
||||
colors active = [binner=0x292929:\ ; border inner color
|
||||
bouter=0x1B1B1B:\ ; border outer color
|
||||
bframe=0x858585],\ ; border frame color
|
||||
colors inactive = [binner=0x4C4C4C:\ ; border inner color
|
||||
bouter=0x1B1B1B:\ ; border outer color
|
||||
bframe=0x555555],\ ; border frame color
|
||||
dtp = 'Zune.dtp' ; dtp colors
|
||||
|
||||
SKIN_BUTTONS \
|
||||
close = [-23:4][18:18],\ ; buttons coordinates
|
||||
minimize = [-42:4][18:18] ; [left:top][width:height]
|
||||
|
||||
SKIN_BITMAPS \
|
||||
left active = bmp_left,\ ; skin bitmaps pointers
|
||||
left inactive = bmp_left1,\
|
||||
oper active = bmp_oper,\
|
||||
oper inactive = bmp_oper1,\
|
||||
base active = bmp_base,\
|
||||
base inactive = bmp_base1
|
||||
|
||||
BITMAP bmp_left ,'active/left.bmp' ; skin bitmaps
|
||||
BITMAP bmp_oper ,'active/oper.bmp'
|
||||
BITMAP bmp_base ,'active/base.bmp'
|
||||
BITMAP bmp_left1,'inactive/left.bmp'
|
||||
BITMAP bmp_oper1,'inactive/oper.bmp'
|
||||
BITMAP bmp_base1,'inactive/base.bmp'
|
||||
@@ -1,11 +0,0 @@
|
||||
;SYSTEM COLORS (.DTP) - COMPILE WITH FASM
|
||||
frame dd 0x8A8A8A
|
||||
grab dd 0x8A8A8A
|
||||
grab_button dd 0xC6C9CB
|
||||
grab_button_text dd 0xFFFFFF
|
||||
grab_text dd 0xFFFFFF
|
||||
work dd 0xE2E2E2
|
||||
work_button dd 0xFF732B
|
||||
work_button_text dd 0xFFFFFF
|
||||
work_text dd 0x000000
|
||||
work_graph dd 0x9D9D9D
|
||||
|
Before Width: | Height: | Size: 150 B |
|
Before Width: | Height: | Size: 438 B |
|
Before Width: | Height: | Size: 4.3 KiB |
@@ -1,4 +0,0 @@
|
||||
@del Zune.skn
|
||||
@fasm Zune.dtp.asm Zune.dtp
|
||||
@fasm Zune.asm Zune.skn
|
||||
@del Zune.dtp
|
||||
|
Before Width: | Height: | Size: 150 B |
|
Before Width: | Height: | Size: 438 B |
|
Before Width: | Height: | Size: 4.3 KiB |
@@ -1,239 +0,0 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; ;;
|
||||
;; Copyright (C) KolibriOS team 2004-2017. All rights reserved. ;;
|
||||
;; Distributed under terms of the GNU General Public License ;;
|
||||
;; ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;============================================================================
|
||||
; This file should be used to generate skins of new standard
|
||||
;============================================================================
|
||||
; skin file structure:
|
||||
;----------------------------------------------------------------------------
|
||||
; header:
|
||||
; dd 'SKIN'
|
||||
; dd = version (1 for now)
|
||||
; dd @ params
|
||||
; dd @ buttons
|
||||
; dd @ bitmaps
|
||||
; ...
|
||||
;----------------------------------------------------------------------------
|
||||
; NOTE: order of sections listed below is insignificant
|
||||
; since they're identified by pointer in above header
|
||||
;----------------------------------------------------------------------------
|
||||
; ...
|
||||
; params:
|
||||
; dd = skin height
|
||||
; dw = right margin
|
||||
; dw = left margin
|
||||
; dw = bottom margin
|
||||
; dw = top margin
|
||||
; dd = inner line color
|
||||
; dd = outer line color
|
||||
; dd = frame color
|
||||
; dd = dtp file size
|
||||
; ?? = dtp file itself
|
||||
; ...
|
||||
;----------------------------------------------------------------------------
|
||||
; ...
|
||||
; buttons:
|
||||
; dd = button type (1 = close, 2 = minimize)
|
||||
; dw = left button coord (could be negative)
|
||||
; dw = top button coord (could be negative)
|
||||
; dw = button width
|
||||
; dw = button height
|
||||
; ... etc for all buttons
|
||||
; dd = 0 (end of buttons list)
|
||||
; ...
|
||||
;----------------------------------------------------------------------------
|
||||
; ...
|
||||
; bitmaps:
|
||||
; dw = bitmap kind (1 = left, 2 = oper, 3 = base)
|
||||
; dw = bitmap type (1 = active, 0 = inactive)
|
||||
; dd @ bitmap
|
||||
; ... etc for all bitmaps
|
||||
; dd 0 (end of bitmaps list)
|
||||
; ...
|
||||
;----------------------------------------------------------------------------
|
||||
; ...
|
||||
; bitmap:
|
||||
; dd = bitmap width
|
||||
; dd = bitmap height
|
||||
; ?? = raw bitmap data
|
||||
; ... etc for all bitmaps
|
||||
; ...
|
||||
;============================================================================
|
||||
|
||||
dd 'SKIN',1,__params__,__buttons__,__bitmaps__
|
||||
|
||||
struc BITMAPFILEHEADER {
|
||||
.bfType dw ? ; WORD
|
||||
.bfSize dd ? ; DWORD
|
||||
.bfReserved1 dw ? ; WORD
|
||||
.bfReserved2 dw ? ; WORD
|
||||
.bfOffBits dd ? ; DWORD
|
||||
}
|
||||
|
||||
struc BITMAPINFOHEADER {
|
||||
.biSize dd ? ; DWORD
|
||||
.biWidth dd ? ; LONG
|
||||
.biHeight dd ? ; LONG
|
||||
.biPlanes dw ? ; WORD
|
||||
.biBitCount dw ? ; WORD
|
||||
.biCompression dd ? ; DWORD
|
||||
.biSizeImage dd ? ; DWORD
|
||||
.biXPelsPerMeter dd ? ; LONG
|
||||
.biYPelsPerMeter dd ? ; LONG
|
||||
.biClrUsed dd ? ; DWORD
|
||||
.biClrImportant dd ? ; DWORD
|
||||
}
|
||||
|
||||
struc _bmp {
|
||||
.h BITMAPFILEHEADER
|
||||
.i BITMAPINFOHEADER
|
||||
}
|
||||
virtual at 0
|
||||
_bmp _bmp
|
||||
end virtual
|
||||
|
||||
macro BITMAP _name*,_fname*
|
||||
{
|
||||
local w,h,a,r,g,b
|
||||
virtual at 0
|
||||
_file equ _#_name
|
||||
_file::
|
||||
file _fname
|
||||
end virtual
|
||||
load w dword from _file:_bmp.i.biWidth
|
||||
load h dword from _file:_bmp.i.biHeight
|
||||
load hsize dword from _file:_bmp.h.bfOffBits
|
||||
align 4
|
||||
label _name
|
||||
.width = w
|
||||
.height = h
|
||||
dd w,h
|
||||
a=hsize+(w*3+(w mod 4))*(h-1)
|
||||
size = $
|
||||
repeat h
|
||||
repeat w
|
||||
load r from _file:a+0
|
||||
load g from _file:a+1
|
||||
load b from _file:a+2
|
||||
db r,g,b
|
||||
a=a+3
|
||||
end repeat
|
||||
a=a-w*3*2-(w mod 4)
|
||||
end repeat
|
||||
}
|
||||
|
||||
macro define_colors name,[col,val]
|
||||
{
|
||||
common
|
||||
local a,b,c
|
||||
forward
|
||||
match =binner,col \{ a = val \}
|
||||
match =bouter,col \{ b = val \}
|
||||
match =bframe,col \{ c = val \}
|
||||
common
|
||||
name equ a,b,c
|
||||
}
|
||||
|
||||
macro SKIN_PARAMS [a]
|
||||
{
|
||||
common
|
||||
local _height,_margins,_colors,_colors_1,_dtp
|
||||
__params__:
|
||||
forward
|
||||
match qq == ww,a
|
||||
\{
|
||||
match =height,qq \\{ _height = ww \\}
|
||||
match =margins,qq \\{
|
||||
match [q1:q2:q3:q4],ww
|
||||
\\\{
|
||||
_margins equ q3,q1,q4,q2
|
||||
\\\}
|
||||
\\}
|
||||
match =colors =active,qq
|
||||
\\{
|
||||
match [q10==q11:q20==q21:q30==q31],ww
|
||||
\\\{
|
||||
define_colors _colors,q10,q11,q20,q21,q30,q31
|
||||
\\\}
|
||||
\\}
|
||||
match =colors =inactive,qq
|
||||
\\{
|
||||
match [q10==q11:q20==q21:q30==q31],ww
|
||||
\\\{
|
||||
define_colors _colors_1,q10,q11,q20,q21,q30,q31
|
||||
\\\}
|
||||
\\}
|
||||
match =dtp,qq \\{ _dtp equ ww \\}
|
||||
\}
|
||||
common
|
||||
dd _height
|
||||
dw _margins
|
||||
dd _colors,_colors_1
|
||||
dd @f - $ - 4
|
||||
file _dtp
|
||||
@@:
|
||||
}
|
||||
|
||||
macro SKIN_BUTTONS [a]
|
||||
{
|
||||
common
|
||||
local btn
|
||||
__buttons__:
|
||||
forward
|
||||
match qq == ww,a
|
||||
\{
|
||||
btn = 0
|
||||
match =close,qq \\{ btn = 1 \\}
|
||||
match =minimize,qq \\{ btn = 2 \\}
|
||||
match [q1:q2][q3:q4],ww
|
||||
\\{
|
||||
if btn <> 0
|
||||
dd btn
|
||||
dw q1,q2,q3,q4
|
||||
end if
|
||||
\\}
|
||||
\}
|
||||
common
|
||||
dd 0
|
||||
}
|
||||
|
||||
macro SKIN_BITMAPS [a]
|
||||
{
|
||||
common
|
||||
local bmp
|
||||
__bitmaps__:
|
||||
forward
|
||||
match qq == ww,a
|
||||
\{
|
||||
bmp=-1
|
||||
match qqq =active,qq \\{ bmp = 1 \\}
|
||||
match qqq =inactive,qq \\{ bmp = 0 \\}
|
||||
match =left qqq,qq
|
||||
\\{
|
||||
if bmp >= 0
|
||||
dw 1,bmp
|
||||
dd ww
|
||||
end if
|
||||
\\}
|
||||
match =oper qqq,qq
|
||||
\\{
|
||||
if bmp >= 0
|
||||
dw 2,bmp
|
||||
dd ww
|
||||
end if
|
||||
\\}
|
||||
match =base qqq,qq
|
||||
\\{
|
||||
if bmp >= 0
|
||||
dw 3,bmp
|
||||
dd ww
|
||||
end if
|
||||
\\}
|
||||
\}
|
||||
common
|
||||
dd 0
|
||||
}
|
||||
@@ -76,5 +76,4 @@ skinlist = {
|
||||
"_old/WindowsXP/WinXP Standard blue/WinXP Standard blue.skn",
|
||||
"_old/WindowsXP/WinXP Standard olive_green/WinXP Standard olive_green.skn",
|
||||
"_old/WindowsXP/WinXP Standard silver/WinXP Standard silver.skn",
|
||||
"Weronika_Saturday/Zune/Zune.skn",
|
||||
}
|
||||