mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Merge pull request #924 from bernd-herzog/dfu_menu
added frame drop rate for m4 signal processing
This commit is contained in:
commit
15c9a76536
@ -35,7 +35,8 @@ DfuMenu::DfuMenu(NavigationView& nav) : nav_ (nav) {
|
|||||||
&text_info_line_4,
|
&text_info_line_4,
|
||||||
&text_info_line_5,
|
&text_info_line_5,
|
||||||
&text_info_line_6,
|
&text_info_line_6,
|
||||||
&text_info_line_7
|
&text_info_line_7,
|
||||||
|
&text_info_line_8
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,14 +49,16 @@ void DfuMenu::paint(Painter& painter) {
|
|||||||
text_info_line_4.set(to_string_dec_uint(shared_memory.m4_heap_usage, 6));
|
text_info_line_4.set(to_string_dec_uint(shared_memory.m4_heap_usage, 6));
|
||||||
text_info_line_5.set(to_string_dec_uint(shared_memory.m4_stack_usage, 6));
|
text_info_line_5.set(to_string_dec_uint(shared_memory.m4_stack_usage, 6));
|
||||||
text_info_line_6.set(to_string_dec_uint(shared_memory.m4_cpu_usage, 6));
|
text_info_line_6.set(to_string_dec_uint(shared_memory.m4_cpu_usage, 6));
|
||||||
text_info_line_7.set(to_string_dec_uint(chTimeNow()/1000, 6));
|
text_info_line_7.set(to_string_dec_uint(shared_memory.m4_buffer_missed, 6));
|
||||||
|
text_info_line_8.set(to_string_dec_uint(chTimeNow()/1000, 6));
|
||||||
|
|
||||||
constexpr auto margin = 5;
|
constexpr auto margin = 5;
|
||||||
|
constexpr auto lines = 8 + 2;
|
||||||
|
|
||||||
painter.fill_rectangle(
|
painter.fill_rectangle(
|
||||||
{
|
{
|
||||||
{6 * CHARACTER_WIDTH - margin, 3 * LINE_HEIGHT - margin},
|
{6 * CHARACTER_WIDTH - margin, 3 * LINE_HEIGHT - margin},
|
||||||
{15 * CHARACTER_WIDTH + margin * 2, 9 * LINE_HEIGHT + margin * 2}
|
{15 * CHARACTER_WIDTH + margin * 2, lines * LINE_HEIGHT + margin * 2}
|
||||||
},
|
},
|
||||||
ui::Color::black()
|
ui::Color::black()
|
||||||
);
|
);
|
||||||
@ -63,7 +66,7 @@ void DfuMenu::paint(Painter& painter) {
|
|||||||
painter.fill_rectangle(
|
painter.fill_rectangle(
|
||||||
{
|
{
|
||||||
{5 * CHARACTER_WIDTH - margin, 3 * LINE_HEIGHT - margin},
|
{5 * CHARACTER_WIDTH - margin, 3 * LINE_HEIGHT - margin},
|
||||||
{CHARACTER_WIDTH, 9 * LINE_HEIGHT + margin * 2}
|
{CHARACTER_WIDTH, lines * LINE_HEIGHT + margin * 2}
|
||||||
},
|
},
|
||||||
ui::Color::dark_cyan()
|
ui::Color::dark_cyan()
|
||||||
);
|
);
|
||||||
@ -71,7 +74,7 @@ void DfuMenu::paint(Painter& painter) {
|
|||||||
painter.fill_rectangle(
|
painter.fill_rectangle(
|
||||||
{
|
{
|
||||||
{21 * CHARACTER_WIDTH + margin, 3 * LINE_HEIGHT - margin},
|
{21 * CHARACTER_WIDTH + margin, 3 * LINE_HEIGHT - margin},
|
||||||
{CHARACTER_WIDTH, 9 * LINE_HEIGHT + margin * 2}
|
{CHARACTER_WIDTH, lines * LINE_HEIGHT + margin * 2}
|
||||||
},
|
},
|
||||||
ui::Color::dark_cyan()
|
ui::Color::dark_cyan()
|
||||||
);
|
);
|
||||||
@ -86,7 +89,7 @@ void DfuMenu::paint(Painter& painter) {
|
|||||||
|
|
||||||
painter.fill_rectangle(
|
painter.fill_rectangle(
|
||||||
{
|
{
|
||||||
{5 * CHARACTER_WIDTH - margin, 12 * LINE_HEIGHT + margin},
|
{5 * CHARACTER_WIDTH - margin, (lines+3) * LINE_HEIGHT + margin},
|
||||||
{17 * CHARACTER_WIDTH + margin * 2, 8}
|
{17 * CHARACTER_WIDTH + margin * 2, 8}
|
||||||
},
|
},
|
||||||
ui::Color::dark_cyan()
|
ui::Color::dark_cyan()
|
||||||
|
@ -54,7 +54,8 @@ private:
|
|||||||
{ { 6 * CHARACTER_WIDTH, 8 * LINE_HEIGHT }, "M4 heap:", Color::dark_cyan() },
|
{ { 6 * CHARACTER_WIDTH, 8 * LINE_HEIGHT }, "M4 heap:", Color::dark_cyan() },
|
||||||
{ { 6 * CHARACTER_WIDTH, 9 * LINE_HEIGHT }, "M4 stack:", Color::dark_cyan() },
|
{ { 6 * CHARACTER_WIDTH, 9 * LINE_HEIGHT }, "M4 stack:", Color::dark_cyan() },
|
||||||
{ { 6 * CHARACTER_WIDTH,10 * LINE_HEIGHT }, "M4 cpu %:", Color::dark_cyan() },
|
{ { 6 * CHARACTER_WIDTH,10 * LINE_HEIGHT }, "M4 cpu %:", Color::dark_cyan() },
|
||||||
{ { 6 * CHARACTER_WIDTH,11 * LINE_HEIGHT }, "uptime:", Color::dark_cyan() }
|
{ { 6 * CHARACTER_WIDTH,11 * LINE_HEIGHT }, "M4 miss:", Color::dark_cyan() },
|
||||||
|
{ { 6 * CHARACTER_WIDTH,12 * LINE_HEIGHT }, "uptime:", Color::dark_cyan() }
|
||||||
};
|
};
|
||||||
|
|
||||||
Text text_info_line_1 {{ 15 * CHARACTER_WIDTH, 5 * LINE_HEIGHT, 5 * CHARACTER_WIDTH, 1 * LINE_HEIGHT }, ""};
|
Text text_info_line_1 {{ 15 * CHARACTER_WIDTH, 5 * LINE_HEIGHT, 5 * CHARACTER_WIDTH, 1 * LINE_HEIGHT }, ""};
|
||||||
@ -64,6 +65,7 @@ private:
|
|||||||
Text text_info_line_5 {{ 15 * CHARACTER_WIDTH, 9 * LINE_HEIGHT, 5 * CHARACTER_WIDTH, 1 * LINE_HEIGHT }, ""};
|
Text text_info_line_5 {{ 15 * CHARACTER_WIDTH, 9 * LINE_HEIGHT, 5 * CHARACTER_WIDTH, 1 * LINE_HEIGHT }, ""};
|
||||||
Text text_info_line_6 {{ 15 * CHARACTER_WIDTH,10 * LINE_HEIGHT, 5 * CHARACTER_WIDTH, 1 * LINE_HEIGHT }, ""};
|
Text text_info_line_6 {{ 15 * CHARACTER_WIDTH,10 * LINE_HEIGHT, 5 * CHARACTER_WIDTH, 1 * LINE_HEIGHT }, ""};
|
||||||
Text text_info_line_7 {{ 15 * CHARACTER_WIDTH,11 * LINE_HEIGHT, 5 * CHARACTER_WIDTH, 1 * LINE_HEIGHT }, ""};
|
Text text_info_line_7 {{ 15 * CHARACTER_WIDTH,11 * LINE_HEIGHT, 5 * CHARACTER_WIDTH, 1 * LINE_HEIGHT }, ""};
|
||||||
|
Text text_info_line_8 {{ 15 * CHARACTER_WIDTH,12 * LINE_HEIGHT, 5 * CHARACTER_WIDTH, 1 * LINE_HEIGHT }, ""};
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace ui */
|
} /* namespace ui */
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "baseband_dma.hpp"
|
#include "baseband_dma.hpp"
|
||||||
|
#include "portapack_shared_memory.hpp"
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
@ -103,8 +104,12 @@ static constexpr auto& gpdma_channel_sgpio = gpdma::channels[portapack::sgpio_gp
|
|||||||
|
|
||||||
static ThreadWait thread_wait;
|
static ThreadWait thread_wait;
|
||||||
|
|
||||||
|
volatile uint32_t buffer_transfered = 0;
|
||||||
|
volatile uint32_t buffer_handled = 0;
|
||||||
|
|
||||||
static void transfer_complete() {
|
static void transfer_complete() {
|
||||||
const auto next_lli_index = gpdma_channel_sgpio.next_lli() - &lli_loop[0];
|
const auto next_lli_index = gpdma_channel_sgpio.next_lli() - &lli_loop[0];
|
||||||
|
buffer_transfered++;
|
||||||
thread_wait.wake_from_interrupt(next_lli_index);
|
thread_wait.wake_from_interrupt(next_lli_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,6 +163,10 @@ void disable() {
|
|||||||
|
|
||||||
baseband::buffer_t wait_for_buffer() {
|
baseband::buffer_t wait_for_buffer() {
|
||||||
const auto next_index = thread_wait.sleep();
|
const auto next_index = thread_wait.sleep();
|
||||||
|
buffer_handled++;
|
||||||
|
|
||||||
|
auto buffer_missed = buffer_transfered - buffer_handled;
|
||||||
|
shared_memory.m4_buffer_missed = buffer_missed;
|
||||||
|
|
||||||
if( next_index >= 0 ) {
|
if( next_index >= 0 ) {
|
||||||
const size_t free_index = (next_index + transfers_per_buffer - 2) & transfers_mask;
|
const size_t free_index = (next_index + transfers_per_buffer - 2) & transfers_mask;
|
||||||
|
@ -69,6 +69,7 @@ struct SharedMemory {
|
|||||||
uint8_t volatile m4_cpu_usage{ 0 };
|
uint8_t volatile m4_cpu_usage{ 0 };
|
||||||
uint16_t volatile m4_stack_usage{ 0 };
|
uint16_t volatile m4_stack_usage{ 0 };
|
||||||
uint16_t volatile m4_heap_usage{ 0 };
|
uint16_t volatile m4_heap_usage{ 0 };
|
||||||
|
uint16_t volatile m4_buffer_missed{ 0 };
|
||||||
};
|
};
|
||||||
|
|
||||||
extern SharedMemory& shared_memory;
|
extern SharedMemory& shared_memory;
|
||||||
|
Loading…
Reference in New Issue
Block a user