#ifndef _FM_MANAGE_H #define _FM_MANAGE_H #include "printf.h" #include "cpu.h" #include "asm/iic_hw.h" #include "asm/iic_soft.h" #include "timer.h" #include "app_config.h" #include "event.h" #include "system/includes.h" #include "typedef.h" #define FREQ_STEP (100)//100 步进 #define REAL_FREQ_MIN (8750) #define REAL_FREQ_MAX (10800) #define VIRTUAL_FREQ_STEP (FREQ_STEP/10) #define REAL_FREQ(x) ((REAL_FREQ_MIN-VIRTUAL_FREQ_STEP) + (x)*VIRTUAL_FREQ_STEP) #define VIRTUAL_FREQ(x) ((x - (REAL_FREQ_MIN-VIRTUAL_FREQ_STEP))/VIRTUAL_FREQ_STEP) #define MAX_CHANNEL ((REAL_FREQ_MAX - REAL_FREQ_MIN)/VIRTUAL_FREQ_STEP + 1) enum { FM_CUR_FRE = 0, FM_FRE_DEC = 1, FM_FRE_INC = 2, }; typedef struct { u8(*init)(void *priv); u8(*close)(void *priv); u8(*set_fre)(void *priv, u16 fre); u8(*mute)(void *priv, u8 flag); u8(*read_id)(void *priv); u8 logo[20]; } FM_INTERFACE; struct _fm_dev_info { u8 iic_hdl; u8 iic_delay; //这个延时并非影响iic的时钟频率,而是2Byte数据之间的延时 u8 logo[20]; }; struct _fm_dev_platform_data { u8 iic_hdl; u8 iic_delay; //这个延时并非影响iic的时钟频率,而是2Byte数据之间的延时 }; extern FM_INTERFACE fm_dev_begin[]; extern FM_INTERFACE fm_dev_end[]; #define REGISTER_FM(fm) \ static FM_INTERFACE fm SEC_USED(.fm_dev) #define list_for_each_fm(c) \ for (c=fm_dev_begin; c