/*
* FireSAT AVC driver
*
* Copyright (c) 2004 Andreas Monitzer <andy@monitzer.com>
* Copyright (c) 2008 Ben Backx <ben@bbackx.com>
* Copyright (c) 2008 Henrik Kurelid <henrik@kurelid.se>
*
* 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.
*/
#include "firesat.h"
#include <ieee1394_transactions.h>
#include <nodemgr.h>
#include <asm/byteorder.h>
#include <linux/delay.h>
#include <linux/crc32.h>
#include "avc_api.h"
#include "firesat-rc.h"
#define RESPONSE_REGISTER 0xFFFFF0000D00ULL
#define COMMAND_REGISTER 0xFFFFF0000B00ULL
#define PCR_BASE_ADDRESS 0xFFFFF0000900ULL
static unsigned int avc_comm_debug = 0;
module_param(avc_comm_debug, int, 0644);
MODULE_PARM_DESC(avc_comm_debug, "debug logging of AV/C communication, default is 0 (no)");
static int __AVCRegisterRemoteControl(struct firesat*firesat, int internal);
/* Frees an allocated packet */
static void avc_free_packet(struct hpsb_packet *packet)
{
hpsb_free_tlabel(packet);
hpsb_free_packet(packet);
}
/*
* Goofy routine that basically does a down_timeout function.
* Stolen from sbp2.c
*/
static int avc_down_timeout(atomic_t *done, int timeout)
{
int i;
for (i = timeout; (i > 0 && atomic_read(done) == 0); i-= HZ/10) {
set_current_state(TASK_INTERRUPTIBLE);
if (schedule_timeout(HZ/10)) /* 100ms */
return(1);
}
return ((i > 0) ? 0:1);
}
static const char* get_ctype_string(__u8 ctype)
{
switch(ctype)
{
case 0:
return "CONTROL";
case 1:
return "STATUS";
case 2:
return "SPECIFIC_INQUIRY";
case 3:
return "NOTIFY";
case 4:
return "GENERAL_INQUIRY";
}
return "UNKNOWN";
}
static const char* get_resp_string(__u8 ctype)
{
switch(ctype)
{
case 8:
return "NOT_IMPLEMENTED";
case 9:
return "ACCEPTED";
case 10:
return "REJECTED";
case 11:
return "IN_TRANSITION";
case 12:
return "IMPLEMENTED_STABLE";
case 13:
return "CHANGED";
case 15:
return "INTERIM";