コード例 #1
0
ファイル: protocol.c プロジェクト: MuMu360121/jordan-kernel
/*
 * TransmitChannelSignal transmits a four int8 value to the channel
 *
 * Params:
 * acktype specifies host or client as well as failure or success
 * channel is the channel to be signaled
 * signal is the value to be delivered
 * mux is the MUX object the data is to be transmitted through
 */
int32 TransmitChannelSignal(int8 acktype, int8 channel, int32 signal,
			    MUX *mux)
{
	COMMBUFF *commbuff;
	CHANNELSIGNAL_PACKET *packetdata;

	DEBUG("TransmitChannelSignal(%lu, %lu, %lu, %p)\n",
	      (int32) acktype, (int32) channel, signal, mux);

	commbuff = int_alloc_commbuff(sizeof(CHANNELSIGNAL_PACKET));

	packetdata = (CHANNELSIGNAL_PACKET *) commbuff_data(commbuff);
	packetdata->type = PACKETTYPE_CHANNELSIGNAL;

	commbuff_copyin_byte(commbuff,
			     offsetof(CHANNELSIGNAL_PACKET, acktype),
			     acktype);
	commbuff_copyin_byte(commbuff,
			     offsetof(CHANNELSIGNAL_PACKET, channel),
			     channel);
	commbuff_copyin_dword(commbuff,
			      offsetof(CHANNELSIGNAL_PACKET, signal),
			      signal);

	queue_commbuff(commbuff, &mux->send_queue);

	mux->total_queued_amount += sizeof(CHANNELSIGNAL_PACKET);

	task_schedule(&mux->send_task);

	return DEBUGERROR(ERROR_NONE);
}
コード例 #2
0
/*
 * TransmitEnableChannel assembles a control enable channel packet and initializes the transmit procedure
 *
 * Params:
 * acktype specifies host or client as well as failure or success
 * channel is the channel to be enabled
 * host_interface is the interface which belongs to the host and is requesting the enable
 * client_interface is the interface which belongs to the client and is responding to the enable
 * bytecredit is the size of the receive buffer on the senders side
 * sendcredit is the number of sends available to the senders side
 * mux is the MUX object the data is to be transmitted through
 */
int32 TransmitEnableChannel (
    int8  acktype,
    int8  channel,
    int8  host_interface,
    int8  client_interface,
    int32 bytecredit,
    int32 sendcredit,
    MUX*  mux
)
{
    COMMBUFF*             commbuff;
    ENABLECHANNEL_PACKET* packetdata;

    DEBUG(
        "TransmitEnableChannel(%lu, %lu, %lu, %lu, %lu, %lu, %p)\n",
        (int32)acktype,
        (int32)channel,
        (int32)host_interface,
        (int32)client_interface,
        (int32)bytecredit,
        (int32)sendcredit,
        mux
    );

    commbuff = int_alloc_commbuff(sizeof(ENABLECHANNEL_PACKET));

    convert_dword(bytecredit);
    convert_dword(sendcredit);

    packetdata       = (ENABLECHANNEL_PACKET*)commbuff_data(commbuff);
    packetdata->type = PACKETTYPE_ENABLECHANNEL;

    commbuff_copyin_byte(commbuff, offsetof(ENABLECHANNEL_PACKET, acktype), acktype);
    commbuff_copyin_byte(commbuff, offsetof(ENABLECHANNEL_PACKET, channel), channel);
    commbuff_copyin_byte(commbuff, offsetof(ENABLECHANNEL_PACKET, host_interface), host_interface);
    commbuff_copyin_byte(commbuff, offsetof(ENABLECHANNEL_PACKET, client_interface), client_interface);
    commbuff_copyin_dword(commbuff, offsetof(ENABLECHANNEL_PACKET, bytecredit), bytecredit);
    commbuff_copyin_dword(commbuff, offsetof(ENABLECHANNEL_PACKET, sendcredit), sendcredit);

    queue_commbuff(commbuff, &mux->send_queue);

    mux->total_queued_amount += sizeof(ENABLECHANNEL_PACKET);

    task_schedule(&mux->send_task);

    return DEBUGERROR(ERROR_NONE);
}
コード例 #3
0
ファイル: protocol.c プロジェクト: MuMu360121/jordan-kernel
/*
 * TransmitCredit assembles a control credit packet and
 * initializes the transmit procedure
 *
 * Params:
 * acktype specifies host or client as well as failure or success
 * channel is the channel the credit should be applied to
 * bytecredit is the amount the byte credit should be increased
 * sendcredit is the amount the send credit should be increased
 * mux is the MUX object the data is to be transmitted through
 */
int32 TransmitCredit(int8 acktype, int8 channel, int32 bytecredit,
		     int32 sendcredit, MUX *mux)
{
	COMMBUFF *commbuff;
	CREDIT_PACKET *packetdata;

	DEBUG("TransmitCredit(%lu, %lu, %lu, 0x%lu, %p)\n",
	      (int32) acktype,
	      (int32) channel,
	      (int32) bytecredit, (int32) sendcredit, mux);

	commbuff = int_alloc_commbuff(sizeof(CREDIT_PACKET));

	convert_dword(bytecredit);
	convert_dword(sendcredit);

	packetdata = (CREDIT_PACKET *) commbuff_data(commbuff);
	packetdata->type = PACKETTYPE_CREDIT;

	commbuff_copyin_byte(commbuff, offsetof(CREDIT_PACKET, acktype),
			     acktype);
	commbuff_copyin_byte(commbuff, offsetof(CREDIT_PACKET, channel),
			     channel);
	commbuff_copyin_dword(commbuff,
			      offsetof(CREDIT_PACKET, bytecredit),
			      bytecredit);
	commbuff_copyin_dword(commbuff,
			      offsetof(CREDIT_PACKET, sendcredit),
			      sendcredit);

	queue_commbuff(commbuff, &mux->send_queue);

	mux->total_queued_amount += sizeof(CREDIT_PACKET);

	task_schedule(&mux->send_task);

	return DEBUGERROR(ERROR_NONE);
}