aboutsummaryrefslogtreecommitdiff
path: root/fmdriver/fmdriver_common.h
diff options
context:
space:
mode:
authorTakamichi Horikawa <takamichiho@gmail.com>2017-03-27 23:28:47 +0900
committerTakamichi Horikawa <takamichiho@gmail.com>2017-03-27 23:28:47 +0900
commitc5a386c9e2cce061310f3660e4898218dabbec31 (patch)
treea031fb49765e3891a0f58427a051ea6ffeaabf2e /fmdriver/fmdriver_common.h
parented25c02966bf944aad480c11fefe34c0f46a728b (diff)
PMD: add initial PPZ8 support
Diffstat (limited to 'fmdriver/fmdriver_common.h')
-rw-r--r--fmdriver/fmdriver_common.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/fmdriver/fmdriver_common.h b/fmdriver/fmdriver_common.h
index 2700336..30cf12c 100644
--- a/fmdriver/fmdriver_common.h
+++ b/fmdriver/fmdriver_common.h
@@ -7,6 +7,10 @@ static inline uint16_t read16le(const uint8_t *ptr) {
return (unsigned)ptr[0] | (((unsigned)ptr[1])<<8);
}
+static inline uint32_t read32le(const uint8_t *ptr) {
+ return (uint32_t)ptr[0] | (((uint32_t)ptr[1])<<8) | (((uint32_t)ptr[2])<<16) | (((uint32_t)ptr[3])<<24);
+}
+
static inline int8_t u8s8(uint8_t v) {
return (v & 0x80) ? ((int16_t)v)-0x100 : v;
}
@@ -15,6 +19,20 @@ static inline int16_t u16s16(uint16_t v) {
return (v & 0x8000u) ? ((int32_t)v)-0x10000l : v;
}
+static inline void fmdriver_fillpcmname(char *dest, const char *src) {
+ int i;
+ for (i = 0; i < 8; i++) {
+ dest[i] = src[i];
+ if (!src[i]) break;
+ }
+ if (src[i]) i = 0;
+
+ for (; i < 8; i++) {
+ dest[i] = ' ';
+ }
+ dest[i] = 0;
+}
+
uint8_t fmdriver_fm_freq2key(uint16_t freq);
uint8_t fmdriver_ssg_freq2key(uint16_t freq);