badut
Posts: 20
Joined: Tue Sep 11, 2012 12:49 pm

Screen02 - variable bit depth

Tue Sep 18, 2012 9:45 pm

I've been trying to extend Alex's screen02 by adding the ability to use bit depths other than high colour.

So far, I've had limited success. I can't get low colour or RGBA to draw anything at all.
High colour draws fine but true colour seems to have the red and blue channels reversed. This sounds like some sort of endianness problem with the way I'm storing the colour into the frame buffer right? That's what I thought at first. But if that's the case, why does high colour work ok?

Here is my draw.s

Code: Select all

/* Store the current colour to draw in */
.align 2
currColour:
  .int 0xFFFFFFFF

/* Store the address of the frame buffer info structure */
.align 2
graphicsAddress:
  .int 0
  
/* Store the 8x16 font */ 
.align 4
font:
  .incbin "font.bin"

/*** Text Section ***/
.section .text

/*
* Sets the draw colour
* r0 must contain the colour suitable for frame buffer bit depth
*/
.globl SetCurrColour
SetCurrColour:
  ldr r1,=currColour
  str r0,[r1]
  mov pc,lr

/*
* Sets the memory location to draw to
* r0 must contain the memory location
*/
.globl SetGraphicsAddress
SetGraphicsAddress:
  ldr r1,=graphicsAddress
  str r0,[r1]
  mov pc,lr

