mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-12-24 23:09:26 -05:00
Merge pull request #956 from bernd-herzog/boot_improvements
removed need for cpld mode setup for QFP100
This commit is contained in:
commit
31031edbd1
@ -489,10 +489,13 @@ bool init() {
|
||||
|
||||
chThdSleepMilliseconds(10);
|
||||
|
||||
if( !portapack::cpld::update_if_necessary(portapack_cpld_config()) ) {
|
||||
portapack::cpld::CpldUpdateStatus result = portapack::cpld::update_if_necessary(portapack_cpld_config());
|
||||
if ( result == portapack::cpld::CpldUpdateStatus::Program_failed ) {
|
||||
|
||||
chThdSleepMilliseconds(10);
|
||||
// If using a "2021/12 QFP100", press and hold the left button while booting. Should only need to do once.
|
||||
if (load_config() != 3 && load_config() != 4){
|
||||
// Mode left (R1) and right (R2,H2,H2+) bypass going into hackrf mode after failing CPLD update
|
||||
// Mode center (autodetect), up (R1) and down (R2,H2,H2+) will go into hackrf mode after failing CPLD update
|
||||
if (load_config() != 3 /* left */ && load_config() != 4 /* right */){
|
||||
shutdown_base();
|
||||
return false;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@
|
||||
namespace portapack {
|
||||
namespace cpld {
|
||||
|
||||
bool update_if_necessary(
|
||||
CpldUpdateStatus update_if_necessary(
|
||||
const Config config
|
||||
) {
|
||||
jtag::GPIOTarget target {
|
||||
@ -51,7 +51,7 @@ bool update_if_necessary(
|
||||
|
||||
/* Run-Test/Idle */
|
||||
if( !cpld.idcode_ok() ) {
|
||||
return false;
|
||||
return CpldUpdateStatus::Idcode_check_failed;
|
||||
}
|
||||
|
||||
cpld.sample();
|
||||
@ -62,7 +62,7 @@ bool update_if_necessary(
|
||||
* in passive state.
|
||||
*/
|
||||
if( !cpld.silicon_id_ok() ) {
|
||||
return false;
|
||||
return CpldUpdateStatus::Silicon_id_check_failed;
|
||||
}
|
||||
|
||||
/* Verify CPLD contents against current bitstream. */
|
||||
@ -86,7 +86,7 @@ bool update_if_necessary(
|
||||
cpld.disable();
|
||||
}
|
||||
|
||||
return ok;
|
||||
return ok ? CpldUpdateStatus::Success : CpldUpdateStatus::Program_failed;
|
||||
}
|
||||
|
||||
} /* namespace cpld */
|
||||
|
@ -27,7 +27,14 @@
|
||||
namespace portapack {
|
||||
namespace cpld {
|
||||
|
||||
bool update_if_necessary(
|
||||
enum class CpldUpdateStatus {
|
||||
Success = 0,
|
||||
Idcode_check_failed = 1,
|
||||
Silicon_id_check_failed = 2,
|
||||
Program_failed = 3
|
||||
};
|
||||
|
||||
CpldUpdateStatus update_if_necessary(
|
||||
const Config config
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user