?? icu.h
字號:
/*----------------------------------------------------------------------------
* Copyright (c) 2001 by National Semiconductor Corporation
* National Semiconductor Corporation
*
* All rights reserved
*
*<<<-------------------------------------------------------------------------
* File Contents:
* icu.c - ICU related definitions
*
* Project: USB Demo firmware
* Author : Yan Nosovitsky
* Date : Oct 2001
*----------------------------------------------------------------------->>>*/
#ifndef __icu_h__
#define __icu_h__
/* INTVECT value Definition */
# define MASKABLE_INTS_BASE 0x10
# define MASKABLE_INTS_LAST 0x2F
# define INT_TAB_SIZE 0x30
/* Internal interrupts */
#define TWM_INT 13
/* External interrupts */
#define DRQ_INT 17
#define USB_NODE_INT 31
#define TIMER_INT 7
/* Events values */
#define EVT_USB_BULK_RX 0x01
#define EVT_USB_BULK_TX 0x02
#define EVT_TIMER_INT 0x04
#define EVT_USB_ISO_RX 0x08
#define EVT_USB_ISO_TX 0x10
#define EVT_MASK (EVT_USB_BULK_RX | EVT_USB_BULK_TX | EVT_TIMER_INT | EVT_USB_ISO_RX | EVT_USB_ISO_TX)
/* Voyager reset and watchdog macro */
#define WATCHDOG_RESET \
TWCFG = TWCFG_WDSDME; \
WDSDM = 0
#define WATCHDOG_COUNT 60
#define WATCHDOG_INIT \
ICU_unmask_int(TIMER_INT); \
T1CRA=0x8000; \
T1CKC=0x4; \
T1CTRL=0x2+16
#define WATCHDOG_START \
T1ICTL=16; \
T1ICLR |= 1
#define WATCHDOG_STOP \
T1ICTL=0
#define TOUCH_WATCHDOG(interval) \
WatchdogTime = interval
/* event table variable */
#ifndef parser_c
extern volatile unsigned int event_table;
extern volatile unsigned int WatchdogTime;
#else
volatile unsigned int event_table = 0; // First initialization
volatile unsigned int WatchdogTime = WATCHDOG_COUNT;
#endif
/* Send event prototype */
#define send_event(X) event_table |= X
#define clear_event(X) { \
_di_(); \
event_table &= ~X; \
_ei_(); \
}
#define IENAM0_LAST 7
#define ISTAT0_LAST 7
#define PSR_E_BIT 9
#define PSR_E_BIT_MASK (1 << PSR_E_BIT)
#define PSR_I_BIT 11
#define PSR_I_BIT_MASK (1 << PSR_I_BIT)
#define ICU_CLEAR_INT(int_no) if (int_no < 16) IECLR0 = (1 << (int_no % 16)); else IECLR1 = (1 << (int_no % 16))
#define ICU_MASK_INT(int_no) if (int_no < 16) IENAM0 &= ~(1 << (int_no % 16)); else IENAM1 &= ~(1 << (int_no % 16))
#define ICU_UNMASK_INT(int_no) if (int_no < 16) IENAM0 |= (1 << (int_no % 16)); else IENAM1 |= (1 << (int_no % 16))
#define ICU_INT_IS_MASKED(int_no) ((int_no < 16) ? ((IENAM0 & (1 << (int_no % 16))) == 0): ((IENAM1 & (1 << (int_no % 16)) ) == 0) )
#define ICU_INT_IS_UNMASKED(int_no) ((int_no < 16) ? (IENAM0 & (1 << (int_no % 16))) : (IENAM1 & (1 << (int_no % 16)) ) )
#define ICU_STATUS_INT(int_no) ((int_no < 16) ? (ISTAT0 & (1 << (int_no % 16))) : (ISTAT1 & (1 << (int_no % 16)) ) )
#define ICU_enable_interrupts() _ei_()
#define ICU_disable_interrupts() _di_()
extern int main();
extern int panic(char *str);
extern void null_handler(void);
extern void ICU_init(void);
extern void ICU_mask_int(int int_no);
extern void ICU_unmask_int(int int_no);
extern void ICU_clear_int(/* int_no */);
extern void ICU_install_handler(int int_no, handler_t handler_func);
#endif __icu_h__
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -