General thunking class to allow C-style callbacks to C++ class members - including optional parameters.
Diff: CThunk.h
- Revision:
- 9:d3b51b06ac54
- Parent:
- 8:12fc2cda71af
--- a/CThunk.h Wed Aug 20 14:37:44 2014 +0000 +++ b/CThunk.h Thu Aug 21 17:09:11 2014 +0000 @@ -89,23 +89,28 @@ { m_thunk.context = context; } + + inline uint32_t entry(void) + { + return (((uint32_t)&m_thunk)|CTHUNK_ADDRESS); + } /* get thunk entry point for connecting rhunk to an IRQ table */ inline operator CThunkEntry(void) { - return (CThunkEntry)(((uint32_t)&m_thunk)|CTHUNK_ADDRESS); + return (CThunkEntry)entry(); } /* get thunk entry point for connecting rhunk to an IRQ table */ inline operator uint32_t(void) { - return (uint32_t)&m_thunk; + return entry(); } /* simple test function */ inline void call(void) { - ((CThunkEntry)(((uint32_t)&m_thunk)|CTHUNK_ADDRESS))(); + ((CThunkEntry)(entry())(); } private: