|
|
|
|
|
|
|
||
|
||
|
|
||
July 1998 |
Revision 1.01 |
|
Persistor Instruments Inc. |
© 1998 All rights reserved. |
|
This function is called by the BIOS on power on or reset. It ploads and prepares all of the BIOS globals outlined in cf1bios.h for use by various programs. A user application will never need to call this function and it is included here for completeness.
|
Prototype: |
void BIOSInit(void); |
|
Definition: |
#include <cf1bios.h> |
|
Notes: |
|
|
Timing: |
Timing-TBD |
This function exists to help programs determine at runtime if they are compatible with the currently installed version of the BIOS. By calling this function with the version information from the initial build of the software, a developer can make a runtime determination of the ability or lack thereof of their program to run on that specific Persistor.
|
Prototype: |
bool BIOSVersionCheck(short ver, short rel, char *id, bool reset); |
|
Definition: |
#include <cf1bios.h> |
|
Inputs: |
ver is the major release number of the BIOS at
build time |
|
Returns: |
Returns true if the parameters supplied match the currently installed version of the BIOS, false otherwise. |
|
Notes: |
|
|
Timing: |
Timing-TBD |
This function returns the serial number of the CF1 on which it is running. This funciton could be used fro a simpler form of license checking in the event of binary distribution. The serial number is burned into ROM and cannot be changed without destroying the CF1.
|
Prototype: |
long *BIOSGetSerNum(void); |
|
Definition: |
#include <cf1bios.h> |
|
Returns: |
Returns a pointer to the serial number of the CF1 |
|
Notes: |
|
|
Timing: |
Timing-TBD |
This call is without practical function but exists to test the calling overhead of BIOS functions Because all BIOS calls are dispatched from a jump table to allow better update compatibility, several extra instructions are added to handle the dispatch table. This function can be used to test the effect of this overhead at any CPU speed or wait state configuration.
|
Prototype: |
void BIOSReturn(void); |
|
Definition: |
#include <cf1bios.h> |
|
Notes: |
|
|
Timing: |
Timing-TBD |
This function forces a hard hardware reset which include assertion of the external /RESET signal. On completion, the CF1 will take whatever reset action has been ordered by the PBM boot command. If the reset action goes beyond entering PBM, the BIOS will be completely re-initialized. If PicoDOS is invoked, PicoDOS will also be completely re-initialized.
This is the cleanest way to terminate a running application if the BIOS or PicoDOS vectors have been altered or you want to guarantee the state of the hardware for the next program run.
|
Prototype: |
void BIOSReset(void); |
|
Definition: |
#include <cf1bios.h> |
|
Notes: |
|
|
Timing: |
Timing-TBD |
This function resets the Persistor as described for the BIOSReset() function above, but forces the CF1 to enter and stay in PBM regardless of the boot settings.
|
Prototype: |
void BIOSResetToPBM (void); |
|
Definition: |
#include <cf1bios.h> |
|
Notes: |
|
|
Timing: |
Timing-TBD |
This function resets the Persistor as described for the BIOSReset() function above, but forces the CF1 to jump to 0xE10000 (PicoDOS) regardless of the boot settings.
|
Prototype: |
void BIOSResetToPicoDOS (void); |
|
Definition: |
#include <cf1bios.h> |
|
Notes: |
|
|
Timing: |
Timing-TBD |
This function resets the Persistor as described for the BIOSReset() function above, but forces the CF1 to jump to the specified address regardless of the boot settings.
|
Prototype: |
void BIOSResetToAddress (ulong target); |
|
Definition: |
#include <cf1bios.h> |
|
Inputs: |
target is the address you wish the persistor to boot to on the reset that will occur when this function is called. |
|
Notes: |
|
|
Timing: |
Timing-TBD |
The BIOSHandlerAddress macro invokes the _BIOSHandlerAddress function to return the absolute address of the function that currently installed in the BIOS jump table to handle a specific BIOS API function. The drvrid argument to _BIOSHandlerAddress() is a non-obvious enumeration constant corrosponding to the relative location of the target API function in the BIOS function list at the top of <cf1bios.h>. You're much better off using the BIOSHandlerAddress macro which lets you simply specify the name of the API function whose address you want to find.
|
Prototype: |
vptr _BIOSHandlerAddress(short drvrid); |
|
Definition: |
#include <cf1bios.h> |
|
Inputs: |
drvrid is the driver table id of the function whose address you seek. See cf1bios.h |
|
Returns: |
Returns the address in the specified slot of the driver table. |
|
Notes: |
1. use the BIOSHandlerAddress macro instead of the
function call |
|
Timing: |
Timing-TBD |
The example below shows how your application code might switch between the built-in SCI UART and some other I/O device using global function pointers and BIOSHandlerAddress macro/function inside of an initialization routine. The three necessary function pointers are declared at the top in global space, then initialized by a call to SerialOpen(). The BIOSHandlerAddress macro/function always returns pointer of type vfptr (defined in <cf1bios.h>) and these must be cast to the correct types to keep the compiler from complaining.
void (* SerialPutByte)(ushort data);
short (* SerialByteAvail)(void);
short (* SerialGetByte)(void);
// SerialOpen()
void SerialOpen(bool sciuart)
{
if (sciuart)
{
SerialPutByte = (void (*)(ushort)) BIOSHandlerAddress(SCITxPutChar);
SerialByteAvail = (short (*)(void)) BIOSHandlerAddress(SCIRxQueuedCount);
SerialGetByte = (short (*)(void)) BIOSHandlerAddress(SCIRxGetChar);
}
else
{
extern void AuxPutByte(ushort data);
extern short AuxByteAvail(void);
extern short AuxGetByte(void);
SerialPutByte = AuxPutByte;
SerialByteAvail = AuxByteAvail;
SerialGetByte = AuxGetByte;
}
} //____ SerialOpen() ____//
The BIOSPatchInsert macro invokes the _BIOSPatchInsert function to let you patch specific BIOS API functions in the BIOS jump table. The drvrid argument to _BIOSPatchInsert () is a non-obvious enumeration constant corrosponding to the relative location of the target API function in the BIOS function list at the top of <cf1bios.h>. You're much better off using the BIOSPatchInsert macro which lets you simply specify the name of the API function you want to patch.
The nature of the BIOS jump table is described in the Programming API Introduction and the actual mechanism is fully described in the the Driver Table Details.
|
Prototype: |
vptr _BIOSPatchInsert(short drvrid, vptr newf); |
|
Definition: |
#include <cf1bios.h> |
|
Inputs: |
drvrid is the driver table id of the function you
wish to replace. See cf1bios.h |
|
Returns: |
Returns the former contents of the specified driver table slot for future reference or for "unpatching." |
|
Notes: |
|
|
Timing: |
Timing-TBD |
The following example shows how you might use this capability to give a visual indication of when the calls to fetch UART characters are blocked while waiting for the input character to appear. We patch in a routine that orbits the on-board LEDs. The SCIRxBlocked() routine gets called repeatedly while waiting for data and this happens so quickly that the two LEDs would appear to glow orange. We add a very simple delay loop to slow down the update rate to something that's visible. After the period is typed, we reinstall the original SCIRxBlocked() to make the CF1 return to its normal behavior.
vfptr orgFunction; // address of original handler
void showBlocked(void);
void showBlocked(void)
{
static ushort delay = 0; // much too fast
if (--delay == 0) // without some
LEDOrbit(true); // long delay
} //____ showBlocked() ____//
void testfunct(void);
void testfunct(void)
{
uprintf("\n Testing BIOSPatchInsert \n");
orgFunction = BIOSPatchInsert(SCIRxBlocked, showBlocked);
while (getch() != '.')
;
BIOSPatchInsert(SCIRxBlocked, orgFunction); // restore
} //____ testfunct() ____//
This function exists solely as a helper function for the other chore maintenance stacks and should never be called by a user application. It adds a chore to the internal chore stack.
|
Prototype: |
bool BIOSAddChore(BIOSChore list[], ushort max, vfptr chore, ushort intReqLevel); |
|
Definition: |
#include <cf1bios.h> |
|
Inputs: |
list is an array of BIOSChore structs to which the
chore is to be added |
|
Returns: |
Returns TRUE if the chore could be added or FALSE if it could not for any reason. |
|
Notes: |
|
|
Timing: |
Timing-TBD |
This function exists solely as a helper function for the other chore maintenance stacks and should never be called by a user application. It removes a chore from the internal chore stack.
|
Prototype: |
bool BIOSRemoveChore(BIOSChore list[], ushort max, vfptr chore); |
|
Definition: |
#include <cf1bios.h> |
|
Inputs: |
list an array of BIOSChore structs from which the
chore is to be removed |
|
Returns: |
Returns TRUE if the chore was successfully removed or FALSE if it could not be found. |
|
Notes: |
|
|
Timing: |
Timing-TBD |
|
|
|
|
|
|
Tel: 508-759-6434 |
|
Fax: 508-759-6436 |
|
|
||