Pi: Add GPIO controls to Raspberry Pi Haiku Loader
* When first32k.bin is added in front of haiku_loader, the OK led comes on verifying haiku_loader is actually running on the Pi.
This commit is contained in:
@@ -56,9 +56,6 @@ fi" ;
|
|||||||
|
|
||||||
HAIKU_BOARD_SDIMAGE_FILES =
|
HAIKU_BOARD_SDIMAGE_FILES =
|
||||||
haiku_loader
|
haiku_loader
|
||||||
haiku_loader.ub
|
|
||||||
haiku_loader_nbsd.ub
|
|
||||||
$(HAIKU_BOARD_SDIMAGE_UBOOT_SCRIPT_NAME)
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -30,6 +30,7 @@ KernelMergeObject boot_platform_raspberrypi_arm.o :
|
|||||||
cpu.cpp
|
cpu.cpp
|
||||||
debug.cpp
|
debug.cpp
|
||||||
devices.cpp
|
devices.cpp
|
||||||
|
gpio.cpp
|
||||||
keyboard.cpp
|
keyboard.cpp
|
||||||
menu.cpp
|
menu.cpp
|
||||||
mmu.cpp
|
mmu.cpp
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2011-2012 Haiku, Inc. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Alexander von Gluck, [email protected]
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "gpio.h"
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
gpio_init()
|
||||||
|
{
|
||||||
|
// Set up pointer to Raspberry Pi GPIO base
|
||||||
|
gGPIOBase = (volatile unsigned *)GPIO_BASE;
|
||||||
|
|
||||||
|
// Take control of general use pins, status led, uart
|
||||||
|
int pin = 0;
|
||||||
|
for (pin = 14; pin <= 25; pin++) {
|
||||||
|
GPIO_IN(pin);
|
||||||
|
GPIO_OUT(pin);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2011-2012 Haiku, Inc. All rights reserved.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Alexander von Gluck, [email protected]
|
||||||
|
*/
|
||||||
|
#ifndef _SYSTEM_BOOT_PLATFORM_PI_GPIO_H
|
||||||
|
#define _SYSTEM_BOOT_PLATFORM_PI_GPIO_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <arch/arm/bcm2708.h>
|
||||||
|
|
||||||
|
|
||||||
|
// Macros for easy GPIO pin access in loader
|
||||||
|
#define GPIO_IN(g) *(gGPIOBase + ((g)/10)) &= ~(7<<(((g)%10)*3))
|
||||||
|
#define GPIO_OUT(g) *(gGPIOBase + ((g)/10)) |= (1<<(((g)%10)*3))
|
||||||
|
#define GPIO_SET(g) *(gGPIOBase + 7) = (1<<g)
|
||||||
|
#define GPIO_CLR(g) *(gGPIOBase + 10) = (1<<g)
|
||||||
|
|
||||||
|
|
||||||
|
volatile unsigned *gGPIOBase;
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
void gpio_init();
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* _SYSTEM_BOOT_PLATFORM_PI_GPIO_H */
|
||||||
@@ -24,4 +24,4 @@ extern void serial_enable(void);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif /* _SYSTEM_BOOT_PLATFORM_ROUTERBOARD_MIPSEL_SERIAL_H */
|
#endif /* _SYSTEM_BOOT_PLATFORM_PI_SERIAL_H */
|
||||||
|
|||||||
@@ -5,11 +5,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "serial.h"
|
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
#include "mmu.h"
|
#include "gpio.h"
|
||||||
#include "keyboard.h"
|
#include "keyboard.h"
|
||||||
|
#include "mmu.h"
|
||||||
|
#include "serial.h"
|
||||||
|
|
||||||
#include <KernelExport.h>
|
#include <KernelExport.h>
|
||||||
#include <boot/platform.h>
|
#include <boot/platform.h>
|
||||||
@@ -33,6 +34,9 @@ extern int main(stage2_args *args);
|
|||||||
void _start(void);
|
void _start(void);
|
||||||
|
|
||||||
|
|
||||||
|
volatile unsigned *gGPIOBase;
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clear_bss(void)
|
clear_bss(void)
|
||||||
{
|
{
|
||||||
@@ -104,6 +108,11 @@ pi_start(void)
|
|||||||
call_ctors();
|
call_ctors();
|
||||||
|
|
||||||
cpu_init();
|
cpu_init();
|
||||||
|
gpio_init();
|
||||||
|
|
||||||
|
// Flick on "OK" led
|
||||||
|
GPIO_CLR(16);
|
||||||
|
|
||||||
mmu_init();
|
mmu_init();
|
||||||
serial_init();
|
serial_init();
|
||||||
console_init();
|
console_init();
|
||||||
|
|||||||
Reference in New Issue
Block a user