5
Line | |
---|
1 | /* Device allocator helper used by PCI Auto/Read Configuration Library |
---|
2 | * |
---|
3 | * COPYRIGHT (c) 2010 Cobham Gaisler AB. |
---|
4 | * |
---|
5 | * The license and distribution terms for this file may be |
---|
6 | * found in the file LICENSE in this distribution or at |
---|
7 | * http://www.rtems.org/license/LICENSE. |
---|
8 | */ |
---|
9 | |
---|
10 | #include <rtems.h> |
---|
11 | #include <stdlib.h> |
---|
12 | #include <rtems/bspIo.h> |
---|
13 | |
---|
14 | #include <pci.h> |
---|
15 | #include <pci/cfg.h> |
---|
16 | |
---|
17 | #include "pci_internal.h" |
---|
18 | |
---|
19 | struct pci_dev *pci_dev_create(int isbus) |
---|
20 | { |
---|
21 | void *ptr; |
---|
22 | int size; |
---|
23 | |
---|
24 | if (isbus) |
---|
25 | size = sizeof(struct pci_bus); |
---|
26 | else |
---|
27 | size = sizeof(struct pci_dev); |
---|
28 | |
---|
29 | ptr = malloc(size); |
---|
30 | if (!ptr) |
---|
31 | rtems_fatal_error_occurred(RTEMS_NO_MEMORY); |
---|
32 | memset(ptr, 0, size); |
---|
33 | return ptr; |
---|
34 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.