📄 pwl.h
字号:
//------------------------------------------------------------------------------
// TEXAS INSTRUMENTS INCORPORATED PROPRIETARY INFORMATION
//
// Property of Texas Instruments -- For Unrestricted Internal Use Only
// Unauthorized reproduction and/or distribution is strictly prohibited. This
// product is protected under copyright law and trade secret law as an
// unpublished work. Created 1987, (C) Copyright 1997 Texas Instruments. All
// rights reserved.
//
// Filename : pwl.h
// Description : Pulse Width Light Interface
// Handle the control of the backlight of LCD and keypad by employing
// a 4096 bit random sequence.
// Project : Samsom ... adpated for Helen
// Author : freygagne@tif.ti.com
// Modified by : Jean-Philippe Ulpiano jp_ulpiano@ti.com
// FUNCTIONS PROVIDED:
// PWL_TestRegisters = Test the default register values on reset
// Check all register bits could be set high and low
// PWL_SetLevelReg = Set a value into Level Reg
// PWL_SetCtrolReg = Set a value into Ctrol Reg
// PWL_GetLevelReg = Get a value into Level Reg
// PWL_GetCtrolReg = Get a value into Ctrol Reg
// PWL_EnableClock = Enable the internal clock
// PWL_DisableClock = Disable the internal clock
// PWL_IsClockEnabled= Disable the internal clock
// PWL_CheckResult = Test the read_data matches the given value
// PWL_CheckLightIntensityEvolutionLcd= on board take a breakpoint on each step
// and check light intensity evolution on LC
//----------------------------------------------------------------------------------
#ifndef __PWL_H
#define __PWL_H
#include "result.h"
#include "test.h"
#include "mapping.h"
#define PWL_CONTROL_OFFSET 0x01
// PWL LEVEL REGISTER
#define PWL_LEVEL_REG (*(REGISTER_UWORD8*) (MAP_PWL_REG))
#define PWL_LEVEL_REG_HIGH_VALUE 0xFF
#define PWL_LEVEL_REG_LOW_VALUE 0x00
#define PWL_LEVEL_REG_RESET_VALUE 0x00
#define PWL_LEVEL_REG_RES_VAL 0x00
// PWL CONTROL REGISTER
#define PWL_CTRL_REG (*(REGISTER_UWORD8*) (MAP_PWL_REG + ALIGNOrNotOn32Bits_from8bits(PWL_CONTROL_OFFSET)))
#define PWL_CTRL_REG_HIGH_VALUE 0x01
#define PWL_CTRL_REG_LOW_VALUE 0x00
#define PWL_CTRL_REG_RESET_VALUE 0x00
#define PWL_CTRL_REG_MASK 0x01
#define PWL_CKEN_POS 0x0
#define PWL_CKEN_NUMB 0x1
#define PWL_CKEN_RES_VAL 0x0
#define PWL_CK_ENABLED 0x01
#define PWL_CK_DISABLED 0x00
#define PWL_SET_LEVEL(newLevel) PWL_LEVEL_REG=(newLevel)
#define PWL_GET_LEVEL() (PWL_LEVEL_REG)
#define PWL_ENABLE_CK() PWL_CTRL_REG=PWL_CK_ENABLED
#define PWL_DISABLE_CK() PWL_CTRL_REG=PWL_CK_DISABLED
typedef enum
{
PWL_LEVEL_RESET_ERROR = 1000,
PWL_CTRL_RESET_ERROR,
PWL_LEVEL_HIGH_VALUE_ERROR, //Impossible to set high value
PWL_CTRL_HIGH_VALUE_ERROR, //Impossible to set high value
PWL_LEVEL_LOW_VALUE_ERROR, //Impossible to set low value
PWL_CTRL_LOW_VALUE_ERROR, //Impossible to set low value
PWL_LEVEL_ALWAYS_HIGH_VALUE_ERROR, //high value disapear
PWL_CTRL_ALWAYS_HIGH_VALUE_ERROR, //high value disapear
PWL_COMP_HIGH_VALUE_ERROR, //comparison error with level is set to max
PWL_COMP_LOW_VALUE_ERROR, //comparison error with level is set to min
PWL_UNEXPECTED_FIQ_ERROR
} PWL_Error_t;
void PWL_TestResetValue(void);
void PWL_TestRegistersAccess(void);
//--------------------------------------------------------------------------------
// NAME : PWL_TestRegisters
// DESCRIPTION : Test the default register values on reset
// Check all register bits could be set high and low
// PARAMETERS : None
// RETURN VALUE : Return the result of the test OK or BAD
// LIMITATIONS : Update results
//---------------------------------------------------------------------------------
UWORD16 PWL_TestRegisters(void);
//--------------------------------------------------------------------------------
// NAME : PWL_SetLevelReg
// PWL_SetCtrolReg
// DESCRIPTION : Set a value into Level Reg and Ctrol Reg
// PARAMETERS :
// value : Value to set
// LIMITATIONS: None
//---------------------------------------------------------------------------------
void PWL_SetLevelReg(const UWORD8 value);
typedef enum
{
PWL_CUT_CLOCK = 0,
PWL_ENABLE_CLOCK = 1
} PWL_ClockEnable_t;
void PWL_SetCtrolReg(const PWL_ClockEnable_t value);
//--------------------------------------------------------------------------------
// NAME : PWL_GetLevelReg
// PWL_GetCtrolReg
// DESCRIPTION : Set a value into Level Reg and Ctrol Reg
// PARAMETERS :
// value : Value to set
// LIMITATIONS: None
//---------------------------------------------------------------------------------
UWORD8 PWL_GetLevelReg(void);
UWORD8 PWL_GetCtrolReg(void);
//--------------------------------------------------------------------------------
// NAME : PWL_EnableClock
// DESCRIPTION : Enable the internal clock
// PARAMETERS : None
// LIMITATIONS : None
//---------------------------------------------------------------------------------
void PWL_EnableClock(void);
//--------------------------------------------------------------------------------
// NAME : PWL_DisableClock
// DESCRIPTION : Disable the internal clock
// PARAMETERS : None
// LIMITATIONS : None
//---------------------------------------------------------------------------------
void PWL_DisableClock(void);
//--------------------------------------------------------------------------------
// NAME : PWL_IsClockEnabled
// DESCRIPTION : Disable the internal clock
// PARAMETERS : None
// RETURN VALUE: Return True when clock is enabled otherwise False
// LIMITATIONS : None
//---------------------------------------------------------------------------------
boolean_t PWL_IsClockEnabled(void);
//--------------------------------------------------------------------------------
// NAME : PWL_CheckResult
// DESCRIPTION : Test the read_data matches the given value
// PARAMETERS :
// read_data: Data value to compare with value (register contents)
// value : Expected Value to match with read_data
// error : Number of the error to fill up into ptres in case of error
// RETURN VALUE : Return the result of the test OK or BAD
// LIMITATIONS: None
//---------------------------------------------------------------------------------
boolean_t PWL_CheckResult(const UWORD8 read_data,
const UWORD8 value,
const PWL_Error_t error);
//--------------------------------------------------------------------------------
// NAME : PWL_CheckLightIntensityEvolutionOnLCD
// DESCRIPTION : on board take a breakpoint on each step
// and check light intensity evolution on LCD
// RETURN VALUE : None
// PARAMETERS : None
// LIMITATIONS : None
//---------------------------------------------------------------------------------
void PWL_CheckLightIntensityEvolutionLcd(void);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -