1 /* 2 * Copyright 2014, Ithamar R. Adema <ithamar@upgrade-android.com> 3 * All rights reserved. Distributed under the terms of the MIT License. 4 */ 5 6 #ifndef _DRIVERS_BUS_FDT_H 7 #define _DRIVERS_BUS_FDT_H 8 9 #include <bus_manager.h> 10 11 #ifdef __cplusplus 12 extern "C" { 13 #endif 14 15 typedef int fdt_device_node; 16 17 struct fdt_device_info { 18 const char *compatible; 19 status_t (*init)(struct fdt_module_info *fdt, fdt_device_node node, void *cookie); 20 }; 21 22 struct fdt_module_info { 23 bus_manager_info binfo; 24 25 // basic call for triggering callbacks for supported devices 26 // scans the whole FDT tree once and calls the info.init function 27 // when a matching device is found. 28 status_t (*setup_devices)(struct fdt_device_info *info, int count, void *cookie); 29 30 // map physical "reg" range "index" of node "node", and return the virtual address in '*_address' 31 // and return the area ID or error if not able to. 32 area_id (*map_reg_range)(fdt_device_node node, int index, void **_address); 33 34 // return entry "index" out of "interrupts" property for node "node", or a negative error code on failure. 35 int (*get_interrupt)(fdt_device_node node, int index); 36 }; 37 38 #define B_FDT_MODULE_NAME "bus_managers/fdt/v1" 39 40 41 #ifdef __cplusplus 42 } 43 #endif 44 45 #endif // _DRIVERS_BUS_FDT_H 46