Changeset 0adddea in mainline
- Timestamp:
- 2011-01-09T12:30:26Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b2263e6a
- Parents:
- 54de5ebd
- Location:
- uspace/lib/c
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/device/hw_res.c
r54de5ebd r0adddea 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 28 29 29 /** @addtogroup libc 30 30 * @{ … … 32 32 /** @file 33 33 */ 34 34 35 35 #include <device/hw_res.h> 36 36 #include <errno.h> … … 44 44 int rc = async_req_1_1(dev_phone, DEV_IFACE_ID(HW_RES_DEV_IFACE), 45 45 GET_RESOURCE_LIST, &count); 46 46 47 hw_resources->count = count; 47 48 if (rc != EOK) … … 67 68 int rc = async_req_1_0(dev_phone, DEV_IFACE_ID(HW_RES_DEV_IFACE), 68 69 ENABLE_INTERRUPT); 70 69 71 return rc == EOK; 70 72 } 71 72 73 74 /** @} 73 74 /** @} 75 75 */ -
uspace/lib/c/include/device/hw_res.h
r54de5ebd r0adddea 39 39 #include <bool.h> 40 40 41 // HW resource provider interface 42 41 /** HW resource provider interface */ 43 42 typedef enum { 44 43 GET_RESOURCE_LIST = 0, … … 46 45 } hw_res_funcs_t; 47 46 48 /** HW resource types .*/47 /** HW resource types */ 49 48 typedef enum { 50 49 INTERRUPT, … … 58 57 } endianness_t; 59 58 60 /** HW resource (e.g. interrupt, memory register, i/o register etc.) .*/61 typedef struct hw_resource{59 /** HW resource (e.g. interrupt, memory register, i/o register etc.) */ 60 typedef struct { 62 61 hw_res_type_t type; 63 62 union { … … 67 66 size_t size; 68 67 } mem_range; 68 69 69 struct { 70 70 uint64_t address; … … 72 72 size_t size; 73 73 } io_range; 74 74 75 struct { 75 76 int irq; … … 78 79 } hw_resource_t; 79 80 80 typedef struct hw_resource_list{81 typedef struct { 81 82 size_t count; 82 83 hw_resource_t *resources; … … 85 86 static inline void clean_hw_resource_list(hw_resource_list_t *hw_res) 86 87 { 87 if ( NULL != hw_res->resources) {88 if (hw_res->resources != NULL) { 88 89 free(hw_res->resources); 89 90
Note:
See TracChangeset
for help on using the changeset viewer.