📄 get_dscr.c
字号:
#include <stdio.h>
#include <fx2.h>
#define GD_DEPTH 3 // Depth of the Get Descriptor nesting
// NOTE: This function is psuedo re-entrant
DSCR xdata* EZUSB_GetDscr(BYTE index, DSCR *start_dscr, BYTE type)
{
static DSCR xdata* dscr[GD_DEPTH];
static BYTE end_type[GD_DEPTH];
DSCR xdata * prev_dscr;
if(start_dscr)
{
dscr[index] = (DSCR xdata*) start_dscr;
end_type[index] = start_dscr->type;
dscr[index] = (DSCR xdata *)((WORD)dscr[index] + dscr[index]->length);
}
while(dscr[index]->type && (dscr[index]->type != end_type[index]))
{
if(dscr[index]->type == type)
{
prev_dscr = dscr[index];
dscr[index] = (DSCR xdata *)((WORD)dscr[index] + dscr[index]->length);
return(prev_dscr);
}
dscr[index] = (DSCR xdata *)((WORD)dscr[index] + dscr[index]->length);
}
return(NULL);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -