亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? post.c

?? 這項工程將讓您把自己的MP3播放器平臺
?? C
字號:
//++
//post.c - power on self test routines
//
//        COPYRIGHT (C) 2005 BY SPARE TIME GIZMOS, MILPITAS CA, USA.
// 1636 Fallen Leaf Drive / Milpitas CA 95035 USA / info@SpareTimeGizmos.com
//
// This file is part of the Spare Time Gizmos MP3 Player firmware.  This firmware
// 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 2 of the License, or (at your option) any later version.
//
// This firmware 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
// this program; if not, write to the Free Software Foundation, Inc., 59 Temple
// Place, Suite 330, Boston, MA  02111-1307  USA.
//
//DESCRIPTION:
//
//   The self test functions currently built in to the firmware are:
//
//	#1 - CPU (P68C668) failure
//	#2 - Flash ROM checksum fail
//
//
//REVISION HISTORY:
// dd-mmm-yy    who     description
// 15-May-05	RLA	New file.
// 13-Oct-05	RLA	Add the RAMSize() function.
//--

// Include files...
#include <stdio.h>		// needed so DBGOUT(()) can find printf!
#include "standard.h"		// standard types - BYTE, WORD, BOOL, etc
#include "reg66x.h"		// declarations for Philips 89C66x processors
#include "player.h"		// project wide (hardware configuration) declarations
#include "timer.h"		// define the DELAYUS() macro...
#include "post.h"		// POST codes for Fail()


//++
//   This function will calculate the checksum of the program EPROM.  The 
// checksum is calculated so that the 16 bit unsigned sum of all the bytes
// in the ROM, _including_ the checksum in the last two bytes, is equal to
// the last two bytes.  This slightly arcane algorithm is used because it
// gives the same value for the checksum as the Data I/O EEPROM programmer.
//
//   Since the checksum is included in itself, we have to go to some lengths
// to prevent the checksum value from affecting its own calculation.  The way
// that's done is to actually use the last _four_ bytes of the ROM - the last
// two contain the checksum and the two before that contain the complement of
// each byte in the checksum.  The sum of a byte and its complement is always
// 0x0100, and since there are two such bytes, adding a checksum to the ROM in
// this way always adds 0x0200 to the original checksum _regardless_ of what
// the actual checksum value may be.  The ROMCKSUM program that's used to
// calculate and store the checksum in the .HEX file takes this into account,
// so we can simply ignore the whole issue here.
//--
PUBLIC WORD ROMChecksum (WORD cbROM)
{
  // cbROM is the size of the system EEPROM, in bytes (e.g. 8192 or 32768)...
  WORD wChecksum;	// checksum accumulator
  WORD pcROM;		// pointer to bytes in ROM

  // Just sum up all the bytes, igoring overflows...  Pretty easy.
  for (wChecksum = pcROM = 0;  pcROM != cbROM;  ++pcROM) {
    wChecksum += * (PCBYTE) pcROM;
    //   If the ROM size is 32K, then believe it or not the WDT will time out
    // before we can finish our checksum.  It's too much overhead to reset the
    // WDT for every single byte, but we can do it every 4K or so...
    //if ((pcROM & 0xFFF) == 0) ResetWDT();
  }

  //DBGOUT(("ROMChecksum: wChecksum=0x%04X, ROM=0x%04X, cbROM=%u ...\n",
  //  wChecksum, *((PCWORD) (cbROM-2)), cbROM));

  return wChecksum;
}


