- 根目录:
- drivers
- staging
- tidspbridge
- rmgr
- dspdrv.c
#include <linux/types.h>
#include <dspbridge/host_os.h>
#include <dspbridge/dbdefs.h>
#include <dspbridge/dbc.h>
#include <dspbridge/drv.h>
#include <dspbridge/dev.h>
#include <dspbridge/dspapi.h>
#include <dspbridge/mgr.h>
#include <dspbridge/dspdrv.h>
u32 dsp_init(u32 *init_status)
{
char dev_node[MAXREGPATHLENGTH] = "TIOMAP1510";
int status = -EPERM;
struct drv_object *drv_obj = NULL;
u32 device_node;
u32 device_node_string;
if (!api_init())
goto func_cont;
status = drv_create(&drv_obj);
if (status) {
api_exit();
goto func_cont;
}
status = drv_request_resources((u32) &dev_node, &device_node_string);
if (!status) {
status = dev_start_device((struct cfg_devnode *)
device_node_string);
if (status)
(void)drv_release_resources
((u32) device_node_string, drv_obj);
} else {
dev_dbg(bridge, "%s: drv_request_resources Failed\n", __func__);
status = -EPERM;
}
if (status) {
for (device_node = drv_get_first_dev_extension();
device_node != 0;
device_node = drv_get_next_dev_extension(device_node)) {
(void)dev_remove_device((struct cfg_devnode *)
device_node);
(void)drv_release_resources((u32) device_node, drv_obj);
}
(void)drv_destroy(drv_obj);
drv_obj = NULL;
api_exit();
dev_dbg(bridge, "%s: Logical device failed init\n", __func__);
}
func_cont:
if (!status) {
(void)api_init_complete2();
} else {
dev_dbg(bridge, "%s: Failed\n", __func__);
}
DBC_ENSURE((!status && drv_obj != NULL) ||
(status && drv_obj == NULL));
*init_status = status;
return (u32) drv_obj;
}
bool dsp_deinit(u32 device_context)
{
bool ret = true;
u32 device_node;
struct mgr_object *mgr_obj = NULL;
struct drv_data *drv_datap = dev_get_drvdata(bridge);
while ((device_node = drv_get_first_dev_extension()) != 0) {
(void)dev_remove_device((struct cfg_devnode *)device_node);
(void)drv_release_resources((u32) device_node,
(struct drv_object *)device_context);
}
(void)drv_destroy((struct drv_object *)device_context);
if (drv_datap && drv_datap->mgr_object) {
mgr_obj = drv_datap->mgr_object;
(void)mgr_destroy(mgr_obj);
} else {
pr_err("%s: Failed to retrieve the object handle\n", __func__);
}
api_exit();
return ret;
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
- 110
- 111
- 112
- 113
- 114
- 115
- 116
- 117
- 118
- 119
- 120
- 121
- 122
- 123
- 124
- 125
- 126
- 127
- 128
- 129
- 130
- 131
- 132
- 133
- 134
- 135
- 136
- 137
- 138
- 139
- 140
- 141
- 142
- 143
- 144