#include <stdio.h>
#include <stdlib.h>
#include "startup.h"
#include "fpga_loader.h"
#include "bf52x_spi.h"
#include "ADP5588_Driver.h"
#include "crc.h"
#include "bf52x_uart.h"
#include "spi_flash.h"
#include "tll6527_core_timer.h"
Include dependency graph for fpga_loader.c:
Defines | |
#define | FPGA_SEC_SIZE (0x40000) |
Contains the FLASH start address for default FPGA load. | |
#define | FPGA_DEFAULT (0x80000) |
#define | FPGA_UART (0xD80000) |
#define | FPGA_DATA_LENGTH (283776) |
Size of the FPGA image. | |
#define | FPGA_CLOCK_SPEED 5000000 |
Functions | |
int | transfer (unsigned char *mem, unsigned long len) |
int | fpga_programmer (unsigned char *memaddr, unsigned long length) |
int | copyToRam (unsigned long Flashaddr, unsigned char *Ramaddr, unsigned long len) |
int | fpga_inputEnable (void) |
enable the inputs from only if the bits 0-7 are output and 8-15 are inputs. | |
int | fpga_loader (crc load_crc) |
Loads the fpga specified by the crc. | |
Variables | |
unsigned char | fpga_image [FPGA_DATA_LENGTH] |
FPGA images from the flash will be copied to this this temperory array for computing the CRC. |
#define FPGA_CLOCK_SPEED 5000000 |
#define FPGA_DATA_LENGTH (283776) |
Size of the FPGA image.
#define FPGA_DEFAULT (0x80000) |
#define FPGA_SEC_SIZE (0x40000) |
Contains the FLASH start address for default FPGA load.
#define FPGA_UART (0xD80000) |
int copyToRam | ( | unsigned long | Flashaddr, | |
unsigned char * | Ramaddr, | |||
unsigned long | len | |||
) |
int fpga_inputEnable | ( | void | ) |
enable the inputs from only if the bits 0-7 are output and 8-15 are inputs.
returns if sucessful or terminates.
Test if 0-7 bits are outputs
reinitialize
int fpga_loader | ( | crc | load_crc | ) |
Loads the fpga specified by the crc.
load_crc | The crc of the fpga to be loaded. returns: 0 on sucess or error code. |
Initializa the CRC engine.
Find the address which matches the CRC. If there is not match while returns with null
Copy the FPGA from FLASH to RAM
Compute the CRC of the FPGA
Check if the memory has the required CRC
Continue with the other address
Load the fpga
int fpga_programmer | ( | unsigned char * | memaddr, | |
unsigned long | length | |||
) |
int transfer | ( | unsigned char * | mem, | |
unsigned long | len | |||
) |
unsigned char fpga_image[FPGA_DATA_LENGTH] |
FPGA images from the flash will be copied to this this temperory array for computing the CRC.