Remove unused helper functions from hackrf_sweep
This commit is contained in:

committed by
Mike Walters

parent
57e0924e0d
commit
86bde9f4c2
@ -92,48 +92,10 @@ int gettimeofday(struct timeval *tv, void* ignored) {
|
|||||||
#define sleep(a) Sleep( (a*1000) )
|
#define sleep(a) Sleep( (a*1000) )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define U64TOA_MAX_DIGIT (31)
|
static float TimevalDiff(const struct timeval *a, const struct timeval *b) {
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
char data[U64TOA_MAX_DIGIT+1];
|
|
||||||
} t_u64toa;
|
|
||||||
|
|
||||||
t_u64toa ascii_u64_data1;
|
|
||||||
t_u64toa ascii_u64_data2;
|
|
||||||
|
|
||||||
static float
|
|
||||||
TimevalDiff(const struct timeval *a, const struct timeval *b)
|
|
||||||
{
|
|
||||||
return (a->tv_sec - b->tv_sec) + 1e-6f * (a->tv_usec - b->tv_usec);
|
return (a->tv_sec - b->tv_sec) + 1e-6f * (a->tv_usec - b->tv_usec);
|
||||||
}
|
}
|
||||||
|
|
||||||
int parse_u64(char* s, uint64_t* const value) {
|
|
||||||
uint_fast8_t base = 10;
|
|
||||||
char* s_end;
|
|
||||||
uint64_t u64_value;
|
|
||||||
|
|
||||||
if( strlen(s) > 2 ) {
|
|
||||||
if( s[0] == '0' ) {
|
|
||||||
if( (s[1] == 'x') || (s[1] == 'X') ) {
|
|
||||||
base = 16;
|
|
||||||
s += 2;
|
|
||||||
} else if( (s[1] == 'b') || (s[1] == 'B') ) {
|
|
||||||
base = 2;
|
|
||||||
s += 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
s_end = s;
|
|
||||||
u64_value = strtoull(s, &s_end, base);
|
|
||||||
if( (s != s_end) && (*s_end == 0) ) {
|
|
||||||
*value = u64_value;
|
|
||||||
return HACKRF_SUCCESS;
|
|
||||||
} else {
|
|
||||||
return HACKRF_ERROR_INVALID_PARAM;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int parse_u32(char* s, uint32_t* const value) {
|
int parse_u32(char* s, uint32_t* const value) {
|
||||||
uint_fast8_t base = 10;
|
uint_fast8_t base = 10;
|
||||||
char* s_end;
|
char* s_end;
|
||||||
@ -161,54 +123,6 @@ int parse_u32(char* s, uint32_t* const value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static char *stringrev(char *str)
|
|
||||||
{
|
|
||||||
char *p1, *p2;
|
|
||||||
|
|
||||||
if(! str || ! *str)
|
|
||||||
return str;
|
|
||||||
|
|
||||||
for(p1 = str, p2 = str + strlen(str) - 1; p2 > p1; ++p1, --p2)
|
|
||||||
{
|
|
||||||
*p1 ^= *p2;
|
|
||||||
*p2 ^= *p1;
|
|
||||||
*p1 ^= *p2;
|
|
||||||
}
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
char* u64toa(uint64_t val, t_u64toa* str)
|
|
||||||
{
|
|
||||||
#define BASE (10ull) /* Base10 by default */
|
|
||||||
uint64_t sum;
|
|
||||||
int pos;
|
|
||||||
int digit;
|
|
||||||
int max_len;
|
|
||||||
char* res;
|
|
||||||
|
|
||||||
sum = val;
|
|
||||||
max_len = U64TOA_MAX_DIGIT;
|
|
||||||
pos = 0;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
digit = (sum % BASE);
|
|
||||||
str->data[pos] = digit + '0';
|
|
||||||
pos++;
|
|
||||||
|
|
||||||
sum /= BASE;
|
|
||||||
}while( (sum>0) && (pos < max_len) );
|
|
||||||
|
|
||||||
if( (pos == max_len) && (sum>0) )
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
str->data[pos] = '\0';
|
|
||||||
res = stringrev(str->data);
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
volatile bool do_exit = false;
|
volatile bool do_exit = false;
|
||||||
|
|
||||||
FILE* fd = NULL;
|
FILE* fd = NULL;
|
||||||
@ -280,9 +194,6 @@ void sigint_callback_handler(int signum) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define PATH_FILE_MAX_LEN (FILENAME_MAX)
|
|
||||||
#define DATE_TIME_MAX_LEN (32)
|
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
int opt;
|
int opt;
|
||||||
const char* path = "/dev/null";
|
const char* path = "/dev/null";
|
||||||
|
Reference in New Issue
Block a user