/* * MSS_CANYANYIN.C * * Created on:2018 January 2 * *//* * CAN_TRANS.C * * Created on:2017 year June 28 * *//************ Include Files ********* * Standard Include Files. */#include <stdint.h> #include <stdlib.h> #include <stddef.h> #include <string.h> #include < Stdio.h> #include <math.h>/* bios/xdc include Files. * * #include <xdc/std.h> #include <xdc/cfg/global.h> #include <xdc/runtime/IHeap.h> #include <xdc/ runtime/system.h> #include <xdc/runtime/Error.h> #include <xdc/runtime/Memory.h> #include <ti/ sysbios/bios.h> #include <ti/sysbios/knl/Task.h> #include <ti/sysbios/knl/Event.h> #include <ti/ sysbios/knl/semaphore.h> #include <ti/sysbios/knl/Clock.h> #include <ti/sysbios/heaps/heapbuf.h># Include <ti/sysbios/heaps/heapmem.h> #include <ti/sysbios/knl/Event.h> #include <ti/sysbios/family/arm/v7a/pmu.h>/ * Can Drivers Files: */#include <ti/common/sys_common.h> #include <ti/drivers/soc/soc.h> #include <ti/ drivers/canfd/canfd.h> #include <ti/drivers/pinmux/pinmux.h> #include <ti/drivers/esm/esm.h># Include <ti/utils/testlogger/logger.h> #include <ti/drivers/osal/HwiP.h> #include "mss_candriver.h" # Include "mss_qspiflash.h"//#include "mss_alarm.h"//************************************************************* CAN Target Output//**************************************************************************void Cantargetoutput (targetinfo* targetimfomation,uint16_t dspdoutlen) {uint16_t I, J; uint32_t can_id1; CAN_ID1 = TARGETOUTTXID1; uint16_t indextempidinfo[32]; uint16_t targetnumber = 0; memset (&indextempidinfo[0], 0, sizeof (uint16_t) *32); Targetnumber = Dspdoutlen; for (i = 0; I < targetnumber; i++) Indextempidinfo[i] = Targetimfomation[i]. Id; for (i = 0; i <; i++) {if (Targettrackingmcb[i]. Fullenptyflag! = 0) {Targettrackingmcb[i]. Fullenptyflag = 0; for (j = 0; J < Targetnumber; J + +) {if (Targettrackingmcb[i]. Targetid = = Targetimfomation[j]. ID) {Targettrackingmcb[i]. Fullenptyflag = 1; Targettrackingmcb[i]. Targetptr = &TargetImfomation[j]; INDEXTEMPIDINFO[J] = 0; }} if (Targettrackingmcb[i]. Fullenptyflag = = 0) memset (&targettrackingmcb[i], 0, sizeof (targettrackingmcb_t)); } else{Targettrackingmcb[i]. Targetptr = (targetinfo*) &enptytargetinfo[0]; }} i = 0; j = 0; for (i = 0; i < Targetnumber; i++) {if (indextempidinfo[i]! = 0) {j = 0; while (Targettrackingmcb[j]. Fullenptyflag = = 1) {j + +;} TARGETTRACKINGMCB[J]. Fullenptyflag = 1; TARGETTRACKINGMCB[J]. Targetid = Targetimfomation[i]. Id; TARGETTRACKINGMCB[J]. Targetptr = &TargetImfomation[i]; }} for (i = 0; i <; i++) {memset (&uctxmsgdata[0], 0, sizeof (unsigned char) *8); //------------------------------------------------------------------------------------------------------------- -----------//id1//sg_ mmr_target_range_rate:53| [Email protected]+ (0.02,-163.84) [ -163.84|163.82] "m/S" vector__xxx TempData = Targettrackingmcb[i]. targetptr->velocity*5; Htempdata = (TempData >> 8); Ltempdata = TempData; UCTXMSGDATA[6] = (Htempdata & 0x3F); UCTXMSGDATA[7] = Ltempdata; Bit mmr_target_pitch_angle:47| for reserve//sg_ [Email protected]+ (0.1,-25.6) [ -25.6|25.5] "deg" vector__xxx tempdata = 0; Htempdata = (TempData >> 8); Ltempdata = TempData; UCTXMSGDATA[5] = (Htempdata & 0x01); UCTXMSGDATA[5] = uctxmsgdata[5] << 7; UCTXMSGDATA[5] = Uctxmsgdata[5] | (Ltempdata >> 1); UCTXMSGDATA[6] = Uctxmsgdata[6] | ((ltempdata&0x01) <<7); Sg_ mmr_target_range:28| [Email protected]+ (0.05,0) [0|300] "M" vector__xxx tempdata = Targettrackingmcb[i]. targetptr->distance*2; Htempdata = (TempData >> 8); Ltempdata = TempData; UCTXMSGDATA[3] = (Htempdata & 0x1F); UCTXMSGDATA[4] = Ltempdata; Sg_ mmr_target_angle:23| [Email protected]+ (0.1,-102.4) [ -102.4|102.3] "deg" vector__xxx tempdata = Targettrackingmcb[i]. targetptr->angle; Htempdata = (TempData >> 8); Ltempdata = TempData; UCTXMSGDATA[2] = htempdata & (0X07); UCTXMSGDATA[2] = uctxmsgdata[2] << 5; UCTXMSGDATA[2] = uctxmsgdata[2] | (Ltempdata >> 3); UCTXMSGDATA[3] = Uctxmsgdata[3] | ((Ltempdata & (0X07)) << 5); Sg_ Mmr_target_radarmode:15| [Email protected]+ (1,0) [0|1] "" vector__xxx uctxmsgdata[1] = uctxmsgdata[1] | Slmodeflag; Sg_ mmr_target_confidence:14| [Email protected]+ (1,0) [0|100] "%" vector__xxx tempdata = 0; Htempdata = (TempData >> 8); Ltempdata = TempData; UCTXMSGDATA[1] = uctxmsgdata[1] | (Ltempdata >> 1); Sg_ mmr_target_frame_index:7| [Email protected]+ (1,0) [0|0] "Count" vector__xxx tempdata = framecnt & 0x0F; Htempdata = (TempData >> 8); Ltempdata = TempData; Uctxmsgdata[0] = Ltempdata; Uctxmsgdata[0] = uctxmsgdata[0] << 4; Sg_ mmr_target_status:3| [Email protected]+ (1,0) [0|15] "Count" vector__xxx tempdata = 0; Htempdata = (TempData >> 8); Ltempdata = TempData; Uctxmsgdata[0] = Uctxmsgdata[0] | (Ltempdata & 0x0F); RetVal = Canfd_transmitdata (Txmsgobjhandle[i], can_id1+i, canfd_mcanframetyPe_classic, 8U, &uctxmsgdata[0], &errcode); } framecnt++;}
About Motorola's can protocol (processor is big end, protocol is small)