Changeset 2a37b9f in mainline for uspace/drv/platform/amdm37x/main.c
- Timestamp:
- 2014-08-28T19:54:48Z (10 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/amdm37x/main.c
r0ddb84b r2a37b9f 45 45 #include "amdm37x.h" 46 46 47 #define NAME " rootamdm37x"47 #define NAME "amdm37x" 48 48 49 49 typedef struct { … … 51 51 match_id_t match_id; 52 52 hw_resource_list_t hw_resources; 53 } rootamdm37x_fun_t;53 } amdm37x_fun_t; 54 54 55 55 /* See amdm37x TRM page 3316 for these values */ … … 130 130 }; 131 131 132 static const rootamdm37x_fun_t amdm37x_funcs[] = {132 static const amdm37x_fun_t amdm37x_funcs[] = { 133 133 { 134 134 .name = "ohci", … … 149 149 150 150 151 static hw_resource_list_t * rootamdm37x_get_resources(ddf_fun_t *fnode);152 static bool rootamdm37x_enable_interrupt(ddf_fun_t *fun);151 static hw_resource_list_t *amdm37x_get_resources(ddf_fun_t *fnode); 152 static bool amdm37x_enable_interrupt(ddf_fun_t *fun); 153 153 154 154 static hw_res_ops_t fun_hw_res_ops = { 155 .get_resource_list = & rootamdm37x_get_resources,156 .enable_interrupt = & rootamdm37x_enable_interrupt,157 }; 158 159 static ddf_dev_ops_t rootamdm37x_fun_ops = {155 .get_resource_list = &amdm37x_get_resources, 156 .enable_interrupt = &amdm37x_enable_interrupt, 157 }; 158 159 static ddf_dev_ops_t amdm37x_fun_ops = { 160 160 .interfaces[HW_RES_DEV_IFACE] = &fun_hw_res_ops 161 161 }; 162 162 163 static int rootamdm37x_add_fun(ddf_dev_t *dev, const rootamdm37x_fun_t *fun)163 static int amdm37x_add_fun(ddf_dev_t *dev, const amdm37x_fun_t *fun) 164 164 { 165 165 assert(dev); … … 182 182 183 183 /* Alloc needed data */ 184 rootamdm37x_fun_t *rf =185 ddf_fun_data_alloc(fnode, sizeof( rootamdm37x_fun_t));184 amdm37x_fun_t *rf = 185 ddf_fun_data_alloc(fnode, sizeof(amdm37x_fun_t)); 186 186 if (!rf) { 187 187 ddf_fun_destroy(fnode); … … 191 191 192 192 /* Set provided operations to the device. */ 193 ddf_fun_set_ops(fnode, & rootamdm37x_fun_ops);193 ddf_fun_set_ops(fnode, &amdm37x_fun_ops); 194 194 195 195 /* Register function. */ … … 212 212 * 213 213 */ 214 static int rootamdm37x_dev_add(ddf_dev_t *dev)214 static int amdm37x_dev_add(ddf_dev_t *dev) 215 215 { 216 216 assert(dev); … … 240 240 /* Register functions */ 241 241 for (unsigned i = 0; i < ARRAY_SIZE(amdm37x_funcs); ++i) { 242 if ( rootamdm37x_add_fun(dev, &amdm37x_funcs[i]) != EOK)242 if (amdm37x_add_fun(dev, &amdm37x_funcs[i]) != EOK) 243 243 ddf_msg(LVL_ERROR, "Failed to add %s function for " 244 244 "BeagleBoard-xM platform.", amdm37x_funcs[i].name); … … 248 248 249 249 /** The root device driver's standard operations. */ 250 static driver_ops_t rootamdm37x_ops = {251 .dev_add = & rootamdm37x_dev_add250 static driver_ops_t amdm37x_ops = { 251 .dev_add = &amdm37x_dev_add 252 252 }; 253 253 254 254 /** The root device driver structure. */ 255 static driver_t rootamdm37x_driver = {255 static driver_t amdm37x_driver = { 256 256 .name = NAME, 257 .driver_ops = & rootamdm37x_ops258 }; 259 260 static hw_resource_list_t * rootamdm37x_get_resources(ddf_fun_t *fnode)261 { 262 rootamdm37x_fun_t *fun = ddf_fun_data_get(fnode);257 .driver_ops = &amdm37x_ops 258 }; 259 260 static hw_resource_list_t * amdm37x_get_resources(ddf_fun_t *fnode) 261 { 262 amdm37x_fun_t *fun = ddf_fun_data_get(fnode); 263 263 assert(fun != NULL); 264 264 return &fun->hw_resources; 265 265 } 266 266 267 static bool rootamdm37x_enable_interrupt(ddf_fun_t *fun)267 static bool amdm37x_enable_interrupt(ddf_fun_t *fun) 268 268 { 269 269 //TODO: Implement … … 275 275 printf("%s: HelenOS AM/DM37x(OMAP37x) platform driver\n", NAME); 276 276 ddf_log_init(NAME); 277 return ddf_driver_main(& rootamdm37x_driver);277 return ddf_driver_main(&amdm37x_driver); 278 278 } 279 279
Note:
See TracChangeset
for help on using the changeset viewer.