1 /* IO interface mux allocator for ETRAX100LX.
2  * Copyright 2004, Axis Communications AB
3  * $Id: io_interface_mux.h,v 1.1 2004/12/13 12:21:53 starvik Exp $
4  */
5 
6 
7 #ifndef _IO_INTERFACE_MUX_H
8 #define _IO_INTERFACE_MUX_H
9 
10 
11 /* C.f. ETRAX100LX Designer's Reference 20.9 */
12 
13 /* The order in enum must match the order of interfaces[] in
14  * io_interface_mux.c */
15 enum cris_io_interface {
16 	/* Begin Non-multiplexed interfaces */
17 	if_eth = 0,
18 	if_serial_0,
19 	/* End Non-multiplexed interfaces */
20 	if_serial_1,
21 	if_serial_2,
22 	if_serial_3,
23 	if_sync_serial_1,
24 	if_sync_serial_3,
25 	if_shared_ram,
26 	if_shared_ram_w,
27 	if_par_0,
28 	if_par_1,
29 	if_par_w,
30 	if_scsi8_0,
31 	if_scsi8_1,
32 	if_scsi_w,
33 	if_ata,
34 	if_csp,
35 	if_i2c,
36 	if_usb_1,
37 	if_usb_2,
38 	/* GPIO pins */
39 	if_gpio_grp_a,
40 	if_gpio_grp_b,
41 	if_gpio_grp_c,
42 	if_gpio_grp_d,
43 	if_gpio_grp_e,
44 	if_gpio_grp_f,
45 	if_max_interfaces,
46 	if_unclaimed
47 };
48 
49 int cris_request_io_interface(enum cris_io_interface ioif, const char *device_id);
50 
51 void cris_free_io_interface(enum cris_io_interface ioif);
52 
53 /* port can be 'a', 'b' or 'g' */
54 int cris_io_interface_allocate_pins(const enum cris_io_interface ioif,
55 				    const char port,
56 				    const unsigned start_bit,
57 				    const unsigned stop_bit);
58 
59 /* port can be 'a', 'b' or 'g' */
60 int cris_io_interface_free_pins(const enum cris_io_interface ioif,
61                                 const char port,
62                                 const unsigned start_bit,
63                                 const unsigned stop_bit);
64 
65 int cris_io_interface_register_watcher(void (*notify)(const unsigned int gpio_in_available,
66 						      const unsigned int gpio_out_available,
67 						      const unsigned char pa_available,
68 						      const unsigned char pb_available));
69 
70 void cris_io_interface_delete_watcher(void (*notify)(const unsigned int gpio_in_available,
71 						     const unsigned int gpio_out_available,
72                                                      const unsigned char pa_available,
73 						     const unsigned char pb_available));
74 
75 #endif /* _IO_INTERFACE_MUX_H */
76