修复错误位宽,加入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();