📄 usb2spi_test.c
字号:
#include <stdio.h>#include <string.h>#include </usr/include/usb.h>#include "USBIOX.h"////////////////////////////////////////////////////////////////////#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <stdio.h>#include <sys/ioctl.h>#include <pthread.h>#include <errno.h>#include <sys/select.h>#define LOG(fmt, args...) printf("TV_SDIO: line %d:in fun %s:" fmt "", __LINE__, __FUNCTION__, ## args)#define CMD_LEN 16static int wtloop = 0;///////////////////////////////////////////////////////////////////#define vid_old 0x4348#define vid_new 0x1a86#define pid 0x5512//璋冭瘯#define debug 1#undef dbg#define dbg(format, arg...) do { if(debug)printf(format "\n" , ## arg); } while (0)#define VERSION "0.1"//////////////////////////////////////////////////////////////////////////////////////unsigned char gucReceDataBuffer[204800];unsigned int CurDataLen,CurDataAdr;#define KillTimer(t) do{}while(0)#define TV_STREAM_PATH "/dev/tv_stream"#define TV_STREAM_IOCTL_WR 100#define TV_STREAM_IOCTL_WR_POLLING 101#define TV_STREAM_IOCTL_WR_Q 102#define TV_STREAM_IOCTL_SDIO_RESET 201#define DATA_PORT_REG 0x99#define INT_IDENTIFICATION_REG 0x01#define FUN1_READ_DATA_READY_MASK (1<<0)#define INT_FROM_CHIP_TO_HOST_MASK (1<<1)#define READ_TRANSFER_COUT_REG_L 0x02#define READ_TRANSFER_COUT_REG_M 0x03#define READ_TRANSFER_COUT_REG_H 0x04#define WRITE_TRANSFER_COUT_REG_L 0x05#define WRITE_TRANSFER_COUT_REG_M 0x06#define WRITE_TRANSFER_COUT_REG_H 0x07#define SDIO_R 0#define SDIO_W 1 struct spibus_ioctl_write_read_param{ char *txbuf; int txlen; char *rxbuf; int rxlen;};typedef struct spibus_ioctl_write_read_param spibus_wr_buf;#ifndef bool#define bool int#endif#define false (0)#define true (1)// Mutex typetypedef pthread_mutex_t Mutex;//!< linux mutex definitionMutex sdio_mutex;/////////////////////////////////////////////////////////////////////////////////////struct sUSBIO_context{ struct usb_device *dev; //璁惧
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -