24 #define AICE_PIPE_MAXLINE 8192
27 PROCESS_INFORMATION proc_info;
39 LOG_ERROR(
"(WIN32) write to pipe failed, error code: 0x%08l" PRIx32, GetLastError());
52 if (!success || (has_read == 0)) {
53 LOG_ERROR(
"(WIN32) read from pipe failed, error code: 0x%08l" PRIx32, GetLastError());
62 STARTUPINFO start_info;
65 ZeroMemory(&proc_info,
sizeof(PROCESS_INFORMATION));
66 ZeroMemory(&start_info,
sizeof(STARTUPINFO));
67 start_info.cb =
sizeof(STARTUPINFO);
71 start_info.dwFlags |= STARTF_USESTDHANDLES;
73 success = CreateProcess(
NULL,
120 SECURITY_ATTRIBUTES attribute;
122 attribute.nLength =
sizeof(SECURITY_ATTRIBUTES);
123 attribute.bInheritHandle = TRUE;
124 attribute.lpSecurityDescriptor =
NULL;
175 if ((n == -1) && (errno == EAGAIN)) {
177 if (cur - then > 500)
198 LOG_ERROR(
"Map aice_pipe to STDIN failed");
206 LOG_ERROR(
"Map aice_pipe to STDOUT failed");
263 LOG_ERROR(
"Register SIGPIPE handler failed");
276 }
else if (pid == 0) {
278 LOG_ERROR(
"AICE_PIPE child process initial error");
282 LOG_ERROR(
"AICE_PIPE parent process initial error");
307 WaitForSingleObject(proc_info.hProcess, INFINITE);
308 CloseHandle(proc_info.hProcess);
309 CloseHandle(proc_info.hThread);
329 *num_of_idcode = line[0];
331 if ((*num_of_idcode == 0) || (*num_of_idcode >= 16))
334 for (
int i = 0 ; i < *num_of_idcode ; i++)
335 idcode[i] =
get_u32(line + i * 4 + 1);
587 uint32_t remain_len =
length;
588 uint32_t prepare_len;
590 uint32_t received_len;
600 while (remain_len > 0) {
604 prepare_len = remain_len;
608 received_line = line;
610 read_len =
aice_pipe_read(received_line, prepare_len - received_len);
613 received_line += read_len;
614 received_len += read_len;
615 }
while (received_len < prepare_len);
621 memcpy(
buffer, line + 1, prepare_len);
622 remain_len -= prepare_len;
634 uint32_t remain_len =
length;
635 uint32_t written_len = 0;
652 while (remain_len > 0) {
656 write_len = remain_len;
670 remain_len -= write_len;
671 written_len += write_len;
796 *physical_address =
get_u32(line + 1);
static struct aice_port_param_s param
static int aice_pipe_parent_init(struct aice_port_param_s *param)
static int aice_pipe_open(struct aice_port_param_s *param)
static int aice_pipe_run(uint32_t coreid)
static int aice_pipe_read(void *buffer, int count)
static int aice_pipe_assert_srst(uint32_t coreid, enum aice_srst_type_s srst)
static int aice_pipe_close(void)
static void sig_pipe(int signo)
#define AICE_PIPE_MAXLINE
static int aice_pipe_idcode(uint32_t *idcode, uint8_t *num_of_idcode)
static int aice_pipe_step(uint32_t coreid)
static int aice_pipe_reset(void)
static int aice_pipe_halt(uint32_t coreid)
static int aice_pipe_write(const void *buffer, int count)
static int aice_pipe_write_debug_reg(uint32_t coreid, uint32_t addr, const uint32_t val)
static int aice_pipe_memory_mode(uint32_t coreid, enum nds_memory_select mem_select)
static int aice_pipe_input[2]
static int aice_pipe_read_tlb(uint32_t coreid, target_addr_t virtual_address, target_addr_t *physical_address)
static int aice_pipe_read_debug_reg(uint32_t coreid, uint32_t addr, uint32_t *val)
static int aice_pipe_write_reg_64(uint32_t coreid, uint32_t num, uint64_t val)
static int aice_pipe_write_reg(uint32_t coreid, uint32_t num, uint32_t val)
static int aice_pipe_memory_access(uint32_t coreid, enum nds_memory_access access_channel)
static int aice_pipe_write_mem_unit(uint32_t coreid, uint32_t addr, uint32_t size, uint32_t count, const uint8_t *buffer)
static int aice_pipe_state(uint32_t coreid, enum aice_target_state_s *state)
static int aice_pipe_output[2]
static int aice_pipe_read_mem_bulk(uint32_t coreid, uint32_t addr, uint32_t length, uint8_t *buffer)
static int aice_pipe_set_jtag_clock(uint32_t a_clock)
static int aice_pipe_child_init(struct aice_port_param_s *param)
static int aice_pipe_read_mem_unit(uint32_t coreid, uint32_t addr, uint32_t size, uint32_t count, uint8_t *buffer)
static int aice_pipe_set_retry_times(uint32_t a_retry_times)
static int aice_pipe_write_mem_bulk(uint32_t coreid, uint32_t addr, uint32_t length, const uint8_t *buffer)
static int aice_pipe_cache_ctl(uint32_t coreid, uint32_t subtype, uint32_t address)
static int aice_pipe_read_reg_64(uint32_t coreid, uint32_t num, uint64_t *val)
static int aice_pipe_read_reg(uint32_t coreid, uint32_t num, uint32_t *val)
struct aice_port_api_s aice_pipe
#define set_u16(buffer, value)
#define set_u32(buffer, value)
#define LOG_ERROR(expr ...)
size_t size
Size of the control block search area.
int(* open)(struct aice_port_param_s *param)