#include <conio.h>
#include <stdio.h>
#include <string.h>
#include <dos.h>
#include <stdlib.h>
#include <stdarg.h>
#include <assert.h>
#include "amd186.h"
#include "remote.h"
#include "clib/rtos.h"
#include "clib/hwapi.h"
Go to the source code of this file.
Defines | |
#define | RC_DMA_LEN 1024 |
Functions | |
unsigned long | DecodeRC5 (unsigned const *samples) |
RC5 decoding state machine. | |
unsigned long | DecodeNEC (unsigned const *samples) |
Decode NEC Timing. | |
unsigned long | DecodeSAMSUNG (unsigned const *samples) |
Decode SAMSUNG timing. | |
void | DecodeSamples (unsigned *samples, unsigned length) |
Try to decode raw timing samples. | |
void interrupt | timerHandler (...) |
Timer interrupt handler. | |
int | RC_KeyAvail () |
Check for currently available keycodes. | |
unsigned long | RC_GetKey () |
Get a keycode from the queue. | |
void | RC_Init () |
This function must be called to initialize the remote control subsystem. | |
void | RC_Done () |
Shutdown the remote control subsystem, and free all used resources. | |
Variables | |
volatile unsigned | dmabuf [RC_DMA_LEN] |
DMA buffer for timing samples. | |
void interrupt(* | oldTimerHandler )(...) |
pointer to the old interrupt handler | |
unsigned long | queue [RC_QUEUE_SIZE] |
queue for received keycodes | |
volatile int | qHead |
volatile int | qCount |
|
Definition at line 36 of file remote.cpp. Referenced by RC_Init(), and timerHandler(). |
|
Decode NEC Timing.
Definition at line 163 of file remote.cpp. References NEC_MARGIN, NEC_PAUSE0, NEC_PAUSE1, NEC_PULSE, NEC_REPEAT, NEC_START1, NEC_START2, RCKEY_CODE, RCKEY_NEC, and RCKEY_REPEAT. Referenced by DecodeSamples(). |
|
RC5 decoding state machine. Based on Guy Carpenter's article "An Efficient Algorithm for Decoding RC5 Remote Control Signals", http://deep.clearwater.com.au/pcm-9574/rc5/rc5.html The RC5 Protocol is widely used by various Vendors, among them Loewe, Philips, Grundig and Marantz
Definition at line 111 of file remote.cpp. References RC5_LONG, RC5_MARGIN, RC5_SHORT, RCKEY_RC5, and RCKEY_REPEAT. Referenced by DecodeSamples(). |
|
Try to decode raw timing samples. Because of the DMA logic, there may be more than one sample per signal edge - we have to clean up the timing buffer before we try to recognize any keycode. After cleanup, different decoder functions are run on the array. If a keycode was recognized, it gets added to the key queue
Definition at line 273 of file remote.cpp. References DecodeNEC(), DecodeRC5(), DecodeSAMSUNG(), qCount, qHead, queue, RC_QUEUE_SIZE, RC_TRESHOLD, and TICKS_PER_uS. Referenced by timerHandler(). |
|
Decode SAMSUNG timing.
Definition at line 213 of file remote.cpp. References RCKEY_REPEAT, RCKEY_SAMSUNG, RTX_Get_System_Ticks(), SAM_MARGIN, SAM_PAUSE0, SAM_PAUSE1, SAM_PULSE, SAM_REPEATMS, SAM_START1, and SAM_START2. Referenced by DecodeSamples(). |
|
Shutdown the remote control subsystem, and free all used resources.
Definition at line 416 of file remote.cpp. References AMD_StopDma(), oldTimerHandler, PCB_T1CON, RC_DMACHANNEL, and TCON_STOP. Referenced by main(). |
|
Get a keycode from the queue. This function will block until a keycode is received. Use the RC_KeyAvail() function to check if there are codes in the queue.
Definition at line 361 of file remote.cpp. References qCount, qHead, queue, RC_KeyAvail(), RC_QUEUE_SIZE, and RTX_Sleep_Time(). Referenced by gfxTest(). |
|
This function must be called to initialize the remote control subsystem.
Definition at line 380 of file remote.cpp. References AMD_EnableDrq(), AMD_StartDma(), DmaInfo::control, DCON_BW, DCON_DINC, DCON_DMIO, DCON_P, DCON_SSYNC, DCON_TC, dmabuf, DmaInfo::dstMem, DmaInfo::length, oldTimerHandler, PCB_T1CMPA, PCB_T1CNT, PCB_T1CON, pfe_enable_bus(), pfe_enable_pcs(), RC_DMA_LEN, RC_DMACHANNEL, DmaInfo::srcPort, TCON_CONT, TCON_INT, TCON_START, TCON_STOP, and timerHandler(). Referenced by main(). |
|
Check for currently available keycodes. Any available keycodes can be retrieved with RC_GetKey()
Definition at line 344 of file remote.cpp. References qCount. Referenced by RC_GetKey(). |
|
Timer interrupt handler. This interrupt is called whenever Timer 0 generates an overflow. If there are bytes in the dmabuf buffer, and the DMA position hasn't changed between two of the interrupts, we received a new datagram. Definition at line 309 of file remote.cpp. References AMD_GetDmaInfo(), AMD_StartDma(), DecodeSamples(), dmabuf, DmaInfo::dstMem, DmaInfo::length, oldTimerHandler, RC_DMA_LEN, and RC_DMACHANNEL. Referenced by RC_Init(). |
|
DMA buffer for timing samples.
Definition at line 40 of file remote.cpp. Referenced by RC_Init(), and timerHandler(). |
|
pointer to the old interrupt handler
Definition at line 43 of file remote.cpp. Referenced by RC_Done(), RC_Init(), and timerHandler(). |
|
Definition at line 47 of file remote.cpp. Referenced by DecodeSamples(), RC_GetKey(), and RC_KeyAvail(). |
|
Definition at line 47 of file remote.cpp. Referenced by DecodeSamples(), and RC_GetKey(). |
|
queue for received keycodes
Definition at line 46 of file remote.cpp. Referenced by DecodeSamples(), and RC_GetKey(). |