Microchip® Advanced Software Framework

zrc.h File Reference

API for ZRC profile includes cmd discovery and RC commands.

Id:
zrc.h 27820 2011-07-24 17:20:51Z pawan.jadia
Author
Microchip Technology Inc: http://www.microchip.com
Support: https://www.microchip.com/support/
#include "rf4ce.h"

Data Structures

struct  zrc_cmd_frm_tag
 ZRC command frame structure. More...
 

Macros

#define aplcKeyExchangeTransferCount_def   aplcMinKeyExchangeTransferCount
 Default value of the key exchange transfer count. More...
 
#define aplcMaxCmdDiscRxOnDuration   200 /* ms */
 The maximum duration that the receiver is enabled on a controller after pairing to receive any command discovery request command frames. More...
 
#define aplcMaxKeyRepeatInterval_ms   100 /* ms */
 The maximum time between consecutive user control repeated command frame transmissions. More...
 
#define aplcMaxPairIndicationWaitTime   1.2 /* second */
 The maximum amount of time a device waits after receiving a successful NLME-AUTO-DISCOVERY.confirm primitive for a pair indication to arrive from the pairing initiator. More...
 
#define aplcMaxPairIndicationWaitTime_us   (aplcMaxPairIndicationWaitTime * 1000000L)
 The maximum amount of time a device waits after receiving a successful NLME-AUTO-DISCOVERY.confirm primitive for a pair indication to arrive from the pairing initiator. More...
 
#define aplcMaxResponseWaitTime   200 /* ms */
 The maximum time a device shall wait for a response command frame following a request command frame. More...
 
#define aplcMaxResponseWaitTime_us   (aplcMaxResponseWaitTime * 1000L)
 The maximum time a device shall wait for a response command frame following a request command frame. More...
 
#define aplcMinKeyExchangeTransferCount   3
 The minimum value of the KeyExTransferCount parameter passed to the pair request primitive during the push button pairing procedure. More...
 
#define aplcMinTargetBlackoutPeriod   100 /* ms */
 The minimum amount of time a device must wait after a successful pairing attempt with a target before attempting command discovery. More...
 
#define aplcMinTargetBlackoutPeriod_us   (aplcMinTargetBlackoutPeriod * 1000L)
 The minimum amount of time a device must wait after a successful pairing attempt with a target before attempting command discovery. More...
 
#define aplKeyRepeatInterval_def   (aplcMaxKeyRepeatInterval_ms)
 Default value of the key repeat interval. More...
 
#define aplKeyRepeatWaitTime_def   (2 * aplcMaxKeyRepeatInterval_ms)
 Default value of the key repeat wait time. More...
 
#define AUTO_DISC_DURATION_SYM   0x1C9C38
 The automatic discovery response mode duration shall be set to 0x1c9c38 (30s). More...
 
#define DISCOVERY_DURATION   0x00186A
 ZRC profile constants. More...
 
#define DISCOVERY_REPETITION_INTERVAL   0x00F424
 Default value for the discovery repetition interval. More...
 
#define MAX_DISCOVERY_REPETITIONS   0x1E
 Default value for maximum number of times the discovery request command is sent. More...
 
#define MAX_REPORTED_NODE_DESCRIPTORS   1
 Default value for Number of reported node descriptor received during discovery process. More...
 

Typedefs

typedef enum cec_code_tag cec_code_t
 Enums used for the RC command codes / CEC commands from HDMI spec. More...
 
typedef enum zrc_cmd_code_tag zrc_cmd_code_t
 Enums used for ZRC command codes. More...
 
typedef struct zrc_cmd_frm_tag zrc_cmd_frm_t
 ZRC command frame structure. More...
 

Enumerations

