diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2010-04-09 01:21:53 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2010-04-09 01:21:53 +0000 |
commit | 7abf2b53a462612808d46d6d77a7f35261a0e5a3 (patch) | |
tree | 241304f7cd2b5d1c2a9e091fe56a33d2d2f8e816 /firmware/target/arm/imx31/spi-imx31.h | |
parent | 43304b87b0662d1619ac60e5297a1694aa580310 (diff) | |
download | rockbox-7abf2b53a462612808d46d6d77a7f35261a0e5a3.tar.gz rockbox-7abf2b53a462612808d46d6d77a7f35261a0e5a3.zip |
Gigabeat S/i.MX31: Sort files in the /target tree into things that are SoC-generic (into /imx31) and player-specific (into /gigabeat-s, based upon current appearances). Move i2s clock init into the appropriate file. Housekeeping only-- no functional changes.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25547 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/imx31/spi-imx31.h')
-rw-r--r-- | firmware/target/arm/imx31/spi-imx31.h | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/firmware/target/arm/imx31/spi-imx31.h b/firmware/target/arm/imx31/spi-imx31.h new file mode 100644 index 0000000000..cf536b646d --- /dev/null +++ b/firmware/target/arm/imx31/spi-imx31.h | |||
@@ -0,0 +1,89 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (c) 2007 Will Robertson | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef SPI_IMX31_H | ||
22 | #define SPI_IMX31_H | ||
23 | |||
24 | #define USE_CSPI1_MODULE (1 << 0) | ||
25 | #define USE_CSPI2_MODULE (1 << 1) | ||
26 | #define USE_CSPI3_MODULE (1 << 2) | ||
27 | |||
28 | /* SPI_MODULE_MASK is set in target's config */ | ||
29 | enum spi_module_number | ||
30 | { | ||
31 | __CSPI_NUM_START = -1, /* The first will be 0 */ | ||
32 | #if (SPI_MODULE_MASK & USE_CSPI1_MODULE) | ||
33 | CSPI1_NUM, | ||
34 | #endif | ||
35 | #if (SPI_MODULE_MASK & USE_CSPI2_MODULE) | ||
36 | CSPI2_NUM, | ||
37 | #endif | ||
38 | #if (SPI_MODULE_MASK & USE_CSPI3_MODULE) | ||
39 | CSPI3_NUM, | ||
40 | #endif | ||
41 | SPI_NUM_CSPI, | ||
42 | }; | ||
43 | |||
44 | struct cspi_map | ||
45 | { | ||
46 | volatile uint32_t rxdata; /* 00h */ | ||
47 | volatile uint32_t txdata; /* 04h */ | ||
48 | volatile uint32_t conreg; /* 08h */ | ||
49 | volatile uint32_t intreg; /* 0Ch */ | ||
50 | volatile uint32_t dmareg; /* 10h */ | ||
51 | volatile uint32_t statreg; /* 14h */ | ||
52 | volatile uint32_t periodreg; /* 18h */ | ||
53 | volatile uint32_t skip1[0x69]; /* 1Ch */ | ||
54 | volatile uint32_t testreg; /* 1C0h */ | ||
55 | }; | ||
56 | |||
57 | struct spi_node | ||
58 | { | ||
59 | enum spi_module_number num; /* Module number (CSPIx_NUM) */ | ||
60 | unsigned long conreg; /* CSPI conreg setup */ | ||
61 | unsigned long periodreg; /* CSPI periodreg setup */ | ||
62 | }; | ||
63 | |||
64 | struct spi_transfer | ||
65 | { | ||
66 | const void *txbuf; | ||
67 | void *rxbuf; | ||
68 | int count; | ||
69 | }; | ||
70 | |||
71 | /* One-time init of SPI driver */ | ||
72 | void spi_init(void); | ||
73 | |||
74 | /* Enable the specified module for the node */ | ||
75 | void spi_enable_module(struct spi_node *node); | ||
76 | |||
77 | /* Disabled the specified module for the node */ | ||
78 | void spi_disable_module(struct spi_node *node); | ||
79 | |||
80 | /* Lock module mutex */ | ||
81 | void spi_lock(struct spi_node *node); | ||
82 | |||
83 | /* Unlock module mutex */ | ||
84 | void spi_unlock(struct spi_node *node); | ||
85 | |||
86 | /* Send and/or receive data on the specified node */ | ||
87 | int spi_transfer(struct spi_node *node, struct spi_transfer *trans); | ||
88 | |||
89 | #endif /* SPI_IMX31_H */ | ||