📄 at91_usart.h
字号:
/* * AT91RM9200 USART 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_USART#define AT91_USART#include "pmla.h" /* poor man's logic analyzer */struct usart_packet { unsigned int us_pr; /* Transmit/Receive Pointer Register copy */ unsigned int us_cr; /* Transmit/Receive Counter Register copy */};#define AT91_USART_SPEED 3686400 /* in bits per second */#define AT91_USART_MAX_PACKET_SZ (AT91_USART_SPEED / 10) /* in bytes per second *//* the number of pages we need to que per read/write */#define AT91_USART_MAX_PAGES ((((PAGE_SIZE * 2) - 2 + AT91_USART_MAX_PACKET_SZ) / PAGE_SIZE) + 2)/* Calculation of time-out duration: (US_RTOR Value) * (Bit Period) */#define AT91_USART_RX_TIMEOUT (5 * 10) /* 5 bytes @ 10 bits/byte */struct usart_frame { struct usart_packet packet[AT91_USART_MAX_PAGES]; struct usart_packet *p_head; struct usart_packet *p_tail_int; wait_queue_head_t waitque; /* wait que for read/write to complete */ struct kiobuf *kiobuf; /* 1 kiobuf for each receive/xmit */ spinlock_t lock1; /* some spinlocks for saving/restoring interrupt levels */ };struct usart_local { AT91PS_USART pUsart; /* base address of USART */ int irq; /* interrupt number for this USART */ AT91PS_TC pTc; /* base address of PERFTEST */ int irq2; /* interrupt number for this PERFTEST */ struct usart_frame rx; int rx_cntr; /* count how many char's actually received before timeout */ struct usart_frame tx;// spinlock_t lock1; /* some spinlocks for saving/restoring interrupt levels */ PMLA pmla; /* software logic analyzer */ ulong time1; /* time stamp1 */ ulong time2; /* time stamp1 */ ulong elapsed_time1; /* time stamp1 */ ulong jitter_time1; /* time stamp1 */};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -