This commit is contained in:
Triss 2021-06-19 22:26:18 +02:00
parent 4a60b6a088
commit ff45c13498
5 changed files with 41 additions and 14 deletions

View File

@ -5,7 +5,7 @@ option(USE_USBCDC_FOR_STDIO "Export an extra USB-CDC interface for stdio, instea
set(FAMILY "rp2040" CACHE STRING "Board/MCU family, decides which drivers to use. Set to RP2040 by default.")
set(BOARD "raspberry_pi_pico" CACHE STRING "Board used, determines the pinout. Defaults to the Raspberry Pi Pico.")
# use directory name for project id
# use directory name for project id # FIXME: use fixed project name
get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME)
set(PROJECT ${BOARD}-${PROJECT})
@ -33,6 +33,9 @@ if(FAMILY STREQUAL "rp2040")
family_initialize_project(PROJECT ${CMAKE_CURRENT_LIST_DIR}) # calls pico_sdk_init()
#pico_sdk_init()
pico_set_program_name(PROJECT "${PROJECT}")
pico_set_program_version(PROJECT "0.1")
add_executable(${PROJECT})
# need uart stdio, usb is busy doing other stuff

View File

@ -169,7 +169,8 @@ libco is licensed under the [ISC license](https://opensource.org/licenses/ISC)
to use the UART interface as a loopback thing.
- [ ] I2C support by emulating the I2C Tiny USB
- [ ] Expose RP2040-internal temperature ADC on I2C-over-USB bus?
- ~~Does SMBus stuff need special treatment here?~~ No.
- ~~Does SMBus stuff need special treatment here?~~ ~~No.~~ Actually, some
parts do, but, laziness.
- [ ] 10-bit I2C address support (Needs poking at the Pico SDK, as it only
supports 7-bit ones).
- [ ] Host-side script that is an XVC (or hw_server) cable and communicates
@ -184,11 +185,12 @@ libco is licensed under the [ISC license](https://opensource.org/licenses/ISC)
- https://github.com/Xilinx/XilinxVirtualCable/
- https://github.com/derekmulcahy/xvcpi
- OpenOCD as XVC client??
- [ ] SUMP logic analyzer?
- see also [this](https://github.com/perexg/picoprobe-sump)
- [ ] Segger RTT?
- [ ] Maybe use the ADCs for something?
- [ ] General generic manual GPIO mode
- [ ] SD/MMC/SDIO (will be a pain)
- [ ] SUMP logic analyzer?????
- see also [this](https://github.com/perexg/picoprobe-sump)
- [ ] AVR programming (USBavr emulation?)
- AVR ISP is hardly used anymore
- TPI/UPDI requires 5V levels, Pico doesn't do that :/

View File

@ -37,9 +37,7 @@ static const uint8_t serprog_cmdmap[32] = {
0, // 58..5f
0, // rest is 0
};
static const char serprog_pgmname[16] = {
'D','a','p','p','e','r','M','i','m','e','-','J','T','A','G',0 // TODO
};
static const char serprog_pgmname[16] = INFO_PRODUCT_BARE;
static uint8_t rx_buf[CFG_TUD_CDC_RX_BUFSIZE];
static uint8_t tx_buf[CFG_TUD_CDC_TX_BUFSIZE];

View File

@ -7,6 +7,7 @@
#include "protocfg.h"
#define INFO_MANUFACTURER "BLAHAJ CTF"
#define INFO_PRODUCT_BARE "Dragnbus"
#define INFO_PRODUCT(board) "Dragnbus (" board ")"
#ifdef DBOARD_HAS_UART

View File

@ -51,10 +51,33 @@ static uint16_t iub_open(uint8_t rhport, tusb_desc_interface_t const* itf_desc,
}
static bool iub_ctl_req(uint8_t rhport, uint8_t stage, tusb_control_request_t const* req) {
if (stage == CONTROL_STAGE_DATA) {
// TODO: should URB_CONTROL out data be read in this stage????
return true;
}
// if (stage == CONTROL_STAGE_DATA && req->bmRequestType_bit.type == TUSB_REQ_TYPE_VENDOR) {
// // TODO: should URB_CONTROL out data be read in this stage????
// // FIXME: cond ^ has false-positives!
// // FIXME: handle 0-byte writes in SETUP stage
// // FIXME: use curcmd var for eliminating false-positives
// // FIXME: other stuff???
// if (req->bRequest >= ITU_CMD_I2C_IO && req->bRequest <= ITU_CMD_I2C_IO_BEGINEND
// /*&& curcmd.cmd == req->bRequest && curcmd.flags == req->wValue
// && curcmd.addr == req->wIndex && curcmd.len == req->wLength*/) {
// uint8_t buf[req->wLength];
// bool rv = tud_control_xfer(rhport, req, buf, req->wLength);
// printf("write addr=%04hx len=%04hx ", req->wIndex, req->wLength);
// if (rv) {
// printf("data=%02x %02x...\n", buf[0], buf[1]);
// status = i2ctu_write(req->wValue, req->bRequest & ITU_CMD_I2C_IO_DIR_MASK,
// req->wIndex, buf, sizeof buf);
// } else {
// printf("no data :/\n");
// status = ITU_STATUS_ADDR_NAK;
// }
// return rv;
// } else {
// //printf("I2C-Tiny-USB: bad command in DATA stage\n");
// //return false;
// }
// return true;
// }
if (stage != CONTROL_STAGE_SETUP) return true;
@ -130,8 +153,8 @@ static bool iub_ctl_req(uint8_t rhport, uint8_t stage, tusb_control_request_t co
printf("data=%02x %02x...\n", buf[0], buf[1]);
return tud_control_xfer(rhport, req, buf, req->wLength);
} else { // write
printf("write addr=%04hx len=%04hx ", req->wIndex, req->wLength);
// FIXME: THIS NO WORKY! STUFF IN BUFFER IS NONSENSE
return true; // handled in DATA stage
/*// FIXME: THIS NO WORKY! STUFF IN BUFFER IS NONSENSE
bool rv = tud_control_xfer(rhport, req, buf, req->wLength);
if (rv) {
printf("data=%02x %02x...\n", buf[0], buf[1]);
@ -141,7 +164,7 @@ static bool iub_ctl_req(uint8_t rhport, uint8_t stage, tusb_control_request_t co
printf("no data :/\n");
status = ITU_STATUS_ADDR_NAK;
}
return rv;
return rv;*/
}
}
break;