/*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ #ifndef _ubik2_interface_h_ #define _ubik2_interface_h_ /*-----------------------------------------------------------------------------------------------*\ \*-----------------------------------------------------------------------------------------------*/ #define MODULE_NAME "ubik2" #define UBIK2_DEBUG /*-----------------------------------------------------------------------------------------------*\ \*-----------------------------------------------------------------------------------------------*/ #if defined(__KERNEL__) #if defined(UBIK2_DEBUG) #define DEB_ERR(args...) printk(KERN_ERR args) #define DEB_WARN(args...) printk(KERN_WARNING args) /*--- #define DEB_INFO(args...) printk(KERN_INFO args) ---*/ #define DEB_INFO(args...) /*--- #define DEB_TRC(args...) printk(KERN_INFO args) ---*/ #define DEB_TRC(args...) #else /*--- #if defined(MANU_DEBUG) ---*/ #define DEB_ERR(args...) printk(KERN_ERR args) #define DEB_WARN(args...) #define DEB_INFO(args...) #define DEB_TRC(args...) #endif /*--- #else ---*/ /*--- #if defined(MANU_DEBUG) ---*/ #include #endif /*--- #if defined(__KERNEL__) ---*/ /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ enum _logic_chan_ll { logic_chan_ubik2_boot_phase_0 = 0, logic_chan_ubik2_boot_phase_1 = 1, logic_chan_ubik2_boot_phase_2 = 2, logic_chan_ubik2_boot_phase_last = 3, logic_chan_ubik2_dsp_loopback = 7, logic_chan_ubik2_through_data = 8, logic_chan_ubik2_remote_loopback = 9, logic_no_chan = 30, logic_chan_last = 31 }; /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ #define LOGIC_CHAN_LL_NAMES { \ "chan_ubik2_boot_phase_0", \ "chan_ubik2_boot_phase_1", \ "chan_ubik2_boot_phase_2", \ "chan_ubik2_boot_phase_last", \ "chan_ubik2_unused_4", \ "chan_ubik2_unused_5", \ "chan_ubik2_unused_6", \ "chan_ubik2_dsp_loopback", \ "chan_ubik2_through_data", \ "chan_ubik2_remote_loopback", \ "chan_ubik2_unused_10", \ "chan_ubik2_unused_11", \ "chan_ubik2_unused_12", \ "chan_ubik2_unused_13", \ "chan_ubik2_unused_14", \ "chan_ubik2_unused_15", \ "chan_ubik2_unused_16", \ "chan_ubik2_unused_17", \ "chan_ubik2_unused_18", \ "chan_ubik2_unused_19", \ "chan_ubik2_unused_20", \ "chan_ubik2_unused_21", \ "chan_ubik2_unused_22", \ "chan_ubik2_unused_23", \ "chan_ubik2_unused_24", \ "chan_ubik2_unused_25", \ "chan_ubik2_unused_26", \ "chan_ubik2_unused_27", \ "chan_ubik2_unused_28", \ "chan_ubik2_unused_29", \ "no_chan", \ "chan_last" \ } /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ enum _ubik2_boot_phase { ubik2_boot_phase_reset, ubik2_boot_phase_0_send, ubik2_boot_phase_0_done, ubik2_boot_phase_1_send, ubik2_boot_phase_1_done, ubik2_boot_phase_2_send, ubik2_boot_phase_2_done, ubik2_boot_phase_3_send, ubik2_boot_phase_run }; /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ enum _logic_chan_ul { logic_chan_Messages, logic_chan_D_Kanal, logic_chan_Manhattan0_Data, logic_chan_Manhattan1_Data, logic_chan_Manhattan2_Data, logic_chan_Transparent }; /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ union __transport_header { struct _transport_header_ul { /*--- Upper Layer ---*/ unsigned int Len : 13; enum _logic_chan_ul chan : 5; unsigned int BlockNr : 5; unsigned int FreeUpTo : 5; unsigned int Ready : 1; unsigned int PoolFlag : 3; /*--- undef only for local use ---*/ } header_ul; struct _transport_header_ll { /*--- Lower Layer ---*/ unsigned int Len : 13; enum _logic_chan_ll chan : 5; unsigned int BlockNr : 5; unsigned int FreeUpTo : 5; unsigned int Ready : 1; unsigned int PoolFlag : 3; /*--- undef only for local use ---*/ } header_ll; unsigned int i; }; #define UBIK2_LL_DATA_BLOCK_SIZE 256 #define UBIK2_LL_BLOCK_SIZE (UBIK2_LL_DATA_BLOCK_SIZE + sizeof(union __transport_header)) #if defined(__KERNEL__) /*------------------------------------------------------------------------------------------*\ * KERNEL INCLUDE * KERNEL INCLUDE * KERNEL INCLUDE * KERNEL INCLUDE * KERNEL INCLUDE * \*------------------------------------------------------------------------------------------*/ struct _ubik2_queue { unsigned int read; /*--- index in das array ---*/ unsigned int write; /*--- index in das array ---*/ unsigned int size; /*--- anzahl der void * elemente in der Queue ---*/ void **ptr[2]; /*--- pointer auf Queue buffer (index 0: DSP, index 1: MIPS Adresssicht) ---*/ #define UBIK2_ADDRESS_MAP_DSP 0 #define UBIK2_ADDRESS_MAP_MIPS 1 }; /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ struct _ubik2 { unsigned int major; unsigned int ToUbik2BufferCount; unsigned int protokoll_fehler; enum _ubik2_boot_phase boot_phase; }; extern struct _ubik2 ubik2; /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ struct _ubik2_device_list { devfs_handle_t devfs_handle; unsigned int minor; char *Name; }; /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ struct _ubik2_open_data { #define UBIK2_WAIT_READ 1 #define UBIK2_WAIT_WRITE 2 unsigned int open_index; unsigned int wait_flag; unsigned int kernel_open; enum _logic_chan_ll chan; unsigned int do_signal; wait_queue_head_t wait_queue; struct fown_struct *pf_owner; struct fasync_struct *fasync; struct _ubik2_queue LocalToMIPS; unsigned int last_block_len; }; /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ unsigned int ubik2_put(struct _ubik2_open_data *open_data, void *data, unsigned int *write_length); unsigned int ubik2_final_put(struct _ubik2_open_data *open_data); unsigned int ubik2_get(struct _ubik2_open_data *open_data, unsigned char **rx_buffer, unsigned int *rx_buffer_length); unsigned int ubik2_commit(struct _ubik2_open_data *open_data); unsigned int ubik2_init_interface(unsigned int *); void ubik2_deinit_interface(void); void ubik2_init_debug(unsigned int queue_size); /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ #define UBIK2_OPEN_READ 0 #define UBIK2_OPEN_WRITE 1 extern struct _ubik2_open_data *ubik2_open_chan[2][logic_chan_last + 1]; /*------------------------------------------------------------------------------------------*\ * durch dem ATM Treiber exportierte Funktionen \*------------------------------------------------------------------------------------------*/ enum _status_ubik2_proto { status_rx_avail = 0, status_tx_done = 1, status_dsp_activate = 2, status_dsp_deactivate = 3, status_dsp_proto_error = 4, status_dsp_packet_lost = 5, status_dsp_ubik2_failed = 6, status_ubik2_memerror = 7, status_boot_0_done = 10, status_boot_1_done = 11, status_boot_2_done = 12, status_boot_3_done = 13 }; /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ #define STATUS_UBIK2_PROTO { \ "status_rx_avail", \ "status_tx_done", \ "status_dsp_activate", \ "status_dsp_deactivate", \ "status_dsp_proto_error", \ "status_dsp_packet_lost", \ "status_dsp_ubik2_failed", \ "status_ubik2_memerror", \ "status_unused_7", \ "status_unused_8", \ "status_unused_9", \ "status_boot_0_done", \ "status_boot_1_done", \ "status_boot_2_done", \ "status_boot_3_done", \ "status_unused_14", \ "status_unused_15" \ } /*------------------------------------------------------------------------------------------*\ * Funktionen die ATM Treiber definiert sind \*------------------------------------------------------------------------------------------*/ extern void *atm_dsp_register_ubik2(unsigned int (*ubik2_Status_notify)(enum _status_ubik2_proto)); extern void atm_dsp_release_ubik2(void); extern void atm_dsp_trigger_ubik2(void); extern void atm_dsp_activate_ubik2(void); extern void atm_dsp_deactivate_ubik2(void); extern void atm_dsp_unlock_addr(unsigned int); extern unsigned int atm_dsp_lock_addr(void *); /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ static int ubik2_kernel_open(struct file *filp, enum _logic_chan_ll chan); static int ubik2_kernel_close(struct file *filp); static int ubik2_kernel_read(struct file *filp, char **read_buffer, size_t max_read_length, loff_t *read_pos); static ssize_t ubik2_kernel_write(struct file *filp, const char *write_buffer, size_t write_length, loff_t *write_pos); #endif/*--- #if defined(__KERNEL__) ---*/ #endif /*--- #ifndef _ubik2_interface_h_ ---*/