Fx2lib
0.2
|
#include "fx2types.h"
Go to the source code of this file.
Defines | |
#define | GPIFDONE (GPIFTRIG&0x80) |
#define | GPIFTC16 (MAKEWORD(GPIFTCB1,GPIFTCB0)) |
#define | GPIFTC32 (MAKEDWORD(MAKEWORD(GPIFTCB3,GPIFTCB2),MAKEWORD(GPIFTCB1,GPIFTCB0))) |
#define | GPIFTRGWR 0 |
These defines/functions pretty much out of the TRM 10.4. | |
#define | GPIFTRGRD 4 |
Enumerations | |
enum | GPIF_EP_NUM { GPIF_EP2 = 0, GPIF_EP4 = 1, GPIF_EP6 = 2, GPIF_EP8 = 3 } |
Functions | |
void | gpif_init (BYTE *waveform, BYTE *initdata) |
void | gpif_setflowstate (BYTE *flowstates, BYTE bank) |
void | gpif_set_tc32 (DWORD tc) |
Simple function to help set the transaction count for gpif transactions. | |
void | gpif_set_tc16 (WORD tc) |
Simple function to set transaction count for gpif transactions. | |
void | gpif_single_read16 (WORD *res, WORD len) |
void | gpif_single_write16 (WORD *dat, WORD len) |
void | gpif_fifo_read (GPIF_EP_NUM ep_num) |
void | gpif_fifo_write (GPIF_EP_NUM ep_num) |
These functions do the same thing that the Cypress gpif designer expored c file does. Instead of including their file directly in your project, you include just the generated waveform data. The gpif2dat script in the utils folder will export your waveform data to a file that can be included in your project.
Definition in file gpif.h.
#define GPIFTRGWR 0 |
enum GPIF_EP_NUM |
void gpif_fifo_read | ( | GPIF_EP_NUM | ep_num | ) |
void gpif_fifo_write | ( | GPIF_EP_NUM | ep_num | ) |
Gpif designer generates a c file with waveform data. Copy the WaveData[128] array and the InitData[7] to your code somewhere Then this function is pretty much the reset of the generated code but ported to sdcc.
uses syncdelay of 4 which might not be long enough if peripheral runs slower than 30mhz. May not affect anything.
IFCONFIG is set with IFCFG[1:0] = 10 for GPIF master but you still have to set the ifclk, polarity, and the rest of the bits
void gpif_set_tc16 | ( | WORD | tc | ) |
Simple function to set transaction count for gpif transactions.
tc | 16 bit Transaction Count |
void gpif_set_tc32 | ( | DWORD | tc | ) |
Simple function to help set the transaction count for gpif transactions.
tc | 32 bit Transaction Count |
void gpif_setflowstate | ( | BYTE * | flowstates, |
BYTE | bank | ||
) |
Uses the correct bytes from your flowstates array. This may or may not be needed depending on whether your waveform data uses flowstates. If you don't know if you need them or not, you probably don't.
flowstates should have 36 elements. bank should be 0-3
void gpif_single_read16 | ( | WORD * | res, |
WORD | len | ||
) |
Use the gpif to read a single word at a time. Read len words and store in res
At least one EPxFIFOCFG has to have wordwide=1 or this functions won't transfer both bytes.
void gpif_single_write16 | ( | WORD * | dat, |
WORD | len | ||
) |
Use the gpif to write a single word at a time. Write len words from data
At leat one EPxFIFOCFG has to have wordwide=1 or this function won't transfer both bytes.