本文整理汇总了C++中TcpalSemaphoreLock函数的典型用法代码示例。如果您正苦于以下问题:C++ TcpalSemaphoreLock函数的具体用法?C++ TcpalSemaphoreLock怎么用?C++ TcpalSemaphoreLock使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TcpalSemaphoreLock函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TcbdDequeue
I32S TcbdDequeue(TcbdQueue_t *_queue, I08U *_chunk, I32S *_size, I32S *_type)
{
*_size = 0;
TcpalSemaphoreLock(&_queue->sem);
if(TcbdQueueIsEmpty(_queue))
{
TcbdDebug(0, "Queue Empty!! \n");
TcpalSemaphoreUnLock(&_queue->sem);
return -1;
}
else
{
TcbdDebug(0, "Dequeue! size%d\n", _queue->q[_queue->front].size);
}
*_size = _queue->q[_queue->front].size;
if(_type) *_type = _queue->q[_queue->front].type;
TcpalMemoryCopy(_chunk, _queue->q[_queue->front].buffer, *_size);
_queue->front = (_queue->front + 1) % _queue->qsize;
_queue->pointer -= *_size;
TcbdDebug(0, "pos:%d, size:%d\n", _queue->pointer, *_size);
TcpalSemaphoreUnLock(&_queue->sem);
return 0;
}
示例2: Tcc353xMiscWriteEx
/* misc wite - not increase address */
I32S Tcc353xMiscWriteEx(I32S _moduleIndex, I32S _diversityIndex,
I08U _miscConfig, I08U *_startAddress,
I32U *_data, I32U _size)
{
Tcc353xHandle_t *h;
I32U i;
I32U temp;
if (Tcc353xHandle[_moduleIndex][_diversityIndex].handleOpen == 0)
return TCC353X_RETURN_FAIL_INVALID_HANDLE;
h = &Tcc353xHandle[_moduleIndex][_diversityIndex];
TcpalSemaphoreLock(&Tcc353xInterfaceSema);
Tcc353xSetRegMiscConfig(h, _miscConfig | 1, _UNLOCK_);
for (i = 0; i< _size; i++) {
Tcc353xSetRegMiscAddress(h, _startAddress[i], _UNLOCK_);
temp = _data[i];
temp = SWAP32(temp);
Tcc353xSetRegMiscData(h, (I08U *) (&temp), _UNLOCK_);
Tcc353xSetRegMiscAction(h, TC3XREG_MISC_ACTION, _UNLOCK_);
}
/* warning : please reset to opcontrol miscconfig0 */
Tcc353xSetRegMiscConfig(h, 0, _UNLOCK_);
TcpalSemaphoreUnLock(&Tcc353xInterfaceSema);
return TCC353X_RETURN_SUCCESS;
}
示例3: Tcc353xDspAsmWrite
I32S Tcc353xDspAsmWrite(Tcc353xHandle_t * _handle, I08U * _data,
I32S _size)
{
I08U inputValue[4];
I32U codeMemoryAddress = TCC353X_CODEMEMBASE;
if (_size <= 0)
return TCC353X_RETURN_FAIL;
codeMemoryAddress = TCC353X_CODEMEMBASE;
TcpalSemaphoreLock(&Tcc353xInterfaceSema);
Tcc353xSetRegDmaControl(_handle,
TC3XREG_CMDDMA_DMAEN |
TC3XREG_CMDDMA_WRITEMODE |
TC3XREG_CMDDMA_CRC32EN, _UNLOCK_);
inputValue[0] = (I08U)((codeMemoryAddress >> 24) & 0xFF);
inputValue[1] = (I08U)((codeMemoryAddress >> 16) & 0xFF);
inputValue[2] = (I08U)((codeMemoryAddress >> 8) & 0xFF);
inputValue[3] = (I08U)(codeMemoryAddress & 0xFF);
Tcc353xSetRegDmaSourceAddress(_handle, &inputValue[0], _UNLOCK_);
inputValue[0] = (I08U)(((_size >> 2) >> 8) & 0xFF);
inputValue[1] = (I08U)((_size >> 2) & 0xFF);
Tcc353xSetRegDmaSize(_handle, &inputValue[0], _UNLOCK_);
Tcc353xSetRegDmaStartControl(_handle,
TC3XREG_CMDDMA_START_AUTOCLR |
TC3XREG_CMDDMA_INIT_AUTOCLR |
TC3XREG_CMDDMA_CRC32INIT_AUTOCLR,
_UNLOCK_);
Tcc353xSetRegDataWindow(_handle, _data, _size, _UNLOCK_);
TcpalSemaphoreUnLock(&Tcc353xInterfaceSema);
return TCC353X_RETURN_SUCCESS;
}
示例4: Tcc353xMemoryWrite
I32S Tcc353xMemoryWrite(I32S _moduleIndex, I32S _diversityIndex,
I32U _address, I08U * _data, I32U _size)
{
I08U inputValue[4];
Tcc353xHandle_t *h;
if (Tcc353xHandle[_moduleIndex][_diversityIndex].handleOpen == 0)
return TCC353X_RETURN_FAIL_INVALID_HANDLE;
h = &Tcc353xHandle[_moduleIndex][_diversityIndex];
if (!(_size > 0))
return TCC353X_RETURN_FAIL;
_address |= PHY_BASE_ADDR;
TcpalSemaphoreLock(&Tcc353xInterfaceSema);
Tcc353xSetRegDmaControl(h,
TC3XREG_CMDDMA_DMAEN |
TC3XREG_CMDDMA_WRITEMODE, _UNLOCK_);
inputValue[0] = (I08U)((_address >> 24) & 0xFF);
inputValue[1] = (I08U)((_address >> 16) & 0xFF);
inputValue[2] = (I08U)((_address >> 8) & 0xFF);
inputValue[3] = (I08U)(_address & 0xFF);
Tcc353xSetRegDmaSourceAddress(h, &inputValue[0], _UNLOCK_);
inputValue[0] = (I08U)(((_size >> 2) >> 8) & 0xFF);
inputValue[1] = (I08U)((_size >> 2) & 0xFF);
Tcc353xSetRegDmaSize(h, &inputValue[0], _UNLOCK_);
Tcc353xSetRegDmaStartControl(h,
TC3XREG_CMDDMA_START_AUTOCLR |
TC3XREG_CMDDMA_INIT_AUTOCLR |
TC3XREG_CMDDMA_CRC32INIT_AUTOCLR,
_UNLOCK_);
Tcc353xSetRegDataWindow(h, _data, _size, _UNLOCK_);
TcpalSemaphoreUnLock(&Tcc353xInterfaceSema);
return TCC353X_RETURN_SUCCESS;
}
示例5: broadcast_drv_if_open
int broadcast_drv_if_open(void)
{
int rc = ERROR;
Tcc353xStreamFormat_t streamFormat;
int ret = 0;
TcpalSemaphoreLock(&Tcc353xDrvSem);
#if defined (_USE_SEND_GOOD_SIGNAL_INFO_CHANGING_)
Time_channel_tune = 0;
Need_send_good_signal = 0;
#endif
Tcc353xI2cOpen(0);
ret = Tcc353xApiOpen(0, &Tcc353xOptionSingle, sizeof(Tcc353xOption_t));
if (ret != TCC353X_RETURN_SUCCESS) {
/* driver re-open routine */
TcpalPrintErr((I08S *) "[1seg] TCC3530 Re-init (close & open)...\n");
Tcc353xWrapperSafeClose ();
/* re-open driver & power ctrl*/
broadcast_drv_if_power_on();
Tcc353xI2cOpen(0);
ret = Tcc353xApiOpen(0, &Tcc353xOptionSingle, sizeof(Tcc353xOption_t));
if (ret != TCC353X_RETURN_SUCCESS) {
TcpalPrintErr((I08S *) "[1seg] TCC3530 Init Fail!!!\n");
Tcc353xWrapperSafeClose ();
TcpalSemaphoreUnLock(&Tcc353xDrvSem);
return ERROR;
}
}
streamFormat.pidFilterEnable = 0;
streamFormat.syncByteFilterEnable = 1;
streamFormat.tsErrorFilterEnable = 1;
streamFormat.tsErrorInsertEnable = 1;
#if defined (_MODEL_TCC3535_) && defined (_TCC3535_ROM_MASK_VER_)
ret = Tcc353xApiInit(0, NULL, 0, &streamFormat);
#else
ret = Tcc353xApiInit(0, (I08U *)TCC353X_BOOT_DATA_ISDBT13SEG,
TCC353X_BOOT_SIZE_ISDBT13SEG, &streamFormat);
#endif
if (ret != TCC353X_RETURN_SUCCESS) {
TcpalPrintErr((I08S *) "[1seg] TCC3530 Init Fail!!!\n");
Tcc353xWrapperSafeClose ();
rc = ERROR;
} else {
TcpalPrintStatus((I08S *) "[1seg] TCC3530 Init Success!!!\n");
rc = OK;
}
OnAir = 1;
TcpalSemaphoreUnLock(&Tcc353xDrvSem);
return rc;
}
示例6: Tcc353xStreamRead
I32S Tcc353xStreamRead(I32S _moduleIndex, I08U * _data, I32S _size)
{
I32S ret;
Tcc353xHandle_t *h;
ret = TCC353X_RETURN_SUCCESS;
h = &Tcc353xHandle[_moduleIndex][0];
TcpalSemaphoreLock(&Tcc353xInterfaceSema);
ret = StreamRead_optimum(_moduleIndex, _data, _size);
TcpalSemaphoreUnLock(&Tcc353xInterfaceSema);
return ret;
}
示例7: WriteProcess
I32S WriteProcess(Tcc353xHandle_t * _handle, I08U _registerAddr,
I08U * _inputData, I32S _size, I08U _unlock)
{
if (_unlock == _LOCK_)
TcpalSemaphoreLock(&Tcc353xInterfaceSema);
_handle->Write(_handle->moduleIndex, _handle->currentAddress,
_registerAddr, _inputData, _size);
if (_unlock == _LOCK_)
TcpalSemaphoreUnLock(&Tcc353xInterfaceSema);
return TCC353X_RETURN_SUCCESS;
}
示例8: TcbdGetFirstQueuePtr
I32S TcbdGetFirstQueuePtr(TcbdQueue_t *_queue, I08U **_chunk, I32S *_size, I32S *_type)
{
TcpalSemaphoreLock(&_queue->sem);
if(TcbdQueueIsEmpty(_queue))
{
TcbdDebug(0, "Queue Empty!! \n");
TcpalSemaphoreUnLock(&_queue->sem);
return -1;
}
*_size = _queue->q[_queue->front].size;
*_chunk = _queue->q[_queue->front].buffer;
if(_type) *_type = _queue->q[_queue->front].type;
TcbdDebug(0, "pos:%d, size:%d\n", _queue->pointer, *_size);
TcpalSemaphoreUnLock(&_queue->sem);
return 0;
}
示例9: TcbdParseStream
inline static void TcbdParseStream(TcbdIrqData_t * irqData)
{
I32S size = TCBD_MAX_THRESHOLD*2, ret = 0;
I08S irqStatus;
I08S irqError;
TcbdDevice_t *device = irqData->device;
TcpalSemaphoreLock(&TcbdIrqData.lock);
ret = TcbdReadIrqStatus(device, &irqStatus, &irqError);
ret |= TcbdClearIrq(device, irqStatus);
ret |= TcbdReadStream(device, StreamBuffer, &size);
if(ret == 0 && !irqError)
{
TcbdParser(StreamBuffer, size);
}
else
{
TcbdDebug(DEBUG_ERROR,
"================================================================================\n"
"### buffer is full, skip the data (status=0x%02X, error=0x%02X, ret:%d, time%d) ###\n"
"================================================================================\n",
irqStatus, irqError, ret, (int)TcpalGetTimeIntervalMs(irqData->startTick));
TcbdInitStreamDataConfig(device, ENABLE_CMD_FIFO, device->lastSelectedBuffer, device->intrThreshold);
TcbdInitParser(NULL);
}
ret = TcbdReadIrqStatus(device, &irqStatus, &irqError);
if(irqError)
{
TcbdDebug(DEBUG_ERROR,
"================================================================================\n"
"### TcbdReadIrqStatus buffer is full, skip the data (status=0x%02X, error=0x%02X, ret:%d, time%d) ###\n"
"================================================================================\n",
irqStatus, irqError, (int)ret, (int)TcpalGetTimeIntervalMs(irqData->startTick));
TcbdInitStreamDataConfig(device, ENABLE_CMD_FIFO, device->lastSelectedBuffer, device->intrThreshold);
TcbdInitParser(NULL);
}
TcpalSemaphoreUnLock(&TcbdIrqData.lock);
}
示例10: Tcc353xMiscWrite
I32S Tcc353xMiscWrite(I32S _moduleIndex, I32S _diversityIndex,
I08U _miscConfig, I08U _address, I32U _data)
{
Tcc353xHandle_t *h;
if (Tcc353xHandle[_moduleIndex][_diversityIndex].handleOpen == 0)
return TCC353X_RETURN_FAIL_INVALID_HANDLE;
h = &Tcc353xHandle[_moduleIndex][_diversityIndex];
TcpalSemaphoreLock(&Tcc353xInterfaceSema);
Tcc353xSetRegMiscConfig(h, _miscConfig | 1, _UNLOCK_);
Tcc353xSetRegMiscAddress(h, _address, _UNLOCK_);
_data = SWAP32(_data);
Tcc353xSetRegMiscData(h, (I08U *) (&_data), _UNLOCK_);
Tcc353xSetRegMiscAction(h, TC3XREG_MISC_ACTION, _UNLOCK_);
/* warning : please reset to opcontrol miscconfig0 */
Tcc353xSetRegMiscConfig(h, 0, _UNLOCK_);
TcpalSemaphoreUnLock(&Tcc353xInterfaceSema);
return TCC353X_RETURN_SUCCESS;
}
示例11: broadcast_drv_if_close
int broadcast_drv_if_close(void)
{
int rc = ERROR;
int ret = 0;
TcpalSemaphoreLock(&Tcc353xDrvSem);
OnAir = 0;
currentSelectedChannel = -1;
currentBroadCast = TMM_13SEG;
ret = Tcc353xApiClose(0);
Tcc353xI2cClose(0);
if(ret == TCC353X_RETURN_SUCCESS)
rc = OK;
#if defined (_USE_SEND_GOOD_SIGNAL_INFO_CHANGING_)
Time_channel_tune = 0;
Need_send_good_signal = 0;
#endif
TcpalSemaphoreUnLock(&Tcc353xDrvSem);
return rc;
}
示例12: Tcc353xMiscRead
I32S Tcc353xMiscRead(I32S _moduleIndex, I32S _diversityIndex,
I08U _miscConfig, I08U _address, I32U * _data)
{
Tcc353xHandle_t *h;
if (Tcc353xHandle[_moduleIndex][_diversityIndex].handleOpen == 0)
return TCC353X_RETURN_FAIL_INVALID_HANDLE;
h = &Tcc353xHandle[_moduleIndex][_diversityIndex];
TcpalSemaphoreLock(&Tcc353xInterfaceSema);
Tcc353xSetRegMiscConfig(h, _miscConfig, _UNLOCK_);
Tcc353xSetRegMiscAddress(h, _address, _UNLOCK_);
Tcc353xSetRegMiscAction(h, TC3XREG_MISC_ACTION, _UNLOCK_);
Tcc353xGetRegMiscData(h, (I08U *) (_data), _UNLOCK_);
_data[0] = SWAP32(_data[0]);
/* */
Tcc353xSetRegMiscConfig(h, 0, _UNLOCK_);
TcpalSemaphoreUnLock(&Tcc353xInterfaceSema);
return TCC353X_RETURN_SUCCESS;
}
示例13: TcbdEnqueue
I32S TcbdEnqueue(TcbdQueue_t *_queue, I08U *_chunk, I32S _size, I32S _type)
{
if(_chunk == NULL || _size <= 0)
{
TcbdDebug(DEBUG_ERROR, "Invalid argument!! \n");
return -1;
}
TcpalSemaphoreLock(&_queue->sem);
if(_queue->pointer + _size > _queue->buffSize)
{
TcbdDebug(0, "Memory full! \n");
TcbdResetQueue(_queue);
TcpalSemaphoreUnLock(&_queue->sem);
return -1;
}
if(TcbdQueueIsFull(_queue))
{
TcbdDebug(0, "Queue Full!! \n");
_queue->pointer = 0;
}
TcpalMemoryCopy(_queue->globalBuffer + _queue->pointer, _chunk, _size);
_queue->q[_queue->rear].buffer = _queue->globalBuffer + _queue->pointer;
_queue->q[_queue->rear].size = _size;
_queue->q[_queue->rear].type = _type;
_queue->rear = (_queue->rear + 1) % _queue->qsize;
_queue->pointer += _size;
TcbdDebug(0, "pos:%d, size:%d\n", _queue->pointer, _size);
TcpalSemaphoreUnLock(&_queue->sem);
return 0;
}
示例14: Tcc353xStreamRead
/* stream read control */
I32S Tcc353xStreamRead(I32S _moduleIndex, I08U * _data, I32S _size)
{
I32U address;
I08U inputValue[4];
Tcc353xHandle_t *h;
if (Tcc353xHandle[_moduleIndex][0].handleOpen == 0)
return TCC353X_RETURN_FAIL_INVALID_HANDLE;
h = &Tcc353xHandle[_moduleIndex][0];
if (!(_size > 0))
return TCC353X_RETURN_FAIL;
address = 0x3F0A0 | PHY_BASE_ADDR;
TcpalSemaphoreLock(&Tcc353xInterfaceSema);
Tcc353xSetRegDmaControl(h,
TC3XREG_CMDDMA_DMAEN |
TC3XREG_CMDDMA_ADDRFIX |
TC3XREG_CMDDMA_READMODE, _UNLOCK_);
inputValue[0] = (I08U)((address >> 24) & 0xFF);
inputValue[1] = (I08U)((address >> 16) & 0xFF);
inputValue[2] = (I08U)((address >> 8) & 0xFF);
inputValue[3] = (I08U)(address & 0xFF);
Tcc353xSetRegDmaSourceAddress(h, &inputValue[0], _UNLOCK_);
inputValue[0] = (I08U)(((_size >> 2) >> 8) & 0xFF);
inputValue[1] = (I08U)((_size >> 2) & 0xFF);
Tcc353xSetRegDmaSize(h, &inputValue[0], _UNLOCK_);
Tcc353xSetRegDmaStartControl(h,
TC3XREG_CMDDMA_START_AUTOCLR |
TC3XREG_CMDDMA_INIT_AUTOCLR |
TC3XREG_CMDDMA_CRC32INIT_AUTOCLR,
_UNLOCK_);
Tcc353xGetRegDataWindow(h, _data, _size, _UNLOCK_);
TcpalSemaphoreUnLock(&Tcc353xInterfaceSema);
return TCC353X_RETURN_SUCCESS;
}
示例15: broadcast_drv_if_set_channel
int broadcast_drv_if_set_channel(struct broadcast_dmb_set_ch_info *udata)
{
Tcc353xTuneOptions tuneOption;
signed long frequency = 214714; /*tmm*/
int ret;
int needLockCheck = 0;
TcpalSemaphoreLock(&Tcc353xDrvSem);
if(OnAir == 0 || udata == NULL) {
TcpalPrintErr((I08S *)"[1seg] broadcast_drv_if_set_channel error [!OnAir]\n");
TcpalSemaphoreUnLock(&Tcc353xDrvSem);
return ERROR;
}
TcpalMemset (&tuneOption, 0x00, sizeof(tuneOption));
/* uhf 1segment */
currentSelectedChannel = udata->channel;
if(udata->segment == 13) {
currentBroadCast = UHF_13SEG;
tuneOption.rfIfType = TCC353X_ZERO_IF;
tuneOption.segmentType = TCC353X_ISDBT_13SEG;
} else {
currentBroadCast = UHF_1SEG;
tuneOption.rfIfType = TCC353X_LOW_IF;
tuneOption.segmentType = TCC353X_ISDBT_1_OF_13SEG;
}
tuneOption.userFifothr = 0;
needLockCheck = 1;
if(udata->channel<13 || udata->channel>62) {
TcpalPrintErr((I08S *)"[1seg] channel information error\n");
TcpalSemaphoreUnLock(&Tcc353xDrvSem);
return ERROR;
}
frequency = frequencyTable[udata->channel-13];
/* lna control - high gain */
/* high gain : PON 1, EN 0 low gain : PON 0, EN 1 */
Tcc353xApiSetGpioControl(0, 0, GPIO_LNA_PON, 1);
Tcc353xApiSetGpioControl(0, 0, GPIO_MMBI_ELNA_EN, 0);
if(needLockCheck && udata->mode == 1) /* Scan mode & need lock check */
ret = Tcc353xApiChannelSearch(0, frequency, &tuneOption);
else /* normal mode */
ret = Tcc353xApiChannelSelect(0, frequency, &tuneOption);
#if defined (_USE_SEND_GOOD_SIGNAL_INFO_CHANGING_)
Time_channel_tune = TcpalGetCurrentTimeCount_ms();
Need_send_good_signal = 1;
#endif
Tcc353xMonitoringApiInit(0, 0);
CurrentMonitoringTime = 0;
if(ret!=TCC353X_RETURN_SUCCESS) {
TcpalSemaphoreUnLock(&Tcc353xDrvSem);
return ERROR;
}
TcpalSemaphoreUnLock(&Tcc353xDrvSem);
return OK;
}