version.c 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. /*
  2. * Copyright (C) 2001-2007 by egnite Software GmbH. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. *
  8. * 1. Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * 2. Redistributions in binary form must reproduce the above copyright
  11. * notice, this list of conditions and the following disclaimer in the
  12. * documentation and/or other materials provided with the distribution.
  13. * 3. Neither the name of the copyright holders nor the names of
  14. * contributors may be used to endorse or promote products derived
  15. * from this software without specific prior written permission.
  16. *
  17. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  18. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  19. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  20. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  21. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  22. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  23. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  24. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  25. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  26. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  27. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  28. * SUCH DAMAGE.
  29. *
  30. * For additional information see http://www.ethernut.de/
  31. *
  32. */
  33. /*
  34. * $Log$
  35. * Revision 1.67 2009/03/09 08:28:03 haraldkipp
  36. * Beta 4.9
  37. *
  38. * Revision 1.66 2009/03/09 08:22:36 haraldkipp
  39. * Release branch 4.8 created
  40. *
  41. * Revision 1.65 2009/03/09 08:15:14 haraldkipp
  42. * Release branch 4.8 announced
  43. *
  44. * Revision 1.64 2009/01/09 17:54:14 haraldkipp
  45. * Next beta will be 4.7.5.
  46. *
  47. * Revision 1.63 2008/10/10 11:52:25 haraldkipp
  48. * Lua added.
  49. *
  50. * Revision 1.62 2008/08/29 15:03:04 haraldkipp
  51. * Fixed Configurator bug #2082123. Options now correctly enabled.
  52. *
  53. * Revision 1.61 2008/08/28 16:11:31 haraldkipp
  54. * Fixed bitbanging SPI for ARM targets.
  55. *
  56. * Revision 1.60 2008/08/25 17:05:27 haraldkipp
  57. * Beta release 4.7.1.
  58. *
  59. * Revision 1.59 2008/08/11 07:00:34 haraldkipp
  60. * BSD types replaced by stdint types (feature request #1282721).
  61. *
  62. * Revision 1.58 2008/07/29 13:06:21 haraldkipp
  63. * Starting beta 4.7
  64. *
  65. * Revision 1.57 2008/07/29 13:04:18 haraldkipp
  66. * Release branch 4.6 created
  67. *
  68. * Revision 1.56 2008/07/29 12:13:38 haraldkipp
  69. * Release branch 4.6 announced
  70. *
  71. * Revision 1.55 2008/07/26 09:39:16 haraldkipp
  72. * Preparing 4.5.7 beta.
  73. *
  74. * Revision 1.54 2008/07/24 17:06:07 haraldkipp
  75. * Preparing 4.5.6 beta.
  76. *
  77. * Revision 1.53 2008/07/14 13:14:38 haraldkipp
  78. * Second build of version 4.5.5.
  79. *
  80. * Revision 1.52 2008/07/10 12:17:41 haraldkipp
  81. * Preparing beta version 4.5.5.
  82. *
  83. * Revision 1.51 2008/04/18 13:12:31 haraldkipp
  84. * ICCAVR fixes, many shorts to int, PPP+RS485 for AT91.
  85. *
  86. * Revision 1.50 2008/04/02 09:39:28 haraldkipp
  87. * Fixed another PHAT file pointer bug.
  88. *
  89. * Revision 1.49 2008/04/01 10:09:55 haraldkipp
  90. * Beta version 4.5.2.
  91. *
  92. * Revision 1.48 2008/02/15 16:50:33 haraldkipp
  93. * Beta release 4.5.1.
  94. *
  95. * Revision 1.47 2007/09/11 15:40:45 haraldkipp
  96. * Release branch 4.4 created
  97. *
  98. * Revision 1.46 2007/08/30 12:15:06 haraldkipp
  99. * Configurable MMC timings.
  100. *
  101. * Revision 1.45 2007/08/29 13:35:19 haraldkipp
  102. * Announcing release branch 4.4.
  103. *
  104. * Revision 1.44 2007/05/24 07:30:48 haraldkipp
  105. * Bugfixes for preparing release candidate.
  106. *
  107. * Revision 1.43 2007/05/02 11:35:25 haraldkipp
  108. * ATmega2561 and other fixes.
  109. * IGMP support started, but not finished.
  110. * Socket ioctl started, but not finished.
  111. *
  112. * Revision 1.42 2007/04/12 08:54:39 haraldkipp
  113. * Supports configurable SPI, VS10XX MP3 decoder chips and Mega256 for
  114. * avr-gcc 4.1.1.
  115. *
  116. * Revision 1.41 2007/02/15 15:59:12 haraldkipp
  117. * First 4.3 Beta Release
  118. *
  119. * Revision 1.40 2006/10/17 11:26:02 haraldkipp
  120. * Release branch 4.2 created.
  121. *
  122. * Revision 1.39 2006/10/05 17:26:58 haraldkipp
  123. * Follows unofficial rc10.
  124. *
  125. * Revision 1.38 2006/09/29 12:19:34 haraldkipp
  126. * RC10
  127. *
  128. * Revision 1.37 2006/08/31 19:19:55 haraldkipp
  129. * No time to write comments. ;-)
  130. *
  131. * Revision 1.36 2006/08/01 07:33:02 haraldkipp
  132. * Preparing new release candidate.
  133. *
  134. * Revision 1.35 2006/07/26 11:14:52 haraldkipp
  135. * Release candidate 6
  136. *
  137. * Revision 1.34 2006/07/10 14:29:03 haraldkipp
  138. * Release candidate 4.1.9.4.
  139. * C++ support added. These patches had been kindly contributed by
  140. * Matthias Wilde.
  141. *
  142. * Revision 1.33 2006/07/05 08:03:54 haraldkipp
  143. * Second trial to move to 4.2.
  144. *
  145. * Revision 1.32 2006/06/28 14:43:06 haraldkipp
  146. * Release candidate prepared.
  147. *
  148. * Revision 1.31 2006/05/15 12:48:49 haraldkipp
  149. * Prepare pre-release 4.1.6.
  150. *
  151. * Revision 1.30 2006/04/07 13:59:55 haraldkipp
  152. * Pre-release 4.1.5.4.
  153. *
  154. * Revision 1.29 2006/02/08 15:20:56 haraldkipp
  155. * ATmega2561 Support
  156. *
  157. * Revision 1.28 2006/01/23 19:53:33 haraldkipp
  158. * Minor fixes
  159. *
  160. * Revision 1.27 2006/01/23 17:37:08 haraldkipp
  161. * Mostly memory alignment fixes.
  162. *
  163. * Revision 1.26 2006/01/22 17:46:18 haraldkipp
  164. * Pre-release 4.1.3
  165. *
  166. * Revision 1.25 2006/01/19 18:39:33 haraldkipp
  167. * Pre-release 4.1.2.
  168. *
  169. * Revision 1.24 2006/01/08 11:55:52 haraldkipp
  170. * Prepare preview snapshot.
  171. *
  172. * Revision 1.23 2005/12/04 18:42:21 haraldkipp
  173. * Release branch X.Y created.
  174. *
  175. * Revision 1.22 2005/12/02 11:36:12 haraldkipp
  176. * Release 4.0 scheduled
  177. *
  178. * Revision 1.21 2005/11/20 14:36:07 haraldkipp
  179. * Preparing last version 4 preview.
  180. *
  181. * Revision 1.20 2005/08/02 17:47:04 haraldkipp
  182. * Major API documentation update.
  183. *
  184. * Revision 1.19 2005/07/20 09:14:40 haraldkipp
  185. * Release 3.9.8
  186. *
  187. * Revision 1.18 2005/06/06 10:40:31 haraldkipp
  188. * Emergency bugfix release 3.9.7.1.
  189. *
  190. * Revision 1.17 2005/05/25 10:04:58 haraldkipp
  191. * Win 32 release.
  192. *
  193. * Revision 1.16 2005/05/24 16:12:51 haraldkipp
  194. * Sigh!
  195. *
  196. * Revision 1.15 2005/05/22 16:05:40 haraldkipp
  197. * *** empty log message ***
  198. *
  199. * Revision 1.14 2005/04/05 17:37:12 haraldkipp
  200. * First Nut/OS running ARM responds to http requests
  201. *
  202. * Revision 1.13 2005/02/07 15:24:46 haraldkipp
  203. * ARP cache bugfix.
  204. *
  205. * Revision 1.12 2005/02/06 16:35:33 haraldkipp
  206. * *** empty log message ***
  207. *
  208. * Revision 1.11 2005/01/02 10:07:10 haraldkipp
  209. * Replaced platform dependant formats in debug outputs.
  210. *
  211. * Revision 1.10 2004/10/03 18:44:40 haraldkipp
  212. * A little bit of Game Boy
  213. *
  214. * Revision 1.9 2004/09/08 09:55:19 haraldkipp
  215. * Although this is no final release, there is a lot of new hardware waiting
  216. * for Nut/OS support. So I marked this with version 3.9.1 before creating
  217. * the long awaited 4.0 branch.
  218. *
  219. * Revision 1.8 2004/01/30 11:50:26 haraldkipp
  220. * Release branch 3.4 created
  221. *
  222. * Revision 1.7 2004/01/27 13:41:52 haraldkipp
  223. * Branch 3.4 announced
  224. *
  225. * Revision 1.6 2003/12/15 19:32:32 haraldkipp
  226. * Preview
  227. *
  228. * Revision 1.5 2003/11/04 17:59:04 haraldkipp
  229. * Corrected
  230. *
  231. * Revision 1.4 2003/11/03 16:28:20 haraldkipp
  232. * Release version 3.3.2
  233. *
  234. * Revision 1.3 2003/08/14 15:22:24 haraldkipp
  235. * New release
  236. *
  237. * Revision 1.2 2003/07/21 18:26:31 haraldkipp
  238. * Version 3.3
  239. *
  240. * Revision 1.1.1.1 2003/05/09 14:41:55 haraldkipp
  241. * Initial using 3.2.1
  242. *
  243. * Revision 1.3 2003/05/06 18:58:16 harald
  244. * Prepare final release
  245. *
  246. * Revision 1.2 2003/03/31 14:40:57 harald
  247. * *** empty log message ***
  248. *
  249. * Revision 1.1 2003/02/04 18:17:07 harald
  250. * Version 3 released
  251. *
  252. */
  253. #include <sys/version.h>
  254. #if defined(__GNUC__)
  255. #define NUM2STR(x) #x
  256. #define OS_VERSION_STRING(a, b, c, d) NUM2STR(a) "." NUM2STR(b) "." NUM2STR(c) "." NUM2STR(d)
  257. static const char *os_version_string =
  258. OS_VERSION_STRING(NUT_VERSION_MAJOR, NUT_VERSION_MINOR, NUT_VERSION_RELEASE, NUT_VERSION_BUILD);
  259. #else
  260. static const char os_version_string[] = {
  261. #if NUT_VERSION_MAJOR >= 10
  262. (NUT_VERSION_MAJOR / 10) + '0',
  263. #endif
  264. (NUT_VERSION_MAJOR % 10) + '0', '.',
  265. #if NUT_VERSION_MINOR >= 10
  266. (NUT_VERSION_MINOR / 10) + '0',
  267. #endif
  268. (NUT_VERSION_MINOR % 10) + '0', '.',
  269. #if NUT_VERSION_RELEASE >= 10
  270. (NUT_VERSION_RELEASE / 10) + '0',
  271. #endif
  272. (NUT_VERSION_RELEASE % 10) + '0', '.',
  273. #if NUT_VERSION_BUILD >= 10
  274. (NUT_VERSION_BUILD / 10) + '0',
  275. #endif
  276. (NUT_VERSION_BUILD % 10) + '0', 0
  277. };
  278. #endif
  279. /*!
  280. * \addtogroup xgNutVersion
  281. */
  282. /*@{*/
  283. /*!
  284. * \brief Return Nut/OS version.
  285. *
  286. * \return Version coded into an unsigned long. Most significant byte
  287. * is the major version number, followed by the minor version
  288. * number, again followed by the release number and finally
  289. * the build number in the least significant byte.
  290. */
  291. uint32_t NutVersion(void)
  292. {
  293. return OS_VERSION_NUMBER;
  294. }
  295. /*!
  296. * \brief Return Nut/OS version string.
  297. *
  298. * \return Pointer to a printable string containing the version number.
  299. * The string contains 4 numbers separated by dots. The first
  300. * is the major version number, followed by the minor version
  301. * number, again followed by the release number and finally
  302. * followed by the build number. In non-official releases this
  303. * may be optionally followed by a space and an additional
  304. * release state.
  305. */
  306. const char *NutVersionString(void)
  307. {
  308. return os_version_string;
  309. }
  310. /*@}*/