Skip to content

Commit

Permalink
no pbuf buffer copy
Browse files Browse the repository at this point in the history
just need the callback to be independent
  • Loading branch information
sidd-kishan committed Jul 14, 2024
1 parent 5fc4f91 commit 874ea20
Show file tree
Hide file tree
Showing 11 changed files with 59,452 additions and 59,505 deletions.
Binary file modified build/CMakeFiles/PicoPiFi.dir/src/main.c.obj
Binary file not shown.
Binary file modified build/CMakeFiles/PicoPiFi.dir/src/wifi_tx.c.obj
Binary file not shown.
Binary file modified build/PicoPiFi.bin
Binary file not shown.
77,223 changes: 38,588 additions & 38,635 deletions build/PicoPiFi.dis

Large diffs are not rendered by default.

Binary file modified build/PicoPiFi.elf
Binary file not shown.
2,335 changes: 1,166 additions & 1,169 deletions build/PicoPiFi.elf.map

Large diffs are not rendered by default.

39,379 changes: 19,687 additions & 19,692 deletions build/PicoPiFi.hex

Large diffs are not rendered by default.

Binary file modified build/PicoPiFi.uf2
Binary file not shown.
2 changes: 1 addition & 1 deletion src/lwip.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ extern struct pbuf *out_pkt;
extern bool link_up;
static void lwip_service_traffic(void);
void printline(int cdc,char string[],int len);
extern int chan;
//extern int chan;

extern char connect_ssid[190], connect_ssid_decode[95], connect_password[190], connect_password_decode[95], retry_ms[6], enc_type[1], wifi_configuration[450], wifi_configuration_last[450];
extern int wifi_congfig_len;
6 changes: 3 additions & 3 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ uint8_t rndis_mac[6] = { 0x20, 0x89, 0x84, 0x6A, 0x96, 0xAA };
int wifi_congfig_len=0;
int eth_frame_send_success;

int chan = 0;
//int chan = 0;

void printline(int cdc,char string[],int len){
char buf[2048];
Expand Down Expand Up @@ -81,6 +81,7 @@ static int scan_result(void *env, const cyw43_ev_scan_result_t *result) {

void core1(){
//user_init_lwip();
cdc_rndis_init(rndis_mac);
lwip_init();
multicore_lockout_victim_init();
//int wifi_conn_error;
Expand Down Expand Up @@ -143,14 +144,13 @@ int main(void)
cyw43_hal_get_mac(0, rndis_mac);
//sscanf(wifi_configuration,"s_a: %s p_a: %s r_a: %s c_a: %s ",connect_ssid,connect_password,retry_ms,enc_type);

cdc_rndis_init(rndis_mac);

multicore_launch_core1(core1);

absolute_time_t scan_time = nil_time;
bool scan_in_progress = false;
next_wifi_try = nil_time;
chan = dma_claim_unused_channel(false);
//chan = dma_claim_unused_channel(false);
while (1) {
if (!link_up) {
if (absolute_time_diff_us(get_absolute_time(), scan_time) < 0) {
Expand Down
12 changes: 7 additions & 5 deletions src/wifi_tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ void cyw43_cb_process_ethernet(void *cb_data, int itf, size_t len, const uint8_t
out_pkt = pbuf_alloc(PBUF_RAW, len, PBUF_POOL);
//memcpy(out_pkt->payload, buf, len);
//pbuf_take(out_pkt, buf, len);

/*
int transfer = (len%2==0)?(len/2):((len+1)/2);
dma_channel_config c = dma_channel_get_default_config(chan);
channel_config_set_transfer_data_size(&c, DMA_SIZE_16);
channel_config_set_read_increment(&c, true);
Expand All @@ -87,20 +88,21 @@ void cyw43_cb_process_ethernet(void *cb_data, int itf, size_t len, const uint8_t
&c, // The configuration we just created
out_pkt->payload,// The initial write address
buf, // The initial read address
(len/2)+1, // Number of transfers; in this case each is 1 byte.
transfer, // Number of transfers; in this case each is 1 byte.
true // Start immediately.
);

*/
out_pkt->payload = buf;
int ret = usbd_rndis_eth_tx(out_pkt);
if (0 != ret) {
ret = ERR_BUF;
}
// We could choose to go and do something else whilst the DMA is doing its
// thing. In this case the processor has nothing else to do, so we just
// wait for the DMA to finish.
dma_channel_wait_for_finish_blocking(chan);
//dma_channel_wait_for_finish_blocking(chan);

pbuf_free(out_pkt);
out_pkt = NULL;
//out_pkt = NULL;
//}
}

0 comments on commit 874ea20

Please sign in to comment.