Changeset ca4c4164 in rtems


Ignore:
Timestamp:
03/09/17 14:44:08 (7 years ago)
Author:
Daniel Hellstrom <daniel@…>
Branches:
5, master
Children:
2d3d8f96
Parents:
05749690
git-author:
Daniel Hellstrom <daniel@…> (03/09/17 14:44:08)
git-committer:
Daniel Hellstrom <daniel@…> (05/14/17 10:31:58)
Message:

leon, grcan: updated device name and use it for ISR

Location:
c/src/lib/libbsp/sparc/shared
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/sparc/shared/can/grcan.c

    r05749690 rca4c4164  
    217217}
    218218#endif
     219
     220#define NELEM(a) ((int) (sizeof (a) / sizeof (a[0])))
    219221
    220222static int grcan_count = 0;
     
    308310                 * by using the driver minor.
    309311                 */
    310                 sprintf(priv->devName, "/dev/grcan%d", dev->minor_drv);
     312                sprintf(priv->devName, "grcan%d", dev->minor_drv);
    311313        } else {
    312314                /* Got special prefix, this means we have a bus prefix
    313315                 * And we should use our "bus minor"
    314316                 */
    315                 sprintf(priv->devName, "/dev/%sgrcan%d", prefix, dev->minor_bus);
     317                sprintf(priv->devName, "%sgrcan%d", prefix, dev->minor_bus);
    316318        }
    317319
     
    11781180}
    11791181
     1182void *grcan_open_by_name(char *name, int *dev_no)
     1183{
     1184        int i;
     1185        for (i = 0; i < grcan_count; i++){
     1186                struct grcan_priv *pDev;
     1187
     1188                pDev = priv_tab[i];
     1189                if (NULL == pDev) {
     1190                        continue;
     1191                }
     1192                if (strncmp(pDev->devName, name, NELEM(pDev->devName)) == 0) {
     1193                        if (dev_no)
     1194                                *dev_no = i;
     1195                        return grcan_open(i);
     1196                }
     1197        }
     1198        return NULL;
     1199}
     1200
    11801201void *grcan_open(int dev_no)
    11811202{
     
    14641485
    14651486        /* Register interrupt routine and enable IRQ at IRQ ctrl */
    1466         drvmgr_interrupt_register(pDev->dev, 0, "grcan", grcan_interrupt, pDev);
     1487        drvmgr_interrupt_register(pDev->dev, 0, pDev->devName,
     1488                                        grcan_interrupt, pDev);
    14671489
    14681490        return 0;
  • c/src/lib/libbsp/sparc/shared/include/grcan.h

    r05749690 rca4c4164  
    170170 */
    171171extern void *grcan_open(int dev_no);
     172
     173/*
     174 * Open a GRCAN device by name. Finds device index then calls
     175 * grcan_open(index).
     176 *
     177 * name:        Device name to open
     178 * dev_no:      Device number matching name. Will be set if device found.
     179 * return:      Device handle to use with all other grcan_ API functions. The
     180 *              function returns NULL if device can not be opened or not found.
     181 */
     182extern void *grcan_open_by_name(char *name, int *dev_no);
    172183
    173184/*
Note: See TracChangeset for help on using the changeset viewer.