kopia lustrzana https://github.com/Wren6991/PicoDVI
Update PIO 1bpp encode
rodzic
692c412af4
commit
aca5db4df3
|
@ -78,7 +78,7 @@ int main() {
|
|||
dma_channel_configure(dma_chan_get, &c,
|
||||
NULL,
|
||||
&encode_pio->rxf[encode_sm],
|
||||
FRAME_WIDTH,
|
||||
FRAME_WIDTH / DVI_SYMBOLS_PER_WORD,
|
||||
false
|
||||
);
|
||||
#endif
|
||||
|
|
|
@ -1,45 +1,46 @@
|
|||
.program tmds_encode_1bpp
|
||||
|
||||
; 1bpp black/white pixels go in, TMDS symbols come out
|
||||
; y is initialised to 0x60005555
|
||||
; Autopull enabled, threshold 32
|
||||
; Autopush enabled, threshold 16
|
||||
; 1bpp black/white pixels go in, TMDS symbols come out.
|
||||
; Each output word contains two output symbols, each 10 bits in size,
|
||||
; right-justified. The least-significant symbol is displayed first.
|
||||
;
|
||||
; We can encode using the following LUT: (yes this is compliant)
|
||||
;
|
||||
; x % 2 | colour | symbol
|
||||
; ------+--------+-------
|
||||
; 0 | 0 | 0x100
|
||||
; 0 | 1 | 0x200
|
||||
; 1 | 0 | 0x1ff
|
||||
; 1 | 1 | 0x2ff
|
||||
;
|
||||
; OSR: shift to right, autopull, threshold 32
|
||||
; ISR: shift to right, autopush, threshold 24
|
||||
;
|
||||
; Note the ISR needs to be shifted to *right* so that we can get the first
|
||||
; pixel in the less-significant position. Threshold 24 so we can get 8x 0-bits
|
||||
; at the LSBs for free :)
|
||||
|
||||
; x == 0 -> first branch nontaken, second taken
|
||||
; x == 1 -> first branch taken, second nontaken
|
||||
even_pixel:
|
||||
out x, 1
|
||||
jmp x--, skip1
|
||||
mov y, !y
|
||||
skip1:
|
||||
mov isr, ::y
|
||||
jmp x--, skip2
|
||||
mov y, !y
|
||||
skip2:
|
||||
in y, 16
|
||||
mov y, ~x
|
||||
in y, 1
|
||||
in x, 1
|
||||
|
||||
odd_pixel:
|
||||
mov x, ~null
|
||||
in x, 8
|
||||
out x, 1
|
||||
jmp x--, skip3
|
||||
mov isr, ::y
|
||||
skip3:
|
||||
mov y, !y
|
||||
jmp x--, skip4
|
||||
mov isr, ::y
|
||||
skip4:
|
||||
in y, 16
|
||||
|
||||
mov y, ~x
|
||||
in y, 1
|
||||
in x, 13 ; Bring total shift to 24, triggering push.
|
||||
|
||||
% c-sdk {
|
||||
static inline void tmds_encode_1bpp_init(PIO pio, uint sm) {
|
||||
uint offset = pio_add_program(pio, &tmds_encode_1bpp_program);
|
||||
pio_sm_config c = tmds_encode_1bpp_program_get_default_config(offset);
|
||||
sm_config_set_out_shift(&c, true, true, 32);
|
||||
sm_config_set_in_shift(&c, false, true, 16);
|
||||
sm_config_set_in_shift(&c, true, true, 24);
|
||||
pio_sm_init(pio, sm, offset, &c);
|
||||
pio_sm_put_blocking(pio, sm, 0x60005555u);
|
||||
pio_sm_exec(pio, sm, pio_encode_pull(false, true));
|
||||
pio_sm_exec(pio, sm, pio_encode_out(pio_y, 32));
|
||||
pio_sm_set_enabled(pio, sm, true);
|
||||
}
|
||||
%}
|
||||
|
|
Ładowanie…
Reference in New Issue