]> git.proxmox.com Git - mirror_edk2.git/blobdiff - NetworkPkg/Application/Ping6/Ping6.c
NetworkPkg: Convert all .uni files to utf-8
[mirror_edk2.git] / NetworkPkg / Application / Ping6 / Ping6.c
index b783c5a02757da8ebb5c32825f844390b24da284..596ee3b00744638ad9c843827d9de6843086621d 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   The implementation for Ping6 application.\r
 \r
-  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -58,14 +58,13 @@ SHELL_PARAM_ITEM    Ping6ParamList[] = {
 EFI_HII_HANDLE    mHiiHandle;\r
 CONST CHAR16      *mIp6DstString;\r
 CONST CHAR16      *mIp6SrcString;\r
-EFI_GUID          mEfiPing6Guid = EFI_PING6_GUID;\r
-UINT32            mFrequency = 0;\r
+UINT64            mFrequency = 0;\r
 /**\r
-  Get and caculate the frequency in tick/ms.\r
+  Get and calculate the frequency in tick/ms.\r
   The result is saved in the globle variable mFrequency\r
 \r
-  @retval EFI_SUCCESS    Caculated the frequency successfully.\r
-  @retval Others         Failed to caculate the frequency.\r
+  @retval EFI_SUCCESS    Calculated the frequency successfully.\r
+  @retval Others         Failed to calculate the frequency.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -76,7 +75,7 @@ Ping6GetFrequency (
   EFI_STATUS               Status;\r
   EFI_CPU_ARCH_PROTOCOL    *Cpu;\r
   UINT64                   CurrentTick;\r
-  UINT32                   TimerPeriod;\r
+  UINT64                   TimerPeriod;\r
 \r
   Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **) &Cpu);\r
 \r
@@ -84,26 +83,26 @@ Ping6GetFrequency (
     return Status;\r
   }\r
 \r
-  Status = Cpu->GetTimerValue (Cpu, 0, &CurrentTick, (UINT64 *) &TimerPeriod);\r
+  Status = Cpu->GetTimerValue (Cpu, 0, &CurrentTick, &TimerPeriod);\r
 \r
   if (EFI_ERROR (Status)) {\r
     //\r
     // For NT32 Simulator only. 358049 is a similar value to keep timer granularity.\r
     // Set the timer period by ourselves.\r
     //\r
-    TimerPeriod = NTTIMERPERIOD;\r
+    TimerPeriod = (UINT64) NTTIMERPERIOD;\r
   }\r
   //\r
   // The timer period is in femtosecond (1 femtosecond is 1e-15 second).\r
   // So 1e+12 is divided by timer period to produce the freq in tick/ms.\r
   //\r
-  mFrequency = (UINT32) DivU64x32 (1000000000000ULL, TimerPeriod);\r
+  mFrequency = DivU64x64Remainder (1000000000000ULL, TimerPeriod, NULL);\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
 /**\r
-  Get and caculate the duration in ms.\r
+  Get and calculate the duration in ms.\r
 \r
   @param[in]  Begin    The start point of time.\r
   @param[in]  End      The end point of time.\r
@@ -111,14 +110,14 @@ Ping6GetFrequency (
   @return The duration in ms.\r
 \r
 **/\r
-UINT32\r
+UINT64\r
 Ping6CalculateTick (\r
   IN UINT64    Begin,\r
   IN UINT64    End\r
   )\r
 {\r
   ASSERT (End > Begin);\r
-  return (UINT32) DivU64x32 (End - Begin, mFrequency);\r
+  return DivU64x64Remainder (End - Begin, mFrequency, NULL);\r
 }\r
 \r
 /**\r
@@ -242,7 +241,7 @@ Ping6OnEchoReplyReceived (
   EFI_IP6_RECEIVE_DATA        *RxData;\r
   ICMP6_ECHO_REQUEST_REPLY    *Reply;\r
   UINT32                      PayLoad;\r
-  UINT32                      Rtt;\r
+  UINT64                      Rtt;\r
   CHAR8                       Near;\r
 \r
   Private = (PING6_PRIVATE_DATA *) Context;\r
@@ -524,7 +523,7 @@ Ping6OnTimerRoutine (
   PING6_ICMP6_TX_INFO    *TxInfo;\r
   LIST_ENTRY             *Entry;\r
   LIST_ENTRY             *NextEntry;\r
-  UINT32                 Time;\r
+  UINT64                 Time;\r
 \r
   Private = (PING6_PRIVATE_DATA *) Context;\r
 \r
@@ -803,13 +802,13 @@ ON_ERROR:
 }\r
 \r
 /**\r
-  Destory the IP6 instance.\r
+  Destroy the IP6 instance.\r
 \r
   @param[in]    Private    The pointer of PING6_PRIVATE_DATA.\r
 \r
 **/\r
 VOID\r
-Ping6DestoryIp6Instance (\r
+Ping6DestroyIp6Instance (\r
   IN PING6_PRIVATE_DATA    *Private\r
   )\r
 {\r
@@ -870,7 +869,7 @@ Ping6 (
   Private->ImageHandle = ImageHandle;\r
   Private->SendNum     = SendNumber;\r
   Private->BufferSize  = BufferSize;\r
-  Private->RttMin      = 0xFFFF;\r
+  Private->RttMin      = ~((UINT64 )(0x0));\r
   Private->Status      = EFI_NOT_READY;\r
 \r
   InitializeListHead (&Private->TxList);\r
@@ -989,7 +988,7 @@ ON_STAT:
       mHiiHandle,\r
       Private->RttMin,\r
       Private->RttMax,\r
-      Private->RttSum / Private->RxCount\r
+      DivU64x64Remainder (Private->RttSum, Private->RxCount, NULL)\r
       );\r
   }\r
 \r
@@ -1020,7 +1019,7 @@ ON_EXIT:
     }\r
 \r
     if (Private->Ip6ChildHandle != NULL) {\r
-      Ping6DestoryIp6Instance (Private);\r
+      Ping6DestroyIp6Instance (Private);\r
     }\r
 \r
     FreePool (Private);\r
@@ -1136,7 +1135,7 @@ InitializePing6 (
   //\r
   // Parse the paramter of destination ip address.\r
   //\r
-  NonOptionCount = ShellCommandLineGetCount();\r
+  NonOptionCount = ShellCommandLineGetCount(ParamPackage);\r
   ValueStr = ShellCommandLineGetRawValue (ParamPackage, (UINT32)(NonOptionCount-1));\r
   if (NonOptionCount != 2) {\r
     ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PING6_INVALID_INPUT), mHiiHandle);\r