/*

  Zerocat Chipflasher --- Flash free firmware, kick the Management Engine.

  Copyright (C) 2017, 2018, 2020, 2021, 2022  Kai Mertens <kmx@posteo.net>

  This file is part of Zerocat Chipflasher.

  Zerocat Chipflasher is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by the
  Free Software Foundation, either version 3 of the License, or (at your
  option) any later version.

  Zerocat Chipflasher is distributed in the hope that it will be useful, but
  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  more details.

  You should have received a copy of the GNU General Public License
  along with Zerocat Chipflasher.
  If not, see <http://www.gnu.org/licenses/>.


***/


signed char SREC_addrlen (
  char SREC_type
  )
{
  /*

    Return the address length in bytes that corresponds to a
    known S-record type.

    Returns -1 if no valid S-record type was passed as parameter.


  ***/


  switch(SREC_type) {
    case '0' ... '1':
    case '5':
    case '9':
      return 2;

    case '2':
    case '6':
    case '8':
      return 3;

    case '3':
    case '7':
      return 4;

    default:
      return -1;  //no valid MOTOROLA Srecord type
  }
}

