mirror of
https://github.com/marqs85/ossc
synced 2025-12-08 10:15:59 +03:00
Compare commits
No commits in common. "496e3f68b8c20b7ef964a6d566876e247cdcc730" and "3194ec6ed35bcd5982fa8d6229c779a95329584e" have entirely different histories.
496e3f68b8
...
3194ec6ed3
@ -51,10 +51,6 @@ 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,
|
||||
|
||||
@ -45,14 +45,7 @@ typedef struct {
|
||||
} __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 unused[29];
|
||||
uint32_t reconfig_start;
|
||||
} rem_update_regs;
|
||||
|
||||
@ -60,8 +53,8 @@ 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, uint8_t* databuf, uint32_t bytes_to_copy, uint16_t fs_csize, uint16_t fs_startsec, uint32_t flash_addr);
|
||||
|
||||
void fw_update_commit(uint32_t* cluster_idx, uint8_t* databuf, uint32_t bytes_to_copy, uint16_t fs_csize, uint16_t fs_startsec);
|
||||
|
||||
#endif
|
||||
|
||||
@ -33,12 +33,10 @@
|
||||
|
||||
static const char *rc_keydesc[REMOTE_MAX_KEYS] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", \
|
||||
"MENU", "OK", "BACK", "UP", "DOWN", "LEFT", "RIGHT", "INFO", "LCD_BACKLIGHT", "SCANLINE_MODE", \
|
||||
"SCANLINE_TYPE", "SCANLINE_INT+", "SCANLINE_INT-", "SHMASK_MODE+", "SHMASK_MODE-", "SHMASK_INT+", "SHMASK_INT-", "LINEMULT_MODE", "PHASE+", "PHASE-",
|
||||
"PROFILE_HOTKEY"};
|
||||
"SCANLINE_TYPE", "SCANLINE_INT+", "SCANLINE_INT-", "LINEMULT_MODE", "PHASE+", "PHASE-", "PROFILE_HOTKEY"};
|
||||
const alt_u16 rc_keymap_default[REMOTE_MAX_KEYS] = {0x3E29, 0x3EA9, 0x3E69, 0x3EE9, 0x3E19, 0x3E99, 0x3E59, 0x3ED9, 0x3E39, 0x3EC9, \
|
||||
0x3E4D, 0x3E1D, 0x3EED, 0x3E2D, 0x3ECD, 0x3EAD, 0x3E6D, 0x3E65, 0x3E01, 0x1C48, \
|
||||
0x1C18, 0x1C50, 0x1CD0, 0x3E5D, 0x3E9D, 0x1C70, 0x1CF0, 0x1CC8, 0x5E58, 0x5ED8,
|
||||
0x3EB9};
|
||||
0x1C18, 0x1C50, 0x1CD0, 0x1CC8, 0x5E58, 0x5ED8, 0x3EB9};
|
||||
alt_u16 rc_keymap[REMOTE_MAX_KEYS];
|
||||
|
||||
extern char menu_row1[LCD_ROW_LEN+1], menu_row2[LCD_ROW_LEN+1];
|
||||
@ -54,7 +52,7 @@ extern alt_u8 profile_sel, profile_sel_menu;
|
||||
extern alt_u8 vm_edit;
|
||||
extern volatile osd_regs *osd;
|
||||
|
||||
extern menu_t menu_scanlines, menu_advtiming, menu_postproc;
|
||||
extern menu_t menu_scanlines, menu_advtiming;
|
||||
|
||||
alt_u32 remote_code;
|
||||
alt_u8 remote_rpt, remote_rpt_prev;
|
||||
@ -222,43 +220,6 @@ int parse_control()
|
||||
render_osd_page();
|
||||
}
|
||||
break;
|
||||
case RC_SHMMODE_MINUS:
|
||||
case RC_SHMMODE_PLUS:
|
||||
if (i == RC_SHMMODE_MINUS)
|
||||
tc.shmask_mode = tc.shmask_mode ? (tc.shmask_mode - 1) : menu_postproc.items[0].sel.max;
|
||||
else
|
||||
tc.shmask_mode = (tc.shmask_mode < menu_postproc.items[0].sel.max) ? (tc.shmask_mode + 1) : 0;
|
||||
|
||||
if (!menu_active) {
|
||||
strncpy((char*)osd->osd_array.data[0][0], menu_postproc.items[0].name, OSD_CHAR_COLS);
|
||||
strncpy((char*)osd->osd_array.data[1][0], menu_postproc.items[0].sel.setting_str[tc.shmask_mode], OSD_CHAR_COLS);
|
||||
osd->osd_config.status_refresh = 1;
|
||||
osd->osd_row_color.mask = 0;
|
||||
osd->osd_sec_enable[0].mask = 3;
|
||||
osd->osd_sec_enable[1].mask = 0;
|
||||
} else if (get_current_menunavi()->m == &menu_postproc) {
|
||||
render_osd_page();
|
||||
}
|
||||
break;
|
||||
case RC_SHMINT_MINUS:
|
||||
case RC_SHMINT_PLUS:
|
||||
if (i == RC_SHMINT_MINUS)
|
||||
tc.shmask_str = tc.shmask_str ? (tc.shmask_str - 1) : 0;
|
||||
else
|
||||
tc.shmask_str = (tc.shmask_str < SCANLINESTR_MAX) ? (tc.shmask_str + 1) : SCANLINESTR_MAX;
|
||||
|
||||
if (!menu_active) {
|
||||
strncpy((char*)osd->osd_array.data[0][0], menu_postproc.items[1].name, OSD_CHAR_COLS);
|
||||
menu_postproc.items[1].num.df(tc.shmask_str);
|
||||
strncpy((char*)osd->osd_array.data[1][0], menu_row2, OSD_CHAR_COLS);
|
||||
osd->osd_config.status_refresh = 1;
|
||||
osd->osd_row_color.mask = 0;
|
||||
osd->osd_sec_enable[0].mask = 3;
|
||||
osd->osd_sec_enable[1].mask = 0;
|
||||
} else if (get_current_menunavi()->m == &menu_postproc) {
|
||||
render_osd_page();
|
||||
}
|
||||
break;
|
||||
case RC_LM_MODE:
|
||||
strncpy(menu_row1, "Linemult mode:", LCD_ROW_LEN+1);
|
||||
strncpy(menu_row2, "press 1-6", LCD_ROW_LEN+1);
|
||||
|
||||
@ -34,10 +34,6 @@
|
||||
#include "file.h"
|
||||
#include "altera_avalon_pio_regs.h"
|
||||
|
||||
#define SECONDARY_FW_ADDR 0x00080000
|
||||
#define FW_FINGERPRINT 0xEFEFEF56
|
||||
#define FW_FINGERPRINT_OFFSET 0x20
|
||||
|
||||
extern char menu_row1[LCD_ROW_LEN+1], menu_row2[LCD_ROW_LEN+1];
|
||||
extern alt_u16 rc_keymap[REMOTE_MAX_KEYS];
|
||||
extern SD_DEV sdcard_dev;
|
||||
@ -45,23 +41,6 @@ extern alt_u32 sys_ctrl;
|
||||
extern flash_ctrl_dev flashctrl_dev;
|
||||
extern rem_update_dev rem_reconfig_dev;
|
||||
|
||||
int fw_init_secondary() {
|
||||
uint32_t fingerprint = *(uint32_t*)(INTEL_GENERIC_SERIAL_FLASH_INTERFACE_TOP_0_AVL_MEM_BASE + SECONDARY_FW_ADDR + FW_FINGERPRINT_OFFSET);
|
||||
|
||||
if (fingerprint != FW_FINGERPRINT) {
|
||||
printf("Invalid FW fingerprint (0x%.8x instead of 0x%.8x)\n", fingerprint, FW_FINGERPRINT);
|
||||
return -1;
|
||||
}
|
||||
|
||||
rem_reconfig_dev.regs->image_addr[0] = SECONDARY_FW_ADDR;
|
||||
rem_reconfig_dev.regs->wdog_enable[0] = 0;
|
||||
rem_reconfig_dev.regs->reconfig_start = 1;
|
||||
|
||||
while (1) {}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//int fw_update(char *dirname, char *filename) {
|
||||
int fw_update() {
|
||||
FIL fw_file;
|
||||
@ -74,7 +53,6 @@ int fw_update() {
|
||||
uint32_t cluster_idx[100]; // enough for >=4kB cluster size
|
||||
uint8_t databuf[SD_BLK_SIZE]; // temp buffer for data
|
||||
uint16_t fs_csize, fs_startsec, cl_iter, cl_soffs;
|
||||
uint32_t flash_addr;
|
||||
|
||||
if (!sdcard_dev.mount) {
|
||||
retval = file_mount();
|
||||
@ -101,15 +79,12 @@ int fw_update() {
|
||||
|
||||
hdr_len = bswap32(hdr.hdr_len);
|
||||
|
||||
if (!(!strncmp(hdr.fw_key, "OSSC", 4) || !strncmp(hdr.fw_key, "OSS2", 4)) || (hdr_len < 26 || hdr_len > 508)) {
|
||||
if (strncmp(hdr.fw_key, "OSSC", 4) || (hdr_len < 26 || hdr_len > 508)) {
|
||||
printf("Invalid FW header\n");
|
||||
retval = -4;
|
||||
goto close_file;
|
||||
}
|
||||
|
||||
// Set target flash address
|
||||
flash_addr = hdr.fw_key[3] == 'C' ? 0x00000000 : SECONDARY_FW_ADDR;
|
||||
|
||||
crcval = crc32((unsigned char *)&hdr, hdr_len, 1);
|
||||
hdr.hdr_len = bswap32(hdr.hdr_len);
|
||||
hdr.data_len = bswap32(hdr.data_len);
|
||||
@ -130,7 +105,7 @@ int fw_update() {
|
||||
goto close_file;
|
||||
}
|
||||
|
||||
sniprintf(menu_row1, LCD_ROW_LEN+1, "v%u.%u%s%s%s", hdr.version_major, hdr.version_minor, hdr.version_suffix[0] ? "-" : "", hdr.version_suffix, (hdr.fw_key[3] == 'C') ? "" : " (sec)" );
|
||||
sniprintf(menu_row1, LCD_ROW_LEN+1, "v%u.%u%s%s", hdr.version_major, hdr.version_minor, hdr.version_suffix[0] ? "-" : "", hdr.version_suffix);
|
||||
sniprintf(menu_row2, LCD_ROW_LEN+1, "Update? 1=Y, 2=N");
|
||||
ui_disp_menu(1);
|
||||
|
||||
@ -209,7 +184,7 @@ int fw_update() {
|
||||
usleep(10000);
|
||||
|
||||
// No return from here
|
||||
fw_update_commit(cluster_idx, databuf, hdr.data_len, fs_csize, fs_startsec, flash_addr);
|
||||
fw_update_commit(cluster_idx, databuf, hdr.data_len, fs_csize, fs_startsec);
|
||||
return 0;
|
||||
} else {
|
||||
printf("FW file not found\n");
|
||||
@ -224,7 +199,7 @@ close_file:
|
||||
}
|
||||
|
||||
// commit FW update. Do not call functions located in flash during update
|
||||
void __attribute__((noinline, flatten, noreturn, __section__(".text_bram"))) fw_update_commit(uint32_t* cluster_idx, uint8_t* databuf, uint32_t bytes_to_copy, uint16_t fs_csize, uint16_t fs_startsec, uint32_t flash_addr) {
|
||||
void __attribute__((noinline, flatten, noreturn, __section__(".text_bram"))) fw_update_commit(uint32_t* cluster_idx, uint8_t* databuf, uint32_t bytes_to_copy, uint16_t fs_csize, uint16_t fs_startsec) {
|
||||
int i, sectors;
|
||||
SDRESULTS res;
|
||||
uint16_t cl_iter, cl_soffs;
|
||||
@ -234,9 +209,9 @@ void __attribute__((noinline, flatten, noreturn, __section__(".text_bram"))) fw_
|
||||
flash_write_protect(&flashctrl_dev, 0);
|
||||
|
||||
// Erase sectors
|
||||
addr = flash_addr;
|
||||
addr = 0;
|
||||
sectors = (bytes_to_copy/FLASH_SECTOR_SIZE) + ((bytes_to_copy % FLASH_SECTOR_SIZE) != 0);
|
||||
data_to = (uint32_t*)(INTEL_GENERIC_SERIAL_FLASH_INTERFACE_TOP_0_AVL_MEM_BASE + flash_addr);
|
||||
data_to = (uint32_t*)(INTEL_GENERIC_SERIAL_FLASH_INTERFACE_TOP_0_AVL_MEM_BASE);
|
||||
|
||||
for (i=0; i<sectors; i++) {
|
||||
flash_sector_erase(&flashctrl_dev, addr);
|
||||
|
||||
@ -262,7 +262,6 @@ MENU(menu_settings, P99_PROTECT({ \
|
||||
//{ LNG("<Import sett. >","<セッテイヨミコミ >"), OPT_FUNC_CALL, { .fun = { import_userdata, NULL } } },
|
||||
//{ LNG("<Export sett. >","<セッテイカキコミ >"), OPT_FUNC_CALL, { .fun = { export_userdata, NULL } } },
|
||||
{ LNG("<Fw. update >","<ファームウェアアップデート>"), OPT_FUNC_CALL, { .fun = { fw_update, NULL } } },
|
||||
{ "<Launch 2nd FW >", OPT_FUNC_CALL, { .fun = { fw_init_secondary, NULL } } },
|
||||
}))
|
||||
|
||||
|
||||
|
||||
2
sys.qsys
2
sys.qsys
@ -625,7 +625,7 @@
|
||||
<parameter name="GUI_config_device" value="EPCS16" />
|
||||
<parameter name="check_app_pof" value="false" />
|
||||
<parameter name="check_avalon_interface" value="true" />
|
||||
<parameter name="m_support_write_config_check" value="true" />
|
||||
<parameter name="m_support_write_config_check" value="false" />
|
||||
<parameter name="operation_mode" value="REMOTE" />
|
||||
</module>
|
||||
<module name="sc_config_0" kind="sc_config" version="1.0" enabled="1" />
|
||||
|
||||
Loading…
Reference in New Issue
Block a user