xref: /utopia/UTPA2-700.0.x/modules/sem/utopia_adaption/sem/SEM_adp.c (revision 53ee8cc121a030b8d368113ac3e966b4705770ef)
1 #include <linux/kernel.h>
2 #include <linux/string.h>
3 #include <linux/slab.h>
4 
5 
6 #include "MsTypes.h"
7 #include "utopia.h"
8 #include "drvSEM.h"
9 #include "drvSEM_priv.h"
10 #include "SEM_adp.h"
11 #include "utopia_adp.h"
12 
13 
14 UADP_SPT_0NXT_DEF(SEM_GETRESOURCE_PARAM);
15 UADP_SPT_0NXT_DEF(SEM_FREERESOURCE_PARAM);
16 UADP_SPT_0NXT_DEF(SEM_RESETRESOURCE_PARAM);
17 UADP_SPT_0NXT_DEF(SEM_GETRESOURCEID_PARAM);
18 UADP_SPT_0NXT_DEF(SEM_GETLIBVER_PARAM);
19 UADP_SPT_0NXT_DEF(SEM_LOCK_PARAM);
20 UADP_SPT_0NXT_DEF(SEM_UNLOCK_PARAM);
21 UADP_SPT_0NXT_DEF(SEM_DELETE_PARAM);
22 
23 
24 
25 
SEM_adp_Init(FUtopiaIOctl * pIoctl)26 MS_U32 SEM_adp_Init(FUtopiaIOctl* pIoctl)
27 {
28 //member of struct
29 //set table
30     UADP_SPT_0NXT(SEM_GETRESOURCE_PARAM);
31     UADP_SPT_0NXT(SEM_FREERESOURCE_PARAM);
32     UADP_SPT_0NXT(SEM_RESETRESOURCE_PARAM);
33     UADP_SPT_0NXT(SEM_GETRESOURCEID_PARAM);
34     UADP_SPT_0NXT(SEM_GETLIBVER_PARAM);
35     UADP_SPT_0NXT(SEM_LOCK_PARAM);
36     UADP_SPT_0NXT(SEM_UNLOCK_PARAM);
37     UADP_SPT_0NXT(SEM_DELETE_PARAM);
38 	*pIoctl= (FUtopiaIOctl)SEM_adp_Ioctl;
39 	return 0;
40 }
41 
42 
43 
44 typedef void (*IOCTL_TIMER_INIT) (void);
45 typedef void (*IOCTL_TIMER_EXIT) (void);
SEM_adp_Ioctl(void * pInstanceTmp,MS_U32 u32Cmd,void * const pArgs)46 MS_U32 SEM_adp_Ioctl(void* pInstanceTmp, MS_U32 u32Cmd, void* const pArgs)
47 {
48     MS_U32 u32Ret=0;
49     char buffer_arg[2048];
50     switch(u32Cmd)
51     {
52         case MDrv_CMD_SEM_Get_Resource:
53             u32Ret=UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_SEM_GETRESOURCE_PARAM, spt_SEM_GETRESOURCE_PARAM ,buffer_arg,sizeof(buffer_arg));
54         case MDrv_CMD_SEM_Free_Resource:
55             u32Ret=UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_SEM_FREERESOURCE_PARAM, spt_SEM_FREERESOURCE_PARAM ,buffer_arg,sizeof(buffer_arg));
56         case MDrv_CMD_SEM_Reset_Resource:
57             u32Ret=UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_SEM_RESETRESOURCE_PARAM, spt_SEM_RESETRESOURCE_PARAM ,buffer_arg,sizeof(buffer_arg));
58         case MDrv_CMD_SEM_Get_ResourceID:
59             u32Ret=UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_SEM_GETRESOURCEID_PARAM, spt_SEM_GETRESOURCEID_PARAM,buffer_arg,sizeof(buffer_arg));
60         case MDrv_CMD_SEM_GetLibVer:
61             u32Ret=UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_SEM_GETLIBVER_PARAM,spt_SEM_GETLIBVER_PARAM,buffer_arg,sizeof(buffer_arg));
62         case MDrv_CMD_SEM_Lock:
63             u32Ret=UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_SEM_LOCK_PARAM, spt_SEM_LOCK_PARAM ,buffer_arg,sizeof(buffer_arg));
64         case MDrv_CMD_SEM_Unlock:
65             u32Ret=UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_SEM_UNLOCK_PARAM, spt_SEM_UNLOCK_PARAM ,buffer_arg,sizeof(buffer_arg));
66         case MDrv_CMD_SEM_Delete:
67             u32Ret=UADPBypassIoctl(pInstanceTmp,u32Cmd,pArgs,spt_SEM_DELETE_PARAM, spt_SEM_DELETE_PARAM ,buffer_arg,sizeof(buffer_arg));
68 		default:
69             break;
70     }
71 	return u32Ret;
72 }