Changeset 178673c in mainline for uspace/drv/rootpc/rootpc.c
- Timestamp:
- 2010-11-30T00:38:54Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ab3a851
- Parents:
- 6f9e7fea
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/rootpc/rootpc.c
r6f9e7fea r178673c 28 28 29 29 /** 30 * @defgroup root_ ia32 Root HW device driver for ia32platform.31 * @brief HelenOS root HW device driver for ia32 platform.30 * @defgroup root_pc Root HW device driver for ia32 and amd64 platform. 31 * @brief HelenOS root HW device driver for ia32 and amd64 platform. 32 32 * @{ 33 33 */ … … 53 53 #include <device/hw_res.h> 54 54 55 #define NAME "root ia32"56 57 typedef struct root ia32_child_dev_data {55 #define NAME "rootpc" 56 57 typedef struct rootpc_child_dev_data { 58 58 hw_resource_list_t hw_resources; 59 } root ia32_child_dev_data_t;60 61 static int root ia32_add_device(device_t *dev);62 static void root_ ia32_init(void);59 } rootpc_child_dev_data_t; 60 61 static int rootpc_add_device(device_t *dev); 62 static void root_pc_init(void); 63 63 64 64 /** The root device driver's standard operations. */ 65 static driver_ops_t root ia32_ops = {66 .add_device = &root ia32_add_device65 static driver_ops_t rootpc_ops = { 66 .add_device = &rootpc_add_device 67 67 }; 68 68 69 69 /** The root device driver structure. */ 70 static driver_t root ia32_driver = {70 static driver_t rootpc_driver = { 71 71 .name = NAME, 72 .driver_ops = &root ia32_ops72 .driver_ops = &rootpc_ops 73 73 }; 74 74 … … 82 82 }; 83 83 84 static root ia32_child_dev_data_t pci_data = {84 static rootpc_child_dev_data_t pci_data = { 85 85 .hw_resources = { 86 86 1, … … 89 89 }; 90 90 91 static hw_resource_list_t *root ia32_get_child_resources(device_t *dev)92 { 93 root ia32_child_dev_data_t *data;94 95 data = (root ia32_child_dev_data_t *) dev->driver_data;91 static hw_resource_list_t *rootpc_get_child_resources(device_t *dev) 92 { 93 rootpc_child_dev_data_t *data; 94 95 data = (rootpc_child_dev_data_t *) dev->driver_data; 96 96 if (NULL == data) 97 97 return NULL; … … 100 100 } 101 101 102 static bool root ia32_enable_child_interrupt(device_t *dev)102 static bool rootpc_enable_child_interrupt(device_t *dev) 103 103 { 104 104 /* TODO */ … … 108 108 109 109 static resource_iface_t child_res_iface = { 110 &root ia32_get_child_resources,111 &root ia32_enable_child_interrupt112 }; 113 114 /* Initialized in root_ ia32_init() function. */115 static device_ops_t root ia32_child_ops;110 &rootpc_get_child_resources, 111 &rootpc_enable_child_interrupt 112 }; 113 114 /* Initialized in root_pc_init() function. */ 115 static device_ops_t rootpc_child_ops; 116 116 117 117 static bool 118 root ia32_add_child(device_t *parent, const char *name, const char *str_match_id,119 root ia32_child_dev_data_t *drv_data)118 rootpc_add_child(device_t *parent, const char *name, const char *str_match_id, 119 rootpc_child_dev_data_t *drv_data) 120 120 { 121 121 printf(NAME ": adding new child device '%s'.\n", name); … … 142 142 143 143 /* Set provided operations to the device. */ 144 child->ops = &root ia32_child_ops;144 child->ops = &rootpc_child_ops; 145 145 146 146 /* Register child device. */ … … 164 164 } 165 165 166 static bool root ia32_add_children(device_t *dev)167 { 168 return root ia32_add_child(dev, "pci0", "intel_pci", &pci_data);166 static bool rootpc_add_children(device_t *dev) 167 { 168 return rootpc_add_child(dev, "pci0", "intel_pci", &pci_data); 169 169 } 170 170 … … 175 175 * @return Zero on success, negative error number otherwise. 176 176 */ 177 static int root ia32_add_device(device_t *dev)178 { 179 printf(NAME ": root ia32_add_device, device handle = %d\n", dev->handle);177 static int rootpc_add_device(device_t *dev) 178 { 179 printf(NAME ": rootpc_add_device, device handle = %d\n", dev->handle); 180 180 181 181 /* Register child devices. */ 182 if (!root ia32_add_children(dev)) {182 if (!rootpc_add_children(dev)) { 183 183 printf(NAME ": failed to add child devices for platform " 184 184 "ia32.\n"); … … 188 188 } 189 189 190 static void root_ ia32_init(void)191 { 192 root ia32_child_ops.interfaces[HW_RES_DEV_IFACE] = &child_res_iface;190 static void root_pc_init(void) 191 { 192 rootpc_child_ops.interfaces[HW_RES_DEV_IFACE] = &child_res_iface; 193 193 } 194 194 195 195 int main(int argc, char *argv[]) 196 196 { 197 printf(NAME ": HelenOS root ia32device driver\n");198 root_ ia32_init();199 return driver_main(&root ia32_driver);197 printf(NAME ": HelenOS rootpc device driver\n"); 198 root_pc_init(); 199 return driver_main(&rootpc_driver); 200 200 } 201 201
Note:
See TracChangeset
for help on using the changeset viewer.