Changeset 6843a9c in mainline for uspace/drv/bus/isa/isa.c
- Timestamp:
- 2012-06-29T13:02:14Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 722912e
- Parents:
- ba72f2b (diff), 0bbd13e (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/drv/bus/isa/isa.c
rba72f2b r6843a9c 52 52 #include <dirent.h> 53 53 #include <fcntl.h> 54 #include <ipc/irc.h> 55 #include <ipc/services.h> 56 #include <sysinfo.h> 57 #include <ns.h> 54 58 #include <sys/stat.h> 55 59 #include <ipc/irc.h> … … 62 66 #include <ops/hw_res.h> 63 67 64 #include <devman.h>65 #include <ipc/devman.h>66 68 #include <device/hw_res.h> 67 69 68 #include " dma_controller.h"70 #include "i8237.h" 69 71 70 72 #define NAME "isa" … … 146 148 147 149 static int isa_dma_channel_fun_setup(ddf_fun_t *fnode, 148 unsigned channel, uint32_t pa, uint16_t size, uint8_t mode)150 unsigned int channel, uint32_t pa, uint16_t size, uint8_t mode) 149 151 { 150 152 assert(fnode); … … 152 154 const hw_resource_list_t *res = &isa_fun->hw_resources; 153 155 assert(res); 154 const int ch = channel; 156 157 const unsigned int ch = channel; 155 158 for (size_t i = 0; i < res->count; ++i) { 156 if (( res->resources[i].type == DMA_CHANNEL_16&&157 res->resources[i].res.dma_channel.dma16 == ch) ||158 ( res->resources[i].type == DMA_CHANNEL_8&&159 res->resources[i].res.dma_channel.dma8 == ch)) {159 if (((res->resources[i].type == DMA_CHANNEL_16) && 160 (res->resources[i].res.dma_channel.dma16 == ch)) || 161 ((res->resources[i].type == DMA_CHANNEL_8) && 162 (res->resources[i].res.dma_channel.dma8 == ch))) { 160 163 return dma_setup_channel(channel, pa, size, mode); 161 164 } 162 165 } 166 163 167 return EINVAL; 164 168 } … … 172 176 static ddf_dev_ops_t isa_fun_ops; 173 177 174 static int isa_ add_device(ddf_dev_t *dev);178 static int isa_dev_add(ddf_dev_t *dev); 175 179 static int isa_dev_remove(ddf_dev_t *dev); 176 180 static int isa_fun_online(ddf_fun_t *fun); … … 179 183 /** The isa device driver's standard operations */ 180 184 static driver_ops_t isa_ops = { 181 . add_device = &isa_add_device,185 .dev_add = &isa_dev_add, 182 186 .dev_remove = &isa_dev_remove, 183 187 .fun_online = &isa_fun_online, … … 198 202 199 203 isa_fun_t *fun = ddf_fun_data_alloc(fnode, sizeof(isa_fun_t)); 200 if (fun == NULL) 204 if (fun == NULL) { 205 ddf_fun_destroy(fnode); 201 206 return NULL; 207 } 202 208 203 209 fibril_mutex_initialize(&fun->mutex); … … 344 350 size_t count = fun->hw_resources.count; 345 351 hw_resource_t *resources = fun->hw_resources.resources; 346 352 347 353 if (count < ISA_MAX_HW_RES) { 348 if ( dma > 0 && dma < 4) {354 if ((dma > 0) && (dma < 4)) { 349 355 resources[count].type = DMA_CHANNEL_8; 350 356 resources[count].res.dma_channel.dma8 = dma; 351 357 352 358 fun->hw_resources.count++; 353 359 ddf_msg(LVL_NOTE, "Added dma 0x%x to function %s", dma, 354 360 fun->fnode->name); 361 355 362 return; 356 363 } 357 364 358 if ( dma > 4 && dma < 8) {365 if ((dma > 4) && (dma < 8)) { 359 366 resources[count].type = DMA_CHANNEL_16; 360 367 resources[count].res.dma_channel.dma16 = dma; 361 368 362 369 fun->hw_resources.count++; 363 370 ddf_msg(LVL_NOTE, "Added dma 0x%x to function %s", dma, 364 371 fun->fnode->name); 372 365 373 return; 366 374 } 367 375 368 376 ddf_msg(LVL_WARN, "Skipped dma 0x%x for function %s", dma, 369 377 fun->fnode->name); … … 396 404 397 405 val = skip_spaces(val); 398 irq = (int) strtol(val, &end, 0x10);406 irq = (int) strtol(val, &end, 10); 399 407 400 408 if (val != end) … … 404 412 static void fun_parse_dma(isa_fun_t *fun, char *val) 405 413 { 406 int dma = 0;414 unsigned int dma = 0; 407 415 char *end = NULL; 408 416 409 417 val = skip_spaces(val); 410 dma = ( int)strtol(val, &end, 10);411 418 dma = (unsigned int) strtol(val, &end, 10); 419 412 420 if (val != end) 413 421 isa_fun_set_dma(fun, dma); … … 589 597 } 590 598 591 static int isa_ add_device(ddf_dev_t *dev)599 static int isa_dev_add(ddf_dev_t *dev) 592 600 { 593 601 isa_bus_t *isa; 594 602 595 ddf_msg(LVL_DEBUG, "isa_ add_device, device handle = %d",603 ddf_msg(LVL_DEBUG, "isa_dev_add, device handle = %d", 596 604 (int) dev->handle); 597 605
Note:
See TracChangeset
for help on using the changeset viewer.