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