upload tizen1.0 source
[kernel/linux-2.6.36.git] / drivers / media / video / s5p-tv / mhl_v1 / si_cpCbus.c
1 /***************************************************************************
2
3
4
5 *   SiI9244 - MHL Transmitter Driver
6
7 *
8
9 * Copyright (C) (2011, Silicon Image Inc)
10
11 *
12
13 * This program is free software; you can redistribute it and/or modify
14
15 * it under the terms of the GNU General Public License as published by
16
17 * the Free Software Foundation version 2.
18
19 *
20
21 * This program is distributed ¡°as is¡± WITHOUT ANY WARRANTY of any
22
23 * kind, whether express or implied; without even the implied warranty
24
25 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
27 * GNU General Public License for more details.
28
29 *
30
31 *****************************************************************************/
32
33 #include <linux/interrupt.h>
34 #include <linux/irq.h>
35 #include <linux/i2c.h>
36 #include <linux/gpio.h>
37 #include <plat/pm.h>
38 #include <asm/irq.h>
39 #include <linux/delay.h>
40 #include <plat/gpio-cfg.h>
41 #include <mach/regs-gpio.h>
42 #include <mach/regs-clock.h>
43
44 #include <linux/syscalls.h> 
45 #include <linux/fcntl.h> 
46 #include <asm/uaccess.h> 
47 #include <linux/types.h>
48
49 #include "Common_Def.h"
50 #include "si_apiCbus.h"
51
52 //extern void rcp_cbus_uevent(void);    //MHL v1 //NAGSM_Android_SEL_Kernel_Aakash_20101126
53
54 #if (IS_CBUS == 1)
55 //------------------------------------------------------------------------------
56 // Module variables
57 //------------------------------------------------------------------------------
58
59 typedef struct
60 {
61         byte rcpKeyCode;          //!< RCP CBUS Key Code
62         char   rcpName[30];
63 } SI_Rc5RcpConversion_t;
64
65 SI_Rc5RcpConversion_t RcpSourceToSink[] =
66 {
67         { MHD_RCP_CMD_SELECT,                   "Select"},
68         { MHD_RCP_CMD_UP,                               "Up"},
69         { MHD_RCP_CMD_DOWN,                             "Down"},
70         { MHD_RCP_CMD_LEFT,                             "Left"},
71         { MHD_RCP_CMD_RIGHT,                    "Right"},
72         //{ MHD_RCP_CMD_RIGHT_UP,               "Right Up"},
73         //{ MHD_RCP_CMD_RIGHT_DOWN,             "Right Down"},
74         //{ MHD_RCP_CMD_LEFT_UP,                "Left Up"},
75         //{ MHD_RCP_CMD_LEFT_DOWN,              "Left Down"},
76         { MHD_RCP_CMD_ROOT_MENU,                "Root Menu"},
77         //{ MHD_RCP_CMD_SETUP_MENU,             "Setup Menu"},
78         //{ MHD_RCP_CMD_CONTENTS_MENU,  "Contents Menu"},
79         //{ MHD_RCP_CMD_FAVORITE_MENU,  "Favorite Menu"},
80         { MHD_RCP_CMD_EXIT,                             "Exit"},
81         // 0x0E - 0x1F Reserved 
82         { MHD_RCP_CMD_NUM_0,                    "Num 0"},
83         { MHD_RCP_CMD_NUM_1,                    "Num 1"},
84         { MHD_RCP_CMD_NUM_2,                    "Num 2"},
85         { MHD_RCP_CMD_NUM_3,                    "Num 3"},
86         { MHD_RCP_CMD_NUM_4,                    "Num 4"},
87         { MHD_RCP_CMD_NUM_5,                    "Num 5"},
88         { MHD_RCP_CMD_NUM_6,                    "Num 6"},
89         { MHD_RCP_CMD_NUM_7,                    "Num 7"},
90         { MHD_RCP_CMD_NUM_8,                    "Num 8"},
91         { MHD_RCP_CMD_NUM_9,                    "Num 9"},
92         //{ MHD_RCP_CMD_DOT,                            "Dot"},
93         { MHD_RCP_CMD_ENTER,                    "Enter"},
94         { MHD_RCP_CMD_CLEAR,                    "Clear"},
95         // 0x2D - 0x2F Reserved 
96         { MHD_RCP_CMD_CH_UP,                    "Channel Up"},
97         { MHD_RCP_CMD_CH_DOWN,                  "Channel Down"},
98         { MHD_RCP_CMD_PRE_CH,                   "Previous Channel"},
99         { MHD_RCP_CMD_SOUND_SELECT,             "Sound Select"},
100         //{ MHD_RCP_CMD_INPUT_SELECT,   "Input Select"},
101         //{ MHD_RCP_CMD_SHOW_INFO,              "Show Info"},
102         //{ MHD_RCP_CMD_HELP,                   "Help"},
103         //{ MHD_RCP_CMD_PAGE_UP,                "Page Up"},
104         //{ MHD_RCP_CMD_PAGE_DOWN,              "Page Down"},
105         // 0x39 - 0x40 Reserved 
106         { MHD_RCP_CMD_VOL_UP,                   "Volume Up"},
107         { MHD_RCP_CMD_VOL_DOWN,                 "Volume Down"},
108         { MHD_RCP_CMD_MUTE,                             "Mute"},
109         { MHD_RCP_CMD_PLAY,                             "Play"},
110         { MHD_RCP_CMD_STOP,                             "Stop"},
111         { MHD_RCP_CMD_PAUSE,                    "Pause"},
112         { MHD_RCP_CMD_RECORD,                   "Record"},
113         { MHD_RCP_CMD_REWIND,                   "Rewind"},
114         { MHD_RCP_CMD_FAST_FWD,                 "Fast Fwd"},
115         { MHD_RCP_CMD_EJECT,                    "Eject"},
116         { MHD_RCP_CMD_FWD,                              "Forward"},
117         { MHD_RCP_CMD_BKWD,                             "Backward"},
118         // 0X4D - 0x4F Reserved
119         //{ MHD_RCP_CMD_ANGLE,                  "Angle"},
120         //{ MHD_RCP_CMD_SUBPICTURE,             "Subpicture"},
121         // 0x52 - 0x5F Reserved
122         { MHD_RCP_CMD_PLAY_FUNC,                "Play Function"},
123         { MHD_RCP_CMD_PAUSE_PLAY_FUNC,  "Pause Play Function"},
124         { MHD_RCP_CMD_RECORD_FUNC,              "Record Function"},
125         { MHD_RCP_CMD_PAUSE_REC_FUNC,   "Pause Record Function"},
126         { MHD_RCP_CMD_STOP_FUNC,                "Stop Function"},
127         { MHD_RCP_CMD_MUTE_FUNC,                "Mute Function"},
128         { MHD_RCP_CMD_UN_MUTE_FUNC,             "Un-Mute Function"},
129         //{ MHD_RCP_CMD_TUNE_FUNC,              "Tune Function"},
130         //{ MHD_RCP_CMD_MEDIA_FUNC,             "Media Function"},
131         // 0x69 - 0x70 Reserved
132         //{ MHD_RCP_CMD_F1,                             "F1"},
133         //{ MHD_RCP_CMD_F2,                             "F2"},
134         //{ MHD_RCP_CMD_F3,                             "F3"},
135         //{ MHD_RCP_CMD_F4,                             "F4"},
136         //{ MHD_RCP_CMD_F5,                             "F5"},
137         // 0x76 - 0x7D Reserved
138         //{ MHD_RCP_CMD_VS,                             "Vendor Specific"}
139         // 0x7F Reserved
140 };
141
142 //------------------------------------------------------------------------------
143 // Function:    CbusRc5toRcpConvert
144 // Description: Translate RC5 command to CBUS RCP command
145 // Parameters:  keyData: key code from the remote controller
146 // Returns:     RCP code equivalent to passed RC5 key code or 0xFF if not in list.
147 //------------------------------------------------------------------------------
148
149 static byte CbusRc5toRcpConvert ( byte keyCode )
150 {
151         byte i;
152         byte retVal = 0xFF;
153         byte length = sizeof(RcpSourceToSink)/sizeof(SI_Rc5RcpConversion_t);
154
155         for ( i = 0; i < length ; i++ )
156         {
157                 if ( keyCode == RcpSourceToSink[i].rcpKeyCode )
158                 {
159                         retVal = RcpSourceToSink[i].rcpKeyCode;
160 #ifdef RCP_DEBUG
161                         printk("CPCBUS:: Send ----> %s\n",
162                                 RcpSourceToSink[i].rcpName );
163 #endif
164                         break;
165                 }
166         }
167
168         /* Return the new code or 0xFF if not found.    */
169
170         return( ( i == length ) ? 0xFF : retVal );
171 }
172
173 //------------------------------------------------------------------------------
174 // Function:    CpCbusSendRcpMessage
175 // Description: Convert input port number to CBUS channel and send the
176 //              passed RC5 key code as a CBUS RCP key code.
177 // Parameters:  port    - Port Processor input port index
178 //              keyCode - Remote control button code.
179 // Returns:     true if successful, false if not MHD port or other failure.
180 //------------------------------------------------------------------------------
181
182 Bool CpCbusSendRcpMessage ( byte channel, byte keyCode )
183 {
184         Bool  success;
185
186         success = FALSE;
187         for ( ;; )
188         {
189                 printk( "CPCBUS:: Sending RCP Msg:: %02X keycode"
190                                 " to channel %d CBUS\n\n",
191                                 (int)keyCode, (int)channel );
192                 if (channel == 0xFF) {
193                         printk( "\n::::::: Bad channel -- " );
194                         break;
195                 }                                     
196
197                 keyCode = CbusRc5toRcpConvert( keyCode );
198                 if (keyCode == 0xFF) {
199                         printk( "\n::::::: Bad KeyCode -- " );
200                         break;
201                 }
202
203                 success = SI_CbusMscMsgSubCmdSend( channel,
204                                                 MHD_MSC_MSG_RCP,
205                                                 keyCode );
206                 break;
207         }
208
209         if ( !success )
210         {
211                 printk("Unable to send command :::::::\n");
212         }
213
214         return success;
215 }
216
217 //------------------------------------------------------------------------------
218 // Function:    CpCbusSendRapMessage
219 // Parameters:  port    - Port Processor input port index
220 //              actionCode - Action code.
221 // Returns:     true if successful, false if not MHD port or other failure.
222 //------------------------------------------------------------------------------
223
224 Bool CpCbusSendRapMessage ( byte channel, byte actCode )
225 {
226         Bool  success;
227
228         success = FALSE;
229         for ( ;; )
230         {
231                 printk( "CPCBUS:: Sending RAP Msg:: %02X action code"
232                         " to channel %d CBUS\n\n",
233                         (int)actCode, (int)channel );
234
235                 if ( channel == 0xFF) {
236                         printk("\n::::::: Bad channel -- ");
237                         break;
238                 }
239
240                 if ((actCode == MHD_RAP_CMD_POLL) ||
241                 (actCode == MHD_RAP_CMD_CHG_QUIET) ||
242                 (actCode != MHD_RAP_CMD_CHG_ACTIVE_PWR)) {
243                         success = SI_CbusMscMsgSubCmdSend(channel,
244                                                 MHD_MSC_MSG_RAP,
245                                                 actCode );
246                         break;
247                 } else {
248                         printk("\n::::::: Bad action code -- ");
249                         break;
250                 }
251         }
252
253         if (!success) {
254                 printk( "Unable to send action command :::::::\n" );
255         }
256
257         return success;
258 }
259
260 //------------------------------------------------------------------------------
261 // Function:    CpProcessRcpMessage
262 // Description: Process the passed RCP message.
263 // Returns:     The RCPK status code.
264 //------------------------------------------------------------------------------
265
266 static byte CpProcessRcpMessage ( byte channel, byte rcpData )
267 {
268         byte rcpkStatus = MHD_MSC_MSG_NO_ERROR;
269
270         printk("RCP Key Code: 0x%02X, channel: 0x%02X\n",
271                         (int)rcpData, (int)channel );
272
273         switch (rcpData) {
274         case MHD_RCP_CMD_SELECT:
275                 printk("\nSelect received\n\n");
276                 break;
277         case MHD_RCP_CMD_UP:
278                 printk("\nUp received\n\n");
279                 break;
280         case MHD_RCP_CMD_DOWN:
281                 printk("\nDown received\n\n");
282                 break;
283         case MHD_RCP_CMD_LEFT:
284                 printk("\nLeft received\n\n");
285                 break;
286         case MHD_RCP_CMD_RIGHT:
287                 printk("\nRight received\n\n");
288                 break;
289         case MHD_RCP_CMD_RIGHT_UP:
290                 printk("\n MHD_RCP_CMD_RIGHT_UP\n\n");
291                 break;
292         case MHD_RCP_CMD_RIGHT_DOWN:
293                 printk("\n MHD_RCP_CMD_RIGHT_DOWN \n\n");
294                 break;
295         case MHD_RCP_CMD_LEFT_UP:
296                 printk("\n MHD_RCP_CMD_LEFT_UP\n\n");
297                 break;
298         case MHD_RCP_CMD_LEFT_DOWN:
299                 printk("\n MHD_RCP_CMD_LEFT_DOWN\n\n");
300                 break;      
301         case MHD_RCP_CMD_ROOT_MENU:
302                 printk("\nRoot Menu received\n\n");
303                 break;
304         case MHD_RCP_CMD_SETUP_MENU:
305                 printk("\n MHD_RCP_CMD_SETUP_MENU\n\n");
306                 break;      
307
308         case MHD_RCP_CMD_CONTENTS_MENU:
309                 printk("\n MHD_RCP_CMD_CONTENTS_MENU\n\n");
310                 break;      
311
312         case MHD_RCP_CMD_FAVORITE_MENU:
313                 printk("\n MHD_RCP_CMD_FAVORITE_MENU\n\n");
314                 break;            
315
316         case MHD_RCP_CMD_EXIT:
317                 printk("\nExit received\n\n");
318                 break;
319
320         case MHD_RCP_CMD_NUM_0:
321                 printk("\nNumber 0 received\n\n");
322                 break;
323
324         case MHD_RCP_CMD_NUM_1:
325                 printk("\nNumber 1 received\n\n");
326                 break;
327
328         case MHD_RCP_CMD_NUM_2:
329                 printk("\nNumber 2 received\n\n");
330                 break;
331
332         case MHD_RCP_CMD_NUM_3:
333                 printk("\nNumber 3 received\n\n");
334                 break;
335
336         case MHD_RCP_CMD_NUM_4:
337                 printk("\nNumber 4 received\n\n");
338                 break;
339
340         case MHD_RCP_CMD_NUM_5:
341                 printk("\nNumber 5 received\n\n");
342                 break;
343
344         case MHD_RCP_CMD_NUM_6:
345                 printk("\nNumber 6 received\n\n");
346                 break;
347
348         case MHD_RCP_CMD_NUM_7:
349                 printk("\nNumber 7 received\n\n");
350                 break;
351
352         case MHD_RCP_CMD_NUM_8:
353                 printk("\nNumber 8 received\n\n");
354                 break;
355
356         case MHD_RCP_CMD_NUM_9:
357                 printk("\nNumber 9 received\n\n");
358                 break;
359
360         case MHD_RCP_CMD_DOT:
361                 printk("\n MHD_RCP_CMD_DOT\n\n");
362                 break;          
363
364         case MHD_RCP_CMD_ENTER:
365                 printk("\nEnter received\n\n");
366                 break;
367
368         case MHD_RCP_CMD_CLEAR:
369                 printk("\nClear received\n\n");
370                 break;
371
372         case MHD_RCP_CMD_CH_UP:
373                 printk("\n MHD_RCP_CMD_CH_UP\n\n");
374                 break; 
375
376         case MHD_RCP_CMD_CH_DOWN:
377                 printk("\n MHD_RCP_CMD_CH_DOWN\n\n");
378                 break;       
379
380         case MHD_RCP_CMD_PRE_CH:
381                 printk("\n MHD_RCP_CMD_PRE_CH\n\n");
382                 break;           
383
384         case MHD_RCP_CMD_SOUND_SELECT:
385                 printk("\nSound Select received\n\n");
386                 break;
387
388         case MHD_RCP_CMD_INPUT_SELECT:
389                 printk("\n MHD_RCP_CMD_INPUT_SELECT\n\n");
390                 break;    
391
392         case MHD_RCP_CMD_SHOW_INFO:
393                 printk("\n MHD_RCP_CMD_SHOW_INFO\n\n");
394                 break;     
395
396         case MHD_RCP_CMD_HELP:
397                 printk("\n MHD_RCP_CMD_HELP\n\n");
398                 break;   
399
400         case MHD_RCP_CMD_PAGE_UP:
401                 printk("\n MHD_RCP_CMD_PAGE_UP\n\n");
402                 break;  
403
404         case MHD_RCP_CMD_PAGE_DOWN:
405                 printk("\n MHD_RCP_CMD_PAGE_DOWN\n\n");
406                 break;             
407
408         case MHD_RCP_CMD_VOL_UP:
409                 printk("\n MHD_RCP_CMD_VOL_UP\n\n");
410                 break;             
411
412         case MHD_RCP_CMD_VOL_DOWN:
413                 printk("\n MHD_RCP_CMD_VOL_DOWN\n\n");
414                 break;             
415
416         case MHD_RCP_CMD_MUTE:
417                 printk("\n MHD_RCP_CMD_MUTE\n\n");
418                 break;             
419
420         case MHD_RCP_CMD_PLAY:
421                 printk("\nPlay received\n\n");
422                 break;
423
424         case MHD_RCP_CMD_STOP:
425                 printk("\n MHD_RCP_CMD_STOP\n\n");
426                 break;   
427
428         case MHD_RCP_CMD_PAUSE:
429                 printk("\nPause received\n\n");
430                 break;
431
432         case MHD_RCP_CMD_RECORD:
433                 printk("\n MHD_RCP_CMD_RECORD\n\n");
434                 break;   
435
436         case MHD_RCP_CMD_FAST_FWD:
437                 printk("\nFastfwd received\n\n");
438                 break;
439
440         case MHD_RCP_CMD_REWIND:
441                 printk("\nRewind received\n\n");
442                 break;
443
444         case MHD_RCP_CMD_EJECT:
445                 printk("\nEject received\n\n");
446                 break;
447
448         case MHD_RCP_CMD_FWD:
449                 printk("\nForward received\n\n");
450                 break;
451
452         case MHD_RCP_CMD_BKWD:
453                 printk("\nBackward received\n\n");
454                 break;
455
456         case MHD_RCP_CMD_PLAY_FUNC:
457                 printk("\nPlay Function received\n\n");
458                 break;
459
460         case MHD_RCP_CMD_PAUSE_PLAY_FUNC:
461                 printk("\nPause_Play Function received\n\n");
462                 break;
463
464         case MHD_RCP_CMD_STOP_FUNC:
465                 printk("\nStop Function received\n\n");
466                 break;
467
468         default:
469                 rcpkStatus = MHD_MSC_MSG_INEFFECTIVE_KEY_CODE;
470                 break;
471         }
472
473         if ( rcpkStatus == MHD_MSC_MSG_INEFFECTIVE_KEY_CODE ) {
474                 printk("\nKeyCode not recognized or supported.\n\n");
475         }
476
477         return rcpkStatus;
478 }
479
480 //------------------------------------------------------------------------------
481 // Function:    CpProcessRapMessage
482 // Description: Process the passed RAP message.
483 // Returns:     The RAPK status code.
484 //------------------------------------------------------------------------------
485
486 static byte CpProcessRapMessage ( byte channel, byte rcpData )
487 {
488         byte rapkStatus = MHD_MSC_MSG_NO_ERROR;
489
490         printk("RAP Key Code: 0x%02X, channel: 0x%02X\n",
491                         (int)rcpData, (int)channel );
492
493         switch (rcpData) {
494         case MHD_RAP_CMD_POLL:
495                 printk("\nPOLL received\n\n");
496                 break;
497
498         case MHD_RAP_CMD_CHG_ACTIVE_PWR:
499                 printk( "\nCHANGE TO ACTIVE POWER STATE"
500                                 " received\n\n");
501                 break;        
502
503         case MHD_RAP_CMD_CHG_QUIET:
504                 printk( "\nCHANGE TO QUIET STATE"
505                                 " received\n\n");
506                 //TPI_GoToD3();  //???
507                 break;
508
509         default:
510                 rapkStatus = MHD_MSC_MSG_RAP_UNRECOGNIZED_ACT_CODE;
511                 break;
512         }
513
514         if ( rapkStatus == MHD_MSC_MSG_RAP_UNRECOGNIZED_ACT_CODE ) {
515                 printk("\nKeyCode not recognized !! \n\n" );
516         }
517
518         return rapkStatus;
519 }
520
521 //------------------------------------------------------------------------------
522 // Function:    CbusConnectionCheck
523 // Description: Display any change in CBUS connection state and enable
524 //              CBUS heartbeat if channel has been connected.
525 // Parameters:  channel - CBUS channel to check
526 //------------------------------------------------------------------------------
527
528 static void CbusConnectionCheck (byte channel)
529 {
530         static byte busConnected[ MHD_MAX_CHANNELS ] = {0};
531
532         /* If CBUS connection state has changed for this channel,   */
533         /* update channel state and hardware.                       */
534
535         if (busConnected[channel] != SI_CbusChannelConnected(channel)) {
536                 busConnected[ channel ] = SI_CbusChannelConnected( channel );
537
538                 // heartbeat has been disabled in all products
539                 // SI_CbusHeartBeat( channel, busConnected[ channel ] );
540
541                 printk("CPCBUS:: ***Channel: %d,  CBUS %s ****\n",
542                                 (int)channel ,
543                                 busConnected[ channel ] ?
544                                 "Connected" : "Unconnected");
545         }
546 }
547
548 //------------------------------------------------------------------------------
549 // Function:    CpCbusProcessPrivateMessage
550 // Description: Get the result of the last message sent and use it appropriately
551 //              or process a request from the connected device.
552 // Parameters:  channel - CBUS channel that has message data for us.
553 //------------------------------------------------------------------------------
554
555 static void CpCbusProcessPrivateMessage(byte channel)
556 {
557         byte     status;
558         cbus_req_t  *pCmdRequest;
559
560         pCmdRequest = SI_CbusRequestData( channel );
561         //CbusRcpData = pCmdRequest->offsetData;
562
563         switch ( pCmdRequest->command ) {
564         case MHD_MSC_MSG_RCP:
565                 printk("MHD_MSC_MSG_RCP 1 \n");
566         /* Acknowledge receipt of command and process it.  Note that    */
567         /* we could send the ack before processing anything, because it */
568         /* is an indicator that the command was properly received, not  */
569         /* that it was executed, however, we use one function to parse  */
570         /* the command for errors AND for processing. The only thing we */
571         /* must do is make sure that the processing does not exceed the */
572         /* ACK response time limit.                                     */
573
574         /* MHL v1                                       */
575         /* NAGSM_Android_SEL_Kernel_Aakash_20101130     */
576         /* Inform Kernel only on MHD_MSC_MSG_RCP        */
577                 //CbusRcpData = pCmdRequest->offsetData;
578
579                 //rcp_cbus_uevent();
580                 //MHL v1 //NAGSM_Android_SEL_Kernel_Aakash_20101126
581
582                 status = CpProcessRcpMessage(channel, pCmdRequest->offsetData);
583                 SI_CbusRcpMessageAck(channel, status, pCmdRequest->offsetData);
584                 break;
585
586         case MHD_MSC_MSG_RCPK:
587                 printk("MHD_MSC_MSG_RCPK 1\n");          
588                 break;
589
590         case MHD_MSC_MSG_RCPE:  
591                 printk("MHD_MSC_MSG_RCPE 1\n");            
592                 break;
593
594         case MHD_MSC_MSG_RAP:
595                 printk("MHD_MSC_MSG_RAP 1\n");            
596                 status = CpProcessRapMessage(channel, pCmdRequest->offsetData );
597                         SI_CbusRapMessageAck(channel, status);
598                 break;
599
600         case MHD_MSC_MSG_RAPK:  
601                 break;
602         }
603 }
604
605 //------------------------------------------------------------------------------
606 // Function:    CpCbusHandler
607 // Description: Polls the send/receive state of the CBUS hardware.
608 //------------------------------------------------------------------------------
609
610 void CpCbusHandler(void)
611 {
612         byte channel, status;
613
614         /* Monitor all CBUS channels.   */
615
616         for (channel = 0; channel < MHD_MAX_CHANNELS; channel++) {
617                 /* Update CBUS status.  */
618                 SI_CbusUpdateBusStatus( channel );
619                 CbusConnectionCheck( channel );
620
621                 /* Monitor CBUS interrupts. */
622                 status = SI_CbusHandler( channel );
623                 if ( status == STATUS_SUCCESS ) {
624                         /* Get status of current request, if any.   */
625
626                         status = SI_CbusRequestStatus( channel );
627                         switch ( status ) {
628                         case CBUS_REQ_IDLE: 
629                                 printk("CBUS_REQ_IDLE\n");
630                                 break;
631
632                         case CBUS_REQ_PENDING:
633                                 printk("CBUS_REQ_PENDING\n");              
634                                 break;
635
636                         case CBUS_REQ_SENT:
637                                 printk("CBUS_REQ_SENT\n");              
638                                 break;
639
640                         case CBUS_REQ_RECEIVED:
641                                 printk("CBUS_REQ_RECEIVED\n");  
642                         /* Received a message or message response.  */
643                         /* Go do what is appropriate.               */
644
645                                 CpCbusProcessPrivateMessage( channel );
646                                 break;
647
648                         default:
649                                 break;
650                         }
651                 } else if ( status == ERROR_NO_HEARTBEAT ) {
652                         printk("Lost CBUS channel %d heartbeat\n",
653                                                 (int)channel);
654                 } else if ( status == ERROR_NACK_FROM_PEER ) {
655                         printk ("NACK received from peer, cmd should be"
656                                 " sent again.\n");
657                 } else {
658                 /* Lee: Only thing that comes here is interrupt timeout */
659                 /*  -- is this bad? */
660                 }
661         }
662 }
663
664 //------------------------------------------------------------------------------
665 // Function:    CpCbusInitialize
666 // Description: Initialize the CBUS subsystem and enabled the default channels
667 //------------------------------------------------------------------------------
668
669 void CpCbusInitialize(void)
670 {
671         /* Initialize the basic hardware.   */
672         SI_CbusInitialize();
673 }
674 #endif