修复错误位宽,加入islast

This commit is contained in:
Ruige Lee (WSL)
2025-01-17 16:21:46 +08:00
parent bf0e345cc9
commit 33f2160365
6 changed files with 53 additions and 32 deletions

View File

@@ -85,11 +85,21 @@ void main()
*plic_priority_6 = 1;
*plic_threshold_0 = 0;
{//再写一次实现延迟,等从机的复位完成
*plic_enable_0_31 = 1 << 3 | 1 << 4 | 1 << 5 | 1 << 6;
*plic_priority_3 = 1;
*plic_priority_4 = 1;
*plic_priority_5 = 1;
*plic_priority_6 = 1;
*plic_threshold_0 = 0;
}
*cdr_softReset = 1; //复位脉冲
*cdr_direct = 0;
register uint32_t flag;
*cdr_softReset = 1; //复位脉冲
*cdr_direct = 0;
register uint32_t flag;
// asm volatile ( //timer 2s
// "1:\n"

View File

@@ -86,7 +86,7 @@ void main()
while(1){
*cdr_softReset = 1; //复位脉冲
*cdr_direct = 0;
isLast = *;
isLast = *cdr_IsLast;
// asm volatile(
// "sw x0, 0x10(x0)\n" //cdr_softReset 写入任意值进行复位//复位脉冲
@@ -100,7 +100,7 @@ void main()
// *WriteGpio = 0x01;
//等待接收开始中断
while(!flag_intRxStart)
while(!flag_intRxStart);
// asm volatile (
// "1:\n"
// "andi %0, sp, 0x04\n"
@@ -134,7 +134,7 @@ void main()
//接收本地包
for( uint32_t i = 0; i < 2; i++ ) {
if( *flag_intRxError ){
if( flag_intRxError ){
while(1);
}
*(localData+i) = *cdr_rxFifo;
@@ -151,13 +151,13 @@ void main()
// *WriteGpio = 0x07;
register uint32_t downSendLen;
downSendLen = downRecvLen - 8;
if(!isLast){
// 下行转发新建包头
register uint32_t downSendHead;
*cdr_txLen = downRecvLen;
downSendLen = downRecvLen - 8;
downSendHead = (downSendLen << 20) | ( 0 << 16) | 0;
*cdr_txFifo = downSendHead;
*cdr_txFifo = 0;
@@ -425,7 +425,7 @@ void main()
// );
slvNum = 64 - ( downRecvLen >> 3 );
*WriteGpio = 1 << slvNum;
// *WriteGpio = 1 << slvNum;
} else if ( operator == 1 ){
// error();

View File

@@ -81,7 +81,9 @@ ExampleRocketSystem s_rocket_mst(
.cdrio_uDatIn(uDatSer[0]),
.cdrio_uDatOut(),
.cdrio_dDatIn(1'b0),
.cdrio_dDatOut(dDatSer[0])
.cdrio_dDatOut(dDatSer[0]),
.cdrio_isOnline(),
.cdrio_isLast(1'b0)
);
@@ -138,7 +140,10 @@ ExampleRocketSystem s_rocket_slv0(
.cdrio_uDatIn(uDatSer[1]),
.cdrio_uDatOut(uDatSer[0]),
.cdrio_dDatIn(dDatSer[0]),
.cdrio_dDatOut(dDatSer[1])
.cdrio_dDatOut(dDatSer[1]),
.cdrio_isOnline(),
.cdrio_isLast(1'b0)
);
@@ -195,7 +200,10 @@ ExampleRocketSystem s_rocket_slv1(
.cdrio_uDatIn(uDatSer[2]),
.cdrio_uDatOut(uDatSer[1]),
.cdrio_dDatIn(dDatSer[1]),
.cdrio_dDatOut(dDatSer[2])
.cdrio_dDatOut(dDatSer[2]),
.cdrio_isOnline(),
.cdrio_isLast(1'b0)
);
@@ -252,7 +260,10 @@ ExampleRocketSystem s_rocket_slv2(
.cdrio_uDatIn(1'b0),
.cdrio_uDatOut(uDatSer[2]),
.cdrio_dDatIn(dDatSer[2]),
.cdrio_dDatOut()
.cdrio_dDatOut(),
.cdrio_isOnline(),
.cdrio_isLast(1'b1)
);