modify code standard

This commit is contained in:
Liu_Weichao 2021-04-29 16:39:24 +08:00
parent c86adeda94
commit ff2904ac26
13 changed files with 75 additions and 94 deletions

View File

@ -107,7 +107,7 @@ void PingEthernet()
printf("ATAdapterFind failed .\n"); printf("ATAdapterFind failed .\n");
printf("Waiting for msg...\n"); printf("Waiting for msg...\n");
struct ping_result result; struct PingResult result;
char *ip_str = "192.168.250.250"; char *ip_str = "192.168.250.250";
if (!opened){ if (!opened){
@ -131,7 +131,7 @@ void SetUpEthernet()
printf("ATAdapterFind failed .\n"); printf("ATAdapterFind failed .\n");
printf("Waiting for msg...\n"); printf("Waiting for msg...\n");
struct ping_result result; struct PingResult result;
if (!opened){ if (!opened){
opened = true; opened = true;

View File

@ -103,7 +103,7 @@ void PingWifi()
} }
printf("Waiting for msg...\n"); printf("Waiting for msg...\n");
struct ping_result result; struct PingResult result;
//www.baidu.com //www.baidu.com
char *ip_str = "36.152.44.95"; char *ip_str = "36.152.44.95";
@ -123,7 +123,7 @@ void SetUpWifi()
} }
printf("Waiting for msg...\n"); printf("Waiting for msg...\n");
struct ping_result result; struct PingResult result;
at_adapter->parent.done.NetAiitOpen(&at_adapter->parent); at_adapter->parent.done.NetAiitOpen(&at_adapter->parent);

View File

