Changeset ca4c4164 in rtems
- Timestamp:
- 03/09/17 14:44:08 (7 years ago)
- 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)
- 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 217 217 } 218 218 #endif 219 220 #define NELEM(a) ((int) (sizeof (a) / sizeof (a[0]))) 219 221 220 222 static int grcan_count = 0; … … 308 310 * by using the driver minor. 309 311 */ 310 sprintf(priv->devName, " /dev/grcan%d", dev->minor_drv);312 sprintf(priv->devName, "grcan%d", dev->minor_drv); 311 313 } else { 312 314 /* Got special prefix, this means we have a bus prefix 313 315 * And we should use our "bus minor" 314 316 */ 315 sprintf(priv->devName, " /dev/%sgrcan%d", prefix, dev->minor_bus);317 sprintf(priv->devName, "%sgrcan%d", prefix, dev->minor_bus); 316 318 } 317 319 … … 1178 1180 } 1179 1181 1182 void *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 1180 1201 void *grcan_open(int dev_no) 1181 1202 { … … 1464 1485 1465 1486 /* 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); 1467 1489 1468 1490 return 0; -
c/src/lib/libbsp/sparc/shared/include/grcan.h
r05749690 rca4c4164 170 170 */ 171 171 extern 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 */ 182 extern void *grcan_open_by_name(char *name, int *dev_no); 172 183 173 184 /*
Note: See TracChangeset
for help on using the changeset viewer.