Example #1
0
void  ADSamplTask(void *p_arg)
{
    int16_t buff[4];
    uint8_t i;
     
    while(TRUE_P)
    {
       __memset(buff, 0, 8);
       for (i = 0; i < 4; i++)
       {
           if (SysAppCfg.ad_chnnl_use[i])
           {
               buff[i] = ADSampl(i);
               //OS_Trace("AD Value = %d\n",buff[i]);
           }

       }
       
       SendFrame(FRM_CMD_AD_V,  (uint8_t *)buff, 8);   //8即8个字节

       OSTimeDlyHMSM(0, 0, 0, 300);
    
    }

}
Example #2
0
static int readData(UINT32 bytesToRead, BYTE **buffer)
{
	FILE *infile = NULL;
	size_t iBytes;
	int rc = 0;
	BYTE eofile;

	__memset(*buffer, 0x00, bytesToRead);
	infile = fopen(in_filename, "r");
	if ( !infile ){
		logError(_("Unable to open input file: %s\n"),
				in_filename);
		return -1;
	}

	//Read the data
	iBytes = fread( *buffer, 1, bytesToRead, infile );
	if ( iBytes < bytesToRead ) {
		logError(_("Error: the secret data file %s contains less than %d bytes. Aborting ...\n"),
				in_filename, bytesToRead);
		rc = -1;
	} else if ( (iBytes = fread( &eofile, 1, 1, infile )) ) {
		//Test if there's more than 20 bytes
		if ( !feof( infile))
			logMsg(_("WARNING: Using only the first %d bytes of file %s for secret data\n"),
					bytesToRead, in_filename);
	} else {
		logDebug(_("Read %d bytes of secret data from file %s.\n"),
			 bytesToRead, in_filename);
	}

	fclose( infile);
	return rc;
}
Example #3
0
void kasan_init_slab_obj(struct kmem_cache *cache, const void *object)
{
	struct kasan_alloc_meta *alloc_info;

	if (!(cache->flags & SLAB_KASAN))
		return;

	alloc_info = get_alloc_info(cache, object);
	__memset(alloc_info, 0, sizeof(*alloc_info));
}
Example #4
0
/* *
 * memset - sets the first @n bytes of the memory area pointed by @s
 * to the specified value @c.
 * @s:      pointer the the memory area to fill
 * @c:      value to set
 * @n:      number of bytes to be set to the value
 *
 * The memset() function returns @s.
 * */
void *memset(void *s, char c, size_t n)
{
#ifdef __HAVE_ARCH_MEMSET
	return __memset(s, c, n);
#else
	char *p = s;
	while (n-- > 0) {
		*p++ = c;
	}
	return s;
#endif /* __HAVE_ARCH_MEMSET */
}
Example #5
0
static void memset_func() {
	/* Compare the whole val area and memset arguemnt that is in range of 1 byte(int8_t) */
	char* val;
	for(int i = 1; i < 4000; i++) {
		val = malloc(i * sizeof(char));
		for(int j = -128; j < 128; j++) {
			__memset(val, j, i * sizeof(char));
			for(int x = 0; x < i; x++) {
				assert_int_equal(j, val[x]);
			}
		}

		free(val);
		val = NULL;
	}
}
Example #6
0
void *memset(void *addr, int c, size_t len)
{
	check_memory_region((unsigned long)addr, len, true, _RET_IP_);

	return __memset(addr, c, len);
}
Example #7
0
void *
memset(void *dst, int c, size_t n)
{
	return __memset(dst, c, n);
}
Example #8
0
void * memset(void * s, int c, size_t n)
{
  return __memset(s, c, n);
}
Example #9
0
void *__constant_c_memset(void *dest, char c, size_t n)
{
	return __memset(dest, c, n);
}
__visible void *memset(void *s, int c, size_t count)
{
	return __memset(s, c, count);
}
Example #11
0
int main(int argc, char * const argv[])
{
	int pfd = -1;
	int fd = -1;
	int ret = EXIT_FAILURE;
	struct epoll_event epoll_event;
	static struct options_t options = {
		.timeout = -1,
	};
	size_t size = 0;

	int argi = parse_arguments(&options, argc, argv);
	if (argi < 0) {
		exit(EXIT_FAILURE);
	}
	else if (argc - argi >= 1) {
		usage(stdout, argv[0]);
		fprintf(stderr, "Error: Too many arguments!\n");
		exit(EXIT_FAILURE);
	}

	pfd = epoll_create(1);
	if (pfd < 0) {
		perror("epoll_create");
		exit(EXIT_FAILURE);
	}

	fd = STDIN_FILENO;
	epoll_event.events = EPOLLIN;
	epoll_event.data.fd = fd;
	ret = epoll_ctl(pfd, EPOLL_CTL_ADD, fd, &epoll_event);
	if (ret) {
		perror("epoll_ctl");
		fd = -1;
		goto exit;
	}

	DUMPFOOTER = 0;
	DUMPADDR = 1;
	for (;;) {
		ssize_t s;
		char buf[BUFSIZE];
		__memset(buf, 0);
		ret = epoll_wait(pfd, &epoll_event, 1, options.timeout);
		if (ret < 0) {
			perror("epoll_wait");
			break;
		}
		else if (!ret) {
			fprintf(stderr, "%s: %s\n", "epoll_wait", strerror(ETIME));
			ret = -1;
			break;
		}

		s = read(fd, buf, sizeof(buf));
		if (s < 0) {
			perror("read");
			ret = s;
			break;
		}
		else if (!s) {
			break;
		}
		buf[s] = 0;
		hexdump(size, buf, s);
		size += s;

		if (size)
			DUMPHEADER = 0;
	}

	if (size)
		printf("%08x\n", size);

exit:
	if (fd > -1) {
		epoll_ctl(pfd, EPOLL_CTL_DEL, fd, &epoll_event);
	}

	if (pfd) {
		close(pfd);
		pfd = -1;
	}

	return !ret ? EXIT_SUCCESS : EXIT_FAILURE;
}
Example #12
0
void *memset(void *addr, int c, size_t len)
{
	__asan_storeN((unsigned long)addr, len);

	return __memset(addr, c, len);
}