1 /****************************************************************
3 Siano Mobile Silicon, Inc.
4 MDTV receiver kernel modules.
5 Copyright (C) 2006-2008, Uri Shkolnik
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 ****************************************************************/
21 #ifndef _SMS_SPI_COMMON_H_
22 #define _SMS_SPI_COMMON_H_
24 #define RX_PACKET_SIZE 0x1000
25 #define SPI_PACKET_SIZE_BITS 8
26 #define SPI_PACKET_SIZE (1<<SPI_PACKET_SIZE_BITS)
27 #define SPI_MAX_CTRL_MSG_SIZE 0x100
29 #define MSG_HDR_FLAG_SPLIT_MSG_HDR 0x0004
48 struct _rx_buffer_st {
50 unsigned long phy_addr;
53 struct _rx_packet_request {
54 struct _rx_buffer_st *msg_buf;
60 struct _spi_dev_cb_st{
61 void (*transfer_data_cb) (void *context, unsigned char *, unsigned long,
62 unsigned char *, unsigned long, int);
63 void (*msg_found_cb) (void *, void *, int, int);
64 struct _rx_buffer_st *(*allocate_rx_buf) (void *, int);
65 void (*free_rx_buf) (void *, struct _rx_buffer_st *);
71 struct _spi_dev_cb_st cb;
73 enum _spi_rx_state rxState;
74 struct _rx_packet_request rxPacket;
75 char *internal_tx_buf;
80 unsigned long buf_phy_addr;
84 void smsspi_common_transfer_msg(struct _spi_dev *dev, struct _spi_msg *txmsg,
86 int smsspicommon_init(struct _spi_dev *dev, void *contex, void *phy_context,
87 struct _spi_dev_cb_st *cb);
89 #if defined HEXDUMP_DEBUG && defined SPIBUS_DEBUG
90 /*! dump a human readable print of a binary buffer */
91 void smsspi_khexdump(char *buf, int len);
93 #define smsspi_khexdump(buf, len)
96 #endif /*_SMS_SPI_COMMON_H_*/