[platforms] new platform Qorvo GP712.#1942
Conversation
|
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
|
CLA -> I signed it! |
examples/Makefile-gp712
Outdated
| @@ -0,0 +1,274 @@ | |||
| # | |||
| # Copyright (c) 2016-2017, The OpenThread Authors. | |||
examples/platforms/gp712/Makefile.am
Outdated
| -I$(top_srcdir)/examples/platforms \ | ||
| -I$(top_srcdir)/examples/platforms/utils\ | ||
| -I$(top_srcdir)/src/core \ | ||
| -lrt \ |
examples/platforms/gp712/flash.c
Outdated
| #include "utils/flash.h" | ||
|
|
||
| static int sFlashFd; | ||
| uint32_t sEraseAddress; |
examples/platforms/gp712/flash.c
Outdated
| { | ||
| FLASH_SIZE = 0x40000, | ||
| FLASH_PAGE_SIZE = 0x800, | ||
| FLASH_PAGE_NUM = 128, |
There was a problem hiding this comment.
These look like they should maybe be #defines rather then enums. If this is going to be an enum, then the names should start with a k and be CamelCase rather then all caps snake_case
examples/platforms/gp712/flash.c
Outdated
| otError utilsFlashInit(void) | ||
| { | ||
| otError error = OT_ERROR_NONE; | ||
| char fileName[20]; |
| uint8_t readChar; | ||
| //Remove trigger byte from pipe | ||
| res = read(PlatSocketPipeFd [0], &readChar, 1); | ||
| (void)(res); |
There was a problem hiding this comment.
Why assign to res if its not going to be used?
| PlatSocketRx(readLen, buffer, clientSocket->socketId); | ||
|
|
||
| res = write(PlatSocketPipeFd [1], &someByte, 1); //[1] = write fd | ||
| (void)(res); |
There was a problem hiding this comment.
Why have res if your just going to assign to it and then ignore the value?
|
|
||
| PlatSocketClose(clientSocket->socketId); | ||
|
|
||
| return NULL; |
There was a problem hiding this comment.
Should this return something other then NULL?
| void PlatSocketRxNewConn(uint8_t id) | ||
| { | ||
| //Find first non-valid client in list - add here | ||
| if (PlatSocketConnection.isValid == 0) |
| //All sockets | ||
| if(PlatSocketConnection.isValid) | ||
| { | ||
| if((int)PlatSocketConnection.socketId == (int)socketId) |
There was a problem hiding this comment.
Both sides of this conditional are originally uint32_t, so why are they both being cast to int before comparison?
|
@aeliot : these commits should cover all of the comments you made. Some of the code was very close to the posix code, and by e.g. removing the checks for WIN the difference becomes a bit bigger, but I guess that's not really an issue. |
|
|
||
| void cbQorvoRadioTransmitDone(otRadioFrame *aPacket, bool aFramePending, otError aError) | ||
| { | ||
| otPlatRadioTransmitDone(pQorvoInstance, aPacket, aFramePending, aError); |
There was a problem hiding this comment.
It is not recommended to use the legacy TransmitDone() callback anymore, could you use the new TxDone() instead?
There was a problem hiding this comment.
I understand the remark, but this is not a trivial change and we do not plan to do that immediately.
There was a problem hiding this comment.
I agree that it is not mandatory for now, the short-term benefit is that ACK messages could also be used for link quality evaluation. But eventually, we need to use the new TxDone() callback for some new features.
There was a problem hiding this comment.
I actually have the same problem with another platform I'm working on. It seams like we may need to come up with a way for these two to coexist going forwards.
|
CLAs look good, thanks! |
examples/Makefile-gp712
Outdated
| # | ||
| define build-arch | ||
| $(ECHO) " BUILD $(1)-$(TargetTuple)" | ||
| $(MAKE) $(JOBSFLAG) -C $(BuildPath)/$(1)-$(TargetTuple) -w \ |
There was a problem hiding this comment.
The other examples Makefiles have $(BuildPath)/$(TargetTuple). Was having $(BuildPath)/$(1)-$(TargetTuple) a conscious decision?
examples/Makefile-gp712
Outdated
| # | ||
| define stage-arch | ||
| $(ECHO) " STAGE $(1)-$(TargetTuple)" | ||
| $(MAKE) $(JOBSFLAG) -C $(BuildPath)/$(1)-$(TargetTuple) -w \ |
examples/Makefile-gp712
Outdated
| CONFIGURE_TARGETS += configure-$(1) | ||
| BUILD_TARGETS += do-build-$(1) | ||
| STAGE_TARGETS += stage-$(1) | ||
| BUILD_DIRS += $(BuildPath)/$(1)-$(TargetTuple) |
| return error; | ||
| } | ||
|
|
||
| void platformUartUpdateFdSet(fd_set *aReadFdSet, fd_set *aWriteFdSet, fd_set *aErrorFdSet, int *aMaxFd) |
|
Also, please add a |
examples/platforms/gp712/flash.c
Outdated
|
|
||
| // Write the page | ||
| r = pwrite(sFlashFd, &(dummyPage[0]), FLASH_PAGE_SIZE, (off_t)address); | ||
| otEXPECT_ACTION(((int)r) == ((int)(FLASH_PAGE_SIZE)), error = OT_ERROR_FAILED); |
There was a problem hiding this comment.
Why are both sides of this conditional cast to int? I think you can do the comparison without the cast.
examples/platforms/gp712/platform.c
Outdated
| { | ||
| if (localInstance) | ||
| { | ||
| return !otTaskletsArePending(localInstance); |
There was a problem hiding this comment.
There should only be one return statement, as per the style guide.
| { | ||
| uint16_t panid; | ||
| } otCachedSettings_t; | ||
| static otCachedSettings_t otCachedSettings; |
There was a problem hiding this comment.
nit: newline between type definition and usage.
examples/platforms/gp712/radio.c
Outdated
| static uint8_t sScanstate = 0; | ||
| static int8_t sLastReceivedPower = 127; | ||
|
|
||
|
|
| otEXPECT_ACTION(tcsetattr(s_out_fd, TCSANOW, &termios) == 0, perror("tcsetattr"); error = OT_ERROR_GENERIC); | ||
| } | ||
|
|
||
| return error; |
There was a problem hiding this comment.
Should only be one return statement.
|
|
||
| // hack | ||
| res = pipe(PlatSocketPipeFd); | ||
| (void)(res); |
There was a problem hiding this comment.
Why assign to res if its going to be ignored?
examples/platforms/gp712/radio.c
Outdated
|
|
||
| enum | ||
| { | ||
| IEEE802154_MIN_LENGTH = 5, |
| { | ||
| buf = malloc(length + 2); | ||
| memcpy(buf, buffer, length); | ||
| buf[length] = '\n'; |
aeliot
left a comment
There was a problem hiding this comment.
LGTM, except my comments in uart-socket.c about unused variables.
|
@aeliot Indeed I missed out two more unused variables -> fixed it. |
|
🎉 congrats! 🎉 Feel free to add Qorvo the AUTHORS file. |
No description provided.