[Vm-dev] VM Maker: VMMaker.oscog-ul.2354.mcz

Javier Diaz-Reinoso javier_diaz_r at mac.com
Sat Mar 17 18:03:51 UTC 2018


Yes that is right, you can use sqUnixSerial.c instead of the sqMacSerialPort.c but there are limitation about the maximum speed, I have a hacked version of sqUnixSerial.c using the the same way that pyserial use, using this file my program sqPronterface works well at 250000 bps in intel mac, and a maximum of  230400 bps in ppc mac:



> On 17 Mar 2018, at 03:02, Clément Bera <bera.clement at gmail.com> wrote:
> 
> 
> 
> On Sat, Mar 17, 2018 at 1:09 AM, Levente Uzonyi <leves at caesar.elte.hu <mailto:leves at caesar.elte.hu>> wrote:
>  
> Hi Eliot,
> 
> I wonder how the Pharo builds handle those. Because these have always been enabled there.
> Also, these primitives are from the original SqueakVM branch (interpreter), so there should be problems as well if the primitives are missing.
> 
> Levente
> 
> On Fri, 16 Mar 2018, Eliot Miranda wrote:
> 
> Hi Levente,
>    no need for any action on your part.  I see that the Serial Port primitives are essentially unimplemented on Mac OS so it is trivial to provide null implementations for the "ByName" ones.
> 
> Last time I talked with the people using the SerialPort plugin they said on Mac they use the linux plugin since the Mac plugin is not implemented, the linux plugin is, and the linux plugin works on all unix systems including Mac.
> 
>  
> 
> On Fri, Mar 16, 2018 at 3:46 PM, Eliot Miranda <eliot.miranda at gmail.com <mailto:eliot.miranda at gmail.com>> wrote:
>       Hi Levente,
>     when I try and build on Mac OS X I get this:
> 
>   "_serialPortOpenByName", referenced from:
>       _primitiveSerialPortOpenByName in SerialPlugin.lib(SerialPlugin.o)
>   "_serialPortReadIntoByName", referenced from:
>       _primitiveSerialPortReadByName in SerialPlugin.lib(SerialPlugin.o)
>   "_serialPortWriteFromByName", referenced from:
>       _primitiveSerialPortWriteByName in SerialPlugin.lib(SerialPlugin.o)
> 
> The implementations are missing in both platforms/Mac OS/plugins/SerialPlugin/sqMacSerialPort.c and platforms/iOS/plugins/SerialPlugin/sqMacSerialPort.c.  They are there in
> platforms/unix/plugins/SerialPlugin/sqUnixSerial.c and platforms/win32/plugins/SerialPlugin/sqWin32SerialPort.c.
> 
> :-(
> 
> 
> On Sat, Mar 10, 2018 at 1:58 PM, <commits at source.squeak.org <mailto:commits at source.squeak.org>> wrote:
> 
>       Levente Uzonyi uploaded a new version of VMMaker to project VM Maker:
>       http://source.squeak.org/VMMaker/VMMaker.oscog-ul.2354.mcz <http://source.squeak.org/VMMaker/VMMaker.oscog-ul.2354.mcz>
> 
>       ==================== Summary ====================
> 
>       Name: VMMaker.oscog-ul.2354
>       Author: ul
>       Time: 10 March 2018, 10:56:45.349653 pm
>       UUID: b8f3192d-2b33-4a5d-83f9-785fbefbc570
>       Ancestors: VMMaker.oscog-eem.2353
> 
>       Restored SerialPlugin's *byName* primitives on non-PharoVM VMs.
> 
>       =============== Diff against VMMaker.oscog-eem.2353 ===============
> 
>       Item was changed:
>         ----- Method: SerialPlugin>>primitiveSerialPortOpenByName:baudRate:stopBitsType:parityType:dataBits:inFlowControlType:outFlowControlType:xOnByte:xOffByte: (in category 'primitives') -----
>         primitiveSerialPortOpenByName: portName baudRate: baudRate stopBitsType: stopBitsType parityType: parityType dataBits: dataBits inFlowControlType: inFlowControl outFlowControlType:
>       outFlowControl xOnByte: xOnChar xOffByte: xOffChar
>       -       <option: #PharoVM>
>               <var: #port type: 'char *'>
> 
>               | port portNameSize |
> 
>               self primitive: 'primitiveSerialPortOpenByName'
>                       parameters: #(String SmallInteger SmallInteger SmallInteger SmallInteger SmallInteger SmallInteger SmallInteger SmallInteger ).
> 
>               portNameSize := interpreterProxy slotSizeOf: (portName asOop: String).
>               port := self cCode: 'calloc(portNameSize+1, sizeof(char))'.
>               self cCode: 'memcpy(port, portName, portNameSize)'.
> 
>               self cCode: 'serialPortOpenByName(
>                               port, baudRate, stopBitsType, parityType, dataBits,
>                               inFlowControl, outFlowControl, xOnChar, xOffChar)'.
> 
>               self free: port.!
> 
>       Item was changed:
>         ----- Method: SerialPlugin>>primitiveSerialPortReadByName:into:startingAt:count: (in category 'primitives') -----
>         primitiveSerialPortReadByName: portName into: array startingAt: startIndex count: count
>       -       <option: #PharoVM>
>               <var: #port type: 'char *'>
> 
>               | port portNameSize bytesRead arrayPtr |
> 
>               self primitive: 'primitiveSerialPortReadByName'
>                       parameters: #(String  ByteArray SmallInteger SmallInteger ).
> 
>               interpreterProxy success: (startIndex >= 1 and: [startIndex + count - 1 <= (interpreterProxy byteSizeOf: array cPtrAsOop)]).
>               "adjust for zero-origin indexing"
> 
>               portNameSize := interpreterProxy slotSizeOf: (portName asOop: String).
>               port := self cCode: 'calloc(portNameSize+1, sizeof(char))'.
>               self cCode: 'memcpy(port, portName, portNameSize)'.
> 
>               arrayPtr := array + startIndex - 1.
>               bytesRead := self cCode: 'serialPortReadIntoByName( port, count, arrayPtr)'.
> 
>               self free: port.
> 
>               ^ bytesRead asSmallIntegerObj!
> 
>       Item was changed:
>         ----- Method: SerialPlugin>>primitiveSerialPortWriteByName:from:startingAt:count: (in category 'primitives') -----
>         primitiveSerialPortWriteByName: portName from: array startingAt: startIndex count: count
>       -       <option: #PharoVM>
>               <var: #port type: 'char *'>
> 
>               | bytesWritten arrayPtr portNameSize port |
> 
>               self primitive: 'primitiveSerialPortWriteByName'
>                       parameters: #(String ByteArray SmallInteger SmallInteger ).
> 
>               portNameSize := interpreterProxy slotSizeOf: (portName asOop: String).
>               port := self cCode: 'calloc(portNameSize+1, sizeof(char))'.
>               self cCode: 'memcpy(port, portName, portNameSize)'.
> 
>               interpreterProxy success: (startIndex >= 1 and: [startIndex + count - 1 <= (interpreterProxy byteSizeOf: array cPtrAsOop)]).
>               interpreterProxy failed
>                       ifFalse: [arrayPtr := array + startIndex - 1.
>                               bytesWritten := self cCode: 'serialPortWriteFromByName(port, count, arrayPtr)' ].
> 
>               self free: port.
> 
>               ^ bytesWritten asSmallIntegerObj!
> 
> 
> 
> 
> --
> _,,,^..^,,,_
> best, Eliot
> 
> 
> 
> 
> --
> _,,,^..^,,,_
> best, Eliot
> 
> 
> 
> 
> 
> -- 
> Clément Béra
> https://clementbera.github.io/ <https://clementbera.github.io/>
> https://clementbera.wordpress.com/ <https://clementbera.wordpress.com/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20180317/ed4e2cdb/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sqMacSerialV2.c.zip
Type: application/zip
Size: 4549 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20180317/ed4e2cdb/attachment-0001.zip>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20180317/ed4e2cdb/attachment-0003.html>


More information about the Vm-dev mailing list