MCPcopy Create free account
hub / github.com/ading2210/linuxpdf / clint_read

Function clint_read

tinyemu/riscv_machine.c:195–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193#endif
194
195static uint32_t clint_read(void *opaque, uint32_t offset, int size_log2)
196{
197 RISCVMachine *m = opaque;
198 uint32_t val;
199
200 assert(size_log2 == 2);
201 switch(offset) {
202 case 0xbff8:
203 val = rtc_get_time(m);
204 break;
205 case 0xbffc:
206 val = rtc_get_time(m) >> 32;
207 break;
208 case 0x4000:
209 val = m->timecmp;
210 break;
211 case 0x4004:
212 val = m->timecmp >> 32;
213 break;
214 default:
215 val = 0;
216 break;
217 }
218 return val;
219}
220
221static void clint_write(void *opaque, uint32_t offset, uint32_t val,
222 int size_log2)

Callers

nothing calls this directly

Calls 1

rtc_get_timeFunction · 0.85

Tested by

no test coverage detected