Subversion Repositories HelenOS

Rev

Rev 4307 | Rev 4351 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4307 Rev 4327
Line 32... Line 32...
32
 
32
 
33
/** @file
33
/** @file
34
 */
34
 */
35
 
35
 
36
#include <assert.h>
36
#include <assert.h>
-
 
37
#include <async.h>
37
#include <ddi.h>
38
#include <ddi.h>
38
#include <errno.h>
39
#include <errno.h>
39
#include <malloc.h>
40
#include <malloc.h>
40
//#include <stdio.h>
41
//#include <stdio.h>
41
#include <ipc/ipc.h>
42
#include <ipc/ipc.h>
Line 68... Line 69...
68
        .addr = NULL,
69
        .addr = NULL,
69
        .dstarg = 2
70
        .dstarg = 2
70
    },
71
    },
71
    {
72
    {
72
        .cmd = CMD_PREDICATE,
73
        .cmd = CMD_PREDICATE,
73
        .value = 2,
74
        .value = 1,
74
        .srcarg = 2
75
        .srcarg = 2
75
    },
76
    },
76
    {   .cmd = CMD_PIO_WRITE_8,
77
/*  {   .cmd = CMD_PIO_WRITE_8,
77
        .addr = NULL,
78
        .addr = NULL,
78
        .srcarg = 2
79
        .value = 0
79
    },
80
    },
80
    {
81
*/  {
81
        .cmd = CMD_ACCEPT
82
        .cmd = CMD_ACCEPT
82
    }
83
    }
83
};
84
};
84
 
85
 
85
static irq_code_t   dp8390_code = {
86
static irq_code_t   dp8390_code = {
Line 139... Line 140...
139
    return EOK;
140
    return EOK;
140
}
141
}
141
 
142
 
142
void irq_handler( ipc_callid_t iid, ipc_call_t * call )
143
void irq_handler( ipc_callid_t iid, ipc_call_t * call )
143
{
144
{
144
//  int irq;
-
 
145
    device_ref  device;
145
    device_ref  device;
146
    dpeth_t *   dep;
146
    dpeth_t *   dep;
147
    packet_t    received;
147
    packet_t    received;
148
    device_id_t device_id;
148
    device_id_t device_id;
149
    int         phone;
149
    int         phone;
150
 
150
 
-
 
151
//  async_serialize_start();
151
    device_id = IRQ_GET_DEVICE( call );
152
    device_id = IRQ_GET_DEVICE( call );
152
//  printf( "device %d - irq %x\n", device_id, IPC_GET_ISR( call ));
-
 
153
    rwlock_write_lock( & netif_globals.lock );
153
    rwlock_write_lock( & netif_globals.lock );
154
    if( find_device( device_id, & device ) != EOK ){
154
    if( find_device( device_id, & device ) != EOK ){
155
        rwlock_write_unlock( & netif_globals.lock );
155
        rwlock_write_unlock( & netif_globals.lock );
-
 
156
//      async_serialize_end()
156
        return;
157
        return;
157
    }
158
    }
158
    dep = ( dpeth_t * ) device->specific;
159
    dep = ( dpeth_t * ) device->specific;
159
//  printf( "dev %d, irq %x\n\n", device->device_id, IPC_GET_ISR( call ));
-
 
160
    if ( dep->de_mode != DEM_ENABLED){
160
    if ( dep->de_mode != DEM_ENABLED){
161
//      continue;
-
 
162
        rwlock_write_unlock( & netif_globals.lock );
161
        rwlock_write_unlock( & netif_globals.lock );
-
 
162
//      async_serialize_end()
163
        return;
163
        return;
164
    }
164
    }
165
    assert( dep->de_flags & DEF_ENABLED);
165
    assert( dep->de_flags & DEF_ENABLED);
166
//  irq= dep.de_irq;
166
    dep->de_int_pending= 0;
167
//  assert(irq >= 0 && irq < NR_IRQ_VECTORS);
167
    printf( "I%d -%d\n", device_id, IPC_GET_ISR( call ));
168
//      if ( dep->de_int_pending || 1)
168
/*  putchar( 'I' );
169
//      {
-
 
170
        dep->de_int_pending= 0;
169
    putchar( '0' + device_id );
171
        dp_check_ints( dep );
170
    putchar( '-' );
172
//      do_int(dep);
171
    putchar( '0' + IPC_GET_ISR( call ) / 100 );
173
/*      r= sys_irqenable(&dep->de_hook);
172
    putchar( '0' + ( IPC_GET_ISR( call ) % 100 ) / 10 );
174
        if (r != OK)
173
    putchar( '0' + IPC_GET_ISR( call ) % 10 );
175
        {
-
 
176
            panic("DP8390",
174
    putchar( '\n' );
177
            "unable enable interrupts", r);
175
*/  dp_check_ints( dep, IPC_GET_ISR( call ));
178
        }
-
 
179
*///    }
-
 
180
    if( dep->received_queue ){
176
    if( dep->received_queue ){
181
        received = dep->received_queue;
177
        received = dep->received_queue;
182
        phone = device->nil_phone;
178
        phone = device->nil_phone;
183
        dep->received_queue = NULL;
179
        dep->received_queue = NULL;
184
        rwlock_write_unlock( & netif_globals.lock );
180
        rwlock_write_unlock( & netif_globals.lock );
185
        nil_received_msg( phone, device_id, received, NULL );
181
        nil_received_msg( phone, device_id, received, NULL );
186
    }else{
182
    }else{
187
        rwlock_write_unlock( & netif_globals.lock );
183
        rwlock_write_unlock( & netif_globals.lock );
188
    }
184
    }
189
    ipc_answer_0( iid, EOK );
185
    ipc_answer_0( iid, EOK );
-
 
186
//      async_serialize_end()
190
}
187
}
191
 
