tft
Vitis Drivers API Documentation
|
Data Structures | |
struct | XTft_Config |
This structure holds the Device base address, video memory base address and Unique identifier of the device. More... | |
struct | XTft |
This structure is the base for whole of the operations that are to be performed on the TFT screen. More... | |
Macros | |
#define | XTFT_ASCIICHAR_OFFSET 32 |
As the first bitmap available in the Character Bitmap array is "space" whose value is 32 in the ASCII character table, this offset enables us to move to this first character in the array. More... | |
#define | XTFT_DEF_FGCOLOR 0x00FFFFFF |
The default color is white for foreground and black for background. More... | |
#define | XTFT_DEF_BGCOLOR 0x0 |
Background Color - Black. More... | |
#define | XTFT_DEF_COLVAL 0x0 |
Default Column Value. More... | |
#define | XTFT_DEF_ROWVAL 0x0 |
Default Row Value. More... | |
#define | GenPixels(a7, a6, a5, a4, a3, a2, a1, a0) |
Compression method for the character bitmaps. More... | |
#define | XTFT_CHAR_WIDTH 8 |
Dimension Definitions. More... | |
#define | XTFT_CHAR_HEIGHT 12 |
Character height. More... | |
#define | XTFT_DISPLAY_WIDTH 640 |
Width of the screen. More... | |
#define | XTFT_DISPLAY_HEIGHT 480 |
Height of the screen. More... | |
#define | XTFT_DISPLAY_BUFFER_WIDTH 1024 |
Buffer width of a line. More... | |
#define | XTFT_DCR_REG_SHIFT 2 |
Reg Shift for DCR Access. More... | |
Functions | |
int | XTft_CfgInitialize (XTft *InstancePtr, XTft_Config *ConfigPtr, UINTPTR EffectiveAddr) |
This function initializes a TFT Driver Instance. More... | |
void | XTft_SetPos (XTft *InstancePtr, u32 ColVal, u32 RowVal) |
This function updates the column, row position in the Instance structure of driver. More... | |
void | XTft_SetPosChar (XTft *InstancePtr, u32 ColVal, u32 RowVal) |
This function changes the column, row position in the Instance structure of driver. More... | |
void | XTft_SetColor (XTft *InstancePtr, u32 FgColor, u32 BgColor) |
This function changes the color values in the instance structure of driver. More... | |
void | XTft_SetPixel (XTft *InstancePtr, u32 ColVal, u32 RowVal, u32 PixelVal) |
This function sets the pixel with the given color at the given column, row position. More... | |
void | XTft_GetPixel (XTft *InstancePtr, u32 ColVal, u32 RowVal, u32 *PixelVal) |
This function gets the color of the pixel at the given column, row position. More... | |
void | XTft_Write (XTft *InstancePtr, u8 CharValue) |
This function performs one of the following three operations based on the CharValue passed : More... | |
void | XTft_Scroll (XTft *InstancePtr) |
This function inserts a new blank line at the bottom of the screen, it deletes the first line and moves the remaining lines up by one line. More... | |
void | XTft_ClearScreen (XTft *InstancePtr) |
This function re-initializes all the pixels to the default background color. More... | |
void | XTft_FillScreen (XTft *InstancePtr, u32 ColStartVal, u32 RowStartVal, u32 ColEndVal, u32 RowEndVal, u32 PixelVal) |
This function fills the screen with the range defined by the start and end values of column and row with the color passed as argument. More... | |
void | XTft_EnableDisplay (XTft *InstancePtr) |
This function enables the TFT display by setting the Display Enable bit in the Control register. More... | |
void | XTft_DisableDisplay (XTft *InstancePtr) |
This function disables the TFT display by clearing the Display Enable bit in the Control register. More... | |
void | XTft_ScanReverse (XTft *InstancePtr) |
This function enables reverse scan by setting the Display Scan Control(DPS) bit in the Control register. More... | |
void | XTft_ScanNormal (XTft *InstancePtr) |
This function enables normal scan by clearing the Display Scan Control(DPS) bit in the Control register. More... | |
void | XTft_SetFrameBaseAddr (XTft *InstancePtr, UINTPTR NewFrameBaseAddr) |
This function changes the Video Memory Base address stored in the Address Register. More... | |
void | XTft_WriteReg (XTft *InstancePtr, u32 RegOffset, u32 Data) |
Write a value to a TFT register. More... | |
u32 | XTft_ReadReg (XTft *InstancePtr, u32 RegOffset) |
Read a value from a TFT register. More... | |
void | XTft_IntrEnable (XTft *InstancePtr) |
This function enables the Vsync Interrupt in the Interrupt Enable and Status Register. More... | |
void | XTft_IntrDisable (XTft *InstancePtr) |
This function disables the Vsync Interrupt in the Interrupt Enable and Status Register. More... | |
int | XTft_GetVsyncStatus (XTft *InstancePtr) |
This function gets the Vsync(Video address latch) status from the Interrupt Enable and Status Register. More... | |
XTft_Config * | XTft_LookupConfig (u16 DeviceId) |
This function obtains the Configuration pointer of the device whose ID is being passed as the parameter to the function. More... | |
Variables | |
u8 | XTft_VidChars [96][12] |
Character array of 96 characters with each character having dimensions of width 8 and height 12 pixels. More... | |
XTft_Config | XTft_ConfigTable [] |
The configuration table for TFT devices in the table. More... | |
XTft_Config | XTft_ConfigTable [] |
The configuration table for TFT devices in the table. More... | |
TFT Register offsets | |
The following definitions provide access to each of the registers of the TFT device. | |
#define | XTFT_AR_OFFSET 0 |
Address Reg (Video memory) Offset. More... | |
#define | XTFT_CR_OFFSET 4 |
Control Register Offset. More... | |
#define | XTFT_IESR_OFFSET 8 |
Interrupt Enable and Status Reg Offset. More... | |
#define | XTFT_AR_LSB_OFFSET 0x10 |
Address Reg LSB (Video memory) Offset. More... | |
#define | XTFT_AR_MSB_OFFSET 0x14 |
Address Reg MSB (Video memory) Offset. More... | |
TFT Control Register (CR) mask(s) | |
#define | XTFT_CR_TDE_MASK 0x01 |
TFT Display Enable Bit Mask. More... | |
#define | XTFT_CR_DPS_MASK 0x02 |
TFT Display Scan Control Bit Mask. More... | |
TFT Interrupt Enable and Status Register (IESR) mask(s) | |
#define | XTFT_IESR_VADDRLATCH_STATUS_MASK 0x01 |
TFT Video Address Latch Status Bit Mask. More... | |
#define | XTFT_IESR_IE_MASK 0x08 |
TFT Interrupt Enable Mask. More... | |
#define GenPixels | ( | a7, | |
a6, | |||
a5, | |||
a4, | |||
a3, | |||
a2, | |||
a1, | |||
a0 | |||
) |
Compression method for the character bitmaps.
a7 | is bit value at 8th position. |
a6 | is bit value at 7th position. |
a5 | is bit value at 6th position. |
a4 | is bit value at 5th position. |
a3 | is bit value at 4th position. |
a2 | is bit value at 3rd position. |
a1 | is bit value at 2nd position. |
a0 | is bit value at 1st position. |
#define XTFT_AR_LSB_OFFSET 0x10 |
Address Reg LSB (Video memory) Offset.
Referenced by XTft_SetFrameBaseAddr().
#define XTFT_AR_MSB_OFFSET 0x14 |
Address Reg MSB (Video memory) Offset.
Referenced by XTft_SetFrameBaseAddr().
#define XTFT_AR_OFFSET 0 |
Address Reg (Video memory) Offset.
Referenced by XTft_SetFrameBaseAddr().
#define XTFT_ASCIICHAR_OFFSET 32 |
As the first bitmap available in the Character Bitmap array is "space" whose value is 32 in the ASCII character table, this offset enables us to move to this first character in the array.
To achieve this we subtract this offset from the char value actually received to the XTft_WriteChar function. Similarly to move to any other character this offset must be subtracted.
#define XTFT_CHAR_HEIGHT 12 |
Character height.
Referenced by XTft_Scroll(), XTft_SetPosChar(), and XTft_Write().
#define XTFT_CHAR_WIDTH 8 |
#define XTFT_CR_DPS_MASK 0x02 |
TFT Display Scan Control Bit Mask.
Referenced by XTft_ScanNormal(), and XTft_ScanReverse().
#define XTFT_CR_OFFSET 4 |
Control Register Offset.
Referenced by XTft_DisableDisplay(), XTft_EnableDisplay(), XTft_ScanNormal(), and XTft_ScanReverse().
#define XTFT_CR_TDE_MASK 0x01 |
TFT Display Enable Bit Mask.
Referenced by XTft_DisableDisplay(), and XTft_EnableDisplay().
#define XTFT_DCR_REG_SHIFT 2 |
Reg Shift for DCR Access.
#define XTFT_DEF_BGCOLOR 0x0 |
Background Color - Black.
Referenced by XTft_CfgInitialize().
#define XTFT_DEF_COLVAL 0x0 |
Default Column Value.
Referenced by XTft_CfgInitialize(), XTft_ClearScreen(), XTft_Scroll(), XTft_SetPosChar(), and XTft_Write().
#define XTFT_DEF_FGCOLOR 0x00FFFFFF |
The default color is white for foreground and black for background.
These values can range from 0 to 0xFFFFFFFF as each color is ranging from 0 to 3F. The default value for column and row is 0.Foreground Color - White
Referenced by XTft_CfgInitialize().
#define XTFT_DEF_ROWVAL 0x0 |
Default Row Value.
Referenced by XTft_CfgInitialize(), and XTft_ClearScreen().
#define XTFT_DISPLAY_BUFFER_WIDTH 1024 |
Buffer width of a line.
Referenced by XTft_GetPixel(), and XTft_SetPixel().
#define XTFT_DISPLAY_HEIGHT 480 |
Height of the screen.
Referenced by XTft_CfgInitialize(), XTft_ClearScreen(), XTft_FillScreen(), XTft_GetPixel(), XTft_Scroll(), XTft_SetPixel(), XTft_SetPos(), and XTft_SetPosChar().
#define XTFT_DISPLAY_WIDTH 640 |
Width of the screen.
Referenced by XTft_CfgInitialize(), XTft_ClearScreen(), XTft_FillScreen(), XTft_GetPixel(), XTft_Scroll(), XTft_SetPixel(), XTft_SetPos(), and XTft_SetPosChar().
#define XTFT_IESR_IE_MASK 0x08 |
TFT Interrupt Enable Mask.
Referenced by XTft_IntrDisable(), and XTft_IntrEnable().
#define XTFT_IESR_OFFSET 8 |
Interrupt Enable and Status Reg Offset.
Referenced by XTft_GetVsyncStatus(), XTft_IntrDisable(), and XTft_IntrEnable().
#define XTFT_IESR_VADDRLATCH_STATUS_MASK 0x01 |
TFT Video Address Latch Status Bit Mask.
Referenced by TftExample(), and XTft_GetVsyncStatus().
int XTft_CfgInitialize | ( | XTft * | InstancePtr, |
XTft_Config * | ConfigPtr, | ||
UINTPTR | EffectiveAddr | ||
) |
This function initializes a TFT Driver Instance.
InstancePtr | is a pointer to the XTft instance. |
ConfigPtr | is a pointer to a XTft_Config configuration structure.This structure will contain the requested configuration for the device. Typically, this is a local structure and the content of which will be copied into the configuration structure within XTft. |
EffectiveAddr | is the device base address in the virtual memory address space. If the address translation is not used then the physical address is passed. Unexpected errors may occur if the address mapping is changed after this function is invoked. |
References XTft_Config::BaseAddress, XTft::BgColor, XTft::ColVal, XTft_Config::DeviceId, XTft::FgColor, XTft::IsReady, XTft::RowVal, XTft::TftConfig, XTft_Config::VideoMemBaseAddr, XTFT_DEF_BGCOLOR, XTFT_DEF_COLVAL, XTFT_DEF_FGCOLOR, XTFT_DEF_ROWVAL, XTFT_DISPLAY_HEIGHT, XTFT_DISPLAY_WIDTH, and XTft_FillScreen().
Referenced by TftExample().
void XTft_ClearScreen | ( | XTft * | InstancePtr | ) |
This function re-initializes all the pixels to the default background color.
InstancePtr | is a pointer to the XTft instance. |
References XTft::BgColor, XTft::ColVal, XTft::IsReady, XTft::RowVal, XTFT_DEF_COLVAL, XTFT_DEF_ROWVAL, XTFT_DISPLAY_HEIGHT, XTFT_DISPLAY_WIDTH, and XTft_FillScreen().
Referenced by TftExample().
void XTft_DisableDisplay | ( | XTft * | InstancePtr | ) |
This function disables the TFT display by clearing the Display Enable bit in the Control register.
InstancePtr | is a pointer to the XTft instance. |
References XTft::IsReady, XTFT_CR_OFFSET, XTFT_CR_TDE_MASK, XTft_ReadReg(), and XTft_WriteReg().
Referenced by TftExample().
void XTft_EnableDisplay | ( | XTft * | InstancePtr | ) |
This function enables the TFT display by setting the Display Enable bit in the Control register.
InstancePtr | is a pointer to the XTft instance. |
References XTft::IsReady, XTFT_CR_OFFSET, XTFT_CR_TDE_MASK, XTft_ReadReg(), and XTft_WriteReg().
Referenced by TftExample().
void XTft_FillScreen | ( | XTft * | InstancePtr, |
u32 | ColStartVal, | ||
u32 | RowStartVal, | ||
u32 | ColEndVal, | ||
u32 | RowEndVal, | ||
u32 | PixelVal | ||
) |
This function fills the screen with the range defined by the start and end values of column and row with the color passed as argument.
InstancePtr | is a pointer to the XTft instance. |
ColStartVal | is the value of the starting column. The valid values are 0 to (XTFT_DISPLAY_WIDTH - 1). |
RowStartVal | is the value of the starting row. The valid values are 0 to (XTFT_DISPLAY_HEIGHT - 1). |
ColEndVal | is the value of the ending column. The valid values are 0 to (XTFT_DISPLAY_WIDTH - 1). |
RowEndVal | is the value of the ending row. The valid values are 0 to (XTFT_DISPLAY_HEIGHT - 1). |
PixelVal | represents the color with which it will be filled on screen. |
References XTft::IsReady, XTFT_DISPLAY_HEIGHT, XTFT_DISPLAY_WIDTH, and XTft_SetPixel().
Referenced by XTft_CfgInitialize(), XTft_ClearScreen(), and XTft_Scroll().
void XTft_GetPixel | ( | XTft * | InstancePtr, |
u32 | ColVal, | ||
u32 | RowVal, | ||
u32 * | PixelVal | ||
) |
This function gets the color of the pixel at the given column, row position.
InstancePtr | is a pointer to the XTft instance. |
ColVal | represents the column on the screen. The valid values are 0 to (XTFT_DISPLAY_WIDTH - 1). |
RowVal | represents the row on the screen. The valid values are 0 to (XTFT_DISPLAY_HEIGHT - 1). |
PixelVal | stores the color value on the screen pointed by given Column and Row position. |
References XTft::IsReady, XTft::TftConfig, XTft_Config::VideoMemBaseAddr, XTFT_DISPLAY_BUFFER_WIDTH, XTFT_DISPLAY_HEIGHT, and XTFT_DISPLAY_WIDTH.
Referenced by XTft_Scroll().
int XTft_GetVsyncStatus | ( | XTft * | InstancePtr | ) |
This function gets the Vsync(Video address latch) status from the Interrupt Enable and Status Register.
InstancePtr | is a pointer to the XTft instance. |
References XTft::IsReady, XTFT_IESR_OFFSET, XTFT_IESR_VADDRLATCH_STATUS_MASK, and XTft_ReadReg().
Referenced by TftExample().
void XTft_IntrDisable | ( | XTft * | InstancePtr | ) |
This function disables the Vsync Interrupt in the Interrupt Enable and Status Register.
InstancePtr | is a pointer to the XTft instance. |
References XTft::IsReady, XTFT_IESR_IE_MASK, XTFT_IESR_OFFSET, XTft_ReadReg(), and XTft_WriteReg().
void XTft_IntrEnable | ( | XTft * | InstancePtr | ) |
This function enables the Vsync Interrupt in the Interrupt Enable and Status Register.
InstancePtr | is a pointer to the XTft instance. |
References XTft::IsReady, XTFT_IESR_IE_MASK, XTFT_IESR_OFFSET, XTft_ReadReg(), and XTft_WriteReg().
XTft_Config * XTft_LookupConfig | ( | u16 | DeviceId | ) |
This function obtains the Configuration pointer of the device whose ID is being passed as the parameter to the function.
DeviceId | is the unique number of the device. |
Referenced by TftExample().
u32 XTft_ReadReg | ( | XTft * | InstancePtr, |
u32 | RegOffset | ||
) |
Read a value from a TFT register.
A 32 bit read is performed.
InstancePtr | is a pointer to the XTft instance. |
RegOffset | is the register offset from the base to read from. |
References XTft_Config::BaseAddress, XTft::IsReady, and XTft::TftConfig.
Referenced by XTft_DisableDisplay(), XTft_EnableDisplay(), XTft_GetVsyncStatus(), XTft_IntrDisable(), XTft_IntrEnable(), XTft_ScanNormal(), and XTft_ScanReverse().
void XTft_ScanNormal | ( | XTft * | InstancePtr | ) |
This function enables normal scan by clearing the Display Scan Control(DPS) bit in the Control register.
InstancePtr | is a pointer to the XTft instance. |
References XTft::IsReady, XTFT_CR_DPS_MASK, XTFT_CR_OFFSET, XTft_ReadReg(), and XTft_WriteReg().
void XTft_ScanReverse | ( | XTft * | InstancePtr | ) |
This function enables reverse scan by setting the Display Scan Control(DPS) bit in the Control register.
InstancePtr | is a pointer to the XTft instance. |
References XTft::IsReady, XTFT_CR_DPS_MASK, XTFT_CR_OFFSET, XTft_ReadReg(), and XTft_WriteReg().
void XTft_Scroll | ( | XTft * | InstancePtr | ) |
This function inserts a new blank line at the bottom of the screen, it deletes the first line and moves the remaining lines up by one line.
InstancePtr | is a pointer to the XTft instance. |
References XTft::BgColor, XTft::IsReady, XTFT_CHAR_HEIGHT, XTFT_DEF_COLVAL, XTFT_DISPLAY_HEIGHT, XTFT_DISPLAY_WIDTH, XTft_FillScreen(), XTft_GetPixel(), and XTft_SetPixel().
Referenced by TftExample(), and XTft_SetPosChar().
void XTft_SetColor | ( | XTft * | InstancePtr, |
u32 | FgColor, | ||
u32 | BgColor | ||
) |
This function changes the color values in the instance structure of driver.
InstancePtr | is a pointer to the XTft instance. |
FgColor | is the color with which member FgColor of Instance structure is updated. |
BgColor | is the color with which member BgColor of Instance structure is updated. |
References XTft::BgColor, XTft::FgColor, and XTft::IsReady.
Referenced by TftExample().
void XTft_SetFrameBaseAddr | ( | XTft * | InstancePtr, |
UINTPTR | NewFrameBaseAddr | ||
) |
This function changes the Video Memory Base address stored in the Address Register.
InstancePtr | is a pointer to the XTft instance. |
NewFrameBaseAddr | is the new memory address value to be written to the Address register. |
References XTft_Config::AddrWidth, XTft::IsReady, XTft::TftConfig, XTft_Config::VideoMemBaseAddr, XTFT_AR_LSB_OFFSET, XTFT_AR_MSB_OFFSET, XTFT_AR_OFFSET, and XTft_WriteReg().
Referenced by TftExample().
void XTft_SetPixel | ( | XTft * | InstancePtr, |
u32 | ColVal, | ||
u32 | RowVal, | ||
u32 | PixelVal | ||
) |
This function sets the pixel with the given color at the given column, row position.
InstancePtr | is a pointer to the XTft instance. |
ColVal | represents the column on the screen. The valid values are 0 to (XTFT_DISPLAY_WIDTH - 1). |
RowVal | represents the row on the screen. The valid values are 0 to (XTFT_DISPLAY_HEIGHT - 1). |
PixelVal | represents the color with which it will be filled on screen. |
References XTft::IsReady, XTft::TftConfig, XTft_Config::VideoMemBaseAddr, XTFT_DISPLAY_BUFFER_WIDTH, XTFT_DISPLAY_HEIGHT, and XTFT_DISPLAY_WIDTH.
Referenced by XTft_FillScreen(), and XTft_Scroll().
void XTft_SetPos | ( | XTft * | InstancePtr, |
u32 | ColVal, | ||
u32 | RowVal | ||
) |
This function updates the column, row position in the Instance structure of driver.
InstancePtr | is a pointer to the XTft instance. |
ColVal | is the column number to which ColVal member of Instance structure is updated. The valid values are 0 to (XTFT_DISPLAY_WIDTH - 1). |
RowVal | is the row number to which RowVal member of Instance structure is updated. The valid values are 0 to (XTFT_DISPLAY_HEIGHT - 1). |
References XTft::ColVal, XTft::IsReady, XTft::RowVal, XTFT_DISPLAY_HEIGHT, and XTFT_DISPLAY_WIDTH.
Referenced by XTft_Write().
void XTft_SetPosChar | ( | XTft * | InstancePtr, |
u32 | ColVal, | ||
u32 | RowVal | ||
) |
This function changes the column, row position in the Instance structure of driver.
It is used to correct the position for the next character to be written if column and row position cross limits.
InstancePtr | is a pointer to the XTft instance. |
ColVal | is the column number to which ColVal member of Instance structure is updated. If ColVal crosses (XTFT_DISPLAY_WIDTH - 1) - XTFT_CHAR_WIDTH, position is moved to next line. The valid values are 0 to (XTFT_DISPLAY_WIDTH - 1). |
RowVal | is the row number to which RowVal member of Instance structure is updated. If RowVal crosses (XTFT_DISPLAY_HEIGHT - 1)- XTFT_CHAR_HEIGHT, the first line will be deleted. The valid values are 0 to (XTFT_DISPLAY_HEIGHT - 1). |
References XTft::ColVal, XTft::IsReady, XTft::RowVal, XTFT_CHAR_HEIGHT, XTFT_CHAR_WIDTH, XTFT_DEF_COLVAL, XTFT_DISPLAY_HEIGHT, XTFT_DISPLAY_WIDTH, and XTft_Scroll().
Referenced by XTft_Write().
void XTft_Write | ( | XTft * | InstancePtr, |
u8 | CharValue | ||
) |
This function performs one of the following three operations based on the CharValue passed :
InstancePtr | is a pointer to the XTft instance. |
CharValue | is the ASCII code value of the character to be written. |
References XTft::BgColor, XTft::ColVal, XTft::FgColor, XTft::IsReady, XTft::RowVal, XTFT_CHAR_HEIGHT, XTFT_CHAR_WIDTH, XTFT_DEF_COLVAL, XTft_SetPos(), and XTft_SetPosChar().
Referenced by TftExample().
void XTft_WriteReg | ( | XTft * | InstancePtr, |
u32 | RegOffset, | ||
u32 | Data | ||
) |
Write a value to a TFT register.
A 32 bit write is performed.
InstancePtr | is a pointer to the XTft instance. |
RegOffset | is the register offset from the base to write to. |
Data | is the data written to the register. |
References XTft_Config::BaseAddress, XTft::IsReady, and XTft::TftConfig.
Referenced by XTft_DisableDisplay(), XTft_EnableDisplay(), XTft_IntrDisable(), XTft_IntrEnable(), XTft_ScanNormal(), XTft_ScanReverse(), and XTft_SetFrameBaseAddr().
XTft_Config XTft_ConfigTable[] |
The configuration table for TFT devices in the table.
Each device should have an entry in this table.
XTft_Config XTft_ConfigTable[] |
The configuration table for TFT devices in the table.
Each device should have an entry in this table.
u8 XTft_VidChars[96][12] |
Character array of 96 characters with each character having dimensions of width 8 and height 12 pixels.
It starts with space as first character.