//----将CAN硬件接收到的数据写进环形缓冲区中--------------------------------------------------------- //功能: 将CAN硬件接收到的数据写进环形缓冲区中,每帧向缓冲区写入13bytes. //参数: rxMsg,CAN接收数据结构体; //返回: 空 //----------------------------------------------------------------------------- static void __WriteMsgToRing(uint8_t byChip,CanRxMsg rxMsg) { uint8_t i,j; uint8_t buf[13]; uint32_t can_id,tmp; CAN_DevCtrl *CAN_DevCtrlTempptr=NULL; struct RingBuf *rxRingBuf=NULL; buf[0]=0x88; can_id=rxMsg.ExtId; tmp=can_id; buf[1]=tmp; buf[2]=tmp>>8; buf[3]=tmp>>16; buf[4]=tmp>>24; for(i=0;i<8;i++) { buf[5+i]=rxMsg.Data[i]; } CAN_DevCtrlTempptr=CAN_DevCtrlPtr+byChip; rxRingBuf=CAN_DevCtrlTempptr->RcvRing; Ring_Write(rxRingBuf,buf,13); gs_u64HardRcvCnt[byChip]++; //CAN调试抓取最近10次接收报文 if(gs_CanDebugFlag) { if(gs_RcvDebugCnt<CN_DEBUG_CAN_CNT) { for(j=0;j<13;j++) { gs_RcvPkg[gs_RcvDebugCnt*13+j]=buf[j]; } gs_RcvDebugCnt++; } } }
u32 cmd_int(ufast_t uart_int_line) { u32 len; len = strlen(scanf_buf); //copy整个硬件缓冲区到协议缓冲区 Ring_Write(&recv_ring_buf, (u8*)scanf_buf,len); MplCmdStatus |= CN_MULTIPLEX_SENSINGBIT_READ; Multiplex_Set(pMultiplexCmd,MplCmdStatus); return 0; }