Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- hi ketul
- 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?"
- ketul
- hi gedare
- ketul
- gedare: https://gist.github.com/ketul93/d717555951174a74c8b4 updated !
- but in this code getting one fatal error. gedare can you help me to rectify it
- → DrJoel has joined
- ← DrJoel has quit (Changing host)
- → DrJoel has joined
- ⓘ ChanServ set mode +o DrJoel
- ketul
- hi DrJoel
- @DrJoel
- hello! How's your code doing?
- ketul
- https://gist.github.com/ketul93/d717555951174a74c8b4
- can you please review it DrJoel
- @DrJoel
- It will be quick. I have to leave in a few minutes for a demo.
- beagleboneblack.h appears to be OK except some enums and struct members are indented with one space not two. Two is the rule.
- I assume there are no tabs.
- ketul
- ya seen that problem
- @DrJoel
- gpio.c: The API describing Doxygen goes in the .h.
- 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
- ketul
- DrJoel: that is defined in gpio.h
- all the macros
- for errors and application is there in init.c
- @DrJoel
- 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.
- ketul
- ohh k
- @DrJoel
- 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.
- gpio.h: I see the error defining macros but you didn't use them. :)
- And the comments don't describe that method X can return it.
- ketul
- yup didn't use all
- ok that I will comment
- used only "GPIO_SUCCESSFUL"
- @DrJoel
- 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
- 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.
- ketul
- ok sure
- thanks DrJoel
- @DrJoel
- 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.
- Did we decide on a macro a BSP defines in bsp.h when it supports gpio?
- init.c: if( should be "if (
- Some of the if lines look long. Make sure < 80 columns.
- 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.
- Obviously the test is BB specific at this point. See line 14.
- 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
- ketul
- yup :)
- ketul
- 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.
- ok got it
- :)
- so you are talking about adding one more abstraction layer
- @DrJoel
- Does that make two or three layers? I think two are sufficient. Application level and BSP level
- ketul
- ya probably 2 layers
- @DrJoel
- OK.. have to head to demo
- have a great weekend
- ← DrJoel has quit (Quit: Do fish get thirsty?)
- rtems-bot
- [trac] TBR/UserManual/MinGW_Tools_for_Windows edited by gedare (Fix ftp links.) http://devel.rtems.org/wiki/TBR/UserManual/MinGW_Tools_for_Windows
- rtems-bot
- [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
- [trac] 2320/defect">#2320/defect (new) updated by gedare (empty comment) http://devel.rtems.org/ticket/2320
- rtems-bot
- [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
- → Davidbrcz has joined
- ← Davidbrcz has quit (Ping timeout: 256 seconds)
- → hesham has joined
- ← javamonn has quit (Remote host closed the connection)
- → javamonn has joined
- beng-nl
- hi all
- @gedare
- hello beng-nl
- ← zoso has quit (Remote host closed the connection)
- rtems-bot
- [trac] SOCIS/2015 edited by hermann19829 (empty comment) http://devel.rtems.org/wiki/SOCIS/2015
- → Davidbrcz has joined
- ← javamonn has quit (Remote host closed the connection)
- → javamonn has joined
- ← javamonn has quit (Read error: Connection reset by peer)
- → javamonn has joined
- → mumptai has joined
- ketul
- hello beng-nl
- beng-nl
- hi ketul
- ketul
- beng-nl: getting fatal error "fatal error: rtems/gpio.h: No such file or directory"
- I added the header to makefile.am
- @gedare
- ketul: bootstrap -p && bootstrap
- ketul
- all done
- @gedare
- what did you add to Makefile.am?
- ketul
- gedare: ## GPIO API
- include_rtems_HEADERS += include/rtems/gpio.h
- ketul
- even it is showing gpio.h in preinstall.am
- @gedare
- paste the preinstall.am entry here
- ketul
- ok let me
- @gedare
- is this the beagle/Makefile.am?
- ketul
- no its in cpukit/
- @gedare
- k
- ketul
- gedare: $(PROJECT_INCLUDE)/rtems/gpio.h: include/rtems/gpio.h $(PROJECT_INCLUDE)/rtems/$
- $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/gpio.h
- PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/gpio.h
- so I added #include <rtems/gpio.h> in my code
- but giving fatal error
- @gedare
- oh
- anytime you do bootstrap -p and then bootstrap, you basically have to re-run configure and make too
- so in your build dir, rm -rf *
- and re-run configure
- it's a nasty build system, and motivates the waf effort.
- beng-nl
- hear hear :)
- ketul
- :) yes beng-nl
- ketul
- gedare: yes I followed all the steps from "./bootstrap; ./bootstrap -p" to "make"
- @gedare
- you have to do bootstrap -p first
- ketul, make sure you ran bootstrap again after bootstrap -p, and then ran configure and make in a clean build directory.
- ketul
- ok gedare let me try it
- @gedare
- ketul: any luck? i'm about to head out for the weekend.
- ketul
- compilation going on
- gedare: have a great weekend
- ketul
- gedare: yup done with that error, but getting another one that I will try to rectify
- gedare: thanks
- ← gedare has quit (Ping timeout: 265 seconds)
- ketul
- beng-nl: :)
- ketul
- beng-nl: wrote "typedef struct gpio_pin_handle;" in gpio.h
- and struct declared in gpio.c
- ketul
- hi gedare free for some time ?
- ← verm__ has quit (Read error: Connection reset by peer)
- → verm__ has joined
- → Davidbrcz has joined
- @gedare
- hi ketul what's up?
- ketul
- hi gedare : have a look at gpio.h @ https://gist.github.com/ketul93/d717555951174a74c8b4
- ketul
- getting error "../../../../../.././beagleboneblack/lib/include/rtems/gpio.h:43:49: error: unknown type name 'gpio_pin_handle'
- extern int rtems_gpio_configure_pin_digital_out(gpio_pin_handle *, unsigned int pin_number);"
- though I declared "typedef struct gpio_pin_handle;"
- @gedare
- sure, the filename is wong for beaglebonenlack.h
- also
- you shouldn't declare the typedef twice, so that is a bit fishy
- probably the struct definition should be in gpio.h and not beaglebonenlack.h
- ketul
- ya file name was typing mistake
- but
- we need to make the gpio.h generalized api
- so abstraction need to be there
- @gedare
- i see
- ketul
- so can't define struct in gpio.h
- so what would you suggest ?
- @gedare
- then you also shouldn't be dereferencing pointers to it
- either you define a struct that is generic across all GPIO implementations
- or you define a struct that the GPIO implementation fills in somehow with some specialization such as function pointers or similar
- ok i'm starting to see the picture
- you want to know how to define the interface in a generic way
- ketul
- struct definition is board specific
- ya kind of
- or is it possible to use void * ?
- @gedare
- then you should not make it a typedef, just forward declare 'struct gpio_pin_handle;'
- ketul
- ok
- @gedare
- and use struct gpio_pin_handle in the interface functions
- i think that should work...
- *thinks*
- otherwise, you define the struct there, and you let the gpio implementation sort of over-ride it, like...
- typedef struct {
- ... generic stuff
- } gpio_pin_handle;
- in bbb_gpio.h:
- typedef struct {
- gpio_pin_handle super;
- ... specific bbb stuff;
- } bbb_pin_handle;
- ketul
- struct gpio_pin_handle isn't worked
- yup that sounds good
- @gedare
- it means you should create structs of type bbb_pin_handle
- and then you pass those to the gpio interface functions
- ok now i have to go. mock that together and see what you come up with i suppose. happy hacking!
- ketul
- yes definitions need to be there in gpio.h otherwise it won't work
- okk
- bye
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement