mirror of
https://github.com/marqs85/ossc
synced 2026-11-27 16:32:17 +03:00
Compare commits
88
Commits
v0.90
..
75adfd8f1a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
75adfd8f1a | ||
|
|
91bc0df236 | ||
|
|
eee3950f2e | ||
|
|
c7fa9527fa | ||
|
|
bb4932fc28 | ||
|
|
5a8b914c84 | ||
|
|
dd79df5167 | ||
|
|
b151be6833 | ||
|
|
8c0a0c181d | ||
|
|
32af38e252 | ||
|
|
e9bfa11fa6 | ||
|
|
906ec6d574 | ||
|
|
1ba635901a | ||
|
|
496e3f68b8 | ||
|
|
4606dc4aba | ||
|
|
3194ec6ed3 | ||
|
|
05a9e351d4 | ||
|
|
e09f3c88b0 | ||
|
|
d6dba1618b | ||
|
|
6198ce7d9e | ||
|
|
30d403f157 | ||
|
|
21f8bc5406 | ||
|
|
41549e0957 | ||
|
|
8ed64b5cba | ||
|
|
933dbbaa75 | ||
|
|
6b554e4088 | ||
|
|
9f0c62c80a | ||
|
|
8f779136fa | ||
|
|
c572fb651a | ||
|
|
3abd3d7ec0 | ||
|
|
e74da07802 | ||
|
|
429b0f7201 | ||
|
|
fe3c6fdfa7 | ||
|
|
2725351039 | ||
|
|
9af171947a | ||
|
|
0c8b85d3f2 | ||
|
|
fae76ac3e4 | ||
|
|
e2f4350ab1 | ||
|
|
ac0181a698 | ||
|
|
7f75717ecb | ||
|
|
e4cec87bec | ||
|
|
dae7b0b250 | ||
|
|
95724c2481 | ||
|
|
2abb9a8668 | ||
|
|
82dada1c36 | ||
|
|
8ef05364b4 | ||
|
|
82c498ac02 | ||
|
|
c91e1ad00c | ||
|
|
10f1afd79c | ||
|
|
e49106b635 | ||
|
|
b45e0fb517 | ||
|
|
1ba1779632 | ||
|
|
46a4f4450f | ||
|
|
88026cafa2 | ||
|
|
353437ab87 | ||
|
|
cb8e2b807c | ||
|
|
080e2b2b91 | ||
|
|
83c33c41b9 | ||
|
|
8b35ba3339 | ||
|
|
edb300e03a | ||
|
|
c0dae3da36 | ||
|
|
1ba02417d5 | ||
|
|
6ae321a9ff | ||
|
|
4bc98224e4 | ||
|
|
0ce2809183 | ||
|
|
31851f372d | ||
|
|
b2998355c8 | ||
|
|
2e1fdab16b | ||
|
|
a3a3304152 | ||
|
|
d8f2b98489 | ||
|
|
e3d055db27 | ||
|
|
ab6bd9fc8a | ||
|
|
de1b441167 | ||
|
|
c5f7483410 | ||
|
|
3a17642d5b | ||
|
|
d57a44131a | ||
|
|
0839e118ad | ||
|
|
86c3f744ed | ||
|
|
df643ec742 | ||
|
|
a825bb048c | ||
|
|
804642bd98 | ||
|
|
94c0526265 | ||
|
|
a8a3142071 | ||
|
|
02b2495221 | ||
|
|
76da437125 | ||
|
|
aa4beec957 | ||
|
|
db1cf5922f | ||
|
|
fd37e4275b |
No files matched your search
+10
@@ -1,3 +1,8 @@
|
||||
*_bb.v
|
||||
*_inst.v
|
||||
*.ppf
|
||||
*.qws
|
||||
greybox_tmp
|
||||
.DS_Store
|
||||
software/sys_controller/.cproject
|
||||
software/sys_controller/.force_relink
|
||||
@@ -18,3 +23,8 @@ software/sys_controller/sys_controller.map
|
||||
software/sys_controller/sys_controller.elf
|
||||
.qsys_edit/*
|
||||
PLLJ_PLLSPE_INFO.txt
|
||||
tools/bin2hex
|
||||
software/sys_controller_bsp/bsp_timestamp
|
||||
*.a
|
||||
software/sys_controller/mem_init/sys_onchip_memory2_0.bin
|
||||
software/sys_controller/mem_init/sys_onchip_memory2_0.hex
|
||||
+3
-3
@@ -1,3 +1,3 @@
|
||||
[submodule "ip/pulpino_qsys"]
|
||||
path = ip/pulpino_qsys
|
||||
url = https://github.com/marqs85/pulpino_qsys.git
|
||||
[submodule "ip/ibex_qsys"]
|
||||
path = ip/ibex_qsys
|
||||
url = git@github.com:marqs85/ibex_qsys.git
|
||||
@@ -13,6 +13,7 @@ Requirements for building and debugging firmware
|
||||
* Software
|
||||
* [Altera Quartus II + Cyclone IV support](http://dl.altera.com/?edition=lite) (v 16.1 or higher - free Lite Edition suffices)
|
||||
* [RISC-V GNU Compiler Toolchain](https://github.com/riscv/riscv-gnu-toolchain)
|
||||
* [Picolibc library for RISC-V](https://github.com/picolibc/picolibc)
|
||||
* GCC (or another C compiler) for host architecture (for building a SD card image)
|
||||
* Make
|
||||
* [iconv](https://en.wikipedia.org/wiki/Iconv) (for building with JP lang menu)
|
||||
@@ -20,19 +21,27 @@ Requirements for building and debugging firmware
|
||||
|
||||
Architecture
|
||||
------------------------------
|
||||
* [Reference board schematics](https://github.com/marqs85/ossc_pcb/raw/v1.6/ossc_board.pdf)
|
||||
* [Reference board schematics](https://github.com/marqs85/ossc_pcb/raw/v1.8/doc/ossc_board.pdf)
|
||||
* [Reference PCB project](https://github.com/marqs85/ossc_pcb)
|
||||
|
||||
|
||||
SW toolchain build procedure
|
||||
--------------------------
|
||||
1. Download, configure, build and install RISC-V toolchain with Newlib + RV32EMC support:
|
||||
1. Download, configure, build and install RISC-V toolchain (with RV32EMC support) and Picolibc.
|
||||
|
||||
From sources:
|
||||
~~~~
|
||||
git clone --recursive https://github.com/riscv/riscv-gnu-toolchain
|
||||
git clone --recursive https://github.com/picolibc/picolibc
|
||||
cd riscv-gnu-toolchain
|
||||
./configure --prefix=/opt/riscv --with-arch=rv32emc --with-abi=ilp32e
|
||||
sudo make # sudo needed if installing under default /opt/riscv location
|
||||
~~~~
|
||||
On Debian-style Linux distros:
|
||||
~~~~
|
||||
sudo apt install gcc-riscv64-unknown-elf binutils-riscv64-unknown-elf picolibc-riscv64-unknown-elf
|
||||
~~~~
|
||||
|
||||
2. Compile custom binary to IHEX converter:
|
||||
~~~~
|
||||
gcc tools/bin2hex.c -o tools/bin2hex
|
||||
@@ -41,9 +50,9 @@ gcc tools/bin2hex.c -o tools/bin2hex
|
||||
|
||||
Building RTL (bitstream)
|
||||
--------------------------
|
||||
1. Initialize pulpino submodules (once after cloning ossc project or when submoduled have been updated)
|
||||
1. Initialize project submodules (once after cloning ossc project or when submoduled have been updated)
|
||||
~~~~
|
||||
git submodule update --init --recursive ip/pulpino_qsys
|
||||
git submodule update --init --recursive
|
||||
~~~~
|
||||
2. Load the project (ossc.qpf) in Quartus
|
||||
3. Generate QSYS output files (only needed before first compilation or when QSYS structure has been modified)
|
||||
@@ -51,12 +60,10 @@ git submodule update --init --recursive ip/pulpino_qsys
|
||||
* Load platform configuration (sys.qsys)
|
||||
* Generate output (Generate -> Generate HDL, Generate)
|
||||
* Close Platform Designer
|
||||
* Run "patch -p0 <scripts/qsys.patch" to patch generated files to optimize block RAM usage
|
||||
* Run "touch software/sys_controller_bsp/bsp_timestamp" to acknowledge QSYS update
|
||||
3. Generate the FPGA bitstream (Processing -> Start Compilation)
|
||||
4. Ensure that there are no severe timing violations by looking into Timing Analyzer report
|
||||
|
||||
NOTE: If the software image (software/sys_controller/mem_init/sys_onchip_memory2_0.hex) was not up to date at the time of compilation, bitstream can be quickly rebuilt with updated hex by running "Processing->Update Memory Initialization File" and "Processing->Start->Start Assembler" in Quartus.
|
||||
|
||||
4. Generate the FPGA bitstream (Processing -> Start Compilation)
|
||||
5. Ensure that there are no timing violations by looking into Timing Analyzer report
|
||||
|
||||
Building software image
|
||||
--------------------------
|
||||
@@ -70,14 +77,12 @@ make [OPTIONS] [TARGET]
|
||||
~~~~
|
||||
OPTIONS may include following definitions:
|
||||
* OSDLANG=JP (Japanese language menu)
|
||||
* ENABLE_AUDIO=y (Includes audio setup code for v1.6 PCB / DIY audio add-on board)
|
||||
|
||||
TARGET is typically one of the following:
|
||||
* all (Default target. Compiles an ELF file)
|
||||
* generate_hex (Generates a memory initialization file required for bitstream and direct download)
|
||||
* clean (cleans ELF and intermediate files. Should be invoked every time OPTIONS are changed between compilations, expect with generate_hex where it is done automatically)
|
||||
|
||||
3. Optionally test updated SW by directly downloading memory image to block RAM via JTAG
|
||||
3. Optionally test updated SW by directly downloading SW image to flash via JTAG (requires valid FPGA bitstream to be present):
|
||||
~~~~
|
||||
make rv-reprogram
|
||||
~~~~
|
||||
@@ -85,16 +90,16 @@ make rv-reprogram
|
||||
|
||||
Installing firmware via JTAG
|
||||
--------------------------
|
||||
The bitstream can be either directly programmed into FPGA (volatile method, suitable for quick testing), or into serial flash chip where it is automatically loaded every time FPGA is subsequently powered on (nonvolatile method, suitable for long-term use).
|
||||
The bitstream can be either directly programmed into FPGA (volatile method, suitable for quick testing), or into serial flash chip alongside SW image where it is automatically loaded every time FPGA is subsequently powered on (nonvolatile method, suitable for long-term use).
|
||||
|
||||
To program FPGA, open Programmer in Quartus, select your USB Blaster device, add configuration file (output_files/ossc.sof) and press Start
|
||||
To directly program FPGA, open Programmer in Quartus, select your USB Blaster device, add configuration file (output_files/ossc.sof) and press Start. Download SW image if it not present / up to date in flash.
|
||||
|
||||
To program flash, FPGA configuration file must be first converted into JTAG indirect Configuration file (.jic). Open conversion tool ("File->Convert Programming Files") in Quartus, click "Open Conversion Setup Data", select "ossc.cof" and press Generate. Then open Programmer, add generated file (output_files/ossc.jic) and press Start after which flash is programmed. Installed/updated firmware is activated after power-cycling the board.
|
||||
To program flash, a combined FPGA image must be first generated and converted into JTAG indirect Configuration file (.jic). Open conversion tool ("File->Convert Programming Files") in Quartus, click "Open Conversion Setup Data", select "ossc.cof" and press Generate. Then open Programmer and ensure that "Initiate configuration after programming" and "Unprotect EPCS/EPCQ devices selected for Erase/Program operation" are checked in Tools->Options. Then clear file list, add generated file (output_files/ossc.jic) and press Start after which flash is programmed. Installed/updated firmware is activated when programming finishes (or after power-cycling the board in case of a fresh flash chip).
|
||||
|
||||
|
||||
Generating SD card image
|
||||
--------------------------
|
||||
Bitstream file (Altera propiertary format) must be wrapped with custom header structure (including checksums) so that it can be processed reliably on the CPU. This can be done with included helper application which generates a disk image which can written to a SD card and subsequently loaded on OSSC:
|
||||
Bitstream file (Altera propiertary format) must be wrapped with custom header structure (including checksums) so that it can be processed reliably on the CPU. This can be done with included helper application which generates an image file which can written on FAT32/exFAT-formatted SD card and subsequently loaded on OSSC:
|
||||
|
||||
1. Compile tools/create_fw_img.c
|
||||
~~~~
|
||||
@@ -102,24 +107,35 @@ cd tools && gcc create_fw_img.c -o create_fw_img
|
||||
~~~~
|
||||
2. Generate the firmware image:
|
||||
~~~~
|
||||
./create_fw_img <rbf> <version> [version_suffix]
|
||||
./create_fw_img <rbf> <sw_image> <offset> <version> [version_suffix]
|
||||
~~~~
|
||||
where
|
||||
* \<rbf\> is RBF format bitstream file (typically ../output_files/ossc.rbf)
|
||||
* \<version\> is version string (e.g. 0.78)
|
||||
* \<sw_image\> is SW image binary (typically ../software/sys_controller/mem_init/flash.bin)
|
||||
* \<offset\> is relative offset for the SW image binary
|
||||
* \<version\> is version string (e.g. 1.20)
|
||||
* \[version_suffix\] is optional max. 8 character suffix name (e.g. "mytest")
|
||||
|
||||
The primary firmware has FPGA bitstream at offset 0x0 and SW image at 0x50000 so the command is typically as follows:
|
||||
~~~~
|
||||
./create_fw_img ../output_files/ossc.rbf ../software/sys_controller/mem_init/flash.bin 0x50000 1.21 mytest
|
||||
~~~~
|
||||
The command creates ossc_\<version\>-\<version_suffix\>.bin which can be copied to fw folder of SD card. A secondary FW (identified by specific key in header) gets automatically installed at flash base address 0x00080000.
|
||||
|
||||
Debugging
|
||||
--------------------------
|
||||
1. Rebuild the software in debug mode:
|
||||
~~~~
|
||||
make clean && make APP_CFLAGS_DEBUG_LEVEL="-DDEBUG" generate_hex
|
||||
make clean && make APP_CFLAGS_DEBUG_LEVEL="-DDEBUG"
|
||||
~~~~
|
||||
NOTE: Fw update functionality via SD card is disabled in debug builds due to code space limitations. If audio support is enabled on debug build, other functionality needs to be disabled as well.
|
||||
|
||||
2. Download memory image via JTAG and open terminal for UART
|
||||
2. Flash SW image via JTAG and open terminal for UART
|
||||
~~~~
|
||||
make rv-reprogram && nios2-terminal
|
||||
~~~~
|
||||
Remember to close nios2-terminal after debug session, otherwise any JTAG transactions will hang/fail.
|
||||
|
||||
|
||||
License
|
||||
---------------------------------------------------
|
||||
[GPL3](LICENSE)
|
||||
@@ -5,9 +5,10 @@ package require -exact sopc 9.1
|
||||
# |
|
||||
set_module_property NAME altera_jtag_avalon_master_mod
|
||||
set_module_property DESCRIPTION "The JTAG to Avalon Master Bridge is a collection of pre-wired components that provide an Avalon Master using the new JTAG channel."
|
||||
set_module_property VERSION "20.1"
|
||||
#set_module_property VERSION "21.1"
|
||||
set_module_property INTERNAL false
|
||||
set_module_property GROUP "Basic Functions/Bridges and Adaptors/Memory Mapped"
|
||||
set_module_property AUTHOR "Altera Corporation"
|
||||
#set_module_property AUTHOR "Altera Corporation"
|
||||
set_module_property DISPLAY_NAME "JTAG to Avalon Master Bridge (customized)"
|
||||
set_module_property DATASHEET_URL "http://www.altera.com/literature/hb/nios2/qts_qii55011.pdf"
|
||||
set_module_property INSTANTIATE_IN_SYSTEM_MODULE true
|
||||
|
||||
@@ -130,7 +130,7 @@ alt_u32 I2C_read(alt_u32 base,alt_u32 last)
|
||||
int I2C_write
|
||||
assumes that any addressing and start
|
||||
has already been done.
|
||||
writes one byte of data from the slave.
|
||||
writes one byte of data from the slave.
|
||||
If last is set the stop bit set.
|
||||
inputs
|
||||
base = the base address of the component
|
||||
@@ -182,7 +182,7 @@ alt_u32 I2C_write(alt_u32 base,alt_u8 data, alt_u32 last)
|
||||
|
||||
}
|
||||
|
||||
void SPI_read(alt_u32 base, alt_u8 *rdata, int len)
|
||||
void __attribute__((noinline, flatten, __section__(".text_bram"))) SPI_read(alt_u32 base, alt_u8 *rdata, int len)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -197,7 +197,7 @@ void SPI_read(alt_u32 base, alt_u8 *rdata, int len)
|
||||
}
|
||||
}
|
||||
|
||||
void SPI_write(alt_u32 base, const alt_u8 *wdata, int len)
|
||||
void __attribute__((noinline, flatten, __section__(".text_bram"))) SPI_write(alt_u32 base, const alt_u8 *wdata, int len)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
Submodule
+1
Submodule ip/ibex_qsys added at 79c0da7011.
@@ -36,8 +36,9 @@ typedef union {
|
||||
uint8_t y_offset:3;
|
||||
uint8_t x_size:2;
|
||||
uint8_t y_size:2;
|
||||
uint8_t border_color:2;
|
||||
uint32_t osd_rsv:15;
|
||||
uint8_t border_color:3;
|
||||
uint8_t highlight_color:3;
|
||||
uint32_t osd_rsv:11;
|
||||
} __attribute__((packed, __may_alias__));
|
||||
uint32_t data;
|
||||
} osd_config_reg;
|
||||
|
||||
@@ -153,7 +153,7 @@ set_interface_property osd_if CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property osd_if SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port osd_if vclk vclk Input 1
|
||||
add_interface_port osd_if xpos xpos Input 11
|
||||
add_interface_port osd_if xpos xpos Input 12
|
||||
add_interface_port osd_if ypos ypos Input 11
|
||||
add_interface_port osd_if osd_enable osd_enable Output 1
|
||||
add_interface_port osd_if osd_color osd_color Output 2
|
||||
add_interface_port osd_if osd_color osd_color Output 3
|
||||
@@ -32,10 +32,10 @@ module osd_generator_top (
|
||||
output avalon_s_waitrequest_n,
|
||||
// OSD interface
|
||||
input vclk,
|
||||
input [10:0] xpos,
|
||||
input [11:0] xpos,
|
||||
input [10:0] ypos,
|
||||
output reg osd_enable,
|
||||
output reg [1:0] osd_color
|
||||
output reg [2:0] osd_color
|
||||
);
|
||||
|
||||
localparam CHAR_ROWS = 30;
|
||||
@@ -43,10 +43,10 @@ localparam CHAR_COLS = 16;
|
||||
localparam CHAR_SECTIONS = 2;
|
||||
localparam CHAR_SEC_SEPARATOR = 2;
|
||||
|
||||
localparam BG_BLACK = 2'h0;
|
||||
localparam BG_BLUE = 2'h1;
|
||||
localparam BG_YELLOW = 2'h2;
|
||||
localparam BG_WHITE = 2'h3;
|
||||
localparam BG_BLACK = 3'h0;
|
||||
localparam BG_BLUE = 3'h1;
|
||||
localparam BG_YELLOW = 3'h6;
|
||||
localparam BG_WHITE = 3'h7;
|
||||
|
||||
localparam OSD_CONFIG_REGNUM = 8'hf0;
|
||||
localparam OSD_ROW_LSEC_ENABLE_REGNUM = 8'hf1;
|
||||
@@ -56,10 +56,12 @@ localparam OSD_ROW_COLOR_REGNUM = 8'hf3;
|
||||
reg [31:0] osd_config;
|
||||
reg [31:0] config_reg[OSD_ROW_LSEC_ENABLE_REGNUM:OSD_ROW_COLOR_REGNUM] /* synthesis ramstyle = "logic" */;
|
||||
|
||||
reg [10:0] xpos_osd_area_scaled, xpos_text_scaled;
|
||||
reg [11:0] xpos_osd_area_scaled, xpos_text_scaled;
|
||||
reg [10:0] ypos_osd_area_scaled, ypos_text_scaled;
|
||||
reg [7:0] x_ptr[2:5], y_ptr[2:5] /* synthesis ramstyle = "logic" */;
|
||||
reg osd_text_act_pp[2:6], osd_act_pp[3:6];
|
||||
reg osd_text_act_lsec_x_hit, osd_text_act_lsec_en, osd_text_act_rsec_x_hit, osd_text_act_rsec_en, osd_text_act_y_hit;
|
||||
reg osd_act_lsec_x_hit, osd_act_lsec_en, osd_act_rsec_x_hit, osd_act_rsec_en, osd_act_y_hit;
|
||||
reg osd_text_act_pp[3:6], osd_act_pp[4:6];
|
||||
reg [14:0] to_ctr, to_ctr_ms;
|
||||
reg char_px;
|
||||
|
||||
@@ -71,9 +73,10 @@ wire [2:0] x_offset = osd_config[7:5];
|
||||
wire [2:0] y_offset = osd_config[10:8];
|
||||
wire [1:0] x_size = osd_config[12:11];
|
||||
wire [1:0] y_size = osd_config[14:13];
|
||||
wire [1:0] border_color = osd_config[16:15];
|
||||
wire [2:0] border_color = osd_config[17:15];
|
||||
wire [2:0] highlight_color = osd_config[20:18];
|
||||
|
||||
wire [10:0] xpos_scaled_w = (xpos >> x_size)-({3'h0, x_offset} << 3);
|
||||
wire [11:0] xpos_scaled_w = (xpos >> x_size)-({3'h0, x_offset} << 3);
|
||||
wire [10:0] ypos_scaled_w = (ypos >> y_size)-({3'h0, y_offset} << 3);
|
||||
wire [7:0] rom_rdaddr;
|
||||
wire [0:7] char_data[7:0];
|
||||
@@ -123,21 +126,27 @@ always @(posedge vclk) begin
|
||||
y_ptr[pp_idx] <= y_ptr[pp_idx-1];
|
||||
end
|
||||
|
||||
osd_text_act_pp[2] <= render_enable &
|
||||
osd_text_act_lsec_x_hit <= (xpos_text_scaled < 8*CHAR_COLS);
|
||||
osd_text_act_lsec_en <= config_reg[OSD_ROW_LSEC_ENABLE_REGNUM][ypos_text_scaled/8];
|
||||
osd_text_act_rsec_x_hit <= (xpos_text_scaled >= 8*(CHAR_COLS+CHAR_SEC_SEPARATOR)) & (xpos_text_scaled < 8*(2*CHAR_COLS+CHAR_SEC_SEPARATOR));
|
||||
osd_text_act_rsec_en <= config_reg[OSD_ROW_RSEC_ENABLE_REGNUM][ypos_text_scaled/8];
|
||||
osd_text_act_y_hit <= (ypos_text_scaled < 8*CHAR_ROWS);
|
||||
osd_text_act_pp[3] <= render_enable &
|
||||
(menu_active || (to_ctr_ms > 0)) &
|
||||
(((xpos_text_scaled < 8*CHAR_COLS) & config_reg[OSD_ROW_LSEC_ENABLE_REGNUM][ypos_text_scaled/8]) |
|
||||
((xpos_text_scaled >= 8*(CHAR_COLS+CHAR_SEC_SEPARATOR)) & (xpos_text_scaled < 8*(2*CHAR_COLS+CHAR_SEC_SEPARATOR)) & config_reg[OSD_ROW_RSEC_ENABLE_REGNUM][ypos_text_scaled/8])) &
|
||||
(ypos_text_scaled < 8*CHAR_ROWS);
|
||||
for(pp_idx = 3; pp_idx <= 6; pp_idx = pp_idx+1) begin
|
||||
((osd_text_act_lsec_x_hit & osd_text_act_lsec_en) | (osd_text_act_rsec_x_hit & osd_text_act_rsec_en)) & osd_text_act_y_hit;
|
||||
for(pp_idx = 4; pp_idx <= 6; pp_idx = pp_idx+1) begin
|
||||
osd_text_act_pp[pp_idx] <= osd_text_act_pp[pp_idx-1];
|
||||
end
|
||||
|
||||
osd_act_pp[3] <= render_enable &
|
||||
osd_act_lsec_x_hit <= (xpos_osd_area_scaled/8 < (CHAR_COLS+1));
|
||||
osd_act_lsec_en <= config_reg[OSD_ROW_LSEC_ENABLE_REGNUM][(ypos_osd_area_scaled/8) ? ((ypos_osd_area_scaled/8)-1) : 0];
|
||||
osd_act_rsec_x_hit <= (xpos_osd_area_scaled/8 >= (CHAR_COLS+1)) & (xpos_osd_area_scaled/8 < (2*CHAR_COLS+CHAR_SEC_SEPARATOR+1));
|
||||
osd_act_rsec_en <= (config_reg[OSD_ROW_RSEC_ENABLE_REGNUM][(ypos_osd_area_scaled/8)-1] | config_reg[OSD_ROW_RSEC_ENABLE_REGNUM][ypos_osd_area_scaled/8]);
|
||||
osd_act_y_hit <= (ypos_osd_area_scaled < 8*(CHAR_ROWS+1));
|
||||
osd_act_pp[4] <= render_enable &
|
||||
(menu_active || (to_ctr_ms > 0)) &
|
||||
(((xpos_osd_area_scaled/8 < (CHAR_COLS+1)) & config_reg[OSD_ROW_LSEC_ENABLE_REGNUM][(ypos_osd_area_scaled/8) ? ((ypos_osd_area_scaled/8)-1) : 0]) |
|
||||
((xpos_osd_area_scaled/8 >= (CHAR_COLS+1)) & (xpos_osd_area_scaled/8 < (2*CHAR_COLS+CHAR_SEC_SEPARATOR+1)) & (config_reg[OSD_ROW_RSEC_ENABLE_REGNUM][(ypos_osd_area_scaled/8)-1] | config_reg[OSD_ROW_RSEC_ENABLE_REGNUM][ypos_osd_area_scaled/8]))) &
|
||||
(ypos_osd_area_scaled < 8*(CHAR_ROWS+1));
|
||||
for(pp_idx = 4; pp_idx <= 6; pp_idx = pp_idx+1) begin
|
||||
((osd_act_lsec_x_hit & osd_act_lsec_en) | (osd_act_rsec_x_hit & osd_act_rsec_en)) & osd_act_y_hit;
|
||||
for(pp_idx = 5; pp_idx <= 6; pp_idx = pp_idx+1) begin
|
||||
osd_act_pp[pp_idx] <= osd_act_pp[pp_idx-1];
|
||||
end
|
||||
|
||||
@@ -147,7 +156,7 @@ always @(posedge vclk) begin
|
||||
|
||||
if (osd_text_act_pp[6]) begin
|
||||
if (char_px) begin
|
||||
osd_color <= config_reg[OSD_ROW_COLOR_REGNUM][char_row] ? BG_YELLOW : BG_WHITE;
|
||||
osd_color <= config_reg[OSD_ROW_COLOR_REGNUM][char_row] ? highlight_color : BG_WHITE;
|
||||
end else begin
|
||||
osd_color <= BG_BLUE;
|
||||
end
|
||||
|
||||
Submodule ip/pulpino_qsys deleted from b11dd7718e.
@@ -20,118 +20,160 @@
|
||||
#ifndef SC_CONFIG_REGS_H_
|
||||
#define SC_CONFIG_REGS_H_
|
||||
|
||||
#include <alt_types.h>
|
||||
#include <stdint.h>
|
||||
|
||||
// bit-fields coded as little-endian
|
||||
typedef union {
|
||||
struct {
|
||||
alt_u16 vmax:11;
|
||||
alt_u8 interlace_flag:1;
|
||||
alt_u8 sc_rsv2:4;
|
||||
alt_u8 fpga_vsyncgen:2;
|
||||
alt_u16 vmax_tvp:11;
|
||||
alt_u8 sc_rsv:2;
|
||||
alt_u8 vsync_flag:1;
|
||||
uint16_t vtotal:11;
|
||||
uint8_t interlace_flag:1;
|
||||
uint8_t sync_active:1;
|
||||
uint32_t fe_rsv:19;
|
||||
} __attribute__((packed, __may_alias__));
|
||||
alt_u32 data;
|
||||
} sc_status_reg;
|
||||
uint32_t data;
|
||||
} fe_status_reg;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
alt_u32 pcnt_frame:20;
|
||||
alt_u16 sc_rsv:12;
|
||||
uint32_t pcnt_field:20;
|
||||
uint8_t hsync_width:8;
|
||||
uint8_t fe_rsv:4;
|
||||
} __attribute__((packed, __may_alias__));
|
||||
alt_u32 data;
|
||||
} sc_status2_reg;
|
||||
uint32_t data;
|
||||
} fe_status2_reg;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
alt_u16 lt_lat_result:16;
|
||||
alt_u16 lt_stb_result:12;
|
||||
alt_u8 lt_rsv:3;
|
||||
alt_u8 lt_finished:1;
|
||||
uint16_t lt_lat_result:16;
|
||||
uint16_t lt_stb_result:12;
|
||||
uint8_t lt_rsv:3;
|
||||
uint8_t lt_finished:1;
|
||||
} __attribute__((packed, __may_alias__));
|
||||
alt_u32 data;
|
||||
uint32_t data;
|
||||
} lt_status_reg;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
alt_u16 h_active:11;
|
||||
alt_u16 h_backporch:9;
|
||||
alt_u8 h_synclen:8;
|
||||
alt_u8 h_l3_240x360:1;
|
||||
alt_u8 h_l5fmt:1;
|
||||
alt_u8 h_multmode:2;
|
||||
uint16_t h_total:12;
|
||||
uint16_t h_active:12;
|
||||
uint16_t h_synclen:8;
|
||||
} __attribute__((packed, __may_alias__));
|
||||
alt_u32 data;
|
||||
} h_config_reg;
|
||||
uint32_t data;
|
||||
} hv_config_reg;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
alt_u16 h_opt_startoff:10;
|
||||
alt_u8 h_opt_sample_mult:3;
|
||||
alt_u8 h_opt_sample_sel:3;
|
||||
alt_u8 h_opt_scale:3;
|
||||
alt_u16 h_mask:11;
|
||||
alt_u8 h_rsv:2;
|
||||
uint16_t h_backporch:9;
|
||||
uint16_t v_total:11;
|
||||
uint16_t v_active:11;
|
||||
uint8_t interlaced:1;
|
||||
} __attribute__((packed, __may_alias__));
|
||||
alt_u32 data;
|
||||
} h_config2_reg;
|
||||
uint32_t data;
|
||||
} hv_config2_reg;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
alt_u16 v_active:11;
|
||||
alt_u8 v_backporch:8;
|
||||
alt_u8 v_synclen:3;
|
||||
alt_u8 v_mask:6;
|
||||
alt_u8 v_rsv:1;
|
||||
alt_u8 v_multmode:3;
|
||||
uint8_t v_synclen:4;
|
||||
uint16_t v_backporch:9;
|
||||
uint16_t v_startline:11;
|
||||
uint8_t h_skip:4;
|
||||
uint8_t h_sample_sel:4;
|
||||
} __attribute__((packed, __may_alias__));
|
||||
alt_u32 data;
|
||||
} v_config_reg;
|
||||
uint32_t data;
|
||||
} hv_config3_reg;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
alt_u8 mask_br:4;
|
||||
alt_u8 mask_color:3;
|
||||
alt_u8 rev_lpf_str:5;
|
||||
alt_u8 panasonic_hack:1;
|
||||
alt_u32 misc_rsv:19;
|
||||
uint16_t x_size:12;
|
||||
uint16_t y_size:11;
|
||||
int16_t y_offset:9;
|
||||
} __attribute__((packed, __may_alias__));
|
||||
alt_u32 data;
|
||||
uint32_t data;
|
||||
} xy_config_reg;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
int16_t x_offset:10;
|
||||
uint8_t x_start_lb:8;
|
||||
int8_t y_start_lb:6;
|
||||
int8_t x_rpt:4;
|
||||
int8_t y_rpt:4;
|
||||
} __attribute__((packed, __may_alias__));
|
||||
uint32_t data;
|
||||
} xy_config2_reg;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
uint8_t mask_br:4;
|
||||
uint8_t mask_color:3;
|
||||
uint8_t reverse_lpf:5;
|
||||
uint8_t lumacode_mode:3;
|
||||
uint8_t shmask_enable:1;
|
||||
uint8_t shmask_iv_x:4;
|
||||
uint8_t shmask_iv_y:4;
|
||||
uint8_t panasonic_hack:1;
|
||||
uint32_t misc_rsv:7;
|
||||
} __attribute__((packed, __may_alias__));
|
||||
uint32_t data;
|
||||
} misc_config_reg;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
alt_u32 sl_l_str_arr:20;
|
||||
alt_u8 sl_l_overlay:5;
|
||||
alt_u8 sl_hybr_str:5;
|
||||
alt_u8 sl_method:1;
|
||||
alt_u8 sl_no_altern:1;
|
||||
uint32_t sl_l_str_arr:24;
|
||||
uint8_t sl_l_overlay:6;
|
||||
uint8_t sl_method:1;
|
||||
uint8_t sl_altern:1;
|
||||
} __attribute__((packed, __may_alias__));
|
||||
alt_u32 data;
|
||||
uint32_t data;
|
||||
} sl_config_reg;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
alt_u32 sl_c_str_arr:24;
|
||||
alt_u8 sl_c_overlay:6;
|
||||
alt_u8 sl_rsv:1;
|
||||
alt_u8 sl_altiv:1;
|
||||
uint32_t sl_c_str_arr_l;
|
||||
} __attribute__((packed, __may_alias__));
|
||||
alt_u32 data;
|
||||
uint32_t data;
|
||||
} sl_config2_reg;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
uint32_t sl_c_str_arr_h:8;
|
||||
uint32_t sl_c_overlay:10;
|
||||
uint8_t sl_iv_y:3;
|
||||
uint8_t sl_iv_x:4;
|
||||
uint8_t sl_hybr_str:5;
|
||||
uint32_t sl_rsv:2;
|
||||
} __attribute__((packed, __may_alias__));
|
||||
uint32_t data;
|
||||
} sl_config3_reg;
|
||||
|
||||
// shmask regs
|
||||
typedef struct {
|
||||
sc_status_reg sc_status;
|
||||
sc_status2_reg sc_status2;
|
||||
uint32_t data[16][16];
|
||||
} shmask_array;
|
||||
|
||||
// lumacode palatte ram
|
||||
typedef struct {
|
||||
uint32_t data[256];
|
||||
} lc_pal_ram;
|
||||
|
||||
typedef struct {
|
||||
fe_status_reg fe_status;
|
||||
fe_status2_reg fe_status2;
|
||||
lt_status_reg lt_status;
|
||||
h_config_reg h_config;
|
||||
h_config2_reg h_config2;
|
||||
v_config_reg v_config;
|
||||
hv_config_reg hv_in_config;
|
||||
hv_config2_reg hv_in_config2;
|
||||
hv_config3_reg hv_in_config3;
|
||||
hv_config_reg hv_out_config;
|
||||
hv_config2_reg hv_out_config2;
|
||||
hv_config3_reg hv_out_config3;
|
||||
xy_config_reg xy_out_config;
|
||||
xy_config2_reg xy_out_config2;
|
||||
misc_config_reg misc_config;
|
||||
sl_config_reg sl_config;
|
||||
sl_config2_reg sl_config2;
|
||||
} __attribute__((packed, __may_alias__)) sc_regs;
|
||||
sl_config3_reg sl_config3;
|
||||
shmask_array shmask_data_array __attribute__ ((aligned (1024)));
|
||||
lc_pal_ram lumacode_pal_ram __attribute__ ((aligned (2048)));
|
||||
} sc_regs;
|
||||
|
||||
#endif //SC_CONFIG_REGS_H_
|
||||
@@ -1,11 +1,11 @@
|
||||
#
|
||||
#
|
||||
# request TCL package from ACDS 16.1
|
||||
#
|
||||
#
|
||||
package require -exact qsys 16.1
|
||||
|
||||
#
|
||||
#
|
||||
# module
|
||||
#
|
||||
#
|
||||
set_module_property DESCRIPTION "Scanconverter config"
|
||||
set_module_property NAME sc_config
|
||||
#set_module_property VERSION 18.0
|
||||
@@ -20,9 +20,9 @@ set_module_property REPORT_TO_TALKBACK false
|
||||
set_module_property ALLOW_GREYBOX_GENERATION false
|
||||
set_module_property REPORT_HIERARCHY false
|
||||
|
||||
#
|
||||
#
|
||||
# file sets
|
||||
#
|
||||
#
|
||||
add_fileset QUARTUS_SYNTH QUARTUS_SYNTH "" ""
|
||||
set_fileset_property QUARTUS_SYNTH TOP_LEVEL sc_config_top
|
||||
set_fileset_property QUARTUS_SYNTH ENABLE_RELATIVE_INCLUDE_PATHS false
|
||||
@@ -35,19 +35,19 @@ set_fileset_property SIM_VERILOG ENABLE_FILE_OVERWRITE_MODE false
|
||||
set_fileset_property SIM_VERILOG TOP_LEVEL sc_config_top
|
||||
add_fileset_file sc_config_top.sv VERILOG PATH sc_config_top.sv
|
||||
|
||||
#
|
||||
#
|
||||
# parameters
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
#
|
||||
# display items
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
#
|
||||
#
|
||||
# connection point clock_sink
|
||||
#
|
||||
#
|
||||
add_interface clock_sink clock end
|
||||
set_interface_property clock_sink clockRate 0
|
||||
set_interface_property clock_sink ENABLED true
|
||||
@@ -59,9 +59,9 @@ set_interface_property clock_sink SVD_ADDRESS_GROUP ""
|
||||
add_interface_port clock_sink clk_i clk Input 1
|
||||
|
||||
|
||||
#
|
||||
#
|
||||
# connection point reset_sink
|
||||
#
|
||||
#
|
||||
add_interface reset_sink reset end
|
||||
set_interface_property reset_sink associatedClock clock_sink
|
||||
set_interface_property reset_sink synchronousEdges DEASSERT
|
||||
@@ -74,9 +74,9 @@ set_interface_property reset_sink SVD_ADDRESS_GROUP ""
|
||||
add_interface_port reset_sink rst_i reset Input 1
|
||||
|
||||
|
||||
#
|
||||
#
|
||||
# connection point avalon_s
|
||||
#
|
||||
#
|
||||
add_interface avalon_s avalon end
|
||||
set_interface_property avalon_s addressUnits WORDS
|
||||
set_interface_property avalon_s associatedClock clock_sink
|
||||
@@ -100,7 +100,7 @@ set_interface_property avalon_s PORT_NAME_MAP ""
|
||||
set_interface_property avalon_s CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property avalon_s SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port avalon_s avalon_s_address address Input 4
|
||||
add_interface_port avalon_s avalon_s_address address Input 10
|
||||
add_interface_port avalon_s avalon_s_writedata writedata Input 32
|
||||
add_interface_port avalon_s avalon_s_readdata readdata Output 32
|
||||
add_interface_port avalon_s avalon_s_byteenable byteenable Input 4
|
||||
@@ -114,9 +114,9 @@ set_interface_assignment avalon_s embeddedsw.configuration.isNonVolatileStorage
|
||||
set_interface_assignment avalon_s embeddedsw.configuration.isPrintableDevice 0
|
||||
|
||||
|
||||
#
|
||||
#
|
||||
# connection point bus
|
||||
#
|
||||
#
|
||||
#add_sv_interface bus sc_if
|
||||
|
||||
# Setting the parameter property to add SV interface parameters
|
||||
@@ -131,9 +131,9 @@ set_interface_assignment avalon_s embeddedsw.configuration.isPrintableDevice 0
|
||||
#add_fileset_file sc_if.sv SYSTEM_VERILOG PATH sc_if.sv SYSTEMVERILOG_INTERFACE
|
||||
|
||||
|
||||
#
|
||||
#
|
||||
# connection point sc_if
|
||||
#
|
||||
#
|
||||
add_interface sc_if conduit end
|
||||
set_interface_property sc_if associatedClock ""
|
||||
set_interface_property sc_if associatedReset ""
|
||||
@@ -143,12 +143,54 @@ set_interface_property sc_if PORT_NAME_MAP ""
|
||||
set_interface_property sc_if CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property sc_if SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port sc_if sc_status_i sc_status_i Input 32
|
||||
add_interface_port sc_if sc_status2_i sc_status2_i Input 32
|
||||
add_interface_port sc_if fe_status_i fe_status_i Input 32
|
||||
add_interface_port sc_if fe_status2_i fe_status2_i Input 32
|
||||
add_interface_port sc_if lt_status_i lt_status_i Input 32
|
||||
add_interface_port sc_if h_config_o h_config_o Output 32
|
||||
add_interface_port sc_if h_config2_o h_config2_o Output 32
|
||||
add_interface_port sc_if v_config_o v_config_o Output 32
|
||||
add_interface_port sc_if hv_in_config_o hv_in_config_o Output 32
|
||||
add_interface_port sc_if hv_in_config2_o hv_in_config2_o Output 32
|
||||
add_interface_port sc_if hv_in_config3_o hv_in_config3_o Output 32
|
||||
add_interface_port sc_if hv_out_config_o hv_out_config_o Output 32
|
||||
add_interface_port sc_if hv_out_config2_o hv_out_config2_o Output 32
|
||||
add_interface_port sc_if hv_out_config3_o hv_out_config3_o Output 32
|
||||
add_interface_port sc_if xy_out_config_o xy_out_config_o Output 32
|
||||
add_interface_port sc_if xy_out_config2_o xy_out_config2_o Output 32
|
||||
add_interface_port sc_if misc_config_o misc_config_o Output 32
|
||||
add_interface_port sc_if sl_config_o sl_config_o Output 32
|
||||
add_interface_port sc_if sl_config2_o sl_config2_o Output 32
|
||||
add_interface_port sc_if sl_config3_o sl_config3_o Output 32
|
||||
|
||||
|
||||
#
|
||||
# connection point shmask_if
|
||||
#
|
||||
add_interface shmask_if conduit end
|
||||
set_interface_property shmask_if associatedClock ""
|
||||
set_interface_property shmask_if associatedReset ""
|
||||
set_interface_property shmask_if ENABLED true
|
||||
set_interface_property shmask_if EXPORT_OF ""
|
||||
set_interface_property shmask_if PORT_NAME_MAP ""
|
||||
set_interface_property shmask_if CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property shmask_if SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port shmask_if vclk vclk Input 1
|
||||
add_interface_port shmask_if shmask_xpos shmask_xpos Input 4
|
||||
add_interface_port shmask_if shmask_ypos shmask_ypos Input 4
|
||||
add_interface_port shmask_if shmask_data shmask_data Output 11
|
||||
|
||||
|
||||
#
|
||||
# connection point lumacode_ram_if
|
||||
#
|
||||
add_interface lc_ram_if conduit end
|
||||
set_interface_property lc_ram_if associatedClock ""
|
||||
set_interface_property lc_ram_if associatedReset ""
|
||||
set_interface_property lc_ram_if ENABLED true
|
||||
set_interface_property lc_ram_if EXPORT_OF ""
|
||||
set_interface_property lc_ram_if PORT_NAME_MAP ""
|
||||
set_interface_property lc_ram_if CMSIS_SVD_VARIABLES ""
|
||||
set_interface_property lc_ram_if SVD_ADDRESS_GROUP ""
|
||||
|
||||
add_interface_port lc_ram_if lumacode_clk_i lumacode_clk_i Input 1
|
||||
add_interface_port lc_ram_if lumacode_addr_i lumacode_addr_i Input 8
|
||||
add_interface_port lc_ram_if lumacode_rden_i lumacode_rden_i Input 1
|
||||
add_interface_port lc_ram_if lumacode_data_o lumacode_data_o Output 32
|
||||
@@ -18,7 +18,7 @@ set_sw_property version 1.0
|
||||
#
|
||||
# Multiple-Version compatibility was introduced in version 7.1;
|
||||
# prior versions are therefore excluded.
|
||||
set_sw_property min_compatible_hw_version 7.1
|
||||
set_sw_property min_compatible_hw_version 1.0
|
||||
|
||||
# Initialize the driver in alt_sys_init()
|
||||
set_sw_property auto_initialize false
|
||||
|
||||
+172
-125
@@ -23,152 +23,186 @@ module sc_config_top(
|
||||
input rst_i,
|
||||
// avalon slave
|
||||
input [31:0] avalon_s_writedata,
|
||||
output [31:0] avalon_s_readdata,
|
||||
input [3:0] avalon_s_address,
|
||||
output reg [31:0] avalon_s_readdata,
|
||||
input [9:0] avalon_s_address,
|
||||
input [3:0] avalon_s_byteenable,
|
||||
input avalon_s_write,
|
||||
input avalon_s_read,
|
||||
input avalon_s_chipselect,
|
||||
output avalon_s_waitrequest_n,
|
||||
// SC interface
|
||||
input [31:0] sc_status_i,
|
||||
input [31:0] sc_status2_i,
|
||||
input [31:0] fe_status_i,
|
||||
input [31:0] fe_status2_i,
|
||||
input [31:0] lt_status_i,
|
||||
output reg [31:0] h_config_o,
|
||||
output reg [31:0] h_config2_o,
|
||||
output reg [31:0] v_config_o,
|
||||
output reg [31:0] misc_config_o,
|
||||
output reg [31:0] sl_config_o,
|
||||
output reg [31:0] sl_config2_o
|
||||
output [31:0] hv_in_config_o,
|
||||
output [31:0] hv_in_config2_o,
|
||||
output [31:0] hv_in_config3_o,
|
||||
output [31:0] hv_out_config_o,
|
||||
output [31:0] hv_out_config2_o,
|
||||
output [31:0] hv_out_config3_o,
|
||||
output [31:0] xy_out_config_o,
|
||||
output [31:0] xy_out_config2_o,
|
||||
output [31:0] misc_config_o,
|
||||
output [31:0] sl_config_o,
|
||||
output [31:0] sl_config2_o,
|
||||
output [31:0] sl_config3_o,
|
||||
// Shadow mask read interface
|
||||
input vclk,
|
||||
input [3:0] shmask_xpos,
|
||||
input [3:0] shmask_ypos,
|
||||
output [10:0] shmask_data,
|
||||
// Lumacode interface
|
||||
input lumacode_clk_i,
|
||||
input [7:0] lumacode_addr_i,
|
||||
input lumacode_rden_i,
|
||||
output [31:0] lumacode_data_o
|
||||
);
|
||||
|
||||
localparam SC_STATUS_REGNUM = 4'h0;
|
||||
localparam SC_STATUS2_REGNUM = 4'h1;
|
||||
localparam LT_STATUS_REGNUM = 4'h2;
|
||||
localparam H_CONFIG_REGNUM = 4'h3;
|
||||
localparam H_CONFIG2_REGNUM = 4'h4;
|
||||
localparam V_CONFIG_REGNUM = 4'h5;
|
||||
localparam MISC_CONFIG_REGNUM = 4'h6;
|
||||
localparam SL_CONFIG_REGNUM = 4'h7;
|
||||
localparam SL_CONFIG2_REGNUM = 4'h8;
|
||||
localparam FE_STATUS_REGNUM = 10'h0;
|
||||
localparam FE_STATUS2_REGNUM = 10'h1;
|
||||
localparam LT_STATUS_REGNUM = 10'h2;
|
||||
localparam HV_IN_CONFIG_REGNUM = 10'h3;
|
||||
localparam HV_IN_CONFIG2_REGNUM = 10'h4;
|
||||
localparam HV_IN_CONFIG3_REGNUM = 10'h5;
|
||||
localparam HV_OUT_CONFIG_REGNUM = 10'h6;
|
||||
localparam HV_OUT_CONFIG2_REGNUM = 10'h7;
|
||||
localparam HV_OUT_CONFIG3_REGNUM = 10'h8;
|
||||
localparam XY_OUT_CONFIG_REGNUM = 10'h9;
|
||||
localparam XY_OUT_CONFIG2_REGNUM = 10'ha;
|
||||
localparam MISC_CONFIG_REGNUM = 10'hb;
|
||||
localparam SL_CONFIG_REGNUM = 10'hc;
|
||||
localparam SL_CONFIG2_REGNUM = 10'hd;
|
||||
localparam SL_CONFIG3_REGNUM = 10'he;
|
||||
|
||||
localparam SHMASK_DATA_OFFSET = 10'h100;
|
||||
localparam LUMACODE_RAM_OFFSET = 10'h200;
|
||||
|
||||
reg [31:0] config_reg[HV_IN_CONFIG_REGNUM:SL_CONFIG3_REGNUM] /* synthesis ramstyle = "logic" */;
|
||||
|
||||
assign avalon_s_waitrequest_n = 1'b1;
|
||||
|
||||
always @(posedge clk_i or posedge rst_i) begin
|
||||
if (rst_i) begin
|
||||
h_config_o <= 0;
|
||||
end else begin
|
||||
if (avalon_s_chipselect && avalon_s_write && (avalon_s_address==H_CONFIG_REGNUM)) begin
|
||||
if (avalon_s_byteenable[3])
|
||||
h_config_o[31:24] <= avalon_s_writedata[31:24];
|
||||
if (avalon_s_byteenable[2])
|
||||
h_config_o[23:16] <= avalon_s_writedata[23:16];
|
||||
if (avalon_s_byteenable[1])
|
||||
h_config_o[15:8] <= avalon_s_writedata[15:8];
|
||||
if (avalon_s_byteenable[0])
|
||||
h_config_o[7:0] <= avalon_s_writedata[7:0];
|
||||
// Shadow mask array
|
||||
altsyncram shmask_array_inst (
|
||||
.address_a (avalon_s_address[7:0]),
|
||||
.address_b ({shmask_ypos, shmask_xpos}),
|
||||
.clock0 (clk_i),
|
||||
.clock1 (vclk),
|
||||
.data_a (avalon_s_writedata[10:0]),
|
||||
.wren_a (avalon_s_chipselect && avalon_s_write && (avalon_s_address >= SHMASK_DATA_OFFSET) && (avalon_s_address < LUMACODE_RAM_OFFSET)),
|
||||
.q_b (shmask_data),
|
||||
.aclr0 (1'b0),
|
||||
.aclr1 (1'b0),
|
||||
.addressstall_a (1'b0),
|
||||
.addressstall_b (1'b0),
|
||||
.byteena_a (1'b1),
|
||||
.byteena_b (1'b1),
|
||||
.clocken0 (1'b1),
|
||||
.clocken1 (1'b1),
|
||||
.clocken2 (1'b1),
|
||||
.clocken3 (1'b1),
|
||||
.data_b ({11{1'b1}}),
|
||||
.eccstatus (),
|
||||
.q_a (),
|
||||
.rden_a (1'b1),
|
||||
.rden_b (1'b1),
|
||||
.wren_b (1'b0));
|
||||
defparam
|
||||
shmask_array_inst.address_aclr_b = "NONE",
|
||||
shmask_array_inst.address_reg_b = "CLOCK1",
|
||||
shmask_array_inst.clock_enable_input_a = "BYPASS",
|
||||
shmask_array_inst.clock_enable_input_b = "BYPASS",
|
||||
shmask_array_inst.clock_enable_output_b = "BYPASS",
|
||||
shmask_array_inst.intended_device_family = "Cyclone IV E",
|
||||
shmask_array_inst.lpm_type = "altsyncram",
|
||||
shmask_array_inst.numwords_a = 256,
|
||||
shmask_array_inst.numwords_b = 256,
|
||||
shmask_array_inst.operation_mode = "DUAL_PORT",
|
||||
shmask_array_inst.outdata_aclr_b = "NONE",
|
||||
shmask_array_inst.outdata_reg_b = "CLOCK1",
|
||||
shmask_array_inst.power_up_uninitialized = "FALSE",
|
||||
shmask_array_inst.widthad_a = 8,
|
||||
shmask_array_inst.widthad_b = 8,
|
||||
shmask_array_inst.width_a = 11,
|
||||
shmask_array_inst.width_b = 11,
|
||||
shmask_array_inst.width_byteena_a = 1;
|
||||
|
||||
// Lumacode palette RAM
|
||||
altsyncram lumacode_pal_ram (
|
||||
.address_a (avalon_s_address[7:0]),
|
||||
.address_b (lumacode_addr_i),
|
||||
.clock0 (clk_i),
|
||||
.clock1 (lumacode_clk_i),
|
||||
.data_a (avalon_s_writedata),
|
||||
.rden_b (lumacode_rden_i),
|
||||
.wren_a (avalon_s_chipselect && avalon_s_write && (avalon_s_address >= LUMACODE_RAM_OFFSET)),
|
||||
.q_b (lumacode_data_o),
|
||||
.aclr0 (1'b0),
|
||||
.aclr1 (1'b0),
|
||||
.addressstall_a (1'b0),
|
||||
.addressstall_b (1'b0),
|
||||
.byteena_a (1'b1),
|
||||
.byteena_b (1'b1),
|
||||
.clocken0 (1'b1),
|
||||
.clocken1 (1'b1),
|
||||
.clocken2 (1'b1),
|
||||
.clocken3 (1'b1),
|
||||
.data_b ({32{1'b1}}),
|
||||
.eccstatus (),
|
||||
.q_a (),
|
||||
.rden_a (1'b1),
|
||||
.wren_b (1'b0));
|
||||
defparam
|
||||
lumacode_pal_ram.address_aclr_b = "NONE",
|
||||
lumacode_pal_ram.address_reg_b = "CLOCK1",
|
||||
lumacode_pal_ram.clock_enable_input_a = "BYPASS",
|
||||
lumacode_pal_ram.clock_enable_input_b = "BYPASS",
|
||||
lumacode_pal_ram.clock_enable_output_b = "BYPASS",
|
||||
lumacode_pal_ram.intended_device_family = "Cyclone IV E",
|
||||
lumacode_pal_ram.lpm_type = "altsyncram",
|
||||
lumacode_pal_ram.numwords_a = 256,
|
||||
lumacode_pal_ram.numwords_b = 256,
|
||||
lumacode_pal_ram.operation_mode = "DUAL_PORT",
|
||||
lumacode_pal_ram.outdata_aclr_b = "NONE",
|
||||
lumacode_pal_ram.outdata_reg_b = "UNREGISTERED",
|
||||
lumacode_pal_ram.power_up_uninitialized = "FALSE",
|
||||
lumacode_pal_ram.rdcontrol_reg_b = "CLOCK1",
|
||||
lumacode_pal_ram.widthad_a = 8,
|
||||
lumacode_pal_ram.widthad_b = 8,
|
||||
lumacode_pal_ram.width_a = 32,
|
||||
lumacode_pal_ram.width_b = 32,
|
||||
lumacode_pal_ram.width_byteena_a = 1;
|
||||
|
||||
|
||||
genvar i;
|
||||
generate
|
||||
for (i=HV_IN_CONFIG_REGNUM; i <= SL_CONFIG3_REGNUM; i++) begin : gen_reg
|
||||
always @(posedge clk_i or posedge rst_i) begin
|
||||
if (rst_i) begin
|
||||
config_reg[i] <= 0;
|
||||
end else begin
|
||||
if (avalon_s_chipselect && avalon_s_write && (avalon_s_address==i)) begin
|
||||
if (avalon_s_byteenable[3])
|
||||
config_reg[i][31:24] <= avalon_s_writedata[31:24];
|
||||
if (avalon_s_byteenable[2])
|
||||
config_reg[i][23:16] <= avalon_s_writedata[23:16];
|
||||
if (avalon_s_byteenable[1])
|
||||
config_reg[i][15:8] <= avalon_s_writedata[15:8];
|
||||
if (avalon_s_byteenable[0])
|
||||
config_reg[i][7:0] <= avalon_s_writedata[7:0];
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
endgenerate
|
||||
|
||||
always @(posedge clk_i or posedge rst_i) begin
|
||||
if (rst_i) begin
|
||||
h_config2_o <= 0;
|
||||
end else begin
|
||||
if (avalon_s_chipselect && avalon_s_write && (avalon_s_address==H_CONFIG2_REGNUM)) begin
|
||||
if (avalon_s_byteenable[3])
|
||||
h_config2_o[31:24] <= avalon_s_writedata[31:24];
|
||||
if (avalon_s_byteenable[2])
|
||||
h_config2_o[23:16] <= avalon_s_writedata[23:16];
|
||||
if (avalon_s_byteenable[1])
|
||||
h_config2_o[15:8] <= avalon_s_writedata[15:8];
|
||||
if (avalon_s_byteenable[0])
|
||||
h_config2_o[7:0] <= avalon_s_writedata[7:0];
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge clk_i or posedge rst_i) begin
|
||||
if (rst_i) begin
|
||||
v_config_o <= 0;
|
||||
end else begin
|
||||
if (avalon_s_chipselect && avalon_s_write && (avalon_s_address==V_CONFIG_REGNUM)) begin
|
||||
if (avalon_s_byteenable[3])
|
||||
v_config_o[31:24] <= avalon_s_writedata[31:24];
|
||||
if (avalon_s_byteenable[2])
|
||||
v_config_o[23:16] <= avalon_s_writedata[23:16];
|
||||
if (avalon_s_byteenable[1])
|
||||
v_config_o[15:8] <= avalon_s_writedata[15:8];
|
||||
if (avalon_s_byteenable[0])
|
||||
v_config_o[7:0] <= avalon_s_writedata[7:0];
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge clk_i or posedge rst_i) begin
|
||||
if (rst_i) begin
|
||||
misc_config_o <= 0;
|
||||
end else begin
|
||||
if (avalon_s_chipselect && avalon_s_write && (avalon_s_address==MISC_CONFIG_REGNUM)) begin
|
||||
if (avalon_s_byteenable[3])
|
||||
misc_config_o[31:24] <= avalon_s_writedata[31:24];
|
||||
if (avalon_s_byteenable[2])
|
||||
misc_config_o[23:16] <= avalon_s_writedata[23:16];
|
||||
if (avalon_s_byteenable[1])
|
||||
misc_config_o[15:8] <= avalon_s_writedata[15:8];
|
||||
if (avalon_s_byteenable[0])
|
||||
misc_config_o[7:0] <= avalon_s_writedata[7:0];
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge clk_i or posedge rst_i) begin
|
||||
if (rst_i) begin
|
||||
sl_config_o <= 0;
|
||||
end else begin
|
||||
if (avalon_s_chipselect && avalon_s_write && (avalon_s_address==SL_CONFIG_REGNUM)) begin
|
||||
if (avalon_s_byteenable[3])
|
||||
sl_config_o[31:24] <= avalon_s_writedata[31:24];
|
||||
if (avalon_s_byteenable[2])
|
||||
sl_config_o[23:16] <= avalon_s_writedata[23:16];
|
||||
if (avalon_s_byteenable[1])
|
||||
sl_config_o[15:8] <= avalon_s_writedata[15:8];
|
||||
if (avalon_s_byteenable[0])
|
||||
sl_config_o[7:0] <= avalon_s_writedata[7:0];
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge clk_i or posedge rst_i) begin
|
||||
if (rst_i) begin
|
||||
sl_config2_o <= 0;
|
||||
end else begin
|
||||
if (avalon_s_chipselect && avalon_s_write && (avalon_s_address==SL_CONFIG2_REGNUM)) begin
|
||||
if (avalon_s_byteenable[3])
|
||||
sl_config2_o[31:24] <= avalon_s_writedata[31:24];
|
||||
if (avalon_s_byteenable[2])
|
||||
sl_config2_o[23:16] <= avalon_s_writedata[23:16];
|
||||
if (avalon_s_byteenable[1])
|
||||
sl_config2_o[15:8] <= avalon_s_writedata[15:8];
|
||||
if (avalon_s_byteenable[0])
|
||||
sl_config2_o[7:0] <= avalon_s_writedata[7:0];
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
// no readback for config regs -> unused bits optimized out
|
||||
always @(*) begin
|
||||
if (avalon_s_chipselect && avalon_s_read) begin
|
||||
case (avalon_s_address)
|
||||
SC_STATUS_REGNUM: avalon_s_readdata = sc_status_i;
|
||||
SC_STATUS2_REGNUM: avalon_s_readdata = sc_status2_i;
|
||||
FE_STATUS_REGNUM: avalon_s_readdata = fe_status_i;
|
||||
FE_STATUS2_REGNUM: avalon_s_readdata = fe_status2_i;
|
||||
LT_STATUS_REGNUM: avalon_s_readdata = lt_status_i;
|
||||
H_CONFIG_REGNUM: avalon_s_readdata = h_config_o;
|
||||
H_CONFIG2_REGNUM: avalon_s_readdata = h_config2_o;
|
||||
V_CONFIG_REGNUM: avalon_s_readdata = v_config_o;
|
||||
MISC_CONFIG_REGNUM: avalon_s_readdata = misc_config_o;
|
||||
SL_CONFIG_REGNUM: avalon_s_readdata = sl_config_o;
|
||||
SL_CONFIG2_REGNUM: avalon_s_readdata = sl_config2_o;
|
||||
default: avalon_s_readdata = 32'h00000000;
|
||||
endcase
|
||||
end else begin
|
||||
@@ -176,4 +210,17 @@ always @(*) begin
|
||||
end
|
||||
end
|
||||
|
||||
assign hv_in_config_o = config_reg[HV_IN_CONFIG_REGNUM];
|
||||
assign hv_in_config2_o = config_reg[HV_IN_CONFIG2_REGNUM];
|
||||
assign hv_in_config3_o = config_reg[HV_IN_CONFIG3_REGNUM];
|
||||
assign hv_out_config_o = config_reg[HV_OUT_CONFIG_REGNUM];
|
||||
assign hv_out_config2_o = config_reg[HV_OUT_CONFIG2_REGNUM];
|
||||
assign hv_out_config3_o = config_reg[HV_OUT_CONFIG3_REGNUM];
|
||||
assign xy_out_config_o = config_reg[XY_OUT_CONFIG_REGNUM];
|
||||
assign xy_out_config2_o = config_reg[XY_OUT_CONFIG2_REGNUM];
|
||||
assign misc_config_o = config_reg[MISC_CONFIG_REGNUM];
|
||||
assign sl_config_o = config_reg[SL_CONFIG_REGNUM];
|
||||
assign sl_config2_o = config_reg[SL_CONFIG2_REGNUM];
|
||||
assign sl_config3_o = config_reg[SL_CONFIG3_REGNUM];
|
||||
|
||||
endmodule
|
||||
@@ -10,19 +10,25 @@
|
||||
<user_name>Page_0</user_name>
|
||||
<page_flags>1</page_flags>
|
||||
<bit0>
|
||||
<sof_filename>output_files/ossc.sof<compress_bitstream>1</compress_bitstream></sof_filename>
|
||||
<sof_filename>output_files/ossc.sof<compress_bitstream>1</compress_bitstream></sof_filename>
|
||||
</bit0>
|
||||
</sof_data>
|
||||
<hex_block>
|
||||
<hex_filename>software/sys_controller/mem_init/flash.hex</hex_filename>
|
||||
<hex_addressing>relative</hex_addressing>
|
||||
<hex_offset>327680</hex_offset>
|
||||
<hex_little_endian>0</hex_little_endian>
|
||||
</hex_block>
|
||||
<version>10</version>
|
||||
<create_cvp_file>0</create_cvp_file>
|
||||
<create_hps_iocsr>0</create_hps_iocsr>
|
||||
<auto_create_rpd>0</auto_create_rpd>
|
||||
<rpd_little_endian>1</rpd_little_endian>
|
||||
<options>
|
||||
<map_file>1</map_file>
|
||||
<map_file>0</map_file>
|
||||
</options>
|
||||
<advanced_options>
|
||||
<ignore_epcs_id_check>0</ignore_epcs_id_check>
|
||||
<ignore_epcs_id_check>1</ignore_epcs_id_check>
|
||||
<ignore_condone_check>2</ignore_condone_check>
|
||||
<plc_adjustment>0</plc_adjustment>
|
||||
<post_chain_bitstream_pad_bytes>-1</post_chain_bitstream_pad_bytes>
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
# -------------------------------------------------------------------------- #
|
||||
#
|
||||
# Copyright (C) 1991-2013 Altera Corporation
|
||||
# Your use of Altera Corporation's design tools, logic functions
|
||||
# and other software and tools, and its AMPP partner logic
|
||||
# functions, and any output files from any of the foregoing
|
||||
# (including device programming or simulation files), and any
|
||||
# associated documentation or information are expressly subject
|
||||
# to the terms and conditions of the Altera Program License
|
||||
# Subscription Agreement, Altera MegaCore Function License
|
||||
# Agreement, or other applicable license agreement, including,
|
||||
# without limitation, that your use is for the sole purpose of
|
||||
# programming logic devices manufactured by Altera and sold by
|
||||
# Altera or its authorized distributors. Please refer to the
|
||||
# Your use of Altera Corporation's design tools, logic functions
|
||||
# and other software and tools, and its AMPP partner logic
|
||||
# functions, and any output files from any of the foregoing
|
||||
# (including device programming or simulation files), and any
|
||||
# associated documentation or information are expressly subject
|
||||
# to the terms and conditions of the Altera Program License
|
||||
# Subscription Agreement, Altera MegaCore Function License
|
||||
# Agreement, or other applicable license agreement, including,
|
||||
# without limitation, that your use is for the sole purpose of
|
||||
# programming logic devices manufactured by Altera and sold by
|
||||
# Altera or its authorized distributors. Please refer to the
|
||||
# applicable agreement for further details.
|
||||
#
|
||||
# -------------------------------------------------------------------------- #
|
||||
@@ -41,7 +41,7 @@ set_global_assignment -name DEVICE EP4CE15E22C8
|
||||
set_global_assignment -name TOP_LEVEL_ENTITY ossc
|
||||
set_global_assignment -name ORIGINAL_QUARTUS_VERSION 13.1
|
||||
set_global_assignment -name PROJECT_CREATION_TIME_DATE "17:27:03 MAY 17, 2014"
|
||||
set_global_assignment -name LAST_QUARTUS_VERSION "20.1.1 Lite Edition"
|
||||
set_global_assignment -name LAST_QUARTUS_VERSION "24.1std.0 Lite Edition"
|
||||
set_global_assignment -name PROJECT_OUTPUT_DIRECTORY output_files
|
||||
set_global_assignment -name MIN_CORE_JUNCTION_TEMP 0
|
||||
set_global_assignment -name MAX_CORE_JUNCTION_TEMP 85
|
||||
@@ -59,38 +59,40 @@ set_global_assignment -name STRATIX_DEVICE_IO_STANDARD "3.3-V LVTTL"
|
||||
set_location_assignment PIN_25 -to clk27
|
||||
set_location_assignment PIN_99 -to hw_reset_n
|
||||
set_location_assignment PIN_23 -to ir_rx
|
||||
set_location_assignment PIN_126 -to cfg[1]
|
||||
set_location_assignment PIN_127 -to cfg[0]
|
||||
|
||||
#============================================================
|
||||
# TVP7002
|
||||
#============================================================
|
||||
set_location_assignment PIN_52 -to R_in[0]
|
||||
set_location_assignment PIN_53 -to R_in[1]
|
||||
set_location_assignment PIN_54 -to R_in[2]
|
||||
set_location_assignment PIN_55 -to R_in[3]
|
||||
set_location_assignment PIN_58 -to R_in[4]
|
||||
set_location_assignment PIN_59 -to R_in[5]
|
||||
set_location_assignment PIN_60 -to R_in[6]
|
||||
set_location_assignment PIN_61 -to R_in[7]
|
||||
set_location_assignment PIN_88 -to B_in[7]
|
||||
set_location_assignment PIN_87 -to B_in[6]
|
||||
set_location_assignment PIN_86 -to B_in[5]
|
||||
set_location_assignment PIN_85 -to B_in[4]
|
||||
set_location_assignment PIN_83 -to B_in[3]
|
||||
set_location_assignment PIN_80 -to B_in[2]
|
||||
set_location_assignment PIN_77 -to B_in[1]
|
||||
set_location_assignment PIN_89 -to PCLK_in
|
||||
set_location_assignment PIN_76 -to B_in[0]
|
||||
set_location_assignment PIN_90 -to HSYNC_in
|
||||
set_location_assignment PIN_91 -to VSYNC_in
|
||||
set_location_assignment PIN_98 -to FID_in
|
||||
set_location_assignment PIN_72 -to G_in[7]
|
||||
set_location_assignment PIN_71 -to G_in[6]
|
||||
set_location_assignment PIN_69 -to G_in[5]
|
||||
set_location_assignment PIN_68 -to G_in[4]
|
||||
set_location_assignment PIN_67 -to G_in[3]
|
||||
set_location_assignment PIN_66 -to G_in[2]
|
||||
set_location_assignment PIN_65 -to G_in[1]
|
||||
set_location_assignment PIN_64 -to G_in[0]
|
||||
set_location_assignment PIN_52 -to TVP_R_i[0]
|
||||
set_location_assignment PIN_53 -to TVP_R_i[1]
|
||||
set_location_assignment PIN_54 -to TVP_R_i[2]
|
||||
set_location_assignment PIN_55 -to TVP_R_i[3]
|
||||
set_location_assignment PIN_58 -to TVP_R_i[4]
|
||||
set_location_assignment PIN_59 -to TVP_R_i[5]
|
||||
set_location_assignment PIN_60 -to TVP_R_i[6]
|
||||
set_location_assignment PIN_61 -to TVP_R_i[7]
|
||||
set_location_assignment PIN_88 -to TVP_B_i[7]
|
||||
set_location_assignment PIN_87 -to TVP_B_i[6]
|
||||
set_location_assignment PIN_86 -to TVP_B_i[5]
|
||||
set_location_assignment PIN_85 -to TVP_B_i[4]
|
||||
set_location_assignment PIN_83 -to TVP_B_i[3]
|
||||
set_location_assignment PIN_80 -to TVP_B_i[2]
|
||||
set_location_assignment PIN_77 -to TVP_B_i[1]
|
||||
set_location_assignment PIN_89 -to TVP_PCLK_i
|
||||
set_location_assignment PIN_76 -to TVP_B_i[0]
|
||||
set_location_assignment PIN_90 -to TVP_HS_i
|
||||
set_location_assignment PIN_91 -to TVP_VSYNC_i
|
||||
set_location_assignment PIN_98 -to TVP_SOG_i
|
||||
set_location_assignment PIN_72 -to TVP_G_i[7]
|
||||
set_location_assignment PIN_71 -to TVP_G_i[6]
|
||||
set_location_assignment PIN_69 -to TVP_G_i[5]
|
||||
set_location_assignment PIN_68 -to TVP_G_i[4]
|
||||
set_location_assignment PIN_67 -to TVP_G_i[3]
|
||||
set_location_assignment PIN_66 -to TVP_G_i[2]
|
||||
set_location_assignment PIN_65 -to TVP_G_i[1]
|
||||
set_location_assignment PIN_64 -to TVP_G_i[0]
|
||||
|
||||
#============================================================
|
||||
# HDMITX
|
||||
@@ -124,7 +126,6 @@ set_location_assignment PIN_7 -to HDMI_TX_RD[5]
|
||||
set_location_assignment PIN_10 -to HDMI_TX_RD[6]
|
||||
set_location_assignment PIN_11 -to HDMI_TX_RD[7]
|
||||
set_location_assignment PIN_100 -to HDMI_TX_INT_N
|
||||
set_location_assignment PIN_127 -to HDMI_TX_MODE
|
||||
|
||||
#============================================================
|
||||
# SD card
|
||||
@@ -171,9 +172,8 @@ set_global_assignment -name OUTPUT_IO_TIMING_NEAR_END_VMEAS "HALF VCCIO" -rise
|
||||
set_global_assignment -name OUTPUT_IO_TIMING_NEAR_END_VMEAS "HALF VCCIO" -fall
|
||||
set_global_assignment -name OUTPUT_IO_TIMING_FAR_END_VMEAS "HALF SIGNAL SWING" -rise
|
||||
set_global_assignment -name OUTPUT_IO_TIMING_FAR_END_VMEAS "HALF SIGNAL SWING" -fall
|
||||
set_global_assignment -name INI_VARS "FIOMGR_ENABLE_SPI_TIMING=ON"
|
||||
|
||||
|
||||
set_global_assignment -name SEARCH_PATH rtl
|
||||
set_global_assignment -name CYCLONEIII_CONFIGURATION_DEVICE EPCS16
|
||||
|
||||
set_global_assignment -name VERILOG_INPUT_VERSION SYSTEMVERILOG_2005
|
||||
@@ -187,7 +187,7 @@ set_global_assignment -name PHYSICAL_SYNTHESIS_EFFORT NORMAL
|
||||
set_global_assignment -name PHYSICAL_SYNTHESIS_COMBO_LOGIC OFF
|
||||
set_global_assignment -name PHYSICAL_SYNTHESIS_REGISTER_DUPLICATION OFF
|
||||
|
||||
set_global_assignment -name OPTIMIZATION_MODE "AGGRESSIVE PERFORMANCE"
|
||||
set_global_assignment -name OPTIMIZATION_MODE BALANCED
|
||||
set_global_assignment -name ALLOW_REGISTER_RETIMING OFF
|
||||
|
||||
set_global_assignment -name ENABLE_OCT_DONE OFF
|
||||
@@ -211,14 +211,14 @@ set_global_assignment -name POWER_DEFAULT_INPUT_IO_TOGGLE_RATE 50%
|
||||
|
||||
|
||||
set_global_assignment -name ROUTER_CLOCKING_TOPOLOGY_ANALYSIS ON
|
||||
set_global_assignment -name PLACEMENT_EFFORT_MULTIPLIER 8.0
|
||||
set_global_assignment -name PLACEMENT_EFFORT_MULTIPLIER 1
|
||||
set_global_assignment -name ROUTER_EFFORT_MULTIPLIER 2.0
|
||||
set_global_assignment -name CYCLONEII_OPTIMIZATION_TECHNIQUE SPEED
|
||||
set_global_assignment -name ENABLE_SIGNALTAP OFF
|
||||
set_global_assignment -name USE_SIGNALTAP_FILE output_files/ossc_la.stp
|
||||
set_global_assignment -name USE_SIGNALTAP_FILE output_files/ossc_new.stp
|
||||
|
||||
set_global_assignment -name FITTER_EFFORT "AUTO FIT"
|
||||
set_global_assignment -name SEED 2
|
||||
set_global_assignment -name SEED 1
|
||||
|
||||
|
||||
|
||||
@@ -230,21 +230,33 @@ set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to HDMI_TX_GD[7]
|
||||
set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to HDMI_TX_RD[1]
|
||||
set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to HDMI_TX_RD[5]
|
||||
set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to HDMI_TX_RD[7]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
set_global_assignment -name VERILOG_FILE rtl/videogen.v
|
||||
set_global_assignment -name VERILOG_FILE rtl/ir_rcv.v
|
||||
set_global_assignment -name VERILOG_FILE rtl/ossc.v
|
||||
set_global_assignment -name VERILOG_FILE rtl/scanconverter.v
|
||||
set_global_assignment -name VERILOG_FILE rtl/linebuf_top.v
|
||||
set_global_assignment -name VERILOG_FILE rtl/tvp7002_frontend.v
|
||||
set_global_assignment -name VERILOG_FILE rtl/lat_tester.v
|
||||
set_global_assignment -name QIP_FILE sys/synthesis/sys.qip
|
||||
set_global_assignment -name QIP_FILE software/sys_controller/mem_init/meminit.qip
|
||||
set_global_assignment -name QIP_FILE rtl/linebuf.qip
|
||||
set_global_assignment -name QIP_FILE rtl/char_rom.qip
|
||||
set_global_assignment -name QIP_FILE rtl/pll_2x.qip
|
||||
set_global_assignment -name QIP_FILE rtl/lpm_mult_4_hybr_ref_pre.qip
|
||||
set_global_assignment -name QIP_FILE rtl/lpm_mult_4_hybr_ref.qip
|
||||
set_global_assignment -name QIP_FILE rtl/lpm_mult_4_sl.qip
|
||||
set_global_assignment -name QIP_FILE rtl/lpm_mult_8x5_9.qip
|
||||
set_global_assignment -name QIP_FILE rtl/lpm_mult_sl.qip
|
||||
set_global_assignment -name SDC_FILE ossc.sdc
|
||||
set_global_assignment -name CDF_FILE output_files/Chain1.cdf
|
||||
set_global_assignment -name SIGNALTAP_FILE output_files/ossc_la.stp
|
||||
set_global_assignment -name QIP_FILE rtl/char_array.qip
|
||||
set_global_assignment -name SEARCH_PATH rtl
|
||||
set_global_assignment -name SEARCH_PATH software/sys_controller/mem_init/
|
||||
set_global_assignment -name SEARCH_PATH ip/ibex_qsys/rtl_extra
|
||||
set_global_assignment -name VERILOG_MACRO "SYNTHESIS=<None>"
|
||||
set_global_assignment -name STRATIXIII_UPDATE_MODE REMOTE
|
||||
set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top
|
||||
@@ -2,43 +2,33 @@
|
||||
|
||||
create_clock -period 27MHz -name clk27 [get_ports clk27]
|
||||
|
||||
set_input_delay -clock clk27 0 [get_ports {sda scl SD_CMD SD_DAT* *ALTERA_DATA0}]
|
||||
set_false_path -from [get_ports {btn* ir_rx HDMI_TX_INT_N HDMI_TX_MODE}]
|
||||
set_input_delay -clock clk27 0 [get_ports {sda scl SD_CMD SD_DAT*}]
|
||||
set_false_path -from [get_ports {btn* cfg* ir_rx HDMI_TX_INT_N LED_R}]
|
||||
set_false_path -to {sys:sys_inst|sys_pio_1:pio_1|readdata*}
|
||||
|
||||
create_generated_clock -name flash_clk -divide_by 2 -source clk27 [get_pins sys:sys_inst|sys_intel_generic_serial_flash_interface_top_0:intel_generic_serial_flash_interface_top_0|sys_intel_generic_serial_flash_interface_top_0_qspi_inf_inst:qspi_inf_inst|flash_clk_reg|q]
|
||||
create_generated_clock -name flash_clk_out -master_clock flash_clk -source [get_pins sys:sys_inst|sys_intel_generic_serial_flash_interface_top_0:intel_generic_serial_flash_interface_top_0|sys_intel_generic_serial_flash_interface_top_0_qspi_inf_inst:qspi_inf_inst|flash_clk_reg|q] -multiply_by 1 [get_ports *ALTERA_DCLK]
|
||||
|
||||
### Scanconverter clock constraints ###
|
||||
|
||||
create_clock -period 108MHz -name pclk_1x [get_ports PCLK_in]
|
||||
create_clock -period 54MHz -name pclk_2x_source [get_ports PCLK_in] -add
|
||||
create_clock -period 54MHz -name pclk_3x_source [get_ports PCLK_in] -add
|
||||
create_clock -period 33MHz -name pclk_4x_source [get_ports PCLK_in] -add
|
||||
create_clock -period 33MHz -name pclk_5x_source [get_ports PCLK_in] -add
|
||||
create_clock -period 165MHz -name pclk_tvp_high [get_ports TVP_PCLK_i]
|
||||
create_clock -period 33MHz -name pclk_tvp_low [get_ports TVP_PCLK_i] -add
|
||||
|
||||
#derive_pll_clocks
|
||||
create_generated_clock -name pclk_2x -master_clock pclk_2x_source -source {scanconverter_inst|pll_pclk|altpll_component|auto_generated|pll1|inclk[1]} -multiply_by 2 -duty_cycle 50.00 {scanconverter_inst|pll_pclk|altpll_component|auto_generated|pll1|clk[0]} -add
|
||||
create_generated_clock -name pclk_3x -master_clock pclk_3x_source -source {scanconverter_inst|pll_pclk|altpll_component|auto_generated|pll1|inclk[1]} -multiply_by 3 -duty_cycle 50.00 {scanconverter_inst|pll_pclk|altpll_component|auto_generated|pll1|clk[0]} -add
|
||||
create_generated_clock -name pclk_4x -master_clock pclk_4x_source -source {scanconverter_inst|pll_pclk|altpll_component|auto_generated|pll1|inclk[1]} -multiply_by 4 -duty_cycle 50.00 {scanconverter_inst|pll_pclk|altpll_component|auto_generated|pll1|clk[1]} -add
|
||||
create_generated_clock -name pclk_5x -master_clock pclk_5x_source -source {scanconverter_inst|pll_pclk|altpll_component|auto_generated|pll1|inclk[1]} -multiply_by 5 -duty_cycle 50.00 {scanconverter_inst|pll_pclk|altpll_component|auto_generated|pll1|clk[1]} -add
|
||||
create_generated_clock -name pclk_27mhz -master_clock clk27 -source {scanconverter_inst|pll_pclk|altpll_component|auto_generated|pll1|inclk[0]} -multiply_by 1 -duty_cycle 50.00 {scanconverter_inst|pll_pclk|altpll_component|auto_generated|pll1|clk[0]} -add
|
||||
create_generated_clock -name pclk_5x -master_clock pclk_tvp_low -source {pll_pclk|altpll_component|auto_generated|pll1|inclk[1]} -multiply_by 5 -duty_cycle 50.00 {pll_pclk|altpll_component|auto_generated|pll1|clk[0]}
|
||||
create_generated_clock -name pclk_27mhz -master_clock clk27 -source {pll_pclk|altpll_component|auto_generated|pll1|inclk[0]} -multiply_by 1 -duty_cycle 50.00 {pll_pclk|altpll_component|auto_generated|pll1|clk[0]} -add
|
||||
|
||||
# retrieve post-mapping clkmux output pin
|
||||
set clkmux_output [get_pins scanconverter_inst|clkctrl1|outclk]
|
||||
set clkmux_output [get_pins clkctrl1|outclk]
|
||||
|
||||
# specify postmux clocks which clock postprocess pipeline
|
||||
create_generated_clock -name pclk_1x_postmux -master_clock pclk_1x -source [get_pins scanconverter_inst|clkctrl1|inclk[0]] -multiply_by 1 $clkmux_output
|
||||
create_generated_clock -name pclk_2x_postmux -master_clock pclk_2x -source [get_pins scanconverter_inst|clkctrl1|inclk[2]] -multiply_by 1 $clkmux_output -add
|
||||
create_generated_clock -name pclk_3x_postmux -master_clock pclk_3x -source [get_pins scanconverter_inst|clkctrl1|inclk[2]] -multiply_by 1 $clkmux_output -add
|
||||
create_generated_clock -name pclk_4x_postmux -master_clock pclk_4x -source [get_pins scanconverter_inst|clkctrl1|inclk[3]] -multiply_by 1 $clkmux_output -add
|
||||
create_generated_clock -name pclk_5x_postmux -master_clock pclk_5x -source [get_pins scanconverter_inst|clkctrl1|inclk[3]] -multiply_by 1 $clkmux_output -add
|
||||
create_generated_clock -name pclk_27mhz_postmux -master_clock pclk_27mhz -source [get_pins scanconverter_inst|clkctrl1|inclk[2]] -multiply_by 1 $clkmux_output -add
|
||||
create_generated_clock -name pclk_1x_postmux -master_clock pclk_tvp_high -source [get_pins clkctrl1|inclk[0]] -multiply_by 1 $clkmux_output
|
||||
create_generated_clock -name pclk_5x_postmux -master_clock pclk_5x -source [get_pins clkctrl1|inclk[2]] -multiply_by 1 $clkmux_output -add
|
||||
create_generated_clock -name pclk_27mhz_postmux -master_clock pclk_27mhz -source [get_pins clkctrl1|inclk[2]] -multiply_by 1 $clkmux_output -add
|
||||
|
||||
# specify output clocks that drive PCLK output pin
|
||||
set pclk_out_port [get_ports HDMI_TX_PCLK]
|
||||
create_generated_clock -name pclk_1x_out -master_clock pclk_1x_postmux -source $clkmux_output -multiply_by 1 $pclk_out_port
|
||||
create_generated_clock -name pclk_2x_out -master_clock pclk_2x_postmux -source $clkmux_output -multiply_by 1 $pclk_out_port -add
|
||||
create_generated_clock -name pclk_3x_out -master_clock pclk_3x_postmux -source $clkmux_output -multiply_by 1 $pclk_out_port -add
|
||||
create_generated_clock -name pclk_4x_out -master_clock pclk_4x_postmux -source $clkmux_output -multiply_by 1 $pclk_out_port -add
|
||||
create_generated_clock -name pclk_5x_out -master_clock pclk_5x_postmux -source $clkmux_output -multiply_by 1 $pclk_out_port -add
|
||||
create_generated_clock -name pclk_27mhz_out -master_clock pclk_27mhz_postmux -source $clkmux_output -multiply_by 1 $pclk_out_port -add
|
||||
|
||||
@@ -47,8 +37,8 @@ derive_clock_uncertainty
|
||||
# input delay constraints
|
||||
set TVP_dmin 0
|
||||
set TVP_dmax 1.5
|
||||
set critinputs [get_ports {R_in* G_in* B_in* HSYNC_in VSYNC_in FID_in}]
|
||||
foreach_in_collection c [get_clocks "pclk_1x pclk_*_source"] {
|
||||
set critinputs [get_ports {TVP_R_i* TVP_G_i* TVP_B_i* TVP_HS_i TVP_SOG_i TVP_VSYNC_i}]
|
||||
foreach_in_collection c [get_clocks "pclk_tvp*"] {
|
||||
set_input_delay -clock $c -min $TVP_dmin $critinputs -add_delay
|
||||
set_input_delay -clock $c -max $TVP_dmax $critinputs -add_delay
|
||||
}
|
||||
@@ -64,30 +54,28 @@ foreach_in_collection c [get_clocks pclk_*_out] {
|
||||
}
|
||||
set_false_path -to [remove_from_collection [all_outputs] $critoutputs_hdmi]
|
||||
|
||||
# Lumacode (constrained to max. 60MHz sampling)
|
||||
set_max_delay 16.6 -from [get_registers sys:sys_inst|sc_config_top:sc_config_0|altsyncram:lumacode_pal_ram|*]
|
||||
|
||||
# Flash controller (delays from N25Q128A datasheet)
|
||||
set_input_delay -clock flash_clk_out -clock_fall 5 [get_ports *ALTERA_DATA0]
|
||||
set_output_delay -clock flash_clk_out 4 [get_ports *ALTERA_SCE]
|
||||
set_output_delay -clock flash_clk_out 2 [get_ports *ALTERA_SDO]
|
||||
|
||||
# Latency tester
|
||||
set_false_path -from [get_registers lat_tester:lt0|mode_synced*]
|
||||
|
||||
|
||||
### CPU/scanconverter clock relations ###
|
||||
|
||||
# Treat CPU clock asynchronous to pixel clocks
|
||||
# Treat CPU clock asynchronous to pixel clocks
|
||||
set_clock_groups -asynchronous -group \
|
||||
{clk27 pclk_27mhz pclk_27mhz_postmux pclk_27mhz_out} \
|
||||
{pclk_1x pclk_1x_postmux pclk_1x_out} \
|
||||
{pclk_2x_source pclk_2x pclk_2x_postmux pclk_2x_out} \
|
||||
{pclk_3x_source pclk_3x pclk_3x_postmux pclk_3x_out} \
|
||||
{pclk_4x_source pclk_4x pclk_4x_postmux pclk_4x_out} \
|
||||
{pclk_5x_source pclk_5x pclk_5x_postmux pclk_5x_out}
|
||||
|
||||
# Ignore paths from registers which are updated only at leading edge of vsync
|
||||
set_false_path -from [get_registers {scanconverter_inst|H_* scanconverter_inst|V_* scanconverter_inst|X_* scanconverter_inst|SL_* scanconverter_inst|LT_POS_*}]
|
||||
|
||||
# Ignore paths from registers which are updated only at leading edge of hsync
|
||||
#set_false_path -from [get_registers {scanconverter:scanconverter_inst|line_idx scanconverter:scanconverter_inst|line_out_idx* scanconverter:scanconverter_inst|hmax*}]
|
||||
|
||||
# Ignore paths that cross clock domains from 3x to 2x and 5x to 4x, since they share a clock line, but cannot co-occur.
|
||||
set_false_path -from [get_clocks {pclk_3x*}] -to [get_registers {scanconverter:scanconverter_inst|*_2x*}]
|
||||
set_false_path -from [get_clocks {pclk_5x*}] -to [get_registers {scanconverter:scanconverter_inst|*_4x*}]
|
||||
|
||||
# Ignore paths to latency tester sync regs
|
||||
set_false_path -to [get_registers {lat_tester:lt0|mode_synced* lat_tester:lt0|VSYNC_in_* lat_tester:lt0|trigger_*}]
|
||||
{clk27} \
|
||||
{pclk_27mhz pclk_27mhz_postmux pclk_27mhz_out} \
|
||||
{pclk_tvp_low} \
|
||||
{pclk_tvp_high} \
|
||||
{pclk_1x_postmux pclk_1x_out} \
|
||||
{pclk_5x pclk_5x_postmux pclk_5x_out}
|
||||
|
||||
|
||||
### JTAG Signal Constraints ###
|
||||
|
||||
+2
-2
@@ -5,14 +5,14 @@
|
||||
<Project Name="ossc_sw" Path="software/ossc_sw.project" Active="Yes"/>
|
||||
<Project Name="tools" Path="tools.project" Active="No"/>
|
||||
<BuildMatrix>
|
||||
<WorkspaceConfiguration Name="Debug" Selected="no">
|
||||
<WorkspaceConfiguration Name="Debug">
|
||||
<Environment/>
|
||||
<Project Name="ossc_rtl" ConfigName="Debug"/>
|
||||
<Project Name="ossc_sw_bsp" ConfigName="Debug"/>
|
||||
<Project Name="ossc_sw" ConfigName="Debug"/>
|
||||
<Project Name="tools" ConfigName="Debug"/>
|
||||
</WorkspaceConfiguration>
|
||||
<WorkspaceConfiguration Name="Release" Selected="yes">
|
||||
<WorkspaceConfiguration Name="Release">
|
||||
<Environment/>
|
||||
<Project Name="ossc_rtl" ConfigName="Release"/>
|
||||
<Project Name="ossc_sw_bsp" ConfigName="Release"/>
|
||||
|
||||
+1
-3
@@ -1,6 +1,4 @@
|
||||
set_global_assignment -name IP_TOOL_NAME "RAM: 2-PORT"
|
||||
set_global_assignment -name IP_TOOL_VERSION "20.1"
|
||||
set_global_assignment -name IP_TOOL_VERSION "24.1"
|
||||
set_global_assignment -name IP_GENERATED_DEVICE_FAMILY "{Cyclone IV E}"
|
||||
set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "char_array.v"]
|
||||
set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "char_array_inst.v"]
|
||||
set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "char_array_bb.v"]
|
||||
+11
-11
@@ -14,24 +14,24 @@
|
||||
// ************************************************************
|
||||
// THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
|
||||
//
|
||||
// 20.1.1 Build 720 11/11/2020 SJ Lite Edition
|
||||
// 24.1std.0 Build 1077 03/04/2025 SC Lite Edition
|
||||
// ************************************************************
|
||||
|
||||
|
||||
//Copyright (C) 2020 Intel Corporation. All rights reserved.
|
||||
//Your use of Intel Corporation's design tools, logic functions
|
||||
//Copyright (C) 2025 Altera Corporation. All rights reserved.
|
||||
//Your use of Altera Corporation's design tools, logic functions
|
||||
//and other software and tools, and any partner logic
|
||||
//functions, and any output files from any of the foregoing
|
||||
//(including device programming or simulation files), and any
|
||||
//associated documentation or information are expressly subject
|
||||
//to the terms and conditions of the Intel Program License
|
||||
//Subscription Agreement, the Intel Quartus Prime License Agreement,
|
||||
//the Intel FPGA IP License Agreement, or other applicable license
|
||||
//to the terms and conditions of the Altera Program License
|
||||
//Subscription Agreement, the Altera Quartus Prime License Agreement,
|
||||
//the Altera IP License Agreement, or other applicable license
|
||||
//agreement, including, without limitation, that your use is for
|
||||
//the sole purpose of programming logic devices manufactured by
|
||||
//Intel and sold by Intel or its authorized distributors. Please
|
||||
//refer to the applicable agreement for further details, at
|
||||
//https://fpgasoftware.intel.com/eula.
|
||||
//Altera and sold by Altera or its authorized distributors. Please
|
||||
//refer to the Altera Software License Subscription Agreements
|
||||
//on the Quartus Prime software download page.
|
||||
|
||||
|
||||
// synopsys translate_off
|
||||
@@ -218,6 +218,6 @@ endmodule
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL char_array.inc FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL char_array.cmp FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL char_array.bsf FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL char_array_inst.v TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL char_array_bb.v TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL char_array_inst.v FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL char_array_bb.v FALSE
|
||||
// Retrieval info: LIB_FILE: altera_mf
|
||||
+1
-3
@@ -1,6 +1,4 @@
|
||||
set_global_assignment -name IP_TOOL_NAME "ROM: 1-PORT"
|
||||
set_global_assignment -name IP_TOOL_VERSION "20.1"
|
||||
set_global_assignment -name IP_TOOL_VERSION "24.1"
|
||||
set_global_assignment -name IP_GENERATED_DEVICE_FAMILY "{Cyclone IV E}"
|
||||
set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "char_rom.v"]
|
||||
set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "char_rom_inst.v"]
|
||||
set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "char_rom_bb.v"]
|
||||
+11
-11
@@ -14,24 +14,24 @@
|
||||
// ************************************************************
|
||||
// THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
|
||||
//
|
||||
// 20.1.1 Build 720 11/11/2020 SJ Lite Edition
|
||||
// 24.1std.0 Build 1077 03/04/2025 SC Lite Edition
|
||||
// ************************************************************
|
||||
|
||||
|
||||
//Copyright (C) 2020 Intel Corporation. All rights reserved.
|
||||
//Your use of Intel Corporation's design tools, logic functions
|
||||
//Copyright (C) 2025 Altera Corporation. All rights reserved.
|
||||
//Your use of Altera Corporation's design tools, logic functions
|
||||
//and other software and tools, and any partner logic
|
||||
//functions, and any output files from any of the foregoing
|
||||
//(including device programming or simulation files), and any
|
||||
//associated documentation or information are expressly subject
|
||||
//to the terms and conditions of the Intel Program License
|
||||
//Subscription Agreement, the Intel Quartus Prime License Agreement,
|
||||
//the Intel FPGA IP License Agreement, or other applicable license
|
||||
//to the terms and conditions of the Altera Program License
|
||||
//Subscription Agreement, the Altera Quartus Prime License Agreement,
|
||||
//the Altera IP License Agreement, or other applicable license
|
||||
//agreement, including, without limitation, that your use is for
|
||||
//the sole purpose of programming logic devices manufactured by
|
||||
//Intel and sold by Intel or its authorized distributors. Please
|
||||
//refer to the applicable agreement for further details, at
|
||||
//https://fpgasoftware.intel.com/eula.
|
||||
//Altera and sold by Altera or its authorized distributors. Please
|
||||
//refer to the Altera Software License Subscription Agreements
|
||||
//on the Quartus Prime software download page.
|
||||
|
||||
|
||||
// synopsys translate_off
|
||||
@@ -160,6 +160,6 @@ endmodule
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL char_rom.inc FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL char_rom.cmp FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL char_rom.bsf FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL char_rom_inst.v TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL char_rom_bb.v TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL char_rom_inst.v FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL char_rom_bb.v FALSE
|
||||
// Retrieval info: LIB_FILE: altera_mf
|
||||
+1
-3
@@ -1,6 +1,4 @@
|
||||
set_global_assignment -name IP_TOOL_NAME "RAM: 2-PORT"
|
||||
set_global_assignment -name IP_TOOL_VERSION "20.1"
|
||||
set_global_assignment -name IP_TOOL_VERSION "24.1"
|
||||
set_global_assignment -name IP_GENERATED_DEVICE_FAMILY "{Cyclone IV E}"
|
||||
set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "linebuf.v"]
|
||||
set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "linebuf_inst.v"]
|
||||
set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "linebuf_bb.v"]
|
||||
+34
-24
@@ -14,24 +14,24 @@
|
||||
// ************************************************************
|
||||
// THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
|
||||
//
|
||||
// 20.1.1 Build 720 11/11/2020 SJ Lite Edition
|
||||
// 24.1std.0 Build 1077 03/04/2025 SC Lite Edition
|
||||
// ************************************************************
|
||||
|
||||
|
||||
//Copyright (C) 2020 Intel Corporation. All rights reserved.
|
||||
//Your use of Intel Corporation's design tools, logic functions
|
||||
//Copyright (C) 2025 Altera Corporation. All rights reserved.
|
||||
//Your use of Altera Corporation's design tools, logic functions
|
||||
//and other software and tools, and any partner logic
|
||||
//functions, and any output files from any of the foregoing
|
||||
//(including device programming or simulation files), and any
|
||||
//associated documentation or information are expressly subject
|
||||
//to the terms and conditions of the Intel Program License
|
||||
//Subscription Agreement, the Intel Quartus Prime License Agreement,
|
||||
//the Intel FPGA IP License Agreement, or other applicable license
|
||||
//to the terms and conditions of the Altera Program License
|
||||
//Subscription Agreement, the Altera Quartus Prime License Agreement,
|
||||
//the Altera IP License Agreement, or other applicable license
|
||||
//agreement, including, without limitation, that your use is for
|
||||
//the sole purpose of programming logic devices manufactured by
|
||||
//Intel and sold by Intel or its authorized distributors. Please
|
||||
//refer to the applicable agreement for further details, at
|
||||
//https://fpgasoftware.intel.com/eula.
|
||||
//Altera and sold by Altera or its authorized distributors. Please
|
||||
//refer to the Altera Software License Subscription Agreements
|
||||
//on the Quartus Prime software download page.
|
||||
|
||||
|
||||
// synopsys translate_off
|
||||
@@ -41,22 +41,28 @@ module linebuf (
|
||||
data,
|
||||
rdaddress,
|
||||
rdclock,
|
||||
rdclocken,
|
||||
wraddress,
|
||||
wrclock,
|
||||
wrclocken,
|
||||
wren,
|
||||
q);
|
||||
|
||||
input [23:0] data;
|
||||
input [11:0] rdaddress;
|
||||
input rdclock;
|
||||
input rdclocken;
|
||||
input [11:0] wraddress;
|
||||
input wrclock;
|
||||
input wrclocken;
|
||||
input wren;
|
||||
output [23:0] q;
|
||||
`ifndef ALTERA_RESERVED_QIS
|
||||
// synopsys translate_off
|
||||
`endif
|
||||
tri1 rdclocken;
|
||||
tri1 wrclock;
|
||||
tri1 wrclocken;
|
||||
tri0 wren;
|
||||
`ifndef ALTERA_RESERVED_QIS
|
||||
// synopsys translate_on
|
||||
@@ -70,6 +76,8 @@ module linebuf (
|
||||
.address_b (rdaddress),
|
||||
.clock0 (wrclock),
|
||||
.clock1 (rdclock),
|
||||
.clocken0 (wrclocken),
|
||||
.clocken1 (rdclocken),
|
||||
.data_a (data),
|
||||
.wren_a (wren),
|
||||
.q_b (sub_wire0),
|
||||
@@ -79,8 +87,6 @@ module linebuf (
|
||||
.addressstall_b (1'b0),
|
||||
.byteena_a (1'b1),
|
||||
.byteena_b (1'b1),
|
||||
.clocken0 (1'b1),
|
||||
.clocken1 (1'b1),
|
||||
.clocken2 (1'b1),
|
||||
.clocken3 (1'b1),
|
||||
.data_b ({24{1'b1}}),
|
||||
@@ -92,9 +98,9 @@ module linebuf (
|
||||
defparam
|
||||
altsyncram_component.address_aclr_b = "NONE",
|
||||
altsyncram_component.address_reg_b = "CLOCK1",
|
||||
altsyncram_component.clock_enable_input_a = "BYPASS",
|
||||
altsyncram_component.clock_enable_input_b = "BYPASS",
|
||||
altsyncram_component.clock_enable_output_b = "BYPASS",
|
||||
altsyncram_component.clock_enable_input_a = "NORMAL",
|
||||
altsyncram_component.clock_enable_input_b = "NORMAL",
|
||||
altsyncram_component.clock_enable_output_b = "NORMAL",
|
||||
altsyncram_component.intended_device_family = "Cyclone IV E",
|
||||
altsyncram_component.lpm_type = "altsyncram",
|
||||
altsyncram_component.numwords_a = 4096,
|
||||
@@ -123,10 +129,10 @@ endmodule
|
||||
// Retrieval info: PRIVATE: BYTE_ENABLE_B NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: BYTE_SIZE NUMERIC "8"
|
||||
// Retrieval info: PRIVATE: BlankMemory NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: CLOCK_ENABLE_INPUT_A NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: CLOCK_ENABLE_INPUT_B NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: CLOCK_ENABLE_OUTPUT_A NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: CLOCK_ENABLE_OUTPUT_B NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: CLOCK_ENABLE_INPUT_A NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: CLOCK_ENABLE_INPUT_B NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: CLOCK_ENABLE_OUTPUT_A NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: CLOCK_ENABLE_OUTPUT_B NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: CLRdata NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: CLRq NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: CLRrdaddress NUMERIC "0"
|
||||
@@ -172,14 +178,14 @@ endmodule
|
||||
// Retrieval info: PRIVATE: WRADDR_ACLR_B NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: WRADDR_REG_B NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: WRCTRL_ACLR_B NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: enable NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: enable NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: rden NUMERIC "0"
|
||||
// Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all
|
||||
// Retrieval info: CONSTANT: ADDRESS_ACLR_B STRING "NONE"
|
||||
// Retrieval info: CONSTANT: ADDRESS_REG_B STRING "CLOCK1"
|
||||
// Retrieval info: CONSTANT: CLOCK_ENABLE_INPUT_A STRING "BYPASS"
|
||||
// Retrieval info: CONSTANT: CLOCK_ENABLE_INPUT_B STRING "BYPASS"
|
||||
// Retrieval info: CONSTANT: CLOCK_ENABLE_OUTPUT_B STRING "BYPASS"
|
||||
// Retrieval info: CONSTANT: CLOCK_ENABLE_INPUT_A STRING "NORMAL"
|
||||
// Retrieval info: CONSTANT: CLOCK_ENABLE_INPUT_B STRING "NORMAL"
|
||||
// Retrieval info: CONSTANT: CLOCK_ENABLE_OUTPUT_B STRING "NORMAL"
|
||||
// Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone IV E"
|
||||
// Retrieval info: CONSTANT: LPM_TYPE STRING "altsyncram"
|
||||
// Retrieval info: CONSTANT: NUMWORDS_A NUMERIC "4096"
|
||||
@@ -197,13 +203,17 @@ endmodule
|
||||
// Retrieval info: USED_PORT: q 0 0 24 0 OUTPUT NODEFVAL "q[23..0]"
|
||||
// Retrieval info: USED_PORT: rdaddress 0 0 12 0 INPUT NODEFVAL "rdaddress[11..0]"
|
||||
// Retrieval info: USED_PORT: rdclock 0 0 0 0 INPUT NODEFVAL "rdclock"
|
||||
// Retrieval info: USED_PORT: rdclocken 0 0 0 0 INPUT VCC "rdclocken"
|
||||
// Retrieval info: USED_PORT: wraddress 0 0 12 0 INPUT NODEFVAL "wraddress[11..0]"
|
||||
// Retrieval info: USED_PORT: wrclock 0 0 0 0 INPUT VCC "wrclock"
|
||||
// Retrieval info: USED_PORT: wrclocken 0 0 0 0 INPUT VCC "wrclocken"
|
||||
// Retrieval info: USED_PORT: wren 0 0 0 0 INPUT GND "wren"
|
||||
// Retrieval info: CONNECT: @address_a 0 0 12 0 wraddress 0 0 12 0
|
||||
// Retrieval info: CONNECT: @address_b 0 0 12 0 rdaddress 0 0 12 0
|
||||
// Retrieval info: CONNECT: @clock0 0 0 0 0 wrclock 0 0 0 0
|
||||
// Retrieval info: CONNECT: @clock1 0 0 0 0 rdclock 0 0 0 0
|
||||
// Retrieval info: CONNECT: @clocken0 0 0 0 0 wrclocken 0 0 0 0
|
||||
// Retrieval info: CONNECT: @clocken1 0 0 0 0 rdclocken 0 0 0 0
|
||||
// Retrieval info: CONNECT: @data_a 0 0 24 0 data 0 0 24 0
|
||||
// Retrieval info: CONNECT: @wren_a 0 0 0 0 wren 0 0 0 0
|
||||
// Retrieval info: CONNECT: q 0 0 24 0 @q_b 0 0 24 0
|
||||
@@ -211,6 +221,6 @@ endmodule
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL linebuf.inc FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL linebuf.cmp FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL linebuf.bsf FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL linebuf_inst.v TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL linebuf_bb.v TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL linebuf_inst.v FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL linebuf_bb.v FALSE
|
||||
// Retrieval info: LIB_FILE: altera_mf
|
||||
@@ -0,0 +1,279 @@
|
||||
//
|
||||
// Copyright (C) 2022 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
//
|
||||
// This file is part of Open Source Scan Converter project.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
//`define DEBUG
|
||||
|
||||
module linebuf_top (
|
||||
input PCLK_CAP_i,
|
||||
input PCLK_OUT_i,
|
||||
input [7:0] R_i,
|
||||
input [7:0] G_i,
|
||||
input [7:0] B_i,
|
||||
input DE_i,
|
||||
input datavalid_i,
|
||||
input [11:0] h_in_active,
|
||||
input [10:0] xpos_i,
|
||||
input [10:0] ypos_i,
|
||||
input [10:0] xpos_lb,
|
||||
input [10:0] ypos_lb,
|
||||
input [10:0] ypos_lb_next,
|
||||
input line_id,
|
||||
input lb_enable,
|
||||
output [7:0] R_linebuf,
|
||||
output [7:0] G_linebuf,
|
||||
output [7:0] B_linebuf,
|
||||
// optional EMIF if
|
||||
input emif_br_clk,
|
||||
input emif_br_reset,
|
||||
output reg [27:0] emif_rd_addr,
|
||||
output reg emif_rd_read,
|
||||
input [255:0] emif_rd_rdata,
|
||||
input emif_rd_waitrequest,
|
||||
input emif_rd_readdatavalid,
|
||||
output reg [5:0] emif_rd_burstcount,
|
||||
output [27:0] emif_wr_addr,
|
||||
output reg emif_wr_write,
|
||||
output [255:0] emif_wr_wdata,
|
||||
input emif_wr_waitrequest,
|
||||
output reg [5:0] emif_wr_burstcount
|
||||
);
|
||||
|
||||
parameter EMIF_ENABLE = 0;
|
||||
parameter NUM_LINE_BUFFERS = 32;
|
||||
|
||||
|
||||
localparam EMIF_WR_MAXBURST = 32;
|
||||
localparam EMIF_RD_MAXBURST = 32;
|
||||
|
||||
generate
|
||||
if (EMIF_ENABLE) begin
|
||||
|
||||
`ifdef DEBUG
|
||||
reg [10:0] emif_wr_stall_ctr /* synthesis noprune */;
|
||||
reg [10:0] emif_rd_stall_ctr /* synthesis noprune */;
|
||||
reg emif_rd_line_missed /* synthesis noprune */;
|
||||
|
||||
always @(posedge emif_br_clk) begin
|
||||
if (emif_wr_write & emif_wr_waitrequest & (emif_wr_stall_ctr != 2047))
|
||||
emif_wr_stall_ctr <= emif_wr_stall_ctr + 1'b1;
|
||||
else
|
||||
emif_wr_stall_ctr <= 0;
|
||||
|
||||
if (emif_rd_burstcount > 0) begin
|
||||
if (emif_rd_readdatavalid)
|
||||
emif_rd_stall_ctr <= 0;
|
||||
else
|
||||
emif_rd_stall_ctr <= emif_rd_stall_ctr + 1'b1;
|
||||
end
|
||||
end
|
||||
`endif
|
||||
|
||||
// Number of 8-pixel blocks per line
|
||||
wire [8:0] blocks_per_line = (h_in_active / 8) + (h_in_active[2:0] != 3'h0);
|
||||
|
||||
/* ------------------------------ EMIF WR interface ------------------------------ */
|
||||
|
||||
// PCLK_CAP_i related signals
|
||||
reg [8:0] emif_wr_fifo_blksleft;
|
||||
reg [19:0] emif_wr_fifo_addr; // [19:9] = y_pos; [8:0] = x_pos_x8
|
||||
reg [23:0] emif_wr_fifo_pixs[7:0] /* synthesis ramstyle = "logic" */;
|
||||
reg emif_wr_fifo_wrreq;
|
||||
reg [8:0] blocks_inserted;
|
||||
reg DE_prev;
|
||||
wire emif_wr_fifo_wrfull;
|
||||
|
||||
// emif_br_clk related signals
|
||||
wire [8:0] emif_wr_fifo_blksleft_q;
|
||||
reg [8:0] emif_wr_blksleft;
|
||||
wire [19:0] emif_wr_fifo_addr_q;
|
||||
wire [23:0] emif_wr_fifo_pixs_q[7:0];
|
||||
reg emif_wr_fifo_iniread_prev;
|
||||
wire emif_wr_fifo_rdempty;
|
||||
wire [8:0] emif_wr_fifo_rdusedw;
|
||||
wire emif_wr_fifo_iniread = (lb_enable & (emif_wr_blksleft == 0) & !emif_wr_fifo_iniread_prev & !emif_wr_fifo_rdempty);
|
||||
wire emif_wr_fifo_rdreq = emif_wr_fifo_iniread | ((emif_wr_burstcount > 1) & !emif_wr_waitrequest);
|
||||
|
||||
assign emif_wr_addr = {3'b001, emif_wr_fifo_addr_q, 5'h0};
|
||||
assign emif_wr_wdata = {8'h0, emif_wr_fifo_pixs_q[0], 8'h0, emif_wr_fifo_pixs_q[1], 8'h0, emif_wr_fifo_pixs_q[2], 8'h0, emif_wr_fifo_pixs_q[3],
|
||||
8'h0, emif_wr_fifo_pixs_q[4], 8'h0, emif_wr_fifo_pixs_q[5], 8'h0, emif_wr_fifo_pixs_q[6], 8'h0, emif_wr_fifo_pixs_q[7]};
|
||||
|
||||
dc_fifo_emif_wr dc_fifo_emif_wr_inst (
|
||||
.data({emif_wr_fifo_blksleft, emif_wr_fifo_addr,
|
||||
emif_wr_fifo_pixs[0], emif_wr_fifo_pixs[1], emif_wr_fifo_pixs[2], emif_wr_fifo_pixs[3],
|
||||
emif_wr_fifo_pixs[4], emif_wr_fifo_pixs[5], emif_wr_fifo_pixs[6], emif_wr_fifo_pixs[7]}),
|
||||
.rdclk(emif_br_clk),
|
||||
.rdreq(emif_wr_fifo_rdreq),
|
||||
.rdempty(emif_wr_fifo_rdempty),
|
||||
.rdusedw(emif_wr_fifo_rdusedw),
|
||||
.wrclk(PCLK_CAP_i),
|
||||
.wrreq(emif_wr_fifo_wrreq),
|
||||
.wrfull(emif_wr_fifo_wrfull),
|
||||
.q({emif_wr_fifo_blksleft_q, emif_wr_fifo_addr_q,
|
||||
emif_wr_fifo_pixs_q[0], emif_wr_fifo_pixs_q[1], emif_wr_fifo_pixs_q[2], emif_wr_fifo_pixs_q[3],
|
||||
emif_wr_fifo_pixs_q[4], emif_wr_fifo_pixs_q[5], emif_wr_fifo_pixs_q[6], emif_wr_fifo_pixs_q[7]})
|
||||
);
|
||||
|
||||
always @(posedge PCLK_CAP_i) begin
|
||||
emif_wr_fifo_wrreq <= 1'b0;
|
||||
|
||||
if (datavalid_i) begin
|
||||
emif_wr_fifo_pixs[xpos_i[2:0]] <= {R_i, G_i, B_i};
|
||||
DE_prev <= DE_i;
|
||||
|
||||
if (~DE_prev & DE_i)
|
||||
blocks_inserted <= 0;
|
||||
|
||||
if ((blocks_inserted < blocks_per_line) & ~emif_wr_fifo_wrfull & (xpos_i[2:0] == 3'h7)) begin
|
||||
emif_wr_fifo_blksleft <= blocks_per_line - blocks_inserted;
|
||||
emif_wr_fifo_addr[19:9] <= ypos_i;
|
||||
emif_wr_fifo_addr[7:0] <= xpos_i[10:3];
|
||||
emif_wr_fifo_wrreq <= 1'b1;
|
||||
blocks_inserted <= blocks_inserted + 1'b1;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
always @(posedge emif_br_clk or posedge emif_br_reset) begin
|
||||
if (emif_br_reset) begin
|
||||
emif_wr_write <= 1'b0;
|
||||
emif_wr_burstcount <= 1'b0;
|
||||
end else begin
|
||||
if (emif_wr_burstcount > 0) begin
|
||||
if (!emif_wr_waitrequest) begin
|
||||
emif_wr_burstcount <= emif_wr_burstcount - 1'b1;
|
||||
if (emif_wr_burstcount == 1) begin
|
||||
emif_wr_blksleft <= 0;
|
||||
emif_wr_write <= 1'b0;
|
||||
end
|
||||
end
|
||||
end else if (lb_enable & (emif_wr_blksleft > 0) & ((emif_wr_fifo_rdusedw >= emif_wr_blksleft-1) | (emif_wr_fifo_rdusedw >= 31))) begin
|
||||
emif_wr_write <= 1'b1;
|
||||
emif_wr_burstcount <= (emif_wr_blksleft > EMIF_WR_MAXBURST) ? EMIF_WR_MAXBURST : emif_wr_blksleft;
|
||||
end else if (emif_wr_fifo_iniread_prev) begin
|
||||
emif_wr_blksleft <= emif_wr_fifo_blksleft_q;
|
||||
end
|
||||
|
||||
emif_wr_fifo_iniread_prev <= emif_wr_fifo_iniread;
|
||||
end
|
||||
end
|
||||
|
||||
/* ------------------------------ EMIF RD interface ------------------------------ */
|
||||
|
||||
// PCLK_OUT_i related signals
|
||||
wire [12:0] linebuf_rdaddr = {xpos_lb + (line_id ? 2560 : 0)};
|
||||
|
||||
// emif_br_clk related signals
|
||||
reg [8:0] blocks_copied;
|
||||
wire linebuf_wren = emif_rd_readdatavalid;
|
||||
wire [191:0] linebuf_wrdata = {emif_rd_rdata[23:0], emif_rd_rdata[55:32], emif_rd_rdata[87:64], emif_rd_rdata[119:96],
|
||||
emif_rd_rdata[151:128], emif_rd_rdata[183:160], emif_rd_rdata[215:192], emif_rd_rdata[247:224]};
|
||||
wire [9:0] linebuf_wraddr = {blocks_copied + (line_id ? 0 : 320)};
|
||||
wire [19:0] emif_rd_block_addr = {ypos_lb_next, blocks_copied};
|
||||
reg line_id_brclk_sync1_reg, line_id_brclk_sync2_reg, line_id_brclk_sync3_reg;
|
||||
|
||||
|
||||
linebuf_double linebuf_rgb (
|
||||
.data(linebuf_wrdata),
|
||||
.rdaddress(linebuf_rdaddr),
|
||||
.rdclock(PCLK_OUT_i),
|
||||
.rdclocken(lb_enable),
|
||||
.wraddress(linebuf_wraddr),
|
||||
.wrclock(emif_br_clk),
|
||||
.wren(linebuf_wren),
|
||||
.wrclocken(lb_enable),
|
||||
.q({R_linebuf, G_linebuf, B_linebuf})
|
||||
);
|
||||
|
||||
// BRAM linebuffer operation
|
||||
always @(posedge emif_br_clk or posedge emif_br_reset) begin
|
||||
if (emif_br_reset) begin
|
||||
emif_rd_read <= 1'b0;
|
||||
emif_rd_burstcount <= 1'b0;
|
||||
end else begin
|
||||
if (emif_rd_burstcount > 0) begin // always finish read first, make sure doesn't last longer than line length
|
||||
if (emif_rd_readdatavalid) begin
|
||||
blocks_copied <= blocks_copied + 1'b1;
|
||||
emif_rd_burstcount <= emif_rd_burstcount - 1'b1;
|
||||
end
|
||||
if (!emif_rd_waitrequest)
|
||||
emif_rd_read <= 1'b0;
|
||||
`ifdef DEBUG
|
||||
emif_rd_line_missed <= (line_id_brclk_sync2_reg != line_id_brclk_sync3_reg);
|
||||
`endif
|
||||
end else if (line_id_brclk_sync2_reg != line_id_brclk_sync3_reg) begin
|
||||
blocks_copied <= 0;
|
||||
end else if (lb_enable & (blocks_copied < blocks_per_line)) begin
|
||||
emif_rd_read <= 1'b1;
|
||||
emif_rd_burstcount <= ((blocks_per_line-blocks_copied) > EMIF_RD_MAXBURST) ? EMIF_RD_MAXBURST : (blocks_per_line-blocks_copied);
|
||||
emif_rd_addr <= {3'b001, emif_rd_block_addr, 5'h0};
|
||||
end
|
||||
|
||||
line_id_brclk_sync1_reg <= line_id;
|
||||
line_id_brclk_sync2_reg <= line_id_brclk_sync1_reg;
|
||||
line_id_brclk_sync3_reg <= line_id_brclk_sync2_reg;
|
||||
end
|
||||
end
|
||||
|
||||
end else begin // EMIF_ENABLE
|
||||
|
||||
/* ------------------------------ BRAM lb interface ------------------------------ */
|
||||
|
||||
reg [5:0] ypos_wraddr;
|
||||
reg [10:0] ypos_prev;
|
||||
reg [10:0] xpos_wraddr;
|
||||
reg [23:0] linebuf_wrdata;
|
||||
reg linebuf_wren;
|
||||
|
||||
wire [16:0] linebuf_wraddr = {ypos_wraddr[($clog2(NUM_LINE_BUFFERS)-1):0], xpos_wraddr};
|
||||
wire [16:0] linebuf_rdaddr = {ypos_lb[($clog2(NUM_LINE_BUFFERS)-1):0], xpos_lb[10:0]};
|
||||
|
||||
|
||||
linebuf linebuf_rgb (
|
||||
.data(linebuf_wrdata),
|
||||
.rdaddress(linebuf_rdaddr),
|
||||
.rdclock(PCLK_OUT_i),
|
||||
.rdclocken(lb_enable),
|
||||
.wraddress(linebuf_wraddr),
|
||||
.wrclock(PCLK_CAP_i),
|
||||
.wren(linebuf_wren),
|
||||
.wrclocken(lb_enable),
|
||||
.q({R_linebuf, G_linebuf, B_linebuf})
|
||||
);
|
||||
|
||||
// Linebuffer write address calculation
|
||||
always @(posedge PCLK_CAP_i) begin
|
||||
if (ypos_i == 0) begin
|
||||
ypos_wraddr <= 0;
|
||||
end else if (ypos_i != ypos_prev) begin
|
||||
if (ypos_wraddr == NUM_LINE_BUFFERS-1)
|
||||
ypos_wraddr <= 0;
|
||||
else
|
||||
ypos_wraddr <= ypos_wraddr + 1'b1;
|
||||
end
|
||||
|
||||
xpos_wraddr <= xpos_i;
|
||||
ypos_prev <= ypos_i;
|
||||
linebuf_wrdata <= {R_i, G_i, B_i};
|
||||
linebuf_wren <= DE_i & datavalid_i;
|
||||
end
|
||||
|
||||
end
|
||||
endgenerate
|
||||
|
||||
endmodule
|
||||
@@ -1,117 +0,0 @@
|
||||
// megafunction wizard: %LPM_MULT%
|
||||
// GENERATION: STANDARD
|
||||
// VERSION: WM1.0
|
||||
// MODULE: lpm_mult
|
||||
|
||||
// ============================================================
|
||||
// File Name: lpm_mult_4_hybr_ref.v
|
||||
// Megafunction Name(s):
|
||||
// lpm_mult
|
||||
//
|
||||
// Simulation Library Files(s):
|
||||
// lpm
|
||||
// ============================================================
|
||||
// ************************************************************
|
||||
// THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
|
||||
//
|
||||
// 20.1.1 Build 720 11/11/2020 SJ Lite Edition
|
||||
// ************************************************************
|
||||
|
||||
|
||||
//Copyright (C) 2020 Intel Corporation. All rights reserved.
|
||||
//Your use of Intel Corporation's design tools, logic functions
|
||||
//and other software and tools, and any partner logic
|
||||
//functions, and any output files from any of the foregoing
|
||||
//(including device programming or simulation files), and any
|
||||
//associated documentation or information are expressly subject
|
||||
//to the terms and conditions of the Intel Program License
|
||||
//Subscription Agreement, the Intel Quartus Prime License Agreement,
|
||||
//the Intel FPGA IP License Agreement, or other applicable license
|
||||
//agreement, including, without limitation, that your use is for
|
||||
//the sole purpose of programming logic devices manufactured by
|
||||
//Intel and sold by Intel or its authorized distributors. Please
|
||||
//refer to the applicable agreement for further details, at
|
||||
//https://fpgasoftware.intel.com/eula.
|
||||
|
||||
|
||||
// synopsys translate_off
|
||||
`timescale 1 ps / 1 ps
|
||||
// synopsys translate_on
|
||||
module lpm_mult_4_hybr_ref (
|
||||
clock,
|
||||
dataa,
|
||||
datab,
|
||||
result);
|
||||
|
||||
input clock;
|
||||
input [8:0] dataa;
|
||||
input [7:0] datab;
|
||||
output [8:0] result;
|
||||
|
||||
wire [8:0] sub_wire0;
|
||||
wire [8:0] result = sub_wire0[8:0];
|
||||
|
||||
lpm_mult lpm_mult_component (
|
||||
.clock (clock),
|
||||
.dataa (dataa),
|
||||
.datab (datab),
|
||||
.result (sub_wire0),
|
||||
.aclr (1'b0),
|
||||
.clken (1'b1),
|
||||
.sclr (1'b0),
|
||||
.sum (1'b0));
|
||||
defparam
|
||||
lpm_mult_component.lpm_hint = "MAXIMIZE_SPEED=9",
|
||||
lpm_mult_component.lpm_pipeline = 1,
|
||||
lpm_mult_component.lpm_representation = "UNSIGNED",
|
||||
lpm_mult_component.lpm_type = "LPM_MULT",
|
||||
lpm_mult_component.lpm_widtha = 9,
|
||||
lpm_mult_component.lpm_widthb = 8,
|
||||
lpm_mult_component.lpm_widthp = 9;
|
||||
|
||||
|
||||
endmodule
|
||||
|
||||
// ============================================================
|
||||
// CNX file retrieval info
|
||||
// ============================================================
|
||||
// Retrieval info: PRIVATE: AutoSizeResult NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: B_isConstant NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: ConstantB NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone IV E"
|
||||
// Retrieval info: PRIVATE: LPM_PIPELINE NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: Latency NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0"
|
||||
// Retrieval info: PRIVATE: SignedMult NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: USE_MULT NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: ValidConstant NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: WidthA NUMERIC "9"
|
||||
// Retrieval info: PRIVATE: WidthB NUMERIC "8"
|
||||
// Retrieval info: PRIVATE: WidthP NUMERIC "9"
|
||||
// Retrieval info: PRIVATE: aclr NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: clken NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: new_diagram STRING "1"
|
||||
// Retrieval info: PRIVATE: optimize NUMERIC "1"
|
||||
// Retrieval info: LIBRARY: lpm lpm.lpm_components.all
|
||||
// Retrieval info: CONSTANT: LPM_HINT STRING "MAXIMIZE_SPEED=9"
|
||||
// Retrieval info: CONSTANT: LPM_PIPELINE NUMERIC "1"
|
||||
// Retrieval info: CONSTANT: LPM_REPRESENTATION STRING "UNSIGNED"
|
||||
// Retrieval info: CONSTANT: LPM_TYPE STRING "LPM_MULT"
|
||||
// Retrieval info: CONSTANT: LPM_WIDTHA NUMERIC "9"
|
||||
// Retrieval info: CONSTANT: LPM_WIDTHB NUMERIC "8"
|
||||
// Retrieval info: CONSTANT: LPM_WIDTHP NUMERIC "9"
|
||||
// Retrieval info: USED_PORT: clock 0 0 0 0 INPUT NODEFVAL "clock"
|
||||
// Retrieval info: USED_PORT: dataa 0 0 9 0 INPUT NODEFVAL "dataa[8..0]"
|
||||
// Retrieval info: USED_PORT: datab 0 0 8 0 INPUT NODEFVAL "datab[7..0]"
|
||||
// Retrieval info: USED_PORT: result 0 0 9 0 OUTPUT NODEFVAL "result[8..0]"
|
||||
// Retrieval info: CONNECT: @clock 0 0 0 0 clock 0 0 0 0
|
||||
// Retrieval info: CONNECT: @dataa 0 0 9 0 dataa 0 0 9 0
|
||||
// Retrieval info: CONNECT: @datab 0 0 8 0 datab 0 0 8 0
|
||||
// Retrieval info: CONNECT: result 0 0 9 0 @result 0 0 9 0
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_hybr_ref.v TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_hybr_ref.inc FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_hybr_ref.cmp FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_hybr_ref.bsf FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_hybr_ref_inst.v FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_hybr_ref_bb.v TRUE
|
||||
// Retrieval info: LIB_FILE: lpm
|
||||
@@ -1,5 +0,0 @@
|
||||
set_global_assignment -name IP_TOOL_NAME "LPM_MULT"
|
||||
set_global_assignment -name IP_TOOL_VERSION "20.1"
|
||||
set_global_assignment -name IP_GENERATED_DEVICE_FAMILY "{Cyclone IV E}"
|
||||
set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "lpm_mult_4_hybr_ref_pre.v"]
|
||||
set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "lpm_mult_4_hybr_ref_pre_bb.v"]
|
||||
@@ -1,5 +1,4 @@
|
||||
set_global_assignment -name IP_TOOL_NAME "LPM_MULT"
|
||||
set_global_assignment -name IP_TOOL_VERSION "20.1"
|
||||
set_global_assignment -name IP_TOOL_VERSION "24.1"
|
||||
set_global_assignment -name IP_GENERATED_DEVICE_FAMILY "{Cyclone IV E}"
|
||||
set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "lpm_mult_4_sl.v"]
|
||||
set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "lpm_mult_4_sl_bb.v"]
|
||||
set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "lpm_mult_8x5_9.v"]
|
||||
@@ -4,7 +4,7 @@
|
||||
// MODULE: lpm_mult
|
||||
|
||||
// ============================================================
|
||||
// File Name: lpm_mult_4_hybr_ref_pre.v
|
||||
// File Name: lpm_mult_8x5_9.v
|
||||
// Megafunction Name(s):
|
||||
// lpm_mult
|
||||
//
|
||||
@@ -14,30 +14,30 @@
|
||||
// ************************************************************
|
||||
// THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
|
||||
//
|
||||
// 20.1.1 Build 720 11/11/2020 SJ Lite Edition
|
||||
// 24.1std.0 Build 1077 03/04/2025 SC Lite Edition
|
||||
// ************************************************************
|
||||
|
||||
|
||||
//Copyright (C) 2020 Intel Corporation. All rights reserved.
|
||||
//Your use of Intel Corporation's design tools, logic functions
|
||||
//Copyright (C) 2025 Altera Corporation. All rights reserved.
|
||||
//Your use of Altera Corporation's design tools, logic functions
|
||||
//and other software and tools, and any partner logic
|
||||
//functions, and any output files from any of the foregoing
|
||||
//(including device programming or simulation files), and any
|
||||
//associated documentation or information are expressly subject
|
||||
//to the terms and conditions of the Intel Program License
|
||||
//Subscription Agreement, the Intel Quartus Prime License Agreement,
|
||||
//the Intel FPGA IP License Agreement, or other applicable license
|
||||
//to the terms and conditions of the Altera Program License
|
||||
//Subscription Agreement, the Altera Quartus Prime License Agreement,
|
||||
//the Altera IP License Agreement, or other applicable license
|
||||
//agreement, including, without limitation, that your use is for
|
||||
//the sole purpose of programming logic devices manufactured by
|
||||
//Intel and sold by Intel or its authorized distributors. Please
|
||||
//refer to the applicable agreement for further details, at
|
||||
//https://fpgasoftware.intel.com/eula.
|
||||
//Altera and sold by Altera or its authorized distributors. Please
|
||||
//refer to the Altera Software License Subscription Agreements
|
||||
//on the Quartus Prime software download page.
|
||||
|
||||
|
||||
// synopsys translate_off
|
||||
`timescale 1 ps / 1 ps
|
||||
// synopsys translate_on
|
||||
module lpm_mult_4_hybr_ref_pre (
|
||||
module lpm_mult_8x5_9 (
|
||||
clock,
|
||||
dataa,
|
||||
datab,
|
||||
@@ -108,10 +108,10 @@ endmodule
|
||||
// Retrieval info: CONNECT: @dataa 0 0 8 0 dataa 0 0 8 0
|
||||
// Retrieval info: CONNECT: @datab 0 0 5 0 datab 0 0 5 0
|
||||
// Retrieval info: CONNECT: result 0 0 9 0 @result 0 0 9 0
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_hybr_ref_pre.v TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_hybr_ref_pre.inc FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_hybr_ref_pre.cmp FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_hybr_ref_pre.bsf FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_hybr_ref_pre_inst.v FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_hybr_ref_pre_bb.v TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_8x5_9.v TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_8x5_9.inc FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_8x5_9.cmp FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_8x5_9.bsf FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_8x5_9_inst.v FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_8x5_9_bb.v FALSE
|
||||
// Retrieval info: LIB_FILE: lpm
|
||||
@@ -1,5 +1,4 @@
|
||||
set_global_assignment -name IP_TOOL_NAME "LPM_MULT"
|
||||
set_global_assignment -name IP_TOOL_VERSION "20.1"
|
||||
set_global_assignment -name IP_TOOL_VERSION "24.1"
|
||||
set_global_assignment -name IP_GENERATED_DEVICE_FAMILY "{Cyclone IV E}"
|
||||
set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "lpm_mult_4_hybr_ref.v"]
|
||||
set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "lpm_mult_4_hybr_ref_bb.v"]
|
||||
set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "lpm_mult_sl.v"]
|
||||
@@ -4,7 +4,7 @@
|
||||
// MODULE: lpm_mult
|
||||
|
||||
// ============================================================
|
||||
// File Name: lpm_mult_4_sl.v
|
||||
// File Name: lpm_mult_sl.v
|
||||
// Megafunction Name(s):
|
||||
// lpm_mult
|
||||
//
|
||||
@@ -14,30 +14,30 @@
|
||||
// ************************************************************
|
||||
// THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
|
||||
//
|
||||
// 20.1.1 Build 720 11/11/2020 SJ Lite Edition
|
||||
// 24.1std.0 Build 1077 03/04/2025 SC Lite Edition
|
||||
// ************************************************************
|
||||
|
||||
|
||||
//Copyright (C) 2020 Intel Corporation. All rights reserved.
|
||||
//Your use of Intel Corporation's design tools, logic functions
|
||||
//Copyright (C) 2025 Altera Corporation. All rights reserved.
|
||||
//Your use of Altera Corporation's design tools, logic functions
|
||||
//and other software and tools, and any partner logic
|
||||
//functions, and any output files from any of the foregoing
|
||||
//(including device programming or simulation files), and any
|
||||
//associated documentation or information are expressly subject
|
||||
//to the terms and conditions of the Intel Program License
|
||||
//Subscription Agreement, the Intel Quartus Prime License Agreement,
|
||||
//the Intel FPGA IP License Agreement, or other applicable license
|
||||
//to the terms and conditions of the Altera Program License
|
||||
//Subscription Agreement, the Altera Quartus Prime License Agreement,
|
||||
//the Altera IP License Agreement, or other applicable license
|
||||
//agreement, including, without limitation, that your use is for
|
||||
//the sole purpose of programming logic devices manufactured by
|
||||
//Intel and sold by Intel or its authorized distributors. Please
|
||||
//refer to the applicable agreement for further details, at
|
||||
//https://fpgasoftware.intel.com/eula.
|
||||
//Altera and sold by Altera or its authorized distributors. Please
|
||||
//refer to the Altera Software License Subscription Agreements
|
||||
//on the Quartus Prime software download page.
|
||||
|
||||
|
||||
// synopsys translate_off
|
||||
`timescale 1 ps / 1 ps
|
||||
// synopsys translate_on
|
||||
module lpm_mult_4_sl (
|
||||
module lpm_mult_sl (
|
||||
clock,
|
||||
dataa,
|
||||
datab,
|
||||
@@ -61,7 +61,7 @@ module lpm_mult_4_sl (
|
||||
.sclr (1'b0),
|
||||
.sum (1'b0));
|
||||
defparam
|
||||
lpm_mult_component.lpm_hint = "MAXIMIZE_SPEED=9",
|
||||
lpm_mult_component.lpm_hint = "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
|
||||
lpm_mult_component.lpm_pipeline = 1,
|
||||
lpm_mult_component.lpm_representation = "UNSIGNED",
|
||||
lpm_mult_component.lpm_type = "LPM_MULT",
|
||||
@@ -93,7 +93,7 @@ endmodule
|
||||
// Retrieval info: PRIVATE: new_diagram STRING "1"
|
||||
// Retrieval info: PRIVATE: optimize NUMERIC "1"
|
||||
// Retrieval info: LIBRARY: lpm lpm.lpm_components.all
|
||||
// Retrieval info: CONSTANT: LPM_HINT STRING "MAXIMIZE_SPEED=9"
|
||||
// Retrieval info: CONSTANT: LPM_HINT STRING "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9"
|
||||
// Retrieval info: CONSTANT: LPM_PIPELINE NUMERIC "1"
|
||||
// Retrieval info: CONSTANT: LPM_REPRESENTATION STRING "UNSIGNED"
|
||||
// Retrieval info: CONSTANT: LPM_TYPE STRING "LPM_MULT"
|
||||
@@ -108,10 +108,10 @@ endmodule
|
||||
// Retrieval info: CONNECT: @dataa 0 0 8 0 dataa 0 0 8 0
|
||||
// Retrieval info: CONNECT: @datab 0 0 8 0 datab 0 0 8 0
|
||||
// Retrieval info: CONNECT: result 0 0 8 0 @result 0 0 8 0
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_sl.v TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_sl.inc FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_sl.cmp FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_sl.bsf FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_sl_inst.v FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_4_sl_bb.v TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_sl.v TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_sl.inc FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_sl.cmp FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_sl.bsf FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_sl_inst.v FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL lpm_mult_sl_bb.v FALSE
|
||||
// Retrieval info: LIB_FILE: lpm
|
||||
+352
-194
@@ -22,17 +22,22 @@
|
||||
|
||||
module ossc (
|
||||
input clk27,
|
||||
input ir_rx,
|
||||
|
||||
inout scl,
|
||||
inout sda,
|
||||
|
||||
input ir_rx,
|
||||
input [1:0] btn,
|
||||
input [7:0] R_in,
|
||||
input [7:0] G_in,
|
||||
input [7:0] B_in,
|
||||
input FID_in,
|
||||
input VSYNC_in,
|
||||
input HSYNC_in,
|
||||
input PCLK_in,
|
||||
input [1:0] cfg,
|
||||
|
||||
input TVP_PCLK_i,
|
||||
input [7:0] TVP_R_i,
|
||||
input [7:0] TVP_G_i,
|
||||
input [7:0] TVP_B_i,
|
||||
input TVP_HS_i,
|
||||
input TVP_SOG_i,
|
||||
input TVP_VSYNC_i,
|
||||
|
||||
output HDMI_TX_PCLK,
|
||||
output reg [7:0] HDMI_TX_RD,
|
||||
output reg [7:0] HDMI_TX_GD,
|
||||
@@ -41,119 +46,198 @@ module ossc (
|
||||
output reg HDMI_TX_HS,
|
||||
output reg HDMI_TX_VS,
|
||||
input HDMI_TX_INT_N,
|
||||
input HDMI_TX_MODE,
|
||||
|
||||
output hw_reset_n,
|
||||
|
||||
output LED_G,
|
||||
output LED_R,
|
||||
inout LED_R,
|
||||
|
||||
output LCD_RS,
|
||||
output LCD_CS_N,
|
||||
output LCD_BL,
|
||||
|
||||
output SD_CLK,
|
||||
inout SD_CMD,
|
||||
inout [3:0] SD_DAT
|
||||
);
|
||||
|
||||
|
||||
wire [15:0] sys_ctrl;
|
||||
wire h_unstable, pll_lock_lost;
|
||||
wire [31:0] h_config, h_config2, v_config, misc_config, sl_config, sl_config2;
|
||||
wire [10:0] vmax, vmax_tvp;
|
||||
wire [1:0] fpga_vsyncgen;
|
||||
wire ilace_flag, vsync_flag;
|
||||
wire [19:0] pcnt_frame;
|
||||
wire [31:0] sys_ctrl;
|
||||
wire lt_active = sys_ctrl[15];
|
||||
wire lt_armed = sys_ctrl[14];
|
||||
wire [1:0] lt_mode = sys_ctrl[13:12];
|
||||
wire tvp_vsync_type = sys_ctrl[10];
|
||||
wire pll_bypass = sys_ctrl[9];
|
||||
wire remote_event = sys_ctrl[8];
|
||||
assign SD_DAT[3] = sys_ctrl[7]; //SD_SPI_SS_N
|
||||
assign LCD_CS_N = sys_ctrl[6];
|
||||
assign LCD_RS = sys_ctrl[5];
|
||||
wire lcd_bl_on = sys_ctrl[4]; //hw_reset_n in v1.2 PCB
|
||||
wire [1:0] lcd_bl_time = sys_ctrl[3:2];
|
||||
wire enable_sc = sys_ctrl[1];
|
||||
assign hw_reset_n = sys_ctrl[0]; //HDMI_TX_RST_N in v1.2 PCB
|
||||
|
||||
wire [31:0] hv_in_config, hv_in_config2, hv_in_config3, hv_out_config, hv_out_config2, hv_out_config3, xy_out_config, xy_out_config2;
|
||||
wire [31:0] misc_config, sl_config, sl_config2, sl_config3;
|
||||
|
||||
wire pll_clkout, pll_clkswitch, pll_locked;
|
||||
wire clkmux_clkout;
|
||||
|
||||
wire [15:0] ir_code;
|
||||
wire [7:0] ir_code_cnt;
|
||||
|
||||
wire [7:0] R_out_sc, G_out_sc, B_out_sc;
|
||||
wire HSYNC_out_sc;
|
||||
wire VSYNC_out_sc;
|
||||
wire PCLK_out;
|
||||
wire DE_out_sc;
|
||||
|
||||
wire [7:0] R_out_vg, G_out_vg, B_out_vg;
|
||||
wire HSYNC_out_vg;
|
||||
wire VSYNC_out_vg;
|
||||
wire DE_out_vg;
|
||||
wire [7:0] R_sc, G_sc, B_sc;
|
||||
wire HSYNC_sc, VSYNC_sc, DE_sc;
|
||||
wire pll_areset, pll_scanclk, pll_scanclkena, pll_configupdate, pll_scandata, pll_scandone, pll_activeclock;
|
||||
wire PCLK_sc;
|
||||
wire pclk_out = PCLK_sc;
|
||||
|
||||
|
||||
reg [7:0] po_reset_ctr = 0;
|
||||
reg po_reset_n = 1'b0;
|
||||
wire jtagm_reset_req;
|
||||
wire sys_reset_n = (po_reset_n & ~jtagm_reset_req);
|
||||
wire jtagm_reset_req, ndmreset_req;
|
||||
reg ndmreset_ack, ndmreset_pulse;
|
||||
wire sys_reset_n = (po_reset_n & ~jtagm_reset_req & ~ndmreset_pulse);
|
||||
|
||||
reg [7:0] R_in_L, G_in_L, B_in_L;
|
||||
reg HSYNC_in_L, VSYNC_in_L, FID_in_L;
|
||||
reg [7:0] TVP_R, TVP_G, TVP_B;
|
||||
reg TVP_HS, TVP_VS, TVP_FID;
|
||||
reg TVP_VS_sync1_reg, TVP_VS_sync2_reg;
|
||||
reg TVP_SOG_sync1_reg, TVP_SOG_sync2_reg, TVP_SOG_prev;
|
||||
reg TVP_HSYNC_sync1_reg, TVP_HSYNC_sync2_reg;
|
||||
reg TVP_VSYNC_sync1_reg, TVP_VSYNC_sync2_reg;
|
||||
|
||||
reg [1:0] btn_L, btn_LL;
|
||||
reg ir_rx_L, ir_rx_LL, HDMI_TX_INT_N_L, HDMI_TX_INT_N_LL, HDMI_TX_MODE_L, HDMI_TX_MODE_LL;
|
||||
reg ir_rx_L, ir_rx_LL, HDMI_TX_INT_N_L, HDMI_TX_INT_N_LL;
|
||||
reg vsync_flag_sync1_reg, vsync_flag_sync2_reg;
|
||||
reg [1:0] cfg_reg;
|
||||
reg cfg_stored;
|
||||
wire TVP_SOG_ALT_i;
|
||||
wire TVP_HSYNC_i = cfg_reg[1] ? TVP_SOG_i : TVP_SOG_ALT_i;
|
||||
|
||||
reg [23:0] resync_led_ctr, warn_pll_lock_lost;
|
||||
reg resync_strobe_sync1_reg, resync_strobe_sync2_reg, resync_strobe_prev;
|
||||
wire resync_strobe_i;
|
||||
wire resync_strobe = resync_strobe_sync2_reg;
|
||||
|
||||
wire [31:0] controls = {ir_code_cnt, 3'b000, vsync_flag_sync2_reg, pll_activeclock, cfg_reg[0], btn_LL, ir_code};
|
||||
|
||||
wire lt_sensor = btn_LL[1];
|
||||
wire lt_active = sys_ctrl[15];
|
||||
wire lt_armed = sys_ctrl[14];
|
||||
wire lt_trigger = HDMI_TX_DE & HDMI_TX_GD[0];
|
||||
wire [1:0] lt_mode = sys_ctrl[13:12];
|
||||
wire lt_trigger = DE_sc & G_sc[0];
|
||||
wire [1:0] lt_mode_synced;
|
||||
wire [15:0] lt_lat_result;
|
||||
wire [11:0] lt_stb_result;
|
||||
wire lt_trig_waiting;
|
||||
wire lt_finished;
|
||||
|
||||
wire remote_event = sys_ctrl[8];
|
||||
reg remove_event_prev;
|
||||
wire [31:0] lumacode_data;
|
||||
wire [7:0] lumacode_addr;
|
||||
wire lumacode_rden;
|
||||
|
||||
reg remote_event_prev;
|
||||
reg [14:0] to_ctr, to_ctr_ms;
|
||||
wire lcd_bl_timeout;
|
||||
|
||||
wire [1:0] osd_color;
|
||||
wire [2:0] osd_color;
|
||||
wire osd_enable_pre;
|
||||
wire osd_enable = osd_enable_pre & ~lt_active;
|
||||
wire [10:0] xpos, xpos_sc, xpos_vg;
|
||||
wire [10:0] ypos, ypos_sc, ypos_vg;
|
||||
wire [11:0] xpos_sc;
|
||||
wire [10:0] ypos_sc;
|
||||
wire [3:0] x_ctr_shmask, y_ctr_shmask;
|
||||
wire [10:0] shmask_data;
|
||||
|
||||
wire pll_areset, pll_scanclk, pll_scanclkena, pll_configupdate, pll_scandata, pll_scandone, pll_activeclock;
|
||||
wire resync_indicator = (warn_pll_lock_lost != 0) | (resync_led_ctr != 0);
|
||||
wire LED_R_i = lt_active ? lt_trig_waiting : resync_indicator;
|
||||
assign LED_G = lt_active ? ~lt_sensor : (ir_code == 0) & (~resync_indicator | cfg_reg[1]);
|
||||
|
||||
assign LCD_BL = lcd_bl_on ? (~lcd_bl_timeout | lt_active) : 1'b0;
|
||||
assign HDMI_TX_PCLK = pclk_out;
|
||||
|
||||
|
||||
// Latch inputs from TVP7002 (synchronized to PCLK_in)
|
||||
always @(posedge PCLK_in or negedge hw_reset_n)
|
||||
begin
|
||||
if (!hw_reset_n) begin
|
||||
R_in_L <= 8'h00;
|
||||
G_in_L <= 8'h00;
|
||||
B_in_L <= 8'h00;
|
||||
HSYNC_in_L <= 1'b0;
|
||||
VSYNC_in_L <= 1'b0;
|
||||
FID_in_L <= 1'b0;
|
||||
end else begin
|
||||
R_in_L <= R_in;
|
||||
G_in_L <= G_in;
|
||||
B_in_L <= B_in;
|
||||
HSYNC_in_L <= HSYNC_in;
|
||||
VSYNC_in_L <= VSYNC_in;
|
||||
FID_in_L <= FID_in;
|
||||
end
|
||||
// TVP7002 RGB digitizer
|
||||
always @(posedge TVP_PCLK_i) begin
|
||||
TVP_R <= TVP_R_i;
|
||||
TVP_G <= TVP_G_i;
|
||||
TVP_B <= TVP_B_i;
|
||||
TVP_HS <= TVP_HS_i;
|
||||
TVP_VS <= TVP_VSYNC_i;
|
||||
|
||||
// sync to pclk
|
||||
TVP_SOG_sync1_reg <= TVP_HSYNC_i;
|
||||
TVP_SOG_sync2_reg <= TVP_SOG_sync1_reg;
|
||||
TVP_SOG_prev <= TVP_SOG_sync2_reg;
|
||||
TVP_VS_sync1_reg <= TVP_VSYNC_i;
|
||||
TVP_VS_sync2_reg <= TVP_VS_sync1_reg;
|
||||
end
|
||||
always @(posedge clk27) begin
|
||||
// sync to always-running fixed meas clk
|
||||
TVP_HSYNC_sync1_reg <= TVP_HSYNC_i;
|
||||
TVP_HSYNC_sync2_reg <= TVP_HSYNC_sync1_reg;
|
||||
TVP_VSYNC_sync1_reg <= TVP_VSYNC_i;
|
||||
TVP_VSYNC_sync2_reg <= TVP_VSYNC_sync1_reg;
|
||||
end
|
||||
|
||||
wire [7:0] TVP_R_post, TVP_G_post, TVP_B_post;
|
||||
wire TVP_HSYNC_post, TVP_VSYNC_post, TVP_DE_post, TVP_FID_post, TVP_datavalid_post;
|
||||
wire TVP_fe_interlace, TVP_fe_frame_change, TVP_sof_scaler, TVP_sync_active;
|
||||
wire [19:0] TVP_fe_pcnt_field;
|
||||
wire [7:0] TVP_hsync_width;
|
||||
wire [10:0] TVP_fe_vtotal, TVP_fe_xpos, TVP_fe_ypos;
|
||||
tvp7002_frontend u_tvp_frontend (
|
||||
.PCLK_i(TVP_PCLK_i),
|
||||
.CLK_MEAS_i(clk27),
|
||||
.reset_n(sys_reset_n),
|
||||
.R_i(TVP_R),
|
||||
.G_i(TVP_G),
|
||||
.B_i(TVP_B),
|
||||
.HS_i(TVP_HS),
|
||||
.VS_i(TVP_VS_sync2_reg),
|
||||
.HSYNC_i(TVP_HSYNC_sync2_reg),
|
||||
.VSYNC_i(TVP_VSYNC_sync2_reg),
|
||||
.DE_i(1'b0),
|
||||
.FID_i(1'b0),
|
||||
.sogref_update_i(TVP_SOG_prev & ~TVP_SOG_sync2_reg),
|
||||
.vsync_i_type(tvp_vsync_type),
|
||||
.hv_in_config(hv_in_config),
|
||||
.hv_in_config2(hv_in_config2),
|
||||
.hv_in_config3(hv_in_config3),
|
||||
.misc_config(misc_config),
|
||||
.lumacode_data(lumacode_data),
|
||||
.R_o(TVP_R_post),
|
||||
.G_o(TVP_G_post),
|
||||
.B_o(TVP_B_post),
|
||||
.HSYNC_o(TVP_HSYNC_post),
|
||||
.VSYNC_o(TVP_VSYNC_post),
|
||||
.DE_o(TVP_DE_post),
|
||||
.FID_o(TVP_FID_post),
|
||||
.interlace_flag(TVP_fe_interlace),
|
||||
.datavalid_o(TVP_datavalid_post),
|
||||
.xpos_o(TVP_fe_xpos),
|
||||
.ypos_o(TVP_fe_ypos),
|
||||
.vtotal(TVP_fe_vtotal),
|
||||
.frame_change(TVP_fe_frame_change),
|
||||
.sof_scaler(TVP_sof_scaler),
|
||||
.pcnt_field(TVP_fe_pcnt_field),
|
||||
.hsync_width(TVP_hsync_width),
|
||||
.sync_active(TVP_sync_active),
|
||||
.lumacode_addr(lumacode_addr),
|
||||
.lumacode_rden(lumacode_rden)
|
||||
);
|
||||
|
||||
// Insert synchronizers to async inputs (synchronize to CPU clock)
|
||||
always @(posedge clk27 or negedge po_reset_n)
|
||||
begin
|
||||
if (!po_reset_n) begin
|
||||
btn_L <= 2'b00;
|
||||
btn_LL <= 2'b00;
|
||||
ir_rx_L <= 1'b0;
|
||||
ir_rx_LL <= 1'b0;
|
||||
HDMI_TX_INT_N_L <= 1'b0;
|
||||
HDMI_TX_INT_N_LL <= 1'b0;
|
||||
HDMI_TX_MODE_L <= 1'b0;
|
||||
HDMI_TX_MODE_LL <= 1'b0;
|
||||
{btn_L, btn_LL} <= '0;
|
||||
{ir_rx_L, ir_rx_LL} <= '0;
|
||||
{HDMI_TX_INT_N_L, HDMI_TX_INT_N_LL} <= '0;
|
||||
{cfg_stored, cfg_reg} <= '0;
|
||||
end else begin
|
||||
btn_L <= btn;
|
||||
btn_LL <= btn_L;
|
||||
ir_rx_L <= ir_rx;
|
||||
ir_rx_LL <= ir_rx_L;
|
||||
HDMI_TX_INT_N_L <= HDMI_TX_INT_N;
|
||||
HDMI_TX_INT_N_LL <= HDMI_TX_INT_N_L;
|
||||
HDMI_TX_MODE_L <= HDMI_TX_MODE;
|
||||
HDMI_TX_MODE_LL <= HDMI_TX_MODE_L;
|
||||
{btn_L, btn_LL} <= {btn, btn_L};
|
||||
{ir_rx_L, ir_rx_LL} <= {ir_rx, ir_rx_L};
|
||||
{HDMI_TX_INT_N_L, HDMI_TX_INT_N_LL} <= {HDMI_TX_INT_N, HDMI_TX_INT_N_L};
|
||||
if (!cfg_stored)
|
||||
cfg_reg <= cfg;
|
||||
cfg_stored <= 1'b1;
|
||||
end
|
||||
end
|
||||
|
||||
@@ -166,55 +250,22 @@ begin
|
||||
po_reset_ctr <= po_reset_ctr + 1'b1;
|
||||
end
|
||||
|
||||
assign hw_reset_n = sys_ctrl[0]; //HDMI_TX_RST_N in v1.2 PCB
|
||||
// ndmreset pulse & ack for RISC-V DM
|
||||
always @(posedge clk27)
|
||||
begin
|
||||
ndmreset_pulse <= !ndmreset_ack & ndmreset_req;
|
||||
ndmreset_ack <= ndmreset_req;
|
||||
end
|
||||
|
||||
|
||||
`ifdef DEBUG
|
||||
assign LED_R = HSYNC_in_L;
|
||||
assign LED_G = VSYNC_in_L;
|
||||
`else
|
||||
assign LED_R = lt_active ? lt_trig_waiting : (pll_lock_lost|h_unstable);
|
||||
assign LED_G = lt_active ? ~lt_sensor : (ir_code == 0);
|
||||
`endif
|
||||
|
||||
assign SD_DAT[3] = sys_ctrl[7]; //SD_SPI_SS_N
|
||||
assign LCD_CS_N = sys_ctrl[6];
|
||||
assign LCD_RS = sys_ctrl[5];
|
||||
wire lcd_bl_on = sys_ctrl[4]; //hw_reset_n in v1.2 PCB
|
||||
wire [1:0] lcd_bl_time = sys_ctrl[3:2];
|
||||
assign LCD_BL = lcd_bl_on ? (~lcd_bl_timeout | lt_active) : 1'b0;
|
||||
|
||||
wire enable_sc = sys_ctrl[1];
|
||||
assign xpos = enable_sc ? xpos_sc : xpos_vg;
|
||||
assign ypos = enable_sc ? ypos_sc : ypos_vg;
|
||||
assign HDMI_TX_PCLK = PCLK_out;
|
||||
|
||||
always @(posedge PCLK_out) begin
|
||||
if (osd_enable) begin
|
||||
if (osd_color == 2'h0) begin
|
||||
{HDMI_TX_RD, HDMI_TX_GD, HDMI_TX_BD} <= 24'h000000;
|
||||
end else if (osd_color == 2'h1) begin
|
||||
{HDMI_TX_RD, HDMI_TX_GD, HDMI_TX_BD} <= 24'h0000ff;
|
||||
end else if (osd_color == 2'h2) begin
|
||||
{HDMI_TX_RD, HDMI_TX_GD, HDMI_TX_BD} <= 24'hffff00;
|
||||
end else begin
|
||||
{HDMI_TX_RD, HDMI_TX_GD, HDMI_TX_BD} <= 24'hffffff;
|
||||
end
|
||||
end else if (enable_sc) begin
|
||||
{HDMI_TX_RD, HDMI_TX_GD, HDMI_TX_BD} <= {R_out_sc, G_out_sc, B_out_sc};
|
||||
end else begin
|
||||
{HDMI_TX_RD, HDMI_TX_GD, HDMI_TX_BD} <= {R_out_vg, G_out_vg, B_out_vg};
|
||||
end
|
||||
|
||||
HDMI_TX_HS <= enable_sc ? HSYNC_out_sc : HSYNC_out_vg;
|
||||
HDMI_TX_VS <= enable_sc ? VSYNC_out_sc : VSYNC_out_vg;
|
||||
HDMI_TX_DE <= enable_sc ? DE_out_sc : DE_out_vg;
|
||||
// Sync vsync flag to CPU clock
|
||||
always @(posedge clk27) begin
|
||||
{vsync_flag_sync1_reg, vsync_flag_sync2_reg} <= {~VSYNC_sc, vsync_flag_sync1_reg};
|
||||
end
|
||||
|
||||
// LCD backlight timeout counters
|
||||
always @(posedge clk27)
|
||||
begin
|
||||
if (remote_event != remove_event_prev) begin
|
||||
if (remote_event != remote_event_prev) begin
|
||||
to_ctr <= 15'd0;
|
||||
to_ctr_ms <= 15'd0;
|
||||
end else begin
|
||||
@@ -234,17 +285,100 @@ begin
|
||||
2'b11: lcd_bl_timeout <= (to_ctr_ms >= 30000); //30s
|
||||
endcase
|
||||
|
||||
remove_event_prev <= remote_event;
|
||||
remote_event_prev <= remote_event;
|
||||
end
|
||||
|
||||
// Generate a warning signal from sync lock loss
|
||||
always @(posedge clk27) begin
|
||||
if (enable_sc) begin
|
||||
if (~resync_strobe_prev & resync_strobe) begin
|
||||
resync_led_ctr <= {24{1'b1}};
|
||||
end else if (resync_led_ctr > 0) begin
|
||||
resync_led_ctr <= resync_led_ctr - 1'b1;
|
||||
end
|
||||
end
|
||||
|
||||
resync_strobe_sync1_reg <= resync_strobe_i;
|
||||
resync_strobe_sync2_reg <= resync_strobe_sync1_reg;
|
||||
resync_strobe_prev <= resync_strobe_sync2_reg;
|
||||
end
|
||||
|
||||
// Generate a warning signal from PLL lock loss
|
||||
always @(posedge clk27 or negedge sys_reset_n)
|
||||
begin
|
||||
if (!sys_reset_n) begin
|
||||
warn_pll_lock_lost <= 1'b0;
|
||||
end else begin
|
||||
if (~pll_areset & ~pll_locked)
|
||||
warn_pll_lock_lost <= 1;
|
||||
else if (warn_pll_lock_lost != 0)
|
||||
warn_pll_lock_lost <= warn_pll_lock_lost + 1'b1;
|
||||
end
|
||||
end
|
||||
|
||||
// Control PLL reference clock switchover
|
||||
always @(posedge clk27)
|
||||
begin
|
||||
pll_clkswitch <= (pll_activeclock != enable_sc);
|
||||
end
|
||||
|
||||
// Output registers
|
||||
always @(posedge pclk_out) begin
|
||||
if (osd_enable) begin
|
||||
{HDMI_TX_RD, HDMI_TX_GD, HDMI_TX_BD} <= {{8{osd_color[2]}}, {8{osd_color[1]}}, {8{osd_color[0]}}};
|
||||
end else begin
|
||||
{HDMI_TX_RD, HDMI_TX_GD, HDMI_TX_BD} <= {R_sc, G_sc, B_sc};
|
||||
end
|
||||
|
||||
HDMI_TX_HS <= HSYNC_sc;
|
||||
HDMI_TX_VS <= VSYNC_sc;
|
||||
HDMI_TX_DE <= DE_sc;
|
||||
end
|
||||
|
||||
|
||||
// A modified <= v1.7 board uses LED_R for TVP_HSYNC input
|
||||
ALT_IOBUF led_r_iobuf (.i(LED_R_i), .oe(cfg_reg[1]), .o(TVP_SOG_ALT_i), .io(LED_R));
|
||||
|
||||
pll_2x pll_pclk (
|
||||
.areset(pll_areset),
|
||||
.clkswitch(pll_clkswitch),
|
||||
.configupdate(pll_configupdate),
|
||||
.inclk0(clk27), // set videogen clock to primary (power-on default) since both reference clocks must be running during switchover
|
||||
.inclk1(TVP_PCLK_i), // is the secondary input clock fully compensated?
|
||||
.scanclk(pll_scanclk),
|
||||
.scanclkena(pll_scanclkena),
|
||||
.scandata(pll_scandata),
|
||||
.activeclock(pll_activeclock),
|
||||
.c0(pll_clkout),
|
||||
.locked(pll_locked),
|
||||
.scandataout(),
|
||||
.scandone(pll_scandone)
|
||||
);
|
||||
|
||||
cycloneive_clkctrl clkctrl1 (
|
||||
.clkselect(pll_bypass ? 2'h0 : 2'h2),
|
||||
.ena(1'b1),
|
||||
.inclk({1'b0, pll_clkout, 1'b0, TVP_PCLK_i}), // fitter forbids using both clk27 and pclk_1x here since they're on opposite sides
|
||||
.outclk(clkmux_clkout)
|
||||
// synopsys translate_off
|
||||
,
|
||||
.devclrn(1'b1),
|
||||
.devpor(1'b1)
|
||||
// synopsys translate_on
|
||||
);
|
||||
defparam
|
||||
clkctrl1.clock_type = "Global Clock",
|
||||
clkctrl1.ena_register_mode = "falling edge",
|
||||
clkctrl1.lpm_type = "cycloneive_clkctrl";
|
||||
|
||||
sys sys_inst(
|
||||
.clk_clk (clk27),
|
||||
.reset_reset_n (sys_reset_n),
|
||||
.pulpino_0_config_testmode_i (1'b0),
|
||||
.pulpino_0_config_fetch_enable_i (1'b1),
|
||||
.pulpino_0_config_clock_gating_i (1'b0),
|
||||
.pulpino_0_config_boot_addr_i (32'h00010000),
|
||||
.reset_sys_reset_n (sys_reset_n),
|
||||
.reset_po_reset_n (po_reset_n),
|
||||
.ibex_0_ndm_ndmreset_o (ndmreset_req),
|
||||
.ibex_0_ndm_ndmreset_ack_i (ndmreset_ack),
|
||||
.ibex_0_config_boot_addr_i (32'h02050000),
|
||||
.ibex_0_config_core_sleep_o (),
|
||||
.master_0_master_reset_reset (jtagm_reset_req),
|
||||
.i2c_opencores_0_export_scl_pad_io (scl),
|
||||
.i2c_opencores_0_export_sda_pad_io (sda),
|
||||
@@ -253,19 +387,33 @@ sys sys_inst(
|
||||
.i2c_opencores_1_export_sda_pad_io (SD_CMD),
|
||||
.i2c_opencores_1_export_spi_miso_pad_i (SD_DAT[0]),
|
||||
.pio_0_sys_ctrl_out_export (sys_ctrl),
|
||||
.pio_1_controls_in_export ({ir_code_cnt, 4'b0000, pll_activeclock, HDMI_TX_MODE_LL, btn_LL, ir_code}),
|
||||
.sc_config_0_sc_if_sc_status_i ({vsync_flag, 2'b00, vmax_tvp, fpga_vsyncgen, 4'h0, ilace_flag, vmax}),
|
||||
.sc_config_0_sc_if_sc_status2_i ({12'h000, pcnt_frame}),
|
||||
.pio_1_controls_in_export (controls),
|
||||
.sc_config_0_sc_if_fe_status_i ({19'h0, TVP_sync_active, TVP_fe_interlace, TVP_fe_vtotal}),
|
||||
.sc_config_0_sc_if_fe_status2_i ({4'h0, TVP_hsync_width, TVP_fe_pcnt_field}),
|
||||
.sc_config_0_sc_if_lt_status_i ({lt_finished, 3'h0, lt_stb_result, lt_lat_result}),
|
||||
.sc_config_0_sc_if_h_config_o (h_config),
|
||||
.sc_config_0_sc_if_h_config2_o (h_config2),
|
||||
.sc_config_0_sc_if_v_config_o (v_config),
|
||||
.sc_config_0_sc_if_hv_in_config_o (hv_in_config),
|
||||
.sc_config_0_sc_if_hv_in_config2_o (hv_in_config2),
|
||||
.sc_config_0_sc_if_hv_in_config3_o (hv_in_config3),
|
||||
.sc_config_0_sc_if_hv_out_config_o (hv_out_config),
|
||||
.sc_config_0_sc_if_hv_out_config2_o (hv_out_config2),
|
||||
.sc_config_0_sc_if_hv_out_config3_o (hv_out_config3),
|
||||
.sc_config_0_sc_if_xy_out_config_o (xy_out_config),
|
||||
.sc_config_0_sc_if_xy_out_config2_o (xy_out_config2),
|
||||
.sc_config_0_sc_if_misc_config_o (misc_config),
|
||||
.sc_config_0_sc_if_sl_config_o (sl_config),
|
||||
.sc_config_0_sc_if_sl_config2_o (sl_config2),
|
||||
.osd_generator_0_osd_if_vclk (PCLK_out),
|
||||
.osd_generator_0_osd_if_xpos (xpos),
|
||||
.osd_generator_0_osd_if_ypos (ypos),
|
||||
.sc_config_0_sc_if_sl_config3_o (sl_config3),
|
||||
.sc_config_0_shmask_if_vclk (PCLK_sc),
|
||||
.sc_config_0_shmask_if_shmask_xpos (x_ctr_shmask),
|
||||
.sc_config_0_shmask_if_shmask_ypos (y_ctr_shmask),
|
||||
.sc_config_0_shmask_if_shmask_data (shmask_data),
|
||||
.sc_config_0_lc_ram_if_lumacode_clk_i (TVP_PCLK_i),
|
||||
.sc_config_0_lc_ram_if_lumacode_addr_i (lumacode_addr),
|
||||
.sc_config_0_lc_ram_if_lumacode_rden_i (lumacode_rden),
|
||||
.sc_config_0_lc_ram_if_lumacode_data_o (lumacode_data),
|
||||
.osd_generator_0_osd_if_vclk (PCLK_sc),
|
||||
.osd_generator_0_osd_if_xpos (xpos_sc),
|
||||
.osd_generator_0_osd_if_ypos (ypos_sc),
|
||||
.osd_generator_0_osd_if_osd_enable (osd_enable_pre),
|
||||
.osd_generator_0_osd_if_osd_color (osd_color),
|
||||
.pll_reconfig_0_pll_reconfig_if_areset (pll_areset),
|
||||
@@ -276,49 +424,74 @@ sys sys_inst(
|
||||
.pll_reconfig_0_pll_reconfig_if_scandone (pll_scandone)
|
||||
);
|
||||
|
||||
scanconverter scanconverter_inst (
|
||||
.reset_n (hw_reset_n),
|
||||
.PCLK_in (PCLK_in),
|
||||
.clk27 (clk27),
|
||||
.enable_sc (enable_sc),
|
||||
.HSYNC_in (HSYNC_in_L),
|
||||
.VSYNC_in (VSYNC_in_L),
|
||||
.FID_in (FID_in_L),
|
||||
.R_in (R_in_L),
|
||||
.G_in (G_in_L),
|
||||
.B_in (B_in_L),
|
||||
.h_config (h_config),
|
||||
.h_config2 (h_config2),
|
||||
.v_config (v_config),
|
||||
.misc_config (misc_config),
|
||||
.sl_config (sl_config),
|
||||
.sl_config2 (sl_config2),
|
||||
.R_out (R_out_sc),
|
||||
.G_out (G_out_sc),
|
||||
.B_out (B_out_sc),
|
||||
.PCLK_out (PCLK_out),
|
||||
.HSYNC_out (HSYNC_out_sc),
|
||||
.VSYNC_out (VSYNC_out_sc),
|
||||
.DE_out (DE_out_sc),
|
||||
.h_unstable (h_unstable),
|
||||
.fpga_vsyncgen (fpga_vsyncgen),
|
||||
.pll_lock_lost (pll_lock_lost),
|
||||
.vmax (vmax),
|
||||
.vmax_tvp (vmax_tvp),
|
||||
.pcnt_frame (pcnt_frame),
|
||||
.ilace_flag (ilace_flag),
|
||||
.vsync_flag (vsync_flag),
|
||||
.lt_active (lt_active),
|
||||
.lt_mode (lt_mode_synced),
|
||||
.xpos (xpos_sc),
|
||||
.ypos (ypos_sc),
|
||||
.pll_areset (pll_areset),
|
||||
.pll_scanclk (pll_scanclk),
|
||||
.pll_scanclkena (pll_scanclkena),
|
||||
.pll_configupdate (pll_configupdate),
|
||||
.pll_scandata (pll_scandata),
|
||||
.pll_scandone (pll_scandone),
|
||||
.pll_activeclock (pll_activeclock)
|
||||
// These do not work in current Quartus version (24.1) and a patch file (scripts/qsys.patch) must be used after Qsys generation instead
|
||||
defparam
|
||||
sys_inst.master_0.fifo.FIFO_DEPTH = 1024;
|
||||
|
||||
scanconverter #(
|
||||
.EMIF_ENABLE(0),
|
||||
.NUM_LINE_BUFFERS(2)
|
||||
) scanconverter_inst (
|
||||
.PCLK_CAP_i(TVP_PCLK_i),
|
||||
.PCLK_OUT_i(clkmux_clkout),
|
||||
.reset_n(hw_reset_n), //TODO: sync to pclk_capture
|
||||
.R_i(TVP_R_post),
|
||||
.G_i(TVP_G_post),
|
||||
.B_i(TVP_B_post),
|
||||
.HSYNC_i(TVP_HSYNC_post),
|
||||
.VSYNC_i(TVP_VSYNC_post),
|
||||
.DE_i(TVP_DE_post),
|
||||
.FID_i(TVP_FID_post),
|
||||
.datavalid_i(TVP_datavalid_post),
|
||||
.interlaced_in_i(TVP_fe_interlace),
|
||||
.frame_change_i(TVP_fe_frame_change),
|
||||
.xpos_i(TVP_fe_xpos),
|
||||
.ypos_i(TVP_fe_ypos),
|
||||
.h_in_active(hv_in_config[23:12]),
|
||||
.hv_out_config(hv_out_config),
|
||||
.hv_out_config2(hv_out_config2),
|
||||
.hv_out_config3(hv_out_config3),
|
||||
.xy_out_config(xy_out_config),
|
||||
.xy_out_config2(xy_out_config2),
|
||||
.misc_config(misc_config),
|
||||
.sl_config(sl_config),
|
||||
.sl_config2(sl_config2),
|
||||
.sl_config3(sl_config3),
|
||||
.testpattern_enable(~enable_sc),
|
||||
.lb_enable(enable_sc),
|
||||
.ext_sync_mode(1'b0),
|
||||
.ext_frame_change_i(1'b0),
|
||||
.ext_R_i(8'h00),
|
||||
.ext_G_i(8'h00),
|
||||
.ext_B_i(8'h00),
|
||||
.PCLK_o(PCLK_sc),
|
||||
.R_o(R_sc),
|
||||
.G_o(G_sc),
|
||||
.B_o(B_sc),
|
||||
.HSYNC_o(HSYNC_sc),
|
||||
.VSYNC_o(VSYNC_sc),
|
||||
.DE_o(DE_sc),
|
||||
.xpos_o(xpos_sc),
|
||||
.ypos_o(ypos_sc),
|
||||
.x_ctr_shmask(x_ctr_shmask),
|
||||
.y_ctr_shmask(y_ctr_shmask),
|
||||
.shmask_data(shmask_data),
|
||||
.resync_strobe(resync_strobe_i),
|
||||
.lt_active(lt_active),
|
||||
.lt_mode(lt_mode_synced),
|
||||
.emif_br_clk(1'b0),
|
||||
.emif_br_reset(1'b0),
|
||||
.emif_rd_addr(),
|
||||
.emif_rd_read(),
|
||||
.emif_rd_rdata(0),
|
||||
.emif_rd_waitrequest(0),
|
||||
.emif_rd_readdatavalid(0),
|
||||
.emif_rd_burstcount(),
|
||||
.emif_wr_addr(),
|
||||
.emif_wr_write(),
|
||||
.emif_wr_wdata(),
|
||||
.emif_wr_waitrequest(0),
|
||||
.emif_wr_burstcount()
|
||||
);
|
||||
|
||||
ir_rcv ir0 (
|
||||
@@ -332,12 +505,12 @@ ir_rcv ir0 (
|
||||
|
||||
lat_tester lt0 (
|
||||
.clk27 (clk27),
|
||||
.pclk (PCLK_out),
|
||||
.pclk (PCLK_sc),
|
||||
.active (lt_active),
|
||||
.armed (lt_armed),
|
||||
.sensor (lt_sensor),
|
||||
.trigger (lt_trigger),
|
||||
.VSYNC_in (HDMI_TX_VS),
|
||||
.VSYNC_in (VSYNC_sc),
|
||||
.mode_in (lt_mode),
|
||||
.mode_synced (lt_mode_synced),
|
||||
.lat_result (lt_lat_result),
|
||||
@@ -346,19 +519,4 @@ lat_tester lt0 (
|
||||
.finished (lt_finished)
|
||||
);
|
||||
|
||||
videogen vg0 (
|
||||
.clk27 (PCLK_out),
|
||||
.reset_n (po_reset_n & ~enable_sc),
|
||||
.lt_active (lt_active),
|
||||
.lt_mode (lt_mode_synced),
|
||||
.R_out (R_out_vg),
|
||||
.G_out (G_out_vg),
|
||||
.B_out (B_out_vg),
|
||||
.HSYNC_out (HSYNC_out_vg),
|
||||
.VSYNC_out (VSYNC_out_vg),
|
||||
.DE_out (DE_out_vg),
|
||||
.xpos (xpos_vg),
|
||||
.ypos (ypos_vg)
|
||||
);
|
||||
|
||||
endmodule
|
||||
@@ -12,7 +12,6 @@
|
||||
<pin name="scandata" direction="input" scope="external" />
|
||||
<pin name="activeclock" direction="output" scope="external" />
|
||||
<pin name="c0" direction="output" scope="external" source="clock" />
|
||||
<pin name="c1" direction="output" scope="external" source="clock" />
|
||||
<pin name="locked" direction="output" scope="external" />
|
||||
<pin name="scandataout" direction="output" scope="external" />
|
||||
<pin name="scandone" direction="output" scope="external" />
|
||||
|
||||
+1
-3
@@ -1,7 +1,5 @@
|
||||
set_global_assignment -name IP_TOOL_NAME "ALTPLL"
|
||||
set_global_assignment -name IP_TOOL_VERSION "20.1"
|
||||
set_global_assignment -name IP_TOOL_VERSION "24.1"
|
||||
set_global_assignment -name IP_GENERATED_DEVICE_FAMILY "{Cyclone IV E}"
|
||||
set_global_assignment -name VERILOG_FILE [file join $::quartus(qip_path) "pll_2x.v"]
|
||||
set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "pll_2x_inst.v"]
|
||||
set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "pll_2x_bb.v"]
|
||||
set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "pll_2x.ppf"]
|
||||
+24
-52
@@ -14,24 +14,24 @@
|
||||
// ************************************************************
|
||||
// THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
|
||||
//
|
||||
// 20.1.1 Build 720 11/11/2020 SJ Lite Edition
|
||||
// 24.1std.0 Build 1077 03/04/2025 SC Lite Edition
|
||||
// ************************************************************
|
||||
|
||||
|
||||
//Copyright (C) 2020 Intel Corporation. All rights reserved.
|
||||
//Your use of Intel Corporation's design tools, logic functions
|
||||
//Copyright (C) 2025 Altera Corporation. All rights reserved.
|
||||
//Your use of Altera Corporation's design tools, logic functions
|
||||
//and other software and tools, and any partner logic
|
||||
//functions, and any output files from any of the foregoing
|
||||
//(including device programming or simulation files), and any
|
||||
//associated documentation or information are expressly subject
|
||||
//to the terms and conditions of the Intel Program License
|
||||
//Subscription Agreement, the Intel Quartus Prime License Agreement,
|
||||
//the Intel FPGA IP License Agreement, or other applicable license
|
||||
//to the terms and conditions of the Altera Program License
|
||||
//Subscription Agreement, the Altera Quartus Prime License Agreement,
|
||||
//the Altera IP License Agreement, or other applicable license
|
||||
//agreement, including, without limitation, that your use is for
|
||||
//the sole purpose of programming logic devices manufactured by
|
||||
//Intel and sold by Intel or its authorized distributors. Please
|
||||
//refer to the applicable agreement for further details, at
|
||||
//https://fpgasoftware.intel.com/eula.
|
||||
//Altera and sold by Altera or its authorized distributors. Please
|
||||
//refer to the Altera Software License Subscription Agreements
|
||||
//on the Quartus Prime software download page.
|
||||
|
||||
|
||||
// synopsys translate_off
|
||||
@@ -48,7 +48,6 @@ module pll_2x (
|
||||
scandata,
|
||||
activeclock,
|
||||
c0,
|
||||
c1,
|
||||
locked,
|
||||
scandataout,
|
||||
scandone);
|
||||
@@ -63,7 +62,6 @@ module pll_2x (
|
||||
input scandata;
|
||||
output activeclock;
|
||||
output c0;
|
||||
output c1;
|
||||
output locked;
|
||||
output scandataout;
|
||||
output scandone;
|
||||
@@ -81,34 +79,32 @@ module pll_2x (
|
||||
|
||||
wire sub_wire0;
|
||||
wire [4:0] sub_wire1;
|
||||
wire sub_wire3;
|
||||
wire sub_wire4;
|
||||
wire sub_wire5;
|
||||
wire sub_wire6;
|
||||
wire sub_wire9 = inclk1;
|
||||
wire sub_wire8 = inclk1;
|
||||
wire activeclock = sub_wire0;
|
||||
wire [1:1] sub_wire3 = sub_wire1[1:1];
|
||||
wire [0:0] sub_wire2 = sub_wire1[0:0];
|
||||
wire c0 = sub_wire2;
|
||||
wire c1 = sub_wire3;
|
||||
wire locked = sub_wire4;
|
||||
wire scandataout = sub_wire5;
|
||||
wire scandone = sub_wire6;
|
||||
wire sub_wire7 = inclk0;
|
||||
wire [1:0] sub_wire8 = {sub_wire9, sub_wire7};
|
||||
wire locked = sub_wire3;
|
||||
wire scandataout = sub_wire4;
|
||||
wire scandone = sub_wire5;
|
||||
wire sub_wire6 = inclk0;
|
||||
wire [1:0] sub_wire7 = {sub_wire8, sub_wire6};
|
||||
|
||||
altpll altpll_component (
|
||||
.areset (areset),
|
||||
.clkswitch (clkswitch),
|
||||
.configupdate (configupdate),
|
||||
.inclk (sub_wire8),
|
||||
.inclk (sub_wire7),
|
||||
.scanclk (scanclk),
|
||||
.scanclkena (scanclkena),
|
||||
.scandata (scandata),
|
||||
.activeclock (sub_wire0),
|
||||
.clk (sub_wire1),
|
||||
.locked (sub_wire4),
|
||||
.scandataout (sub_wire5),
|
||||
.scandone (sub_wire6),
|
||||
.locked (sub_wire3),
|
||||
.scandataout (sub_wire4),
|
||||
.scandone (sub_wire5),
|
||||
.clkbad (),
|
||||
.clkena ({6{1'b1}}),
|
||||
.clkloss (),
|
||||
@@ -140,10 +136,6 @@ module pll_2x (
|
||||
altpll_component.clk0_duty_cycle = 50,
|
||||
altpll_component.clk0_multiply_by = 1,
|
||||
altpll_component.clk0_phase_shift = "0",
|
||||
altpll_component.clk1_divide_by = 1,
|
||||
altpll_component.clk1_duty_cycle = 50,
|
||||
altpll_component.clk1_multiply_by = 1,
|
||||
altpll_component.clk1_phase_shift = "0",
|
||||
altpll_component.compensate_clock = "CLK0",
|
||||
altpll_component.inclk0_input_frequency = 37037,
|
||||
altpll_component.inclk1_input_frequency = 37037,
|
||||
@@ -178,7 +170,7 @@ module pll_2x (
|
||||
altpll_component.port_scanread = "PORT_UNUSED",
|
||||
altpll_component.port_scanwrite = "PORT_UNUSED",
|
||||
altpll_component.port_clk0 = "PORT_USED",
|
||||
altpll_component.port_clk1 = "PORT_USED",
|
||||
altpll_component.port_clk1 = "PORT_UNUSED",
|
||||
altpll_component.port_clk2 = "PORT_UNUSED",
|
||||
altpll_component.port_clk3 = "PORT_UNUSED",
|
||||
altpll_component.port_clk4 = "PORT_UNUSED",
|
||||
@@ -227,11 +219,8 @@ endmodule
|
||||
// Retrieval info: PRIVATE: CUR_FBIN_CLK STRING "c0"
|
||||
// Retrieval info: PRIVATE: DEVICE_SPEED_GRADE STRING "8"
|
||||
// Retrieval info: PRIVATE: DIV_FACTOR0 NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: DIV_FACTOR1 NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: DUTY_CYCLE0 STRING "50.00000000"
|
||||
// Retrieval info: PRIVATE: DUTY_CYCLE1 STRING "50.00000000"
|
||||
// Retrieval info: PRIVATE: EFF_OUTPUT_FREQ_VALUE0 STRING "27.000000"
|
||||
// Retrieval info: PRIVATE: EFF_OUTPUT_FREQ_VALUE1 STRING "27.000000"
|
||||
// Retrieval info: PRIVATE: EXPLICIT_SWITCHOVER_COUNTER STRING "0"
|
||||
// Retrieval info: PRIVATE: EXT_FEEDBACK_RADIO STRING "0"
|
||||
// Retrieval info: PRIVATE: GLOCKED_COUNTER_EDIT_CHANGED STRING "1"
|
||||
@@ -252,26 +241,18 @@ endmodule
|
||||
// Retrieval info: PRIVATE: LVDS_MODE_DATA_RATE STRING "Not Available"
|
||||
// Retrieval info: PRIVATE: LVDS_MODE_DATA_RATE_DIRTY NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: LVDS_PHASE_SHIFT_UNIT0 STRING "deg"
|
||||
// Retrieval info: PRIVATE: LVDS_PHASE_SHIFT_UNIT1 STRING "ps"
|
||||
// Retrieval info: PRIVATE: MIG_DEVICE_SPEED_GRADE STRING "Any"
|
||||
// Retrieval info: PRIVATE: MIRROR_CLK0 STRING "0"
|
||||
// Retrieval info: PRIVATE: MIRROR_CLK1 STRING "0"
|
||||
// Retrieval info: PRIVATE: MULT_FACTOR0 NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: MULT_FACTOR1 NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: NORMAL_MODE_RADIO STRING "1"
|
||||
// Retrieval info: PRIVATE: OUTPUT_FREQ0 STRING "100.00000000"
|
||||
// Retrieval info: PRIVATE: OUTPUT_FREQ1 STRING "100.00000000"
|
||||
// Retrieval info: PRIVATE: OUTPUT_FREQ_MODE0 STRING "0"
|
||||
// Retrieval info: PRIVATE: OUTPUT_FREQ_MODE1 STRING "0"
|
||||
// Retrieval info: PRIVATE: OUTPUT_FREQ_UNIT0 STRING "MHz"
|
||||
// Retrieval info: PRIVATE: OUTPUT_FREQ_UNIT1 STRING "MHz"
|
||||
// Retrieval info: PRIVATE: PHASE_RECONFIG_FEATURE_ENABLED STRING "1"
|
||||
// Retrieval info: PRIVATE: PHASE_RECONFIG_INPUTS_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: PHASE_SHIFT0 STRING "0.00000000"
|
||||
// Retrieval info: PRIVATE: PHASE_SHIFT1 STRING "0.00000000"
|
||||
// Retrieval info: PRIVATE: PHASE_SHIFT_STEP_ENABLED_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: PHASE_SHIFT_UNIT0 STRING "deg"
|
||||
// Retrieval info: PRIVATE: PHASE_SHIFT_UNIT1 STRING "ps"
|
||||
// Retrieval info: PRIVATE: PLL_ADVANCED_PARAM_CHECK STRING "0"
|
||||
// Retrieval info: PRIVATE: PLL_ARESET_CHECK STRING "1"
|
||||
// Retrieval info: PRIVATE: PLL_AUTOPLL_CHECK NUMERIC "1"
|
||||
@@ -294,14 +275,11 @@ endmodule
|
||||
// Retrieval info: PRIVATE: SPREAD_USE STRING "0"
|
||||
// Retrieval info: PRIVATE: SRC_SYNCH_COMP_RADIO STRING "0"
|
||||
// Retrieval info: PRIVATE: STICKY_CLK0 STRING "1"
|
||||
// Retrieval info: PRIVATE: STICKY_CLK1 STRING "1"
|
||||
// Retrieval info: PRIVATE: SWITCHOVER_COUNT_EDIT NUMERIC "1"
|
||||
// Retrieval info: PRIVATE: SWITCHOVER_FEATURE_ENABLED STRING "1"
|
||||
// Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0"
|
||||
// Retrieval info: PRIVATE: USE_CLK0 STRING "1"
|
||||
// Retrieval info: PRIVATE: USE_CLK1 STRING "1"
|
||||
// Retrieval info: PRIVATE: USE_CLKENA0 STRING "0"
|
||||
// Retrieval info: PRIVATE: USE_CLKENA1 STRING "0"
|
||||
// Retrieval info: PRIVATE: USE_MIL_SPEED_GRADE NUMERIC "0"
|
||||
// Retrieval info: PRIVATE: ZERO_DELAY_RADIO STRING "0"
|
||||
// Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all
|
||||
@@ -310,10 +288,6 @@ endmodule
|
||||
// Retrieval info: CONSTANT: CLK0_DUTY_CYCLE NUMERIC "50"
|
||||
// Retrieval info: CONSTANT: CLK0_MULTIPLY_BY NUMERIC "1"
|
||||
// Retrieval info: CONSTANT: CLK0_PHASE_SHIFT STRING "0"
|
||||
// Retrieval info: CONSTANT: CLK1_DIVIDE_BY NUMERIC "1"
|
||||
// Retrieval info: CONSTANT: CLK1_DUTY_CYCLE NUMERIC "50"
|
||||
// Retrieval info: CONSTANT: CLK1_MULTIPLY_BY NUMERIC "1"
|
||||
// Retrieval info: CONSTANT: CLK1_PHASE_SHIFT STRING "0"
|
||||
// Retrieval info: CONSTANT: COMPENSATE_CLOCK STRING "CLK0"
|
||||
// Retrieval info: CONSTANT: INCLK0_INPUT_FREQUENCY NUMERIC "37037"
|
||||
// Retrieval info: CONSTANT: INCLK1_INPUT_FREQUENCY NUMERIC "37037"
|
||||
@@ -347,7 +321,7 @@ endmodule
|
||||
// Retrieval info: CONSTANT: PORT_SCANREAD STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_SCANWRITE STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_clk0 STRING "PORT_USED"
|
||||
// Retrieval info: CONSTANT: PORT_clk1 STRING "PORT_USED"
|
||||
// Retrieval info: CONSTANT: PORT_clk1 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_clk2 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_clk3 STRING "PORT_UNUSED"
|
||||
// Retrieval info: CONSTANT: PORT_clk4 STRING "PORT_UNUSED"
|
||||
@@ -371,7 +345,6 @@ endmodule
|
||||
// Retrieval info: USED_PORT: activeclock 0 0 0 0 OUTPUT GND "activeclock"
|
||||
// Retrieval info: USED_PORT: areset 0 0 0 0 INPUT GND "areset"
|
||||
// Retrieval info: USED_PORT: c0 0 0 0 0 OUTPUT_CLK_EXT VCC "c0"
|
||||
// Retrieval info: USED_PORT: c1 0 0 0 0 OUTPUT_CLK_EXT VCC "c1"
|
||||
// Retrieval info: USED_PORT: clkswitch 0 0 0 0 INPUT GND "clkswitch"
|
||||
// Retrieval info: USED_PORT: configupdate 0 0 0 0 INPUT GND "configupdate"
|
||||
// Retrieval info: USED_PORT: inclk0 0 0 0 0 INPUT_CLK_EXT GND "inclk0"
|
||||
@@ -392,7 +365,6 @@ endmodule
|
||||
// Retrieval info: CONNECT: @scandata 0 0 0 0 scandata 0 0 0 0
|
||||
// Retrieval info: CONNECT: activeclock 0 0 0 0 @activeclock 0 0 0 0
|
||||
// Retrieval info: CONNECT: c0 0 0 0 0 @clk 0 0 1 0
|
||||
// Retrieval info: CONNECT: c1 0 0 0 0 @clk 0 0 1 1
|
||||
// Retrieval info: CONNECT: locked 0 0 0 0 @locked 0 0 0 0
|
||||
// Retrieval info: CONNECT: scandataout 0 0 0 0 @scandataout 0 0 0 0
|
||||
// Retrieval info: CONNECT: scandone 0 0 0 0 @scandone 0 0 0 0
|
||||
@@ -401,8 +373,8 @@ endmodule
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_2x.inc FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_2x.cmp FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_2x.bsf FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_2x_inst.v TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_2x_bb.v TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_2x_inst.v FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_2x_bb.v FALSE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_2x.mif TRUE
|
||||
// Retrieval info: GEN_FILE: TYPE_NORMAL pll_2x.hex TRUE
|
||||
// Retrieval info: LIB_FILE: altera_mf
|
||||
|
||||
+538
-1105
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,561 @@
|
||||
//
|
||||
// Copyright (C) 2022-2023 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
//
|
||||
// This file is part of Open Source Scan Converter project.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
module tvp7002_frontend (
|
||||
input PCLK_i,
|
||||
input CLK_MEAS_i,
|
||||
input reset_n,
|
||||
input [7:0] R_i,
|
||||
input [7:0] G_i,
|
||||
input [7:0] B_i,
|
||||
input HS_i,
|
||||
input VS_i,
|
||||
input HSYNC_i,
|
||||
input VSYNC_i,
|
||||
input DE_i,
|
||||
input FID_i,
|
||||
input sogref_update_i,
|
||||
input vsync_i_type,
|
||||
input [31:0] hv_in_config,
|
||||
input [31:0] hv_in_config2,
|
||||
input [31:0] hv_in_config3,
|
||||
input [31:0] misc_config,
|
||||
input [31:0] lumacode_data,
|
||||
output [7:0] R_o,
|
||||
output [7:0] G_o,
|
||||
output [7:0] B_o,
|
||||
output HSYNC_o,
|
||||
output VSYNC_o,
|
||||
output DE_o,
|
||||
output FID_o,
|
||||
output reg interlace_flag,
|
||||
output datavalid_o,
|
||||
output [10:0] xpos_o,
|
||||
output [10:0] ypos_o,
|
||||
output reg [10:0] vtotal,
|
||||
output reg frame_change,
|
||||
output reg sof_scaler,
|
||||
output reg [19:0] pcnt_field,
|
||||
output reg [7:0] hsync_width,
|
||||
output reg sync_active,
|
||||
output [7:0] lumacode_addr,
|
||||
output lumacode_rden
|
||||
);
|
||||
|
||||
localparam FID_EVEN = 1'b0;
|
||||
localparam FID_ODD = 1'b1;
|
||||
|
||||
localparam VSYNC_SEPARATED = 1'b0;
|
||||
localparam VSYNC_RAW = 1'b1;
|
||||
|
||||
localparam LC_DISABLED = 3'd0;
|
||||
localparam LC_2S = 3'd1;
|
||||
localparam LC_2S2X = 3'd2;
|
||||
localparam LC_3S = 3'd3;
|
||||
localparam LC_4S = 3'd4;
|
||||
localparam LC_NES = 3'd5;
|
||||
localparam LC_GTIA = 3'd6;
|
||||
localparam LC_CTIA = 3'd7;
|
||||
|
||||
localparam PP_PL_START = 1;
|
||||
localparam PP_DE_POS_START = PP_PL_START;
|
||||
localparam PP_DE_POS_LENGTH = 1;
|
||||
localparam PP_DE_POS_END = PP_DE_POS_START + PP_DE_POS_LENGTH;
|
||||
localparam PP_RLPF_START = PP_DE_POS_END;
|
||||
localparam PP_RLPF_LENGTH = 3;
|
||||
localparam PP_RLPF_END = PP_RLPF_START + PP_RLPF_LENGTH;
|
||||
localparam PP_PL_END = PP_RLPF_END;
|
||||
|
||||
reg [11:0] h_cnt, h_cnt_sogref;
|
||||
reg [10:0] v_cnt;
|
||||
reg [10:0] vmax_cnt;
|
||||
reg HS_i_prev, VS_i_np_prev;
|
||||
reg HSYNC_i_np_prev, VSYNC_i_np_prev;
|
||||
reg [1:0] fid_next_ctr;
|
||||
reg fid_next;
|
||||
reg [3:0] h_ctr;
|
||||
|
||||
reg [7:0] R_pp[PP_PL_START:PP_PL_END] /* synthesis ramstyle = "logic" */;
|
||||
reg [7:0] G_pp[PP_PL_START:PP_PL_END] /* synthesis ramstyle = "logic" */;
|
||||
reg [7:0] B_pp[PP_PL_START:PP_PL_END] /* synthesis ramstyle = "logic" */;
|
||||
reg HSYNC_pp[PP_PL_START:PP_PL_END] /* synthesis ramstyle = "logic" */;
|
||||
reg VSYNC_pp[PP_PL_START:PP_PL_END] /* synthesis ramstyle = "logic" */;
|
||||
reg FID_pp[PP_PL_START:PP_PL_END] /* synthesis ramstyle = "logic" */;
|
||||
reg DE_pp[PP_DE_POS_END:PP_PL_END] /* synthesis ramstyle = "logic" */;
|
||||
reg datavalid_pp[PP_DE_POS_END:PP_PL_END] /* synthesis ramstyle = "logic" */;
|
||||
reg [10:0] xpos_pp[PP_DE_POS_END:PP_PL_END] /* synthesis ramstyle = "logic" */;
|
||||
reg [10:0] ypos_pp[PP_DE_POS_END:PP_PL_END] /* synthesis ramstyle = "logic" */;
|
||||
|
||||
// Reverse LPF
|
||||
wire rlpf_trigger_act;
|
||||
reg signed [14:0] R_diff_s15_pre, G_diff_s15_pre, B_diff_s15_pre, R_diff_s15, G_diff_s15, B_diff_s15;
|
||||
reg [7:0] R_pp_prev_rlpf, G_pp_prev_rlpf, B_pp_prev_rlpf;
|
||||
|
||||
// Lumacode
|
||||
reg [1:0] lc_code[1:4];
|
||||
reg [2:0] lc_ctr;
|
||||
reg [2:0] lc_cnt;
|
||||
reg [2:0] lc_emp_nes;
|
||||
reg [3:0] lc_atari_hue, lc_atari_luma;
|
||||
reg lc_atari_ctr;
|
||||
|
||||
// Measurement registers
|
||||
reg [20:0] pcnt_frame_ctr;
|
||||
reg [17:0] syncpol_det_ctr, hsync_hpol_ctr, vsync_hpol_ctr;
|
||||
reg [2:0] sync_inactive_ctr;
|
||||
reg [11:0] pcnt_line, pcnt_line_ctr, meas_h_cnt, meas_h_cnt_sogref;
|
||||
reg [7:0] hs_ctr;
|
||||
reg pcnt_line_stored;
|
||||
reg [10:0] meas_v_cnt;
|
||||
reg meas_hl_det, meas_fid;
|
||||
reg hsync_i_pol, vsync_i_pol;
|
||||
|
||||
wire [11:0] H_TOTAL = hv_in_config[11:0];
|
||||
wire [11:0] H_ACTIVE = hv_in_config[23:12];
|
||||
wire [7:0] H_SYNCLEN = hv_in_config[31:24];
|
||||
wire [8:0] H_BACKPORCH = hv_in_config2[8:0];
|
||||
|
||||
wire [10:0] V_ACTIVE = hv_in_config2[30:20];
|
||||
wire [3:0] V_SYNCLEN = hv_in_config3[3:0];
|
||||
wire [8:0] V_BACKPORCH = hv_in_config3[12:4];
|
||||
|
||||
wire [5:0] MISC_REV_LPF_STR = (misc_config[11:7] + 6'd16);
|
||||
wire MISC_REV_LPF_ENABLE = (misc_config[11:7] != 5'h0);
|
||||
wire [2:0] MISC_LUMACODE_MODE = misc_config[14:12];
|
||||
|
||||
wire [11:0] h_cnt_ref = (vsync_i_type == VSYNC_SEPARATED) ? h_cnt_sogref : h_cnt;
|
||||
wire [11:0] even_min_thold = (H_TOTAL / 12'd4);
|
||||
wire [11:0] even_max_thold = (H_TOTAL / 12'd2) + (H_TOTAL / 12'd4);
|
||||
|
||||
wire [11:0] meas_h_cnt_ref = (vsync_i_type == VSYNC_SEPARATED) ? meas_h_cnt_sogref : meas_h_cnt;
|
||||
wire [11:0] meas_even_min_thold = (pcnt_line / 12'd4);
|
||||
wire [11:0] meas_even_max_thold = (pcnt_line / 12'd2) + (pcnt_line / 12'd4);
|
||||
wire meas_vblank_region = (pcnt_frame_ctr < 8*pcnt_line) | (pcnt_frame_ctr > (({1'b0, pcnt_field}<<interlace_flag) - 4*pcnt_line)) |
|
||||
(interlace_flag & (pcnt_frame_ctr < (pcnt_field+8*pcnt_line)) & (pcnt_frame_ctr > (pcnt_field - 4*pcnt_line)));
|
||||
wire [11:0] glitch_filt_thold = meas_vblank_region ? (pcnt_line/4) : (pcnt_line/8);
|
||||
|
||||
// TODO: calculate H/V polarity independently
|
||||
wire VS_i_np = (VS_i ^ ~vsync_i_pol);
|
||||
wire VSYNC_i_np = (VSYNC_i ^ ~vsync_i_pol);
|
||||
wire HSYNC_i_np = (HSYNC_i ^ ~hsync_i_pol);
|
||||
|
||||
// Sample skip for low-res optimized modes
|
||||
wire [3:0] H_SKIP = hv_in_config3[27:24];
|
||||
wire [3:0] H_SAMPLE_SEL = hv_in_config3[31:28];
|
||||
|
||||
// Lumacode
|
||||
wire [2:0] LC_SAMPLES;
|
||||
wire [2:0] LC_H_SKIP = ((H_SKIP+1) / LC_SAMPLES) - 1;
|
||||
|
||||
// SOF position for scaler
|
||||
wire [10:0] V_SOF_LINE = hv_in_config3[23:13];
|
||||
|
||||
function [7:0] apply_reverse_lpf;
|
||||
input [7:0] data_prev;
|
||||
input signed [14:0] diff;
|
||||
reg signed [10:0] result;
|
||||
|
||||
begin
|
||||
result = {3'b0,data_prev} + ~diff[14:4]; // allow for a small error to reduce adder length
|
||||
apply_reverse_lpf = result[10] ? 8'h00 : |result[9:8] ? 8'hFF : result[7:0];
|
||||
end
|
||||
endfunction
|
||||
|
||||
// Lumacode number of samples selection
|
||||
always @(*) begin
|
||||
case(MISC_LUMACODE_MODE)
|
||||
LC_2S,LC_CTIA : LC_SAMPLES = 2; // 2 samples for {C64, C128, Spectrum, TMS99xxA} / 4 samples for VCS (2 per half-pixel)
|
||||
LC_2S2X : LC_SAMPLES = 1; // 2 samples for VIC20, Intellivision, G7000 (1 per doubled pixel)
|
||||
LC_3S,LC_NES,LC_GTIA : LC_SAMPLES = 3; // 3 samples for {NES, SMS} / 6 samples for Atari 8bit (3 per pixel)
|
||||
LC_4S : LC_SAMPLES = 4; // 4 samples for Atari 7800
|
||||
default : LC_SAMPLES = 1;
|
||||
endcase
|
||||
end
|
||||
|
||||
// Pipeline stage 1
|
||||
always @(posedge PCLK_i) begin
|
||||
R_pp[1] <= R_i;
|
||||
G_pp[1] <= G_i;
|
||||
B_pp[1] <= B_i;
|
||||
|
||||
HS_i_prev <= HS_i;
|
||||
VS_i_np_prev <= VS_i_np;
|
||||
|
||||
if (HS_i_prev & ~HS_i) begin
|
||||
h_cnt <= 0;
|
||||
h_ctr <= 0;
|
||||
HSYNC_pp[1] <= 1'b0;
|
||||
|
||||
if (fid_next_ctr > 0)
|
||||
fid_next_ctr <= fid_next_ctr - 1'b1;
|
||||
|
||||
if (fid_next_ctr == 2'h1) begin
|
||||
// regenerated output timings start lagging by one scanline due to vsync detection,
|
||||
// compensate by starting v_cnt from 1 (effectively reduces V_SYNCLEN by 1)
|
||||
v_cnt <= 1;
|
||||
if (~(interlace_flag & (fid_next == FID_EVEN))) begin
|
||||
vmax_cnt <= 0;
|
||||
//vtotal <= vmax_cnt + 1'b1;
|
||||
frame_change <= 1'b1;
|
||||
end else begin
|
||||
vmax_cnt <= vmax_cnt + 1'b1;
|
||||
end
|
||||
end else begin
|
||||
v_cnt <= v_cnt + 1'b1;
|
||||
vmax_cnt <= vmax_cnt + 1'b1;
|
||||
frame_change <= 1'b0;
|
||||
end
|
||||
|
||||
sof_scaler <= (vmax_cnt == V_SOF_LINE);
|
||||
end else begin
|
||||
if (h_ctr == H_SKIP) begin
|
||||
h_cnt <= h_cnt + 1'b1;
|
||||
h_ctr <= 0;
|
||||
if (h_cnt == H_SYNCLEN-1)
|
||||
HSYNC_pp[1] <= 1'b1;
|
||||
end else begin
|
||||
h_ctr <= h_ctr + 1'b1;
|
||||
end
|
||||
end
|
||||
|
||||
// vsync leading edge processing per quadrant
|
||||
if (VS_i_np_prev & ~VS_i_np) begin
|
||||
if ((HS_i_prev & ~HS_i) | (h_cnt_ref < even_min_thold)) begin
|
||||
fid_next <= FID_ODD;
|
||||
fid_next_ctr <= 2'h1;
|
||||
end else if ((h_cnt_ref > even_max_thold) | ~interlace_flag) begin
|
||||
fid_next <= FID_ODD;
|
||||
fid_next_ctr <= 2'h2;
|
||||
end else begin
|
||||
fid_next <= FID_EVEN;
|
||||
fid_next_ctr <= 2'h2;
|
||||
end
|
||||
end
|
||||
|
||||
// record starting position of csync leading edge for later FID detection
|
||||
if (sogref_update_i) begin
|
||||
h_cnt_sogref <= (h_cnt > even_max_thold) ? 0 : h_cnt;
|
||||
end
|
||||
|
||||
if (((fid_next == FID_ODD) & (HS_i_prev & ~HS_i)) | ((fid_next == FID_EVEN) & (h_cnt == (H_TOTAL/2)-1'b1))) begin
|
||||
if (fid_next_ctr == 2'h1) begin
|
||||
VSYNC_pp[1] <= 1'b0;
|
||||
FID_pp[1] <= fid_next;
|
||||
//interlace_flag <= FID_pp[1] ^ fid_next;
|
||||
end else begin
|
||||
if (v_cnt == V_SYNCLEN-1)
|
||||
VSYNC_pp[1] <= 1'b1;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
// Pipeline stage 2
|
||||
always @(posedge PCLK_i) begin
|
||||
// Lumacode sample aggregation
|
||||
if (h_ctr == H_SAMPLE_SEL) begin
|
||||
lc_code[1] <= G_pp[1][7:6];
|
||||
lc_cnt <= 0;
|
||||
lc_ctr <= 0;
|
||||
lc_atari_ctr <= (h_cnt == 0) ? 0 : lc_atari_ctr ^ 1'b1;
|
||||
end else if (lc_ctr == LC_H_SKIP) begin
|
||||
lc_code[2+lc_cnt] <= G_pp[1][7:6];
|
||||
lc_cnt <= lc_cnt + 1;
|
||||
lc_ctr <= 0;
|
||||
end else begin
|
||||
lc_ctr <= lc_ctr + 1;
|
||||
end
|
||||
|
||||
// Lumacode related source-specific registers (used as part of palette RAM addressing / data processing)
|
||||
// Lumacode NES
|
||||
if (MISC_LUMACODE_MODE == LC_NES) begin
|
||||
if ((h_ctr == H_SAMPLE_SEL) & ({lc_code[1], lc_code[2], lc_code[3]} < 8))
|
||||
lc_emp_nes <= {lc_code[2][0], lc_code[3]};
|
||||
// Lumacode 2 samples (1 per doubled pixel)
|
||||
end else if (MISC_LUMACODE_MODE == LC_2S2X) begin
|
||||
if ((h_ctr == H_SAMPLE_SEL) & lc_atari_ctr) begin
|
||||
lc_atari_luma[1:0] <= lc_code[1];
|
||||
end
|
||||
// Lumacode Atari GTIA
|
||||
end else if (MISC_LUMACODE_MODE == LC_GTIA) begin
|
||||
if (h_ctr == H_SAMPLE_SEL) begin
|
||||
if (lc_atari_ctr) begin
|
||||
// Store hue and luma (high bits) for 1st pixel, and display last pixel of previous pair
|
||||
lc_atari_hue <= {lc_code[1], lc_code[2]};
|
||||
lc_atari_luma[3:2] <= lc_code[3];
|
||||
//{R_pp[2], G_pp[2], B_pp[2]} <= lumacode_data_gtia[{lc_atari_hue, lc_atari_luma}];
|
||||
end else begin
|
||||
// Store luma for 2nd pixel, and display first pixel of current pair
|
||||
lc_atari_luma <= {lc_code[2], lc_code[3]};
|
||||
//{R_pp[2], G_pp[2], B_pp[2]} <= lumacode_data_gtia[{lc_atari_hue, lc_atari_luma[3:2], lc_code[1]}];
|
||||
end
|
||||
end
|
||||
// Lumacode Atari VCS
|
||||
end else if (MISC_LUMACODE_MODE == LC_CTIA) begin
|
||||
if (h_ctr == H_SAMPLE_SEL) begin
|
||||
if (lc_atari_ctr) begin
|
||||
// Store first 2 lumacode samples (hue) from double-sampled input (160col->320col)
|
||||
lc_atari_hue <= {lc_code[1], lc_code[2]};
|
||||
end else begin
|
||||
// Display pixel after receiving remaining 2 lumacode samples (luma)
|
||||
//{R_pp[2], G_pp[2], B_pp[2]} <= lumacode_data_ctia[{lc_atari_hue, lc_code[1], lc_code[2][1]}];
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
{R_pp[2], G_pp[2], B_pp[2]} <= {R_pp[1], G_pp[1], B_pp[1]};
|
||||
HSYNC_pp[2] <= HSYNC_pp[1];
|
||||
VSYNC_pp[2] <= VSYNC_pp[1];
|
||||
FID_pp[2] <= FID_pp[1];
|
||||
DE_pp[2] <= (h_cnt >= H_SYNCLEN+H_BACKPORCH) & (h_cnt < H_SYNCLEN+H_BACKPORCH+H_ACTIVE) & (v_cnt >= V_SYNCLEN+V_BACKPORCH) & (v_cnt < V_SYNCLEN+V_BACKPORCH+V_ACTIVE);
|
||||
datavalid_pp[2] <= (h_ctr == H_SAMPLE_SEL);
|
||||
xpos_pp[2] <= (h_cnt-H_SYNCLEN-H_BACKPORCH);
|
||||
ypos_pp[2] <= (v_cnt-V_SYNCLEN-V_BACKPORCH);
|
||||
end
|
||||
|
||||
// Pipeline stages 3-
|
||||
integer pp_idx;
|
||||
always @(posedge PCLK_i) begin
|
||||
for(pp_idx = PP_RLPF_START+1; pp_idx <= PP_PL_END; pp_idx = pp_idx+1) begin
|
||||
R_pp[pp_idx] <= R_pp[pp_idx-1];
|
||||
G_pp[pp_idx] <= G_pp[pp_idx-1];
|
||||
B_pp[pp_idx] <= B_pp[pp_idx-1];
|
||||
HSYNC_pp[pp_idx] <= HSYNC_pp[pp_idx-1];
|
||||
VSYNC_pp[pp_idx] <= VSYNC_pp[pp_idx-1];
|
||||
FID_pp[pp_idx] <= FID_pp[pp_idx-1];
|
||||
DE_pp[pp_idx] <= DE_pp[pp_idx-1];
|
||||
datavalid_pp[pp_idx] <= datavalid_pp[pp_idx-1];
|
||||
xpos_pp[pp_idx] <= xpos_pp[pp_idx-1];
|
||||
ypos_pp[pp_idx] <= ypos_pp[pp_idx-1];
|
||||
end
|
||||
|
||||
/* ---------- Reverse LPF (3 cycles) ---------- */
|
||||
// Store a copy of valid sample data
|
||||
if (datavalid_pp[PP_RLPF_START]) begin
|
||||
R_pp_prev_rlpf <= R_pp[PP_RLPF_START];
|
||||
G_pp_prev_rlpf <= G_pp[PP_RLPF_START];
|
||||
B_pp_prev_rlpf <= B_pp[PP_RLPF_START];
|
||||
end
|
||||
// Push previous valid data into pipeline when RLPF enabled
|
||||
if (MISC_REV_LPF_ENABLE) begin
|
||||
R_pp[PP_RLPF_START+1] <= R_pp_prev_rlpf;
|
||||
G_pp[PP_RLPF_START+1] <= G_pp_prev_rlpf;
|
||||
B_pp[PP_RLPF_START+1] <= B_pp_prev_rlpf;
|
||||
end
|
||||
// Calculate diff to previous valid data
|
||||
R_diff_s15_pre <= (R_pp_prev_rlpf - R_pp[PP_RLPF_START]);
|
||||
G_diff_s15_pre <= (G_pp_prev_rlpf - G_pp[PP_RLPF_START]);
|
||||
B_diff_s15_pre <= (B_pp_prev_rlpf - B_pp[PP_RLPF_START]);
|
||||
|
||||
// Cycle 2
|
||||
R_diff_s15 <= (R_diff_s15_pre * MISC_REV_LPF_STR);
|
||||
G_diff_s15 <= (G_diff_s15_pre * MISC_REV_LPF_STR);
|
||||
B_diff_s15 <= (B_diff_s15_pre * MISC_REV_LPF_STR);
|
||||
|
||||
// Cycle 3
|
||||
if (MISC_REV_LPF_ENABLE & (MISC_LUMACODE_MODE == LC_DISABLED)) begin
|
||||
R_pp[PP_RLPF_END] <= apply_reverse_lpf(R_pp[PP_RLPF_START+2], R_diff_s15);
|
||||
G_pp[PP_RLPF_END] <= apply_reverse_lpf(G_pp[PP_RLPF_START+2], G_diff_s15);
|
||||
B_pp[PP_RLPF_END] <= apply_reverse_lpf(B_pp[PP_RLPF_START+2], B_diff_s15);
|
||||
end
|
||||
|
||||
/* --- Lumacode overwrite data from RAM --- */
|
||||
if (MISC_LUMACODE_MODE != LC_DISABLED) begin
|
||||
if (MISC_LUMACODE_MODE == LC_NES) begin
|
||||
// NES
|
||||
R_pp[PP_RLPF_START+1] <= &lc_emp_nes[1:0] ? (lumacode_data[23:16]/2) : (|lc_emp_nes[1:0] ? (lumacode_data[23:16] - lumacode_data[23:16]/4) : lumacode_data[23:16]);
|
||||
G_pp[PP_RLPF_START+1] <= (lc_emp_nes[2] & lc_emp_nes[0]) ? (lumacode_data[15:8]/2) : ((lc_emp_nes[2] | lc_emp_nes[0]) ? (lumacode_data[15:8] - lumacode_data[15:8]/4) : lumacode_data[15:8]);
|
||||
B_pp[PP_RLPF_START+1] <= &lc_emp_nes[2:1] ? (lumacode_data[7:0]/2) : (|lc_emp_nes[2:1] ? (lumacode_data[7:0] - lumacode_data[7:0]/4) : lumacode_data[7:0]);
|
||||
end else begin
|
||||
// With other palette data used as-is
|
||||
R_pp[PP_RLPF_START+1] <= lumacode_data[23:16];
|
||||
G_pp[PP_RLPF_START+1] <= lumacode_data[15:8];
|
||||
B_pp[PP_RLPF_START+1] <= lumacode_data[7:0];
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
// Lumacode palette RAM inputs
|
||||
always @(*)
|
||||
case (MISC_LUMACODE_MODE)
|
||||
LC_2S: begin // C64, C128, Spectrum, TMS99xxA
|
||||
lumacode_addr = {4'h0, lc_code[1], lc_code[2]};
|
||||
lumacode_rden = 1;
|
||||
end
|
||||
LC_2S2X: begin // VIC20, Intellivision, G7000
|
||||
lumacode_addr = {4'h0, lc_atari_luma[1:0], lc_code[1]};
|
||||
lumacode_rden = (h_ctr == H_SAMPLE_SEL) & !lc_atari_ctr;
|
||||
end
|
||||
LC_3S,LC_NES: begin // SMS, NES
|
||||
lumacode_addr = {2'h0, lc_code[1], lc_code[2], lc_code[3]};
|
||||
lumacode_rden = 1;
|
||||
end
|
||||
LC_4S: begin // Atari 7800
|
||||
lumacode_addr = {lc_code[1], lc_code[2], lc_code[3], lc_code[4]};
|
||||
lumacode_rden = 1;
|
||||
end
|
||||
LC_GTIA: begin // Atari GTIA
|
||||
lumacode_addr = lc_atari_ctr ? {lc_atari_hue, lc_atari_luma} : {lc_atari_hue, lc_atari_luma[3:2], lc_code[1]};
|
||||
lumacode_rden = (h_ctr == H_SAMPLE_SEL);
|
||||
end
|
||||
LC_CTIA: begin // Atari CTIA/TIA
|
||||
lumacode_addr = {1'h0, lc_atari_hue, lc_code[1], lc_code[2][1]};
|
||||
lumacode_rden = (h_ctr == H_SAMPLE_SEL) & !lc_atari_ctr;
|
||||
end
|
||||
default: begin // Standard output
|
||||
lumacode_addr = '0;
|
||||
lumacode_rden = 0;
|
||||
end
|
||||
endcase
|
||||
|
||||
// Output
|
||||
assign R_o = R_pp[PP_PL_END];
|
||||
assign G_o = G_pp[PP_PL_END];
|
||||
assign B_o = B_pp[PP_PL_END];
|
||||
assign HSYNC_o = HSYNC_pp[PP_PL_END];
|
||||
assign VSYNC_o = VSYNC_pp[PP_PL_END];
|
||||
assign FID_o = FID_pp[PP_PL_END];
|
||||
assign DE_o = DE_pp[PP_PL_END];
|
||||
assign datavalid_o = datavalid_pp[PP_PL_END];
|
||||
assign xpos_o = xpos_pp[PP_PL_END];
|
||||
assign ypos_o = ypos_pp[PP_PL_END];
|
||||
|
||||
|
||||
// Calculate horizontal and vertical counts
|
||||
always @(posedge CLK_MEAS_i) begin
|
||||
if ((VSYNC_i_np_prev & ~VSYNC_i_np) & (~interlace_flag | (meas_fid == FID_EVEN))) begin
|
||||
pcnt_frame_ctr <= 1;
|
||||
pcnt_line_stored <= 1'b0;
|
||||
if (sync_active & (pcnt_frame_ctr != '1))
|
||||
pcnt_field <= interlace_flag ? (pcnt_frame_ctr>>1) : pcnt_frame_ctr[19:0];
|
||||
end else if (pcnt_frame_ctr < '1) begin
|
||||
pcnt_frame_ctr <= pcnt_frame_ctr + 1'b1;
|
||||
end else begin
|
||||
pcnt_field <= 0;
|
||||
end
|
||||
|
||||
if (HSYNC_i_np_prev & ~HSYNC_i_np) begin
|
||||
pcnt_line_ctr <= 1;
|
||||
hs_ctr <= 1;
|
||||
|
||||
// store count 1ms after vsync
|
||||
if (~pcnt_line_stored & (pcnt_frame_ctr > 21'd27000)) begin
|
||||
pcnt_line <= pcnt_line_ctr;
|
||||
hsync_width <= hs_ctr;
|
||||
pcnt_line_stored <= 1'b1;
|
||||
end
|
||||
end else begin
|
||||
pcnt_line_ctr <= pcnt_line_ctr + 1'b1;
|
||||
if (~HSYNC_i_np)
|
||||
hs_ctr <= hs_ctr + 1'b1;
|
||||
end
|
||||
|
||||
HSYNC_i_np_prev <= HSYNC_i_np;
|
||||
VSYNC_i_np_prev <= VSYNC_i_np;
|
||||
end
|
||||
|
||||
// Detect sync polarities and activity during ~10ms interval
|
||||
always @(posedge CLK_MEAS_i) begin
|
||||
if (syncpol_det_ctr == 0) begin
|
||||
hsync_i_pol <= (hsync_hpol_ctr > 18'h1ffff);
|
||||
vsync_i_pol <= (vsync_hpol_ctr > 18'h1ffff);
|
||||
|
||||
hsync_hpol_ctr <= 0;
|
||||
vsync_hpol_ctr <= 0;
|
||||
|
||||
if ((vsync_hpol_ctr == '0) | (vsync_hpol_ctr == '1)) begin
|
||||
// If vsync has been stale for ~100ms, clear activity flag
|
||||
if (sync_inactive_ctr == '1)
|
||||
sync_active <= 1'b0;
|
||||
else
|
||||
sync_inactive_ctr <= sync_inactive_ctr + 1'b1;
|
||||
end else begin
|
||||
sync_inactive_ctr <= 0;
|
||||
sync_active <= 1'b1;
|
||||
end
|
||||
end else begin
|
||||
if (HSYNC_i)
|
||||
hsync_hpol_ctr <= hsync_hpol_ctr + 1'b1;
|
||||
if (VSYNC_i)
|
||||
vsync_hpol_ctr <= vsync_hpol_ctr + 1'b1;
|
||||
end
|
||||
|
||||
syncpol_det_ctr <= syncpol_det_ctr + 1'b1;
|
||||
end
|
||||
|
||||
// Detect interlace and line count
|
||||
always @(posedge CLK_MEAS_i) begin
|
||||
if ((HSYNC_i_np_prev & ~HSYNC_i_np) & (meas_h_cnt > glitch_filt_thold)) begin
|
||||
// detect half-line equalization pulses
|
||||
if ((meas_h_cnt > ((pcnt_line/2) - (pcnt_line/4))) && (meas_h_cnt < ((pcnt_line/2) + (pcnt_line/4)))) begin
|
||||
/*if (meas_hl_det) begin
|
||||
meas_hl_det <= 1'b0;
|
||||
meas_h_cnt <= 0;
|
||||
meas_v_cnt <= meas_v_cnt + 1'b1;
|
||||
end else begin*/
|
||||
meas_hl_det <= 1'b1;
|
||||
meas_h_cnt <= meas_h_cnt + 1'b1;
|
||||
//end
|
||||
end else begin
|
||||
meas_hl_det <= 1'b0;
|
||||
meas_h_cnt <= 0;
|
||||
meas_v_cnt <= meas_v_cnt + 1'b1;
|
||||
end
|
||||
meas_h_cnt_sogref <= meas_h_cnt;
|
||||
end else if (meas_vblank_region & (meas_h_cnt >= pcnt_line+4)) begin
|
||||
// hsync may be missing or irregular during vblank, force line change detect if pcnt_line is exceeded
|
||||
meas_hl_det <= 1'b0;
|
||||
meas_h_cnt <= 0;
|
||||
meas_v_cnt <= meas_v_cnt + 1'b1;
|
||||
end else begin
|
||||
meas_h_cnt <= meas_h_cnt + 1'b1;
|
||||
end
|
||||
|
||||
if (VSYNC_i_np_prev & ~VSYNC_i_np) begin
|
||||
if ((meas_h_cnt_ref < meas_even_min_thold) | (meas_h_cnt_ref > meas_even_max_thold)) begin
|
||||
meas_fid <= FID_ODD;
|
||||
interlace_flag <= (meas_fid == FID_EVEN);
|
||||
|
||||
if (vsync_i_type == VSYNC_RAW) begin
|
||||
// vsync leading edge may occur at hsync edge or either side of it
|
||||
if ((HSYNC_i_np_prev & ~HSYNC_i_np) | (meas_h_cnt >= pcnt_line)) begin
|
||||
meas_v_cnt <= 1;
|
||||
vtotal <= meas_v_cnt;
|
||||
end else if (meas_h_cnt < meas_even_min_thold) begin
|
||||
meas_v_cnt <= 1;
|
||||
vtotal <= meas_v_cnt - 1'b1;
|
||||
end else begin
|
||||
meas_v_cnt <= 0;
|
||||
vtotal <= meas_v_cnt;
|
||||
end
|
||||
end else begin
|
||||
meas_v_cnt <= 0;
|
||||
vtotal <= meas_v_cnt;
|
||||
end
|
||||
end else begin
|
||||
meas_fid <= FID_EVEN;
|
||||
interlace_flag <= (meas_fid == FID_ODD);
|
||||
if (meas_fid == FID_EVEN) begin
|
||||
meas_v_cnt <= 0;
|
||||
vtotal <= meas_v_cnt;
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
endmodule
|
||||
+15
-104
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (C) 2015-2017 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
// Copyright (C) 2015-2023 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
//
|
||||
// This file is part of Open Source Scan Converter project.
|
||||
//
|
||||
@@ -17,21 +17,13 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
`include "lat_tester_includes.v"
|
||||
|
||||
module videogen (
|
||||
input clk27,
|
||||
input reset_n,
|
||||
input lt_active,
|
||||
input [1:0] lt_mode,
|
||||
input pclk,
|
||||
input [11:0] xpos,
|
||||
input [10:0] ypos,
|
||||
output reg [7:0] R_out,
|
||||
output reg [7:0] G_out,
|
||||
output reg [7:0] B_out,
|
||||
output reg HSYNC_out,
|
||||
output reg VSYNC_out,
|
||||
output reg DE_out,
|
||||
output reg [9:0] xpos,
|
||||
output reg [9:0] ypos
|
||||
output reg [7:0] B_out
|
||||
);
|
||||
|
||||
//Parameters for 720x480@59.94Hz (858px x 525lines, pclk 27MHz -> 59.94Hz)
|
||||
@@ -57,98 +49,17 @@ parameter V_GRAYRAMP = 10'd84;
|
||||
parameter H_BORDER = ((H_AREA-H_GRADIENT)>>1);
|
||||
parameter V_BORDER = ((V_AREA-V_GRADIENT)>>1);
|
||||
|
||||
parameter X_START = H_SYNCLEN + H_BACKPORCH;
|
||||
parameter Y_START = V_SYNCLEN + V_BACKPORCH;
|
||||
|
||||
//Counters
|
||||
reg [9:0] h_cnt; //max. 1024
|
||||
reg [9:0] v_cnt; //max. 1024
|
||||
|
||||
//HSYNC gen (negative polarity)
|
||||
always @(posedge clk27 or negedge reset_n)
|
||||
// Pattern gen
|
||||
always @(posedge pclk)
|
||||
begin
|
||||
if (!reset_n) begin
|
||||
h_cnt <= 0;
|
||||
xpos <= 0;
|
||||
HSYNC_out <= 0;
|
||||
end else begin
|
||||
//Hsync counter
|
||||
if (h_cnt < H_TOTAL-1) begin
|
||||
h_cnt <= h_cnt + 1'b1;
|
||||
if (h_cnt >= X_START)
|
||||
xpos <= xpos + 1'b1;
|
||||
end else begin
|
||||
h_cnt <= 0;
|
||||
xpos <= 0;
|
||||
end
|
||||
|
||||
//Hsync signal
|
||||
HSYNC_out <= (h_cnt < H_SYNCLEN) ? 1'b0 : 1'b1;
|
||||
end
|
||||
end
|
||||
|
||||
//VSYNC gen (negative polarity)
|
||||
always @(posedge clk27 or negedge reset_n)
|
||||
begin
|
||||
if (!reset_n) begin
|
||||
v_cnt <= 0;
|
||||
ypos <= 0;
|
||||
VSYNC_out <= 0;
|
||||
end else begin
|
||||
//Vsync counter
|
||||
if (h_cnt == H_TOTAL-1) begin
|
||||
if (v_cnt < V_TOTAL-1) begin
|
||||
v_cnt <= v_cnt + 1'b1;
|
||||
if (v_cnt >= Y_START)
|
||||
ypos <= ypos + 1'b1;
|
||||
end else begin
|
||||
v_cnt <= 0;
|
||||
ypos <= 0;
|
||||
end
|
||||
end
|
||||
|
||||
//Vsync signal
|
||||
VSYNC_out <= (v_cnt < V_SYNCLEN) ? 1'b0 : 1'b1;
|
||||
end
|
||||
end
|
||||
|
||||
//Data and ENABLE gen
|
||||
always @(posedge clk27 or negedge reset_n)
|
||||
begin
|
||||
if (!reset_n) begin
|
||||
R_out <= 8'h00;
|
||||
G_out <= 8'h00;
|
||||
B_out <= 8'h00;
|
||||
DE_out <= 1'b0;
|
||||
end else begin
|
||||
if (lt_active) begin
|
||||
case (lt_mode)
|
||||
default: begin
|
||||
{R_out, G_out, B_out} <= {3{8'h00}};
|
||||
end
|
||||
`LT_POS_TOPLEFT: begin
|
||||
{R_out, G_out, B_out} <= {3{((xpos < (H_ACTIVE/`LT_WIDTH_DIV)) && (ypos < (V_ACTIVE/`LT_HEIGHT_DIV))) ? 8'hff : 8'h00}};
|
||||
end
|
||||
`LT_POS_CENTER: begin
|
||||
{R_out, G_out, B_out} <= {3{((xpos >= ((H_ACTIVE/2)-(H_ACTIVE/(`LT_WIDTH_DIV*2)))) && (xpos < ((H_ACTIVE/2)+(H_ACTIVE/(`LT_WIDTH_DIV*2)))) && (ypos >= ((V_ACTIVE/2)-(V_ACTIVE/(`LT_HEIGHT_DIV*2)))) && (ypos < ((V_ACTIVE/2)+(V_ACTIVE/(`LT_HEIGHT_DIV*2))))) ? 8'hff : 8'h00}};
|
||||
end
|
||||
`LT_POS_BOTTOMRIGHT: begin
|
||||
{R_out, G_out, B_out} <= {3{((xpos >= (H_ACTIVE-(H_ACTIVE/`LT_WIDTH_DIV))) && (ypos >= (V_ACTIVE-(V_ACTIVE/`LT_HEIGHT_DIV)))) ? 8'hff : 8'h00}};
|
||||
end
|
||||
endcase
|
||||
end else begin
|
||||
if ((xpos < H_OVERSCAN) || (xpos >= H_OVERSCAN+H_AREA) || (ypos < V_OVERSCAN) || (ypos >= V_OVERSCAN+V_AREA))
|
||||
{R_out, G_out, B_out} <= {3{(xpos[0] ^ ypos[0]) ? 8'hff : 8'h00}};
|
||||
else if ((xpos < H_OVERSCAN+H_BORDER) || (xpos >= H_OVERSCAN+H_AREA-H_BORDER) || (ypos < V_OVERSCAN+V_BORDER) || (ypos >= V_OVERSCAN+V_AREA-V_BORDER))
|
||||
{R_out, G_out, B_out} <= {3{8'h50}};
|
||||
else if (ypos >= V_OVERSCAN+V_BORDER+V_GRADIENT-V_GRAYRAMP)
|
||||
{R_out, G_out, B_out} <= {3{8'((((xpos - (H_OVERSCAN+H_BORDER)) >> 4) << 3) + (xpos - (H_OVERSCAN+H_BORDER) >> 6))}};
|
||||
else
|
||||
{R_out, G_out, B_out} <= {3{8'((xpos - (H_OVERSCAN+H_BORDER)) >> 1)}};
|
||||
end
|
||||
|
||||
DE_out <= (h_cnt >= X_START && h_cnt < X_START + H_ACTIVE && v_cnt >= Y_START && v_cnt < Y_START + V_ACTIVE);
|
||||
end
|
||||
if ((xpos < H_OVERSCAN) || (xpos >= H_OVERSCAN+H_AREA) || (ypos < V_OVERSCAN) || (ypos >= V_OVERSCAN+V_AREA))
|
||||
{R_out, G_out, B_out} <= {3{(xpos[0] ^ ypos[0]) ? 8'hff : 8'h00}};
|
||||
else if ((xpos < H_OVERSCAN+H_BORDER) || (xpos >= H_OVERSCAN+H_AREA-H_BORDER) || (ypos < V_OVERSCAN+V_BORDER) || (ypos >= V_OVERSCAN+V_AREA-V_BORDER))
|
||||
{R_out, G_out, B_out} <= {3{8'h50}};
|
||||
else if (ypos >= V_OVERSCAN+V_BORDER+V_GRADIENT-V_GRAYRAMP)
|
||||
{R_out, G_out, B_out} <= {3{8'((((xpos - (H_OVERSCAN+H_BORDER)) >> 4) << 3) + (xpos - (H_OVERSCAN+H_BORDER) >> 6))}};
|
||||
else
|
||||
{R_out, G_out, B_out} <= {3{8'((xpos - (H_OVERSCAN+H_BORDER)) >> 1)}};
|
||||
end
|
||||
|
||||
endmodule
|
||||
@@ -0,0 +1,58 @@
|
||||
# flash details
|
||||
set flash_base 0x02000000
|
||||
set flash_imem_offset 0x00100000
|
||||
set flash_imem_base [format 0x%.8x [expr $flash_base + $flash_imem_offset]]
|
||||
set flash_secsize 65536
|
||||
|
||||
# flash controller register addresses
|
||||
set control_register 0x00020100
|
||||
set operating_protocols_setting 0x00020110
|
||||
set read_instr 0x00020114
|
||||
set write_instr 0x00020118
|
||||
set flash_cmd_setting 0x0002011c
|
||||
set flash_cmd_ctrl 0x00020120
|
||||
set flash_cmd_addr_register 0x00020124
|
||||
set flash_cmd_write_data_0 0x00020128
|
||||
set flash_cmd_read_data_0 0x00020130
|
||||
|
||||
#Select the master service type and check for available service paths.
|
||||
set service_paths [get_service_paths master]
|
||||
|
||||
#Set the master service path.
|
||||
set master_service_path [lindex $service_paths 0]
|
||||
|
||||
#Open the master service.
|
||||
set claim_path [claim_service master $master_service_path mylib]
|
||||
|
||||
puts "Halting CPU"
|
||||
master_write_32 $claim_path 0x40 0x00000001
|
||||
master_write_32 $claim_path 0x40 0x80000001
|
||||
|
||||
#read status reg
|
||||
master_write_32 $claim_path $flash_cmd_setting 0x00001805
|
||||
master_write_32 $claim_path $flash_cmd_ctrl 0x1
|
||||
set st [master_read_8 $claim_path $flash_cmd_read_data_0 1]
|
||||
puts "\nSTATUS: $st"
|
||||
|
||||
#read flag reg
|
||||
master_write_32 $claim_path $flash_cmd_setting 0x00001848
|
||||
master_write_32 $claim_path $flash_cmd_ctrl 0x1
|
||||
set flags [master_read_8 $claim_path $flash_cmd_read_data_0 1]
|
||||
puts "FLAGS: $flags"
|
||||
|
||||
#read vcr reg
|
||||
master_write_32 $claim_path $flash_cmd_setting 0x00001861
|
||||
master_write_32 $claim_path $flash_cmd_ctrl 0x1
|
||||
set vcr [master_read_8 $claim_path $flash_cmd_read_data_0 1]
|
||||
puts "VCR: $vcr"
|
||||
|
||||
#read evcr reg
|
||||
master_write_32 $claim_path $flash_cmd_setting 0x00001881
|
||||
master_write_32 $claim_path $flash_cmd_ctrl 0x1
|
||||
set evcr [master_read_8 $claim_path $flash_cmd_read_data_0 1]
|
||||
puts "EVCR: $evcr"
|
||||
|
||||
#clear flag register
|
||||
master_write_32 $claim_path $flash_cmd_setting 0x00000050
|
||||
master_write_32 $claim_path $flash_cmd_ctrl 0x1
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
--- sys/synthesis/submodules/sys_master_0.v 2025-07-25 10:15:46.708247405 +0300
|
||||
+++ sys/synthesis/submodules/sys_master_0.v 2025-07-25 10:15:54.937804924 +0300
|
||||
@@ -156,9 +156,9 @@
|
||||
|
||||
altera_avalon_sc_fifo #(
|
||||
.SYMBOLS_PER_BEAT (1),
|
||||
.BITS_PER_SYMBOL (8),
|
||||
- .FIFO_DEPTH (64),
|
||||
+ .FIFO_DEPTH (1024),
|
||||
.CHANNEL_WIDTH (0),
|
||||
.ERROR_WIDTH (0),
|
||||
.USE_PACKETS (0),
|
||||
.USE_FILL_LEVEL (0),
|
||||
@@ -0,0 +1,36 @@
|
||||
#Select the master service type and check for available service paths.
|
||||
while 1 {
|
||||
set service_paths [get_service_paths master]
|
||||
if {[llength $service_paths] > 0} {
|
||||
break
|
||||
}
|
||||
puts "Refreshing connections..."
|
||||
refresh_connections
|
||||
after 100
|
||||
}
|
||||
|
||||
#Set the master service path.
|
||||
set master_service_path [lindex $service_paths 0]
|
||||
|
||||
#Open the master service.
|
||||
set claim_path [claim_service master $master_service_path mylib]
|
||||
|
||||
puts "Halting CPU"
|
||||
master_write_32 $claim_path 0x40 0x00000001
|
||||
master_write_32 $claim_path 0x40 0x80000001
|
||||
|
||||
master_write_32 $claim_path 0x5c [expr 0x2207b1]
|
||||
puts "DPC: [master_read_32 $claim_path 0x10 1]"
|
||||
master_write_32 $claim_path 0x5c [expr 0x220341]
|
||||
puts "MEPC: [master_read_32 $claim_path 0x10 1]"
|
||||
master_write_32 $claim_path 0x5c [expr 0x220342]
|
||||
puts "MCAUSE: [master_read_32 $claim_path 0x10 1]"
|
||||
|
||||
set offset 0x1001
|
||||
foreach i {ra sp gp tp t0 t1 t2 s0 s1 a0 a1 a2 a3 a4 a5} {
|
||||
master_write_32 $claim_path 0x5c [expr 0x220000 + $offset]
|
||||
puts "$i: [master_read_32 $claim_path 0x10 1]"
|
||||
set offset [expr $offset + 1]
|
||||
}
|
||||
|
||||
master_write_32 $claim_path 0x40 0x40000000
|
||||
@@ -0,0 +1,29 @@
|
||||
#Select the master service type and check for available service paths.
|
||||
while 1 {
|
||||
set service_paths [get_service_paths master]
|
||||
if {[llength $service_paths] > 0} {
|
||||
break
|
||||
}
|
||||
puts "Refreshing connections..."
|
||||
refresh_connections
|
||||
after 100
|
||||
}
|
||||
|
||||
#Set the master service path.
|
||||
set master_service_path [lindex $service_paths 0]
|
||||
|
||||
#Open the master service.
|
||||
set claim_path [claim_service master $master_service_path mylib]
|
||||
|
||||
puts "Halting CPU"
|
||||
master_write_32 $claim_path 0x40 0x00000001
|
||||
master_write_32 $claim_path 0x40 0x80000001
|
||||
|
||||
puts "Resetting system"
|
||||
master_write_32 $claim_path 0x40 0x00000003
|
||||
after 1
|
||||
master_write_32 $claim_path 0x40 0x00000001
|
||||
master_write_32 $claim_path 0x40 0x00000000
|
||||
|
||||
close_service master $claim_path
|
||||
puts "Done"
|
||||
@@ -0,0 +1,30 @@
|
||||
#Select the master service type and check for available service paths.
|
||||
while 1 {
|
||||
set service_paths [get_service_paths master]
|
||||
if {[llength $service_paths] > 0} {
|
||||
break
|
||||
}
|
||||
puts "Refreshing connections..."
|
||||
refresh_connections
|
||||
after 100
|
||||
}
|
||||
|
||||
#Set the master service path.
|
||||
set master_service_path [lindex $service_paths 0]
|
||||
|
||||
#Open the master service.
|
||||
set claim_path [claim_service master $master_service_path mylib]
|
||||
|
||||
puts "Halting CPU via sleep"
|
||||
master_write_32 $claim_path 0x200 0x00000002
|
||||
|
||||
close_service master $claim_path
|
||||
|
||||
|
||||
set jtag_debug_list [get_service_paths jtag_debug]
|
||||
set jd [ lindex $jtag_debug_list 0 ]
|
||||
open_service jtag_debug $jd
|
||||
puts "Resetting system"
|
||||
jtag_debug_reset_system $jd
|
||||
close_service jtag_debug $jd
|
||||
puts "Done"
|
||||
+79
-12
@@ -1,5 +1,35 @@
|
||||
# flash details
|
||||
set flash_base 0x02000000
|
||||
set flash_imem_offset 0x00050000
|
||||
set flash_imem_base [format 0x%.8x [expr $flash_base + $flash_imem_offset]]
|
||||
set flash_secsize 65536
|
||||
|
||||
# flash controller register addresses
|
||||
set control_register 0x00020100
|
||||
set operating_protocols_setting 0x00020110
|
||||
set read_instr 0x00020114
|
||||
set write_instr 0x00020118
|
||||
set flash_cmd_setting 0x0002011c
|
||||
set flash_cmd_ctrl 0x00020120
|
||||
set flash_cmd_addr_register 0x00020124
|
||||
set flash_cmd_write_data_0 0x00020128
|
||||
set flash_cmd_read_data_0 0x00020130
|
||||
|
||||
# target file details
|
||||
set bin_file mem_init/flash.bin
|
||||
set bin_size [file size $bin_file]
|
||||
set num_sectors [expr ($bin_size / $flash_secsize) + (($bin_size % $flash_secsize) ne 0)]
|
||||
|
||||
#Select the master service type and check for available service paths.
|
||||
set service_paths [get_service_paths master]
|
||||
while 1 {
|
||||
set service_paths [get_service_paths master]
|
||||
if {[llength $service_paths] > 0} {
|
||||
break
|
||||
}
|
||||
puts "Refreshing connections..."
|
||||
refresh_connections
|
||||
after 100
|
||||
}
|
||||
|
||||
#Set the master service path.
|
||||
set master_service_path [lindex $service_paths 0]
|
||||
@@ -8,18 +38,55 @@ set master_service_path [lindex $service_paths 0]
|
||||
set claim_path [claim_service master $master_service_path mylib]
|
||||
|
||||
puts "Halting CPU"
|
||||
master_write_32 $claim_path 0x0 0x1
|
||||
master_write_32 $claim_path 0x40 0x00000001
|
||||
master_write_32 $claim_path 0x40 0x80000001
|
||||
|
||||
puts "Writing block RAM"
|
||||
master_write_from_file $claim_path mem_init/sys_onchip_memory2_0.bin 0x10000
|
||||
#write enable
|
||||
master_write_32 $claim_path $flash_cmd_setting 0x00000006
|
||||
master_write_32 $claim_path $flash_cmd_ctrl 0x1
|
||||
|
||||
#write status register (clear BP)
|
||||
master_write_32 $claim_path $flash_cmd_setting 0x00001001
|
||||
#master_write_32 $claim_path $flash_cmd_write_data_0 0x0000005c
|
||||
master_write_32 $claim_path $flash_cmd_write_data_0 0x00000000
|
||||
master_write_32 $claim_path $flash_cmd_ctrl 0x1
|
||||
|
||||
puts "Erasing $num_sectors flash sectors"
|
||||
set addr $flash_imem_offset
|
||||
for {set i 0} {$i<$num_sectors} {incr i} {
|
||||
master_write_32 $claim_path $flash_cmd_setting 0x00000006
|
||||
master_write_32 $claim_path $flash_cmd_ctrl 0x1
|
||||
master_write_32 $claim_path $flash_cmd_setting 0x000003D8
|
||||
master_write_32 $claim_path $flash_cmd_addr_register $addr
|
||||
master_write_32 $claim_path $flash_cmd_ctrl 0x1
|
||||
set addr [expr $addr + $flash_secsize]
|
||||
after 500
|
||||
}
|
||||
|
||||
puts "Writing flash"
|
||||
# JTAG to Avalon master does not support sink backpressure
|
||||
#master_write_from_file $claim_path mem_init/flash.bin $flash_imem_base
|
||||
|
||||
# work around lack of backpressure support by writing chunks of master FIFO size
|
||||
set chunks [llength [glob mem_init/chunks/*]]
|
||||
puts "Programming $chunks chunks"
|
||||
set addr $flash_imem_base
|
||||
for {set i 0} {$i<$chunks} {incr i} {
|
||||
set file [format "flash.%04d" $i]
|
||||
master_write_from_file $claim_path mem_init/chunks/$file $addr
|
||||
set addr [expr $addr + 1024]
|
||||
}
|
||||
#master_read_to_file $claim_path mem_init/flash_readback.bin $flash_imem_base $bin_size
|
||||
#master_read_to_file $claim_path mem_init/ram_readback.bin 0x010000 65536
|
||||
|
||||
# flush flashctrl cmd fifo to ensure writes have finished
|
||||
master_read_32 $claim_path $flash_base 1
|
||||
|
||||
puts "Resetting system"
|
||||
master_write_32 $claim_path 0x40 0x00000003
|
||||
after 1
|
||||
master_write_32 $claim_path 0x40 0x00000001
|
||||
master_write_32 $claim_path 0x40 0x00000000
|
||||
|
||||
close_service master $claim_path
|
||||
|
||||
|
||||
set jtag_debug_list [get_service_paths jtag_debug]
|
||||
set jd [ lindex $jtag_debug_list 0 ]
|
||||
open_service jtag_debug $jd
|
||||
puts "Resetting system"
|
||||
jtag_debug_reset_system $jd
|
||||
close_service jtag_debug $jd
|
||||
puts "Done"
|
||||
+100
-71
@@ -26,6 +26,103 @@
|
||||
}]]]>
|
||||
</Plugin>
|
||||
</Plugins>
|
||||
<VirtualDirectory Name="sys_controller">
|
||||
<VirtualDirectory Name="fatfs">
|
||||
<VirtualDirectory Name="source">
|
||||
<File Name="sys_controller/fatfs/source/ffsystem.c"/>
|
||||
<File Name="sys_controller/fatfs/source/ff.h"/>
|
||||
<File Name="sys_controller/fatfs/source/ff.c"/>
|
||||
<File Name="sys_controller/fatfs/source/diskio.h"/>
|
||||
<File Name="sys_controller/fatfs/source/diskio.c"/>
|
||||
<File Name="sys_controller/fatfs/source/ffunicode.c"/>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
<File Name="sys_controller/av_controller.c"/>
|
||||
<VirtualDirectory Name="src">
|
||||
<File Name="sys_controller/src/file.c"/>
|
||||
<File Name="sys_controller/src/sdcard.c"/>
|
||||
<File Name="sys_controller/src/firmware.c"/>
|
||||
<File Name="sys_controller/src/controls.c"/>
|
||||
<File Name="sys_controller/src/avconfig.c"/>
|
||||
<File Name="sys_controller/src/userdata.c"/>
|
||||
<File Name="sys_controller/src/flash.c"/>
|
||||
<File Name="sys_controller/src/menu.c"/>
|
||||
<File Name="sys_controller/src/utils.c"/>
|
||||
<File Name="sys_controller/src/video_modes_list.c"/>
|
||||
<File Name="sys_controller/src/video_modes.c"/>
|
||||
<File Name="sys_controller/src/fat16_export.c"/>
|
||||
<File Name="sys_controller/src/lcd.c"/>
|
||||
<File Name="sys_controller/src/lumacode_palettes.c"/>
|
||||
<File Name="sys_controller/src/shmask_arrays.c"/>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="ic_drivers">
|
||||
<VirtualDirectory Name="pcm1862">
|
||||
<File Name="sys_controller/ic_drivers/pcm1862/pcm1862_regs.h"/>
|
||||
<File Name="sys_controller/ic_drivers/pcm1862/pcm1862.c"/>
|
||||
<File Name="sys_controller/ic_drivers/pcm1862/pcm1862.h"/>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="st7032">
|
||||
<File Name="sys_controller/ic_drivers/st7032/st7032.c"/>
|
||||
<File Name="sys_controller/ic_drivers/st7032/st7032.h"/>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="tvp7002">
|
||||
<File Name="sys_controller/ic_drivers/tvp7002/tvp7002.c"/>
|
||||
<File Name="sys_controller/ic_drivers/tvp7002/tvp7002.h"/>
|
||||
<File Name="sys_controller/ic_drivers/tvp7002/tvp7002_regs.h"/>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="it6613">
|
||||
<File Name="sys_controller/ic_drivers/it6613/typedef.h"/>
|
||||
<File Name="sys_controller/ic_drivers/it6613/edid.h"/>
|
||||
<File Name="sys_controller/ic_drivers/it6613/it6613_sys.c"/>
|
||||
<File Name="sys_controller/ic_drivers/it6613/it6613.h"/>
|
||||
<File Name="sys_controller/ic_drivers/it6613/hdmitx.h"/>
|
||||
<File Name="sys_controller/ic_drivers/it6613/HDMI_COMMON.h"/>
|
||||
<File Name="sys_controller/ic_drivers/it6613/it6613_sys.h"/>
|
||||
<File Name="sys_controller/ic_drivers/it6613/EDID.c"/>
|
||||
<File Name="sys_controller/ic_drivers/it6613/hdmitx_nios2.c"/>
|
||||
<File Name="sys_controller/ic_drivers/it6613/it6613_drv.h"/>
|
||||
<File Name="sys_controller/ic_drivers/it6613/it6613.c"/>
|
||||
<File Name="sys_controller/ic_drivers/it6613/HDMI_TX.h"/>
|
||||
<File Name="sys_controller/ic_drivers/it6613/HDMI_TX.c"/>
|
||||
<File Name="sys_controller/ic_drivers/it6613/it6613_drv.c"/>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="sh1107">
|
||||
<File Name="sys_controller/ic_drivers/sh1107/font12.h"/>
|
||||
<File Name="sys_controller/ic_drivers/sh1107/sh1107.h"/>
|
||||
<File Name="sys_controller/ic_drivers/sh1107/sh1107.c"/>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="ths7353">
|
||||
<File Name="sys_controller/ic_drivers/ths7353/ths7353.c"/>
|
||||
<File Name="sys_controller/ic_drivers/ths7353/ths7353.h"/>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="ulibSD">
|
||||
<File Name="sys_controller/ulibSD/sd_io.c"/>
|
||||
<File Name="sys_controller/ulibSD/integer.h"/>
|
||||
<File Name="sys_controller/ulibSD/spi_io.c"/>
|
||||
<File Name="sys_controller/ulibSD/sd_io.h"/>
|
||||
<File Name="sys_controller/ulibSD/spi_io.h"/>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="inc">
|
||||
<File Name="sys_controller/inc/file.h"/>
|
||||
<File Name="sys_controller/inc/firmware.h"/>
|
||||
<File Name="sys_controller/inc/controls.h"/>
|
||||
<File Name="sys_controller/inc/av_controller.h"/>
|
||||
<File Name="sys_controller/inc/menu.h"/>
|
||||
<File Name="sys_controller/inc/sdcard.h"/>
|
||||
<File Name="sys_controller/inc/utils.h"/>
|
||||
<File Name="sys_controller/inc/avconfig.h"/>
|
||||
<File Name="sys_controller/inc/video_modes.h"/>
|
||||
<File Name="sys_controller/inc/fat16_export.h"/>
|
||||
<File Name="sys_controller/inc/flash.h"/>
|
||||
<File Name="sys_controller/inc/userdata.h"/>
|
||||
<File Name="sys_controller/inc/lcd.h"/>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="config">
|
||||
<File Name="sys_controller/config/ffconf.h"/>
|
||||
<File Name="sys_controller/config/sysconfig.h"/>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
<Reconciliation>
|
||||
<Regexes/>
|
||||
<Excludepaths/>
|
||||
@@ -33,76 +130,8 @@
|
||||
<Extensions>
|
||||
<![CDATA[*.cpp;*.c;*.h;*.hpp;*.xrc;*.wxcp;*.fbp]]>
|
||||
</Extensions>
|
||||
<Topleveldir>/home/markus/Code/ossc/software</Topleveldir>
|
||||
<Topleveldir>/home/markus/Code/ossc/software/</Topleveldir>
|
||||
</Reconciliation>
|
||||
<VirtualDirectory Name="sys_controller">
|
||||
<VirtualDirectory Name="ths7353">
|
||||
<File Name="sys_controller/ths7353/ths7353.h"/>
|
||||
<File Name="sys_controller/ths7353/ths7353.c"/>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="it6613">
|
||||
<File Name="sys_controller/it6613/it6613_drv.c"/>
|
||||
<File Name="sys_controller/it6613/HDMI_TX.c"/>
|
||||
<File Name="sys_controller/it6613/HDMI_TX.h"/>
|
||||
<File Name="sys_controller/it6613/it6613.c"/>
|
||||
<File Name="sys_controller/it6613/it6613_drv.h"/>
|
||||
<File Name="sys_controller/it6613/hdmitx_nios2.c"/>
|
||||
<File Name="sys_controller/it6613/EDID.c"/>
|
||||
<File Name="sys_controller/it6613/it6613_sys.h"/>
|
||||
<File Name="sys_controller/it6613/HDMI_COMMON.h"/>
|
||||
<File Name="sys_controller/it6613/hdmitx.h"/>
|
||||
<File Name="sys_controller/it6613/it6613.h"/>
|
||||
<File Name="sys_controller/it6613/it6613_sys.c"/>
|
||||
<File Name="sys_controller/it6613/edid.h"/>
|
||||
<File Name="sys_controller/it6613/typedef.h"/>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="spi_charlcd">
|
||||
<File Name="sys_controller/spi_charlcd/lcd.c"/>
|
||||
<File Name="sys_controller/spi_charlcd/lcd.h"/>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="tvp7002">
|
||||
<File Name="sys_controller/tvp7002/video_modes.c"/>
|
||||
<File Name="sys_controller/tvp7002/tvp7002_regs.h"/>
|
||||
<File Name="sys_controller/tvp7002/video_modes.h"/>
|
||||
<File Name="sys_controller/tvp7002/tvp7002.h"/>
|
||||
<File Name="sys_controller/tvp7002/tvp7002.c"/>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="memory">
|
||||
<File Name="sys_controller/memory/flash.h"/>
|
||||
<File Name="sys_controller/memory/flash.c"/>
|
||||
<File Name="sys_controller/memory/sdcard.h"/>
|
||||
<File Name="sys_controller/memory/sdcard.c"/>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="ossc">
|
||||
<File Name="sys_controller/ossc/utils.h"/>
|
||||
<File Name="sys_controller/ossc/utils.c"/>
|
||||
<File Name="sys_controller/ossc/menu.c"/>
|
||||
<File Name="sys_controller/ossc/menu.h"/>
|
||||
<File Name="sys_controller/ossc/sysconfig.h"/>
|
||||
<File Name="sys_controller/ossc/controls.h"/>
|
||||
<File Name="sys_controller/ossc/controls.c"/>
|
||||
<File Name="sys_controller/ossc/avconfig.h"/>
|
||||
<File Name="sys_controller/ossc/avconfig.c"/>
|
||||
<File Name="sys_controller/ossc/av_controller.c"/>
|
||||
<File Name="sys_controller/ossc/av_controller.h"/>
|
||||
<File Name="sys_controller/ossc/firmware.h"/>
|
||||
<File Name="sys_controller/ossc/firmware.c"/>
|
||||
<File Name="sys_controller/ossc/userdata.h"/>
|
||||
<File Name="sys_controller/ossc/userdata.c"/>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="ulibSD">
|
||||
<File Name="sys_controller/ulibSD/integer.h"/>
|
||||
<File Name="sys_controller/ulibSD/sd_io.c"/>
|
||||
<File Name="sys_controller/ulibSD/sd_io.h"/>
|
||||
<File Name="sys_controller/ulibSD/spi_io.h"/>
|
||||
<File Name="sys_controller/ulibSD/spi_io.c"/>
|
||||
</VirtualDirectory>
|
||||
<VirtualDirectory Name="pcm1862">
|
||||
<File Name="sys_controller/pcm1862/pcm1862.c"/>
|
||||
<File Name="sys_controller/pcm1862/pcm1862.h"/>
|
||||
<File Name="sys_controller/pcm1862/pcm1862_regs.h"/>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
<Description/>
|
||||
<Dependencies/>
|
||||
<Dependencies Name="Debug"/>
|
||||
@@ -141,7 +170,7 @@
|
||||
<Target Name="Ack BSP update">cd ../sys_controller_bsp && touch bsp_timestamp</Target>
|
||||
<RebuildCommand/>
|
||||
<CleanCommand>make clean</CleanCommand>
|
||||
<BuildCommand>make ENABLE_AUDIO=y APP_CFLAGS_DEBUG_LEVEL="-DDEBUG" generate_hex</BuildCommand>
|
||||
<BuildCommand>make ENABLE_AUDIO=y APP_CFLAGS_DEBUG_LEVEL="-DDEBUG"</BuildCommand>
|
||||
<PreprocessFileCommand/>
|
||||
<SingleFileCommand/>
|
||||
<MakefileGenerationCommand/>
|
||||
@@ -187,7 +216,7 @@
|
||||
<Target Name="Ack BSP update">cd ../sys_controller_bsp && touch bsp_timestamp</Target>
|
||||
<RebuildCommand/>
|
||||
<CleanCommand>make clean</CleanCommand>
|
||||
<BuildCommand>make ENABLE_AUDIO=y generate_hex</BuildCommand>
|
||||
<BuildCommand>make ENABLE_AUDIO=y</BuildCommand>
|
||||
<PreprocessFileCommand/>
|
||||
<SingleFileCommand/>
|
||||
<MakefileGenerationCommand/>
|
||||
|
||||
+137
-110
@@ -38,13 +38,13 @@ ALT_LDFLAGS :=
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# The adjust-path macro
|
||||
#
|
||||
#
|
||||
# If COMSPEC/ComSpec is defined, Make is launched from Windows through
|
||||
# Cygwin. The adjust-path macro converts absolute windows paths into
|
||||
# unix style paths (Example: c:/dir -> /c/dir). This will ensture
|
||||
# paths are readable by GNU Make.
|
||||
#
|
||||
# If COMSPEC/ComSpec is not defined, Make is launched from linux, and no
|
||||
# If COMSPEC/ComSpec is not defined, Make is launched from linux, and no
|
||||
# adjustment is necessary
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
@@ -57,7 +57,7 @@ endif # COMSPEC
|
||||
|
||||
ifdef COMSPEC # if Windows OS
|
||||
|
||||
ifeq ($(MAKE_VERSION),3.81)
|
||||
ifeq ($(MAKE_VERSION),3.81)
|
||||
#
|
||||
# adjust-path/adjust-path-mixed for Mingw Gnu Make on Windows
|
||||
#
|
||||
@@ -69,10 +69,10 @@ ifeq ($(MAKE_VERSION),3.81)
|
||||
|
||||
#
|
||||
# adjust-path
|
||||
# - converts back slash characters into forward slashes
|
||||
# - converts back slash characters into forward slashes
|
||||
# - if input arg ($1) is an empty string then return the empty string
|
||||
# - if input arg ($1) does not contain the string ":/", then return input arg
|
||||
# - using sed, convert mixed path [c:/...] into mingw path [/c/...]
|
||||
# - using sed, convert mixed path [c:/...] into mingw path [/c/...]
|
||||
define adjust-path
|
||||
$(strip \
|
||||
$(if $1,\
|
||||
@@ -83,13 +83,13 @@ endef
|
||||
|
||||
#
|
||||
# adjust-path-mixed
|
||||
# - converts back slash characters into forward slashes
|
||||
# - converts back slash characters into forward slashes
|
||||
# - if input arg ($1) is an empty string then return the empty string
|
||||
# - if input arg ($1) does not begin with a forward slash '/' char, then
|
||||
# - if input arg ($1) does not begin with a forward slash '/' char, then
|
||||
# return input arg
|
||||
# - using sed, convert mingw path [/c/...] or cygwin path [/c/cygdrive/...]
|
||||
# into a mixed path [c:/...]
|
||||
define adjust-path-mixed
|
||||
# - using sed, convert mingw path [/c/...] or cygwin path [/c/cygdrive/...]
|
||||
# into a mixed path [c:/...]
|
||||
define adjust-path-mixed
|
||||
$(strip \
|
||||
$(if $1,\
|
||||
$(if $(findstring $(subst \,/,$1),$(patsubst /%,%,$(subst \,/,$1))),\
|
||||
@@ -97,7 +97,7 @@ $(subst \,/,$1),\
|
||||
$(shell echo $(subst \,/,$1) | sed -e 's,^/cygdrive/\([a-zA-Z]\)/,\1:/,' -e 's,^/\([a-zA-Z]\)/,\1:/,'))))
|
||||
endef
|
||||
|
||||
else # MAKE_VERSION != 3.81 (MAKE_VERSION == 3.80 or MAKE_VERSION == 3.79)
|
||||
else # MAKE_VERSION != 3.81 (MAKE_VERSION == 3.80 or MAKE_VERSION == 3.79)
|
||||
#
|
||||
# adjust-path for Cygwin Gnu Make
|
||||
# $(call adjust-path,c:/aaa/bbb) = /cygdrive/c/aaa/bbb
|
||||
@@ -123,56 +123,63 @@ endif # COMSPEC
|
||||
ACTIVE_BUILD_CONFIG := default
|
||||
BUILD_CONFIGS := default
|
||||
|
||||
# The following TYPE comment allows tools to identify the 'type' of target this
|
||||
# makefile is associated with.
|
||||
# The following TYPE comment allows tools to identify the 'type' of target this
|
||||
# makefile is associated with.
|
||||
# TYPE: APP_MAKEFILE
|
||||
|
||||
# This following VERSION comment indicates the version of the tool used to
|
||||
# generate this makefile. A makefile variable is provided for VERSION as well.
|
||||
# This following VERSION comment indicates the version of the tool used to
|
||||
# generate this makefile. A makefile variable is provided for VERSION as well.
|
||||
# ACDS_VERSION: 14.1
|
||||
ACDS_VERSION := 14.1
|
||||
|
||||
# This following BUILD_NUMBER comment indicates the build number of the tool
|
||||
# used to generate this makefile.
|
||||
# This following BUILD_NUMBER comment indicates the build number of the tool
|
||||
# used to generate this makefile.
|
||||
# BUILD_NUMBER: 190
|
||||
|
||||
# Define path to the application ELF.
|
||||
# It may be used by the makefile fragments so is defined before including them.
|
||||
#
|
||||
# Define path to the application ELF.
|
||||
# It may be used by the makefile fragments so is defined before including them.
|
||||
#
|
||||
ELF := sys_controller.elf
|
||||
|
||||
# Paths to C, C++, and assembly source files.
|
||||
C_SRCS += it6613/EDID.c
|
||||
C_SRCS += it6613/HDMI_TX.c
|
||||
C_SRCS += it6613/hdmitx_nios2.c
|
||||
C_SRCS += it6613/it6613.c
|
||||
C_SRCS += it6613/it6613_drv.c
|
||||
C_SRCS += it6613/it6613_sys.c
|
||||
C_SRCS += tvp7002/tvp7002.c
|
||||
C_SRCS += tvp7002/video_modes.c
|
||||
C_SRCS += ths7353/ths7353.c
|
||||
C_SRCS += pcm1862/pcm1862.c
|
||||
C_SRCS += spi_charlcd/lcd.c
|
||||
C_SRCS += memory/flash.c
|
||||
C_SRCS += memory/sdcard.c
|
||||
C_SRCS += ossc/av_controller.c
|
||||
C_SRCS += ossc/avconfig.c
|
||||
C_SRCS += ossc/controls.c
|
||||
C_SRCS += ossc/firmware.c
|
||||
C_SRCS += ossc/fat16_export.c
|
||||
C_SRCS += av_controller.c
|
||||
C_SRCS += src/avconfig.c
|
||||
C_SRCS += src/utils.c
|
||||
C_SRCS += src/controls.c
|
||||
ifeq ($(OSDLANG),JP)
|
||||
C_SRCS += ossc/menu_sjis.c
|
||||
C_SRCS += src/menu_sjis.c
|
||||
else
|
||||
C_SRCS += ossc/menu.c
|
||||
C_SRCS += src/menu.c
|
||||
endif
|
||||
C_SRCS += src/video_modes.c
|
||||
C_SRCS += src/flash.c
|
||||
C_SRCS += src/firmware.c
|
||||
ifeq ($(OSDLANG),JP)
|
||||
C_SRCS += ossc/userdata_sjis.c
|
||||
C_SRCS += src/userdata_sjis.c
|
||||
else
|
||||
C_SRCS += ossc/userdata.c
|
||||
C_SRCS += src/userdata.c
|
||||
endif
|
||||
C_SRCS += ossc/utils.c
|
||||
C_SRCS += src/sdcard.c
|
||||
C_SRCS += src/fat16_export.c
|
||||
C_SRCS += src/lcd.c
|
||||
C_SRCS += src/file.c
|
||||
C_SRCS += ic_drivers/it6613/EDID.c
|
||||
C_SRCS += ic_drivers/it6613/HDMI_TX.c
|
||||
C_SRCS += ic_drivers/it6613/hdmitx_nios2.c
|
||||
C_SRCS += ic_drivers/it6613/it6613.c
|
||||
C_SRCS += ic_drivers/it6613/it6613_drv.c
|
||||
C_SRCS += ic_drivers/it6613/it6613_sys.c
|
||||
C_SRCS += ic_drivers/tvp7002/tvp7002.c
|
||||
C_SRCS += ic_drivers/ths7353/ths7353.c
|
||||
C_SRCS += ic_drivers/pcm1862/pcm1862.c
|
||||
C_SRCS += ic_drivers/st7032/st7032.c
|
||||
C_SRCS += ic_drivers/sh1107/sh1107.c
|
||||
C_SRCS += ulibSD/sd_io.c
|
||||
C_SRCS += ulibSD/spi_io.c
|
||||
C_SRCS += fatfs/source/diskio.c
|
||||
C_SRCS += fatfs/source/ff.c
|
||||
C_SRCS += fatfs/source/ffsystem.c
|
||||
C_SRCS += fatfs/source/ffunicode.c
|
||||
CXX_SRCS :=
|
||||
ASM_SRCS := crt0.boot_E.S
|
||||
|
||||
@@ -190,18 +197,18 @@ CREATE_ELF_DERIVED_FILES := 0
|
||||
CREATE_LINKER_MAP := 1
|
||||
|
||||
# Common arguments for ALT_CFLAGSs
|
||||
APP_CFLAGS_DEFINED_SYMBOLS :=
|
||||
ifeq ($(ENABLE_AUDIO),y)
|
||||
APP_CFLAGS_DEFINED_SYMBOLS += -DENABLE_AUDIO
|
||||
endif
|
||||
APP_CFLAGS_DEFINED_SYMBOLS := -DPICOLIBC_INTEGER_PRINTF_SCANF
|
||||
ifeq ($(OSDLANG),JP)
|
||||
APP_CFLAGS_DEFINED_SYMBOLS += -DOSDLANG_JP
|
||||
endif
|
||||
ifeq ($(HAS_SH1107),y)
|
||||
APP_CFLAGS_DEFINED_SYMBOLS += -DHAS_SH1107
|
||||
endif
|
||||
APP_CFLAGS_UNDEFINED_SYMBOLS :=
|
||||
APP_CFLAGS_OPTIMIZATION := -Os
|
||||
APP_CFLAGS_DEBUG_LEVEL :=
|
||||
APP_CFLAGS_WARNINGS := -Wall -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-function -Wno-packed-bitfield-compat
|
||||
APP_CFLAGS_USER_FLAGS := -fdata-sections -ffunction-sections -fshort-enums -fgnu89-inline -flto
|
||||
APP_CFLAGS_USER_FLAGS := -fdata-sections -ffunction-sections -fshort-enums -fgnu89-inline -flto -msmall-data-limit=0
|
||||
|
||||
APP_ASFLAGS_USER :=
|
||||
APP_LDFLAGS_USER := -Wl,--gc-sections
|
||||
@@ -216,14 +223,18 @@ SYS_LIB :=
|
||||
BSP_ROOT_DIR := ../sys_controller_bsp/
|
||||
|
||||
# List of application specific include directories, library directories and library names
|
||||
APP_INCLUDE_DIRS += it6613
|
||||
APP_INCLUDE_DIRS += tvp7002
|
||||
APP_INCLUDE_DIRS += ths7353
|
||||
APP_INCLUDE_DIRS += pcm1862
|
||||
APP_INCLUDE_DIRS += spi_charlcd
|
||||
APP_INCLUDE_DIRS += /usr/lib/picolibc/riscv64-unknown-elf/include
|
||||
APP_INCLUDE_DIRS += config
|
||||
APP_INCLUDE_DIRS += inc
|
||||
APP_INCLUDE_DIRS += ic_drivers/it6613
|
||||
APP_INCLUDE_DIRS += ic_drivers/tvp7002
|
||||
APP_INCLUDE_DIRS += ic_drivers/ths7353
|
||||
APP_INCLUDE_DIRS += ic_drivers/pcm1862
|
||||
APP_INCLUDE_DIRS += ic_drivers/st7032
|
||||
APP_INCLUDE_DIRS += ic_drivers/sh1107
|
||||
APP_INCLUDE_DIRS += memory
|
||||
APP_INCLUDE_DIRS += ulibSD
|
||||
APP_INCLUDE_DIRS += ossc
|
||||
APP_INCLUDE_DIRS += fatfs/source
|
||||
APP_LIBRARY_DIRS :=
|
||||
APP_LIBRARY_NAMES :=
|
||||
|
||||
@@ -257,7 +268,7 @@ endif
|
||||
all:
|
||||
@$(ECHO) [$(APP_NAME) build complete]
|
||||
|
||||
all : build_pre_process libs app build_post_process
|
||||
all : build_pre_process libs app mem_init_generate_new build_post_process
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
@@ -283,25 +294,25 @@ ABS_BSP_ROOT_DIR := $(call adjust-path-mixed,$(shell cd "$(BSP_ROOT_DIR)"; pwd))
|
||||
BSP_INCLUDE_FILE := $(BSP_ROOT_DIR)/public.mk
|
||||
ALT_LIBRARY_ROOT_DIR := $(BSP_ROOT_DIR)
|
||||
include $(BSP_INCLUDE_FILE)
|
||||
# C2H will need this to touch the BSP public.mk and avoid the sopc file
|
||||
# C2H will need this to touch the BSP public.mk and avoid the sopc file
|
||||
# out-of-date error during a BSP make
|
||||
ABS_BSP_INCLUDE_FILE := $(ABS_BSP_ROOT_DIR)/public.mk
|
||||
|
||||
|
||||
ifneq ($(WARNING.SMALL_STACK_SIZE),)
|
||||
# This WARNING is here to protect you from unknowingly using a very small stack
|
||||
# If the warning is set, increase your stack size or enable the BSP small stack
|
||||
# If the warning is set, increase your stack size or enable the BSP small stack
|
||||
# setting to eliminate the warning
|
||||
$(warning WARNING: $(WARNING.SMALL_STACK_SIZE))
|
||||
endif
|
||||
|
||||
# If the BSP public.mk indicates that ALT_SIM_OPTIMIZE is set, rename the ELF
|
||||
# by prefixing it with RUN_ON_HDL_SIMULATOR_ONLY_.
|
||||
# If the BSP public.mk indicates that ALT_SIM_OPTIMIZE is set, rename the ELF
|
||||
# by prefixing it with RUN_ON_HDL_SIMULATOR_ONLY_.
|
||||
ifneq ($(filter -DALT_SIM_OPTIMIZE,$(ALT_CPPFLAGS)),)
|
||||
ELF := RUN_ON_HDL_SIMULATOR_ONLY_$(ELF)
|
||||
endif
|
||||
|
||||
# If the BSP public.mk indicates that ALT_PROVIDE_GMON is set, add option to
|
||||
# If the BSP public.mk indicates that ALT_PROVIDE_GMON is set, add option to
|
||||
# download_elf target
|
||||
ifneq ($(filter -DALT_PROVIDE_GMON,$(ALT_CPPFLAGS)),)
|
||||
GMON_OUT_FILENAME := gmon.out
|
||||
@@ -396,7 +407,7 @@ APP_ASFLAGS := $(APP_ASM_INC_DIRS) \
|
||||
$(ASFLAGS)
|
||||
|
||||
# Arguments only for the linker.
|
||||
APP_LDFLAGS := $(APP_LDFLAGS_USER) --specs=nano.specs -nostartfiles
|
||||
APP_LDFLAGS := $(APP_LDFLAGS_USER) --specs=picolibc.specs -nostartfiles
|
||||
|
||||
ifneq ($(LINKER_SCRIPT),)
|
||||
APP_LDFLAGS += -T'$(LINKER_SCRIPT)'
|
||||
@@ -434,22 +445,22 @@ ifeq ($(CREATE_LINKER_MAP), 1)
|
||||
APP_LDFLAGS += -Wl,-Map=$(LINKER_MAP_NAME)
|
||||
endif
|
||||
|
||||
# QUARTUS_PROJECT_DIR and SOPC_NAME need to be defined if you want the
|
||||
# mem_init_install target of the mem_init.mk (located in the associated BSP)
|
||||
# to know how to copy memory initialization files (e.g. .dat, .hex) into
|
||||
# QUARTUS_PROJECT_DIR and SOPC_NAME need to be defined if you want the
|
||||
# mem_init_install target of the mem_init.mk (located in the associated BSP)
|
||||
# to know how to copy memory initialization files (e.g. .dat, .hex) into
|
||||
# directories required for Quartus compilation or RTL simulation.
|
||||
|
||||
# Defining QUARTUS_PROJECT_DIR causes mem_init_install to copy memory
|
||||
# initialization files into your Quartus project directory. This is required
|
||||
# to provide the initial memory contents of FPGA memories that can be
|
||||
# initialized by the programming file (.sof) or Hardcopy ROMs. It is also used
|
||||
# Defining QUARTUS_PROJECT_DIR causes mem_init_install to copy memory
|
||||
# initialization files into your Quartus project directory. This is required
|
||||
# to provide the initial memory contents of FPGA memories that can be
|
||||
# initialized by the programming file (.sof) or Hardcopy ROMs. It is also used
|
||||
# for VHDL simulation of on-chip memories.
|
||||
|
||||
# Defining SOPC_NAME causes the mem_init_install target to copy memory
|
||||
# initialization files into your RTL simulation directory. This is required
|
||||
# to provide the initial memory contents of all memories that can be
|
||||
# initialized by RTL simulation. This variable should be set to the same name
|
||||
# as your SOPC Builder system name. For example, if you have a system called
|
||||
# Defining SOPC_NAME causes the mem_init_install target to copy memory
|
||||
# initialization files into your RTL simulation directory. This is required
|
||||
# to provide the initial memory contents of all memories that can be
|
||||
# initialized by RTL simulation. This variable should be set to the same name
|
||||
# as your SOPC Builder system name. For example, if you have a system called
|
||||
# "foo.sopc", this variable should be set to "foo".
|
||||
|
||||
# If SOPC_NAME is not set and QUARTUS_PROJECT_DIR is set, then derive SOPC_NAME.
|
||||
@@ -459,23 +470,23 @@ SOPC_NAME := $(basename $(notdir $(wildcard $(QUARTUS_PROJECT_DIR)/*.sopcinfo)))
|
||||
endif
|
||||
endif
|
||||
|
||||
# Defining JDI_FILE is required to specify the JTAG Debug Information File
|
||||
# path. This file is generated by Quartus, and is needed along with the
|
||||
# .sopcinfo file to resolve processor instance ID's from names in a multi-CPU
|
||||
# systems. For multi-CPU systems, the processor instance ID is used to select
|
||||
# Defining JDI_FILE is required to specify the JTAG Debug Information File
|
||||
# path. This file is generated by Quartus, and is needed along with the
|
||||
# .sopcinfo file to resolve processor instance ID's from names in a multi-CPU
|
||||
# systems. For multi-CPU systems, the processor instance ID is used to select
|
||||
# from multiple CPU's during ELF download.
|
||||
|
||||
# Both JDI_FILE and SOPCINFO_FILE are provided by the BSP if they found during
|
||||
# BSP creation. If JDI_FILE is not set and QUARTUS_PROJECT_DIR is set, then
|
||||
# derive JDI_FILE. We do not attempt to derive SOPCINFO_FILE since there may be
|
||||
# multiple .sopcinfo files in a Quartus project.
|
||||
# Both JDI_FILE and SOPCINFO_FILE are provided by the BSP if they found during
|
||||
# BSP creation. If JDI_FILE is not set and QUARTUS_PROJECT_DIR is set, then
|
||||
# derive JDI_FILE. We do not attempt to derive SOPCINFO_FILE since there may be
|
||||
# multiple .sopcinfo files in a Quartus project.
|
||||
ifeq ($(JDI_FILE),)
|
||||
ifneq ($(QUARTUS_PROJECT_DIR),)
|
||||
JDI_FILE := $(firstword $(wildcard $(QUARTUS_PROJECT_DIR)/output_files/*.jdi) $(wildcard $(QUARTUS_PROJECT_DIR)/*.jdi))
|
||||
endif
|
||||
endif
|
||||
|
||||
# Path to root runtime directory used for hdl simulation
|
||||
# Path to root runtime directory used for hdl simulation
|
||||
RUNTIME_ROOT_DIR := $(CONFIG_OBJ_DIR)/runtime
|
||||
|
||||
|
||||
@@ -523,7 +534,7 @@ SDIR_OBJ_LIST := $(sort $(SDIR_OBJ_LIST_C) $(SDIR_OBJ_LIST_CPP) \
|
||||
|
||||
# Relative-pathed objects that being with "../" are handled differently.
|
||||
#
|
||||
# Regular objects are created as
|
||||
# Regular objects are created as
|
||||
# $(CONFIG_OBJ_DIR)/<path>/<filename>.o
|
||||
# where the path structure is maintained under the obj directory. This
|
||||
# applies for both absolute and relative paths; in the absolute path
|
||||
@@ -531,16 +542,16 @@ SDIR_OBJ_LIST := $(sort $(SDIR_OBJ_LIST_C) $(SDIR_OBJ_LIST_CPP) \
|
||||
# directory. This is done to allow two source files with the same name
|
||||
# to be included as part of the project.
|
||||
#
|
||||
# Note: On Cygwin, the path recreated under the obj directory will be
|
||||
# Note: On Cygwin, the path recreated under the obj directory will be
|
||||
# the cygpath -u output path.
|
||||
#
|
||||
# Relative-path objects that begin with "../" cause problems under this
|
||||
# Relative-path objects that begin with "../" cause problems under this
|
||||
# scheme, as $(CONFIG_OBJ_DIR)/../<rest of path>/ can potentially put the object
|
||||
# files anywhere in the system, creating clutter and polluting the source tree.
|
||||
# As such, their paths are flattened - the object file created will be
|
||||
# $(CONFIG_OBJ_DIR)/<filename>.o. Due to this, two files specified with
|
||||
# "../" in the beginning cannot have the same name in the project. VPATH
|
||||
# will be set for these sources to allow make to relocate the source file
|
||||
# As such, their paths are flattened - the object file created will be
|
||||
# $(CONFIG_OBJ_DIR)/<filename>.o. Due to this, two files specified with
|
||||
# "../" in the beginning cannot have the same name in the project. VPATH
|
||||
# will be set for these sources to allow make to relocate the source file
|
||||
# via %.o rules.
|
||||
#
|
||||
# The following lines separate the object list into the flatten and regular
|
||||
@@ -628,7 +639,7 @@ ifneq ($(wildcard $(SOPCINFO_FILE)),)
|
||||
ELF_PATCH_FLAG += --sopcinfo $(SOPCINFO_FILE)
|
||||
endif
|
||||
|
||||
# Use the DOWNLOAD_CABLE variable to specify which JTAG cable to use.
|
||||
# Use the DOWNLOAD_CABLE variable to specify which JTAG cable to use.
|
||||
# This is not needed if you only have one cable.
|
||||
ifneq ($(DOWNLOAD_CABLE),)
|
||||
DOWNLOAD_CABLE_FLAG := --cable '$(DOWNLOAD_CABLE)'
|
||||
@@ -657,11 +668,11 @@ build_post_process :
|
||||
# included makefile fragment.
|
||||
#
|
||||
ifeq ($(DEFAULT_CROSS_COMPILE),)
|
||||
DEFAULT_CROSS_COMPILE := riscv32-unknown-elf-
|
||||
DEFAULT_CROSS_COMPILE := riscv64-unknown-elf-
|
||||
endif
|
||||
|
||||
ifeq ($(DEFAULT_STACKREPORT),)
|
||||
DEFAULT_STACKREPORT := riscv32-unknown-elf-size
|
||||
DEFAULT_STACKREPORT := riscv64-unknown-elf-size
|
||||
endif
|
||||
|
||||
ifeq ($(DEFAULT_DOWNLOAD),)
|
||||
@@ -715,7 +726,7 @@ AR := $(CROSS_COMPILE)ar
|
||||
endif
|
||||
|
||||
ifeq ($(origin LD),default)
|
||||
LD := $(CROSS_COMPILE)g++
|
||||
LD := $(CROSS_COMPILE)gcc
|
||||
endif
|
||||
|
||||
ifeq ($(origin RM),default)
|
||||
@@ -760,7 +771,7 @@ ifeq ($(MKDIR),)
|
||||
MKDIR := $(DEFAULT_MKDIR)
|
||||
endif
|
||||
|
||||
RV_OBJCOPY = riscv32-unknown-elf-objcopy
|
||||
RV_OBJCOPY = riscv64-unknown-elf-objcopy
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# PATTERN RULES TO BUILD OBJECTS
|
||||
@@ -793,7 +804,7 @@ $(AS) -MP -MMD -c $(APP_CPPFLAGS) $(APP_CFLAGS) $(APP_ASFLAGS) -o $@ $<
|
||||
$(AS_POST_PROCESS)
|
||||
endef
|
||||
|
||||
ifeq ($(MAKE_VERSION),3.81)
|
||||
ifeq ($(MAKE_VERSION),3.81)
|
||||
.SECONDEXPANSION:
|
||||
|
||||
$(APP_OBJS_C): $(CONFIG_OBJ_DIR)/%.o: $$(call adjust-path-mixed,%.c)
|
||||
@@ -891,7 +902,7 @@ help :
|
||||
@$(ECHO) " all (default) - Application and all libraries (including BSP)"
|
||||
@$(ECHO) " bsp - Just the BSP"
|
||||
@$(ECHO) " libs - All libraries (including BSP)"
|
||||
@$(ECHO) " flash - All flash files"
|
||||
@$(ECHO) " flash - All flash files"
|
||||
@$(ECHO) " mem_init_generate - All memory initialization files"
|
||||
ifeq ($(QSYS),1)
|
||||
@$(ECHO) " mem_init_install - This target is deprecated for QSys Systems"
|
||||
@@ -952,7 +963,7 @@ $(APP_LDDEPS): libs
|
||||
endif
|
||||
|
||||
# Rules to force your project to rebuild or relink
|
||||
# .force_relink file will cause any application that depends on this project to relink
|
||||
# .force_relink file will cause any application that depends on this project to relink
|
||||
# .force_rebuild file will cause this project to rebuild object files
|
||||
# .force_rebuild_all file will cause this project and any project that depends on this project to rebuild object files
|
||||
|
||||
@@ -975,7 +986,7 @@ clean : clean_elf_derived_files
|
||||
endif
|
||||
|
||||
clean :
|
||||
@$(RM) -r $(ELF) $(OBJDUMP_NAME) $(LINKER_MAP_NAME) $(OBJ_ROOT_DIR) $(RUNTIME_ROOT_DIR) $(FORCE_REBUILD_DEP_LIST) ossc/menu_sjis.c ossc/userdata_sjis.c
|
||||
@$(RM) -r $(ELF) $(OBJDUMP_NAME) $(LINKER_MAP_NAME) $(OBJ_ROOT_DIR) $(RUNTIME_ROOT_DIR) $(FORCE_REBUILD_DEP_LIST) src/menu_sjis.c src/userdata_sjis.c
|
||||
@$(ECHO) [$(APP_NAME) clean complete]
|
||||
|
||||
# Clean just the BSP.
|
||||
@@ -1019,9 +1030,9 @@ download-elf : $(ELF)
|
||||
else \
|
||||
$(ECHO) Info: Downloading $(ELF); \
|
||||
$(DOWNLOAD) --go --cpu_name=$(CPU_NAME) $(DOWNLOAD_CABLE_FLAG) $(SOPC_SYSID_FLAG) $(DOWNLOAD_JDI_FLAG) $(WRITE_GMON_OPTION) $(ELF); \
|
||||
fi
|
||||
fi
|
||||
|
||||
# Delete the target of a rule if it has changed and its commands exit
|
||||
# Delete the target of a rule if it has changed and its commands exit
|
||||
# with a nonzero exit status.
|
||||
.DELETE_ON_ERROR:
|
||||
|
||||
@@ -1132,22 +1143,38 @@ print-elf-name:
|
||||
#------------------------------------------------------------------------------
|
||||
# CUSTOM TARGETS
|
||||
#------------------------------------------------------------------------------
|
||||
ossc/menu_sjis.c: ossc/menu.c
|
||||
iconv -f UTF-8 -t SHIFT-JIS ossc/menu.c > ossc/menu_sjis.c
|
||||
src/menu_sjis.c: src/menu.c
|
||||
iconv -f UTF-8 -t SHIFT-JIS src/menu.c > src/menu_sjis.c
|
||||
|
||||
ossc/userdata_sjis.c: ossc/userdata.c
|
||||
iconv -f UTF-8 -t SHIFT-JIS ossc/userdata.c > ossc/userdata_sjis.c
|
||||
src/userdata_sjis.c: src/userdata.c
|
||||
iconv -f UTF-8 -t SHIFT-JIS src/userdata.c > src/userdata_sjis.c
|
||||
|
||||
mem_init/sys_onchip_memory2_0.hex: sys_controller.elf
|
||||
$(RV_OBJCOPY) --change-addresses -0x10000 -O binary --gap-fill 0 $< mem_init/sys_onchip_memory2_0.bin
|
||||
../../tools/bin2hex 4 mem_init/sys_onchip_memory2_0.bin mem_init/sys_onchip_memory2_0.hex
|
||||
mem_init/flash.hex: sys_controller.elf
|
||||
$(RV_OBJCOPY) --change-addresses -0x02050000 -O binary --gap-fill 0 $< mem_init/flash.bin
|
||||
$(RV_OBJCOPY) --change-addresses -0x02050000 -O ihex --gap-fill 0 $< mem_init/flash.hex
|
||||
mkdir -p mem_init/chunks
|
||||
rm -f mem_init/chunks/*
|
||||
split -d -b 1024 -a 4 mem_init/flash.bin mem_init/chunks/flash.
|
||||
|
||||
.PHONY: mem_init_generate_new
|
||||
mem_init_generate_new: mem_init/sys_onchip_memory2_0.hex
|
||||
mem_init_generate_new: mem_init/flash.hex
|
||||
|
||||
.PHONY: generate_hex
|
||||
generate_hex: clean mem_init_generate_new
|
||||
.PHONY: regenerate_hex
|
||||
regenerate_hex: clean mem_init_generate_new
|
||||
|
||||
.PHONY: rv-reprogram
|
||||
rv-reprogram: mem_init_generate_new
|
||||
jtagconfig
|
||||
system-console -cli --script ../../scripts/rv-reprogram.tcl
|
||||
|
||||
rv-bt:
|
||||
jtagconfig
|
||||
system-console -cli --script ../../scripts/rv-bt.tcl
|
||||
|
||||
rv-reboot:
|
||||
jtagconfig
|
||||
system-console -cli --script ../../scripts/rv-reboot.tcl
|
||||
|
||||
rv-ndmreset:
|
||||
jtagconfig
|
||||
system-console -cli --script ../../scripts/rv-ndmreset.tcl
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,296 @@
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ Configurations of FatFs Module
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
#define FFCONF_DEF 5380 /* Revision ID */
|
||||
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ Function Configurations
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
#define FF_FS_READONLY 0
|
||||
/* This option switches read-only configuration. (0:Read/Write or 1:Read-only)
|
||||
/ Read-only configuration removes writing API functions, f_write(), f_sync(),
|
||||
/ f_unlink(), f_mkdir(), f_chmod(), f_rename(), f_truncate(), f_getfree()
|
||||
/ and optional writing functions as well. */
|
||||
|
||||
|
||||
#define FF_FS_MINIMIZE 0
|
||||
/* This option defines minimization level to remove some basic API functions.
|
||||
/
|
||||
/ 0: Basic functions are fully enabled.
|
||||
/ 1: f_stat(), f_getfree(), f_unlink(), f_mkdir(), f_truncate() and f_rename()
|
||||
/ are removed.
|
||||
/ 2: f_opendir(), f_readdir() and f_closedir() are removed in addition to 1.
|
||||
/ 3: f_lseek() function is removed in addition to 2. */
|
||||
|
||||
|
||||
#define FF_USE_FIND 1
|
||||
/* This option switches filtered directory read functions, f_findfirst() and
|
||||
/ f_findnext(). (0:Disable, 1:Enable 2:Enable with matching altname[] too) */
|
||||
|
||||
|
||||
#define FF_USE_MKFS 0
|
||||
/* This option switches f_mkfs(). (0:Disable or 1:Enable) */
|
||||
|
||||
|
||||
#define FF_USE_FASTSEEK 0
|
||||
/* This option switches fast seek feature. (0:Disable or 1:Enable) */
|
||||
|
||||
|
||||
#define FF_USE_EXPAND 0
|
||||
/* This option switches f_expand(). (0:Disable or 1:Enable) */
|
||||
|
||||
|
||||
#define FF_USE_CHMOD 0
|
||||
/* This option switches attribute control API functions, f_chmod() and f_utime().
|
||||
/ (0:Disable or 1:Enable) Also FF_FS_READONLY needs to be 0 to enable this option. */
|
||||
|
||||
|
||||
#define FF_USE_LABEL 0
|
||||
/* This option switches volume label API functions, f_getlabel() and f_setlabel().
|
||||
/ (0:Disable or 1:Enable) */
|
||||
|
||||
|
||||
#define FF_USE_FORWARD 0
|
||||
/* This option switches f_forward(). (0:Disable or 1:Enable) */
|
||||
|
||||
|
||||
#define FF_USE_STRFUNC 1
|
||||
#define FF_PRINT_LLI 0
|
||||
#define FF_PRINT_FLOAT 0
|
||||
#define FF_STRF_ENCODE 3
|
||||
/* FF_USE_STRFUNC switches the string API functions, f_gets(), f_putc(), f_puts()
|
||||
/ and f_printf().
|
||||
/
|
||||
/ 0: Disable. FF_PRINT_LLI, FF_PRINT_FLOAT and FF_STRF_ENCODE have no effect.
|
||||
/ 1: Enable without LF - CRLF conversion.
|
||||
/ 2: Enable with LF - CRLF conversion.
|
||||
/
|
||||
/ FF_PRINT_LLI = 1 makes f_printf() support long long argument and FF_PRINT_FLOAT = 1/2
|
||||
/ makes f_printf() support floating point argument. These features want C99 or later.
|
||||
/ When FF_LFN_UNICODE >= 1 with LFN enabled, string API functions convert the character
|
||||
/ encoding in it. FF_STRF_ENCODE selects assumption of character encoding ON THE FILE
|
||||
/ to be read/written via those functions.
|
||||
/
|
||||
/ 0: ANSI/OEM in current CP
|
||||
/ 1: Unicode in UTF-16LE
|
||||
/ 2: Unicode in UTF-16BE
|
||||
/ 3: Unicode in UTF-8
|
||||
*/
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ Locale and Namespace Configurations
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
#define FF_CODE_PAGE 437
|
||||
/* This option specifies the OEM code page to be used on the target system.
|
||||
/ Incorrect code page setting can cause a file open failure.
|
||||
/
|
||||
/ 437 - U.S.
|
||||
/ 720 - Arabic
|
||||
/ 737 - Greek
|
||||
/ 771 - KBL
|
||||
/ 775 - Baltic
|
||||
/ 850 - Latin 1
|
||||
/ 852 - Latin 2
|
||||
/ 855 - Cyrillic
|
||||
/ 857 - Turkish
|
||||
/ 860 - Portuguese
|
||||
/ 861 - Icelandic
|
||||
/ 862 - Hebrew
|
||||
/ 863 - Canadian French
|
||||
/ 864 - Arabic
|
||||
/ 865 - Nordic
|
||||
/ 866 - Russian
|
||||
/ 869 - Greek 2
|
||||
/ 932 - Japanese (DBCS)
|
||||
/ 936 - Simplified Chinese (DBCS)
|
||||
/ 949 - Korean (DBCS)
|
||||
/ 950 - Traditional Chinese (DBCS)
|
||||
/ 0 - Include all code pages above and configured by f_setcp()
|
||||
*/
|
||||
|
||||
|
||||
#define FF_USE_LFN 1
|
||||
#define FF_MAX_LFN 255
|
||||
/* The FF_USE_LFN switches the support for LFN (long file name).
|
||||
/
|
||||
/ 0: Disable LFN. FF_MAX_LFN has no effect.
|
||||
/ 1: Enable LFN with static working buffer on the BSS. Always NOT thread-safe.
|
||||
/ 2: Enable LFN with dynamic working buffer on the STACK.
|
||||
/ 3: Enable LFN with dynamic working buffer on the HEAP.
|
||||
/
|
||||
/ To enable the LFN, ffunicode.c needs to be added to the project. The LFN feature
|
||||
/ requiers certain internal working buffer occupies (FF_MAX_LFN + 1) * 2 bytes and
|
||||
/ additional (FF_MAX_LFN + 44) / 15 * 32 bytes when exFAT is enabled.
|
||||
/ The FF_MAX_LFN defines size of the working buffer in UTF-16 code unit and it can
|
||||
/ be in range of 12 to 255. It is recommended to be set 255 to fully support the LFN
|
||||
/ specification.
|
||||
/ When use stack for the working buffer, take care on stack overflow. When use heap
|
||||
/ memory for the working buffer, memory management functions, ff_memalloc() and
|
||||
/ ff_memfree() exemplified in ffsystem.c, need to be added to the project. */
|
||||
|
||||
|
||||
#define FF_LFN_UNICODE 0
|
||||
/* This option switches the character encoding on the API when LFN is enabled.
|
||||
/
|
||||
/ 0: ANSI/OEM in current CP (TCHAR = char)
|
||||
/ 1: Unicode in UTF-16 (TCHAR = WCHAR)
|
||||
/ 2: Unicode in UTF-8 (TCHAR = char)
|
||||
/ 3: Unicode in UTF-32 (TCHAR = DWORD)
|
||||
/
|
||||
/ Also behavior of string I/O functions will be affected by this option.
|
||||
/ When LFN is not enabled, this option has no effect. */
|
||||
|
||||
|
||||
#define FF_LFN_BUF 255
|
||||
#define FF_SFN_BUF 12
|
||||
/* This set of options defines size of file name members in the FILINFO structure
|
||||
/ which is used to read out directory items. These values should be suffcient for
|
||||
/ the file names to read. The maximum possible length of the read file name depends
|
||||
/ on character encoding. When LFN is not enabled, these options have no effect. */
|
||||
|
||||
|
||||
#define FF_FS_RPATH 1
|
||||
/* This option configures support for relative path.
|
||||
/
|
||||
/ 0: Disable relative path and remove related API functions.
|
||||
/ 1: Enable relative path. f_chdir() and f_chdrive() are available.
|
||||
/ 2: f_getcwd() is available in addition to 1.
|
||||
*/
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ Drive/Volume Configurations
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
#define FF_VOLUMES 1
|
||||
/* Number of volumes (logical drives) to be used. (1-10) */
|
||||
|
||||
|
||||
#define FF_STR_VOLUME_ID 0
|
||||
#define FF_VOLUME_STRS "RAM","NAND","CF","SD","SD2","USB","USB2","USB3"
|
||||
/* FF_STR_VOLUME_ID switches support for volume ID in arbitrary strings.
|
||||
/ When FF_STR_VOLUME_ID is set to 1 or 2, arbitrary strings can be used as drive
|
||||
/ number in the path name. FF_VOLUME_STRS defines the volume ID strings for each
|
||||
/ logical drive. Number of items must not be less than FF_VOLUMES. Valid
|
||||
/ characters for the volume ID strings are A-Z, a-z and 0-9, however, they are
|
||||
/ compared in case-insensitive. If FF_STR_VOLUME_ID >= 1 and FF_VOLUME_STRS is
|
||||
/ not defined, a user defined volume string table is needed as:
|
||||
/
|
||||
/ const char* VolumeStr[FF_VOLUMES] = {"ram","flash","sd","usb",...
|
||||
*/
|
||||
|
||||
|
||||
#define FF_MULTI_PARTITION 0
|
||||
/* This option switches support for multiple volumes on the physical drive.
|
||||
/ By default (0), each logical drive number is bound to the same physical drive
|
||||
/ number and only an FAT volume found on the physical drive will be mounted.
|
||||
/ When this feature is enabled (1), each logical drive number can be bound to
|
||||
/ arbitrary physical drive and partition listed in the VolToPart[]. Also f_fdisk()
|
||||
/ will be available. */
|
||||
|
||||
|
||||
#define FF_MIN_SS 512
|
||||
#define FF_MAX_SS 512
|
||||
/* This set of options configures the range of sector size to be supported. (512,
|
||||
/ 1024, 2048 or 4096) Always set both 512 for most systems, generic memory card and
|
||||
/ harddisk, but a larger value may be required for on-board flash memory and some
|
||||
/ type of optical media. When FF_MAX_SS is larger than FF_MIN_SS, FatFs is
|
||||
/ configured for variable sector size mode and disk_ioctl() needs to implement
|
||||
/ GET_SECTOR_SIZE command. */
|
||||
|
||||
|
||||
#define FF_LBA64 0
|
||||
/* This option switches support for 64-bit LBA. (0:Disable or 1:Enable)
|
||||
/ To enable the 64-bit LBA, also exFAT needs to be enabled. (FF_FS_EXFAT == 1) */
|
||||
|
||||
|
||||
#define FF_MIN_GPT 0x10000000
|
||||
/* Minimum number of sectors to switch GPT as partitioning format in f_mkfs() and
|
||||
/ f_fdisk(). 2^32 sectors maximum. This option has no effect when FF_LBA64 == 0. */
|
||||
|
||||
|
||||
#define FF_USE_TRIM 0
|
||||
/* This option switches support for ATA-TRIM. (0:Disable or 1:Enable)
|
||||
/ To enable this feature, also CTRL_TRIM command should be implemented to
|
||||
/ the disk_ioctl(). */
|
||||
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------/
|
||||
/ System Configurations
|
||||
/---------------------------------------------------------------------------*/
|
||||
|
||||
#define FF_FS_TINY 0
|
||||
/* This option switches tiny buffer configuration. (0:Normal or 1:Tiny)
|
||||
/ At the tiny configuration, size of file object (FIL) is shrinked FF_MAX_SS bytes.
|
||||
/ Instead of private sector buffer eliminated from the file object, common sector
|
||||
/ buffer in the filesystem object (FATFS) is used for the file data transfer. */
|
||||
|
||||
|
||||
#define FF_FS_EXFAT 1
|
||||
/* This option switches support for exFAT filesystem. (0:Disable or 1:Enable)
|
||||
/ To enable exFAT, also LFN needs to be enabled. (FF_USE_LFN >= 1)
|
||||
/ Note that enabling exFAT discards ANSI C (C89) compatibility. */
|
||||
|
||||
|
||||
#define FF_FS_NORTC 1
|
||||
#define FF_NORTC_MON 11
|
||||
#define FF_NORTC_MDAY 1
|
||||
#define FF_NORTC_YEAR 2024
|
||||
/* The option FF_FS_NORTC switches timestamp feature. If the system does not have
|
||||
/ an RTC or valid timestamp is not needed, set FF_FS_NORTC = 1 to disable the
|
||||
/ timestamp feature. Every object modified by FatFs will have a fixed timestamp
|
||||
/ defined by FF_NORTC_MON, FF_NORTC_MDAY and FF_NORTC_YEAR in local time.
|
||||
/ To enable timestamp function (FF_FS_NORTC = 0), get_fattime() need to be added
|
||||
/ to the project to read current time form real-time clock. FF_NORTC_MON,
|
||||
/ FF_NORTC_MDAY and FF_NORTC_YEAR have no effect.
|
||||
/ These options have no effect in read-only configuration (FF_FS_READONLY = 1). */
|
||||
|
||||
|
||||
#define FF_FS_NOFSINFO 0
|
||||
/* If you need to know correct free space on the FAT32 volume, set bit 0 of this
|
||||
/ option, and f_getfree() at the first time after volume mount will force
|
||||
/ a full FAT scan. Bit 1 controls the use of last allocated cluster number.
|
||||
/
|
||||
/ bit0=0: Use free cluster count in the FSINFO if available.
|
||||
/ bit0=1: Do not trust free cluster count in the FSINFO.
|
||||
/ bit1=0: Use last allocated cluster number in the FSINFO if available.
|
||||
/ bit1=1: Do not trust last allocated cluster number in the FSINFO.
|
||||
*/
|
||||
|
||||
|
||||
#define FF_FS_LOCK 0
|
||||
/* The option FF_FS_LOCK switches file lock function to control duplicated file open
|
||||
/ and illegal operation to open objects. This option must be 0 when FF_FS_READONLY
|
||||
/ is 1.
|
||||
/
|
||||
/ 0: Disable file lock function. To avoid volume corruption, application program
|
||||
/ should avoid illegal open, remove and rename to the open objects.
|
||||
/ >0: Enable file lock function. The value defines how many files/sub-directories
|
||||
/ can be opened simultaneously under file lock control. Note that the file
|
||||
/ lock control is independent of re-entrancy. */
|
||||
|
||||
|
||||
#define FF_FS_REENTRANT 0
|
||||
#define FF_FS_TIMEOUT 1000
|
||||
/* The option FF_FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs
|
||||
/ module itself. Note that regardless of this option, file access to different
|
||||
/ volume is always re-entrant and volume control functions, f_mount(), f_mkfs()
|
||||
/ and f_fdisk(), are always not re-entrant. Only file/directory access to
|
||||
/ the same volume is under control of this featuer.
|
||||
/
|
||||
/ 0: Disable re-entrancy. FF_FS_TIMEOUT have no effect.
|
||||
/ 1: Enable re-entrancy. Also user provided synchronization handlers,
|
||||
/ ff_mutex_create(), ff_mutex_delete(), ff_mutex_take() and ff_mutex_give(),
|
||||
/ must be added to the project. Samples are available in ffsystem.c.
|
||||
/
|
||||
/ The FF_FS_TIMEOUT defines timeout period in unit of O/S time tick.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*--- End of configuration options ---*/
|
||||
@@ -25,6 +25,7 @@
|
||||
#define SD_SPI_BASE I2C_OPENCORES_1_BASE
|
||||
|
||||
#ifndef DEBUG
|
||||
#include <stdio.h>
|
||||
#define OS_PRINTF(...)
|
||||
#define ErrorF(...)
|
||||
#define printf(...)
|
||||
@@ -38,6 +39,8 @@
|
||||
#define printf dd_printf
|
||||
#endif
|
||||
|
||||
#define sniprintf snprintf
|
||||
|
||||
#define WAITLOOP_SLEEP_US 10000
|
||||
|
||||
#endif /* SYSCONFIG_H_ */
|
||||
@@ -71,6 +71,14 @@ zero_loop:
|
||||
ble x26, x27, zero_loop
|
||||
zero_loop_end:
|
||||
|
||||
copy_sections:
|
||||
jal alt_load
|
||||
|
||||
cache_setup:
|
||||
fence.i
|
||||
csrwi 0x7C0, 1
|
||||
cache_setup_end:
|
||||
|
||||
|
||||
main_entry:
|
||||
/* jump to alt_main program entry point */
|
||||
|
||||
@@ -55,6 +55,15 @@ zero_loop:
|
||||
ble x14, x15, zero_loop
|
||||
zero_loop_end:
|
||||
|
||||
copy_sections:
|
||||
jal alt_load
|
||||
copy_sections_end:
|
||||
|
||||
cache_setup:
|
||||
fence.i
|
||||
csrwi 0x7C0, 1
|
||||
cache_setup_end:
|
||||
|
||||
|
||||
main_entry:
|
||||
/* jump to alt_main program entry point */
|
||||
|
||||
@@ -0,0 +1,377 @@
|
||||
----------------------------------------------------------------------------
|
||||
Revision history of FatFs module
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
R0.00 (February 26, 2006)
|
||||
|
||||
Prototype.
|
||||
|
||||
|
||||
|
||||
R0.01 (April 29, 2006)
|
||||
|
||||
The first release.
|
||||
|
||||
|
||||
|
||||
R0.02 (June 01, 2006)
|
||||
|
||||
Added FAT12 support.
|
||||
Removed unbuffered mode.
|
||||
Fixed a problem on small (<32M) partition.
|
||||
|
||||
|
||||
|
||||
R0.02a (June 10, 2006)
|
||||
|
||||
Added a configuration option (_FS_MINIMUM).
|
||||
|
||||
|
||||
|
||||
R0.03 (September 22, 2006)
|
||||
|
||||
Added f_rename().
|
||||
Changed option _FS_MINIMUM to _FS_MINIMIZE.
|
||||
|
||||
|
||||
|
||||
R0.03a (December 11, 2006)
|
||||
|
||||
Improved cluster scan algorithm to write files fast.
|
||||
Fixed f_mkdir() creates incorrect directory on FAT32.
|
||||
|
||||
|
||||
|
||||
R0.04 (February 04, 2007)
|
||||
|
||||
Added f_mkfs().
|
||||
Supported multiple drive system.
|
||||
Changed some interfaces for multiple drive system.
|
||||
Changed f_mountdrv() to f_mount().
|
||||
|
||||
|
||||
|
||||
R0.04a (April 01, 2007)
|
||||
|
||||
Supported multiple partitions on a physical drive.
|
||||
Added a capability of extending file size to f_lseek().
|
||||
Added minimization level 3.
|
||||
Fixed an endian sensitive code in f_mkfs().
|
||||
|
||||
|
||||
|
||||
R0.04b (May 05, 2007)
|
||||
|
||||
Added a configuration option _USE_NTFLAG.
|
||||
Added FSINFO support.
|
||||
Fixed DBCS name can result FR_INVALID_NAME.
|
||||
Fixed short seek (<= csize) collapses the file object.
|
||||
|
||||
|
||||
|
||||
R0.05 (August 25, 2007)
|
||||
|
||||
Changed arguments of f_read(), f_write() and f_mkfs().
|
||||
Fixed f_mkfs() on FAT32 creates incorrect FSINFO.
|
||||
Fixed f_mkdir() on FAT32 creates incorrect directory.
|
||||
|
||||
|
||||
|
||||
R0.05a (February 03, 2008)
|
||||
|
||||
Added f_truncate() and f_utime().
|
||||
Fixed off by one error at FAT sub-type determination.
|
||||
Fixed btr in f_read() can be mistruncated.
|
||||
Fixed cached sector is not flushed when create and close without write.
|
||||
|
||||
|
||||
|
||||
R0.06 (April 01, 2008)
|
||||
|
||||
Added fputc(), fputs(), fprintf() and fgets().
|
||||
Improved performance of f_lseek() on moving to the same or following cluster.
|
||||
|
||||
|
||||
|
||||
R0.07 (April 01, 2009)
|
||||
|
||||
Merged Tiny-FatFs as a configuration option. (_FS_TINY)
|
||||
Added long file name feature. (_USE_LFN)
|
||||
Added multiple code page feature. (_CODE_PAGE)
|
||||
Added re-entrancy for multitask operation. (_FS_REENTRANT)
|
||||
Added auto cluster size selection to f_mkfs().
|
||||
Added rewind option to f_readdir().
|
||||
Changed result code of critical errors.
|
||||
Renamed string functions to avoid name collision.
|
||||
|
||||
|
||||
|
||||
R0.07a (April 14, 2009)
|
||||
|
||||
Septemberarated out OS dependent code on reentrant cfg.
|
||||
Added multiple sector size feature.
|
||||
|
||||
|
||||
|
||||
R0.07c (June 21, 2009)
|
||||
|
||||
Fixed f_unlink() can return FR_OK on error.
|
||||
Fixed wrong cache control in f_lseek().
|
||||
Added relative path feature.
|
||||
Added f_chdir() and f_chdrive().
|
||||
Added proper case conversion to extended character.
|
||||
|
||||
|
||||
|
||||
R0.07e (November 03, 2009)
|
||||
|
||||
Septemberarated out configuration options from ff.h to ffconf.h.
|
||||
Fixed f_unlink() fails to remove a sub-directory on _FS_RPATH.
|
||||
Fixed name matching error on the 13 character boundary.
|
||||
Added a configuration option, _LFN_UNICODE.
|
||||
Changed f_readdir() to return the SFN with always upper case on non-LFN cfg.
|
||||
|
||||
|
||||
|
||||
R0.08 (May 15, 2010)
|
||||
|
||||
Added a memory configuration option. (_USE_LFN = 3)
|
||||
Added file lock feature. (_FS_SHARE)
|
||||
Added fast seek feature. (_USE_FASTSEEK)
|
||||
Changed some types on the API, XCHAR->TCHAR.
|
||||
Changed .fname in the FILINFO structure on Unicode cfg.
|
||||
String functions support UTF-8 encoding files on Unicode cfg.
|
||||
|
||||
|
||||
|
||||
R0.08a (August 16, 2010)
|
||||
|
||||
Added f_getcwd(). (_FS_RPATH = 2)
|
||||
Added sector erase feature. (_USE_ERASE)
|
||||
Moved file lock semaphore table from fs object to the bss.
|
||||
Fixed f_mkfs() creates wrong FAT32 volume.
|
||||
|
||||
|
||||
|
||||
R0.08b (January 15, 2011)
|
||||
|
||||
Fast seek feature is also applied to f_read() and f_write().
|
||||
f_lseek() reports required table size on creating CLMP.
|
||||
Extended format syntax of f_printf().
|
||||
Ignores duplicated directory separators in given path name.
|
||||
|
||||
|
||||
|
||||
R0.09 (September 06, 2011)
|
||||
|
||||
f_mkfs() supports multiple partition to complete the multiple partition feature.
|
||||
Added f_fdisk().
|
||||
|
||||
|
||||
|
||||
R0.09a (August 27, 2012)
|
||||
|
||||
Changed f_open() and f_opendir() reject null object pointer to avoid crash.
|
||||
Changed option name _FS_SHARE to _FS_LOCK.
|
||||
Fixed assertion failure due to OS/2 EA on FAT12/16 volume.
|
||||
|
||||
|
||||
|
||||
R0.09b (January 24, 2013)
|
||||
|
||||
Added f_setlabel() and f_getlabel().
|
||||
|
||||
|
||||
|
||||
R0.10 (October 02, 2013)
|
||||
|
||||
Added selection of character encoding on the file. (_STRF_ENCODE)
|
||||
Added f_closedir().
|
||||
Added forced full FAT scan for f_getfree(). (_FS_NOFSINFO)
|
||||
Added forced mount feature with changes of f_mount().
|
||||
Improved behavior of volume auto detection.
|
||||
Improved write throughput of f_puts() and f_printf().
|
||||
Changed argument of f_chdrive(), f_mkfs(), disk_read() and disk_write().
|
||||
Fixed f_write() can be truncated when the file size is close to 4GB.
|
||||
Fixed f_open(), f_mkdir() and f_setlabel() can return incorrect value on error.
|
||||
|
||||
|
||||
|
||||
R0.10a (January 15, 2014)
|
||||
|
||||
Added arbitrary strings as drive number in the path name. (_STR_VOLUME_ID)
|
||||
Added a configuration option of minimum sector size. (_MIN_SS)
|
||||
2nd argument of f_rename() can have a drive number and it will be ignored.
|
||||
Fixed f_mount() with forced mount fails when drive number is >= 1. (appeared at R0.10)
|
||||
Fixed f_close() invalidates the file object without volume lock.
|
||||
Fixed f_closedir() returns but the volume lock is left acquired. (appeared at R0.10)
|
||||
Fixed creation of an entry with LFN fails on too many SFN collisions. (appeared at R0.07)
|
||||
|
||||
|
||||
|
||||
R0.10b (May 19, 2014)
|
||||
|
||||
Fixed a hard error in the disk I/O layer can collapse the directory entry.
|
||||
Fixed LFN entry is not deleted when delete/rename an object with lossy converted SFN. (appeared at R0.07)
|
||||
|
||||
|
||||
|
||||
R0.10c (November 09, 2014)
|
||||
|
||||
Added a configuration option for the platforms without RTC. (_FS_NORTC)
|
||||
Changed option name _USE_ERASE to _USE_TRIM.
|
||||
Fixed volume label created by Mac OS X cannot be retrieved with f_getlabel(). (appeared at R0.09b)
|
||||
Fixed a potential problem of FAT access that can appear on disk error.
|
||||
Fixed null pointer dereference on attempting to delete the root direcotry. (appeared at R0.08)
|
||||
|
||||
|
||||
|
||||
R0.11 (February 09, 2015)
|
||||
|
||||
Added f_findfirst(), f_findnext() and f_findclose(). (_USE_FIND)
|
||||
Fixed f_unlink() does not remove cluster chain of the file. (appeared at R0.10c)
|
||||
Fixed _FS_NORTC option does not work properly. (appeared at R0.10c)
|
||||
|
||||
|
||||
|
||||
R0.11a (September 05, 2015)
|
||||
|
||||
Fixed wrong media change can lead a deadlock at thread-safe configuration.
|
||||
Added code page 771, 860, 861, 863, 864, 865 and 869. (_CODE_PAGE)
|
||||
Removed some code pages actually not exist on the standard systems. (_CODE_PAGE)
|
||||
Fixed errors in the case conversion teble of code page 437 and 850 (ff.c).
|
||||
Fixed errors in the case conversion teble of Unicode (cc*.c).
|
||||
|
||||
|
||||
|
||||
R0.12 (April 12, 2016)
|
||||
|
||||
Added support for exFAT file system. (_FS_EXFAT)
|
||||
Added f_expand(). (_USE_EXPAND)
|
||||
Changed some members in FINFO structure and behavior of f_readdir().
|
||||
Added an option _USE_CHMOD.
|
||||
Removed an option _WORD_ACCESS.
|
||||
Fixed errors in the case conversion table of Unicode (cc*.c).
|
||||
|
||||
|
||||
|
||||
R0.12a (July 10, 2016)
|
||||
|
||||
Added support for creating exFAT volume with some changes of f_mkfs().
|
||||
Added a file open method FA_OPEN_APPEND. An f_lseek() following f_open() is no longer needed.
|
||||
f_forward() is available regardless of _FS_TINY.
|
||||
Fixed f_mkfs() creates wrong volume. (appeared at R0.12)
|
||||
Fixed wrong memory read in create_name(). (appeared at R0.12)
|
||||
Fixed compilation fails at some configurations, _USE_FASTSEEK and _USE_FORWARD.
|
||||
|
||||
|
||||
|
||||
R0.12b (September 04, 2016)
|
||||
|
||||
Made f_rename() be able to rename objects with the same name but case.
|
||||
Fixed an error in the case conversion teble of code page 866. (ff.c)
|
||||
Fixed writing data is truncated at the file offset 4GiB on the exFAT volume. (appeared at R0.12)
|
||||
Fixed creating a file in the root directory of exFAT volume can fail. (appeared at R0.12)
|
||||
Fixed f_mkfs() creating exFAT volume with too small cluster size can collapse unallocated memory. (appeared at R0.12)
|
||||
Fixed wrong object name can be returned when read directory at Unicode cfg. (appeared at R0.12)
|
||||
Fixed large file allocation/removing on the exFAT volume collapses allocation bitmap. (appeared at R0.12)
|
||||
Fixed some internal errors in f_expand() and f_lseek(). (appeared at R0.12)
|
||||
|
||||
|
||||
|
||||
R0.12c (March 04, 2017)
|
||||
|
||||
Improved write throughput at the fragmented file on the exFAT volume.
|
||||
Made memory usage for exFAT be able to be reduced as decreasing _MAX_LFN.
|
||||
Fixed successive f_getfree() can return wrong count on the FAT12/16 volume. (appeared at R0.12)
|
||||
Fixed configuration option _VOLUMES cannot be set 10. (appeared at R0.10c)
|
||||
|
||||
|
||||
|
||||
R0.13 (May 21, 2017)
|
||||
|
||||
Changed heading character of configuration keywords "_" to "FF_".
|
||||
Removed ASCII-only configuration, FF_CODE_PAGE = 1. Use FF_CODE_PAGE = 437 instead.
|
||||
Added f_setcp(), run-time code page configuration. (FF_CODE_PAGE = 0)
|
||||
Improved cluster allocation time on stretch a deep buried cluster chain.
|
||||
Improved processing time of f_mkdir() with large cluster size by using FF_USE_LFN = 3.
|
||||
Improved NoFatChain flag of the fragmented file to be set after it is truncated and got contiguous.
|
||||
Fixed archive attribute is left not set when a file on the exFAT volume is renamed. (appeared at R0.12)
|
||||
Fixed exFAT FAT entry can be collapsed when write or lseek operation to the existing file is done. (appeared at R0.12c)
|
||||
Fixed creating a file can fail when a new cluster allocation to the exFAT directory occures. (appeared at R0.12c)
|
||||
|
||||
|
||||
|
||||
R0.13a (October 14, 2017)
|
||||
|
||||
Added support for UTF-8 encoding on the API. (FF_LFN_UNICODE = 2)
|
||||
Added options for file name output buffer. (FF_LFN_BUF, FF_SFN_BUF).
|
||||
Added dynamic memory allocation option for working buffer of f_mkfs() and f_fdisk().
|
||||
Fixed f_fdisk() and f_mkfs() create the partition table with wrong CHS parameters. (appeared at R0.09)
|
||||
Fixed f_unlink() can cause lost clusters at fragmented file on the exFAT volume. (appeared at R0.12c)
|
||||
Fixed f_setlabel() rejects some valid characters for exFAT volume. (appeared at R0.12)
|
||||
|
||||
|
||||
|
||||
R0.13b (April 07, 2018)
|
||||
|
||||
Added support for UTF-32 encoding on the API. (FF_LFN_UNICODE = 3)
|
||||
Added support for Unix style volume ID. (FF_STR_VOLUME_ID = 2)
|
||||
Fixed accesing any object on the exFAT root directory beyond the cluster boundary can fail. (appeared at R0.12c)
|
||||
Fixed f_setlabel() does not reject some invalid characters. (appeared at R0.09b)
|
||||
|
||||
|
||||
|
||||
R0.13c (October 14, 2018)
|
||||
Supported stdint.h for C99 and later. (integer.h was included in ff.h)
|
||||
Fixed reading a directory gets infinite loop when the last directory entry is not empty. (appeared at R0.12)
|
||||
Fixed creating a sub-directory in the fragmented sub-directory on the exFAT volume collapses FAT chain of the parent directory. (appeared at R0.12)
|
||||
Fixed f_getcwd() cause output buffer overrun when the buffer has a valid drive number. (appeared at R0.13b)
|
||||
|
||||
|
||||
|
||||
R0.14 (October 14, 2019)
|
||||
Added support for 64-bit LBA and GUID partition table (FF_LBA64 = 1)
|
||||
Changed some API functions, f_mkfs() and f_fdisk().
|
||||
Fixed f_open() function cannot find the file with file name in length of FF_MAX_LFN characters.
|
||||
Fixed f_readdir() function cannot retrieve long file names in length of FF_MAX_LFN - 1 characters.
|
||||
Fixed f_readdir() function returns file names with wrong case conversion. (appeared at R0.12)
|
||||
Fixed f_mkfs() function can fail to create exFAT volume in the second partition. (appeared at R0.12)
|
||||
|
||||
|
||||
R0.14a (December 5, 2020)
|
||||
Limited number of recursive calls in f_findnext().
|
||||
Fixed old floppy disks formatted with MS-DOS 2.x and 3.x cannot be mounted.
|
||||
Fixed some compiler warnings.
|
||||
|
||||
|
||||
|
||||
R0.14b (April 17, 2021)
|
||||
Made FatFs uses standard library <string.h> for copy, compare and search instead of built-in string functions.
|
||||
Added support for long long integer and floating point to f_printf(). (FF_STRF_LLI and FF_STRF_FP)
|
||||
Made path name parser ignore the terminating separator to allow "dir/".
|
||||
Improved the compatibility in Unix style path name feature.
|
||||
Fixed the file gets dead-locked when f_open() failed with some conditions. (appeared at R0.12a)
|
||||
Fixed f_mkfs() can create wrong exFAT volume due to a timing dependent error. (appeared at R0.12)
|
||||
Fixed code page 855 cannot be set by f_setcp().
|
||||
Fixed some compiler warnings.
|
||||
|
||||
|
||||
|
||||
R0.15 (November 6, 2022)
|
||||
Changed user provided synchronization functions in order to completely eliminate the platform dependency from FatFs code.
|
||||
FF_SYNC_t is removed from the configuration options.
|
||||
Fixed a potential error in f_mount when FF_FS_REENTRANT.
|
||||
Fixed file lock control FF_FS_LOCK is not mutal excluded when FF_FS_REENTRANT && FF_VOLUMES > 1 is true.
|
||||
Fixed f_mkfs() creates broken exFAT volume when the size of volume is >= 2^32 sectors.
|
||||
Fixed string functions cannot write the unicode characters not in BMP when FF_LFN_UNICODE == 2 (UTF-8).
|
||||
Fixed a compatibility issue in identification of GPT header.
|
||||
|
||||
|
||||
|
||||
R0.15a (November 22, 2024)
|
||||
Fixed a complie error when FF_FS_LOCK != 0.
|
||||
Fixed a potential issue when work FatFs concurrency with FF_FS_REENTRANT, FF_VOLUMES >= 2 and FF_FS_LOCK > 0.
|
||||
Made f_setlabel() accept a volume label in Unix style volume ID when FF_STR_VOLUME_ID == 2.
|
||||
Made FatFs update PercInUse field in exFAT VBR. (A preceding f_getfree() is needed for the accuracy)
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
FatFs Module Source Files R0.15
|
||||
|
||||
|
||||
FILES
|
||||
|
||||
00readme.txt This file.
|
||||
00history.txt Revision history.
|
||||
ff.c FatFs module.
|
||||
ffconf.h Configuration file of FatFs module.
|
||||
ff.h Common include file for FatFs and application module.
|
||||
diskio.h Common include file for FatFs and disk I/O module.
|
||||
diskio.c An example of glue function to attach existing disk I/O module to FatFs.
|
||||
ffunicode.c Optional Unicode utility functions.
|
||||
ffsystem.c An example of optional O/S related functions.
|
||||
|
||||
|
||||
Low level disk I/O module is not included in this archive because the FatFs
|
||||
module is only a generic file system layer and it does not depend on any specific
|
||||
storage device. You need to provide a low level disk I/O module written to
|
||||
control the storage device that attached to the target system.
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Low level disk I/O module SKELETON for FatFs (C)ChaN, 2019 */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* If a working storage control module is available, it should be */
|
||||
/* attached to the FatFs via a glue function rather than modifying it. */
|
||||
/* This is an example of glue functions to attach various exsisting */
|
||||
/* storage control modules to the FatFs module with a defined API. */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
#include "ff.h" /* Obtains integer types */
|
||||
#include "diskio.h" /* Declarations of disk functions */
|
||||
#include "sd_io.h"
|
||||
#include "sysconfig.h"
|
||||
|
||||
extern SD_DEV sdcard_dev;
|
||||
|
||||
/* Definitions of physical drive number for each drive */
|
||||
#define DEV_RAM 0 /* Example: Map Ramdisk to physical drive 0 */
|
||||
#define DEV_MMC 1 /* Example: Map MMC/SD card to physical drive 1 */
|
||||
#define DEV_USB 2 /* Example: Map USB MSD to physical drive 2 */
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Get Drive Status */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
DSTATUS disk_status (
|
||||
BYTE pdrv /* Physical drive nmuber to identify the drive */
|
||||
)
|
||||
{
|
||||
//res = SD_Status(&sdcard_dev);
|
||||
|
||||
return sdcard_dev.mount ? RES_OK : STA_NODISK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Inidialize a Drive */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
DSTATUS disk_initialize (
|
||||
BYTE pdrv /* Physical drive nmuber to identify the drive */
|
||||
)
|
||||
{
|
||||
DSTATUS stat;
|
||||
SDRESULTS res;
|
||||
|
||||
if (sdcard_dev.mount)
|
||||
return SD_OK;
|
||||
|
||||
res = SD_Init(&sdcard_dev);
|
||||
|
||||
return (res == SD_OK) ? RES_OK : STA_NOINIT;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Read Sector(s) */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
DRESULT disk_read (
|
||||
BYTE pdrv, /* Physical drive nmuber to identify the drive */
|
||||
BYTE *buff, /* Data buffer to store read data */
|
||||
LBA_t sector, /* Start sector in LBA */
|
||||
UINT count /* Number of sectors to read */
|
||||
)
|
||||
{
|
||||
SDRESULTS res;
|
||||
int i;
|
||||
|
||||
if (!sdcard_dev.mount)
|
||||
return STA_NOINIT;
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
res = SD_Read(&sdcard_dev, (void*)&buff[i*SD_BLK_SIZE], sector+i, 0, SD_BLK_SIZE);
|
||||
if (res != SD_OK)
|
||||
return RES_PARERR;
|
||||
}
|
||||
|
||||
return (res == SD_OK) ? RES_OK : RES_PARERR;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Write Sector(s) */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
#if FF_FS_READONLY == 0
|
||||
|
||||
DRESULT disk_write (
|
||||
BYTE pdrv, /* Physical drive nmuber to identify the drive */
|
||||
const BYTE *buff, /* Data to be written */
|
||||
LBA_t sector, /* Start sector in LBA */
|
||||
UINT count /* Number of sectors to write */
|
||||
)
|
||||
{
|
||||
SDRESULTS res;
|
||||
int i;
|
||||
|
||||
if (!sdcard_dev.mount)
|
||||
return STA_NOINIT;
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
res = SD_Write(&sdcard_dev, (void*)&buff[i*SD_BLK_SIZE], sector+i);
|
||||
if (res != SD_OK)
|
||||
return RES_PARERR;
|
||||
}
|
||||
|
||||
return RES_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
/* Miscellaneous Functions */
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
DRESULT disk_ioctl (
|
||||
BYTE pdrv, /* Physical drive nmuber (0..) */
|
||||
BYTE cmd, /* Control code */
|
||||
void *buff /* Buffer to send/receive control data */
|
||||
)
|
||||
{
|
||||
DRESULT res;
|
||||
int result;
|
||||
|
||||
return RES_PARERR;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
/*-----------------------------------------------------------------------/
|
||||
/ Low level disk interface modlue include file (C)ChaN, 2019 /
|
||||
/-----------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _DISKIO_DEFINED
|
||||
#define _DISKIO_DEFINED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Status of Disk Functions */
|
||||
typedef BYTE DSTATUS;
|
||||
|
||||
/* Results of Disk Functions */
|
||||
typedef enum {
|
||||
RES_OK = 0, /* 0: Successful */
|
||||
RES_ERROR, /* 1: R/W Error */
|
||||
RES_WRPRT, /* 2: Write Protected */
|
||||
RES_NOTRDY, /* 3: Not Ready */
|
||||
RES_PARERR /* 4: Invalid Parameter */
|
||||
} DRESULT;
|
||||
|
||||
|
||||
/*---------------------------------------*/
|
||||
/* Prototypes for disk control functions */
|
||||
|
||||
|
||||
DSTATUS disk_initialize (BYTE pdrv);
|
||||
DSTATUS disk_status (BYTE pdrv);
|
||||
DRESULT disk_read (BYTE pdrv, BYTE* buff, LBA_t sector, UINT count);
|
||||
DRESULT disk_write (BYTE pdrv, const BYTE* buff, LBA_t sector, UINT count);
|
||||
DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
|
||||
|
||||
|
||||
/* Disk Status Bits (DSTATUS) */
|
||||
|
||||
#define STA_NOINIT 0x01 /* Drive not initialized */
|
||||
#define STA_NODISK 0x02 /* No medium in the drive */
|
||||
#define STA_PROTECT 0x04 /* Write protected */
|
||||
|
||||
|
||||
/* Command code for disk_ioctrl fucntion */
|
||||
|
||||
/* Generic command (Used by FatFs) */
|
||||
#define CTRL_SYNC 0 /* Complete pending write process (needed at FF_FS_READONLY == 0) */
|
||||
#define GET_SECTOR_COUNT 1 /* Get media size (needed at FF_USE_MKFS == 1) */
|
||||
#define GET_SECTOR_SIZE 2 /* Get sector size (needed at FF_MAX_SS != FF_MIN_SS) */
|
||||
#define GET_BLOCK_SIZE 3 /* Get erase block size (needed at FF_USE_MKFS == 1) */
|
||||
#define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at FF_USE_TRIM == 1) */
|
||||
|
||||
/* Generic command (Not used by FatFs) */
|
||||
#define CTRL_POWER 5 /* Get/Set power status */
|
||||
#define CTRL_LOCK 6 /* Lock/Unlock media removal */
|
||||
#define CTRL_EJECT 7 /* Eject media */
|
||||
#define CTRL_FORMAT 8 /* Create physical format on the media */
|
||||
|
||||
/* MMC/SDC specific ioctl command */
|
||||
#define MMC_GET_TYPE 10 /* Get card type */
|
||||
#define MMC_GET_CSD 11 /* Get CSD */
|
||||
#define MMC_GET_CID 12 /* Get CID */
|
||||
#define MMC_GET_OCR 13 /* Get OCR */
|
||||
#define MMC_GET_SDSTAT 14 /* Get SD status */
|
||||
#define ISDIO_READ 55 /* Read data form SD iSDIO register */
|
||||
#define ISDIO_WRITE 56 /* Write data to SD iSDIO register */
|
||||
#define ISDIO_MRITE 57 /* Masked write data to SD iSDIO register */
|
||||
|
||||
/* ATA/CF specific ioctl command */
|
||||
#define ATA_GET_REV 20 /* Get F/W revision */
|
||||
#define ATA_GET_MODEL 21 /* Get model name */
|
||||
#define ATA_GET_SN 22 /* Get serial number */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,431 @@
|
||||
/*----------------------------------------------------------------------------/
|
||||
/ FatFs - Generic FAT Filesystem module R0.15a /
|
||||
/-----------------------------------------------------------------------------/
|
||||
/
|
||||
/ Copyright (C) 2024, ChaN, all right reserved.
|
||||
/
|
||||
/ FatFs module is an open source software. Redistribution and use of FatFs in
|
||||
/ source and binary forms, with or without modification, are permitted provided
|
||||
/ that the following condition is met:
|
||||
|
||||
/ 1. Redistributions of source code must retain the above copyright notice,
|
||||
/ this condition and the following disclaimer.
|
||||
/
|
||||
/ This software is provided by the copyright holder and contributors "AS IS"
|
||||
/ and any warranties related to this software are DISCLAIMED.
|
||||
/ The copyright owner or contributors be NOT LIABLE for any damages caused
|
||||
/ by use of this software.
|
||||
/
|
||||
/----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
#ifndef FF_DEFINED
|
||||
#define FF_DEFINED 5380 /* Revision ID */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if !defined(FFCONF_DEF)
|
||||
#include "ffconf.h" /* FatFs configuration options */
|
||||
#endif
|
||||
#if FF_DEFINED != FFCONF_DEF
|
||||
#error Wrong configuration file (ffconf.h).
|
||||
#endif
|
||||
|
||||
|
||||
/* Integer types used for FatFs API */
|
||||
|
||||
#if defined(_WIN32) /* Windows VC++ (for development only) */
|
||||
#define FF_INTDEF 2
|
||||
#include <windows.h>
|
||||
typedef unsigned __int64 QWORD;
|
||||
#include <float.h>
|
||||
#define isnan(v) _isnan(v)
|
||||
#define isinf(v) (!_finite(v))
|
||||
|
||||
#elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__cplusplus) /* C99 or later */
|
||||
#define FF_INTDEF 2
|
||||
#include <stdint.h>
|
||||
typedef unsigned int UINT; /* int must be 16-bit or 32-bit */
|
||||
typedef unsigned char BYTE; /* char must be 8-bit */
|
||||
typedef uint16_t WORD; /* 16-bit unsigned */
|
||||
typedef uint32_t DWORD; /* 32-bit unsigned */
|
||||
typedef uint64_t QWORD; /* 64-bit unsigned */
|
||||
typedef WORD WCHAR; /* UTF-16 code unit */
|
||||
|
||||
#else /* Earlier than C99 */
|
||||
#define FF_INTDEF 1
|
||||
typedef unsigned int UINT; /* int must be 16-bit or 32-bit */
|
||||
typedef unsigned char BYTE; /* char must be 8-bit */
|
||||
typedef unsigned short WORD; /* short must be 16-bit */
|
||||
typedef unsigned long DWORD; /* long must be 32-bit */
|
||||
typedef WORD WCHAR; /* UTF-16 code unit */
|
||||
#endif
|
||||
|
||||
|
||||
/* Type of file size and LBA variables */
|
||||
|
||||
#if FF_FS_EXFAT
|
||||
#if FF_INTDEF != 2
|
||||
#error exFAT feature wants C99 or later
|
||||
#endif
|
||||
typedef QWORD FSIZE_t;
|
||||
#if FF_LBA64
|
||||
typedef QWORD LBA_t;
|
||||
#else
|
||||
typedef DWORD LBA_t;
|
||||
#endif
|
||||
#else
|
||||
#if FF_LBA64
|
||||
#error exFAT needs to be enabled when enable 64-bit LBA
|
||||
#endif
|
||||
typedef DWORD FSIZE_t;
|
||||
typedef DWORD LBA_t;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Type of path name strings on FatFs API (TCHAR) */
|
||||
|
||||
#if FF_USE_LFN && FF_LFN_UNICODE == 1 /* Unicode in UTF-16 encoding */
|
||||
typedef WCHAR TCHAR;
|
||||
#define _T(x) L ## x
|
||||
#define _TEXT(x) L ## x
|
||||
#elif FF_USE_LFN && FF_LFN_UNICODE == 2 /* Unicode in UTF-8 encoding */
|
||||
typedef char TCHAR;
|
||||
#define _T(x) u8 ## x
|
||||
#define _TEXT(x) u8 ## x
|
||||
#elif FF_USE_LFN && FF_LFN_UNICODE == 3 /* Unicode in UTF-32 encoding */
|
||||
typedef DWORD TCHAR;
|
||||
#define _T(x) U ## x
|
||||
#define _TEXT(x) U ## x
|
||||
#elif FF_USE_LFN && (FF_LFN_UNICODE < 0 || FF_LFN_UNICODE > 3)
|
||||
#error Wrong FF_LFN_UNICODE setting
|
||||
#else /* ANSI/OEM code in SBCS/DBCS */
|
||||
typedef char TCHAR;
|
||||
#define _T(x) x
|
||||
#define _TEXT(x) x
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Definitions of volume management */
|
||||
|
||||
#if FF_MULTI_PARTITION /* Multiple partition configuration */
|
||||
typedef struct {
|
||||
BYTE pd; /* Associated physical drive */
|
||||
BYTE pt; /* Associated partition (0:Auto detect, 1-4:Forced partition) */
|
||||
} PARTITION;
|
||||
extern PARTITION VolToPart[]; /* Volume to partition mapping table */
|
||||
#endif
|
||||
|
||||
#if FF_STR_VOLUME_ID
|
||||
#ifndef FF_VOLUME_STRS
|
||||
extern const char* VolumeStr[FF_VOLUMES]; /* User defined volume ID table */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Filesystem object structure (FATFS) */
|
||||
|
||||
typedef struct {
|
||||
BYTE fs_type; /* Filesystem type (0:blank filesystem object) */
|
||||
BYTE pdrv; /* Volume hosting physical drive */
|
||||
BYTE ldrv; /* Logical drive number (used only when FF_FS_REENTRANT) */
|
||||
BYTE n_fats; /* Number of FATs (1 or 2) */
|
||||
BYTE wflag; /* win[] status (1:dirty) */
|
||||
BYTE fsi_flag; /* Allocation information control (b7:disabled, b0:dirty) */
|
||||
WORD id; /* Volume mount ID */
|
||||
WORD n_rootdir; /* Number of root directory entries (FAT12/16) */
|
||||
WORD csize; /* Cluster size [sectors] */
|
||||
#if FF_MAX_SS != FF_MIN_SS
|
||||
WORD ssize; /* Sector size (512, 1024, 2048 or 4096) */
|
||||
#endif
|
||||
#if FF_USE_LFN
|
||||
WCHAR* lfnbuf; /* LFN working buffer */
|
||||
#endif
|
||||
#if FF_FS_EXFAT
|
||||
BYTE* dirbuf; /* Directory entry block scratch pad buffer for exFAT */
|
||||
#endif
|
||||
#if !FF_FS_READONLY
|
||||
DWORD last_clst; /* Last allocated cluster (Unknown if >= n_fatent) */
|
||||
DWORD free_clst; /* Number of free clusters (Unknown if >= n_fatent-2) */
|
||||
#endif
|
||||
#if FF_FS_RPATH
|
||||
DWORD cdir; /* Current directory start cluster (0:root) */
|
||||
#if FF_FS_EXFAT
|
||||
DWORD cdc_scl; /* Containing directory start cluster (invalid when cdir is 0) */
|
||||
DWORD cdc_size; /* b31-b8:Size of containing directory, b7-b0: Chain status */
|
||||
DWORD cdc_ofs; /* Offset in the containing directory (invalid when cdir is 0) */
|
||||
#endif
|
||||
#endif
|
||||
DWORD n_fatent; /* Number of FAT entries (number of clusters + 2) */
|
||||
DWORD fsize; /* Number of sectors per FAT */
|
||||
LBA_t volbase; /* Volume base sector */
|
||||
LBA_t fatbase; /* FAT base sector */
|
||||
LBA_t dirbase; /* Root directory base sector (FAT12/16) or cluster (FAT32/exFAT) */
|
||||
LBA_t database; /* Data base sector */
|
||||
#if FF_FS_EXFAT
|
||||
LBA_t bitbase; /* Allocation bitmap base sector */
|
||||
#endif
|
||||
LBA_t winsect; /* Current sector appearing in the win[] */
|
||||
BYTE win[FF_MAX_SS]; /* Disk access window for Directory, FAT (and file data at tiny cfg) */
|
||||
} FATFS;
|
||||
|
||||
|
||||
|
||||
/* Object ID and allocation information (FFOBJID) */
|
||||
|
||||
typedef struct {
|
||||
FATFS* fs; /* Pointer to the hosting volume of this object */
|
||||
WORD id; /* Hosting volume's mount ID */
|
||||
BYTE attr; /* Object attribute */
|
||||
BYTE stat; /* Object chain status (b1-0: =0:not contiguous, =2:contiguous, =3:fragmented in this session, b2:sub-directory stretched) */
|
||||
DWORD sclust; /* Object data start cluster (0:no cluster or root directory) */
|
||||
FSIZE_t objsize; /* Object size (valid when sclust != 0) */
|
||||
#if FF_FS_EXFAT
|
||||
DWORD n_cont; /* Size of first fragment - 1 (valid when stat == 3) */
|
||||
DWORD n_frag; /* Size of last fragment needs to be written to FAT (valid when not zero) */
|
||||
DWORD c_scl; /* Containing directory start cluster (valid when sclust != 0) */
|
||||
DWORD c_size; /* b31-b8:Size of containing directory, b7-b0: Chain status (valid when c_scl != 0) */
|
||||
DWORD c_ofs; /* Offset in the containing directory (valid when file object and sclust != 0) */
|
||||
#endif
|
||||
#if FF_FS_LOCK
|
||||
UINT lockid; /* File lock ID origin from 1 (index of file semaphore table Files[]) */
|
||||
#endif
|
||||
} FFOBJID;
|
||||
|
||||
|
||||
|
||||
/* File object structure (FIL) */
|
||||
|
||||
typedef struct {
|
||||
FFOBJID obj; /* Object identifier (must be the 1st member to detect invalid object pointer) */
|
||||
BYTE flag; /* File status flags */
|
||||
BYTE err; /* Abort flag (error code) */
|
||||
FSIZE_t fptr; /* File read/write pointer (Zeroed on file open) */
|
||||
DWORD clust; /* Current cluster of fpter (invalid when fptr is 0) */
|
||||
LBA_t sect; /* Sector number appearing in buf[] (0:invalid) */
|
||||
#if !FF_FS_READONLY
|
||||
LBA_t dir_sect; /* Sector number containing the directory entry (not used at exFAT) */
|
||||
BYTE* dir_ptr; /* Pointer to the directory entry in the win[] (not used at exFAT) */
|
||||
#endif
|
||||
#if FF_USE_FASTSEEK
|
||||
DWORD* cltbl; /* Pointer to the cluster link map table (nulled on open, set by application) */
|
||||
#endif
|
||||
#if !FF_FS_TINY
|
||||
BYTE buf[FF_MAX_SS]; /* File private data read/write window */
|
||||
#endif
|
||||
} FIL;
|
||||
|
||||
|
||||
|
||||
/* Directory object structure (DIR) */
|
||||
|
||||
typedef struct {
|
||||
FFOBJID obj; /* Object identifier */
|
||||
DWORD dptr; /* Current read/write offset */
|
||||
DWORD clust; /* Current cluster */
|
||||
LBA_t sect; /* Current sector (0:Read operation has terminated) */
|
||||
BYTE* dir; /* Pointer to the directory item in the win[] */
|
||||
BYTE fn[12]; /* SFN (in/out) {body[8],ext[3],status[1]} */
|
||||
#if FF_USE_LFN
|
||||
DWORD blk_ofs; /* Offset of current entry block being processed (0xFFFFFFFF:Invalid) */
|
||||
#endif
|
||||
#if FF_USE_FIND
|
||||
const TCHAR* pat; /* Pointer to the name matching pattern */
|
||||
#endif
|
||||
} DIR;
|
||||
|
||||
|
||||
|
||||
/* File information structure (FILINFO) */
|
||||
|
||||
typedef struct {
|
||||
FSIZE_t fsize; /* File size */
|
||||
WORD fdate; /* Modified date */
|
||||
WORD ftime; /* Modified time */
|
||||
BYTE fattrib; /* File attribute */
|
||||
#if FF_USE_LFN
|
||||
TCHAR altname[FF_SFN_BUF + 1];/* Alternative file name */
|
||||
TCHAR fname[FF_LFN_BUF + 1]; /* Primary file name */
|
||||
#else
|
||||
TCHAR fname[12 + 1]; /* File name */
|
||||
#endif
|
||||
} FILINFO;
|
||||
|
||||
|
||||
|
||||
/* Format parameter structure (MKFS_PARM) */
|
||||
|
||||
typedef struct {
|
||||
BYTE fmt; /* Format option (FM_FAT, FM_FAT32, FM_EXFAT and FM_SFD) */
|
||||
BYTE n_fat; /* Number of FATs */
|
||||
UINT align; /* Data area alignment (sector) */
|
||||
UINT n_root; /* Number of root directory entries */
|
||||
DWORD au_size; /* Cluster size (byte) */
|
||||
} MKFS_PARM;
|
||||
|
||||
|
||||
|
||||
/* File function return code (FRESULT) */
|
||||
|
||||
typedef enum {
|
||||
FR_OK = 0, /* (0) Function succeeded */
|
||||
FR_DISK_ERR, /* (1) A hard error occurred in the low level disk I/O layer */
|
||||
FR_INT_ERR, /* (2) Assertion failed */
|
||||
FR_NOT_READY, /* (3) The physical drive does not work */
|
||||
FR_NO_FILE, /* (4) Could not find the file */
|
||||
FR_NO_PATH, /* (5) Could not find the path */
|
||||
FR_INVALID_NAME, /* (6) The path name format is invalid */
|
||||
FR_DENIED, /* (7) Access denied due to a prohibited access or directory full */
|
||||
FR_EXIST, /* (8) Access denied due to a prohibited access */
|
||||
FR_INVALID_OBJECT, /* (9) The file/directory object is invalid */
|
||||
FR_WRITE_PROTECTED, /* (10) The physical drive is write protected */
|
||||
FR_INVALID_DRIVE, /* (11) The logical drive number is invalid */
|
||||
FR_NOT_ENABLED, /* (12) The volume has no work area */
|
||||
FR_NO_FILESYSTEM, /* (13) Could not find a valid FAT volume */
|
||||
FR_MKFS_ABORTED, /* (14) The f_mkfs function aborted due to some problem */
|
||||
FR_TIMEOUT, /* (15) Could not take control of the volume within defined period */
|
||||
FR_LOCKED, /* (16) The operation is rejected according to the file sharing policy */
|
||||
FR_NOT_ENOUGH_CORE, /* (17) LFN working buffer could not be allocated or given buffer is insufficient in size */
|
||||
FR_TOO_MANY_OPEN_FILES, /* (18) Number of open files > FF_FS_LOCK */
|
||||
FR_INVALID_PARAMETER /* (19) Given parameter is invalid */
|
||||
} FRESULT;
|
||||
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------*/
|
||||
/* FatFs Module Application Interface */
|
||||
/*--------------------------------------------------------------*/
|
||||
|
||||
FRESULT f_open (FIL* fp, const TCHAR* path, BYTE mode); /* Open or create a file */
|
||||
FRESULT f_close (FIL* fp); /* Close an open file object */
|
||||
FRESULT f_read (FIL* fp, void* buff, UINT btr, UINT* br); /* Read data from the file */
|
||||
FRESULT f_read_cc (FIL* fp, uint32_t* buff, UINT btr, UINT* br, UINT max_clusters); /* Collect cluster# */
|
||||
FRESULT f_write (FIL* fp, const void* buff, UINT btw, UINT* bw); /* Write data to the file */
|
||||
FRESULT f_lseek (FIL* fp, FSIZE_t ofs); /* Move file pointer of the file object */
|
||||
FRESULT f_truncate (FIL* fp); /* Truncate the file */
|
||||
FRESULT f_sync (FIL* fp); /* Flush cached data of the writing file */
|
||||
FRESULT f_opendir (DIR* dp, const TCHAR* path); /* Open a directory */
|
||||
FRESULT f_closedir (DIR* dp); /* Close an open directory */
|
||||
FRESULT f_readdir (DIR* dp, FILINFO* fno); /* Read a directory item */
|
||||
FRESULT f_findfirst (DIR* dp, FILINFO* fno, const TCHAR* path, const TCHAR* pattern); /* Find first file */
|
||||
FRESULT f_findnext (DIR* dp, FILINFO* fno); /* Find next file */
|
||||
FRESULT f_mkdir (const TCHAR* path); /* Create a sub directory */
|
||||
FRESULT f_unlink (const TCHAR* path); /* Delete an existing file or directory */
|
||||
FRESULT f_rename (const TCHAR* path_old, const TCHAR* path_new); /* Rename/Move a file or directory */
|
||||
FRESULT f_stat (const TCHAR* path, FILINFO* fno); /* Get file status */
|
||||
FRESULT f_chmod (const TCHAR* path, BYTE attr, BYTE mask); /* Change attribute of a file/dir */
|
||||
FRESULT f_utime (const TCHAR* path, const FILINFO* fno); /* Change timestamp of a file/dir */
|
||||
FRESULT f_chdir (const TCHAR* path); /* Change current directory */
|
||||
FRESULT f_chdrive (const TCHAR* path); /* Change current drive */
|
||||
FRESULT f_getcwd (TCHAR* buff, UINT len); /* Get current directory */
|
||||
FRESULT f_getfree (const TCHAR* path, DWORD* nclst, FATFS** fatfs); /* Get number of free clusters on the drive */
|
||||
FRESULT f_getlabel (const TCHAR* path, TCHAR* label, DWORD* vsn); /* Get volume label */
|
||||
FRESULT f_setlabel (const TCHAR* label); /* Set volume label */
|
||||
FRESULT f_forward (FIL* fp, UINT(*func)(const BYTE*,UINT), UINT btf, UINT* bf); /* Forward data to the stream */
|
||||
FRESULT f_expand (FIL* fp, FSIZE_t fsz, BYTE opt); /* Allocate a contiguous block to the file */
|
||||
FRESULT f_mount (FATFS* fs, const TCHAR* path, BYTE opt); /* Mount/Unmount a logical drive */
|
||||
FRESULT f_mkfs (const TCHAR* path, const MKFS_PARM* opt, void* work, UINT len); /* Create a FAT volume */
|
||||
FRESULT f_fdisk (BYTE pdrv, const LBA_t ptbl[], void* work); /* Divide a physical drive into some partitions */
|
||||
FRESULT f_setcp (WORD cp); /* Set current code page */
|
||||
int f_putc (TCHAR c, FIL* fp); /* Put a character to the file */
|
||||
int f_puts (const TCHAR* str, FIL* cp); /* Put a string to the file */
|
||||
int f_printf (FIL* fp, const TCHAR* str, ...); /* Put a formatted string to the file */
|
||||
TCHAR* f_gets (TCHAR* buff, int len, FIL* fp); /* Get a string from the file */
|
||||
|
||||
/* Some API fucntions are implemented as macro */
|
||||
|
||||
#define f_eof(fp) ((int)((fp)->fptr == (fp)->obj.objsize))
|
||||
#define f_error(fp) ((fp)->err)
|
||||
#define f_tell(fp) ((fp)->fptr)
|
||||
#define f_size(fp) ((fp)->obj.objsize)
|
||||
#define f_rewind(fp) f_lseek((fp), 0)
|
||||
#define f_rewinddir(dp) f_readdir((dp), 0)
|
||||
#define f_rmdir(path) f_unlink(path)
|
||||
#define f_unmount(path) f_mount(0, path, 0)
|
||||
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------*/
|
||||
/* Additional Functions */
|
||||
/*--------------------------------------------------------------*/
|
||||
|
||||
/* RTC function (provided by user) */
|
||||
#if !FF_FS_READONLY && !FF_FS_NORTC
|
||||
DWORD get_fattime (void); /* Get current time */
|
||||
#endif
|
||||
|
||||
|
||||
/* LFN support functions (defined in ffunicode.c) */
|
||||
|
||||
#if FF_USE_LFN >= 1
|
||||
WCHAR ff_oem2uni (WCHAR oem, WORD cp); /* OEM code to Unicode conversion */
|
||||
WCHAR ff_uni2oem (DWORD uni, WORD cp); /* Unicode to OEM code conversion */
|
||||
DWORD ff_wtoupper (DWORD uni); /* Unicode upper-case conversion */
|
||||
#endif
|
||||
|
||||
|
||||
/* O/S dependent functions (samples available in ffsystem.c) */
|
||||
|
||||
#if FF_USE_LFN == 3 /* Dynamic memory allocation */
|
||||
void* ff_memalloc (UINT msize); /* Allocate memory block */
|
||||
void ff_memfree (void* mblock); /* Free memory block */
|
||||
#endif
|
||||
#if FF_FS_REENTRANT /* Sync functions */
|
||||
int ff_mutex_create (int vol); /* Create a sync object */
|
||||
void ff_mutex_delete (int vol); /* Delete a sync object */
|
||||
int ff_mutex_take (int vol); /* Lock sync object */
|
||||
void ff_mutex_give (int vol); /* Unlock sync object */
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/*--------------------------------------------------------------*/
|
||||
/* Flags and Offset Address */
|
||||
/*--------------------------------------------------------------*/
|
||||
|
||||
/* File access mode and open method flags (3rd argument of f_open function) */
|
||||
#define FA_READ 0x01
|
||||
#define FA_WRITE 0x02
|
||||
#define FA_OPEN_EXISTING 0x00
|
||||
#define FA_CREATE_NEW 0x04
|
||||
#define FA_CREATE_ALWAYS 0x08
|
||||
#define FA_OPEN_ALWAYS 0x10
|
||||
#define FA_OPEN_APPEND 0x30
|
||||
|
||||
/* Fast seek controls (2nd argument of f_lseek function) */
|
||||
#define CREATE_LINKMAP ((FSIZE_t)0 - 1)
|
||||
|
||||
/* Format options (2nd argument of f_mkfs function) */
|
||||
#define FM_FAT 0x01
|
||||
#define FM_FAT32 0x02
|
||||
#define FM_EXFAT 0x04
|
||||
#define FM_ANY 0x07
|
||||
#define FM_SFD 0x08
|
||||
|
||||
/* Filesystem type (FATFS.fs_type) */
|
||||
#define FS_FAT12 1
|
||||
#define FS_FAT16 2
|
||||
#define FS_FAT32 3
|
||||
#define FS_EXFAT 4
|
||||
|
||||
/* File attribute bits for directory entry (FILINFO.fattrib) */
|
||||
#define AM_RDO 0x01 /* Read only */
|
||||
#define AM_HID 0x02 /* Hidden */
|
||||
#define AM_SYS 0x04 /* System */
|
||||
#define AM_DIR 0x10 /* Directory */
|
||||
#define AM_ARC 0x20 /* Archive */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* FF_DEFINED */
|
||||
@@ -0,0 +1,208 @@
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* A Sample Code of User Provided OS Dependent Functions for FatFs */
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
#include "ff.h"
|
||||
|
||||
|
||||
#if FF_USE_LFN == 3 /* Use dynamic memory allocation */
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* Allocate/Free a Memory Block */
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
#include <stdlib.h> /* with POSIX API */
|
||||
|
||||
|
||||
void* ff_memalloc ( /* Returns pointer to the allocated memory block (null if not enough core) */
|
||||
UINT msize /* Number of bytes to allocate */
|
||||
)
|
||||
{
|
||||
return malloc((size_t)msize); /* Allocate a new memory block */
|
||||
}
|
||||
|
||||
|
||||
void ff_memfree (
|
||||
void* mblock /* Pointer to the memory block to free (no effect if null) */
|
||||
)
|
||||
{
|
||||
free(mblock); /* Free the memory block */
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#if FF_FS_REENTRANT /* Mutal exclusion */
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* Definitions of Mutex */
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
#define OS_TYPE 0 /* 0:Win32, 1:uITRON4.0, 2:uC/OS-II, 3:FreeRTOS, 4:CMSIS-RTOS */
|
||||
|
||||
|
||||
#if OS_TYPE == 0 /* Win32 */
|
||||
#include <windows.h>
|
||||
static HANDLE Mutex[FF_VOLUMES + 1]; /* Table of mutex handle */
|
||||
|
||||
#elif OS_TYPE == 1 /* uITRON */
|
||||
#include "itron.h"
|
||||
#include "kernel.h"
|
||||
static mtxid Mutex[FF_VOLUMES + 1]; /* Table of mutex ID */
|
||||
|
||||
#elif OS_TYPE == 2 /* uc/OS-II */
|
||||
#include "includes.h"
|
||||
static OS_EVENT *Mutex[FF_VOLUMES + 1]; /* Table of mutex pinter */
|
||||
|
||||
#elif OS_TYPE == 3 /* FreeRTOS */
|
||||
#include "FreeRTOS.h"
|
||||
#include "semphr.h"
|
||||
static SemaphoreHandle_t Mutex[FF_VOLUMES + 1]; /* Table of mutex handle */
|
||||
|
||||
#elif OS_TYPE == 4 /* CMSIS-RTOS */
|
||||
#include "cmsis_os.h"
|
||||
static osMutexId Mutex[FF_VOLUMES + 1]; /* Table of mutex ID */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* Create a Mutex */
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* This function is called in f_mount function to create a new mutex
|
||||
/ or semaphore for the volume. When a 0 is returned, the f_mount function
|
||||
/ fails with FR_INT_ERR.
|
||||
*/
|
||||
|
||||
int ff_mutex_create ( /* Returns 1:Function succeeded or 0:Could not create the mutex */
|
||||
int vol /* Mutex ID: Volume mutex (0 to FF_VOLUMES - 1) or system mutex (FF_VOLUMES) */
|
||||
)
|
||||
{
|
||||
#if OS_TYPE == 0 /* Win32 */
|
||||
Mutex[vol] = CreateMutex(NULL, FALSE, NULL);
|
||||
return (int)(Mutex[vol] != INVALID_HANDLE_VALUE);
|
||||
|
||||
#elif OS_TYPE == 1 /* uITRON */
|
||||
T_CMTX cmtx = {TA_TPRI,1};
|
||||
|
||||
Mutex[vol] = acre_mtx(&cmtx);
|
||||
return (int)(Mutex[vol] > 0);
|
||||
|
||||
#elif OS_TYPE == 2 /* uC/OS-II */
|
||||
OS_ERR err;
|
||||
|
||||
Mutex[vol] = OSMutexCreate(0, &err);
|
||||
return (int)(err == OS_NO_ERR);
|
||||
|
||||
#elif OS_TYPE == 3 /* FreeRTOS */
|
||||
Mutex[vol] = xSemaphoreCreateMutex();
|
||||
return (int)(Mutex[vol] != NULL);
|
||||
|
||||
#elif OS_TYPE == 4 /* CMSIS-RTOS */
|
||||
osMutexDef(cmsis_os_mutex);
|
||||
|
||||
Mutex[vol] = osMutexCreate(osMutex(cmsis_os_mutex));
|
||||
return (int)(Mutex[vol] != NULL);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* Delete a Mutex */
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* This function is called in f_mount function to delete a mutex or
|
||||
/ semaphore of the volume created with ff_mutex_create function.
|
||||
*/
|
||||
|
||||
void ff_mutex_delete ( /* Returns 1:Function succeeded or 0:Could not delete due to an error */
|
||||
int vol /* Mutex ID: Volume mutex (0 to FF_VOLUMES - 1) or system mutex (FF_VOLUMES) */
|
||||
)
|
||||
{
|
||||
#if OS_TYPE == 0 /* Win32 */
|
||||
CloseHandle(Mutex[vol]);
|
||||
|
||||
#elif OS_TYPE == 1 /* uITRON */
|
||||
del_mtx(Mutex[vol]);
|
||||
|
||||
#elif OS_TYPE == 2 /* uC/OS-II */
|
||||
OS_ERR err;
|
||||
|
||||
OSMutexDel(Mutex[vol], OS_DEL_ALWAYS, &err);
|
||||
|
||||
#elif OS_TYPE == 3 /* FreeRTOS */
|
||||
vSemaphoreDelete(Mutex[vol]);
|
||||
|
||||
#elif OS_TYPE == 4 /* CMSIS-RTOS */
|
||||
osMutexDelete(Mutex[vol]);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* Request a Grant to Access the Volume */
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* This function is called on enter file functions to lock the volume.
|
||||
/ When a 0 is returned, the file function fails with FR_TIMEOUT.
|
||||
*/
|
||||
|
||||
int ff_mutex_take ( /* Returns 1:Succeeded or 0:Timeout */
|
||||
int vol /* Mutex ID: Volume mutex (0 to FF_VOLUMES - 1) or system mutex (FF_VOLUMES) */
|
||||
)
|
||||
{
|
||||
#if OS_TYPE == 0 /* Win32 */
|
||||
return (int)(WaitForSingleObject(Mutex[vol], FF_FS_TIMEOUT) == WAIT_OBJECT_0);
|
||||
|
||||
#elif OS_TYPE == 1 /* uITRON */
|
||||
return (int)(tloc_mtx(Mutex[vol], FF_FS_TIMEOUT) == E_OK);
|
||||
|
||||
#elif OS_TYPE == 2 /* uC/OS-II */
|
||||
OS_ERR err;
|
||||
|
||||
OSMutexPend(Mutex[vol], FF_FS_TIMEOUT, &err));
|
||||
return (int)(err == OS_NO_ERR);
|
||||
|
||||
#elif OS_TYPE == 3 /* FreeRTOS */
|
||||
return (int)(xSemaphoreTake(Mutex[vol], FF_FS_TIMEOUT) == pdTRUE);
|
||||
|
||||
#elif OS_TYPE == 4 /* CMSIS-RTOS */
|
||||
return (int)(osMutexWait(Mutex[vol], FF_FS_TIMEOUT) == osOK);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* Release a Grant to Access the Volume */
|
||||
/*------------------------------------------------------------------------*/
|
||||
/* This function is called on leave file functions to unlock the volume.
|
||||
*/
|
||||
|
||||
void ff_mutex_give (
|
||||
int vol /* Mutex ID: Volume mutex (0 to FF_VOLUMES - 1) or system mutex (FF_VOLUMES) */
|
||||
)
|
||||
{
|
||||
#if OS_TYPE == 0 /* Win32 */
|
||||
ReleaseMutex(Mutex[vol]);
|
||||
|
||||
#elif OS_TYPE == 1 /* uITRON */
|
||||
unl_mtx(Mutex[vol]);
|
||||
|
||||
#elif OS_TYPE == 2 /* uC/OS-II */
|
||||
OSMutexPost(Mutex[vol]);
|
||||
|
||||
#elif OS_TYPE == 3 /* FreeRTOS */
|
||||
xSemaphoreGive(Mutex[vol]);
|
||||
|
||||
#elif OS_TYPE == 4 /* CMSIS-RTOS */
|
||||
osMutexRelease(Mutex[vol]);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* FF_FS_REENTRANT */
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File renamed without changes.
File renamed without changes.
+102
-57
@@ -16,19 +16,19 @@ extern BOOL bHDMIMode;
|
||||
extern BOOL bAudioEnable;
|
||||
BOOL ParseEDID();
|
||||
|
||||
INSTANCE InitInstanceData =
|
||||
INSTANCE InitInstanceData =
|
||||
{
|
||||
0,0, //I2C_DEV, I2C_ADDR
|
||||
0, //bIntType (TxCLK active, Push-Pull Mode, INT active low)
|
||||
0,/* | T_MODE_CCIR656 | T_MODE_SYNCEMB | T_MODE_INDDR */ // bInputVideoSignalType
|
||||
|
||||
|
||||
B_AUDFMT_STD_I2S, // bOutputAudioMode, 0x00, standard i2s, rising edge to sample ws/i2s, not full packet mode REG[0xE1]
|
||||
|
||||
|
||||
0,// bAudioChannelSwap
|
||||
B_AUD_EN_I2S0 | B_AUD_I2S | M_AUD_16BIT, // bAudioChannelEnable, 0x01, REG[0xE0], defined in it6613_drv.h
|
||||
AUDFS_48KHz, //0, //bAudFs,
|
||||
0, // TMDSClock
|
||||
TRUE,//bAuthenticated
|
||||
TRUE,//bAuthenticated
|
||||
TRUE,// bHDMIMode
|
||||
FALSE,// bIntPOL
|
||||
FALSE // bHPD
|
||||
@@ -38,19 +38,19 @@ bool HDMITX_ChipVerify(void){
|
||||
bool bPass = FALSE;
|
||||
alt_u8 szID[4];
|
||||
int i;
|
||||
|
||||
|
||||
|
||||
|
||||
for(i=0;i<4;i++)
|
||||
szID[i] = HDMITX_ReadI2C_Byte(i);
|
||||
|
||||
|
||||
// if (szID[0] == 0x00 && szID[1] == 0xCA && szID[1] == 0x13 && szID[1] == 0x06) szID[0] ???
|
||||
if ((szID[1] == 0xCA && szID[2] == 0x13 && szID[3] == 0x06) || (szID[1] == 0xCA && szID[2] == 0x13 && szID[3] == 0x16)){
|
||||
bPass = TRUE;
|
||||
printf("TX Chip Revision ID: %d\n", szID[0]);
|
||||
printf("TX Chip Revision ID: %d\n", szID[0]);
|
||||
}else{
|
||||
printf("NG, Read TX Chip ID:%02X%02X%02X%02Xh (expected:00CA1306h)\n", szID[0], szID[1], szID[2], szID[3]);
|
||||
printf("NG, Read TX Chip ID:%02X%02X%02X%02Xh (expected:00CA1306h)\n", szID[0], szID[1], szID[2], szID[3]);
|
||||
}
|
||||
|
||||
|
||||
return bPass;
|
||||
}
|
||||
|
||||
@@ -62,33 +62,33 @@ bool HDMITX_Init(void){
|
||||
OS_PRINTF("Failed to find IT6613 HDMI-TX Chip.\n");
|
||||
bSuccess = FALSE;
|
||||
//return 0;
|
||||
}
|
||||
}
|
||||
|
||||
HDMITX_InitInstance(&InitInstanceData) ;
|
||||
InitIT6613() ;
|
||||
|
||||
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
bool HDMITX_HPD(void){
|
||||
if (TX_HDP)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
void HDMITX_SetAVIInfoFrame(alt_u8 VIC, alt_u8 OutputColorMode, bool b16x9, bool ITU709, bool ITC, alt_u8 pixelrep)
|
||||
void HDMITX_SetAVIInfoFrame(alt_u8 VIC, alt_u8 OutputColorMode, alt_u8 AspectRatio, bool ITU709, bool ITC, alt_u8 pixelrep)
|
||||
{
|
||||
AVI_InfoFrame AviInfo;
|
||||
|
||||
OS_PRINTF("HDMITX_SetAVIInfoFrame: VIC=%d, ColorMode=%d, Aspect-Ratio=%s, ITU709=%s, ITC=%s, pixelrep=%u\n",
|
||||
VIC, OutputColorMode, b16x9?"16:9":"4:3", ITU709?"Yes":"No", ITC?"Yes":"No", pixelrep);
|
||||
OS_PRINTF("HDMITX_SetAVIInfoFrame: VIC=%d, ColorMode=%d, Aspect-Ratio=%d, ITU709=%s, ITC=%s, pixelrep=%u\n",
|
||||
VIC, OutputColorMode, AspectRatio, ITU709?"Yes":"No", ITC?"Yes":"No", pixelrep);
|
||||
|
||||
AviInfo.pktbyte.AVI_HB[0] = AVI_INFOFRAME_TYPE|0x80 ;
|
||||
AviInfo.pktbyte.AVI_HB[1] = AVI_INFOFRAME_VER ;
|
||||
AviInfo.pktbyte.AVI_HB[2] = AVI_INFOFRAME_LEN ;
|
||||
|
||||
AviInfo.pktbyte.AVI_HB[0] = AVI_INFOFRAME_TYPE|0x80 ;
|
||||
AviInfo.pktbyte.AVI_HB[1] = AVI_INFOFRAME_VER ;
|
||||
AviInfo.pktbyte.AVI_HB[2] = AVI_INFOFRAME_LEN ;
|
||||
|
||||
switch(OutputColorMode)
|
||||
{
|
||||
case F_MODE_YUV444:
|
||||
@@ -108,7 +108,7 @@ void HDMITX_SetAVIInfoFrame(alt_u8 VIC, alt_u8 OutputColorMode, bool b16x9, bool
|
||||
//AviInfo.pktbyte.AVI_DB[0] = (0<<5)|(1<<4) ;
|
||||
AviInfo.pktbyte.AVI_DB[0] |= 2; // indicate "no overscan"
|
||||
AviInfo.pktbyte.AVI_DB[1] = 8 ;
|
||||
//AviInfo.pktbyte.AVI_DB[1] |= (!b16x9)?(1<<4):(2<<4) ; // 4:3 or 16:9
|
||||
AviInfo.pktbyte.AVI_DB[1] |= (AspectRatio & 3)<<4 ; // 0: aspect ratio not specified, 1: indicate 4:3, 2: indicate 16:9
|
||||
AviInfo.pktbyte.AVI_DB[1] |= (!ITU709)?(1<<6):(2<<6) ; // ITU709 or ITU601
|
||||
AviInfo.pktbyte.AVI_DB[2] = ((1<<3) | (ITC<<7)) ; // indicate "full-range RGB", setup ITC bit
|
||||
AviInfo.pktbyte.AVI_DB[3] = VIC ;
|
||||
@@ -128,7 +128,7 @@ void HDMITX_SetAVIInfoFrame(alt_u8 VIC, alt_u8 OutputColorMode, bool b16x9, bool
|
||||
void HDMITX_ChangeVideoTiming(int VIC){
|
||||
int OutputVideoTiming = VIC;
|
||||
int HdmiColorMode;
|
||||
|
||||
|
||||
switch(bOutputColorMode)
|
||||
{
|
||||
case F_MODE_YUV444:
|
||||
@@ -141,15 +141,15 @@ void HDMITX_ChangeVideoTiming(int VIC){
|
||||
default:
|
||||
HdmiColorMode = HDMI_RGB444;
|
||||
break ;
|
||||
}
|
||||
|
||||
HDMITX_ChangeDisplayOption(OutputVideoTiming, HdmiColorMode); // just modify variable. Take effect when HDMITX_SetOutput is called in HDMITX_DevLoopProc
|
||||
}
|
||||
|
||||
HDMITX_ChangeDisplayOption(OutputVideoTiming, HdmiColorMode); // just modify variable. Take effect when HDMITX_SetOutput is called in HDMITX_DevLoopProc
|
||||
}
|
||||
|
||||
void HDMITX_ChangeVideoTimingAndColor(int VIC, COLOR_TYPE Color){
|
||||
int OutputVideoTiming = VIC;
|
||||
int HdmiColorMode;
|
||||
|
||||
|
||||
switch(Color)
|
||||
{
|
||||
case COLOR_YUV444:
|
||||
@@ -162,12 +162,12 @@ void HDMITX_ChangeVideoTimingAndColor(int VIC, COLOR_TYPE Color){
|
||||
default:
|
||||
HdmiColorMode = HDMI_RGB444;
|
||||
break ;
|
||||
}
|
||||
HDMITX_ChangeDisplayOption(OutputVideoTiming, HdmiColorMode);
|
||||
}
|
||||
HDMITX_ChangeDisplayOption(OutputVideoTiming, HdmiColorMode);
|
||||
}
|
||||
|
||||
void HDMITX_DisableVideoOutput(void){
|
||||
DisableVideoOutput();
|
||||
DisableVideoOutput();
|
||||
}
|
||||
|
||||
void HDMITX_EnableVideoOutput(void){
|
||||
@@ -183,7 +183,7 @@ void HDMITX_SetColorSpace(COLOR_TYPE InputColor, COLOR_TYPE OutputColor){
|
||||
|
||||
bool HDMITX_IsSinkSupportYUV444(void){
|
||||
bool bSupport = FALSE;
|
||||
if (RxCapability.Valid && RxCapability.ValidHDMI && RxCapability.ValidCEA &&
|
||||
if (RxCapability.Valid && RxCapability.ValidHDMI && RxCapability.ValidCEA &&
|
||||
(RxCapability.VideoMode & CEA_SUPPORT_YUV444))
|
||||
bSupport = TRUE;
|
||||
return bSupport;
|
||||
@@ -191,7 +191,7 @@ bool HDMITX_IsSinkSupportYUV444(void){
|
||||
|
||||
bool HDMITX_IsSinkSupportYUV422(void){
|
||||
bool bSupport = FALSE;
|
||||
if (RxCapability.Valid && RxCapability.ValidHDMI && RxCapability.ValidCEA &&
|
||||
if (RxCapability.Valid && RxCapability.ValidHDMI && RxCapability.ValidCEA &&
|
||||
(RxCapability.VideoMode & CEA_SUPPORT_YUV422))
|
||||
bSupport = TRUE;
|
||||
return bSupport;
|
||||
@@ -199,19 +199,19 @@ bool HDMITX_IsSinkSupportYUV422(void){
|
||||
|
||||
bool HDMITX_IsSinkSupportColorDepth36(void){
|
||||
bool bSupport = FALSE;
|
||||
if (RxCapability.Valid && RxCapability.ValidHDMI && RxCapability.ValidCEA &&
|
||||
if (RxCapability.Valid && RxCapability.ValidHDMI && RxCapability.ValidCEA &&
|
||||
RxCapability.dc.info.DC_36Bit)
|
||||
bSupport = TRUE;
|
||||
return bSupport;
|
||||
return bSupport;
|
||||
}
|
||||
|
||||
|
||||
bool HDMITX_IsSinkSupportColorDepth30(void){
|
||||
bool bSupport = FALSE;
|
||||
if (RxCapability.Valid && RxCapability.ValidHDMI && RxCapability.ValidCEA &&
|
||||
if (RxCapability.Valid && RxCapability.ValidHDMI && RxCapability.ValidCEA &&
|
||||
RxCapability.dc.info.DC_30Bit)
|
||||
bSupport = TRUE;
|
||||
return bSupport;
|
||||
return bSupport;
|
||||
}
|
||||
|
||||
void HDMITX_SetOutputColorDepth(int ColorDepth){
|
||||
@@ -228,36 +228,36 @@ bool HDMITX_DevLoopProc()
|
||||
|
||||
// Richard CheckHDMI(&HPD,&HPDChange) ;
|
||||
CheckHDMITX(&HPD,&HPDChange) ;
|
||||
|
||||
|
||||
if (HPD == PreHPD && HPDChange) // richard add
|
||||
return FALSE;
|
||||
|
||||
TX_HDP = HPD;
|
||||
PreHPD = HPD;
|
||||
PreHPDChange = HPDChange;
|
||||
|
||||
|
||||
TX_HDP = HPD;
|
||||
PreHPD = HPD;
|
||||
PreHPDChange = HPDChange;
|
||||
|
||||
if( HPDChange )
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
OS_PRINTF("HPDChange\n");
|
||||
if( HPD )
|
||||
{
|
||||
OS_PRINTF("HPD=ON\n");
|
||||
RxCapability.Valid = ParseEDID() ;
|
||||
//bOutputColorMode = F_MODE_YUV444; //F_MODE_RGB444; // richard node. users can change color space here according to HDMI sink
|
||||
|
||||
//bOutputColorMode = F_MODE_YUV444; //F_MODE_RGB444; // richard node. users can change color space here according to HDMI sink
|
||||
|
||||
if( RxCapability.Valid && RxCapability.ValidHDMI )
|
||||
{
|
||||
OS_PRINTF("HDMI Display found\n");
|
||||
bHDMIMode = TRUE ;
|
||||
|
||||
|
||||
if(RxCapability.VideoMode & (1<<6))
|
||||
{
|
||||
bAudioEnable = TRUE ;
|
||||
}
|
||||
|
||||
#if 0 // richard, don't care edid, the output always RGB444
|
||||
|
||||
#if 0 // richard, don't care edid, the output always RGB444
|
||||
if( RxCapability.VideoMode & (1<<5))
|
||||
{
|
||||
bOutputColorMode &= ~F_MODE_CLRMOD_MASK ;
|
||||
@@ -268,17 +268,17 @@ bool HDMITX_DevLoopProc()
|
||||
bOutputColorMode &= ~F_MODE_CLRMOD_MASK ;
|
||||
bOutputColorMode |= F_MODE_YUV422 ;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
else if (!RxCapability.Valid)
|
||||
{
|
||||
OS_PRINTF("Failed to read EDID\n");
|
||||
|
||||
|
||||
// enable it when edid fail
|
||||
bHDMIMode = TRUE ;
|
||||
bAudioEnable = TRUE ;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
OS_PRINTF("Invalid HDMI Display\n");
|
||||
bHDMIMode = FALSE ;
|
||||
@@ -287,7 +287,7 @@ bool HDMITX_DevLoopProc()
|
||||
|
||||
OS_PRINTF("HDMITX_SetOutput\n");
|
||||
//HDMITX_SetOutput() ;
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -308,7 +308,7 @@ bool HDMITX_DevLoopProc()
|
||||
HDMITX_SetOutput() ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return HPDChange;
|
||||
}
|
||||
|
||||
@@ -339,3 +339,48 @@ void HDMITX_SetAudioInfoFrame(BYTE bAudioDwSampling)
|
||||
|
||||
EnableAudioInfoFrame(TRUE, (BYTE *) &AudioInfo);
|
||||
}
|
||||
|
||||
void HDMITX_SetHDRInfoFrame(BYTE HDR_TF)
|
||||
{
|
||||
int i;
|
||||
HDR_InfoFrame HDRInfo;
|
||||
|
||||
HDRInfo.info.Type = HDR_INFOFRAME_TYPE;
|
||||
HDRInfo.info.Ver = HDR_INFOFRAME_VER;
|
||||
HDRInfo.info.Len = HDR_INFOFRAME_LEN;
|
||||
|
||||
HDRInfo.info.TF = HDR_TF;
|
||||
|
||||
for (i=1; i<HDR_INFOFRAME_LEN; i++) {
|
||||
HDRInfo.pktbyte.HDR_DB[i] = 0;
|
||||
}
|
||||
|
||||
/*HDRInfo.pktbyte.HDR_DB[22] = 0xe8;
|
||||
HDRInfo.pktbyte.HDR_DB[23] = 0x03;
|
||||
HDRInfo.pktbyte.HDR_DB[24] = 0xfa;
|
||||
HDRInfo.pktbyte.HDR_DB[25] = 0x00;*/
|
||||
|
||||
EnableGPInfoFrame(TRUE, (BYTE *) &HDRInfo);
|
||||
}
|
||||
|
||||
void HDMITX_SetVRRInfoFrame(BYTE enable)
|
||||
{
|
||||
int i;
|
||||
Freesync_InfoFrame VRRInfo;
|
||||
|
||||
VRRInfo.info.Type = SPD_INFOFRAME_TYPE;
|
||||
VRRInfo.info.Ver = VENDORSPEC_INFOFRAME_VER;
|
||||
VRRInfo.info.Len = VENDORSPEC_INFOFRAME_LEN;
|
||||
|
||||
VRRInfo.info.Enable = enable ? 0x1a : 0;
|
||||
VRRInfo.info.Mode2 = 0x07;
|
||||
VRRInfo.info.min_rate = 40;
|
||||
VRRInfo.info.max_rate = 144;
|
||||
|
||||
for (i=1; i<VENDORSPEC_INFOFRAME_LEN-3; i++) {
|
||||
VRRInfo.pktbyte.FS_DB[i] = 0;
|
||||
}
|
||||
|
||||
EnableGPInfoFrame(TRUE, (BYTE *) &VRRInfo);
|
||||
}
|
||||
|
||||
+3
-1
@@ -12,7 +12,7 @@ bool HDMITX_ChipVerify(void);
|
||||
bool HDMITX_HPD(void);
|
||||
void HDMITX_ChangeVideoTiming(int VIC);
|
||||
void HDMITX_ChangeVideoTimingAndColor(int VIC, COLOR_TYPE Color);
|
||||
void HDMITX_SetAVIInfoFrame(alt_u8 VIC, alt_u8 OutputColorMode, bool b16x9, bool ITU709, bool ITC, alt_u8 pixelrep);
|
||||
void HDMITX_SetAVIInfoFrame(alt_u8 VIC, alt_u8 OutputColorMode, alt_u8 AspectRatio, bool ITU709, bool ITC, alt_u8 pixelrep);
|
||||
|
||||
void HDMITX_DisableVideoOutput(void);
|
||||
void HDMITX_EnableVideoOutput(void);
|
||||
@@ -27,5 +27,7 @@ bool HDMITX_IsSinkSupportColorDepth30(void);
|
||||
void HDMITX_SetOutputColorDepth(int ColorDepth);
|
||||
|
||||
void HDMITX_SetAudioInfoFrame(BYTE bAudioDwSampling);
|
||||
void HDMITX_SetHDRInfoFrame(BYTE enableHDR);
|
||||
void HDMITX_SetVRRInfoFrame(BYTE enable);
|
||||
|
||||
#endif /*HDMI_TX_H_*/
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+139
-105
@@ -80,6 +80,7 @@ static SYS_STATUS SetAVIInfoFrame(AVI_InfoFrame *pAVIInfoFrame) ;
|
||||
static SYS_STATUS SetAudioInfoFrame(Audio_InfoFrame *pAudioInfoFrame) ;
|
||||
static SYS_STATUS SetSPDInfoFrame(SPD_InfoFrame *pSPDInfoFrame) ;
|
||||
static SYS_STATUS SetMPEGInfoFrame(MPEG_InfoFrame *pMPGInfoFrame) ;
|
||||
static SYS_STATUS SetGPInfoFrame(BYTE *pInfoFrameData) ;
|
||||
static SYS_STATUS ReadEDID(BYTE *pData,BYTE bSegment,BYTE offset,SHORT Count) ;
|
||||
static void AbortDDC() ;
|
||||
static void ClearDDCFIFO() ;
|
||||
@@ -183,7 +184,7 @@ static _CODE BYTE bCSCOffset_0_255[] =
|
||||
0xCE,0x3C,0x83,0x03,0xAE,0x3F,
|
||||
0x49,0x3D,0x33,0x3F,0x83,0x03
|
||||
} ;
|
||||
#endif
|
||||
#endif
|
||||
/*
|
||||
#ifdef SUPPORT_INPUTYUV
|
||||
|
||||
@@ -270,7 +271,7 @@ static BYTE InitIT6613_HDCPROM()
|
||||
HDMITX_WriteI2C_Byte(0xF8,0xA5) ; // password
|
||||
HDMITX_WriteI2C_Byte(REG_TX_LISTCTRL,0x60) ; // Richard, ????
|
||||
I2C_Read_ByteN(0xE0,0x00,uc,5) ; // richard note. internal rom is used
|
||||
|
||||
|
||||
if(uc[0] == 1 &&
|
||||
uc[1] == 1 &&
|
||||
uc[2] == 1 &&
|
||||
@@ -288,7 +289,7 @@ static BYTE InitIT6613_HDCPROM()
|
||||
HDMITX_WriteI2C_Byte(REG_TX_LISTCTRL,0x00) ; // Richard, ????
|
||||
}
|
||||
HDMITX_WriteI2C_Byte(0xF8,0xFF) ; // password
|
||||
|
||||
|
||||
// richard add
|
||||
return ER_SUCCESS;
|
||||
}
|
||||
@@ -299,26 +300,26 @@ void InitIT6613()
|
||||
HDMITX_WriteI2C_Byte(REG_TX_INT_CTRL,Instance[0].bIntType) ;
|
||||
Instance[0].bIntPOL = (Instance[0].bIntType&B_INTPOL_ACTH)?TRUE:FALSE ;
|
||||
|
||||
// Reset
|
||||
// Reset
|
||||
HDMITX_WriteI2C_Byte(REG_TX_SW_RST,B_REF_RST|B_VID_RST|B_AUD_RST|B_AREF_RST|B_HDCP_RST) ;
|
||||
DelayMS(1) ;
|
||||
HDMITX_WriteI2C_Byte(REG_TX_SW_RST,B_VID_RST|B_AUD_RST|B_AREF_RST|B_HDCP_RST) ;
|
||||
|
||||
#if 0
|
||||
|
||||
#if 0
|
||||
// Enable clock ring (richard add according toe programming guide)
|
||||
HDMITX_WriteI2C_Byte(REG_TX_AFE_DRV_CTRL, 0x10);
|
||||
|
||||
|
||||
// Set default DVI mode (richard add according toe programming guide)
|
||||
// HDMITX_WriteI2C_Byte(REG_TX_HDMI_MODE, 0x01); // set HDMI mode
|
||||
HDMITX_WriteI2C_Byte(REG_TX_HDMI_MODE, 0x00); // set DVI mode
|
||||
#endif
|
||||
// HDMITX_WriteI2C_Byte(REG_TX_HDMI_MODE, 0x01); // set HDMI mode
|
||||
HDMITX_WriteI2C_Byte(REG_TX_HDMI_MODE, 0x00); // set DVI mode
|
||||
#endif
|
||||
|
||||
// Avoid power loading in un play status.
|
||||
HDMITX_WriteI2C_Byte(REG_TX_AFE_DRV_CTRL,B_AFE_DRV_RST|B_AFE_DRV_PWD) ;
|
||||
|
||||
// set interrupt mask,mask value 0 is interrupt available.
|
||||
// richard HDMITX_WriteI2C_Byte(REG_TX_INT_MASK1,0xB2) ; // enable interrupt: HPD, DDCBusHangMask,
|
||||
HDMITX_WriteI2C_Byte(REG_TX_INT_MASK1,0xB2) ; // enable interrupt: HPD, DDCBusHangMask,
|
||||
// richard HDMITX_WriteI2C_Byte(REG_TX_INT_MASK1,0xB2) ; // enable interrupt: HPD, DDCBusHangMask,
|
||||
HDMITX_WriteI2C_Byte(REG_TX_INT_MASK1,0xB2) ; // enable interrupt: HPD, DDCBusHangMask,
|
||||
HDMITX_WriteI2C_Byte(REG_TX_INT_MASK2,0xF8) ; // enable interrupt: AuthFailMask, AUthDoneMask, KSVListChkMask
|
||||
HDMITX_WriteI2C_Byte(REG_TX_INT_MASK3,0x37) ; // enable interrupt: PktAudMask, PktDBDMask, PkMpgMask, AUdCTSMask, HDCPSynDetMask
|
||||
|
||||
@@ -331,7 +332,7 @@ void InitIT6613()
|
||||
DISABLE_AUD_INFOFRM_PKT() ;
|
||||
DISABLE_SPD_INFOFRM_PKT() ;
|
||||
DISABLE_MPG_INFOFRM_PKT();
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Setup Output Audio format.
|
||||
@@ -396,7 +397,7 @@ BOOL EnableVideoOutput(VIDEOPCLKLEVEL level,BYTE inputColorMode,BYTE outputColor
|
||||
uc = HDMITX_ReadI2C_Byte(REG_TX_CLK_CTRL1) ;
|
||||
uc |= B_VDO_LATCH_EDGE ;
|
||||
HDMITX_WriteI2C_Byte(REG_TX_CLK_CTRL1, uc) ;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
HDMITX_WriteI2C_Byte(REG_TX_SW_RST, B_AUD_RST|B_AREF_RST|B_HDCP_RST) ;
|
||||
|
||||
@@ -442,7 +443,7 @@ BOOL EnableAudioOutput(ULONG VideoPixelClock,BYTE bAudioSampleFreq,BYTE ChannelN
|
||||
|
||||
Instance[0].TMDSClock = VideoPixelClock ;
|
||||
Instance[0].bAudFs = bAudioSampleFreq ;
|
||||
|
||||
|
||||
ErrorF("EnableAudioOutput(%d,%ld,%x,%d,%d,%d);\n",0,VideoPixelClock,bAudioSampleFreq,ChannelNumber,bAudSWL,bSPDIF) ;
|
||||
|
||||
switch(ChannelNumber)
|
||||
@@ -474,12 +475,12 @@ BOOL EnableAudioOutput(ULONG VideoPixelClock,BYTE bAudioSampleFreq,BYTE ChannelN
|
||||
HDMITX_WriteI2C_Byte(REGPktAudCTS0,0x50) ;
|
||||
HDMITX_WriteI2C_Byte(REGPktAudCTS1,0x73) ;
|
||||
HDMITX_WriteI2C_Byte(REGPktAudCTS2,0x00) ;
|
||||
|
||||
|
||||
HDMITX_WriteI2C_Byte(REGPktAudN0,0) ;
|
||||
HDMITX_WriteI2C_Byte(REGPktAudN1,0x18) ;
|
||||
HDMITX_WriteI2C_Byte(REGPktAudN2,0) ;
|
||||
Switch_HDMITX_Bank(0) ;
|
||||
|
||||
|
||||
HDMITX_WriteI2C_Byte(0xC5, 2) ; // D[1] = 0, HW auto count CTS
|
||||
}
|
||||
else
|
||||
@@ -615,15 +616,15 @@ EnableHDCP(BYTE bEnable)
|
||||
{
|
||||
if(ER_FAIL == HDCP_Authenticate())
|
||||
{
|
||||
|
||||
HDCP_ResetAuth() ;
|
||||
|
||||
HDCP_ResetAuth() ;
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
HDCP_ResetAuth() ;
|
||||
HDCP_ResetAuth() ;
|
||||
}
|
||||
return TRUE ;
|
||||
}
|
||||
@@ -638,8 +639,8 @@ CheckHDMITX(BYTE *pHPD,BYTE *pHPDChange)
|
||||
BOOL HPD ;
|
||||
|
||||
sysstat = HDMITX_ReadI2C_Byte(REG_TX_SYS_STATUS) ; // read system status register
|
||||
|
||||
// OS_PRINTF("sysstat(REG[0x0E])=%02Xh\r\n", sysstat);
|
||||
|
||||
// OS_PRINTF("sysstat(REG[0x0E])=%02Xh\r\n", sysstat);
|
||||
|
||||
HPD = ((sysstat & (B_HPDETECT|B_RXSENDETECT)) == (B_HPDETECT|B_RXSENDETECT))?TRUE:FALSE ;
|
||||
|
||||
@@ -751,7 +752,7 @@ CheckHDMITX(BYTE *pHPD,BYTE *pHPDChange)
|
||||
}
|
||||
|
||||
SetupAudioChannel() ; // 2007/12/12 added by jj_tseng
|
||||
|
||||
|
||||
if(pHPD)
|
||||
{
|
||||
*pHPD = HPD ? TRUE:FALSE ;
|
||||
@@ -810,7 +811,7 @@ EnableAudioInfoFrame(BYTE bEnable,BYTE *pAudioInfoFrame)
|
||||
if(!bEnable)
|
||||
{
|
||||
// richard modify, DISABLE_AVI_INFOFRM_PKT() ;
|
||||
DISABLE_AUD_INFOFRM_PKT();
|
||||
DISABLE_AUD_INFOFRM_PKT();
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
@@ -823,6 +824,22 @@ EnableAudioInfoFrame(BYTE bEnable,BYTE *pAudioInfoFrame)
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
BOOL
|
||||
EnableGPInfoFrame(BYTE bEnable, BYTE *pInfoFrame)
|
||||
{
|
||||
if (!bEnable) {
|
||||
DISABLE_NULL_PKT();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if(SetGPInfoFrame(pInfoFrame) == ER_SUCCESS)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
void
|
||||
SetAVMute(BYTE bEnable)
|
||||
{
|
||||
@@ -1087,7 +1104,7 @@ BOOL ProgramDEGenModeByID(MODE_ID id,BYTE bInputSignalType)
|
||||
{
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
|
||||
Switch_HDMITX_Bank(0) ;
|
||||
HDMITX_WriteI2C_Byte(0x90,DeGen_Table[i].Reg90) ;
|
||||
HDMITX_WriteI2C_Byte(0x92,DeGen_Table[i].Reg92) ;
|
||||
@@ -1100,7 +1117,7 @@ BOOL ProgramDEGenModeByID(MODE_ID id,BYTE bInputSignalType)
|
||||
HDMITX_WriteI2C_Byte(0x9E,DeGen_Table[i].Reg9E) ;
|
||||
HDMITX_WriteI2C_Byte(0x9F,DeGen_Table[i].Reg9F) ;
|
||||
return TRUE ;
|
||||
|
||||
|
||||
}
|
||||
return FALSE ;
|
||||
}
|
||||
@@ -1181,21 +1198,21 @@ ProgramSyncEmbeddedVideoMode(BYTE VIC,BYTE bInputSignalType)
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(SyncEmbTable[i].fmt == 0xFF)
|
||||
{
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
|
||||
HDMITX_WriteI2C_Byte(REG_TX_HVPol,SyncEmbTable[i].RegHVPol) ; // Reg90
|
||||
HDMITX_WriteI2C_Byte(REG_TX_HfPixel,SyncEmbTable[i].RegHfPixel) ; // Reg91
|
||||
|
||||
|
||||
HDMITX_WriteI2C_Byte(REG_TX_HSSL,SyncEmbTable[i].RegHSSL) ; // Reg95
|
||||
HDMITX_WriteI2C_Byte(REG_TX_HSEL,SyncEmbTable[i].RegHSEL) ; // Reg96
|
||||
HDMITX_WriteI2C_Byte(REG_TX_HSH,SyncEmbTable[i].RegHSH) ; // Reg97
|
||||
HDMITX_WriteI2C_Byte(REG_TX_VSS1,SyncEmbTable[i].RegVSS1) ; // RegA0
|
||||
HDMITX_WriteI2C_Byte(REG_TX_VSE1,SyncEmbTable[i].RegVSE1) ; // RegA1
|
||||
|
||||
|
||||
HDMITX_WriteI2C_Byte(REG_TX_VSS2,SyncEmbTable[i].RegVSS2) ; // RegA2
|
||||
HDMITX_WriteI2C_Byte(REG_TX_VSE2,SyncEmbTable[i].RegVSE2) ; // RegA3
|
||||
}
|
||||
@@ -1441,7 +1458,7 @@ SetCSCScale(BYTE bInputMode,BYTE bOutputMode)
|
||||
case F_MODE_ITU601|F_MODE_0_255:
|
||||
default:
|
||||
ErrorF("ITU601 0-255 ") ;
|
||||
|
||||
|
||||
HDMITX_WriteI2C_ByteN(REG_TX_CSC_YOFF,bCSCOffset_0_255,SIZEOF_CSCOFFSET) ;
|
||||
HDMITX_WriteI2C_ByteN(REG_TX_CSC_MTX11_L,bCSCMtx_RGB2YUV_ITU601_0_255,SIZEOF_CSCMTX) ;
|
||||
break ;
|
||||
@@ -1685,7 +1702,7 @@ SetAudioFormat(BYTE NumChannel,BYTE AudioEnable,BYTE bSampleFreq,BYTE AudSWL,BYT
|
||||
fs = ~fs ; // OFS is the one's complement of FS
|
||||
HDMITX_WriteI2C_Byte(REG_TX_AUDCHST_OFS_WL,(fs<<4)|SWL) ;
|
||||
Switch_HDMITX_Bank(0) ;
|
||||
|
||||
|
||||
// richard modify (could be bug), if(!(AudioEnable | B_AUD_SPDIF))
|
||||
if(!(AudioEnable & B_AUD_SPDIF))
|
||||
{
|
||||
@@ -1693,7 +1710,7 @@ SetAudioFormat(BYTE NumChannel,BYTE AudioEnable,BYTE bSampleFreq,BYTE AudSWL,BYT
|
||||
}
|
||||
|
||||
Instance[0].bAudioChannelEnable = AudioEnable ;
|
||||
|
||||
|
||||
// HDMITX_AndREG_Byte(REG_TX_SW_RST,B_AUD_RST) ; // enable Audio
|
||||
return ER_SUCCESS;
|
||||
}
|
||||
@@ -1717,30 +1734,30 @@ AutoAdjustAudio()
|
||||
// return ;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
Switch_HDMITX_Bank(1) ;
|
||||
|
||||
|
||||
N = ((unsigned long)HDMITX_ReadI2C_Byte(REGPktAudN2)&0xF) << 16 ;
|
||||
N |= ((unsigned long)HDMITX_ReadI2C_Byte(REGPktAudN1)) <<8 ;
|
||||
N |= ((unsigned long)HDMITX_ReadI2C_Byte(REGPktAudN0)) ;
|
||||
|
||||
|
||||
CTS = ((unsigned long)HDMITX_ReadI2C_Byte(REGPktAudCTSCnt2)&0xF) << 16 ;
|
||||
CTS |= ((unsigned long)HDMITX_ReadI2C_Byte(REGPktAudCTSCnt1)) <<8 ;
|
||||
CTS |= ((unsigned long)HDMITX_ReadI2C_Byte(REGPktAudCTSCnt0)) ;
|
||||
Switch_HDMITX_Bank(0) ;
|
||||
|
||||
// CTS = TMDSCLK * N / ( 128 * SampleFreq )
|
||||
// SampleFreq = TMDSCLK * N / (128*CTS)
|
||||
|
||||
if( CTS == 0 )
|
||||
|
||||
// CTS = TMDSCLK * N / ( 128 * SampleFreq )
|
||||
// SampleFreq = TMDSCLK * N / (128*CTS)
|
||||
|
||||
if( CTS == 0 )
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
SampleFreq = Instance[0].TMDSClock/CTS ;
|
||||
SampleFreq *= N ;
|
||||
SampleFreq /= 128 ;
|
||||
|
||||
|
||||
if( SampleFreq>31000 && SampleFreq<=38050 )
|
||||
{
|
||||
Instance[0].bAudFs = AUDFS_32KHz ;
|
||||
@@ -1776,16 +1793,16 @@ AutoAdjustAudio()
|
||||
Instance[0].bAudFs = AUDFS_192KHz ;
|
||||
fs = AUDFS_192KHz ;;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
Instance[0].bAudFs = AUDFS_OTHER;
|
||||
fs = AUDFS_OTHER;;
|
||||
}
|
||||
|
||||
// bPendingAdjustAudioFreq = FALSE ;
|
||||
|
||||
|
||||
SetNCTS(Instance[0].TMDSClock, Instance[0].bAudFs) ; // set N, CTS by new generated clock.
|
||||
|
||||
|
||||
Switch_HDMITX_Bank(1) ; // adjust the new fs in channel status registers
|
||||
HDMITX_WriteI2C_Byte(REG_TX_AUDCHST_CA_FS,0x00|fs) ; // choose clock
|
||||
fs = ~fs ; // OFS is the one's complement of FS
|
||||
@@ -1793,7 +1810,7 @@ AutoAdjustAudio()
|
||||
uc &= 0xF ;
|
||||
uc |= fs << 4 ;
|
||||
HDMITX_WriteI2C_Byte(REG_TX_AUDCHST_OFS_WL,uc) ;
|
||||
|
||||
|
||||
Switch_HDMITX_Bank(0) ;
|
||||
|
||||
}
|
||||
@@ -1994,7 +2011,7 @@ AbortDDC()
|
||||
{
|
||||
break ; // success
|
||||
}
|
||||
|
||||
|
||||
if( uc & (B_DDC_NOACK|B_DDC_WAITBUS|B_DDC_ARBILOSE) )
|
||||
{
|
||||
ErrorF("AbortDDC Fail by reg16=%02X\n",uc) ;
|
||||
@@ -2100,12 +2117,12 @@ ReadEDID(BYTE *pData,BYTE bSegment,BYTE offset,SHORT Count)
|
||||
for(TimeOut = 0 ; TimeOut < 200 ; TimeOut++)
|
||||
{
|
||||
ucdata = HDMITX_ReadI2C_Byte(REG_TX_DDC_STATUS) ;
|
||||
|
||||
|
||||
if(ucdata&B_DDC_DONE)
|
||||
{
|
||||
break ;
|
||||
break ;
|
||||
}
|
||||
|
||||
|
||||
if((ucdata & B_DDC_ERROR)||(HDMITX_ReadI2C_Byte(REG_TX_INT_STAT1) & B_INT_DDC_BUS_HANG))
|
||||
{
|
||||
ErrorF("Called AboutDDC()\n") ;
|
||||
@@ -2458,14 +2475,14 @@ HDCP_Authenticate()
|
||||
|
||||
HDCP_GetBKSV(BKSV) ;
|
||||
ErrorF("BKSV %02X %02X %02X %02X %02X\n",BKSV[0],BKSV[1],BKSV[2],BKSV[3],BKSV[4]) ;
|
||||
|
||||
|
||||
for(TimeOut = 0, ucdata = 0 ; TimeOut < 5 ; TimeOut ++)
|
||||
{
|
||||
ucdata += countbit(BKSV[TimeOut]) ;
|
||||
}
|
||||
if( ucdata != 20 ) return ER_FAIL ;
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef SUPPORT_REVOKE_KSV
|
||||
HDCP_VerifyRevocationList(SRM1,BKSV,&revoked) ;
|
||||
if(revoked)
|
||||
@@ -2513,7 +2530,7 @@ HDCP_Authenticate()
|
||||
{
|
||||
HDCP_Auth_Fire();
|
||||
// wait for status ;
|
||||
|
||||
|
||||
for(TimeOut = 250 ; TimeOut > 0 ; TimeOut --)
|
||||
{
|
||||
DelayMS(5) ; // delay 1ms
|
||||
@@ -2525,7 +2542,7 @@ HDCP_Authenticate()
|
||||
Instance[0].bAuthenticated = TRUE ;
|
||||
break ;
|
||||
}
|
||||
|
||||
|
||||
ucdata = HDMITX_ReadI2C_Byte(REG_TX_INT_STAT2) ;
|
||||
if(ucdata & B_INT_AUTH_FAIL)
|
||||
{
|
||||
@@ -2616,12 +2633,12 @@ HDCP_GetKSVList(BYTE *pKSVList,BYTE cDownStream)
|
||||
{
|
||||
BYTE TimeOut = 100 ;
|
||||
BYTE ucdata ;
|
||||
|
||||
|
||||
if(cDownStream == 0 || pKSVList == NULL)
|
||||
{
|
||||
return ER_FAIL ;
|
||||
}
|
||||
|
||||
|
||||
HDMITX_WriteI2C_Byte(REG_TX_DDC_MASTER_CTRL,B_MASTERHOST) ;
|
||||
HDMITX_WriteI2C_Byte(REG_TX_DDC_HEADER,0x74) ;
|
||||
HDMITX_WriteI2C_Byte(REG_TX_DDC_REQOFF,0x43) ;
|
||||
@@ -2667,13 +2684,13 @@ HDCP_GetVr(BYTE *pVr)
|
||||
{
|
||||
BYTE TimeOut ;
|
||||
BYTE ucdata ;
|
||||
|
||||
|
||||
if(pVr == NULL)
|
||||
{
|
||||
// richard return NULL ;
|
||||
return ER_FAIL;
|
||||
}
|
||||
|
||||
|
||||
HDMITX_WriteI2C_Byte(REG_TX_DDC_MASTER_CTRL,B_MASTERHOST) ;
|
||||
HDMITX_WriteI2C_Byte(REG_TX_DDC_HEADER,0x74) ;
|
||||
HDMITX_WriteI2C_Byte(REG_TX_DDC_REQOFF,0x20) ;
|
||||
@@ -2713,9 +2730,9 @@ HDCP_GetVr(BYTE *pVr)
|
||||
pVr[TimeOut*4+2] = (ULONG)HDMITX_ReadI2C_Byte(REG_TX_SHA_RD_BYTE2) ;
|
||||
pVr[TimeOut*4+1] = (ULONG)HDMITX_ReadI2C_Byte(REG_TX_SHA_RD_BYTE3) ;
|
||||
pVr[TimeOut*4] = (ULONG)HDMITX_ReadI2C_Byte(REG_TX_SHA_RD_BYTE4) ;
|
||||
ErrorF("V' = %02X %02X %02X %02X\n",pVr[TimeOut*4],pVr[TimeOut*4+1],pVr[TimeOut*4+2],pVr[TimeOut*4+3]) ;
|
||||
ErrorF("V' = %02X %02X %02X %02X\n",pVr[TimeOut*4],pVr[TimeOut*4+1],pVr[TimeOut*4+2],pVr[TimeOut*4+3]) ;
|
||||
}
|
||||
|
||||
|
||||
return ER_SUCCESS ;
|
||||
}
|
||||
|
||||
@@ -2728,7 +2745,7 @@ HDCP_GetM0(BYTE *pM0)
|
||||
{
|
||||
return ER_FAIL ;
|
||||
}
|
||||
|
||||
|
||||
HDMITX_WriteI2C_Byte(REG_TX_SHA_SEL,5) ; // read m0[31:0] from reg51~reg54
|
||||
pM0[0] = HDMITX_ReadI2C_Byte(REG_TX_SHA_RD_BYTE1) ;
|
||||
pM0[1] = HDMITX_ReadI2C_Byte(REG_TX_SHA_RD_BYTE2) ;
|
||||
@@ -2764,7 +2781,7 @@ void SHATransform(ULONG * h)
|
||||
{
|
||||
LONG t;
|
||||
|
||||
|
||||
|
||||
for (t = 16; t < 80; t++) {
|
||||
ULONG tmp = w[t - 3] ^ w[t - 8] ^ w[t - 14] ^ w[t - 16];
|
||||
w[t] = rol(tmp,1);
|
||||
@@ -2787,7 +2804,7 @@ void SHATransform(ULONG * h)
|
||||
h[2] = rol(h[1],30);
|
||||
h[1] = h[0];
|
||||
h[0] = tmp;
|
||||
|
||||
|
||||
}
|
||||
for (t = 20; t < 40; t++) {
|
||||
ULONG tmp = rol(h[0],5) + (h[1] ^ h[2] ^ h[3]) + h[4] + w[t] + 0x6ed9eba1;
|
||||
@@ -2841,8 +2858,8 @@ void SHA_Simple(void *p,LONG len,BYTE *output)
|
||||
int i, t ;
|
||||
ULONG c ;
|
||||
char *pBuff = p ;
|
||||
|
||||
|
||||
|
||||
|
||||
for( i = 0 ; i < len ; i++ )
|
||||
{
|
||||
t = i/4 ;
|
||||
@@ -2867,14 +2884,14 @@ void SHA_Simple(void *p,LONG len,BYTE *output)
|
||||
w[t] = 0 ;
|
||||
}
|
||||
w[15] = len*8 ;
|
||||
|
||||
|
||||
for( t = 0 ; t< 16 ; t++ )
|
||||
{
|
||||
printf("w[%2d] = %08lX\n",t,w[t]) ;
|
||||
}
|
||||
|
||||
SHATransform(sha) ;
|
||||
|
||||
|
||||
for( i = 0 ; i < 5 ; i++ )
|
||||
{
|
||||
output[i*4] = (BYTE)((sha[i]>>24)&0xFF) ;
|
||||
@@ -2888,7 +2905,7 @@ static SYS_STATUS
|
||||
HDCP_CheckSHA(BYTE pM0[],USHORT BStatus,BYTE pKSVList[],int cDownStream,BYTE Vr[])
|
||||
{
|
||||
int i,n ;
|
||||
|
||||
|
||||
for(i = 0 ; i < cDownStream*5 ; i++)
|
||||
{
|
||||
SHABuff[i] = pKSVList[i] ;
|
||||
@@ -2926,7 +2943,7 @@ HDCP_CheckSHA(BYTE pM0[],USHORT BStatus,BYTE pKSVList[],int cDownStream,BYTE Vr[
|
||||
{
|
||||
printf(" %02X",Vr[i]) ;
|
||||
}
|
||||
|
||||
|
||||
for(i = 0 ; i < 20 ; i++)
|
||||
{
|
||||
if(V[i] != Vr[i])
|
||||
@@ -2941,7 +2958,7 @@ static SYS_STATUS
|
||||
HDCP_Authenticate_Repeater()
|
||||
{
|
||||
BYTE uc ;
|
||||
#ifdef SUPPORT_DSSSHA
|
||||
#ifdef SUPPORT_DSSSHA
|
||||
BYTE revoked ;
|
||||
int i ;
|
||||
#else
|
||||
@@ -2978,7 +2995,7 @@ HDCP_Authenticate_Repeater()
|
||||
//////////////////////////////////////
|
||||
// Authenticate Fired
|
||||
//////////////////////////////////////
|
||||
|
||||
|
||||
HDCP_GetBCaps(&BCaps,&BStatus) ;
|
||||
DelayMS(2);
|
||||
HDCP_Auth_Fire();
|
||||
@@ -3038,7 +3055,7 @@ HDCP_Authenticate_Repeater()
|
||||
{
|
||||
ErrorF("Wait KSV FIFO Ready %d\n",TimeOut) ;
|
||||
}
|
||||
|
||||
|
||||
if(HDCP_GetBCaps(&BCaps,&BStatus) == ER_FAIL)
|
||||
{
|
||||
ErrorF("Get BCaps fail\n") ;
|
||||
@@ -3061,17 +3078,17 @@ HDCP_Authenticate_Repeater()
|
||||
}
|
||||
|
||||
ErrorF("Wait timeout = %d\n",TimeOut) ;
|
||||
|
||||
|
||||
ClearDDCFIFO() ;
|
||||
GenerateDDCSCLK() ;
|
||||
cDownStream = (BStatus & M_DOWNSTREAM_COUNT) ;
|
||||
|
||||
|
||||
if(cDownStream == 0 || cDownStream > 6 || BStatus & (B_MAX_CASCADE_EXCEEDED|B_DOWNSTREAM_OVER))
|
||||
{
|
||||
ErrorF("Invalid Down stream count,fail\n") ;
|
||||
goto HDCP_Repeater_Fail ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(HDCP_GetKSVList(KSVList,cDownStream) == ER_FAIL)
|
||||
{
|
||||
@@ -3087,38 +3104,38 @@ HDCP_Authenticate_Repeater()
|
||||
uc += countbit(KSVList[i*5+TimeOut]) ;
|
||||
}
|
||||
if( uc != 20 ) revoked = TRUE ;
|
||||
#ifdef SUPPORT_REVOKE_KSV
|
||||
#ifdef SUPPORT_REVOKE_KSV
|
||||
HDCP_VerifyRevocationList(SRM1,&KSVList[i*5],&revoked) ;
|
||||
#endif
|
||||
if(revoked)
|
||||
{
|
||||
ErrorF("KSVFIFO[%d] = %02X %02X %02X %02X %02X is revoked\n",i,KSVList[i*5],KSVList[i*5+1],KSVList[i*5+2],KSVList[i*5+3],KSVList[i*5+4]) ;
|
||||
ErrorF("KSVFIFO[%d] = %02X %02X %02X %02X %02X is revoked\n",i,KSVList[i*5],KSVList[i*5+1],KSVList[i*5+2],KSVList[i*5+3],KSVList[i*5+4]) ;
|
||||
goto HDCP_Repeater_Fail ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(HDCP_GetVr(Vr) == ER_FAIL)
|
||||
{
|
||||
goto HDCP_Repeater_Fail ;
|
||||
goto HDCP_Repeater_Fail ;
|
||||
}
|
||||
|
||||
if(HDCP_GetM0(M0) == ER_FAIL)
|
||||
{
|
||||
goto HDCP_Repeater_Fail ;
|
||||
}
|
||||
|
||||
|
||||
// do check SHA
|
||||
if(HDCP_CheckSHA(M0,BStatus,KSVList,cDownStream,Vr) == ER_FAIL)
|
||||
{
|
||||
goto HDCP_Repeater_Fail ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
HDCP_ResumeRepeaterAuthenticate() ;
|
||||
Instance[0].bAuthenticated = TRUE ;
|
||||
return ER_SUCCESS ;
|
||||
|
||||
|
||||
HDCP_Repeater_Fail:
|
||||
HDCP_CancelRepeaterAuthenticate() ;
|
||||
return ER_FAIL ;
|
||||
@@ -3307,21 +3324,9 @@ SetAVIInfoFrame(AVI_InfoFrame *pAVIInfoFrame)
|
||||
}
|
||||
|
||||
Switch_HDMITX_Bank(1) ;
|
||||
HDMITX_WriteI2C_Byte(REG_TX_AVIINFO_DB1,pAVIInfoFrame->pktbyte.AVI_DB[0]);
|
||||
HDMITX_WriteI2C_Byte(REG_TX_AVIINFO_DB2,pAVIInfoFrame->pktbyte.AVI_DB[1]);
|
||||
HDMITX_WriteI2C_Byte(REG_TX_AVIINFO_DB3,pAVIInfoFrame->pktbyte.AVI_DB[2]);
|
||||
HDMITX_WriteI2C_Byte(REG_TX_AVIINFO_DB4,pAVIInfoFrame->pktbyte.AVI_DB[3]);
|
||||
HDMITX_WriteI2C_Byte(REG_TX_AVIINFO_DB5,pAVIInfoFrame->pktbyte.AVI_DB[4]);
|
||||
HDMITX_WriteI2C_Byte(REG_TX_AVIINFO_DB6,pAVIInfoFrame->pktbyte.AVI_DB[5]);
|
||||
HDMITX_WriteI2C_Byte(REG_TX_AVIINFO_DB7,pAVIInfoFrame->pktbyte.AVI_DB[6]);
|
||||
HDMITX_WriteI2C_Byte(REG_TX_AVIINFO_DB8,pAVIInfoFrame->pktbyte.AVI_DB[7]);
|
||||
HDMITX_WriteI2C_Byte(REG_TX_AVIINFO_DB9,pAVIInfoFrame->pktbyte.AVI_DB[8]);
|
||||
HDMITX_WriteI2C_Byte(REG_TX_AVIINFO_DB10,pAVIInfoFrame->pktbyte.AVI_DB[9]);
|
||||
HDMITX_WriteI2C_Byte(REG_TX_AVIINFO_DB11,pAVIInfoFrame->pktbyte.AVI_DB[10]);
|
||||
HDMITX_WriteI2C_Byte(REG_TX_AVIINFO_DB12,pAVIInfoFrame->pktbyte.AVI_DB[11]);
|
||||
HDMITX_WriteI2C_Byte(REG_TX_AVIINFO_DB13,pAVIInfoFrame->pktbyte.AVI_DB[12]);
|
||||
for(i = 0,ucData = 0; i < 13 ; i++)
|
||||
for(i = 0,ucData = 0; i < AVI_INFOFRAME_LEN ; i++)
|
||||
{
|
||||
HDMITX_WriteI2C_Byte(REG_TX_AVIINFO_DB1+i+(i>=5),pAVIInfoFrame->pktbyte.AVI_DB[i]);
|
||||
ucData -= pAVIInfoFrame->pktbyte.AVI_DB[i] ;
|
||||
}
|
||||
ErrorF("SetAVIInfo(): ") ;
|
||||
@@ -3369,13 +3374,9 @@ SetAudioInfoFrame(Audio_InfoFrame *pAudioInfoFrame)
|
||||
}
|
||||
|
||||
Switch_HDMITX_Bank(1) ;
|
||||
HDMITX_WriteI2C_Byte(REG_TX_PKT_AUDINFO_CC,pAudioInfoFrame->pktbyte.AUD_DB[0]);
|
||||
HDMITX_WriteI2C_Byte(REG_TX_PKT_AUDINFO_SF,pAudioInfoFrame->pktbyte.AUD_DB[1]);
|
||||
HDMITX_WriteI2C_Byte(REG_TX_PKT_AUDINFO_CA,pAudioInfoFrame->pktbyte.AUD_DB[3]);
|
||||
HDMITX_WriteI2C_Byte(REG_TX_PKT_AUDINFO_DM_LSV,pAudioInfoFrame->pktbyte.AUD_DB[4]) ;
|
||||
|
||||
for(i = 0,ucData = 0 ; i< 5 ; i++)
|
||||
{
|
||||
HDMITX_WriteI2C_Byte(REG_TX_PKT_AUDINFO_CC+i,pAudioInfoFrame->pktbyte.AUD_DB[i]);
|
||||
ucData -= pAudioInfoFrame->pktbyte.AUD_DB[i] ;
|
||||
}
|
||||
ucData -= 0x80+AUDIO_INFOFRAME_VER+AUDIO_INFOFRAME_TYPE+AUDIO_INFOFRAME_LEN ;
|
||||
@@ -3388,6 +3389,39 @@ SetAudioInfoFrame(Audio_InfoFrame *pAudioInfoFrame)
|
||||
return ER_SUCCESS ;
|
||||
}
|
||||
|
||||
static SYS_STATUS
|
||||
SetGPInfoFrame(BYTE *pInfoFrameData)
|
||||
{
|
||||
int i ;
|
||||
BYTE ucData ;
|
||||
HDR_InfoFrame *pInfoFrame = (HDR_InfoFrame*)pInfoFrameData;
|
||||
|
||||
if(!pInfoFrame)
|
||||
{
|
||||
return ER_FAIL ;
|
||||
}
|
||||
|
||||
DISABLE_NULL_PKT();
|
||||
|
||||
Switch_HDMITX_Bank(1) ;
|
||||
|
||||
HDMITX_WriteI2C_Byte(REG_TX_PKT_HB00, (0x80+pInfoFrame->info.Type));
|
||||
HDMITX_WriteI2C_Byte(REG_TX_PKT_HB01, pInfoFrame->info.Ver);
|
||||
HDMITX_WriteI2C_Byte(REG_TX_PKT_HB02, pInfoFrame->info.Len);
|
||||
|
||||
for(i = 0,ucData = 0 ; i< pInfoFrame->info.Len ; i++)
|
||||
{
|
||||
HDMITX_WriteI2C_Byte(REG_TX_PKT_PB01+i, pInfoFrame->pktbyte.HDR_DB[i]);
|
||||
ucData -= pInfoFrame->pktbyte.HDR_DB[i] ;
|
||||
}
|
||||
ucData -= 0x80+pInfoFrame->info.Type+pInfoFrame->info.Ver+pInfoFrame->info.Len ;
|
||||
HDMITX_WriteI2C_Byte(REG_TX_PKT_PB00, ucData);
|
||||
|
||||
Switch_HDMITX_Bank(0) ;
|
||||
ENABLE_NULL_PKT();
|
||||
return ER_SUCCESS ;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Function: SetSPDInfoFrame()
|
||||
// Parameter: pSPDInfoFrame - the pointer to HDMI SPD Infoframe ucData
|
||||
@@ -3409,7 +3443,7 @@ SetSPDInfoFrame(SPD_InfoFrame *pSPDInfoFrame)
|
||||
}
|
||||
|
||||
Switch_HDMITX_Bank(1) ;
|
||||
for(i = 0,ucData = 0 ; i < 25 ; i++)
|
||||
for(i = 0,ucData = 0 ; i < SPD_INFOFRAME_LEN ; i++)
|
||||
{
|
||||
ucData -= pSPDInfoFrame->pktbyte.SPD_DB[i] ;
|
||||
HDMITX_WriteI2C_Byte(REG_TX_PKT_SPDINFO_PB1+i,pSPDInfoFrame->pktbyte.SPD_DB[i]) ;
|
||||
+14
-13
@@ -277,7 +277,7 @@
|
||||
#define B_AFE_DRV_PDRXDET (1<<2)
|
||||
#define B_AFE_DRV_TERMON (1<<1)
|
||||
#define B_AFE_DRV_ENCAL (1<<0)
|
||||
|
||||
|
||||
#define REG_TX_AFE_XP_CTRL 0x62
|
||||
#define B_AFE_XP_GAINBIT (1<<7)
|
||||
#define B_AFE_XP_PWDPLL (1<<6)
|
||||
@@ -287,7 +287,7 @@
|
||||
#define B_AFE_XP_PWDI (1<<2)
|
||||
#define B_AFE_XP_DEI (1<<1)
|
||||
#define B_AFE_XP_DER (1<<0)
|
||||
|
||||
|
||||
#define REG_TX_AFE_ISW_CTRL 0x63
|
||||
#define B_AFE_RTERM_SEL (1<<7)
|
||||
#define B_AFE_IP_BYPASS (1<<6)
|
||||
@@ -296,7 +296,7 @@
|
||||
#define B_AFE_DRV_ISWK 7
|
||||
|
||||
#define REG_TX_AFE_IP_CTRL 0x64
|
||||
|
||||
|
||||
#define B_AFE_IP_GAINBIT (1<<7)
|
||||
#define B_AFE_IP_PWDPLL (1<<6)
|
||||
#define M_AFE_IP_CKSEL (3<<4)
|
||||
@@ -315,15 +315,15 @@
|
||||
#define M_AFE_DRV_VSW (3<<2)
|
||||
#define B_AFE_RING_SLOW (1<<1)
|
||||
#define B_AFE_RING_FAST (1<<0)
|
||||
#define REG_TX_AFE_TEST 0x66
|
||||
#define REG_TX_AFE_TEST 0x66
|
||||
#define B_AFE_AFE_ENTEST (1<<6)
|
||||
#define B_AFE_AFE_ENBIST (1<<5)
|
||||
#define M_AFE_CAL_RTERM_MANUAL 0x1F
|
||||
#define REG_TX_AFE_LFSR 0x67
|
||||
#define REG_TX_AFE_LFSR 0x67
|
||||
#define B_AFE_AFELFSR_VAL (1<<7)
|
||||
#define B_AFE_DIS_AFELFSR (1<<6)
|
||||
#define M_AFE_RTERM_VAOUE 0xF
|
||||
|
||||
|
||||
//
|
||||
//#define REG_TX_AFE_DRV_CTRL 0x61
|
||||
// #define M_AFE_DRV_SR (3<<2)
|
||||
@@ -448,7 +448,7 @@
|
||||
#define B_BLUE_SCR_MUTE (1<<1)
|
||||
#define B_NODEF_PHASE (1<<2)
|
||||
#define B_PHASE_RESYNC (1<<3)
|
||||
|
||||
|
||||
#define O_COLOR_DEPTH 4
|
||||
#define M_COLOR_DEPTH 7
|
||||
#define B_COLOR_DEPTH_MASK (M_COLOR_DEPTH<<O_COLOR_DEPTH)
|
||||
@@ -688,12 +688,12 @@
|
||||
// data structure
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
typedef struct _INSTANCE_STRUCT {
|
||||
|
||||
|
||||
BYTE I2C_DEV ;
|
||||
BYTE I2C_ADDR ;
|
||||
|
||||
|
||||
/////////////////////////////////////////////////
|
||||
// Interrupt Type
|
||||
// Interrupt Type
|
||||
/////////////////////////////////////////////////
|
||||
BYTE bIntType ; // = 0 ;
|
||||
/////////////////////////////////////////////////
|
||||
@@ -707,12 +707,12 @@ typedef struct _INSTANCE_STRUCT {
|
||||
BYTE bAudioChannelSwap ; // = 0 ;
|
||||
BYTE bAudioChannelEnable ;
|
||||
BYTE bAudFs ;
|
||||
unsigned long TMDSClock ;
|
||||
unsigned long TMDSClock ;
|
||||
BYTE bAuthenticated:1 ;
|
||||
BYTE bHDMIMode: 1;
|
||||
BYTE bIntPOL:1 ; // 0 = Low Active
|
||||
BYTE bIntPOL:1 ; // 0 = Low Active
|
||||
BYTE bHPD:1 ;
|
||||
|
||||
|
||||
} INSTANCE ;
|
||||
|
||||
|
||||
@@ -828,6 +828,7 @@ BOOL CheckHDMITX(BYTE *pHPD,BYTE *pHPDChange) ;
|
||||
BOOL EnableHDCP(BYTE bEnable) ;
|
||||
BOOL EnableAVIInfoFrame(BYTE bEnable,BYTE *pAVIInfoFrame);
|
||||
BOOL EnableAudioInfoFrame(BYTE bEnable,BYTE *pAudioInfoFrame);
|
||||
BOOL EnableGPInfoFrame(BYTE bEnable, BYTE *pInfoFrame);
|
||||
// BOOL EnableVideoOutputIndirect(BYTE xCnt,BYTE inputColorMode,BYTE outputColorMode,BYTE bHDMI) ;
|
||||
void SetAVMute(BYTE bEnable) ;
|
||||
void SetOutputColorDepthPhase(BYTE ColorDepth,BYTE bPhase) ;
|
||||
File renamed without changes.
File renamed without changes.
+48
-1
@@ -130,7 +130,7 @@ typedef enum {
|
||||
#define F_VIDMODE_16_235 F_MODE_16_235 // richard add
|
||||
|
||||
|
||||
typedef union _VideoFormatCode
|
||||
typedef union _VideoFormatCode
|
||||
{
|
||||
struct _VFC
|
||||
{
|
||||
@@ -195,18 +195,21 @@ typedef union _VideoFormatCode
|
||||
#define SPD_INFOFRAME_TYPE 0x03
|
||||
#define AUDIO_INFOFRAME_TYPE 0x04
|
||||
#define MPEG_INFOFRAME_TYPE 0x05
|
||||
#define HDR_INFOFRAME_TYPE 0x07
|
||||
|
||||
#define VENDORSPEC_INFOFRAME_VER 0x01
|
||||
#define AVI_INFOFRAME_VER 0x02
|
||||
#define SPD_INFOFRAME_VER 0x01
|
||||
#define AUDIO_INFOFRAME_VER 0x01
|
||||
#define MPEG_INFOFRAME_VER 0x01
|
||||
#define HDR_INFOFRAME_VER 0x01
|
||||
|
||||
#define VENDORSPEC_INFOFRAME_LEN 8
|
||||
#define AVI_INFOFRAME_LEN 13
|
||||
#define SPD_INFOFRAME_LEN 25
|
||||
#define AUDIO_INFOFRAME_LEN 10
|
||||
#define MPEG_INFOFRAME_LEN 10
|
||||
#define HDR_INFOFRAME_LEN 26
|
||||
|
||||
#define ACP_PKT_LEN 9
|
||||
#define ISRC1_PKT_LEN 16
|
||||
@@ -249,6 +252,33 @@ typedef union _AVI_InfoFrame
|
||||
} pktbyte ;
|
||||
} AVI_InfoFrame ;
|
||||
|
||||
typedef union _Freesync_InfoFrame {
|
||||
|
||||
struct {
|
||||
BYTE Type ;
|
||||
BYTE Ver ;
|
||||
BYTE Len ;
|
||||
|
||||
BYTE Enable ;
|
||||
|
||||
BYTE Rsvd1 ;
|
||||
BYTE Rsvd2 ;
|
||||
BYTE Rsvd3 ;
|
||||
BYTE Rsvd4 ;
|
||||
|
||||
BYTE Mode2 ;
|
||||
|
||||
BYTE min_rate ;
|
||||
BYTE max_rate ;
|
||||
} info ;
|
||||
|
||||
struct {
|
||||
BYTE FS_HB[3] ;
|
||||
BYTE FS_DB[VENDORSPEC_INFOFRAME_LEN] ;
|
||||
} pktbyte ;
|
||||
|
||||
} Freesync_InfoFrame ;
|
||||
|
||||
typedef union _Audio_InfoFrame {
|
||||
|
||||
struct {
|
||||
@@ -316,6 +346,23 @@ typedef union _SPD_InfoFrame {
|
||||
} pktbyte ;
|
||||
} SPD_InfoFrame ;
|
||||
|
||||
// HDR
|
||||
typedef union _HDR_InfoFrame {
|
||||
struct {
|
||||
BYTE Type ;
|
||||
BYTE Ver ;
|
||||
BYTE Len ;
|
||||
|
||||
BYTE TF ;
|
||||
BYTE DESC_ID ;
|
||||
BYTE DESC[24] ;
|
||||
} info ;
|
||||
struct {
|
||||
BYTE HDR_HB[3] ;
|
||||
BYTE HDR_DB[HDR_INFOFRAME_LEN] ;
|
||||
} pktbyte ;
|
||||
} HDR_InfoFrame ;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Using for interface.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
+36
@@ -18,6 +18,7 @@
|
||||
//
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include "system.h"
|
||||
#include "i2c_opencores.h"
|
||||
@@ -48,6 +49,41 @@ void pcm_source_sel(pcm_input_t input) {
|
||||
pcm1862_writereg(PCM1862_ADC1R, (1<<6)|adc_ch);
|
||||
}
|
||||
|
||||
void pcm_set_stereo_mode(int mono_enable) {
|
||||
uint32_t gain;
|
||||
int i;
|
||||
const uint8_t chregs[] = {0, 1, 6, 7};
|
||||
uint32_t stereo_cfg[] = {0x100000, 0x0, 0x0, 0x100000};
|
||||
uint32_t mono_cfg[] = {0x0804DC, 0x0804DC, 0x0804DC, 0x0804DC};
|
||||
uint32_t *ch_cfg = mono_enable ? mono_cfg : stereo_cfg;
|
||||
|
||||
pcm1862_writereg(PCM1862_PAGESEL, 1);
|
||||
|
||||
for (i=0; i<sizeof(chregs); i++) {
|
||||
pcm1862_writereg(PCM1862_DSP2_ADDR, chregs[i]);
|
||||
pcm1862_writereg(PCM1862_DSP2_WDATA0, (ch_cfg[i] >> 16) & 0xff);
|
||||
pcm1862_writereg(PCM1862_DSP2_WDATA1, (ch_cfg[i] >> 8) & 0xff);
|
||||
pcm1862_writereg(PCM1862_DSP2_WDATA2, ch_cfg[i] & 0xff);
|
||||
pcm1862_writereg(PCM1862_DSP2_CFG, (1<<0));
|
||||
while ((pcm1862_readreg(PCM1862_DSP2_CFG) & ((1<<0)|(1<<2))) != 0) {}
|
||||
}
|
||||
|
||||
/*for (i=0; i<12; i++) {
|
||||
pcm1862_writereg(0x02, i);
|
||||
pcm1862_writereg(0x01, (1<<1));
|
||||
|
||||
while ((pcm1862_readreg(0x01) & (1<<1)) != 0) {}
|
||||
|
||||
gain = pcm1862_readreg(0x08) << 16;
|
||||
gain |= pcm1862_readreg(0x09) << 8;
|
||||
gain |= pcm1862_readreg(0x0A);
|
||||
|
||||
printf("ch%u gain: 0x%x\n", i, gain);
|
||||
}*/
|
||||
|
||||
pcm1862_writereg(PCM1862_PAGESEL, 0);
|
||||
}
|
||||
|
||||
void pcm_set_gain(alt_8 db_gain) {
|
||||
alt_8 gain_val = 2*db_gain;
|
||||
|
||||
+2
@@ -32,6 +32,8 @@ typedef enum {
|
||||
|
||||
void pcm_source_sel(pcm_input_t input);
|
||||
|
||||
void pcm_set_stereo_mode(int mono_enable);
|
||||
|
||||
void pcm_set_gain(alt_8 db_gain);
|
||||
|
||||
int pcm1862_init();
|
||||
+16
@@ -23,6 +23,9 @@
|
||||
#define PCM1862_BASE (0x94>>1)
|
||||
|
||||
#define PCM1862_PAGESEL 0x00
|
||||
|
||||
/* Page 0 registers */
|
||||
|
||||
#define PCM1862_PGA1L 0x01
|
||||
#define PCM1862_PGA1R 0x02
|
||||
#define PCM1862_PGA2L 0x03
|
||||
@@ -56,4 +59,17 @@
|
||||
#define PCM1862_PWR_CTRL 0x70
|
||||
#define PCM1862_DSP_CTRL 0x71
|
||||
|
||||
|
||||
/* Page 1 registers */
|
||||
|
||||
#define PCM1862_DSP2_CFG 0x01
|
||||
#define PCM1862_DSP2_ADDR 0x02
|
||||
#define PCM1862_DSP2_WDATA0 0x04
|
||||
#define PCM1862_DSP2_WDATA1 0x05
|
||||
#define PCM1862_DSP2_WDATA2 0x06
|
||||
#define PCM1862_DSP2_RDATA0 0x08
|
||||
#define PCM1862_DSP2_RDATA1 0x09
|
||||
#define PCM1862_DSP2_RDATA2 0x0A
|
||||
|
||||
|
||||
#endif /* PCM1862_REGS_H_ */
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,139 @@
|
||||
//
|
||||
// Copyright (C) 2025 Balázs Triszka <info@balika011.hu>
|
||||
//
|
||||
// This file is part of Open Source Scan Converter project.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include "lcd.h"
|
||||
#include "sh1107.h"
|
||||
#include "alt_types.h"
|
||||
#include "altera_avalon_pio_regs.h"
|
||||
#include "i2c_opencores.h"
|
||||
#include "av_controller.h"
|
||||
#include "font12.h"
|
||||
|
||||
#define OLED_WIDTH 128
|
||||
#define OLED_HEIGHT 64
|
||||
|
||||
extern alt_u32 sys_ctrl;
|
||||
|
||||
static void OLED_Write(uint8_t value)
|
||||
{
|
||||
SPI_write(I2CA_BASE, &value, 1);
|
||||
}
|
||||
|
||||
void sh1107_init()
|
||||
{
|
||||
sys_ctrl &= ~(LCD_CS_N | LCD_RS);
|
||||
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl);
|
||||
|
||||
alt_u8 init[] = {
|
||||
0xae, /*turn off OLED display*/
|
||||
0x00, /*set lower column address*/
|
||||
0x10, /*set higher column address*/
|
||||
0xb0, /*set page address*/
|
||||
0xdc, 0x00, /*set display start line*/
|
||||
0x81, /*contract control*/
|
||||
0x6f, /*128*/
|
||||
0x21, /* Set Memory addressing mode (0x20/0x21) */
|
||||
0xa1, /*set segment remap*/
|
||||
0xc0, /*Com scan direction*/
|
||||
0xa4, /*Disable Entire Display On (0xA4/0xA5)*/
|
||||
0xa6, /*normal / reverse*/
|
||||
0xa8, /*multiplex ratio*/
|
||||
0x3f, /*duty = 1/64*/
|
||||
0xd3, 0x60, /*set display offset*/
|
||||
0xd5, 0x41, /*set osc division*/
|
||||
0xd9, 0x22, /*set pre-charge period*/
|
||||
0xdb, 0x35, /*set vcomh*/
|
||||
0xad, /*set charge pump enable*/
|
||||
0x8a /*Set DC-DC enable (a=0:disable; a=1:enable) */
|
||||
};
|
||||
SPI_write(I2CA_BASE, init, sizeof(init));
|
||||
|
||||
// Clear the screen
|
||||
OLED_Write(0xb0);
|
||||
for (alt_u8 i = 0; i < OLED_HEIGHT; i++)
|
||||
{
|
||||
sys_ctrl &= ~LCD_RS;
|
||||
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl);
|
||||
OLED_Write(0x00 + (i & 0x0f));
|
||||
OLED_Write(0x10 + (i >> 4));
|
||||
|
||||
sys_ctrl |= LCD_RS;
|
||||
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl);
|
||||
for (alt_u8 i = 0; i < OLED_WIDTH / 8; i++)
|
||||
OLED_Write(0);
|
||||
}
|
||||
|
||||
sys_ctrl &= ~LCD_RS;
|
||||
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl);
|
||||
|
||||
// Turn on
|
||||
OLED_Write(0xaf);
|
||||
|
||||
sys_ctrl |= LCD_CS_N;
|
||||
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl);
|
||||
}
|
||||
|
||||
void sh1107_write(char *row1, char *row2)
|
||||
{
|
||||
sys_ctrl &= ~(LCD_CS_N | LCD_RS);
|
||||
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl);
|
||||
|
||||
alt_u8 row1len = strnlen(row1, LCD_ROW_LEN);
|
||||
|
||||
for (alt_u8 i = 0; i < 12; i++)
|
||||
{
|
||||
sys_ctrl &= ~LCD_RS;
|
||||
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl);
|
||||
OLED_Write(0xb0);
|
||||
OLED_Write(0x00 + ((i + 13) & 0x0f));
|
||||
OLED_Write(0x10 + ((i + 13) >> 4));
|
||||
|
||||
sys_ctrl |= LCD_RS;
|
||||
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl);
|
||||
for (alt_u8 j = 0; j < row1len; j++)
|
||||
OLED_Write(Font12_Table[(row1[j] - 0x20) * 12 + i]);
|
||||
|
||||
for (alt_u8 j = row1len; j < LCD_ROW_LEN; j++)
|
||||
OLED_Write(Font12_Table[i]);
|
||||
}
|
||||
|
||||
alt_u8 row2len = strnlen(row2, LCD_ROW_LEN);
|
||||
|
||||
for (alt_u8 i = 0; i < 12; i++)
|
||||
{
|
||||
sys_ctrl &= ~LCD_RS;
|
||||
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl);
|
||||
OLED_Write(0xb0);
|
||||
OLED_Write(0x00 + ((i + 39) & 0x0f));
|
||||
OLED_Write(0x10 + ((i + 39) >> 4));
|
||||
|
||||
sys_ctrl |= LCD_RS;
|
||||
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl);
|
||||
for (alt_u8 j = 0; j < row2len; j++)
|
||||
OLED_Write(Font12_Table[(row2[j] - 0x20) * 12 + i]);
|
||||
|
||||
for (alt_u8 j = row2len; j < LCD_ROW_LEN; j++)
|
||||
OLED_Write(Font12_Table[i]);
|
||||
}
|
||||
|
||||
sys_ctrl |= LCD_CS_N;
|
||||
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// Copyright (C) 2025 Balázs Triszka <info@balika011.hu>
|
||||
//
|
||||
// This file is part of Open Source Scan Converter project.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef SH1107_H_
|
||||
#define SH1107_H_
|
||||
|
||||
#include "system.h"
|
||||
#include <stdio.h>
|
||||
#include "sysconfig.h"
|
||||
|
||||
void sh1107_init();
|
||||
|
||||
void sh1107_write(char *row1, char *row2);
|
||||
|
||||
#endif /* sh1107_H_ */
|
||||
+5
-6
@@ -1,5 +1,6 @@
|
||||
//
|
||||
// Copyright (C) 2015-2016 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
// Copyright (C) 2025 Balázs Triszka <info@balika011.hu>
|
||||
//
|
||||
// This file is part of Open Source Scan Converter project.
|
||||
//
|
||||
@@ -20,25 +21,23 @@
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include "lcd.h"
|
||||
#include "st7032.h"
|
||||
#include "alt_types.h"
|
||||
#include "altera_avalon_pio_regs.h"
|
||||
#include "i2c_opencores.h"
|
||||
#include "av_controller.h"
|
||||
|
||||
#define LCD_CMD 0x00
|
||||
#define LCD_DATA 0x40
|
||||
|
||||
#define WRDELAY 20
|
||||
#define CLEARDELAY 800
|
||||
|
||||
extern alt_u16 sys_ctrl;
|
||||
extern alt_u32 sys_ctrl;
|
||||
|
||||
static void lcd_cmd(alt_u8 cmd, alt_u16 postdelay) {
|
||||
SPI_write(I2CA_BASE, &cmd, 1);
|
||||
usleep(postdelay);
|
||||
}
|
||||
|
||||
void lcd_init()
|
||||
void st7032_init()
|
||||
{
|
||||
sys_ctrl &= ~(LCD_CS_N|LCD_RS);
|
||||
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl);
|
||||
@@ -59,7 +58,7 @@ void lcd_init()
|
||||
IOWR_ALTERA_AVALON_PIO_DATA(PIO_0_BASE, sys_ctrl);
|
||||
}
|
||||
|
||||
void lcd_write(char *row1, char *row2)
|
||||
void st7032_write(char *row1, char *row2)
|
||||
{
|
||||
alt_u8 i, rowlen;
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// Copyright (C) 2015-2016 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
// Copyright (C) 2025 Balázs Triszka <info@balika011.hu>
|
||||
//
|
||||
// This file is part of Open Source Scan Converter project.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef ST7032_H_
|
||||
#define ST7032_H_
|
||||
|
||||
#include "system.h"
|
||||
#include <stdio.h>
|
||||
#include "sysconfig.h"
|
||||
|
||||
void st7032_init();
|
||||
|
||||
void st7032_write(char *row1, char *row2);
|
||||
|
||||
#endif /* st7032_H_ */
|
||||
File renamed without changes.
File renamed without changes.
+59
-41
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (C) 2015-2018 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
// Copyright (C) 2015-2023 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
//
|
||||
// This file is part of Open Source Scan Converter project.
|
||||
//
|
||||
@@ -38,7 +38,8 @@ const ypbpr_to_rgb_csc_t csc_coeffs[] = {
|
||||
};
|
||||
|
||||
static const alt_u8 Kvco[] = {75, 85, 150, 200};
|
||||
static const char *Kvco_str[] = { "Ultra low", "Low", "Medium", "High" };
|
||||
static const char* const Kvco_str[] = { "Ultra low", "Low", "Medium", "High" };
|
||||
static alt_u8 full_vs_bypass;
|
||||
|
||||
static void tvp_set_clamp_type(video_format fmt)
|
||||
{
|
||||
@@ -65,11 +66,11 @@ static void tvp_set_clamp_alc(video_type type, alt_u8 clamp_ref_offset, alt_8 cl
|
||||
alt_u8 clamp_width, alc_offset;
|
||||
|
||||
switch (type) {
|
||||
case VIDEO_LDTV:
|
||||
/*case VIDEO_LDTV:
|
||||
clamp_pos += 2;
|
||||
clamp_width = 6;
|
||||
alc_offset = 1;
|
||||
break;
|
||||
break;*/
|
||||
case VIDEO_HDTV:
|
||||
clamp_pos += 50;
|
||||
clamp_width = 32;
|
||||
@@ -91,6 +92,8 @@ static void tvp_set_clamp_alc(video_type type, alt_u8 clamp_ref_offset, alt_8 cl
|
||||
else if (clamp_pos + clamp_width + alc_offset > 255)
|
||||
clamp_pos = 255 - alc_offset - clamp_width;
|
||||
|
||||
printf("Clamp pos: %u, width: %u (ref_offset: %u, user_offset %d)\n", clamp_pos, clamp_width, clamp_ref_offset, clamp_user_offset);
|
||||
|
||||
tvp_writereg(TVP_CLAMPSTART, (alt_u8)clamp_pos);
|
||||
tvp_writereg(TVP_CLAMPWIDTH, clamp_width);
|
||||
|
||||
@@ -145,24 +148,30 @@ inline void tvp_reset()
|
||||
|
||||
inline void tvp_disable_output()
|
||||
{
|
||||
alt_u8 syncproc_rst = tvp_readreg(TVP_MISCCTRL4) | (1<<7);
|
||||
|
||||
tvp_writereg(TVP_MISCCTRL1, 0x13);
|
||||
usleep(10000);
|
||||
tvp_writereg(TVP_MISCCTRL2, 0x03);
|
||||
usleep(10000);
|
||||
tvp_writereg(TVP_MISCCTRL4, syncproc_rst);
|
||||
usleep(1000);
|
||||
tvp_writereg(TVP_MISCCTRL4, syncproc_rst & 0x7F);
|
||||
}
|
||||
|
||||
inline void tvp_enable_output()
|
||||
{
|
||||
usleep(10000);
|
||||
tvp_writereg(TVP_MISCCTRL2, 0x00);
|
||||
}
|
||||
|
||||
inline void tvp_powerdown()
|
||||
{
|
||||
alt_u8 syncproc_rst = tvp_readreg(TVP_MISCCTRL4) | (1<<7);
|
||||
|
||||
tvp_writereg(TVP_MISCCTRL4, syncproc_rst);
|
||||
usleep(1000);
|
||||
tvp_writereg(TVP_MISCCTRL4, syncproc_rst & 0x7F);
|
||||
usleep(1000);
|
||||
tvp_writereg(TVP_MISCCTRL1, 0x13);
|
||||
tvp_writereg(TVP_POWERCTRL, 0x07);
|
||||
}
|
||||
|
||||
inline void tvp_powerup()
|
||||
{
|
||||
tvp_writereg(TVP_MISCCTRL1, 0x11);
|
||||
usleep(10000);
|
||||
tvp_writereg(TVP_MISCCTRL2, 0x02);
|
||||
usleep(10000);
|
||||
tvp_writereg(TVP_POWERCTRL, 0x00);
|
||||
}
|
||||
|
||||
inline void tvp_set_hpllcoast(alt_u8 pre, alt_u8 post)
|
||||
@@ -192,10 +201,8 @@ void tvp_init()
|
||||
.c_gain = DEFAULT_COARSE_GAIN,
|
||||
};
|
||||
|
||||
// disable output
|
||||
tvp_disable_output();
|
||||
|
||||
// Set default configuration (skip those which match register reset values)
|
||||
full_vs_bypass = 0;
|
||||
|
||||
// Configure external refclk, HPLL generated pclk
|
||||
tvp_sel_clk(REFCLK_EXT27, 0);
|
||||
@@ -208,6 +215,9 @@ void tvp_init()
|
||||
// NOTE: Value 1 syncs the edges!
|
||||
tvp_writereg(TVP_VSOUTALIGN, 1);
|
||||
|
||||
// Bypass VSYNC processing
|
||||
tvp_writereg(TVP_MISCCTRL4, 0x09);
|
||||
|
||||
// Set default CSC coeffs.
|
||||
tvp_sel_csc(&csc_coeffs[0]);
|
||||
|
||||
@@ -242,6 +252,10 @@ void tvp_init()
|
||||
//set analog (coarse) gain to max recommended value (-> 91% of the ADC range with 0.7Vpp input)
|
||||
//set rest of the gain digitally (fine) to utilize 100% of the range at the output (0.91*(1+(26/256)) = 1)
|
||||
tvp_set_gain_offset(&def_gain_offs);
|
||||
|
||||
// Disable PLL and ADC but enable outputs to enable frontend mode detection
|
||||
tvp_enable_output();
|
||||
tvp_powerdown();
|
||||
}
|
||||
|
||||
void tvp_set_gain_offset(color_setup_t *col) {
|
||||
@@ -255,8 +269,12 @@ void tvp_set_gain_offset(color_setup_t *col) {
|
||||
tvp_writereg(TVP_B_FOFFSET_MSB, col->b_f_off);
|
||||
}
|
||||
|
||||
void tvp_set_full_vs_bypass(alt_u8 enable) {
|
||||
full_vs_bypass = enable;
|
||||
}
|
||||
|
||||
// Configure H-PLL (sampling rate, VCO gain and charge pump current)
|
||||
void tvp_setup_hpll(alt_u16 h_samplerate, alt_u16 refclks_per_line, alt_u8 plldivby2)
|
||||
void tvp_setup_hpll(alt_u16 h_samplerate, alt_u16 pixs_per_line, alt_u16 refclks_per_line, alt_u8 plldivby2)
|
||||
{
|
||||
alt_u32 pclk_est;
|
||||
alt_u8 vco_range;
|
||||
@@ -291,9 +309,11 @@ void tvp_setup_hpll(alt_u16 h_samplerate, alt_u16 refclks_per_line, alt_u8 plldi
|
||||
vco_range = 3;
|
||||
}
|
||||
|
||||
cp_current = (40*Kvco[vco_range]+h_samplerate/2) / h_samplerate; //"+h_samplerate/2" for fast rounding
|
||||
if (cp_current > 7)
|
||||
cp_current = 7;
|
||||
cp_current = (40*Kvco[vco_range]+pixs_per_line/2) / pixs_per_line; //"+pixs_per_line/2" for fast rounding
|
||||
if (cp_current > 6)
|
||||
cp_current = 6;
|
||||
else if (cp_current == 0)
|
||||
cp_current = 1;
|
||||
|
||||
printf("VCO range: %s\nCPC: %u\n", Kvco_str[vco_range], cp_current);
|
||||
tvp_writereg(TVP_HPLLCTRL, ((vco_range << 6) | (cp_current << 3)));
|
||||
@@ -344,17 +364,12 @@ void tvp_set_clp_lpf(alt_u8 val)
|
||||
printf("CLP LPF value set to 0x%x\n", val);
|
||||
}
|
||||
|
||||
alt_u8 tvp_set_hpll_phase(alt_u8 val, alt_u8 sample_mult)
|
||||
void tvp_set_hpll_phase(alt_u8 val)
|
||||
{
|
||||
alt_u8 sample_sel;
|
||||
alt_u8 status = tvp_readreg(TVP_HPLLPHASE) & 0x07;
|
||||
|
||||
sample_sel = (val*sample_mult)/32;
|
||||
val = val*sample_mult % 32;
|
||||
tvp_writereg(TVP_HPLLPHASE, (val<<3)|status);
|
||||
printf("Phase selection: %u/%u (FPGA), %u/32 (TVP)\n", sample_sel+1, sample_mult, val+1);
|
||||
|
||||
return sample_sel;
|
||||
printf("TVP Phase set to %u/32 (%u deg)\n", val, (val*11250)/1000);
|
||||
}
|
||||
|
||||
void tvp_set_sog_thold(alt_u8 val)
|
||||
@@ -368,11 +383,15 @@ void tvp_set_alcfilt(alt_u8 nsv, alt_u8 nsh) {
|
||||
tvp_writereg(TVP_ALCFILT, (nsv<<3)|nsh);
|
||||
}
|
||||
|
||||
void tvp_source_setup(video_type type, alt_u16 h_samplerate, alt_u16 refclks_per_line, alt_u8 plldivby2, alt_u8 h_synclen_px, alt_8 clamp_user_offset)
|
||||
void tvp_source_setup(video_type type, alt_u16 h_samplerate, alt_u16 pixs_per_line, alt_u16 refclks_per_line, alt_u8 plldivby2, alt_u8 h_synclen_px, alt_8 clamp_user_offset, alt_u8 vmode_changed)
|
||||
{
|
||||
// Due to short MVS width, clamp reference starts prematurely (at the end of MVS window). Adjust offset so that reference moves back to hsync trailing edge.
|
||||
alt_u8 clamp_ref_offset = h_synclen_px - (((30*h_samplerate)/refclks_per_line)+5)/10;
|
||||
|
||||
// Reset sync processing if mode changed to avoid occasional wobbling issue
|
||||
if (vmode_changed)
|
||||
tvp_writereg(TVP_MISCCTRL4, tvp_readreg(TVP_MISCCTRL4) | (1<<7));
|
||||
|
||||
// Clamp and ALC
|
||||
tvp_set_clamp_alc(type, clamp_ref_offset, clamp_user_offset, 1);
|
||||
|
||||
@@ -381,18 +400,18 @@ void tvp_source_setup(video_type type, alt_u16 h_samplerate, alt_u16 refclks_per
|
||||
// Macrovision stripper filters out glitches and serration pulses that may occur outside of sync window (HSYNC_lead +- TVP_MVSWIDTH*37ns). Enabled for all inputs.
|
||||
switch (type) {
|
||||
case VIDEO_PC:
|
||||
tvp_writereg(TVP_MISCCTRL4, 0x0C);
|
||||
tvp_writereg(TVP_MISCCTRL4, 0x0D);
|
||||
break;
|
||||
case VIDEO_LDTV:
|
||||
//case VIDEO_LDTV:
|
||||
case VIDEO_SDTV:
|
||||
case VIDEO_EDTV:
|
||||
case VIDEO_HDTV:
|
||||
default:
|
||||
tvp_writereg(TVP_MISCCTRL4, 0x08);
|
||||
tvp_writereg(TVP_MISCCTRL4, 0x09);
|
||||
break;
|
||||
}
|
||||
|
||||
tvp_setup_hpll(h_samplerate, refclks_per_line, plldivby2);
|
||||
tvp_setup_hpll(h_samplerate, pixs_per_line, refclks_per_line, plldivby2);
|
||||
}
|
||||
|
||||
void tvp_source_sel(tvp_input_t input, tvp_sync_input_t syncinput, video_format fmt)
|
||||
@@ -412,7 +431,7 @@ void tvp_source_sel(tvp_input_t input, tvp_sync_input_t syncinput, video_format
|
||||
else // RGBS
|
||||
tvp_writereg(TVP_SYNCCTRL1, 0x53);
|
||||
|
||||
usleep(1000);
|
||||
usleep(100000);
|
||||
sync_status = tvp_readreg(TVP_SYNCSTAT);
|
||||
if (sync_status & (1<<7))
|
||||
printf("%s detected, %s polarity\n", (sync_status & (1<<3)) ? "Csync" : "Hsync", (sync_status & (1<<5)) ? "pos" : "neg");
|
||||
@@ -434,11 +453,10 @@ void tvp_source_sel(tvp_input_t input, tvp_sync_input_t syncinput, video_format
|
||||
else
|
||||
tvp_writereg(TVP_MISCCTRL3, 0x00);
|
||||
|
||||
#ifdef SYNCBYPASS
|
||||
tvp_writereg(TVP_SYNCBYPASS, 0x03);
|
||||
#else
|
||||
tvp_writereg(TVP_SYNCBYPASS, 0x00);
|
||||
#endif
|
||||
if ((syncinput > TVP_SOG3) && (syncinput < TVP_CS_A))
|
||||
tvp_writereg(TVP_SYNCBYPASS, full_vs_bypass ? 0x02 : 0x00);
|
||||
else
|
||||
tvp_writereg(TVP_SYNCBYPASS, 0x00);
|
||||
|
||||
//TODO:
|
||||
//TVP_ADCSETUP
|
||||
+10
-15
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (C) 2015-2018 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
// Copyright (C) 2015-2023 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
//
|
||||
// This file is part of Open Source Scan Converter project.
|
||||
//
|
||||
@@ -26,7 +26,6 @@
|
||||
|
||||
#define DEFAULT_VSYNC_THOLD 0x44
|
||||
#define DEFAULT_LINELEN_TOL 0x06
|
||||
#define DEFAULT_SAMPLER_PHASE 0x10
|
||||
#define DEFAULT_PRE_COAST 1
|
||||
#define DEFAULT_POST_COAST 0
|
||||
#define DEFAULT_SYNC_LPF 0
|
||||
@@ -74,16 +73,6 @@ typedef struct {
|
||||
alt_u16 B_Pr;
|
||||
} ypbpr_to_rgb_csc_t;
|
||||
|
||||
typedef struct {
|
||||
alt_u8 r_f_off;
|
||||
alt_u8 g_f_off;
|
||||
alt_u8 b_f_off;
|
||||
alt_u8 r_f_gain;
|
||||
alt_u8 g_f_gain;
|
||||
alt_u8 b_f_gain;
|
||||
alt_u8 c_gain;
|
||||
} __attribute__((packed)) color_setup_t;
|
||||
|
||||
|
||||
inline alt_u32 tvp_readreg(alt_u32 regaddr);
|
||||
|
||||
@@ -95,6 +84,10 @@ inline void tvp_disable_output();
|
||||
|
||||
inline void tvp_enable_output();
|
||||
|
||||
inline void tvp_powerdown();
|
||||
|
||||
inline void tvp_powerup();
|
||||
|
||||
inline void tvp_set_hpllcoast(alt_u8 pre, alt_u8 post);
|
||||
|
||||
inline void tvp_set_linelen_tol(alt_u8 val);
|
||||
@@ -105,7 +98,9 @@ void tvp_init();
|
||||
|
||||
void tvp_set_gain_offset(color_setup_t *col);
|
||||
|
||||
void tvp_setup_hpll(alt_u16 h_samplerate, alt_u16 refclks_per_line, alt_u8 plldivby2);
|
||||
void tvp_set_full_vs_bypass(alt_u8 enable);
|
||||
|
||||
void tvp_setup_hpll(alt_u16 h_samplerate, alt_u16 pixs_per_line, alt_u16 refclks_per_line, alt_u8 plldivby2);
|
||||
|
||||
void tvp_sel_csc(const ypbpr_to_rgb_csc_t *csc);
|
||||
|
||||
@@ -115,13 +110,13 @@ void tvp_set_sync_lpf(alt_u8 val);
|
||||
|
||||
void tvp_set_clp_lpf(alt_u8 val);
|
||||
|
||||
alt_u8 tvp_set_hpll_phase(alt_u8 val, alt_u8 sample_mult);
|
||||
void tvp_set_hpll_phase(alt_u8 val);
|
||||
|
||||
void tvp_set_sog_thold(alt_u8 val);
|
||||
|
||||
void tvp_set_alcfilt(alt_u8 nsv, alt_u8 nsh);
|
||||
|
||||
void tvp_source_setup(video_type type, alt_u16 h_samplerate, alt_u16 refclks_per_line, alt_u8 plldivby2, alt_u8 h_synclen_px, alt_8 clamp_user_offset);
|
||||
void tvp_source_setup(video_type type, alt_u16 h_samplerate, alt_u16 pixs_per_line, alt_u16 refclks_per_line, alt_u8 plldivby2, alt_u8 h_synclen_px, alt_8 clamp_user_offset, alt_u8 vmode_changed);
|
||||
|
||||
void tvp_source_sel(tvp_input_t input, tvp_sync_input_t syncinput, video_format fmt);
|
||||
|
||||
File renamed without changes.
+67
-37
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (C) 2015-2019 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
// Copyright (C) 2015-2023 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
//
|
||||
// This file is part of Open Source Scan Converter project.
|
||||
//
|
||||
@@ -30,6 +30,8 @@
|
||||
#define LT_ACTIVE (1<<15)
|
||||
#define LT_ARMED (1<<14)
|
||||
#define LT_MODE_OFFS 12
|
||||
#define VSYNC_I_TYPE (1<<10)
|
||||
#define PLL_BYPASS (1<<9)
|
||||
#define REMOTE_EVENT (1<<8)
|
||||
#define SD_SPI_SS_N (1<<7)
|
||||
#define LCD_CS_N (1<<6)
|
||||
@@ -39,37 +41,18 @@
|
||||
#define VIDGEN_OFF (1<<1)
|
||||
#define AV_RESET_N (1<<0)
|
||||
|
||||
#define LT_CTRL_MASK 0xf000
|
||||
#define LT_CTRL_MASK 0xf000
|
||||
|
||||
// HDMI_TX definitions
|
||||
#define HDMITX_MODE_MASK 0x00040000
|
||||
|
||||
#define PLL_ACTIVECLK_MASK 0x00080000
|
||||
|
||||
#define TX_PIXELREP_DISABLE 0
|
||||
#define TX_PIXELREP_2X 1
|
||||
#define TX_PIXELREP_4X 3
|
||||
|
||||
// FPGA macros
|
||||
#define FPGA_V_MULTMODE_1X 0
|
||||
#define FPGA_V_MULTMODE_2X 1
|
||||
#define FPGA_V_MULTMODE_3X 2
|
||||
#define FPGA_V_MULTMODE_4X 3
|
||||
#define FPGA_V_MULTMODE_5X 4
|
||||
|
||||
#define FPGA_H_MULTMODE_FULLWIDTH 0
|
||||
#define FPGA_H_MULTMODE_ASPECTFIX 1
|
||||
#define FPGA_H_MULTMODE_OPTIMIZED 2
|
||||
#define FPGA_H_MULTMODE_OPTIMIZED_1X 3
|
||||
#define VSYNC_FLAG_MASK 0x00100000
|
||||
|
||||
#define AUTO_OFF 0
|
||||
#define AUTO_CURRENT_INPUT 1
|
||||
#define AUTO_MAX_COUNT 100
|
||||
#define AUTO_MAX_COUNT 100
|
||||
#define AUTO_CURRENT_MAX_COUNT 6
|
||||
|
||||
#define PLL_CONFIG_VG 0
|
||||
#define PLL_CONFIG_2X_5X 1
|
||||
#define PLL_CONFIG_3X_4X 2
|
||||
|
||||
// In reverse order of importance
|
||||
typedef enum {
|
||||
@@ -93,34 +76,81 @@ typedef struct {
|
||||
//TODO: transform binary values into flags
|
||||
typedef struct {
|
||||
alt_u32 totlines;
|
||||
alt_u32 pcnt_field;
|
||||
alt_u32 hsync_width;
|
||||
alt_u32 clkcnt;
|
||||
alt_u8 progressive;
|
||||
alt_u8 macrovis;
|
||||
alt_8 id;
|
||||
alt_u8 sync_active;
|
||||
alt_u8 fpga_vmultmode;
|
||||
alt_u8 fpga_hmultmode;
|
||||
alt_u8 tx_pixelrep;
|
||||
alt_u8 hdmitx_pixr_ifr;
|
||||
alt_u8 hdmitx_pclk_level;
|
||||
HDMI_Video_Type hdmitx_vic;
|
||||
alt_u8 sample_mult;
|
||||
alt_u8 sample_sel;
|
||||
alt_u8 hsync_cut;
|
||||
alt_u16 h_mult_total;
|
||||
mode_flags target_lm;
|
||||
alt_u32 pclk_o_hz;
|
||||
avinput_t avinput;
|
||||
alt_u8 pll_config;
|
||||
// Current configuration
|
||||
avconfig_t cc;
|
||||
} avmode_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t profile_link;
|
||||
avinput_t def_input;
|
||||
uint8_t auto_input;
|
||||
uint8_t auto_av1_ypbpr;
|
||||
uint8_t auto_av2_ypbpr;
|
||||
uint8_t auto_av3_ypbpr;
|
||||
uint8_t lcd_bl_timeout;
|
||||
uint8_t osd_enable;
|
||||
uint8_t osd_status_timeout;
|
||||
uint8_t osd_highlight_color;
|
||||
uint8_t phase_hotkey_enable;
|
||||
} settings_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t iv_x;
|
||||
uint8_t iv_y;
|
||||
uint16_t v[16][16];
|
||||
} shmask_data_arr;
|
||||
|
||||
typedef struct {
|
||||
char name[20];
|
||||
shmask_data_arr arr;
|
||||
} c_shmask_t;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
uint32_t c64_pal[16];
|
||||
uint32_t zx_pal[16];
|
||||
uint32_t msx_pal[16];
|
||||
uint32_t intv_pal[16];
|
||||
uint32_t nes_pal[64];
|
||||
uint32_t tia_pal[128];
|
||||
uint32_t gtia_pal[256];
|
||||
uint32_t maria_pal[256];
|
||||
uint32_t sms_pal[64];
|
||||
uint32_t vic20_pal[16];
|
||||
uint32_t g7000_pal[16];
|
||||
uint32_t mc6847_pal[16];
|
||||
} __attribute__((packed, __may_alias__));
|
||||
uint32_t data[880];
|
||||
} lc_palette_set;
|
||||
|
||||
typedef struct {
|
||||
char name[20];
|
||||
lc_palette_set pal;
|
||||
} c_lc_palette_set_t;
|
||||
|
||||
void ui_disp_menu(alt_u8 osd_mode);
|
||||
void ui_disp_status(alt_u8 refresh_osd_timer);
|
||||
|
||||
int load_profile();
|
||||
int save_profile();
|
||||
void set_sampler_phase(uint8_t sampler_phase, uint8_t update_sc);
|
||||
|
||||
void set_default_c_shmask();
|
||||
void set_default_c_lc_palette_set();
|
||||
|
||||
void print_vm_stats();
|
||||
int latency_test();
|
||||
|
||||
void update_sc_config();
|
||||
|
||||
void invalidate_loaded_arrays();
|
||||
void update_settings(int init_setup);
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (C) 2015-2019 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
// Copyright (C) 2015-2023 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
//
|
||||
// This file is part of Open Source Scan Converter project.
|
||||
//
|
||||
@@ -21,7 +21,7 @@
|
||||
#define AVCONFIG_H_
|
||||
|
||||
#include "alt_types.h"
|
||||
#include "tvp7002.h"
|
||||
#include "sysconfig.h"
|
||||
|
||||
#define SIGNED_NUMVAL_ZERO 128
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#define VSYNC_THOLD_MIN 10
|
||||
#define VSYNC_THOLD_MAX 200
|
||||
#define SD_SYNC_WIN_MAX 255
|
||||
#define PLL_COAST_MAX 5
|
||||
#define PLL_COAST_MAX 10
|
||||
#define REVERSE_LPF_MAX 31
|
||||
#define COARSE_GAIN_MAX 15
|
||||
#define ALC_H_FILTER_MAX 7
|
||||
@@ -73,63 +73,98 @@ typedef enum {
|
||||
} avinput_t;
|
||||
|
||||
typedef struct {
|
||||
alt_u8 sl_mode;
|
||||
alt_u8 sl_type;
|
||||
alt_u8 sl_hybr_str;
|
||||
alt_u8 sl_method;
|
||||
alt_u8 sl_altern;
|
||||
alt_u8 sl_altiv;
|
||||
alt_u8 sl_str;
|
||||
alt_u8 sl_id;
|
||||
alt_u8 sl_cust_l_str[5];
|
||||
alt_u8 sl_cust_c_str[6];
|
||||
alt_u8 linemult_target;
|
||||
alt_u8 l2_mode;
|
||||
alt_u8 l3_mode;
|
||||
alt_u8 l4_mode;
|
||||
alt_u8 l5_mode;
|
||||
alt_u8 l5_fmt;
|
||||
alt_u8 r_f_off;
|
||||
alt_u8 g_f_off;
|
||||
alt_u8 b_f_off;
|
||||
alt_u8 r_f_gain;
|
||||
alt_u8 g_f_gain;
|
||||
alt_u8 b_f_gain;
|
||||
alt_u8 c_gain;
|
||||
} __attribute__((packed)) color_setup_t;
|
||||
|
||||
typedef struct {
|
||||
/* P-LM mode options */
|
||||
alt_u8 pm_240p;
|
||||
alt_u8 pm_384p;
|
||||
alt_u8 pm_480i;
|
||||
alt_u8 pm_480p;
|
||||
alt_u8 pm_1080i;
|
||||
alt_u8 ar_256col;
|
||||
alt_u8 h_mask;
|
||||
alt_u8 v_mask;
|
||||
alt_u8 mask_br;
|
||||
alt_u8 mask_color;
|
||||
alt_u8 tx_mode;
|
||||
alt_u8 hdmi_itc;
|
||||
alt_u8 pt_mode;
|
||||
alt_u8 l2_mode;
|
||||
alt_u8 l3_mode;
|
||||
alt_u8 l4_mode;
|
||||
alt_u8 l5_mode;
|
||||
alt_u8 l6_mode;
|
||||
alt_u8 l5_fmt;
|
||||
alt_u8 s480p_mode;
|
||||
alt_u8 s400p_mode;
|
||||
alt_u8 tvp_hpll2x;
|
||||
alt_u8 upsample2x;
|
||||
alt_u8 ypbpr_cs;
|
||||
alt_u8 ar_256col;
|
||||
alt_u8 default_vic;
|
||||
alt_u8 clamp_offset;
|
||||
alt_u8 tvp_hpll2x;
|
||||
alt_u8 adc_pll_bw;
|
||||
alt_u8 fpga_pll_bw;
|
||||
alt_u8 panasonic_hack;
|
||||
alt_u8 o480p_pbox;
|
||||
|
||||
/* Postprocessing settings */
|
||||
alt_u8 sl_mode;
|
||||
alt_u8 sl_type;
|
||||
alt_u8 sl_hybr_str;
|
||||
alt_u8 sl_method;
|
||||
alt_u8 sl_altern;
|
||||
alt_u8 sl_str;
|
||||
alt_u8 sl_id;
|
||||
alt_u8 sl_cust_l_str[6];
|
||||
alt_u8 sl_cust_c_str[6];
|
||||
alt_u8 sl_cust_iv_x;
|
||||
alt_u8 sl_cust_iv_y;
|
||||
alt_u8 mask_br;
|
||||
alt_u8 mask_color;
|
||||
alt_u8 reverse_lpf;
|
||||
alt_u8 shmask_mode;
|
||||
alt_u8 shmask_str;
|
||||
alt_u8 lumacode_mode;
|
||||
alt_u8 lumacode_pal;
|
||||
|
||||
/* AFE settings */
|
||||
alt_u8 sync_vth;
|
||||
alt_u8 linelen_tol;
|
||||
alt_u8 vsync_thold;
|
||||
alt_u8 sync_lpf;
|
||||
alt_u8 stc_lpf;
|
||||
alt_u8 video_lpf;
|
||||
alt_u8 pre_coast;
|
||||
alt_u8 post_coast;
|
||||
alt_u8 full_tx_setup;
|
||||
alt_u8 vga_ilace_fix;
|
||||
alt_u8 av3_alt_rgb;
|
||||
alt_u8 panasonic_hack;
|
||||
alt_u8 reverse_lpf;
|
||||
alt_u8 audio_dw_sampl;
|
||||
alt_u8 audio_swap_lr;
|
||||
alt_u8 audio_gain;
|
||||
alt_u8 default_vic;
|
||||
alt_u8 clamp_offset;
|
||||
alt_u8 ypbpr_cs;
|
||||
alt_u8 video_lpf;
|
||||
alt_u8 sync_lpf;
|
||||
alt_u8 stc_lpf;
|
||||
alt_u8 alc_h_filter;
|
||||
alt_u8 alc_v_filter;
|
||||
color_setup_t col;
|
||||
alt_u8 full_vs_bypass;
|
||||
|
||||
/* Audio settings */
|
||||
alt_u8 audio_dw_sampl;
|
||||
alt_u8 audio_swap_lr;
|
||||
alt_u8 audio_gain;
|
||||
alt_u8 audio_mono;
|
||||
|
||||
/* TX / extra settings */
|
||||
alt_u8 tx_mode;
|
||||
alt_u8 hdmi_itc;
|
||||
alt_u8 hdmi_ar;
|
||||
alt_u8 hdmi_hdr;
|
||||
alt_u8 hdmi_vrr;
|
||||
alt_u8 full_tx_setup;
|
||||
alt_u8 av3_alt_rgb;
|
||||
avinput_t link_av;
|
||||
} __attribute__((packed)) avconfig_t;
|
||||
|
||||
int set_default_avconfig();
|
||||
int set_default_profile(int update_cc);
|
||||
int reset_profile();
|
||||
int load_profile();
|
||||
int save_profile();
|
||||
int load_profile_sd();
|
||||
int save_profile_sd();
|
||||
|
||||
#endif
|
||||
@@ -51,6 +51,10 @@ typedef enum {
|
||||
RC_SL_TYPE,
|
||||
RC_SL_PLUS,
|
||||
RC_SL_MINUS,
|
||||
RC_SHMMODE_PLUS,
|
||||
RC_SHMMODE_MINUS,
|
||||
RC_SHMINT_PLUS,
|
||||
RC_SHMINT_MINUS,
|
||||
RC_LM_MODE,
|
||||
RC_PHASE_PLUS,
|
||||
RC_PHASE_MINUS,
|
||||
@@ -60,6 +64,7 @@ typedef enum {
|
||||
#define REMOTE_MAX_KEYS (RC_PROF_HOTKEY-RC_BTN1+1)
|
||||
|
||||
void setup_rc();
|
||||
void set_default_keymap();
|
||||
int parse_control();
|
||||
|
||||
#endif
|
||||
File renamed without changes.
@@ -0,0 +1,14 @@
|
||||
#ifndef FILE_H_
|
||||
#define FILE_H_
|
||||
|
||||
#include "ff.h"
|
||||
#include "sysconfig.h"
|
||||
|
||||
FRESULT file_mount();
|
||||
FRESULT file_open(FIL* fil, char* path);
|
||||
FRESULT file_close(FIL* fil);
|
||||
TCHAR* file_get_string(FIL* fil, char* buff, int len);
|
||||
FRESULT scan_files (char* path);
|
||||
int find_files_exec(char* path, char* pat, FILINFO *fno, int efirst, int elast, void (*func)(FILINFO *fno));
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,67 @@
|
||||
//
|
||||
// Copyright (C) 2015-2023 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
//
|
||||
// This file is part of Open Source Scan Converter project.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef FIRMWARE_H_
|
||||
#define FIRMWARE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include "sysconfig.h"
|
||||
|
||||
#define FW_VER_MAJOR 1
|
||||
#define FW_VER_MINOR 21
|
||||
|
||||
#ifdef OSDLANG_JP
|
||||
#define FW_SUFFIX "j"
|
||||
#else
|
||||
#define FW_SUFFIX ""
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
char fw_key[4];
|
||||
uint8_t version_major;
|
||||
uint8_t version_minor;
|
||||
char version_suffix[8];
|
||||
uint32_t hdr_len;
|
||||
uint32_t data_len;
|
||||
uint32_t data_crc;
|
||||
char padding[482];
|
||||
uint32_t hdr_crc;
|
||||
} __attribute__((packed)) fw_hdr;
|
||||
|
||||
typedef struct {
|
||||
uint32_t sm_cur_state[4];
|
||||
uint32_t force_early_confdone[4];
|
||||
uint32_t wdog_timeout[4];
|
||||
uint32_t wdog_enable[4];
|
||||
uint32_t image_addr[4];
|
||||
uint32_t force_int_osc[4];
|
||||
uint32_t reg_trig_cnd[4];
|
||||
uint32_t reset_timer;
|
||||
uint32_t reconfig_start;
|
||||
} rem_update_regs;
|
||||
|
||||
typedef struct {
|
||||
volatile rem_update_regs *regs;
|
||||
} rem_update_dev;
|
||||
|
||||
int fw_init_secondary();
|
||||
int fw_update();
|
||||
void fw_update_commit(uint32_t* cluster_idx, uint32_t bytes_to_copy, uint16_t fs_csize, uint16_t fs_startsec, uint32_t flash_addr);
|
||||
|
||||
#endif
|
||||
@@ -20,22 +20,32 @@
|
||||
#ifndef FLASH_H_
|
||||
#define FLASH_H_
|
||||
|
||||
#include "alt_types.h"
|
||||
#include <stdint.h>
|
||||
#include "sysconfig.h"
|
||||
#include "altera_epcq_controller2.h"
|
||||
|
||||
// EPCS16 pagesize is 256 bytes
|
||||
// Flash is split 50-50 to FW and userdata, 1MB each
|
||||
#define PAGESIZE 256
|
||||
#define PAGES_PER_SECTOR 256 //EPCS "sector" corresponds to "block" on Spansion flash
|
||||
#define SECTORSIZE (PAGESIZE*PAGES_PER_SECTOR)
|
||||
#define USERDATA_OFFSET 0x100000
|
||||
#define MAX_USERDATA_ENTRY 15 // 16 sectors for userdata
|
||||
#define FLASH_SECTOR_SIZE 65536
|
||||
|
||||
#define FLASH_VERIFY_ERROR 204
|
||||
typedef struct {
|
||||
uint32_t ctrl;
|
||||
uint32_t baud_rate;
|
||||
uint32_t cs_delay;
|
||||
uint32_t read_capture;
|
||||
uint32_t oper_mode;
|
||||
uint32_t read_instr;
|
||||
uint32_t write_instr;
|
||||
uint32_t flash_cmd_cfg;
|
||||
uint32_t flash_cmd_ctrl;
|
||||
uint32_t flash_cmd_addr;
|
||||
uint32_t flash_cmd_wrdata[2];
|
||||
uint32_t flash_cmd_rddata[2];
|
||||
} gen_flash_if_regs;
|
||||
|
||||
typedef struct {
|
||||
volatile gen_flash_if_regs *regs;
|
||||
uint32_t flash_size;
|
||||
} flash_ctrl_dev;
|
||||
|
||||
int init_flash();
|
||||
int verify_flash(alt_u32 offset, alt_u32 length, alt_u32 golden_crc, alt_u8 *tmpbuf);
|
||||
void flash_write_protect(flash_ctrl_dev *dev, int enable);
|
||||
void flash_sector_erase(flash_ctrl_dev *dev, uint32_t addr);
|
||||
|
||||
#endif /* FLASH_H_ */
|
||||
@@ -1,5 +1,6 @@
|
||||
//
|
||||
// Copyright (C) 2015-2016 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
// Copyright (C) 2025 Balázs Triszka <info@balika011.hu>
|
||||
//
|
||||
// This file is part of Open Source Scan Converter project.
|
||||
//
|
||||
@@ -20,14 +21,10 @@
|
||||
#ifndef LCD_H_
|
||||
#define LCD_H_
|
||||
|
||||
#include "system.h"
|
||||
#include <stdio.h>
|
||||
#include "sysconfig.h"
|
||||
|
||||
#define LCD_ROW_LEN 16
|
||||
|
||||
void lcd_init();
|
||||
|
||||
void lcd_write(char *row1, char *row2);
|
||||
|
||||
#endif /* LCD_H_ */
|
||||
#endif /* LCD_H_ */
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (C) 2015-2016 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
// Copyright (C) 2015-2023 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
//
|
||||
// This file is part of Open Source Scan Converter project.
|
||||
//
|
||||
@@ -21,7 +21,9 @@
|
||||
#define MENU_H_
|
||||
|
||||
#include "alt_types.h"
|
||||
#include "sysconfig.h"
|
||||
#include "controls.h"
|
||||
#include "video_modes.h"
|
||||
|
||||
#ifdef OSDLANG_JP
|
||||
#define LNG(e, j) j
|
||||
@@ -29,11 +31,22 @@
|
||||
#define LNG(e, j) e
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
NO_ACTION = 0,
|
||||
OPT_SELECT = RC_OK,
|
||||
PREV_MENU = RC_BACK,
|
||||
PREV_PAGE = RC_UP,
|
||||
NEXT_PAGE = RC_DOWN,
|
||||
VAL_MINUS = RC_LEFT,
|
||||
VAL_PLUS = RC_RIGHT,
|
||||
} menucode_id; // order must be consequential with rc_code_t
|
||||
|
||||
typedef enum {
|
||||
OPT_AVCONFIG_SELECTION,
|
||||
OPT_AVCONFIG_NUMVALUE,
|
||||
OPT_AVCONFIG_NUMVAL_U16,
|
||||
OPT_SUBMENU,
|
||||
OPT_CUSTOMMENU,
|
||||
OPT_FUNC_CALL,
|
||||
} menuitem_type;
|
||||
|
||||
@@ -41,6 +54,7 @@ typedef int (*func_call)(void);
|
||||
typedef void (*arg_func)(void);
|
||||
typedef void (*disp_func)(alt_u8);
|
||||
typedef void (*disp_func_u16)(alt_u16*);
|
||||
typedef void (*cstm_disp_func)(menucode_id, int);
|
||||
|
||||
typedef struct {
|
||||
alt_u8 *data;
|
||||
@@ -53,7 +67,7 @@ typedef struct {
|
||||
alt_u8 wrap_cfg;
|
||||
alt_u8 min;
|
||||
alt_u8 max;
|
||||
const char **setting_str;
|
||||
const char *const *const setting_str;
|
||||
} opt_avconfig_selection;
|
||||
|
||||
typedef struct {
|
||||
@@ -73,17 +87,22 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
func_call f;
|
||||
const arg_info_t *arg_info;
|
||||
const arg_info_t *arg_info; // must be at 4byte offset
|
||||
} opt_func_call;
|
||||
|
||||
typedef struct menustruct menu_t;
|
||||
|
||||
typedef struct {
|
||||
const menu_t *menu;
|
||||
const arg_info_t *arg_info;
|
||||
const arg_info_t *arg_info; // must be at 4byte offset
|
||||
arg_func arg_f;
|
||||
} opt_submenu;
|
||||
|
||||
typedef struct {
|
||||
cstm_disp_func cstm_f;
|
||||
const arg_info_t *arg_info; // must be at 4byte offset
|
||||
} opt_custommenu;
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
menuitem_type type;
|
||||
@@ -92,39 +111,40 @@ typedef struct {
|
||||
opt_avconfig_numvalue num;
|
||||
opt_avconfig_numvalue_u16 num_u16;
|
||||
opt_submenu sub;
|
||||
opt_custommenu cstm;
|
||||
opt_func_call fun;
|
||||
};
|
||||
} menuitem_t;
|
||||
|
||||
struct menustruct {
|
||||
alt_u8 num_items;
|
||||
menuitem_t *items;
|
||||
const menuitem_t *items;
|
||||
};
|
||||
|
||||
#define SETTING_ITEM(x) 0, sizeof(x)/sizeof(char*)-1, x
|
||||
#define MENU(X, Y) menuitem_t X##_items[] = Y; const menu_t X = { sizeof(X##_items)/sizeof(menuitem_t), X##_items };
|
||||
#define MENU(X, Y) const menuitem_t X##_items[] = Y; const menu_t X = { sizeof(X##_items)/sizeof(menuitem_t), X##_items };
|
||||
#define P99_PROTECT(...) __VA_ARGS__
|
||||
|
||||
typedef enum {
|
||||
NO_ACTION = 0,
|
||||
OPT_SELECT = RC_OK,
|
||||
PREV_MENU = RC_BACK,
|
||||
PREV_PAGE = RC_UP,
|
||||
NEXT_PAGE = RC_DOWN,
|
||||
VAL_MINUS = RC_LEFT,
|
||||
VAL_PLUS = RC_RIGHT,
|
||||
} menucode_id; // order must be consequential with rc_code_t
|
||||
|
||||
typedef struct {
|
||||
const menu_t *m;
|
||||
alt_u8 mp;
|
||||
} menunavi;
|
||||
|
||||
typedef int (*load_func)(char*, char*);
|
||||
|
||||
menunavi* get_current_menunavi();
|
||||
void init_menu();
|
||||
void render_osd_page();
|
||||
void display_menu(alt_u8 forcedisp);
|
||||
void sampler_phase_disp(alt_u8 v);
|
||||
void set_func_ret_msg(char *msg);
|
||||
void update_osd_size(mode_data_t *vm_out);
|
||||
void refresh_osd();
|
||||
void cstm_shmask_load(menucode_id code, int setup_disp);
|
||||
void cstm_lc_palette_set_load(menucode_id code, int setup_disp);
|
||||
void cstm_fw_update(menucode_id code, int setup_disp);
|
||||
void enter_cstm(const menuitem_t *item, int detached_mode);
|
||||
static void vm_select();
|
||||
static void vm_tweak(alt_u16 *v);
|
||||
static void sampler_phase_tweak(alt_u8 v);
|
||||
|
||||
#endif
|
||||
File renamed without changes.
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Copyright (C) 2015-2018 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
// Copyright (C) 2015-2025 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
//
|
||||
// This file is part of Open Source Scan Converter project.
|
||||
//
|
||||
@@ -20,21 +20,17 @@
|
||||
#ifndef USERDATA_H_
|
||||
#define USERDATA_H_
|
||||
|
||||
#include "alt_types.h"
|
||||
#include <stdint.h>
|
||||
#include "sysconfig.h"
|
||||
#include "controls.h"
|
||||
#include "av_controller.h"
|
||||
#include "avconfig.h"
|
||||
#include "video_modes.h"
|
||||
#include "flash.h"
|
||||
|
||||
#define PROFILE_NAME_LEN 12
|
||||
#define USERDATA_NAME_LEN 13
|
||||
#define MAX_USERDATA_ENTRY 15
|
||||
#define MAX_SD_USERDATA_ENTRY 100
|
||||
|
||||
#define MAX_PROFILE (MAX_USERDATA_ENTRY-1)
|
||||
#define MAX_SD_PROFILE (MAX_SD_USERDATA_ENTRY-1)
|
||||
#define INIT_CONFIG_SLOT MAX_USERDATA_ENTRY
|
||||
|
||||
#define UDATA_IMPT_CANCELLED 104
|
||||
#define UDATA_EXPT_CANCELLED 105
|
||||
#define SD_INIT_CONFIG_SLOT MAX_SD_USERDATA_ENTRY
|
||||
|
||||
typedef enum {
|
||||
UDE_INITCFG = 0,
|
||||
@@ -43,39 +39,26 @@ typedef enum {
|
||||
|
||||
typedef struct {
|
||||
char userdata_key[8];
|
||||
alt_u8 version_major;
|
||||
alt_u8 version_minor;
|
||||
char name[USERDATA_NAME_LEN+1];
|
||||
ude_type type;
|
||||
uint8_t num_items;
|
||||
} __attribute__((packed, __may_alias__)) ude_hdr;
|
||||
|
||||
typedef struct {
|
||||
ude_hdr hdr;
|
||||
alt_u16 data_len;
|
||||
alt_u8 last_profile[AV_LAST];
|
||||
alt_u8 profile_link;
|
||||
avinput_t last_input;
|
||||
avinput_t def_input;
|
||||
alt_u8 lcd_bl_timeout;
|
||||
alt_u8 auto_input;
|
||||
alt_u8 auto_av1_ypbpr;
|
||||
alt_u8 auto_av2_ypbpr;
|
||||
alt_u8 auto_av3_ypbpr;
|
||||
alt_u8 osd_enable;
|
||||
alt_u8 osd_status_timeout;
|
||||
alt_u16 keys[REMOTE_MAX_KEYS];
|
||||
} __attribute__((packed, __may_alias__)) ude_initcfg;
|
||||
uint16_t id;
|
||||
uint16_t version;
|
||||
uint16_t data_size;
|
||||
} __attribute__((packed, __may_alias__)) ude_item_hdr;
|
||||
|
||||
typedef struct {
|
||||
ude_hdr hdr;
|
||||
char name[PROFILE_NAME_LEN+1];
|
||||
alt_u16 avc_data_len;
|
||||
alt_u16 vm_data_len;
|
||||
avconfig_t avc;
|
||||
mode_data_t vm[VIDEO_MODES_CNT];
|
||||
} __attribute__((packed, __may_alias__)) ude_profile;
|
||||
ude_item_hdr hdr;
|
||||
void *data;
|
||||
} ude_item_map;
|
||||
|
||||
int write_userdata(alt_u8 entry);
|
||||
int read_userdata(alt_u8 entry, int dry_run);
|
||||
int write_userdata(uint8_t entry);
|
||||
int read_userdata(uint8_t entry, int dry_run);
|
||||
int write_userdata_sd(uint8_t entry);
|
||||
int read_userdata_sd(uint8_t entry, int dry_run);
|
||||
int import_userdata();
|
||||
int export_userdata();
|
||||
|
||||
File renamed without changes.
@@ -0,0 +1,188 @@
|
||||
//
|
||||
// Copyright (C) 2015-2023 Markus Hiienkari <mhiienka@niksula.hut.fi>
|
||||
//
|
||||
// This file is part of Open Source Scan Converter project.
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
|
||||
#ifndef VIDEO_MODES_H_
|
||||
#define VIDEO_MODES_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include "sysconfig.h"
|
||||
#include "avconfig.h"
|
||||
#include "it6613_sys.h"
|
||||
|
||||
#define DEF_PHASE 0x10
|
||||
|
||||
#define H_TOTAL_MIN 300
|
||||
#define H_TOTAL_MAX 3200
|
||||
#define H_TOTAL_ADJ_MAX 19
|
||||
#define H_SYNCLEN_MIN 10
|
||||
#define H_SYNCLEN_MAX 255
|
||||
#define H_BPORCH_MIN 0
|
||||
#define H_BPORCH_MAX 511
|
||||
#define H_ACTIVE_MIN 200
|
||||
#define H_ACTIVE_MAX 3000
|
||||
#define H_ACTIVE_SMP_MAX 2048
|
||||
#define V_SYNCLEN_MIN 1
|
||||
#define V_SYNCLEN_MAX 15
|
||||
#define V_BPORCH_MIN 0
|
||||
#define V_BPORCH_MAX 511
|
||||
#define V_ACTIVE_MIN 160
|
||||
#define V_ACTIVE_MAX 1728
|
||||
|
||||
typedef enum {
|
||||
FORMAT_RGBS = 0,
|
||||
FORMAT_RGBHV = 1,
|
||||
FORMAT_RGsB = 2,
|
||||
FORMAT_YPbPr = 3
|
||||
} video_format;
|
||||
|
||||
typedef enum {
|
||||
VIDEO_SDTV = (1<<0),
|
||||
VIDEO_EDTV = (1<<1),
|
||||
VIDEO_HDTV = (1<<2),
|
||||
VIDEO_PC = (1<<3),
|
||||
} video_type;
|
||||
|
||||
typedef enum {
|
||||
GROUP_NONE = 0,
|
||||
GROUP_240P = 1,
|
||||
GROUP_288P = 2,
|
||||
GROUP_384P = 3,
|
||||
GROUP_480I = 4,
|
||||
GROUP_576I = 5,
|
||||
GROUP_480P = 6,
|
||||
GROUP_576P = 7,
|
||||
GROUP_720P = 8,
|
||||
GROUP_1080I = 9,
|
||||
GROUP_1080P = 10,
|
||||
} video_group;
|
||||
|
||||
typedef enum {
|
||||
MODE_INTERLACED = (1<<0), //deprecated
|
||||
MODE_CRT = (1<<1),
|
||||
//at least one of the flags below must be set for each P-LM mode
|
||||
MODE_PT = (1<<2),
|
||||
MODE_L2 = (1<<3),
|
||||
MODE_L2_512_COL = (1<<4),
|
||||
MODE_L2_384_COL = (1<<5),
|
||||
MODE_L2_320_COL = (1<<6),
|
||||
MODE_L2_256_COL = (1<<7),
|
||||
MODE_L2_240x360 = (1<<8),
|
||||
MODE_L3_GEN_16_9 = (1<<9),
|
||||
MODE_L3_GEN_4_3 = (1<<10),
|
||||
MODE_L3_512_COL = (1<<11),
|
||||
MODE_L3_384_COL = (1<<12),
|
||||
MODE_L3_320_COL = (1<<13),
|
||||
MODE_L3_256_COL = (1<<14),
|
||||
MODE_L3_240x360 = (1<<15),
|
||||
MODE_L4_GEN_4_3 = (1<<16),
|
||||
MODE_L4_512_COL = (1<<17),
|
||||
MODE_L4_384_COL = (1<<18),
|
||||
MODE_L4_320_COL = (1<<19),
|
||||
MODE_L4_256_COL = (1<<20),
|
||||
MODE_L5_GEN_4_3 = (1<<21),
|
||||
MODE_L5_512_COL = (1<<22),
|
||||
MODE_L5_384_COL = (1<<23),
|
||||
MODE_L5_320_COL = (1<<24),
|
||||
MODE_L5_256_COL = (1<<25),
|
||||
MODE_L6_GEN_4_3 = (1<<26),
|
||||
MODE_L6_512_COL = (1<<27),
|
||||
MODE_L6_384_COL = (1<<28),
|
||||
MODE_L6_320_COL = (1<<29),
|
||||
MODE_L6_256_COL = (1<<30),
|
||||
} mode_flags;
|
||||
|
||||
typedef enum {
|
||||
VMODE_480p = 24,
|
||||
} vmode_t;
|
||||
|
||||
typedef struct {
|
||||
uint16_t h_active;
|
||||
uint16_t v_active;
|
||||
uint16_t v_hz_x100;
|
||||
uint16_t h_total;
|
||||
uint8_t h_total_adj;
|
||||
uint16_t v_total;
|
||||
uint16_t h_backporch;
|
||||
uint16_t v_backporch;
|
||||
uint8_t h_synclen;
|
||||
uint8_t v_synclen;
|
||||
uint8_t interlaced;
|
||||
} sync_timings_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t h;
|
||||
uint8_t v;
|
||||
} aspect_ratio_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t h;
|
||||
uint8_t v;
|
||||
} mask_t;
|
||||
|
||||
typedef enum {
|
||||
TX_1X = 0,
|
||||
TX_2X = 1,
|
||||
TX_4X = 2
|
||||
} HDMI_pixelrep_t;
|
||||
|
||||
typedef struct {
|
||||
char name[11];
|
||||
HDMI_Video_Type vic;
|
||||
sync_timings_t timings;
|
||||
uint8_t sampler_phase;
|
||||
union {
|
||||
aspect_ratio_t ar;
|
||||
mask_t mask;
|
||||
};
|
||||
video_type type;
|
||||
video_group group;
|
||||
mode_flags flags;
|
||||
} mode_data_t;
|
||||
|
||||
typedef struct {
|
||||
int8_t x_rpt;
|
||||
int8_t y_rpt;
|
||||
uint8_t h_skip;
|
||||
uint8_t h_sample_sel;
|
||||
int16_t x_offset;
|
||||
int16_t y_offset;
|
||||
uint16_t x_size;
|
||||
uint16_t y_size;
|
||||
uint16_t framesync_line;
|
||||
uint8_t x_start_lb;
|
||||
int8_t y_start_lb;
|
||||
uint8_t framelock;
|
||||
uint8_t tx_pixelrep;
|
||||
uint8_t hdmitx_pixr_ifr;
|
||||
// for generation from 27MHz clock
|
||||
int8_t si_pclk_mult;
|
||||
} vm_proc_config_t;
|
||||
|
||||
|
||||
void set_default_vm_table();
|
||||
|
||||
uint32_t estimate_dotclk(mode_data_t *vm_in, uint32_t h_hz);
|
||||
|
||||
uint32_t calculate_pclk(uint32_t src_clk_hz, mode_data_t *vm_out, vm_proc_config_t *vm_conf);
|
||||
|
||||
int get_pure_lm_mode(avconfig_t *cc, mode_data_t *vm_in, mode_data_t *vm_out, vm_proc_config_t *vm_conf);
|
||||
|
||||
int get_vmode(vmode_t vmode_id, mode_data_t *vm_in, mode_data_t *vm_out, vm_proc_config_t *vm_conf);
|
||||
|
||||
#endif /* VIDEO_MODES_H_ */
|
||||
@@ -1,13 +1,19 @@
|
||||
SEARCH_DIR(.)
|
||||
__DYNAMIC = 0;
|
||||
|
||||
/* First 16 flash sectors reserved for 2 firmware images (2x 0.5MB).
|
||||
In typical configuration a firmware image consists of
|
||||
* compressed bitstream (5 sectors / 0.3MB)
|
||||
* flash_imem (3 sectors / 0.2MB)
|
||||
Last 16 flash sectors reserved for userdata (16x 64KB). */
|
||||
MEMORY
|
||||
{
|
||||
dataram : ORIGIN = 0x00010000, LENGTH = 0xa000
|
||||
flash_imem : ORIGIN = 0x02050000, LENGTH = 196608
|
||||
dataram : ORIGIN = 0x00010000, LENGTH = 16384
|
||||
}
|
||||
|
||||
/* Stack information variables */
|
||||
_min_stack = 0x400; /* 1K - minimum stack space to reserve */
|
||||
_min_stack = 0x1000; /* 4KB - minimum stack space to reserve */
|
||||
_stack_start = ORIGIN(dataram) + LENGTH(dataram);
|
||||
|
||||
/* We have to align each sector to word boundaries as our current s19->slm
|
||||
@@ -19,7 +25,7 @@ SECTIONS
|
||||
{
|
||||
. = ALIGN(4);
|
||||
KEEP(*(.vectors))
|
||||
} > dataram
|
||||
} > flash_imem
|
||||
|
||||
.text : {
|
||||
. = ALIGN(4);
|
||||
@@ -40,7 +46,16 @@ SECTIONS
|
||||
*(.lit)
|
||||
*(.shdata)
|
||||
_endtext = .;
|
||||
} > dataram
|
||||
} > flash_imem
|
||||
|
||||
.rodata : {
|
||||
. = ALIGN(4);
|
||||
*(.rodata);
|
||||
*(.rodata.*)
|
||||
*(.srodata);
|
||||
*(.srodata.*)
|
||||
. = ALIGN(4);
|
||||
} > flash_imem
|
||||
|
||||
/*--------------------------------------------------------------------*/
|
||||
/* Global constructor/destructor segement */
|
||||
@@ -69,20 +84,19 @@ SECTIONS
|
||||
PROVIDE_HIDDEN (__fini_array_end = .);
|
||||
} > dataram
|
||||
|
||||
.rodata : {
|
||||
.text_bram : AT ( LOADADDR (.rodata) + SIZEOF (.rodata) ) {
|
||||
. = ALIGN(4);
|
||||
*(.rodata);
|
||||
*(.rodata.*)
|
||||
PROVIDE (__ram_text_start = ABSOLUTE(.));
|
||||
*(.text_bram);
|
||||
. = ALIGN(4);
|
||||
PROVIDE (__ram_text_end = ABSOLUTE(.));
|
||||
} > dataram
|
||||
|
||||
.shbss :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
*(.shbss)
|
||||
} > dataram
|
||||
PROVIDE (__flash_text_bram_start = LOADADDR(.text_bram));
|
||||
|
||||
.data : {
|
||||
.data : AT ( LOADADDR (.text_bram) + SIZEOF (.text_bram) ) {
|
||||
. = ALIGN(4);
|
||||
PROVIDE (__ram_rwdata_start = ABSOLUTE(.));
|
||||
sdata = .;
|
||||
_sdata = .;
|
||||
*(.data);
|
||||
@@ -93,6 +107,16 @@ SECTIONS
|
||||
*(.sdata2.*)
|
||||
edata = .;
|
||||
_edata = .;
|
||||
. = ALIGN(4);
|
||||
PROVIDE (__ram_rwdata_end = ABSOLUTE(.));
|
||||
} > dataram
|
||||
|
||||
PROVIDE (__flash_rwdata_start = LOADADDR(.data));
|
||||
|
||||
.shbss :
|
||||
{
|
||||
. = ALIGN(4);
|
||||
*(.shbss)
|
||||
} > dataram
|
||||
|
||||
.bss :
|
||||
|
||||
Loaded 100 of 142 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user