home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / programming / misc_programming / int2.spc < prev    next >
Text File  |  1990-01-05  |  9KB  |  253 lines

  1.  
  2.              The Specification of NMI Service Routine (INT 2H)
  3.              -------------------------------------------------
  4.                        Content 
  5.  
  6.               A. Description ......................... AT compatible
  7.  
  8.               B. Laptop notes ...................... for 1100LX model
  9.  
  10.               C. EISA notes ........................ for 1200 model
  11.  
  12.  
  13.   A. Description:
  14.                               
  15.      The non-maskable interrupt is a hardware interrupt that can not be
  16.   masked. It signals the system microprocessor when a parity, a channel
  17.   error has occurred. On the 1100LX laptop model, this routine also handles
  18.   the screen inactive, power saving, and sleep mode.  These kinds of
  19.   NMI must be distinguished by the service routine.
  20.      If parity or channel error ocurred, NMI will display error message 
  21.   and halt the system.
  22.  
  23.   NOTE:
  24.      1. NMIs can be disabled by setting bit 7 of CMOS ( port 70h ).
  25.  
  26.  
  27.  
  28.   B. Laptop notes:
  29.  
  30.       For 1100LX laptop model, functions of int 2h is shown below:
  31.  
  32.       1. It is called by RTC interrupt (int 70H) because the system is 
  33.          inactive (user did not press any key) for a long time.
  34.       
  35.       2. To force system into sleep mode, NMI is triggered when the user
  36.          presses the stand_by button or a low battery power occurred.
  37.       
  38.       3. If screen is inactive time-out, turn off the LCD and disable
  39.          external monitor display.
  40.  
  41.       4. If sleep mode is active, turn off LCD and disable external monitor,
  42.          power off hard disk,floppy and modem, and change CPU speed into
  43.          low speed. 
  44.          When CPU is in low speed, the system will check the wakeup flag.
  45.          If the system is activated by the user by pressing the sleep mode
  46.          button or when external power is supplied do the following: 
  47.          -  recover CPU clock
  48.          -  turn on screen
  49.          -  power on hard disk and modem
  50.  
  51.       5. If low battery power is on level 1, flush power LED (8 MHz).
  52.       
  53.       6. If low battery power is on level 2, flush power LED (4 MHz) and
  54.          enter into stand_by mode.
  55.       
  56.       7. When using an external power supply, power saving function is 
  57.          ignored.
  58.             
  59.       8. If an unexpected NMI occurred, nothing need to be done just leave
  60.          this routine.
  61.  
  62.  
  63.      BIOS Data Area (segment at 400h)
  64.          0b4h -- word -- standby inactive time counter (in seconds)
  65.          0b6h -- byte -- power saving flag
  66.                  bit 7 = 1 -- system inactive flag
  67.                  bit 6 = 1 -- in stand_by 
  68.                  bit 5 = 1 -- screen inactive saving enable
  69.                  bit 4 = 1 -- sleep enable
  70.                  bit 3 =   -- system use power type last time
  71.                  bit 2 = 1 -- screen inactive flag
  72.                  bit 1 = 1 -- power on by alarm flag
  73.                  bit 0 = 1 -- active flag
  74.  
  75.      Port 36Fh for read/write
  76.  
  77.         Bit-0       0  Hard disk +12V OFF
  78.                     1  Hard disk +12V ON
  79.  
  80.         Bit-1       0  Hard disk +5V OFF
  81.                     1  Hard disk +5V ON
  82.  
  83.         Bit-2       0  Floppy disk +5V OFF
  84.                     1  Floppy disk +5V ON
  85.  
  86.         Bit-3       0  LCD +5V OFF
  87.                     1  LCD +5V ON
  88.  
  89.         Bit-4       0  LCD Backlight +12V OFF
  90.                     1  LCD Backlight +12V ON
  91.  
  92.         Bit-5       0  LCD -23V OFF
  93.                     1  LCD -23V ON
  94.  
  95.         Bit-6       0  Modem +5V OFF
  96.                     1  Modem +5V ON
  97.  
  98.         Bit-7       0  Use external keyboard
  99.                     1  Use internal keyboard
  100.  
  101.      Port 35Fh for read
  102.  
  103.         Bit-0       0  Normal status
  104.                     1  Battery low level 1
  105.  
  106.         Bit-1       0  Normal status
  107.                     1  Battery low level 2
  108.  
  109.         Bit-2       Monitor sense bit
  110.  
  111.         Bit-3       0  System power use AC adapter
  112.                     1  System power use Battery
  113.  
  114.         Bit-4       0  Stand-by LED OFF
  115.                     1  Stand-by LED ON
  116.  
  117.         Bit-5       N/A
  118.  
  119.         Bit-6       N/A
  120.  
  121.         Bit-7       0  Normal status
  122.                     1  Stand-by button pressed
  123.  
  124.  
  125.      Port 35Fh for write
  126.  
  127.         Bit-0       0  Low speed
  128.                     1  High speed
  129.  
  130.         Bit-1       N/A
  131.  
  132.         Bit-2       0  Normal status
  133.                     1  Turn off DC/DC converter ===> power off
  134.  
  135.         Bit-3       0  Enable NMI generated
  136.                     1  Clear NMI status
  137.  
  138.         Bit-4       0  Turn OFF stand-by LED
  139.                     1  Turn ON stand-by LED
  140.  
  141.         Bit-5       N/A
  142.  
  143.         Bit-6       N/A
  144.  
  145.         Bit-7       N/A
  146.  
  147.      Sequence of int 2h on 1100LX :
  148.  
  149.         Clear NMI flag (set port 35Fh bit-3 = 1 )
  150.         DO CASE
  151.            CASE 1 : Power type change:
  152.                     IF system use AC power (Port 35Fh bit-3 = 0) THEN
  153.                        reload system inactive timer.
  154.                        turn off flash power LED.
  155.                        IF system is in sleep mode THEN (wake up system)
  156.                           recover CPU speed, activate  HDD/FDD/ 
  157.                           MODEM and Display turn off stand_by LED.
  158.                        ENDIF
  159.                     ELSE
  160.                        IF Battery low level 2 THEN
  161.                           DO CASE 2.
  162.                        ELSE
  163.                           IF Battery low level 1 THEN
  164.                              DO CASE 4.
  165.                           ENDIF
  166.                        ENDIF
  167.                     ENDIF
  168.      
  169.            CASE 2 : Battery low level 2     : port 35Fh bit-1 = 1
  170.                     Warning user by speaker and flash power LED.
  171.                     * Square wave output of CMOS (4 Hz).
  172.                     * Speaker beep.
  173.  
  174.                     When the CPU change to low speed:
  175.                     - inactivate the HDD, FDD, Modem 
  176.                     - display (Screen,Controller)
  177.                     - turn on stand-by LED.
  178.                     
  179.                     Dummy loop until system uses AC power.
  180.                        (by checking the AC power usage bit)
  181.                     Stop warning beep and off flash power LED.
  182.      
  183.            CASE 3 : Stand-by button pressed: Port 35Fh bit-7 = 1
  184.                     IF in normal mode (40:b6h bit 6 = 0) THEN
  185.                         set stand_by flag (40:b6h bit 6 = 1)
  186.                         CPU change low speed, inactive the HDD, FDD, Modem 
  187.                         and display (Screen,Controller) turn on stand-by 
  188.                         LED.
  189.                         loop until stand-by pressed by user
  190.                         recover CPU speed, active the HDD, FDD, MODEM and 
  191.                         Display, turn off stand_by LED.
  192.                         reset stand_by flag (40:b6h bit 6 = 0)
  193.                     ENDIF
  194.      
  195.            CASE 4 : Battery low level 1     : port 35Fh bit-0 = 1
  196.                     Warning user by flash power LED.
  197.                     * Using SQW output (8 Hz) of RTC.
  198.      
  199.            CASE 5 : system inactive time-out (40:b6h bit 7 = 1)
  200.                     clear system inactive time-out bit
  201.                     set stand_by flag (40:b6h bit 6 = 1)
  202.                     CPU change to low speed, inactive the HDD, FDD, Modem 
  203.                     and display (Screen,Controller), turn on stand-by LED.
  204.                     Dummy loop until stand-by is pressed by the user
  205.                     Recover CPU speed, active the HDD, FDD, MODEM and 
  206.                     Display, turn off stand_by LED.
  207.                     reset stand_by flag (40:b6h bit 6 = 0)
  208.                     reset system inactive flag (40:b6h bit 7 = 0)
  209.      
  210.            CASE 6 : Parity/channel error 
  211.                     Display error message and system halt
  212.      
  213.            OTHER  : Do nothing 
  214.         END CASE
  215.         Enable NMI (Set port 35Fh bit-3 = 1, then 35Fh bit-3 = 0)
  216.      
  217.      Comment:
  218.            * Case 5 is software int 2 which is invoked by RTC update_end
  219.               interrupt. this case is available on system use battery power.
  220.            * During power up, the following voltages should be applied
  221.              to reduce the power supply surge current.
  222.             
  223.              - System board applies +5V,+12V,-12V
  224.              - LCD applies +5V,-23V,+12V
  225.              - HDD applies +5V,+12V
  226.              - FDD applies +5V
  227.      
  228.      Notes:  The following is very important for LCD:
  229.             * LCD power on sequence:  +5V > video display > -23V > +12V
  230.             * LCD power off sequence: +12V > -23V > video display > +5V
  231.  
  232.  
  233.  
  234.  
  235.    C. For EISA notes:
  236.  
  237.          For 1200 EISA model function of int 2h as shown below:
  238.  
  239.     case 1: Parity error
  240.             Display error message and then halt the system.
  241.     case 2: I/O channel error
  242.             Search which expansion board causes I/O check error.
  243.             Display error message and correct the expansion board (send 
  244.                IOCHKRST plus at least 500 ns to the expansion board and then
  245.                reinitialize and enable it).
  246.     case 3: Fail_save timeout
  247.             Display error message and then halt the system.
  248.     case 4: Bus timeout
  249.             Read bus master status latch (port 464h, 465h)
  250.             Display error message
  251.             Clear bus timeout status and reinitialize system
  252.     case 5: Software NMI (when write any value into port 462h)
  253.