Skip to content

Commit

Permalink
Allow CPLD driver to provide a default profile (#91)
Browse files Browse the repository at this point in the history
Change-Id: Id728767b3aa21053f08208dc62542cab89827e46
  • Loading branch information
hoglet67 committed May 6, 2019
1 parent 98e99af commit 49320d4
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 16 deletions.
1 change: 1 addition & 0 deletions src/cpld.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ typedef struct {
// for the two different CPLD implementations
typedef struct {
const char *name;
const char *default_profile;
void (*init)(int cpld_version);
int (*get_version)();
void (*set_mode)(int mode7);
Expand Down
1 change: 1 addition & 0 deletions src/cpld_atom.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ static int cpld_get_delay() {
}
cpld_t cpld_atom = {
.name = "Atom",
.default_profile = "Atom_CPLD",
.init = cpld_init,
.get_version = cpld_get_version,
.calibrate = cpld_calibrate,
Expand Down
1 change: 1 addition & 0 deletions src/cpld_normal.c
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,7 @@ static int cpld_get_delay() {
}
cpld_t cpld_normal = {
.name = "Normal",
.default_profile = "BBC_Micro",
.init = cpld_init,
.get_version = cpld_get_version,
.calibrate = cpld_calibrate,
Expand Down
29 changes: 17 additions & 12 deletions src/osd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2118,7 +2118,9 @@ int osd_key(int key) {

}
set_status_message(msg);
load_profiles(get_feature(F_PROFILE), 1);
// Don't re-write profile.txt here - it was
// already written if the profile was changed
load_profiles(get_feature(F_PROFILE), 0);
break;
}
case I_RESTORE:
Expand Down Expand Up @@ -2202,7 +2204,7 @@ int osd_key(int key) {
}

void osd_init() {
char *prop = NULL;
const char *prop = NULL;
// Precalculate character->screen mapping table
//
// Normal size mapping, odd numbered characters
Expand Down Expand Up @@ -2433,19 +2435,22 @@ void osd_init() {
log_info("FOUND PROFILE: %s", profile_names[i]);
}
}
// The default profile is provided by the CPLD
prop = cpld->default_profile;
// It can be over-ridden by a local profile.txt file
cbytes = file_load("/profile.txt", config_buffer, MAX_CONFIG_BUFFER_SIZE);
if (cbytes) {
prop = get_prop_no_space(config_buffer, "profile");
if (prop) {
for (int i=0; i<count; i++) {
if (strcmp(profile_names[i], prop) == 0) {
set_profile(i);
load_profiles(i, 0);
process_profile(i);
set_feature(F_SUBPROFILE, 0);
log_info("Profile = %s", prop);
break;
}
}
if (prop) {
for (int i=0; i<count; i++) {
if (strcmp(profile_names[i], prop) == 0) {
set_profile(i);
load_profiles(i, 0);
process_profile(i);
set_feature(F_SUBPROFILE, 0);
log_info("Profile = %s", prop);
break;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/rgb_to_hdmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1640,7 +1640,7 @@ int get_paletteControl() {
return paletteControl;
}

void set_resolution(int mode, char *name, int reboot) {
void set_resolution(int mode, const char *name, int reboot) {
char osdline[80];
if (resolution != mode) {
if (osd_active()) {
Expand Down
2 changes: 1 addition & 1 deletion src/rgb_to_hdmi.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ void set_subprofile(int value);
int get_subprofile();
void set_paletteControl(int value);
int get_paletteControl();
void set_resolution(int mode, char *name, int reboot);
void set_resolution(int mode, const char *name, int reboot);
int get_resolution();
void set_interpolation(int mode, int reboot);
int get_interpolation();
Expand Down
3 changes: 1 addition & 2 deletions src/scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,12 @@ EOF

cp -a config.txt ${DIR}
cp -a default_config.txt ${DIR}
cp -a profile.txt ${DIR}
cp -a firmware/* ${DIR}
cp -a Profiles ${DIR}
cp -a Resolutions ${DIR}

cd releases/${NAME}
zip -qr ../${NAME}.zip `find . -type f | sort`
zip -qr ../${NAME}.zip .
cd ../..

unzip -l releases/${NAME}.zip

0 comments on commit 49320d4

Please sign in to comment.