/* 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;
}
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;
}
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;
}