https://bitbucket.org/coutts/5dplus
Tip revision: 0d7cbec6dea8a278a468d89a5bf23bf5670a3172 authored by Coutts on 21 June 2012, 12:32:49 UTC
Fix font sizes (thanks Alex!) and fixed problem of bmp_buffer moving around, using a pointer to the bmp_vram now instead of the raw address. Also testing ML menu with skeleton shoot menu, not working yet though.
Fix font sizes (thanks Alex!) and fixed problem of bmp_buffer moving around, using a pointer to the bmp_vram now instead of the raw address. Also testing ML menu with skeleton shoot menu, not working yet though.
Tip revision: 0d7cbec
legacy.c
/*##################################################################################
# #
# _____ _ _ #
# | ___| | | | | #
# |___ \ __| |_ __ | |_ _ ___ #
# \ \/ _` | '_ \| | | | / __| #
# /\__/ / (_| | |_) | | |_| \__ \ #
# \____/ \__,_| .__/|_|\__,_|___/ #
# | | #
# |_| #
# #
#################################################################################*/
/*##################################################################################
#
# Legacy code from when I first got code running on the 5d. I used these
# functions to locate the read_bootflag() and write_bootflag() routines
# in the 5d bootloader even though I did not have a copy of the bootloader
# or any way to obtain a copy of it.
#
# I used the 400d bootloader as a guide for instructions / signatures to search
# for. These are useful for early porting efforts on other cameras where the
# bootflag is not yet enabled, and the developer can't use file i/o functions
# to dump the bootloader.
#
# - Coutts
#
#################################################################################*/
#include "vxworks.h"
//~ ASM instruction for this signature ==> "ADR R0, aErrorFlagAreaW"
//~ aErrorFlagAreaW string ==> "ERROR [Flag area write NG!!]\n\n"
#define ASM_SIG 0xE28F0F11
#define SLEEP_CONST 70000
/* sleep routine. may need to adjust SLEEP_CONST */
void sleep(int n)
{
int i,j;
static volatile int k = 0;
for (i = 0; i < n; i++)
for (j = 0; j < SLEEP_CONST; j++)
k++;
}
/* blink red led to represent binary 1 */
void blink1()
{
LEDBLUE = LEDON;
sleep(3);
LEDBLUE = LEDOFF;
sleep(6);
}
/* blink blue led to represent binary 0 */
void blink0()
{
LEDRED = LEDON;
sleep(3);
LEDRED = LEDOFF;
sleep(6);
}
//~ search a memory range for an ARM instruction. useful for locating functions via
//~ signature matching.
void searchmem()
{
int i;
for( i=0xFFFF0000; i<0xFFFFFFFF; i+=4 ) //~ range in memory to search in.
{
if( *(int*)i == ASM_SIG )
{
LEDBLUE = LEDON;
sleep(5);
LEDBLUE = LEDOFF;
sleep(5);
blinkaddr(i);
}
}
}
//~ blink a value (or address) through the LEDs (red = 0, blue = 1)
//~ - to blink out value at a location, pass the argument 'addr' as *(int*)some_location.
//~ - don't forget to reverse the endianness of the resulting binary number you record from this,
//~ otherwise none of the data will make sense!
void blinkaddr(int addr)
{
LEDRED = LEDON;
LEDBLUE = LEDON;
sleep(5);
LEDRED = LEDOFF;
LEDBLUE = LEDOFF;
sleep(5);
int i;
for( i=0; i<32; i++ )
{
if( ((addr >> i) & 1) )
{
blink1();
}
else
{
blink0();
}
}
sleep(10);
LEDRED = LEDON; //~ turn red LED on to let user know the routine is done.
while(1);
}