as399x.h File Reference

Declaration of low level functions provided by the AS399x series chips. More...

#include "global.h"

Defines

#define AS399X_ENABLE_SENDER()   do{IO2(LOW);IO3(HIGH);}while(0)
#define AS399X_ENABLE_RECEIVER()   do{IO2(HIGH);IO3(HIGH);}while(0)
#define AS399X_CMD_IDLE   0x80
#define AS399X_CMD_SOFTINIT   0x83
#define AS399X_CMD_HOPMAINFREQ   0x84
#define AS399X_CMD_HOPAUXFREQ   0x85
#define AS399X_CMD_TRIGGERADCCON   0x87
#define AS399X_CMD_TRIGGER_CALIBRATION   0x88
#define AS399X_CMD_RESETFIFO   0x8F
#define AS399X_CMD_TRANSMCRC   0x90
#define AS399X_CMD_TRANSMCRCEHEAD   0x91
#define AS399X_CMD_TRANSM   0x92
#define AS399X_CMD_DELAYEDTRANSM   0x93
#define AS399X_CMD_DELAYEDTRANSMCRC   0x94
#define AS399X_CMD_BLOCKRX   0x96
#define AS399X_CMD_ENABLERX   0x97
#define AS399X_CMD_QUERY   0x98
#define AS399X_CMD_QUERYREP   0x99
#define AS399X_CMD_QUERYADJUSTUP   0x9A
#define AS399X_CMD_QUERYADJUSTNIC   0x9B
#define AS399X_CMD_QUERYADJUSTDOWN   0x9C
#define AS399X_CMD_ACKN   0x9D
#define AS399X_CMD_NAK   0x9E
#define AS399X_CMD_REQRN   0x9F
#define AS399X_REG_STATUSCTRL   0x00
#define AS399X_REG_PROTOCOLCTRL   0x01
#define AS399X_REG_TXOPTGEN2   0x02
#define AS399X_REG_RXOPTGEN2   0x03
#define AS399X_REG_TRCALREGGEN2   0x04
#define AS399X_REG_TRCALGEN2MISC   0x05
#define AS399X_REG_TXREPLYDELAY   0x06
#define AS399X_REG_RXNORESPWAIT   0x07
#define AS399X_REG_RXWAITTIME   0x08
#define AS399X_REG_RXSPECIAL   0x09
#define AS399X_REG_RXSPECIAL2   0x0A
#define AS399X_REG_IOCONTROL   0x0B
#define AS399X_REG_TESTSETTING   0x12
#define AS399X_REG_CLSYSAOCPCTRL   0x14
#define AS399X_REG_MODULATORCTRL   0x15
#define AS399X_REG_PLLMAIN   0x16
#define AS399X_REG_PLLAUX   0x17
#define AS399X_REG_DAC   0x18
#define AS399X_REG_ADC   0x19
#define AS399X_REG_IRQSTATUS   0x0C
#define AS399X_REG_IRQMASKREG   0x0D
#define AS399X_REG_AGCINTERNALSTATUS   0x0E
#define AS399X_REG_RSSILEVELS   0x0F
#define AS399X_REG_AGLSTATUS   0x10
#define AS399X_REG_MEASURE_SELECTOR   0x11
#define AS399X_REG_RXLENGTHUP   0x1A
#define AS399X_REG_RXLENGTHLOW   0x1B
#define AS399X_REG_FIFOSTATUS   0x1C
#define AS399X_REG_TXLENGTHUP   0x1D
#define AS399X_REG_TXLENGTHLOW   0x1E
#define AS399X_REG_FIFO   0x1F
#define AS399X_IRQ_NORESP   0x01
#define AS399X_IRQ_PREAMBLE   0x02
#define AS399X_IRQ_RXCOUNT   0x04
#define AS399X_IRQ_HEADER   0x08
#define AS399X_IRQ_CRCERROR   0x10
#define AS399X_IRQ_FIFO   0x20
#define AS399X_IRQ_RX   0x40
#define AS399X_IRQ_TX   0x80
#define AS399X_FIFOSTAT_HIGHLEVEL   0x80
#define AS399X_FIFOSTAT_LOWLEVEL   0x40
#define AS399X_FIFOSTAT_OVERFLOW   0x20
#define RESP_TXIRQ   AS399X_IRQ_TX
#define RESP_RXIRQ   AS399X_IRQ_RX

