-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
8,956 additions
and
8,562 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
|
||
|
||
#define CONFIG_FLASH_SIZE_1MB | ||
|
||
//#define CONFIG_FLASH_SIZE_2MB | ||
|
||
#ifdef CONFIG_FLASH_SIZE_1MB | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
/*****************************************************************************/ | ||
/* */ | ||
/* File Name : csl_mbed.h */ | ||
/* */ | ||
/* Description : This file contains all declarations and functions */ | ||
/* related to the chip support library. */ | ||
/* */ | ||
/* MbedOS Usage : Call maclib_get_funcs_struct() to get MACLib funcs; */ | ||
/* Define mbed_reg_func_t var, Register it by ml_init; */ | ||
/* */ | ||
/*****************************************************************************/ | ||
|
||
#ifndef CSL_MBED_H | ||
#define CSL_MBED_H | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/*****************************************************************************/ | ||
/* Constants */ | ||
/*****************************************************************************/ | ||
#define RDA_EXT_INT_MAC_HW_INDEX 8 | ||
#define RDA_EXT_INT_MAC_HW_PRI 0x80 | ||
|
||
/*****************************************************************************/ | ||
/* Enums */ | ||
/*****************************************************************************/ | ||
typedef enum { | ||
MACLIB_EVENT_PEND = 0, | ||
MACLIB_EVENT_PROCESS = 1, | ||
MACLIB_EVENT_CLEANUP = 2 | ||
} MACLIB_EVENT_HANDLE_T; | ||
|
||
/*****************************************************************************/ | ||
/* Data Types */ | ||
/*****************************************************************************/ | ||
typedef struct | ||
{ | ||
unsigned int ml_id; /* Buffer identification */ | ||
unsigned char* ml_data; /* Pkt start address */ | ||
unsigned short ml_len; /* Pkt length */ | ||
} maclib_buf_t; | ||
|
||
/* Structure that contains functions provided by MACLib */ | ||
typedef struct { | ||
/* Initialize MAC Library, input param: mbed_reg_func_t *reg_funcs */ | ||
int (*ml_init)(void *reg_funcs); | ||
|
||
/* As a peroid task to process MAC Library background event */ | ||
void (*ml_tasklet)(void); | ||
|
||
/* Get a new packet buffer, output param: maclib_buf_t *buf */ | ||
void (*ml_get_pkt_buf)(void *buf); | ||
|
||
/* Mbed stack send packet to MAC Library, input param: maclib_buf_t *buf*/ | ||
int (*ml_xmit_pkt)(void *buf); | ||
|
||
/* Mbed receive and processing packet done, input param: unsigned int buf_id */ | ||
void (*ml_recv_pkt_comp)(unsigned int buf_id); | ||
} maclib_func_t; | ||
|
||
/* Structure that contains functions provided by MbedOS */ | ||
typedef struct { | ||
/* MAC Library send packet to mbed stack, input param: maclib_buf_t *buf */ | ||
void (*mbed_recv_pkt)(void *buf); | ||
|
||
/* Critical section start realized in mbed */ | ||
void (*mbed_critical_sec_start)(void); | ||
|
||
/* Critical section end realized in mbed */ | ||
void (*mbed_critical_sec_end)(void); | ||
|
||
/* Create interrupt in mbed, input param: vector/priority/isr(function), */ | ||
/* return: interrupt handle, non-zero is valid */ | ||
void * (*mbed_create_interrupt)(unsigned int vec, unsigned int pri, void *isr); | ||
|
||
/* Delete interrupt in mbed, input param: vector */ | ||
void (*mbed_delete_interrupt)(unsigned int vec); | ||
|
||
/* Enable interrupt in mbed, input param: vector */ | ||
void (*mbed_enable_interrupt)(unsigned int vec); | ||
|
||
/* Disable interrupt in mbed, input param: vector */ | ||
void (*mbed_disable_interrupt)(unsigned int vec); | ||
|
||
/* Get current time realized in mbed, return time in units of micro second */ | ||
unsigned long (*mbed_get_cur_time_ms)(void); | ||
|
||
/* Create alarm in mbed, input param: func(callback)/data(pass to func), */ | ||
/* return: alarm handle, non-zero is valid */ | ||
void * (*mbed_create_alarm)(void *func, unsigned int data); | ||
|
||
/* Delete alarm in mbed, input param: alarm handle */ | ||
void (*mbed_delete_alarm)(void **handle); | ||
|
||
/* Start alarm in mbed, input param: alarm handle/timeout(micro second) */ | ||
void (*mbed_start_alarm)(void *handle, unsigned int timeout_ms); | ||
|
||
/* Stop alarm in mbed, input param: alarm handle */ | ||
void (*mbed_stop_alarm)(void *handle); | ||
|
||
#if defined(MBED_MUTEX_INTERFACE) | ||
/* Create mutex */ | ||
void (*mbed_mutex_create)(void); | ||
|
||
/* Delete mutex */ | ||
unsigned int (*mbed_mutex_delete)(void *rdamutex); | ||
|
||
/* Wait mutex, timer unit : millisec */ | ||
unsigned int (*mbed_mutex_wait)(void *rdamutex, unsigned int millisec); | ||
|
||
/* Release mutex */ | ||
unsigned int (*mbed_mutex_release)(void *rdamutex); | ||
#endif /* MBED_MUTEX_INTERFACE */ | ||
|
||
/* Event post/get callback function, input param: event_type */ | ||
void (*mbed_event_hdl_cb)(unsigned int event); | ||
|
||
/* maclib task sleep callback function */ | ||
void (*mbed_task_sleep_cb)(void); | ||
|
||
/* maclib task wakeup callback function */ | ||
void (*mbed_task_wakeup_cb)(void); | ||
} maclib_import_func_t; | ||
|
||
/*****************************************************************************/ | ||
/* Extern Function Declarations */ | ||
/*****************************************************************************/ | ||
extern void maclib_get_funcs_struct(maclib_func_t *func_str); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* CSL_MBED_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#ifndef _WLAND_DBG_H_ | ||
#define _WLAND_DBG_H_ | ||
#include <stdio.h> | ||
#include "rda5991h_wland.h" | ||
#include "wland_types.h" | ||
|
||
extern int wland_dbg_dump; | ||
extern int wland_dbg_level; | ||
|
||
#define RDA_WLAND_DBG | ||
|
||
#ifdef RDA_WLAND_DBG | ||
#define WLAND_DBG(level, fmt, ...) do {\ | ||
int dbg_level = D_##level##_LEVEL;\ | ||
if((dbg_level <= wland_dbg_level)){\ | ||
printf("%s,"fmt, __func__, ##__VA_ARGS__);\ | ||
} \ | ||
} while (0) | ||
/* | ||
#define WLAND_ERR(fmt, ...) do {\ | ||
printf("[RDAWLAN_ERR]: " fmt, ##__VA_ARGS__);\ | ||
} while (0) | ||
*/ | ||
//if frmae_len is zero, get len from frame header | ||
static inline void wland_dump_frame(const char* msg, u8 *data, u32 frame_len) | ||
{ | ||
|
||
u32 len,i; | ||
|
||
if(wland_dbg_dump == 1){ | ||
if(frame_len != 0) | ||
len = frame_len; | ||
else | ||
len = data[0] | ((data[1]&0x0f) << 8); | ||
printf("%s : ",msg); | ||
for(i=0; i<len; i++) | ||
printf("%02x ", *(data+i)); | ||
printf("\r\nframe_len=%d\r\n", len); | ||
} | ||
return; | ||
} | ||
#else | ||
#define WLAND_DBG(level, fmt, ...) | ||
static inline void wland_dump_frame(const char* msg, u8 *data, u32 frame_len) | ||
{} | ||
#endif | ||
#endif /*_WLAND_DBG_H_*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#ifndef _WLAND_OTA_H_ | ||
#define _WLAND_OTA_H_ | ||
#include "wland_types.h" | ||
#include "rda_ccfg_api.h" | ||
|
||
extern u32 flash_size; | ||
|
||
#define CRC32_TABLE_ADDR 0xbb5c | ||
#define CRC32_ADDR 0x8dff//u32 crc32(const u8 *p, size_t len) | ||
|
||
#define CRC32_TABLE_ADDR_4 0xbbd8 | ||
#define CRC32_ADDR_4 0x8e33//u32 crc32(const u8 *p, size_t len) | ||
|
||
static inline unsigned int bootrom_crc32(unsigned char *p, unsigned int len) | ||
{ | ||
unsigned int func = CRC32_ADDR; | ||
if (rda_ccfg_hwver() >= 4) { | ||
func = CRC32_ADDR_4; | ||
} | ||
return ((unsigned int(*)(unsigned char *, unsigned int))func)(p, len); | ||
} | ||
|
||
#endif /*_WLAND_OTA_H_*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Oops, something went wrong.