]> git.proxmox.com Git - mirror_edk2.git/blob - EdkModulePkg/Universal/Network/Snp32_64/Dxe/WaitForPacket.c
Fix capitalization
[mirror_edk2.git] / EdkModulePkg / Universal / Network / Snp32_64 / Dxe / WaitForPacket.c
1 /*++
2 Copyright (c) 2006, Intel Corporation
3 All rights reserved. This program and the accompanying materials
4 are licensed and made available under the terms and conditions of the BSD License
5 which accompanies this distribution. The full text of the license may be found at
6 http://opensource.org/licenses/bsd-license.php
7
8 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
9 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
10
11 Module name:
12 WaitForPacket.c
13
14 Abstract:
15 Event handler to check for available packet.
16
17 --*/
18
19
20 #include "Snp.h"
21
22 VOID
23 EFIAPI
24 SnpWaitForPacketNotify (
25 EFI_EVENT Event,
26 VOID *SnpPtr
27 )
28 /*++
29
30 Routine Description:
31
32 Arguments:
33
34 Returns:
35
36 --*/
37 {
38 PXE_DB_GET_STATUS PxeDbGetStatus;
39
40 //
41 // Do nothing if either parameter is a NULL pointer.
42 //
43 if (Event == NULL || SnpPtr == NULL) {
44 return ;
45 }
46 //
47 // Do nothing if the SNP interface is not initialized.
48 //
49 switch (((SNP_DRIVER *) SnpPtr)->mode.State) {
50 case EfiSimpleNetworkInitialized:
51 break;
52
53 case EfiSimpleNetworkStopped:
54 case EfiSimpleNetworkStarted:
55 default:
56 return ;
57 }
58 //
59 // Fill in CDB for UNDI GetStatus().
60 //
61 ((SNP_DRIVER *) SnpPtr)->cdb.OpCode = PXE_OPCODE_GET_STATUS;
62 ((SNP_DRIVER *) SnpPtr)->cdb.OpFlags = 0;
63 ((SNP_DRIVER *) SnpPtr)->cdb.CPBsize = PXE_CPBSIZE_NOT_USED;
64 ((SNP_DRIVER *) SnpPtr)->cdb.CPBaddr = PXE_CPBADDR_NOT_USED;
65 ((SNP_DRIVER *) SnpPtr)->cdb.DBsize = sizeof (UINT32) * 2;
66 ((SNP_DRIVER *) SnpPtr)->cdb.DBaddr = (UINT64) (UINTN) (((SNP_DRIVER *) SnpPtr)->db);
67 ((SNP_DRIVER *) SnpPtr)->cdb.StatCode = PXE_STATCODE_INITIALIZE;
68 ((SNP_DRIVER *) SnpPtr)->cdb.StatFlags = PXE_STATFLAGS_INITIALIZE;
69 ((SNP_DRIVER *) SnpPtr)->cdb.IFnum = ((SNP_DRIVER *) SnpPtr)->if_num;
70 ((SNP_DRIVER *) SnpPtr)->cdb.Control = PXE_CONTROL_LAST_CDB_IN_LIST;
71
72 //
73 // Clear contents of DB buffer.
74 //
75 ZeroMem (((SNP_DRIVER *) SnpPtr)->db, sizeof (UINT32) * 2);
76
77 //
78 // Issue UNDI command and check result.
79 //
80 (*((SNP_DRIVER *) SnpPtr)->issue_undi32_command) ((UINT64) (UINTN) &((SNP_DRIVER *) SnpPtr)->cdb);
81
82 if (((SNP_DRIVER *) SnpPtr)->cdb.StatCode != EFI_SUCCESS) {
83 return ;
84 }
85 //
86 // We might have a packet. Check the receive length and signal
87 // the event if the length is not zero.
88 //
89 CopyMem (
90 &PxeDbGetStatus,
91 ((SNP_DRIVER *) SnpPtr)->db,
92 sizeof (UINT32) * 2
93 );
94
95 if (PxeDbGetStatus.RxFrameLen != 0) {
96 gBS->SignalEvent (Event);
97 }
98 }
99
100 /* eof - WaitForPacket.c */