Functions

void as399xSingleCommand (u8 command)
void as399xContinuousRead (u8 address, s8 len, u8 *readbuf)
void as399xFifoRead (s8 len, u8 *readbuf)
u8 as399xSingleRead (u8 address)
void as399xWritePredistortion (const u8 *buf)
void as399xContinuousWrite (u8 address, u8 *buf, s8 len)
void as399xSingleWrite (u8 address, u8 value)
void as399xCommandContinuousAddress (u8 *command, u8 com_len, u8 address, u8 *buf, u8 buf_len)
u8 as399xGetFIFOStatus (void)
u8 as399xGetIRQStatus (void)
void as399xWaitForResponse (u16 waitMask)
void as399xWaitForResponseTimed (u16 waitMask, u16 ms)
void as399xEnterDirectMode ()
void as399xExitDirectMode ()

Variables

volatile u16 as399xResponse


Detailed Description

Declaration of low level functions provided by the AS399x series chips.

Author:
U.Herrmann ( based on work by E.Grubmueller

T. Luecker (Substitute)

Declares low level functions provided by the AS399x series chips. All higher level functions are provided by as399x_public.h and protocol work is contained in gen2.h and iso6b.h

Define Documentation

#define AS399X_CMD_ACKN   0x9D

AS3990 direct command: sending acknowledge command to tag.

#define AS399X_CMD_BLOCKRX   0x96

AS3990 direct command: block receive operation.

#define AS399X_CMD_DELAYEDTRANSM   0x93

AS3990 direct command: delayed transmition without CRC.

#define AS399X_CMD_DELAYEDTRANSMCRC   0x94

AS3990 direct command: delayed transmition with CRC.

#define AS399X_CMD_ENABLERX   0x97

AS3990 direct command: enable receive operation.

#define AS399X_CMD_HOPAUXFREQ   0x85

AS3990 direct command: hop to aux frequency.

#define AS399X_CMD_HOPMAINFREQ   0x84

AS3990 direct command: hop to main frequency.

#define AS399X_CMD_IDLE   0x80

AS3990 direct command: idle.

#define AS399X_CMD_NAK   0x9E

AS3990 direct command: sending not acknowledge command to tag.

#define AS399X_CMD_QUERY   0x98

AS3990 direct command: sending query command to tag.

#define AS399X_CMD_QUERYADJUSTDOWN   0x9C

AS3990 direct command: sending query adjust down command to tag.

#define AS399X_CMD_QUERYADJUSTNIC   0x9B

AS3990 direct command: sending query adjust nic command to tag.

#define AS399X_CMD_QUERYADJUSTUP   0x9A

AS3990 direct command: sending query adjust up command to tag.

#define AS399X_CMD_QUERYREP   0x99

AS3990 direct command: sending queryrep command to tag.

#define AS399X_CMD_REQRN   0x9F

AS3990 direct command: sending request new RN16 or Handle command to tag.

#define AS399X_CMD_RESETFIFO   0x8F

AS3990 direct command: reset AS399X_REG_FIFO.

#define AS399X_CMD_SOFTINIT   0x83

AS3990 direct command: soft init.

#define AS399X_CMD_TRANSM   0x92

AS3990 direct command: transmition to tag without CRC.

#define AS399X_CMD_TRANSMCRC   0x90

AS3990 direct command: transmition to tag with CRC.

#define AS399X_CMD_TRANSMCRCEHEAD   0x91

AS3990 direct command: transmition to tag with CRC expecting headerbit.

#define AS399X_CMD_TRIGGER_CALIBRATION   0x88

AS3992 direct command: trigger rx filter calibration.

#define AS399X_CMD_TRIGGERADCCON   0x87

AS3990 direct command: trigger AS399X_REG_ADC conversion.

 
#define AS399X_ENABLE_RECEIVER (  )     do{IO2(HIGH);IO3(HIGH);}while(0)

macro for setting the input ports used for direct mode

 
#define AS399X_ENABLE_SENDER (  )     do{IO2(LOW);IO3(HIGH);}while(0)

macro for setting the output ports used for direct mode

#define AS399X_FIFOSTAT_HIGHLEVEL   0x80

AS3990 AS399X_REG_FIFO status register: FIFO 2/3 full.

#define AS399X_FIFOSTAT_LOWLEVEL   0x40

AS3990 AS399X_REG_FIFO status register: FIFO 1/3 full.

#define AS399X_FIFOSTAT_OVERFLOW   0x20

AS3990 AS399X_REG_FIFO status register: FIFO overflow.

#define AS399X_IRQ_CRCERROR   0x10

AS3990 interrupt: error1 bit.

#define AS399X_IRQ_FIFO   0x20

AS3990 interrupt: fifo bit.

#define AS399X_IRQ_HEADER   0x08

AS3990 interrupt: header bit.

#define AS399X_IRQ_NORESP   0x01

AS3990 interrupt: no response bit.

#define AS399X_IRQ_PREAMBLE   0x02

AS3990 interrupt: error 3 bit.

#define AS399X_IRQ_RX   0x40

AS3990 IRQ status register: receive complete.

#define AS399X_IRQ_RXCOUNT   0x04

AS3990 interrupt: error 2 bit.

#define AS399X_IRQ_TX   0x80

AS3990 IRQ status register: transmit complete.

#define AS399X_REG_ADC   0x19

AS3990 register: AS399X_REG_ADC control.

#define AS399X_REG_AGCINTERNALSTATUS   0x0E

AS3990 register: AGC and Internal status.

#define AS399X_REG_AGLSTATUS   0x10

AS3990 register: AGL status.

#define AS399X_REG_CLSYSAOCPCTRL   0x14

AS3990 register: CL_sys,analouge out and CP control.

#define AS399X_REG_DAC   0x18

AS3990 register: AS399X_REG_DAC control.

#define AS399X_REG_FIFO   0x1F

AS3990 register: data AS399X_REG_FIFO.

#define AS399X_REG_FIFOSTATUS   0x1C

AS3990 register: AS399X_REG_FIFO status.

#define AS399X_REG_IOCONTROL   0x0B

AS3990 register: regulator and IO control.

#define AS399X_REG_IRQMASKREG   0x0D

AS3990 register: IRQ mask.

#define AS399X_REG_IRQSTATUS   0x0C

AS3990 register: IRQ status.

#define AS399X_REG_MEASURE_SELECTOR   0x11

AS3990 register: Test setting 1 and measurement selection.

#define AS399X_REG_MODULATORCTRL   0x15

AS3990 register: modulator control.

#define AS399X_REG_PLLAUX   0x17

AS3990 register: PLL A/B divider auxiliary register (three bytes deep).

#define AS399X_REG_PLLMAIN   0x16

AS3990 register: PLL R, A/B divider main register (three bytes deep).

#define AS399X_REG_PROTOCOLCTRL   0x01

AS3990 register: protocol control.

#define AS399X_REG_RSSILEVELS   0x0F

AS3990 register: RSSI levels.

#define AS399X_REG_RXLENGTHLOW   0x1B

AS3990 register: number of bytes to receive (lower byte).

#define AS399X_REG_RXLENGTHUP   0x1A

AS3990 register: Test setting 2.

AS3990 register: number of bytes to receive (upper byte)

#define AS399X_REG_RXNORESPWAIT   0x07

AS3990 register: wait time until no response interrupt is generated.

#define AS399X_REG_RXOPTGEN2   0x03

AS3990 register: receive options GEN2.

#define AS399X_REG_RXSPECIAL   0x09

AS3990 register: receive special settings.

#define AS399X_REG_RXSPECIAL2   0x0A

AS3990 register: receive special settings 2.

#define AS399X_REG_RXWAITTIME   0x08

AS3990 register: wait time after transmition until the receiver is enabled.

#define AS399X_REG_STATUSCTRL   0x00

AS3990 register: status control.

#define AS399X_REG_TESTSETTING   0x12

AS3990 register: chip version.

#define AS399X_REG_TRCALGEN2MISC   0x05

AS3990 register: TRcal and misc.

#define AS399X_REG_TRCALREGGEN2   0x04

AS3990 register: TRcal low.

#define AS399X_REG_TXLENGTHLOW   0x1E

AS3990 register: number of bytes to transmit (lower byte).

#define AS399X_REG_TXLENGTHUP   0x1D

AS3990 register: number of bytes to transmit (upper byte).

#define AS399X_REG_TXOPTGEN2   0x02

AS3990 register: transmit options GEN2.

#define AS399X_REG_TXREPLYDELAY   0x06

AS3990 register: delayed reply transmission wait time.

#define RESP_RXIRQ   AS399X_IRQ_RX

Indication that rx is done, corresponds to AS399X_IRQ_RX falling edge.

#define RESP_TXIRQ   AS399X_IRQ_TX

Indication that tx is done, corresponds to AS399X_IRQ_TX falling edge.


Function Documentation

void as399xCommandContinuousAddress ( u8 *  command,
u8  com_len,
u8  address,
u8 *  buf,
u8  buf_len 
)

Sends first some commands to the AS3990.

The number of commands is specified with the parameter com_len. Then it sets the address where the first byte has to be written and after that every byte from the buffer is written to the AS3990.

Parameters:
*command Pointer to the first byte of the command buffer
com_len Length of the command buffer.
address addressbyte
*buf Pointer to the first byte of the data array.
buf_len Length of the buffer.

void as399xContinuousRead ( u8  address,
s8  len,
u8 *  readbuf 
)

Reads data from a address and some following addresses from the AS3990.

The len parameter defines the number of address read.

Parameters:
address addressbyte
len Length of the buffer.
*readbuf Pointer to the first byte of the array where the data has to be stored in.

void as399xContinuousWrite ( u8  address,
u8 *  buf,
s8  len 
)

Continuous Write -> writes several bytes to subsequent addresses of the AS399X.


Parameters:
address addressbyte
*buf Pointer to the first byte of the array.
len Length of the buffer.

void as399xEnterDirectMode (  ) 

Enter the direct mode.

The direct mode is needed since the AS3991 doesn't support ISO18000-6B directly. Direct mode means that the MCU directly issues the commands. The AS3991 modulates the serial stream from the MCU and sends it out.

void as399xExitDirectMode (  ) 

Leave the direct mode.

After calling this function the AS3991 is in normal mode again.

void as399xFifoRead ( s8  len,
u8 *  readbuf 
)

Reads data from the fifo and some following addresses from the AS3990.

The len parameter defines the number of address read. Does this in a secure way so that it works also on AS3991 devices in serial mode

Parameters:
len Length of the buffer.
*readbuf Pointer to the first byte of the array where the data has to be stored in.

u8 as399xGetFIFOStatus ( void   ) 

This function is used to read the AS3990 AS399X_REG_FIFO status.


Returns:
The databyte read from the AS3990

u8 as399xGetIRQStatus ( void   ) 

This function is used to read the AS3990 IRQ status.


Returns:
The databyte read from the AS3990

void as399xSingleCommand ( u8  command  ) 

Sends only one command to the AS3990.


Parameters:
command The command which is send to the AS3990.

u8 as399xSingleRead ( u8  address  ) 

Single Read -> reads one byte from one address of the AS3990.


Parameters:
address The addressbyte
Returns:
The databyte read from the AS3990

void as399xSingleWrite ( u8  address,
u8  value 
)

Single Write -> writes one byte to one address of the AS3990.


Parameters:
address The addressbyte
value The databyte

void as399xWaitForResponse ( u16  waitMask  ) 

This function waits for the specified response(IRQ).

void as399xWaitForResponseTimed ( u16  waitMask,
u16  ms 
)

This function waits for the specified response(IRQ).

void as399xWritePredistortion ( const u8 *  buf  ) 

Write 252 byte predistortion data, preserving version register.

Parameters:
*buf Pointer to the first byte of the array.
len Length of the buffer.


Variable Documentation

volatile u16 as399xResponse

This variable is used as flag to signal an data reception.

It is a bit mask of the RESP_TXIRQ, RESP_RXIRQ, RESP_* values


Generated on Thu May 20 12:27:23 2013 for AS3992 UHF RFID Reader Firmware by  arm.eleckits.com 1.5.1