enum  cec_code_tag {
  SELECT = 0x00,
  UP = 0x01,
  DOWN = 0x02,
  LEFT = 0x03,
  RIGHT = 0x04,
  RIGHT_UP = 0x05,
  RIGHT_DOWN = 0x06,
  LEFT_UP = 0x07,
  LEFT_DOWN = 0x08,
  ROOT_MENU = 0x09,
  SETUP_MENU = 0x0a,
  CONTENTS_MENU = 0x0b,
  FAVORITE_MENU = 0x0c,
  EXIT = 0x0d,
  MEDIA_TOP_MENU = 0x10,
  MEDIA_CONTEXT_MENU = 0x11,
  NUMBER_SHIFT = 0x1d,
  NUMBER_11 = 0x1e,
  NUMBER_12 = 0x1f,
  NUMBER_0 = 0x20,
  NUMBER_1 = 0x21,
  NUMBER_2 = 0x22,
  NUMBER_3 = 0x23,
  NUMBER_4 = 0x24,
  NUMBER_5 = 0x25,
  NUMBER_6 = 0x26,
  NUMBER_7 = 0x27,
  NUMBER_8 = 0x28,
  NUMBER_9 = 0x29,
  DOT = 0x2a,
  ENTER = 0x2b,
  CLEAR = 0x2c,
  NEXT_FAVORITE = 0x2f,
  CHANNEL_UP = 0x30,
  CHANNEL_DOWN = 0x31,
  PREVIOUS_CHANNEL = 0x32,
  SOUND_SELECT = 0x33,
  INPUT_SELECT = 0x34,
  DISPLAY_INFORMATION = 0x35,
  HELP = 0x36,
  PAGE_UP = 0x37,
  PAGE_DOWN = 0x38,
  POWER = 0x40,
  VOLUME_UP = 0x41,
  VOLUME_DOWN = 0x42,
  MUTE = 0x43,
  PLAY = 0x44,
  STOP = 0x45,
  PAUSE = 0x46,
  RECORD = 0x47,
  REWIND = 0x48,
  FAST_FORWARD = 0x49,
  EJECT = 0x4a,
  FORWARD = 0x4b,
  BACKWARD = 0x4c,
  STOP_RECORD = 0x4d,
  PAUSE_RECORD = 0x4e,
  ANGLE = 0x50,
  SUB_PICTURE = 0x51,
  VIDEO_ON_DEMAND = 0x52,
  ELECTRONIC_PROGRAM_GUIDE = 0x53,
  TIMER_PROGRAMMING = 0x54,
  INITIAL_CONFIGURATION = 0x55,
  SELECT_BROADCAST_TYPE = 0x56,
  SELECT_SOUND_PRESENTATION = 0x57,
  PLAY_FUNCTION = 0x60,
  PAUSE_PLAY_FUNCTION = 0x61,
  RECORD_FUNCTION = 0x62,
  PAUSE_RECORD_FUNCTION = 0x63,
  STOP_FUNCTION = 0x64,
  MUTE_FUNCTION = 0x65,
  RESTORE_VOLUME_FUNCTION = 0x66,
  TUNE_FUNCTION = 0x67,
  SELECT_MEDIA_FUNCTION = 0x68,
  SELECT_AV_INPUT_FUNCTION = 0x69,
  SELECT_AUDIO_INPUT_FUNCTION = 0x6a,
  POWER_TOGGLE_FUNCTION = 0x6b,
  POWER_OFF_FUNCTION = 0x6c,
  POWER_ON_FUNCTION = 0x6d,
  F1_BLUE = 0x71,
  F2_RED = 0x72,
  F3_GREEN = 0x73,
  F4_YELLOW = 0x74,
  F5 = 0x75,
  DATA = 0x76
}
 Enums used for the RC command codes / CEC commands from HDMI spec. More...
 
enum  zrc_cmd_code_tag {
  USER_CONTROL_IDLE = 0x00,
  USER_CONTROL_PRESSED = 0x01,
  USER_CONTROL_REPEATED = 0x02,
  USER_CONTROL_RELEASED = 0x03,
  CMD_DISCOVERY_REQUEST = 0x04,
  CMD_DISCOVERY_RESPONSE = 0x05
}
 Enums used for ZRC command codes. More...
 

Functions

void zrc_cmd_disc_confirm (nwk_enum_t Status, uint8_t PairingRef, uint8_t *SupportedCmd)
 Callback ZRC command discovery confirm. More...
 
void zrc_cmd_disc_indication (uint8_t PairingRef)
 Callback ZRC command discovery indication. More...
 
bool zrc_cmd_disc_request (uint8_t PairingRef)
 Sends the ZRC command discovery request. More...
 
bool zrc_cmd_disc_response (uint8_t PairingRef, uint8_t *SupportedCmd)
 ZRC command discovery response. More...
 
void zrc_cmd_indication (uint8_t PairingRef, uint8_t nsduLength, uint8_t *nsdu, uint8_t RxLinkQuality, uint8_t RxFlags)
 Prints RC command code text; used for example apps and debugging. More...
 
void zrc_data_confirm (nwk_enum_t Status, uint8_t PairingRef)
 Handle the data confirm (received from network layer). More...
 
void zrc_data_indication (uint8_t PairingRef, uint8_t nsduLength, uint8_t *nsdu, uint8_t RxLinkQuality, uint8_t RxFlags)
 Handles the cmd data indications received from the network layer. More...
 

#define aplcKeyExchangeTransferCount_def   aplcMinKeyExchangeTransferCount

Default value of the key exchange transfer count.

#define aplcMaxCmdDiscRxOnDuration   200 /* ms */

The maximum duration that the receiver is enabled on a controller after pairing to receive any command discovery request command frames.

#define aplcMaxKeyRepeatInterval_ms   100 /* ms */

The maximum time between consecutive user control repeated command frame transmissions.

#define aplcMaxPairIndicationWaitTime   1.2 /* second */

