2016-06-12 20:43:24 +00:00
|
|
|
//
|
|
|
|
// Copyright (C) 2015-2016 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/>.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include <string.h>
|
2016-07-09 20:12:35 +00:00
|
|
|
#include "system.h"
|
2016-06-12 20:43:24 +00:00
|
|
|
#include "avconfig.h"
|
2016-07-09 20:12:35 +00:00
|
|
|
#include "av_controller.h"
|
|
|
|
#include "altera_avalon_pio_regs.h"
|
2016-06-12 20:43:24 +00:00
|
|
|
#include "tvp7002.h"
|
|
|
|
|
2016-11-06 13:24:26 +00:00
|
|
|
#define DEFAULT_ON 1
|
2016-06-12 20:43:24 +00:00
|
|
|
#define DEFAULT_PRE_COAST 1
|
|
|
|
#define DEFAULT_POST_COAST 0
|
|
|
|
#define DEFAULT_SAMPLER_PHASE 16
|
|
|
|
#define DEFAULT_SYNC_VTH 11
|
2016-08-20 12:54:28 +00:00
|
|
|
#define DEFAULT_FINE_GAIN 26
|
|
|
|
#define DEFAULT_FINE_OFFSET 0x80
|
2016-06-12 20:43:24 +00:00
|
|
|
|
2016-08-16 19:45:23 +00:00
|
|
|
extern mode_data_t video_modes[], video_modes_def[];
|
|
|
|
extern alt_u8 video_mode_cnt;
|
2016-09-05 17:49:41 +00:00
|
|
|
extern alt_u8 update_cur_vm;
|
2016-08-16 19:45:23 +00:00
|
|
|
|
2016-06-12 20:43:24 +00:00
|
|
|
// Target configuration
|
|
|
|
avconfig_t tc;
|
|
|
|
|
|
|
|
// Default configuration
|
|
|
|
const avconfig_t tc_default = {
|
2016-08-20 12:54:28 +00:00
|
|
|
.sampler_phase = DEFAULT_SAMPLER_PHASE,
|
|
|
|
.sync_vth = DEFAULT_SYNC_VTH,
|
2016-09-05 17:49:41 +00:00
|
|
|
.linelen_tol = DEFAULT_LINELEN_TOL,
|
2016-08-20 12:54:28 +00:00
|
|
|
.vsync_thold = DEFAULT_VSYNC_THOLD,
|
|
|
|
.pre_coast = DEFAULT_PRE_COAST,
|
|
|
|
.post_coast = DEFAULT_POST_COAST,
|
2016-11-06 13:24:26 +00:00
|
|
|
#ifdef DIY_AUDIO
|
|
|
|
.audio_dw_sampl = DEFAULT_ON,
|
|
|
|
#endif
|
2016-08-20 12:54:28 +00:00
|
|
|
.col = {
|
|
|
|
.r_f_gain = DEFAULT_FINE_GAIN,
|
|
|
|
.g_f_gain = DEFAULT_FINE_GAIN,
|
|
|
|
.b_f_gain = DEFAULT_FINE_GAIN,
|
|
|
|
.r_f_off = DEFAULT_FINE_OFFSET,
|
|
|
|
.g_f_off = DEFAULT_FINE_OFFSET,
|
|
|
|
.b_f_off = DEFAULT_FINE_OFFSET,
|
|
|
|
},
|
2016-06-12 20:43:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
int set_default_avconfig()
|
|
|
|
{
|
|
|
|
memcpy(&tc, &tc_default, sizeof(avconfig_t));
|
2016-07-09 20:12:35 +00:00
|
|
|
tc.tx_mode = !!(IORD_ALTERA_AVALON_PIO_DATA(PIO_1_BASE) & HDMITX_MODE_MASK);
|
2016-06-12 20:43:24 +00:00
|
|
|
|
2016-08-16 19:45:23 +00:00
|
|
|
memcpy(video_modes, video_modes_def, video_mode_cnt*sizeof(mode_data_t));
|
2016-09-05 17:49:41 +00:00
|
|
|
update_cur_vm = 1;
|
2016-08-16 19:45:23 +00:00
|
|
|
|
2016-06-12 20:43:24 +00:00
|
|
|
return 0;
|
|
|
|
}
|