You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

76 lines
1.7 KiB

/* vim: set ts=4 sw=4 et fdm=marker: */
#ifndef __BSP_API___
#define __BSP_API___
#include <vxWorks.h>
#ifdef __cplusplus
extern "C" {
#endif
/* {{{ SM2130 */
#define __SM2130__IOC_MAGIC ('S' << 16)
#define XFER_TYPE_WR (1)
#define XFER_TYPE_RD (2)
#define FIOC_SM2130_WR (__SM2130__IOC_MAGIC | XFER_TYPE_WR)
#define FIOC_SM2130_RD (__SM2130__IOC_MAGIC | XFER_TYPE_RD)
#define FIOC_SM2130_READY (__SM2130__IOC_MAGIC | 0x10)
#define FIOC_SM2130_ACKABLE (__SM2130__IOC_MAGIC | 0x11)
#define FIOC_SM2130_ACKIRQ (__SM2130__IOC_MAGIC | 0x12)
#define FIOC_SM2130_RST (__SM2130__IOC_MAGIC | 0x13)
#define FIOC_SM2130_REQISR (__SM2130__IOC_MAGIC | 0x14)
#define FIOC_SM2130_REGRD (__SM2130__IOC_MAGIC | 0x21)
#define FIOC_SM2130_REGWR (__SM2130__IOC_MAGIC | 0x22)
#define FIOC_SM2130_SMADDR (__SM2130__IOC_MAGIC | 0x23)
#define FIOC_SM2130_RDMEM (__SM2130__IOC_MAGIC | 0x24)
#define FIOC_SM2130_WRMEM (__SM2130__IOC_MAGIC | 0x25)
struct sm2130_xfer {
UINT8 reg;
UINT16 val;
};
typedef struct sm2130_xfer SM2130_XFER;
#define SMX_MAX_WORDS (64)
struct sm2130_xfer_mem {
int count;
UINT8 reg;
UINT16 address;
UINT16 *membuf;
};
typedef struct sm2130_xfer_mem SM2130_MEM_XFER;
/* }}} */
/* {{{ spidev FIO_SPIXFER msgs */
#define FIO_XFER_TX (1 << 0)
#define FIO_XFER_RX (1 << 1)
#define FIO_XFER_DUPLEX ((FIO_XFER_TX) | (FIO_XFER_RX))
/* ioctl */
#define FIO_SPIXFER (('P' << 16) | 0x1001)
struct spi_xfer {
int len;
int xferDir;
UINT8 *txbuf;
UINT8 *rxbuf;
};
struct spi_xfer_msg {
int count;
struct spi_xfer *xfer;
};
/* }}} */
/* functions */
int envInit();
int bspLoadUserApp();
int updateVxWorks(const char *file, int pos);
#ifdef __cplusplus
}
#endif
#endif