📄 snd_next.m
字号:
msg_return_t msg_result;
#if TypeCheck
boolean_t msg_simple;
#endif TypeCheck
unsigned int msg_size = 32;
#if UseStaticMsgType
static const msg_type_t owner_portType = {
/* msg_type_name = */ MSG_TYPE_PORT,
/* msg_type_size = */ 32,
/* msg_type_number = */ 1,
/* msg_type_inline = */ TRUE,
/* msg_type_longform = */ FALSE,
/* msg_type_deallocate = */ FALSE,
/* msg_type_unused = */ 0,
};
#endif UseStaticMsgType
#if UseStaticMsgType
static const msg_type_t RetCodeCheck = {
/* msg_type_name = */ MSG_TYPE_INTEGER_32,
/* msg_type_size = */ 32,
/* msg_type_number = */ 1,
/* msg_type_inline = */ TRUE,
/* msg_type_longform = */ FALSE,
/* msg_type_deallocate = */ FALSE,
/* msg_type_unused = */ 0
};
#endif UseStaticMsgType
#if UseStaticMsgType
static const msg_type_t dma_countCheck = {
/* msg_type_name = */ MSG_TYPE_INTEGER_32,
/* msg_type_size = */ 32,
/* msg_type_number = */ 1,
/* msg_type_inline = */ TRUE,
/* msg_type_longform = */ FALSE,
/* msg_type_deallocate = */ FALSE,
/* msg_type_unused = */ 0
};
#endif UseStaticMsgType
#if UseStaticMsgType
InP->owner_portType = owner_portType;
#else UseStaticMsgType
InP->owner_portType.msg_type_name = MSG_TYPE_PORT;
InP->owner_portType.msg_type_size = 32;
InP->owner_portType.msg_type_number = 1;
InP->owner_portType.msg_type_inline = TRUE;
InP->owner_portType.msg_type_longform = FALSE;
InP->owner_portType.msg_type_deallocate = FALSE;
#endif UseStaticMsgType
InP->owner_port /* owner_port */ = /* owner_port */ owner_port;
InP->Head.msg_simple = FALSE;
InP->Head.msg_size = msg_size;
InP->Head.msg_type = MSG_TYPE_NORMAL | MSG_TYPE_RPC;
InP->Head.msg_request_port = kern_serv_port;
InP->Head.msg_reply_port = mig_get_reply_port();
InP->Head.msg_id = 1014;
msg_result = msg_rpc(&InP->Head, MSG_OPTION_NONE, sizeof(Reply), 0, 0);
if (msg_result != RPC_SUCCESS) {
if (msg_result == RCV_INVALID_PORT)
mig_dealloc_reply_port();
return msg_result;
}
#if TypeCheck
msg_size = OutP->Head.msg_size;
msg_simple = OutP->Head.msg_simple;
#endif TypeCheck
if (OutP->Head.msg_id != 1114)
return MIG_REPLY_MISMATCH;
#if TypeCheck
if (((msg_size != 40) || (msg_simple != TRUE)) &&
((msg_size != sizeof(death_pill_t)) ||
(msg_simple != TRUE) ||
(OutP->RetCode == KERN_SUCCESS)))
return MIG_TYPE_ERROR;
#endif TypeCheck
#if TypeCheck
#if UseStaticMsgType
if (* (int *) &OutP->RetCodeType != * (int *) &RetCodeCheck)
#else UseStaticMsgType
if ((OutP->RetCodeType.msg_type_inline != TRUE) ||
(OutP->RetCodeType.msg_type_longform != FALSE) ||
(OutP->RetCodeType.msg_type_name != MSG_TYPE_INTEGER_32) ||
(OutP->RetCodeType.msg_type_number != 1) ||
(OutP->RetCodeType.msg_type_size != 32))
#endif UseStaticMsgType
return MIG_TYPE_ERROR;
#endif TypeCheck
if (OutP->RetCode != KERN_SUCCESS)
return OutP->RetCode;
#if TypeCheck
#if UseStaticMsgType
if (* (int *) &OutP->dma_countType != * (int *) &dma_countCheck)
#else UseStaticMsgType
if ((OutP->dma_countType.msg_type_inline != TRUE) ||
(OutP->dma_countType.msg_type_longform != FALSE) ||
(OutP->dma_countType.msg_type_name != MSG_TYPE_INTEGER_32) ||
(OutP->dma_countType.msg_type_number != 1) ||
(OutP->dma_countType.msg_type_size != 32))
#endif UseStaticMsgType
return MIG_TYPE_ERROR;
#endif TypeCheck
*dma_count /* dma_count */ = /* *dma_count */ OutP->dma_count;
return OutP->RetCode;
}
/* Routine InterruptCount */
mig_external kern_return_t ntsoundInterruptCount (
port_t kern_serv_port,
port_t owner_port,
int *irq_count)
{
typedef struct {
msg_header_t Head;
msg_type_t owner_portType;
port_t owner_port;
} Request;
typedef struct {
msg_header_t Head;
msg_type_t RetCodeType;
kern_return_t RetCode;
msg_type_t irq_countType;
int irq_count;
} Reply;
union {
Request In;
Reply Out;
} Mess;
register Request *InP = &Mess.In;
register Reply *OutP = &Mess.Out;
msg_return_t msg_result;
#if TypeCheck
boolean_t msg_simple;
#endif TypeCheck
unsigned int msg_size = 32;
#if UseStaticMsgType
static const msg_type_t owner_portType = {
/* msg_type_name = */ MSG_TYPE_PORT,
/* msg_type_size = */ 32,
/* msg_type_number = */ 1,
/* msg_type_inline = */ TRUE,
/* msg_type_longform = */ FALSE,
/* msg_type_deallocate = */ FALSE,
/* msg_type_unused = */ 0,
};
#endif UseStaticMsgType
#if UseStaticMsgType
static const msg_type_t RetCodeCheck = {
/* msg_type_name = */ MSG_TYPE_INTEGER_32,
/* msg_type_size = */ 32,
/* msg_type_number = */ 1,
/* msg_type_inline = */ TRUE,
/* msg_type_longform = */ FALSE,
/* msg_type_deallocate = */ FALSE,
/* msg_type_unused = */ 0
};
#endif UseStaticMsgType
#if UseStaticMsgType
static const msg_type_t irq_countCheck = {
/* msg_type_name = */ MSG_TYPE_INTEGER_32,
/* msg_type_size = */ 32,
/* msg_type_number = */ 1,
/* msg_type_inline = */ TRUE,
/* msg_type_longform = */ FALSE,
/* msg_type_deallocate = */ FALSE,
/* msg_type_unused = */ 0
};
#endif UseStaticMsgType
#if UseStaticMsgType
InP->owner_portType = owner_portType;
#else UseStaticMsgType
InP->owner_portType.msg_type_name = MSG_TYPE_PORT;
InP->owner_portType.msg_type_size = 32;
InP->owner_portType.msg_type_number = 1;
InP->owner_portType.msg_type_inline = TRUE;
InP->owner_portType.msg_type_longform = FALSE;
InP->owner_portType.msg_type_deallocate = FALSE;
#endif UseStaticMsgType
InP->owner_port /* owner_port */ = /* owner_port */ owner_port;
InP->Head.msg_simple = FALSE;
InP->Head.msg_size = msg_size;
InP->Head.msg_type = MSG_TYPE_NORMAL | MSG_TYPE_RPC;
InP->Head.msg_request_port = kern_serv_port;
InP->Head.msg_reply_port = mig_get_reply_port();
InP->Head.msg_id = 1015;
msg_result = msg_rpc(&InP->Head, MSG_OPTION_NONE, sizeof(Reply), 0, 0);
if (msg_result != RPC_SUCCESS) {
if (msg_result == RCV_INVALID_PORT)
mig_dealloc_reply_port();
return msg_result;
}
#if TypeCheck
msg_size = OutP->Head.msg_size;
msg_simple = OutP->Head.msg_simple;
#endif TypeCheck
if (OutP->Head.msg_id != 1115)
return MIG_REPLY_MISMATCH;
#if TypeCheck
if (((msg_size != 40) || (msg_simple != TRUE)) &&
((msg_size != sizeof(death_pill_t)) ||
(msg_simple != TRUE) ||
(OutP->RetCode == KERN_SUCCESS)))
return MIG_TYPE_ERROR;
#endif TypeCheck
#if TypeCheck
#if UseStaticMsgType
if (* (int *) &OutP->RetCodeType != * (int *) &RetCodeCheck)
#else UseStaticMsgType
if ((OutP->RetCodeType.msg_type_inline != TRUE) ||
(OutP->RetCodeType.msg_type_longform != FALSE) ||
(OutP->RetCodeType.msg_type_name != MSG_TYPE_INTEGER_32) ||
(OutP->RetCodeType.msg_type_number != 1) ||
(OutP->RetCodeType.msg_type_size != 32))
#endif UseStaticMsgType
return MIG_TYPE_ERROR;
#endif TypeCheck
if (OutP->RetCode != KERN_SUCCESS)
return OutP->RetCode;
#if TypeCheck
#if UseStaticMsgType
if (* (int *) &OutP->irq_countType != * (int *) &irq_countCheck)
#else UseStaticMsgType
if ((OutP->irq_countType.msg_type_inline != TRUE) ||
(OutP->irq_countType.msg_type_longform != FALSE) ||
(OutP->irq_countType.msg_type_name != MSG_TYPE_INTEGER_32) ||
(OutP->irq_countType.msg_type_number != 1) ||
(OutP->irq_countType.msg_type_size != 32))
#endif UseStaticMsgType
return MIG_TYPE_ERROR;
#endif TypeCheck
*irq_count /* irq_count */ = /* *irq_count */ OutP->irq_count;
return OutP->RetCode;
}
/* Routine Write */
mig_external kern_return_t ntsoundWrite (
port_t kern_serv_port,
port_t owner_port,
sound_data_t data,
unsigned int dataCnt,
int *actual_count)
{
typedef struct {
msg_header_t Head;
msg_type_t owner_portType;
port_t owner_port;
msg_type_long_t dataType;
short data[7000];
} Request;
typedef struct {
msg_header_t Head;
msg_type_t RetCodeType;
kern_return_t RetCode;
msg_type_t actual_countType;
int actual_count;
} Reply;
union {
Request In;
Reply Out;
} Mess;
register Request *InP = &Mess.In;
register Reply *OutP = &Mess.Out;
msg_return_t msg_result;
#if TypeCheck
boolean_t msg_simple;
#endif TypeCheck
unsigned int msg_size = 44;
/* Maximum request size 14044 */
unsigned int msg_size_delta;
#if UseStaticMsgType
static const msg_type_t owner_portType = {
/* msg_type_name = */ MSG_TYPE_PORT,
/* msg_type_size = */ 32,
/* msg_type_number = */ 1,
/* msg_type_inline = */ TRUE,
/* msg_type_longform = */ FALSE,
/* msg_type_deallocate = */ FALSE,
/* msg_type_unused = */ 0,
};
#endif UseStaticMsgType
#if UseStaticMsgType
static const msg_type_long_t dataType = {
{
/* msg_type_name = */ 0,
/* msg_type_size = */ 0,
/* msg_type_number = */ 0,
/* msg_type_inline = */ TRUE,
/* msg_type_longform = */ TRUE,
/* msg_type_deallocate = */ FALSE,
},
/* msg_type_long_name = */ MSG_TYPE_INTEGER_16,
/* msg_type_long_size = */ 16,
/* msg_type_long_number = */ 7000,
};
#endif UseStaticMsgType
#if UseStaticMsgType
static const msg_type_t RetCodeCheck = {
/* msg_type_name = */ MSG_TYPE_INTEGER_32,
/* msg_type_size = */ 32,
/* msg_type_number = */ 1,
/* msg_type_inline = */ TRUE,
/* msg_type_longform = */ FALSE,
/* msg_type_deallocate = */ FALSE,
/* msg_type_unused = */ 0
};
#endif UseStaticMsgType
#if UseStaticMsgType
static const msg_type_t actual_countCheck = {
/* msg_type_name = */ MSG_TYPE_INTEGER_32,
/* msg_type_size = */ 32,
/* msg_type_number = */ 1,
/* msg_type_inline = */ TRUE,
/* msg_type_longform = */ FALSE,
/* msg_type_deallocate = */ FALSE,
/* msg_type_unused = */ 0
};
#endif UseStaticMsgType
#if UseStaticMsgType
InP->owner_portType = owner_portType;
#else UseStaticMsgType
InP->owner_portType.msg_type_name = MSG_TYPE_PORT;
InP->owner_portType.msg_type_size = 32;
InP->owner_portType.msg_type_number = 1;
InP->owner_portType.msg_type_inline = TRUE;
InP->owner_portType.msg_type_longform = FALSE;
InP->owner_portType.msg_type_deallocate = FALSE;
#endif UseStaticMsgType
InP->owner_port /* owner_port */ = /* owner_port */ owner_port;
#if UseStaticMsgType
InP->dataType = dataType;
#else UseStaticMsgType
InP->dataType.msg_type_long_name = MSG_TYPE_INTEGER_16;
InP->dataType.msg_type_long_size = 16;
InP->dataType.msg_type_header.msg_type_inline = TRUE;
InP->dataType.msg_type_header.msg_type_longform = TRUE;
InP->dataType.msg_type_header.msg_type_deallocate = FALSE;
#endif UseStaticMsgType
if (dataCnt > 7000)
return MIG_ARRAY_TOO_LARGE;
bcopy((char *) data, (char *) InP->data, 2 * dataCnt);
InP->dataType.msg_type_long_number /* dataCnt */ = /* dataType.msg_type_long_number */ dataCnt;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -