xref: /freebsd/sys/dev/sdio/sdio_if.m (revision 031beb4e239bfce798af17f5fe8dba8bcaf13d99)
1*67ca7330SBjoern A. Zeeb#-
2*67ca7330SBjoern A. Zeeb# Copyright (c) 2019 The FreeBSD Foundation
3*67ca7330SBjoern A. Zeeb#
4*67ca7330SBjoern A. Zeeb# Portions of this software were developed by Björn Zeeb
5*67ca7330SBjoern A. Zeeb# under sponsorship from the FreeBSD Foundation.
6*67ca7330SBjoern A. Zeeb#
7*67ca7330SBjoern A. Zeeb# Redistribution and use in source and binary forms, with or without
8*67ca7330SBjoern A. Zeeb# modification, are permitted provided that the following conditions
9*67ca7330SBjoern A. Zeeb# are met:
10*67ca7330SBjoern A. Zeeb# 1. Redistributions of source code must retain the above copyright
11*67ca7330SBjoern A. Zeeb#    notice, this list of conditions and the following disclaimer.
12*67ca7330SBjoern A. Zeeb# 2. Redistributions in binary form must reproduce the above copyright
13*67ca7330SBjoern A. Zeeb#    notice, this list of conditions and the following disclaimer in the
14*67ca7330SBjoern A. Zeeb#    documentation and/or other materials provided with the distribution.
15*67ca7330SBjoern A. Zeeb#
16*67ca7330SBjoern A. Zeeb# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17*67ca7330SBjoern A. Zeeb# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18*67ca7330SBjoern A. Zeeb# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19*67ca7330SBjoern A. Zeeb# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20*67ca7330SBjoern A. Zeeb# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21*67ca7330SBjoern A. Zeeb# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22*67ca7330SBjoern A. Zeeb# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23*67ca7330SBjoern A. Zeeb# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24*67ca7330SBjoern A. Zeeb# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25*67ca7330SBjoern A. Zeeb# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26*67ca7330SBjoern A. Zeeb#
27*67ca7330SBjoern A. Zeeb#
28*67ca7330SBjoern A. Zeeb
29*67ca7330SBjoern A. Zeeb#include <sys/bus.h>
30*67ca7330SBjoern A. Zeeb#include <machine/bus.h>
31*67ca7330SBjoern A. Zeeb
32*67ca7330SBjoern A. ZeebINTERFACE sdio;
33*67ca7330SBjoern A. Zeeb
34*67ca7330SBjoern A. Zeeb#
35*67ca7330SBjoern A. Zeeb# READ DIRECT (1byte)
36*67ca7330SBjoern A. Zeeb#
37*67ca7330SBjoern A. ZeebMETHOD int read_direct {
38*67ca7330SBjoern A. Zeeb	device_t dev;
39*67ca7330SBjoern A. Zeeb	uint8_t fn;
40*67ca7330SBjoern A. Zeeb	uint32_t addr;
41*67ca7330SBjoern A. Zeeb	uint8_t *val;
42*67ca7330SBjoern A. Zeeb};
43*67ca7330SBjoern A. Zeeb
44*67ca7330SBjoern A. Zeeb#
45*67ca7330SBjoern A. Zeeb# WRITE DIRECT (1byte)
46*67ca7330SBjoern A. Zeeb#
47*67ca7330SBjoern A. ZeebMETHOD int write_direct {
48*67ca7330SBjoern A. Zeeb	device_t dev;
49*67ca7330SBjoern A. Zeeb	uint8_t fn;
50*67ca7330SBjoern A. Zeeb	uint32_t addr;
51*67ca7330SBjoern A. Zeeb	uint8_t val;
52*67ca7330SBjoern A. Zeeb};
53*67ca7330SBjoern A. Zeeb
54*67ca7330SBjoern A. Zeeb#
55*67ca7330SBjoern A. Zeeb# READ EXTENDED
56*67ca7330SBjoern A. Zeeb#
57*67ca7330SBjoern A. ZeebMETHOD int read_extended {
58*67ca7330SBjoern A. Zeeb	device_t dev;
59*67ca7330SBjoern A. Zeeb	uint8_t fn;
60*67ca7330SBjoern A. Zeeb	uint32_t addr;
61*67ca7330SBjoern A. Zeeb	uint32_t size;
62*67ca7330SBjoern A. Zeeb	uint8_t *buffer;
63*67ca7330SBjoern A. Zeeb	bool incaddr;
64*67ca7330SBjoern A. Zeeb};
65*67ca7330SBjoern A. Zeeb
66*67ca7330SBjoern A. Zeeb#
67*67ca7330SBjoern A. Zeeb# WRITE EXTENDED
68*67ca7330SBjoern A. Zeeb#
69*67ca7330SBjoern A. ZeebMETHOD int write_extended {
70*67ca7330SBjoern A. Zeeb	device_t dev;
71*67ca7330SBjoern A. Zeeb	uint8_t fn;
72*67ca7330SBjoern A. Zeeb	uint32_t addr;
73*67ca7330SBjoern A. Zeeb	uint32_t size;
74*67ca7330SBjoern A. Zeeb	uint8_t *buffer;
75*67ca7330SBjoern A. Zeeb	bool incaddr;
76*67ca7330SBjoern A. Zeeb};
77*67ca7330SBjoern A. Zeeb
78*67ca7330SBjoern A. Zeeb# end
79