changeset 582:81753f5e902e

tpudrv12.c: l1dmacro_RF_sleep() and l1dmacro_RF_wakeup() done
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Fri, 15 Aug 2014 19:25:58 +0000
parents bbb1e73782e6
children ff1065828669
files gsm-fw/L1/tpudrv/tpudrv12.c
diffstat 1 files changed, 60 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/gsm-fw/L1/tpudrv/tpudrv12.c	Fri Aug 15 07:14:49 2014 +0000
+++ b/gsm-fw/L1/tpudrv/tpudrv12.c	Fri Aug 15 19:25:58 2014 +0000
@@ -740,47 +740,83 @@
    TPU_Reset(0);
    TP_Ptr = (UWORD16 *) TPU_RAM;
 
-   *TP_Ptr++ = TPU_MOVE(REG_SPI_ACT_U, TXM_SLEEP);
-   *TP_Ptr++ = TPU_MOVE(REG_SPI_ACT_L, TXM_SLEEP);
-   MOVE_REG_TSP_TO_RF(START_SCRIPT(DRP_IDLE),((UWORD16)( ((UWORD32)(&drp_regs->SCRIPT_STARTL))&0xFFFF)));
+   *TP_Ptr++ = TPU_MOVE(TSP_ACT, 0x01);
+   *TP_Ptr++ = TPU_MOVE(TSP_ACT, 0x17);
 
    *TP_Ptr++ = TPU_OFFSET(servingCellOffset);
-
 }
 
 //  l1dmacro_RF_sleep
 //  Program RF for BIG or DEEP sleep
 
 
+/* Rita version differs from LoCosto, reconstructing from disassembly */
 void l1dmacro_RF_sleep  (void)
 {
-  // sending REG_OFF script
-   MOVE_REG_TSP_TO_RF(START_SCRIPT(DRP_REG_OFF), ((UWORD16)( ((UWORD32)(&drp_regs->SCRIPT_STARTL))&0xFFFF)));
-
-  *TP_Ptr++ = TPU_MOVE(REG_SPI_ACT_U, TXM_SLEEP);  //Shutdown FEM
-
-  *TP_Ptr++ = TPU_SLEEP;
-   TP_Ptr = (SYS_UWORD16 *) TPU_RAM;
-   TP_Enable(1);
-   TPU_wait_idle();
-
+	TSP_TO_RF(0x0002);
+	*TP_Ptr++ = TPU_MOVE(TSP_ACT, 0x01);
+	*TP_Ptr++ = TPU_WAIT(1);
+	*TP_Ptr++ = TPU_MOVE(TSP_SPI_SET1, 0x21);
+	*TP_Ptr++ = TPU_MOVE(TSP_SPI_SET2, 0x02);
+	*TP_Ptr++ = TPU_MOVE(TSP_CTRL1, 0x41);
+	*TP_Ptr++ = TPU_MOVE(TSP_CTRL2, 0x02);
+	*TP_Ptr++ = TPU_WAIT(100);
+	/* code from tpudrv61.c follows, same for Rita and LoCosto */
+	*TP_Ptr++ = TPU_SLEEP;
+	TP_Ptr = (SYS_UWORD16 *) TPU_RAM;
+	TP_Enable(1);
+	/*
+	 * The following call does not appear in tpudrv12.obj, and
+	 * there is no TPU_wait_idle() function in Leonardo tpudrv.obj
+	 * either.  But this wait operation makes sense to me, so
+	 * I'm keeping it as-is from the LoCosto version for now.
+	 * -- Space Falcon
+	 */
+	TPU_wait_idle();
 }
 
-
 //  l1dmacro_RF_wakeup
 //* wakeup RF from BIG or DEEP sleep
 
+/* Rita version differs from LoCosto, reconstructing from disassembly */
 void l1dmacro_RF_wakeup  (void)
 {
-   // sending REG_ON script
-   MOVE_REG_TSP_TO_RF(START_SCRIPT(DRP_REG_ON), ((UWORD16)( ((UWORD32)(&drp_regs->SCRIPT_STARTL))&0xFFFF)));
-
-   *TP_Ptr++ = TPU_SLEEP;
-   TP_Ptr = (SYS_UWORD16 *) TPU_RAM;
-   TP_Enable(1);
-   TPU_wait_idle();
-
-
+	TP_Ptr = (SYS_UWORD16 *) TPU_RAM;
+	*TP_Ptr++ = TPU_MOVE(TSP_SPI_SET1, 0x01);
+	*TP_Ptr++ = TPU_MOVE(TSP_SPI_SET2, 0x06);
+	*TP_Ptr++ = TPU_MOVE(TSP_CTRL1, 0x41);
+	*TP_Ptr++ = TPU_MOVE(TSP_CTRL2, 0x02);
+	*TP_Ptr++ = TPU_WAIT(100);
+	*TP_Ptr++ = TPU_MOVE(TSP_ACT, rf_path[rf_index].rx_down | 0x01);
+	*TP_Ptr++ = TPU_WAIT(1);
+	*TP_Ptr++ = TPU_MOVE(TSP_ACT, rf_path[rf_index].rx_down);
+	*TP_Ptr++ = TPU_WAIT(8);
+	*TP_Ptr++ = TPU_MOVE(TSP_ACT, rf_path[rf_index].rx_down | 0x01);
+	*TP_Ptr++ = TPU_WAIT(5);
+	TSP_TO_RF(0x0012);
+	*TP_Ptr++ = TPU_FAT(0);
+	*TP_Ptr++ = TPU_FAT(0);
+	*TP_Ptr++ = TPU_FAT(0);
+	*TP_Ptr++ = TPU_FAT(0);
+	*TP_Ptr++ = TPU_FAT(0);
+	*TP_Ptr++ = TPU_FAT(0);
+	TSP_TO_RF(0x003A);
+	*TP_Ptr++ = TPU_WAIT(7);
+	TSP_TO_RF(0xC003);
+	*TP_Ptr++ = TPU_WAIT(7);
+	TSP_TO_RF(0x02FE);
+	*TP_Ptr++ = TPU_WAIT(7);
+	TSP_TO_RF(0x401F);
+	*TP_Ptr++ = TPU_WAIT(7);
+	TSP_TO_RF(0x043D);
+	*TP_Ptr++ = TPU_WAIT(7);
+	*TP_Ptr++ = TPU_WAIT(117);
+	/* code from tpudrv61.c follows, same for Rita and LoCosto */
+	*TP_Ptr++ = TPU_SLEEP;
+	TP_Ptr = (SYS_UWORD16 *) TPU_RAM;
+	TP_Enable(1);
+	/* same issue as in the previous function */
+	TPU_wait_idle();
 }