📄 sdla_fr.h
字号:
/****************************************************************************** sdla_fr.h Sangoma frame relay firmware API definitions.** Author: Jaspreet Singh <jaspreet@sangoma.com>* Gene Kozin <74604.152@compuserve.com>** Copyright: (c) 1995-1996 Sangoma Technologies Inc.** This program is free software; you can redistribute it and/or* modify it under the terms of the GNU General Public License* as published by the Free Software Foundation; either version* 2 of the License, or (at your option) any later version.* ============================================================================* Oct 12, 1997 Jaspreet Singh Added FR_READ_DLCI_IB_MAPPING* Jul 21, 1997 Jaspreet Singh Changed FRRES_TOO_LONG and FRRES_TOO_MANY to * 0x05 and 0x06 respectively.* Dec 23, 1996 Gene Kozin v2.0* Apr 29, 1996 Gene Kozin v1.0 (merged version S502 & S508 definitions).* Sep 26, 1995 Gene Kozin Initial version.*****************************************************************************/#ifndef _SDLA_FR_H#define _SDLA_FR_H/*---------------------------------------------------------------------------- * Notes: * ------ * 1. All structures defined in this file are byte-alined. To ensure * portability of this code between different platforms and compilers, one * of the following defines must be defined before including this file: * * Compiler Platform Define Use option * -------- -------- ------ ---------- * GNU C Linux _GNUC_ - * Microsoft C DOS/Windows _MSC_ - */#ifdef _GNUC_# ifndef PACKED# define PACKED __attribute__((packed))# endif /* PACKED */#else# define PACKED#endif#ifdef _MSC_# pragma pack(1)#endif/* Adapter memory layout */#define FR_MB_VECTOR 0xE000 /* mailbox window vector */#define FR502_RX_VECTOR 0xA000 /* S502 direct receive window vector */#define FR502_MBOX_OFFS 0xF60 /* S502 mailbox offset */#define FR508_MBOX_OFFS 0 /* S508 mailbox offset */#define FR502_FLAG_OFFS 0x1FF0 /* S502 status flags offset */#define FR508_FLAG_OFFS 0x1000 /* S508 status flags offset */#define FR502_RXMB_OFFS 0x900 /* S502 direct receive mailbox offset */#define FR508_TXBC_OFFS 0x1100 /* S508 Tx buffer info offset */#define FR508_RXBC_OFFS 0x1120 /* S508 Rx buffer info offset *//* Important constants */#define FR502_MAX_DATA 4096 /* maximum data buffer length */#define FR508_MAX_DATA 4080 /* maximum data buffer length *//****** Data Structures *****************************************************//*---------------------------------------------------------------------------- * Frame relay command block. */typedef struct fr_cmd{ unsigned char command PACKED; /* command code */ unsigned short length PACKED; /* length of data buffer */ unsigned char result PACKED; /* return code */ unsigned short dlci PACKED; /* DLCI number */ unsigned char attr PACKED; /* FECN, BECN, DE and C/R bits */ unsigned short rxlost1 PACKED; /* frames discarded at int. level */ unsigned long rxlost2 PACKED; /* frames discarded at app. level */ unsigned char rsrv[2] PACKED; /* reserved for future use */} fr_cmd_t;/* 'command' field defines */#define FR_WRITE 0x01#define FR_READ 0x02#define FR_ISSUE_IS_FRAME 0x03#define FR_SET_CONFIG 0x10#define FR_READ_CONFIG 0x11#define FR_COMM_DISABLE 0x12#define FR_COMM_ENABLE 0x13#define FR_READ_STATUS 0x14#define FR_READ_STATISTICS 0x15#define FR_FLUSH_STATISTICS 0x16#define FR_LIST_ACTIVE_DLCI 0x17#define FR_FLUSH_DATA_BUFFERS 0x18#define FR_ADD_DLCI 0x20#define FR_DELETE_DLCI 0x21#define FR_ACTIVATE_DLCI 0x22#define FR_DEACTIVATE_DLCI 0x22#define FR_READ_MODEM_STATUS 0x30#define FR_SET_MODEM_STATUS 0x31#define FR_READ_ERROR_STATS 0x32#define FR_FLUSH_ERROR_STATS 0x33#define FR_READ_DLCI_IB_MAPPING 0x34#define FR_READ_CODE_VERSION 0x40#define FR_SET_INTR_MODE 0x50#define FR_READ_INTR_MODE 0x51/* 'result' field defines */#define FRRES_OK 0x00 /* command executed successfully */#define FRRES_DISABLED 0x01 /* communications not enabled */#define FRRES_INOPERATIVE 0x02 /* channel inoperative */#define FRRES_DLCI_INACTIVE 0x03 /* DLCI is inactive */#define FRRES_DLCI_INVALID 0x04 /* DLCI is not configured */#define FRRES_TOO_LONG 0x05#define FRRES_TOO_MANY 0x06#define FRRES_CIR_OVERFLOW 0x07 /* Tx throughput has exceeded CIR */#define FRRES_BUFFER_OVERFLOW 0x08#define FRRES_MODEM_FAILURE 0x10 /* DCD and/or CTS dropped */#define FRRES_CHANNEL_DOWN 0x11 /* channel became inoperative */#define FRRES_CHANNEL_UP 0x12 /* channel became operative */#define FRRES_DLCI_CHANGE 0x13 /* DLCI status (or number) changed */#define FRRES_DLCI_MISMATCH 0x14#define FRRES_INVALID_CMD 0x1F /* invalid command *//* 'attr' field defines */#define FRATTR_/*---------------------------------------------------------------------------- * Frame relay mailbox. * This structure is located at offset FR50?_MBOX_OFFS into FR_MB_VECTOR. * For S502 it is also located at offset FR502_RXMB_OFFS into * FR502_RX_VECTOR. */typedef struct fr_mbox{ unsigned char opflag PACKED; /* 00h: execution flag */ fr_cmd_t cmd PACKED; /* 01h: command block */ unsigned char data[1] PACKED; /* 10h: variable length data buffer */} fr_mbox_t;/*---------------------------------------------------------------------------- * S502 frame relay status flags. * This structure is located at offset FR502_FLAG_OFFS into FR_MB_VECTOR. */typedef struct fr502_flags{ unsigned char rsrv1[1] PACKED; /* 00h: */ unsigned char tx_ready PACKED; /* 01h: Tx buffer available */ unsigned char rx_ready PACKED; /* 02h: Rx frame available */ unsigned char event PACKED; /* 03h: asynchronous event */ unsigned char mstatus PACKED; /* 04h: modem status */ unsigned char rsrv2[8] PACKED; /* 05h: */ unsigned char iflag PACKED; /* 0Dh: interrupt flag */ unsigned char imask PACKED; /* 0Eh: interrupt mask */} fr502_flags_t;/*---------------------------------------------------------------------------- * S508 frame relay status flags. * This structure is located at offset FR508_FLAG_OFFS into FR_MB_VECTOR. */typedef struct fr508_flags{ unsigned char rsrv1[3] PACKED; /* 00h: reserved */ unsigned char event PACKED; /* 03h: asynchronous event */ unsigned char mstatus PACKED; /* 04h: modem status */ unsigned char rsrv2[11] PACKED; /* 05h: reserved */ unsigned char iflag PACKED; /* 10h: interrupt flag */ unsigned char imask PACKED; /* 11h: interrupt mask */ unsigned long tse_offs PACKED; /* 12h: Tx status element */ unsigned short dlci PACKED; /* 16h: DLCI NUMBER */} fr508_flags_t;/* 'event' field defines */#define FR_EVENT_STATUS 0x01 /* channel status change ??? */#define FR_EVENT_DLC_STATUS 0x02 /* DLC status change */#define FR_EVENT_BAD_DLCI 0x04 /* FSR included wrong DLCI */#define FR_EVENT_LINK_DOWN 0x40 /* DCD or CTS low *//* 'mstatus' field defines */#define FR_MDM_DCD 0x08 /* mdm_status: DCD */#define FR_MDM_CTS 0x20 /* mdm_status: CTS *//* 'iflag' & 'imask' fields defines */#define FR_INTR_RXRDY 0x01 /* Rx ready */#define FR_INTR_TXRDY 0x02 /* Tx ready */#define FR_INTR_MODEM 0x04 /* modem status change (DCD, CTS) */#define FR_INTR_READY 0x08 /* interface command completed */#define FR_INTR_DLC 0x10 /* DLC status change */#define FR_INTR_TIMER 0x20 /* millisecond timer *//*---------------------------------------------------------------------------- * Receive Buffer Configuration Info. S508 only! * This structure is located at offset FR508_RXBC_OFFS into FR_MB_VECTOR. */typedef struct fr_buf_info{ unsigned short rse_num PACKED; /* 00h: number of status elements */ unsigned long rse_base PACKED; /* 02h: receive status array base */ unsigned long rse_next PACKED; /* 06h: next status element */ unsigned long buf_base PACKED; /* 0Ah: rotational buffer base */ unsigned short reserved PACKED; /* 0Eh: */ unsigned long buf_top PACKED; /* 10h: rotational buffer top */} fr_buf_info_t;/*---------------------------------------------------------------------------- * Buffer Status Element. S508 only! * Array of structures of this type is located at offset defined by the * 'rse_base' field of the frBufInfo_t structure into absolute adapter * memory address space. */typedef struct fr_buf_ctl{ unsigned char flag PACKED; /* 00h: ready flag */ unsigned short length PACKED; /* 01h: frame length */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -