74 #define SESSION_GEN2 1
76 #define SESSION_ISO6B 2
84 #define POWER_NORMAL 1
86 #define POWER_NORMAL_RF 2
88 #define POWER_STANDBY 3
90 #if APPLDEBUG && (USE_LOGGER == LOGGER_ON)
92 #define APPLOGDUMP dbgHexDump
95 #define APPLOGDUMP(...)
125 #if FEMTO2 || FEMTO2_1 || RADON || (NEWTON && !RUN_ON_AS3980 )
227 #ifdef ANTENNA_SWITCH
229 #if RADON || FEMTO2 || FEMTO2_1 || NEWTON
256 void configTxRx(
void);
257 void readerConfig(
void);
258 void antennaPower(
void);
259 void antennaTuner(
void);
260 void autoTuner(
void);
261 void tunerTable(
void);
262 u8 inventoryGen2(
void);
264 void wrongCommand(
void);
265 void initCommands(
void);
267 void selectTag(
void);
268 void writeToTag(
void);
269 void readFromTag(
void);
270 void executeGenericCommand(
void);
271 void executeRSSICMD(
void);
272 void lockUnlockTag(
void);
273 static void hopChannelRelease(
void);
274 static s8 hopFrequencies(
void);
281 static void applyTunerSettingForFreq(u32 freq);
294 APPLOG(
"allocation timeout\n");
313 if (currentSession == newSession)
return;
314 switch (currentSession)
336 currentSession = newSession;
348 void wrongCommand(
void)
351 APPLOG(
"WRONG COMMAND\n");
355 void performSelects()
365 #define POWER_AND_SELECT_TAG() do{ status = hopFrequencies(); if (status) goto exit; powerAndSelectTag(); if(num_of_tags==0){status=GEN2_ERR_SELECT;goto exit;}}while(0)
367 static int powerAndSelectTag(
void )
377 APPLOG(
"Could not select tag\n");
381 selectedTag = tags_+1;
407 void antennaPower(
void)
425 APPLOG(
"ANTENNA ERROR\n");
430 cmdBuffer.txSize = CMD_ANTENNA_POWER_REPLY_SIZE;
510 void antennaTuner(
void)
514 memset(
cmdBuffer.txData, 0, CMD_ANTENNA_TUNER_REPLY_SIZE);
517 if (
cmdBuffer.rxData[0] && mainTuner.cinSenFn)
520 if (tunerParams.cin > 31)
521 tunerParams.cin = 31;
524 if (
cmdBuffer.rxData[2] && mainTuner.clenSenFn)
527 if (tunerParams.clen > 31)
528 tunerParams.clen = 31;
531 if (
cmdBuffer.rxData[4] && mainTuner.coutSenFn)
534 if (tunerParams.cout > 31)
535 tunerParams.cout = 31;
538 APPLOG(
"receive main tuner parameters cin= %hhx, clen= %hhx cout=%hhx\n", tunerParams.cin, tunerParams.clen, tunerParams.cout);
540 if (
cmdBuffer.rxData[6] && ant1Tuner.cinSenFn)
542 tunerAnt1Params.cin =
cmdBuffer.rxData[7];
543 if (tunerAnt1Params.cin > 31)
544 tunerAnt1Params.cin = 31;
547 if (
cmdBuffer.rxData[8] && ant1Tuner.clenSenFn)
549 tunerAnt1Params.clen =
cmdBuffer.rxData[9];
550 if (tunerAnt1Params.clen > 31)
551 tunerAnt1Params.clen = 31;
554 if (
cmdBuffer.rxData[10] && ant1Tuner.coutSenFn)
556 tunerAnt1Params.cout =
cmdBuffer.rxData[11];
557 if (tunerAnt1Params.cout > 31)
558 tunerAnt1Params.cout = 31;
561 APPLOG(
"receive ant1 tuner parameters cin= %hhx, clen= %hhx cout=%hhx\n", tunerAnt1Params.cin, tunerAnt1Params.clen, tunerAnt1Params.cout);
569 cmdBuffer.txData[7] = tunerAnt1Params.cin;
570 cmdBuffer.txData[9] = tunerAnt1Params.clen;
571 cmdBuffer.txData[11]= tunerAnt1Params.cout;
572 APPLOG(
"send ant1 tuner parameters cin= %hhx, clen= %hhx cout=%hhx\n", tunerAnt1Params.cin, tunerAnt1Params.clen, tunerAnt1Params.cout);
574 cmdBuffer.txSize = CMD_ANTENNA_TUNER_REPLY_SIZE;
575 APPLOG(
"send main tuner parameters cin= %hhx, clen= %hhx cout=%hhx\n", tunerParams.cin, tunerParams.clen, tunerParams.cout);
579 cmdBuffer.txSize = CMD_ANTENNA_TUNER_REPLY_SIZE;
632 params = &tunerParams;
637 APPLOG(
"tune antenna, algorithm: %hhx, id=%hhx\n",
cmdBuffer.rxData[0],tuner_id);
644 params = &tunerAnt1Params;
673 cmdBuffer.txSize = CMD_AUTO_TUNER_REPLY_SIZE;
674 APPLOG(
"send tune parameters cin= %hhx, clen= %hhx cout=%hhx\n", params->cin, params->clen, params->cout);
680 cmdBuffer.txSize = CMD_AUTO_TUNER_REPLY_SIZE;
692 u16 iq1 = 0, iq2 = 0;
696 freq += ((
long)
cmdBuffer.rxData[2]) << 8;
697 freq += ((long)
cmdBuffer.rxData[3]) << 16;
699 idx = tuningTable.tableSize;
702 tuningTable.freq[idx] = freq;
703 tuningTable.tuneEnable[idx] = 0;
707 tuningTable.tuneEnable[idx] += 1;
708 tuningTable.cin[0][idx] =
cmdBuffer.rxData[5];
709 tuningTable.clen[0][idx] =
cmdBuffer.rxData[6];
710 tuningTable.cout[0][idx] =
cmdBuffer.rxData[7];
713 tuningTable.tunedIQ[0][idx] = iq1;
718 tuningTable.tuneEnable[idx] += 2;
719 tuningTable.cin[1][idx] =
cmdBuffer.rxData[11];
720 tuningTable.clen[1][idx] =
cmdBuffer.rxData[12];
721 tuningTable.cout[1][idx] =
cmdBuffer.rxData[13];
724 tuningTable.tunedIQ[1][idx] = iq2;
726 if (tuningTable.tuneEnable[idx] > 0)
727 tuningTable.tableSize++;
729 APPLOG(
"add tunetable f=%x%x, tablesize=%hhx, tune1=%hhx cin1=%hhx clen1=%hhx cout1=%hhx iq1=%hx "
730 "tune2=%hhx cin2=%hhx clen2=%hhx cout2=%hhx iq2=%hx\n", freq, tuningTable.tableSize,
734 if (tuningTable.tableSize >=
MAXTUNE)
736 tuningTable.tableSize =
MAXTUNE;
740 return tuningTable.tableSize;
885 void tunerTable(
void)
889 memset(
cmdBuffer.txData, 0, CMD_TUNER_TABLE_REPLY_SIZE);
899 cmdBuffer.txData[2] = tuningTable.tableSize;
903 APPLOG(
"delete tuning table tablesize= %hhx\n", tuningTable.tableSize);
904 tuningTable.currentEntry = 0;
905 tuningTable.tableSize = 0;
924 cmdBuffer.txSize = CMD_TUNER_TABLE_REPLY_SIZE;
927 cmdBuffer.txSize = CMD_ANTENNA_TUNER_REPLY_SIZE;
1000 void readerConfig(
void)
1003 APPLOG(
"readerConfig\n");
1020 memset(
cmdBuffer.txData, 0xFF, CMD_READER_CONFIG_REPLY_SIZE);
1052 #ifdef ANTENNA_SWITCH
1083 if (
cmdBuffer.txSize > CMD_READER_CONFIG_REPLY_SIZE)
1084 cmdBuffer.txSize = CMD_READER_CONFIG_REPLY_SIZE;
1110 *txSize = WRITE_REG_REPLY_SIZE;
1131 *txSize = READ_REG_REPLY_SIZE;
1196 APPLOG(
"configTxParams\n");
1200 #ifdef ANTENNA_SWITCH
1212 cmdBuffer.txSize = CMD_CONFIG_TX_RX_REPLY_SIZE;
1215 #ifdef ANTENNA_SWITCH
1227 if (currentSession ==
SESSION_GEN2) currentSession = 0;
1242 memset(
cmdBuffer.txData, 0, CMD_GEN2_SETTINGS_REPLY_SIZE);
1243 cmdBuffer.txSize = CMD_GEN2_SETTINGS_REPLY_SIZE;
1400 APPLOG(
"READ registers complete\n");
1403 for ( i = 0; i < 0x3f; i++)
1407 || (i > 0x1D && i < 0x22)
1408 || (i > 0x22 && i < 0x29)
1409 || (i > 0x2E && i < 0x33)
1423 static void initTagInfo()
1430 for (i = 0; i <
sizeof(
tags_) ; i ++)
1459 unsigned char word_data[8];
1461 memcpy(&word_data, &
cmdBuffer.rxData[i+1], 8);
1463 APPLOG(
"call 6b Inventory\n");
1481 memcpy(&
cmdBuffer.txData[1 + (i-1)*8],tags_[i-1].
epc,8);
1512 unsigned char word_data[8];
1513 unsigned char uid[8];
1516 APPLOG(
"call 6b Read \n");
1531 cmdBuffer.txSize = CMD_READ_FROM_TAG_6B_REPLY_SIZE;
1535 cmdBuffer.txSize = CMD_READ_FROM_TAG_6B_REPLY_SIZE;
1556 unsigned char response[1];
1557 unsigned char uid[8];
1560 APPLOG(
"call 6b Write \n");
1581 cmdBuffer.txSize = CMD_WRITE_TO_TAG_6B_REPLY_SIZE;
1596 foundTags = inventoryGen2();
1598 APPLOG(
"inventory Gen2, found tags: %hhx\n", foundTags);
1677 u8 inventoryGen2(
void)
1680 s8 (*followTagCommand)(
Tag *tag) = NULL;
1685 result = hopFrequencies();
1718 hopChannelRelease();
1852 cmdBuffer.txSize = CMD_SELECT_REPLY_SIZE;
1862 void selectTag(
void)
1910 APPLOG(
"SELECT Tag target\n");
1917 cmdBuffer.txSize = CMD_SELECT_REPLY_SIZE;
1947 u8 writeTagMem(u32 memAdress,
Tag const * tag, u8
const * data_buf, u8 data_length_words, u8 mem_type, s8* status, u8* tag_error)
1952 APPLOG(
"len=%hhx\n",data_length_words);
1954 while (length < data_length_words)
1960 error =
gen2WriteWordToTag(tag, mem_type, memAdress + length, &data_buf[2*length], tag_error);
1962 if (error) delay_ms(20);
1977 void writeToTag(
void)
1982 u32 address = readU32FromLittleEndianBuffer(&
cmdBuffer.rxData[1]);
1985 APPLOG(
"WRITE TO Tag\n");
1987 POWER_AND_SELECT_TAG();
1993 APPLOG(
"no need to access Tag\n");
1998 APPLOG(
"need to access Tag");
2001 APPLOG(
" -> suceeded\n");
2010 len = writeTagMem(address, selectedTag,
cmdBuffer.rxData+9,
2011 datalen, membank, &status,
cmdBuffer.txData + 1);
2015 hopChannelRelease();
2016 cmdBuffer.txSize = CMD_WRITE_TO_TAG_REPLY_SIZE;
2021 #define RNDI 7 //index of first random value in buffer
2022 static void pseudoRandomContinuousModulation()
2024 static u8 bufferIndex = 0;
2030 rnd ^= (
cmdBuffer.rxData[RNDI+bufferIndex*2] | (
cmdBuffer.rxData[RNDI+bufferIndex*2+1]<<8));
2034 if (bufferIndex > 5)
2039 buf[0] = (rnd & 0x7F);
2041 buf[0] = (rnd & 0xFF);
2043 buf[1] = (rnd >> 8) & 0xFF;
2179 u16 reflectedValues = 0;
2184 freq += ((u32)
cmdBuffer.rxData[2]) << 8;
2185 freq += ((u32)
cmdBuffer.rxData[3]) << 16;
2187 APPLOG(
"CHANGE FREQ f=%x%x, subcmd=%hhx\n", freq,
cmdBuffer.rxData[0]);
2194 if (
cmdBuffer.rxSize < CMD_CHANGE_FREQ_RSSI_RX_SIZE)
2216 cmdBuffer.txData[1] = ((rssiValues >> 4) & 0xf);
2230 if (
cmdBuffer.rxSize < CMD_CHANGE_FREQ_REFL_RX_SIZE)
2241 applyTunerSettingForFreq(freq);
2250 cmdBuffer.txData[0] = (reflectedValues & 0xff) - (noiseLevel & 0xff);
2251 cmdBuffer.txData[1] = ((reflectedValues >> 8)&0xff) - ((noiseLevel >> 8)&0xff);
2258 if (
cmdBuffer.rxSize < CMD_CHANGE_FREQ_ADD_RX_SIZE)
2310 if (
cmdBuffer.rxSize < CMD_CHANGE_FREQ_SETHOP_RX_SIZE)
2348 if (
cmdBuffer.rxSize < CMD_CHANGE_FREQ_CONTMOD_RX_SIZE)
2355 u8 rxnorespwait, rxwait;
2358 u8 txbuf[] = {0x9E, 0x9E};
2360 APPLOG(
"continuous modulation, duration: %hx\n", time_ms);
2377 pseudoRandomContinuousModulation();
2387 as3993ClrResponse();
2393 APPLOG(
"finished sending \n");
2407 APPLOG(
"changeFreq finished, reply data: \n");
2440 void readFromTag(
void)
2444 u32 wrdPtr = readU32FromLittleEndianBuffer(&
cmdBuffer.rxData[1]);
2446 u8 rxed = CMD_ERROR_REPLY_SIZE;
2448 APPLOG(
"READ FROM Tag\n");
2449 APPLOG(
"membank = %hhx\n", membank);
2450 APPLOG(
"wrdptr = %hx%hx\n", wrdPtr);
2451 APPLOG(
"raw datalen = %hhx\n", datalen);
2455 POWER_AND_SELECT_TAG();
2462 APPLOG(
"no need to access Tag\n");
2467 APPLOG(
"need to access Tag");
2470 APPLOG(
" -> suceeded\n");
2474 APPLOG(
" -> failed status: %hhx\n", status);
2487 if (ERR_CHIP_HEADER == status)
2504 if (ERR_CHIP_HEADER == status)
2514 hopChannelRelease();
2517 APPLOG(
"read finished, status: %hhx rxed: %hhx\n", status, rxed);
2540 void lockUnlockTag(
void)
2548 POWER_AND_SELECT_TAG();
2555 APPLOG(
"no need to access Tag\n");
2560 if (status!=0)
goto exit;
2561 APPLOG(
"need to access Tag");
2562 if (status==0)
APPLOG(
" access suceeded\n");
2563 else APPLOG(
" access failed\n");
2566 APPLOG(
"LOCK UNLOCK Tag: mask_and_action %hhx %hhx %hhx \n", mask[0],mask[1],mask[2]);
2570 if (status) delay_ms(20);
2571 hopChannelRelease();
2606 POWER_AND_SELECT_TAG();
2611 if (status) delay_ms(20);
2612 hopChannelRelease();
2613 cmdBuffer.txSize = CMD_KILL_TAG_REPLY_SIZE;
2653 cmdBuffer.txSize = CMD_START_STOP_REPLY_SIZE;
2686 executeGenericCommand();
2689 void executeGenericCommand()
2692 u16 toTagSize, fromTagSize;
2693 u8 toTagBuffer[200];
2695 u16 dataBytes, leftBits, startBytehandle;
2696 u16 receivedBytes=CMD_ERROR_REPLY_SIZE;
2702 POWER_AND_SELECT_TAG();
2706 APPLOG(
"no need to access Tag\n");
2711 APPLOG(
"need to access Tag");
2714 APPLOG(
" -> suceeded\n");
2718 APPLOG(
" -> failed status: %hhx\n", status);
2730 dataBytes = (toTagSize - 16 + 7)/8 ;
2731 leftBits = (dataBytes * 8) -(toTagSize-16);
2732 startBytehandle = dataBytes - 1;
2733 if ( leftBits == 0 )
2745 receivedBytes = (fromTagSize+7)/8 + 2;
2746 APPLOG(
"fromTagBuf: status: %hhx txed: %hhx\n", status, fromTagSize);
2750 hopChannelRelease();
2756 void callRSSIMeasureCMD(
void)
2763 void executeRSSICMD()
2772 freq += ((u32)
cmdBuffer.rxData[1]) << 8;
2773 freq += ((u32)
cmdBuffer.rxData[2]) << 16;
2775 APPLOG(
"RSSI CMD f=%x%x\n", freq);
2802 void initCommands(
void)
2815 #ifdef ANTENNA_SWITCH
2823 static void applyTunerSettingForFreq(u32 freq)
2826 unsigned long int diff, best;
2828 if (tuningTable.tableSize == 0)
2834 for(i=0; i<tuningTable.tableSize; i++)
2837 if (tuningTable.freq[i] > freq)
2838 diff = tuningTable.freq[i] - freq;
2840 diff = freq - tuningTable.freq[i];
2848 tuningTable.currentEntry = idx;
2851 tunerSetTuning(&mainTuner, tuningTable.cin[usedAntenna - 1][idx],
2852 tuningTable.clen[usedAntenna - 1][idx],
2853 tuningTable.cout[usedAntenna - 1][idx]);
2854 APPLOG(
"***** apply tune f=%x%x, idx=%hhx, tune1=%hhx cin=%hhx clen=%hhx cout=%hhx\n", freq, idx,
2855 tuningTable.tuneEnable[idx], tuningTable.cin[usedAntenna-1][idx],
2856 tuningTable.clen[usedAntenna-1][idx], tuningTable.cout[usedAntenna-1][idx]);
2857 tunerParams.cin = tuningTable.cin[usedAntenna - 1][idx];
2858 tunerParams.clen = tuningTable.clen[usedAntenna - 1][idx];
2859 tunerParams.cout = tuningTable.cout[usedAntenna - 1][idx];
2865 static s8 hopFrequencies(
void)
2872 u8 regValRFOutput = 0;
2902 if ( ++currentFreqIdx >=
Frequencies.numFreqs ) currentFreqIdx = 0;
2911 rssiIQsum = (rssi&0x0f) + (rssi>>4);
2926 if ( ++currentFreqIdx >=
Frequencies.numFreqs ) currentFreqIdx = 0;
2930 if ( ++currentFreqIdx >=
Frequencies.numFreqs ) currentFreqIdx = 0;
2940 applyTunerSettingForFreq(
Frequencies.freq[currentFreqIdx]);
2962 REFLPOWERTOOHIGHLED(LEDON);
2968 APPLOG(
"hopFrequencies failed: reflected power too high: %hx > %hx\n",refl,6032);
2969 return ERR_REFLECTED_POWER;
2973 REFLPOWERTOOHIGHLED(LEDOFF);
2985 APPLOG(
"countFreqHop has reached %hhx\n",
Frequencies.countFreqHop[currentFreqIdx]);
2986 APPLOG(
"old reflected power: %hx\n", tuningTable.tunedIQ[
usedAntenna-1][tuningTable.currentEntry]);
2987 APPLOG(
"measured reflected power: %hx\n", refl);
2995 APPLOG(
"redo tuning, old cin: %hhx, clen: %hhx, cout: %hhx\n", tuningTable.cin[
usedAntenna-1][tuningTable.currentEntry],
2996 tuningTable.clen[
usedAntenna-1][tuningTable.currentEntry], tuningTable.cout[
usedAntenna-1][tuningTable.currentEntry]);
2997 APPLOG(
"new values cin: %hhx, clen: %hhx, cout: %hhx, iq: %hx\n", tunerParams.cin,
2998 tunerParams.clen, tunerParams.cout, tunerParams.reflectedPower);
2999 tuningTable.cin[
usedAntenna-1][tuningTable.currentEntry] = tunerParams.cin;
3000 tuningTable.clen[
usedAntenna-1][tuningTable.currentEntry] = tunerParams.clen;
3001 tuningTable.cout[
usedAntenna-1][tuningTable.currentEntry] = tunerParams.cout;
3002 tuningTable.tunedIQ[
usedAntenna-1][tuningTable.currentEntry] = tunerParams.reflectedPower;
3018 APPLOG(
"hopFrequencies failed: did not find a free channel\n");
3023 static void hopChannelRelease(
void)
3324 u8
commands( u8 protocol, u16 rxSize,
const u8 * rxData, u16 * txSize, u8 * txData )
3326 APPLOG(
"%hhxI\n", protocol);
3330 if (protocol >= CALL_FKT_SIZE)
3332 APPLOG(
"invalid command:ERR_REQUEST\n");
3341 if (rxSize <
call_fkt_[protocol].min_rx_size)
3343 APPLOG(
"commands(%hhx):ERR_REQUEST %hx < %hx\n",protocol,rxSize,
call_fkt_[protocol].min_rx_size);
3346 if (*txSize <
call_fkt_[protocol].min_tx_size)
3348 APPLOG(
"commands(%hhx):ERR_PARAM %hx < %hx\n",protocol,*txSize,
call_fkt_[protocol].min_tx_size);
3356 APPLOG(
"commands execution finished len:%hhx, replyError:%hhx\n\n", *txSize,
cmdBuffer.result);
3360 #define SENDTAGHEADER 3
3361 #define SENDNOTAGINFO 7
3362 #define SENDTAGFIXDATALEN 8
3363 #define SENDTAGMINLEN (SENDTAGHEADER + SENDTAGFIXDATALEN)
3390 u8
sendTagData( u8 * protocol, u16 * txSize, u8 * txData, u16 remainingSize )
3392 static u8 element = 0;
3400 if (remainingSize < SENDTAGMINLEN)
3418 *txSize = SENDNOTAGINFO;
3423 *txSize = SENDTAGHEADER;
3425 offset = SENDTAGHEADER;
3428 if (remainingSize < (*txSize + SENDTAGMINLEN + tags_[element].epclen))
3436 *txSize += SENDTAGFIXDATALEN + tags_[element].
epclen;
3437 txData[offset+0] = tags_[element].
agc;
3438 txData[offset+1] = tags_[element].
rssi;
3442 txData[offset+5] = tags_[element].
epclen + 2;
3443 txData[offset+6] = tags_[element].
pc[0];
3444 txData[offset+7] = tags_[element].
pc[1];
3445 memcpy(&txData[offset+8], tags_[element].epc, tags_[element].epclen);
3449 txData[offset+8+tags_[element].
epclen] = tags_[element].tidlength;
3450 memcpy(&txData[offset+8+tags_[element].epclen+1], tags_[element].tid, tags_[element].tidlength);
3451 offset += tags_[element].tidlength+1;
3452 *txSize += tags_[element].tidlength+1;
3454 offset += SENDTAGFIXDATALEN + tags_[element].
epclen;
3457 APPLOG(
"all tags sent, len: %hhx , elem: %hhx , numTags: %hhx\n", *txSize, element,
num_of_tags);
3499 _LATB2 = (
cmdBuffer.rxData[1] & 0x02) >> 1;
3507 APPLOG(
"not available\n");
3544 int wQAdjustParamsMode =
cmdBuffer.rxData[3];
3545 int wScanTuningParamsMode =
cmdBuffer.rxData[8];
3551 if (wDelayMode == 1)
3553 APPLOG(
"Change Delay \n");
3558 if (wQAdjustParamsMode == 1)
3560 APPLOG(
"Change Query Adjust Parameters \n");
3567 if (wScanTuningParamsMode == 1)
3569 APPLOG(
"Change Scan Tuning interval \n");
3620 APPLOG(
"first 4 Words correctly read");
3632 if ( (ret !=
ERR_NONE) && !((ret == ERR_CHIP_HEADER) && (tag->
tid[wordPtr*2])== 0x03))
3638 else if ( (ret == ERR_CHIP_HEADER) && (tag->
tid[0] == 0x03) )
3640 APPLOG(
"ERROR Headerbit=%hhx\n", tag->
tid[0]);
3649 if ( (ret !=
ERR_NONE) && !((ret == ERR_CHIP_HEADER) && (tag->
tid[wordPtr*2])== 0x03))
3676 APPLOG(
"slots:%x; tags: %x", slots, num_of_tags);
3682 else if (((
double)slots/2) > (2.0 * num_of_tags) && (
gen2qbegin > 0) )
static u8 adjustmentUpThreshold
static void checkAndSetSession(u8 newSession)
void callConfigTxRx(void)
s8 as3993TxRxGen2Bytes(u8 cmd, u8 *txbuf, u16 txbits, u8 *rxbuf, u16 *rxbits, u8 norestime, u8 followCmd, u8 waitTxIrq)
void callInventory6B(void)
s8 iso6bWrite(u8 *uid, u8 addr, u8 data, u8 *buffer)
Issue WRITE command according to ISO18000-6 to write a specified number of bytes to a memory location...
ISO6B protocol header file.
void as3993EnterPowerStandbyMode()
Enter the standby power down mode: EN is high, stby is high and rf_on bit is low. ...
u16 as3993GetReflectedPowerNoiseLevel(void)
Main error codes. Please add your application specific error codes in your application starting with ...
Declaration of low level functions provided by the as3993 series chips.
void callReadFromTag6B(void)
s8 gen2LockTag(Tag *tag, const u8 *mask_action, u8 *tag_reply)
struct callFunction call_fkt_[CALL_FKT_SIZE]
static struct CmdBuffer cmdBuffer
This file provides declarations for tuner related functions.
void as3993EnterPowerNormalMode()
Enter the normal power mode: EN is high, stby and rf_on bits are low.
void insertBitStream(u8 *dest, u8 const *source, u8 len, u8 bitpos)
void callWriteToTag6B(void)
s8 gen2KillTag(Tag const *tag, u8 const *password, u8 rfu, u8 recom, u8 *tag_error)
static struct gen2Config gen2Configuration
void callAntennaPower(void)
unsigned gen2SearchForTags(Tag *tags_, u8 maxtags, u8 q, u8 addRounds, u8 queryAdjustUpTh, u8 queryAdjustDownTh, BOOL(*cbContinueScanning)(void), BOOL singulate, BOOL toggleSession, s8(*followTagCommand)(Tag *tag))
int doCyclicInventory(void)
static u8 readerPowerDownMode
This file provides declarations for global helper functions.
s8 iso6bRead(u8 *uid, u8 addr, u8 *buffer)
Issue READ command according to ISO18000-6 and stores the result in a buffer.
static TuningTable tuningTable __attribute__((far))
static u8 adjustmentRounds
void tunerOneHillClimb(const TunerConfiguration *config, TunerParameters *p, u16 maxSteps)
unsigned gen2SearchForTagsAutoAck(Tag *tags_, u8 maxtags, u8 q, BOOL(*cbContinueScanning)(void), BOOL singulate, BOOL toggleSession, s8(*followTagCommand)(Tag *tag))
This file is the include file for the timer.c file.
static void powerDownReader(void)
void callLockUnlockTag(void)
void gen2Close(void)
Close a session.
s8 gen2AccessTag(Tag const *tag, u8 const *password)
s8 as3993GetSensitivity()
void callTunerTable(void)
static BOOL continueCheckTimeout()
static u8 cyclicInventory
void tunerMultiHillClimb(const TunerConfiguration *config, TunerParameters *res)
static u8 adjustmentDownThreshold
void callInventoryGen2(void)
void as3993SingleWrite(u8 address, u8 value)
void callWriteToTag(void)
static u16 inventoryDelay
void callInventoryGen2Internal()
s8 gen2QueryMeasureRSSI(u8 *agc, u8 *log_rssis, s8 *irssi, s8 *qrssi)
Perform a gen2 QUERY command and measure received signal strength.
s8 gen2WriteWordToTag(Tag const *tag, u8 memBank, u32 wordPtr, u8 const *databuf, u8 *tag_error)
void iso6bClose()
Close a session.
void as3993SetBaseFrequency(u8 regs, u32 frequency)
void gen2Select(struct gen2SelectParams *p)
static u16 scanTuningInterval
void iso6bOpen()
Open a session.
static u8 maxSendingLimitTimedOut
void callGenericCommand(void)
void tunerSetTuning(const TunerConfiguration *config, u8 cin, u8 clen, u8 cout)
void as3993EnterPowerNormalRfMode()
Enter the normal power mode with rf on. EN is high, stby bit is low and rf_on bit is high...
static struct gen2SelectParams selParams[MAX_SELECTS]
void as3993AntennaPower(u8 on)
static u8 tagDataAvailable
u8 readRegister(u8 addr, u16 *txSize, u8 *txData)
void tunerTraversal(const TunerConfiguration *config, TunerParameters *res)
void callConfigGen2(void)
u8 readRegisters(u16 *txSize, u8 *txData)
static u8 readTIDinInventoryRound
Configuration file for all AS99x firmware.
void callReadFromTag(void)
static s8 inventoryResult
void callWrongCommand(void)
static u16 maxSendingTime
void tunerSetCap(const TunerConfiguration *config, u8 component, u8 val)
static u8 guiActiveProfile
void gen2Open(const struct gen2Config *config)
Open a session.
void as3993SingleCommand(u8 command)
static void powerUpReader(void)
void callReaderConfig(void)
u8 as3993SingleRead(u8 address)
u16 as3993GetReflectedPower(void)
This file is the include file for the appl_commands.c file.
u8 commands(u8 protocol, u16 rxSize, const u8 *rxData, u16 *txSize, u8 *txData)
serial output log declaration file
u16 tunerGetReflected(void)
s8 iso6bInventoryRound(Tag *tags, u8 maxtags, u8 mask, u8 *filter, u8 startaddress)
Declaration of public functions provided by the AS3993 series chips.
void as3993ExitPowerStandbyMode()
Exit the standby power down mode.
static u16 currentFreqIdx
void as3993ExitPowerNormalMode()
Exit the normal power mode.
#define CMD_INVENTORY_GEN2
static u8 addToTuningTable(void)
u8 sendTagData(u8 *protocol, u16 *txSize, u8 *txData, u16 remainingSize)
static u16 maxSendingLimit
void as3993EnterPowerDownMode()
Enter the power down mode by setting EN pin to low, saving registers beforehand.
static void adaptSlotCounter(int num_of_tags)
void callInventoryParams(void)
static u8 scanRetuningLevel
This file provides declarations for functions for the GEN2 aka ISO6c protocol.
#define GEN2_ERR_CHANNEL_TIMEOUT
void callAntennaTuner(void)
void as3993ExitPowerDownMode()
Exit the power down mode by setting EN pin to high, restoring registers afterwards.
void as3993ExitPowerNormalRfMode()
Exit the normal power mode with rf on.
s8 gen2ReadFromTag(Tag *tag, u8 memBank, u32 wordPtr, u8 wordCount, u8 *destbuf)
void callChangeFreq(void)
u8 writeRegister(u8 addr, u8 value, u16 *txSize, u8 *txData)