IMPLEMENT bool Uart::change_mode(TransferMode m, BaudRate r) { Proc::Status o = Proc::cli_save(); Unsigned8 old_lcr = lcr(); if(r != BAUD_NC) { lcr(old_lcr | 0x80/*DLAB*/); Unsigned16 divisor = Base_rate/r; trb( divisor & 0x0ff ); /* BRD_LOW */ ier( (divisor >> 8) & 0x0ff ); /* BRD_HIGH */ lcr(old_lcr); }
IMPLEMENT bool Uart::startup(Address _port, int __irq) { port = _port; _irq = __irq; Proc::Status o = Proc::cli_save(); if (!valid()) { Proc::sti_restore(o); fail(); return false; } ier(Base_ier_bits);/* disable all rs-232 interrupts */ mcr(0x0b); /* out2, rts, and dtr enabled */ fcr(1); /* enable fifo */ fcr(0x07); /* clear rcv xmit fifo */ fcr(1); /* enable fifo */ lcr(0); /* clear line control register */ /* clearall interrupts */ /*read*/ msr(); /* IRQID 0*/ /*read*/ iir(); /* IRQID 1*/ /*read*/ trb(); /* IRQID 2*/ /*read*/ lsr(); /* IRQID 3*/ while(lsr() & 1/*DATA READY*/) /*read*/ trb(); Proc::sti_restore(o); return true; }
IMPLEMENT void Uart::shutdown() { Proc::Status o = Proc::cli_save(); mcr(0x06); fcr(0); lcr(0); ier(0); Proc::sti_restore(o); }
int main(int argc,char** argv) { ros::init(argc,argv,"global_planning"); tf::TransformListener tf(ros::Duration(10)); costmap_2d::Costmap2DROS lcr("costmap",tf); global_planner::testCostmap costmap("my_costap",&lcr); ros::spin(); return 0; }