/*

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

  Copyright (C) 2016, 2017, 2018, 2019, 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/>.


***/


/*

  Documentation
  =============


  Brief
  -----


  Entities that help to configure allowed key input.
  With these keys associated are predefined strings that are used as
  menu options and input feedback at the same time.


***/


# ifndef __KEY_ENABLE_BITS_H__
#   define __KEY_ENABLE_BITS_H__


//  Key Enable IDs
//  ==============


enum tag_KEYID {
  KEYID_a,
  KEYID_b,
  KEYID_c,
  KEYID_d,

  KEYID_f,
  KEYID_k,
  KEYID_n,
  KEYID_o,

  KEYID_p,
  KEYID_q,
  KEYID_r,
  KEYID_s,

  KEYID_t,
  KEYID_B,
  KEYID_E,
  KEYID_G,

  KEYID_I,
  KEYID_K,
  KEYID_O,
  KEYID_S,

  KEYID_W,
  KEYID_X,
  KEYID_dollar,
  KEYID_pcent,

  KEYID_tilde,
  KEYID_qmark,
  ID_NONE                 //special ID for "no key"
};


//  Key Enable Register Bits
//  ========================


#   define KEYBIT_q           (1 << KEYID_q)
#   define KEYBIT_d           (1 << KEYID_d)
#   define KEYBIT_t           (1 << KEYID_t)
#   define KEYBIT_o           (1 << KEYID_o)
#   define KEYBIT_O           (1 << KEYID_O)
#   define KEYBIT_p           (1 << KEYID_p)
#   define KEYBIT_s           (1 << KEYID_s)
#   define KEYBIT_S           (1 << KEYID_S)
#   define KEYBIT_k           (1 << KEYID_k)
#   define KEYBIT_K           (1 << KEYID_K)
#   define KEYBIT_b           (1 << KEYID_b)
#   define KEYBIT_B           (1 << KEYID_B)
#   define KEYBIT_c           (1 << KEYID_c)
#   define KEYBIT_E           (1 << KEYID_E)
#   define KEYBIT_I           (1 << KEYID_I)
#   define KEYBIT_f           (1 << KEYID_f)
#   define KEYBIT_G           (1 << KEYID_G)
#   define KEYBIT_r           (1 << KEYID_r)
#   define KEYBIT_W           (1 << KEYID_W)
#   define KEYBIT_n           (1 << KEYID_n)
#   define KEYBIT_X           (1 << KEYID_X)
#   define KEYBIT_dollar      (1 << KEYID_dollar)
#   define KEYBIT_a           (1 << KEYID_a)
#   define KEYBIT_pcent       (1 << KEYID_pcent)
#   define KEYBIT_qmark       (1 << KEYID_qmark)
#   define KEYBIT_tilde       (1 << KEYID_tilde)


//  Default Keyreg Value
//  ====================


#   define KEYREG_DEFAULT     0 \
  | KEYBIT_a \
  | KEYBIT_d \
  | KEYBIT_f \
  | KEYBIT_q \
  | KEYBIT_t \
  | KEYBIT_tilde \
  | KEYBIT_qmark

unsigned int keyreg = 0;


//  Menu Option Strings
//  ===================


// Order matters, prompt is listing keys in same order.
char * keymsg[] = {
  "a: previous record",
  "b: 64k batch read",
  "c: chip -> file",
  "d: probe chip, match record",

  "f: next record",
  "k: 32k batch read",
  "n: read random range",
  "o: SOTP -> file",

  "p: page batch read",
  "q: cancel/(SPI-Bus off)/quit",
  "r: show register values",
  "s: 4k batch read",

  "t: toggle line type",
  "B: 64k batch erase",
  "E: erase chip",
  "G: global sector protect",

  "I: file -> chip",
  "K: 32k batch erase",
  "O: file -> SOTP",
  "S: 4k batch erase",
  "W: set register values",

  "X: global sector unprotect",
  "$: increase payload",
  "%: cycle $FF modes",
  "~: toggle WIP check",
  "?: show menu",

  ""    //ID_NONE
};

# endif
/* __KEY_ENABLE_BITS_H__ */
