Initial revision
[reactos.git] / reactos / doc / api.txt
1 This file attempts to document the functions made publically available by
2 the various subsystems.
3
4 * Formatted I/O operations *
5
6 NAME: int vsprintf(char *buf, const char *fmt, va_list args)
7 NAME: int sprintf(char* buf, const char* fmt, ...)
8 WHERE: internal/kernel.h
9 FUNCTION: The same as the standard c library versions
10
11 * PIO operations *
12
13 NAME: in[b/w/l](port)
14 WHERE: internal/io.h
15 FUNCTION: Read an IO port of the specified size (byte/word or long)
16 RETURNS: The value read
17
18 NAME: out[b/w/l](port,val)
19 WHERE: internal/io.h
20 FUNCTION: Write an IO port of the specified size (byte/word or long)
21
22 NAME: in_p[b/w/l](port)
23 WHERE: internal/io.h
24 FUNCTION: Read an IO port of the specified size (byte/word or long) with
25 a pause
26 RETURNS: The value read
27
28 NAME: out_p[b/w/l](port,val)
29 WHERE: internal/io.h
30 FUNCTION: Write an IO port of the specified size (byte/word or long) with
31 a pause
32
33 * Bit operations *
34
35 NAME: int set_bit(int nr, void* addr)
36 NAME: int clear_bit(int nr, void* addr)
37 NAME: int change_bit(int nr, void* addr)
38 WHERE: internal/bitops.h>
39 FUNCTION: Operate on a bit in the word pointed to by addr
40 RETURN: 0 if the bit was cleared before the operations
41 non-zero otherwise
42
43 * Debugging functions *
44
45 NAME: DPRINT(fmt,....)
46 WHERE: internal/debug.h
47 FUNCTION: Outputs a string to the console if NDEBUG isn't defined before
48 including internal/debug.h, a NOP otherwise
49 ARGUMENTS: The same as printf
50
51 NAME: printk
52 WHERE: internal/kernel.h
53 FUNCTION: Outputs a string to the console
54 ARGUMENTS: The same as printf
55
56 * Memory managment functions *
57
58 NAME: unsigned int physical_to_linear(unsigned int paddr)
59 WHERE: hal/page.h
60 FUNCTION: Converts a physical address to a linear one
61 RECEIVES:
62 paddr = the physical address to convert
63 RETURNS: A virtual address where the memory at that physical address can be
64 accessed
65
66 NAME: void* ExAllocatePool(unsigned int size, unsigned int type = 0);
67 WHERE: internal/pool.h
68 FUNCTION: Allocates a block of memory
69 RECEIVES:
70 size = the size of the block to allocate
71 type = will be whether to allocate pagable memory
72 RETURNS: The address of the block
73 NOTE: This isn't interrupt safe
74
75 NAME: void ExFreePool(void* block)
76 WHERE: internal/pool.h
77 FUNCTION: Frees a block of memory
78
79 NAME: void free_page(unsigned int physical_base, unsigned int nr = 1)
80 WHERE: internal/mm.h
81 FUNCTION: Adds a continuous range of physical memory to the free list
82
83 NAME: unsigned int get_free_page(void)
84 WHERE: internal/mm.h
85 FUNCTION: Gets a free page
86 RETURNS: Its physical address
87
88 NAME: unsigned int get_page_physical_address(unsigned int vaddr)
89 WHERE: internal/mm.h
90 FUNCTION: Gets the physical address of a page
91
92 NAME: void mark_page_not_writable(unsigned int vaddr)
93 WHERE: internal/mm.h
94 FUNCTION: Prevent writing the page
95
96 * DMA functions *
97
98 NAME: unsigned int get_dma_page(unsigned int max_address)
99 WHERE: internal/mm.h
100 FUNCTION: Gets a page with a restricted physical address i.e. suitable for
101 dma
102 RETURNS: The physical address of the page
103
104 NAME: void disable_dma(unsigned int dmanr)
105 WHERE: internal/dma.h
106 FUNCTION: Disables the specified dma channel
107
108 NAME: void enable_dma(unsigned int dmanr)
109 WHERE: internal/dma.h
110 FUNCTION: Enables the specified dma channel
111
112 NAME: void clear_dma_ff(unsigned int dmanr)
113 WHERE: internal/dma.h
114 FUNCTION: Clear the dma flip-flop
115
116 NAME: void set_dma_mode(unsigned int dmanr, char mode)
117 WHERE: internal/dma.h
118 FUNCTION: Sets the type of dma transfer
119
120 NAME: void set_dma_page(unsigned int dmanr, char pagenr)
121 WHERE: internal/dma.h
122 FUNCTION: Set only the page register bits of the transfer address
123
124 NAME: void set_dma_addr(unsigned int dmanr, unsigned int a)
125 WHERE: internal/dma.h
126 FUNCTION: Set the transfer address for dma
127 NOTE: Assumes flip-flop is clear
128
129 NAME: void set_dma_count(unsigned int dmanr, unsigned int count)
130 WHERE: internal/dma.h
131 FUNCTION: Sets the size of the transfer
132 ARGUMENTS:
133 count = the number of bytes to transfer
134 NOTE: Count must be even for channels 5-7
135
136 NAME: int get_dma_residue(unsigned int dmanr)
137 WHERE: internal/dma.h
138 FUNCTION: Gets the residue remaining after a dma transfer on the channel
139
140