Subversion Repositories seema-scanner

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 jakw 1
/*
2
 * API.h
3
 *
4
 * This module provides C callable APIs for each of the command supported by LightCrafter4500 platform and detailed in the programmer's guide.
5
 *
6
 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
7
 * ALL RIGHTS RESERVED
8
 *
9
*/
10
 
11
#ifndef API_H
12
#define API_H
13
 
14
/* Bit masks. */
15
#define BIT0        0x01
16
#define BIT1        0x02
17
#define BIT2        0x04
18
#define BIT3        0x08
19
#define BIT4        0x10
20
#define BIT5        0x20
21
#define BIT6        0x40
22
#define BIT7        0x80
23
#define BIT8      0x0100
24
#define BIT9      0x0200
25
#define BIT10     0x0400
26
#define BIT11     0x0800
27
#define BIT12     0x1000
28
#define BIT13     0x2000
29
#define BIT14     0x4000
30
#define BIT15     0x8000
31
#define BIT16 0x00010000
32
#define BIT17 0x00020000
33
#define BIT18 0x00040000
34
#define BIT19 0x00080000
35
#define BIT20 0x00100000
36
#define BIT21 0x00200000
37
#define BIT22 0x00400000
38
#define BIT23 0x00800000
39
#define BIT24 0x01000000
40
#define BIT25 0x02000000
41
#define BIT26 0x04000000
42
#define BIT27 0x08000000
43
#define BIT28 0x10000000
44
#define BIT29 0x20000000
45
#define BIT30 0x40000000
46
#define BIT31 0x80000000
47
 
48
#define STAT_BIT_FLASH_BUSY     BIT3
49
#define HID_MESSAGE_MAX_SIZE    512
50
 
51
typedef struct _hidmessageStruct
52
{
53
    struct _hidhead
54
    {
55
        struct _packetcontrolStruct
56
        {
57
            unsigned char dest		:3; /* 0 - ProjCtrl; 1 - RFC; 7 - Debugmsg */
58
            unsigned char reserved	:2;
59
            unsigned char nack		:1; /* Command Handler Error */
60
            unsigned char reply	:1; /* Host wants a reply from device */
61
            unsigned char rw		:1; /* Write = 0; Read = 1 */
62
        }flags;
63
        unsigned char seq;
64
        unsigned short length;
65
    }head;
66
    union
67
    {
68
        unsigned short cmd;
69
        unsigned char data[HID_MESSAGE_MAX_SIZE];
70
    }text;
71
}hidMessageStruct;
72
 
73
typedef struct _readCmdData
74
{
75
    unsigned char CMD2;
76
    unsigned char CMD3;
77
    unsigned short len;
78
}CmdFormat;
79
 
80
typedef struct _rectangle
81
{
82
    unsigned short firstPixel;
83
    unsigned short firstLine;
84
    unsigned short pixelsPerLine;
85
    unsigned short linesPerFrame;
86
}rectangle;
87
 
88
typedef enum
89
{
90
    SOURCE_SEL,
91
    PIXEL_FORMAT,
92
    CLK_SEL,
93
    CHANNEL_SWAP,
94
    FPD_MODE,
95
    CURTAIN_COLOR,
96
    POWER_CONTROL,
97
    FLIP_LONG,
98
    FLIP_SHORT,
99
    TPG_SEL,
100
    PWM_INVERT,
101
    LED_ENABLE,
102
    GET_VERSION,
103
    SW_RESET,
104
    DMD_PARK,
105
    BUFFER_FREEZE,
106
    STATUS_HW,
107
    STATUS_SYS,
108
    STATUS_MAIN,
109
    CSC_DATA,
110
    GAMMA_CTL,
111
    BC_CTL,
112
    PWM_ENABLE,
113
    PWM_SETUP,
114
    PWM_CAPTURE_CONFIG,
115
    GPIO_CONFIG,
116
    LED_CURRENT,
117
    DISP_CONFIG,
118
    TEMP_CONFIG,
119
    TEMP_READ,
120
    MEM_CONTROL,
121
    I2C_CONTROL,
122
    LUT_VALID,
123
    DISP_MODE,
124
    TRIG_OUT1_CTL,
125
    TRIG_OUT2_CTL,
126
    RED_STROBE_DLY,
127
    GRN_STROBE_DLY,
128
    BLU_STROBE_DLY,
129
    PAT_DISP_MODE,
130
    PAT_TRIG_MODE,
131
    PAT_START_STOP,
132
    BUFFER_SWAP,
133
    BUFFER_WR_DISABLE,
134
    CURRENT_RD_BUFFER,
135
    PAT_EXPO_PRD,
136
    INVERT_DATA,
137
    PAT_CONFIG,
138
    MBOX_ADDRESS,
139
    MBOX_CONTROL,
140
    MBOX_DATA,
141
    TRIG_IN1_DELAY,
142
    TRIG_IN2_CONTROL,
143
    SPLASH_LOAD,
144
    SPLASH_LOAD_TIMING,
145
    GPCLK_CONFIG,
146
    PULSE_GPIO_23,
147
    ENABLE_LCR_DEBUG,
148
    TPG_COLOR,
149
    PWM_CAPTURE_READ,
150
    PROG_MODE,
151
    BL_STATUS,
152
    BL_SPL_MODE,
153
    BL_GET_MANID,
154
    BL_GET_DEVID,
155
    BL_GET_CHKSUM,
156
    BL_SET_SECTADDR,
157
    BL_SECT_ERASE,
158
    BL_SET_DNLDSIZE,
159
    BL_DNLD_DATA,
160
    BL_FLASH_TYPE,
161
    BL_CALC_CHKSUM,
162
    BL_PROG_MODE,
163
}LCR_CMD;
164
 
