📄 encregdrv4.c
字号:
/*------------------------------------------------------------------------------
-- --
-- This software is confidential and proprietary and may be used --
-- only as expressly authorized by a licensing agreement from --
-- --
-- Hantro Products Oy. --
-- --
-- In the event of publication, the following notice is applicable: --
-- --
-- (C) COPYRIGHT 2003 HANTRO PRODUCTS OY --
-- ALL RIGHTS RESERVED --
-- --
-- The entire notice above must be reproduced on all copies. --
-- --
--------------------------------------------------------------------------------
--
-- Abstract : Encoder HW register access functions
--
-------------------------------------------------------------------------------*/
#include "ewl.h"
#include "basetype.h"
#include "encregdrv.h"
#include "EncSim.h"
/* 1. (AMBAIFE) Encoder Register Offsets */
#define ENCREG(nr) (nr<<2)
/* 2. Mask fields */
#define mask_13b (u32)0x00001FFF
/* 3. Encoder register access drivers */
/******************************************************************************/
/********************** ENCODER REGISTER (BASE + 0x5C) ************************/
/******************************************************************************/
/*******************************************************************************
Function name : SetEncChkP1Bits
Description : Set the target bits for checkpoint 1
Return type : void
Argument : u32 bits
*******************************************************************************/
void SetEncChkP1Bits(u32 bits)
{
u32 val;
ASSERT(bits <= 8191);
val = EWL_ReadReg(0x5C);
val = (val & ~(mask_13b << 13)) | (bits << 13);
EWL_WriteReg(0x5C, val);
}
/*******************************************************************************
Function name : GetEncChkP1Bits
Description : Get the bits for checkpoint 1
Return type : u32
*******************************************************************************/
u32 GetEncChkP1Bits()
{
u32 val;
val = EWL_ReadReg(0x5C);
val = (val >> 13);
return val;
}
/*******************************************************************************
Function name : SetEncChkP2Bits
Description : Set the target bits for checkpoint 2
Return type : void
Argument : u32 bits
*******************************************************************************/
void SetEncChkP2Bits(u32 bits)
{
u32 val;
ASSERT(bits <= 8191);
val = EWL_ReadReg(0x5C);
val = (val & ~(mask_13b)) | (bits);
EWL_WriteReg(0x5C, val);
}
/*******************************************************************************
Function name : GetEncChkP2Bits
Description : Get the bits for checkpoint 2
Return type : u32
*******************************************************************************/
u32 GetEncChkP2Bits()
{
u32 val;
val = EWL_ReadReg(0x5C);
val = (mask_13b & (val));
return val;
}
/******************************************************************************/
/********************** ENCODER REGISTER (BASE + 0x60) ************************/
/******************************************************************************/
/*******************************************************************************
Function name : SetEncChkP3Bits
Description : Set the target bits for checkpoint 3
Return type : void
Argument : u32 bits
*******************************************************************************/
void SetEncChkP3Bits(u32 bits)
{
u32 val;
ASSERT(bits <= 8191);
val = EWL_ReadReg(0x60);
val = (val & ~(mask_13b << 13)) | (bits << 13);
EWL_WriteReg(0x60, val);
}
/*******************************************************************************
Function name : GetEncChkP3Bits
Description : Get the bits for checkpoint 3
Return type : u32
*******************************************************************************/
u32 GetEncChkP3Bits()
{
u32 val;
val = EWL_ReadReg(0x60);
val = (val >> 13);
return val;
}
/*******************************************************************************
Function name : SetEncChkP4Bits
Description : Set the target bits for checkpoint 4
Return type : void
Argument : u32 bits
*******************************************************************************/
void SetEncChkP4Bits(u32 bits)
{
u32 val;
ASSERT(bits <= 8191);
val = EWL_ReadReg(0x60);
val = (val & ~(mask_13b)) | (bits);
EWL_WriteReg(0x60, val);
}
/*******************************************************************************
Function name : GetEncChkP4Bits
Description : Get the bits for checkpoint 4
Return type : u32
*******************************************************************************/
u32 GetEncChkP4Bits()
{
u32 val;
val = EWL_ReadReg(0x60);
val = (mask_13b & (val));
return val;
}
/******************************************************************************/
/********************** ENCODER REGISTER (BASE + 0x64) ************************/
/******************************************************************************/
/*******************************************************************************
Function name : SetEncChkP5Bits
Description : Set the target bits for checkpoint 5
Return type : void
Argument : u32 bits
*******************************************************************************/
void SetEncChkP5Bits(u32 bits)
{
u32 val;
ASSERT(bits <= 8191);
val = EWL_ReadReg(0x64);
val = (val & ~(mask_13b << 13)) | (bits << 13);
EWL_WriteReg(0x64, val);
}
/*******************************************************************************
Function name : GetEncChkP5Bits
Description : Get the bits for checkpoint 5
Return type : u32
*******************************************************************************/
u32 GetEncChkP5Bits()
{
u32 val;
val = EWL_ReadReg(0x64);
val = (val >> 13);
return val;
}
/*******************************************************************************
Function name : SetEncChkP6Bits
Description : Set the target bits for checkpoint 6
Return type : void
Argument : u32 bits
*******************************************************************************/
void SetEncChkP6Bits(u32 bits)
{
u32 val;
ASSERT(bits <= 8191);
val = EWL_ReadReg(0x64);
val = (val & ~(mask_13b)) | (bits);
EWL_WriteReg(0x64, val);
}
/*******************************************************************************
Function name : GetEncChkP6Bits
Description : Get the bits for checkpoint 6
Return type : u32
*******************************************************************************/
u32 GetEncChkP6Bits()
{
u32 val;
val = EWL_ReadReg(0x64);
val = (mask_13b & (val));
return val;
}
/******************************************************************************/
/********************** ENCODER REGISTER (BASE + 0x68) ************************/
/******************************************************************************/
/*******************************************************************************
Function name : SetEncChkP7Bits
Description : Set the target bits for checkpoint 7
Return type : void
Argument : u32 bits
*******************************************************************************/
void SetEncChkP7Bits(u32 bits)
{
u32 val;
ASSERT(bits <= 8191);
val = EWL_ReadReg(0x68);
val = (val & ~(mask_13b << 13)) | (bits << 13);
EWL_WriteReg(0x68, val);
}
/*******************************************************************************
Function name : GetEncChkP7Bits
Description : Get the bits for checkpoint 7
Return type : u32
*******************************************************************************/
u32 GetEncChkP7Bits()
{
u32 val;
val = EWL_ReadReg(0x68);
val = (val >> 13);
return val;
}
/*******************************************************************************
Function name : SetEncChkP8Bits
Description : Set the target bits for checkpoint 8
Return type : void
Argument : u32 bits
*******************************************************************************/
void SetEncChkP8Bits(u32 bits)
{
u32 val;
ASSERT(bits <= 8191);
val = EWL_ReadReg(0x68);
val = (val & ~(mask_13b)) | (bits);
EWL_WriteReg(0x68, val);
}
/*******************************************************************************
Function name : GetEncChkP8Bits
Description : Get the bits for checkpoint 8
Return type : u32
*******************************************************************************/
u32 GetEncChkP8Bits()
{
u32 val;
val = EWL_ReadReg(0x68);
val = (mask_13b & (val));
return val;
}
/******************************************************************************/
/********************** ENCODER REGISTER (BASE + 0x6C) ************************/
/******************************************************************************/
/*******************************************************************************
Function name : SetEncChkP9Bits
Description : Set the target bits for checkpoint 9
Return type : void
Argument : u32 bits
*******************************************************************************/
void SetEncChkP9Bits(u32 bits)
{
u32 val;
ASSERT(bits <= 8191);
val = EWL_ReadReg(0x6C);
val = (val & ~(mask_13b << 13)) | (bits << 13);
EWL_WriteReg(0x6C, val);
}
/*******************************************************************************
Function name : GetEncChkP9Bits
Description : Get the bits for checkpoint 9
Return type : u32
*******************************************************************************/
u32 GetEncChkP9Bits()
{
u32 val;
val = EWL_ReadReg(0x6C);
val = (val >> 13);
return val;
}
/*******************************************************************************
Function name : SetEncChkP10Bits
Description : Set the target bits for checkpoint 10
Return type : void
Argument : u32 bits
*******************************************************************************/
void SetEncChkP10Bits(u32 bits)
{
u32 val;
ASSERT(bits <= 8191);
val = EWL_ReadReg(0x6C);
val = (val & ~(mask_13b)) | (bits);
EWL_WriteReg(0x6C, val);
}
/*******************************************************************************
Function name : GetEncChkP10Bits
Description : Get the bits for checkpoint 10
Return type : u32
*******************************************************************************/
u32 GetEncChkP10Bits()
{
u32 val;
val = EWL_ReadReg(0x6C);
val = (mask_13b & (val));
return val;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -