Changeset 74db5a1 in mainline for uspace/drv/fb/amdm37x_dispc/main.c


Ignore:
Timestamp:
2013-01-20T20:47:02Z (11 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9cc4b2b4
Parents:
163bc23
Message:

amdm37x_dispc: Add function initialization.

Covnert register map to uspace.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/fb/amdm37x_dispc/main.c

    r163bc23 r74db5a1  
    2828 */
    2929
    30 /** @addtogroup kfb
     30/** @addtogroup amdm37x
    3131 * @{
    3232 */
     
    3535 */
    3636
     37#include <ddf/log.h>
    3738#include <errno.h>
     39#include <str_error.h>
    3840#include <stdio.h>
     41#include <ops/graph_dev.h>
     42#include <graph.h>
    3943#include "port.h"
     44
     45#include "amdm37x_dispc.h"
    4046
    4147#define NAME  "amdm37x_dispc"
    4248
     49static graph_dev_ops_t graph_vsl_dev_ops = {
     50        .connect = (connect_func) &graph_visualizer_connection
     51};
     52
     53static ddf_dev_ops_t graph_fun_ops = {
     54        .interfaces[GRAPH_DEV_IFACE] = &graph_vsl_dev_ops
     55};
     56
    4357static int amdm37x_dispc_dev_add(ddf_dev_t *dev)
    4458{
    45         port_init(dev);
    46         printf("%s: Accepting connections\n", NAME);
     59        ddf_fun_t *fun = ddf_fun_create(dev, fun_exposed, "dispc");
     60        if (!fun) {
     61                ddf_log_error("Failed to create visualizer function\n");
     62                return ENOMEM;
     63        }
     64        amdm37x_dispc_t *dispc =
     65            ddf_fun_data_alloc(fun, sizeof(amdm37x_dispc_t));
     66        if (!dispc) {
     67                ddf_log_error("Failed to allocate dispc structure\n");
     68                ddf_fun_destroy(fun);
     69                return ENOMEM;
     70        }
     71        ddf_fun_set_ops(fun, &graph_fun_ops);
     72        int ret = amdm37x_dispc_init(dispc);
     73        if (ret != EOK) {
     74                ddf_log_error("Failed to init dispc: %s\n", str_error(ret));
     75                ddf_fun_destroy(fun);
     76                return ret;
     77        }
     78        ret = ddf_fun_bind(fun);
     79        if (ret != EOK) {
     80                ddf_log_error("Failed to bind function: %s\n", str_error(ret));
     81                amdm37x_dispc_fini(dispc);
     82                ddf_fun_destroy(fun);
     83                return ret;
     84        }
    4785        return EOK;
    4886}
     
    6098{
    6199        printf("%s: HelenOS AM/DM37x framebuffer driver\n", NAME);
     100        ddf_log_init(NAME);
    62101        return ddf_driver_main(&amdm37x_dispc_driver);
    63102}
Note: See TracChangeset for help on using the changeset viewer.