mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
[board/msp-430-common board/msba2 core/]
* introduced dummy function for msp-430 config-save * moved sysconfig from board to core [sys/transceiver cpu/] * moved some buffer size defines to cpu dependent parts * some cleanups
This commit is contained in:
parent
4a2c58bbba
commit
fb1cb91c75
@ -27,7 +27,7 @@
|
||||
|
||||
SubDir TOP board msb-430-common ;
|
||||
|
||||
Module board : board_init.c debug_uart.c ;
|
||||
Module board : board_init.c debug_uart.c config.c ;
|
||||
UseModule board ;
|
||||
|
||||
SubInclude TOP cpu $(CPU) ;
|
||||
|
@ -28,7 +28,7 @@
|
||||
CPU = msp430 ;
|
||||
MCU = msp430x1612 ;
|
||||
|
||||
FLASH_PORT ?= /dev/ttyUSB0 ;
|
||||
FLASH_PORT ?= "$(PORT)" ;
|
||||
FLASHER ?= mspdebug ;
|
||||
FLASHFLAGS ?= -d $(FLASH_PORT) -j uif ;
|
||||
|
||||
|
6
board/msb-430-common/config.c
Normal file
6
board/msb-430-common/config.c
Normal file
@ -0,0 +1,6 @@
|
||||
#include <stdint.h>
|
||||
#include <config.h>
|
||||
|
||||
uint8_t config_save(void) {
|
||||
return 1;
|
||||
}
|
@ -51,12 +51,6 @@ and the mailinglist (subscription via web site)
|
||||
#define PCRTC BIT9
|
||||
#define CL_CPU_DIV 4
|
||||
|
||||
config_t sysconfig = {
|
||||
0, ///< default ID
|
||||
0, ///< default radio address
|
||||
0, ///< default radio channel
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief Enabling MAM and setting number of clocks used for Flash memory fetch
|
||||
|
@ -22,6 +22,7 @@
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <config.h>
|
||||
#include "tcb.h"
|
||||
#include "cpu.h"
|
||||
#include "flags.h"
|
||||
@ -85,5 +86,7 @@ int inISR(void);
|
||||
|
||||
extern volatile int lpm_prevent_sleep;
|
||||
|
||||
extern config_t sysconfig;
|
||||
|
||||
/** @} */
|
||||
#endif /* KERNEL_H_ */
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <lpm.h>
|
||||
#include <thread.h>
|
||||
#include <hwtimer.h>
|
||||
#include <config.h>
|
||||
|
||||
#ifdef MODULE_AUTO_INIT
|
||||
#include <auto_init.h>
|
||||
@ -41,6 +42,12 @@ volatile int lpm_prevent_sleep = 0;
|
||||
extern void main(void);
|
||||
extern void cpu_switch_context_exit(void);
|
||||
|
||||
config_t sysconfig = {
|
||||
0, ///< default ID
|
||||
0, ///< default radio address
|
||||
0, ///< default radio channel
|
||||
};
|
||||
|
||||
static void idle_thread(void) {
|
||||
while(1) {
|
||||
if (lpm_prevent_sleep) {
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define ENABLE_DEBUG
|
||||
#include <debug.h>
|
||||
|
@ -84,5 +84,8 @@ and the mailinglist (subscription via web site)
|
||||
#define CC_CONF_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
|
||||
/** @} */
|
||||
|
||||
#define TRANSCEIVER_BUFFER_SIZE (10)
|
||||
#define RX_BUF_SIZE (10)
|
||||
|
||||
/** @} */
|
||||
#endif /* CPUCONF_H_ */
|
||||
|
@ -37,6 +37,9 @@ and the mailinglist (subscription via web site)
|
||||
|
||||
#define KERNEL_CONF_STACKSIZE_IDLE 64
|
||||
#define MSP430_ISR_STACK_SIZE 256
|
||||
|
||||
#define RX_BUF_SIZE (4)
|
||||
#define TRANSCEIVER_BUFFER_SIZE (4)
|
||||
/** @} */
|
||||
|
||||
#endif /* CPUCONF_H_ */
|
||||
|
@ -29,5 +29,5 @@ SubDir TOP drivers cc110x_ng ;
|
||||
|
||||
HDRS += $(TOP)/drivers/cc110x_ng ;
|
||||
|
||||
Module cc110x_ng : cc1100.c cc1100-rx.c cc1100-tx.c cc1100-defaultSettings.c cc1100_spi.c : board_cc1100 swtimer gpioint ;
|
||||
Module cc110x_ng : cc1100.c cc1100-rx.c cc1100-tx.c cc1100-defaultSettings.c cc1100_spi.c : board_cc1100 swtimer ;
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <msg.h>
|
||||
#include <transceiver.h>
|
||||
|
||||
#include <cpu-conf.h>
|
||||
#include <board.h>
|
||||
|
||||
static uint8_t receive_packet_variable(uint8_t *rxBuffer, uint8_t length);
|
||||
@ -96,7 +97,8 @@ static uint8_t receive_packet_variable(uint8_t *rxBuffer, uint8_t length) {
|
||||
|
||||
/* Any bytes available in RX FIFO? */
|
||||
if ((cc1100_spi_read_status(CC1100_RXBYTES) & BYTES_IN_RXFIFO)) {
|
||||
LED_GREEN_TOGGLE;
|
||||
//LED_GREEN_TOGGLE;
|
||||
LED_RED_TOGGLE;
|
||||
// Read length byte (first byte in RX FIFO)
|
||||
packetLength = cc1100_spi_read_reg(CC1100_RXFIFO);
|
||||
// Read data from RX FIFO and store in rxBuffer
|
||||
|
@ -60,7 +60,7 @@ uint8_t cc1100_send(cc1100_packet_t *packet) {
|
||||
restoreIRQ(cpsr);
|
||||
// Wait for GDO2 to be cleared -> end of packet
|
||||
while (cc1100_get_gdo2() != 0);
|
||||
LED_GREEN_TOGGLE;
|
||||
//LED_GREEN_TOGGLE;
|
||||
|
||||
// Experimental - TOF Measurement
|
||||
cc1100_after_send();
|
||||
|
@ -6,8 +6,6 @@
|
||||
#include <stdint.h>
|
||||
#include <cc1100-config.h>
|
||||
|
||||
#define RX_BUF_SIZE (10)
|
||||
|
||||
#define CC1100_MAX_DATA_LENGTH (58)
|
||||
|
||||
#define CC1100_HEADER_LENGTH (3) ///< Header covers SRC, DST and FLAGS
|
||||
|
@ -68,12 +68,12 @@ int main(void)
|
||||
cc1100_set_address(2);
|
||||
|
||||
|
||||
while(1) {
|
||||
// while(1) {
|
||||
puts(".");
|
||||
int result = cc1100_send_csmaca(1, 4, 2, i, sizeof(i));
|
||||
printf("%i\n", result);
|
||||
hwtimer_wait(1000 * 1000);
|
||||
}
|
||||
// }
|
||||
#else
|
||||
cc1100_set_address(1);
|
||||
while(1) {
|
||||
|
5
projects/msb430_cc110x_ng/Jamfile
Normal file
5
projects/msb430_cc110x_ng/Jamfile
Normal file
@ -0,0 +1,5 @@
|
||||
SubDir TOP projects msb430_cc110x_ng ;
|
||||
|
||||
Module msb430_cc110x_ng : main.c : cc110x_ng transceiver ps posix_io uart0 auto_init ;
|
||||
|
||||
UseModule msb430_cc110x_ng ;
|
119
projects/msb430_cc110x_ng/main.c
Normal file
119
projects/msb430_cc110x_ng/main.c
Normal file
@ -0,0 +1,119 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <shell.h>
|
||||
#include <board_uart0.h>
|
||||
#include <posix_io.h>
|
||||
#include <thread.h>
|
||||
#include <board.h>
|
||||
#include <hwtimer.h>
|
||||
#include <swtimer.h>
|
||||
#include <msg.h>
|
||||
#include <transceiver.h>
|
||||
#include <cc1100_ng.h>
|
||||
|
||||
#define RADIO_STACK_SIZE (1024)
|
||||
|
||||
#define SND_BUFFER_SIZE (3)
|
||||
#define RCV_BUFFER_SIZE (4)
|
||||
|
||||
#define SENDING_DELAY (5 * 1000)
|
||||
|
||||
char radio_stack_buffer[RADIO_STACK_SIZE];
|
||||
|
||||
uint8_t snd_buffer[SND_BUFFER_SIZE][CC1100_MAX_DATA_LENGTH];
|
||||
|
||||
msg msg_q[RCV_BUFFER_SIZE];
|
||||
|
||||
static msg mesg;
|
||||
static transceiver_command_t tcmd;
|
||||
static radio_packet_t p;
|
||||
|
||||
void sender(char *count);
|
||||
void print_buffer(char *unused);
|
||||
|
||||
void sender(char *count) {
|
||||
unsigned int c = 3;
|
||||
unsigned int i;
|
||||
|
||||
mesg.type = SND_PKT;
|
||||
mesg.content.ptr = (char*) &tcmd;
|
||||
|
||||
tcmd.transceivers = TRANSCEIVER_CC1100;
|
||||
tcmd.data = &p;
|
||||
|
||||
p.length = CC1100_MAX_DATA_LENGTH;
|
||||
p.dst = 0;
|
||||
|
||||
for (i = 0; i < c; i++) {
|
||||
puts(".");
|
||||
p.data = snd_buffer[i % SND_BUFFER_SIZE];
|
||||
msg_send(&mesg, transceiver_pid, 1);
|
||||
swtimer_usleep(SENDING_DELAY);
|
||||
}
|
||||
}
|
||||
|
||||
void print_buffer(char *unused) {
|
||||
uint8_t i;
|
||||
extern radio_packet_t transceiver_buffer[];
|
||||
for (i = 0; i < TRANSCEIVER_BUFFER_SIZE; i++) {
|
||||
printf("[%u] %u # %u # %u\n", i, transceiver_buffer[i].processing, transceiver_buffer[i].length, transceiver_buffer[i].data[i]);
|
||||
}
|
||||
extern rx_buffer_t cc1100_rx_buffer[];
|
||||
for (i = 0; i < TRANSCEIVER_BUFFER_SIZE; i++) {
|
||||
printf("[%u] %u # %u \n", i, cc1100_rx_buffer[i].packet.length, cc1100_rx_buffer[i].packet.data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void radio(void) {
|
||||
msg m;
|
||||
radio_packet_t *p;
|
||||
uint8_t i;
|
||||
|
||||
msg_init_queue(msg_q, RCV_BUFFER_SIZE);
|
||||
|
||||
while (1) {
|
||||
msg_receive(&m);
|
||||
if (m.type == PKT_PENDING) {
|
||||
p = (radio_packet_t*) m.content.ptr;
|
||||
printf("Packet waiting, process %p...\n", p);
|
||||
printf("\tLength:\t%u\n", p->length);
|
||||
printf("\tSrc:\t%u\n", p->src);
|
||||
printf("\tDst:\t%u\n", p->dst);
|
||||
printf("\tLQI:\t%u\n", p->lqi);
|
||||
printf("\tRSSI:\t%u\n", p->rssi);
|
||||
|
||||
for (i = 0; i < p->length; i++) {
|
||||
printf("%02X ", p->data[i]);
|
||||
}
|
||||
p->processing--;
|
||||
printf("\n");
|
||||
}
|
||||
else if (m.type == ENOBUFFER) {
|
||||
puts("Transceiver buffer full");
|
||||
}
|
||||
else {
|
||||
puts("Unknown packet received");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
int radio_pid;
|
||||
uint8_t i;
|
||||
for (i = 0; i < SND_BUFFER_SIZE; i++) {
|
||||
memset(snd_buffer[i], i, CC1100_MAX_DATA_LENGTH);
|
||||
}
|
||||
radio_pid = thread_create(radio_stack_buffer, RADIO_STACK_SIZE, PRIORITY_MAIN-2, CREATE_STACKTEST, radio, "radio");
|
||||
transceiver_init(TRANSCEIVER_CC1100);
|
||||
transceiver_start();
|
||||
transceiver_register(TRANSCEIVER_CC1100, radio_pid);
|
||||
sender(NULL);
|
||||
|
||||
while (1) {
|
||||
extern void thread_print_all(void);
|
||||
thread_print_all();
|
||||
print_buffer(NULL);
|
||||
swtimer_usleep(10000000);
|
||||
}
|
||||
}
|
13
projects/msb430_cc110x_ng/tests/hello-world
Executable file
13
projects/msb430_cc110x_ng/tests/hello-world
Executable file
@ -0,0 +1,13 @@
|
||||
#!/usr/bin/expect
|
||||
|
||||
set timeout 5
|
||||
|
||||
spawn pseudoterm $env(PORT)
|
||||
|
||||
expect {
|
||||
"Hello World!" {}
|
||||
timeout { exit 1 }
|
||||
}
|
||||
|
||||
puts "\nTest successful!\n"
|
||||
|
@ -1,5 +1,5 @@
|
||||
SubDir TOP projects test_cc110x_ng ;
|
||||
|
||||
Module test_cc110x_ng : main.c : cc110x_ng shell shell_commands transceiver ps rtc posix_io uart0 auto_init ;
|
||||
Module test_cc110x_ng : main.c : cc110x_ng shell shell_commands transceiver ps rtc posix_io uart0 auto_init gpioint ;
|
||||
|
||||
UseModule test_cc110x_ng ;
|
||||
|
@ -1,7 +1,9 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <board_uart0.h>
|
||||
#ifdef MODULE_RTC
|
||||
#include <lpc2387-rtc.h>
|
||||
#endif
|
||||
#include <auto_init.h>
|
||||
|
||||
#define ENABLE_DEBUG
|
||||
|
@ -3,17 +3,15 @@
|
||||
|
||||
#include <radio/types.h>
|
||||
|
||||
/* Packets to buffer */
|
||||
#define TRANSCEIVER_BUFFER_SIZE (10)
|
||||
/* Stack size for transceiver thread */
|
||||
#define TRANSCEIVER_STACK_SIZE (2048)
|
||||
#define TRANSCEIVER_STACK_SIZE (512)
|
||||
|
||||
/* The maximum of threads to register */
|
||||
#define TRANSCEIVER_MAX_REGISTERED (10)
|
||||
#define TRANSCEIVER_MAX_REGISTERED (4)
|
||||
|
||||
/* The size of the message queue between driver and transceiver (must be power
|
||||
* of two */
|
||||
#define TRANSCEIVER_MSG_BUFFER_SIZE (64)
|
||||
#define TRANSCEIVER_MSG_BUFFER_SIZE (32)
|
||||
|
||||
/**
|
||||
* @brief Message types for transceiver interface
|
||||
|
@ -20,6 +20,10 @@
|
||||
#endif
|
||||
|
||||
//#define ENABLE_DEBUG (1)
|
||||
#ifdef ENABLE_DEBUG
|
||||
#undef TRANSCEIVER_BUFFER_SIZE
|
||||
#define TRANSCEIVER_BUFFER_SIZE (2048)
|
||||
#endif
|
||||
#include <debug.h>
|
||||
|
||||
/*------------------------------------------------------------------------------------*/
|
||||
|
Loading…
Reference in New Issue
Block a user