HAL Documentation

This documentation  provides preliminary explaination of the HAL library, a
more detailed version of this document is in the process of being written
and will be released with future driver builds.

------------------------------------------------------------
MGAOpenLibrary

Description: Link Client functions with HAL Librery

Input:
LPBOARDHANDLE pBoard: Handle to the board structure containing all the information about the board.

LPBARDHANDLElpClient: Pointer to the client stucture

ulClientSize: Size of the client structure

Error:
return 0 on success

-------------------------------------------------------------
MGAGetHardwareInfo

Description:

Fills MGAWINFO structure.

struct {
ULONG UlCapsFirstOutput;
ULONG ulCapsSecondOutput;
ULONG ulVideoMemory;
} FAR *LPMGAHWINFO;

#define MGAHWINFOCAPS_CRTC1_DIGITAL         (1L << 1)
#define MGAHWINFOCAPS_CRTC1_TV              (1L << 2)
#define MGAHWINFOCAPS_CRTC2_ANALOG          (1L << 3)
#define MGAHWINFOCAPS_CRTC2_DIGITAL         (1L << 4)
#define MGAHWINFOCAPS_CRTC2_TV              (1L << 5)
#define MGAHWINFOCAPS_OUTPUT_VGA            (1L << 6)
#define MGAHWINFOCAPS_CRTC2                 (MGAHWINFOCAPS_CRTC2_ANALOG | MGAHWINFOCAPS_CRTC2_DIGITAL | MGAHWINFOCAPS_CRTC2_TV)
#define MGAHWINFOCAPS_OUTPUT_ANALOG         (MGAHWINFOCAPS_CRTC1_ANALOG | MGAHWINFOCAPS_CRTC2_ANALOG)
#define MGAHWINFOCAPS_OUTPUT_DIGITAL        (MGAHWINFOCAPS_CRTC1_DIGITAL | MGAHWINFOCAPS_CRTC2_DIGITAL)
#define MGAHWINFOCAPS_OUTPUT_TV             (MGAHWINFOCAPS_CRTC1_TV | MGAHWINFOCAPS_CRTC2_TV)

example:

if (pMga->pMgaHwInfo->ulCapsSecondOutput & MGAHWINFOCAPS_OUTPUT_TV )
{
	ErrorF("TV detected\n");
	xf86DrvMsg(pScrn->scrnIndex, X_INFO, "TV detected\n ");
}
if (pMga->pMgaHwInfo->ulCapsSecondOutput & MGAHWINFOCAPS_OUTPUT_DIGITAL)
{
        xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Digital Screen  detected\n ");
}

Inputs:

LPBOARDHANDLE  pBoard: Handle to the board structure containing all the information about the board.

LPMGAHWINFO pMgaHwInfo:  Handle to the board  structure containing all
the information about the specific Board.

Error:
Returns 0 on success
------------------------------------------------------------
MGAValidateMode

Description:

Validates the mode given by client.

Here are the different options for pMgaModeInfo->flOutput:

MGAMODEINFO_FORCE_PITCH
MGAMODEINFO_FORCE_DISPLAYORG
MGAMODEINFO_SECOND_CRTC
MGAMODEINFO_ANALOG1
MGAMODEINFO_ANALOG2
MGAMODEINFO_DIGITAL1
MGAMODEINFO_DIGITAL2
MGAMODEINFO_TV

These options can be combined together to set different combinations.
Example:

/*The second crtc outputs to a digital screen*/
pMgaModeInfo->flOutput= MGAMODEINFO_DIGITAL2 | MGAMODEINFO_SECOND_CRTC
| MGAMODEINFO_FORCE_PITCH | MGAMODEINFO_FORCE_DISPLAYORG;

- or -

/*The second crtc outputs to an analog screen*/
pMgaModeInfo-> flOutput = MGAMODEINFO_ANALOG2| MGAMODEINFO_SECOND_CRTC
| MGAMODEINFO_FORCE_PITCH | MGAMODEINFO_FORCE_DISPLAYORG;

- or -

/*The second crtc outputs to a tv*/
pMga->pMgaModeInfo->flOutput = MGAMODEINFO_TV | MGAMODEINFO_SECOND_CRTC | MGAMODEINFO_FORCE_PITCH | MGAMODEINFO_FORCE_DISPLAYORG;

Inputs:
LPBOARDHANDLE pBoard: Handle to the board structure containing all the information about the board.

LPMGAMODEINFO pMgaModeInfo: Pointer to structure containing information about a specific display mode. (You need to fill the structure except the video parameters part which will be filled by the function).

Error:
Returns 0 on success

-------------------------------------------------------------
MGASetMode

Description:

Initializes the board.

Here are the different options for pMgaModeInfo->flOutput:

MGAMODEINFO_FORCE_PITCH
MGAMODEINFO_FORCE_DISPLAYORG
MGAMODEINFO_SECOND_CRTC
MGAMODEINFO_ANALOG1
MGAMODEINFO_ANALOG2
MGAMODEINFO_DIGITAL1
MGAMODEINFO_DIGITAL2
MGAMODEINFO_TV

These options can be combined together to set different combinations.
Example:

/*The second crtc outputs to a digital screen*/
pMgaModeInfo->flOutput= MGAMODEINFO_DIGITAL2 | MGAMODEINFO_SECOND_CRTC
| MGAMODEINFO_FORCE_PITCH | MGAMODEINFO_FORCE_DISPLAYORG;

- or -

/*The second crtc outputs to an analog screen*/
pMgaModeInfo-> flOutput = MGAMODEINFO_ANALOG2| MGAMODEINFO_SECOND_CRTC
| MGAMODEINFO_FORCE_PITCH | MGAMODEINFO_FORCE_DISPLAYORG;

- or -

/*The second crtc outputs to a tv*/
pMga->pMgaModeInfo->flOutput = MGAMODEINFO_TV | MGAMODEINFO_SECOND_CRTC | MGAMODEINFO_FORCE_PITCH | MGAMODEINFO_FORCE_DISPLAYORG;

Inputs:
LPBOARDHANDLE pBoard: Handle to the board structure containing all the information about the board.

LPMGAMODEINFO pMgaModeInfo: Pointer to structure containing information about a specific display mode. (You need to fill the structure except the video parameters part which will be filled by the function).

Error:
Returns 0 on success

------------------------------------------------------------

MGASetVgaMode

Description:

Switchs the VGA mode

Inputs:
LPBOARDHANDLE pBoard: Handle to the board structure containing all the information about the board.

Error:
Returns 0 on success

------------------------------------------------------------

MGARestoreVgaState

Description:

Restores the VGA State

Inputs:
LPBOARDHANDLE pBoard: Handle to the board structure containing all the information about the board.

Error:
Returns 0 on success

------------------------------------------------------------

MGASaveVgaState

Description:

Saves the VGA state

Inputs:
LPBOARDHANDLE pBoard: Handle to the board structure containing all the information about the board.

Error:
Returns 0 on success

------------------------------------------------------------

MGACloseLibrary

Description:

Closes the library

Inputs:
LPBOARDHANDLE pBoard: Handle to the board structure containing all the information about the board.

Error:
Returns 0 on success
