#include #include /*#include */ /*#include */ /*#include */ #include #define BAUDRATE 10000000 long bpmPromQspiInit(void) { long rval; /* Initialize + setup QSPI driver */ if ( ( rval = coldfQspiInit() ) ) return rval; printf("bpmPromQspiInit: coldfire QSPI initialized\n"); if ( ( rval = coldfQspiSetup(0, BAUDRATE, 0, 0, DRV5282_QSPI_SETUP_CS_ACTVLOW) ) ) { return rval; } printf("bpmPromQspiInit: coldfire QSPI set up\n"); return 0; } int bpmQspiWriteBootReg(unsigned value) { uint8_t buf[2]; uint16_t cs = 0xe; /* use chip select 0 */ buf[0] = 0x3e; /* the address of the boot register in Jeff's register map */ buf[1] = value; coldfQspiWrite(buf, 2, cs); printf("bpmQspiWriteBootReg: writing value=0x%x with chip-select mask=0x%x to reg 0x%02x\n", buf[1], (unsigned int) cs, buf[0]); return 0; } /* diagnostic to see version */ int bpmQspiReadVerReg() { uint8_t buf[2]; int n = 2; int rc; uint16_t cs = 0xe; /* use chip select 0 */ buf[0] = 0x5; /* the only way to read data out, is to push something, which you aren't allowed to do, so it doesn't set anything, but THEN it gives you the version back (Only case for this) */ rc = coldfQspiWriteRead(buf, buf, n, cs); printf("bpmQspiReadVerReg: read 0x%x with chip-select mask=0x%x from reg 0x%02x\n", buf[1], cs, buf[0]); return (int) buf[1]; }