⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usbhal.h

📁 PDIUSBD12的嵌入式软件
💻 H
字号:
/*
*
*   usbhal.h
*
*   Def's for PDIUSBD12 USB device comm's - "hardware abstraction layer"
*   Platform-dependent I/O support.
*   MJB - Nov.2005
*/

#ifndef __USBHAL_H__
#define __USBHAL_H__


/* D12 base address (for processors with memory-mapped I/O) */
extern  volatile uchar * const PDIUSBD12_Addr;

/*
*   If USB comm's is totally interrupt-driven, DISABLE_USB_IRQ and RESTORE_USB_IRQ
*   can be defined as "do nothing", provided that the USB ISR and its sub-functions
*   do not re-enable the USB IRQ prior to exit from the ISR.
*
*   Where a USB function is called from a background task, the USB function is prevented from
*   being interrupted by means of calls to disable_USB_interrupt() and restore_USB_interrupt().
*   Note that restore_USB_interrupt() will only re-enable USB IRQ's if they were already
*   enabled at the time disable_USB_interrupt() was last called.
*/
#define  DISABLE_USB_IRQ  { if ( USBflags.bits.in_isr == FALSE )  disable_USB_interrupt(); }
#define  RESTORE_USB_IRQ  { if ( USBflags.bits.in_isr == FALSE )  restore_USB_interrupt(); }


/*
*   <reg> values for I/O macros below...
*/
#define  D12_DATA       (0)

#ifdef   MOTOROLA_68K
#define  D12_COMMAND    (2)     /* I/O registers are word-aligned (D12_A0 == MCU_A01 ) */
#else
#define  D12_COMMAND    (1)     /* I/O registers are byte-aligned */
#endif

/*
*   Macro:  Output byte (command or data) to PDIUSBD12 register
*
*   Arg's:  reg --  0 => select data mode, else select command mode
*           b   --  byte value to be written
*/
#define  d12outp(reg,b)  ( *(PDIUSBD12_Addr + reg) = b )

/*
*   Macro:  Input data byte from PDIUSBD12 register
*
*   Arg's:  reg --  2 => select command mode, 0 => select data mode
*/
#define  d12inp(reg)  ( *(PDIUSBD12_Addr + reg) )


#endif  /* __USBHAL_H__ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -