testIP commented

This commit is contained in:
paul nehlich 2024-05-21 15:37:27 +02:00
parent 9d3740dfd6
commit 4e8f49bf57

View File

@ -160,71 +160,71 @@ static const uint16_t stackSizeWords = 512;
StaticTask_t xTaskBuffer; StaticTask_t xTaskBuffer;
StackType_t xStack[512]; StackType_t xStack[512];
void testIp() { // void testIp() {
uartIsrQueue = // uartIsrQueue =
xQueueCreateStatic(QUEUE_LENGTH, 1, ucQueueStorageArea, &xStaticQueue); // xQueueCreateStatic(QUEUE_LENGTH, 1, ucQueueStorageArea, &xStaticQueue);
lwip_init(); // lwip_init();
ip4_addr_t slip_addr = {PP_HTONL(LWIP_MAKEU32(10, 0, 0, 32))}, // ip4_addr_t slip_addr = {PP_HTONL(LWIP_MAKEU32(10, 0, 0, 32))},
slip_mask = {PP_HTONL(LWIP_MAKEU32(255, 255, 255, 0))}, // slip_mask = {PP_HTONL(LWIP_MAKEU32(255, 255, 255, 0))},
slip_gw = {PP_HTONL(LWIP_MAKEU32(10, 0, 0, 1))}; // slip_gw = {PP_HTONL(LWIP_MAKEU32(10, 0, 0, 1))};
netif_add(&netif, &slip_addr, &slip_mask, &slip_gw, NULL, slipif_init, // netif_add(&netif, &slip_addr, &slip_mask, &slip_gw, NULL, slipif_init,
netif_input); // netif_input);
netif_set_default(&netif); // netif_set_default(&netif);
// should be done by driver, which does not do it, so we do it here // // should be done by driver, which does not do it, so we do it here
netif_set_link_up(&netif); // netif_set_link_up(&netif);
netif_set_up(&netif); // netif_set_up(&netif);
udpecho_raw_pcb = udp_new_ip_type(IPADDR_TYPE_ANY); // udpecho_raw_pcb = udp_new_ip_type(IPADDR_TYPE_ANY);
if (udpecho_raw_pcb != NULL) { // if (udpecho_raw_pcb != NULL) {
err_t err; // err_t err;
err = udp_bind(udpecho_raw_pcb, IP_ANY_TYPE, 7); // err = udp_bind(udpecho_raw_pcb, IP_ANY_TYPE, 7);
if (err == ERR_OK) { // if (err == ERR_OK) {
udp_recv(udpecho_raw_pcb, udpecho_raw_recv, NULL); // udp_recv(udpecho_raw_pcb, udpecho_raw_recv, NULL);
} else { // } else {
/* TODO */ // /* TODO */
} // }
} else { // } else {
/* TODO */ // /* TODO */
} // }
/* Install the UART Interrupt handler. */ // /* Install the UART Interrupt handler. */
BaseType_t xStatus = // BaseType_t xStatus =
XScuGic_Connect(&xInterruptController, STDIN_INT_NR, // XScuGic_Connect(&xInterruptController, STDIN_INT_NR,
(Xil_ExceptionHandler)handleUARTInt, NULL); // (Xil_ExceptionHandler)handleUARTInt, NULL);
configASSERT(xStatus == XST_SUCCESS); // configASSERT(xStatus == XST_SUCCESS);
(void)xStatus; /* Remove compiler warning if configASSERT() is not defined. */ // (void)xStatus; /* Remove compiler warning if configASSERT() is not defined. */
// Set trigger level to 62 of 64 bytes, giving interrupt some time to react // // Set trigger level to 62 of 64 bytes, giving interrupt some time to react
XUartPs_WriteReg(STDIN_BASEADDRESS, XUARTPS_RXWM_OFFSET, 62); // XUartPs_WriteReg(STDIN_BASEADDRESS, XUARTPS_RXWM_OFFSET, 62);
// Setting the rx timeout to n*4 -1 bits // // Setting the rx timeout to n*4 -1 bits
XUartPs_WriteReg(STDIN_BASEADDRESS, XUARTPS_RXTOUT_OFFSET, 50); // XUartPs_WriteReg(STDIN_BASEADDRESS, XUARTPS_RXTOUT_OFFSET, 50);
// enable UART Interrupts // // enable UART Interrupts
u32 mask = XUARTPS_IXR_RTRIG | XUARTPS_IXR_RXOVR | XUARTPS_IXR_RXFULL | // u32 mask = XUARTPS_IXR_RTRIG | XUARTPS_IXR_RXOVR | XUARTPS_IXR_RXFULL |
XUARTPS_IXR_TOUT; // XUARTPS_IXR_TOUT;
/* Write the mask to the IER Register */ // /* Write the mask to the IER Register */
XUartPs_WriteReg(STDIN_BASEADDRESS, XUARTPS_IER_OFFSET, mask); // XUartPs_WriteReg(STDIN_BASEADDRESS, XUARTPS_IER_OFFSET, mask);
/* Write the inverse of the Mask to the IDR register */ // /* Write the inverse of the Mask to the IDR register */
XUartPs_WriteReg(STDIN_BASEADDRESS, XUARTPS_IDR_OFFSET, (~mask)); // XUartPs_WriteReg(STDIN_BASEADDRESS, XUARTPS_IDR_OFFSET, (~mask));
/* Enable the interrupt for the UART1 in the interrupt controller. */ // /* Enable the interrupt for the UART1 in the interrupt controller. */
XScuGic_Enable(&xInterruptController, STDIN_INT_NR); // XScuGic_Enable(&xInterruptController, STDIN_INT_NR);
// Start lwip task // // Start lwip task
xTaskCreateStatic( // xTaskCreateStatic(
lwip_main, /* The function that implements the task. */ // lwip_main, /* The function that implements the task. */
"lwip", /* The text name assigned to the task - for debug // "lwip", /* The text name assigned to the task - for debug
only as it is not used by the kernel. */ // only as it is not used by the kernel. */
stackSizeWords, /* The size of the stack to allocate to the task. */ // stackSizeWords, /* The size of the stack to allocate to the task. */
NULL, /* The parameter passed to the task - not used in this // NULL, /* The parameter passed to the task - not used in this
simple case. */ // simple case. */
4, /* The priority assigned to the task. */ // 4, /* The priority assigned to the task. */
xStack, &xTaskBuffer); // xStack, &xTaskBuffer);
} // }