changeset 18:80c8857ce1c7

ABB init hooked in
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 15 May 2020 05:23:20 +0000
parents 9a8a20d45be7
children 399779c700da
files components/main src/cs/system/main/abb_init.c src/cs/system/main/main.c
diffstat 3 files changed, 71 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/components/main	Fri May 15 04:54:15 2020 +0000
+++ b/components/main	Fri May 15 05:23:20 2020 +0000
@@ -56,7 +56,7 @@
 c_file $SRCDIR/init.c
 c_file $SRCDIR/create_RVtasks.c
 c_file $SRCDIR/main.c
-c_file $SRCDIR/sys_dummy.c
+c_file $SRCDIR/abb_init.c
 
 # a couple of assembly modules for the gcc-built version
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/cs/system/main/abb_init.c	Fri May 15 05:23:20 2020 +0000
@@ -0,0 +1,66 @@
+/*
+ * This module is a small extract from TI's l1_init.c,
+ * containing the function that initializes access to the ABB.
+ */
+
+#include <string.h>
+#include "l1_types.h"
+#include "sys_types.h"
+#include "spi_drv.h"
+#include "abb.h"
+
+#include "mem.h"
+#include "inth.h"
+#include "dma.h"
+#include "iq.h"
+
+#include "clkm.h"
+#include "rhea_arm.h"
+#include "ulpd.h"
+
+/*-------------------------------------------------------*/
+/* l1_abb_power_on()                                     */
+/*-------------------------------------------------------*/
+/* Parameters :                                          */
+/* Return     :                                          */
+/* Functionality :                                       */
+/* Initialize the global structure for spi communication */
+/* with ABB.                                             */
+/* Set up ABB connection (CLK 13M free)                  */
+/* Aknowledge the ABB status register                    */
+/* Configure ABB modules                                 */
+/* Program the ramp parameters into the NDB              */
+/* Load in the NDB registers' value to be programmed in  */
+/* ABB at first communication it                         */
+/*-------------------------------------------------------*/
+
+void l1_abb_power_on(void)
+{
+    T_SPI_DEV *Abb;
+    T_SPI_DEV init_spi_device;
+    UWORD16 Abb_Status;
+
+    Abb               = &init_spi_device;   /* Pointer initialization to device communication structure */
+    Abb->PrescVal     = SPI_CLOCK_DIV_1;    /* ABB transmission parameters initialization */
+    Abb->DataTrLength = SPI_WNB_15;
+    Abb->DevAddLength = 5;
+    Abb->DevId        = ABB;
+    Abb->ClkEdge      = SPI_CLK_EDG_RISE;
+    Abb->TspEnLevel   = SPI_NTSPEN_NEG_LEV;
+    Abb->TspEnForm    = SPI_NTSPEN_LEV_TRIG;
+
+    SPI_InitDev(Abb);                   /* Initialize the spi to work with ABB */
+
+    ABB_free_13M();                     /* Set up Abb connection (CLK 13M free).*/
+    Abb_Status = ABB_Read_Status();     /* Aknowledge the Abb status register.  */
+
+    /*------------------------------------------------------------------*/
+    /* Add here SW to manage Abb VRPCSTS status register informations   */
+    /*------------------------------------------------------------------*/
+
+    ABB_Read_Register_on_page(PAGE0,ITSTATREG);  /* Aknowledge the interrupt status register */
+                                        /* to clear any pending interrupt */
+
+    /* FC FFS editor: different arguments from full L1 */
+    ABB_on(0, 0);
+}
--- a/src/cs/system/main/main.c	Fri May 15 04:54:15 2020 +0000
+++ b/src/cs/system/main/main.c	Fri May 15 05:23:20 2020 +0000
@@ -6,6 +6,10 @@
 	Init_Drivers();
 #if 0
 	Cust_Init_Layer1();
+#else
+	/* init functions done in l1_initialize() */
+	initialize_wait_loop();
+	l1_abb_power_on();
 #endif
 	Init_Serial_Flows();
 #if 0