code: def _get_free_words(self, blockAllowed, isRead):
          
          if blockAllowed:
              # DAP_TransferBlock request packet:
              #   BYTE | BYTE *****| SHORT**********| BYTE *************| WORD *********|
              # > 0x06 | DAP Index | Transfer Count | Transfer Request  | Transfer Data |
              #  ******|***********|****************|*******************|+++++++++++++++|
              send = self._size - 5 - 4 * self._write_count
  
              # DAP_TransferBlock response packet:
              #   BYTE | SHORT *********| BYTE *************| WORD *********|
              # < 0x06 | Transfer Count | Transfer Response | Transfer Data |
              #  ******|****************|*******************|+++++++++++++++|
              recv = self._size - 4 - 4 * self._read_count
  
              if isRead:
                  return recv // 4
              else:
                  return send // 4
          else:
              # DAP_Transfer request packet:
              #   BYTE | BYTE *****| BYTE **********| BYTE *************| WORD *********|
              # > 0x05 | DAP Index | Transfer Count | Transfer Request  | Transfer Data |
              #  ******|***********|****************|+++++++++++++++++++++++++++++++++++|
              send = self._size - 3 - 1 * self._read_count - 5 * self._write_count
  
              # DAP_Transfer response packet:
              #   BYTE | BYTE **********| BYTE *************| WORD *********|
              # < 0x05 | Transfer Count | Transfer Response | Transfer Data |
              #  ******|****************|*******************|+++++++++++++++|
              recv = self._size - 3 - 4 * self._read_count
  
              if isRead:
                  # 1 request byte in request packet, 4 data bytes in response packet
                  return min(send, recv // 4)
              else:
                  # 1 request byte + 4 data bytes
                  return send // 5
docs: Return the number of words free in the transmit packet