The maximum amount of time a device waits after receiving a successful NLME-AUTO-DISCOVERY.confirm primitive for a pair indication to arrive from the pairing initiator.

Unit is seconds.

#define aplcMaxPairIndicationWaitTime_us   (aplcMaxPairIndicationWaitTime * 1000000L)

The maximum amount of time a device waits after receiving a successful NLME-AUTO-DISCOVERY.confirm primitive for a pair indication to arrive from the pairing initiator.

Unit is micro seconds.

#define aplcMaxResponseWaitTime   200 /* ms */

The maximum time a device shall wait for a response command frame following a request command frame.

Unit is milli seconds.

#define aplcMaxResponseWaitTime_us   (aplcMaxResponseWaitTime * 1000L)

The maximum time a device shall wait for a response command frame following a request command frame.

Unit is micro seconds.

#define aplcMinKeyExchangeTransferCount   3

The minimum value of the KeyExTransferCount parameter passed to the pair request primitive during the push button pairing procedure.

#define aplcMinTargetBlackoutPeriod   100 /* ms */

The minimum amount of time a device must wait after a successful pairing attempt with a target before attempting command discovery.

Unit is milli seconds.

#define aplcMinTargetBlackoutPeriod_us   (aplcMinTargetBlackoutPeriod * 1000L)

The minimum amount of time a device must wait after a successful pairing attempt with a target before attempting command discovery.

Unit is micro seconds.

#define aplKeyRepeatInterval_def   (aplcMaxKeyRepeatInterval_ms)

Default value of the key repeat interval.

#define aplKeyRepeatWaitTime_def   (2 * aplcMaxKeyRepeatInterval_ms)

Default value of the key repeat wait time.

#define AUTO_DISC_DURATION_SYM   0x1C9C38

The automatic discovery response mode duration shall be set to 0x1c9c38 (30s).

#define DISCOVERY_DURATION   0x00186A

ZRC profile constants.

Controller discovery duration

#define DISCOVERY_REPETITION_INTERVAL   0x00F424

Default value for the discovery repetition interval.

#define MAX_DISCOVERY_REPETITIONS   0x1E

Default value for maximum number of times the discovery request command is sent.

#define MAX_REPORTED_NODE_DESCRIPTORS   1

Default value for Number of reported node descriptor received during discovery process.

typedef enum cec_code_tag cec_code_t

Enums used for the RC command codes / CEC commands from HDMI spec.

(See Annex A: Mandatory command matrix)

Enums used for ZRC command codes.

ZRC command frame structure.

Enums used for the RC command codes / CEC commands from HDMI spec.

(See Annex A: Mandatory command matrix)

Enumerator
SELECT 
UP 
DOWN 
LEFT 
RIGHT 
RIGHT_UP 
RIGHT_DOWN 
LEFT_UP 
LEFT_DOWN 
ROOT_MENU 
SETUP_MENU 
CONTENTS_MENU 
FAVORITE_MENU 
EXIT 
MEDIA_TOP_MENU 
MEDIA_CONTEXT_MENU 
NUMBER_SHIFT 
NUMBER_11 
NUMBER_12 
NUMBER_0 
NUMBER_1 
NUMBER_2 
NUMBER_3 
NUMBER_4 
NUMBER_5 
NUMBER_6 
NUMBER_7 
NUMBER_8 
NUMBER_9 
DOT 
ENTER 
CLEAR 
NEXT_FAVORITE 
CHANNEL_UP 
CHANNEL_DOWN 
PREVIOUS_CHANNEL 
SOUND_SELECT 
INPUT_SELECT 
DISPLAY_INFORMATION 
HELP 
PAGE_UP 
PAGE_DOWN 
POWER 
VOLUME_UP 
VOLUME_DOWN 
MUTE 
PLAY 
STOP 
PAUSE 
RECORD 
REWIND 
FAST_FORWARD 
EJECT 
FORWARD 
BACKWARD 
STOP_RECORD 
PAUSE_RECORD 
ANGLE 
SUB_PICTURE 
VIDEO_ON_DEMAND 
ELECTRONIC_PROGRAM_GUIDE 
TIMER_PROGRAMMING 
INITIAL_CONFIGURATION 
SELECT_BROADCAST_TYPE 
SELECT_SOUND_PRESENTATION 
PLAY_FUNCTION 
PAUSE_PLAY_FUNCTION 
RECORD_FUNCTION 
PAUSE_RECORD_FUNCTION 
STOP_FUNCTION 
MUTE_FUNCTION 
RESTORE_VOLUME_FUNCTION 
TUNE_FUNCTION 
SELECT_MEDIA_FUNCTION 
SELECT_AV_INPUT_FUNCTION 
SELECT_AUDIO_INPUT_FUNCTION 
POWER_TOGGLE_FUNCTION 
POWER_OFF_FUNCTION 
POWER_ON_FUNCTION 
F1_BLUE 
F2_RED 
F3_GREEN 
F4_YELLOW 
F5 
DATA 

