⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 menu.c

📁 Windows CE 6.0 BSP for the Beagle Board.
💻 C
📖 第 1 页 / 共 2 页
字号:
					while (*pChk)
					{
						if ((*pChk!=' ') && (*pChk!='\t'))
							break;
						pChk++;
					}
					if (*pChk)
						*pStart = 0;    /* nothing allowed after g */
					else
					{
						DumpGPIORegisters();
					}
					break;
				case 'x':
				case 'X':
					pChk++;
					while (*pChk)
					{
						if ((*pChk!=' ') && (*pChk!='\t'))
							break;
						pChk++;
					}
					if (*pChk)
						*pStart = 0;    /* nothing allowed after x */
					else
						goto Exit;
					break;
				case 'm':
				case 'M':
					pChk++;
					if ((*pChk!=' ') && (*pChk!='\t'))
						*pStart = 0;
					else
					{
						while ((*pChk==' ') || (*pChk=='\t'))
							pChk++;
						if (!(*pChk))
							*pStart = 0;
						else
						{
							if (!ParseHex(&saddr,&pChk))
								*pStart = 0;
							else
							{
								while ((*pChk==' ') || (*pChk=='\t'))
									pChk++;
								if (!(*pChk))
									*pStart = 0;
								else
								{
									if (!ParseHex(&daddr,&pChk))
										*pStart = 0;
									else
									{
										while ((*pChk==' ') || (*pChk=='\t'))
											pChk++;
										if (!(*pChk))
											*pStart = 0;
										else
										{
											len = 1;
											while ((*pChk==' ') || (*pChk=='\t'))
												pChk++;
											if (*pChk)
											{
												if (ParseDec(&inp,&pChk))
												{
													len = inp;
													while (*pChk)
													{
														if ((*pChk!=' ') && (*pChk!='\t'))
															break;
														pChk++;
													}
													if (*pChk)
														*pStart = 0;    /* nothing allowed after optional length */
												}
											}
											pSAddr = (void *)saddr;
											pDAddr = (void *)daddr;
											memmove(pDAddr,pSAddr,len);
										}
									}
								}
							}
						}
					}
					break;
				case 'r':
					pChk++;
					if ((*pChk!=' ') && (*pChk!='\t'))
						*pStart = 0;
					else
					{
						while ((*pChk==' ') || (*pChk=='\t'))
							pChk++;
						if (!(*pChk))
							*pStart = 0;
						else
						{
							if (!ParseHex(&addr,&pChk))
								*pStart = 0;
							else
							{
								addr &= 0xFFFFFFFC; /* round down to aligned 4-byte boundary */
								len = 1;
								while ((*pChk==' ') || (*pChk=='\t'))
									pChk++;
								if (*pChk)
								{
									if (ParseDec(&inp,&pChk))
									{
										len = inp;
										while (*pChk)
										{
											if ((*pChk!=' ') && (*pChk!='\t'))
												break;
											pChk++;
										}
										if (*pChk)
											*pStart = 0;    /* nothing allowed after optional length */
									}
								}
								i = 0;
								pAddr = (DWORD *)addr;
								OALLog(L"Physical           +0       +4       +8       +C\r\n");
								do {
									OALLog(L"%08X:    ",pAddr);
									OALLog(L"%08X ",*pAddr);
									pAddr++; i++; if (i==len) break;
									OALLog(L"%08X ",*pAddr);
									pAddr++; i++; if (i==len) break;
									OALLog(L"%08X ",*pAddr);
									pAddr++; i++; if (i==len) break;
									OALLog(L"%08X ",*pAddr);
									pAddr++; i++; if (i==len) break;
									OALLog(L"\r\n");
								} while (i!=len);
								OALLog(L"\r\n\r\n");
							}
						}
					}
					break;
				case 'R':	// read BYTE
					pChk++;
					if ((*pChk!=' ') && (*pChk!='\t'))
						*pStart = 0;
					else
					{
						while ((*pChk==' ') || (*pChk=='\t'))
							pChk++;
						if (!(*pChk))
							*pStart = 0;
						else
						{
							if (!ParseHex(&addr,&pChk))
								*pStart = 0;
							else
							{
								len = 1;
								while ((*pChk==' ') || (*pChk=='\t'))
									pChk++;
								/* now output byte at 'addr'  */
								pBAddr = (BYTE *)addr;
								OALLog(L"%08X:    ",pBAddr);
								OALLog(L"%02X ",*pBAddr);
								OALLog(L"\r\n\r\n");
							}
						}
					}
					break;
				case 'w':
					pChk++;
					if ((*pChk!=' ') && (*pChk!='\t'))
						*pStart = 0;
					else
					{
						while ((*pChk==' ') || (*pChk=='\t'))
							pChk++;
						if (!(*pChk))
							*pStart = 0;
						else
						{
							if (!ParseHex(&addr,&pChk))
								*pStart = 0;
							else
							{
								while ((*pChk==' ') || (*pChk=='\t'))
									pChk++;
								if (!(*pChk))
									*pStart = 0;
								else
								{
									if (!ParseHex(&val,&pChk))
										*pStart = 0;
									else
									{
										pAddr = (DWORD *)addr;
										*pAddr = val;
									}
								}
							}
						}
					}
					break;
				case 'W':	// write byte
					pChk++;
					if ((*pChk!=' ') && (*pChk!='\t'))
						*pStart = 0;
					else
					{
						while ((*pChk==' ') || (*pChk=='\t'))
							pChk++;
						if (!(*pChk))
							*pStart = 0;
						else
						{
							if (!ParseHex(&addr,&pChk))
								*pStart = 0;
							else
							{
								while ((*pChk==' ') || (*pChk=='\t'))
									pChk++;
								if (!(*pChk))
									*pStart = 0;
								else
								{
									if (!ParseHex(&val,&pChk) || val > 255)
										*pStart = 0;
									else
									{
										pBAddr = (BYTE *)addr;
										*pBAddr = (BYTE)val;
									}
								}
							}
						}
					}
					break;
				case 'f':
				case 'F':
					pChk++;
					if ((*pChk!=' ') && (*pChk!='\t'))
						*pStart = 0;
					else
					{
						while ((*pChk==' ') || (*pChk=='\t'))
							pChk++;
						if (!(*pChk))
							*pStart = 0;
						else
						{
							if (!ParseHex(&addr,&pChk))
								*pStart = 0;
							else
							{
								while ((*pChk==' ') || (*pChk=='\t'))
									pChk++;
								if (!(*pChk))
									*pStart = 0;
								else
								{
									if (!ParseHex(&val,&pChk))
										*pStart = 0;
									else
									{
										len = 1;
										while ((*pChk==' ') || (*pChk=='\t'))
											pChk++;
										if (*pChk)
										{
											if (ParseDec(&inp,&pChk))
											{
												len = inp;
												while (*pChk)
												{
													if ((*pChk!=' ') && (*pChk!='\t'))
														break;
													pChk++;
												}
												if (*pChk)
													*pStart = 0;    /* nothing allowed after optional value */
											}
										}
										pAddr = (DWORD *)addr;
										for (i=0;i<len;i++)
										{
											*pAddr++ = val;
										}
									}
								}
							}
						}
					}
					break;
				//case 'L':	// launch at address
				//case 'l':
				//	pChk++;
				//	if ((*pChk!=' ') && (*pChk!='\t'))
				//		*pStart = 0;
				//	else
				//	{
				//		while ((*pChk==' ') || (*pChk=='\t'))
				//			pChk++;
				//		if (!(*pChk))
				//			*pStart = 0;
				//		else
				//		{
				//			if (!ParseHex(&addr,&pChk))
				//				*pStart = 0;
				//			else
				//			{
				//				len = 1;
				//				while ((*pChk==' ') || (*pChk=='\t'))
				//					pChk++;
				//				KITLOutputDebugString ("Launch at physical %X",addr);
				//				KITLOutputDebugString ("\r\n\r\n\r\n");
				//				OALStall(1000000);	// let the messages get out
				//				Launch(addr);
				//				// Should never get here...
				//				//
				//				KITLOutputDebugString("SpinForever...\r\n");
				//				OALSpinForever();
				//			}
				//		}
				//	}
				//	break;
				//case 'e':
				//case 'E':
				//	pChk++;
				//	if ((*pChk!=' ') && (*pChk!='\t'))
				//		*pStart = 0;
				//	else
				//	{
				//		while ((*pChk==' ') || (*pChk=='\t'))
				//			pChk++;
				//		if (!(*pChk))
				//			*pStart = 0;
				//		else
				//		{
				//			if (!ParseDec(&addr,&pChk))
				//				*pStart = 0;
				//			else
				//			{
				//				len = 1;
				//				while ((*pChk==' ') || (*pChk=='\t'))
				//					pChk++;
				//				if (*pChk)
				//				{
				//					if (ParseDec(&inp,&pChk))
				//					{
				//						len = inp;
				//						while (*pChk)
				//						{
				//							if ((*pChk!=' ') && (*pChk!='\t'))
				//								break;
				//							pChk++;
				//						}
				//						if (*pChk)
				//							*pStart = 0;    /* nothing allowed after optional length */
				//					}
				//				}
				//				if (addr + len > g_FlashInfo.dwNumBlocks)
				//					OALLog(L"  ** INVALID RANGE FOR ERASE **\r\n");
				//				else
				//				{
				//					if (LockBlocks(FALSE,addr,len))
				//					{
				//						FlashEraseBlock(addr, len);
				//					}
				//					OALLog(L"\r\n");
				//				}
				//			}
				//		}
				//	}
				//	break;
				//case 'p':
				//case 'P':
				//	pChk++;
				//	if ((*pChk!=' ') && (*pChk!='\t'))
				//		*pStart = 0;
				//	else
				//	{
				//		while ((*pChk==' ') || (*pChk=='\t'))
				//			pChk++;
				//		if (!(*pChk))
				//			*pStart = 0;
				//		else
				//		{
				//			if (!ParseHex(&saddr,&pChk))
				//				*pStart = 0;
				//			else
				//			{
				//				if (saddr > g_FlashInfo.dwNumBlocks * g_FlashInfo.wSectorsPerBlock)
				//					OALLog(L"  ** INVALID SECTOR ADDRESS **\r\n");
				//				else
				//				{
				//					while ((*pChk==' ') || (*pChk=='\t'))
				//						pChk++;
				//					if (!(*pChk))
				//						*pStart = 0;
				//					else
				//					{
				//						if (!ParseHex(&daddr,&pChk))
				//							*pStart = 0;
				//						else
				//						{
				//							if (!IsValidAddr(daddr,1,NULL))
				//								OALLog(L"  ** INVALID BUFFER MEMORY ADDRESS **\r\n");
				//							else
				//							{
				//								while ((*pChk==' ') || (*pChk=='\t'))
				//									pChk++;
				//								if (!(*pChk))
				//									*pStart = 0;
				//								else
				//								{
				//									len = 1;
				//									while ((*pChk==' ') || (*pChk=='\t'))
				//										pChk++;
				//									if (*pChk)
				//									{
				//										if (ParseDec(&inp,&pChk))
				//										{
				//											len = inp;
				//											while (*pChk)
				//											{
				//												if ((*pChk!=' ') && (*pChk!='\t'))
				//													break;
				//												pChk++;
				//											}
				//											if (*pChk)
				//												*pStart = 0;    /* nothing allowed after optional length */
				//										}
				//									}
				//									if (!IsValidAddr(daddr,(len * g_FlashInfo.wDataBytesPerSector),&addOffs))
				//										OALLog(L"  ** INVALID BUFFER MEMORY ADDRESS RANGE **\r\n");
				//									else
				//									{
				//										if (!FMD_WriteSector(saddr, (LPBYTE)daddr, NULL, len))
				//										{
				//											OALLog(L""Failed to program Flash.\r\n");
				//										}
				//									}
				//								}
				//							}
				//						}
				//					}
				//				}
				//			}
				//		}
				//	}
				//	break;
				default:
					if (*pChk)
						*pStart = 0;    /* nothing allowed after charater */
					break;
				}
			if (!(*pStart))
				OALLog(L"  ** INVALID COMMAND **\r\n");
        }
    } while (1);
Exit:
	OALLog(L"\r\n\r\n");
}

//------------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -