Loadmodule emergency fix

This commit is contained in:
furrtek 2016-02-06 23:19:28 +01:00
parent 44d26d1789
commit ba94ce55ef
12 changed files with 52 additions and 43 deletions

View File

@ -105,14 +105,14 @@ void m4_switch(const char * hash) {
modhash = const_cast<char*>(hash);
// Ask M4 to enter wait loop in RAM
BasebandConfiguration baseband_switch {
.mode = 255, // DEBUG
/*BasebandConfiguration baseband_switch {
.mode = 255,
.sampling_rate = 0,
.decimation_factor = 1,
};
BasebandConfigurationMessage message { baseband_switch };
shared_memory.baseband_queue.push(message);
shared_memory.baseband_queue.push(message);*/
}
void m4_request_shutdown() {

View File

@ -192,7 +192,7 @@ LCRView::LCRView(
transmitter_model.set_baseband_configuration({
.mode = 1,
.sampling_rate = 1536000, // Is this right ?
.sampling_rate = 2280000, // Is this right ?
.decimation_factor = 1,
});
@ -323,7 +323,7 @@ LCRView::LCRView(
transmitter_model.enable();
};
button_txsetup.on_select = [&nav, &transmitter_model](Button&){
button_txsetup.on_select = [&nav](Button&){
nav.push(new AFSKSetupView { nav });
};

View File

@ -85,7 +85,7 @@ private:
Checkbox checkbox_am_a {
{ 16, 68 },
20,
0,
""
};
Button button_setam_a {
@ -94,7 +94,7 @@ private:
};
Checkbox checkbox_am_b {
{ 16, 68+40 },
20,
0,
""
};
Button button_setam_b {
@ -103,7 +103,7 @@ private:
};
Checkbox checkbox_am_c {
{ 16, 68+40+40 },
20,
0,
" "
};
Button button_setam_c {
@ -112,7 +112,7 @@ private:
};
Checkbox checkbox_am_d {
{ 16, 68+40+40+40 },
20,
0,
""
};
Button button_setam_d {
@ -121,7 +121,7 @@ private:
};
Checkbox checkbox_am_e {
{ 16, 68+40+40+40+40 },
20,
0,
""
};
Button button_setam_e {

View File

@ -35,7 +35,7 @@
#include <cstring>
#include <stdio.h>
using namespace hackrf::one;
using namespace portapack;
namespace ui {
@ -53,31 +53,20 @@ void LoadModuleView::on_hide() {
}
void LoadModuleView::on_show() {
// Ask for MD5 signature and compare
ModuleIDMessage message;
//message_map.unregister_handler(Message::ID::ModuleID);
char md5_signature[16];
uint8_t c;
EventDispatcher::message_map().register_handler(Message::ID::ModuleID,
[this](Message* const p) {
uint8_t c;
const auto message = static_cast<const ModuleIDMessage*>(p);
if (message->query == false) { // Shouldn't be needed
for (c=0;c<16;c++) {
if (message->md5_signature[c] != _hash[c]) break;
}
if (c == 16) {
text_info.set("Module already loaded :)");
_mod_loaded = true;
} else {
loadmodule();
}
}
}
);
message.query = true;
shared_memory.baseband_queue.push(message);
memcpy(md5_signature, (const void *)(0x10087FF0), 16);
for (c=0; c<16; c++) {
if (md5_signature[c] != _hash[c]) break;
}
if (c == 16) {
text_info.set("Module already loaded :)");
_mod_loaded = true;
} else {
text_info.set("Loading module");
loadmodule();
}
}
int LoadModuleView::load_image() {
@ -133,9 +122,11 @@ int LoadModuleView::load_image() {
void LoadModuleView::loadmodule() {
//message_map.unregister_handler(Message::ID::ReadyForSwitch);
EventDispatcher::message_map().register_handler(Message::ID::ReadyForSwitch,
m4_switch(_hash);
/*EventDispatcher::message_map().register_handler(Message::ID::ReadyForSwitch,
[this](Message* const p) {
(void)p;
(void)p;*/
if (load_image()) {
text_info.set(to_string_hex(*((unsigned int*)0x10080000),8));
//text_infob.set(to_string_hex(*((unsigned int*)0x10080004),8));
@ -145,10 +136,9 @@ void LoadModuleView::loadmodule() {
text_info.set("Module not found :(");
_mod_loaded = false;
}
}
);
// }
//);
m4_switch(_hash);
}
LoadModuleView::LoadModuleView(
@ -166,7 +156,7 @@ LoadModuleView::LoadModuleView(
_hash = hash;
button_ok.on_select = [this,&nav,new_view](Button&){
nav.pop();
//nav.pop();
if (_mod_loaded == true) nav.push(new_view);
};
}

Binary file not shown.

Binary file not shown.

View File

@ -123,6 +123,22 @@ void BasebandThread::run() {
delete baseband_buffer;
}
char ram_loop[32];
typedef int (*fn_ptr)(void);
fn_ptr loop_ptr;
void ram_loop_fn(void) {
while(1) {}
}
void BasebandThread::wait_for_switch(void) {
memcpy(&ram_loop[0], reinterpret_cast<char*>(&ram_loop_fn), 32);
loop_ptr = reinterpret_cast<fn_ptr>(&ram_loop[0]);
ReadyForSwitchMessage message;
shared_memory.application_queue.push(message);
(*loop_ptr)();
}
BasebandProcessor* BasebandThread::create_processor(const int32_t mode) {
switch(mode) {
case 0: return new NarrowbandAMAudio();
@ -132,6 +148,7 @@ BasebandProcessor* BasebandThread::create_processor(const int32_t mode) {
case 4: return new WidebandSpectrum();
case 5: return new TPMSProcessor();
case 6: return new ERTProcessor();
case 255: wait_for_switch();
default: return nullptr;
}
}

View File

@ -45,6 +45,8 @@ public:
return baseband::Direction::Receive;
}
void wait_for_switch(void);
Thread* thread_main { nullptr };
Thread* thread_rssi { nullptr };
BasebandProcessor* baseband_processor { nullptr };

View File

@ -1,2 +1,2 @@
const char md5_baseband[16] = {0xba,0x35,0x2a,0xd7,0x2c,0x17,0x40,0x68,0x54,0x8a,0x5f,0x9a,0x98,0x8b,0x9d,0x73,};
const char md5_baseband_tx[16] = {0x65,0x3a,0x50,0x6c,0xf4,0x93,0x69,0xce,0x8c,0x8d,0x3c,0xb6,0x9e,0x21,0xba,0xd8,};
const char md5_baseband[16] = {0x03,0x77,0xc0,0x0b,0x13,0x5b,0x84,0x72,0x8f,0x4b,0xbb,0x51,0x48,0x54,0x82,0xd3,};
const char md5_baseband_tx[16] = {0xa3,0xb9,0xd4,0x35,0xb5,0xe0,0x66,0x82,0xac,0x61,0x59,0xa1,0x27,0x36,0x0b,0xfe,};

Binary file not shown.

Binary file not shown.

Binary file not shown.