int idle_info_task() { struct StHttpDlInfo *pHttpInfo = GetHttpDlInfo(); static unsigned int last_time = 0; static int end_flash = 0; int speed = 0; int loopmax = 0; int looptotals = 0; int played = 0; int n = 0; char bar[101] = { 0 }; char breaken[10]=" "; while (1) { //bk_wlan_dtim_rf_ps_mode_enable(); //bk_wlan_dtim_rf_ps_timer_start(); if (pHttpInfo->mp3_size <= 0) { Djy_EventDelay(1000*1000); continue; } loopmax = LoopBytesMgrTotals(); looptotals = LoopBytesMgrMax(); last_time = GET_TIME_MS(); memset(bar, '.', sizeof(bar)); bar[100] = 0; n = pHttpInfo->mp3_pos*100/pHttpInfo->mp3_size; if (pHttpInfo->mp3_pos == pHttpInfo->mp3_size) n = 100; memset(bar, '#', n); if (looptotals < pHttpInfo->mp3_pos) { played = pHttpInfo->mp3_pos - looptotals; played = played*100/pHttpInfo->mp3_size; memset(bar, '=', played); } bar[100] = 0; speed = (int)(pHttpInfo->mp3_pos/(GET_TIME_MS()-pHttpInfo->begin))*0.98; if (pHttpInfo->mp3_pos == pHttpInfo->mp3_size) { if (end_flash == 0) printf("[%-100s][%d%%][%dKB/S][%d/%d][%s][LOOP:%d/%d][brate:%d]%s\r\n", bar, n, speed, pHttpInfo->mp3_pos, pHttpInfo->mp3_size, pHttpInfo->url, loopmax, looptotals, Mp3Framebitrate(), breaken); if (pHttpInfo->mp3_size == pHttpInfo->mp3_pos) { end_flash = 1; } } else { end_flash = 0; printf("[%-100s][%d%%][%dKB/S][%d/%d][%s][LOOP:%d/%d][brate:%d]%s\r", bar, n, speed, pHttpInfo->mp3_pos, pHttpInfo->mp3_size, pHttpInfo->url, loopmax, looptotals, Mp3Framebitrate(), breaken); } fflush(stdout); Djy_EventDelay(500*1000); } }
/******************************************************************************* 功能:获取CAN可读寄存器的值。 参数:无. 输出:无。 *******************************************************************************/ static void Sh_CAN_Pkg(void) { uint8_t i,j; gs_CanDebugFlag=true; Djy_EventDelay(3*1000*mS); printf("CAN Pkg Snd/Rcv:\r\n"); printf("%s Snd:\r\n",CN_PRINT_PREFIX); for(i=0;i<CN_DEBUG_CAN_CNT;i++) { printf("%s ID:%d ",CN_PRINT_PREFIX,i); for(j=0;j<13;j++) { printf("0x%x ",gs_SndPkg[13*i+j]); } printf("\r\n"); } printf("%s Rcv:\r\n",CN_PRINT_PREFIX); for(i=0;i<CN_DEBUG_CAN_CNT;i++) { printf("%s ID:%d ",CN_PRINT_PREFIX,i); for(j=0;j<13;j++) { printf("0x%x ",gs_RcvPkg[13*i+j]); } printf("\r\n"); } gs_CanDebugFlag=false; gs_SndDebugCnt=0; gs_RcvDebugCnt=0; memset(gs_SndPkg,0,13*CN_DEBUG_CAN_CNT); memset(gs_RcvPkg,0,13*CN_DEBUG_CAN_CNT); printf("The End.\r\n"); }
void GDD_Execu(struct tagGkWinRsc *desktop) { HWND hwnd; MSG msg; int w,h; pGkWinDesktop=desktop; w=pGkWinDesktop->right-pGkWinDesktop->left; h=pGkWinDesktop->bottom-pGkWinDesktop->top; hwnd =CreateDesktop(desktop_proc,"Desktop", 0,0,w,h, NULL); ShowWindow(hwnd,TRUE); while(1) { if(PeekMessage(&msg,hwnd)) { DispatchMessage(&msg); } else { Djy_EventDelay(mS*50); GDD_TimerExecu(GUI_GetTickMS()); // TouchScreenExecu(); } } }
void djy_main(void) { Led_Task(); // Timer_Test(); mcb1700_display(); while(1) { Djy_EventDelay(500*mS); } }
ptu32_t djy_main(void) { MainTestEntry(); // djyip_main(); while(1) { Djy_EventDelay(1000*mS); } return 0; }
ptu32_t led_flash(void) { while(1) { GPIO_SettoLow(CN_GPIO_C, (1<<4)|(1<<6)|(1<<8)); GPIO_SettoHigh(CN_GPIO_C, (1<<9)); Djy_EventDelay(500*mS); GPIO_SettoLow(CN_GPIO_C, (1<<4)|(1<<6)|(1<<9)); GPIO_SettoHigh(CN_GPIO_C, (1<<8)); Djy_EventDelay(500*mS); GPIO_SettoLow(CN_GPIO_C, (1<<6)|(1<<9)|(1<<8)); GPIO_SettoHigh(CN_GPIO_C, (1<<4)); Djy_EventDelay(500*mS); GPIO_SettoLow(CN_GPIO_C, (1<<9)|(1<<4)|(1<<8)); GPIO_SettoHigh(CN_GPIO_C, (1<<6)); Djy_EventDelay(500*mS); } }
static bool_t __Rtc_SetTime(s64 time) { bool_t result = false; struct tm dtm; s64 time_s; u32 dtime,timout = 1500*mS; time_s = time/1000000; Tm_LocalTime_r(&time_s,&dtm); if((dtm.tm_year > 2000) && (dtm.tm_year < 2099)) { RTC->RTC_CR |= RTC_CR_UPDTIM | RTC_CR_UPDCAL; while((RTC->RTC_SR & RTC_SR_ACKUPD) != RTC_SR_ACKUPD) { Djy_EventDelay(100*mS); timout -= 100*mS; if(timout <= 0) { RTC->RTC_CR &= ~(RTC_CR_UPDCAL | RTC_CR_UPDTIM) ; RTC->RTC_SCCR |= RTC_SCCR_SECCLR; /* clear SECENV in SCCR */ return false; } } // while ((RTC->RTC_SR & RTC_SR_ACKUPD) != RTC_SR_ACKUPD) ; RTC->RTC_SCCR = RTC_SCCR_ACKCLR ; dtime = (HexToBcd(dtm.tm_hour) << RTC_TIMR_HOUR_Pos) | (HexToBcd(dtm.tm_min) << RTC_TIMR_MIN_Pos) | (HexToBcd(dtm.tm_sec) << RTC_TIMR_SEC_Pos); RTC->RTC_TIMR = dtime; if(dtm.tm_wday == 0) dtm.tm_wday = 7; dtime = (HexToBcd(dtm.tm_year - 2000) << RTC_CALR_YEAR_Pos) | (HexToBcd(dtm.tm_mon) << RTC_CALR_MONTH_Pos) | (HexToBcd(dtm.tm_mday) << RTC_CALR_DATE_Pos) | (HexToBcd(dtm.tm_wday) << RTC_CALR_DAY_Pos)| (HexToBcd(20) << RTC_CALR_CENT_Pos); RTC->RTC_CALR = dtime; RTC->RTC_CR &= ~(RTC_CR_UPDCAL | RTC_CR_UPDTIM) ; RTC->RTC_SCCR |= RTC_SCCR_SECCLR; /* clear SECENV in SCCR */ result = !((RTC->RTC_VER & RTC_VER_NVTIM) | (RTC->RTC_VER & RTC_VER_NVCAL)) ; } return result; }
// ============================================================================= // 功能:按页写,最大字节不能超过一页大小的数据,WC是芯片的写控制引脚,每次写之前需拉低 // 电平,写完需拉高电平,但是本板件WC一直是低电平,这样导致写完后,芯片需花一定 // 时间去判断是否写完 // 参数:PageNo,页号 // pSrcBuf,写入的数据 // SrcLen,写入字节数,必须小于一页数据量 // 返回:写入的字节数 // ============================================================================= u32 E2PROM_WritePage(u32 PageNo,u8 *pSrcBuf,u32 SrcLen) { u32 Addr,result=0; if((PageNo > CN_E2ROM_MAX_PAGE) || (SrcLen == 0) || (SrcLen > CN_E2ROM_PAGE_SIZE) || (NULL == pSrcBuf)) return result; Addr = PageNo * CN_E2ROM_PAGE_SIZE; result = IIC_Write(&pg_E2ROM_Dev,Addr,pSrcBuf,SrcLen,1,CN_E2ROM_OP_TIMEOUT); Djy_EventDelay(CN_CHIP_WRITE_FINISHED_TIME); return result; }
ptu32_t EnetTest(void) { u32 i; for(i = 0; i < 128; i ++) { sendbuf[i] = i; } while(1) { Enet_SendPacket(sendbuf,128); Djy_EventDelay(1000*mS); // Enet_RecvPacket(sendbuf); // Djy_EventDelay(1000*mS); } return 0; }
void djy_main(void) { u8 flag =0; djy_printk("Enter djy_main()!\r\n"); Led_Task(); // structtest(); // Enet_Task(); // Lcd_Task(); // if(flag) // GLCD_Task(); // Timer_Test(); while(1) { Djy_EventDelay(500*mS); } }
//----DM9000A初始化------------------------------------------------------------- //功能:初始化DM9000A //参数:无 //返回:正常时返回0,错误时返回错误号 //----------------------------------------------------------------------------- u32 dm9000a_init(void) { u16 i; dm9000a_reset(); // 软件复位 if (dm9000a_probe() != 0) // 探查当前操作的芯片是否为DM9000A(读出ID进行对比) return -1; iow(DM9000A_GPR, 0x00); // PHYPD=0时使能PHY,默认为1表示不使能内部PHY Djy_DelayUs(20*mS); iow(DM9000A_NCR, 0x03); // 选择内部PHY Djy_DelayUs(20); iow(DM9000A_NCR, 0x03); // 选择内部PHY(重复一次) Djy_DelayUs(20); ior(DM9000A_NSR); // 清除发送状态(读取即可清除) dm9000a_set_macaddr(MyMAC); // 设置MAC地址 dm9000a_set_multicastaddr(); // 设置多播地址 set_phy_mode(); // 自动协商 while (!(phyr_h(1) & 0x20)) // 自动协商完成标志位 { Djy_EventDelay(5*mS); // 50mS } // 读回IO、Base模式 ehi.io = (ior(DM9000A_ISR)>>6) & 0x3; ehi.base = (phyr_h(17)>>12) & 0xF; semp_dm9000 = Lock_SempCreate(1, 1, NULL); if (semp_dm9000 == NULL) { return -1; } dm9000a_reset_to_new(); // TODO DM9000A具有IP、UDP、TCP的检验和自动计算功能 //... i = ior(DM9000A_NSR); // xxx del 需要等于0x40才表示连接成功 return 0; }
//----监测CAN通信数据收发情况--------------------------------------------------------- //功能: 监测CAN通信数据收发情况,当2s中CAN控制器收或者发报文数没有变化时,即可认为CAN //控制器出现故障,此时需要将CAN控制器进行复位操作. //参数: 无. //返回: 无. //----------------------------------------------------------------------------- ptu32_t __Can_Monitor(void) { s64 sndcnt[4]={0,0,0,0}; s64 rcvcnt[4]={0,0,0,0}; uint8_t i; bool_t bQiYongFlag[4]={false,false,false,false}; bool_t bRstFlag[4]={false,false,false,false}; while(1) { for(i=0;i<CN_CAN_NUM;i++) { bRstFlag[i]=false; sndcnt[i]=gs_u64HardSndCnt[i]; rcvcnt[i]=gs_u64HardRcvCnt[i]; if((sndcnt[i]!=0)||(rcvcnt[i]!=0)) { bQiYongFlag[i]=true; //表示该CAN总线被启动了,没有启动的总线无需监测。 } } Djy_EventDelay(CN_CAN_DEV_MONITOR_TIME); for(i=0;i<CN_CAN_NUM;i++) { if(bQiYongFlag[i]) { if(sndcnt[i]==gs_u64HardSndCnt[i]) { gs_TxErrRstCnt[i]++; CAN_Hard_Init(i,gs_CANBaudRate[i],NULL); bRstFlag[i]=true; } if(!bRstFlag[i]) { if( rcvcnt[i]==gs_u64HardRcvCnt[i]) { gs_RxErrRstCnt[i]++; CAN_Hard_Init(i,gs_CANBaudRate[i],NULL); } } } } } return 1; }
bool_t tcptstserver(void) { int sockfd; int clientfd; int multiid; int addrlen; int i =0; struct sockaddr_in serveraddr; struct sockaddr_in clientaddr; char *sndbuf; char *rcvbuf; int sndlen; s64 sndtotal; unsigned int sndprint =0; int sndopt; s64 sndtimestart; s64 sndtimetest; int sndspeed; int sndkbytes; int rcvlen; int rcvtotal; int rcvtimes; s64 rcvtimestart; s64 rcvtimeend; u32 nrcvtime; u32 activebits; struct tagMultiplexSetsCB *writesets; u32 badmultiwrite =0; struct tagMultiplexSetsCB *acceptsets; //创建发送集合 activebits = CN_SOCKET_OR | CN_SOCKET_WRITEALBE; writesets = Multiplex_Creat(activebits); if(NULL==writesets) { printk("Create WriteSets failed!\n\r"); } else { printk("Create WriteSets success!\n\r"); } //创建接收客户端集合 activebits = CN_SOCKET_OR | CN_SOCKET_ACCEPT; acceptsets = Multiplex_Creat(activebits); if(NULL==acceptsets) { printk("Create acceptsets failed!\n\r"); } else { printk("Create acceptsets success!\n\r"); } sockfd = socket(AF_INET, SOCK_STREAM, 0); if(-1 == sockfd) { printk("socket failed!\n\r"); return true; } else { printk("socket success!\n\r"); } serveraddr.sin_port = htons(CN_TCP_SERVERPORT); serveraddr.sin_addr.s_addr = htonl(INADDR_ANY); if(-1==bind(sockfd, &serveraddr, sizeof(serveraddr))) { printk("bind failed!\n\r"); return true; } else { printk("bind success!\n\r"); } if(-1 == listen(sockfd, 100)) { printk("listen failed!\n\r"); return true; } else { printk("listen success!\n\r"); } //测试MULTIIO,不断的监视服务器端 //设置为非阻塞 // sndopt = 1; // if(0 == setsockopt(sockfd,SOL_SOCKET ,SO_NOBLOCK,&sndopt,4)) // { // printk("Server:Set server noblock success!\n\r"); // } // else // { // printk("Sever:Set server noblock failed!\n\r"); // } if(Socket_MultiplexAdd(acceptsets,sockfd,CN_SOCKET_ACCEPT)) { printk("add server to acceptsets success!\n\r"); } else { printk("add server to acceptsets failed!\n\r"); } while(1) { if(sockfd != Multiplex_Wait(acceptsets,NULL, CN_TIMEOUT_FOREVER)) { printk("MultiIo activated err!\n\r"); } else { printk("MultiIo activated success!\n\r"); } clientfd = accept(sockfd, &clientaddr, &addrlen); if(clientfd != -1) { printk("Got an client:ip = %08x port = %04x\n\r",\ ntohl(clientaddr.sin_addr.s_addr),ntohs(clientaddr.sin_port)); //关闭NAGLE sndopt = 1; if(0 == setsockopt(clientfd, IPPROTO_TCP,TCP_NODELAY,&sndopt,4)) { printk("Client:close nagle success!\n\r"); } else { printk("Client:close nagle failed!\n\r"); } //设置接收缓冲区 sndopt = CN_RCVBUF_LEN; if(0 == setsockopt(clientfd,SOL_SOCKET ,SO_RCVBUF,&sndopt,4)) { printk("Client:set client sndbuf success!\n\r"); } else { printk("Client:set client sndbuf failed!\n\r"); } //TEST RCV // rcvtotal = 0; // rcvbuf = M_Malloc(CN_RCVBUF_LEN,CN_TIMEOUT_FOREVER); // rcvtimestart = DjyGetTime(); // while(1) // { // rcvlen = recv(clientfd,rcvbuf,CN_RCVBUF_LEN,0); // if(rcvlen>0) // { // rcvtotal+=rcvlen; // rcvtimes++; // } // else // { // printk("Rcv Failed!\n\r"); // } // if(0==rcvtimes%1000) // { // rcvtimeend = DjyGetTime(); // nrcvtime = (u32)(rcvtimeend - rcvtimestart); // printk("Rcv: Len =0x%08x MBytes,Time = 0x%08x us\n\r",\ // rcvtotal/1024/1024,nrcvtime); // } // } //TEST SND //设置发送缓冲区 sndopt = CN_SNDBUF_LEN; if(0 == setsockopt(clientfd,SOL_SOCKET ,SO_SNDBUF,&sndopt,4)) { printk("Client:set client sndbuf success!\n\r"); } else { printk("Client:set client sndbuf failed!\n\r"); } sndbuf = M_Malloc(CN_SNDBUF_LEN,CN_TIMEOUT_FOREVER); for(i = 0; i <CN_SNDBUF_LEN; i++) { sndbuf[i] = 'a'+i%27; } while(1) { sndlen = send(clientfd,sndbuf,CN_SNDBUF_LEN,0); sgSndTimes++; Djy_EventDelay(1000*mS); } //设置接收缓冲区16KB sndopt = 0x4000; if(0 == setsockopt(clientfd,SOL_SOCKET ,SO_RCVBUF,&sndopt,4)) { printk("Client:set client rcvbuf success!\n\r"); } else { printk("Client:set client rcvbuf failed!\n\r"); } //设置发送低水位,发送低水平为28K sndopt = 0x7000; if(0 == setsockopt(clientfd,SOL_SOCKET ,SO_SNDLOWAT,&sndopt,4)) { printk("Client:set client sndbuf trig level success!\n\r"); } else { printk("Client:set client sndbuf trig level failed!\n\r"); } //设置接收水位,4KB sndopt = 0x1000; if(0 == setsockopt(clientfd,SOL_SOCKET ,SO_RCVLOWAT,&sndopt,4)) { printk("Client:set client rcvbuf trig level success!\n\r"); printk("Client:Begin Data Snd Test!\n\r"); } else { printk("Client:set client rcvbuf trig level failed!\n\r"); } //设置为非阻塞 sndopt = 1; if(0 == setsockopt(clientfd,SOL_SOCKET ,SO_NOBLOCK,&sndopt,4)) { printk("Client:Set noblock success!\n\r"); } else { printk("Client:set noblock failed!\n\r"); } // if(Socket_MultiplexAdd(writesets,clientfd,CN_SOCKET_WRITEALBE)) { printk("add client to writesets success!\n\r"); } else { printk("add client to writesets failed!\n\r"); } sndtotal = 0; sndtimestart = DjyGetTime(); while(1) { multiid = Multiplex_Wait(writesets,NULL, CN_TIMEOUT_FOREVER); if(clientfd == multiid) { sndlen = send(clientfd,sndbuf,CN_SNDBUF_LEN,0); sndprint++; if(sndlen >0) { sndtotal += sndlen; if(0 == sndprint%10000) { sndkbytes = sndtotal /1024; sndtimetest = DjyGetTime(); sndtimetest -= sndtimestart; sndspeed = (sndtotal*1000)/sndtimetest; printk("Send Msg:%d kbytes--speed = %d KB/S\n\r",\ sndkbytes,sndspeed); } // Djy_EventDelay(1000*mS); } else { // printk("Client SndSet trigged but could not write!\n\r"); } } else { badmultiwrite++; } } } else { printk("Bad Accept!\n\r"); } } closesocket(sockfd); return true; }
//----posix函数---------------------------------------------------------------- //功能: 符合POSIX接口的usleep函数。POSIX中要求sleep是可以被终止的(例如ctrl-C), // 这个暂不实现。 //参数: useconds,usleep的微秒数 //返回: POSIX要求剩余时间,直接返回0。 //----------------------------------------------------------------------------- int usleep(useconds_t useconds) { Djy_EventDelay(useconds); return 0; }
bool_t UdpServer_Snd(void) { int sockfd; int clientfd; int addrlen; struct sockaddr_in serveraddr; struct sockaddr_in clientaddr; char *rcvbuf; int rcvlen; int sndopt; sockfd = socket(AF_INET, SOCK_DGRAM, 0); if(-1 == sockfd) { printk("socket failed!\n\r"); return false; } else { printk("socket success!\n\r"); } serveraddr.sin_port = htons(CN_UDP_SERVERPORT); serveraddr.sin_addr.s_addr = htonl(INADDR_ANY); if(-1==bind(sockfd, &serveraddr, sizeof(serveraddr))) { printk("bind failed!\n\r"); return false; } else { printk("bind success!\n\r"); } if(-1 == listen(sockfd, 100)) { printk("listen failed!\n\r"); return false; } else { printk("listen success!\n\r"); } while(1) { clientfd = accept(sockfd, &clientaddr, &addrlen); if(clientfd != -1) { printk("Got an client:ip = %08x port = %04x\n\r",\ ntohl(clientaddr.sin_addr.s_addr),ntohs(clientaddr.sin_port)); //关闭NAGLE sndopt = 1; if(0 == setsockopt(clientfd, IPPROTO_TCP,TCP_NODELAY,&sndopt,4)) { printk("Client:close nagle success!\n\r"); } else { printk("Client:close nagle failed!\n\r"); } //设置发送缓冲区 sndopt = CN_SOCKBUF_LEN; if(0 == setsockopt(clientfd,SOL_SOCKET ,SO_SNDBUF,&sndopt,4)) { printk("Client:set client sndbuf success!\n\r"); } else { printk("Client:set client sndbuf failed!\n\r"); } //设置发送缓冲区触发水平 rcvbuf = M_Malloc(CN_BUF_LEN,CN_TIMEOUT_FOREVER); while(1) { rcvlen = recv(clientfd,rcvbuf,CN_BUF_LEN,0); if(rcvlen > 0) { rcvbuf[rcvlen] = '\0'; printk("RcvMsg: %s\n\r",rcvbuf); } else { printk("TcpServerSnd:snd failed!\n\r"); closesocket(clientfd); break; } Djy_EventDelay(1000*mS); } } else { printk("Bad Accept!\n\r"); } } closesocket(sockfd); return true; }
//----CAN发送函数------------------------------------- //功能: CAN发送函数 //参数: // byChip: CAN控制器编号 0~1(为兼容项目组代码,保留此参数,在SR5333中该参数 // 为0,SR5333 V1.01版本中只使用了一个CAN控制器) // txBuf: 报文的发送缓冲区 // len: 发送报文的长度,13的整数倍. //返回: 成功发送的长度 //----------------------------------------------------------------------------- uint32_t CAN_WriteData(uint8_t byChip, uint8_t* txBuf, uint32_t len) { uint32_t Id=0,Len=0; uint8_t pkgnum,i,j; tagCanReg *pCan; sint8_t TxMailboxNo; //参数检查 if(txBuf==NULL) { gs_u64SndPkgBadCnt[byChip]++; return 0; } if(byChip>=2) { gs_u64SndPkgBadCnt[byChip]++; return 0; } if((len%13!=0)||(len==0)) { gs_u64SndPkgBadCnt[byChip]++; return 0; } if(byChip==0) { pCan=(tagCanReg *)CAN1_BASE; } else if(byChip==1) { pCan=(tagCanReg *)CAN2_BASE; } else return false; pkgnum=len/13; gs_u64AppSndCnt[byChip]+=pkgnum; for(i=0;i<pkgnum;i++) { //check Tx mailbox is or not empty TxMailboxNo=__SelectOneEmptyTxMalibox(byChip); if(TxMailboxNo==-1) { //Wait for 5mS Djy_EventDelay(5*mS); TxMailboxNo=__SelectOneEmptyTxMalibox(byChip); if(TxMailboxNo==-1) { gs_u64SndPkgBadCnt[byChip]++; continue; } } Id=0x0000; Id|=(uint32_t)txBuf[1+13*i]<<24; Id|=(uint32_t)txBuf[2+13*i]<<16; Id|=(uint32_t)txBuf[3+13*i]<<8; Id|=(uint32_t)txBuf[4+13*i]; //Request the tx mailbox pCan->sTxMailBox[TxMailboxNo].TIR&=CAN_TI0R_TXRQ; //Set ID and RTR/IDE filed Data frame Extend Frame pCan->sTxMailBox[TxMailboxNo].TIR|=(Id<<3)|(1<<2); //Set DLC filed pCan->sTxMailBox[TxMailboxNo].TDTR&=(uint32_t)0xFFFFFFF0U; pCan->sTxMailBox[TxMailboxNo].TDTR|=0x00000008U; //Set data filed pCan->sTxMailBox[TxMailboxNo].TDLR=(uint32_t)(txBuf[13*i+8]<<24)|\ (uint32_t)(txBuf[13*i+7]<<16)|(uint32_t)(txBuf[13*i+6]<<8)|\ (uint32_t)txBuf[13*i+5]; pCan->sTxMailBox[TxMailboxNo].TDHR=(uint32_t)(txBuf[13*i+12]<<24)|\ (uint32_t)(txBuf[13*i+11]<<16)|(uint32_t)(txBuf[13*i+10]<<8)\ |(uint32_t)txBuf[13*i+9]; //Request transmission pCan->sTxMailBox[TxMailboxNo].TIR|=CAN_TI0R_TXRQ; //Wait for 5ms Djy_EventDelay(5*mS); //查询是否成功发送出去 if(__IsCanTxOk(byChip,TxMailboxNo)) { gs_u64HardSndCnt[byChip]++; Len+=13; } //CAN调试时抓取最近10次发送报文 if(gs_CanDebugFlag) { if(gs_SndDebugCnt<CN_DEBUG_CAN_CNT) { for(j=0;j<13;j++) { gs_SndPkg[gs_SndDebugCnt*13+j]=txBuf[j]; } gs_SndDebugCnt++; } } } return Len; }