Advertisement
Guest User

Untitled

a guest
May 30th, 2015
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.94 KB | None | 0 0
  1. hi ketul
  2. ketul: if you haven't been paying attention to it, you should read the mailing list thread on users@rtems.org about "Embedded board with good support out of the box?"
  3. ketul
  4. hi gedare
  5. ketul
  6. gedare: https://gist.github.com/ketul93/d717555951174a74c8b4 updated !
  7. but in this code getting one fatal error. gedare can you help me to rectify it
  8. → DrJoel has joined
  9. ← DrJoel has quit (Changing host)
  10. → DrJoel has joined
  11. ⓘ ChanServ set mode +o DrJoel
  12. ketul
  13. hi DrJoel
  14. @DrJoel
  15. hello! How's your code doing?
  16. ketul
  17. https://gist.github.com/ketul93/d717555951174a74c8b4
  18. can you please review it DrJoel
  19. @DrJoel
  20. It will be quick. I have to leave in a few minutes for a demo.
  21. beagleboneblack.h appears to be OK except some enums and struct members are indented with one space not two. Two is the rule.
  22. I assume there are no tabs.
  23. ketul
  24. ya seen that problem
  25. @DrJoel
  26. gpio.c: The API describing Doxygen goes in the .h.
  27. gpio.c: returning 1, 2 for errors isn't good form. Define them as #define constants or as an enumeration for GPIO_ERRORS or something
  28. ketul
  29. DrJoel: that is defined in gpio.h
  30. all the macros
  31. for errors and application is there in init.c
  32. @DrJoel
  33. Each value returned should be covered in the comments. Comment for rtems_gpio_configure_pin_digital_out() says 0 or 1 but returns 0, 1, and 2. That's the method I am talking about.
  34. ketul
  35. ohh k
  36. @DrJoel
  37. The methods below that are documented as 0/-1 but return 0/2. Defining the error names as macros is OK but document what it means when they are returned.
  38. gpio.h: I see the error defining macros but you didn't use them. :)
  39. And the comments don't describe that method X can return it.
  40. ketul
  41. yup didn't use all
  42. ok that I will comment
  43. used only "GPIO_SUCCESSFUL"
  44. @DrJoel
  45. Using them all in a particular method is not an issue if you used the entire set across all methods. Key is unique status per condition per method. So if method X returns error A, it has a unique interpretation. At least that's my view of good error codes. No guessing what it means
  46. beng-nl and gedare can comment but we may want to already use a BSD 2-clause license for this code if you don't mind. Ask them.
  47. ketul
  48. ok sure
  49. thanks DrJoel
  50. @DrJoel
  51. You don't have to have extern on methods in gpio.h and the detailed Doxygen in the C file should be in here. That's what shows up in the generated output.
  52. Did we decide on a macro a BSP defines in bsp.h when it supports gpio?
  53. init.c: if( should be "if (
  54. Some of the if lines look long. Make sure < 80 columns.
  55. Putting the return code in a variable and testing the variable would be better since it makes it easier/possible to print the status when debugging.
  56. Obviously the test is BB specific at this point. See line 14.
  57. We need to work on how to make this code generic so it just works without knowing a BSP. Likely this means bsp.h will have to include the bsp/beagleboneblack.h when configured for that variant and the test will ahve to check BSP_HAS_GPIO or whatever macro we decide to say means it supports GPIO
  58. ketul
  59. yup :)
  60. ketul
  61. but DrJoel different boards have different methods of accessing the gpio pins so at line 14 it is defined that it is using the macros for BBB.
  62. ok got it
  63. :)
  64. so you are talking about adding one more abstraction layer
  65. @DrJoel
  66. Does that make two or three layers? I think two are sufficient. Application level and BSP level
  67. ketul
  68. ya probably 2 layers
  69. @DrJoel
  70. OK.. have to head to demo
  71. have a great weekend
  72. ← DrJoel has quit (Quit: Do fish get thirsty?)
  73. rtems-bot
  74. [trac] TBR/UserManual/MinGW_Tools_for_Windows edited by gedare (Fix ftp links.) http://devel.rtems.org/wiki/TBR/UserManual/MinGW_Tools_for_Windows
  75. rtems-bot
  76. [trac] 2320/defect">#2320/defect (new) updated by gedare (The following search shows where the old links are still existing in the wiki: ...) http://devel.rtems.org/ticket/2320
  77. [trac] 2320/defect">#2320/defect (new) updated by gedare (empty comment) http://devel.rtems.org/ticket/2320
  78. rtems-bot
  79. [git] b17fb17 by Sebastian Huber: [Revert "tmtests/tm26: Avoid NULL pointer access" There is no NULL pointer access. Please note that _Thread_Get_executing() != executing variable in Low_task(). This reverts commit 5611839a7e2e371dd1f327c336c785095f634e55.] http://devel.rtems.org/changeset/b17fb17/rtems
  80. → Davidbrcz has joined
  81. ← Davidbrcz has quit (Ping timeout: 256 seconds)
  82. → hesham has joined
  83. ← javamonn has quit (Remote host closed the connection)
  84. → javamonn has joined
  85. beng-nl
  86. hi all
  87. @gedare
  88. hello beng-nl
  89. ← zoso has quit (Remote host closed the connection)
  90. rtems-bot
  91. [trac] SOCIS/2015 edited by hermann19829 (empty comment) http://devel.rtems.org/wiki/SOCIS/2015
  92. → Davidbrcz has joined
  93. ← javamonn has quit (Remote host closed the connection)
  94. → javamonn has joined
  95. ← javamonn has quit (Read error: Connection reset by peer)
  96. → javamonn has joined
  97. → mumptai has joined
  98. ketul
  99. hello beng-nl
  100. beng-nl
  101. hi ketul
  102. ketul
  103. beng-nl: getting fatal error "fatal error: rtems/gpio.h: No such file or directory"
  104. I added the header to makefile.am
  105. @gedare
  106. ketul: bootstrap -p && bootstrap
  107. ketul
  108. all done
  109. @gedare
  110. what did you add to Makefile.am?
  111. ketul
  112. gedare: ## GPIO API
  113. include_rtems_HEADERS += include/rtems/gpio.h
  114. ketul
  115. even it is showing gpio.h in preinstall.am
  116. @gedare
  117. paste the preinstall.am entry here
  118. ketul
  119. ok let me
  120. @gedare
  121. is this the beagle/Makefile.am?
  122. ketul
  123. no its in cpukit/
  124. @gedare
  125. k
  126. ketul
  127. gedare: $(PROJECT_INCLUDE)/rtems/gpio.h: include/rtems/gpio.h $(PROJECT_INCLUDE)/rtems/$
  128. $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/gpio.h
  129. PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/gpio.h
  130. so I added #include <rtems/gpio.h> in my code
  131. but giving fatal error
  132. @gedare
  133. oh
  134. anytime you do bootstrap -p and then bootstrap, you basically have to re-run configure and make too
  135. so in your build dir, rm -rf *
  136. and re-run configure
  137. it's a nasty build system, and motivates the waf effort.
  138. beng-nl
  139. hear hear :)
  140. ketul
  141. :) yes beng-nl
  142. ketul
  143. gedare: yes I followed all the steps from "./bootstrap; ./bootstrap -p" to "make"
  144. @gedare
  145. you have to do bootstrap -p first
  146. ketul, make sure you ran bootstrap again after bootstrap -p, and then ran configure and make in a clean build directory.
  147. ketul
  148. ok gedare let me try it
  149. @gedare
  150. ketul: any luck? i'm about to head out for the weekend.
  151. ketul
  152. compilation going on
  153. gedare: have a great weekend
  154. ketul
  155. gedare: yup done with that error, but getting another one that I will try to rectify
  156. gedare: thanks
  157. ← gedare has quit (Ping timeout: 265 seconds)
  158. ketul
  159. beng-nl: :)
  160. ketul
  161. beng-nl: wrote "typedef struct gpio_pin_handle;" in gpio.h
  162. and struct declared in gpio.c
  163. ketul
  164. hi gedare free for some time ?
  165. ← verm__ has quit (Read error: Connection reset by peer)
  166. → verm__ has joined
  167. → Davidbrcz has joined
  168. @gedare
  169. hi ketul what's up?
  170. ketul
  171. hi gedare : have a look at gpio.h @ https://gist.github.com/ketul93/d717555951174a74c8b4
  172. ketul
  173. getting error "../../../../../.././beagleboneblack/lib/include/rtems/gpio.h:43:49: error: unknown type name 'gpio_pin_handle'
  174. extern int rtems_gpio_configure_pin_digital_out(gpio_pin_handle *, unsigned int pin_number);"
  175. though I declared "typedef struct gpio_pin_handle;"
  176. @gedare
  177. sure, the filename is wong for beaglebonenlack.h
  178. also
  179. you shouldn't declare the typedef twice, so that is a bit fishy
  180. probably the struct definition should be in gpio.h and not beaglebonenlack.h
  181. ketul
  182. ya file name was typing mistake
  183. but
  184. we need to make the gpio.h generalized api
  185. so abstraction need to be there
  186. @gedare
  187. i see
  188. ketul
  189. so can't define struct in gpio.h
  190. so what would you suggest ?
  191. @gedare
  192. then you also shouldn't be dereferencing pointers to it
  193. either you define a struct that is generic across all GPIO implementations
  194. or you define a struct that the GPIO implementation fills in somehow with some specialization such as function pointers or similar
  195. ok i'm starting to see the picture
  196. you want to know how to define the interface in a generic way
  197. ketul
  198. struct definition is board specific
  199. ya kind of
  200. or is it possible to use void * ?
  201. @gedare
  202. then you should not make it a typedef, just forward declare 'struct gpio_pin_handle;'
  203. ketul
  204. ok
  205. @gedare
  206. and use struct gpio_pin_handle in the interface functions
  207. i think that should work...
  208. *thinks*
  209. otherwise, you define the struct there, and you let the gpio implementation sort of over-ride it, like...
  210. typedef struct {
  211. ... generic stuff
  212. } gpio_pin_handle;
  213. in bbb_gpio.h:
  214. typedef struct {
  215. gpio_pin_handle super;
  216. ... specific bbb stuff;
  217. } bbb_pin_handle;
  218. ketul
  219. struct gpio_pin_handle isn't worked
  220. yup that sounds good
  221. @gedare
  222. it means you should create structs of type bbb_pin_handle
  223. and then you pass those to the gpio interface functions
  224. ok now i have to go. mock that together and see what you come up with i suppose. happy hacking!
  225. ketul
  226. yes definitions need to be there in gpio.h otherwise it won't work
  227. okk
  228. bye
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement