c++


Finding IRQ index for Linux driver


I am attempting to write a Linux driver to respond to a hardware interrupt.
To register an interrupt callback, I need to use:
request_irq(int num, void * interrupt_handler, static char *interrupt_name, struct platform_device *platform);
However, to use this, I need to know the virtual mapping of the IRQ index I want. I have found this possible function:
struct resource *platform_get_resource(struct platform_device *dev,unsigned int type, unsigned int num);
Where type I believe should be IORESOURCE_IRQ, and num is an index corresponding to a list of resource structs within *dev.
So far I believe the way to set up a platform device is with this:
static struct platform_device *pdev;
static struct resource *res;
int init_module(void){
pdev = platform_device_alloc("platform_name",UNIQUE_ID);
if(!pdev){return -1};
//NEED HELP HERE
res = platform_get_resource(pdev,IRQ_RESOURCE,0);
request_irq(res->start,irq_handler,0,"irq_name",NULL);
}
So I need to understand how to configure pdev so that platform_get_resource knows that I want the IRQ corresponding to index 85, and will give me back the appropriate resource that I can use in request_irq. How can I go about doing this?

Related Links

integerset obtaining the given array
Arduino Invalid conversion from 'char' to 'char*'
virtual ClistCtrl with checkboxes on displayed report list style
Error when modifying vector member of another class
Interrupt Service Routine can't be called directly
Lambda capture by default reference vs named
convert bitset<64> to string every 8 bit
argument of type “int” incompatible with parameter of type “int”
When is the correct time to call restoreState for QHeaderView?
How does it pass lvalue reference to std::forward with CRTP?
Using lower_bound function in loop is giving runtime error?
Problems with rand(), always taking the same random generated number [duplicate]
Reading Credentials file fails with error 32
The mechanism of shared_ptr
C++ specialized function template
Compiler errors with cmath on Mac OS X

Categories

HOME
ruby-on-rails-4
screensaver
veins
asp-classic
g2o
ipad
login
android-gradle
spark-dataframe
rhel
spring-statemachine
integer
cloudify
gun
qtspim
premailer
pex
u2
bus
fxml
affiliate
master-detail
wasapi
jquery-chosen
android-ffmpeg
ggiraph
neoscms
hp-quality-center
puma
aircrack-ng
cloudfoundry-uaa
uwamp
cassandra-3.0
citations
database-theory
angular2-http
card-flip
meta-tags
scalacheck
mapped-drive
khan-academy
auto-value
lighttable
simplemodal
ifttt
nsfontpanel
safe-browsing
gitversion
terminal-emulator
case-class
jsdoc3
smartmeter
ucos
miva
schemaless
sceditor
optional
asana-connect
rpath
ch
nsolid
anthill
simplify
ibm-jazz
traceroute
idiorm
zodb
bitarray
du
mpi4py
pull-request
smslib
android-bundle
zipcode
lastaccesstime
jquery-dynatree
httplib
arbitrary-precision
pre-commit-hook
sharepoint-clientobject
textile
basic-msi
invalidation
mongodb-indexes
alassetslibrary
offlineapps
inter-process-communicat
emacs-semantic
array-formulas
jwebunit
capability
nservicebus3
customer-support
incompatibletypeerror
iphone-4
custom-view
wind-river-workbench
ubuntu-9.10
itsm

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile