annotate src/cs/system/main/abb_init.c @ 26:680f6fdb5e62

add target for Sony Ericsson K200/K220
author Vadim Yanitskiy <fixeria@osmocom.org>
date Wed, 20 Dec 2023 01:59:09 +0700
parents 80c8857ce1c7
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This module is a small extract from TI's l1_init.c,
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * containing the function that initializes access to the ABB.
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 */
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <string.h>
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include "l1_types.h"
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include "sys_types.h"
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include "spi_drv.h"
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include "abb.h"
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #include "mem.h"
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 #include "inth.h"
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 #include "dma.h"
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 #include "iq.h"
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 #include "clkm.h"
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 #include "rhea_arm.h"
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 #include "ulpd.h"
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 /*-------------------------------------------------------*/
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 /* l1_abb_power_on() */
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 /*-------------------------------------------------------*/
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 /* Parameters : */
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 /* Return : */
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 /* Functionality : */
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 /* Initialize the global structure for spi communication */
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 /* with ABB. */
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 /* Set up ABB connection (CLK 13M free) */
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 /* Aknowledge the ABB status register */
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 /* Configure ABB modules */
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 /* Program the ramp parameters into the NDB */
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 /* Load in the NDB registers' value to be programmed in */
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 /* ABB at first communication it */
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 /*-------------------------------------------------------*/
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 void l1_abb_power_on(void)
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 {
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 T_SPI_DEV *Abb;
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 T_SPI_DEV init_spi_device;
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 UWORD16 Abb_Status;
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 Abb = &init_spi_device; /* Pointer initialization to device communication structure */
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 Abb->PrescVal = SPI_CLOCK_DIV_1; /* ABB transmission parameters initialization */
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 Abb->DataTrLength = SPI_WNB_15;
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 Abb->DevAddLength = 5;
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 Abb->DevId = ABB;
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 Abb->ClkEdge = SPI_CLK_EDG_RISE;
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 Abb->TspEnLevel = SPI_NTSPEN_NEG_LEV;
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 Abb->TspEnForm = SPI_NTSPEN_LEV_TRIG;
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 SPI_InitDev(Abb); /* Initialize the spi to work with ABB */
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 ABB_free_13M(); /* Set up Abb connection (CLK 13M free).*/
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 Abb_Status = ABB_Read_Status(); /* Aknowledge the Abb status register. */
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 /*------------------------------------------------------------------*/
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 /* Add here SW to manage Abb VRPCSTS status register informations */
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 /*------------------------------------------------------------------*/
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 ABB_Read_Register_on_page(PAGE0,ITSTATREG); /* Aknowledge the interrupt status register */
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 /* to clear any pending interrupt */
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 /* FC FFS editor: different arguments from full L1 */
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 ABB_on(0, 0);
80c8857ce1c7 ABB init hooked in
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 }