/*
* Sets the pixel at (x, y) to the colour in currColour.
* r0 must contain x (< frame buffer width)
* r1 must contain y (< frame buffer height)
*/
.global SetPixel
SetPixel:
  ldr r3,=graphicsAddress
  ldr r3,[r3]
  
  push {r4,r5,r6}
  
  /* Check 0<=y<height && 0<=x<width */
  ldr r5,[r3,#4]
  cmp r1,r5
  ldrlo r5,[r3,#0]
  cmplo r0,r5
  pophs {r4,r5,r6}
  movhs pc,lr
  
  x .req r0
  y .req r1
  fbInfoAddr .req r3
  
  bytesPerPixel .req r2
  ldr bytesPerPixel,[fbInfoAddr,#20]
  lsr bytesPerPixel,#3 /* Bytes per pixel - assuming bitDepth is a multiple of 8 */
  
  pixelAddr .req r4
  fbWidth .req r5
  numPixels .req r6
  
  /* numPixels is y by width plus x */
  mla numPixels,y,fbWidth,x
  .unreq fbWidth
  .unreq x
  .unreq y
  
  byteCounter .req r1
  mov byteCounter,#0
  mov pixelAddr,#0
  /* Multiply numPixels by bytes per pixel to get address offset */
  multLoop$:
    add pixelAddr,numPixels
    add byteCounter,#1
    cmp byteCounter,bytesPerPixel
    blo multLoop$
  .unreq numPixels
  .unreq byteCounter
  
  fbAddr .req r0
  ldr fbAddr,[fbInfoAddr,#32]
  .unreq fbInfoAddr
  add pixelAddr,fbAddr
  .unreq fbAddr
  
  currColour .req r3
  colourByteOffset .req r5
  mov colourByteOffset,#0
  
  ldr currColour,=currColour
  ldr currColour,[currColour]
  
  strColLoop$:
    strb currColour,[pixelAddr,colourByteOffset]
    add colourByteOffset,#1
    cmp colourByteOffset,bytesPerPixel
    lsrlo currColour,#8
    blo strColLoop$

  .unreq bytesPerPixel
  .unreq colourByteOffset
  .unreq currColour
  .unreq pixelAddr
    
  pop {r4,r5,r6}
  mov pc,lr
Using the above, if I set my bit depth to 16, this works as expected:

Code: Select all

  mov r0,#0xF800
  bl SetCurrColour
@ Draws something in red

  mov r0,#0x07E0
  bl SetCurrColour
@ Draws something in green

  mov r0,#0x001F
  bl SetCurrColour
@ Draws something in blue
But if I set bit depth to 24, it does this:

Code: Select all

  mov r0,#0xFF0000
  bl SetCurrColour
@ Draws something in blue (HUH?!)

  mov r0,#0x00FF00
  bl SetCurrColour
@ Draws something in green (ok)

  mov r0,#0x0000FF
  bl SetCurrColour
@ Draws something in red (HUH?!)
:oops:

User avatar
DexOS
Posts: 876
Joined: Wed May 16, 2012 6:32 pm
Contact: Website

Re: Screen02 - variable bit depth

Tue Sep 18, 2012 10:14 pm

Have a look here may help
https://github.com/raspberrypi/firmware ... -interface
example:
Get pixel order

* Tag: 0x00040006
* Request:
o Length: 0
* Response:
o Length: 4
o Value:
+ u32: state
* State:
o 0x0: BGR
o 0x1: RGB
Batteries not included, Some assembly required.

badut
Posts: 20
Joined: Tue Sep 11, 2012 12:49 pm

Re: Screen02 - variable bit depth

Wed Sep 19, 2012 1:40 am

Thanks DexOS,

I'm not sure I understand everything on that page.

Trying to picture what the request and response buffers would look like for a "Get pixel order" tag.

Request:
u32: 0x0000001c // Size of the entire request buffer
u32: 0x00000000 // buffer request code
u32: 0x00040006 // ie, the tag id of "Get pixel order"
u32: 0x00000004 // ie, the buffer size I'm giving for the response
u32: 0x00000000 // request indicator
u32: 0x00000000 // 4 byte buffer for the response value
u32: 0x00000000 // end tag

Response:
u32: 0x0000001c // Size of the entire request buffer
u32: 0x80000000 // buffer response code
u32: 0x00040006 // ie, the tag id of "Get pixel order"
u32: 0x00000004 // ie, the buffer size I'm giving for the response
u32: 0x80000004 // response indicator, response value should be 4 bytes long
u32: 0x00000001 // eg value for RGB
u32: 0x00000000 // end tag

Am I close? :?

The reason I have my doubts is cause it says
u8...: sequence of concatenated tags
Why would the concatenated tags be a sequence of u8's?

User avatar
DexOS
Posts: 876
Joined: Wed May 16, 2012 6:32 pm
Contact: Website

Re: Screen02 - variable bit depth

Wed Sep 19, 2012 3:16 pm

badut wrote:Thanks DexOS,

I'm not sure I understand everything on that page.

Trying to picture what the request and response buffers would look like for a "Get pixel order" tag.

Request:
u32: 0x0000001c // Size of the entire request buffer
u32: 0x00000000 // buffer request code
u32: 0x00040006 // ie, the tag id of "Get pixel order"
u32: 0x00000004 // ie, the buffer size I'm giving for the response
u32: 0x00000000 // request indicator
u32: 0x00000000 // 4 byte buffer for the response value
u32: 0x00000000 // end tag

Response:
u32: 0x0000001c // Size of the entire request buffer
u32: 0x80000000 // buffer response code
u32: 0x00040006 // ie, the tag id of "Get pixel order"
u32: 0x00000004 // ie, the buffer size I'm giving for the response
u32: 0x80000004 // response indicator, response value should be 4 bytes long
u32: 0x00000001 // eg value for RGB
u32: 0x00000000 // end tag

Am I close? :?

The reason I have my doubts is cause it says
u8...: sequence of concatenated tags
Why would the concatenated tags be a sequence of u8's?
Some basic (fasmarm code by Peter Lemon )

Code: Select all

; Run Tags
imm32 r0,TAGS_STRUCT
orr r0,MAIL_TAGS
imm32 r1,MB_WRITE_TAGS
ldr r1,[r1]
str r0,[r1] ; Mail Box Write      
data

Code: Select all

align 16
TAGS_STRUCT: ; Mailbox Property Interface Buffer Structure
  dw TAGS_END - TAGS_STRUCT ; Buffer Size In Bytes (Including The Header Values, The End Tag And Padding)
  dw $00000000 ; Buffer Request/Response Code
               ; Request Codes: $00000000 Process Request Response Codes: $80000000 Request Successful, $80000001 Partial Response
; Sequence Of Concatenated Tags
  dw Get_Firmware_Revision ; Tag Identifier
  dw $00000004 ; Value Buffer Size In Bytes
  dw $00000004 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
VCFirmwareRevisionValue:
  dw 0 ; Value Buffer


  dw Get_Board_Model ; Tag Identifier
  dw $00000004 ; Value Buffer Size In Bytes
  dw $00000004 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
HWBoardModelValue:
  dw 0 ; Value Buffer

  dw Get_Board_Revision ; Tag Identifier
  dw $00000004 ; Value Buffer Size In Bytes
  dw $00000004 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
HWBoardRevisionValue:
  dw 0 ; Value Buffer

  dw Get_Board_MAC_Address ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000006 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
HWBoardMACAddressValue:
  dd 0 ; Value Buffer

  dw Get_Board_Serial ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
HWBoardSerialValue:
  dd 0 ; Value Buffer

  dw Get_ARM_Memory ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
HWARMMemoryBaseAddressValue:
  dw 0 ; Value Buffer
HWARMMemorySizeValue:
  dw 0 ; Value Buffer

  dw Get_VC_Memory ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
HWVCMemoryBaseAddressValue:
  dw 0 ; Value Buffer
HWVCMemorySizeValue:
  dw 0 ; Value Buffer


  dw Get_DMA_Channels ; Tag Identifier
  dw $00000004 ; Value Buffer Size In Bytes
  dw $00000004 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
SRMDMAChannelsValue:
  dw 0 ; Value Buffer


  dw Get_Power_State ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
PWRSDCardIDValue:
  dw PWR_SD_Card_ID ; Value Buffer
PWRSDCardStateValue:
  dw 0 ; Value Buffer

  dw Get_Power_State ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
PWRUART0IDValue:
  dw PWR_UART0_ID ; Value Buffer
PWRUART0StateValue:
  dw 0 ; Value Buffer

  dw Get_Power_State ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
PWRUART1IDValue:
  dw PWR_UART1_ID ; Value Buffer
PWRUART1StateValue:
  dw 0 ; Value Buffer

  dw Get_Power_State ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
PWRUSBHCDIDValue:
  dw PWR_USB_HCD_ID ; Value Buffer
PWRUSBHCDStateValue:
  dw 0 ; Value Buffer

  dw Get_Power_State ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
PWRI2C0IDValue:
  dw PWR_I2C0_ID ; Value Buffer
PWRI2C0StateValue:
  dw 0 ; Value Buffer

  dw Get_Power_State ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
PWRI2C1IDValue:
  dw PWR_I2C1_ID ; Value Buffer
PWRI2C1StateValue:
  dw 0 ; Value Buffer

  dw Get_Power_State ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
PWRI2C2IDValue:
  dw PWR_I2C2_ID ; Value Buffer
PWRI2C2StateValue:
  dw 0 ; Value Buffer

  dw Get_Power_State ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
PWRSPIIDValue:
  dw PWR_SPI_ID ; Value Buffer
PWRSPIStateValue:
  dw 0 ; Value Buffer

  dw Get_Power_State ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
PWRCCP2TXIDValue:
  dw PWR_CCP2TX_ID ; Value Buffer
PWRCCP2TXStateValue:
  dw 0 ; Value Buffer


  dw Get_Timing ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw PWR_SD_Card_ID ; Value Buffer
PWRSDCardTimingValue:
  dw 0 ; Value Buffer

  dw Get_Timing ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw PWR_UART0_ID ; Value Buffer
PWRUART0TimingValue:
  dw 0 ; Value Buffer

  dw Get_Timing ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw PWR_UART1_ID ; Value Buffer
PWRUART1TimingValue:
  dw 0 ; Value Buffer

  dw Get_Timing ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw PWR_USB_HCD_ID ; Value Buffer
PWRUSBHCDTimingValue:
  dw 0 ; Value Buffer

  dw Get_Timing ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw PWR_I2C0_ID ; Value Buffer
PWRI2C0TimingValue:
  dw 0 ; Value Buffer

  dw Get_Timing ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw PWR_I2C1_ID ; Value Buffer
PWRI2C1TimingValue:
  dw 0 ; Value Buffer

  dw Get_Timing ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw PWR_I2C2_ID ; Value Buffer
PWRI2C2TimingValue:
  dw 0 ; Value Buffer

  dw Get_Timing ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw PWR_SPI_ID ; Value Buffer
PWRSPITimingValue:
  dw 0 ; Value Buffer

  dw Get_Timing ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw PWR_CCP2TX_ID ; Value Buffer
PWRCCP2TXTimingValue:
  dw 0 ; Value Buffer


  dw Get_Clock_State ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
CLKEMMCIDValue:
  dw CLK_EMMC_ID ; Value Buffer
CLKEMMCStateValue:
  dw 0 ; Value Buffer

  dw Get_Clock_State ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
CLKUARTIDValue:
  dw CLK_UART_ID ; Value Buffer
CLKUARTStateValue:
  dw 0 ; Value Buffer

  dw Get_Clock_State ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
CLKARMIDValue:
  dw CLK_ARM_ID ; Value Buffer
CLKARMStateValue:
  dw 0 ; Value Buffer

  dw Get_Clock_State ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
CLKCOREIDValue:
  dw CLK_CORE_ID ; Value Buffer
CLKCOREStateValue:
  dw 0 ; Value Buffer

  dw Get_Clock_State ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
CLKV3DIDValue:
  dw CLK_V3D_ID ; Value Buffer
CLKV3DStateValue:
  dw 0 ; Value Buffer

  dw Get_Clock_State ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
CLKH264IDValue:
  dw CLK_H264_ID ; Value Buffer
CLKH264StateValue:
  dw 0 ; Value Buffer

  dw Get_Clock_State ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
CLKISPIDValue:
  dw CLK_ISP_ID ; Value Buffer
CLKISPStateValue:
  dw 0 ; Value Buffer

  dw Get_Clock_State ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
CLKSDRAMIDValue:
  dw CLK_SDRAM_ID ; Value Buffer
CLKSDRAMStateValue:
  dw 0 ; Value Buffer

  dw Get_Clock_State ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
CLKPIXELIDValue:
  dw CLK_PIXEL_ID ; Value Buffer
CLKPIXELStateValue:
  dw 0 ; Value Buffer

  dw Get_Clock_State ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
CLKPWMIDValue:
  dw CLK_PWM_ID ; Value Buffer
CLKPWMStateValue:
  dw 0 ; Value Buffer


  dw Get_Clock_Rate ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw CLK_EMMC_ID ; Value Buffer
CLKEMMCRateValue:
  dw 0 ; Value Buffer

  dw Get_Clock_Rate ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw CLK_UART_ID ; Value Buffer
CLKUARTRateValue:
  dw 0 ; Value Buffer

  dw Get_Clock_Rate ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw CLK_ARM_ID ; Value Buffer
CLKARMRateValue:
  dw 0 ; Value Buffer

  dw Get_Clock_Rate ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw CLK_CORE_ID ; Value Buffer
CLKCORERateValue:
  dw 0 ; Value Buffer

  dw Get_Clock_Rate ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw CLK_V3D_ID ; Value Buffer
CLKV3DRateValue:
  dw 0 ; Value Buffer

  dw Get_Clock_Rate ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw CLK_H264_ID ; Value Buffer
CLKH264RateValue:
  dw 0 ; Value Buffer

  dw Get_Clock_Rate ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw CLK_ISP_ID ; Value Buffer
CLKISPRateValue:
  dw 0 ; Value Buffer

  dw Get_Clock_Rate ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw CLK_SDRAM_ID ; Value Buffer
CLKSDRAMRateValue:
  dw 0 ; Value Buffer

  dw Get_Clock_Rate ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw CLK_PIXEL_ID ; Value Buffer
CLKPIXELRateValue:
  dw 0 ; Value Buffer

  dw Get_Clock_Rate ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw CLK_PWM_ID ; Value Buffer
CLKPWMRateValue:
  dw 0 ; Value Buffer


  dw Get_Max_Clock_Rate ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw CLK_EMMC_ID ; Value Buffer
CLKEMMCMaxValue:
  dw 0 ; Value Buffer

  dw Get_Max_Clock_Rate ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw CLK_UART_ID ; Value Buffer
CLKUARTMaxValue:
  dw 0 ; Value Buffer

  dw Get_Max_Clock_Rate ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw CLK_ARM_ID ; Value Buffer
CLKARMMaxValue:
  dw 0 ; Value Buffer

  dw Get_Max_Clock_Rate ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw CLK_CORE_ID ; Value Buffer
CLKCOREMaxValue:
  dw 0 ; Value Buffer

  dw Get_Max_Clock_Rate ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw CLK_V3D_ID ; Value Buffer
CLKV3DMaxValue:
  dw 0 ; Value Buffer

  dw Get_Max_Clock_Rate ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw CLK_H264_ID ; Value Buffer
CLKH264MaxValue:
  dw 0 ; Value Buffer

  dw Get_Max_Clock_Rate ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw CLK_ISP_ID ; Value Buffer
CLKISPMaxValue:
  dw 0 ; Value Buffer

  dw Get_Max_Clock_Rate ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw CLK_SDRAM_ID ; Value Buffer
CLKSDRAMMaxValue:
  dw 0 ; Value Buffer

  dw Get_Max_Clock_Rate ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw CLK_PIXEL_ID ; Value Buffer
CLKPIXELMaxValue:
  dw 0 ; Value Buffer

  dw Get_Max_Clock_Rate ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw CLK_PWM_ID ; Value Buffer
CLKPWMMaxValue:
  dw 0 ; Value Buffer


dw Get_Min_Clock_Rate ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw CLK_EMMC_ID ; Value Buffer
CLKEMMCMinValue:
  dw 0 ; Value Buffer

  dw Get_Min_Clock_Rate ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw CLK_UART_ID ; Value Buffer
CLKUARTMinValue:
  dw 0 ; Value Buffer

  dw Get_Min_Clock_Rate ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw CLK_ARM_ID ; Value Buffer
CLKARMMinValue:
  dw 0 ; Value Buffer

  dw Get_Min_Clock_Rate ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw CLK_CORE_ID ; Value Buffer
CLKCOREMinValue:
  dw 0 ; Value Buffer

  dw Get_Min_Clock_Rate ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw CLK_V3D_ID ; Value Buffer
CLKV3DMinValue:
  dw 0 ; Value Buffer

  dw Get_Min_Clock_Rate ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw CLK_H264_ID ; Value Buffer
CLKH264MinValue:
  dw 0 ; Value Buffer

  dw Get_Min_Clock_Rate ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw CLK_ISP_ID ; Value Buffer
CLKISPMinValue:
  dw 0 ; Value Buffer

  dw Get_Min_Clock_Rate ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw CLK_SDRAM_ID ; Value Buffer
CLKSDRAMMinValue:
  dw 0 ; Value Buffer

  dw Get_Min_Clock_Rate ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw CLK_PIXEL_ID ; Value Buffer
CLKPIXELMinValue:
  dw 0 ; Value Buffer

  dw Get_Min_Clock_Rate ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw CLK_PWM_ID ; Value Buffer
CLKPWMMinValue:
  dw 0 ; Value Buffer

  dw Get_Turbo ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw 0 ; Value Buffer
CLKTurboValue:
  dw 0 ; Value Buffer


  dw Get_Voltage ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
VLTCoreIDValue:
  dw VLT_Core_ID ; Value Buffer
VLTCoreValue:
  dw 0 ; Value Buffer

  dw Get_Voltage ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
VLTSDRAM_CIDValue:
  dw VLT_SDRAM_C_ID ; Value Buffer
VLTSDRAM_CValue:
  dw 0 ; Value Buffer

  dw Get_Voltage ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
VLTSDRAM_PIDValue:
  dw VLT_SDRAM_P_ID ; Value Buffer
VLTSDRAM_PValue:
  dw 0 ; Value Buffer

  dw Get_Voltage ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
VLTSDRAM_IIDValue:
  dw VLT_SDRAM_I_ID ; Value Buffer
VLTSDRAM_IValue:
  dw 0 ; Value Buffer


  dw Get_Max_Voltage ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw VLT_Core_ID ; Value Buffer
VLTCoreMaxValue:
  dw 0 ; Value Buffer

  dw Get_Max_Voltage ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw VLT_SDRAM_C_ID ; Value Buffer
VLTSDRAM_CMaxValue:
  dw 0 ; Value Buffer

  dw Get_Max_Voltage ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw VLT_SDRAM_P_ID ; Value Buffer
VLTSDRAM_PMaxValue:
  dw 0 ; Value Buffer

  dw Get_Max_Voltage ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw VLT_SDRAM_I_ID ; Value Buffer
VLTSDRAM_IMaxValue:
  dw 0 ; Value Buffer


  dw Get_Min_Voltage ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw VLT_Core_ID ; Value Buffer
VLTCoreMinValue:
  dw 0 ; Value Buffer

  dw Get_Min_Voltage ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw VLT_SDRAM_C_ID ; Value Buffer
VLTSDRAM_CMinValue:
  dw 0 ; Value Buffer

  dw Get_Min_Voltage ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw VLT_SDRAM_P_ID ; Value Buffer
VLTSDRAM_PMinValue:
  dw 0 ; Value Buffer

  dw Get_Min_Voltage ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw VLT_SDRAM_I_ID ; Value Buffer
VLTSDRAM_IMinValue:
  dw 0 ; Value Buffer


  dw Get_Temperature ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
  dw 0 ; Value Buffer
VLTTemperatureValue:
  dw 0 ; Value Buffer

  dw Get_Physical_Display ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
FBPhysicalDisplayWidthValue:
  dw 0 ; Value Buffer
FBPhysicalDisplayHeightValue:
  dw 0 ; Value Buffer

  dw Get_Virtual_Buffer ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
FBVirtualBufferWidthValue:
  dw 0 ; Value Buffer
FBVirtualBufferHeightValue:
  dw 0 ; Value Buffer

  dw Get_Depth ; Tag Identifier
  dw $00000004 ; Value Buffer Size In Bytes
  dw $00000004 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
FBDepthValue:
  dw 0 ; Value Buffer

  dw Get_Pixel_Order ; Tag Identifier
  dw $00000004 ; Value Buffer Size In Bytes
  dw $00000004 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
FBPixelOrderValue:
  dw 0 ; Value Buffer

  dw Get_Alpha_Mode ; Tag Identifier
  dw $00000004 ; Value Buffer Size In Bytes
  dw $00000004 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
FBAlphaModeValue:
  dw 0 ; Value Buffer

  dw Get_Pitch ; Tag Identifier
  dw $00000004 ; Value Buffer Size In Bytes
  dw $00000004 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
FBPitchValue:
  dw 0 ; Value Buffer

  dw Get_Virtual_Offset ; Tag Identifier
  dw $00000008 ; Value Buffer Size In Bytes
  dw $00000008 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
FBVirtualOffsetXValue:
  dw 0 ; Value Buffer
FBVirtualOffsetYValue:
  dw 0 ; Value Buffer

  dw Get_Overscan ; Tag Identifier
  dw $00000010 ; Value Buffer Size In Bytes
  dw $00000010 ; 1 bit (MSB) Request/Response Indicator (0=Request, 1=Response), 31 bits (LSB) Value Length In Bytes
FBOverscanTopValue:
  dw 0 ; Value Buffer
FBOverscanBottomValue:
  dw 0 ; Value Buffer
FBOverscanLeftValue:
  dw 0 ; Value Buffer
FBOverscanRightValue:
  dw 0 ; Value Buffer

dw $00000000 ; $0 (End Tag)
TAGS_END:                              
The imm32 is a macro see here:

Code: Select all

macro imm32 reg,immediate {				
mov reg,immediate and $FF				
orr reg,reg,immediate and $FF00 			
orr reg,reg,immediate and $FF0000			 
orr reg,reg,immediate and $FF000000			 
}							
Hope that helps
Batteries not included, Some assembly required.

badut
Posts: 20
Joined: Tue Sep 11, 2012 12:49 pm

Re: Screen02 - variable bit depth

Thu Sep 20, 2012 1:03 am

Thank you, that does help :D

tufty
Posts: 1456
Joined: Sun Sep 11, 2011 2:32 pm

Re: Screen02 - variable bit depth

Thu Sep 20, 2012 4:28 am

I'm assuming that fasmarm doesn't provide it, but in real code I would strongly suggest replacing dex's imm32 with this:

Code: Select all

ldr rN, =imm32
This will either generate a one instruction mov/mvn or an ldr rN, [pc, #offset] (or, on armv6T and above, a 16 bit mov/movt pair).

User avatar
DexOS
Posts: 876
Joined: Wed May 16, 2012 6:32 pm
Contact: Website

Re: Screen02 - variable bit depth

Thu Sep 20, 2012 2:56 pm

tufty wrote:I'm assuming that fasmarm doesn't provide it, but in real code I would strongly suggest replacing dex's imm32 with this:

Code: Select all

ldr rN, =imm32
This will either generate a one instruction mov/mvn or an ldr rN, [pc, #offset] (or, on armv6T and above, a 16 bit mov/movt pair).
tufty is right,
FASMARM will not currently recognize any of the ARM pseudo-instructions like LDR Rd,=
Batteries not included, Some assembly required.

Return to “Bare metal, Assembly language”