mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
refactoring
This commit is contained in:
parent
e80e4e3bfd
commit
df8e79f9e6
@ -33,7 +33,7 @@
|
||||
namespace portapack {
|
||||
namespace cpld {
|
||||
|
||||
uint32_t update_if_necessary(
|
||||
CpldUpdateStatus update_if_necessary(
|
||||
const Config config
|
||||
) {
|
||||
jtag::GPIOTarget target {
|
||||
@ -51,7 +51,7 @@ uint32_t update_if_necessary(
|
||||
|
||||
/* Run-Test/Idle */
|
||||
if( !cpld.idcode_ok() ) {
|
||||
return 1;
|
||||
return CpldUpdateStatus::Idcode_check_failed;
|
||||
}
|
||||
|
||||
cpld.sample();
|
||||
@ -62,7 +62,7 @@ uint32_t update_if_necessary(
|
||||
* in passive state.
|
||||
*/
|
||||
if( !cpld.silicon_id_ok() ) {
|
||||
return 2;
|
||||
return CpldUpdateStatus::Silicon_id_check_failed;
|
||||
}
|
||||
|
||||
/* Verify CPLD contents against current bitstream. */
|
||||
@ -86,7 +86,7 @@ uint32_t update_if_necessary(
|
||||
cpld.disable();
|
||||
}
|
||||
|
||||
return ok ? 0 : 3;
|
||||
return ok ? CpldUpdateStatus::Success : CpldUpdateStatus::Program_failed;
|
||||
}
|
||||
|
||||
} /* namespace cpld */
|
||||
|
@ -27,8 +27,14 @@
|
||||
namespace portapack {
|
||||
namespace cpld {
|
||||
|
||||
enum class CpldUpdateStatus {
|
||||
Success = 0,
|
||||
Idcode_check_failed = 1,
|
||||
Silicon_id_check_failed = 2,
|
||||
Program_failed = 3
|
||||
};
|
||||
|
||||
uint32_t update_if_necessary(
|
||||
CpldUpdateStatus update_if_necessary(
|
||||
const Config config
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user