Enums used for ZRC command codes.

Enumerator
USER_CONTROL_IDLE 
USER_CONTROL_PRESSED 
USER_CONTROL_REPEATED 
USER_CONTROL_RELEASED 
CMD_DISCOVERY_REQUEST 
CMD_DISCOVERY_RESPONSE 

void zrc_cmd_disc_confirm ( nwk_enum_t  Status,
uint8_t  PairingRef,
uint8_t *  SupportedCmd 
)

Callback ZRC command discovery confirm.

The command discovery confirm callback provides information about the sent command discovery request.

Parameters
StatusStatus of the sent command discovery request
PairingRefPairing reference used for the command discovery request
SupportedCmdPointer to 32 byte array containing the supported commands

Callback ZRC command discovery confirm.

   request command was receiced.
Parameters
Statusnwk status
PairingRefPairing Ref for destination.
SupportedCmdSupported commands by destination node.

References UNUSED.

void zrc_cmd_disc_indication ( uint8_t  PairingRef)

Callback ZRC command discovery indication.

The command discovery indication callback indicates that a command discovery request command was receiced.

Parameters
PairingRefPairing reference used for the command discovery request

Callback ZRC command discovery indication.

Parameters
PairingRefPairing Ref for the source.

Reset QT600-Interface board

References AG_PERIODIC, CH_AGILITY_EXECUTION, IDLE, node_status, nwk_ch_agility_request(), PGM_READ_BLOCK, RESET_QT600_OFF, and zrc_cmd_disc_response().

bool zrc_cmd_disc_request ( uint8_t  PairingRef)

Sends the ZRC command discovery request.

The command discovery request allows a node to query which user control commands are supported on a remote node, i.e. those specified in the user control pressed command frame.

Parameters
PairingRefPairing reference of the device to address the request.
Returns
true if request has been added to NHLE-NWK queue successfully; else false

Referenced by pbp_pair_confirm().

bool zrc_cmd_disc_response ( uint8_t  PairingRef,
uint8_t *  SupportedCmd 
)

ZRC command discovery response.

The command discovery response allows a device to answer to an incoming command discovery request.

Parameters
PairingRefPairing reference used for the command discovery request
SupportedCmdPointer to 32 byte array containing supported CEC commands
Returns
true if request has been added to NHLE-NWK queue successfully; else false

Referenced by zrc_cmd_disc_indication().

void zrc_cmd_indication ( uint8_t  PairingRef,
uint8_t  nsduLength,
uint8_t *  nsdu,
uint8_t  RxLinkQuality,
uint8_t  RxFlags 
)

Prints RC command code text; used for example apps and debugging.

Parameters
commandCEC command code
Returns
String describing the command Initialites the command transmission from the application.
Parameters
PairingRefPairing reference
VendorIdVendor Id information
CmdCodeZRC cmd code (Press/Release)
CmdLengthLength of the rc cmd (rc cmd code + Payload)
CmdPointer to payload data, i.e. RC command; rc command code (rc cmd code + Payload)
TxOptionsTransmission options (Eg. ack, security etc)
Returns
true returns the status of zrc_cmd_request. Callback function to the application indicating the status the sent ZRC command request.
Parameters
StatusStatus of the command request
PairingRefPairing reference
RcCmdRC command code. API indicating a received the command to ZRC application.
PairingRefPairing reference of the source node
nsduLengthLength of the received data
nsduPointer to payload data, i.e. RC command
RxLinkQualityLink quality of received packet
RxFlagsRx Flags.

Prints RC command code text; used for example apps and debugging.

Parameters
PairingRefPairing reference
nsduLengthLength of the payload.
nsduActual payload
RxLinkQualityLink quality of received packet.
RxFlagsRx Flags.

Receive the data on RF4CE Link, Store in Tx_Buffer and Send to TWI interface

References zrc_cmd_frm_tag::fcf, LED_DATA, LED_TOGGLE, pal_led(), PutChar(), rf4ce_new_msg, UNUSED, and USER_CONTROL_PRESSED.

void zrc_data_confirm ( nwk_enum_t  Status,
uint8_t  PairingRef 
)

Handle the data confirm (received from network layer).

Parameters
StatusStatus received from the network layer.
PairingRefPairing reference
void zrc_data_indication ( uint8_t  PairingRef,
uint8_t  nsduLength,
uint8_t *  nsdu,
uint8_t  RxLinkQuality,
uint8_t  RxFlags 
)

Handles the cmd data indications received from the network layer.

  (cmd discovery and remote control commands).
Parameters
PairingRefPairing reference
nsduLengthLength of the received data
nsduActual data
RxLinkQualityLink quality of received packet
RxFlagsRx Flags.