//++
//   This routine will size the external data RAM on this 8051.  It's not a
// memory test in any way, and you shouldn't assume the memory works just
// because you get a number back from this routine. It's also a non-destructive
// test and restores the original RAM contents before it returns.
//
//   Notice that this implicitly assumes that RAM is contiguous and can be 
// addressed starting from location zero - if external RAM is mapped to
// another address or is non-contiguous, you're out of luck.  Also note that
// it returns zero if no external RAM can be found; in the unlikely event that
// we actually have 64K of RAM, you'll only get back 65535!
//--
PUBLIC WORD RAMSize (void)
{
  WORD cbRAM = 0;  WORD T1;
  //   The algorithm is pretty simple - just modify a pair of bytes in external
  // RAM until we find a word which can't be modified and then stop.  We could
  // test every pair of bytes, but in the interest of expediency we assume that
  // memory occurs in multiples of 256 bytes and only test every page.  Note that
  // some microprocessors, notably the 89C66x family, have RAMs that are not
  // multiples of 1K bytes (e.g. the 89C668 actually has 7936 bytes of "external"
  // RAM).
  //
  //   This routine has a few limitations, the most important of which is that
  // it won't work correctly for memory which is incompletely decoded (for example,
  // an 8K external SRAM where A15, A14 and A13 are unconnected).  That isn't a
  // problem for any of the embedded MCU's we're currently using.
  do {
    T1 = *((WORD volatile XDATA *) cbRAM);
    *((WORD volatile XDATA *) cbRAM) = 0xA55A;
    if (*((WORD volatile XDATA *) cbRAM) != 0xA55A) break;
    *((WORD volatile XDATA *) cbRAM) = T1;
    cbRAM += 256;
  } while (cbRAM != 0);
  return cbRAM;
}


#ifdef UNUSED
//++
//   This routine performs a very simple test of external SRAM.  External RAM
// is assumed to be mapped starting from address 0 and thru cbRAM-1.  Pass 1
// of this test simply writes every pair of RAM bytes with its address and the
// next pair with the complement of its address.  Pass 2 reads back and verifies
// the data from pass 1.  If the SRAM fails, then error code PC_XRAM is POSTed.
//--
PUBLIC BOOL RAMTest (WORD cbRAM)
{
  WORD pxRAM = cbRAM;  WORD nCount=0;  BOOL fPass = TRUE;

  // Pass 1...
  for (pxRAM = 0;  pxRAM != cbRAM;  pxRAM += 2) {
    *((PXWORD) pxRAM) =  pxRAM;  pxRAM += 2;
    *((PXWORD) pxRAM) = ~pxRAM;
  }

  // Pass 2...
  for (pxRAM = 0;  pxRAM != cbRAM;  pxRAM += 2) {
    if (*((PXWORD) pxRAM) !=  pxRAM) {
      //DBGOUT(("RAM failure, addr=0x%04x, data=0x%04x\n", pxRAM, *((PXWORD) pxRAM)));
      fPass = FALSE;
    }
    pxRAM += 2;
    if (*((PXWORD) pxRAM) != ~pxRAM) {
      //DBGOUT(("RAM failure, addr=0x%04x, data=0x%04x\n", pxRAM, *((PXWORD) pxRAM)));
      fPass = FALSE;
    }
  }

  return fPass;
}
#endif


//++
//   Blink the single player diagnostic LED.  Notice that this is a "terminal"
// routine - it disables interrupts and never returns control to the caller.
// It's used for debugging and in the case of POST failures...
//--
//   Note that we want to use the DELAYUS macro here, not the more convenient
// DelayMS() subroutine, because the latter depends on timer 2 being initialized
// and working correctly.  The DELAYUS macro generates a programmed delay loop
// directly inline and doesn't depend on anything else working...
#define SHORT_PAUSE {WORD j;  for (j = 2000;  j != 0;  --j) DELAYUS(100); }
#define LONG_PAUSE  {WORD j;  for (j = 15000;  j != 0;  --j) DELAYUS(100); }
PUBLIC void BlinkLED (BYTE nCode)
{
  BYTE nCount;
  INT_OFF;
  while (1) {
    for (nCount = nCode;  nCount > 0;  --nCount) {
      LED_ON;  SHORT_PAUSE;  LED_OFF;  SHORT_PAUSE;
    }
    LONG_PAUSE;
  }
}


