Changeset 2a37b9f in mainline for uspace/drv/platform/mac/mac.c
- Timestamp:
- 2014-08-28T19:54:48Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0f2a9be
- Parents:
- 0ddb84b
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/platform/mac/mac.c
r0ddb84b r2a37b9f 42 42 #include <stdio.h> 43 43 44 #define NAME " rootmac"44 #define NAME "mac" 45 45 46 46 typedef struct { 47 47 hw_resource_list_t hw_resources; 48 } rootmac_fun_t;48 } mac_fun_t; 49 49 50 50 static hw_resource_t pci_conf_regs[] = { … … 69 69 }; 70 70 71 static rootmac_fun_t pci_data = {71 static mac_fun_t pci_data = { 72 72 .hw_resources = { 73 73 2, … … 76 76 }; 77 77 78 static ddf_dev_ops_t rootmac_fun_ops;78 static ddf_dev_ops_t mac_fun_ops; 79 79 80 80 /** Obtain function soft-state from DDF function node */ 81 static rootmac_fun_t *rootmac_fun(ddf_fun_t *fnode)81 static mac_fun_t *mac_fun(ddf_fun_t *fnode) 82 82 { 83 83 return ddf_fun_data_get(fnode); 84 84 } 85 85 86 static bool rootmac_add_fun(ddf_dev_t *dev, const char *name,87 const char *str_match_id, rootmac_fun_t *fun_proto)86 static bool mac_add_fun(ddf_dev_t *dev, const char *name, 87 const char *str_match_id, mac_fun_t *fun_proto) 88 88 { 89 89 ddf_msg(LVL_DEBUG, "Adding new function '%s'.", name); … … 97 97 goto failure; 98 98 99 rootmac_fun_t *fun = ddf_fun_data_alloc(fnode, sizeof(rootmac_fun_t));99 mac_fun_t *fun = ddf_fun_data_alloc(fnode, sizeof(mac_fun_t)); 100 100 *fun = *fun_proto; 101 101 … … 106 106 107 107 /* Set provided operations to the device. */ 108 ddf_fun_set_ops(fnode, & rootmac_fun_ops);108 ddf_fun_set_ops(fnode, &mac_fun_ops); 109 109 110 110 /* Register function. */ … … 133 133 * 134 134 */ 135 static int rootmac_dev_add(ddf_dev_t *dev)135 static int mac_dev_add(ddf_dev_t *dev) 136 136 { 137 137 #if 0 138 138 /* Register functions */ 139 if (! rootmac_add_fun(dev, "pci0", "intel_pci", &pci_data))139 if (!mac_add_fun(dev, "pci0", "intel_pci", &pci_data)) 140 140 ddf_msg(LVL_ERROR, "Failed to add functions for Mac platform."); 141 141 #else 142 142 (void)pci_data; 143 (void) rootmac_add_fun;143 (void)mac_add_fun; 144 144 #endif 145 145 … … 148 148 149 149 /** The root device driver's standard operations. */ 150 static driver_ops_t rootmac_ops = {151 .dev_add = & rootmac_dev_add150 static driver_ops_t mac_ops = { 151 .dev_add = &mac_dev_add 152 152 }; 153 153 154 154 /** The root device driver structure. */ 155 static driver_t rootmac_driver = {155 static driver_t mac_driver = { 156 156 .name = NAME, 157 .driver_ops = & rootmac_ops157 .driver_ops = &mac_ops 158 158 }; 159 159 160 static hw_resource_list_t * rootmac_get_resources(ddf_fun_t *fnode)160 static hw_resource_list_t *mac_get_resources(ddf_fun_t *fnode) 161 161 { 162 rootmac_fun_t *fun = rootmac_fun(fnode);162 mac_fun_t *fun = mac_fun(fnode); 163 163 assert(fun != NULL); 164 164 … … 166 166 } 167 167 168 static bool rootmac_enable_interrupt(ddf_fun_t *fun)168 static bool mac_enable_interrupt(ddf_fun_t *fun) 169 169 { 170 170 /* TODO */ … … 174 174 175 175 static hw_res_ops_t fun_hw_res_ops = { 176 .get_resource_list = & rootmac_get_resources,177 .enable_interrupt = & rootmac_enable_interrupt176 .get_resource_list = &mac_get_resources, 177 .enable_interrupt = &mac_enable_interrupt 178 178 }; 179 179 … … 182 182 printf("%s: HelenOS Mac platform driver\n", NAME); 183 183 ddf_log_init(NAME); 184 rootmac_fun_ops.interfaces[HW_RES_DEV_IFACE] = &fun_hw_res_ops;185 return ddf_driver_main(& rootmac_driver);184 mac_fun_ops.interfaces[HW_RES_DEV_IFACE] = &fun_hw_res_ops; 185 return ddf_driver_main(&mac_driver); 186 186 } 187 187
Note:
See TracChangeset
for help on using the changeset viewer.