nios: Define packet length in shared header
This commit is contained in:
parent
d7f1908629
commit
84a9ccc328
4 changed files with 36 additions and 6 deletions
30
fpga_common/include/nios_pkt_formats.h
Normal file
30
fpga_common/include/nios_pkt_formats.h
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) 2015 Nuand LLC
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#ifndef BLADERF_NIOS_PKT_FORMATS_H_
|
||||
#define BLADERF_NIOS_PKT_FORMATS_H_
|
||||
|
||||
#include "nios_pkt_legacy.h"
|
||||
#include "nios_pkt_retune.h"
|
||||
|
||||
#define NIOS_PKT_LEN 16
|
||||
|
||||
#endif
|
||||
|
|
@ -99,7 +99,7 @@ int main(void)
|
|||
}
|
||||
|
||||
/* Receive the rest of the message */
|
||||
while (count < PKT_BUFLEN) {
|
||||
while (count < NIOS_PKT_LEN) {
|
||||
while (!fx3_uart_has_data());
|
||||
set_request(&pkt, count++, fx3_uart_read());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "nios_pkt_formats.h"
|
||||
|
||||
#ifndef ARRAY_SIZE
|
||||
# define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
|
||||
|
|
@ -33,11 +34,10 @@
|
|||
|
||||
#define PKT_MAGIC_IDX 0
|
||||
#define PKT_CFG_IDX 1
|
||||
#define PKT_BUFLEN 16
|
||||
|
||||
struct pkt_buf {
|
||||
const uint8_t req[PKT_BUFLEN]; /* Request */
|
||||
uint8_t resp[PKT_BUFLEN]; /* Response */
|
||||
const uint8_t req[NIOS_PKT_LEN]; /* Request */
|
||||
uint8_t resp[NIOS_PKT_LEN]; /* Response */
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@
|
|||
|
||||
#include <stdint.h>
|
||||
#include "pkt_handler.h"
|
||||
#include "nios_pkt_legacy.h" /* Shared definitions between NIOII & host */
|
||||
#include "nios_pkt_formats.h"
|
||||
|
||||
#define PKT_LEGACY_MAGIC ((uint8_t) UART_PKT_MAGIC)
|
||||
#define PKT_LEGACY_REQUIRED_BYTES PKT_BUFLEN
|
||||
#define PKT_LEGACY_REQUIRED_BYTES NIOS_PKT_LEN
|
||||
|
||||
void pkt_legacy(struct pkt_buf *b);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue