本文整理汇总了C++中rio_dprintk函数的典型用法代码示例。如果您正苦于以下问题:C++ rio_dprintk函数的具体用法?C++ rio_dprintk怎么用?C++ rio_dprintk使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rio_dprintk函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: RIOFoadRta
int RIOFoadRta(struct Host *HostP, struct Map *MapP)
{
struct CmdBlk *CmdBlkP;
rio_dprintk(RIO_DEBUG_CMD, "FOAD RTA\n");
CmdBlkP = RIOGetCmdBlk();
if (!CmdBlkP) {
rio_dprintk(RIO_DEBUG_CMD, "FOAD RTA: GetCmdBlk failed\n");
return -ENXIO;
}
CmdBlkP->Packet.dest_unit = MapP->ID;
CmdBlkP->Packet.dest_port = BOOT_RUP;
CmdBlkP->Packet.src_unit = 0;
CmdBlkP->Packet.src_port = BOOT_RUP;
CmdBlkP->Packet.len = 0x84;
CmdBlkP->Packet.data[0] = IFOAD;
CmdBlkP->Packet.data[1] = 0;
CmdBlkP->Packet.data[2] = IFOAD_MAGIC & 0xFF;
CmdBlkP->Packet.data[3] = (IFOAD_MAGIC >> 8) & 0xFF;
if (RIOQueueCmdBlk(HostP, MapP->ID - 1, CmdBlkP) == RIO_FAIL) {
rio_dprintk(RIO_DEBUG_CMD, "FOAD RTA: Failed to queue foad command\n");
return -EIO;
}
return 0;
}
开发者ID:Einheri,项目名称:wl500g,代码行数:29,代码来源:riocmd.c
示例2: RIOSuspendBootRta
int RIOSuspendBootRta(struct Host *HostP, int ID, int Link)
{
struct CmdBlk *CmdBlkP;
rio_dprintk(RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA ID %d, link %c\n", ID, 'A' + Link);
CmdBlkP = RIOGetCmdBlk();
if (!CmdBlkP) {
rio_dprintk(RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: GetCmdBlk failed\n");
return -ENXIO;
}
CmdBlkP->Packet.dest_unit = ID;
CmdBlkP->Packet.dest_port = BOOT_RUP;
CmdBlkP->Packet.src_unit = 0;
CmdBlkP->Packet.src_port = BOOT_RUP;
CmdBlkP->Packet.len = 0x84;
CmdBlkP->Packet.data[0] = IWAIT;
CmdBlkP->Packet.data[1] = Link;
CmdBlkP->Packet.data[2] = IWAIT_MAGIC & 0xFF;
CmdBlkP->Packet.data[3] = (IWAIT_MAGIC >> 8) & 0xFF;
if (RIOQueueCmdBlk(HostP, ID - 1, CmdBlkP) == RIO_FAIL) {
rio_dprintk(RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: Failed to queue iwait command\n");
return -EIO;
}
return 0;
}
开发者ID:Einheri,项目名称:wl500g,代码行数:29,代码来源:riocmd.c
示例3: put_free_end
/****************************************
* Put a packet onto the end of the
* free list
****************************************/
void put_free_end(struct Host *HostP, struct PKT __iomem *PktP)
{
struct rio_free_list __iomem *tmp_pointer;
unsigned short old_end, new_end;
unsigned long flags;
rio_spin_lock_irqsave(&HostP->HostLock, flags);
/*************************************************
* Put a packet back onto the back of the free list
*
************************************************/
rio_dprintk(RIO_DEBUG_PFE, "put_free_end(PktP=%p)\n", PktP);
if ((old_end = readw(&HostP->ParmMapP->free_list_end)) != TPNULL) {
new_end = RIO_OFF(HostP->Caddr, PktP);
tmp_pointer = (struct rio_free_list __iomem *) RIO_PTR(HostP->Caddr, old_end);
writew(new_end, &tmp_pointer->next);
writew(old_end, &((struct rio_free_list __iomem *) PktP)->prev);
writew(TPNULL, &((struct rio_free_list __iomem *) PktP)->next);
writew(new_end, &HostP->ParmMapP->free_list_end);
} else { /* First packet on the free list this should never happen! */
rio_dprintk(RIO_DEBUG_PFE, "put_free_end(): This should never happen\n");
writew(RIO_OFF(HostP->Caddr, PktP), &HostP->ParmMapP->free_list_end);
tmp_pointer = (struct rio_free_list __iomem *) PktP;
writew(TPNULL, &tmp_pointer->prev);
writew(TPNULL, &tmp_pointer->next);
}
rio_dprintk(RIO_DEBUG_CMD, "Before unlock: %p\n", &HostP->HostLock);
rio_spin_unlock_irqrestore(&HostP->HostLock, flags);
}
开发者ID:274914765,项目名称:C,代码行数:36,代码来源:rioparam.c
示例4: add_transmit
/*
** To add a packet to the queue, you set the PKT_IN_USE bit in the address,
** and then move the TxAdd pointer along one position to point to the next
** packet pointer. You must wrap the pointer from the end back to the start.
*/
void add_transmit(struct Port *PortP)
{
if (readw(PortP->TxAdd) & PKT_IN_USE) {
rio_dprintk(RIO_DEBUG_PARAM, "add_transmit: Packet has been stolen!");
}
writew(readw(PortP->TxAdd) | PKT_IN_USE, PortP->TxAdd);
PortP->TxAdd = (PortP->TxAdd == PortP->TxEnd) ? PortP->TxStart : PortP->TxAdd + 1;
writew(RIO_OFF(PortP->Caddr, PortP->TxAdd), &PortP->PhbP->tx_add);
}
开发者ID:274914765,项目名称:C,代码行数:14,代码来源:rioparam.c
示例5: RIOCommandRta
int RIOCommandRta(struct rio_info *p, unsigned long RtaUnique, int (*func) (struct Host * HostP, struct Map * MapP))
{
unsigned int Host;
rio_dprintk(RIO_DEBUG_CMD, "Command RTA 0x%lx func %p\n", RtaUnique, func);
if (!RtaUnique)
return (0);
for (Host = 0; Host < p->RIONumHosts; Host++) {
unsigned int Rta;
struct Host *HostP = &p->RIOHosts[Host];
for (Rta = 0; Rta < RTAS_PER_HOST; Rta++) {
struct Map *MapP = &HostP->Mapping[Rta];
if (MapP->RtaUniqueNum == RtaUnique) {
uint Link;
/*
** now, lets just check we have a route to it...
** IF the routing stuff is working, then one of the
** topology entries for this unit will have a legit
** route *somewhere*. We care not where - if its got
** any connections, we can get to it.
*/
for (Link = 0; Link < LINKS_PER_UNIT; Link++) {
if (MapP->Topology[Link].Unit <= (u8) MAX_RUP) {
/*
** Its worth trying the operation...
*/
return (*func) (HostP, MapP);
}
}
}
}
}
return -ENXIO;
}
开发者ID:Einheri,项目名称:wl500g,代码行数:39,代码来源:riocmd.c
示例6: RIOUnUse
int RIOUnUse(unsigned long iPortP, struct CmdBlk *CmdBlkP)
{
struct Port *PortP = (struct Port *) iPortP;
unsigned long flags;
rio_spin_lock_irqsave(&PortP->portSem, flags);
rio_dprintk(RIO_DEBUG_CMD, "Decrement in use count for port\n");
if (PortP->InUse) {
if (--PortP->InUse != NOT_INUSE) {
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return 0;
}
}
/*
** While PortP->InUse is set (i.e. a preemptive command has been sent to
** the RTA and is awaiting completion), any transmit data is prevented from
** being transferred from the write queue into the transmit packets
** (add_transmit) and no furthur transmit interrupt will be sent for that
** data. The next interrupt will occur up to 500ms later (RIOIntr is called
** twice a second as a saftey measure). This was the case when kermit was
** used to send data into a RIO port. After each packet was sent, TCFLSH
** was called to flush the read queue preemptively. PortP->InUse was
** incremented, thereby blocking the 6 byte acknowledgement packet
** transmitted back. This acknowledgment hung around for 500ms before
** being sent, thus reducing input performance substantially!.
** When PortP->InUse becomes NOT_INUSE, we must ensure that any data
** hanging around in the transmit buffer is sent immediately.
*/
writew(1, &PortP->HostP->ParmMapP->tx_intr);
/* What to do here ..
wakeup( (caddr_t)&(PortP->InUse) );
*/
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return 0;
}
开发者ID:Einheri,项目名称:wl500g,代码行数:37,代码来源:riocmd.c
示例7: RIORFlushEnable
int RIORFlushEnable(unsigned long iPortP, struct CmdBlk *CmdBlkP)
{
struct Port *PortP = (struct Port *) iPortP;
struct PKT __iomem *PacketP;
unsigned long flags;
rio_spin_lock_irqsave(&PortP->portSem, flags);
while (can_remove_receive(&PacketP, PortP)) {
remove_receive(PortP);
put_free_end(PortP->HostP, PacketP);
}
if (readw(&PortP->PhbP->handshake) == PHB_HANDSHAKE_SET) {
/*
** MAGIC! (Basically, handshake the RX buffer, so that
** the RTAs upstream can be re-enabled.)
*/
rio_dprintk(RIO_DEBUG_CMD, "Util: Set RX handshake bit\n");
writew(PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET, &PortP->PhbP->handshake);
}
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return RIOUnUse(iPortP, CmdBlkP);
}
开发者ID:Einheri,项目名称:wl500g,代码行数:24,代码来源:riocmd.c
示例8: RIOIdentifyRta
int RIOIdentifyRta(struct rio_info *p, void __user * arg)
{
unsigned int Host;
if (copy_from_user(&IdRta, arg, sizeof(IdRta))) {
rio_dprintk(RIO_DEBUG_CMD, "RIO_IDENTIFY_RTA copy failed\n");
p->RIOError.Error = COPYIN_FAILED;
return -EFAULT;
}
for (Host = 0; Host < p->RIONumHosts; Host++) {
unsigned int Rta;
struct Host *HostP = &p->RIOHosts[Host];
for (Rta = 0; Rta < RTAS_PER_HOST; Rta++) {
struct Map *MapP = &HostP->Mapping[Rta];
if (MapP->RtaUniqueNum == IdRta.RtaUnique) {
uint Link;
/*
** now, lets just check we have a route to it...
** IF the routing stuff is working, then one of the
** topology entries for this unit will have a legit
** route *somewhere*. We care not where - if its got
** any connections, we can get to it.
*/
for (Link = 0; Link < LINKS_PER_UNIT; Link++) {
if (MapP->Topology[Link].Unit <= (u8) MAX_RUP) {
/*
** Its worth trying the operation...
*/
struct CmdBlk *CmdBlkP;
rio_dprintk(RIO_DEBUG_CMD, "IDENTIFY RTA\n");
CmdBlkP = RIOGetCmdBlk();
if (!CmdBlkP) {
rio_dprintk(RIO_DEBUG_CMD, "IDENTIFY RTA: GetCmdBlk failed\n");
return -ENXIO;
}
CmdBlkP->Packet.dest_unit = MapP->ID;
CmdBlkP->Packet.dest_port = BOOT_RUP;
CmdBlkP->Packet.src_unit = 0;
CmdBlkP->Packet.src_port = BOOT_RUP;
CmdBlkP->Packet.len = 0x84;
CmdBlkP->Packet.data[0] = IDENTIFY;
CmdBlkP->Packet.data[1] = 0;
CmdBlkP->Packet.data[2] = IdRta.ID;
if (RIOQueueCmdBlk(HostP, MapP->ID - 1, CmdBlkP) == RIO_FAIL) {
rio_dprintk(RIO_DEBUG_CMD, "IDENTIFY RTA: Failed to queue command\n");
return -EIO;
}
return 0;
}
}
}
}
}
return -ENOENT;
}
开发者ID:Einheri,项目名称:wl500g,代码行数:63,代码来源:riocmd.c
示例9: RIOQueueCmdBlk
/*
** attach a command block to the list of commands to be performed for
** a given rup.
*/
int RIOQueueCmdBlk(struct Host *HostP, uint Rup, struct CmdBlk *CmdBlkP)
{
struct CmdBlk **Base;
struct UnixRup *UnixRupP;
unsigned long flags;
if (Rup >= (unsigned short) (MAX_RUP + LINKS_PER_UNIT)) {
rio_dprintk(RIO_DEBUG_CMD, "Illegal rup number %d in RIOQueueCmdBlk\n", Rup);
RIOFreeCmdBlk(CmdBlkP);
return RIO_FAIL;
}
UnixRupP = &HostP->UnixRups[Rup];
rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
/*
** If the RUP is currently inactive, then put the request
** straight on the RUP....
*/
if ((UnixRupP->CmdsWaitingP == NULL) && (UnixRupP->CmdPendingP == NULL) && (readw(&UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE) && (CmdBlkP->PreFuncP ? (*CmdBlkP->PreFuncP) (CmdBlkP->PreArg, CmdBlkP)
: 1)) {
rio_dprintk(RIO_DEBUG_CMD, "RUP inactive-placing command straight on. Cmd byte is 0x%x\n", CmdBlkP->Packet.data[0]);
/*
** Whammy! blat that pack!
*/
HostP->Copy(&CmdBlkP->Packet, RIO_PTR(HostP->Caddr, readw(&UnixRupP->RupP->txpkt)), sizeof(struct PKT));
/*
** place command packet on the pending position.
*/
UnixRupP->CmdPendingP = CmdBlkP;
/*
** set the command register
*/
writew(TX_PACKET_READY, &UnixRupP->RupP->txcontrol);
rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
return 0;
}
rio_dprintk(RIO_DEBUG_CMD, "RUP active - en-queing\n");
if (UnixRupP->CmdsWaitingP != NULL)
rio_dprintk(RIO_DEBUG_CMD, "Rup active - command waiting\n");
if (UnixRupP->CmdPendingP != NULL)
rio_dprintk(RIO_DEBUG_CMD, "Rup active - command pending\n");
if (readw(&UnixRupP->RupP->txcontrol) != TX_RUP_INACTIVE)
rio_dprintk(RIO_DEBUG_CMD, "Rup active - command rup not ready\n");
Base = &UnixRupP->CmdsWaitingP;
rio_dprintk(RIO_DEBUG_CMD, "First try to queue cmdblk %p at %p\n", CmdBlkP, Base);
while (*Base) {
rio_dprintk(RIO_DEBUG_CMD, "Command cmdblk %p here\n", *Base);
Base = &((*Base)->NextP);
rio_dprintk(RIO_DEBUG_CMD, "Now try to queue cmd cmdblk %p at %p\n", CmdBlkP, Base);
}
rio_dprintk(RIO_DEBUG_CMD, "Will queue cmdblk %p at %p\n", CmdBlkP, Base);
*Base = CmdBlkP;
CmdBlkP->NextP = NULL;
rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
return 0;
}
开发者ID:Einheri,项目名称:wl500g,代码行数:76,代码来源:riocmd.c
示例10: RIOServiceHost
void RIOServiceHost(struct rio_info *p, struct Host *HostP, int From)
{
rio_spin_lock(&HostP->HostLock);
if ((HostP->Flags & RUN_STATE) != RC_RUNNING) {
static int t = 0;
rio_spin_unlock(&HostP->HostLock);
if ((t++ % 200) == 0)
rio_dprintk(RIO_DEBUG_INTR, "Interrupt but host not running. flags=%x.\n", (int) HostP->Flags);
return;
}
rio_spin_unlock(&HostP->HostLock);
if (readw(&HostP->ParmMapP->rup_intr)) {
writew(0, &HostP->ParmMapP->rup_intr);
p->RIORupCount++;
RupIntr++;
rio_dprintk(RIO_DEBUG_INTR, "rio: RUP interrupt on host %Zd\n", HostP - p->RIOHosts);
RIOPollHostCommands(p, HostP);
}
if (readw(&HostP->ParmMapP->rx_intr)) {
int port;
writew(0, &HostP->ParmMapP->rx_intr);
p->RIORxCount++;
RxIntr++;
rio_dprintk(RIO_DEBUG_INTR, "rio: RX interrupt on host %Zd\n", HostP - p->RIOHosts);
/*
** Loop through every port. If the port is mapped into
** the system ( i.e. has /dev/ttyXXXX associated ) then it is
** worth checking. If the port isn't open, grab any packets
** hanging on its receive queue and stuff them on the free
** list; check for commands on the way.
*/
for (port = p->RIOFirstPortsBooted; port < p->RIOLastPortsBooted + PORTS_PER_RTA; port++) {
struct Port *PortP = p->RIOPortp[port];
struct tty_struct *ttyP;
struct PKT __iomem *PacketP;
/*
** not mapped in - most of the RIOPortp[] information
** has not been set up!
** Optimise: ports come in bundles of eight.
*/
if (!PortP->Mapped) {
port += 7;
continue; /* with the next port */
}
/*
** If the host board isn't THIS host board, check the next one.
** optimise: ports come in bundles of eight.
*/
if (PortP->HostP != HostP) {
port += 7;
continue;
}
/*
** Let us see - is the port open? If not, then don't service it.
*/
if (!(PortP->PortState & PORT_ISOPEN)) {
continue;
}
/*
** find corresponding tty structure. The process of mapping
** the ports puts these here.
*/
ttyP = PortP->gs.tty;
/*
** Lock the port before we begin working on it.
*/
rio_spin_lock(&PortP->portSem);
/*
** Process received data if there is any.
*/
if (can_remove_receive(&PacketP, PortP))
RIOReceive(p, PortP);
/*
** If there is no data left to be read from the port, and
** it's handshake bit is set, then we must clear the handshake,
** so that that downstream RTA is re-enabled.
*/
if (!can_remove_receive(&PacketP, PortP) && (readw(&PortP->PhbP->handshake) == PHB_HANDSHAKE_SET)) {
/*
** MAGIC! ( Basically, handshake the RX buffer, so that
** the RTAs upstream can be re-enabled. )
*/
rio_dprintk(RIO_DEBUG_INTR, "Set RX handshake bit\n");
writew(PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET, &PortP->PhbP->handshake);
}
rio_spin_unlock(&PortP->portSem);
}
}
//.........这里部分代码省略.........
开发者ID:FatSunHYS,项目名称:OSCourseDesign,代码行数:101,代码来源:riointr.c
示例11: RIOKillNeighbour
int RIOKillNeighbour(struct rio_info *p, void __user * arg)
{
uint Host;
uint ID;
struct Host *HostP;
struct CmdBlk *CmdBlkP;
rio_dprintk(RIO_DEBUG_CMD, "KILL HOST NEIGHBOUR\n");
if (copy_from_user(&KillUnit, arg, sizeof(KillUnit))) {
rio_dprintk(RIO_DEBUG_CMD, "RIO_KILL_NEIGHBOUR copy failed\n");
p->RIOError.Error = COPYIN_FAILED;
return -EFAULT;
}
if (KillUnit.Link > 3)
return -ENXIO;
CmdBlkP = RIOGetCmdBlk();
if (!CmdBlkP) {
rio_dprintk(RIO_DEBUG_CMD, "UFOAD: GetCmdBlk failed\n");
return -ENXIO;
}
CmdBlkP->Packet.dest_unit = 0;
CmdBlkP->Packet.src_unit = 0;
CmdBlkP->Packet.dest_port = BOOT_RUP;
CmdBlkP->Packet.src_port = BOOT_RUP;
CmdBlkP->Packet.len = 0x84;
CmdBlkP->Packet.data[0] = UFOAD;
CmdBlkP->Packet.data[1] = KillUnit.Link;
CmdBlkP->Packet.data[2] = UFOAD_MAGIC & 0xFF;
CmdBlkP->Packet.data[3] = (UFOAD_MAGIC >> 8) & 0xFF;
for (Host = 0; Host < p->RIONumHosts; Host++) {
ID = 0;
HostP = &p->RIOHosts[Host];
if (HostP->UniqueNum == KillUnit.UniqueNum) {
if (RIOQueueCmdBlk(HostP, RTAS_PER_HOST + KillUnit.Link, CmdBlkP) == RIO_FAIL) {
rio_dprintk(RIO_DEBUG_CMD, "UFOAD: Failed queue command\n");
return -EIO;
}
return 0;
}
for (ID = 0; ID < RTAS_PER_HOST; ID++) {
if (HostP->Mapping[ID].RtaUniqueNum == KillUnit.UniqueNum) {
CmdBlkP->Packet.dest_unit = ID + 1;
if (RIOQueueCmdBlk(HostP, ID, CmdBlkP) == RIO_FAIL) {
rio_dprintk(RIO_DEBUG_CMD, "UFOAD: Failed queue command\n");
return -EIO;
}
return 0;
}
}
}
RIOFreeCmdBlk(CmdBlkP);
return -ENXIO;
}
开发者ID:Einheri,项目名称:wl500g,代码行数:61,代码来源:riocmd.c
示例12: RIOPollHostCommands
/*
** Here we go - if there is an empty rup, fill it!
** must be called at splrio() or higher.
*/
void RIOPollHostCommands(struct rio_info *p, struct Host *HostP)
{
struct CmdBlk *CmdBlkP;
struct UnixRup *UnixRupP;
struct PKT __iomem *PacketP;
unsigned short Rup;
unsigned long flags;
Rup = MAX_RUP + LINKS_PER_UNIT;
do { /* do this loop for each RUP */
/*
** locate the rup we are processing & lock it
*/
UnixRupP = &HostP->UnixRups[--Rup];
spin_lock_irqsave(&UnixRupP->RupLock, flags);
/*
** First check for incoming commands:
*/
if (readw(&UnixRupP->RupP->rxcontrol) != RX_RUP_INACTIVE) {
int FreeMe;
PacketP = (struct PKT __iomem *) RIO_PTR(HostP->Caddr, readw(&UnixRupP->RupP->rxpkt));
switch (readb(&PacketP->dest_port)) {
case BOOT_RUP:
rio_dprintk(RIO_DEBUG_CMD, "Incoming Boot %s packet '%x'\n", readb(&PacketP->len) & 0x80 ? "Command" : "Data", readb(&PacketP->data[0]));
rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
FreeMe = RIOBootRup(p, Rup, HostP, PacketP);
rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
break;
case COMMAND_RUP:
/*
** Free the RUP lock as loss of carrier causes a
** ttyflush which will (eventually) call another
** routine that uses the RUP lock.
*/
rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
FreeMe = RIOCommandRup(p, Rup, HostP, PacketP);
if (readb(&PacketP->data[5]) == MEMDUMP) {
rio_dprintk(RIO_DEBUG_CMD, "Memdump from 0x%x complete\n", readw(&(PacketP->data[6])));
rio_memcpy_fromio(p->RIOMemDump, &(PacketP->data[8]), 32);
}
rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
break;
case ROUTE_RUP:
rio_spin_unlock_irqrestore(&UnixRupP->RupLock, flags);
FreeMe = RIORouteRup(p, Rup, HostP, PacketP);
rio_spin_lock_irqsave(&UnixRupP->RupLock, flags);
break;
default:
rio_dprintk(RIO_DEBUG_CMD, "Unknown RUP %d\n", readb(&PacketP->dest_port));
FreeMe = 1;
break;
}
if (FreeMe) {
rio_dprintk(RIO_DEBUG_CMD, "Free processed incoming command packet\n");
put_free_end(HostP, PacketP);
writew(RX_RUP_INACTIVE, &UnixRupP->RupP->rxcontrol);
if (readw(&UnixRupP->RupP->handshake) == PHB_HANDSHAKE_SET) {
rio_dprintk(RIO_DEBUG_CMD, "Handshake rup %d\n", Rup);
writew(PHB_HANDSHAKE_SET | PHB_HANDSHAKE_RESET, &UnixRupP->RupP->handshake);
}
}
}
/*
** IF a command was running on the port,
** and it has completed, then tidy it up.
*/
if ((CmdBlkP = UnixRupP->CmdPendingP) && /* ASSIGN! */
(readw(&UnixRupP->RupP->txcontrol) == TX_RUP_INACTIVE)) {
/*
** we are idle.
** there is a command in pending.
** Therefore, this command has finished.
** So, wakeup whoever is waiting for it (and tell them
** what happened).
*/
if (CmdBlkP->Packet.dest_port == BOOT_RUP)
rio_dprintk(RIO_DEBUG_CMD, "Free Boot %s Command Block '%x'\n", CmdBlkP->Packet.len & 0x80 ? "Command" : "Data", CmdBlkP->Packet.data[0]);
rio_dprintk(RIO_DEBUG_CMD, "Command %p completed\n", CmdBlkP);
/*
** Clear the Rup lock to prevent mutual exclusion.
*/
//.........这里部分代码省略.........
开发者ID:Einheri,项目名称:wl500g,代码行数:101,代码来源:riocmd.c
示例13: riotopen
int riotopen(struct tty_struct *tty, struct file *filp)
{
unsigned int SysPort;
int repeat_this = 250;
struct Port *PortP; /* pointer to the port structure */
unsigned long flags;
int retval = 0;
func_enter();
/* Make sure driver_data is NULL in case the rio isn't booted jet. Else gs_close
is going to oops.
*/
tty->driver_data = NULL;
SysPort = rio_minor(tty);
if (p->RIOFailed) {
rio_dprintk(RIO_DEBUG_TTY, "System initialisation failed\n");
func_exit();
return -ENXIO;
}
rio_dprintk(RIO_DEBUG_TTY, "port open SysPort %d (mapped:%d)\n", SysPort, p->RIOPortp[SysPort]->Mapped);
/*
** Validate that we have received a legitimate request.
** Currently, just check that we are opening a port on
** a host card that actually exists, and that the port
** has been mapped onto a host.
*/
if (SysPort >= RIO_PORTS) { /* out of range ? */
rio_dprintk(RIO_DEBUG_TTY, "Illegal port number %d\n", SysPort);
func_exit();
return -ENXIO;
}
/*
** Grab pointer to the port stucture
*/
PortP = p->RIOPortp[SysPort]; /* Get control struc */
rio_dprintk(RIO_DEBUG_TTY, "PortP: %p\n", PortP);
if (!PortP->Mapped) { /* we aren't mapped yet! */
/*
** The system doesn't know which RTA this port
** corresponds to.
*/
rio_dprintk(RIO_DEBUG_TTY, "port not mapped into system\n");
func_exit();
return -ENXIO;
}
tty->driver_data = PortP;
PortP->gs.tty = tty;
PortP->gs.count++;
rio_dprintk(RIO_DEBUG_TTY, "%d bytes in tx buffer\n", PortP->gs.xmit_cnt);
retval = gs_init_port(&PortP->gs);
if (retval) {
PortP->gs.count--;
return -ENXIO;
}
/*
** If the host hasn't been booted yet, then
** fail
*/
if ((PortP->HostP->Flags & RUN_STATE) != RC_RUNNING) {
rio_dprintk(RIO_DEBUG_TTY, "Host not running\n");
func_exit();
return -ENXIO;
}
/*
** If the RTA has not booted yet and the user has choosen to block
** until the RTA is present then we must spin here waiting for
** the RTA to boot.
*/
/* I find the above code a bit hairy. I find the below code
easier to read and shorter. Now, if it works too that would
be great... -- REW
*/
rio_dprintk(RIO_DEBUG_TTY, "Checking if RTA has booted... \n");
while (!(PortP->HostP->Mapping[PortP->RupNum].Flags & RTA_BOOTED)) {
if (!PortP->WaitUntilBooted) {
rio_dprintk(RIO_DEBUG_TTY, "RTA never booted\n");
func_exit();
return -ENXIO;
}
/* Under Linux you'd normally use a wait instead of this
busy-waiting. I'll stick with the old implementation for
now. --REW
*/
if (RIODelay(PortP, HUNDRED_MS) == RIO_FAIL) {
rio_dprintk(RIO_DEBUG_TTY, "RTA_wait_for_boot: EINTR in delay \n");
func_exit();
return -EINTR;
}
//.........这里部分代码省略.........
开发者ID:Tigrouzen,项目名称:k1099,代码行数:101,代码来源:riotty.c
示例14: RIONewTable
/*
** A configuration table has been loaded. It is now up to us
** to sort it out and use the information contained therein.
*/
int RIONewTable(struct rio_info *p)
{
int Host, Host1, Host2, NameIsUnique, Entry, SubEnt;
struct Map *MapP;
struct Map *HostMapP;
struct Host *HostP;
char *cptr;
/*
** We have been sent a new table to install. We need to break
** it down into little bits and spread it around a bit to see
** what we have got.
*/
/*
** Things to check:
** (things marked 'xx' aren't checked any more!)
** (1) That there are no booted Hosts/RTAs out there.
** (2) That the names are properly formed
** (3) That blank entries really are.
** xx (4) That hosts mentioned in the table actually exist. xx
** (5) That the IDs are unique (per host).
** (6) That host IDs are zero
** (7) That port numbers are valid
** (8) That port numbers aren't duplicated
** (9) That names aren't duplicated
** xx (10) That hosts that actually exist are mentioned in the table. xx
*/
rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(1)\n");
if (p->RIOSystemUp) { /* (1) */
p->RIOError.Error = HOST_HAS_ALREADY_BEEN_BOOTED;
return -EBUSY;
}
p->RIOError.Error = NOTHING_WRONG_AT_ALL;
p->RIOError.Entry = -1;
p->RIOError.Other = -1;
for (Entry = 0; Entry < TOTAL_MAP_ENTRIES; Entry++) {
MapP = &p->RIOConnectTable[Entry];
if ((MapP->Flags & RTA16_SECOND_SLOT) == 0) {
rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(2)\n");
cptr = MapP->Name; /* (2) */
cptr[MAX_NAME_LEN - 1] = '\0';
if (cptr[0] == '\0') {
memcpy(MapP->Name, MapP->RtaUniqueNum ? "RTA NN" : "HOST NN", 8);
MapP->Name[5] = '0' + Entry / 10;
MapP->Name[6] = '0' + Entry % 10;
}
while (*cptr) {
if (*cptr < ' ' || *cptr > '~') {
p->RIOError.Error = BAD_CHARACTER_IN_NAME;
p->RIOError.Entry = Entry;
return -ENXIO;
}
cptr++;
}
}
/*
** If the entry saved was a tentative entry then just forget
** about it.
*/
if (MapP->Flags & SLOT_TENTATIVE) {
MapP->HostUniqueNum = 0;
MapP->RtaUniqueNum = 0;
continue;
}
rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(3)\n");
if (!MapP->RtaUniqueNum && !MapP->HostUniqueNum) { /* (3) */
if (MapP->ID || MapP->SysPort || MapP->Flags) {
rio_dprintk(RIO_DEBUG_TABLE, "%s pretending to be empty but isn't\n", MapP->Name);
p->RIOError.Error = TABLE_ENTRY_ISNT_PROPERLY_NULL;
p->RIOError.Entry = Entry;
return -ENXIO;
}
rio_dprintk(RIO_DEBUG_TABLE, "!RIO: Daemon: test (3) passes\n");
continue;
}
rio_dprintk(RIO_DEBUG_TABLE, "RIONewTable: entering(4)\n");
for (Host = 0; Host < p->RIONumHosts; Host++) { /* (4) */
if (p->RIOHosts[Host].UniqueNum == MapP->HostUniqueNum) {
HostP = &p->RIOHosts[Host];
/*
** having done the lookup, we don't really want to do
** it again, so hang the host number in a safe place
*/
MapP->Topology[0].Unit = Host;
break;
}
}
if (Host >= p->RIONumHosts) {
rio_dprintk(RIO_DEBUG_TABLE, "RTA %s has unknown host unique number 0x%x\n", MapP->Name, MapP->HostUniqueNum);
//.........这里部分代码省略.........
开发者ID:Einheri,项目名称:wl500g,代码行数:101,代码来源:riotable.c
示例15: RIOReceive
/*
** Routine for handling received data for tty drivers
*/
static void RIOReceive(struct rio_info *p, struct Port *PortP)
{
struct tty_struct *TtyP;
unsigned short transCount;
struct PKT __iomem *PacketP;
register unsigned int DataCnt;
unsigned char __iomem *ptr;
unsigned char *buf;
int copied = 0;
static int intCount, RxIntCnt;
/*
** The receive data process is to remove packets from the
** PHB until there aren't any more or the current cblock
** is full. When this occurs, there will be some left over
** data in the packet, that we must do something with.
** As we haven't unhooked the packet from the read list
** yet, we can just leave the packet there, having first
** made a note of how far we got. This means that we need
** a pointer per port saying where we start taking the
** data from - this will normally be zero, but when we
** run out of space it will be set to the offset of the
** next byte to copy from the packet data area. The packet
** length field is decremented by the number of bytes that
** we successfully removed from the packet. When this reaches
** zero, we reset the offset pointer to be zero, and free
** the packet from the front of the queue.
*/
intCount++;
TtyP = PortP->gs.tty;
if (!TtyP) {
rio_dprintk(RIO_DEBUG_INTR, "RIOReceive: tty is null. \n");
return;
}
if (PortP->State & RIO_THROTTLE_RX) {
rio_dprintk(RIO_DEBUG_INTR, "RIOReceive: Throttled. Can't handle more input.\n");
return;
}
if (PortP->State & RIO_DELETED) {
while (can_remove_receive(&PacketP, PortP)) {
remove_receive(PortP);
put_free_end(PortP->HostP, PacketP);
}
} else {
/*
** loop, just so long as:
** i ) there's some data ( i.e. can_remove_receive )
** ii ) we haven't been blocked
** iii ) there's somewhere to put the data
** iv ) we haven't outstayed our welcome
*/
transCount = 1;
while (can_remove_receive(&PacketP, PortP)
&& transCount) {
RxIntCnt++;
/*
** check that it is not a command!
*/
if (readb(&PacketP->len) & PKT_CMD_BIT) {
rio_dprintk(RIO_DEBUG_INTR, "RIO: unexpected command packet received on PHB\n");
/* rio_dprint(RIO_DEBUG_INTR, (" sysport = %d\n", p->RIOPortp->PortNum)); */
rio_dprintk(RIO_DEBUG_INTR, " dest_unit = %d\n", readb(&PacketP->dest_unit));
rio_dprintk(RIO_DEBUG_INTR, " dest_port = %d\n", readb(&PacketP->dest_port));
rio_dprintk(RIO_DEBUG_INTR, " src_unit = %d\n", readb(&PacketP->src_unit));
rio_dprintk(RIO_DEBUG_INTR, " src_port = %d\n", readb(&PacketP->src_port));
rio_dprintk(RIO_DEBUG_INTR, " len = %d\n", readb(&PacketP->len));
rio_dprintk(RIO_DEBUG_INTR, " control = %d\n", readb(&PacketP->control));
rio_dprintk(RIO_DEBUG_INTR, " csum = %d\n", readw(&PacketP->csum));
rio_dprintk(RIO_DEBUG_INTR, " data bytes: ");
for (DataCnt = 0; DataCnt < PKT_MAX_DATA_LEN; DataCnt++)
rio_dprintk(RIO_DEBUG_INTR, "%d\n", readb(&PacketP->data[DataCnt]));
remove_receive(PortP);
put_free_end(PortP->HostP, PacketP);
continue; /* with next packet */
}
/*
** How many characters can we move 'upstream' ?
**
** Determine the minimum of the amount of data
** available and the amount of space in which to
** put it.
**
** 1. Get the packet length by masking 'len'
** for only the length bits.
** 2. Available space is [buffer size] - [space used]
**
** Transfer count is the minimum of packet length
** and available space.
*/
//.........这里部分代码省略.........
开发者ID:FatSunHYS,项目名称:OSCourseDesign,代码行数:101,代码来源:riointr.c
示例16: RIOCommandRup
/*
** Incoming command on the COMMAND_RUP to be processed.
*/
static int RIOCommandRup(struct rio_info *p, uint Rup, struct Host *HostP, struct PKT __iomem *PacketP)
{
struct PktCmd __iomem *PktCmdP = (struct PktCmd __iomem *)PacketP->data;
struct Port *PortP;
struct UnixRup *UnixRupP;
unsigned short SysPort;
unsigned short ReportedModemStatus;
unsigned short rup;
unsigned short subCommand;
unsigned long flags;
func_enter();
/*
** 16 port RTA note:
** Command rup packets coming from the RTA will have pkt->data[1] (which
** translates to PktCmdP->PhbNum) set to the host port number for the
** particular unit. To access the correct BaseSysPort for a 16 port RTA,
** we can use PhbNum to get the rup number for the appropriate 8 port
** block (for the first block, this should be equal to 'Rup').
*/
rup = readb(&PktCmdP->PhbNum) / (unsigned short) PORTS_PER_RTA;
UnixRupP = &HostP->UnixRups[rup];
SysPort = UnixRupP->BaseSysPort + (readb(&PktCmdP->PhbNum) % (unsigned short) PORTS_PER_RTA);
rio_dprintk(RIO_DEBUG_CMD, "Command on rup %d, port %d\n", rup, SysPort);
if (UnixRupP->BaseSysPort == NO_PORT) {
rio_dprintk(RIO_DEBUG_CMD, "OBSCURE ERROR!\n");
rio_dprintk(RIO_DEBUG_CMD, "Diagnostics follow. Please WRITE THESE DOWN and report them to Specialix Technical Support\n");
rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Host number %Zd, name ``%s''\n", HostP - p->RIOHosts, HostP->Name);
rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Rup number 0x%x\n", rup);
if (Rup < (unsigned short) MAX_RUP) {
rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for RTA ``%s''\n", HostP->Mapping[Rup].Name);
} else
rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for link ``%c'' of host ``%s''\n", ('A' + Rup - MAX_RUP), HostP->Name);
rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Destination 0x%x:0x%x\n", readb(&PacketP->dest_unit), readb(&PacketP->dest_port));
rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Source 0x%x:0x%x\n", readb(&PacketP->src_unit), readb(&PacketP->src_port));
rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Length 0x%x (%d)\n", readb(&PacketP->len), readb(&PacketP->len));
rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Control 0x%x (%d)\n", readb(&PacketP->control), readb(&PacketP->control));
rio_dprintk(RIO_DEBUG_CMD, "PACKET information: Check 0x%x (%d)\n", readw(&PacketP->csum), readw(&PacketP->csum));
rio_dprintk(RIO_DEBUG_CMD, "COMMAND information: Host Port Number 0x%x, " "Command Code 0x%x\n", readb(&PktCmdP->PhbNum), readb(&PktCmdP->Command));
return 1;
}
PortP = p->RIOPortp[SysPort];
rio_spin_lock_irqsave(&PortP->portSem, flags);
switch (readb(&PktCmdP->Command)) {
case BREAK_RECEIVED:
rio_dprintk(RIO_DEBUG_CMD, "Received a break!\n");
/* If the current line disc. is not multi-threading and
the current processor is not the default, reset rup_intr
and return 0 to ensure that the command packet is
not freed. */
/* Call tmgr HANGUP HERE */
/* Fix this later when every thing works !!!! RAMRAJ */
gs_got_break(&PortP->gs);
break;
case COMPLETE:
rio_dprintk(RIO_DEBUG_CMD, "Command complete on phb %d host %Zd\n", readb(&PktCmdP->PhbNum), HostP - p->RIOHosts);
subCommand = 1;
switch (readb(&PktCmdP->SubCommand)) {
case MEMDUMP:
rio_dprintk(RIO_DEBUG_CMD, "Memory dump cmd (0x%x) from addr 0x%x\n", readb(&PktCmdP->SubCommand), readw(&PktCmdP->SubAddr));
break;
case READ_REGISTER:
rio_dprintk(RIO_DEBUG_CMD, "Read register (0x%x)\n", readw(&PktCmdP->SubAddr));
p->CdRegister = (readb(&PktCmdP->ModemStatus) & MSVR1_HOST);
break;
default:
subCommand = 0;
break;
}
if (subCommand)
break;
rio_dprintk(RIO_DEBUG_CMD, "New status is 0x%x was 0x%x\n", readb(&PktCmdP->PortStatus), PortP->PortState);
if (PortP->PortState != readb(&PktCmdP->PortStatus)) {
rio_dprintk(RIO_DEBUG_CMD, "Mark status & wakeup\n");
PortP->PortState = readb(&PktCmdP->PortStatus);
/* What should we do here ...
wakeup( &PortP->PortState );
*/
} else
rio_dprintk(RIO_DEBUG_CMD, "No change\n");
/* FALLTHROUGH */
case MODEM_STATUS:
/*
** Knock out the tbusy and tstop bits, as these are not relevant
** to the check for modem status change (they're just there because
** it's a convenient place to put them!).
*/
ReportedModemStatus = readb(&PktCmdP->ModemStatus);
if ((PortP->ModemState & MSVR1_HOST) == (ReportedModemStatus & MSVR1_HOST)) {
rio_dprintk(RIO_DEBUG_CMD, "Modem status unchanged 0x%x\n", PortP->ModemState);
/*
//.........这里部分代码省略.........
开发者ID:Einheri,项目名称:wl500g,代码行数:101,代码来源:riocmd.c
示例17: riotclose
/*
** RIOClose the port.
** The operating system thinks that this is last close for the device.
** As there are two interfaces to the port (Modem and tty), we need to
** check that both are closed before we close the device.
*/
int riotclose(void *ptr)
{
struct Port *PortP = ptr; /* pointer to the port structure */
int deleted = 0;
int try = -1; /* Disable the timeouts by setting them to -1 */
int repeat_this = -1; /* Congrats to those having 15 years of
uptime! (You get to break the driver.) */
unsigned long end_time;
struct tty_struct *tty;
unsigned long flags;
int rv = 0;
rio_dprintk(RIO_DEBUG_TTY, "port close SysPort %d\n", PortP->PortNum);
/* PortP = p->RIOPortp[SysPort]; */
rio_dprintk(RIO_DEBUG_TTY, "Port is at address %p\n", PortP);
/* tp = PortP->TtyP; *//* Get tty */
tty = PortP->gs.tty;
rio_dprintk(RIO_DEBUG_TTY, "TTY is at address %p\n", tty);
if (PortP->gs.closing_wait)
end_time = jiffies + PortP->gs.closing_wait;
else
end_time = jiffies + MAX_SCHEDULE_TIMEOUT;
rio_spin_lock_irqsave(&PortP->portSem, flags);
/*
** Setting this flag will make any process trying to open
** this port block until we are complete closing it.
*/
PortP->State |= RIO_CLOSING;
if ((PortP->State & RIO_DELETED)) {
rio_dprintk(RIO_DEBUG_TTY, "Close on deleted RTA\n");
deleted = 1;
}
if (p->RIOHalted) {
RIOClearUp(PortP);
rv = -EIO;
goto close_end;
}
rio_dprintk(RIO_DEBUG_TTY, "Clear bits\n");
/*
** clear the open bits for this device
*/
PortP->State &= ~RIO_MOPEN;
PortP->State &= ~RIO_CARR_ON;
PortP->ModemState &= ~MSVR1_CD;
/*
** If the device was open as both a Modem and a tty line
** then we need to wimp out here, as the port has not really
** been finally closed (gee, whizz!) The test here uses the
** bit for the OTHER mode of operation, to see if THAT is
** still active!
*/
if ((PortP->State & (RIO_LOPEN | RIO_MOPEN))) {
/*
** The port is still open for the other task -
** return, pretending that we are still active.
*/
rio_dprintk(RIO_DEBUG_TTY, "Channel %d still open !\n", PortP->PortNum);
PortP->State &= ~RIO_CLOSING;
if (PortP->firstOpen)
PortP->firstOpen--;
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return -EIO;
}
rio_dprintk(RIO_DEBUG_TTY, "Closing down - everything must go!\n");
PortP->State &= ~RIO_DYNOROD;
/*
** This is where we wait for the port
** to drain down before closing. Bye-bye....
** (We never meant to do this)
*/
rio_dprintk(RIO_DEBUG_TTY, "Timeout 1 starts\n");
if (!deleted)
while ((PortP->InUse != NOT_INUSE) && !p->RIOHalted && (PortP->TxBufferIn != PortP->TxBufferOut)) {
if (repeat_this-- <= 0) {
rv = -EINTR;
rio_dprintk(RIO_DEBUG_TTY, "Waiting for not idle closed broken by signal\n");
RIOPreemptiveCmd(p, PortP, FCLOSE);
goto close_end;
}
rio_dprintk(RIO_DEBUG_TTY, "Calling timeout to flush in closing\n");
rio_spin_unlock_irqrestore(&PortP->portSem, flags);
if (RIODelay_ni(PortP, HUNDRED_MS * 10) == RIO_FAIL) {
rio_dprintk(RIO_DEBUG_TTY, "RTA EINTR in delay \n");
//.........这里部分代码省略.........
开发者ID:Tigrouzen,项目名称:k1099,代码行数:101,代码来源:riotty.c
示例18: RIOTxEnable
/* Enable and start the transmission of packets */
void RIOTxEnable(char *en)
{
struct Port *PortP;
struct rio_info *p;
struct tty_struct *tty;
int c;
struct PKT __iomem *PacketP;
unsigned long flags;
PortP = (struct Port *) en;
p = (struct rio_info *) PortP->p;
tty = PortP->gs.tty;
rio_dprintk(RIO_DEBUG_INTR, "tx port %d: %d chars queued.\n", PortP->PortNum, PortP->gs.xmit_cnt);
if (!PortP->gs.xmit_cnt)
return;
/* This routine is an order of magnitude simpler than the specialix
version. One of the disadvantages is that this version will send
an incomplete packet (usually 64 bytes instead of 72) once for
|
请发表评论