本文整理汇总了C++中DbgOut函数的典型用法代码示例。如果您正苦于以下问题:C++ DbgOut函数的具体用法?C++ DbgOut怎么用?C++ DbgOut使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DbgOut函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ZeroMemory
//.........这里部分代码省略.........
//m_tlv2[tlvno].specular = 0xFF000000;
tlvno++;
}
}
int curindex = 0;
for( vno = 0; vno < (BGVNUM - 1); vno++ ){
for( uno = 0; uno < (BGUNUM - 1); uno++ ){
m_Indices[curindex] = BGUNUM * vno + uno;
m_Indices[curindex + 2] = BGUNUM * (vno + 1) + uno;
m_Indices[curindex + 1] = BGUNUM * vno + uno + 1;
curindex += 3;
m_Indices[curindex] = BGUNUM * (vno + 1) + uno;
m_Indices[curindex + 2] = BGUNUM * (vno + 1) + uno + 1;
m_Indices[curindex + 1] = BGUNUM * vno + uno + 1;
curindex += 3;
}
}
//m_Indices[0] = 1;
//m_Indices[1] = 3;
//m_Indices[2] = 0;
//m_Indices[3] = 2;
ret = CheckMultiTexOk( pd3dDevice );
if( ret ){
multitexok = 0;
DbgOut( "bgdisp2 : ini : CheckMultiTexOk : warning !!!\n" );
}
ret = Create3DBuffers( pd3dDevice );
_ASSERT( !ret );
if( ret ){
DbgOut( "bgdisp2 : Create3DBuffers error !!!\n" );
}
if( resetflag == 0 ){
ret = CreateTexture( pd3dDevice );
_ASSERT( !ret );
if( ret ){
DbgOut( "bgdisp2 : CreateTexture error !!!\n" );
}
}
ret = Copy2IndexBuffer();
_ASSERT( !ret );
if( ret ){
DbgOut( "bgdisp2 : Copy2IndexBuffer error !!!\n" );
}
ret = Copy2VertexBuffer();
_ASSERT( !ret );
if( ret ){
DbgOut( "bgdisp2 : Copy2VertexBuffer error !!!\n" );
}
///////////////
// pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
// pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
示例2: write
static ssize_t write(struct file *file, const char *buf, size_t count,
loff_t *ppos)
{
int i = 0;
*ppos = 0; /* file position not used, always set to 0 */
/* DbgOut((KERN_ERR "tspdrv: write....\n")); */
/*
** Prevent unauthorized caller to write data.
** TouchSense service is the only valid caller.
*/
if (file->private_data != (void *)TSPDRV_MAGIC_NUMBER) {
DbgOut((KERN_ERR "tspdrv: unauthorized write.\n"));
return 0;
}
#ifdef CONFIG_TACTILE_ASSIST
/* Check buffer size */
if ((count < SPI_HEADER_SIZE) || (count > SPI_BUFFER_SIZE)) {
DbgOut((KERN_ERR "tspdrv: invalid write buffer size.\n"));
return 0;
}
if (count == SPI_HEADER_SIZE)
g_bOutputDataBufferEmpty = 1;
else
g_bOutputDataBufferEmpty = 0;
#else
if ((count <= SPI_HEADER_SIZE) || (count > SPI_BUFFER_SIZE)) {
DbgOut((KERN_ERR "tspdrv: invalid write buffer size.\n"));
return 0;
}
#endif
/* Copy immediately the input buffer */
if (0 != copy_from_user(g_cwrite_buffer, buf, count)) {
/* Failed to copy all the data, exit */
DbgOut((KERN_ERR "tspdrv: copy_from_user failed.\n"));
return 0;
}
while (i < count) {
int nindex_free_buffer; /* initialized below */
samples_buffer *pinput_buffer =
(samples_buffer *)(&g_cwrite_buffer[i]);
#ifdef CONFIG_TACTILE_ASSIST
if ((i + SPI_HEADER_SIZE) > count) {
#else
if ((i + SPI_HEADER_SIZE) >= count) {
#endif
/*
** Index is about to go beyond the buffer size.
** (Should never happen).
*/
DbgOut((KERN_EMERG "tspdrv: invalid buffer index.\n"));
return 0;
}
/* Check bit depth */
if (8 != pinput_buffer->nbit_depth)
DbgOut((KERN_WARNING
"tspdrv: invalid bit depth.Use default value(8).\n"));
/* The above code not valid if SPI header size is not 3 */
#if (SPI_HEADER_SIZE != 3)
#error "SPI_HEADER_SIZE expected to be 3"
#endif
/* Check buffer size */
if ((i + SPI_HEADER_SIZE + pinput_buffer->nbuffer_size)
> count) {
/*
** Index is about to go beyond the buffer size.
** (Should never happen).
*/
DbgOut((KERN_EMERG "tspdrv: invalid data size.\n"));
return 0;
}
/* Check actuator index */
if (NUM_ACTUATORS <= pinput_buffer->nactuator_index) {
DbgOut((KERN_ERR "tspdrv: invalid actuator index.\n"));
i += (SPI_HEADER_SIZE + pinput_buffer->nbuffer_size);
continue;
}
if (0 == g_samples_buffer[pinput_buffer->nactuator_index]
.actuator_samples[0].nbuffer_size) {
nindex_free_buffer = 0;
} else if (0 == g_samples_buffer[pinput_buffer->nactuator_index]
.actuator_samples[1].nbuffer_size) {
nindex_free_buffer = 1;
} else {
/* No room to store new samples */
DbgOut((KERN_ERR
"tspdrv: no room to store new samples.\n"));
return 0;
}
//.........这里部分代码省略.........
示例3: ToasterClassInstaller
DWORD CALLBACK
ToasterClassInstaller(
_In_ DI_FUNCTION InstallFunction,
_In_ HDEVINFO DeviceInfoSet,
_In_ PSP_DEVINFO_DATA DeviceInfoData OPTIONAL
)
/*++
Routine Description:
Responds to Class-installer messages
.
Arguments:
InstallFunction [in]
DeviceInfoSet [in]
DeviceInfoData [in]
Return Value:
Returns: NO_ERROR, ERROR_DI_POSTPROCESSING_REQUIRED, or an error code.
--*/
{
switch (InstallFunction)
{
case DIF_INSTALLDEVICE:
//
// Sent twice: once before installing the device and once
// after installing device, if you have returned
// ERROR_DI_POSTPROCESSING_REQUIRED during the first pass.
//
DbgOut("DIF_INSTALLDEVICE");
break;
case DIF_ADDPROPERTYPAGE_ADVANCED:
//
// Sent when you check the properties of the device in the
// device manager.
//
DbgOut("DIF_ADDPROPERTYPAGE_ADVANCED");
return PropPageProvider(DeviceInfoSet, DeviceInfoData);
case DIF_POWERMESSAGEWAKE:
//
// Sent when you check the power management tab
//
DbgOut("DIF_POWERMESSAGEWAKE");
break;
case DIF_PROPERTYCHANGE:
//
// Sent when you change the property of the device using
// SetupDiSetDeviceInstallParams. (Enable/Disable/Restart)
//
DbgOut("DIF_PROPERTYCHANGE");
break;
case DIF_REMOVE:
//
// Sent when you uninstall the device.
//
DbgOut("DIF_REMOVE");
break;
case DIF_NEWDEVICEWIZARD_FINISHINSTALL:
//
// Sent near the end of installation to allow
// an installer to supply wizard page(s) to the user.
// These wizard pages are different from the device manager
// property sheet.There are popped only once during install.
//
DbgOut("DIF_NEWDEVICEWIZARD_FINISHINSTALL");
break;
case DIF_SELECTDEVICE:
DbgOut("DIF_SELECTDEVICE");
break;
case DIF_DESTROYPRIVATEDATA:
//
// Sent when Setup destroys a device information set
// or an SP_DEVINFO_DATA element, or when Setup discards
// its list of co-installers and class installer for a device
//
DbgOut("DIF_DESTROYPRIVATEDATA");
break;
case DIF_INSTALLDEVICEFILES:
DbgOut("DIF_INSTALLDEVICEFILES");
break;
case DIF_ALLOW_INSTALL:
//
// Sent to confirm whether the installer wants to allow
// the installation of device.
//
DbgOut("DIF_ALLOW_INSTALL");
break;
case DIF_SELECTBESTCOMPATDRV:
DbgOut("DIF_SELECTBESTCOMPATDRV");
break;
case DIF_INSTALLINTERFACES:
//.........这里部分代码省略.........
示例4: ioctl
static int ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
#endif
{
switch (cmd)
{
case TSPDRV_SET_MAGIC_NUMBER:
file->private_data = (void*)TSPDRV_MAGIC_NUMBER;
break;
case TSPDRV_ENABLE_AMP:
ImmVibeSPI_ForceOut_AmpEnable(arg);
#ifdef VIBE_RUNTIME_RECORD
if (atomic_read(&g_bRuntimeRecord)) {
DbgRecord((arg,";------- TSPDRV_ENABLE_AMP ---------\n"));
}
#else
DbgRecorderReset((arg));
DbgRecord((arg,";------- TSPDRV_ENABLE_AMP ---------\n"));
#endif
break;
case TSPDRV_DISABLE_AMP:
ImmVibeSPI_ForceOut_AmpDisable(arg);
#ifdef VIBE_RUNTIME_RECORD
if (atomic_read(&g_bRuntimeRecord)) {
DbgRecord((arg,";------- TSPDRV_DISABLE_AMP ---------\n"));
}
#endif
break;
case TSPDRV_GET_NUM_ACTUATORS:
return NUM_ACTUATORS;
case TSPDRV_SET_DBG_LEVEL:
{
long nDbgLevel;
if (0 != copy_from_user((void *)&nDbgLevel, (const void __user *)arg, sizeof(long))) {
/* Error copying the data */
DbgOut((DBL_ERROR, "copy_from_user failed to copy debug level data.\n"));
return -1;
}
if (DBL_TEMP <= nDbgLevel && nDbgLevel <= DBL_OVERKILL)
atomic_set(&g_nDebugLevel, nDbgLevel);
else
DbgOut((DBL_ERROR, "Invalid debug level requested, ignored."));
break;
}
case TSPDRV_GET_DBG_LEVEL:
return atomic_read(&g_nDebugLevel);
#ifdef VIBE_RUNTIME_RECORD
case TSPDRV_SET_RUNTIME_RECORD_FLAG:
{
long nRecordFlag;
if (0 != copy_from_user((void *)&nRecordFlag, (const void __user *)arg, sizeof(long))) {
/* Error copying the data */
DbgOut((DBL_ERROR, "copy_from_user failed to copy runtime record flag.\n"));
return -1;
}
atomic_set(&g_bRuntimeRecord, nRecordFlag);
if (nRecordFlag) {
int i;
for (i = 0; i < NUM_ACTUATORS; i++) {
DbgRecorderReset((i));
}
}
break;
}
case TSPDRV_GET_RUNTIME_RECORD_FLAG:
return atomic_read(&g_bRuntimeRecord);
case TSPDRV_SET_RUNTIME_RECORD_BUF_SIZE:
{
long nRecorderBufSize;
if (0 != copy_from_user((void *)&nRecorderBufSize, (const void __user *)arg, sizeof(long))) {
/* Error copying the data */
DbgOut((DBL_ERROR, "copy_from_user failed to copy recorder buffer size.\n"));
return -1;
}
if (0 == DbgSetRecordBufferSize(nRecorderBufSize)) {
DbgOut((DBL_ERROR, "DbgSetRecordBufferSize failed.\n"));
return -1;
}
break;
}
case TSPDRV_GET_RUNTIME_RECORD_BUF_SIZE:
return DbgGetRecordBufferSize();
#endif
case TSPDRV_SET_DEVICE_PARAMETER:
{
device_parameter deviceParam;
if (0 != copy_from_user((void *)&deviceParam, (const void __user *)arg, sizeof(deviceParam))) {
/* Error copying the data */
DbgOut((DBL_ERROR, "tspdrv: copy_from_user failed to copy kernel parameter data.\n"));
return -1;
}
//.........这里部分代码省略.........
示例5: platform_release
static void platform_release(struct device *dev)
{
DbgOut((DBL_ERROR, "tspdrv: platform_release.\n"));
}
示例6: init_module
int init_module(void)
{
int nRet, i; /* initialized below */
#ifdef IMPLEMENT_AS_CHAR_DRIVER
g_nMajor = register_chrdev(0, MODULE_NAME, &fops);
if (g_nMajor < 0) {
DbgOut((KERN_ERR "tspdrv: can't get major number.\n"));
return g_nMajor;
}
#else
nRet = misc_register(&miscdev);
if (nRet) {
DbgOut((KERN_ERR "tspdrv: misc_register failed.\n"));
return nRet;
}
#endif
nRet = platform_device_register(&platdev);
if (nRet)
DbgOut((KERN_ERR "tspdrv: platform_device_register failed.\n"));
nRet = platform_driver_register(&platdrv);
if (nRet)
DbgOut((KERN_ERR "tspdrv: platform_driver_register failed.\n"));
nRet = platform_driver_register(&max8997_hapticmotor_driver);
if (nRet)
DbgOut((KERN_ERR "tspdrv: platform_driver_register failed (hapticmotor).\n"));
DbgRecorderInit(());
vibetonz_clk_on(&platdev.dev);
ImmVibeSPI_ForceOut_Initialize();
VibeOSKernelLinuxInitTimer();
/* Get and concatenate device name and initialize data buffer */
g_cchDeviceName = 0;
for (i = 0; i < NUM_ACTUATORS; i++) {
char *szName = g_szDeviceName + g_cchDeviceName;
ImmVibeSPI_Device_GetName(i, szName, VIBE_MAX_DEVICE_NAME_LENGTH);
/* Append version information and get buffer length */
strcat(szName, VERSION_STR);
g_cchDeviceName += strlen(szName);
g_SamplesBuffer[i].nIndexPlayingBuffer = -1; /* Not playing */
g_SamplesBuffer[i].actuatorSamples[0].nBufferSize = 0;
g_SamplesBuffer[i].actuatorSamples[1].nBufferSize = 0;
}
wake_lock_init(&vib_wake_lock, WAKE_LOCK_SUSPEND, "vib_present");
if (device_create_file(&platdev.dev, &dev_attr_vibrator_level_max) < 0) {
printk(KERN_ERR "Failed to create device file(%s)!\n", dev_attr_vibrator_level_max.attr.name);
}
if (device_create_file(&platdev.dev, &dev_attr_vibrator_level) < 0) {
printk(KERN_ERR "Failed to create device file(%s)!\n", dev_attr_vibrator_level.attr.name);
}
vibetonz_start();
return 0;
}
示例7: write
static ssize_t write( struct file *file, const char *buf, size_t count, loff_t *ppos )
{
int i = 0;
*ppos = 0; /* file position not used, always set to 0 */
/*
** Prevent unauthorized caller to write data.
** TouchSense service is the only valid caller.
*/
if ( file->private_data != (void*)TSPDRV_MAGIC_NUMBER ) {
DbgOut( ( KERN_ERR "tspdrv: unauthorized write.\n" ) );
return 0;
}
/* Copy immediately the input buffer */
if ( 0 != copy_from_user( g_cWriteBuffer, buf, count ) ) {
/* Failed to copy all the data, exit */
DbgOut( ( KERN_ERR "tspdrv: copy_from_user failed.\n" ) );
return 0;
}
/* Check buffer size */
if ( ( count <= SPI_HEADER_SIZE ) || ( count > SPI_BUFFER_SIZE ) ) {
DbgOut( ( KERN_ERR "tspdrv: invalid write buffer size.\n" ) );
return 0;
}
while ( i < count ) {
int nIndexFreeBuffer; /* initialized below */
samples_buffer* pInputBuffer = (samples_buffer*)(&g_cWriteBuffer[i]);
if ( ( i + SPI_HEADER_SIZE ) >= count ) {
/*
** Index is about to go beyond the buffer size.
** (Should never happen).
*/
DbgOut( ( KERN_EMERG "tspdrv: invalid buffer index.\n" ) );
}
/* Check bit depth */
if ( 8 != pInputBuffer->nBitDepth ) {
DbgOut( ( KERN_WARNING "tspdrv: invalid bit depth. Use default value (8).\n" ) );
}
/* The above code not valid if SPI header size is not 3 */
#if ( SPI_HEADER_SIZE != 3 )
#error "SPI_HEADER_SIZE expected to be 3"
#endif
/* Check buffer size */
if ( ( i + SPI_HEADER_SIZE + pInputBuffer->nBufferSize ) > count ) {
/*
** Index is about to go beyond the buffer size.
** (Should never happen).
*/
DbgOut( ( KERN_EMERG "tspdrv: invalid data size.\n" ) );
}
/* Check actuator index */
if ( NUM_ACTUATORS <= pInputBuffer->nActuatorIndex ) {
DbgOut( ( KERN_ERR "tspdrv: invalid actuator index.\n" ) );
i += ( SPI_HEADER_SIZE + pInputBuffer->nBufferSize );
continue;
}
if ( 0 == g_SamplesBuffer[pInputBuffer->nActuatorIndex].actuatorSamples[0].nBufferSize ) {
nIndexFreeBuffer = 0;
} else if ( 0 == g_SamplesBuffer[pInputBuffer->nActuatorIndex].actuatorSamples[1].nBufferSize ) {
nIndexFreeBuffer = 1;
} else {
/* No room to store new samples */
DbgOut( ( KERN_ERR "tspdrv: no room to store new samples.\n" ) );
return 0;
}
/* Store the data in the free buffer of the given actuator */
memcpy( &(g_SamplesBuffer[pInputBuffer->nActuatorIndex].actuatorSamples[nIndexFreeBuffer]), &g_cWriteBuffer[i], (SPI_HEADER_SIZE + pInputBuffer->nBufferSize) );
/* If the no buffer is playing, prepare to play g_SamplesBuffer[pInputBuffer->nActuatorIndex].actuatorSamples[nIndexFreeBuffer] */
if ( -1 == g_SamplesBuffer[pInputBuffer->nActuatorIndex].nIndexPlayingBuffer ) {
g_SamplesBuffer[pInputBuffer->nActuatorIndex].nIndexPlayingBuffer = nIndexFreeBuffer;
g_SamplesBuffer[pInputBuffer->nActuatorIndex].nIndexOutputValue = 0;
}
/* Increment buffer index */
i += ( SPI_HEADER_SIZE + pInputBuffer->nBufferSize );
} // end of while
#ifdef QA_TEST
g_nForceLog[g_nForceLogIndex++] = g_cSPIBuffer[0];
if ( g_nForceLogIndex >= FORCE_LOG_BUFFER_SIZE ) {
for ( i=0; i<FORCE_LOG_BUFFER_SIZE; i++ ) {
printk( "<6>%d\t%d\n", g_nTime, g_nForceLog[i] );
g_nTime += TIME_INCREMENT;
}
//.........这里部分代码省略.........
示例8: ImmVibeSPI_ForceOut_AmpEnable
/*
** Called to enable amp (enable output force0)
*/
IMMVIBESPIAPI VibeStatus ImmVibeSPI_ForceOut_AmpEnable(VibeUInt8 nActuatorIndex)
{
int cnt = 0;
unsigned char I2C_data[1];
int ret = VIBE_S_SUCCESS;
int fd = 0;
mm_segment_t oldfs = get_fs();
set_fs(KERNEL_DS);
fd = sys_open("/sdcard/vib.txt", O_RDONLY , 0755);
if (!g_bAmpEnabled)
{
DbgOut((KERN_DEBUG "ImmVibeSPI_ForceOut_AmpEnable.\n"));
g_bAmpEnabled = true;
PWM_CLK_ENABLE;
#ifdef ISA1200_HEN_ENABLE
SYS_API_HEN_HIGH;
#endif
if(fd >= 0) //ELT Test Mode
{
printk("[ImmVibeSPI_ForceOut_AmpEnable] Case : ELT Test Vibration\n");
if(status == 0){
printk("[ImmVibeSPI_ForceOut_AmpEnable] ELT : Register Setting \n");
I2C_data[0] = LDO_VOLTAGE_30V; // LDO Voltage : 3.0V
do
{
ret = SYS_API__I2C__Write(SCTRL, I2C_data[0]);
cnt++;
}while(VIBE_S_SUCCESS != ret && cnt < RETRY_CNT);
if( VIBE_S_SUCCESS != ret) DEBUG_MSG("[ImmVibeSPI_ForceOut_Initialize] I2C_Write Error, Slave Address = [%d], ret = [%d]\n", I2C_data[0], ret);
I2C_data[0] = 0x93; //224Hz
do{
ret = SYS_API__I2C__Write(HCTRL4, I2C_data[0]);
cnt++;
}while(VIBE_S_SUCCESS != ret && cnt < RETRY_CNT);
if( VIBE_S_SUCCESS != ret) DEBUG_MSG("[ImmVibeSPI_ForceOut_Initialize] I2C_Write Error, Slave Address = [%d], ret = [%d]\n", I2C_data[0], ret);
I2C_data[0] = tspdrv_i2c_read_byte_data(SCTRL);
printk("[ImmVibeSPI_ForceOut_AmpEnable] ELT HCTRL0 written data : 0x%x\n", I2C_data[0]);
I2C_data[0] = tspdrv_i2c_read_byte_data(HCTRL4);
printk("[ImmVibeSPI_ForceOut_AmpEnable] ELT HCTRL1 written data : 0x%x\n", I2C_data[0]);
status = 1;
}
else{ //Normal Mode
printk("[ImmVibeSPI_ForceOut_AmpEnable] ELT : just vibrate \n");
}
}
else{
printk("[ImmVibeSPI_ForceOut_AmpEnable] Case : Normal Vibration\n");
if(status == 1){
printk("[ImmVibeSPI_ForceOut_AmpEnable] Normal : Register Setting \n");
I2C_data[0] = g_nLDO_Voltage; // LDO Voltage : 2.7V
do
{
ret = SYS_API__I2C__Write(SCTRL, I2C_data[0]);
cnt++;
}while(VIBE_S_SUCCESS != ret && cnt < RETRY_CNT);
if( VIBE_S_SUCCESS != ret) DEBUG_MSG("[ImmVibeSPI_ForceOut_Initialize] I2C_Write Error, Slave Address = [%d], ret = [%d]\n", I2C_data[0], ret);
I2C_data[0] = 0x94; //230Hz
do{
ret = SYS_API__I2C__Write(HCTRL4, I2C_data[0]);
cnt++;
}while(VIBE_S_SUCCESS != ret && cnt < RETRY_CNT);
if( VIBE_S_SUCCESS != ret) DEBUG_MSG("[ImmVibeSPI_ForceOut_Initialize] I2C_Write Error, Slave Address = [%d], ret = [%d]\n", I2C_data[0], ret);
I2C_data[0] = tspdrv_i2c_read_byte_data(SCTRL);
printk("[ImmVibeSPI_ForceOut_AmpEnable] Normal HCTRL0 written data : 0x%x\n", I2C_data[0]);
I2C_data[0] = tspdrv_i2c_read_byte_data(HCTRL4);
printk("[ImmVibeSPI_ForceOut_AmpEnable] Normal HCTRL1 written data : 0x%x\n", I2C_data[0]);
status =0;
}
else{
printk("[ImmVibeSPI_ForceOut_AmpEnable] Normal : just vibrate \n");
}
}
I2C_data[0] = 0x88; // Haptic Drive Enable + PWM Input mode
//.........这里部分代码省略.........
示例9: ImmVibeSPI_ForceOut_Initialize
/*
** Called at initialization time to set PWM frequencies, disable amp, etc...
*/
IMMVIBESPIAPI VibeStatus ImmVibeSPI_ForceOut_Initialize(void)
{
int cnt = 0;
unsigned char I2C_data[1];
int ret = VIBE_S_SUCCESS;
DbgOut((KERN_DEBUG "ImmVibeSPI_ForceOut_Initialize.\n"));
SYS_API_VDDP_ON;
SYS_API_LEN_HIGH;
SLEEP(20 /*ms*/);
I2C_data[0] = g_nLDO_Voltage; // LDO Voltage
do
{
ret = SYS_API__I2C__Write(SCTRL, I2C_data[0]);
cnt++;
}while(VIBE_S_SUCCESS != ret && cnt < RETRY_CNT);
if( VIBE_S_SUCCESS != ret) DEBUG_MSG("[ImmVibeSPI_ForceOut_Initialize] I2C_Write Error, Slave Address = [%d], ret = [%d]\n", I2C_data[0], ret);
I2C_data[0] = 0x08; // Haptic Drive Disable + PWM Input mode
do
{
ret = SYS_API__I2C__Write(HCTRL0, I2C_data[0]);
cnt++;
}while(VIBE_S_SUCCESS != ret && cnt < RETRY_CNT);
if( VIBE_S_SUCCESS != ret) DEBUG_MSG("[ImmVibeSPI_ForceOut_Initialize] I2C_Write Error, Slave Address = [%d], ret = [%d]\n", I2C_data[0], ret);
I2C_data[0] = 0x40; // EXT clock + DAC inversion + LRA
do
{
ret = SYS_API__I2C__Write(HCTRL1, I2C_data[0]);
cnt++;
}while(VIBE_S_SUCCESS != ret && cnt < RETRY_CNT);
if( VIBE_S_SUCCESS != ret) DEBUG_MSG("[ImmVibeSPI_ForceOut_Initialize] I2C_Write Error, Slave Address = [%d], ret = [%d]\n", I2C_data[0], ret);
I2C_data[0] = 0x00; // Disable Software Reset
do
{
ret = SYS_API__I2C__Write(HCTRL2, I2C_data[0]);
cnt++;
}while(VIBE_S_SUCCESS != ret && cnt < RETRY_CNT);
if( VIBE_S_SUCCESS != ret) DEBUG_MSG("[ImmVibeSPI_ForceOut_Initialize] I2C_Write Error, Slave Address = [%d], ret = [%d]\n", I2C_data[0], ret);
I2C_data[0] = 0x13; // Disable Software Reset
do
{
ret = SYS_API__I2C__Write(HCTRL3, I2C_data[0]);
cnt++;
}while(VIBE_S_SUCCESS != ret && cnt < RETRY_CNT);
if( VIBE_S_SUCCESS != ret) DEBUG_MSG("[ImmVibeSPI_ForceOut_Initialize] I2C_Write Error, Slave Address = [%d], ret = [%d]\n", I2C_data[0], ret);
I2C_data[0] = 0x93; //20.3KHz -> 229.xHz
do
{
ret = SYS_API__I2C__Write(HCTRL4, I2C_data[0]);
cnt++;
}while(VIBE_S_SUCCESS != ret && cnt < RETRY_CNT);
if( VIBE_S_SUCCESS != ret) DEBUG_MSG("[ImmVibeSPI_ForceOut_Initialize] I2C_Write Error, Slave Address = [%d], ret = [%d]\n", I2C_data[0], ret);
I2C_data[0] = 0x00;
do
{
ret = SYS_API__I2C__Write(HCTRL5, I2C_data[0]);
cnt++;
}while(VIBE_S_SUCCESS != ret && cnt < RETRY_CNT);
if( VIBE_S_SUCCESS != ret) DEBUG_MSG("[ImmVibeSPI_ForceOut_Initialize] I2C_Write Error, Slave Address = [%d], ret = [%d]\n", I2C_data[0], ret);
I2C_data[0] = 0x00;
do
{
ret = SYS_API__I2C__Write(HCTRL6, I2C_data[0]);
cnt++;
}while(VIBE_S_SUCCESS != ret && cnt < RETRY_CNT);
if( VIBE_S_SUCCESS != ret) DEBUG_MSG("[ImmVibeSPI_ForceOut_Initialize] I2C_Write Error, Slave Address = [%d], ret = [%d]\n", I2C_data[0], ret);
return VIBE_S_SUCCESS;
}
示例10: ImmVibeSPI_ForceOut_SetSamples
/*
** Called by the real-time loop to set PWM duty cycle
*/
IMMVIBESPIAPI VibeStatus ImmVibeSPI_ForceOut_SetSamples(VibeUInt8 nActuatorIndex,
VibeUInt16 nOutputSignalBitDepth,
VibeUInt16 nBufferSizeInBytes,
VibeInt8 * pForceOutputBuffer)
{
#if 0
VibeInt8 nForce;
switch (nOutputSignalBitDepth) {
case 8:
/* pForceOutputBuffer is expected to contain 1 byte */
if (nBufferSizeInBytes != 1) {
DbgOut((KERN_ERR "[ImmVibeSPI] ImmVibeSPI_ForceOut_SetSamples nBufferSizeInBytes = %d\n", nBufferSizeInBytes));
return VIBE_E_FAIL;
}
nForce = pForceOutputBuffer[0];
break;
case 16:
/* pForceOutputBuffer is expected to contain 2 byte */
if (nBufferSizeInBytes != 2)
return VIBE_E_FAIL;
/* Map 16-bit value to 8-bit */
nForce = ((VibeInt16 *)pForceOutputBuffer)[0] >> 8;
break;
default:
/* Unexpected bit depth */
return VIBE_E_FAIL;
}
if (nForce == 0)
/* Set 50% duty cycle or disable amp */
else
/* Map force from [-127, 127] to [0, PWM_DUTY_MAX] */
#endif
VibeInt8 nForce;
switch (nOutputSignalBitDepth) {
case 8:
/* pForceOutputBuffer is expected to contain 1 byte */
if (nBufferSizeInBytes != 1) {
DbgOut((KERN_ERR "[ImmVibeSPI] ImmVibeSPI_ForceOut_SetSamples nBufferSizeInBytes = %d\n", nBufferSizeInBytes));
return VIBE_E_FAIL;
}
nForce = pForceOutputBuffer[0];
break;
case 16:
/* pForceOutputBuffer is expected to contain 2 byte */
if (nBufferSizeInBytes != 2)
return VIBE_E_FAIL;
/* Map 16-bit value to 8-bit */
nForce = ((VibeInt16 *)pForceOutputBuffer)[0] >> 8;
break;
default:
/* Unexpected bit depth */
return VIBE_E_FAIL;
}
if (nForce == 0) {
/* Set 50% duty cycle or disable amp */
ImmVibeSPI_ForceOut_AmpDisable(0);
} else {
/* Map force from [-127, 127] to [0, PWM_DUTY_MAX] */
ImmVibeSPI_ForceOut_AmpEnable(0);
#if !defined(CONFIG_MACH_P4NOTE)
vibtonz_pwm(nForce);
#endif
}
return VIBE_S_SUCCESS;
}
示例11: av_log_set_callback
Codec_Errors H263VideoEncoder::Open(MediaFormat* encFormat, CodecData* encData){
Codec_Errors retval = CODEC_SUCCEEDED;
av_log_set_callback(&avlog_cb);
try
{
sprintf(dbg_buffer, "Opening H263VideoEncoder\n");
DbgOut(dbg_buffer);
avcodec_register_all(); //initialize codecs.
CurrentFormat = encFormat; //store format settings.
CurrentData = encData;
VideoMediaFormat* vf = (VideoMediaFormat*)encFormat;
//find the H.263 encoder.
FFEncoder = avcodec_find_encoder(CODEC_ID_H263P);
if(!FFEncoder) //if I didn't find it, return not supported.
retval = CODEC_NOT_SUPPORTED;
else{
sprintf(dbg_buffer, "\tFound codec\n");
DbgOut(dbg_buffer);
//if we found the encoder, then instantiate the context and set config.
FFEncoderContext = avcodec_alloc_context3(FFEncoder);
FFEncoderContext->codec_type = AVMEDIA_TYPE_VIDEO;
FFEncoderContext->bit_rate = ((double)encData->BitRate/8) / (double)vf->FPS;
sprintf(dbg_buffer, "\tBit Rate = %d\n", FFEncoderContext->bit_rate);
DbgOut(dbg_buffer);
FFEncoderContext->width = vf->Width;
FFEncoderContext->height = vf->Height;
// FFEncoderContext->rc_max_rate = FFEncoderContext->bit_rate;
// FFEncoderContext->rc_min_rate = FFEncoderContext->bit_rate;
// FFEncoderContext->rc_buffer_size = FFEncoderContext->bit_rate * vf->FPS;
AVRational fps;
fps.num = vf->FPS;
fps.den = 1;
sprintf(dbg_buffer, "\tFrame Rate = %d\n", vf->FPS);
DbgOut(dbg_buffer);
FFEncoderContext->time_base = fps;
FFEncoderContext->bit_rate_tolerance = FFEncoderContext->bit_rate*av_q2d(FFEncoderContext->time_base);
FFEncoderContext->gop_size = encData->KeyFrameSpace;
sprintf(dbg_buffer, "\tKFS = %d\n", FFEncoderContext->gop_size);
DbgOut(dbg_buffer);
FFEncoderContext->max_b_frames = 0;
FFEncoderContext->pix_fmt = PIX_FMT_YUV420P;
TempFrame = alloc_picture(PIX_FMT_YUV420P, vf->Width, vf->Height);
sprintf(dbg_buffer, "\tWidth= %d, Height = %d, Format = %d\n", vf->Width, vf->Height, vf->PixelFormat);
DbgOut(dbg_buffer);
//if the input frame's format is going to be different from our format, then we need to scale.
PixelFormat fmt = (PixelFormat)VideoMediaFormat::GetFFPixel(vf->PixelFormat);
if(fmt != PIX_FMT_YUV420P)
{
sprintf(dbg_buffer, "\tInitializing Scaler\n");
DbgOut(dbg_buffer);
//instantiate a scaler.
ScaleContext = sws_getContext(vf->Width, vf->Height,
fmt,
vf->Width, vf->Height,
PIX_FMT_YUV420P,
SWS_BICUBIC, NULL, NULL, NULL);
}
//open the codec.
int err = avcodec_open2(FFEncoderContext, FFEncoder,NULL);
sprintf(dbg_buffer, "\tCodec Open returned %d\n", err);
DbgOut(dbg_buffer);
if(err < 0){ //if we failed to open, return error.
retval = CODEC_FAILED_TO_OPEN;
}
}
}
catch(...)
{
retval = CODEC_UNEXPECTED;
}
sprintf(dbg_buffer, "Finished opening H263VideoEncoder\n");
DbgOut(dbg_buffer);
return retval;
}
示例12: D3DCOLOR_COLORVALUE
int CBgDisp2::Render( LPDIRECT3DDEVICE9 pd3dDevice )
{
// pd3dDevice->SetTexture( 0, NULL );
// g_curtex0 = NULL;
// pd3dDevice->SetTexture( 1, NULL );
// g_curtex1 = NULL;
////////
/***
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );
g_cop0 = D3DTOP_MODULATE;
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );//!!!!
g_aop0 = D3DTOP_MODULATE;
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
pd3dDevice->SetSamplerState( 0, D3DSAMP_ADDRESSU, D3DTADDRESS_WRAP );
pd3dDevice->SetSamplerState( 0, D3DSAMP_ADDRESSV, D3DTADDRESS_WRAP );
pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_ONE );
pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_ONE );
//pd3dDevice->SetRenderState( D3DRS_LIGHTING, FALSE );//頂点色はソフトウェアで計算します。
pd3dDevice->SetRenderState( D3DRS_LIGHTING, TRUE );
pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_CCW );
//pd3dDevice->SetRenderState( D3DRS_SHADEMODE, D3DSHADE_FLAT );
pd3dDevice->SetRenderState( D3DRS_SHADEMODE, D3DSHADE_GOURAUD );
pd3dDevice->SetRenderState( D3DRS_WRAP0, 0 );
pd3dDevice->SetRenderState( D3DRS_DITHERENABLE, TRUE );
pd3dDevice->SetRenderState( D3DRS_SPECULARENABLE, TRUE );
pd3dDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_TRUE );
//pd3dDevice->SetRenderState( D3DRS_AMBIENT, 0x40404040 );
pd3dDevice->SetRenderState( D3DRS_AMBIENT,
D3DCOLOR_COLORVALUE( 0.40, 0.40, 0.40, 1.0 ) );
pd3dDevice->SetRenderState( D3DRS_NORMALIZENORMALS, FALSE );
pd3dDevice->SetRenderState( D3DRS_VERTEXBLEND, D3DVBF_DISABLE );
//pd3dDevice->SetRenderState( D3DRENDERSTATE_ZENABLE, D3DZB_TRUE );
pd3dDevice->SetRenderState( D3DRS_ZWRITEENABLE, TRUE );
***/
///////
HRESULT hres;
int ret = 0;
hres = pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, FALSE );
if( hres != D3D_OK ){
DbgOut( "bgdisp2 : Render : SetRenderState 0 error !!!\n" );
}
//pd3dDevice->SetTextureStageState( 0, D3DTSS_ADDRESSU, D3DTADDRESS_WRAP );
//pd3dDevice->SetTextureStageState( 0, D3DTSS_ADDRESSV, D3DTADDRESS_WRAP );
hres = pd3dDevice->SetRenderState( D3DRS_WRAP0, 0 );
g_renderstate[ D3DRS_WRAP0 ] = 0;
if( hres != D3D_OK ){
DbgOut( "bgdisp2 : Render : SetRenderState 1 error !!!\n" );
}
if( multitexok != 0 ){
hres = pd3dDevice->SetRenderState( D3DRS_WRAP1, 0 );
g_renderstate[ D3DRS_WRAP1 ] = 0;
if( hres != D3D_OK ){
DbgOut( "bgdisp2 : Render : SetRenderState 2 error !!!\n" );
}
}
pd3dDevice->SetRenderState( D3DRS_FOGENABLE, g_fogenable );
pd3dDevice->SetRenderState( D3DRS_FOGCOLOR, g_fogcolor );
pd3dDevice->SetRenderState( D3DRS_FOGVERTEXMODE, D3DFOG_LINEAR );
pd3dDevice->SetRenderState( D3DRS_FOGTABLEMODE, D3DFOG_NONE );
pd3dDevice->SetRenderState( D3DRS_FOGSTART, *((DWORD*)(&g_fogstart)) );
pd3dDevice->SetRenderState( D3DRS_FOGEND, *((DWORD*)(&g_fogend)) );
LPDIRECT3DTEXTURE9 tex0 = g_texbnk->GetTexData( texname, transparent1 );
LPDIRECT3DTEXTURE9 tex1 = g_texbnk->GetTexData( texname2, transparent2 );
// if( g_curtex0 != tex0 ){
pd3dDevice->SetTexture( 0, tex0 );
g_curtex0 = tex0;
// }
//DbgOut( "bgdisp2 : Render : %s, %x : %s, %x\r\n", texname, tex0, texname2, tex1 );
if( tex1 && (multitexok != 0) ){
if( g_cop0 != D3DTOP_MODULATE ){
pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );
g_cop0 = D3DTOP_MODULATE;
}
if( g_aop0 != D3DTOP_MODULATE ){
pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
g_aop0 = D3DTOP_MODULATE;
}
if( g_cop1 != D3DTOP_MODULATE ){
pd3dDevice->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_MODULATE );
//.........这里部分代码省略.........
示例13: immersion_vibrator_resume
static int immersion_vibrator_resume(struct platform_device *pdev)
{
DbgOut((KERN_INFO "tspdrv: resume.\n"));
return 0; /* can resume */
}
示例14: while
int CIM2File::GetFloatFromLine( int lineleng, int pos, int* lengptr, int* isendptr, float* floatptr )
{
//isend は、要素の読み込み前に、終端0が現れたときに1にセットさする。
*isendptr = 0;
//非数字部分を読み飛ばす。
int stepnum = 0;
char curc = m_line[pos];
int minusflag = 0;//数字の直前に'-'があるかどうかのフラグ。
while( isdigit( curc ) == 0 ){
stepnum++;
if( (pos + stepnum) >= lineleng ){
*isendptr = 1;
return 0;
}
if( curc == '-' ){
minusflag = 1;
}else{
minusflag = 0;
}
curc = m_line[ pos + stepnum ];
}
// データ長を求める
int startpos;
startpos = pos + stepnum;
int endpos = startpos;
while( (endpos < lineleng) && ( (isdigit( curc ) != 0) || (curc == '.') ) ){
endpos++;
curc = m_line[ endpos ];
}
int dataleng;
dataleng = endpos - startpos;
if( dataleng >= 256 ){
DbgOut( "IM2file : GetFloatData : dataleng toot long error %d!!!\n", dataleng );
_ASSERT( 0 );
return 1;
}
// 文字列を番号に変換。
char seristr[256];
strncpy_s( seristr, 256, m_line + startpos, dataleng );
seristr[dataleng] = 0;
if( minusflag == 1 ){
*floatptr = (float)(-atof( seristr ));
}else{
*floatptr = (float)(atof( seristr ));
}
*lengptr = stepnum + dataleng;
return 0;
}
示例15: InitLoadParams
int CExtLineIO::CreateLine( CTreeHandler2* lpth, CShdHandler* lpsh, CMotHandler* lpmh, D3DXVECTOR3* pptr, int pointnum, int maxpointnum, int linekind )
{
int ret;
m_lpth = lpth;
m_lpsh = lpsh;
m_lpmh = lpmh;
InitLoadParams();
ret = m_lpth->Start( 0 );
if( ret ){
_ASSERT( 0 );
return 1;
}
befseri = curseri;
curseri = 1;// 0は、CreateHandlerで作成済
befdepth = curdepth;
curdepth = 1;// 0は、CreateHandlerで作成済
befshdtype = curshdtype;
curshdtype = SHDEXTLINE;
char lname[1024];
ZeroMemory( lname, 1024 );
SYSTEMTIME systime;
GetLocalTime( &systime );
sprintf_s( lname, 1024, "Line_%d_%d_%d_%d_%d_%d_%d",
systime.wYear,
systime.wMonth,
systime.wDay,
systime.wHour,
systime.wMinute,
systime.wSecond,
systime.wMilliseconds
);
ret = AddShape2Tree( lname );
if( ret ){
_ASSERT( 0 );
return 1;
}
ret = SetMeshInfo( &tempinfo, SHDEXTLINE, pointnum, maxpointnum, linekind );
if( ret ){
_ASSERT( 0 );
return 1;
}
ret = Init3DObj();
if( ret ){
_ASSERT( 0 );
return 1;
}
////////
CExtLine* curline;
CShdElem* curselem;
curselem = (*m_lpsh)( curseri );
if( !curselem ){
_ASSERT( 0 );
return 1;
}
curline = curselem->extline;
if( !curline ){
_ASSERT( 0 );
return 1;
}
int pno;
int epid;
for( pno = 0; pno < pointnum; pno++ ){
ret = curline->AddExtPoint( -1, 1, &epid );
if( ret || (epid < 0) ){
DbgOut( "extlineio : curline AddExtPoint error !!!\n" );
_ASSERT( 0 );
return 1;
}
ret = curline->SetExtPointPos( epid, pptr + pno );
if( ret ){
DbgOut( "extlineio : curline SetExtPointPos error !!!\n ");
_ASSERT( 0 );
return 1;
}
}
////////
ret = m_lpsh->SetChain( 0 );
if( ret ){
_ASSERT( 0 );
//.........这里部分代码省略.........