URL
https://opencores.org/ocsvn/gecko3/gecko3/trunk
Subversion Repositories gecko3
Compare Revisions
- This comparison shows the changes necessary to convert path
/gecko3/trunk/GECKO3COM/gecko3com-fw/firmware
- from Rev 29 to Rev 32
- ↔ Reverse comparison
Rev 29 → Rev 32
/include/gecko3com_regs.h
117,13 → 117,13
/* define pinning of the GPIF interface RDY signals |
accessible in the GPIFREADYSTAT register */ |
#define bmWRX bmBIT0 /**< GPIFREADYSTAT bitmask to access Write Request Xilinx */ |
#define bmRDYX bmBIT1 /**< GPIFREADYSTAT bitmask to access ReDY Xilinx |
#define bmRDYX bmBIT1 /**< GPIFREADYSTAT bitmask to access ReDY Xilinx */ |
|
/* define pinning of the GPIF interface CTL signals |
accessible while the GPIF is in the IDLE state through the |
GPIFIDLECTL register */ |
#define bmWRU bmBIT1 /**< GPIFREADYSTAT bitmask to access Write Request Xilinx */ |
#define bmRDYU bmBIT2 /**< GPIFREADYSTAT bitmask to access ReDY Xilinx |
#define bmRDYU bmBIT2 /**< GPIFREADYSTAT bitmask to access ReDY Xilinx */ |
|
/* |
* Port A (bit addressable): |
/include/spi.h
27,7 → 27,7
* |
* \details Library to communicate with SPI devices |
* |
* \author GNU Radio guys |
* \author GNU Radio team |
* |
* \note to use this SPI library you have to define the following |
* keywords in your pinmapping header file. For GECKO3COM |
54,10 → 54,10
/* |
* SPI_FMT_* goes in wIndexL |
*/ |
#define bmSPI_FORMAT 0x80 |
#define bmSPI_FORMAT 0x80 /**< bitmask to work on the format */ |
# define bmSPI_FORMAT_LSB 0x80 /**< least signficant bit first */ |
# define bmSPI_FORMAT_MSB 0x00 /**< most significant bit first */ |
#define bmSPI_HEADER 0x60 |
#define bmSPI_HEADER 0x60 /**< bits to select the header bytes */ |
# define bmSPI_HEADER_0 0x00 /**< 0 header bytes */ |
# define bmSPI_HEADER_1 0x20 /**< 1 header byte */ |
# define bmSPI_HEADER_2 0x40 /**< 2 header bytes */ |
67,13 → 67,13
void init_spi (void); |
|
/** \brief basic function to read data from the SPI bus |
* \param[in] unsigned char header_hi, high byte of the header to send |
* \param[in[ unsigned char header_lo, low byte of the header to send |
* \param[in] unsigned char enables, bitmask with the correct device selected |
* \param[in] unsigned char format, bitmask byte to select byte order |
* and number of header bytes |
* \param[out]*buf pointer to a buffer to write the received data in it |
* \param[in] unsigned char len, number of bytes to be read from bus |
* \param[in] header_hi high byte of the header to send |
* \param[in] header_lo low byte of the header to send |
* \param[in] enables bitmask with the correct device selected |
* \param[in] format bitmask byte to select byte order |
* and number of header bytes |
* \param[out] *buf pointer to a buffer to write the received data in it |
* \param[in] len number of bytes to be read from bus |
* |
* \return returns non-zero if successful, else 0 */ |
unsigned char |
82,13 → 82,13
xdata unsigned char *buf, unsigned char len); |
|
/** \brief basic function to write data to the SPI bus |
* \param[in] unsigned char header_hi, high byte of the header to send |
* \param[in[ unsigned char header_lo, low byte of the header to send |
* \param[in] unsigned char enables, bitmask with the correct device selected |
* \param[in] unsigned char format, bitmask byte to select byte order |
* \param[in] header_hi high byte of the header to send |
* \param[in] header_lo low byte of the header to send |
* \param[in] enables bitmask with the correct device selected |
* \param[in] format bitmask byte to select byte order |
* and number of header bytes |
* \param[in]*buf pointer to a buffer which holds the data to send |
* \param[in] unsigned char len, number of bytes to be written to the bus |
* \param[in] *buf pointer to a buffer which holds the data to send |
* \param[in] len number of bytes to be written to the bus |
* |
* \return returns non-zero if successful, else 0 */ |
unsigned char |
/include/gecko3com_commands.h
43,13 → 43,16
|
#include <gecko3com_interfaces.h> |
|
#define MAX_EP0_PKTSIZE 64 /* max size of EP0 packet on FX2 */ |
#define MAX_EP0_PKTSIZE 64 /**< max size of EP0 packet on FX2 */ |
|
/* ---------------------------------------------------------------- |
* Vendor bmRequestType's |
* --------------------------------------------------------------*/ |
|
#define VRT_VENDOR_IN 0xC0 |
/** bmRequestType for a IN vendor specific command */ |
#define VRT_VENDOR_IN 0xC0 |
|
/** bmRequestType for a OUT vendor specific command */ |
#define VRT_VENDOR_OUT 0x40 |
|
/* ---------------------------------------------------------------- |
67,13 → 70,13
|
/* OUT commands */ |
|
#define VRQ_SET_SERIAL 0x01 |
#define VRQ_SET_SERIAL 0x01 /**< set serial number */ |
|
#define VRQ_SET_HW_REV 0x02 |
#define VRQ_SET_HW_REV 0x02 /**< set hardware revision */ |
|
#define VRQ_SET_FPGA_TYPE 0x03 |
#define VRQ_SET_FPGA_TYPE 0x03 /**< set fpga type */ |
|
#define VRQ_SET_FPGA_IDCODE 0x04 |
#define VRQ_SET_FPGA_IDCODE 0x04 /**< set fpga jtag idcode */ |
|
|
#endif /* _GECKO3COM_COMMANDS_H_ */ |
/include/usb_tmc.h
50,12 → 50,17
|
|
/* USBTMC MsgID. Values, Ref.: Table 2 */ |
#define DEV_DEP_MSG_OUT 1 /**< device dependent command message */ |
#define REQUEST_DEV_DEP_MSG_IN 2 /**< command message that requests the device to send a USBTMC response */ |
#define DEV_DEP_MSG_IN 2 /**< response message to the REQUEST_DEV_DEP_MSG_IN */ |
#define VENDOR_SPECIFIC_OUT 126 /**< vendor specific command message */ |
#define REQUEST_VENDOR_SPECIFIC_IN 127 /**< command message that requests the device to send a vendor specific USBTMC response */ |
#define VENDOR_SPECIFIC_IN 127 /**< response message to the REQUEST_VENDOR_SPECIFIC_IN */ |
#define DEV_DEP_MSG_OUT 1 /**< device dependent command message */ |
#define REQUEST_DEV_DEP_MSG_IN 2 /**< command message that requests the |
device to send a USBTMC response */ |
#define DEV_DEP_MSG_IN 2 /**< response message to the |
REQUEST_DEV_DEP_MSG_IN */ |
#define VENDOR_SPECIFIC_OUT 126 /**< vendor specific command message */ |
#define REQUEST_VENDOR_SPECIFIC_IN 127 /**< command message that requests the |
device to send a vendor specific |
USBTMC response */ |
#define VENDOR_SPECIFIC_IN 127 /**< response message to the |
REQUEST_VENDOR_SPECIFIC_IN */ |
|
|
/* format of bmRequestType byte */ |
137,8 → 142,10
uint32_t TransferSize; |
int8_t bmTransferAttributes; |
int8_t Reserved[3]; |
} DEV_DEP_MSG_OUT_Header, /**< \brief Bulk-OUT Header for a DEV_DEP_MSG, Ref.: Table 3 */ |
DEV_DEP_MSG_IN_Header; /**< \brief Bulk-IN Header for a DEV_DEP_MSG, Ref.: Table 9 */ |
} DEV_DEP_MSG_OUT_Header, /**< Bulk-OUT Header for a DEV_DEP_MSG, |
Ref.: Table 3 */ |
DEV_DEP_MSG_IN_Header; /**< Bulk-IN Header for a DEV_DEP_MSG, |
Ref.: Table 9 */ |
|
/** \brief Structure to handle USBTMC device dependent message IN requests. |
* |
157,12 → 164,12
{ |
uint32_t TransferSize; |
int8_t Reserved[4]; |
} VENDOR_SPECIFIC_OUT_Header, /**< \brief structure to handle vendor specific |
} VENDOR_SPECIFIC_OUT_Header, /**< structure to handle vendor specific |
*IN/OUT or REQUESTS according to Ref.: Table 5 */ |
REQUEST_VENDOR_SPECIFIC_IN_Header, /**< \brief structure to handle vendor |
REQUEST_VENDOR_SPECIFIC_IN_Header, /**< structure to handle vendor |
* specific IN/OUT or REQUESTS according |
* Ref.: Table 6 */ |
VENDOR_SPECIFIC_IN_Header; /**< \brief structure to handle vendor specific |
VENDOR_SPECIFIC_IN_Header; /**< structure to handle vendor specific |
* IN/OUT or REQUESTS according Ref.: Table 10 */ |
|
/** \brief general Header structure for USBTMC bulk messages. The MsgID value |
225,9 → 232,12
typedef struct { |
uint8_t bTag; /**< contains the bTag value of the currently active transfer */ |
uint32_t transfer_size; |
uint8_t new_transfer; /**< flag to signal the start of a new transfer, else 0 */ |
uint32_t nbytes_rxd; /**< contains the number of bytes received in active tmc OUT transfer */ |
uint32_t nbytes_txd; /**< contains the number of bytes transmitted in active tmc IN transfer */ |
uint8_t new_transfer; /**< flag to signal the start of a new transfer, |
else 0 */ |
uint32_t nbytes_rxd; /**< contains the number of bytes received in active |
tmc OUT transfer */ |
uint32_t nbytes_txd; /**< contains the number of bytes transmitted in active |
tmc IN transfer */ |
|
} TMC_Transfer_Info; |
|
240,10 → 250,15
|
|
/* Global variables */ |
extern volatile static TMC_Status usb_tmc_status; /**< Global variable contains the status of the last tmc operation. normally USB_TMC_SUCCESS */ |
extern volatile TMC_State usb_tmc_state; /**< Global variable contains the state of the tmc system. Example USB_TMC_IDLE or USB_TMC_IN_TRANSFER */ |
extern volatile idata TMC_Transfer_Info usb_tmc_transfer; /** Global struct to hold all usb tmc transfer relevant information */ |
extern volatile idata IEEE488_status_registers ieee488_status; /**< Struct that contains all status and enable registers for the IEEE488 status reporting capabilities */ |
extern volatile static TMC_Status usb_tmc_status; /**< Global variable |
contains the status of the last tmc operation. normally USB_TMC_SUCCESS */ |
extern volatile TMC_State usb_tmc_state; /**< Global variable contains |
the state of the tmc system. Example USB_TMC_IDLE or USB_TMC_IN_TRANSFER */ |
extern volatile idata TMC_Transfer_Info usb_tmc_transfer; /**< Global struct |
to hold all usb tmc transfer relevant information */ |
extern volatile idata IEEE488_status_registers ieee488_status; /**< Struct |
that contains all status and enable registers for the IEEE488 status reporting |
capabilities */ |
|
|
/** Makro to check if this setup package is a USBTMC request */ |
269,10 → 284,12
/** \brief clears all global variables to known states. sets the POWER_ON bit */ |
void init_usb_tmc(); |
|
/** set the mav bit (Message available or "Queue not empty") in the IEEE488 status structure */ |
/** set the mav bit (Message available or "Queue not empty") in the IEEE488 |
status structure */ |
#define IEEE488_set_mav() (ieee488_status.StatusByteRegister |= 0x10) |
|
/** clear the mav bit (Message available or "Queue not empty") in the IEEE488 status structure */ |
/** clear the mav bit (Message available or "Queue not empty") in the IEEE488 |
status structure */ |
#define IEEE488_clear_mav() (ieee488_status.StatusByteRegister &= 0xEF) |
|
/** \brief evalutates the status IEEE488 status byte. represents the current |
288,4 → 305,4
*/ |
uint8_t IEEE488_status_query(idata IEEE488_status_registers *status); |
|
#endif |
#endif /* _USBTMC_H_ */ |
/include/delay.h
35,7 → 35,7
|
/** |
* delay for approximately usecs microseconds |
* \param[in] unsigned char usecs number of microseconds to wait |
* \param[in] usecs number of microseconds to wait |
* \warning limit of 255 usecs. |
*/ |
void udelay (unsigned char usecs); |
42,7 → 42,7
|
/** |
* delay for approximately msecs milliseconds |
* \param[in] unsigned short msecs number of milliseconds to wait |
* \param[in] msecs number of milliseconds to wait |
*/ |
void mdelay (unsigned short msecs); |
|
/include/debugprint.h
56,6 → 56,7
/** print debug information */ |
#define print_info(String) ser_printString("INFO: "); printf_tiny(String) |
#else |
/** print debug information */ |
#define print_info(String) |
#endif |
|
63,13 → 64,15
/** print debug warnings */ |
#define print_warn(String) ser_printString("WARNING: "); printf_tiny(String) |
#else |
/** print debug warnings */ |
#define print_warn(String) |
#endif |
|
#ifdef DEBUG_LEVEL_ERROR |
/* print debug errors */ |
/** print debug errors */ |
#define print_err(String) ser_printString("ERROR: "); printf_tiny(String) |
#else |
/** print debug errors */ |
#define print_err(String) |
#endif |
|
/include/gecko3com_i2c.h
44,13 → 44,18
/** |
* offsets into boot eeprom for configuration values |
*/ |
#define FPGA_TYPE_OFFSET 0x3FDD /**< ASCII string with the fpga type as it is in the bit file */ |
#define FPGA_TYPE_LEN 16 |
#define FPGA_IDCODE_OFFSET 0x3FED /**< the JTAG chip IDCODE is a 32 bit integer stored as 0x11223344 */ |
#define FPGA_IDCODE_LEN 10 |
/** ASCII string with the fpga type as it is in the bit file */ |
#define FPGA_TYPE_OFFSET 0x3FDD |
#define FPGA_TYPE_LEN 16 /**< length of the FPGA type string */ |
|
/** the JTAG chip IDCODE is a 32 bit integer stored as 0x11223344 */ |
#define FPGA_IDCODE_OFFSET 0x3FED |
#define FPGA_IDCODE_LEN 10 /**< length of the IDCODE string */ |
|
/** the hardware revision of this board, one char */ |
#define HW_REV_OFFSET 0x3FF7 |
#define SERIAL_NO_OFFSET 0x3FF8 |
#define SERIAL_NO_LEN 8 |
#define SERIAL_NO_OFFSET 0x3FF8 /**< place to store the serial number */ |
#define SERIAL_NO_LEN 8 /**< length of the serial number string */ |
|
#endif /* INCLUDED_GECKO3COM_I2C_H */ |
|
/include/spi_flash.h
52,8 → 52,8
* |
*/ |
|
#ifndef SPI_FLASH /* prevent circular inclusions */ |
#define SPI_FLASH /* by using protection macros */ |
#ifndef _SPI_FLASH_H_ /* prevent circular inclusions */ |
#define _SPI_FLASH_H_ |
|
#include <stdint.h> |
//#include "spi.h" |
91,17 → 91,17
#define MEMCAPACITY_32MBIT_SPA 0x15 /**< 32 MBit memory capacity */ |
|
|
#define MAXADRESS_8MBIT 0x0FFFFF |
#define MAXADRESS_8MBIT 0x0FFFFF /**< 8 Mbit device highest usable Adress */ |
#define FLASH_SIZE_8MBIT (0x0100000) /**< Total 8 Mbit device size in Bytes */ |
#define FLASH_PAGE_COUNT_8MBIT (0x01000) /**< Total 8 Mbit device size in Pages */ |
#define FLASH_SECTOR_COUNT_8MBIT (0x10) /**< Total 8 Mbit device size in Sectors */ |
|
#define MAXADRESS_16MBIT 0x1FFFFF |
#define MAXADRESS_16MBIT 0x1FFFFF /**< 16 Mbit device highest usable Adress */ |
#define FLASH_SIZE_16MBIT (0x0200000) /**< Total 16 Mbit device size in Bytes */ |
#define FLASH_PAGE_COUNT_16MBIT (0x02000) /**< Total 16 Mbit device size in Pages */ |
#define FLASH_SECTOR_COUNT_16MBIT (0x20) /**< Total 16 Mbit device size in Sectors */ |
|
#define MAXADRESS_32MBIT 0x3FFFFF |
#define MAXADRESS_32MBIT 0x3FFFFF /**< 32 Mbit device highest usable Adress */ |
#define FLASH_SIZE_32MBIT (0x0400000) /**< Total 32 Mbit device size in Bytes */ |
#define FLASH_PAGE_COUNT_32MBIT (0x04000) /**< Total 32 Mbit device size in Pages */ |
#define FLASH_SECTOR_COUNT_32MBIT (0x40) /**< Total 32 Mbit device size in Sectors */ |
183,7 → 183,9
*/ |
#define pageEnd(adr) ((adr) | 0x000000FF) |
|
|
/** This struct contains all the needed information about the detected flash |
* chip (limits, memory structure,...) to work with it. |
* Is filled during init */ |
extern SPI_flash xdata flash_dr; |
|
/************************** Function Prototypes ******************************/ |
207,14 → 209,14
|
/** \brief Reads data from the SPI flash |
* |
* \param[in] xdata SPI_flash flashPtr pointer to an SPI_flash struct |
* \param[in] xdata uint32_t *adress pointer to the flash start adress to read |
* from |
* \param[out] xdata uint8_t *buffer, pointer to a buffer to write the data into |
* \param[in] length of the data to read |
* \return returns non-zero if successful, else 0 |
* \param[in] flashPtr pointer to an SPI_flash struct |
* \param[in] *adress pointer to the flash start adress to read from |
* \param[out] *buffer pointer to a buffer to write the data into |
* \param[in] length length of the data to read |
* \return returns non-zero if successful, else 0 |
*/ |
int8_t spiflash_read(xdata SPI_flash *flashPtr, xdata uint32_t *adress, xdata uint8_t *buffer, const idata uint16_t length); |
int8_t spiflash_read(xdata SPI_flash *flashPtr, xdata uint32_t *adress, \ |
xdata uint8_t *buffer, const idata uint16_t length); |
|
|
/** \brief deletes the whole SPI flash |
249,8 → 251,5
*/ |
int8_t spiflash_write(xdata SPI_flash *flashPtr, xdata uint32_t *adress, xdata uint8_t *buffer, uint16_t length); |
|
#ifdef __cplusplus |
} |
#endif |
|
#endif |
#endif /* _SPI_FLASH_H_ */ |
/include/scpi_parser.h
81,11 → 81,11
* implemented (due to memory restrictions) and all of them are handled in |
* the parser. Device dependent commands are handled outside of the parser. |
* |
* \param[in] idata uint16_t *offset pointer to the offset, buffer[offset] is |
* \param[in] *offset pointer to the offset, buffer[offset] is |
* the current position, anything before this is already consumed. |
* \param[in] xdata Scanner *s a Scanner struct with the member *source set to |
* \param[in] *s a Scanner struct with the member *source set to |
* the start of the scpi message |
* \param[in] xdata TMC_Response_Queue *queue pointer to a TMC_Response_Queue |
* \param[in] *queue pointer to a TMC_Response_Queue |
* \return Status value, 0 if an error occoured in this case the error is |
* written to the IEEE488 event register. */ |
int8_t scpi_scan(idata uint16_t *offset, xdata Scanner *s, xdata TMC_Response_Queue *queue); |
/include/i2c.h
37,7 → 37,7
/** |
* i2c read function. reads a block of data with the length len |
* |
* \param[in] i2c_addr device adress on the i2c bus |
* \param[in] addr device adress on the i2c bus |
* \param[out] buf result buffer, contains the readed data when successful |
* \param[in] len length of the block to read |
* \return returns non-zero if successful, else 0 |
47,7 → 47,7
/** |
* i2c write function. writes a block of data with the length len |
* |
* \param[in] i2c_addr device adress on the i2c bus |
* \param[in] addr device adress on the i2c bus |
* \param[in] buf data buffer, contains the data to be written |
* \param[in] len length of the block to write |
* \return returns non-zero if successful, else 0 |
/include/gecko3com_gpif.h
37,10 → 37,13
#ifndef INCLUDED_GECKO3COM_GPIF_H |
#define INCLUDED_GECKO3COM_GPIF_H |
|
/** signal that a read (data flows from the FPGA to the FX2) in in progress */ |
#define bmGPIF_READ_IN_PROGRESS 1 |
|
#define bmGPIF_READ_IN_PROGRESS 1 |
/** signal that there is data waiting in the OUT fifo to be handled */ |
#define bmGPIF_PENDING_DATA 2 |
|
|
/** flag to signal, that the GPIF receives data from the FPGA */ |
volatile static idata uint8_t flGPIF; |
|
/include/fx2utils.h
37,16 → 37,17
void fx2_stall_ep0 (void); |
|
/** |
* Resets the data toggle bit of the endpoint ep |
* \brief Resets the data toggle bit of the endpoint ep |
* |
* \detail A description of the function and purpose of the toggle bit and |
when the firmware has to reset it is in the EZ-USB Technical |
Reference Manual. Chapter 8 Page 16 |
* A description of the function and purpose of the toggle bit and |
* when the firmware has to reset it is in the EZ-USB Technical |
* Reference Manual. Chapter 8 Page 16 |
* \param[in] ep Endpoint number |
*/ |
void fx2_reset_data_toggle (unsigned char ep); |
|
/* Renumerate the FX2. This means a disconnect and reconnect from the USB bus */ |
/** \brief Renumerate the FX2. |
* This means a disconnect and reconnect from the USB bus */ |
void fx2_renumerate (void); |
|
|
/include/gecko3com_common.h
41,8 → 41,8
#include "i2c.h" |
#include "gecko3com_i2c.h" |
|
#define TRUE 1 |
#define FALSE 0 |
#define TRUE 1 /**< TRUE */ |
#define FALSE 0 /**< FALSE */ |
|
/* Defines for LED output colors */ |
#define RED 0x02 /**< Switch bi-color LED to RED */ |
50,14 → 50,16
#define ORANGE 0x06 /**< Switch bi-color LED to ORANGE */ |
#define LEDS_OFF 0x00 /**< Switch bi-color LED off */ |
|
/** flag to store the state of the LED */ |
extern volatile uint8_t flLED; |
|
|
/* defines and global variable for context switching between EZ-USB and GPIF/FPGA */ |
#define GECKO3COM_LOCAL 0 /** firmware parses commands */ |
#define GECKO3COM_REMOTE 1 /** no commands parsed, data passed to fpga */ |
#define GECKO3COM_LOCAL 0 /**< firmware parses commands */ |
#define GECKO3COM_REMOTE 1 /**< no commands parsed, data passed to fpga */ |
|
extern volatile uint8_t flLOCAL; /**< flag to signal who interpretes TMC messages */ |
/** flag to signal who interpretes TMC messages */ |
extern volatile uint8_t flLOCAL; |
|
|
|
/lib/ser.c
61,10 → 61,6
* Initializes the UART for the serial Port 0 with 115,2 Kbaud, 1 start, |
* 1 stop and no parity bit. |
************************************************************************* |
* \param[in] |
* \param[out] |
* \return |
************************************************************************* |
* \author Christoph Zimmermann, SDCC Team |
* \date 21.Nov.2008 |
************************************************************************/ |
162,7 → 158,7
/************************************************************************/ |
/** \brief receives one char from the serial line |
************************************************************************* |
* \return receive character |
* \return received character |
************************************************************************* |
* \author Christoph Zimmermann, SDCC Team |
* \date 21.Nov.2008 |
187,7 → 183,7
/************************************************************************/ |
/** \brief sends a string of characters over the serial line |
************************************************************************* |
* \param[in] string to send |
* \param[in] *String string to send |
************************************************************************* |
* \author Christoph Zimmermann, SDCC Team |
* \date 21.Nov.2008 |
/src/eeprom_io.c
36,10 → 36,12
#include "delay.h" |
#include "debugprint.h" |
|
#define EEPROM_HIGH_ADDR 0x3FFF |
#define PAGE_LEN 0x40 |
#define PAGE_START_MASK 0xFFC0 |
#define PAGE_MASK 0x003F |
#define EEPROM_HIGH_ADDR 0x3FFF /**< highest available addres, length */ |
#define PAGE_LEN 0x40 /**< lenght of a memory page */ |
/** bit mask to get the corresponding page start adress */ |
#define PAGE_START_MASK 0xFFC0 |
/** bit mask to select the adress inside a memory page */ |
#define PAGE_MASK 0x003F |
|
|
/* returns non-zero if successful, else 0 */ |
/src/gecko3com_main.c
69,18 → 69,28
#include "ser.h" |
#endif |
|
/* -------------------------------------------------------------------- */ |
/* -------------------------------------------------------------------------- */ |
|
#define WATCHDOG_TIME 100 /**< time until the watchdog times out, 100 equals 1 second */ |
|
/* Global variables */ |
volatile uint8_t watchdog_count = WATCHDOG_TIME; |
idata int32_t file_size; |
xdata uint32_t flash_adress; |
xdata unsigned char *buffer; |
xdata TMC_Response_Queue response_queue; |
|
/* Global variables --------------------------------------------------------- */ |
|
/** watchdog counter variable (UNUSED) */ |
volatile uint8_t watchdog_count = WATCHDOG_TIME; |
|
/** the filesize of an fpga configuration file, read from the bit file header */ |
idata int32_t file_size; |
|
/** stores the current used addres for spi flash access */ |
xdata uint32_t flash_adress; |
/** general pointer to pass the place where to read data to different |
functions (normally endpoint buffer) */ |
xdata unsigned char *buffer; |
|
xdata TMC_Response_Queue response_queue; /**< buffer to hold the TMC response */ |
|
|
/** \brief with executing this function, we confirm that we handled the |
* endpoint 0 data and that we are ready to get new data (rearm the endpoint). |
*/ |
114,9 → 124,10
|
|
#ifdef USB_DFU_SUPPORT |
/** \brief this function writes the new firmware data in endpoint 0 to the I2C eeprom |
* \note this function is only available when the DFU (device firware upgrade) class |
* support is enabled. |
/** \brief this function writes the new firmware data in endpoint 0 to the I2C \ |
* eeprom. |
* \note this function is only available when the DFU (device firware upgrade) \ |
* class support is enabled. |
*/ |
uint8_t app_firmware_write (void) |
{ |
143,16 → 154,12
/** \brief analyze the header from the fpga configuration file and compares the |
* the fpga type with the on board fpga and returs the configuration file size. |
* |
* \param[in] xdata unsigned char *buffer pointer to the buffer to read from |
* (normally endpoint buffer) |
* \param[in] idata uint16_t *offset pointer to the offset, buffer[offset] |
* \param[in] *offset pointer to the offset, buffer[offset] |
* is the current position, anything before this is already consumed. |
* \param[in] idata uint16_t *byte_count pointer to the length of the whole |
* buffer. |
* \param[in] *byte_count pointer to the length of the whole buffer. |
* \return returns non-zero if successful, else 0 |
*/ |
uint8_t app_check_fpga_type_from_header(/*xdata unsigned char *buffer,*/ \ |
idata uint16_t *offset, \ |
uint8_t app_check_fpga_type_from_header(idata uint16_t *offset, \ |
idata uint16_t *byte_count) |
{ |
static xdata Fpga_Info fpga_file_header; |
217,16 → 224,12
|
/** \brief function to configure an fpga with data from usb |
* |
* \param[in] xdata unsigned char *buffer pointer to the buffer to read from |
* (normally endpoint buffer) |
* \param[in] idata uint16_t *offset pointer to the offset, buffer[offset] |
* \param[in] *offset pointer to the offset, buffer[offset] |
* is the current position, anything before this is already consumed. |
* \param[in] idata uint16_t *byte_count pointer to the length of the whole |
* buffer. |
* \param[in] *byte_count pointer to the length of the whole buffer. |
* \return returns non-zero if successful, else 0 |
*/ |
uint8_t app_configure_fpga(/* xdata unsigned char *buffer,*/ \ |
idata uint16_t *offset, \ |
uint8_t app_configure_fpga(idata uint16_t *offset, \ |
idata uint16_t *byte_count) |
{ |
/* Is this the first part of configuration? */ |
276,7 → 279,7
|
/** \brief function to write an fpga configuration from usb to the spi flash |
* |
* \detail The SPI flash is big enough to hold store two different fpga |
* The SPI flash is big enough to hold store two different fpga |
* configuration files. To handle this, we split the SPI flash address |
* space simply at the half. \n |
* The data structure in the SPI flash is really simple:\n |
283,16 → 286,12
* \li 32bit file size value (little endian, as used by the fx2) |
* \li binary data from the fpga configuration file |
* |
* \param[in] xdata unsigned char *buffer pointer to the buffer to read from |
* (normally endpoint buffer) |
* \param[in] idata uint16_t *offset pointer to the offset, buffer[offset] |
* \param[in] *offset pointer to the offset, buffer[offset] |
* is the current position, anything before this is already consumed. |
* \param[in] idata uint16_t *byte_count pointer to the length of the whole |
* buffer. |
* \param[in] *byte_count pointer to the length of the whole buffer. |
* \return returns non-zero if successful, else 0 |
*/ |
uint8_t app_write_conf_to_flash(/* xdata unsigned char *buffer,*/ \ |
idata uint16_t *offset, \ |
uint8_t app_write_conf_to_flash(idata uint16_t *offset, \ |
idata uint16_t *byte_count) |
{ |
idata uint16_t length; |
379,19 → 378,18
|
|
/** \brief erases the desired file slot in spi flash |
* \detail send the erase command for one spi flash memory block and loop |
* through the main_loop untill we finished erasing the whole fpga |
* configuration file slot. |
* |
* send the erase command for one spi flash memory block and loop |
* through the main_loop untill we finished erasing the whole fpga |
* configuration file slot. |
* |
* \param[in] xdata unsigned char *buffer pointer to the buffer to read from |
* (normally endpoint buffer) |
* \param[in] idata uint16_t *offset pointer to the offset, buffer[offset] |
* \param[in] *offset pointer to the offset, buffer[offset] |
* is the current position, anything before this is already consumed. |
* \return returns non-zero if successful, else 0 |
* |
* \todo uncomment this function after finishing debuging, else no space left! |
*/ |
uint8_t app_gecko3com_flash_delete(/* uint8_t *buffer,*/ idata uint16_t *offset) { |
uint8_t app_gecko3com_flash_delete(idata uint16_t *offset) { |
|
xdata uint32_t flash_adress; |
xdata uint32_t local_uint32_var; |
/src/gecko3com_common.c
172,6 → 172,7
LED_PORT ^= bmPC_LED1; |
} |
|
/** unused function on GECKO3COM */ |
void |
set_sleep_bits (uint8_t bits, uint8_t mask) |
{ |
/src/spi.c
95,6 → 95,7
} |
} |
|
/** \brief disables all devices on the SPI bus */ |
#define disable_all() setup_enables (0) |
|
void |