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
|
/****************************************************************************
*
* Copyright(c) 2010 Yamaha Corporation. All rights reserved.
*
* Module : mcdevprof.c
*
* Description : MC Driver device profile
*
* Version : 1.0.0 2010.09.10
*
****************************************************************************/
#include "mcdevprof.h"
#include "mcmachdep.h"
#if MCDRV_DEBUG_LEVEL
#include "mcdebuglog.h"
#endif
static MCDRV_DEV_ID geDevID = eMCDRV_DEV_ID_1N2;
static UINT8 gabValid[][3] =
{
/* MC-1N2 MC-2N MC-3N */
{0, 0, 1}, /* DI2 */
{0, 0, 1}, /* RANGE */
{0, 0, 1}, /* BYPASS */
{0, 0, 1}, /* ADC1 */
{0, 0, 0}, /* PAD2 */
{0, 1, 1}, /* DBEX */
{0, 0, 1}, /* GPMODE */
{0, 0, 1}, /* DTMF */
{0, 0, 1}, /* IRQ */
};
static UINT8 gabSlaveAddr[3][2] =
{
/* Digital Analog */
{0x3A, 0x3A}, /* MC1N2 */
{0x00, 0x00}, /* MC2N */
{0x00, 0x00} /* MC3N */
};
/****************************************************************************
* McDevProf_SetDevId
*
* Description:
* Set device ID.
* Arguments:
* eDevId device ID
* Return:
* none
*
****************************************************************************/
void McDevProf_SetDevId(MCDRV_DEV_ID eDevId)
{
#if (MCDRV_DEBUG_LEVEL>=4)
McDebugLog_FuncIn("McDevProf_SetDevId");
#endif
geDevID = eDevId;
#if (MCDRV_DEBUG_LEVEL>=4)
McDebugLog_FuncOut("McDevProf_SetDevId", 0);
#endif
}
/****************************************************************************
* McDevProf_IsValid
*
* Description:
* Validity function.
* Arguments:
* function kind
* Return:
* 0:Invalid/1:Valid
*
****************************************************************************/
UINT8 McDevProf_IsValid
(
MCDRV_FUNC_KIND eFuncKind
)
{
UINT8 bData;
#if (MCDRV_DEBUG_LEVEL>=4)
SINT32 sdRet;
McDebugLog_FuncIn("McDevProf_IsValid");
#endif
bData = gabValid[eFuncKind][geDevID];
#if (MCDRV_DEBUG_LEVEL>=4)
sdRet = (SINT32)bData;
McDebugLog_FuncOut("McDevProf_IsValid", &sdRet);
#endif
return bData;
}
/****************************************************************************
* McDevProf_GetSlaveAddr
*
* Description:
* get slave address.
* Arguments:
* eSlaveAddrKind slave address kind
* Return:
* slave address
*
****************************************************************************/
UINT8 McDevProf_GetSlaveAddr
(
MCDRV_SLAVE_ADDR_KIND eSlaveAddrKind
)
{
UINT8 bData = gabSlaveAddr[geDevID][eSlaveAddrKind];
#if (MCDRV_DEBUG_LEVEL>=4)
SINT32 sdRet;
McDebugLog_FuncIn("McDevProf_GetSlaveAddr");
#endif
#if (MCDRV_DEBUG_LEVEL>=4)
sdRet = (SINT32)bData;
McDebugLog_FuncOut("McDevProf_GetSlaveAddr", &sdRet);
#endif
return bData;
}
|