1.1 --- a/pkg/devices/lib/lcd/include/lcd-jz4740.h Mon Jun 01 15:43:34 2020 +0200
1.2 +++ b/pkg/devices/lib/lcd/include/lcd-jz4740.h Mon Jun 01 15:47:14 2020 +0200
1.3 @@ -28,7 +28,8 @@
1.4
1.5 #include <stdint.h>
1.6
1.7 -/* Descriptor referenced by the DMA mechanism. */
1.8 +/* Descriptor referenced by the DMA mechanism extended to 8 words for JZ4780
1.9 + support. */
1.10
1.11 struct Jz4740_lcd_descriptor
1.12 {
1.13 @@ -36,16 +37,9 @@
1.14 uint32_t source; /* FSADR: frame source address */
1.15 uint32_t identifier; /* FIDR: frame identifier */
1.16 uint32_t command; /* CMD: command */
1.17 -};
1.18 -
1.19 -/* 8-word "new descriptor" variant for the JZ4780. */
1.20
1.21 -struct Jz4780_lcd_descriptor
1.22 -{
1.23 - struct Jz4780_lcd_descriptor *next; /* FDADR: frame descriptor address */
1.24 - uint32_t source; /* FSADR: frame source address */
1.25 - uint32_t identifier; /* FIDR: frame identifier */
1.26 - uint32_t command; /* CMD: command */
1.27 + /* "New" descriptor fields. */
1.28 +
1.29 uint32_t offset; /* OFFSIZE: offset in words between lines */
1.30 uint32_t page_width; /* PW: number of words per line (16x16 block mode) */
1.31 uint32_t command_position; /* CNUM: command number (smart LCD mode) or
1.32 @@ -53,6 +47,15 @@
1.33 uint32_t fg_size; /* DESSIZE: foreground size and alpha properties */
1.34 };
1.35
1.36 +/* Interrupt conditions. */
1.37 +
1.38 +enum Jz4740_lcd_irq_condition
1.39 +{
1.40 + Lcd_irq_none = 0,
1.41 + Lcd_irq_frame_start = 1,
1.42 + Lcd_irq_frame_end = 2,
1.43 +};
1.44 +
1.45
1.46
1.47 /* C++ language interface. */
1.48 @@ -69,14 +72,37 @@
1.49 Hw::Register_block<32> _regs;
1.50 Jz4740_lcd_panel *_panel;
1.51 int _burst_size;
1.52 + enum Jz4740_lcd_irq_condition _irq_conditions = Lcd_irq_none;
1.53 + l4_cap_idx_t _irq = L4_INVALID_CAP;
1.54
1.55 /* Control register value calculation. */
1.56
1.57 uint32_t _control_bpp();
1.58 + uint32_t _control_irq();
1.59 uint32_t _control_panel();
1.60 uint32_t _control_stn_frc();
1.61 uint32_t _control_transfer();
1.62
1.63 + /* OSD configure register value calculation. */
1.64 +
1.65 + uint32_t _osd_config_irq();
1.66 +
1.67 + /* Command register value calculation. */
1.68 +
1.69 + uint32_t _command_irq();
1.70 +
1.71 + /* Status register value calculation. */
1.72 +
1.73 + uint32_t _status_irq();
1.74 +
1.75 + /* Priority level threshold value calculation. */
1.76 +
1.77 + uint32_t _priority_transfer();
1.78 +
1.79 + /* Position value calculation. */
1.80 +
1.81 + uint32_t _position_bpp();
1.82 +
1.83 /* Panel mode access. */
1.84
1.85 uint32_t _mode();
1.86 @@ -103,6 +129,7 @@
1.87 void disable();
1.88 void disable_quick();
1.89 void enable();
1.90 + bool enabled();
1.91
1.92 /* Peripheral properties. */
1.93
1.94 @@ -117,6 +144,7 @@
1.95
1.96 /* Memory properties. */
1.97
1.98 + l4_size_t get_pixel_size();
1.99 l4_size_t get_line_size();
1.100 l4_size_t get_screen_size();
1.101 l4_size_t get_aligned_size();
1.102 @@ -142,6 +170,14 @@
1.103 void config(struct Jz4740_lcd_descriptor *desc_vaddr,
1.104 struct Jz4740_lcd_descriptor *desc_paddr,
1.105 l4_addr_t fb_paddr);
1.106 +
1.107 + /* Interrupt configuration. */
1.108 +
1.109 + void set_irq(l4_cap_idx_t irq, enum Jz4740_lcd_irq_condition conditions);
1.110 +
1.111 + /* Interrupt handling. */
1.112 +
1.113 + long wait_for_irq();
1.114 };
1.115
1.116 #endif
1.117 @@ -158,9 +194,18 @@
1.118 struct Jz4740_lcd_descriptor *desc_paddr,
1.119 l4_addr_t fb_paddr);
1.120
1.121 +void jz4740_lcd_set_irq(void *lcd, l4_cap_idx_t irq,
1.122 + enum Jz4740_lcd_irq_condition conditions);
1.123 +
1.124 +long jz4740_lcd_wait_for_irq(void *lcd);
1.125 +
1.126 void jz4740_lcd_disable(void *lcd);
1.127 void jz4740_lcd_disable_quick(void *lcd);
1.128 void jz4740_lcd_enable(void *lcd);
1.129 +int jz4740_lcd_enabled(void *lcd);
1.130 +
1.131 +l4_size_t jz4740_lcd_get_descriptors_size(void *lcd);
1.132 +l4_size_t jz4740_lcd_get_screen_size(void *lcd);
1.133
1.134 l4_addr_t jz4740_lcd_get_palette(void *lcd, l4_addr_t base);
1.135 int jz4740_lcd_get_pixel_clock(void *lcd);