Line 1104... |
Line 1104... |
|
|
retry_ok();
|
retry_ok();
|
return DBG_ERR_OK;
|
return DBG_ERR_OK;
|
}
|
}
|
|
|
|
|
|
/* read a word from wishbone */
|
|
int usb_dbg_wb_read8(uint32_t adr, uint8_t *data) {
|
|
if ((err = usb_dbg_set_chain(DC_WISHBONE))) return err;
|
|
if ((err = usb_dbg_command(DBG_WB_READ8, adr, 1))) return err;
|
|
if ((err = usb_dbg_go((unsigned char*)data, 1, 1))) return err;
|
|
//*data = ntohl(*data);
|
|
return err;
|
|
}
|
|
|
/* read a word from wishbone */
|
/* read a word from wishbone */
|
int usb_dbg_wb_read32(uint32_t adr, uint32_t *data) {
|
int usb_dbg_wb_read32(uint32_t adr, uint32_t *data) {
|
// uint32_t err;
|
// uint32_t err;
|
if ((err = usb_dbg_set_chain(DC_WISHBONE))) return err;
|
if ((err = usb_dbg_set_chain(DC_WISHBONE))) return err;
|
if ((err = usb_dbg_command(DBG_WB_READ32, adr, 4))) return err;
|
if ((err = usb_dbg_command(DBG_WB_READ32, adr, 4))) return err;
|
if ((err = usb_dbg_go((unsigned char*)data, 4, 1))) return err;
|
if ((err = usb_dbg_go((unsigned char*)data, 4, 1))) return err;
|
//*data = ntohl(*data);
|
//*data = ntohl(*data);
|
return err;
|
return err;
|
}
|
}
|
|
|
/* write a word to wishbone */
|
/* write a byte to wishbone */
|
int usb_dbg_wb_write8(uint32_t adr, uint8_t data) {
|
int usb_dbg_wb_write8(uint32_t adr, uint8_t data) {
|
if ((err = usb_dbg_set_chain(DC_WISHBONE))) return err;
|
if ((err = usb_dbg_set_chain(DC_WISHBONE))) return err;
|
if ((err = usb_dbg_command(DBG_WB_WRITE8, adr, 1))) return err;
|
if ((err = usb_dbg_command(DBG_WB_WRITE8, adr, 1))) return err;
|
if ((err = usb_dbg_go((unsigned char*)&data, 1, 0))) return err;
|
if ((err = usb_dbg_go((unsigned char*)&data, 1, 0))) return err;
|
return DBG_ERR_OK;
|
return DBG_ERR_OK;
|