📄 iicdirection.c
字号:
/*
* Copyright (c) 1995 - 1999 by TriMedia Technologies.
*
* +------------------------------------------------------------------+
* | This software is furnished under a license and may only be used |
* | and copied in accordance with the terms and conditions of such |
* | a license and with the inclusion of this copyright notice. This |
* | software or any other copies of this software may not be provided|
* | or otherwise made available to any other person. The ownership |
* | and title of this software is not transferred. |
* | |
* | The information in this software is subject to change without |
* | any prior notice and should not be construed as a commitment by |
* | TriMedia Technologies. |
* | |
* | this code and information is provided "as is" without any |
* | warranty of any kind, either expressed or implied, including but |
* | not limited to the implied warranties of merchantability and/or |
* | fitness for any particular purpose. |
* +------------------------------------------------------------------+
*
* Module name : iicDirection.c 1.3
*
* Last update : 18:43:41 - 00/11/09
*
*
*/
#include <tmlib/tmtypes.h>
#include <tmlib/dprintf.h>
#include <tmlib/AppSem.h>
#include <tm1/tmLibdevErr.h>
#include <tm1/tmAssert.h>
#include "iicDirection.h"
static struct _AppSem_Semaphore directionLock = _AppSem_INITIALISED_SEM;
static Bool initialized = False;
static directionSwitchFunction_t switchFunc = Null;
static UInt32 defaultDirection = 0;
extern tmLibdevErr_t iicDirectionInit(piicDirectionParam_t params)
{
DP(("iicDirectionInit\n"));
tmAssert(params, TMLIBDEV_ERR_NULL_PARAMETER);
tmAssert(params->directionSwitchFunction, TMLIBDEV_ERR_NULL_PARAMETER);
switchFunc = params->directionSwitchFunction;
defaultDirection = params->defaultDirection;
initialized = True;
return TMLIBDEV_OK;
}
extern tmLibdevErr_t iicDirectionSelect(UInt direction)
{
tmLibdevErr_t err;
DP(("iicDirectionSelect\n"));
if (!initialized)
return TMLIBDEV_OK;
AppSem_P(&directionLock);
err = switchFunc(direction);
if (err != TMLIBDEV_OK)
AppSem_V(&directionLock);
return err;
}
extern tmLibdevErr_t iicDirectionUnSelect(UInt direction)
{
tmLibdevErr_t err;
DP(("iicDirectionUnSelect\n"));
if (!initialized)
return TMLIBDEV_OK;
err = switchFunc(defaultDirection);
AppSem_V(&directionLock);
return err;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -