<commit_before>/* utils.c -- Utils for MicroDAQ device
 *
 * Copyright (C) 2013 Embedded Solutions
 * All rights reserved.
 *
 * This software may be modified and distributed under the terms
 * of the BSD license.  See the LICENSE file for details.
 */
 
#if (!defined MATLAB_MEX_FILE) && (!defined MDL_REF_SIM_TGT) 
#include "utils.h"

// Accurate n = ((t us * f MHz) - 5) / 1.65

void delay_accurate (uint32_t n)
{
#if defined(_TMS320C6X)
  asm ("      STW     B0, *+B15[2]    ");
  asm ("      SUB     A4, 24, A4      ");          // Total cycles taken by this function, with n = 0, including clocks taken to jump to this function
  asm ("      CMPGT   A4, 0, B0       ");
  asm ("loop:                         ");
  asm (" [B0] B       loop            ");
  asm (" [B0] SUB     A4, 6, A4       ");          // Cycles taken by loop
  asm ("      CMPGT   A4, 0, B0       ");
  asm ("      NOP     3               ");
  asm ("      LDW     *+B15[2], B0    ");
#endif
}

void delay_us( uint32_t us)
{
	delay_accurate(us * 182);
}

void delay2(uint32_t delay)
{
	volatile cnt; 
	for(cnt = 0; cnt < delay; cnt++); 
}

uint8_t raw_read8(uint32_t addr)
{
	return *(uint8_t *)(addr);
}

uint16_t raw_read16(uint32_t addr)
{
	return *(uint16_t *)(addr);
}
<commit_msg>Missing var type<commit_after>/* utils.c -- Utils for MicroDAQ device
 *
 * Copyright (C) 2013 Embedded Solutions
 * All rights reserved.
 *
 * This software may be modified and distributed under the terms
 * of the BSD license.  See the LICENSE file for details.
 */
 
#if (!defined MATLAB_MEX_FILE) && (!defined MDL_REF_SIM_TGT) 
#include "utils.h"

// Accurate n = ((t us * f MHz) - 5) / 1.65

void delay_accurate (uint32_t n)
{
#if defined(_TMS320C6X)
  asm ("      STW     B0, *+B15[2]    ");
  asm ("      SUB     A4, 24, A4      ");          // Total cycles taken by this function, with n = 0, including clocks taken to jump to this function
  asm ("      CMPGT   A4, 0, B0       ");
  asm ("loop:                         ");
  asm (" [B0] B       loop            ");
  asm (" [B0] SUB     A4, 6, A4       ");          // Cycles taken by loop
  asm ("      CMPGT   A4, 0, B0       ");
  asm ("      NOP     3               ");
  asm ("      LDW     *+B15[2], B0    ");
#endif
}

void delay_us( uint32_t us)
{
	delay_accurate(us * 182);
}

void delay2(uint32_t delay)
{
	volatile int cnt; 
	for(cnt = 0; cnt < delay; cnt++); 
}

uint8_t raw_read8(uint32_t addr)
{
	return *(uint8_t *)(addr);
}

uint16_t raw_read16(uint32_t addr)
{
	return *(uint16_t *)(addr);
}

{'fraction_non_alphanumeric': 0.13591465823785065, 'fraction_numerical': 0.04820229158435401, 'mean_word_length': 2.1029411764705883, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5141413', 'n_tokens_mistral': 1026, 'n_tokens_neox': 935, 'n_words': 289}