|
@@ -1,121 +1,4 @@
|
|
|
|
|
|
-
|
|
|
-<<<<<<< HEAD
|
|
|
-// /* include path: ..../A2F/root/usr/include */
|
|
|
-
|
|
|
-// #include <stdio.h>
|
|
|
-// #include <fcntl.h>
|
|
|
-// #include <linux/types.h>
|
|
|
-// //#include <linux/jiffies.h>
|
|
|
-// #include <unistd.h>
|
|
|
-
|
|
|
-// typedef unsigned char uint8_t;
|
|
|
-// typedef unsigned long uint32_t;
|
|
|
-
|
|
|
-// typedef struct {
|
|
|
-// uint32_t address;
|
|
|
-// uint8_t data;
|
|
|
-// } cpld_t;
|
|
|
-
|
|
|
-// typedef struct {
|
|
|
-// uint32_t clockspeed;
|
|
|
-// uint32_t ownAddr;
|
|
|
-// uint8_t DevAddr;
|
|
|
-// uint8_t buf[100];
|
|
|
-// uint8_t Size;
|
|
|
-// } i2c_arg_t;
|
|
|
-
|
|
|
-
|
|
|
-// #define GENERATE_CMD(__MAGIC__, __MAJOR__, __CMD__) \
|
|
|
-// ((0x3<<30) | (__MAJOR__<<16) | (__MAGIC__<<8) | __CMD__)
|
|
|
-
|
|
|
-// #define SET_ADDR GENERATE_CMD('x', 101, 2)
|
|
|
-// #define TRANSFER GENERATE_CMD('x', 101, 4)
|
|
|
-// #define MASTER_RCV GENERATE_CMD('x', 101, 5)
|
|
|
-// #define SLAVE_RCV GENERATE_CMD('x', 101, 6)
|
|
|
-// int main()
|
|
|
-// {
|
|
|
-// /* //FMC test app
|
|
|
-// cpld_t cpld_arg;
|
|
|
-// printf("This is test app!\n");
|
|
|
-// int fd;
|
|
|
-// fd = open("/dev/fmc_cpld", O_RDWR);
|
|
|
-// if(fd == NULL)
|
|
|
-// printf("Open failed\n");
|
|
|
-
|
|
|
-// cpld_arg.address = 0x64000000;
|
|
|
-// cpld_arg.data = 0x55;
|
|
|
-// ioctl(fd, 0, &cpld_arg);
|
|
|
-// cpld_arg.data = 0;
|
|
|
-// ioctl(fd, 1, &cpld_arg);
|
|
|
-// printf("Read from cpld: %#x\n", cpld_arg.data);
|
|
|
-
|
|
|
-// close(fd);
|
|
|
-// */
|
|
|
-
|
|
|
-// /* //gpio interrup test app
|
|
|
-// int fd;
|
|
|
-// uint8_t buf;
|
|
|
-// int ret = 0;
|
|
|
-// fd = open("/dev/test_module", O_RDWR);
|
|
|
-// if(fd == NULL)
|
|
|
-// printf("open failed\n");
|
|
|
-// while(1)
|
|
|
-// {
|
|
|
-// ret = read(fd, &buf, 1);
|
|
|
-// printf("test app read %#x\n", buf);
|
|
|
-// }
|
|
|
-
|
|
|
-// close(fd);*/
|
|
|
-
|
|
|
-// int fd;
|
|
|
-// int i;
|
|
|
-// i2c_arg_t i2c_arg;
|
|
|
-// fd = open("/dev/i2c1", O_RDWR);
|
|
|
-// if(fd == NULL)
|
|
|
-// printf("open failed\n");
|
|
|
-
|
|
|
-// i2c_arg.ownAddr = 0;
|
|
|
-// i2c_arg.DevAddr = 0x92;
|
|
|
-// i2c_arg.buf[0] = 1;
|
|
|
-// i2c_arg.buf[1] = 2;
|
|
|
-// i2c_arg.buf[2] = 3;
|
|
|
-// i2c_arg.Size = 0;
|
|
|
-// while(1)
|
|
|
-// {
|
|
|
-// // ioctl(fd, 1, &i2c_arg); //get speed
|
|
|
-// // printf("speed: %d\n", i2c_arg.clockspeed);
|
|
|
-// // sleep(1);
|
|
|
-// //
|
|
|
-// // i2c_arg.clockspeed = 400000;
|
|
|
-// // ioctl(fd, 0, &i2c_arg); //set speed
|
|
|
-// // sleep(1);
|
|
|
-// //
|
|
|
-// // ioctl(fd, 3, &i2c_arg); //get addr
|
|
|
-// // printf("addr: %#x\n", i2c_arg.ownAddr);
|
|
|
-// // sleep(1);
|
|
|
-
|
|
|
-// // i2c_arg.ownAddr = 0x42;
|
|
|
-// // ioctl(fd, SET_ADDR, &i2c_arg); //set addr
|
|
|
-// // sleep(1);
|
|
|
-
|
|
|
-// // ioctl(fd, MASTER_RCV, &i2c_arg);
|
|
|
-// // printf("Read: %#x, %#x\n", i2c_arg.buf[0], i2c_arg.buf[1]);
|
|
|
-// // sleep(1);
|
|
|
-
|
|
|
-// ioctl(fd, SLAVE_RCV, &i2c_arg);
|
|
|
-// printf("\ni2c1 rec: ");
|
|
|
-// for(i=0;i<i2c_arg.Size;i++)
|
|
|
-// printf("%#x ", i2c_arg.buf[i]);
|
|
|
-// printf("\n");
|
|
|
-
|
|
|
-// }
|
|
|
-
|
|
|
-// close(fd);
|
|
|
-
|
|
|
-=======
|
|
|
-/* include path: ..../A2F/root/usr/include */
|
|
|
-
|
|
|
#include <stdio.h>
|
|
|
#include <string.h>
|
|
|
#include <fcntl.h>
|
|
@@ -128,40 +11,8 @@
|
|
|
|
|
|
int main()
|
|
|
{
|
|
|
+ printf("test_app\n");
|
|
|
+ printf("Build time: %s %s\n", __DATE__, __TIME__);
|
|
|
|
|
|
- int fd;
|
|
|
- uint8_t buf[7] = {0x40, 0xb8, 0x08, 0x20, 0x0, 0x1,0xdf};
|
|
|
-
|
|
|
- fd = open("/dev/i2c1", O_RDWR);
|
|
|
- if(fd < 0)
|
|
|
- printf("error1!\n");
|
|
|
-
|
|
|
- while(1)
|
|
|
- {
|
|
|
- stm32_i2c_master_write(fd, buf[0], &buf[1], 6);
|
|
|
- sleep(5);
|
|
|
- }
|
|
|
-
|
|
|
- close(fd);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // int i;
|
|
|
- // uint8_t id[500] = {0};
|
|
|
- // for(i=0;i<500;i++)
|
|
|
- // id[i] = i;
|
|
|
->>>>>>> master
|
|
|
-
|
|
|
- // sf_sector_erase(2, 0x1000);
|
|
|
- // sf_write(2, 0x1000, id, 500);
|
|
|
- // sf_read(2, 0x1000, id, 1000);
|
|
|
|
|
|
- // for(i=0;i<500;i++)
|
|
|
- // id[i] = 1;
|
|
|
- // sf_sector_erase(2, 0x1000);
|
|
|
- // sf_write(2, 0x1000, id, 500);
|
|
|
- // sf_read(2, 0x1000, id, 1000);
|
|
|
-
|
|
|
-// return 0;
|
|
|
-// }
|
|
|
+}
|