// A way to access the data as packetInContents[n] from ATS code
macdef packetInContents =
$extval(arrayref(uint8, 256),“packetInContents”)
How do I get a pointer of packetInContents to pass to spi_send_c?
Note, I’d be ok making a different kind of variable for packetInContents (C
version) just for passing it, rather than somehow converting
packetInContents (ATS version).
error(3): the tuple/record pattern is ill-typed.
patsopt(TRANS3): there are [1] errors in total.
exit(ATS): uncaught exception:
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_error_2esats__FatalErrorExn(1025)On Tuesday, December 15, 2015 at 9:31:55 PM UTC-7, gmhwxi wrote:
Try cast:
val _ = spi_send_c($UN.cast(packetInContents), $UN.cast{uint8}(0))
On Tue, Dec 15, 2015 at 11:07 PM, Mike Jones <pro...@gmail.com <javascript:>> wrote:
If I have:
// Writes array of data to hardware using length
fun spi_send_c (cPtr0(uint8), uint8): uint32 = “mac#spi_send_c”
// A way to access the data as packetInContents[n] from ATS code
macdef packetInContents =
$extval(arrayref(uint8, 256),“packetInContents”)
How do I get a pointer of packetInContents to pass to spi_send_c?
Note, I’d be ok making a different kind of variable for packetInContents
(C version) just for passing it, rather than somehow converting
packetInContents (ATS version).
In this case, it is void* to void* in C. The cast is just
for circumventing typechecking in ATS.On Tuesday, December 15, 2015 at 11:41:36 PM UTC-5, Mike Jones wrote:
Never mind. It was due to a mismatch in the return value. It compiled.
wrt cast(), does it cast anything to anything, or is it a pointer caster?
On Tuesday, December 15, 2015 at 9:39:53 PM UTC-7, Mike Jones wrote:
Results in:
error(3): the tuple/record pattern is ill-typed.
patsopt(TRANS3): there are [1] errors in total.
exit(ATS): uncaught exception:
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_error_2esats__FatalErrorExn(1025)
On Tuesday, December 15, 2015 at 9:31:55 PM UTC-7, gmhwxi wrote:
Try cast:
val _ = spi_send_c($UN.cast(packetInContents), $UN.cast{uint8}(0))
On Tue, Dec 15, 2015 at 11:07 PM, Mike Jones pro...@gmail.com wrote:
If I have:
// Writes array of data to hardware using length
fun spi_send_c (cPtr0(uint8), uint8): uint32 = “mac#spi_send_c”
// A way to access the data as packetInContents[n] from ATS code
macdef packetInContents =
$extval(arrayref(uint8, 256),“packetInContents”)
How do I get a pointer of packetInContents to pass to spi_send_c?
Note, I’d be ok making a different kind of variable for
packetInContents (C version) just for passing it, rather than somehow
converting packetInContents (ATS version).
// A way to access the data as packetInContents[n] from ATS code
macdef packetInContents =
$extval(arrayref(uint8, 256),“packetInContents”)
How do I get a pointer of packetInContents to pass to spi_send_c?
Note, I’d be ok making a different kind of variable for packetInContents
(C version) just for passing it, rather than somehow converting
packetInContents (ATS version).
Never mind. It was due to a mismatch in the return value. It compiled.
wrt cast(), does it cast anything to anything, or is it a pointer caster?On Tuesday, December 15, 2015 at 9:39:53 PM UTC-7, Mike Jones wrote:
Results in:
error(3): the tuple/record pattern is ill-typed.
patsopt(TRANS3): there are [1] errors in total.
exit(ATS): uncaught exception:
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_error_2esats__FatalErrorExn(1025)
On Tuesday, December 15, 2015 at 9:31:55 PM UTC-7, gmhwxi wrote:
Try cast:
val _ = spi_send_c($UN.cast(packetInContents), $UN.cast{uint8}(0))
On Tue, Dec 15, 2015 at 11:07 PM, Mike Jones pro...@gmail.com wrote:
If I have:
// Writes array of data to hardware using length
fun spi_send_c (cPtr0(uint8), uint8): uint32 = “mac#spi_send_c”
// A way to access the data as packetInContents[n] from ATS code
macdef packetInContents =
$extval(arrayref(uint8, 256),“packetInContents”)
How do I get a pointer of packetInContents to pass to spi_send_c?
Note, I’d be ok making a different kind of variable for packetInContents
(C version) just for passing it, rather than somehow converting
packetInContents (ATS version).
I’ll make some safe ATS function call and put this dangerous cast inside so
the maintainer does not accidentally pass something too small, etc.On Tuesday, December 15, 2015 at 9:44:19 PM UTC-7, gmhwxi wrote:
In this case, it is void* to void* in C. The cast is just
for circumventing typechecking in ATS.
On Tuesday, December 15, 2015 at 11:41:36 PM UTC-5, Mike Jones wrote:
Never mind. It was due to a mismatch in the return value. It compiled.
wrt cast(), does it cast anything to anything, or is it a pointer caster?
On Tuesday, December 15, 2015 at 9:39:53 PM UTC-7, Mike Jones wrote:
Results in:
error(3): the tuple/record pattern is ill-typed.
patsopt(TRANS3): there are [1] errors in total.
exit(ATS): uncaught exception:
_2home_2hwxi_2Research_2ATS_2dPostiats_2src_2pats_error_2esats__FatalErrorExn(1025)
On Tuesday, December 15, 2015 at 9:31:55 PM UTC-7, gmhwxi wrote:
Try cast:
val _ = spi_send_c($UN.cast(packetInContents), $UN.cast{uint8}(0))
On Tue, Dec 15, 2015 at 11:07 PM, Mike Jones pro...@gmail.com wrote:
If I have:
// Writes array of data to hardware using length
fun spi_send_c (cPtr0(uint8), uint8): uint32 = “mac#spi_send_c”
// A way to access the data as packetInContents[n] from ATS code
macdef packetInContents =
$extval(arrayref(uint8, 256),“packetInContents”)
How do I get a pointer of packetInContents to pass to spi_send_c?
Note, I’d be ok making a different kind of variable for
packetInContents (C version) just for passing it, rather than somehow
converting packetInContents (ATS version).