Change in osmo-ccid-firmware[master]: CICD: Add ccid_proto.c with value_string of important enumerations

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed May 15 18:26:32 UTC 2019


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/14052 )

Change subject: CICD: Add ccid_proto.c with value_string of important enumerations
......................................................................

CICD: Add ccid_proto.c with value_string of important enumerations

Change-Id: Idc6b3d2f0a22db3a57f0c05d96c776e92b718b07
---
M ccid/Makefile
A ccid/ccid_proto.c
M ccid/ccid_proto.h
3 files changed, 77 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/ccid/Makefile b/ccid/Makefile
index 34df8c9..a259c90 100644
--- a/ccid/Makefile
+++ b/ccid/Makefile
@@ -1,6 +1,6 @@
 
 
-ccid_descriptors: ccid_descriptors.o
+ccid_descriptors: ccid_descriptors.o ccid_proto.o
 	$(CC) -lasan -losmocore -laio -o $@ $^
 
 %.o: %.c
diff --git a/ccid/ccid_proto.c b/ccid/ccid_proto.c
new file mode 100644
index 0000000..9275cf2
--- /dev/null
+++ b/ccid/ccid_proto.c
@@ -0,0 +1,67 @@
+#include <osmocom/core/utils.h>
+#include "ccid_proto.h"
+
+const struct value_string ccid_msg_type_vals[] = {
+	OSMO_VALUE_STRING(RDR_to_PC_NotifySlotChange),
+	OSMO_VALUE_STRING(RDR_to_PC_HardwareError),
+	OSMO_VALUE_STRING(PC_to_RDR_IccPowerOn),
+	OSMO_VALUE_STRING(PC_to_RDR_IccPowerOff),
+	OSMO_VALUE_STRING(PC_to_RDR_GetSlotStatus),
+	OSMO_VALUE_STRING(PC_to_RDR_XfrBlock),
+	OSMO_VALUE_STRING(PC_to_RDR_GetParameters),
+	OSMO_VALUE_STRING(PC_to_RDR_ResetParameters),
+	OSMO_VALUE_STRING(PC_to_RDR_SetParameters),
+	OSMO_VALUE_STRING(PC_to_RDR_Escape),
+	OSMO_VALUE_STRING(PC_to_RDR_IccClock),
+	OSMO_VALUE_STRING(PC_to_RDR_T0APDU),
+	OSMO_VALUE_STRING(PC_to_RDR_Secure),
+	OSMO_VALUE_STRING(PC_to_RDR_Mechanical),
+	OSMO_VALUE_STRING(PC_to_RDR_Abort),
+	OSMO_VALUE_STRING(PC_to_RDR_SetDataRateAndClockFrequency),
+	OSMO_VALUE_STRING(RDR_to_PC_DataBlock),
+	OSMO_VALUE_STRING(RDR_to_PC_SlotStatus),
+	OSMO_VALUE_STRING(RDR_to_PC_Escape),
+	OSMO_VALUE_STRING(RDR_to_PC_DataRateAndClockFrequency),
+	{ 0, NULL }
+};
+
+const struct value_string ccid_class_spec_req_vals[] = {
+	{ CLASS_SPEC_CCID_ABORT, "CCID_ABORT" },
+	{ CLASS_SPEC_CCID_GET_CLOCK_FREQ, "GET_CLOCK_FREQ" },
+	{ CLASS_SPEC_CCID_GET_DATA_RATES, "GET_DATA_RATES" },
+	{ 0, NULL }
+};
+
+const struct value_string ccid_power_select_vals[] = {
+	{ CCID_PWRSEL_AUTO, "AUTO" },
+	{ CCID_PWRSEL_5V0, "5.0V" },
+	{ CCID_PWRSEL_3V0, "3.0V" },
+	{ CCID_PWRSEL_1V8, "1.8V" },
+	{ 0, NULL }
+};
+
+const struct value_string ccid_clock_command_vals[] = {
+	{ CCID_CLOCK_CMD_RESTART, "RESTART" },
+	{ CCID_CLOCK_CMD_STOP, "STOP" },
+	{ 0, NULL }
+};
+
+const struct value_string ccid_error_code_vals[] = {
+	{ CCID_ERR_CMD_ABORTED, 		"CMD_ABORTED" },
+	{ CCID_ERR_ICC_MUTE,			"ICC_MUTE" },
+	{ CCID_ERR_XFR_PARITY_ERROR,		"XFR_PARITY_ERROR" },
+	{ CCID_ERR_XFR_OVERRUN,			"XFR_OVERRUN" },
+	{ CCID_ERR_HW_ERROR,			"HW_ERROR" },
+	{ CCID_ERR_BAD_ATR_TS,			"BAD_ATR_TS" },
+	{ CCID_ERR_BAD_ATR_TCK,			"BAD_ATR_TCK" },
+	{ CCID_ERR_ICC_PROTOCOL_NOT_SUPPORTED,	"ICC_PROTOCOL_NOT_SUPPORTED" },
+	{ CCID_ERR_ICC_CLASS_NOT_SUPPORTED,	"ICC_CLASS_NOT_SUPPORTED" },
+	{ CCID_ERR_PROCEDURE_BYTE_CONFLICT,	"PROCEDURE_BYTE_CONFLICT" },
+	{ CCID_ERR_DEACTIVATED_PROTOCOL,	"DEACTIVATED_PROTOCOL" },
+	{ CCID_ERR_BUSY_WITH_AUTO_SEQUENCE,	"BUSY_WITH_AUTO_SEQUENCE" },
+	{ CCID_ERR_PIN_TIMEOUT,			"PIN_TIMEOUT" },
+	{ CCID_ERR_PIN_CANCELLED,		"PIN_CANCELLED" },
+	{ CCID_ERR_CMD_SLOT_BUSY,		"CMD_SLOT_BUSY" },
+	{ CCID_ERR_CMD_NOT_SUPPORTED,		"CMD_NOT_SUPPORTED" },
+	{ 0, NULL }
+};
diff --git a/ccid/ccid_proto.h b/ccid/ccid_proto.h
index 470416c..e10be8a 100644
--- a/ccid/ccid_proto.h
+++ b/ccid/ccid_proto.h
@@ -1,5 +1,6 @@
 #pragma once
 #include <stdint.h>
+#include <osmocom/core/utils.h>
 
 /* Identifies the length of type of subordinate descriptors of a CCID device
  * Table 5.1-1 Smart Card Device Class descriptors */
@@ -372,3 +373,11 @@
 	struct ccid_rdr_to_pc_notify_slot_change	slot_change;
 	struct ccid_rdr_to_pc_hardware_error		hw_error;
 };
+
+
+extern const struct value_string ccid_msg_type_vals[];
+extern const struct value_string ccid_class_spec_req_vals[];
+extern const struct value_string ccid_power_select_vals[];
+extern const struct value_string ccid_clock_command_vals[];
+extern const struct value_string ccid_error_code_vals[];
+

-- 
To view, visit https://gerrit.osmocom.org/14052
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ccid-firmware
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Idc6b3d2f0a22db3a57f0c05d96c776e92b718b07
Gerrit-Change-Number: 14052
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190515/122cc35d/attachment.htm>


More information about the gerrit-log mailing list