Creating Stubs for OAL Functions
Stubs are routines that do not contain executable code. They act as placeholders for functions that need to be fully implemented later. When implementing stubs, you can leave comments that describe what you eventually need to do to add functionality to your function. By scanning existing sample platform code, you can easily obtain the function header, such as return type and arguments, for each of these functions.
You can either create the stub functions from scratch or copy an existing boot loader or OAL that is of similar CPU type and board design, and then use #if0
and #endif
tags for the function contents.
To create a stub function
Obtain the function header definition for the function to be stubbed by referring to a sample platform that supports similar hardware. The function header includes a return type and a series of function arguments.
From the function header definition, create an empty function implementation.
If the function header specifies a return type, add a placeholder return value to satisfy the compiler.
For example, if the function returns a Boolean value, add either
return (TRUE);
orreturn (FALSE);
to satisfy the compiler. A successful function call is usually signaled by a TRUE or 0 value, while failure is usually signaled by a FALSE or non-zero value. However, this depends on the function and the data being returned.
The following code example shows the stub for the OEMReadData function:
BOOL OEMReadData (DWORD cbData, LPBYTE pbData) { return(TRUE); }
See Also
How to Develop an OEM Adaptation Layer
Last updated on Wednesday, April 13, 2005
© 2005 Microsoft Corporation. All rights reserved.