//++
//--
PUBLIC void POST (BYTE nCode, BOOL fContinue)
{
  // In the debug version, print a textual description of the error code...
#ifdef DEBUG
  //   If a CPU failure occurs then the serial port has not been initialized
  // and we can't use DBGOUT - it would just hang forever!
  if (nCode == PC_CPU) goto BLINK;
  DBGOUT(("??FAIL: (%bu) ", nCode));
  switch (nCode) {
    case PC_CPU:	DBGOUT(("CPU failure"));			break;
    case PC_CHECKSUM:	DBGOUT(("ROM checksum error"));			break;
    case PC_SRAM:       DBGOUT(("Internal SRAM failure"));              break;
    case PC_STA013:	DBGOUT(("STA013 failure"));			break;
    case PC_DISPLAY:	DBGOUT(("Display (VFD or LCD) failure"));	break;
  }
  DBGOUT((" ...\n"));
#endif
  if (fContinue) return;
  DBGOUT(("\nSYSTEM HALTED.  POWER CYCLE TO RESTART ...\n\n"));
#ifdef DEBUG
BLINK:
#endif
  BlinkLED(nCode);  HALT;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
www.亚洲在线| 欧美日韩电影在线| 亚洲超碰精品一区二区| 精品成人一区二区| 欧美无乱码久久久免费午夜一区| 精品一区二区免费视频| 亚洲一区二区在线免费观看视频 | 丰满白嫩尤物一区二区| 午夜精品视频一区| 亚洲色图制服诱惑| 国产欧美日韩卡一| 欧美成人bangbros| 欧美日韩亚洲综合一区| 成人高清视频在线观看| 精品一区二区在线视频| 亚洲国产aⅴ成人精品无吗| 国产精品久久综合| 精品国产乱码久久| 91精品国产91综合久久蜜臀| 色呦呦日韩精品| 成人app网站| 国产福利一区二区三区视频| 裸体歌舞表演一区二区| 日日噜噜夜夜狠狠视频欧美人| 亚洲欧美影音先锋| 亚洲国产精品成人综合色在线婷婷 | 亚洲免费观看高清完整| 国产精品免费网站在线观看| 欧美精品一区二区在线观看| 4438x亚洲最大成人网| 欧美制服丝袜第一页| 99久久久无码国产精品| 成人手机在线视频| 国产成人免费网站| 国模套图日韩精品一区二区| 麻豆精品精品国产自在97香蕉 | 成人av高清在线| 国产99久久久精品| 成人综合激情网| 国产一区999| 国产成人a级片| 国产成人自拍在线| 国产精品羞羞答答xxdd| 国产一区二区三区香蕉| 国产一级精品在线| 国产精品一卡二卡在线观看| 国产精品亚洲成人| 国产suv精品一区二区6| 懂色一区二区三区免费观看| 成人精品gif动图一区| aaa亚洲精品| 在线一区二区三区做爰视频网站| 欧美亚洲综合色| 欧美日韩高清一区二区| 欧美一区二区三区视频| 欧美mv和日韩mv的网站| 久久无码av三级| 亚洲国产精品t66y| 亚洲人123区| 亚洲r级在线视频| 热久久国产精品| 国产精品一区二区三区乱码| jlzzjlzz欧美大全| 欧美亚洲图片小说| 日韩视频免费观看高清完整版在线观看| 欧美一区日韩一区| 久久午夜电影网| 综合精品久久久| 天天综合天天综合色| 韩国午夜理伦三级不卡影院| 白白色亚洲国产精品| 欧美日韩精品三区| 久久久精品中文字幕麻豆发布| 中文字幕第一区二区| 午夜免费久久看| 国产美女精品在线| 欧美怡红院视频| 精品福利av导航| 亚洲精品国产成人久久av盗摄| 青青草原综合久久大伊人精品优势| 国产福利不卡视频| 欧美色偷偷大香| 久久久三级国产网站| 一区二区三区四区亚洲| 极品瑜伽女神91| 91福利视频在线| 久久久亚洲高清| 亚洲成av人片在www色猫咪| 激情欧美一区二区三区在线观看| 97精品国产露脸对白| 日韩视频免费观看高清完整版在线观看| 国产精品美日韩| 奇米影视一区二区三区| 色综合天天做天天爱| 久久嫩草精品久久久精品一| 亚洲国产精品视频| 成人三级伦理片| 91精品国产福利在线观看| 亚洲免费观看在线视频| 国产美女精品在线| 欧美一区日本一区韩国一区| 亚洲精品中文在线影院| 国产精品2024| 欧美一区二区成人6969| 亚洲一区二区在线免费看| 成人妖精视频yjsp地址| 欧美一区二区私人影院日本| 亚洲精选在线视频| 波多野结衣精品在线| 亚洲精品一区二区三区香蕉| 日韩激情中文字幕| 欧美色图12p| 一区二区免费在线| 波多野结衣一区二区三区| 久久久久久久精| 美女视频黄a大片欧美| 欧美日本免费一区二区三区| 亚洲欧美日韩国产中文在线| 国产成人在线看| 日韩精品专区在线影院观看 | 成人黄色在线看| 精品精品国产高清a毛片牛牛 | 岛国av在线一区| 日韩无一区二区| 日本午夜精品一区二区三区电影| 精品视频免费在线| 又紧又大又爽精品一区二区| 99国产精品久久久久| 日本一区二区视频在线| 粉嫩高潮美女一区二区三区| 久久久久国产精品麻豆| 国产精品一二三四五| 久久综合久色欧美综合狠狠| 国产资源在线一区| 久久影院午夜片一区| 精品一二线国产| 欧美一级日韩不卡播放免费| 日韩成人av影视| 欧美一区二区视频在线观看| 日韩国产欧美在线播放| 91精品国产91久久久久久一区二区 | 欧美成人精品福利| 久久av中文字幕片| 精品国产一区二区三区久久久蜜月 | 亚洲免费av观看| 色悠久久久久综合欧美99| 亚洲另类春色国产| 欧美色电影在线| 青娱乐精品视频在线| 日韩精品一区二区三区视频在线观看| 久久精品国产精品青草| 精品捆绑美女sm三区| 国产超碰在线一区| 国产精品久久一卡二卡| 色94色欧美sute亚洲线路一ni| 亚洲成人动漫在线观看| 日韩手机在线导航| 国产成人在线看| 亚洲精品国产精华液| 91精品国产高清一区二区三区蜜臀| 久久成人久久爱| 中文字幕av一区二区三区 | 日韩欧美国产精品| 国产精品18久久久久久久网站| 日本一区二区三区免费乱视频| 99麻豆久久久国产精品免费| 亚洲国产精品久久不卡毛片| 欧美一级一区二区| 国产99精品国产| 亚洲国产aⅴ天堂久久| 欧美r级在线观看| 99视频一区二区三区| 亚洲国产视频一区| 26uuu亚洲婷婷狠狠天堂| av福利精品导航| 日韩国产在线观看一区| 国产欧美精品一区| 欧美视频一区二区三区| 国产在线观看免费一区| 亚洲同性gay激情无套| 日韩欧美中文字幕精品| 不卡av电影在线播放| 日韩高清在线观看| 国产精品高清亚洲| 欧美一区二区在线观看| 97久久精品人人澡人人爽| 美腿丝袜在线亚洲一区| 亚洲精品成人少妇| 精品久久久三级丝袜| 欧美在线一区二区三区| 国产电影精品久久禁18| 亚洲va天堂va国产va久| 中文字幕精品综合| 欧美一区二区观看视频| 日本道免费精品一区二区三区| 久草精品在线观看| 亚洲免费观看高清完整版在线 | 欧美一级一区二区| 色综合久久中文综合久久牛| 国产专区欧美精品|