int start_main(void) { GeneralInitialise(); Gpio_SetMorse(36, true); Gpio_WordSpace(); Gpio_SetMorse(1, false); Gpio_SetPinDirection(RPI_STATUS, OUTPUT); SmallDelay(5); Gpio_Write(RPI_STATUS, SET); // Setting turns LED off. Gpio_DashDelay(); Gpio_FlashStatusLed(PAT_H, END_OF_WORD); // Atags_Init(); int result; int mode = MODE1024X768X24; do { result = InitFb(mode); } while(0 != result); Fb_ClearScreen(); struct ColourStructure colour; colour.red = 0xD0; // Sand D0C090 colour.green = 0xC0; // Button gray D4D0C8 colour.blue = 0x90; Fb_SetBackgroundColour(colour); colour.red = 0x30; colour.green = 0x30; colour.blue = 0x30; Fb_SetForegroundColour(colour); char putString[] = "Hello World!\n\r\n\rReady> "; Fb_WriteLine(putString); Gpio_SetMorse(1, false); Gpio_FlashStatusLed(PAT_V, END_OF_WORD); /* Start debug uint32_t* memory1 = AllocateMemory(0x10); char hexString[9]; Fb_WriteString("memory1: "); Fb_WriteLine(String_ConvertToHexString((uint32_t) memory1, hexString, 8)); FreeAllocatedMemory(memory1); Console_WriteMemoryBlockHex((uint32_t) &__bss_end__, (uint32_t) ((uint32_t*)(&__bss_end__) + 0x20)); // End debug */ Gpio_SetPinDirection(RPI_GPIO7_P7, INPUT); int morseBit; while(1) { morseBit = Gpio_Read(RPI_GPIO7_P7); if (0 == morseBit) { Gpio_Write(RPI_STATUS, N_SET); } else { Gpio_Write(RPI_STATUS, N_CLEAR); } } return 0; }
/* Returns true/false if initialization was successful */ bool VMware::InitHardware(void) { /* This has to be done first, otherwise we can't * access the SVGA registers */ if(!setupIoPorts()) { dbprintf("VMware - Failed to setup the IO ports.\n"); return false; } /*** Grab the SVGA Id ***/ m_regId = vmwareGetSvgaId(); if(m_regId == (uint32)SVGA_ID_2) { dbprintf("VMware - SVGA Id is SVGA_ID_2\n"); } else if(m_regId == (uint32)SVGA_ID_1) { dbprintf("VMware - SVGA Id is SVGA_ID_1\n"); return false; } else if(m_regId == (uint32)SVGA_ID_0) { dbprintf("VMware - SVGA Id is SVGA_ID_0\n"); return false; } else { dbprintf("VMware - SVGA Id is SVGA_ID_INVALID\n"); return false; } /*** Map the frame buffer and the command FIFO ***/ if(!CreateFb()) { dbprintf("VMware -Failed to map the frame buffer.\n"); return false; } dbprintf("VMware - Successfully mapped the frame buffer.\n"); if(!CreateFifo()) { dbprintf("VMware - Failed to map the command FIFO.\n"); return false; } dbprintf("VMware - Successfully mapped the command FIFO.\n"); /*** Initialize the FB ***/ if(!InitFb()) { dbprintf("VMware - Failed to initialized the frame buffer.\n"); return false; } dbprintf("VMware - Successfully initialized the frame buffer.\n"); /*** Initialize the command FIFO ***/ if(!InitFifo()) { dbprintf("VMware - Failed to initialized the command FIFO.\n"); return false; } dbprintf("VMware - Successfully initialized the command FIFO.\n"); /*** Initially disable hardware cursor ***/ vmwareWriteReg(SVGA_REG_CURSOR_X, 0); vmwareWriteReg(SVGA_REG_CURSOR_Y, 0); vmwareWriteReg(SVGA_REG_CURSOR_ON, SVGA_CURSOR_ON_HIDE); return true; }