summaryrefslogtreecommitdiff
path: root/drivers/dsp/syslink/multicore_ipc/ipc_ioctl.c
blob: 2dba28c71dbe392749e918e265ecfec15d778aad (plain)
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
/*
 *  ipc_ioctl.c
 *
 *  This is the collection of ioctl functions that will invoke various ipc
 *  module level functions based on user comands
 *
 *  Copyright (C) 2008-2009 Texas Instruments, Inc.
 *
 *  This package is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License version 2 as
 *  published by the Free Software Foundation.
 *
 *  THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
 *  IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 *  WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
 *  PURPOSE.
 */

#include <linux/uaccess.h>

#include <gt.h>
#include <ipc_ioctl.h>
#include <multiproc_ioctl.h>
#include <nameserver_ioctl.h>
#include <heapbuf_ioctl.h>
#include <sharedregion_ioctl.h>
#include <gatepeterson_ioctl.h>
#include <listmp_sharedmemory_ioctl.h>
#include <messageq_ioctl.h>
#include <messageq_transportshm_ioctl.h>
#include <nameserver_remotenotify_ioctl.h>

/*
 * ======== ipc_ioctl_router ========
 *  Purpose:
 *  This will route the ioctl commands to proper
 *  modules
 */
int ipc_ioc_router(u32 cmd, ulong arg)
{
	s32 retval = 0;
	u32 ioc_nr = _IOC_NR(cmd);

	printk(KERN_ERR "ipc_ioc_router \n"
		"cmd: %x, ioc_nr: %x(%d), arg: %x\n", cmd, ioc_nr, ioc_nr,
		(unsigned int) arg);

	if (ioc_nr >= MULTIPROC_BASE_CMD && ioc_nr <= MULTIPROC_END_CMD)
		retval = multiproc_ioctl(NULL, NULL, cmd, arg);
	else if (ioc_nr >= NAMESERVER_BASE_CMD &&
					ioc_nr <= NAMESERVER_END_CMD)
		retval = nameserver_ioctl(NULL, NULL, cmd, arg);
	else if (ioc_nr >= HEAPBUF_BASE_CMD && ioc_nr <= HEAPBUF_END_CMD)
		retval = heapbuf_ioctl(NULL, NULL, cmd, arg);
	else if (ioc_nr >= SHAREDREGION_BASE_CMD &&
					ioc_nr <= SHAREDREGION_END_CMD)
		retval = sharedregion_ioctl(NULL, NULL, cmd, arg);
	else if (ioc_nr >= GATEPETERSON_BASE_CMD &&
					ioc_nr <= GATEPETERSON_END_CMD)
		retval = gatepeterson_ioctl(NULL, NULL, cmd, arg);
	else if (ioc_nr >= LISTMP_SHAREDMEMORY_BASE_CMD &&
					ioc_nr <= LISTMP_SHAREDMEMORY_END_CMD)
		retval = listmp_sharedmemory_ioctl(NULL, NULL, cmd, arg);
	else if (ioc_nr >= MESSAGEQ_BASE_CMD &&
					ioc_nr <= MESSAGEQ_END_CMD)
		retval = messageq_ioctl(NULL, NULL, cmd, arg);
	else if (ioc_nr >= MESSAGEQ_TRANSPORTSHM_BASE_CMD &&
					ioc_nr <= MESSAGEQ_TRANSPORTSHM_END_CMD)
		retval = messageq_transportshm_ioctl(NULL, NULL, cmd, arg);
	else if (ioc_nr >= NAMESERVERREMOTENOTIFY_BASE_CMD &&
				ioc_nr <= NAMESERVERREMOTENOTIFY_END_CMD)
		retval = nameserver_remotenotify_ioctl(NULL, NULL, cmd, arg);
	else
		retval = -ENOTTY;

	return retval;
}