Created
May 23, 2011 18:41
-
-
Save mbolivar/987258 to your computer and use it in GitHub Desktop.
newyorkbrass code snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See http://forums.leaflabs.com/topic.php?id=739&page=2 | |
class HardwareResourceParams | |
{ | |
public: | |
HardwareResourceParams(); | |
}; | |
class HardwareResource | |
{ | |
public: | |
Start(); | |
Stop(); | |
Setup(HardwareResourceParams * params); | |
}; | |
class DMABuffer | |
{ | |
}; | |
// There may be multiple ways of implementing DMA for variouss purposes | |
class DMABase : public HardwareResource | |
{ | |
public: | |
DMABase(); | |
buffer | |
}; | |
// There may be multiple ways of implementing DMA for variouss purposes | |
// Class implementing DMA Reading with double bouffering | |
class DMAReader : public HardwareResource | |
{ | |
public: | |
DMAReader(); | |
int read(void * buffer, int n); | |
buffer | |
}; | |
// Class implementing DMA Writing with double bouffering | |
class DMAWriter : public HardwareResource | |
{ | |
public: | |
DMAWriter(); | |
int write(void * buffer, int n); | |
DMABuffer buffer; | |
}; | |
And finally we have: | |
class ADC : public HardwareResource | |
{ | |
public: | |
ADC(){ // } | |
Setup(...); | |
// read a single word | |
int Read(); | |
}; | |
} | |
class DAC : public HardwareResource | |
{ | |
public: | |
DAC(){ // } | |
Setup(...); | |
// Send a single word | |
Write(int data); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment