]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/staging/vt6656/control.c
Merge branches 'core/futexes' and 'core/iommu' into core/urgent
[karo-tx-linux.git] / drivers / staging / vt6656 / control.c
1 /*
2  * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
3  * All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  *
20  * File: control.c
21  *
22  * Purpose: Handle USB control endpoint
23  *
24  * Author: Jerry Chen
25  *
26  * Date: Apr. 5, 2004
27  *
28  * Functions:
29  *      CONTROLnsRequestOut - Write variable length bytes to MEM/BB/MAC/EEPROM
30  *      CONTROLnsRequestIn - Read variable length bytes from MEM/BB/MAC/EEPROM
31  *      ControlvWriteByte - Write one byte to MEM/BB/MAC/EEPROM
32  *      ControlvReadByte - Read one byte from MEM/BB/MAC/EEPROM
33  *      ControlvMaskByte - Read one byte from MEM/BB/MAC/EEPROM and clear/set some bits in the same address
34  *
35  * Revision History:
36  *      04-05-2004 Jerry Chen:  Initial release
37  *      11-24-2004 Warren Hsu: Add ControlvWriteByte,ControlvReadByte,ControlvMaskByte
38  *
39  */
40
41 #include "control.h"
42 #include "rndis.h"
43
44 /*---------------------  Static Definitions -------------------------*/
45 //static int          msglevel                =MSG_LEVEL_INFO;
46 //static int          msglevel                =MSG_LEVEL_DEBUG;
47 /*---------------------  Static Classes  ----------------------------*/
48
49 /*---------------------  Static Variables  --------------------------*/
50
51 /*---------------------  Static Functions  --------------------------*/
52
53 /*---------------------  Export Variables  --------------------------*/
54
55 /*---------------------  Export Functions  --------------------------*/
56
57
58 void ControlvWriteByte(PSDevice pDevice, BYTE byRegType, BYTE byRegOfs, BYTE byData)
59 {
60 BYTE            byData1;
61
62     byData1 = byData;
63
64     CONTROLnsRequestOut(pDevice,
65                         MESSAGE_TYPE_WRITE,
66                         byRegOfs,
67                         byRegType,
68                         1,
69                         &byData1
70                         );
71
72 }
73
74
75 void ControlvReadByte(PSDevice pDevice, BYTE byRegType, BYTE byRegOfs, PBYTE pbyData)
76 {
77 NTSTATUS        ntStatus;
78 BYTE            byData1;
79
80
81     ntStatus = CONTROLnsRequestIn(pDevice,
82                                     MESSAGE_TYPE_READ,
83                                     byRegOfs,
84                                     byRegType,
85                                     1,
86                                     &byData1);
87
88     *pbyData = byData1;
89
90 }
91
92
93
94 void ControlvMaskByte(PSDevice pDevice, BYTE byRegType, BYTE byRegOfs, BYTE byMask, BYTE byData)
95 {
96 BYTE            pbyData[2];
97
98     pbyData[0] = byData;
99     pbyData[1] = byMask;
100
101     CONTROLnsRequestOut(pDevice,
102                         MESSAGE_TYPE_WRITE_MASK,
103                         byRegOfs,
104                         byRegType,
105                         2,
106                         pbyData
107                         );
108
109 }