📄 dobulk.c
字号:
/*
****************************************************************************
H I T A C H I P R O P R I E T A R Y
COPYRIGHT (c) 2001 BY Semiconductor & Integrated Circuits,Hitachi,Ltd.
--- ALL RIGHTS RESERVED ---
File Name :DoBulk.c
Working :Executing Bulk transfer
Modified :Rev 2001_11_28 {Author : T.Ishikawa}
Modified :Rev 2001_09_28 {Author : T.Ishikawa}
Created :Rev 1.0 {Author : T.Ishikawa[2001.Jan.10]}
****************************************************************************
*/
#ifndef SysMemMap
#include "SysMemMap.h"
#endif /* SysMemMap */
#ifndef CatProType
#include "CatProType.h"
#endif /* CatProType */
/* Prototype */
short ActBulkOut(unsigned long,unsigned char,unsigned char);
short ActBulkIn(unsigned long,unsigned char,unsigned char);
void ActBulkInReady(unsigned long,unsigned char,unsigned char);
/* Contents */
/***************************************************************************
Function Name :ActBulkOut(unsigned long,unsigned char,unsigned char)
Working :Executing Bulk-OUT transfer
Return Value :short
Modified :{Author : T.Ishikawa[2001.Nov.28]}
Modified :{Author : T.Ishikawa[2001.Aug.09]}
Modified :{Author : T.Ishikawa[2001.Jan.10]}
Modified :{Author : S.Suzuki[1998.Nov.5]}
Modified :{Author : T.Ishikawa[1998.Mar.11]}
Created :{Author : T.Ishikawa[1997.Dec.11]}
***************************************************************************/
short ActBulkOut(unsigned long interruptBitStreamLVar ,unsigned char epInfoNumberLVar ,unsigned char dataBuffNumberLVar) {
/* receive data byte size */
short getByteLVar = 0;
BULK_OTSF_CLEAR
#if SET_ENABLE_CPU == 7622 /* CPU is SH7622 */
if ((((unsigned long)dataBuffGPtr[dataBuffNumberLVar].AccessDataType.WriteType.startPtr & 0x03L) == 0x00L) && ((*EpInfo[epInfoNumberLVar].FifoSize & 0x03) == 0x00)) {
getByteLVar = GetPacket4(&EpInfo[epInfoNumberLVar],&dataBuffGPtr[dataBuffNumberLVar]);
}
else {
getByteLVar = GetPacket(&EpInfo[epInfoNumberLVar],&dataBuffGPtr[dataBuffNumberLVar]);
}
#elif SET_ENABLE_CPU == 7729 /* CPU is SH7729 and USB module is FPGA */
getByteLVar = GetPacketLong(&EpInfo[epInfoNumberLVar],&dataBuffGPtr[dataBuffNumberLVar]);
#elif SET_ENABLE_CPU == 7727 /* CPU is SH7727 */
getByteLVar = GetPacket(&EpInfo[epInfoNumberLVar],&dataBuffGPtr[dataBuffNumberLVar]);
#elif SET_ENABLE_CPU == 2215 /* CPU is H8S/2215 */
#ifdef BOT_MSClass
if ((*EpInfo[epInfoNumberLVar].FifoSize & 0x03) == 0x00) {
getByteLVar = GetPacket4S(&EpInfo[epInfoNumberLVar],&dataBuffGPtr[dataBuffNumberLVar]);
#endif /* BOT_MSClass */
#ifdef PrinterClass
if ((((unsigned long)dataBuffGPtr[dataBuffNumberLVar].AccessDataType.WriteType.startPtr & 0x01L) == 0) && ((*EpInfo[epInfoNumberLVar].FifoSize & 0x03) == 0x00)) {
getByteLVar = GetPacket4(&EpInfo[epInfoNumberLVar],&dataBuffGPtr[dataBuffNumberLVar]);
#endif /* PrinterClass */
}
else {
getByteLVar = GetPacket(&EpInfo[epInfoNumberLVar],&dataBuffGPtr[dataBuffNumberLVar]);
}
#else
getByteLVar = GetPacket(&EpInfo[epInfoNumberLVar],&dataBuffGPtr[dataBuffNumberLVar]);
#endif /* SET_ENABLE_CPU */
return getByteLVar;
}
/***************************************************************************
Function Name :ActBulkIn(unsigned long,unsigned char,unsigned char)
Working :Executing Bulk-IN transfer
Return Value :short
Modified :{Author : T.Ishikawa[2001.Nov.28]}
Modified :{Author : T.Ishikawa[2001.Aug.09]}
Modified :{Author : T.Ishikawa[2001.Jan.10]}
Modified :{Author : S.Suzuki[1998.Nov.5]}
Modified :{Author : T.Ishikawa[1998.Mar.11]}
Created :{Author : T.Ishikawa[1997.Dec.11]}
***************************************************************************/
short ActBulkIn(unsigned long interruptBitStreamLVar ,unsigned char epInfoNumberLVar ,unsigned char dataBuffNumberLVar) {
/* transfer data byte size */
short putByteLVar = 0;
BULK_ITSF_CLEAR
#ifdef PrinterClass /* in case of Printer Class */
if ((dataBuffGPtr[dataBuffNumberLVar].AccessDataType.ReadType.endPtr - dataBuffGPtr[dataBuffNumberLVar].AccessDataType.ReadType.startPtr) < EpInfo[dataBuffNumberLVar].MaxPacketSize) {
/* in case of short packet transfer next */
SET_BULK_IN_INTERRUPT2
/* get interrupt enable flag */
GET_INTERRUPT_ENABLE
}
#endif /* PrinterClass */
#if SET_ENABLE_CPU == 7622 /* CPU is SH7622 */
if ((((unsigned long)dataBuffGPtr[dataBuffNumberLVar].AccessDataType.ReadType.startPtr & 0x03L) == 0x00L) && ((dataBuffGPtr[dataBuffNumberLVar].AccessDataType.ReadType.endPtr - dataBuffGPtr[dataBuffNumberLVar].AccessDataType.ReadType.startPtr) & 0x03L) == 0x00L) {
putByteLVar = PutPacket4(&EpInfo[epInfoNumberLVar],&dataBuffGPtr[dataBuffNumberLVar]);
}
else {
putByteLVar = PutPacket(&EpInfo[epInfoNumberLVar],&dataBuffGPtr[dataBuffNumberLVar]);
}
#elif SET_ENABLE_CPU == 7729 /* CPU is SH7729 and USB module is FPGA */
putByteLVar = PutPacket(&EpInfo[epInfoNumberLVar],&dataBuffGPtr[dataBuffNumberLVar]);
#elif SET_ENABLE_CPU == 7727 /* CPU is SH7727 */
putByteLVar = PutPacket(&EpInfo[epInfoNumberLVar],&dataBuffGPtr[dataBuffNumberLVar]);
#elif SET_ENABLE_CPU == 2215 /* CPU is H8S/2215 */
#ifdef BOT_MSClass
if ((((unsigned char)dataBuffGPtr[dataBuffNumberLVar].AccessDataType.ReadType.endPtr - (unsigned char)dataBuffGPtr[dataBuffNumberLVar].AccessDataType.ReadType.startPtr) & 0x03) == 0x00) {
putByteLVar = PutPacket4S(&EpInfo[epInfoNumberLVar],&dataBuffGPtr[dataBuffNumberLVar]);
#endif /* BOT_MSClass */
#ifdef PrinterClass
if ((((unsigned long)dataBuffGPtr[dataBuffNumberLVar].AccessDataType.WriteType.startPtr & 0x01L) == 0) && (((unsigned char)dataBuffGPtr[dataBuffNumberLVar].AccessDataType.ReadType.endPtr - (unsigned char)dataBuffGPtr[dataBuffNumberLVar].AccessDataType.ReadType.startPtr) & 0x03) == 0x00) {
putByteLVar = PutPacket4(&EpInfo[epInfoNumberLVar],&dataBuffGPtr[dataBuffNumberLVar]);
#endif /* PrinterClass */
}
else {
putByteLVar = PutPacket(&EpInfo[epInfoNumberLVar],&dataBuffGPtr[dataBuffNumberLVar]);
}
#else
putByteLVar = PutPacket(&EpInfo[epInfoNumberLVar],&dataBuffGPtr[dataBuffNumberLVar]);
#endif /* SET_ENABLE_CPU */
return putByteLVar;
}
/***************************************************************************
Function Name :ActBulkInReady(unsigned long,unsigned char,unsigned char)
Working :Getting ready for Bulk-IN transfer
Return Value :void
Modified :{Author : T.Ishikawa[2001.Aug.09]}
Modified :{Author : S.Suzuki[1998.Nov.5]}
Modified :{Author : T.Ishikawa[1998.Mar.11]}
Created :{Author : T.Ishikawa[1997.Dec.11]}
***************************************************************************/
void ActBulkInReady(unsigned long interruptBitStreamLVar ,unsigned char epInfoNumberLVar ,unsigned char dataBuffNumberLVar) {
BULK_ITFF_CLEAR
SET_BULK_IN_INTERRUPT1
/* get interrupt enable flag */
GET_INTERRUPT_ENABLE
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -