80 if (transferDelayCounter > 0) {
81 --transferDelayCounter;
83 if (responseQueue.
empty()) {
86 retval = readCurrentByteFromCurrentSector();
87 if (currentByteInSector ==
sizeof(sectorBuf)) {
96 if (currentSector >= hd->getNbSectors()) {
98 retval = DATA_ERROR_TOKEN_OUT_OF_RANGE;
100 retval = readCurrentByteFromCurrentSector();
101 if (currentByteInSector ==
sizeof(sectorBuf)) {
103 currentByteInSector = -1;
123 if (currentByteInSector == -1) {
124 if (value == START_BLOCK_TOKEN) {
125 currentByteInSector++;
129 if (currentByteInSector <
int(
sizeof(sectorBuf))) {
130 sectorBuf.
raw[currentByteInSector] = value;
132 currentByteInSector++;
133 if (currentByteInSector == (
sizeof(sectorBuf) + 2)) {
134 byte response = DRT_ACCEPTED;
137 hd->writeSector(currentSector, sectorBuf);
139 response = DRT_WRITE_ERROR;
142 transferDelayCounter = 1;
148 if (currentByteInSector == -1) {
149 if (value == STOP_TRAN_TOKEN) {
152 if (value == START_BLOCK_TOKEN_MBW) {
153 currentByteInSector++;
157 if (currentByteInSector <
int(
sizeof(sectorBuf))) {
158 sectorBuf.
raw[currentByteInSector] = value;
160 currentByteInSector++;
161 if (currentByteInSector == (
sizeof(sectorBuf) + 2)) {
163 byte response = DRT_ACCEPTED;
164 if (currentSector >= hd->getNbSectors()) {
165 response = DRT_WRITE_ERROR;
173 hd->writeSector(currentSector, sectorBuf);
174 currentByteInSector = -1;
177 response = DRT_WRITE_ERROR;
186 transferDelayCounter = 1;
192 if ((cmdIdx == 0 && (value >> 6) == 1)
194 cmdBuf[cmdIdx] = value;