📄 projectorctl.h
字号:
/****************************************************************************/
/* TEXAS INSTRUMENTS PROPRIETARY INFORMATION */
/* */
/* (c) Copyright, Texas Instruments Incorporated, 2006. */
/* All Rights Reserved. */
/* */
/* Property of Texas Instruments Incorporated. Restricted Rights - */
/* Use, duplication, or disclosure is subject to restrictions set */
/* forth in TI's program license agreement and associated documentation. */
/****************************************************************************/
/****************************************************************************/
/* projectorCtl.h */
/****************************************************************************/
#ifndef __PROJECTORCONTROL_H
#define __PROJECTORCONTROL_H
#include "common.h"
#include "sysmon.h"
/****************************************************/
/* Projector control command byte 1 definitions. */
/****************************************************/
typedef enum Cmd1Msg
{
CMD1_ACK,
CMD1_NACK,
CMD1_WRITE,
CMD1_WRITE_RESPONSE,
CMD1_READ,
CMD1_READ_RESPONSE
}
CMD1_TYPE;
/****************************************************/
/* Arrays of CMD_DICT_ENTRY define command IDs and */
/* command handlers. */
/****************************************************/
#define CMD_KEY( cmd2, cmd3, cmd1 ) ((cmd2 << 16 ) | ( cmd3 << 8 ) | cmd1 )
typedef struct _dictEntry
{
uint32 key; /* key */
BOOL (*pFunc)( void ); /* function value */
}
CMD_DICT_ENTRY;
/****************************************************/
/* An array of CMD_DICT_ENTRY arrays define all */
/*sets of command IDs handled by the application. */
/****************************************************/
typedef struct CmdDictArrayStruct
{
CMD_DICT_ENTRY *pDict; /* head of dictionary array */
size_t dictSize; /* size of array */
}
CMD_ARRAY_STRUCT;
/****************************************************/
/* Public functions. */
/****************************************************/
BOOL pctl_addCmdDict( CMD_DICT_ENTRY *pDict, size_t dictSize );
EXEC_CC_ENUM pctl_init( void );
void pctl_info( TASKINFO_STRUCT *info );
/****************************************************************************/
/* Message parsing functions and macros. */
/****************************************************************************/
#define MAX_MSG 256 /* maximum message body size */
extern int16 nRemReadPC; /* number of message bytes remaining to read */
extern int16 nRemWritePC; /* number of message bytes remaining to write */
extern uint08 *rdp; /* pointer to next message byte to read */
extern uint08 *wrp; /* pointer to next message byte to write */
#define cmdRemRead() ( nRemReadPC ) /* no. bytes remaining to read */
#define cmdRemWrite() ( nRemWritePC ) /* no. bytes remaining to write */
#define cmdGetPtrRead() ( rdp ) /* pointer to next byte to read */
#define cmdGetPtrWrite() ( wrp ) /* pointer to next byte to write */
/****************************************************/
/* Following functions fetch/store 'nBytes' from/to */
/* the current projector control message. Value is */
/* copied to/from the caller's environment. */
/* */
/* returns: */
/* FALSE - No bytes available to fetch/store. */
/* TRUE - Success. */
/* */
/* Note that these functions update success flags */
/* and report an ACK back to the host application */
/* if a fetch/store fails. */
/****************************************************/
BOOL cmdGet( int32 nBytes, void *parm );
BOOL cmdPut( int32 nBytes, void *parm );
/****************************************************/
/* Following functions bump the read/write pointers */
/* when the caller has directly read/written the */
/* message buffer instead of using the serialized */
/* accessors. */
/* */
/* returns: */
/* FALSE - No bytes available to increment by 'n' */
/* TRUE - Success. */
/****************************************************/
BOOL cmdIncRead( int32 nBytes ); /* increment read pointer by 'n' bytes */
BOOL cmdIncWrite( int32 nBytes ); /* increment write pointer by 'n' bytes */
/****************************************************/
/* Following macros perform the same function as a */
/* cmdPut() function, using a single parameter. */
/****************************************************/
#define cmdPut1( parm ) ( cmdPut( 1, &parm ))
#define cmdPut2( parm ) ( cmdPut( 2, &parm ))
#define cmdPut4( parm ) ( cmdPut( 4, &parm ))
/****************************************************/
/* Following macros return an lvalue and perform a */
/* typecast. This sometimes eliminates the need for */
/* allocating a receiving object, as is necessary */
/* when calling cmdGet(). */
/* */
/* Note that the macros require "parmUnion" to be */
/* defined in projectorCtl.c. */
/* */
/* Be aware of the order in which these macros are */
/* called. For example, multiple instances of these */
/* macros should not be included in the parameter */
/* list of a single function call, since the order */
/* of parameter fetches is not specified... */
/****************************************************/
union parmUnionType
{
int08 p1;
int16 p2;
int32 p4;
};
extern union parmUnionType parmUnion;
/****************************************************/
#define cmdGet1( parmtype ) ( cmdGet( 1, &parmUnion.p1 ), (parmtype)parmUnion.p1 )
#define cmdGet2( parmtype ) ( cmdGet( 2, &parmUnion.p2 ), (parmtype)parmUnion.p2 )
#define cmdGet4( parmtype ) ( cmdGet( 4, &parmUnion.p4 ), (parmtype)parmUnion.p4 )
/****************************************************/
/* Following macros write a constant value. This */
/* sometimes eliminates the need for allocating and */
/* initializing an object, as is necessary when */
/* calling cmdPut(). */
/* */
/* Note that the macros require "parmUnion" to be */
/* defined in projectorCtl.c. */
/****************************************************/
#define cmdPutK1( parm ) ( parmUnion.p1 = (int08)parm, cmdPut( 1, &parmUnion.p1 ))
#define cmdPutK2( parm ) ( parmUnion.p2 = (int16)parm, cmdPut( 2, &parmUnion.p2 ))
#define cmdPutK4( parm ) ( parmUnion.p4 = (int32)parm, cmdPut( 4, &parmUnion.p4 ))
/****************************************************/
/* Float/Fixed point conversions. */
/****************************************************/
float cmdFixedToFloat( int fixed, int precision );
int cmdFloatToFixed( float flt, int precision );
/****************************************************/
/* Validate address validity: TRUE if address is */
/* invalid. */
/****************************************************/
BOOL invalidAddress( void *address );
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -