Changeset bc73a085 in rtems


Ignore:
Timestamp:
Jun 17, 2020, 5:57:26 AM (3 weeks ago)
Author:
Chris Johns <chrisj@…>
Branches:
5, master
Children:
46c23871
Parents:
4a8b135
git-author:
Chris Johns <chrisj@…> (06/17/20 05:57:26)
git-committer:
Chris Johns <chrisj@…> (06/18/20 02:03:28)
Message:

i386/pc: Initialise the printk serial port on first use

Location:
bsps/i386/pc386/console
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • bsps/i386/pc386/console/conscfg.c

    r4a8b135 rbc73a085  
    4747  #define CLOCK_RATE    (115200 * 16)
    4848
    49   static uint8_t com_get_register(uint32_t addr, uint8_t i)
     49  static uint8_t com_get_register(uintptr_t addr, uint8_t i)
    5050  {
    51     register uint8_t val;
    52 
     51    uint8_t val;
    5352    inport_byte( (addr + i), val );
    5453    return val;
    5554  }
    5655
    57   static void com_set_register(uint32_t addr, uint8_t i, uint8_t val)
     56  static void com_set_register(uintptr_t addr, uint8_t i, uint8_t val)
    5857  {
    5958    outport_byte( (addr + i), val );
  • bsps/i386/pc386/console/printk_support.c

    r4a8b135 rbc73a085  
    3030rtems_device_minor_number BSPPrintkPort = 0;
    3131
     32static bool serialInit;
     33static bool serialOK;
     34
     35static bool serialValid(console_tbl *port)
     36{
     37  if (port->pDeviceFns) {
     38    if (!serialInit) {
     39      serialOK = true;
     40      if (port->pDeviceFns->deviceProbe != NULL) {
     41        if (!port->pDeviceFns->deviceProbe( BSPPrintkPort ))
     42          serialOK = false;
     43        else if (port->pDeviceFns->deviceInitialize != NULL)
     44          port->pDeviceFns->deviceInitialize( BSPPrintkPort );
     45        else
     46          serialOK = false;
     47      }
     48      serialInit = true;
     49    }
     50  }
     51  return serialOK;
     52}
     53
    3254void BSP_outch(char ch);
    3355int BSP_inch(void);
     
    4365  if ( !isVga ) {
    4466    console_tbl *port = Console_Port_Tbl[BSPPrintkPort];
    45     if (port->pDeviceFns && port->pDeviceFns->deviceWritePolled) {
    46       port->pDeviceFns->deviceWritePolled( BSPPrintkPort, ch );
     67    if (serialValid(port)) {
     68      if (port->pDeviceFns->deviceWritePolled) {
     69        port->pDeviceFns->deviceWritePolled( BSPPrintkPort, ch );
     70      }
     71      return;
    4772    }
    48     return;
    4973  }
    5074
     
    6690  if ( !isVga ) {
    6791    console_tbl *port = Console_Port_Tbl[BSPPrintkPort];
    68     if (port->pDeviceFns && port->pDeviceFns->deviceRead) {
    69       do {
    70         result = port->pDeviceFns->deviceRead( BSPPrintkPort );
    71       } while (result == -1);
    72       return result;
     92    if (serialValid(port)) {
     93      if (port->pDeviceFns->deviceRead) {
     94        do {
     95          result = port->pDeviceFns->deviceRead( BSPPrintkPort );
     96        } while (result == -1);
     97        return result;
     98      }
    7399    }
    74100  }
Note: See TracChangeset for help on using the changeset viewer.