summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Lojewski <github@meklort.com>2019-05-04 18:37:45 -0600
committerEvan Lojewski <github@meklort.com>2019-05-04 18:37:45 -0600
commit2ba81481412418ef287c87083c9a582b97398b9d (patch)
treed964e2cfcddac3e797acc7bff911bc4fc00cbf6e
parentec6150b37a84b26e9591f2a36761415b3ec2cab4 (diff)
downloadbcm5719-ortega-2ba81481412418ef287c87083c9a582b97398b9d.tar.gz
bcm5719-ortega-2ba81481412418ef287c87083c9a582b97398b9d.zip
Add a passthrough rx routine bypassing any buffers.
-rw-r--r--ape/CMakeLists.txt3
-rw-r--r--libs/Network/CMakeLists.txt7
-rw-r--r--libs/Network/include/Network.h5
-rw-r--r--libs/Network/rx.c225
-rw-r--r--simulator/CMakeLists.txt3
-rw-r--r--utils/bcmregtool/CMakeLists.txt2
-rw-r--r--utils/bcmregtool/main.cpp364
7 files changed, 246 insertions, 363 deletions
diff --git a/ape/CMakeLists.txt b/ape/CMakeLists.txt
index dcd5297..0159e1d 100644
--- a/ape/CMakeLists.txt
+++ b/ape/CMakeLists.txt
@@ -54,11 +54,10 @@ arm_add_executable(${PROJECT_NAME}
)
arm_linker_script(${PROJECT_NAME} ${LINKER_SCRIPT})
-target_link_libraries(${PROJECT_NAME} NVRam-arm MII-arm APE-arm Network-arm)
+target_link_libraries(${PROJECT_NAME} NVRam-arm MII-arm APE-arm Network-arm NCSI-arm)
target_link_libraries(${PROJECT_NAME} bcm5719-arm)
target_compile_options(${PROJECT_NAME} PRIVATE -nodefaultlibs)
-
# Simulator add_executable
# simulator_add_executable(sim-${PROJECT_NAME}
# init_hw.c
diff --git a/libs/Network/CMakeLists.txt b/libs/Network/CMakeLists.txt
index 3618c71..a393172 100644
--- a/libs/Network/CMakeLists.txt
+++ b/libs/Network/CMakeLists.txt
@@ -46,18 +46,15 @@ project(Network)
# Host Simulation library
-simulator_add_library(${PROJECT_NAME} STATIC tx.c generic.c)
+simulator_add_library(${PROJECT_NAME} STATIC tx.c rx.c generic.c)
target_link_libraries(${PROJECT_NAME} PRIVATE simulator NCSI)
target_include_directories(${PROJECT_NAME} PUBLIC ../../include)
target_include_directories(${PROJECT_NAME} PUBLIC include)
# ARM Library
-arm_add_library(${PROJECT_NAME}-arm STATIC init.c tx.c generic.c)
+arm_add_library(${PROJECT_NAME}-arm STATIC init.c tx.c rx.c generic.c)
target_link_libraries(${PROJECT_NAME}-arm PRIVATE NCSI-arm)
target_include_directories(${PROJECT_NAME}-arm PUBLIC ../../include)
target_include_directories(${PROJECT_NAME}-arm PUBLIC include)
- # SET_SOURCE_FILES_PROPERTIES( tx.c PROPERTIES COMPILE_FLAGS -O3 )
-
-
# add_subdirectory(tests) \ No newline at end of file
diff --git a/libs/Network/include/Network.h b/libs/Network/include/Network.h
index d96d665..b49afae 100644
--- a/libs/Network/include/Network.h
+++ b/libs/Network/include/Network.h
@@ -59,6 +59,11 @@ void Network_TX_transmitLePacket(uint8_t* packet, uint32_t length);
// void Network_TX_transmitPassthroughPacket(RegAPE_PERIBmcToNcRxStatus_t rx_status);
+bool Network_RxLePatcket(uint32_t* buffer, uint32_t* length);
+bool Network_PassthroughRxPatcket(void);
+
+
+
void Network_SetMACAddr(uint16_t high, uint32_t low, uint32_t index, bool enabled);
diff --git a/libs/Network/rx.c b/libs/Network/rx.c
new file mode 100644
index 0000000..88f8bea
--- /dev/null
+++ b/libs/Network/rx.c
@@ -0,0 +1,225 @@
+////////////////////////////////////////////////////////////////////////////////
+///
+/// @file rx.c
+///
+/// @project
+///
+/// @brief Network reception routines
+///
+////////////////////////////////////////////////////////////////////////////////
+///
+////////////////////////////////////////////////////////////////////////////////
+///
+/// @copyright Copyright (c) 2019, Evan Lojewski
+/// @cond
+///
+/// All rights reserved.
+///
+/// Redistribution and use in source and binary forms, with or without
+/// modification, are permitted provided that the following conditions are met:
+/// 1. Redistributions of source code must retain the above copyright notice,
+/// this list of conditions and the following disclaimer.
+/// 2. Redistributions in binary form must reproduce the above copyright notice,
+/// this list of conditions and the following disclaimer in the documentation
+/// and/or other materials provided with the distribution.
+/// 3. Neither the name of the copyright holder nor the
+/// names of its contributors may be used to endorse or promote products
+/// derived from this software without specific prior written permission.
+///
+////////////////////////////////////////////////////////////////////////////////
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+/// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+/// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+/// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+/// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+/// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+/// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+/// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+/// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+/// POSSIBILITY OF SUCH DAMAGE.
+/// @endcond
+////////////////////////////////////////////////////////////////////////////////
+
+
+#include <Network.h>
+#include <Ethernet.h>
+#include <APE_APE.h>
+#include <APE_APE_PERI.h>
+#include <APE_RX_PORT.h>
+#include <types.h>
+
+#include <stdbool.h>
+
+#ifdef CXX_SIMULATOR
+#include <stdio.h>
+#endif
+
+bool Network_RxLePatcket(uint32_t* buffer, uint32_t* bytes)
+{
+ RegAPERxbufoffsetFunc0_t rxbuf;
+ rxbuf = APE.RxbufoffsetFunc0;
+ if((int)rxbuf.bits.Valid)
+ {
+ union {
+ uint32_t r32;
+ struct {
+ uint32_t payload_length:7;
+ uint32_t next_block:23;
+ uint32_t first:1;
+ uint32_t not_last:1;
+ } bits;
+ } control;
+ int count = rxbuf.bits.Count;
+ // int tailid = rxbuf.bits.Tail;
+ int blockid = rxbuf.bits.Head;
+ // printf("Valid packet at offset %x\n", blockid);
+ uint32_t buffer_pos = 0;
+
+ do
+ {
+ // printf("Block at %x\n", blockid);
+ RegRX_PORTIn_t* block = (RegRX_PORTIn_t*)&RX_PORT.In[RX_PORT_IN_ALL_BLOCK_WORDS * blockid];
+ // printf("Control %x\n", (uint32_t)block[0].r32);
+ control.r32 = block[0].r32;
+ // printf(" Payload Len %d\n", control.bits.payload_length);
+ // printf(" Next Block %d\n", control.bits.next_block);
+ // printf(" First %d\n", control.bits.first);
+ // printf(" Not Last %d\n", control.bits.not_last);
+ int32_t words = (control.bits.payload_length + 3)/4;
+ int32_t offset;
+ if(control.bits.first)
+ {
+ offset = RX_PORT_IN_ALL_FIRST_PAYLOAD_WORD;
+ }
+ else
+ {
+ offset = RX_PORT_IN_ALL_ADDITIONAL_PAYLOAD_WORD;
+ }
+ // printf("Using offset %d\n", offset);
+ for(int i = 0; i < words; i++)
+ {
+ uint32_t data = block[i + offset].r32;
+ buffer[buffer_pos++] = data;
+ // printf(" word %d: 0x%08X\n", i, data);
+ }
+
+ blockid = control.bits.next_block;
+ count--;
+ } while(count);
+
+ // Transmit to NC
+ // disableNCSIHandling();
+ // enableNCSIHandling();
+
+ RegAPERxPoolRetire0_t retire;
+ retire.r32 = (1 << 24);
+ retire.bits.Head = rxbuf.bits.Head;
+ retire.bits.Tail = rxbuf.bits.Tail;
+ retire.bits.Count = rxbuf.bits.Count;
+ // retire.print();
+
+
+ APE.RxPoolRetire0 = retire;
+ rxbuf.r32 |= (1 << 31);
+ // rxbuf.print();
+ APE.RxbufoffsetFunc0 = rxbuf;
+ *bytes = 4 * buffer_pos;
+
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+bool Network_PassthroughRxPatcket(void)
+{
+ RegAPERxbufoffsetFunc0_t rxbuf;
+ rxbuf = APE.RxbufoffsetFunc0;
+ if((int)rxbuf.bits.Valid)
+ {
+ union {
+ uint32_t r32;
+ struct {
+ uint32_t payload_length:7;
+ uint32_t next_block:23;
+ uint32_t first:1;
+ uint32_t not_last:1;
+ } bits;
+ } control;
+ int count = rxbuf.bits.Count;
+ // int tailid = rxbuf.bits.Tail;
+ int blockid = rxbuf.bits.Head;
+
+ do
+ {
+ count--;
+ // printf("Block at %x\n", blockid);
+ RegRX_PORTIn_t* block = (RegRX_PORTIn_t*)&RX_PORT.In[RX_PORT_IN_ALL_BLOCK_WORDS * blockid];
+ // printf("Control %x\n", (uint32_t)block[0].r32);
+ control.r32 = block[0].r32;
+ // printf(" Payload Len %d\n", control.bits.payload_length);
+ // printf(" Next Block %d\n", control.bits.next_block);
+ // printf(" First %d\n", control.bits.first);
+ // printf(" Not Last %d\n", control.bits.not_last);
+ int32_t words = (control.bits.payload_length + 3)/4;
+ int32_t offset;
+ if(control.bits.first)
+ {
+ offset = RX_PORT_IN_ALL_FIRST_PAYLOAD_WORD;
+ }
+ else
+ {
+ offset = RX_PORT_IN_ALL_ADDITIONAL_PAYLOAD_WORD;
+ }
+
+ // Wait for enough free space.
+ while(APE_PERI.BmcToNcTxStatus.bits.InFifo < words);
+
+
+ int i;
+ for(i = 0; i < words-1; i++)
+ {
+ uint32_t data = block[i + offset].r32;
+ APE_PERI.BmcToNcTxBuffer.r32 = data;
+ }
+
+ if(count) // could use !control.bits.not_last
+ {
+ uint32_t data = block[i + offset].r32;
+ APE_PERI.BmcToNcTxBuffer.r32 = data;
+ }
+ else
+ {
+ uint32_t data = block[i + offset].r32;
+ // Last word to send.
+ APE_PERI.BmcToNcTxControl.r32 = 0; // full word.
+ APE_PERI.BmcToNcTxBufferLast.r32 = data;
+ }
+
+ // Retire this block.
+ RegAPERxPoolRetire0_t retire;
+ retire.r32 = (1 << 24);
+ retire.bits.Head = blockid;
+ retire.bits.Tail = blockid;
+ retire.bits.Count = 1;
+ APE.RxPoolRetire0 = retire;
+
+
+ blockid = control.bits.next_block;
+ } while(count);
+
+ // Mark the register as read.
+ rxbuf.r32 |= (1 << 31);
+ APE.RxbufoffsetFunc0 = rxbuf;
+
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+} \ No newline at end of file
diff --git a/simulator/CMakeLists.txt b/simulator/CMakeLists.txt
index 21c0698..57e500b 100644
--- a/simulator/CMakeLists.txt
+++ b/simulator/CMakeLists.txt
@@ -35,6 +35,9 @@ simulator_add_library(${PROJECT_NAME} STATIC
APE_TX_PORT.cpp
APE_TX_PORT_sim.cpp
+ APE_RX_PORT.cpp
+ APE_RX_PORT_sim.cpp
+
)
include_directories(../libs/NVRam)
diff --git a/utils/bcmregtool/CMakeLists.txt b/utils/bcmregtool/CMakeLists.txt
index 76fa724..2a3cb86 100644
--- a/utils/bcmregtool/CMakeLists.txt
+++ b/utils/bcmregtool/CMakeLists.txt
@@ -9,7 +9,7 @@ set(SOURCES
)
simulator_add_executable(${PROJECT_NAME} ${SOURCES})
-target_link_libraries(${PROJECT_NAME} PRIVATE NVRam VPD MII APE apeloader-binary NCSI)
+target_link_libraries(${PROJECT_NAME} PRIVATE NVRam VPD MII APE apeloader-binary NCSI Network)
target_link_libraries(${PROJECT_NAME} PRIVATE simulator OptParse elfio)
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION .)
diff --git a/utils/bcmregtool/main.cpp b/utils/bcmregtool/main.cpp
index ebce69d..30b30fe 100644
--- a/utils/bcmregtool/main.cpp
+++ b/utils/bcmregtool/main.cpp
@@ -69,13 +69,8 @@
#include <bcm5719_SHM_CHANNEL0.h>
#include <elfio/elfio.hpp>
-#include <APE_FILTERS.h>
-#include <APE_NVIC.h>
+#include <types.h>
#include <APE_APE_PERI.h>
-#include <APE_TX_PORT.h>
-
-#include <Ethernet.h>
-#include <NCSI.h>
#include "../NVRam/bcm5719_NVM.h"
@@ -85,17 +80,6 @@ using optparse::OptionParser;
elfio gELFIOReader;
-uint8_t ping_packet[] = {
- 0x00, 0x0c, 0x29, 0x64, 0x66, 0xe2, 0x2c, 0x09, 0x4d, 0x00, 0x01, 0x4a, 0x08, 0x00, 0x45, 0x00,
- 0x00, 0x54, 0x12, 0xe1, 0x40, 0x00, 0x40, 0x01, 0x40, 0xbb, 0xc0, 0xa8, 0x20, 0x62, 0x04, 0x02,
- 0x02, 0x01, 0x08, 0x00, 0xa1, 0xae, 0x15, 0x5f, 0x00, 0x52, 0xdc, 0xf1, 0x63, 0xae, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00,
-};
-uint32_t ping_packet_len = sizeof(ping_packet);
-
const char* regnames[32] = {
"$zero", /* Zero register - always 0 */
"$at", /* Assembler register */
@@ -314,255 +298,6 @@ void writeMemory(uint32_t rxAddr, uint32_t value)
DEVICE.RxRiscMode = mode;
}
-
-uint32_t allocationBlocksNeeded(uint32_t frame_size)
-{
- static const uint32_t first_size = 20 * sizeof(uint32_t);
- static const uint32_t remaining_size = 30 * sizeof(uint32_t);
- uint32_t blocks = 1;
- // Block size is 128 bytes, first one has 12 words used, so 20 words available.
- if(frame_size > first_size)
- {
- frame_size -= 20 * sizeof(uint32_t);
-
- // Remaining blocks can hold 30 words;
- blocks += ((frame_size + remaining_size - 1) / remaining_size);
- }
-
- printf("%d blocks needed for packet\n", blocks);
- return blocks;
-}
-int32_t allocateTXBlock(void)
-{
-#if 1
- int32_t block = -1;
-
- // Wait for allocator state machine to finish.
- // while(APE_TX_TO_NET_BUFFER_ALLOCATOR_0_STATE_PROCESSING == APE.TxToNetBufferAllocator0.bits.State);
-
- // Set the alloc bit.
- RegAPETxToNetBufferAllocator0_t alloc;
- alloc.r32 = 0;
- alloc.bits.RequestAllocation = 1;
- APE.TxToNetBufferAllocator0 = alloc;
-
- // Wait for state machine to finish
- RegAPETxToNetBufferAllocator0_t status;
- do {
- status = APE.TxToNetBufferAllocator0;
- } while(APE_TX_TO_NET_BUFFER_ALLOCATOR_0_STATE_PROCESSING == status.bits.State);
-
- if(APE_TX_TO_NET_BUFFER_ALLOCATOR_0_STATE_ALLOCATION_OK != status.bits.State)
- {
- block = -1;
- printf("Error: Failed to allocate TX block.\n");
- }
- else
- {
- block = status.bits.Index;
- printf("Allocated block %d\n", block);
- }
-
- return block;
-#else
- static int block = 1;
- int this_block = block;
- block++;
- printf("Allocated block %d\n", this_block);
- return this_block;
-#endif
-}
-
-uint32_t initFirstBlock(RegTX_PORTOut_t* block, uint32_t length, int32_t blocks, int32_t next_block, uint32_t* packet)
-{
- int copy_length;
- int i;
- union {
- uint32_t r32;
- struct {
- uint32_t payload_length:7;
- uint32_t next_block:23;
- uint32_t first:1;
- uint32_t not_last:1;
- } bits;
- } control;
-
- control.r32 = 0;
- control.bits.next_block = next_block >= 0 ? next_block : 0;
- control.bits.first = 1;
-
- if(length > ((TX_PORT_OUT_ALL_BLOCK_WORDS - TX_PORT_OUT_ALL_FIRST_PAYLOAD_WORD)*4))
- {
- copy_length = (TX_PORT_OUT_ALL_BLOCK_WORDS - TX_PORT_OUT_ALL_FIRST_PAYLOAD_WORD)*4;
- control.bits.not_last = 1;
- }
- else
- {
- // Last.
- copy_length = length;
- control.bits.not_last = 0;
- }
-
- // block[1] = uninitialized;
- block[2].r32 = 0;
- block[3].r32 = 0;
- block[4].r32 = 0;
- block[5].r32 = 0;
- block[6].r32 = 0;
- block[7].r32 = 0;
- block[8].r32 = 0;
- block[9].r32 = 0;
- // block[10] = uninitialized;
- // block[11] = uninitialized;
- block[TX_PORT_OUT_ALL_FRAME_LEN_WORD].r32 = length;
- block[TX_PORT_OUT_ALL_NUM_BLOCKS_WORD].r32 = blocks;
-
- // Copy Payload Data.
- int num_words = (copy_length + sizeof(uint32_t) - 1)/sizeof(uint32_t);
- for(i = 0; i < num_words; i++)
- {
- block[TX_PORT_OUT_ALL_FIRST_PAYLOAD_WORD + i].r32 = be32toh(packet[i]);
- printf("Block[%d]: 0x%08X\n", i+TX_PORT_OUT_ALL_FIRST_PAYLOAD_WORD, packet[i]);
- }
-
- // Pad if too small.
- if(copy_length < ETHERNET_FRAME_MIN)
- {
- copy_length = ETHERNET_FRAME_MIN;
- length = ETHERNET_FRAME_MIN;
- }
- num_words = (copy_length + sizeof(uint32_t) - 1)/sizeof(uint32_t);
- for(; i < num_words; i++)
- {
- // Pad remaining with 0's
- block[TX_PORT_OUT_ALL_FIRST_PAYLOAD_WORD + i].r32 = 0;
- printf("Block[%d]: pad(0)\n", i+TX_PORT_OUT_ALL_FIRST_PAYLOAD_WORD);
- }
-
-
- for(i = 0; i < 12; i++)
- {
- // printf("Block[%d]: 0x%08X\n", i, (uint32_t)block[i].r32);
- }
-
- control.bits.payload_length = copy_length;
-
- printf("Control0: %x\n", control.r32);
- block[TX_PORT_OUT_ALL_CONTROL_WORD].r32 = control.r32;
-
- length -= control.bits.payload_length;
-
- return copy_length;
-}
-
-uint32_t initAdditionalBlock(RegTX_PORTOut_t* block, int32_t next_block, uint32_t length, uint32_t* packet)
-{
- int i;
- union {
- uint32_t r32;
- struct {
- uint32_t payload_length:7;
- uint32_t next_block:23;
- uint32_t first:1;
- uint32_t not_last:1;
- } bits;
- } control;
-
- control.r32 = 0;
- control.bits.first = 0;
- control.bits.next_block = next_block;
-
- if(length > ((TX_PORT_OUT_ALL_BLOCK_WORDS - TX_PORT_OUT_ALL_ADDITIONAL_PAYLOAD_WORD)*4))
- {
- control.bits.payload_length = (TX_PORT_OUT_ALL_BLOCK_WORDS - TX_PORT_OUT_ALL_ADDITIONAL_PAYLOAD_WORD)*4;
- control.bits.not_last = 1;
- }
- else
- {
- // Last
- control.bits.payload_length = length;
- control.bits.not_last = 0;
- }
-
- // block[1] = uninitialized;
-
- for(i = 0; i < 2; i++)
- {
- // printf("ABlock[%d]: 0x%08X\n", i, (uint32_t)block[i].r32);
- }
-
- // Copy payload data.
- int num_words = (length + sizeof(uint32_t) - 1)/sizeof(uint32_t);
- for(i = 0; i < num_words; i++)
- {
- block[TX_PORT_OUT_ALL_ADDITIONAL_PAYLOAD_WORD + i].r32 = be32toh(packet[i]);
- printf("ABlock[%d]: 0x%08X\n", i+TX_PORT_OUT_ALL_ADDITIONAL_PAYLOAD_WORD, packet[i]);
-
- }
-
- printf("Control: %x\n", control.r32);
- block[TX_PORT_OUT_ALL_CONTROL_WORD].r32 = control.r32;
-
- length -= control.bits.payload_length;
-
- return length;
-}
-
-
-void transmitPacket(uint8_t* packet, uint32_t length)
-{
- uint32_t* packet_32 = (uint32_t*)packet;
- uint32_t consumed = 0;
- uint32_t blocks = allocationBlocksNeeded(length);
- int total_blocks = blocks;;
-
- // First block
- int32_t first = allocateTXBlock();
- int32_t next_block = -1;
- if(blocks > 1)
- {
- next_block = allocateTXBlock();
- }
- RegTX_PORTOut_t* block = &TX_PORT.Out[TX_PORT_OUT_ALL_BLOCK_WORDS * first];
-
- consumed += initFirstBlock(block, length, blocks, next_block, &packet_32[consumed/4]);
- blocks -= 1;
- while(blocks)
- {
-
- block = &TX_PORT.Out[TX_PORT_OUT_ALL_BLOCK_WORDS * next_block];
- blocks--;
- if(blocks)
- {
- next_block = allocateTXBlock();
- consumed += initAdditionalBlock(block, next_block, length-consumed, &packet_32[consumed/4]);
- }
- else
- {
- initAdditionalBlock(block, 0, length - consumed, &packet_32[consumed/4]);
- }
- }
-
- int tail = next_block;
- if(next_block == -1)
- {
- tail = first;
- }
-
- printf("Head: %d, Tail: %d\n", first, tail);
-
- RegAPETxToNetDoorbellFunc0_t doorbell;
- doorbell.r32 = 0;
- doorbell.bits.Head = first;
- doorbell.bits.Tail = tail;
- doorbell.bits.Length = total_blocks;
- doorbell.print();
-
- APE.TxToNetDoorbellFunc0 = doorbell;
- APE.TxToNetDoorbellFunc0.print();
- APE.TxToNetBufferReturn0.print();
-}
-
void step(void)
{
uint32_t oldPC = DEVICE.RxRiscProgramCounter.r32;
@@ -904,14 +639,15 @@ int main(int argc, char const *argv[])
{
DEVICE.ReceiveMacMode.print();
DEVICE.EmacMode.print();
- APE.RxPoolModeStatus0.print();
APE.RxbufoffsetFunc0.print();
+ APE.RxPoolModeStatus0.print();
+
exit(0);
}
if(options.get("tx"))
{
- // allocateTXBlock();
+ DEVICE.GrcModeControl.print();
DEVICE.EmacMode.print();
APE.Mode.print();
APE.Status.print();
@@ -924,18 +660,9 @@ int main(int argc, char const *argv[])
if(APE.TxToNetDoorbellFunc0.bits.TXQueueFull)
{
fprintf(stderr, "TX Queue Full\n");
- // abort();
}
- transmitPacket(ping_packet, 68);
- APE.TxState0.print();
- APE.TxToNetPoolModeStatus0.print();
- APE.TxToNetBufferAllocator0.print();
- APE.TxToNetBufferRing0.print();
- APE.TxToNetBufferReturn0.print();
- APE.TxToNetDoorbellFunc0.print();
exit(0);
-
}
if(options.get("ape"))
@@ -960,88 +687,15 @@ int main(int argc, char const *argv[])
printf("APE RCPU PCI Vendor/Device ID: 0x%08X\n", (uint32_t)SHM.RcpuPciVendorDeviceId.r32);
printf("APE RCPU PCI Subsystem ID: 0x%08X\n", (uint32_t)SHM.RcpuPciSubsystemId.r32);
- // boot_ape_loader();
- // printf("Loader Command: 0x%08X\n", (uint32_t)SHM.LoaderCommand.r32);
- // printf("Loader Arg0: 0x%08X\n", (uint32_t)SHM.LoaderArg0.r32);
- // printf("Loader Arg1: 0x%08X\n", (uint32_t)SHM.LoaderArg1.r32);
-
- // SHM.LoaderArg0.r32 = 0x00100040;
- // SHM.LoaderCommand.bits.Command = SHM_LOADER_COMMAND_COMMAND_READ_MEM;
-
- // // Wait for command to be handled.
- // while(0 != SHM.LoaderCommand.bits.Command);
- // printf("Loader Command: 0x%08X\n", (uint32_t)SHM.LoaderCommand.r32);
- // printf("Loader Arg0: 0x%08X\n", (uint32_t)SHM.LoaderArg0.r32);
- // printf("Loader Arg1: 0x%08X\n", (uint32_t)SHM.LoaderArg1.r32);
-
- // // boot_ape_loader();
- // FILTERS.ElementConfig[0].print();
- // FILTERS.ElementConfig[15].print();
- // FILTERS.ElementConfig[16].print();
- // FILTERS.RuleConfiguration.print();
- // FILTERS.RuleSet[0].print();
- // FILTERS.RuleSet[1].print();
- // FILTERS.RuleSet[2].print();
-
- // NVIC.VectorTableOffset.print();
-
- // NVIC.InterruptControlType.print();
- // NVIC.SystickControlAndStatus.print();
- // NVIC.SystickControlAndStatus.bits.ENABLE = 1;
- // NVIC.SystickControlAndStatus.print();
-
- // NVIC.SystickReloadValue.print();
- // // NVIC.SystickReloadValue.bits.RELOAD=0xFFFFFFFF;
- // NVIC.SystickCurrentValue.print();
- // NVIC.SystickCurrentValue.print();
- // NVIC.SystickCalibrationValue.print();
- // APE_PERI.RmuControl.bits.AutoDrv =1;
APE_PERI.RmuControl.print();
-#if 0
- uint32_t buffer[1024];
-
- RegAPE_PERIBmcToNcRxStatus_t stat;
- stat.r32 = APE_PERI.BmcToNcRxStatus.r32;
- stat.print();
-
- if(stat.bits.New)
- {
- int32_t bytes = stat.bits.PacketLength;
- int i = 0;
- while(bytes > 0)
- {
- uint32_t word = (APE_PERI.BmcToNcReadBuffer.r32);
- buffer[i] = word;
- printf("Word %d: 0x%08X\n", i, word);
- i++;
- bytes -= 4;
- }
- NetworkFrame_t *frame = ((NetworkFrame_t*)buffer);
+ DEVICE.PerfectMatch1High.print();
+ DEVICE.PerfectMatch1Low.print();
- if(stat.bits.Bad)
- {
- // TODO: ACK bad packet.
- APE_PERI.BmcToNcRxControl.bits.ResetBad = 1;
- while(APE_PERI.BmcToNcRxControl.bits.ResetBad);
- }
- else if(!stat.bits.Passthru)
- {
- handleNCSIFrame(frame);
- }
- else
- {
- // Pass through to network
- }
- }
- // printf("REG_APE__NC_BMC_TX_STATUS__IN_FIFO")
- // APE_PERI.BmcToNcTxStatus.print();
- // APE_PERI.BmcToNcTxControl.print();
- // APE_PERI.BmcToNcRxControl.print();
- // APE_PERI.ArbControl.print();
- printf("RegAPENcsiChannel0CtrlstatRx: 0x%08X\n", (uint32_t)SHM_CHANNEL0.NcsiChannelCtrlstatRx.r32);
-#endif
+ APE.TxToNetPoolModeStatus0.print();
+ APE.RxPoolModeStatus0.print();
+
exit(0);
}
OpenPOWER on IntegriCloud