📄 cdr04iic.h
字号:
/* == IDENTIFICATION ================================================== * * Copyright (C) 2004, Philips Semiconductors Nuernberg * * System : Vega Family * Component : PT or FT * Module : DRIVER * Unit : IIC Bus Driver * File : cdr04iic.h * * @(#) %filespec: cdr04iic.h-45 % *//* == HISTORY ========================================================= *//* * Name Date Ver Action * -------------------------------------------------------------------- * tcmc_asb 25-Feb-2004 45 D53:PR297, more flexible interface for common * use in different projects: * p_dr14_IICSetDackn * p_dr14_IICSetClk * tcmc_hyu 07-Nov-2001 rework after code crosscheck * tcmc_asa 19-Oct-2001 change t_iic_exec to t_dr04_IICExecute * tcmc_ore 23-Jan-2001 DacknDisable is default 0 * tcmc_asa 29-Jan-2001 change __C51__ to __arm * tcmc_asa 30-Nov-2000 created, copied from D46 dr_iic.h * */ /*MPM:::DRIVER::IIC-Bus-handler:cdr04iic.h ============================== *//* *//* ABSTRACT: *//* *//* This module contains public definitions and prototypes of this driver*//* * Global functions to be called by other layers: * ---------------------------------------------- * - p_dr14_IICDackn * - p_dr14_IICImmediate * - p_dr14_IICRead * - p_dr14_IICSchedule * - p_dr14_IICTransmit * - p_dr14_IICWrite * * Layer local functions to be called from inside this layer: * ---------------------------------------------------------- * - p_dr14_IICInit * - p_dr14_IICSetDackn * - p_dr14_IICSetClk * - p_dr14_IICInterrupt * * Unit functions to be called only by this unit: * ---------------------------------------------- * - None *//* == DECLARATION OF TYPES ====================================== *//* */#ifndef cdr04_h# define cdr04_h# ifdef cdr14_c# define PUBLIC# else# define PUBLIC extern# endif/* == DEFINITION OF CONSTANTS ============================================= */# define DR04_IIC_WRITE 0x00 // part of slave address on bus# define DR04_IIC_READ 0x01 // part of slave address on bus# define DR04_IIC_RESULT 0xFD // store result byte to 'buf'# define DR04_IIC_EXECUTE 0xFE // execute 'buf', parameter nBytes# define DR04_IIC_END_OF_JOBS 0xFF // terminates sequence of IIC_job/* == DECLARATION OF TYPES ================================================ */typedef struct{ u16 un_Ctrl; /* IIC_END_OF_JOBS terminates jobs * IIC_EXECUTE ((t_dr04_IICExecute)buf)(nBytes) * !! executed on irq level !! * IIC_RESULT *(u8 *)buf= state; 1:ok * IIC_WRITE | mod write buf, ctrl ored to devAddr * IIC_READ | mod read buf, ctrl ored to devAddr */ u16 un_NBytes; /* IIC_READ, IIC_WRITE: number of bytes to read or write * IIC_EXECUTE: parameter for function call * IIC_RESULT: don't care */ void*pu8_Buf; /* IIC_READ, IIC_WRITE: buffer to write from or read into * IIC_EXECUTE: address of function to be called * IIC_RESULT: address of result byte */} t_dr04_IICJob;typedef void(* t_dr04_IICExecute)(u16 un_NBytes);/* == DECLARATION OF LITERALS ====================================== *//* *//* == DECLARATION OF GLOBAL DATA ===================================== *//* */#define DR04_IIC_IS_BUSY ( p_dr14_IICBusy())#define DR04_IIC_IS_FREE (!p_dr14_IICBusy())/* == DECLARATION OF FUNCTIONS ======================================== *//* */void p_dr14_IICInit (void);u32 p_dr14_IICDackn (void);u32 p_dr14_IICBusy (void);void p_dr14_IICSetDackn(u32 u8_Pin);void p_dr14_IICSetClk (u32 u8_Clk); // 0/1/2/3 = 36, 48, 72, 96 kHzvoid p_dr14_IICSchedule(u8 u8_Slave, const t_dr04_IICJob *firstJob);/* ** The following macro definition may be used where inline execution ** of p_dr14_IICSchedule is desired.** At the moment only function call supported.*/#define DR04_IIC_SCHEDULE /* u8 u8_Slave, const IIC_job *firstJob */ \/**/ p_dr14_IICSchedulevoid p_dr14_IICTransmit (u8 u8_Slave, const t_dr04_IICJob *firstJob);s32 p_dr14_IICImmediate(u8 u8_Slave,u8 u8_Ctrl,void *pv_Buf,u32 u8_NByt);#define p_dr14_IICWrite(sla,buf,n) \/**/ p_dr14_IICImmediate(sla, DR04_IIC_WRITE, buf, n)#define p_dr14_IICRead(sla,buf,n) \/**/ p_dr14_IICImmediate(sla, DR04_IIC_READ, buf, n)void p_dr14_IICInterrupt(void);#undef PUBLIC#endif /* cdr04_h */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -