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