📄 control.c
字号:
/* * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc. * All rights reserved. * * This software is copyrighted by and is the sole property of * VIA Networking Technologies, Inc. This software may only be used * in accordance with the corresponding license agreement. Any unauthorized * use, duplication, transmission, distribution, or disclosure of this * software is expressly forbidden. * * This software is provided by VIA Networking Technologies, Inc. "as is" * and any express or implied warranties, including, but not limited to, the * implied warranties of merchantability and fitness for a particular purpose * are disclaimed. In no event shall VIA Networking Technologies, Inc. * be liable for any direct, indirect, incidental, special, exemplary, or * consequential damages. * * * File: control.c * * Purpose: Handle USB control endpoint * * Author: Jerry Chen * * Date: Apr. 5, 2004 * * Functions: * CONTROLnsRequestOut - Write variable length bytes to MEM/BB/MAC/EEPROM * CONTROLnsRequestIn - Read variable length bytes from MEM/BB/MAC/EEPROM * ControlvWriteByte - Write one byte to MEM/BB/MAC/EEPROM * ControlvReadByte - Read one byte from MEM/BB/MAC/EEPROM * ControlvMaskByte - Read one byte from MEM/BB/MAC/EEPROM and clear/set some bits in the same address * * Revision History: * 04-05-2004 Jerry Chen: Initial release * 11-24-2004 Warren Hsu: Add ControlvWriteByte,ControlvReadByte,ControlvMaskByte * */#if !defined(__CONTROL_H__)#include "control.h"#endif#if !defined(__UMEM_H__)#include "umem.h"#endif#if !defined(__RNDIS_H__)#include "rndis.h"#endif/*--------------------- Static Definitions -------------------------*///static int msglevel =MSG_LEVEL_INFO;//static int msglevel =MSG_LEVEL_DEBUG;/*--------------------- Static Classes ----------------------------*//*--------------------- Static Variables --------------------------*//*--------------------- Static Functions --------------------------*//*--------------------- Export Variables --------------------------*//*--------------------- Export Functions --------------------------*/void ControlvWriteByte(PSDevice pDevice, BYTE byRegType, BYTE byRegOfs, BYTE byData){BYTE byData1; byData1 = byData; CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_WRITE, byRegOfs, byRegType, 1, &byData1 ); }void ControlvReadByte(PSDevice pDevice, BYTE byRegType, BYTE byRegOfs, PBYTE pbyData){NTSTATUS ntStatus;BYTE byData1; ntStatus = CONTROLnsRequestIn(pDevice, MESSAGE_TYPE_READ, byRegOfs, byRegType, 1, &byData1); *pbyData = byData1; }void ControlvMaskByte(PSDevice pDevice, BYTE byRegType, BYTE byRegOfs, BYTE byMask, BYTE byData){BYTE pbyData[2]; pbyData[0] = byData; pbyData[1] = byMask; CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_WRITE_MASK, byRegOfs, byRegType, 2, pbyData ); }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -