Commit bedd8403f77f790e9876578885eab1200ba2f8d8

Authored by Mike Frysinger
Committed by Wolfgang Denk
1 parent 81813cb01f

export SPI functions to standalone apps

While we're here, fix the broken #ifdef handling in _exports.h.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

Showing 3 changed files with 20 additions and 5 deletions Side-by-side Diff

... ... @@ -38,5 +38,13 @@
38 38 gd->jt[XF_i2c_write] = (void *) i2c_write;
39 39 gd->jt[XF_i2c_read] = (void *) i2c_read;
40 40 #endif
  41 +#ifdef CONFIG_CMD_SPI
  42 + gd->jt[XF_spi_init] = (void *) spi_init;
  43 + gd->jt[XF_spi_setup_slave] = (void *) spi_setup_slave;
  44 + gd->jt[XF_spi_free_slave] = (void *) spi_free_slave;
  45 + gd->jt[XF_spi_claim_bus] = (void *) spi_claim_bus;
  46 + gd->jt[XF_spi_release_bus] = (void *) spi_release_bus;
  47 + gd->jt[XF_spi_xfer] = (void *) spi_xfer;
  48 +#endif
41 49 }
  1 +/*
  2 + * You do not need to use #ifdef around functions that may not exist
  3 + * in the final configuration (such as i2c).
  4 + */
1 5 EXPORT_FUNC(get_version)
2 6 EXPORT_FUNC(getc)
3 7 EXPORT_FUNC(tstc)
4 8  
5 9  
6 10  
... ... @@ -14,14 +18,16 @@
14 18 EXPORT_FUNC(do_reset)
15 19 EXPORT_FUNC(getenv)
16 20 EXPORT_FUNC(setenv)
17   -#ifdef CONFIG_HAS_UID
18 21 EXPORT_FUNC(forceenv)
19   -#endif
20 22 EXPORT_FUNC(simple_strtoul)
21 23 EXPORT_FUNC(simple_strtol)
22 24 EXPORT_FUNC(strcmp)
23   -#if defined(CONFIG_CMD_I2C)
24 25 EXPORT_FUNC(i2c_write)
25 26 EXPORT_FUNC(i2c_read)
26   -#endif
  27 +EXPORT_FUNC(spi_init)
  28 +EXPORT_FUNC(spi_setup_slave)
  29 +EXPORT_FUNC(spi_free_slave)
  30 +EXPORT_FUNC(spi_claim_bus)
  31 +EXPORT_FUNC(spi_release_bus)
  32 +EXPORT_FUNC(spi_xfer)
... ... @@ -33,6 +33,7 @@
33 33 int i2c_write (uchar, uint, int , uchar* , int);
34 34 int i2c_read (uchar, uint, int , uchar* , int);
35 35 #endif
  36 +#include <spi.h>
36 37  
37 38 void app_startup(char **);
38 39  
... ... @@ -46,7 +47,7 @@
46 47 XF_MAX
47 48 };
48 49  
49   -#define XF_VERSION 4
  50 +#define XF_VERSION 5
50 51  
51 52 #if defined(CONFIG_I386)
52 53 extern gd_t *global_data;