165
int LCR_SetInputSource(unsigned int source, unsigned int portWidth);
166
int LCR_GetInputSource(unsigned int *pSource, unsigned int *portWidth);
167
int LCR_SetPixelFormat(unsigned int format);
168
int LCR_GetPixelFormat(unsigned int *pFormat);
169
int LCR_SetPortClock(unsigned int clock);
170
int LCR_GetPortClock(unsigned int *pClock);
171
int LCR_SetDataChannelSwap(unsigned int port, unsigned int swap);
172
int LCR_GetDataChannelSwap(unsigned int *pPort, unsigned int *pSwap);
173
int LCR_SetFPD_Mode_Field(unsigned int PixelMappingMode, bool SwapPolarity, unsigned int FieldSignalSelect);
174
int LCR_GetFPD_Mode_Field(unsigned int *pPixelMappingMode, bool *pSwapPolarity, unsigned int *pFieldSignalSelect);
175
int LCR_SetPowerMode(bool);
176
int LCR_SetLongAxisImageFlip(bool);
177
bool LCR_GetLongAxisImageFlip();
178
int LCR_SetShortAxisImageFlip(bool);
179
bool LCR_GetShortAxisImageFlip();
180
int LCR_SetTPGSelect(unsigned int pattern);
181
int LCR_GetTPGSelect(unsigned int *pPattern);
182
int LCR_SetPWMInvert(bool invert);
183
int LCR_GetPWMInvert(bool *inverted);
184
int LCR_SetLedEnables(bool SeqCtrl, bool Red, bool Green, bool Blue);
185
int LCR_GetLedEnables(bool *pSeqCtrl, bool *pRed, bool *pGreen, bool *pBlue);
186
int LCR_GetVersion(unsigned int *pApp_ver, unsigned int *pAPI_ver, unsigned int *pSWConfig_ver, unsigned int *pSeqConfig_ver);
187
int LCR_SoftwareReset(void);
188
int LCR_GetStatus(unsigned char *pHWStatus, unsigned char *pSysStatus, unsigned char *pMainStatus);
189
int LCR_SetPWMEnable(unsigned int channel, bool Enable);
190
int LCR_GetPWMEnable(unsigned int channel, bool *pEnable);
191
int LCR_SetPWMConfig(unsigned int channel, unsigned int pulsePeriod, unsigned int dutyCycle);
192
int LCR_GetPWMConfig(unsigned int channel, unsigned int *pPulsePeriod, unsigned int *pDutyCycle);
193
int LCR_SetPWMCaptureConfig(unsigned int channel, bool enable, unsigned int sampleRate);
194
int LCR_GetPWMCaptureConfig(unsigned int channel, bool *pEnabled, unsigned int *pSampleRate);
195
int LCR_SetGPIOConfig(unsigned int pinNum, bool enAltFunc, bool altFunc1, bool dirOutput, bool outTypeOpenDrain, bool pinState);
196
int LCR_GetGPIOConfig(unsigned int pinNum, bool *pEnAltFunc, bool *pAltFunc1, bool *pDirOutput, bool *pOutTypeOpenDrain, bool *pState);
197
int LCR_GetLedCurrents(unsigned char *pRed, unsigned char *pGreen, unsigned char *pBlue);
198
int LCR_SetLedCurrents(unsigned char RedCurrent, unsigned char GreenCurrent, unsigned char BlueCurrent);
199
int LCR_SetDisplay(rectangle croppedArea, rectangle displayArea);
200
int LCR_GetDisplay(rectangle *pCroppedArea, rectangle *pDisplayArea);
201
int LCR_MemRead(unsigned int addr, unsigned int *readWord);
202
int LCR_MemWrite(unsigned int addr, unsigned int data);
203
int LCR_ValidatePatLutData(unsigned int *pStatus);
204
int LCR_SetPatternDisplayMode(bool external);
205
int LCR_GetPatternDisplayMode(bool *external);
206
int LCR_SetTrigOutConfig(unsigned int trigOutNum, bool invert, unsigned int rising, unsigned int falling);
207
int LCR_GetTrigOutConfig(unsigned int trigOutNum, bool *pInvert,unsigned int *pRising, unsigned int *pFalling);
208
int LCR_SetRedLEDStrobeDelay(unsigned char rising, unsigned char falling);
209
int LCR_SetGreenLEDStrobeDelay(unsigned char rising, unsigned char falling);
210
int LCR_SetBlueLEDStrobeDelay(unsigned char rising, unsigned char falling);
211
int LCR_GetRedLEDStrobeDelay(unsigned char *, unsigned char *);
212
int LCR_GetGreenLEDStrobeDelay(unsigned char *, unsigned char *);
213
int LCR_GetBlueLEDStrobeDelay(unsigned char *, unsigned char *);
214
int LCR_SetProgrammingMode(bool EnterProgMode);
215
int LCR_ExitProgrammingMode(void);
216
int LCR_GetProgrammingMode(bool *ProgMode);
217
int LCR_GetFlashManID(unsigned short *manID);
218
int LCR_GetFlashDevID(unsigned long long *devID);
219
int LCR_GetBLStatus(unsigned char *BL_Status);
220
int LCR_BLSpecialMode(unsigned int Mode);
221
int LCR_SetFlashAddr(unsigned int Addr);
222
int LCR_FlashSectorErase(void);
223
int LCR_SetDownloadSize(unsigned int dataLen);
224
int LCR_DownloadData(unsigned char *pByteArray, unsigned int dataLen);
225
void LCR_WaitForFlashReady(void);
226
int LCR_SetFlashType(unsigned char Type);
227
int LCR_CalculateFlashChecksum(void);
228
int LCR_GetFlashChecksum(unsigned int*checksum);
229
int LCR_SetMode(bool SLmode);
230
int LCR_GetMode(bool *pMode);
231
int LCR_LoadSplash(unsigned int index);
232
int LCR_GetSplashIndex(unsigned int *pIndex);
233
int LCR_SetTPGColor(unsigned short redFG, unsigned short greenFG, unsigned short blueFG, unsigned short redBG, unsigned short greenBG, unsigned short blueBG);
234
int LCR_GetTPGColor(unsigned short *pRedFG, unsigned short *pGreenFG, unsigned short *pBlueFG, unsigned short *pRedBG, unsigned short *pGreenBG, unsigned short *pBlueBG);
235
int LCR_ClearPatLut(void);
236
int LCR_AddToPatLut(int TrigType, int PatNum,int BitDepth,int LEDSelect,bool InvertPat, bool InsertBlack,bool BufSwap, bool trigOutPrev);
237
int LCR_GetPatLutItem(int index, int *pTrigType, int *pPatNum,int *pBitDepth,int *pLEDSelect,bool *pInvertPat, bool *pInsertBlack,bool *pBufSwap, bool *pTrigOutPrev);
238
int LCR_SendPatLut(void);
239
int LCR_SendSplashLut(unsigned char *lutEntries, unsigned int numEntries);
240
int LCR_GetPatLut(int numEntries);
241
int LCR_GetSplashLut(unsigned char *pLut, int numEntries);
242
int LCR_SetPatternTriggerMode(bool);
243
int LCR_GetPatternTriggerMode(bool *);
244
int LCR_PatternDisplay(int Action);
245
int LCR_SetPatternConfig(unsigned int numLutEntries, bool repeat, unsigned int numPatsForTrigOut2, unsigned int numSplash);
246
int LCR_GetPatternConfig(unsigned int *pNumLutEntries, bool *pRepeat, unsigned int *pNumPatsForTrigOut2, unsigned int *pNumSplash);
247
int LCR_SetExpsosure_FramePeriod(unsigned int exposurePeriod, unsigned int framePeriod);
248
int LCR_GetExposure_FramePeriod(unsigned int *pExposure, unsigned int *pFramePeriod);
249
int LCR_SetTrigIn1Delay(unsigned int Delay);
250
int LCR_GetTrigIn1Delay(unsigned int *pDelay);
251
int LCR_SetInvertData(bool invert);
252
int LCR_PWMCaptureRead(unsigned int channel, unsigned int *pLowPeriod, unsigned int *pHighPeriod);
253
int LCR_SetGeneralPurposeClockOutFreq(unsigned int clkId, bool enable, unsigned int clkDivider);
254
int LCR_GetGeneralPurposeClockOutFreq(unsigned int clkId, bool *pEnabled, unsigned int *pClkDivider);
255
int LCR_MeasureSplashLoadTiming(unsigned int startIndex, unsigned int numSplash);
256
int LCR_ReadSplashLoadTiming(unsigned int *pTimingData);
257
 
258
 
259
#endif // API_H