188
 
192
int netif_probe_auto_message( void ){
189
int netif_probe_auto_message( void ){
193
    return ENOTSUP;
190
    return ENOTSUP;
194
}
191
}
Line 234... Line 231...
234
 
231
 
235
    device_ref  device;
232
    device_ref  device;
236
    dpeth_t *   dep;
233
    dpeth_t *   dep;
237
    packet_t    next;
234
    packet_t    next;
238
 
235
 
-
 
236
    ERROR_PROPAGATE( find_device( device_id, & device ));
-
 
237
    dep = ( dpeth_t * ) device->specific;
-
 
238
//  TODO remove debug dump:
239
    uint8_t *   data;
239
    uint8_t *   data;
240
    data = packet_get_data( packet );
240
    data = packet_get_data( packet );
241
    printf( "Sending packet:\n\tid\t= %d\n\tlength\t= %d\n\tdata\t= %.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX\n\t\t%.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX\n", packet_get_id( packet ), packet_get_data_length( packet ), data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ], data[ 4 ], data[ 5 ], data[ 6 ], data[ 7 ], data[ 8 ], data[ 9 ], data[ 10 ], data[ 11 ], data[ 12 ], data[ 13 ], data[ 14 ], data[ 15 ], data[ 16 ], data[ 17 ], data[ 18 ], data[ 19 ], data[ 20 ], data[ 21 ], data[ 22 ], data[ 23 ], data[ 24 ], data[ 25 ], data[ 26 ], data[ 27 ], data[ 28 ], data[ 29 ], data[ 30 ], data[ 31 ], data[ 32 ], data[ 33 ], data[ 34 ], data[ 35 ], data[ 36 ], data[ 37 ], data[ 38 ], data[ 39 ], data[ 40 ], data[ 41 ], data[ 42 ], data[ 43 ], data[ 44 ], data[ 45 ], data[ 46 ], data[ 47 ], data[ 48 ], data[ 49 ], data[ 50 ], data[ 51 ], data[ 52 ], data[ 53 ], data[ 54 ], data[ 55 ], data[ 56 ], data[ 57 ], data[ 58 ], data[ 59 ] );
241
    printf( "Sending packet:\n\tid\t= %d\n\tlength\t= %d\n\tdata\t= %.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX\n\t\t%.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX\n", packet_get_id( packet ), packet_get_data_length( packet ), data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ], data[ 4 ], data[ 5 ], data[ 6 ], data[ 7 ], data[ 8 ], data[ 9 ], data[ 10 ], data[ 11 ], data[ 12 ], data[ 13 ], data[ 14 ], data[ 15 ], data[ 16 ], data[ 17 ], data[ 18 ], data[ 19 ], data[ 20 ], data[ 21 ], data[ 22 ], data[ 23 ], data[ 24 ], data[ 25 ], data[ 26 ], data[ 27 ], data[ 28 ], data[ 29 ], data[ 30 ], data[ 31 ], data[ 32 ], data[ 33 ], data[ 34 ], data[ 35 ], data[ 36 ], data[ 37 ], data[ 38 ], data[ 39 ], data[ 40 ], data[ 41 ], data[ 42 ], data[ 43 ], data[ 44 ], data[ 45 ], data[ 46 ], data[ 47 ], data[ 48 ], data[ 49 ], data[ 50 ], data[ 51 ], data[ 52 ], data[ 53 ], data[ 54 ], data[ 55 ], data[ 56 ], data[ 57 ], data[ 58 ], data[ 59 ] );
242
 
242
 
243
    ERROR_PROPAGATE( find_device( device_id, & device ));
-
 
244
    dep = ( dpeth_t * ) device->specific;
-
 
245
    // process packet queue
243
    // process packet queue
246
    do{
244
    do{
247
        next = pq_detach( packet );
245
        next = pq_detach( packet );
248
        if( do_pwrite( dep, packet, FALSE ) != EBUSY ){
246
        if( do_pwrite( dep, packet, FALSE ) != EBUSY ){
249
            netif_pq_release( packet_get_id( packet ));
247
            netif_pq_release( packet_get_id( packet ));
250
        }
248
        }
251
        packet = next;
249
        packet = next;
252
    }while( packet );
250
    }while( packet );
-
 
251
    dp8390_dump( dep );
253
    return EOK;
252
    return EOK;
254
}
253
}
255
 
254
 
256
int netif_start_message( device_ref device ){
255
int netif_start_message( device_ref device ){
257
    ERROR_DECLARE;
256
    ERROR_DECLARE;