79 if (transferDelayCounter > 0) {
80 --transferDelayCounter;
82 if (responseQueue.
empty()) {
85 retval = readCurrentByteFromCurrentSector();
86 if (currentByteInSector ==
sizeof(sectorBuf)) {
95 if (currentSector >= hd->getNbSectors()) {
97 retval = DATA_ERROR_TOKEN_OUT_OF_RANGE;
99 retval = readCurrentByteFromCurrentSector();
100 if (currentByteInSector ==
sizeof(sectorBuf)) {
102 currentByteInSector = -1;
122 if (currentByteInSector == -1) {
123 if (value == START_BLOCK_TOKEN) {
124 currentByteInSector++;
128 if (currentByteInSector <
int(
sizeof(sectorBuf))) {
129 sectorBuf.
raw[currentByteInSector] = value;
131 currentByteInSector++;
132 if (currentByteInSector == (
sizeof(sectorBuf) + 2)) {
133 byte response = DRT_ACCEPTED;
136 hd->writeSector(currentSector, sectorBuf);
138 response = DRT_WRITE_ERROR;
141 transferDelayCounter = 1;
147 if (currentByteInSector == -1) {
148 if (value == STOP_TRAN_TOKEN) {
151 if (value == START_BLOCK_TOKEN_MBW) {
152 currentByteInSector++;
156 if (currentByteInSector <
int(
sizeof(sectorBuf))) {
157 sectorBuf.
raw[currentByteInSector] = value;
159 currentByteInSector++;
160 if (currentByteInSector == (
sizeof(sectorBuf) + 2)) {
162 byte response = DRT_ACCEPTED;
163 if (currentSector >= hd->getNbSectors()) {
164 response = DRT_WRITE_ERROR;
172 hd->writeSector(currentSector, sectorBuf);
173 currentByteInSector = -1;
176 response = DRT_WRITE_ERROR;
185 transferDelayCounter = 1;
191 if ((cmdIdx == 0 && (value >> 6) == 1)
193 cmdBuf[cmdIdx] = value;