Files
repo-smod-atsc/src/cfgad9528/main.c
T

54 lines
947 B
C

#include <stdint.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/types.h>
#include <linux/spi/spidev.h>
#include <memory.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <termios.h>
#include <errno.h>
#include <math.h>
#include <string.h>
#include <pthread.h>
#include "common.h"
#include "platform.h"
#include "spi0.h"
#include "ad9528_config.h"
int main(int argc, char *argv[])
{
int ret;
ret = openSpiDev(SPIDEV_AD9528_NODE_NAME);
if(ret < 0 ) {
return -1;
}
ret = initSpiDev();
if(ret < 0 ) {
return -1;
}
if(argc == 2 && strcmp(argv[1], "--check-ready") == 0) {
return ad9528_is_ready() ? 0 : 2;
}
ret = ad9528_config();
if(ret == 0) {
PRINTF_INFO("ad9528 cfg ok.\r\n");
} else {
PRINTF_INFO("ERROR:ad9528 cfg fail.\r\n");
}
return ret == 0 ? 0 : 1;
}