00001
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 #ifndef _DACIFB_H_
00049 #define _DACIFB_H_
00050
00051 #include <avr32/io.h>
00052 #include "compiler.h"
00053
00054 #if UC3C
00055 #define AVR32_FLASHC_CALIBRATION_FOURTH_WORD_ADDRESS 0x8080020C
00056 #endif
00057
00060 #define DACIFB_CHANNEL_SELECTION_NONE 0x0
00061 #define DACIFB_CHANNEL_SELECTION_A 0x1
00062 #define DACIFB_CHANNEL_SELECTION_B 0x2
00063 #define DACIFB_CHANNEL_SELECTION_AB 0x3
00064
00067 #define DACIFB_REFERENCE_EXT 0x0
00068 #define DACIFB_REFERENCE_VDDANA 0x1
00069
00072 #define DACIFB_TRIGGER_MODE_MANUAL 0x0
00073 #define DACIFB_TRIGGER_MODE_TIMER 0x1
00074 #define DACIFB_TRIGGER_MODE_EVENT 0x2
00075
00077
00079 #define DACIFB_CONFIGURATION_REFUSED 0x0
00080
00082 #define DACIFB_CONFIGURATION_ACCEPTED 0x1
00083
00085 #define DACIFB_STATUS_COMPLETED 0x2
00086
00088 #define DACIFB_STATUS_NOT_COMPLETED 0x3
00089
00092 #define DACIFB_CHI_MIN_VALUE 500000
00093
00096 #define DACIFB_CHRx_MIN_VALUE 40000
00097
00100 #define DACIFB_CHRx_MAX_VALUE 33333
00101
00103 typedef struct
00104 {
00106 Bool reference;
00107
00109 U8 channel_selection;
00110
00112 U8 gain_calibration_value;
00113
00115 U8 offset_calibration_value;
00116
00118 Bool low_power;
00119
00121 Bool dual;
00122
00124 U32 prescaler_clock_hz;
00125
00126 } dacifb_opt_t;
00127
00129 typedef struct
00130 {
00132 Bool auto_refresh_mode;
00133
00135 U8 trigger_mode;
00136
00138 Bool left_adjustment;
00139
00141 U8 data_shift;
00142
00144 Bool data_round_enable;
00145
00146 } dacifb_channel_opt_t;
00147
00154 extern void dacifb_get_calibration_data( volatile avr32_dacifb_t * dacifb,
00155 dacifb_opt_t * p_dacifb_opt,
00156 U8 instance);
00157
00166 extern U8 dacifb_configure(volatile avr32_dacifb_t * dacifb,
00167 dacifb_opt_t * p_dacifb_opt,
00168 U32 pb_hz);
00169
00178 extern U8 dacifb_configure_channel(volatile avr32_dacifb_t * dacifb,
00179 U8 channel,
00180 dacifb_channel_opt_t * p_dacifb_channel_opt,
00181 U32 prescaler_clock_hz);
00182
00188 extern void dacifb_start_channel(volatile avr32_dacifb_t * dacifb,
00189 U8 channel,
00190 U32 cpu_hz);
00191
00199 extern Bool dacifb_check_eoc(volatile avr32_dacifb_t * dacifb,
00200 U8 channel);
00208 extern void dacifb_set_value(volatile avr32_dacifb_t * dacifb,
00209 U8 channel,
00210 Bool dual,
00211 U32 value);
00212
00219 extern void dacifb_reload_timer(volatile avr32_dacifb_t * dacifb,
00220 U8 channel,
00221 U8 timer_us,
00222 U32 prescaler_clock_hz);
00223
00224 #endif // _DACIFB_H_