Skip to content

Commit

Permalink
Optimise , add option to not wait for mailbox
Browse files Browse the repository at this point in the history
  • Loading branch information
dp111 committed Jun 3, 2022
1 parent db537a1 commit a89cfed
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
16 changes: 8 additions & 8 deletions src/Pi1MHz.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ static emulator_list emulator[] = {

uint8_t *JIM_ram; // 480M Bytes of RAM for pizero

uint32_t JIM_ram_size; // Size of JIM ram in 16Mbyte steps
uint8_t JIM_ram_size; // Size of JIM ram in 16Mbyte steps

// Memory for FRED and JIM
static uint8_t * const Pi1MHz_Memory = (uint8_t *)0x100;
Expand Down Expand Up @@ -271,7 +271,7 @@ static void init_emulator() {
RPI_PropertyAdd(DATABUS_TO_OUTPUTS); // r3
RPI_PropertyAdd(TEST_PINS_OUTPUTS); // r4
RPI_PropertyAdd(0); // r5 TEST_MASK
RPI_PropertyProcess();
RPI_PropertyProcess(false);

RPI_IRQBase->FIQ_control = 0x80 + 67; // doorbell FIQ

Expand Down Expand Up @@ -317,13 +317,13 @@ static void init_JIM()
extern char _end;

RPI_PropertySetWord(0x00038030,12,1); // Set domain 12 ISP
JIM_ram_size = mem_info(1); // get size of ram
JIM_ram_size = JIM_ram_size - (unsigned int)&_end; // remove program
JIM_ram_size = JIM_ram_size -( 4*1024*1024) ; // 4Mbytes for other mallocs
JIM_ram_size = JIM_ram_size & 0xFF000000; // round down to 16Mbyte boundary
JIM_ram_size = JIM_ram_size >> 24 ; // set to 16Mbyte sets
uint32_t temp = mem_info(1); // get size of ram
temp = temp - (unsigned int)&_end; // remove program
temp = temp -( 4*1024*1024) ; // 4Mbytes for other mallocs
temp = temp & 0xFF000000; // round down to 16Mbyte boundary
JIM_ram_size = (uint8_t)(temp >> 24) ; // set to 16Mbyte sets

fx_register[0] = (uint8_t)JIM_ram_size; // fx addr 0 returns ram size
fx_register[0] = JIM_ram_size; // fx addr 0 returns ram size

JIM_ram = (uint8_t *) malloc(16*1024*1024*JIM_ram_size); // malloc 480Mbytes

Expand Down
2 changes: 1 addition & 1 deletion src/Pi1MHz.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ nPCFD IO25 Pin 22 o o Pin 21 IO9 D7
#include <stdbool.h>
#include <stdint.h>
// JIM_ram_size is in 16Mbyte steps
extern uint32_t JIM_ram_size;
extern uint8_t JIM_ram_size;

extern uint8_t * JIM_ram;

Expand Down
2 changes: 1 addition & 1 deletion src/framebuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1402,7 +1402,7 @@ static void fb_initialize() {
RPI_PropertyNewTag(TAG_SET_PHYSICAL_SIZE,2); RPI_PropertyAddTwoWords(SCREEN_WIDTH, SCREEN_HEIGHT );
RPI_PropertyNewTag(TAG_SET_VIRTUAL_SIZE,2); RPI_PropertyAddTwoWords(SCREEN_WIDTH, SCREEN_HEIGHT *2 );
RPI_PropertyNewTag(TAG_SET_DEPTH,1); RPI_PropertyAdd(SCREEN_DEPTH);
RPI_PropertyProcess();
RPI_PropertyProcess(true);

if( ( mp = RPI_PropertyGet( TAG_ALLOCATE_BUFFER ) ) )
{
Expand Down
2 changes: 1 addition & 1 deletion src/ram_emulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void ram_emulator_page_addr(unsigned int gpio)

if ( addr == 0xfd)
{ if (data > (JIM_ram_size))
data = (uint8_t) JIM_ram_size;
data = JIM_ram_size;
page_ram_addr = (page_ram_addr & 0x00FFFFFF) | data<<24;
} else {
if ( addr == 0xfe)
Expand Down
1 change: 0 additions & 1 deletion src/rpi/block.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ struct emmc_block_dev
size_t block_size;
int use_sdma;
int card_removal;
uint32_t base_clock;
};


Expand Down
3 changes: 2 additions & 1 deletion src/rpi/mailbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#define PROP_SIZE 1024

#include "base.h"
#include <stdbool.h>

#define RPI_MAILBOX0_BASE ( PERIPHERAL_BASE + 0xB880 )
#define RPI_MAILBOX1_BASE ( PERIPHERAL_BASE + 0xB8A0 )
Expand Down Expand Up @@ -189,7 +190,7 @@ extern void RPI_PropertyStart(rpi_mailbox_tag_t tag, uint32_t length);
extern void RPI_PropertyNewTag(rpi_mailbox_tag_t tag, uint32_t length);
extern void RPI_PropertyAdd(uint32_t data);
extern void RPI_PropertyAddTwoWords(uint32_t data, uint32_t data2);
extern unsigned int RPI_PropertyProcess( void );
extern unsigned int RPI_PropertyProcess( bool wait );
extern void RPI_PropertyProcessNoCheck( void );
extern rpi_mailbox_property_t* RPI_PropertyGet( rpi_mailbox_tag_t tag );

Expand Down

0 comments on commit a89cfed

Please sign in to comment.