📄 at91_spi.h
字号:
/* * AT91RM9200 SPI driver for use for high speed packet sending/receiving * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */#ifndef AT91_SPI#define AT91_SPI#define AT91_SPI_MAJOR 60 /* in the local range, experimental */#define AT91C_SPI_DEFAULT_BUAD 1200000 /* default baud rate */#define AT91C_SPI_DELAY_BEFORE_SCK 16struct spi_packet { unsigned int us_pr; /* Transmit/Receive Pointer Register copy */ unsigned int us_cr; /* Transmit/Receive Counter Register copy */};#define AT91_SPI_MAX_PACKET_SZ 10000 /* in bytes per write *//* the number of pages we need to queue per write */#define AT91_SPI_MAX_PAGES ((((PAGE_SIZE * 2) - 2 + AT91_SPI_MAX_PACKET_SZ) / PAGE_SIZE) + 2)struct spi_frame { struct spi_packet packet[AT91_SPI_MAX_PAGES]; struct spi_packet *p_head; struct spi_packet *p_tail_int; wait_queue_head_t waitqueue; /* wait queue for read/write to complete */ struct kiobuf *kiobuf; /* 1 kiobuf for each receive/xmit */ spinlock_t lock1; /* some spinlocks for saving/restoring interrupt levels */ };/* the following frame is queued for transmission every 120 Hz. Every "otherN" introduces a 960 Hz delay. This causes ECG + BP to output at a 480 Hz rate */struct spi_ana_out_frame /* one 120 Hz packet to spi devices */ { unsigned int ecg1; /* PCS1 */ unsigned int other1; /* PCS3 */ unsigned int bp1; /* PCS1 */ unsigned int other2; /* PCS3 */ unsigned int ecg2; /* PCS1 */ unsigned int other3; /* PCS3 */ unsigned int bp2; /* PCS1 */ unsigned int other4; /* PCS3 */ unsigned int ecg3; /* PCS1 */ unsigned int other5; /* PCS3 */ unsigned int bp3; /* PCS1 */ unsigned int other6; /* PCS3 */ unsigned int ecg4; /* PCS1 */ unsigned int other7; /* PCS3 */ unsigned int bp4; /* PCS1 */#define AT91_SPI_OTHER_MAX 50 /* the max number of spi values to other than ana out devices */ unsigned int other[AT91_SPI_OTHER_MAX]; };struct spi_local { int flags; /* flags as follows: */#define AT91_SPI_IOCTL_MODE 1 /* we're in the ioctl mode of usart */#define AT91_SPI_DO_READ 2 /* flag to do the read of SPI */ AT91PS_SPI pSpi; /* base address of SPI */ int irq; /* interrupt number for this SPI */ struct spi_frame tx; int other_send_cnt; /* how many bytes to send of other, used as flag also */ int other_pcs; /* what PCS to use for this one */ struct spi_ana_out_frame spi_ao_packet; };extern struct spi_local at92_spi_priv; /* so combined usart/spi driver can get to us */#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -