Changes in uspace/drv/audio/sb16/main.c [7de1988c:5b1adf5] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/audio/sb16/main.c
r7de1988c r5b1adf5 49 49 50 50 static int sb_add_device(ddf_dev_t *device); 51 static int sb_get_res(ddf_dev_t *device, addr_range_t **pp_sb_regs, 52 addr_range_t **pp_mpu_regs, int *irq, int *dma8, int *dma16); 51 static int sb_get_res(ddf_dev_t *device, uintptr_t *sb_regs, 52 size_t *sb_regs_size, uintptr_t *mpu_regs, size_t *mpu_regs_size, 53 int *irq, int *dma8, int *dma16); 53 54 static int sb_enable_interrupts(ddf_dev_t *device); 54 55 … … 102 103 } 103 104 104 addr_range_t sb_regs; 105 addr_range_t *p_sb_regs = &sb_regs; 106 addr_range_t mpu_regs; 107 addr_range_t *p_mpu_regs = &mpu_regs; 105 uintptr_t sb_regs = 0, mpu_regs = 0; 106 size_t sb_regs_size = 0, mpu_regs_size = 0; 108 107 int irq = 0, dma8 = 0, dma16 = 0; 109 108 110 rc = sb_get_res(device, &p_sb_regs, &p_mpu_regs, &irq, &dma8, &dma16); 109 rc = sb_get_res(device, &sb_regs, &sb_regs_size, &mpu_regs, 110 &mpu_regs_size, &irq, &dma8, &dma16); 111 111 if (rc != EOK) { 112 112 ddf_log_error("Failed to get resources: %s.", str_error(rc)); … … 114 114 } 115 115 116 sb16_irq_code( p_sb_regs, dma8, dma16, irq_cmds, irq_ranges);116 sb16_irq_code((void*)sb_regs, dma8, dma16, irq_cmds, irq_ranges); 117 117 118 118 irq_code_t irq_code = { … … 139 139 } 140 140 141 rc = sb16_init_sb16(soft_state, p_sb_regs, device, dma8, dma16); 141 rc = sb16_init_sb16(soft_state, (void*)sb_regs, sb_regs_size, device, 142 dma8, dma16); 142 143 if (rc != EOK) { 143 144 ddf_log_error("Failed to init sb16 driver: %s.", … … 146 147 } 147 148 148 rc = sb16_init_mpu(soft_state, p_mpu_regs);149 rc = sb16_init_mpu(soft_state, (void*)mpu_regs, mpu_regs_size); 149 150 if (rc == EOK) { 150 151 ddf_fun_t *mpu_fun = … … 172 173 } 173 174 174 static int sb_get_res(ddf_dev_t *device, addr_range_t **pp_sb_regs, 175 addr_range_t **pp_mpu_regs, int *irq, int *dma8, int *dma16) 175 static int sb_get_res(ddf_dev_t *device, uintptr_t *sb_regs, 176 size_t *sb_regs_size, uintptr_t *mpu_regs, size_t *mpu_regs_size, 177 int *irq, int *dma8, int *dma16) 176 178 { 177 179 assert(device); … … 223 225 } 224 226 227 225 228 if (hw_res.io_ranges.count == 1) { 226 if ( pp_sb_regs && *pp_sb_regs)227 * *pp_sb_regs = hw_res.io_ranges.ranges[0];228 if ( pp_mpu_regs)229 * pp_mpu_regs = NULL;229 if (sb_regs) 230 *sb_regs = hw_res.io_ranges.ranges[0].address; 231 if (sb_regs_size) 232 *sb_regs_size = hw_res.io_ranges.ranges[0].size; 230 233 } else { 231 234 const int sb = 232 235 (hw_res.io_ranges.ranges[0].size >= sizeof(sb16_regs_t)) 233 ? 0 : 1;236 ? 1 : 0; 234 237 const int mpu = 1 - sb; 235 if (pp_sb_regs && *pp_sb_regs) 236 **pp_sb_regs = hw_res.io_ranges.ranges[sb]; 237 if (pp_mpu_regs && *pp_mpu_regs) 238 **pp_mpu_regs = hw_res.io_ranges.ranges[mpu]; 238 if (sb_regs) 239 *sb_regs = hw_res.io_ranges.ranges[sb].address; 240 if (sb_regs_size) 241 *sb_regs_size = hw_res.io_ranges.ranges[sb].size; 242 if (mpu_regs) 243 *sb_regs = hw_res.io_ranges.ranges[mpu].address; 244 if (mpu_regs_size) 245 *sb_regs_size = hw_res.io_ranges.ranges[mpu].size; 239 246 } 240 247 … … 254 261 return enabled ? EOK : EIO; 255 262 } 256 257 263 /** 258 264 * @}
Note:
See TracChangeset
for help on using the changeset viewer.