Control, transfer, control, transfer in USB is a bit different from the other transfer types we already
explained.
Every one of the other TransFair types we talked about consists of only a single transaction.
But control, transfer or every control, every every controlled TransFair consists of multiple USV
transactions, and these transactions are divided into three stages.
So let's now talk about these three stages.
But before starting, let me tell you this.
Gray packets are packets sent by the host and white packets are packets sent by the device.
So let's start explaining the first stage in every single control transfer setup stage setup stage is
always the first stage in all controlled transfers and set up stage consists of one single USB transaction
and just it's a normal transaction, which consists of three packets as we see here, token packet,
the data packet, then handshake packet.
The token packet in this setup stage is a setup token and this is the first time we see setup token
inus.
And this is probably the only place where you will see a set up tour continues and as and if you remember,
we already said that set up Tolkan is very similar to out Tolkan.
So it just indicates that the host will be sending some data to the device.
And this is exactly what we see here.
And when the device receives all the data successfully, it acknowledged that by sending acknowledged
handshake.
So again, the first stage in every single control transfer is set up stage and set up stage consists
of only one single USB transaction.
It's a set up transaction because the token of this transaction is set up token and this setup token
tells the device that the host will be sending some special data.
And here this sentence is very important.
Let me repeat this again.
Set up token, unlike out token setup, Token tells the device that the host will be sending some special
data or let's say some special pre structured data in the data packet.
And this special pre structured data is called USPI request.
In simple words, set up stage is responsible for sending a USB request from the host to the device.
And this request, or let's say that the details of this request exist inside the data packet of the
setup stage.
And this request may be asking the device to receive some data from the host or it may be asking the
device to send some data to the host.
It depends on the request itself.
So let me repeat this one last time again, set up stage is the very first stage in every single control
TransFair.
And it consists of one single transaction, and this transaction is a set up transaction because it
begins when the host sends a set up token.
This set token tells the device that in the upcoming data packet, there will be a request coming from
the host.
And this USB request is just let's say it's just normal data, but it's pre structured.
So every single bit of this data means something special.
We will see the structure and details of the important U.S. request soon.
And finally, when the device receives that this request successfully, it acknowledged by sending an
AK hansei packet.
Hopefully this is clear.
Now, just before moving to the next stage of the control transfer.
You probably noticed that I didn't draw or mention nacke and total handshake packets here.
This is simply because USB devices or let's say more accurately from now, add up USB functions are
not allowed to reply to set up tokens by Mac or Stoel handshake.
The device must do its its best to be able to always receive set up tokens.
And if something wrong happened, the device can only ignore what it received without sending any handshake
packet.
This is why I didn't mention Mac and stole packets here.
The second stage in USV Control TransFair is data stage.
Data stage is an optional stage, which means it may present in some but not all of controlled transfers.
And if control transfer includes data stage, this data stage may consist of one to multiple USB transactions.
So unlike setup stage, which consists only of a single USB transaction, data stage can consist of
multiple USB transactions.
And if a control transfer has a data stage or not, and how many transactions data stage should have,
that totally depends on the USB requests in the setup stage.
So in simple words, the USB request may be asking the device to send some data to the host, or it
may be telling the device to receive some data from the host.
In such cases, data stage will exist and how many transactions it will include.
This totally depends on how big the data the host when the host wants to send or receive to or from
the device.
So if the host in the USB request in the setup stage is asking the device to send some data to the host,
then the transaction in the data stage will be in data transactions.
So this here.
Because the data will be flowing from the device to the host.
On the other hand, if the host in the U.S. request is requesting the device or is requesting from the
device to receive some some data from the host, then data stage will include out transactions.
Like this here.
So maybe single or multiple out transactions and the same year, maybe one or multiple in transactions.
This totally depends on the U.S. request itself and on the size of data that will be sent or received,
and here, as you can see this in transaction or this transaction or.
Just very normal in and all transactions, just like what we already saw before in the other transfer
types.
So in the data stage, when the host wants to receive some data from the device, it sends an Intercon.
Then the device starts sending the data and the host acknowledged receiving the data when everything
is received or was received successfully.
And here the device has again the possibility to reply by Nacke or total handshake packets, and similarly,
if the host wants the device to receive some data, it sends in the data stage and out packet or outtalking,
let's say.
Then it sends the data and the device acknowledges receiving the data.
If everything was received successfully, so very normal in or out transactions.
Let me remind you again here.
I'm just showing you one transaction in both cases.
So one in transaction in case the host requests receiving some data and one transaction in case the
host is requesting the device to receive some data.
But the stage may include not only one transaction, but multiple transactions.
So we can have multiple in transactions in the data stage or multiple out transactions in that data
stage.
This is, of course, if data packet is too small to send the whole data in only a single packet, then
sending multiple transactions is required.
And finally, the last stage in TransFair is status stage.
Status stage includes only one single USB transaction, and this transaction here in the status stage
is always the opposite of the data stage.
What does this mean?
This means if the data in the data stage was sent in the indirection.
Then the stage, the stage will be an outdoor transaction and similarly, if the direction of the data
in the data stage was out.
Then the status stage will be and in transaction, and this makes total sense because here if the host
in the setup stage requested some data from the device.
Then the device will be sending some data in the data stage.
And when the host receives the whole data, it will tell that by sending the opposite transaction,
so the transactions in that data stage where in transactions then the host will finish the whole control
transfer by sending an out transaction.
And similarly, if in the setup stage, if the host requested the device to receive some data, then
the host will be sending the data in the data stage.
And when the host finishes sending the whole data, it will tell the device that the whole data has
been sent by sending the opposite transaction, which is an in transaction.
And the data packet in the state of stage has no data in it, it's a zero Leontes data packet, which
means it has no payload.
If the transaction in the state stage was an out transaction or in transaction, it doesn't matter.
Data packet in status stage includes no data.
It has no payload because it's just a signal to tell the host or the device that control transfer has
just finished.
Hopefully, you understand now USB control transfers, because this is a very important topic here and
we will spend a lot of time in implementing this principle and this figure here or the information or
the mechanism you see here in this figure.
So please try to understand it as good as possible.