FreeCalypso > hg > freecalypso-sw
annotate gsm-fw/bsp/abb+spi/spi_drv.c @ 945:86ff6d0b0a97
loadtools: fc-compalram trivial utility added
author | Mychaela Falconia <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 02 Nov 2015 17:36:02 +0000 |
parents | 54459b912ef0 |
children |
rev | line source |
---|---|
589
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
1 /******************************************************************************/ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
2 /* TEXAS INSTRUMENTS INCORPORATED PROPRIETARY INFORMATION */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
3 /* */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
4 /* Property of Texas Instruments -- For Unrestricted Internal Use Only */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
5 /* Unauthorized reproduction and/or distribution is strictly prohibited. This*/ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
6 /* product is protected under copyright law and trade secret law as an*/ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
7 /* unpublished work. Created 1987, (C) Copyright 1997 Texas Instruments. All*/ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
8 /* rights reserved. */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
9 /* */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
10 /* */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
11 /* Filename : spi_drv.c */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
12 /* */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
13 /* Description : Functions to drive the SPI module. */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
14 /* The Serial Port Interface is a bidirectional 3 lines */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
15 /* interface dedicated to the transfer of data to and */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
16 /* from up to 5 external devices offering a 3 lines */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
17 /* serial interface. */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
18 /* In this project, it is only used to connect the TI */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
19 /* Analog BaseBand (ABB). */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
20 /* It is assumed that the ABB is connected as the SPI */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
21 /* device 0. */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
22 /* */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
23 /* This interface is specified to be compatible with */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
24 /* the UMA1018M Philips, the FUJITSU MB15F02, the */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
25 /* SIEMENS PMB2306T synthesizers and the TI ABB. */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
26 /* */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
27 /* This serial port is based on a looped shift-register */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
28 /* thus allowing both transmit (PISO) and receive (SIPO) */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
29 /* modes. */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
30 /* */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
31 /* */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
32 /* Author : Pascal PUEL */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
33 /* */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
34 /* Version number : 1.45 */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
35 /* */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
36 /* Date and time : 07/01/03 */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
37 /* */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
38 /* Previous delta : Rework */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
39 /* */ |
54459b912ef0
gsm-fw/bsp/abb+spi/spi_*.c: formatting fixes (line length and tabs)
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
157
diff
changeset
|
40 /******************************************************************************/ |
148
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
41 |
157
e48ea5875df7
gsm-fw: SPI task code compiles and links
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
148
diff
changeset
|
42 #include "spi_drv.h" |
148
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
43 |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
44 |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
45 |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
46 /*-----------------------------------------------------------------------*/ |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
47 /* SPI_InitDev() */ |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
48 /* */ |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
49 /* This function initializes the SPI registers for an external device */ |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
50 /* connected to the serial port. */ |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
51 /* */ |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
52 /*-----------------------------------------------------------------------*/ |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
53 void SPI_InitDev(T_SPI_DEV *Device) |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
54 { |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
55 unsigned short Param,Gate,Shiftval; |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
56 unsigned short Mask = 0x7bde; |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
57 |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
58 /* Clock enable, mask ITs and pre scale setting */ |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
59 * (volatile SYS_UWORD16 *) SPI_REG_SET1 = (SPI_CLK_ON | Device->PrescVal | SPI_IT_MASK_0 | SPI_IT_MASK_1); |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
60 |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
61 /* Building the parameter for REG_SET2 initialization */ |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
62 Shiftval = Device->DevId >> 7; |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
63 Param = (Device->ClkEdge | Device->TspEnLevel | Device->TspEnForm)<<Shiftval ; |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
64 Gate = Mask<<Shiftval; |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
65 |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
66 * (volatile SYS_UWORD16 *) SPI_REG_SET2 = (* (volatile SYS_UWORD16 *) SPI_REG_SET2 & Gate) | Param; |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
67 |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
68 |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
69 /* Configuring CTRL_REG : this writting erases the previous one */ |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
70 * (volatile SYS_UWORD16 *) SPI_REG_CTRL = (Device->DataTrLength | Device->DevId); |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
71 |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
72 /* Stop the SPI clock */ |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
73 #ifdef SPI_CLK_LOW_POWER |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
74 SPI_CLK_DISABLE |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
75 #endif |
63750f70796d
gsm-fw/bsp/abb+spi: initial import from the Leonardo TCS211 version
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
76 } |