本文整理汇总了C++中outpw函数的典型用法代码示例。如果您正苦于以下问题:C++ outpw函数的具体用法?C++ outpw怎么用?C++ outpw使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了outpw函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: usiRead
/*
addr: memory address
len: byte count
buf: buffer to put the read back data
*/
int usiRead(UINT32 addr, UINT32 len, UINT8 *buf)
{
int volatile i;
outpw(REG_USI_SSR, inpw(REG_USI_SSR) | 0x01); // CS0
// read command
outpw(REG_USI_Tx0, 03);
usiTxLen(0, 8);
usiActive();
// address
outpw(REG_USI_Tx0, addr);
usiTxLen(0, 24);
usiActive();
// data
for (i=0; i<len; i++)
{
outpw(REG_USI_Tx0, 0xff);
usiTxLen(0, 8);
usiActive();
*buf++ = inpw(REG_USI_Rx0) & 0xff;
}
outpw(REG_USI_SSR, inpw(REG_USI_SSR) & 0xfe); // CS0
return USI_NO_ERR;
}
示例2: IORBDone
VOID NEAR IORBDone (NPA npA)
{
PIORB pIORB = npA->pIORB;
/*
** If a removable media has changed then ignore any error that
** may have occured and report the changed media error.
** Report media changed only once.
*/
DISABLE
pIORB->ErrorCode = npA->IORBError;
pIORB->Status = npA->IORBStatus | IORB_DONE;
#if PCITRACER
outpw (TRPORT+2, 0x9999);
outpw (TRPORT+2, pIORB->Status);
outpw (TRPORT+2, pIORB->ErrorCode);
#endif
npA->pIORB = 0;
ENABLE
if (pIORB->RequestControl & IORB_ASYNC_POST) pIORB->NotifyAddress (pIORB);
#if PCITRACER
outpw (TRPORT, 0xDEEE);
#endif
}
示例3: alloc_task
/******************************************************************************
FUNCTION void alloc_task()
RETURNS None.
PARAMETERS None.
PURPOSE
Allocate channels.
WRITTEN BY
Takuji Ebinuma.
******************************************************************************/
void alloc_task()
{
int i,k,already_allocated;
static int sv = 26;//15;//22;//12;//15;//26;//0; //[Art] to reduce acquisition time!
int sv_index[2] = {27, 17};
///while (1) {
for (i=0; i<MAX_CHANNELS; i++) {
if (CH[i].prn==IDLE) {
CH[i].lock_status = NO_LOCK;
CH[i].pow_code = LossThresh;
CH[i].pow_carr = LossThresh;
CH[i].IP = 0;
CH[i].QP = 0;
CH[i].E= 0;
CH[i].Tau = 0;
CH[i].half_chip_counter = 0;
CH[i].freq_bin_counter = 0;
CH[i].pull_in_time = 0;
CH[i].carr_nco = CARR_REF + CarrSrchStep*2; //[Art] to reduce acquisition time!
CH[i].code_nco = CODE_REF;
outpw((CH[i].BASE+PRN_KEY), prntaps[sv]);
///outpw((CH[i].BASE+CARR_NCO), CH[i].carr_nco);
outpw((CH[i].BASE+CARR_NCO_LOW), (CH[i].carr_nco & 0x0000ffff));
///outpw((CH[i].BASE+CARR_NCO_HIGH), ((CH[i].carr_nco & 0xffff0000)>>16));
if (CH[i].carr_nco_sign > 0 ){
outpw((CH[i].BASE+CARR_NCO_HIGH), ( ((CH[i].carr_nco & 0xffff0000)>>16) | (1<<15) )); //[Art]. (1<<15) is the sign!
} //of the NCO freq.
else {
示例4: capClkRatio
void capClkRatio(BOOL ratio)
{
if(ratio==TRUE)
outpw(REG_CAPFuncEnable,inpw(REG_CAPFuncEnable)|0x00100000);
else
outpw(REG_CAPFuncEnable,inpw(REG_CAPFuncEnable)&0xffEfffff);
}
示例5: hwt_stop
/************************
*
* hwt_stop
*
* Stop hardware timer.
*
* void hwt_stop(
* struct s_smc *smc) ;
* In
* smc - A pointer to the SMT Context structure.
* Out
* Nothing.
*
************************/
void hwt_stop(struct s_smc *smc)
{
outpw(ADDR(B2_TI_CRTL), TIM_STOP) ;
outpw(ADDR(B2_TI_CRTL), TIM_CL_IRQ) ;
smc->hw.timer_activ = FALSE ;
}
示例6: icTimerInit
/*----------------------------------------------------------------------------------------
函数名: icTimerInit
参数:
None
返回值:
None
描述:
对所选择的定时器进行硬件初始化
----------------------------------------------------------------------------------------*/
void icTimerInit(void)
{
#if USE_TIMER == 0
// 开定时器0
SYSCLK->CLKSEL1.TMR0_S = 4; // 选择48M计时频率
SYSCLK->APBCLK.TMR0_EN = 1; // 开时钟
outpw((uint32_t)&TIMER0->TCSR ,0 ); // 关闭定时器
TIMER0->TISR.TIF = 1; // 清除中断标志
TIMER0->TCMPR = 49152; // 计数10 频率49.152MHz 得1KHZ
TIMER0->TCSR.PRESCALE = 0;
outpw((uint32_t)&TIMER0->TCSR, (uint32_t)((1 << 30) | (1 << 29) | (1 << 27))); // 使能定时器,使能中断,模式01周期重复计数
NVIC_EnableIRQ(TMR0_IRQn);
#else
// 开定时器1
SYSCLK->CLKSEL1.TMR1_S = 0; // 选择10K计时频率
SYSCLK->APBCLK.TMR1_EN =1; // 开时钟
outpw((uint32_t)&TIMER1->TCSR ,0 ); // 关闭定时器
TIMER1->TISR.TIF = 1; // 清除中断标志
TIMER1->TCMPR = 10; // 计数10 频率10KHZ 得1KHZ
TIMER1->TCSR.PRESCALE = 0;
outpw((uint32_t)&TIMER1->TCSR, (uint32_t)((1 << 30) | (1 << 29) | (1 << 27))); // 使能定时器,使能中断,模式01周期重复计数
NVIC_EnableIRQ(TMR1_IRQn);
#endif
}
示例7: plc_send_bits
static int plc_send_bits(struct s_smc *smc, struct s_phy *phy, int len)
{
int np = phy->np ; /* PHY index */
int n ;
int i ;
SK_UNUSED(smc) ;
/* create bit vector */
for (i = len-1,n = 0 ; i >= 0 ; i--) {
n = (n<<1) | phy->t_val[phy->bitn+i] ;
}
if (inpw(PLC(np,PL_STATUS_B)) & PL_PCM_SIGNAL) {
#if 0
printf("PL_PCM_SIGNAL is set\n") ;
#endif
return 1;
}
/* write bit[n] & length = 1 to regs */
outpw(PLC(np,PL_VECTOR_LEN),len-1) ; /* len=nr-1 */
outpw(PLC(np,PL_XMIT_VECTOR),n) ;
#ifdef DEBUG
#if 1
#ifdef DEBUG_BRD
if (smc->debug.d_plc & 0x80)
#else
if (debug.d_plc & 0x80)
#endif
printf("SIGNALING bit %d .. %d\n",phy->bitn,phy->bitn+len-1) ;
#endif
#endif
return 0;
}
示例8: init_psg
void init_psg(int dacAdjust )
{
#ifndef WINDOWS_NT
word indexPort, dataPort, i;
#else
PUCHAR indexPort, dataPort;
word i;
#endif
indexPort = encBaseAddr + PSG_ADDR_CTRL;
dataPort = encBaseAddr + PSG_DATA_CTRL;
for (i = 0; i < PSG_NBRE_REG - 3; i++) /* 3 for 3 registers RO */
{
outpw (indexPort, i);
#ifndef WINDOWS_NT
if (i == 0x0a) /* Ajustement dependant du DAC */
outpw (dataPort, ptrEncReg->psgReg[i] + dacAdjust);
else
outpw (dataPort, ptrEncReg->psgReg[i]);
#else
if (i == 0x0a) /* Ajustement dependant du DAC */
outpw ((PUSHORT)dataPort, (USHORT)(ptrEncReg->psgReg[i] + dacAdjust));
else
outpw ((PUSHORT)dataPort, (USHORT)(ptrEncReg->psgReg[i]));
#endif
}
}
示例9: usiInitDevice
int usiInitDevice(UINT32 clock_by_MHz)
{
int volatile rate, id;
// multi PAD control
outpw(REG_PADC0, inpw(REG_PADC0)|0x40);
/* init SPI interface */
rate = clock_by_MHz / 40; // access SPIFlash 20MHz
if (((clock_by_MHz % 40) == 0) && (rate != 1))
rate = rate - 1;
outpw(REG_USI_DIVIDER, rate);
id = usiReadID();
// sysprintf("id [0x%x]\n", id);
if (id == 0xef12)
return 1024; // 512KB, 1024 sectors(for file system, 1 sector=512 byte)
else if (id == 0xef13)
return 2048; // 1MB, 2048 sectors(for file system, 1 sector=512 byte)
else if (id == 0xef14)
return 4096; // 2MB, 4096 sectors
else if (id == 0xef15)
return 8192; // 4MB, 8192 sectors
else
return USI_ERR_DEVICE;
return USI_NO_ERR;
}
示例10: ADC_IRQHandler
//*****************************************************************************
//
//! \brief ADC Interrupt Service Routine.According to the interrupt flags to call
//! the corresponding callback function.
//!
//! \param None
//!
//! \return None
//
//*****************************************************************************
void ADC_IRQHandler(void)
{
if(ADC->SR_BITS.ADF==1)
{
if(g_ptADCCallBack)
g_ptADCCallBack(g_pu32UserData[0]);
/* clear the A/D conversion flag */
/* "ADC->ADSR.ADF = 1;" is not recommended. It may clear CMPF0 and CMPF1. */
outpw(ADC_ADSR, (inpw(ADC_ADSR)&(~0x7))|0x1);
}
if(ADC->SR_BITS.CMPF0==1)
{
if(g_ptADCMP0CallBack)
g_ptADCMP0CallBack(g_pu32UserData[1]);
/* clear the A/D compare flag 0 */
/* "ADC->ADSR.CMPF0 = 1;" is not recommended. It may clear ADF and CMPF1. */
outpw(ADC_ADSR, (inpw(ADC_ADSR)&(~0x7))|0x2);
}
if(ADC->SR_BITS.CMPF1==1)
{
if(g_ptADCMP1CallBack)
g_ptADCMP1CallBack(g_pu32UserData[2]);
/* clear the A/D compare flag 1 */
/* "ADC->ADSR.CMPF1 = 1;" is not recommended. It may clear ADF and CMPF0. */
outpw(ADC_ADSR, (inpw(ADC_ADSR)&(~0x7))|0x4);
}
}
示例11: usiEraseSector
int usiEraseSector(UINT32 addr, UINT32 secCount)
{
int volatile i;
for (i=0; i<secCount; i++)
{
usiWriteEnable();
outpw(REG_USI_SSR, inpw(REG_USI_SSR) | 0x01); // CS0
// erase command
outpw(REG_USI_Tx0, 0xd8);
usiTxLen(0, 8);
usiActive();
// address
outpw(REG_USI_Tx0, addr+i*0x10000); // 1 sector = 64KB
usiTxLen(0, 24);
usiActive();
outpw(REG_USI_SSR, inpw(REG_USI_SSR) & 0xfe); // CS0
// check status
usiCheckBusy();
}
return USI_NO_ERR;
}
示例12: usiReadID
UINT16 usiReadID()
{
UINT16 volatile id;
outpw(REG_USI_SSR, inpw(REG_USI_SSR) | 0x01); // CS0
// command 8 bit
outpw(REG_USI_Tx0, 0x90);
usiTxLen(0, 8);
usiActive();
// address 24 bit
outpw(REG_USI_Tx0, 0x000000);
usiTxLen(0, 24);
usiActive();
// data 16 bit
outpw(REG_USI_Tx0, 0xffff);
usiTxLen(0, 16);
usiActive();
id = inpw(REG_USI_Rx0) & 0xffff;
outpw(REG_USI_SSR, inpw(REG_USI_SSR) & 0xfe); // CS0
return id;
}
示例13: led_yellow_set_state
void led_yellow_set_state( uint8_t state )
{
if (state)
outpw(P1DATA, (inpw(P1DATA) & ~0x1800) & ~0x200);
else
outpw(P1DATA, (inpw(P1DATA) & ~0x1800) | 0x200);
}
示例14: i2cOpen
/**
* @brief This function reset the i2c interface and enable interrupt.
* @param[in] param is interface number.
* @return open status.
* @retval 0 success.
* @retval I2C_ERR_BUSY Interface already opened.
* @retval I2C_ERR_NODEV Interface number out of range.
*/
int32_t i2cOpen(PVOID param)
{
i2c_dev *dev;
if( (uint32_t)param >= I2C_NUMBER)
return I2C_ERR_NODEV;
dev = (i2c_dev *)((uint32_t)&i2c_device[(uint32_t)param] );
if( dev->openflag != 0 ) /* a card slot can open only once */
return(I2C_ERR_BUSY);
/* Enable engine clock */
if((uint32_t)param == 0)
outpw(REG_CLK_PCLKEN1, inpw(REG_CLK_PCLKEN1) | 0x1);
else
outpw(REG_CLK_PCLKEN1, inpw(REG_CLK_PCLKEN1) | 0x2);
memset(dev, 0, sizeof(i2c_dev));
dev->base = ((uint32_t)param) ? I2C1_BA : I2C0_BA;
_i2cReset(dev);
dev->openflag = 1;
return 0;
}
示例15: CheckClock
/*************************************************************************
module :[周波数チェック]
function :[周波数チェック]
return :[チェック結果]
common :[]
condition :[
機種 0:ポプラB 1:
]
comment :[]
machine :[SH7043]
language :[SHC]
keyword :[CHK]
date :[1997/06/24]
author :[山口]
*************************************************************************/
void CheckClock( UBYTE Machine ) /* 機種 */
{
UWORD tmp; /*テンポラリー*/
UWORD i; /*ループ*/
/* 周波数チェック(以下の配列定数は配列0がポプラB、配列1が?) */
UDWORD clock_port[] = {RTC_PORT,0xC203C0}; /* 周波数チェックポート*/
UWORD clock_CE_bit[] = {0x0001,0x0001}; /* 周波数チェックCEビット */
UWORD clock_IO_bit[] = {0x0004,0x0004}; /* 周波数チェックIOビット 0:ON(W) 1:OFF(R) */
/* UWORD clock_IO_bit[] = {IO_BIT_RTC_IO,0x0004}; /@ 周波数チェックIOビット 1997/11/13 By T.Yamaguchi */
/*---------------------------------------------------------------------
** SAKAKIでは、ATLANTAに対して、IO_BIT_RTC_IOの論理が逆転しています。
** チェッカー作成時には、変更が必要です。まだ変更していません。
** 1998/07/10 H.Yoshikawa
*/
/** CE,IOをLowにセット */
tmp = clock_IO_bit[Machine]; /** CE,IOをOFF */
outpw(clock_port[Machine],tmp); /** 周波数チェックポート出力 */
/** CE、IO制御 */
tmp |= clock_CE_bit[Machine]; /** CE ON */
outpw(clock_port[Machine],tmp); /** 周波数チェックポート出力 */
for ( i = 0; i < 1801; i++ ) {} /** 5〜6msウエイト */
for ( i = 0; i < 5; i++ ) {
tmp &= (~clock_IO_bit[Machine]);/** IO ON */
outpw(clock_port[Machine],tmp); /** 周波数チェックポート出力 */
tmp |= clock_IO_bit[Machine]; /** IO OFF */
outpw(clock_port[Machine],tmp); /** 周波数チェックポート出力 */
}
}