Home

BIOS REFERENCE MANUAL - K-Team

image

Contents

1. K system A All information in this document is preliminary and subject to change str reset Init of the resources of the manager This system call inits the manager Input Output Call examples in assembler and C CALL_BIOS str reset 0 execute the function str_reset K Team http www k team com info k team com May 25 1999 145 K system A All information in this document is preliminary and subject to change str cnut dascii bin32C binarg ascii paramNb Conversion from an ASCII decimal formatted buffer to a 32 bit binary one This system call converts an ASCII decimal representation formatted buffer to a 32 bit binary one An error is returned if the buffer is inconsistent Here is an example ASCII in 10 1 4 4 66 r n 0 Parameter number 3 Binary out OxA Ox1 Ox4 Input stacking order paramNb Number of parameters asci i Pointer on the ASCII buffer binary Pointer on the binary buffer Output D 0 Conuersion OK DO 1 Format of the buffer inconsistent Call examples in assembler and C push 32 A6 paramNb number of parameters push 32 A6 asci i pointer on an ASCII buffer push 32 A6 b inary pointer on a binary buffer CALL_BIOS str cnvt _dasci i_bin32 3 execute the function test 32 DO jump mi R8 Error buffer format error int32 status uint32 binary paramNb char ascii status str conuert dascii bin32 binar
2. K system A All information in this document is preliminary and subject to change tim_wai t_syne CsyncMask Wait for an external synchronisation This system call waits for an external synchronisation generated by some low level actions After this system call the current task descriptor is placed in the suspended sync list Only an event generated by a low level action can place the suspended task descriptor in the execution list Input stacking order syncMask 2 PID sample syncMask 2 1 Trajectory terminated on target syncMask 2 2 Message sent by MSG manager syncMask 2 3 Message received by MSG manager syncMask 2 4 Message sent by SER manager syncMask 2 5 Byte received by SER manager syncMask 2 6 IR sensors sync each sensors generate a sync syncMask 2 7 IR sensors sync the sensor generates a sync syncMask 2 8 IRQ interruption Output Call examples in assembler and C push 32 A6 syncMask wait for CALL_BIOS tim_wait sync 1 execute the function uint32 suncMask tim_wai t suncCsunchMask K Team http www k team com info k team com May 25 1999 42 K system A All information in this document is preliminary and subject to change tim get task des ptr Return the pointer on the main task descriptor This system call returns the pointer on the main task descriptor structure Input stacking order Output taskDescripto
3. Koala coo BIOS REFERENCE MANUAL Version 1 0 K Team S A Lausanne 25 mai 1999 Documentation author K Team S A Ch de Vuasset CP 111 1028 Pr verenges Switzerland email info k team com WWW http www k team com Trademark Acknowledgements IBM PC International Business Machines Corp Macintosh Apple Corp SUN Sparc Station SUN Microsystems Corp LabVIEW National Instruments Corp Khepera K Team S A NOTICE The contents of this manual are subject to change without notice Allefforts have been made to ensure the accuracy of the contents of this manual How ever should any errors be detected In this case please inform the K Team S A The above notwithstanding K Team S A can assume no responsibility for any errors in this manual K system A All information in this document is preliminary and subject to change Table of content Table of content Abstract Preliminary BIOS organisation Basic managers General constraints Rules for building applications Table of content Generalities Table of content Generalities Table of content Generalities The PID implementation The speed profile generator Table of content Generalities K Team http www k team com info k team com May 25 1999 1 K system A All information in this document is preliminary and subject to change Table of content Generalities Table of content Generalities R
4. This system call acknowledge one or more interrupts coming from the general input lines Bits 0 to 11 are the acknowledge bits for inputs 0 to 11 Writing a 0 to a bit acknowledge the corresponding inter rupt and clear it Input stacking order ackMask acknowledge mask clearing the interrupt Output Call examples in assembler and C push 32 A6 ackMask CALL_BIOS uio ack irq inputs 1 3 execute the function uint32 ackMask uio_ack_irq inputsCackMask K Team http www k team com info k team com May 25 1999 132 K system A All information in this document is preliminary and subject to change uio_get_status_irq inputs Get the status of the interrupt inputs This system call returns the state values of the interrupts corresponding to the general inputs Bit 0 to 11 correspond to the state of inputs 0 to 11 Input stacking order Output D interruptValue State of the interrupts Call examples in assembler and C CALL_BIOS uio_get_status_irq_inputs execute the function moue 32 D A6 interruptValue general input value uint32 interruptUalue interruptUalue uio get status irq inputsC K Team http www k team com info k team com May 25 1999 133 K system A All information in this document is preliminary and subject to change uio get input stateCinputNbr Get the value of one digital input This system call returns the stat
5. int32 position position1 mot_new_posi tion_2mCpositionl position0 K Team http www k team com info k team com May 25 1999 60 K system A All information in this document is preliminary and subject to change mot_conf ig_profil imCmotorNb maxSpeed maxAcceleration Set up the coefficients of the profile controller for one motor This system call initialises the speed and the acceleration coefficients for the profile controller for one motor As usual the values stacked are coded on 32 bits The acceleration representation is coded in fixed point 24 8 24 bits integer and 8 bits fractionnary The following good coefficients lab tested can be used for nearly all applications An error is returned if the motor does not exist Maximum of the speed maxSpeed 20 units Maximum of the acceleration maxAcceleration 0 25 units The unit of the speed is 0 03 mm 10 ms The unit of the acceleration is 0 03 mm 10 ms 2 Input stacking order maxAcceleration maxSpeed mo torNb Output DO 0 DO 1 Call examples in assembler and C Rcceleration coefficient Speed coefficient Number of the motor 1 OK The motor does not exist push 32 A6 maxAcceleration acceleration push 32 A6 maxSpeed push 32 A6 mo torNb 3 speed motor number CALL_BIOS mot config profil 1m 3 execute the function test 32 DO jump mi R8 Error int32 status the motor does n
6. Conversion from a 32 bit binary buffer to an ASCII decimal formatted one This system call converts a 32 bit binary buffer to an ASCII decimal representation formatted one Here is an example Binary in OxA 0x1 0x4 0x324 0x345 0x43 Parameter number 3 ASCII out 10 1 4 r n 0 Input stacking order paramNb Number of parameters binary Pointer on the binary buffer asci i Pointer on the ASCII buffer Output Call examples in assembler and C push 32 A6 paramNb number of parameters push 32 A6 binary pointer on a binary buffer push 32 A6 asci i pointer on an ASCII buffer CALL BIOS str cnut bin32 dascii 3 execute the function char ascii uint32 binary paramNb str conuert bin32 dasciiCascii binary paramNb K Team http www k team com info k team com May 25 1999 148 K system A All information in this document is preliminary and subject to change str cnut bin8 dasciiCascii binary paramNb Conversion from an 8 bit binary buffer to an ASCII decimal formatted one This system call converts an 8 bit binary buffer to an ASCII decimal representation formatted one Here is an example Binary in OxA 0x1 0x4 0x24 0x35 0x43 Parameter number 3 ASCII out 10 1 4 r n 0 Input stacking order paramNb Number of parameters binary Pointer on the binary buffer asci i Pointer on the ASCII buffer Output Call examples in assembler and C push 32
7. Input stacking order reference Pointer on a 16 char max string terminated with null Q Output DO lt gt 1 General pointer DO 1 No association Call examples in assembler and C push 32 R 16 reference pointer on the reference CALL_BIOS tim_find_association 1 execute the function test 32 DO jump mi R8 Error no association moue 32 DO AG general pointer int32 status uint32 general 5 static char reference Sensors status tim_find_associationCreference if status lt return 1j general Cuint32 status K Team http www k team com info k team com May 25 1999 40 K system A All information in this document is preliminary and subject to change tim_remove_associationCreference Remove an association from the table This system call removes an association from the table An error is returned if there is no such associ ation Input stacking order reference Pointer on a 16 char max string terminated with null M8 Output DO 0 Rssociation remoued DO 1 No association Call examples in assembler and C push 32 R 16 reference pointer on the reference CALL_BIOS tim_remove_association 1 5 execute the function test 32 DO jump mi R8 Error no association int32 status char reference status tim_remove_associationCreference if status lt return 1 K Team http www k team com info k team com May 25 1999 41
8. bios_get_system Get the family identifier type of the system This system call returns the family identifier type of the device supported by the K Team Here is the list of the available devices Input stacking order Output DO family Family identifier Call examples in assembler and C CALL_BIOS bios_get_system execute the function move 32 D A6 family family identifier uint32 family family bios_get_system K Team http www k team com info k team com May 25 1999 13 K system A All information in this document is preliminary and subject to change bios_restar t_system Perform a restart of the system This system call allows to restart the system All the peripherals memory and BIOS managers are initialised The function selected by the jumper is executed after this system call Input stacking order Output Call examples in assembler and C CALL_BIOS bios_restart_system execute the function bios_restart_system K Team http www k team com info k team com May 25 1999 14 K system A All information in this document is preliminary and subject to change COM Rev 1 02 K Team http www k team com info k team com COM COM manager i o manager Family ID BIOS Table of content com reset o com reserue channel com_release_channel com send buffer buffer size com_
9. execute the function move 32 DO A6 jumperValue jumper value uint32 jumperUalue jumperUalue var_get_jumper K Team http www k team com info k team com May 25 1999 113 K system A All information in this document is preliminary and subject to change uar on edCledNb Turn on one LED This system call turns on a selected LED An error is returned if the LED does not exist Input stacking order ledNb Output De Q De 1 Call examples in assembler and C push 32 A6 1edNb CALL_BIOS var_on_led 1 test 32 DO jump mi R8 Error int32 status uint32 ledNb status uar on ledCledNb if status lt 0D return 1j K Team http www k team com Number of the LED OK The LED does not exist 5 execute the function the LED does not exist info k team com May 25 1999 114 K system A All information in this document is preliminary and subject to change var off led l1edNb Turn off one LED This system call turns off a selected LED An error is returned if the LED does not exist Input stacking order 1edNb Output De De Number of the LED OK The LED does not exist Call examples in assembler and C push 32 CALL_BIOS test 32 jump mi int32 uint32 A6 1edNb var_of f_led 1 execute the function DO R8 Error the LED does not exist status ledNb status uar off led ledNb if
10. if status lt 0 return 1j analogUalue Cuint32 status Q http www k team com info k team com May 25 1999 138 K system A All information in this document is preliminary and subject to change ctr reserue channel C Reserve the battery EEPROM channel This system call reserves the channel for a transaction with the EEPROM of the battery The EEPROM channel is a critical resource which can be shared with other tasks An error is returned if the channel is busy Input stacking order Output DO 0 Channel reserued and ready to operate DO 1 Channel busy Call examples in assembler and C CALL_BIOS ctr_reserve channel execute the function test 32 DO jump mi R8 Error wait int32 status status ctr reserue channel C5 if status lt 0D return 1j K Team http www k team com info k team com May 25 1999 139 K system A All information in this document is preliminary and subject to change ctr release channel C Release the battery EEPROM channel This system call releases the EEPROM channel The other tasks can now use this channel Input stacking order Output Call examples in assembler and C CALL_BIOS ctr_release channel 3 execute the function ctr release channel K Team http www k team com info k team com May 25 1999 140 K system A All information in this document is preliminary and subj
11. CALL BIOS mma_receive_byte_1 execute the function test 32 DO jump mi R8 Error 3 channel error moue 8 D A6 aByte a character int32 status uints aByte status mma_receive_byte_10 5 if status lt 0 return 1j aByte Cuint8 status Edoardo Franzi franzi k team com May 25 1999 92 K system A All information in this document is preliminary and subject to change mma_rece ive_by te_2 Receive one byte by the MMA 2 channel This system call looks for the reception buffer of the MMA 2 channel if one byte is available Input stacking order Output DO 16 000000nn nn byte DO 1 Buffer empty Call examples in assembler and C CALL_BIOS mma_receive_byte_2 execute the function test 32 DO 3 jump mi R8 Error 3 channel error moue 8 D A6 aByte a character int32 status uints aByte status mma receiue byte 2 5 if status lt return 1j aByte Cuint8 status Edoardo Franzi franzi k team com May 25 1999 93 K system A All information in this document is preliminary and subject to change mma tx status QC Get the status of the MMA 0 channel transmitter This system call looks for the status of the MMA 0 channel transmitter Input stacking order Output D 0 Buffer empty DO 1 Buffer not empty Call examples in assembler and C CALL BIOS mma tx status 0 0 execute the function test 32 DO 3 jump mi R8 Erro
12. Here is an example ASCII in 10 23455 4 456 23 r n 0 Parameter number 4 ASCII out 23 r n 0 Input stacking order paramNb Number of parameters asci i Pointer on the ASCII buffer Output asci i Pointer at the end of the ASCII buffer DO 1 Too many parameters Call examples in assembler and C push 32 A6 paramNb number of parameters push 32 A6 asci i pointer on an ASCII buffer CALL_BIOS str_skip_parm_protocol 2 5 execute the function test 32 DO 3 jump mi R8 Error 3 too many parameters int32 status char asci i uint32 paramhNb status str skip parm protocol Cascii paramNb if status lt 0 return 1j K Team http www k team com info k team com May 25 1999 151 K system A All information in this document is preliminary and subject to change str cnut ubin dasciiCascii binaryValue Conversion of a single 32 bit value to an ASCII buffer decimal mode This system call converts a single 32 bit value to a decimal ASCII buffer Here is an example Binary value in 0x10A34 ASCII out 68148 Input stacking order binaryValue Binary value asci i Pointer on the ASCII buffer Output asci i Pointer at the end of the ASCII buffer Call examples in assembler and C push 32 A6 b inaryValue binary value push 32 A6 tasci i pointer on an ASCII buffer CALL_BIOS str cnut ubin dascii 2 execute the function char asci i uint32 binaryVa
13. except i onNb exception number push 32 R 16 procedure CALL_BIOS var _set_exception 2 execute the function test 32 DO jump mi R8 Error the exception does not exist void procedureCuoid int32 status uint32 exceptionNb status uar set exception procedure exceptionNb if status lt return 1j K Team http www k team com info k team com May 25 1999 120 K system A All information in this document is preliminary and subject to change var_cpu_speed CPUSpeedValue Change the speed of the CPU Avoid using this system call This system call changes the speed of the CPU It has to be used very carefully in fact there are other devices which are influenced when the speed is changed serial baudrate in particular An error is re turned if the speed does not exist Input stacking order CPUSpeedUalue Speed number 0 16 78 MHz 1 8 38 MHz DO OK DO 1 speed does not exist Call examples in assembler and C push 32 A6 CPUSpeedValue the speed value CRLL BIOS uar cpu speed 1 3 execute the function test 32 DO jump mi R8 Error the speed does not exist int32 status uint32 CPUSpeedUalue status var_cpu_speed CPUSpeedVal ue 5 if status lt return 1j K Team http www k team com info k team com May 25 1999 121 K system A All information in this document is preliminary and subject to change var_get_extensionCaddress
14. motor speed value push 32 A6 speed1 motor 1 speed value CALL_BIOS mot neu speed 2m 2 execute the function int32 speed speedl mot neu speed 2m speedl speed 5 K Team http www k team com info k team com May 25 1999 57 K system A All information in this document is preliminary and subject to change mot_conf ig position 1mCmotorNb kp ki kd Initialise the position PID coefficients for one motor This system call initialises the position PID coefficients for one motor As usual the values stacked are coded on 32 bits but only the LSW is used for the PID The following good PID coefficients lab test ed can be used for nearly all applications An error is returned if the motor does not exist Proportional coefficient kp 400 Integral coefficient ki 4 Derivative coefficient kd 400 Input stacking order kd Derivative coefficient ki Integral coefficient kp Proportional coefficient mo torNb Number of the motor 1 Output DO 0 OK DO 1 The motor does not exist Call examples in assembler and C push 32 A6 kd derivative push 32 A6F k i integral push 32 A6 kp proportional push 32 A6 mo torNb motor number CALL_BIOS mot_config position_im 4 5 execute the function test 32 DO jump mi R8 Error 3 the motor does not exist int32 status uint32 motorNb kp ki kd status mot_config _position_imCmotorNb kp ki kd if Cstautus lt
15. return 1 K Team http www k team com info k team com May 25 1999 58 K system A All information in this document is preliminary and subject to change mot_put_sensors_2m positioni posi tion New absolute position for the two motors This system call changes the value of one incremental sensor of the two motors The unit of the position 0 03 mm Input stacking order posi tion Position of the sensor positionl Position of the sensor 1 Output Call examples in assembler and C push 32 A6 posi tiond position push 32 A6 posi tion position 1 CALL_BIOS mot put sensors 2m 2 execute the function int32 position position1 mot_put_sensors_2m positionl posi tion K Team http www k team com info k team com May 25 1999 59 K system A All information in this document is preliminary and subject to change mot_new_posi tion_2mCpositioni posi tion New position for the two motors This system call changes the position of the two motors Maximum forward position position 231 1 units Maximum backward position position 2 units The unit of the position is 0 03 mm Input stacking order posi tion Position of the motor position1 Position of the motor 1 Output Call examples in assembler and C push 32 A6 posi tiond position push 32 A6 posi tionl position 1 CALL_BIOS mot neu position 2m 2 execute the function
16. A6 paramNb number of parameters push 32 A6 binary pointer on a binary buffer push 32 R6 ascii pointer on an ASCII buffer CALL_BIOS str cnut bin8 dascii 3 execute the function char ascii uints binary uint32 paramhNb str cnut bin8 dasciiCascii binary paramNb K Team http www k team com info k team com May 25 1999 149 K system A All information in this document is preliminary and subject to change str_get_size_asci i Casci I Get the size of an ASCII buffer This system call returns the size of an ASCII buffer The character O is not counted Input stacking order asci i Pointer on the ASCII buffer Output size Size of the buffer Call examples in assembler and C push 32 A6 asci i pointer on an ASCII buffer CALL BIOS str get size ascii 1 execute the function move 32 D A6 size the value uint32 size char asci i size str_get_size_asci iCascii K Team http www k team com info k team com May 25 1999 150 K system A All information in this document is preliminary and subject to change str_skip _parm_protocol ascii paramNb Skip parameters Cand their separators from an ASCII buffer This system call skips parameters from an ASCII buffer The buffer is formatted as the standard pro tocol Paral Para2 The parameter separator is also skipped An error is returned if there are too many parameters
17. Team http www k team com info k team com STR STR manager string and ascii conversion manager Family ID BIOS Table of content str reset n ee ww we we str cnut dascii bin32 binarg ascii paramNb str cnut dascii bin8 binarg ascii paramNb str cnut bin32 dasciiCascii binary paramNb str cnut bin8 dasciiCascii binary paramNb str_get_size_asciiCascii s s e eo str skip parm protocolCascii paramNb str cnut ubin dasciiCascii binaryValue str_skip_parmCascii paramNb str cnut ubin hasciiCascii binaryValue str cnut hascii bin32 binarg ascii paramNb str cnut hascii bin8 binarg ascii paramNb str cnut bin32 hasciiCascii binary paramNb str cnut bin8 hasciiCascii binary paramNb K Team http www k team com info k team com May 25 1999 143 K system A All information in this document is preliminary and subject to change Generalities This module operates particular string conversions which can be very useful when we have a connec tion with visualisation software tools Formatted ASCII to binary as well as binary to ASCII conver sions are realised Here are general ASCII and binary string formats ASCII Sgn Para 1 Sgn Para 2 Sgn Para 3 r n 0 Ex 123 4567 234236 0 5 r n 0 Binary OxPara 1 OxPara 2 OxPara 3 OxPara n Ex Ox1 0x3 0x4 0x23 K Team http www k team com info k team com May 25 1999 144
18. http www k team com info k team com May 25 1999 104 K system A All information in this document is preliminary and subject to change ser conf i g baudrate Set up the baudrate This system call allows to change the baudrate of the serial SCI channel eight possibilities are availa ble An error is returned if the baudrate does not exist Input stacking order baudrate 0 9600 B 1 600 B 2 1200 B 3 4800 B 4 9600 B 5 519200 B 6 538400 B 7 57600 B 8 115200 B 9 230400 B DO OK DO 1 The baudrate does not exist Call examples in assembler and C push 32 A6 baudrate baudrate CALL_BIOS ser _config 1 execute the function test 32 DO jump mi R8 Error the baudrate does not exist int32 status uint32 baudrate status ser config baudrate if status lt 0D return 1 K Team http www k team com info k team com May 25 1999 105 K system A All information in this document is preliminary and subject to change ser_send_buf fer buffer size Send one buffer by the serial SCI channel This system call sends one buffer of less that 500 bytes by the serial SCI channel It is under the control of the Tx interruption An error is returned if any Input stacking order size Size of the buffer to send buf fer Pointer on the buffer Output DO OK DO Channel busy DO Size of the buffer excessive DO Size of the buffer 0
19. including a couple of new system calls is present between the application and the BIOS Here is an example int32 status uint32 id static char textId Process to n r status install_task textId 800 procedure if status lt exit Error id Cuint32 status status kill taskCid if status lt exit Error K Team http www k team com info k team com May 25 1999 5 K system A All information in this document is preliminary and subject to change 3 Protection of the critical memory ressources It is sometimes necessary to be sure that a memory structure is protected against some external writing ex coming from an other task To do that critical resource accesses need to be encapsulated by lock and unlock semaphore During the encapsulation time only the active task is executed Here is an example Writing process tim_lock 5 This locks the time sharing for Ci 0 i lt KNBELEMENTS i vectori ij tim_unlock This unlocks the time sharing Reading process tim_lock This locks the time sharing for Ci 0 i lt KNBELEMENTS i workVector i vectorli l tim_unlock This unlocks the time sharing K Team http www k team com info k team com May 25 1999 6 K system A All information in this document is preliminary and subject to change 4 Protection of the critical I Os ressources As
20. status of the active channel Input stacking order Output D xxx0000000 1 Tx buffer not empty DO xxx800000 10 Rx buffer not empty DO 4 Harduare error Call examples in assembler and C CRLL COM com get status channel 0 5 execute the function test 32 DO 3 jump mi R8 Error hardware error int32 status status com get status channel K Team http www k team com info k team com May 25 1999 23 K system A All information in this document is preliminary and subject to change TIM Rev 1 00 K Team http www k team com info k team com TIM TIM manager multi tasking kernel Family ID BIOS Table of content timreset 2 eo ww ew ww sn tim_new_inst_task textId stack procedure tim_remove_inst taskC id tim_suspend_taskC time tim_generate_event tim_wai t_event taskMask tim_get_id tim_get_ticcount tim_run_kernel tim_swi tch fastC tim lock ws tim unlock e n SURE tim_def ine_associationCreference general tim_find_association reference tim_remove_associationCreference tim_wait syneCsyncMask tim_get_task_des_ptr K Team http www k team com info k team com May 25 1999 24 K system A All information in this document is preliminary and subject to change Generalities This module manages the multitasking capabilities of the system Thirty two use
21. the active channel This system call reserves the active channel for a transaction The active channel is a critical resource which can be shared with other tasks An error is returned if the channel is busy Input stacking order Output DO 0 Channel reserued and ready to operate DO 1 Channel busy Call examples in assembler and C CALL COM com_reserve channel execute the function test 32 DO 7 jump mi R8 Error wait int32 status status com reserue channel 0 if status lt 0D return 1 K Team http www k team com info k team com May 25 1999 19 K system A All information in this document is preliminary and subject to change com release channel C Release the actiue channel This system call releases the active channel The other tasks can now use this channel Input stacking order Output Call examples in assembler and C CALL_COM com_release channel 3 execute the function com release channel C K Team http www k team com info k team com May 25 1999 20 K system A All information in this document is preliminary and subject to change com send buf ferC buffer size Send one buffer via the active channel This system call sends one buffer of less that 500 bytes by the active channel An error is returned if any Input stacking order size Size of the buffer to send buf fer Pointer on the buffer Output DO
22. 25 1999 117 K system A All information in this document is preliminary and subject to change var_ enable_irg Enable the user interruption This system call enables the user interruption Input stacking order Output Call examples in assembler and C CALL_BIOS var_enab1le_irg execute the function var_enable_irq K Team http www k team com info k team com May 25 1999 118 K system A All information in this document is preliminary and subject to change var_disable_irg Disable the user interruption This system call disables the user interruption Input stacking order Output Call examples in assembler and C CALL_BIOS var_disable_irg execute the function var disable inrqCG K Team http www k team com info k team com May 25 1999 119 K system A All information in this document is preliminary and subject to change var_set_exception_vector procedure excepti onNb Attribute one procedure to an exception vector number This system call initialises an exception vector number with the address of one procedure The return code of the procedure has to be RTSF An error is returned if the exception does not exist Input stacking order exept i onNb Number of the exception procedure Pointer on the procedure Output DO OK DO The exception does not exist Call examples in assembler and C push 32 A6
23. Call examples in assembler and C push 32 A6 size size of the buffer to send push 32 A6 buf fer pointer on the buffer CALL_BIOS ser_send_buf fer 2 execute the function test 32 DO jump mi R8 Error channel error int32 status uint8 buf fer uint32 size status ser_send_buf fer buffer size if status lt return status K Team http www k team com info k team com May 25 1999 106 K system A All information in this document is preliminary and subject to change ser_rece i ve_byte Receive one byte by the serial SCI channel This system call looks for the reception buffer of the serial SCI channel if one byte is available This system call is under control of the Rx interruption Input stacking order Output DO 16 000000nn nn byte DO 1 Buffer empty Call examples in assembler and C CALL_BIOS ser receive byte 0 3 execute the function test 32 DO jump mi R8 Error channel error moue 8 D A6 aByte a character int32 status uints aByte status ser_receive_byte if status lt 0 return 1j aByte Cuint8 status K Team http www k team com info k team com May 25 1999 107 K system A All information in this document is preliminary and subject to change ser_tx_status Get the status of the serial SCI channel transmitter This system call looks for the status of the serial SCI channel transmitter Input stack
24. MA MMA manager Multi Microcontroller Adapter manager Family ID BIOS Table of content mma_reset mma reserue channel QC mma reserue channel 1 mma reserue channel 2C mma release channel 0C mma release channel 1 mma release channel 2C mma send buf fer QCbuf fer mma send buf fer_1 buf fer mma send buf fer_2 buf fer mma_receive_byte_ mma_receive_byte_10 mma receiue byte 2 mma_tx_status_ mma tx status 1C mma _tx_s tatus_2 mma rx status 0C mma rx status 1C mma rx status 2 Edoardo Franzi franzi Q k team com May 25 1999 79 K system A All information in this document is preliminary and subject to change Generalities This module manages the communications via the multi microcontroller parallel channel MMA Mul ti Micro controller Adapter All the operations are executed by interruptions The interface with the MMA is achieved by using circular buffers thus long waiting polling periods are avoided Edoardo Franzi franzi k team com May 25 1999 80 K system A All information in this document is preliminary and subject to change mma_reset C Init of the resources of the manager This system call inits the manager Input Output Call examples in assembler and C CALL_BIOS mma reset 0 execute the function mma_reset Edoardo Franzi franzi k team com May 25 1999 81 K syst
25. OK DO Channel busy DO Size of the buffer too big DO Size of the buffer 0 DO Hardware error Call examples in assembler and C push 32 A6 size size of the buffer to send push 32 A6 buf fer pointer on the buffer CALL_COM com_sens_buf fer 2 execute the function test 32 DO jump mi R8 Error channel error int32 status uints buf fer uint32 size status com_sens_buf fer buffer size if status lt return status K Team http www k team com info k team com May 25 1999 21 K system A All information in this document is preliminary and subject to change com_rece i ve_by te Receive one byte via the active channel This system call looks for the reception buffer of the active channel if one byte is available Input stacking order Output DO 16 000000nn nn byte DO 1 Buffer empty DO 4 Harduare error Call examples in assembler and C CRLL COM com _receive_byte 0 execute the function test 32 DO jump mi R8 Error channel error moue 8 D A6 aByte a character int32 status uints aByte status com_receive_byte if status lt return status aByte Cuint8 status K Team http www k team com info k team com May 25 1999 22 K system A All information in this document is preliminary and subject to change com get status channel Get the status of the actiue channel This system call looks for the
26. Read on the extension bus This system call allows to read the extension bus of the system The address is relative to the beginning of the memory space 0 63 Input stacking order address Relative address 63 Output binaryValue 0x000000bb Call examples in assembler and C push 32 A6 address CALL_BIOS uar get extension 1 5 execute the function moue 8 A6 b inaryValue the value def ine ioport 10 0x10 uint32 binaryValue address address uint32 ioport binaryValue var get extensionladdress K Team http www k team com info k team com May 25 1999 122 K system A All information in this document is preliminary and subject to change var_put_extensionCaddress binaryValue Write on the extension bus This system call allows to write values on the extension bus of the system The address is relative to the beginning of the memory space 0 63 Input stacking order binaryValue 0x000000bb address Relative address 63 Output Call examples in assembler and C push 32 A6 b inaryValue the value push 32 A6 address CALL_BIOS var_put_extension 2 execute the function define ioport 10 0x10 uint32 binaryValue address address int32 ioport var_put_extensionCaddress binaryValue 5 K Team http www k team com info k team com May 25 1999 123 K system A All information in this document is preliminary a
27. am com info k team com May 25 1999 10 K system A All information in this document is preliminary and subject to change bios_get_ident Get the pointer on an identifier string This system call returns the pointer on an identifier ASCII string terminated with 0 which indi cates the date and the revision number of the BIOS Input stacking order Output DO identifier Pointer on the identifier string Call examples in assembler and C CALL_BIOS bios_get_ident execute the function move 32 D A6 identi fier pointer on the identifier string char jdentifier identifier bios get ident K Team http www k team com info k team com May 25 1999 11 K system A All information in this document is preliminary and subject to change bios_get_rev Get the BIOS version and revision This system call returns an ASCII identifier containing the version and revision of the BIOS Input stacking order Output D0 31 241 D 23 16 DO 15 81 Der e1 Call examples in assembler and C CALL_BIOS bios_get_rev move 32 D A6 vers ion uint32 version version bios_get_rev 5 K Team http www k team com Version Point MSB revision LSB revision execute the function 3 version info k team com May 25 1999 12 K system A All information in this document is preliminary and subject to change
28. ation The protocol is always supervised by the master microcontroller star topology Figure 6 shows how a message is coded and the different phases of the protocol Message format Turret ID Transaction Length of the number usable message Message byte 1 Message byte 2 Message byte n OOo Z Message level Byte level Master Master Figure 6 Message format and protocol sequences K Team http www k team com info k team com May 25 1999 72 K system A All information in this document is preliminary and subject to change msg_reset Init of the resources of the manager This system call inits the manager Input stacking order Output Call examples in assembler and C CALL_BIOS msg reset 0 execute the function msg_reset K Team http www k team com info k team com May 25 1999 13 K system A All information in this document is preliminary and subject to change msg_reserve_channel channelNb Reserve the logical channel of the network This system call reserves the logical channel of the network for a transaction The network is a critical resource which can be shared with other tasks An error is returned if the channel is busy Input stacking order channe1Nb Number of the logical channel Output DO Channel reserved and ready to operate DO 1 The channel does not exist DO 2 The channel busy Call examples in assem
29. atus lt return 1 K Team http www k team com info k team com May 25 1999 156 K system A All information in this document is preliminary and subject to change stricnvt_bin32_hasciiCascii binary paramNb Conversion from a 32 bit binary buffer to an ASCII hexadecimal formatted one This system call converts a 32 bit binary buffer to an ASCII hexadecimal representation formatted one Here is an example Binary in OxA 0x1 0x4 0x324 0x345 0x43 Parameter number 3 ASCII out A 1 4 r n 0 Input stacking order paramNb Number of parameters binary Pointer on the binary buffer asci i Pointer on the ASCII buffer Output Call examples in assembler and C push 32 A6 paramNb number of parameters push 32 A6 binary pointer on a binary buffer push 32 A6 asci i pointer on an ASCII buffer CALL BIOS str cnut bin32 hascii 3 execute the function char ascii uint32 binary paramNb str conuert bin32 hasciiCascii binary paramNb K Team http www k team com info k team com May 25 1999 157 K system A All information in this document is preliminary and subject to change str cnut bin8 hasciiCascii binary paramNb Conversion from an 8 bit binary buffer to an ASCII hexadecimal formatted one This system call converts an 8 bit binary buffer to an ASCII hexadecimal representation formatted one Here is an example Binary in OxA 0x1 0x4 0
30. bler and C push 32 A6 channelNb channel number CALL_BIOS msg reserue channel 1 execute the function test 32 DO A jump mi R8 Error wait int32 status status msg reserue channel CchannelNb if Cstautus lt return 1 K Team http www k team com info k team com May 25 1999 74 K system A All information in this document is preliminary and subject to change msg release channel Cchanne1Nb Release the logical channel of the netuork This system call releases the logical channel of the network The other tasks can now use this channel Input stacking order channe1Nb Number of the logical channel Output D 0 Channel released DO 1 The channel does not exist Call examples in assembler and C K Team push 32 A6 channelNb channel number CALL_BIOS msg release channel 1 execute the function int32 status status msg release channel CchannelNb if Cstautus lt return 1 http www k team com info k team com May 25 1999 75 K system A All information in this document is preliminary and subject to change msg_send_message mesgS sizeS Send one message This system call sends one message on the network The status of this call is given back An error is returned if the message was not sent because of a time out error Input stacking order sizeS Size of messageS Pointer Output DO 0 Message DO 1 Message Call
31. ct to change mma rx status QC Get the status of the MMA channel receiver This system call looks for the status of the MMA 0 channel receiver Input stacking order Output D 0 Buffer empty DO 1 Buffer not empty Call examples in assembler and C CALL_BIOS mma_rx_status_ execute the function test 32 DO H jump mi R8 Error 3 buffer not empty int32 status status mma rx channel 0 if status lt return 1 Edoardo Franzi franzi Q k team com May 25 1999 97 K system A All information in this document is preliminary and subject to change mma rx status 1 Get the status of the MMA 1 channel receiver This system call looks for the status of the MMA 1 channel receiver Input stacking order Output DO 0 Buffer empty DO 1 Buffer not empty Call examples in assembler and C CALL_BIOS mma rx status 1 0 execute the function test 32 DO H jump mi R8 Error 3 buffer not empty int32 status status mma rx channel 16 if status lt return 1 Edoardo Franzi franzi k team com May 25 1999 98 K system A All information in this document is preliminary and subject to change mma rx status 2 Get the status of the MMA 2 channel receiver This system call looks for the status of the MMA 2 channel receiver Input stacking order Output D 0 Buffer empty DO 1 Buffer not empty Call examples i
32. ction tim_swi tch fastC5 K Team http www k team com info k team com May 25 1999 36 K system A All information in this document is preliminary and subject to change tim_lock Lock the time sharing This system call locks the time sharing Only the current task is executed The system call is useful to protect critical resources memory structures or I O accesses Input stacking order Output Call examples in assembler and C CALL_BIOS tim_lock execute the function tim_lock K Team http www k team com info k team com May 25 1999 37 K system A All information in this document is preliminary and subject to change tim_unlock Unlock the time sharing This system call unlocks the time sharing If more than one tim_lock system call was executed the same number of tim_unlock system calls has to be performed Input stacking order Output Call examples in assembler and C CALL_BIOS tim_unlock execute the function tim unlock C K Team http www k team com info k team com May 25 1999 38 K system A All information in this document is preliminary and subject to change tim_def ine_associationCreference general Define an association between a string and a general pointer This system call makes it possible to define an association between a 16 character string and a general 32 bit pointer This a
33. e values of one digital input Input stacking order inputNbr input number Output D state OK DO 1 The input does not exist Call examples in assembler and C push 32 A6 inputNbr CRLL BIOS uio get input state 1 execute the function test 32 DO jump mi R8 Error the input does not exist int32 status uint32 inputNbr status uio get input stateCinputNbr if status lt return 1 else return status K Team http www k team com info k team com May 25 1999 134 K system A All information in this document is preliminary and subject to change CTR Rev 1 00 K Team http www k team com info k team com CTR CTR manager Ccontrol signals manager Family ID BIOS Table of content ctr reset e o ctr get ana ualueCctrChannel ctr_reserve_channel ctr_release_channel ctr_get_eepromCaddress ctr_put_eepromCaddress binaryValue K Team http www k team com info k team com May 25 1999 135 K system A All information in this document is preliminary and subject to change Generalities This module manages the control signals for the Koala robot including the general power consump tion the motor power consumption and the management of specific devices related to this battery eep rom for instance K Team http www k team com info k team com May 25 1999 136 K system A All
34. ect to change ctr get eepromCaddress Read a 16 bit word on the battery EEPROM This system call allows to read the battery EEPROM The address is relative to the beginning of the memory space Input stacking order address Relative address Output binaryValue x bbbb Call examples in assembler and C push 32 A6 address CALL_BIOS ctr get eeprom 1 execute the function moue 8 A6 b inaryValue the value def ine ioport 10 0x10 uint32 binaryValue address address uint32 ioport binaryValue ctr get eepromCaddress K Team http www k team com info k team com May 25 1999 141 K system A All information in this document is preliminary and subject to change ctr_put_eepromCaddress binaryValue Write a 16 bit word on the battery EEPROM This system call allows to write values on the battery EEPROM The address is relative to the begin ning of the memory space Input stacking order binaryValue x Obbbb address Relative address Output Call examples in assembler and C push 32 A6 b inaryValue the value push 32 A6 address CALL_BIOS ctr put eeprom 2 execute the function uint32 binaryValue address ctr_put_eepromCaddress binaryValue K Team http www k team com info k team com May 25 1999 142 K system A All information in this document is preliminary and subject to change STR Rev 1 00 K
35. ed by one or more other tasks After this system call the cur rent task descriptor is placed in the suspended event list Only an event generated by another task can place the suspended task descriptor in the execution list Input stacking order taskMask Coding mask of the events which have to synchronise this task The mask is usually the logical OR between the ID numbers of the task descriptors concerned Call examples in assembler and C move 32 A6 id1 Da or 32 A6 i1d13 D0 IDs task descriptors 1 and 13 push 32 DO wait for the task 1 or 13 CALL_BIOS tim_wai t euent 1 execute the function uint32 idl id13 tim_wai t euentCid1 id13 5 K Team http www k team com info k team com May 25 1999 32 K system A All information in this document is preliminary and subject to change tim_get_id Return the task descriptor ID of the current task This system call returns the task descriptor ID number of the current task Input stacking order Output id ID of the current task descriptor Call examples in assembler and C CALL_BIOS tim_get_id execute the function move 32 De A6 id id of the current task descriptor uint32 id id tim_get_idQ K Team http www k team com info k team com May 25 1999 33 K system A All information in this document is preliminary and subject to change tim_get_ticcount Return the number of tic count from t
36. ed_value 15 execute the function test 32 DO jump mi R8 Error the sensor does not exist move 32 D A6 sensorValue sensor value int32 status uint32 sensorUalue sensorNb status sens get reflected value CsensorhNb if status lt 0D return 1 sensorValue Cuint32 status K Team http www k team com info k team com May 25 1999 67 K system A All information in this document is preliminary and subject to change sens_get_ amb i ent_valueCsensorNb Get the ambient value of one sensor This system call returns the ambient value of the sensor selected The number 0 to 15 are used to select one sensor An error is returned if the sensor does not exist Input stacking order sensorNb Number of the sensor I 0 151 Output D sensorUalue Ualue of the sensor DO 1 The sensor does not exist Call examples in assembler and C push 32 A6 sensorNb sensor number CALL_BIOS sens_get_ambient_value 1 execute the function test 32 DO jump mi R8 Error the sensor does not exist move 32 D A6 sensorValue sensor value int32 status uint32 sensorUalue sensorNb status sens get ambient valueCsensorhNb if status lt return 1 sensorValue Cuint32 status K Team http www k team com info k team com May 25 1999 68 K system A All information in this document is preliminary and subject to change sens_get_pointer Get the pointer o
37. eferences K Team http www k team com info k team com May 25 1999 2 K system A All information in this document is preliminary and subject to change K Team http www k team com info k team com Koala BIOS 1 00 Reference Manual Rev 1 00 Abstract The high level of complexity of the Koala robot coupled with its multi microcontroller architecture Fra91 and its multitasking capabilities requires a robust low level software named BIOS Basic I Os system This document describes how this software is organised to manage all the system resources and give all the necessary information to use them for building applications Preliminary The reader is supposed to have a good knowledge of the MC68xxx programming and of MC68331 mi crocontroller hardware features Mot89 Mot91 Mot92 The program examples are shown in C and in assembler CALM syntax JDN86 At the end of this document some examples will be shown to make the work with Koala easy 1 CALM is the abbreviation for Common Assembler Language for Microprocessors which is one product designed at LAMI EPFL K Team http www k team com info k team com May 25 1999 3 K system A All information in this document is preliminary and subject to change BIOS organisation Figure 1 shows the basic subdivision of the BIOS Different managers were designed to control only a specific part of the system e g module MOT controls all the moti
38. em A All information in this document is preliminary and subject to change mma reserue channel QC Reserve the MMA channel This system call reserves the MMA 0 channel for a transaction The MMA channel is a critical resource which can be shared with other tasks An error is returned if the channel is busy Input stacking order Output DO 0 Channel reserued and ready to operate DO 1 Channel busy Call examples in assembler and C CALL_BIOS mma reserue channel 0 0 execute the function test 32 DO H jump mi R8 Error wait int32 status status mma reserue channel 0 if status lt 0 return 1 Edoardo Franzi franzi Q k team com May 25 1999 82 K system A All information in this document is preliminary and subject to change mma_reserve_channel 1 Reserve the MMA 1 channel This system call reserves the MMA 1 channel for a transaction The MMA channel is a critical resource which can be shared with other tasks An error is returned if the channel is busy Input stacking order Output DO 0 Channel reserued and ready to operate DO 1 Channel busy Call examples in assembler and C CALL_BIOS mma reserue channel 1 0 execute the function test 32 DO H jump mi R8 Error wait int32 status status mma reserue channel 10625 if status lt 0 return 1 Edoardo Franzi franzi Q k team com May 25 1999 83 K system A Al
39. erts a single 32 bit value to an hexadecimal ASCII buffer Here is an example Binary value in 0x10A34 ASCII out 10A34 Input stacking order binaryValue Binary value asci i Pointer on the ASCII buffer Output asci i Pointer at the end of the ASCII buffer Call examples in assembler and C push 32 A6 b inaryValue binary value push 32 A6 tasci i pointer on an ASCII buffer CALL_BIOS str cnut ubin hascii 2 execute the function char asci i uint32 binaryValue ascii stricnuvt_vbin_hasciiCascii binaryValue K Team http www k team com info k team com May 25 1999 154 K system A All information in this document is preliminary and subject to change stricnvt_hascii_bin32Cbinary ascii paramNb Conversion from an ASCII hexadecimal formatted buffer to a 32 bit binary one This system call converts an ASCII hexadecimal representation formatted buffer to a 32 bit binary one An error is returned if the buffer is inconsistent Here is an example ASCII in 10 1 4 4 66 r n 0 Parameter number 3 Binary out 0x10 Ox1 0x4 Input stacking order paramNb Number of parameters asci i Pointer on the ASCII buffer binary Pointer on the binary buffer Output D 0 Conuersion OK DO 1 Format of the buffer inconsistent Call examples in assembler and C push 32 A6 paramNb number of parameters push 32 A6 asci i pointer on an ASCII buffer push 32 A6 b inar
40. es in assembler and C CALL_BIOS mma release channel 1 0 execute the function mma release channel 10 Edoardo Franzi franzi Q k team com May 25 1999 86 K system A All information in this document is preliminary and subject to change mma release channel1 2 Release the MMA 2 channel This system call releases the MMA 2 channel The other tasks can now use this channel Input stacking order Output Call examples in assembler and C CALL_BIOS mma release channel 2 0 execute the function mma release channel 20 Edoardo Franzi franzi Q k team com May 25 1999 87 K system A All information in this document is preliminary and subject to change mma_send_buf fer_ buf fer size Send one buffer by the MMA channel This system call sends one buffer of less that 1024 bytes by the MMA 0 channel An error is returned if any Input stacking order size Size of the buffer to send buf fer Pointer on the buffer Output DO OK DO Channel busy DO Size of the buffer excessive DO Size of the buffer 0 Call examples in assembler and C push 32 A6 size size of the buffer to send push 32 A6 buf fer pointer on the buffer CALL_BIOS mma_send_buf fer_ 2 execute the function test 32 DO jump mi R8 Error channel int32 status uint8 buf fer uint32 size status mma_send_buf fer_ buffer size if status lt return stat
41. es of the digital inputs This system call returns the state values of the digital inputs Bit 0 to 11 correspond to the state of inputs 0 to 11 Input stacking order Output DO inputsValue State of the digital inputs Call examples in assembler and C CALL_BIOS uio_get_inputs execute the function move 32 DO A6 inputsValue general input value uint32 inputsValue inputsUalue uio_get inputs K Team http www k team com info k team com May 25 1999 130 K system A All information in this document is preliminary and subject to change uio_set_msk_irq inputs C interrup tMask Set the interrupt mask on the general input port This system call sets the mask which enable or disable general input to become interrupt request lines Bits O to 11 are the mask bits for inputs 0 to 11 Interrupt are generated if the bit is set to 1 are masked if set to 0 Input stacking order interruptMask mask enabling disabling the interrupt Output Call examples in assembler and C push 32 A6 interrupthMask CALL_BIOS uio_set_msk _irq inputs 1 5 execute the function uint32 interrup tMask uio_set_msk_irg inputs interrup tMask 5 K Team http www k team com info k team com May 25 1999 131 K system A All information in this document is preliminary and subject to change uio_ack_irq inputs CackMask Acknowledge the interrupt on the general input port
42. examples in assembler and C push 32 A6 sizeS push 32 A6 messageS CALL_BIOS msg_send_message 2 test 32 DO jump mi R8 Error int32 status uint8 messageS uint32 sizes the message on the message sent correctly not sent because of a time out error size of the buffer 3 pointer on the message execute the function time out error status msg send message messageS sizeS if Cstautus lt return 1 K Team http www k team com info k team com May 25 1999 76 K system A All information in this document is preliminary and subject to change msg_receive_message mesgR sizeR Receive one message This system call waits for one message on the network The status of this system call is given back An error is returned if the message was not received because of a time out error Input stacking order sizeR Size of messageR Pointer Output DO 0 Message DO 1 Message Call examples in assembler and C push 32 A6 sizeR push 32 A6 messageR CALL_BIOS msg_receive_message 25 test 32 DO jump mi R8 Error int32 status uint8 messageR uint32 sizeR the message on the message received correctly not received because of a time out error size of the buffer pointer on the message execute the function time out error status msg_receive_message messageR sizeR if Cstautus lt return 1 K Team http www k team com i
43. for the memory protection I Os need to be protected To avoid to lock the time sharing for this pur pose a couple of system calls are used to reserve and to release an I Os channel For the user an easier implementation by a macro is available Here is an example Process 1 RESERVE_COM This reserves the standard I Os channel printfC K Sustem 8 E Franzi K Team A n 5 RELERSE COM This releases the standard I Os channel Process 2 RESERUE COM This reserues the standard I Os channel printfC Khepera minirobot n RELERSE COM This releases the standard I Os channel K Team http www k team com info k team com May 25 1999 7 K system A All information in this document is preliminary and subject to change BIOS Rev 1 00 K Team http www k team com info k team com BIOS BIOS manager Family ID BIOS Table of content bios_reset bios_get_ident bios get reu bios_get_system bios restart systemC K Team http www k team com info k team com May 25 1999 8 K system A All information in this document is preliminary and subject to change Generalities This module includes all the files necessary to manage a dedicated part of the system XYZ AST Moreover all the input system calls to the different modules are managed by one table located at the beginning of the BIOS code The system calls are performed by pus
44. g ascii paramNb if status lt return 1j K Team http www k team com info k team com May 25 1999 146 K system A All information in this document is preliminary and subject to change str cnut dascii bin8C binarg ascii paramNb Conversion from an ASCII decimal formatted buffer to an 8 bit binary one This system call converts an ASCII decimal representation formatted buffer to an 8 bit binary one An error is returned if the buffer is inconsistent Here is an example ASCII in 10 1 4 4 66 r n 0 Parameter number 3 Binary out 0x10 Ox1 0x4 Input stacking order paramNb Number of parameters asci i Pointer on the ASCII buffer binary Pointer on the binary buffer Output D 0 Conuersion OK DO 1 Format of the buffer inconsistent Call examples in assembler and C push 32 A6 paramNb number of parameters push 32 A6 asci i pointer on an ASCII buffer push 32 A6 binary pointer on a binary buffer CALL_BIOS str cnvt_dasci i_bin8 3 execute the function test 32 DO jump mi R8 Error buffer format error int32 status uint8 binary char ascii uint32 paramNb status str cnut dascii bin8 binaru ascii PparamNb if status lt 0 return 1 K Team http www k team com info k team com May 25 1999 147 K system A All information in this document is preliminary and subject to change stricnvt_bin32_dasciiCascii binary paramNb
45. he integral contribution for the output of the controller K is coded on 16 bits The resultant product Eq 4 is coded on 32 bits Uk is the integrate contribution for the output of the controller Kg is coded on 16 bits The resultant product Eq 5 is coded on 32 bits K Team http www k team com info k team com May 25 1999 46 K system A All information in this document is preliminary and subject to change The speed profile generator All the movements in the position control mode are under the control of the speed profile generator For each sample the speed generator computes the next desired speed According to the maximum ac celeration and speed a trapezoidal speed profile figure 4 is generated using the mechanical equations Dynamic changes of the trajectory Maximum speed pinitial Figure 4 Speed and position movements K Team http www k team com info k team com May 25 1999 47 K system A All information in this document is preliminary and subject to change mot reset Init the resources of the manager This system system call inits the manager The PID is initialised in the speed control mode Input stacking order Output Call examples in assembler and C CALL_BIOS mot reset 0 execute the function mot_reset K Team http www k team com info k team com May 25 1999 48 K system A All information in this document is prelim
46. he system call tim_start_kernel This system call returns the number of tic count from the system call t i m s tar t kernel The value is expressed in milliseconds Input stacking order Output ticCount value of the tic count Call examples in assembler and C CALL_BIOS tim get ticcount 0 execute the function move 32 D A6 t i cCount the value uint32 ticCount ticCount tim get ticcount K Team http www k team com info k team com May 25 1999 34 K system A All information in this document is preliminary and subject to change timrun kernel Start the execution of the scheduled tasks DO NOT USE FOR APPLICATIONS This system call starts the execution of the kernel Input stacking order Output Call examples in assembler and C CALL BIOS tim_run_kernel execute the function tim run kernel K Team http www k team com info k team com May 25 1999 35 K system A All information in this document is preliminary and subject to change tim_swi tch fast Stop the current task and switch to another one This system call stops immediately the execution of the current task and switches to another one If only one task descriptor is inside the execution list the switched task will be rescheduled immediately Input stacking order Output Call examples in assembler and C CALL_BIOS tim_switch_fast execute the fun
47. hing into the stack the different parameters followed by a TRAP 0 and a number of 16 bits which codes the call Obviously the stack has to be readjusted according to the number of parameters pushed Here is an example push 32 Valuel push 32 Value2 trap 0 16 Cal INumber add 32 4 2 SP first parameter second parameter BIOS call the number of the function stack adjust To improve the readability of the programs the BIOS system call sequence can be replaced by a macro MRCRO CRLL BIOS trap Q 16 1 add 32 4 2 SP ENDMRCRO The previous example becomes push 32 Valuel push 32 Value2 CALL_BIOS CalINumber 2 K Team http www k team com call the BIOS the number of the function stack adjust first parameter second parameter BIOS call info Q k team com May 25 1999 9 K system A All information in this document is preliminary and subject to change bios_reset Init the resources of the module DO NOT USE FOR APPLICATIONS This system call inits all the common resources used by the different BIOS modules bios_reset has to be called before using any other system call This system call is performed during the start up Input stacking order Output Call examples in assembler and C CALL_BIOS bios_reset execute the function bios reset K Team http www k te
48. inary and subject to change mot_conf i g speed 1m motorNb kp ki kd Initialise the speed PID coefficients for one motor This system call initialises the speed PID coefficients for one motor As usual the values stacked are coded on 32 bits but only the LSW is used for the PID The following good PID coefficients lab test ed can be used for nearly all applications An error is returned if the motor does not exist Proportional coefficient kp 1000 Integral coefficient ki 800 Derivative coefficient kd 100 Input stacking order kd Derivative coefficient ki Integral coefficient kp Proportional coefficient mo torNb Number of the motor 0 11 Output DO 0 OK DO 1 The motor does not exist Call examples in assembler and C push 32 A6 kd derivative push 32 A6 k i integral push 32 A6 kp proportional push 32 A6 mo torNb motor number CALL_BIOS mot config speed 1m 4 execute the function test 32 DO H jump mi R8 Error 3 the motor does not exist int32 status uint32 motorNb kp ki kd status mot config speed 1m motorNb kp ki kd if Cstautus lt return 1 K Team http www k team com info k team com May 25 1999 49 K system A All information in this document is preliminary and subject to change mot_new_speed_im CmotorNb speed New speed for one motor This system call changes the speed of one motor An error is returned if the mot
49. information in this document is preliminary and subject to change ctr reset Init of the resources of the manager This system call inits the manager Input stacking order Output Call examples in assembler and C CALL BIOS ctr reset 0 execute the function ctr_reset K Team http www k team com info k team com May 25 1999 137 K system A All information in this document is preliminary and subject to change ctr_get _ana_valueCctrChannel Get the value of a CTR analog channel This system call returns the value of the analog channel selected An error is returned if the input does not exist Six channels are used 0 1 2 3 4 5 Battery voltage measure unit 20 mV General consumption current measure unit 8 mA Ambient temperature measure unit 0 1 C Left motor current measure unit 4 mA Right motor current measure unit 4 mA Battery temerature measure unit 0 1 C Input stacking order ctrChannel Number of the analog CTR channel Output DO analogValue Analog value DO 1 The input does not exist Call examples in assembler and C K Team push 32 A6 ctrChannel number of the input CALL_BIOS sens get ana value 1 execute the function test 32 DO jump mi R8 Error the input does not exist move 32 D A6 analogValue 3 analog value int32 status uint32 analogValue ctrChannel status sens get ana valueCctrChannel
50. ing order Output D 0 Buffer empty DO 1 Buffer not empty Call examples in assembler and C CALL_BIOS ser_tx_status 3 execute the function test 32 DO 3 jump mi R8 Error 3 buffer not empty int32 status status ser tx channel 5 if status lt return 1 K Team http www k team com info k team com May 25 1999 108 K system A All information in this document is preliminary and subject to change ser_rx_status Get the status of the serial SCI channel receiver This system call looks for the status of the serial SCI channel receiver Input stacking order Output D 0 Buffer empty DO 1 Buffer not empty Call examples in assembler and C CALL_BIOS ser_rx_status execute the function test 32 DO jump mi R8 Error 3 buffer not empty int32 status status ser rx channel if status lt 0D return 1 K Team http www k team com info k team com May 25 1999 109 K system A All information in this document is preliminary and subject to change VAR Rev 2 00 K Team http www k team com info k team com VAR VAR manager misc and interruption manager Family ID BIOS Table of content uar reset ugr get jumper uar on ledCledNb uar off ledCledNb uar change ledCledNb2 var_set_irg vector procedure var enable irq var_disable_irq var_set_exception _
51. l information in this document is preliminary and subject to change mma reserue channel 2 Reserve the MMA 2 channel This system call reserves the MMA 2 channel for a transaction The MMA channel is a critical resource which can be shared with other tasks An error is returned if the channel is busy Input stacking order Output DO 0 Channel reserued and ready to operate DO 1 Channel busy Call examples in assembler and C CALL_BIOS mma reserue channel 2 0 execute the function test 32 DO H jump mi R8 Error wait int32 status status mma reserue channel 20 if status lt 0 return 1 Edoardo Franzi franzi Q k team com May 25 1999 84 K system A All information in this document is preliminary and subject to change mma release channel 0C Release the MMA channel This system call releases the MMA 0 channel The other tasks can now use this channel Input stacking order Output Call examples in assembler and C CALL_BIOS mma release channel 0 0 execute the function mma release channel 0 Edoardo Franzi franzi Q k team com May 25 1999 85 K system A All information in this document is preliminary and subject to change mma release channel 1 Release the MMA 1 channel This system call releases the MMA 1 channel The other tasks can now use this channel Input stacking order Output Call exampl
52. l the resources necessary for the movement management A classical PID con troller coupled with a trapezoidal speed generator is available and allows a good speed and position control Motor 0 Motor 1 Figure 3 Motor number and direction position K Team http www k team com info k team com May 25 1999 45 K system A All information in this document is preliminary and subject to change The PID implementation Speed and position controllers are based on a numerical PID implementation s k u k u k ug k Eq 1 e k Reference Mesure k Eq 2 u k K e K Eq 3 uk uk 1 K e k Eq 4 uy k Kqle k e k 1 Eq 5 e s k is the output of controller Its value is coded on 32 bits but only 16 bits are used The PWM hardware implemen tation allows to use only 8 bits of the total dynamic Here are the corresponding PWM k and the direction command d k values ati for s eQDP n P ae s K 15 not for s k 22 78 d k sgn s k Eq 7 e k is the input error of the controller Its value is coded on 32 bits but only 16 bits are used for the computation If the absolute value of the error is greater than 2 the cumulation sum u of the error of the integral part stops U k is the proportional contribution for the output of the controller K is coded on 16 bits The resultant product Eq 3 is coded on 32 bits U k is t
53. ll information in this document is preliminary and subject to change mot_get_speed motorNb Get the speed of one motor This system call returns the speed difference of two absolute positions in one sample time of one mo tor The unit of the speed is 0 03 mm 10 ms Input stacking order mo torNb Number of the motor 1 Output D speed Instantaneous speed Call examples in assembler and C push 32 A6 mo torNb motor number CALL_BIOS mot get speed 1 execute the function move 32 D A6 speed speed value int32 speed uint32 mo torNb speed mot get speedCmotorNb K Team http www k team com info k team com May 25 1999 52 K system A All information in this document is preliminary and subject to change mot_put_sensors imCmotorNb position New absolute position for one motor This system call sets the value of the incremental sensor of one motor An error is returned if the motor does not exist The unit of the position 0 03 mm Input stacking order position Position value mo torNb Number of the motor 0 11 Output DO 0 OK DO 1 The motor does not exist Call examples in assembler and C push 32 A6 posi tion position value push 32 A6 mo torNb motor number CALL_BIOS mot put sensors 1m 2 execute the function test 32 DO jump mi R8 Error the motor does not exist int32 status position uint32 motorNb status mot_pu
54. llows a task to export high level references For example task 1 manages every thing about the sensors it can publish a pointer on a sensor table with a high level reference All the other tasks that need to work with sensors can obtain the sensor pointer via the global high level refer ence The general table can contain 32 associations An error is returned if the association table is full before the system call Input stacking order general General pointer reference Pointer on a 16 char Cmax string terminated with null Q Output D 0 Rssociation created DO 1 Rssociation table full Call examples in assembler and C push 32 86 general general pointer push 32 R16 reference 3 pointer on the reference CRLL BIOS tim_define_association 2 5 execute the function test 32 DO jump mi R8 Error too many associations int32 status static char reference Sensors uint32 general 5 status tim define association reference general if status lt return 1j K Team http www k team com info k team com May 25 1999 39 K system A All information in this document is preliminary and subject to change tim_f ind_associationCreference Look for an association This system call allows to get a general pointer referenced with a 16 character string The string has to match the information in the association table An error is returned if there is no association
55. lue ascii stricnvt_vbin_dasciiCascii binaryValue K Team http www k team com info k team com May 25 1999 152 K system A All information in this document is preliminary and subject to change str skip parmlascii paramNb Skip parameters and their separators SP from an ASCII buffer This system call skips parameters from an ASCII buffer The buffer is formatted as the standard pro tocol Paral Para2 The parameter separator is also skipped An error is returned if there are too many parameters Here is an example ASCII in 10 23455 4 456 23 r n 0 Parameter number 4 ASCII out 23 r n 0 Input stacking order paramNb Number of parameters asci i Pointer on the ASCII buffer Output DO 0 Skipping OK DO 1 Too many parameters Call examples in assembler and C push 32 A6 paramNb number of parameters push 32 R6 ascii pointer on an ASCII buffer CALL_BIOS str skip parm 2 execute the function test 32 DO jump mi R8 Error 3 too many parameters int32 status char asci i uint32 paramNb status str_skip_parmCascii paramNb if status lt return 1 K Team http www k team com info k team com May 25 1999 153 K system A All information in this document is preliminary and subject to change str cnut ubin hasciiCascii binaryValue Conversion of a single 32 bit value to an ASCII buffer Chexadecimal mode This system call conv
56. n assembler and C CALL_BIOS mma_rx_status_2 execute the function test 32 DO H jump mi R8 Error 3 buffer not empty int32 status status mma rx channel 20 if status lt return 1 Edoardo Franzi franzi Q k team com May 25 1999 99 K system A All information in this document is preliminary and subject to change SER Rev 1 00 K Team http www k team com info k team com SER SER manager serial RS232 manager Family ID BIOS Table of content ser_reset ser_reserve_channel ser_release channel ser_config baudrate ser_send_buffer buffer size ser_receive_byte ser_tx_status ser_rx_status K Team http www k team com info k team com May 25 1999 100 K system A All information in this document is preliminary and subject to change Generalities This module manages the communications via the asynchronous serial channel SCI Serial Communi cation Interface All the operations are executed by interruptions The interface with the SCI is achieved by using circular buffers thus long waiting polling periods are avoided The format used is fixed at 8 bits 2 stop bits no parity Only the baudrate can be changed K Team http www k team com info k team com May 25 1999 101 K system A All information in this document is preliminary and subject to change ser reset Init of the reso
57. n the IRSENSOR structure This system call returns the pointer on the IRSENSOR structure pointer 0 to 15 are used to point the value of the processed sensor K x Ambient Pulsed Pointer 16 to 31 are used to point the value of the ambient light Here is the sensor structure def ine SENSORNB 16 typedef struct uint16 oProximi tySensor SENSORNB 1 uint16 oAmb i entL i ghtSensor SENSORNB 1 IRSENSOR Input stacking order Output DO sensor Pointer on the structure sensor Call examples in assembler and C CALL_BIOS sens get pointer O execute the function push 32 DO A pop 32 A1 3 pointer on sensor structure IRSENSOR sensor sensor sens_get_pointer K Team http www k team com info k team com May 25 1999 69 K system A All information in this document is preliminary and subject to change sens get ana valueCinputNb Get the value of one analog input This system call returns the value of the analog input selected An error is returned if the input does not exist Ten channels are used 0 Reserved left reflected light value Reserved left ambient light value Reserved right reflected light value Reserved right ambient light value User User User User User 1 2 3 4 5 6 T 8 9 User Input stacking order i npu tNb Number of the analog input 9 Output DO analogUalue Analog value DO 1 The input does not exist Call e
58. nd subject to change UIO Rev 1 00 K Team http www k team com info k team com UIO UIO manager general INPUT OUTPUT manager Family ID BIOS Table of content uio _reset uio on_outCoutNbr uio_off_outCoutNbr gt uio change outCoutNbr uio_get_inputs uio_set_msk_irq inputs interrup tMask uio_ack_irq inputsCackMask uio_get_status_irq inputs uio_get_input_stateCinputNbr K Team http www k team com info k team com May 25 1999 124 K system A All information in this document is preliminary and subject to change Generalities This module manages the digital I O port available on Koala The analog channels are managed by the SENS manager channel 0 on the I O port correspond to channel 4 of the A D converter Analog inputs Vref Reference voltage 4 096V ANAS Analog channel 5 000000000000 00000000 ANAO Analog channel 0 GNA Analog ground DINII Digital input 11 DINO Digital input 0 Digital Inputs Digital CMOS outputs VCC 5V 2 outputs DCO3 CMOS output channel 3 Y 1 i DCO0 CMOS output channel 0 GND Digital ground 2 outputs BATT 12V battery voltage 2 outputs DPO7 Digital power output channel 7 DPOO Digital power output channel 0 GND Power ground 2 outputs o o o o o o o Oo o o o o oli o i Q P ro o o o io Digital open collector outp
59. nfo k team com May 25 1999 TI K system A All information in this document is preliminary and subject to change msg snd rec message msgS sizeS msgH sizeR rep Send and receiue one message This system call sends one message on the network and waits for an answer An error is returned if the message was not received because of a time out error Input stacking order rep Number of tries if error sizeR Size of the message to be received msgR Pointer on the message to be received sizeS Size of the message to be sent msgS Pointer on the message to be sent Output DO Message sent and received correctly DO Message not sent nor received because of a time out error too many reps Call examples in assembler and C push 32 2 try 2 times push 32 A6 sizeR size of the buffer R push 32 A6 msgR pointer on the message push 32 A6 sizeS size of the buffer S push 32 A6 msgS pointer on the message CALL BIOS msg snd rec message 5 execute the function test 32 DO jump mi R8 Error time out error int32 status uints msgS msgh uint32 sizeS sizeR rep status msg snd rec message msgS sizeS msgh sizeR if Cstautus lt return 1 K Team http www k team com info k team com May 25 1999 78 K system A All information in this document is preliminary and subject to change MMA Rev 1 00 Franzi Edo K Team S A franzi k team com M
60. o four phases Phase 0 read the ambient light value Phase 1 with a first sample hold stores the ambient light Phase 2 turn on the LED of the selected sensor Phase 3 read the ambient light LED light value Sensors left LO to L7 Sensors right RO to R7 Figure 5 Position and number of the sensors Left sensors take the numbers 0 to 7 right sensors from 8 to 15 K Team http www k team com info k team com May 25 1999 65 K system A All information in this document is preliminary and subject to change sens_reset Init of the resources of the manager This system call inits the manager Input stacking order Output Call examples in assembler and C CALL_BIOS sens reset 0 execute the function sens reset K Team http www k team com info k team com May 25 1999 66 K system A All information in this document is preliminary and subject to change sens_get_ref1ected_valueCsensorNb Get the reflected value of one sensor This system call returns the reflected value of the sensor selected The number 0 to 15 are used to select one sensor An error is returned if the sensor does not exist Input stacking order sensorNb Number of the sensor I 0 151 Output D sensorUalue Ualue of the sensor DO 1 The sensor does not exist Call examples in assembler and C push 32 A6 sensorNb sensor number CALL_BIOS sens_get_reflect
61. on resources module MSG controls the network communications TIM controls the multitasking etc APPLICATION Com manager TIM MOT VAR UIO CTR SENS MSG MMA Micro kernel Motion Misc and int Universal I O Control signals IR sensor String Serial Multi uC net Multi uC bus multi tasking manager manager manager manager manager manager manager manager manager manager HARDWARE Figure 1 General topology of the BIOS The code is completely relocatable and is designed to allow an easy interface with a high level language such as C Basic managers As already mentioned each physical part of the system is under the control of a specific manager The complete details of these modules will be presented later Here is the list BIOS global core of the BIOS MOT Motor manager SENS infra red sensor manager COM Host communication manager Uses resources of SER MSG or MMA SER serial link manager MSG multi microcontroller network communication manager MMA multi microcontroller parallel bus communication manager VAR misc device manager jumpers LEDs etc UIO general purpose I O manager CTR control electronics manager power supply power consumption etc TIM multitasking manager STR string manager K Team http www k team com info k team com May 25 1999 4 K system A All information in this document is preliminary and subject to change General constraints It is vital to ob
62. or does not exist Maximum forward speed speed 127 units Maximum backward speed speed 128 units The unit of the speed is 0 03 mm 10 ms Input stacking order speed Speed value mo torNb Number of the motor 1 Output DO 0 OK DO 1 The motor does not exist Call examples in assembler and C push 32 A6 speed speed value push 32 A6 mo torNb motor number CRLL BIOS mot neu speed 1m 2 execute the function test 32 DO jump mi R8 Error the motor does not exist int32 status speed uint32 mo torNb status mot neu speed 1m motorNb speed if Cstautus lt return 1 K Team http www k team com info k team com May 25 1999 50 K system A All information in this document is preliminary and subject to change mot_get_posi tion CmotorNb Get the absolute position of one motor This system call returns the absolute position coming from the incremental sensor of one motor The unit of the position is 0 03 mm Input stacking order mo torNb Number of the motor 1 Output D position Absolute position value Call examples in assembler and C push 32 A6 mo torNb motor number CALL_BIOS mot get position 1 execute the function moue 32 DO A6 posi tion position value int32 position uint32 mo torNb position mot get position motorNb K Team http www k team com info k team com May 25 1999 51 K system A A
63. osition if Cstautus lt return 1 K Team http www k team com info k team com May 25 1999 55 K system A All information in this document is preliminary and subject to change mot_new_pwm 1imCmotorNb pum New pwm for one motor This system call changes the pwm of one motor An error is returned if the motor does not exist Maximum forward pwm pwm 27 1 units Maximum backward pwm pwm 2 units Input stacking order pum Pum value mo torNb Number of the motor 1 Output DO 0 OK DO 1 The motor does not exist Call examples in assembler and C push 32 A6 pwm pum value push 32 A6 mo torNb motor number CRLL BIOS mot neu pum 1m 2 execute the function test 32 DO jump mi R8 Error the motor does not exist int32 status pum uint32 motorNb status mot neu pum 1mX motorNb pwm if Cstautus lt return 1 K Team http www k team com info k team com May 25 1999 56 K system A All information in this document is preliminary and subject to change mot_new_speed_2m speed1 speed New speed for the two motors This system call changes the speed of the motors Maximum forward speed speed 127 units Maximum backward speed speed 128 units The unit of the speed is 0 03 mm 10 ms Input stacking order speed Speed value speedi Speed value Output Call examples in assembler and C push 32 A6 speed
64. ot exist uint32 motorNb maxAcceleration maxSpeed status mot_config _profil_im motorNb maxSpeed maxficceleration if Cstautus lt return 1 K Team http www k team com info k team com May 25 1999 61 K system A All information in this document is preliminary and subject to change mot get status motorNb Get the status of the motion for one motor This system call gives the status of the motion controller speed and position for one motor Input stacking order mo torNb Number of the motor 0 11 Output DO status Status of the motion 2 0 2 15 error of the controller 2 16 2 17 mode speed 1 position 2 PWM 2 18 on target if mode position Call examples in assembler and C push 32 A6 mo torNb motor number CALL_BIOS mot get status 1 execute the function move 32 D A6 status status of the motion int32 status uint32 mo torNb status mot_get_status motorNb if Cstautus lt return 1 K Team http www k team com info k team com May 25 1999 62 K system A All information in this document is preliminary and subject to change mot neu pum 2mCpum 1 pum Neu pum for the tuo motors This system call changes the pwm of the two motors Maximum forward pwm pwm 27 1 units Maximum backward pwm pwm 2 units Input stacking order pwm Pwm of the motor pum 1 Pwm of the motor 1 Ou
65. push 32 A6 size size of the buffer to send push 32 A6 buf fer pointer on the buffer CALL_BIOS mma_send_buf fer_2 2 execute the function test 32 DO jump mi R8 Error channel int32 status uint8 buf fer uint32 size status mma_send_buf fer_2 buffer size if status lt return status Edoardo Franzi franzi k team com May 25 1999 90 K system A All information in this document is preliminary and subject to change mma_rece i ve_by te_ Receive one byte by the MMA channel This system call looks for the reception buffer of the MMA 0 channel if one byte is available Input stacking order Output DO 16 000000nn nn byte DO 1 Buffer empty Call examples in assembler and C CALL_BIOS mma_receive_byte_ execute the function test 32 DO 3 jump mi R8 Error 3 channel error moue 8 D A6 aByte a character int32 status uints aByte status mma receiue byte 0C if status lt return 1j aByte Cuint8 status Edoardo Franzi franzi k team com May 25 1999 91 K system A All information in this document is preliminary and subject to change mma receiue byte 1 Receive one byte by the MMA 1 channel This system call looks for the reception buffer of the MMA 1 channel if one byte is available Input stacking order Output DO 16 000000nn nn byte DO 1 Buffer empty Call examples in assembler and C
66. r 3 buffer not empty int32 status status mma tx channel 0 if status lt return 1j Edoardo Franzi franzi Q k team com May 25 1999 94 K system A All information in this document is preliminary and subject to change mma tx status 1 Get the status of the MMA 1 channel transmitter This system call looks for the status of the MMA 1 channel transmitter Input stacking order Output DO 0 Buffer empty DO 1 Buffer not empty Call examples in assembler and C CALL BIOS mma_tx_status_1 9 execute the function test 32 DO 3 jump mi R8 Error 3 buffer not empty int32 status status mma tx channel 1 if status lt 0D return 1j Edoardo Franzi franzi Q k team com May 25 1999 95 K system A All information in this document is preliminary and subject to change mma tx status 2 Get the status of the MMA 2 channel transmitter This system call looks for the status of the MMA 2 channel transmitter Input stacking order Output D 0 Buffer empty DO 1 Buffer not empty Call examples in assembler and C CALL BIOS mma tx status 2 0 execute the function test 32 DO 3 jump mi R8 Error 3 buffer not empty int32 status status mma tx channel 2 if status lt 0D return 1 Edoardo Franzi franzi Q k team com May 25 1999 96 K system A All information in this document is preliminary and subje
67. r main task descriptor pointer Call examples in assembler and C CALL_BIOS tim_get_task_des_ptr execute the function move 32 DO A6 taskDescr iptor the value PROCDESC taskDescriptor taskDescriptor tim_get_task_des_ptr 5 K Team http www k team com info k team com May 25 1999 43 K system A All information in this document is preliminary and subject to change MOT Rev 1 01 K Team http www k team com info k team com MOT MOT manager motion control Family ID BIOS Table of content mot_reset 7 7 m mot conf i g speed 1m mo torNb kp ki kd mot neu speed 1mCmotorNb speed n mot get position Cmo torNb I s mot_get_speed motorNb mot put sensors 1im imotorNb posi tion mot_stop s e w w e a 3 mot_new_position imCmotorNb posi tion mot neu pum imCmotorNb pum mot neu speed 2m speedl speed mot config_position imCmotorNb kp ki kd mot put sensors 2m positioni1 position mot_new_position_2mCpositionl position mot config profil 1mXImotorNb maxSpeed maxAcceleration mot_get_status motorNb s e e e o es oo mot neu pum 2mCpum1 pwm ss s s s s s e e we oo K Team http www k team com info k team com May 25 1999 44 K system A All information in this document is preliminary and subject to change Generalities This module controls al
68. r tasks can be run si multaneously The first task descriptor on the execution list IDLE task is always present and is ini tialised during the start up the user cannot operate with this task The basic functions necessary to operate with a multitasking kernel are implemented task synchronisations suspend tasks global serv ices etc Time sharing allows to switch the tasks after 5 ms The management of the context change is very fast it takes only 1 5 of the CPU time Figure 2 shows the main states of the task descriptors here is the way they work The empty list has to be considered as a tank of usable task descriptors As many as thirty two task descriptors can be used from this list The execution list contains all the task descriptors that can run at a given time This is the normal state for a task The wait list contains all the task descriptors that have been suspended for a programmed time This list is under the control of the real time clock PIT 1 ms of resolution When a timeout occurs for a task its descriptors will be placed again in the execution list The event list contains all the task descriptors which are waiting for a software external event The events have to be generated by other task When an event occurs its descriptor will be placed again in the execution list The sync list contains all the task descriptors that are waiting for a hardware external synchronisation The synchroni sations are generated by hardwa
69. re low level functions When a synchronisation occurs its descriptor will be placed again in the execution list 1 A task descriptor is a structured memory representation of a task or a process on which the micro kernel oper ates K Team http www k team com info k team com May 25 1999 25 K system A All information in this document is preliminary and subject to change Empty list Exec list Wait list Event list Sync list ID 1 2 IDLE Proc ID 1 0 ID 1 lt lt 3 ID 1 5 ID 1 6 ID 1 7 ID 1 8 A tim new inst task E Event Place a task descriptor into the Execution list Place a task descriptor into the Execution list B tim suspend task F tim wait sync Suspend a task for a time the task descriptor Suspend a task for an external event the task descriptor is moved into the Wait list is moved into the Sync list C Timeout G External event Place a task descriptor into the Execution list Place a task descriptor into the Execution list D tim wait event H tim remove task Suspend a task for an event the task descriptor Place a task descriptor into the Empty list is moved into the Event list Figure 2 Possible states of a task descriptor K Team http www k team com info k team com May 25 1999 26 K sy
70. receive_byte com get status channel C s K Team http www k team com info k team com May 25 1999 15 K system A All information in this document is preliminary and subject to change Generalities This module manages all the I Os channels of the system The user must only define during the start up which physical channel is active The default channel is under the control of the SER manager Here is an example RESERVE_COM if the channel is busy the task is switched printf KOS EFr 99 n send by the active channel RELEASE_COM release the channel for other tasks In this example the string is sent on the active channel The COM manager redirects the communica tions according to some conditions during the start up Table 1 shows some conditions for the redirec tion at boot depending from the extension configuration Other redirections MMA can be also used SER Radio turret Irda turret Other I Os turret Redirection to Active Not active Not active Not active Channel SER Active Active x x Channel Radio Active x Active x Channel Irda Active Active Active x Channel Radio Active Active Active Active Channel Radio Table 1 Redirection of the I Os channels K Team http www k team com info k team com May 25 1999 16 K system A All information in this document is preliminary and subject to change The sys
71. rror K Team http www k team com info k team com May 25 1999 29 K system A All information in this document is preliminary and subject to change tim_suspend_task time Suspend a task for a time This system call suspends the current task for a time The time can be chosen inside an interval of 1 ms to about 50 days 32 bits with 1 ms of resolution Input stacking order time Length of time Output Call examples in assembler and C push 32 A6 time length of time CALL_BIOS tim suspend task 1 execute the function uint32 time tim_suspend_task time K Team http www k team com info k team com May 25 1999 30 K system A All information in this document is preliminary and subject to change tim generate event Generate an event This system call generates an event used to synchronise other tasks If a task was expecting a particular event suspended inside the event list it will be placed again in the execution list when the event oc curs Input stacking order Output Call examples in assembler and C CALL BIOS tim generate event execute the function tim generate event K Team http www k team com info k team com May 25 1999 31 K system A All information in this document is preliminary and subject to change tim_wai t_event taskMask Wait for an event This system call waits for an event generat
72. serve the few rules below in order to realise robust applications None of the Koala hard ware resources initialised and used by the BIOS should be modified VBR register has to be initialised before using the BIOS This is done during the start up process The parameters are stacked before the function calls their size always takes on 32 bits even if only 8 or 16 bits are sig nificant All the function calls can modify the following microcontroller registers DO D1 AO Al F The BIOS never modifies the other registers If one call has to return one result the register DO is used BIOS uses TRAP 0 to TRAP 7 Rules for building applications All the programs that compose the Koala system as well as the user applications are under the control of micro kernel TIM manager This software architecture allows to run simultaneously as many as 32 tasks The user who would like to write applications needs to be at ease with multi tasking program ming methodology 1 Using the BIOS managers Before using the functions available inside the managers the user has to initialise them The BIOS and TIM managers do not need to be initialised Here is an example to initialize the SER manager ser_reset 2 Launching and killing processes The BIOS does not include any memory management For this reason and only for C applications the launching and the killing system calls are not directly managed by the TIM manager An additional C layer
73. sh 32 R 16 procedure 3 pointer on the task code push 32 R 16 s tack 3 pointer on the stack push 32 R16 textId 3 pointer on an ASCII text CRLL BIOS tim_new_inst_task 3 execute the function test 32 DO jump mi R8 Error 3 too many task descriptors move 32 De A6 id id of the task descriptor void procedure void int32 status uint32 id static char textId My task n r status install_task textId 800 procedure if status lt exi tC0 5 Error id Cuint32 status K Team http www k team com info k team com May 25 1999 28 K system A All information in this document is preliminary and subject to change tim_remove_inst task C id Remove a task descriptor NOT USABLE FOR C APPLICATIONS Instead use kill_taskCid This system call removes one task descriptor An error is returned if the task descriptor does not exist For C applications the user should use k i 11 task id Input stacking order id ID of the task descriptor Output DO 2 0 2 31 ID of the task descriptor DO 1 The task descriptor does not exist Call examples in assembler and C push 32 A6 id ID of the task descriptor CRLL BIOS tim_remove_inst_task 1 3 execute the function test 32 DO jump mi R8 Error the task descriptor does not exist move 32 D A6 id 3 id of the removed task descriptor int32 status uint32 id status kill_taskCid if status lt 0 exit E
74. status lt 0 return 1 K Team http www k team com info k team com May 25 1999 115 K system A All information in this document is preliminary and subject to change var change led 1edNb Change the state of one LED This system call toggles the state of one selected LED An error is returned if the LED does not exist Input stacking order 1edNb Number of the LED Output DO 0 OK DO 1 The LED does not exist Call examples in assembler and C push 32 A6 1edNb CRLL BIOS var change_led 1 3 execute the function test 32 DO jump mi R8 Error the LED does not exist int32 status uint32 ledNb status uar change edCledNb if status lt 0D return 1j K Team http www k team com info k team com May 25 1999 116 K system A All information in this document is preliminary and subject to change var_set_irq vector procedure Attribute one procedure to the user interruption This system call initialises the user interruption vector with the address of one procedure The return code of the procedure has to be a RTS and not a RTSF Input stacking order procedure Pointer on the procedure Output Call examples in assembler and C push 32 R 16 procedure A CALL_BIOS var set irq vector 1 execute the function void procedure void var_set_irq vector procedure K Team http www k team com info k team com May
75. stem A All information in this document is preliminary and subject to change timreset Init of the resources of the module DO NOT USE FOR APPLICATIONS This system call inits the manager Input stacking order Output Call examples in assembler and C CALL_BIOS tim_reset execute the function tim_reset 5 K Team http www k team com info k team com May 25 1999 27 K system A All information in this document is preliminary and subject to change tim_new_inst_task textId stack procedure Place a new task descriptor in the execution list NOT USABLE FOR C APPLICATIONS Instead use install task textId stackLength procedure This system call places one task descriptor in the execution list As many as thirty two task descriptors can be contained in the execution list An error is returned if the execution list is full before the system call For C applications the user should use install_task textId stackLength procedure The minimun stack length should be 800 800 long words However the user can increase it according with the number of local variables that his program uses Input stacking order procedure Pointer on the task code stack Pointer on the stack textId Pointer on a string terminated with null Output DO 2 0 2 31 ID of the task descriptor DO 1 Too many task descriptors in the execution list Call examples in assembler and C pu
76. t_sensors_im motorNb posi tion if Cstautus lt return 1 K Team http www k team com info k team com May 25 1999 53 K system A All information in this document is preliminary and subject to change mot_stop Stop the motors and set PID coefficients to zero This system call immediately stops the two motors and sets the PID coefficients to zero Input stacking order Output Call examples in assembler and C CALL_BIOS mot_stop execute the function mot stop O K Team http www k team com info k team com May 25 1999 54 K system A All information in this document is preliminary and subject to change mot_new_position imCmotorNb position New position for one motor This system call changes the position of one motor An error is returned if the motor does not exist Maximum forward position position 23 1 units Maximum backward position position 23 units The unit of the position is 0 03 mm Input stacking order position Position value mo torNb Number of the motor 1 Output DO 0 OK DO 1 The motor does not exist Call examples in assembler and C push 32 A6 posi tion position value push 32 A6 motorNb motor number CALL_BIOS mot_new_position_im 2 execute the function test 32 DO jump mi R8 Error the motor does not exist int32 status position uint32 motorNb status mot neu position 1mXmotorhNb p
77. tem calls are performed by pushing into the stack the different parameters followed by a soft ware TRAP 6 and a 16 bit number which codes the call Obviously the stack has to be readjusted according to the number of parameters pushed Here is an example push 32 Valuel push 32 Value2 trap 6 16 Cal INumber add 32 4 2 SP first parameter second parameter COM call the number of the function stack adjust To improve the readability of the programs the COM system call sequence can be replaced by a macro MRCRO CALL_COM trap 6 16 1 add 32 4 2 SP ENDMRCRO The previous example becomes push 32 push 32 CALL_COM Valuel Value2 Cal 1 Number 2 K Team http www k team com info k team com call the COM the number of the function stack adjust first parameter second parameter COM call May 25 1999 17 K system A All information in this document is preliminary and subject to change com reset Init of the resources of the manager This system call inits the manager Input Output Call examples in assembler and C CRLL COM X COM reset 0 execute the function com_reset K Team http www k team com info k team com May 25 1999 18 K system A All information in this document is preliminary and subject to change com_reserve_channel C Reserve
78. tput Call examples in assembler and C push 32 A6 pwm pum push 32 A6 pwm 1 pum 1 CALL_BIOS mot neu pum 2m 2 execute the function int32 pwm pwm1 mot neu pum 2m pumi pum0 K Team http www k team com info k team com May 25 1999 63 K system A All information in this document is preliminary and subject to change SENS Rev 1 01 K Team http www k team com info k team com SENS SENS manager CIR sensors and analog manager Family ID BIOS Table of content sens_reset sens get reflected value sensorNb sens get ambient valueCsensorNb sens_get_pointer sens_get_ana_valueCinputNb K Team http www k team com info k team com May 25 1999 64 K system A All information in this document is preliminary and subject to change Generalities This module manages the eight IR sensors figure 5 and all the analog inputs The hardware which controls the different phases of the IR sensor measure is completely under the control of this manager Channel 0 is used to get the value pulse light of the left IR sensors Channel 1 is used to get the value ambient light of the left IR sensors Channel 2 is used to get the value pulse light of the right IR sensors Channel 3 is used to get the value ambient light of the right IR sensors Channels 4 to 9 user The sequence necessary to manage the IR sensors is divided int
79. umber 0 to 8 correspond to the 8 digital power outputs Outputs number 9 to 11 correspond to the 4 CMOS outputs Input stacking order outNbr Output number Output DO 0 OK DO 1 The output does not exist Call examples in assembler and C push 32 A6 outNbr CALL_BIOS uio_off_out 1 execute the function test 32 DO jump mi R8 Error the output does not exist int32 status uint32 outhbr status uio off outCoutNbr if status lt return 1j K Team http www k team com info k team com May 25 1999 128 K system A All information in this document is preliminary and subject to change uio change outCoutNbr Change the state of a digital output This system call changes the state of a digital output Outputs number 0 to 8 correspond to the 8 digital power outputs Outputs number 9 to 11 correspond to the 4 CMOS outputs Input stacking order outNbr Output number Output DO 0 OK DO 1 The output does not exist Call examples in assembler and C push 32 A6 outNbr CALL_BIOS uio change out 1 execute the function test 32 DO jump mi R8 Error the output does not exist int32 status uint32 outNbr status uio_change outCoutNbr if status lt return 1j K Team http www k team com info k team com May 25 1999 129 K system A All information in this document is preliminary and subject to change uio_get_inputs Get the valu
80. urces of the manager This system call inits the manager The baudrate is selected to 9600 bits s Input Output Call examples in assembler and C CALL_BIOS ser reset 0 execute the function ser_reset K Team http www k team com info k team com May 25 1999 102 K system A All information in this document is preliminary and subject to change ser_reserve_channel C Reserve the serial SCI channel This system call reserves the serial SCI channel for a transaction The serial SCI channel is a critical resource which can be shared with other tasks An error is returned if the channel is busy Input stacking order Output DO 0 Channel reserued and ready to operate DO 1 Channel busy Call examples in assembler and C CALL_BIOS ser_reserve channel 3 execute the function test 32 DO 3 jump mi R8 Error wait int32 status status ser reserue channel 5 if status lt 0 return 1 K Team http www k team com info k team com May 25 1999 103 K system A All information in this document is preliminary and subject to change ser release channel C Release the serial SCI channel This system call releases the serial SCI channel The other tasks can now use this channel Input stacking order Output Call examples in assembler and C CALL_BIOS ser_release channel 3 execute the function ser release channel K Team
81. us Edoardo Franzi franzi k team com May 25 1999 88 K system A All information in this document is preliminary and subject to change mma send buffer 1 buffer size Send one buffer by the MMA 1 channel This system call sends one buffer of less that 1024 bytes by the MMA 1 channel An error is returned if any Input stacking order size Size of the buffer to send buffer Pointer on the buffer Output DO OK DO Channel busy DO Size of the buffer excessive DO Size of the buffer 0 Call examples in assembler and C push 32 A6 size size of the buffer to send push 32 A6 buf fer pointer on the buffer CALL_BIOS mma_send_buf fer_1 2 execute the function test 32 DO jump mi R8 Error channel int32 status uint8 buf fer uint32 size status mma_send_buf fer_l buffer size if status lt return status Edoardo Franzi franzi k team com May 25 1999 89 K system A All information in this document is preliminary and subject to change mma_send_buf fer_2 buf fer size Send one buffer by the MMA 2 channel This system call sends one buffer of less that 1024 bytes by the MMA 2 channel An error is returned if any Input stacking order size Size of the buffer to send buf fer Pointer on the buffer Output DO OK DO Channel busy DO Size of the buffer excessive DO Size of the buffer 0 Call examples in assembler and C
82. uts Figure 8 General I O port definitions K Team http www k team com info k team com May 25 1999 125 K system A All information in this document is preliminary and subject to change uio reset Init of the resources of the manager This system call inits the manager Input stacking order Output Call examples in assembler and C CALL_BIOS uio reset execute the function var_reset K Team http www k team com info k team com May 25 1999 126 K system A All information in this document is preliminary and subject to change uio on outCoutNbr Set ON a digi tal output This system call switch ON a digital output Outputs number 0 to 8 correspond to the 8 digital power outputs Outputs number 9 to 11 correspond to the 4 CMOS outputs Input stacking order outNbr Output number Output DO 0 OK DO 1 The output does not exist Call examples in assembler and C push 32 A6 outNbr CALL_BIOS uio_on_out 1 execute the function test 32 DO jump mi R8 Error the output does not exist int32 status uint32 outNbr status uio_on_outCoutNbr if status lt return 1j K Team http www k team com info k team com May 25 1999 127 K system A All information in this document is preliminary and subject to change uio_of f_outCoutNbr Set OFF a digital output This system call switch OFF a digital output Outputs n
83. vec tor procedure excep ti onNb var _cpu_speed CPUSpeedValue 2 6 var_get_extensionCaddress s s s s s eo var_put_extensionCaddress binaryValue e K Team http www k team com info k team com May 25 1999 110 K system A All information in this document is preliminary and subject to change Generalities This module manages different low level resources such as jumper reading LEDs control and the user external interruption The parallel extension bus of the system is also under the control of this module LedO Led Led2 selector Figure 7 LED and jumper definitions K Team http www k team com info k team com May 25 1999 111 K system A All information in this document is preliminary and subject to change uar reset Init of the resources of the manager This system call inits the manager Input stacking order Output Call examples in assembler and C CALL_BIOS var _reset execute the function var_reset K Team http www k team com info k team com May 25 1999 112 K system A All information in this document is preliminary and subject to change var get_ jumper Get the value of the selector This system call returns the state values of the selector of the main board Input stacking order Output DO jumperUalue State of the jumpers Call examples in assembler and C CALL_BIOS var_get_jumper
84. x24 0x35 0x43 Parameter number 3 ASCII out A 1 4 r n 0 Input stacking order paramNb Number of parameters binary Pointer on the binary buffer asci i Pointer on the ASCII buffer Output Call examples in assembler and C push 32 A6 paramNb number of parameters push 32 A6 binary pointer on a binary buffer push 32 R6 ascii pointer on an ASCII buffer CALL_BIOS str cnut bin8 hascii 3 execute the function char ascii uints binary uint32 paramhNb str cnut bin8 hasciiCascii binary paramNb K Team http www k team com info k team com May 25 1999 158 K system A All information in this document is preliminary and subject to change References JDN86 Common Assembly Language for Microprocessors Jean Daniel Nicoud and Patrick Fah Swiss Federal Institute of Technology LAMI December 1986 Mot89 Central Processor Unit Reference Manual Ref CPU32RM AD Motorola INC 1989 Mot91 MC68331 User s Manual Ref MC68331UM AD Motorola INC 1991 Mot92 Programmer s Reference Manual Ref M68000PM AD Rev 1 Motorola INC 1992 Fra91 Syst me multiprocesseur pour la commande de robots Report R91 50 Edoardo Franzi Swiss Federal Institute of Technology LAMI August 1991 K Team http www k team com info k team com May 25 1999 159
85. xamples in assembler and C push 32 A6 inputNb number of the input CRLL BIOS sens get ana value 1 execute the function test 32 DO jump mi R8 Error the input does not exist move 32 D A6 analogValue 3 analog value int32 status uint32 analogUalue inputNb status sens get ana valueCinputNb if status lt return 1j analogUalue Cuint32 status K Team http www k team com info k team com May 25 1999 70 K system A All information in this document is preliminary and subject to change MSG Rev 2 00 K Team http www k team com info k team com MSG MSG manager local multi microcontroller network manager Family ID BIOS Table of content msgreset we wo s Bose eee e msg_reserve_channelCchannelNb sow amp msg_release_channelCchannelNb bcs ES ce msg send message mesgS sizeS t y o4 wow msg_receive_message mesgR sizeR msg snd rec message msgS sizeS msgh sizeR rep K Team http www k team com info k team com May 25 1999 71 K system A All information in this document is preliminary and subject to change Generalities This module manages all the communications between the main microcontroller of the system master and the different microcontrollers slaves available on the network The small local network controlled by this module operates in a single master multi slave configur
86. y pointer on a binary buffer CALL_BIOS str cnut hascii bin32 3 execute the function test 32 DO jump mi R8 Error buffer format error int32 status uint32 binary paramNb char ascii status str conuert hascii bin32 binarg ascii paramNb if status lt 0D return 1j K Team http www k team com info k team com May 25 1999 155 K system A All information in this document is preliminary and subject to change str cnut hascii bin8C binarg ascii paramNb Conversion from an ASCII hexadecimal formatted buffer to an 8 bit binary one This system call converts an ASCII hexadecimal representation formatted buffer to an 8 bit binary one An error is returned if the buffer is inconsistent Here is an example ASCII in 10 1 4 4 66 r n 0 Parameter number 3 Binary out 0x10 Ox1 0x4 Input stacking order paramNb Number of parameters asci i Pointer on the ASCII buffer binary Pointer on the binary buffer Output D 0 Conuersion OK DO 1 Format of the buffer inconsistent Call examples in assembler and C push 32 A6 paramNb number of parameters push 32 A6 asci i pointer on an ASCII buffer push 32 A6 binary pointer on a binary buffer CALL_BIOS str cnut hascii bin8 3 execute the function test 32 DO jump mi R8 Error buffer format error int32 status uint8 binary char ascii uint32 paramNb status str cnut hascii bin8C binaru ascii PparamNb if st

Download Pdf Manuals

image

Related Search

Related Contents

清浄度検査キット(ふき取り) - キッコーマン バイオケミファ  PDFカタログ/1.2MB  préparer la première épreuve écrite d`admissibilité  Manual du propriétaire  Manual Português DV6025BR Parte II  6 Inch Network High-definition Speed Dome User Manual V2.0.0  Philips GC029  Home Decorators Collection 1872510210 Instructions / Assembly  Philips SHAVER 3000 PowerTouch PT724  Samsung Purple 14 Kg 127V manual do usuário  

Copyright © All rights reserved.
Failed to retrieve file