Changeset b5e68c8 in mainline for uspace/lib/c/include/device/hw_res.h
- Timestamp:
- 2011-05-12T16:49:44Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f36787d7
- Parents:
- e80329d6 (diff), 750636a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/device/hw_res.h
re80329d6 rb5e68c8 27 27 */ 28 28 29 29 /** @addtogroup libc 30 30 * @{ 31 31 */ … … 39 39 #include <bool.h> 40 40 41 // HW resource provider interface 41 /** HW resource provider interface */ 42 typedef enum { 43 HW_RES_GET_RESOURCE_LIST = 0, 44 HW_RES_ENABLE_INTERRUPT 45 } hw_res_method_t; 42 46 43 typedef enum { 44 GET_RESOURCE_LIST = 0, 45 ENABLE_INTERRUPT 46 } hw_res_funcs_t; 47 48 /** HW resource types. */ 47 /** HW resource types */ 49 48 typedef enum { 50 49 INTERRUPT, … … 58 57 } endianness_t; 59 58 60 61 /** HW resource (e.g. interrupt, memory register, i/o register etc.). */ 62 typedef struct hw_resource { 59 /** HW resource (e.g. interrupt, memory register, i/o register etc.) */ 60 typedef struct { 63 61 hw_res_type_t type; 64 62 union { 65 63 struct { 66 64 uint64_t address; 67 endianness_t endianness; 68 size_t size; 65 endianness_t endianness; 66 size_t size; 69 67 } mem_range; 68 70 69 struct { 71 70 uint64_t address; 72 endianness_t endianness; 73 size_t size; 71 endianness_t endianness; 72 size_t size; 74 73 } io_range; 74 75 75 struct { 76 int irq; 77 } interrupt; 78 } res; 76 int irq; 77 } interrupt; 78 } res; 79 79 } hw_resource_t; 80 80 81 typedef struct hw_resource_list{81 typedef struct { 82 82 size_t count; 83 hw_resource_t *resources; 83 hw_resource_t *resources; 84 84 } hw_resource_list_t; 85 85 86 static inline void clean_hw_resource_list(hw_resource_list_t *hw_res)86 static inline void hw_res_clean_resource_list(hw_resource_list_t *hw_res) 87 87 { 88 if (NULL != hw_res->resources) {88 if (hw_res->resources != NULL) { 89 89 free(hw_res->resources); 90 90 91 hw_res->resources = NULL; 91 92 } 92 hw_res->count = 0; 93 94 hw_res->count = 0; 93 95 } 94 96 95 96 97 bool get_hw_resources(int dev_phone, hw_resource_list_t *hw_resources); 98 99 bool enable_interrupt(int dev_phone); 100 97 extern int hw_res_get_resource_list(int, hw_resource_list_t *); 98 extern bool hw_res_enable_interrupt(int); 101 99 102 100 #endif
Note:
See TracChangeset
for help on using the changeset viewer.