* Rewritten for new CAN queues by Pavel Pisa - OCERA team member
* email:pisa@cmp.felk.cvut.cz
* This software is released under the GPL-License.
- * Version lincan-0.2 9 Jul 2003
+ * Version lincan-0.3 17 Jun 2004
*/
#include "../include/can.h"
unsigned btr0=0, btr1=0;
struct canuser_t *canuser = (struct canuser_t*)(file->private_data);
struct msgobj_t *obj;
- struct chip_t *chip;
+ struct canchip_t *chip;
struct canque_ends_t *qends;
if(!canuser || (canuser->magic != CAN_USER_MAGIC)){
break;
}
case CONF_FILTER: {
- #if 0
- if (!strcmp(chip->chip_type,"i82527")) {
-
- unsigned char id1, id0;
- id1 = (unsigned char) (arg << 5);
- id0 = (unsigned char) (arg >> 3);
-
- DEBUGMSG("configuring ID=%lx in message object:"
- " %02x, %02x\n", arg, id0, id1);
- can_write_reg(chip,id1,MSG_OFFSET(obj->object) +
- iMSGID1);
- can_write_reg(chip,id0,MSG_OFFSET(obj->object) +
- iMSGID0);
- }
- #endif
/* In- and output buffer re-initialization */
}
break;
}
+
+ case CONF_BAUDPARAMS: {
+ struct can_baudparams_t params;
+ copy_from_user(¶ms, (void*)arg, sizeof(struct can_baudparams_t));
+ if(params.flags == -1) params.flags = 0;
+ if(params.baudrate == -1) params.baudrate = chip->baudrate;
+ if(params.sjw == -1) params.sjw = 0;
+ if(params.sample_pt == -1) params.sample_pt = 75;
+ i=chip->chipspecops->baud_rate(chip, params.baudrate, chip->clock, params.sjw,
+ params.sample_pt, params.flags);
+ if(i>=0) chip->baudrate = params.baudrate;
+ else {
+ CANMSG("Error setting baud parameters\n");
+ return -1;
+ }
+ break;
+ }
+
+
default: {
CANMSG("Not a valid ioctl command\n");
return -EINVAL;