@ -240,7 +240,7 @@ __exit:
return result; return result;
} }
int EthernetPing(struct AdapterAT *adapterAT, const char *destination,struct ping_result *ping_resp) int EthernetPing(struct AdapterAT *adapterAT, const char *destination,struct PingResult *ping_resp)
{ {
char *ping_result = NONE; char *ping_result = NONE;
ping_result = (char *) UserCalloc(1, 17); ping_result = (char *) UserCalloc(1, 17);

View File

@ -43,9 +43,9 @@ struct Socket
{ {
uint8_t fd; uint8_t fd;
uint8_t status ; uint8_t status ;
struct ADDRESS_IPV4 src_ip; struct AddressIpv4 src_ip;
uint16_t src_port; uint16_t src_port;
struct ADDRESS_IPV4 dst_ip; struct AddressIpv4 dst_ip;
uint16_t dst_port; uint16_t dst_port;
uint8_t type; uint8_t type;
uint8_t af_type; uint8_t af_type;
@ -59,24 +59,24 @@ struct ATDone
int (*ATOperateUp)(struct AdapterAT *adapterAT); int (*ATOperateUp)(struct AdapterAT *adapterAT);
int (*ATOperateDown)(struct AdapterAT *adapterAT); int (*ATOperateDown)(struct AdapterAT *adapterAT);
int (*ATOperateAddr)(struct AdapterAT *adapterAT, uint ip, uint gateway, uint netmask); int (*ATOperateAddr)(struct AdapterAT *adapterAT, uint ip, uint gateway, uint netmask);
int (*ATOperateDns)(struct AdapterAT *adapterAT, struct ADDRESS_IPV4 *dns_addr, uint8 dns_count); int (*ATOperateDns)(struct AdapterAT *adapterAT, struct AddressIpv4 *dns_addr, uint8 dns_count);
int (*ATOperateDHCP)(struct AdapterAT *adapterAT, bool enable); int (*ATOperateDHCP)(struct AdapterAT *adapterAT, bool enable);
int (*ATPing)(struct AdapterAT *adapterAT, const char *destination, struct ping_result *ping_resp); int (*ATPing)(struct AdapterAT *adapterAT, const char *destination, struct PingResult *ping_resp);
int (*ATNetstat)(struct AdapterAT *adapterAT); int (*ATNetstat)(struct AdapterAT *adapterAT);
int (*ATOperateDefault)(struct AdapterAT *adapterAT); int (*ATOperateDefault)(struct AdapterAT *adapterAT);
int (*ATSocketCreate)(struct AdapterAT *adapterAT , uint8_t socket_fd , uint8_t type , uint8_t af_type ); int (*ATSocketCreate)(struct AdapterAT *adapterAT , uint8_t socket_fd , uint8_t type , uint8_t af_type );
int (*ATSocketConnect)(struct AdapterAT *adapterAT , uint8_t socket_fd , struct ADDRESS_IPV4 dst_ip , uint16_t dst_port, uint8 is_client); int (*ATSocketConnect)(struct AdapterAT *adapterAT , uint8_t socket_fd , struct AddressIpv4 dst_ip , uint16_t dst_port, uint8 is_client);
int (*ATSocketClose)(struct AdapterAT *adapterAT , uint8_t socket_fd ); int (*ATSocketClose)(struct AdapterAT *adapterAT , uint8_t socket_fd );
}; };
struct AdapterAT { struct AdapterAT {
struct Adapter parent; struct Adapter parent;
struct ATAgent *agent; struct ATAgent *agent;
struct ADDRESS_IPV4 ip; struct AddressIpv4 ip;
struct ADDRESS_IPV4 netmask; struct AddressIpv4 netmask;
struct ADDRESS_IPV4 gateway; struct AddressIpv4 gateway;
struct ADDRESS_IPV4 dns[DNS_COUNT]; struct AddressIpv4 dns[DNS_COUNT];
uint32 at_adapter_id; uint32 at_adapter_id;
struct Socket socket[SOCKET_MAX]; struct Socket socket[SOCKET_MAX];
uint8 hardware_address_len; uint8 hardware_address_len;
@ -84,7 +84,7 @@ struct AdapterAT {
uint16 flags; uint16 flags;
uint16 mtu; uint16 mtu;
void (*change_cb )(struct AdapterAT *adapterAT, enum cb_type type, enum change_type ch_type_); void (*change_cb )(struct AdapterAT *adapterAT, enum CbType type, enum ChangeType ch_type_);
struct ATDone atdone; struct ATDone atdone;

View File

@ -42,7 +42,7 @@ int EthernetReceive(struct Adapter *padapter, char *rev_buffer, int buffer_len,
int EthernetSetUp(struct AdapterAT *adapterAT); int EthernetSetUp(struct AdapterAT *adapterAT);
int EthernetDHCP(struct AdapterAT *adapterAT, bool enable); int EthernetDHCP(struct AdapterAT *adapterAT, bool enable);
int EthernetPing(struct AdapterAT *adapterAT, const char *destination, struct ping_result *ping_resp); int EthernetPing(struct AdapterAT *adapterAT, const char *destination, struct PingResult *ping_resp);
int EthernetNetstat(struct AdapterAT *adapterAT); int EthernetNetstat(struct AdapterAT *adapterAT);
#endif #endif

View File

@ -44,7 +44,7 @@ int WifiSetUp(struct AdapterAT *adapter_at);
int WifiSetDown(struct AdapterAT *adapter_at); int WifiSetDown(struct AdapterAT *adapter_at);
int WifiSetAddr(struct AdapterAT *adapter_at, uint ip, uint gateway, uint netmask); int WifiSetAddr(struct AdapterAT *adapter_at, uint ip, uint gateway, uint netmask);
int WifiDHCP(struct AdapterAT *adapter_at, bool enable); int WifiDHCP(struct AdapterAT *adapter_at, bool enable);
int WifiPing(struct AdapterAT *adapter_at, const char *destination,struct ping_result *ping_resp); int WifiPing(struct AdapterAT *adapter_at, const char *destination,struct PingResult *ping_resp);
int WifiNetstat(struct AdapterAT *adapter_at); int WifiNetstat(struct AdapterAT *adapter_at);
#endif #endif

View File

@ -31,7 +31,7 @@ typedef void(*send_success)(void* param);
#define DNS_COUNT 2U #define DNS_COUNT 2U
#define HW_MAX 8U #define HW_MAX 8U
enum cb_type enum CbType
{ {
CB_ADDR_IP, /* IP address */ CB_ADDR_IP, /* IP address */
CB_ADDR_NETMASK, /* subnet mask */ CB_ADDR_NETMASK, /* subnet mask */
@ -47,24 +47,24 @@ enum cb_type
CB_STATUS_DHCP_DISABLE, /* disable DHCP capability */ CB_STATUS_DHCP_DISABLE, /* disable DHCP capability */
}; };
enum change_type enum ChangeType
{ {
addr_change, ADDR_CHANGE,
status_change, STATUS_CHANGE,
}; };
struct ADDRESS_IPV4 struct AddressIpv4
{ {
uint32 ipv4; uint32 ipv4;
}; };
struct ping_result struct PingResult
{ {
struct ADDRESS_IPV4 ip_addr; /* response IP address */ struct AddressIpv4 ip_addr; /* response IP address */
uint16 data_len; /* response data length */ uint16 data_len; /* response data length */
uint16 ttl; /* time to live */ uint16 ttl; /* time to live */
uint32 ticks; /* response time, unit tick */ uint32 ticks; /* response time, unit tick */
void *UserData; /* user-specific data */ void *user_data; /* user-specific data */
}; };
#define ETHERNET_ADAPTER_ID 0x03U #define ETHERNET_ADAPTER_ID 0x03U

View File

@ -304,7 +304,7 @@ __exit:
return result; return result;
} }
int WifiPing(struct AdapterAT *adapter_at, const char *destination,struct ping_result *ping_resp) int WifiPing(struct AdapterAT *adapter_at, const char *destination,struct PingResult *ping_resp)
{ {
char *ping_result = NONE; char *ping_result = NONE;
char *dst = NONE; char *dst = NONE;

View File

@ -36,25 +36,6 @@
extern "C" { extern "C" {
#endif #endif
enum dev
{
Dev_TYPE_Block,
Dev_TYPE_Char ,
Dev_TYPE_CAN ,
Dev_TYPE_Graphic,
Dev_TYPE_I2CBUS,
Dev_TYPE_Miscellaneous,
Dev_TYPE_NetIf ,
Dev_TYPE_RTC ,
Dev_TYPE_SPIBUS,
Dev_TYPE_SPIDevice,
Dev_TYPE_Timer,
Dev_TYPE_Touch,
Dev_TYPE_USBDevice,
Dev_TYPE_USBHost,
Dev_TYPE_Unknown
};
#define OSIGN_OPER_CLOSE (0U << 0) #define OSIGN_OPER_CLOSE (0U << 0)
#define OSIGN_OPER_RDONLY (1U << 0) #define OSIGN_OPER_RDONLY (1U << 0)
#define OSIGN_OPER_WRONLY (1U << 1) #define OSIGN_OPER_WRONLY (1U << 1)

View File

@ -453,7 +453,7 @@ static struct DynamicBuddyMemoryDone DynamicDone = {
/** /**
* This function initializes the static segment struction. * This function initializes the static segment struction.
* *
* @param StaticSegment the StaticSegment to be initialized * @param static_segment the static_segment to be initialized
*/ */
static void SmallMemInit(struct ByteMemory *byte_memory) static void SmallMemInit(struct ByteMemory *byte_memory)
{ {
@ -520,28 +520,28 @@ static void SmallMemInit(struct ByteMemory *byte_memory)
*/ */
static void SmallMemFree(void *pointer) static void SmallMemFree(void *pointer)
{ {
struct segment *StaticSegment = NONE; struct segment *static_segment = NONE;
struct DynamicAllocNode *node = NONE; struct DynamicAllocNode *node = NONE;
NULL_PARAM_CHECK(pointer); NULL_PARAM_CHECK(pointer);
/* get the allocNode */ /* get the allocNode */
node = PTR2ALLOCNODE((char*)pointer-SIZEOF_DYNAMICALLOCNODE_MEM); node = PTR2ALLOCNODE((char*)pointer-SIZEOF_DYNAMICALLOCNODE_MEM);
StaticSegment = (struct segment*)(x_size_t)node->size; static_segment = (struct segment*)(x_size_t)node->size;
/* update the statistic information of StaticSegment */ /* update the statistic information of static_segment */
node->size = (x_size_t)StaticSegment->freelist; node->size = (x_size_t)static_segment->freelist;
StaticSegment->freelist = (uint8 *)node; static_segment->freelist = (uint8 *)node;
StaticSegment->block_free_count++; static_segment->block_free_count++;
/* parameter detection */ /* parameter detection */
CHECK(StaticSegment->block_free_count <= StaticSegment->block_total_count); CHECK(static_segment->block_free_count <= static_segment->block_total_count);
} }
/** /**
* This funcation allocates a static memory block from static segment. * This funcation allocates a static memory block from static segment.
* *
* @param StaticSegment the heart static segment structure to allocate static memory * @param static_segment the heart static segment structure to allocate static memory
* @param size the size to be allocated * @param size the size to be allocated
* *
* @return pointer address on success; NULL on failure * @return pointer address on success; NULL on failure
@ -550,26 +550,26 @@ static void *SmallMemMalloc(struct ByteMemory *byte_memory, x_size_t size)
{ {
void *result = NONE; void *result = NONE;
struct DynamicAllocNode *node = NONE; struct DynamicAllocNode *node = NONE;
struct segment *StaticSegment = NONE; struct segment *static_segment = NONE;
NULL_PARAM_CHECK(byte_memory); NULL_PARAM_CHECK(byte_memory);
if (size == SIZEOF_32B) if (size == SIZEOF_32B)
StaticSegment = &byte_memory->static_manager[0]; static_segment = &byte_memory->static_manager[0];
else else
StaticSegment = &byte_memory->static_manager[1]; static_segment = &byte_memory->static_manager[1];
/* current static segment has free static memory block */ /* current static segment has free static memory block */
if(StaticSegment->block_free_count>0) { if(static_segment->block_free_count>0) {
/* get the head static memory block */ /* get the head static memory block */
result = StaticSegment->freelist; result = static_segment->freelist;
node = PTR2ALLOCNODE(StaticSegment->freelist); node = PTR2ALLOCNODE(static_segment->freelist);
node->prev_adj_size = STATIC_BLOCK_MASK; node->prev_adj_size = STATIC_BLOCK_MASK;
/* update the statistic information of static segment */ /* update the statistic information of static segment */
StaticSegment->freelist = (uint8 *)(long)(node->size); static_segment->freelist = (uint8 *)(long)(node->size);
StaticSegment->block_free_count--; static_segment->block_free_count--;
node->size = (long)StaticSegment; node->size = (long)static_segment;
} }
if(result) { if(result) {
@ -727,7 +727,7 @@ void x_free(void *pointer)
node = PTR2ALLOCNODE((char*)pointer-SIZEOF_DYNAMICALLOCNODE_MEM); node = PTR2ALLOCNODE((char*)pointer-SIZEOF_DYNAMICALLOCNODE_MEM);
CHECK(ByteManager.done->JudgeAllocated(node)); CHECK(ByteManager.done->JudgeAllocated(node));
/* judge release the memory block ro StaticSegment or dynamic buddy memory */ /* judge release the memory block ro static_segment or dynamic buddy memory */
#ifdef KERNEL_SMALL_MEM_ALLOC #ifdef KERNEL_SMALL_MEM_ALLOC
if(node->prev_adj_size & STATIC_BLOCK_MASK) { if(node->prev_adj_size & STATIC_BLOCK_MASK) {
ByteManager.static_manager->done->release(pointer); ByteManager.static_manager->done->release(pointer);

View File

@ -50,15 +50,15 @@ int32 JudgeAssignReadyBitmapIsEmpty(struct OsAssignReadyVector *ready_vector)
struct TaskDescriptor * ChooseTaskWithHighestPrio(struct OsAssignReadyVector *ready_vector) struct TaskDescriptor * ChooseTaskWithHighestPrio(struct OsAssignReadyVector *ready_vector)
{ {
struct TaskDescriptor *TargetTask = NONE; struct TaskDescriptor *target_task = NONE;
NULL_PARAM_CHECK(ready_vector); NULL_PARAM_CHECK(ready_vector);
TargetTask = SYS_DOUBLE_LINKLIST_ENTRY(ready_vector->priority_ready_vector[ready_vector->highest_prio].node_next, target_task = SYS_DOUBLE_LINKLIST_ENTRY(ready_vector->priority_ready_vector[ready_vector->highest_prio].node_next,
struct TaskDescriptor, struct TaskDescriptor,
task_dync_sched_member.sched_link); task_dync_sched_member.sched_link);
return TargetTask; return target_task;
} }
void OsAssignReadyVectorInit(struct OsAssignReadyVector *ready_vector) void OsAssignReadyVectorInit(struct OsAssignReadyVector *ready_vector)

View File

@ -67,11 +67,11 @@ typedef enum
typedef enum typedef enum
{ {
SD_Respone_1 = 1, SD_RESPONE_1 = 1,
SD_Respone_1b, SD_RESPONE_1B,
SD_Respone_2, SD_RESPONE_2,
SD_Respone_3, SD_RESPONE_3,
SD_Respone_7, SD_RESPONE_7,
}SdRespone; }SdRespone;
struct SdCmdParam struct SdCmdParam

View File

@ -102,10 +102,10 @@ static uint32 SdSendCmdByte(SpiSdDeviceType spi_sd_dev, struct SdCmdParam *sd_cm
switch (sd_cmd_param->sd_respone_type) switch (sd_cmd_param->sd_respone_type)
{ {
case SD_Respone_1 : case SD_RESPONE_1 :
sd_cmd_param->sd_respone_data[0] = read[0]; sd_cmd_param->sd_respone_data[0] = read[0];
return EOK; return EOK;
case SD_Respone_1b : case SD_RESPONE_1B :
sd_cmd_param->sd_respone_data[0] = read[0]; sd_cmd_param->sd_respone_data[0] = read[0];
start_time = 0; start_time = 0;
@ -119,7 +119,7 @@ static uint32 SdSendCmdByte(SpiSdDeviceType spi_sd_dev, struct SdCmdParam *sd_cm
}while(0xFF != read_byte); }while(0xFF != read_byte);
return EOK; return EOK;
case SD_Respone_2 : case SD_RESPONE_2 :
sd_cmd_param->sd_respone_data[0] = read[0]; sd_cmd_param->sd_respone_data[0] = read[0];
read_param.buffer = (void *)&read_byte; read_param.buffer = (void *)&read_byte;
@ -129,8 +129,8 @@ static uint32 SdSendCmdByte(SpiSdDeviceType spi_sd_dev, struct SdCmdParam *sd_cm
sd_cmd_param->sd_respone_data[1] = read_byte; sd_cmd_param->sd_respone_data[1] = read_byte;
return EOK; return EOK;
case SD_Respone_3 : case SD_RESPONE_3 :
case SD_Respone_7 : case SD_RESPONE_7 :
sd_cmd_param->sd_respone_data[0] = read[0]; sd_cmd_param->sd_respone_data[0] = read[0];
read_param.buffer = (void *)&read; read_param.buffer = (void *)&read;
@ -204,7 +204,7 @@ static uint32 SdHwInit(SpiSdDeviceType spi_sd_dev)
g_sd_cmd_param.sd_cmd_type = SD_CMD_0; g_sd_cmd_param.sd_cmd_type = SD_CMD_0;
g_sd_cmd_param.sd_cmd_args = 0x00; g_sd_cmd_param.sd_cmd_args = 0x00;
g_sd_cmd_param.sd_cmd_crc = 0x95; g_sd_cmd_param.sd_cmd_crc = 0x95;
g_sd_cmd_param.sd_respone_type = SD_Respone_1; g_sd_cmd_param.sd_respone_type = SD_RESPONE_1;
start_time = 0; start_time = 0;
@ -238,7 +238,7 @@ static uint32 SdConfirmType(SpiSdDeviceType spi_sd_dev)
g_sd_cmd_param.sd_cmd_type = SD_CMD_8; g_sd_cmd_param.sd_cmd_type = SD_CMD_8;
g_sd_cmd_param.sd_cmd_args = 0x01AA; g_sd_cmd_param.sd_cmd_args = 0x01AA;
g_sd_cmd_param.sd_cmd_crc = 0x87; g_sd_cmd_param.sd_cmd_crc = 0x87;
g_sd_cmd_param.sd_respone_type = SD_Respone_7; g_sd_cmd_param.sd_respone_type = SD_RESPONE_7;
start_time = 0; start_time = 0;
@ -290,7 +290,7 @@ static uint32 SdHwReset(SpiSdDeviceType spi_sd_dev)
g_sd_cmd_param.sd_cmd_type = SD_CMD_55; g_sd_cmd_param.sd_cmd_type = SD_CMD_55;
g_sd_cmd_param.sd_cmd_args = 0x00; g_sd_cmd_param.sd_cmd_args = 0x00;
g_sd_cmd_param.sd_cmd_crc = 0x65; g_sd_cmd_param.sd_cmd_crc = 0x65;
g_sd_cmd_param.sd_respone_type = SD_Respone_1; g_sd_cmd_param.sd_respone_type = SD_RESPONE_1;
/*pull down the cs pin*/ /*pull down the cs pin*/
SpiDevConfigureCs(&spi_sd_dev->spi_dev->haldev, 1, 0); SpiDevConfigureCs(&spi_sd_dev->spi_dev->haldev, 1, 0);
@ -308,7 +308,7 @@ static uint32 SdHwReset(SpiSdDeviceType spi_sd_dev)
g_sd_cmd_param.sd_cmd_type = SD_ACMD_41; g_sd_cmd_param.sd_cmd_type = SD_ACMD_41;
g_sd_cmd_param.sd_cmd_args = 0x40000000; g_sd_cmd_param.sd_cmd_args = 0x40000000;
g_sd_cmd_param.sd_cmd_crc = 0x77; g_sd_cmd_param.sd_cmd_crc = 0x77;
g_sd_cmd_param.sd_respone_type = SD_Respone_1; g_sd_cmd_param.sd_respone_type = SD_RESPONE_1;
ret = SdSendCmdByte(spi_sd_dev, &g_sd_cmd_param); ret = SdSendCmdByte(spi_sd_dev, &g_sd_cmd_param);
if (EOK != ret) { if (EOK != ret) {
@ -325,7 +325,7 @@ static uint32 SdHwReset(SpiSdDeviceType spi_sd_dev)
g_sd_cmd_param.sd_cmd_type = SD_CMD_58; g_sd_cmd_param.sd_cmd_type = SD_CMD_58;
g_sd_cmd_param.sd_cmd_args = 0x00; g_sd_cmd_param.sd_cmd_args = 0x00;
g_sd_cmd_param.sd_cmd_crc = 0x00; g_sd_cmd_param.sd_cmd_crc = 0x00;
g_sd_cmd_param.sd_respone_type = SD_Respone_3; g_sd_cmd_param.sd_respone_type = SD_RESPONE_3;
/*pull down the cs pin*/ /*pull down the cs pin*/
SpiDevConfigureCs(&spi_sd_dev->spi_dev->haldev, 1, 0); SpiDevConfigureCs(&spi_sd_dev->spi_dev->haldev, 1, 0);
@ -362,7 +362,7 @@ static uint32 SdHwReset(SpiSdDeviceType spi_sd_dev)
g_sd_cmd_param.sd_cmd_type = SD_CMD_55; g_sd_cmd_param.sd_cmd_type = SD_CMD_55;
g_sd_cmd_param.sd_cmd_args = 0x00; g_sd_cmd_param.sd_cmd_args = 0x00;
g_sd_cmd_param.sd_cmd_crc = 0x65; g_sd_cmd_param.sd_cmd_crc = 0x65;
g_sd_cmd_param.sd_respone_type = SD_Respone_1; g_sd_cmd_param.sd_respone_type = SD_RESPONE_1;
/*pull down the cs pin*/ /*pull down the cs pin*/
SpiDevConfigureCs(&spi_sd_dev->spi_dev->haldev, 1, 0); SpiDevConfigureCs(&spi_sd_dev->spi_dev->haldev, 1, 0);
@ -381,7 +381,7 @@ static uint32 SdHwReset(SpiSdDeviceType spi_sd_dev)
g_sd_cmd_param.sd_cmd_type = SD_ACMD_41; g_sd_cmd_param.sd_cmd_type = SD_ACMD_41;
g_sd_cmd_param.sd_cmd_args = 0x40000000; g_sd_cmd_param.sd_cmd_args = 0x40000000;
g_sd_cmd_param.sd_cmd_crc = 0x77; g_sd_cmd_param.sd_cmd_crc = 0x77;
g_sd_cmd_param.sd_respone_type = SD_Respone_1; g_sd_cmd_param.sd_respone_type = SD_RESPONE_1;
ret = SdSendCmdByte(spi_sd_dev, &g_sd_cmd_param); ret = SdSendCmdByte(spi_sd_dev, &g_sd_cmd_param);
if (EOK != ret) { if (EOK != ret) {
@ -417,7 +417,7 @@ static uint32 SdHwReset(SpiSdDeviceType spi_sd_dev)
g_sd_cmd_param.sd_cmd_type = SD_CMD_1; g_sd_cmd_param.sd_cmd_type = SD_CMD_1;
g_sd_cmd_param.sd_cmd_args = 0x00; g_sd_cmd_param.sd_cmd_args = 0x00;
g_sd_cmd_param.sd_cmd_crc = 0x00; g_sd_cmd_param.sd_cmd_crc = 0x00;
g_sd_cmd_param.sd_respone_type = SD_Respone_1; g_sd_cmd_param.sd_respone_type = SD_RESPONE_1;
/*pull down the cs pin*/ /*pull down the cs pin*/
SpiDevConfigureCs(&spi_sd_dev->spi_dev->haldev, 1, 0); SpiDevConfigureCs(&spi_sd_dev->spi_dev->haldev, 1, 0);
@ -452,7 +452,7 @@ static uint32 SdHwSetBlockLength(SpiSdDeviceType spi_sd_dev)
g_sd_cmd_param.sd_cmd_type = SD_CMD_16; g_sd_cmd_param.sd_cmd_type = SD_CMD_16;
g_sd_cmd_param.sd_cmd_args = SD_BLOCK_LENGTH; g_sd_cmd_param.sd_cmd_args = SD_BLOCK_LENGTH;
g_sd_cmd_param.sd_cmd_crc = 0x00; g_sd_cmd_param.sd_cmd_crc = 0x00;
g_sd_cmd_param.sd_respone_type = SD_Respone_1; g_sd_cmd_param.sd_respone_type = SD_RESPONE_1;
/*pull down the cs pin*/ /*pull down the cs pin*/
SpiDevConfigureCs(&spi_sd_dev->spi_dev->haldev, 1, 0); SpiDevConfigureCs(&spi_sd_dev->spi_dev->haldev, 1, 0);
@ -674,7 +674,7 @@ static uint32 SdHwReadCSD(SpiSdDeviceType spi_sd_dev)
g_sd_cmd_param.sd_cmd_type = SD_CMD_9; g_sd_cmd_param.sd_cmd_type = SD_CMD_9;
g_sd_cmd_param.sd_cmd_args = 0x00; g_sd_cmd_param.sd_cmd_args = 0x00;
g_sd_cmd_param.sd_cmd_crc = 0x00; g_sd_cmd_param.sd_cmd_crc = 0x00;
g_sd_cmd_param.sd_respone_type = SD_Respone_2; g_sd_cmd_param.sd_respone_type = SD_RESPONE_2;
/*pull down the cs pin*/ /*pull down the cs pin*/
SpiDevConfigureCs(&spi_sd_dev->spi_dev->haldev, 1, 0); SpiDevConfigureCs(&spi_sd_dev->spi_dev->haldev, 1, 0);
@ -754,7 +754,7 @@ static uint32 SdReadSingleBlock(SpiSdDeviceType spi_sd_dev, uint32 id, uint8 *re
g_sd_cmd_param.sd_cmd_args = id * spi_sd_dev->sd_param.block_param.block_size; g_sd_cmd_param.sd_cmd_args = id * spi_sd_dev->sd_param.block_param.block_size;
} }
g_sd_cmd_param.sd_cmd_crc = 0x00; g_sd_cmd_param.sd_cmd_crc = 0x00;
g_sd_cmd_param.sd_respone_type = SD_Respone_1; g_sd_cmd_param.sd_respone_type = SD_RESPONE_1;
/*pull down the cs pin*/ /*pull down the cs pin*/
SpiDevConfigureCs(&spi_sd_dev->spi_dev->haldev, 1, 0); SpiDevConfigureCs(&spi_sd_dev->spi_dev->haldev, 1, 0);
@ -823,7 +823,7 @@ static uint32 SdReadMultiBlock(SpiSdDeviceType spi_sd_dev, uint32 id, const uint
g_sd_cmd_param.sd_cmd_args = id * spi_sd_dev->sd_param.block_param.block_size; g_sd_cmd_param.sd_cmd_args = id * spi_sd_dev->sd_param.block_param.block_size;
} }
g_sd_cmd_param.sd_cmd_crc = 0x00; g_sd_cmd_param.sd_cmd_crc = 0x00;
g_sd_cmd_param.sd_respone_type = SD_Respone_1; g_sd_cmd_param.sd_respone_type = SD_RESPONE_1;
/*pull down the cs pin*/ /*pull down the cs pin*/
SpiDevConfigureCs(&spi_sd_dev->spi_dev->haldev, 1, 0); SpiDevConfigureCs(&spi_sd_dev->spi_dev->haldev, 1, 0);
@ -876,7 +876,7 @@ static uint32 SdReadMultiBlock(SpiSdDeviceType spi_sd_dev, uint32 id, const uint
g_sd_cmd_param.sd_cmd_type = SD_CMD_12; g_sd_cmd_param.sd_cmd_type = SD_CMD_12;
g_sd_cmd_param.sd_cmd_args = 0x00; g_sd_cmd_param.sd_cmd_args = 0x00;
g_sd_cmd_param.sd_cmd_crc = 0x00; g_sd_cmd_param.sd_cmd_crc = 0x00;
g_sd_cmd_param.sd_respone_type = SD_Respone_1b; g_sd_cmd_param.sd_respone_type = SD_RESPONE_1B;
ret = SdSendCmdByte(spi_sd_dev, &g_sd_cmd_param); ret = SdSendCmdByte(spi_sd_dev, &g_sd_cmd_param);
if (EOK != ret) { if (EOK != ret) {
@ -908,7 +908,7 @@ static uint32 SdWriteSingleBlock(SpiSdDeviceType spi_sd_dev, uint32 id, const ui
g_sd_cmd_param.sd_cmd_args = id * spi_sd_dev->sd_param.block_param.block_size; g_sd_cmd_param.sd_cmd_args = id * spi_sd_dev->sd_param.block_param.block_size;
} }
g_sd_cmd_param.sd_cmd_crc = 0x00; g_sd_cmd_param.sd_cmd_crc = 0x00;
g_sd_cmd_param.sd_respone_type = SD_Respone_1; g_sd_cmd_param.sd_respone_type = SD_RESPONE_1;
/*pull down the cs pin*/ /*pull down the cs pin*/
SpiDevConfigureCs(&spi_sd_dev->spi_dev->haldev, 1, 0); SpiDevConfigureCs(&spi_sd_dev->spi_dev->haldev, 1, 0);
@ -986,7 +986,7 @@ static uint32 SdWriteMultiBlock(SpiSdDeviceType spi_sd_dev, uint32 id, const voi
g_sd_cmd_param.sd_cmd_type = SD_CMD_55; g_sd_cmd_param.sd_cmd_type = SD_CMD_55;
g_sd_cmd_param.sd_cmd_args = 0x00; g_sd_cmd_param.sd_cmd_args = 0x00;
g_sd_cmd_param.sd_cmd_crc = 0x00; g_sd_cmd_param.sd_cmd_crc = 0x00;
g_sd_cmd_param.sd_respone_type = SD_Respone_1; g_sd_cmd_param.sd_respone_type = SD_RESPONE_1;
ret = SdSendCmdByte(spi_sd_dev, &g_sd_cmd_param); ret = SdSendCmdByte(spi_sd_dev, &g_sd_cmd_param);
if (EOK != ret) { if (EOK != ret) {
@ -1002,7 +1002,7 @@ static uint32 SdWriteMultiBlock(SpiSdDeviceType spi_sd_dev, uint32 id, const voi
g_sd_cmd_param.sd_cmd_type = SD_ACMD_23; g_sd_cmd_param.sd_cmd_type = SD_ACMD_23;
g_sd_cmd_param.sd_cmd_args = block_num; g_sd_cmd_param.sd_cmd_args = block_num;
g_sd_cmd_param.sd_cmd_crc = 0x00; g_sd_cmd_param.sd_cmd_crc = 0x00;
g_sd_cmd_param.sd_respone_type = SD_Respone_1; g_sd_cmd_param.sd_respone_type = SD_RESPONE_1;
ret = SdSendCmdByte(spi_sd_dev, &g_sd_cmd_param); ret = SdSendCmdByte(spi_sd_dev, &g_sd_cmd_param);
if (EOK != ret) { if (EOK != ret) {
@ -1023,7 +1023,7 @@ static uint32 SdWriteMultiBlock(SpiSdDeviceType spi_sd_dev, uint32 id, const voi
g_sd_cmd_param.sd_cmd_args = id * spi_sd_dev->sd_param.block_param.block_size; g_sd_cmd_param.sd_cmd_args = id * spi_sd_dev->sd_param.block_param.block_size;
} }
g_sd_cmd_param.sd_cmd_crc = 0x00; g_sd_cmd_param.sd_cmd_crc = 0x00;
g_sd_cmd_param.sd_respone_type = SD_Respone_1; g_sd_cmd_param.sd_respone_type = SD_RESPONE_1;
start_time = 0; start_time = 0;
do do