⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mxcspi.h

📁 QNX ADS BSP code for i.MX27 chips
💻 H
字号:
/* * $QNXLicenseC:  * Copyright 2007, QNX Software Systems.   *   * Licensed under the Apache License, Version 2.0 (the "License"). You   * may not reproduce, modify or distribute this software except in   * compliance with the License. You may obtain a copy of the License   * at: http://www.apache.org/licenses/LICENSE-2.0   *   * Unless required by applicable law or agreed to in writing, software   * distributed under the License is distributed on an "AS IS" basis,   * WITHOUT WARRANTIES OF ANY KIND, either express or implied.  *  * This file may contain contributions from others, either as   * contributors under the License or as licensors under other terms.    * Please review this entire file for other proprietary rights or license   * notices, as well as the QNX Development Suite License Guide at   * http://licensing.qnx.com/license-guide/ for other information.  * $ */#ifndef _MX21_CSPI_H_INCLUDED#define _MX21_CSPI_H_INCLUDED#include <assert.h>#include <stdio.h>#include <stdlib.h>#include <stdint.h>#include <errno.h>#include <pthread.h>#include <unistd.h>#include <string.h>#include <sys/mman.h>#include <sys/neutrino.h>#include <hw/inout.h>#include <hw/spi-master.h>#include <arm/mx21.h>#define	MX21_CSPI_PRIORITY		21#define	MX21_CSPI_EVENT			1#define MX21_CSPI_RXDATA		0x00	/* Receive data register */#define MX21_CSPI_TXDATA		0x04	/* Transmit data register */#define MX21_CSPI_CONREG		0x08	/* Control register */#define MX21_CSPI_INTREG		0x0C	/* Interrupt control register */#define	MX21_CSPI_TESTREG		0x10	/* Test register */#define MX21_CSPI_PERIODREG		0x14	/* Sample period control register */#define MX21_CSPI_DMAREG		0x18	/* DMA control register */#define MX21_CSPI_RESETREG		0x1C	/* Reset register */typedef struct {	SPIDEV		spi;		/* This has to be the first element */	unsigned	pbase;	uintptr_t	vbase;	int			irq;	int			iid;	int			chid, coid;	uint32_t	bitrate;	uint32_t	clock;	uint32_t	period;	uint8_t		*pbuf;	int			xlen, tlen, rlen;	int			dlen;	int			dtime;		/* usec per data, for time out use */	struct sigevent	spievent;} mx21_cspi_t;extern void *mx21_init(void *hdl, char *options);extern void mx21_dinit(void *hdl);extern void *mx21_xfer(void *hdl, uint32_t device, uint8_t *buf, int *len);extern int mx21_setcfg(void *hdl, uint16_t device, spi_cfg_t *cfg);extern int mx21_devinfo(void *hdl, uint32_t device, spi_devinfo_t *info);extern int mx21_drvinfo(void *hdl, spi_drvinfo_t *info);extern int mx21_xchange(mx21_cspi_t *mx21, uint8_t *buf, int len);extern int mx21_read(mx21_cspi_t *mx21, uint8_t *buf, int len);extern int mx21_write(mx21_cspi_t *mx21, uint8_t *buf, int len);extern int mx21_attach_intr(mx21_cspi_t *mx21);extern int mx21_wait(mx21_cspi_t *dev, int len);extern int mx21_cfg(void *hdl, spi_cfg_t *cfg);#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -