-
-/* Top level core(root) device: core@garbage
-
- The core device captures incomming dma requests and changes them to
- outgoing io requests. */
-
-STATIC_INLINE_CORE void
-core_init_callback(const device *me,
- psim *system)
-{
- core *memory = (core*)me->data;
- DTRACE_INIT(core);
- core_init(memory);
-}
-
-
-STATIC_INLINE_CORE void
-core_attach_address_callback(const device *me,
- const char *name,
- attach_type attach,
- int space,
- unsigned_word addr,
- unsigned nr_bytes,
- access_type access,
- const device *who) /*callback/default*/
-{
- core *memory = (core*)me->data;
- DTRACE_ATTACH_ADDRESS(core);
- if (space != 0)
- error("core_attach_address_callback() invalid address space\n");
- core_attach(memory,
- attach,
- space,
- access,
- addr,
- nr_bytes,
- who);
-}
-
-
-STATIC_INLINE_CORE unsigned
-core_dma_read_buffer_callback(const device *me,
- void *dest,
- int space,
- unsigned_word addr,
- unsigned nr_bytes)
-{
- core *memory = (core*)me->data;
- DTRACE_DMA_READ_BUFFER(core);
- return core_map_read_buffer(core_readable(memory),
- dest,
- addr,
- nr_bytes);
-}
-
-
-STATIC_INLINE_CORE unsigned
-core_dma_write_buffer_callback(const device *me,
- const void *source,
- int space,
- unsigned_word addr,
- unsigned nr_bytes,
- int violate_read_only_section)
-{
- core *memory = (core*)me->data;
- core_map *map = (violate_read_only_section
- ? core_readable(memory)
- : core_writeable(memory));
- DTRACE_DMA_WRITE_BUFFER(core);
- return core_map_write_buffer(map,
- source,
- addr,
- nr_bytes);
-}
-
-
-static device_callbacks const core_callbacks = {
- core_init_callback,
- core_attach_address_callback,
- unimp_device_detach_address,
- unimp_device_io_read_buffer,
- unimp_device_io_write_buffer,
- core_dma_read_buffer_callback,
- core_dma_write_buffer_callback,
- unimp_device_attach_interrupt,
- unimp_device_detach_interrupt,
- unimp_device_interrupt,
- unimp_device_interrupt_ack,
- unimp_device_ioctl,
-};
-
-
-INLINE_CORE const device *
-core_device_create(core *memory)
-{
- return device_create_from("core", "/", memory, &core_callbacks, NULL);
-}
-
-
-