Download code/validation/C/0003615_4byte_time.c from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 1.24 kB
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/code/validation/C/0003615_4byte_time.c
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/code/validation/C/0003615_4byte_time.c
-
curl -L -o 0003615_4byte_time.c https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/code/validation/C/0003615_4byte_time.c
1.24 kB
| /* | |
| * Userspace c library Example to measure delay between two 4 byte writes but this time includes cycles taken to calculate the delay | |
| * | |
| * Copyright (C) 2015 Apaar Gupta | |
| * This file is licensed under the terms of the GNU General Public License | |
| * version 2. This program is licensed "as is" without any warranty of any | |
| * kind, whether express or implied. | |
| */ | |
| static inline u32 read_PIEP_COUNT(void) | |
| { | |
| return PIEP_COUNT; | |
| } | |
| int main() | |
| { | |
| /* configure timer */ | |
| PIEP_GLOBAL_CFG = GLOBAL_CFG_CNT_ENABLE | | |
| GLOBAL_CFG_DEFAULT_INC(1) | | |
| GLOBAL_CFG_CMP_INC(1); | |
| PIEP_CMP_STATUS = CMD_STATUS_CMP_HIT(1); | |
| PIEP_CMP_CFG |= CMP_CFG_CMP_EN(1); | |
| int current = 0,last = 0,delay = 0; | |
| while(check_init() != 1); | |
| uint8_t check_flag = 0; //getting the pru to wait until we are ready to read | |
| while(check_flag == 0) | |
| { | |
| read_buffer(1,&check_flag,1); | |
| } | |
| while(1) | |
| { | |
| //if(check_index(0)) //checking if the buffer is full or not | |
| //{ | |
| current = read_PIEP_COUNT(); | |
| delay = current - last; | |
| write_buffer(0,(uint8_t*)(&delay),4); | |
| last = current; | |
| //} | |
| } | |
| return 0; | |
| } | |