Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 727 → Rev 726

/shark/trunk/ports/servo/servo.c
135,8 → 135,6
volatile unsigned int TX_position[4] = {0,0,0,0};
volatile unsigned int RX_cycle = 0;
volatile unsigned int TX_cycle = 0;
volatile unsigned int servo_skip = 0;
volatile unsigned int lock_write = 0;
 
const int BaudTable[] = {
1200,
157,7 → 155,7
}
 
void servo_indication(unsigned port, BYTE data) {
 
if (RXTX_addr[port][RX_position[port]] == NULL) {
if (data != RXTX_buff[port][RX_position[port]])
servo_rx_error(port,1);
184,25 → 182,17
}
if ((RX_cycle == TX_cycle && RX_position[port] > TX_position[port]) ||
(RX_cycle > TX_cycle))
servo_rx_error(port,3);
servo_rx_error(port,2);
 
}
 
}
 
extern int SCom_Error;
 
void servo_confirm(unsigned port, BYTE msg_status) {
 
if (msg_status == COM_ERROR) {
kern_printf("(SERVO: PORT:%d ERROR:%d)",port,SCom_Error);
servo_skip = 1;
}
if (msg_status == COM_ERROR)
kern_printf("(SERVO: PORT:%d ERROR)",port);
 
if (msg_status == COM_OK) {
lock_write = 0;
}
 
}
 
int servo_send_msg(unsigned port, BYTE *msg, unsigned len_msg, BYTE *res, unsigned len_res) {
210,9 → 200,6
int i = 0, old, oldcycle, RX = 0;
SYS_FLAGS f;
 
while(lock_write == 1);
lock_write = 1;
 
f = kern_fsave();
 
old = TX_position[port];
264,10 → 251,8
 
int servo_wait(unsigned port, int RX) {
 
servo_skip = 0;
 
/* Active wait until number bytes received */
while (RXTX_buff[port][RX] == 0 && servo_skip == 0);
while (RXTX_buff[port][RX] == 0);
 
return 0;