MC3302_SDK_V1.1.9_202507281.../bsp/test/lzma/lzma_test.c
2025-11-11 12:08:31 +08:00

43 lines
1018 B
C
Executable File

#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <stdlib.h>
#include "custom_ioctl.h"
int main(int argc, char *argv[]) {
if (argc != 4) {
fprintf(stderr, "Usage: %s <src> <dst> <len>\n", argv[0]);
return 1;
}
unsigned int src = strtoul(argv[1], NULL, 0);
unsigned int dst = strtoul(argv[2], NULL, 0);
unsigned int len = strtoul(argv[3], NULL, 0);
int fd = open("/dev/molchip_lzma", O_RDWR);
if (fd == -1) {
perror("Failed to open device");
return 1;
}
struct custom_data data = {
.src = src,
.dst = dst,
.len = len,
};
printf("the date of data.src is 0x%08x, data.dst is 0x%08x data.len is 0x%08x \r\n", data.src, data.dst,data.dst,data.len );
if (ioctl(fd, LZMA_DECODE_CMD, &data) == -1) {
printf("lzma_test_fail \r\n");
perror("ioctl failed");
close(fd);
return 1;
}
printf("Test passed\r\n");
close(fd);
return 0;
}