16 | | === unsigned int _get_epc( void ) === |
17 | | Returns the value stored in the CP0_EPC register, for the processor running the calling task. |
18 | | |
19 | | === unsigned int _get_cr( void ) === |
20 | | Returns the value stored in the CP0_CR register, for the processor running the calling task. |
21 | | |
22 | | === unsigned int _get_sr( void ) === |
23 | | Returns the value stored in the CP0_SR register, for the processor running the calling task. |
24 | | |
25 | | === unsigned int _get_bvar( void ) === |
26 | | Returns the value stored in the CP0_BVAR register, for the processor running the calling task. |
27 | | |
28 | | === unsigned int _get_procid( void ) === |
29 | | Returns the global processor identifier stored in the CP0_PROCID register for the processor running the calling task. |
30 | | |
31 | | === unsigned int _get_protime( void ) === |
32 | | Returns the cycle count stored in the CP0_TIME register for the processor running the calling task. |
33 | | |
34 | | === void _set_sched( unsigned int value ) === |
35 | | Writes ''value'' in the CP0_SCHED register, for the processor running the calling task. |
36 | | |
37 | | === void _set_sr( unsigned int value ) === |
38 | | Writes ''value'' in the CP0_SR register, for the processor running the calling task. |
39 | | |
40 | | === void _it_disable( unsigned int* save_sr_ptr ) === |
41 | | Disables interrupts for the processor running the calling task and save the CP0_SR value at address ''save_sr_ptr''. |
42 | | |
43 | | === void _it_restore( unsigned int* save_sr_ptr ) === |
44 | | Writes the value pointed by ''save_sr_ptr'' into the CP0_SR register, for the processor running the calling task. |
45 | | |
46 | | == __2) CP2 registers access functions__ == |
47 | | |
48 | | === unsigned int _get_mmu_ptpr( void ) === |
49 | | Returns the value stored in the CP2_PTPR register, for the processor running the calling task. |
50 | | |
51 | | === unsigned int _get_mmu_mode( void ) === |
52 | | Returns the value stored in the CP2_MODE register, for the processor running the calling task. |
53 | | |
54 | | === void _set_mmu_ptpr( unsigned int value ) === |
55 | | Writes ''value'' in the CP2_PTPR register, for the processor running the calling task. |
56 | | |
57 | | === void _set_mmu_mode( unsigned int value ) === |
58 | | Writes ''value'' in the CP2_MODE register, for the processor running the calling task. |
59 | | |
60 | | == __3) Physical addressing functions__ == |
61 | | |
62 | | === unsigned int _physical_read( unsigned long long paddr ) === |
63 | | Returns the 32 bits word stored at physical address ''paddr'', after a temporary DTLB deactivation. |
64 | | It uses the CP2_PADDR_EXT register. |
65 | | |
66 | | === void _physical_write( unsigned long long paddr, unsigned int value ) |
67 | | Writes the 32 bits word ''value'' at physical address ''paddr'', after a temporary DTLB deactivation. |
68 | | It uses the CP2_PADDR_EXT register. |
69 | | |
70 | | === unsigned long long _physical_read_ull( unsigned long long paddr ) === |
71 | | Returns the 64 bits word stored at physical address ''paddr'', after a temporary DTLB deactivation. |
72 | | It uses the CP2_PADDR_EXT register. |
73 | | |
74 | | === void _physical_write_ull( unsigned long long paddr, unsigned long long value ) === |
75 | | Writes the 64 bits word ''value'' at physical address ''paddr'', after a temporary DTLB deactivation. |
76 | | It uses the CP2_PADDR_EXT register. |
77 | | |
78 | | === void _physical_memcpy( unsigned long long dst_paddr, unsigned long long src paddr, unsigned int size ) === |
79 | | This function makes a memcpy from a source buffer to a destination buffer, using physical addresses, after a temporary DTLB de-activation. The ''src_paddr'', ''dst_paddr'' and ''size'' arguments must be multiple of 4 bytes. |
80 | | |
81 | | === unsigned int _io_extended_read( unsigned int* vaddr ) === |
82 | | This function is used by the GIET-VM drivers to read a 32 bits word in a peripheral register. |
83 | | If the MMU is not activated, the virtual address is extended using X_IO and Y_IO (defined in the hard-config.h file) to reach the cluster_io. |
84 | | |
85 | | === void _io_extended_write( unsigned int* vaddr, unsigned int value ) === |
86 | | This function is used by the GIET-VM drivers to write a 32 bits word in a peripheral register. |
87 | | If the MMU is not activated, the virtual address is extended using X_IO and Y_IO (defined in the hard-config.h file) to reach the cluster_io. |
88 | | |
89 | | == __4) Spin-lock access functions__ == |
90 | | |
91 | | The ''giet_lock_t'' structure is defined in the ''utils.h'' file to have one single lock in a 64 bytes cache line. It should be aligned on a cache line boundary. |
92 | | |
93 | | === void _get_lock( giet_lock_t lock ) === |
94 | | Takes a lock with a blocking ll/sc atomic access. If the cache coherence is granted by the hardware, |
95 | | the first read is a standard (cacheable) lw, as the local copy can be polled when the lock is already taken by another task, reducing trafic on the interconnect. When the lock is released by the owner task, the local copy is updated or invalidated by the coherence protocol. If there is no hardware cache coherence a pseudo random delay is introduced between two successive retry. |
96 | | |
97 | | === void _release_lock( giet_lock_t lock ) === |
98 | | Releases (or initializes) a lock. |
99 | | |
100 | | == __5) TTY0 access functions == |
101 | | |
102 | | === void _puts( char* string ) === |
103 | | Displays a ''string'' on kernel TTY0. This function does NOT take the TTY0 lock. |
104 | | |
105 | | === void _putx( unsigned int value ) === |
106 | | Displays a 32 bits word as an hexadecimal string on kernel TTY0. This function does NOT take the TTY0 lock. |
107 | | |
108 | | === void _putl( unsigned long long value ) === |
109 | | Displays a 64 bits word as an hexadecimal string on kernel TTY0. This function does NOT take the TTY0 lock. |
110 | | |
111 | | === void _putd( unsigned int value ) === |
112 | | Displays a 32 bits word as an decimal string on kernel TTY0. This function does NOT take the TTY0 lock. |
113 | | |
114 | | === void _printf( char* format, ... ) === |
115 | | Display a format on kernel TTY0. To provide an atomic display, this function takes the lock protecting |
116 | | exclusive access to TTY0, entering a critical section until the lock is released. |
117 | | Only a limited number of formats are supported: |
118 | | * %d : 32 bits signed decimal |
119 | | * %u : 32 bits unsigned decimal |
120 | | * %x : 32 bits unsigned hexa |
121 | | * %l : 64 bits unsigned hexa |
122 | | * %c : char |
123 | | * %s : string |
124 | | |
125 | | === void _getc( char* byte ) === |
126 | | This blocking function uses a polling strategy on the TTY0 status register to get a single character. |
127 | | |
128 | | == __6) Task context access functions__ == |
129 | | |
130 | | === unsigned int _get_current_task_id( void ) === |
131 | | This function returns the local index of the currently running task from the processor scheduler. |
132 | | |
133 | | === unsigned int _get_task_slot( unsigned int gpid, unsigned int ltid, unsigned int slot ) |
134 | | This function returns the content of a context ''slot'' for a task identified by the the ''gpid'' argument |
135 | | (global processor index), and the ''ltid'' argument (local task index on the processor). |
136 | | |
137 | | === void _set_task_slot( unsigned int gpid, unsigned int ltid, unsigned int slot, unsigned int value ) |
138 | | This function writes ''value'' in the the context ''slot'' of the task identified by the the ''gpid'' argument |
139 | | (global processor index), and the ''ltid'' argument (local task index on the processor). |
140 | | |
141 | | === unsigned int _get_context_slot( unsigned int slot ) |
142 | | This function returns the content of a context ''slot'' for the calling task. |
143 | | |
144 | | === void _set_task_slot( unsigned int slot, unsigned int value ) |
145 | | This function writes ''value'' in the the context ''slot'' of the running task. |
146 | | |
147 | | == __7) Mapping access functions |
148 | | |
149 | | These functions can be used by both the boot-loader and the kernel to extract informations from the mapping_info data structure (defined in the ''mapping_info.h'' file), that has been loaded into system memory by the boot-loader. |
150 | | |
151 | | === mapping_cluster_t* _get_cluster_base( mapping_header_t* header ) === |
152 | | Returns a pointer on the first cluster in the clusters array. |
153 | | |
154 | | === mapping_cluster_t* _get_cluster_base( mapping_header_t* header ) === |
155 | | Returns a pointer on the first cluster in the clusters array. |
156 | | |
157 | | === mapping_pseg_t* _get_pseg_base( mapping_header_t* header ) === |
158 | | Returns a pointer on the first pseg in the psegs array. |
159 | | |
160 | | === mapping_vspace_t* _get_vspace_base( mapping_header_t* header ) === |
161 | | Returns a pointer on the first vspace in the vspaces array. |
162 | | |
163 | | === mapping_vseg_t* _get_vseg_base( mapping_header_t* header ) === |
164 | | Returns a pointer on the first vseg in the vsegs array. |
165 | | |
166 | | === mapping_vobj_t* _get_vobj_base( mapping_header_t* header ) === |
167 | | Returns a pointer on the first vobj in the vobjs array. |
168 | | |
169 | | === mapping_cluster_t* _get_task_base( mapping_header_t* header ) === |
170 | | Returns a pointer on the first task in the tasks array. |
171 | | |
172 | | === mapping_cluster_t* _get_proc_base( mapping_header_t* header ) === |
173 | | Returns a pointer on the first proc in the procs array. |
174 | | |
175 | | === mapping_cluster_t* _get_irq_base( mapping_header_t* header ) === |
176 | | Returns a pointer on the first irq in the irqs array. |
177 | | |
178 | | === mapping_cluster_t* _get_coproc_base( mapping_header_t* header ) === |
179 | | Returns a pointer on the first coproc in the coprocs array. |
180 | | |
181 | | === mapping_cluster_t* _get_cp_port_base( mapping_header_t* header ) === |
182 | | Returns a pointer on the first cpport in the cpports array. |
183 | | |
184 | | === mapping_cluster_t* _get_periph_base( mapping_header_t* header ) === |
185 | | Returns a pointer on the first periph in the periphs array. |
186 | | |
187 | | == __X) Miscelaneous functions__ == |