Changes in uspace/lib/c/generic/device/hw_res.c [38d150e:b7fd2a0] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/device/hw_res.c
r38d150e rb7fd2a0 38 38 #include <stdlib.h> 39 39 40 int hw_res_get_resource_list(async_sess_t *sess,40 errno_t hw_res_get_resource_list(async_sess_t *sess, 41 41 hw_resource_list_t *hw_resources) 42 42 { … … 45 45 async_exch_t *exch = async_exchange_begin(sess); 46 46 47 int rc = async_req_1_1(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),47 errno_t rc = async_req_1_1(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE), 48 48 HW_RES_GET_RESOURCE_LIST, &count); 49 49 … … 75 75 } 76 76 77 int hw_res_enable_interrupt(async_sess_t *sess, int irq)77 errno_t hw_res_enable_interrupt(async_sess_t *sess, int irq) 78 78 { 79 79 async_exch_t *exch = async_exchange_begin(sess); 80 80 81 int rc = async_req_2_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),81 errno_t rc = async_req_2_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE), 82 82 HW_RES_ENABLE_INTERRUPT, irq); 83 83 async_exchange_end(exch); … … 86 86 } 87 87 88 int hw_res_disable_interrupt(async_sess_t *sess, int irq)88 errno_t hw_res_disable_interrupt(async_sess_t *sess, int irq) 89 89 { 90 90 async_exch_t *exch = async_exchange_begin(sess); 91 91 92 int rc = async_req_2_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),92 errno_t rc = async_req_2_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE), 93 93 HW_RES_DISABLE_INTERRUPT, irq); 94 94 async_exchange_end(exch); … … 97 97 } 98 98 99 int hw_res_clear_interrupt(async_sess_t *sess, int irq)99 errno_t hw_res_clear_interrupt(async_sess_t *sess, int irq) 100 100 { 101 101 async_exch_t *exch = async_exchange_begin(sess); 102 102 103 int rc = async_req_2_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),103 errno_t rc = async_req_2_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE), 104 104 HW_RES_CLEAR_INTERRUPT, irq); 105 105 async_exchange_end(exch); … … 122 122 * 123 123 */ 124 int hw_res_dma_channel_setup(async_sess_t *sess,124 errno_t hw_res_dma_channel_setup(async_sess_t *sess, 125 125 unsigned channel, uint32_t pa, uint32_t size, uint8_t mode) 126 126 { … … 128 128 129 129 const uint32_t packed = (channel & 0xffff) | (mode << 16); 130 const int ret = async_req_4_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),130 const errno_t ret = async_req_4_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE), 131 131 HW_RES_DMA_CHANNEL_SETUP, packed, pa, size); 132 132 … … 140 140 * @param channel DMA channel. 141 141 * 142 * @return Number of bytes remaining in the buffer if positive. 143 * @return Error code if negative. 142 * @param[out] rem Number of bytes remaining in the buffer if positive. 143 * 144 * @return Error code. 144 145 * 145 146 */ 146 int hw_res_dma_channel_remain(async_sess_t *sess, unsigned channel)147 errno_t hw_res_dma_channel_remain(async_sess_t *sess, unsigned channel, size_t *rem) 147 148 { 148 149 async_exch_t *exch = async_exchange_begin(sess); 149 150 150 151 sysarg_t remain; 151 const int ret = async_req_2_1(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),152 const errno_t ret = async_req_2_1(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE), 152 153 HW_RES_DMA_CHANNEL_REMAIN, channel, &remain); 153 154 … … 155 156 156 157 if (ret == EOK) 157 returnremain;158 *rem = remain; 158 159 159 160 return ret;
Note:
See TracChangeset
for help on using the changeset viewer.