static int WritePNGChunk(FILE *fp, uint32 size, char *type, uint8 *data) { uint32 crc; uint8 tempo[4]; tempo[0]=size>>24; tempo[1]=size>>16; tempo[2]=size>>8; tempo[3]=size; if(fwrite(tempo,4,1,fp)!=1) return 0; if(fwrite(type,4,1,fp)!=1) return 0; if(size) if(fwrite(data,1,size,fp)!=size) return 0; crc=CalcCRC32(0,(uint8 *)type,4); if(size) crc=CalcCRC32(crc,data,size); tempo[0]=crc>>24; tempo[1]=crc>>16; tempo[2]=crc>>8; tempo[3]=crc; if(fwrite(tempo,4,1,fp)!=1) return 0; return 1; }
void init ( uint data_rate_kbps, uchar * pBuffer, ushort frame_len, COMPLEX8* pSymbolBuf, ulong symbol_buf_size ) { // TxVector CF_11aTxVector::frame_length() = frame_len; CF_11aTxVector::data_rate_kbps () = data_rate_kbps; // 1Mbps CF_11aTxVector::crc32 () = CalcCRC32(pBuffer, frame_len ); // no CRC32? // TxFrameBuffer CF_TxFrameBuffer::mpdu_buf0 () = pBuffer; CF_TxFrameBuffer::mpdu_buf1 () = NULL; CF_TxFrameBuffer::mpdu_buf_size0 () = frame_len; CF_TxFrameBuffer::mpdu_buf_size1 () = 0; // CF_Error CF_Error::error_code () = E_ERROR_SUCCESS; // CF_Scrambler CF_ScramblerSeed::sc_seed() = 0xFF; // CF_TxSampleBuf CF_TxSampleBuffer::tx_sample_buf () = pSymbolBuf; CF_TxSampleBuffer::tx_sample_buf_size () = symbol_buf_size; }
void PreparePacket(const Config& config, PVOID pSymbolBuffer, ULONG SymbolBufferSize) { UINT i; PUCHAR pbIn = DataBuffer; //ULONG CRC32; unsigned int DataSize = config.GetPayloadLength(); assert(DataBufferSize >= DataSize + 4); for (i = 0; i < DataSize; i++) { *pbIn = 'A'; pbIn++; } PDOT11RFC1042ENCAP pWlanHeader = (PDOT11RFC1042ENCAP)DataBuffer; pWlanHeader->MacHeader.FrameControl.Type = FRAME_DATA; *(PULONG)pbIn = CalcCRC32(DataBuffer, DataSize); Mdl.Next = NULL; Mdl.StartVa = (PULONG)DataBuffer; Mdl.ByteOffset = 0; Mdl.MappedSystemVa = (PULONG)DataBuffer; Mdl.ByteCount = DataSize; Packet.pMdl = &Mdl; Packet.PacketSize = DataSize; Packet.pReserved = pSymbolBuffer; Packet.Reserved2 = SymbolBufferSize; Packet.Reserved1 = *(PULONG)(DataBuffer + DataSize); TxVector.ti_uiDataRate = Dot11ADataRate_Kbps2Code(config.GetDataRate()); TxVector.ti_uiBufferLength = DataSize; TxVector.SampleRate = config.GetSampleRate(); }
void CLicenseKey::InitUID() { USES_CONVERSION; TCHAR szDir [MAX_PATH]; ::GetWindowsDirectory (szDir, MAX_PATH); TCHAR szDrive [MAX_PATH]; _tsplitpath_s (szDir, szDrive,MAX_PATH, NULL,0, NULL,0, NULL,0); DWORD dwSerialNumber=0; ::GetVolumeInformation (szDrive, NULL, 0, &dwSerialNumber, NULL, NULL, NULL, 0 ); int nLen = _tcslen (szDrive); if (nLen < MAX_PATH) { szDrive[nLen] = _T('\\'); szDrive[nLen+1] = _T('\0'); } CString m_strUID; m_strUID.Format (_T("%s%X%s%s"), m_szAppName, dwSerialNumber, (LPCTSTR)theApp.GetUser(), (LPCTSTR)theApp.GetCompany() ); LPCSTR szUID = T2CA ( m_strUID ); long nUID = CalcCRC32(szUID, m_strUID.GetLength() ); nUID = nUID < 0 ? -nUID : nUID; m_nUID = nUID; }
void InitPConnection(void) { extern int32_t _flash_end; fwid = CalcCRC32((uint8_t *)(FLASH_BASE_ADDR), (uint32_t)(&_flash_end) & 0x07FFFFF); /* * Initializes a serial-over-USB CDC driver. */ mduObjectInit(&MDU1); mduStart(&MDU1, &midiusbcfg); bduObjectInit(&BDU1); bduStart(&BDU1, &bulkusbcfg); /* * Activates the USB driver and then the USB bus pull-up on D+. * Note, a delay is inserted in order to not have to disconnect the cable * after a reset. */ usbDisconnectBus(midiusbcfg.usbp); chThdSleepMilliseconds(1000); usbStart(midiusbcfg.usbp, &usbcfg); usbConnectBus(midiusbcfg.usbp); chThdCreateStatic(waThreadUSBDMidi, sizeof(waThreadUSBDMidi), NORMALPRIO, ThreadUSBDMidi, NULL); }
// set data packet without crc16 static void Dot11BPreparePacket(const Config& config, PVOID pSymbolBuffer, ULONG SymbolBufferSize) { ULONG i; PUCHAR pbIn = DataBuffer; unsigned int dataSize = config.GetPayloadLength(); assert(DataBufferSize >= dataSize + 4); for (i = 0; i < dataSize; i++) { *pbIn = 'B'; pbIn++; } PDOT11RFC1042ENCAP pWlanHeader = (PDOT11RFC1042ENCAP)DataBuffer; pWlanHeader->MacHeader.FrameControl.Type = FRAME_DATA; *(PULONG)pbIn = CalcCRC32(DataBuffer, dataSize); Mdl.Next = NULL; Mdl.StartVa = (PULONG)DataBuffer; Mdl.ByteOffset = 0; Mdl.MappedSystemVa = (PULONG)DataBuffer; Mdl.ByteCount = dataSize; Packet.pMdl = &Mdl; Packet.PacketSize = dataSize; Packet.pReserved = pSymbolBuffer; Packet.Reserved2 = SymbolBufferSize; Packet.Reserved1 = *(PULONG)(DataBuffer + dataSize); TxVector.DateRate = Dot11BDataRate_Kbps2Code(config.GetDataRate()); TxVector.PreambleType = DOT11B_PLCP_IS_LONG_PREAMBLE; }
FRandom::FRandom (const char *name) { NameCRC = CalcCRC32 ((const BYTE *)name, (unsigned int)strlen (name)); #ifndef NDEBUG initialized = false; Name = name; // A CRC of 0 is reserved for nameless RNGs that don't get stored // in savegames. The chance is very low that you would get a CRC of 0, // but it's still possible. assert (NameCRC != 0); #endif // Insert the RNG in the list, sorted by CRC FRandom **prev = &RNGList, *probe = RNGList; while (probe != NULL && probe->NameCRC < NameCRC) { prev = &probe->Next; probe = probe->Next; } #ifndef NDEBUG if (probe != NULL) { // Because RNGs are identified by their CRCs in save games, // no two RNGs can have names that hash to the same CRC. // Obviously, this means every RNG must have a unique name. assert (probe->NameCRC != NameCRC); } #endif Next = probe; *prev = this; }
FRandom *FRandom::StaticFindRNG (const char *name) { DWORD NameCRC = CalcCRC32 ((const BYTE *)name, (unsigned int)strlen (name)); // Use the default RNG if this one happens to have a CRC of 0. if (NameCRC == 0) return &pr_exrandom; // Find the RNG in the list, sorted by CRC FRandom **prev = &RNGList, *probe = RNGList; while (probe != NULL && probe->NameCRC < NameCRC) { prev = &probe->Next; probe = probe->Next; } // Found one so return it. if (probe == NULL || probe->NameCRC != NameCRC) { // A matching RNG doesn't exist yet so create it. probe = new FRandom(name); // Store the new RNG for destruction when ZDoom quits. NewRNGs.Push(probe); } return probe; }
// возвращает рассчитанное значение CRC static uint64 crcCalculate(byte *data, uint32 datasize) { byte FieldSize = crcGetFieldSize(datasize); switch (FieldSize) { case 1: return CalcCRC8(data, datasize); case 2: return CalcCRC16(data, datasize); case 4: return CalcCRC32(data, datasize); case 8: return CalcCRC64(data, datasize); default: printf("Invalid CRCFieldSize size: %d\n", FieldSize); break; } return 0xFFFFFFFF; }
BOOLEAN Test11AACK(PDOT11_MOD_ARGS pArgs) { static A16 COMPLEX8 AckBuffer[16 * 1024]; MAC_ADDRESS RecvMacAddress; RecvMacAddress.Address[0] = 0x00; RecvMacAddress.Address[1] = 0x14; RecvMacAddress.Address[2] = 0x6c; RecvMacAddress.Address[3] = 0xe2; RecvMacAddress.Address[4] = 0x00; RecvMacAddress.Address[5] = 0xe5; ULONG OutputLengthInBytes = BB11AModulateACK(pArgs->SampleRate, &RecvMacAddress, AckBuffer); DOT11_MAC_ACK_FRAME AckFrame = {0}; BB11A_TX_VECTOR Dot11ATxVector = {0}; ULONG ulCRC; AckFrame.FrameControl.Subtype = SUBT_ACK; AckFrame.FrameControl.Type = FRAME_CTRL; AckFrame.RecvAddress = RecvMacAddress; AckFrame.Duration = 0; AckFrame.FCS = ulCRC = CalcCRC32((PUCHAR)&AckFrame, sizeof(DOT11_MAC_ACK_FRAME) - sizeof(ULONG)); Dot11ATxVector.ti_uiBufferLength = sizeof(DOT11_MAC_ACK_FRAME); Dot11ATxVector.ti_uiDataRate = DOT11A_RATE_6M; Dot11ATxVector.SampleRate = pArgs->SampleRate; Mdl.Next = NULL; Mdl.StartVa = (PULONG)&AckFrame; Mdl.ByteOffset = 0; Mdl.MappedSystemVa = (PULONG)&AckFrame; Mdl.ByteCount = sizeof(DOT11_MAC_ACK_FRAME) - 4; Packet.pReserved = (PVOID)SymbolBuffer; Packet.Reserved2 = SYMBOLBUF_SIZE; Packet.pMdl = &Mdl; Packet.Reserved1 = ulCRC; Packet.PacketSize = sizeof(DOT11_MAC_ACK_FRAME) - 4; BB11ATxFrameMod(&Dot11ATxVector, &Packet); if(memcmp(AckBuffer, SymbolBuffer, OutputLengthInBytes) == 0) { printf("802.11a ACK test OK!(ACK size: %d)\n", OutputLengthInBytes); return TRUE; } printf("802.11a ACK test Fail!(ACK size: %d)\n", OutputLengthInBytes); return FALSE; }
/************************************************************************** * function name : UUID_setFormatEmmcUuid_imp * function describe : get uuid from OTP memory * in parameter : int uuid_len : need to get length(Byte) * out parameter : * author : * create time : * return value : UUID memory : get uuid SUCCESS NULL : set uuid FAIL * remarks : the uuid lenght is less then 24 Byte **************************************************************************/ unsigned char *UUID_getFormatEmmcUuid_imp( int uuid_len ) { static unsigned char u8buf[32] = {0}; unsigned int crc32 = 0; unsigned int i = 0; if (uuid_len > 24) { UUIDLOGE("Invalid UUID length!"); return FALSE; } /** get UUID from OTP */ if (HI_UNF_OTP_Open() != HI_SUCCESS) { UUIDLOGE("Open OTP failed!"); return NULL; } if (HI_UNF_OTP_GetCustomerKey(u8buf, 16) != HI_SUCCESS) { UUIDLOGE("1:Get UUID failed!"); goto ERR; } for (i = 0; i < 16; i++) { if (HI_UNF_OTP_GetStbPrivData(i, &u8buf[i + 16]) != HI_SUCCESS) { UUIDLOGE("2:Get UUID failed!"); goto ERR; } } memcpy((unsigned char *)&crc32, (unsigned char *)&u8buf[24], 4); //crc32 = *(unsigned int *)&u8buf[24]; if (crc32 != CalcCRC32(u8buf, 24)) { UUIDLOGE("UUID not correct!"); goto ERR; } memset(&u8buf[24], 0, (32 - 24)); // *(unsigned int *)&u8buf[24] = 0; HI_UNF_OTP_Close(); return u8buf; ERR: HI_UNF_OTP_Close(); return NULL; }
/************************************************************************** * function name : UUID_setFormatEmmcUuid_imp * function describe : write uuid to OTP memory * in parameter : unsigned char *uuid : uuid buffer pointer int len : uuid string length(Byte) * out parameter : * author : * create time : * return value : TRUE : set uuid SUCCESS FALSE : set uuid FAIL * remarks : the uuid lenght is less then 24 Byte **************************************************************************/ BOOL UUID_setFormatEmmcUuid_imp(unsigned char *uuid, int len) { unsigned char u8buf[32] = {0}; unsigned int crc32 = 0; unsigned int i = 0; if (len > 24) { UUIDLOGE("Invalid UUID length!"); return FALSE; } memcpy(u8buf, uuid, len); crc32 = CalcCRC32(u8buf, 24); memcpy((unsigned char *)(&(u8buf[24])), (unsigned char *)(&crc32), 4); //*(unsigned int *)&u8buf[24] = crc32; /** write UUID to OTP */ if (HI_UNF_OTP_Open() != HI_SUCCESS) { UUIDLOGE("Open OTP failed!"); return FALSE; } if (HI_UNF_OTP_SetCustomerKey(u8buf, 16) != HI_SUCCESS) { UUIDLOGE("1:Set UUID failed!"); HI_UNF_OTP_Close(); return FALSE; } for (i = 0; i < 16; i++) { if (HI_UNF_OTP_SetStbPrivData(i, u8buf[i + 16]) != HI_SUCCESS) { UUIDLOGE("2:Set UUID failed!"); HI_UNF_OTP_Close(); return FALSE; } } HI_UNF_OTP_Close(); return TRUE; }
// calculate CRC32 on file UDWORD CDiskImage::CrcFile(PCAPSFILE pcf) { UDWORD crc=0; // shortcut for memory files if (pcf->flag & CFF_MEMMAP) { if (!pcf->memmap || pcf->size<0) return crc; return CalcCRC(pcf->memmap, pcf->size); } // open file CCapsFile file; if (file.Open(pcf)) return crc; int len=file.GetSize(); if (len) { int bufsize=DEF_CRCBUF; PUBYTE buf=new UBYTE[bufsize]; // calculate CRC32 on file while (len) { int size=len > bufsize ? bufsize : len; if (file.Read(buf, size) != size) { crc=0; break; } crc=CalcCRC32(buf, size, crc); len-=size; } delete [] buf; } return crc; }
// создаёт поле CRC. Возвращает его размер static byte crcMakeField(byte *data, uint32 datasize, byte *crcbuffer) { byte FieldSize = crcGetFieldSize(datasize); switch (FieldSize) { case 1: crcbuffer[0] = CalcCRC8(data, datasize); break; case 2: { word crc16 = CalcCRC16(data, datasize); if (IsLittleEndian()) memrev(&crc16, sizeof(crc16)); memcpy(crcbuffer, &crc16, sizeof(crc16)); break; } case 4: { uint32 crc32 = CalcCRC32(data, datasize); if (IsLittleEndian()) memrev(&crc32, sizeof(crc32)); memcpy(crcbuffer, &crc32, sizeof(crc32)); break; } case 8: { uint64 crc64 = CalcCRC64(data, datasize); if (IsLittleEndian()) memrev(&crc64, sizeof(crc64)); memcpy(crcbuffer, &crc64, sizeof(crc64)); break; } default: printf("Invalid CRCFieldSize size: %d\n", FieldSize); break; } return FieldSize; }
ULONG TestModAck(PUCHAR PhyACKBuffer) { int i; ULONG crc32; DOT11_MAC_ACK_FRAME AckFrame = {0}; DOT11B_PLCP_TXVECTOR Dot11BTxVector = {0}; UINT OutputLength = 0; ULONG OutputLengthFIR = 0; MAC_ADDRESS RecvMacAddress; RecvMacAddress.Address[0] = 0x00; RecvMacAddress.Address[1] = 0x14; RecvMacAddress.Address[2] = 0x6c; RecvMacAddress.Address[3] = 0xe2; RecvMacAddress.Address[4] = 0x00; RecvMacAddress.Address[5] = 0xe5; AckFrame.FrameControl.Subtype = SUBT_ACK; AckFrame.FrameControl.Type = FRAME_CTRL; AckFrame.RecvAddress = RecvMacAddress; AckFrame.Duration = 0; AckFrame.FCS = CalcCRC32((PUCHAR)&AckFrame, sizeof(DOT11_MAC_ACK_FRAME) - sizeof(ULONG)); Dot11BTxVector.PreambleType = DOT11B_PLCP_IS_SHORT_PREAMBLE; Dot11BTxVector.DateRate = DOT11B_PLCP_DATA_RATE_2M; Dot11BTxVector.ModSelect = DOT11B_PLCP_IS_CCK; BB11BPMDBufferTx4XWithShortHeader( &Dot11BTxVector, (PUCHAR)&AckFrame, sizeof(DOT11_MAC_ACK_FRAME) - 4, (PUCHAR)TempAckIntermidiateOutput, &OutputLength); //OutputLength is COMPLEX8 count crc32 = CalcCRC32((PUCHAR)TempAckIntermidiateOutput, OutputLength * sizeof(COMPLEX8)); //printf("inter crc32=0x%08x\n", crc32); if (crc32 != 0xaca87240) { printf("crc32 for FIR input is different, 0x%08x", crc32); } memset(((PUCHAR)TempAckIntermidiateOutput) + OutputLength * sizeof(COMPLEX8), 0x00, 64); Save((PUCHAR)TempAckIntermidiateOutput, OutputLength * sizeof(COMPLEX8)); BB11BPMDSpreadFIR4SSE( TempAckIntermidiateOutput, OutputLength, (PCOMPLEX8)PhyACKBuffer, &OutputLengthFIR); for (i = 0; i < 512; i++) { if (temp[i] != PhyACKBuffer[OutputLength * sizeof(COMPLEX8) - 512 + i]) { printf("bug exists\n"); printf("%d\n", PhyACKBuffer[OutputLength * sizeof(COMPLEX8) - 512 + i]); break; } } crc32 = CalcCRC32((PUCHAR)PhyACKBuffer, OutputLength * sizeof(COMPLEX8)); //printf("out crc32=0x%08x\n", crc32); if (crc32 != 0xfdf0c0fc) { printf("crc32 for FIR input is different, 0x%08x\n", crc32); } else { Save((PUCHAR)PhyACKBuffer, OutputLength * sizeof(COMPLEX8)); } ASSERT(OutputLength == OutputLengthFIR); return OutputLength * sizeof(COMPLEX8); }
uint32 FCEUI_CRC32(uint32 crc, uint8 *buf, uint32 len) { return(CalcCRC32(crc,buf,len)); }
void CCRC32::AddDataBlock(BYTE* pData, unsigned length) { for(unsigned i = 0; i < length; i++) CalcCRC32(pData[i]); }
int main(void) { DMA1_Stream0->CR=0; DMA1_Stream1->CR=0; DMA1_Stream2->CR=0; DMA1_Stream3->CR=0; DMA1_Stream4->CR=0; DMA1_Stream5->CR=0; DMA1_Stream6->CR=0; DMA1_Stream7->CR=0; DMA2_Stream0->CR=0; DMA2_Stream1->CR=0; DMA2_Stream2->CR=0; DMA2_Stream3->CR=0; DMA2_Stream4->CR=0; DMA2_Stream5->CR=0; DMA2_Stream6->CR=0; DMA2_Stream7->CR=0; palClearPad(GPIOD,7); // disable USBH power // copy vector table memcpy((char *)0x20000000, (const char *)&_vectors, 0x200); // remap SRAM1 to 0x00000000 SYSCFG->MEMRMP |= 0x03; // FMC_SDRAMDeInit(0); // RCC->AHB3RSTR |= 1; //RCC_AHB3RSTR_FMCRST RCC->AHB3ENR |= 1; //RCC_AHB3ENR_FMCEN; // HAL_DeInit(); // HAL_Init(); watchdog_feed(); halInit(); // float usb inputs, hope the host notices detach... palSetPadMode(GPIOA, 11, PAL_MODE_INPUT); palSetPadMode(GPIOA, 12, PAL_MODE_INPUT); // setup LEDs palSetPadMode(LED1_PORT,LED1_PIN,PAL_MODE_OUTPUT_PUSHPULL); palSetPad(LED1_PORT,LED1_PIN); #ifdef LED2_PIN palSetPadMode(LED2_PORT,LED2_PIN,PAL_MODE_OUTPUT_PUSHPULL); #endif chSysInit(); watchdog_feed(); configSDRAM(); #ifdef SERIALDEBUG // SD2 for serial debug output palSetPadMode(GPIOA, 3, PAL_MODE_ALTERNATE(7) | PAL_MODE_INPUT); // RX palSetPadMode(GPIOA, 2, PAL_MODE_OUTPUT_PUSHPULL); // TX palSetPadMode(GPIOA, 2, PAL_MODE_ALTERNATE(7)); // TX // 115200 baud static const SerialConfig sd2Cfg = {115200, 0, 0, 0}; sdStart(&SD2, &sd2Cfg); #endif DBGPRINTCHAR('a'); uint32_t pbuf[16]; SDRAM_ReadBuffer(&pbuf[0], 0 + 0x050000, 16); DBGPRINTCHAR('x'); watchdog_feed(); uint32_t *sdram32 = (uint32_t *)SDRAM_BANK_ADDR; uint8_t *sdram8 = (uint8_t *)SDRAM_BANK_ADDR; if ((sdram8[0] != 'f') || (sdram8[1] != 'l') || (sdram8[2] != 'a') || (sdram8[3] != 's') || (sdram8[4] != 'c') || (sdram8[5] != 'o') || (sdram8[6] != 'p') || (sdram8[7] != 'y')) { DispayAbortErr(1); } DBGPRINTCHAR('b'); uint32_t flength = sdram32[2]; uint32_t fcrc = sdram32[3]; if (flength > 1 * 1024 * 1024) { DispayAbortErr(2); } DBGPRINTCHAR('c'); DBGPRINTHEX(flength); uint32_t ccrc = CalcCRC32((uint8_t *)(SDRAM_BANK_ADDR + 0x010), flength); DBGPRINTCHAR('d'); DBGPRINTHEX(ccrc); DBGPRINTHEX(fcrc); if (ccrc != fcrc) { DispayAbortErr(3); } DBGPRINTCHAR('e'); // unlock sequence FLASH->KEYR = 0x45670123; FLASH->KEYR = 0xCDEF89AB; uint32_t i; for (i = 0; i < 12; i++) { flash_Erase_sector(i); LCD_drawStringN(0, 3, "Erased sector", 128); LCD_drawNumber3D(80, 3, i); refresh_LCD(); palWritePad(LED2_PORT,LED2_PIN,1); chThdSleepMilliseconds(100); palWritePad(LED2_PORT,LED2_PIN,0); DBGPRINTCHAR('f'); DBGPRINTHEX(i); } DBGPRINTCHAR('g'); DBGPRINTHEX(flength); ccrc = CalcCRC32((uint8_t *)(SDRAM_BANK_ADDR + 0x010), flength); DBGPRINTCHAR('h'); DBGPRINTHEX(ccrc); DBGPRINTHEX(fcrc); if (ccrc != fcrc) { DispayAbortErr(4); } DBGPRINTCHAR('i'); int destptr = FLASH_BASE_ADDR; // flash base adress uint32_t *srcptr = (uint32_t *)(SDRAM_BANK_ADDR + 0x010); // sdram base adress + header offset for (i = 0; i < (flength + 3) / 4; i++) { uint32_t d = *srcptr; flash_ProgramWord(destptr, d); if ((FLASH->SR != 0) && (FLASH->SR != 1)) { DBGPRINTCHAR('z'); DBGPRINTHEX(FLASH->SR); } // DBGPRINTHEX(f); if ((i & 0xFFF) == 0) { palWritePad(LED2_PORT,LED2_PIN,1); chThdSleepMilliseconds(100); palWritePad(LED2_PORT,LED2_PIN,0); DBGPRINTCHAR('j'); DBGPRINTHEX(destptr); DBGPRINTHEX(*(srcptr)); } destptr += 4; srcptr++; } DBGPRINTCHAR('k'); ccrc = CalcCRC32((uint8_t *)(FLASH_BASE_ADDR), flength); DBGPRINTCHAR('l'); DBGPRINTHEX(ccrc); DBGPRINTHEX(fcrc); if (ccrc != fcrc) { DispayAbortErr(5); } DBGPRINTCHAR('\r'); DBGPRINTCHAR('\n'); DBGPRINTCHAR('S'); DBGPRINTCHAR('U'); DBGPRINTCHAR('C'); DBGPRINTCHAR('C'); DBGPRINTCHAR('E'); DBGPRINTCHAR('S'); DBGPRINTCHAR('S'); DBGPRINTCHAR('\r'); DBGPRINTCHAR('\n'); chThdSleepMilliseconds(1000); NVIC_SystemReset(); return 0; }