📄 dc_comm.c
字号:
/*
** WASABI-Hot! version 1.2c (DeviceController sub-unit)
**
**
** -- copyright (c) 2001-2004 by Philips Japan, Ltd. -- All rights reserved --
**
**
** ** This code has been made to check/learn **
** ** the ISP1362/ISP1363 functionalities **
** ** Release 06-Aug-2004 **
**
** HIGASHIYAMA, Ken
**
** Application Laboratory, Mobile and Connectivity
** Semiconductors Div, Philips Japan Ltd.
** ken.higashiyama@philips.com
** +81-3-3740-5136
**
**
*/
#include <stdio.h>
#include <dos.h>
#include "general.h"
#include "_dc/dc_comm.h"
#include "_dc/dc_hal.h"
#include "_dc/dc_flags.h"
//*********************************************************************************************//
//
// Device Controller Commands
//
//*********************************************************************************************//
/* Write */
void Comm( unsigned short command_code)
{
D13_outport(D13_COMMAND_PORT, command_code);
}
void Comm_w16(unsigned short command_code, unsigned short value)
{
D13_outport(D13_COMMAND_PORT, command_code);
D13_outport(D13_DATA_PORT, value);
}
void Comm_w32(unsigned short command_code, unsigned long value)
{
D13_outport(D13_COMMAND_PORT, command_code);
D13_outport(D13_DATA_PORT, (unsigned short)value);
D13_outport(D13_DATA_PORT, (unsigned short)(value>>16));
}
void Comm_w(unsigned short command_code, unsigned short length, unsigned short *buf)
{
unsigned short i;
D13_outport(D13_COMMAND_PORT, command_code);
D13_outport(D13_DATA_PORT, length);
for (i=1; i<=(length+1)/2; i++, buf++ )
D13_outport( D13_DATA_PORT, *buf );
}
/* Read */
unsigned short Comm_r16(unsigned short command_code)
{
unsigned short value;
D13_outport(D13_COMMAND_PORT, command_code);
value=D13_inport(D13_DATA_PORT);
return value;
}
unsigned long Comm_r32(unsigned short command_code)
{
unsigned long value;
D13_outport(D13_COMMAND_PORT, command_code);
value=D13_inport(D13_DATA_PORT);
value |= ( ( (unsigned long) D13_inport( D13_DATA_PORT ) ) <<16 );
return value;
}
unsigned short Comm_r(unsigned short command_code, unsigned short *buf)
{
unsigned short i, length;
D13_outport(D13_COMMAND_PORT, command_code);
length=D13_inport(D13_DATA_PORT) & 0x00FF;
for (i=1; i<=(length+1)/2; i++, buf++ )
*buf=D13_inport(D13_DATA_PORT);
return length;
}
unsigned short change_endian(unsigned short value)
{
unsigned short i;
i=value<<8;
i |= value>>8;
return i;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -