-
Notifications
You must be signed in to change notification settings - Fork 0
/
sdio.inc
83 lines (64 loc) · 2.08 KB
/
sdio.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
;; Copyright (C) 2022-2024, Mikhail Frolov aka Doczom
;; SDIO subsystem SDHCI driver. Base functons for working.
; Ñïèñîê âíåøíèõ SDIO ìîäóëåé ÿäðà
sdio_drv_list:
dd sdio_drv_list
dd sdio_drv_list
struct SDIO_SERVICE
next rd 1
prev rd 1
sdio_func rd 1 ;ptr
ends
struct SDIO_SERVICE_FUNC
check_fbr rd 1
; stdcall void* check_fbr(SDHCI_SLOT* slot_str)
; Called for find driver to this card. Function rerturning
; DWORD or zero. Return value - pdata for calling func
int_handler rd 1
; stdcall int int_handler(void* pdata)
; This function calling in sdhc_irq() when geting
; card interrupt
close_card rd 1
; stdcall int close_card(void* pdata)
; Calling when card removed.
ends
export_sdio_api:
dd REG_SDIO_SERVICE
dd UNREG_SDIO_SERVICE
dd SCAN_SDIO_DEV
dd IO_RW_DIRECT ;cmd52
dd IO_RW_EXTENDED ; cmd53
proc REG_SDIO_SERVICE stdcall sdio_func: dword
; alloc new item list
mov eax, sizeof.SDIO_SERVICE
invoke Kmalloc
test eax, eax
jz .exit
mov ecx, [sdio_func]
mov [eax + SDIO_SERVICE.sdio_func], ecx
cli
mov ecx, [sdio_drv_list]
mov [eax], ecx
mov [eax + SDIO_SERVICE.prev], sdio_drv_list
mov [ecx + SDIO_SERVICE.prev], eax
mov [sdio_drv_list], eax
sti
.exit:
ret
endp
proc UNREG_SDIO_SERVICE stdcall sdio_hand: dword
; del in list
mov eax, [sdio_hand]
mov edx, [eax]
mov ecx, [eax + SDIO_SERVICE.prev]
mov [edx + SDIO_SERVICE.prev], ecx
mov [ecx], edx
; find all slots, using this service
; free struct
mov eax, [sdio_hand]
invoke Kfree
ret
endp
proc SCAN_SDIO_DEV stdcall sdio_hand: dword
ret
endp