Changeset 005b765 in mainline for uspace/drv/fb/amdm37x_dispc/amdm37x_dispc_regs.h
- Timestamp:
- 2013-01-24T22:07:06Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 03362fbd, 3acd1bb, d59c046
- Parents:
- 6218d4b (diff), 24bead17 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/fb/amdm37x_dispc/amdm37x_dispc_regs.h
r6218d4b r005b765 1 1 /* 2 * Copyright (c) 201 2Jan Vesely2 * Copyright (c) 2013 Jan Vesely 3 3 * All rights reserved. 4 4 * … … 34 34 */ 35 35 36 #ifndef KERN_AMDM37x_DISPC_H_37 #define KERN_AMDM37x_DISPC_H_36 #ifndef AMDM37x_DISPC_REGS_H_ 37 #define AMDM37x_DISPC_REGS_H_ 38 38 39 39 /* AMDM37x TRM p. 1813 */ … … 41 41 #define AMDM37x_DISPC_SIZE 1024 42 42 43 #define __paddname(line) PADD32_ ## line 44 #define _paddname(line) __paddname(line) 45 #define PADD32(count) uint32_t _paddname(__LINE__)[count] 46 47 #include <typedefs.h> 43 #include <macros.h> 48 44 49 45 typedef struct { … … 51 47 #define AMDM37X_DISPC_REVISION_MASK 0xff 52 48 53 PADD32 (3);49 PADD32[3]; 54 50 ioport32_t sysconfig; 55 51 #define AMDM37X_DISPC_SYSCONFIG_AUTOIDLE_FLAG (1 << 0) … … 86 82 #define AMDM37X_DISPC_IRQ_WAKEUP_FLAG (1 << 16) 87 83 88 PADD32 (8);84 PADD32[8]; 89 85 ioport32_t control; 90 86 #define AMDM37X_DISPC_CONTROL_LCD_ENABLE_FLAG (1 << 0) … … 149 145 #define AMDM37X_DISPC_CONFIG_TVALPHABLENDERENABLE_FLAG (1 << 19) 150 146 151 PADD32 (1);147 PADD32[1]; 152 148 ioport32_t default_color[2]; 153 149 ioport32_t trans_color[2]; … … 215 211 #define AMDM37X_DISPC_SIZE_HEIGHT_SHIFT 16 216 212 217 PADD32 (4);213 PADD32[4]; 218 214 ioport32_t attributes; 219 215 #define AMDM37X_DISPC_GFX_ATTRIBUTES_ENABLE_FLAG (1 << 0) … … 266 262 } fir_coef[8]; 267 263 ioport32_t conv_coef[5]; 268 PADD32 (2);264 PADD32[2]; 269 265 } vid[2]; 270 266 /* 0x1d4 */ … … 273 269 ioport32_t vid_fir_coef_v[8]; 274 270 /* 0x200 */ 275 PADD32 (8);271 PADD32[8]; 276 272 /* 0x220 */ 277 273 ioport32_t cpr_coef_r; … … 283 279 ioport32_t vid_preload[2]; 284 280 285 } __attribute__((packed)) amdm37x_dispc_regs_t; 286 287 288 static inline void amdm37x_dispc_setup_fb(amdm37x_dispc_regs_t *regs, 289 unsigned x, unsigned y, unsigned bpp, uintptr_t pa) 290 { 291 ASSERT(regs); 292 /* Init sequence for dispc is in chapter 7.6.5.1.4 p. 1810, 293 * no idea what parts of that work. */ 294 295 /* Disable all interrupts */ 296 regs->irqenable = 0; 297 298 /* Pixel format specifics*/ 299 uint32_t attrib_pixel_format = 0; 300 uint32_t control_data_lanes = 0; 301 switch (bpp) 302 { 303 case 32: 304 attrib_pixel_format = AMDM37X_DISPC_GFX_ATTRIBUTES_FORMAT_RGBX; 305 control_data_lanes = AMDM37X_DISPC_CONTROL_TFTDATALINES_24B; 306 break; 307 case 24: 308 attrib_pixel_format = AMDM37X_DISPC_GFX_ATTRIBUTES_FORMAT_RGB24; 309 control_data_lanes = AMDM37X_DISPC_CONTROL_TFTDATALINES_24B; 310 break; 311 case 16: 312 attrib_pixel_format = AMDM37X_DISPC_GFX_ATTRIBUTES_FORMAT_RGB16; 313 control_data_lanes = AMDM37X_DISPC_CONTROL_TFTDATALINES_16B; 314 break; 315 default: 316 ASSERT(false); 317 } 318 319 /* Prepare sizes */ 320 const uint32_t size_reg = 321 (((x - 1) & AMDM37X_DISPC_SIZE_WIDTH_MASK) 322 << AMDM37X_DISPC_SIZE_WIDTH_SHIFT) | 323 (((y - 1) & AMDM37X_DISPC_SIZE_HEIGHT_MASK) 324 << AMDM37X_DISPC_SIZE_HEIGHT_SHIFT); 325 326 /* modes taken from u-boot, for 1024x768 */ 327 // TODO replace magic values with actual correct values 328 // regs->timing_h = 0x1a4024c9; 329 // regs->timing_v = 0x02c00509; 330 // regs->pol_freq = 0x00007028; 331 // regs->divisor = 0x00010001; 332 333 /* setup output */ 334 regs->size_lcd = size_reg; 335 regs->size_dig = size_reg; 336 337 /* Nice blue default color */ 338 regs->default_color[0] = 0x0000ff; 339 regs->default_color[1] = 0x0000ff; 340 341 /* Setup control register */ 342 uint32_t control = 0 | 343 AMDM37X_DISPC_CONTROL_PCKFREEENABLE_FLAG | 344 (control_data_lanes << AMDM37X_DISPC_CONTROL_TFTDATALINES_SHIFT) | 345 AMDM37X_DISPC_CONTROL_GPOUT0_FLAG | 346 AMDM37X_DISPC_CONTROL_GPOUT1_FLAG; 347 regs->control = control; 348 349 /* No gamma stuff only data */ 350 uint32_t config = (AMDM37X_DISPC_CONFIG_LOADMODE_DATAEVERYFRAME 351 << AMDM37X_DISPC_CONFIG_LOADMODE_SHIFT); 352 regs->config = config; 353 354 355 /* Set framebuffer base address */ 356 regs->gfx.ba[0] = pa; 357 regs->gfx.ba[1] = pa; 358 regs->gfx.position = 0; 359 360 /* Setup fb size */ 361 regs->gfx.size = size_reg; 362 363 /* Set pixel format */ 364 uint32_t attribs = 0 | 365 (attrib_pixel_format << AMDM37X_DISPC_GFX_ATTRIBUTES_FORMAT_SHIFT); 366 regs->gfx.attributes = attribs; 367 368 /* 0x03ff03c0 is the default */ 369 regs->gfx.fifo_threshold = 0x03ff03c0; 370 /* This value should be stride - width, 1 means next pixel i.e. 371 * stride == width */ 372 regs->gfx.row_inc = 1; 373 /* number of bytes to next pixel in BPP multiples */ 374 regs->gfx.pixel_inc = 1; 375 /* only used if video is played over fb */ 376 regs->gfx.window_skip = 0; 377 /* Gamma and palette table */ 378 regs->gfx.table_ba = 0; 379 380 /* enable frame buffer graphics */ 381 regs->gfx.attributes |= AMDM37X_DISPC_GFX_ATTRIBUTES_ENABLE_FLAG; 382 /* Update register values */ 383 regs->control |= AMDM37X_DISPC_CONTROL_GOLCD_FLAG; 384 regs->control |= AMDM37X_DISPC_CONTROL_GODIGITAL_FLAG; 385 /* Enable output */ 386 regs->control |= AMDM37X_DISPC_CONTROL_LCD_ENABLE_FLAG; 387 regs->control |= AMDM37X_DISPC_CONTROL_DIGITAL_ENABLE_FLAG; 388 } 281 } amdm37x_dispc_regs_t; 389 282 390 283
Note:
See TracChangeset
for help on using the changeset viewer.